@iframe-resizer/child 5.4.7-beta.2 → 5.4.7-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.4.7-beta.2 (umd) - 2025-06-16
4
+ * @module iframe-resizer/child 5.4.7-beta.4 (umd) - 2025-06-30
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
- !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="font-weight: normal;",t="font-weight: bold;",n="font-style: italic;",o=e+n,r="default",i=Object.freeze({assert:!0,error:!0,warn:!0}),a={expand:!0,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},s={profile:0,profileEnd:0,timeStamp:0,trace:0},l=Object.assign(console);const{fromEntries:c,keys:d}=Object,u=e=>[e,l[e]],f=e=>t=>[t,function(n){e[t]=n}],m=(e,t)=>c(d(e).map(t));const p=!(typeof window>"u"||"function"!=typeof window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches,g=p?"color: #A9C7FB;":"color: #135CD2;",h=p?"color: #E3E3E3;":"color: #1F1F1F;",y="5.4.7-beta.2",v=10,b="data-iframe-size",z="data-iframe-overflowed",w="data-iframe-ignore",$="bottom",S="right",O="autoResizeEnabled",M=Symbol("sizeChanged"),E="manualResize",k="parentResize",j={[E]:1,[k]:1},T="setOffsetSize",I="resizeObserver",A="overflowObserver",P="mutationObserver",C="No change in content size detected",x="init",R=(e,t,n,o)=>e.addEventListener(t,n,o||!1),N=["<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 q=e=>(e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(N[e]),B=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},L=e=>e,F=e=>Math.round(1e3*e)/1e3,W=e=>e.charAt(0).toUpperCase()+e.slice(1),D=e=>""!=`${e}`&&void 0!==e;function H(e){switch(!0){case!D(e):return"";case D(e.id):return`${e.nodeName}#${e.id}`;case D(e.name):return`${e.nodeName} (${e.name}`;case D(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const U=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${W(t)}`)};let V=!0;const Z=(J=function(n={}){const c={},d={},p=[],g={...a,expand:!n.collapsed||a.expanded,...n};let h="";function y(){p.length=0,h=""}function v(){delete g.event,y()}const b=()=>!!p.some((([e])=>e in i))||!!g.expand;function z(){if(0!==p.length){l[b()?"group":"groupCollapsed"](`%c${g.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(g)} %c${g.showTime?h:""}`,e,t,o);for(const[e,...t]of p)l.assert(e in l,`Unknown console method: ${e}`),e in l&&l[e](...t);l.groupEnd(),v()}else v()}function w(){""===h&&(h=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}())}function $(e,...t){0===p.length&&(w(),queueMicrotask((()=>queueMicrotask(z)))),p.push([e,...t])}function S(e=r,...t){c[e]?$("log",`${e}: ${performance.now()-c[e]} ms`,...t):$("timeLog",e,...t)}return{...m(g,f(g)),...m(console,(e=>[e,(...t)=>$(e,...t)])),...m(s,u),assert:function(e,...t){e||$("assert",e,...t)},count:function(e=r){d[e]?d[e]+=1:d[e]=1,$("log",`${e}: ${d[e]}`)},countReset:function(e=r){delete d[e]},endAutoGroup:z,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){if(!Error.prototype.isPrototypeOf(e))throw e;$("error",e)}return n},event:function(e){w(),g.event=e},purge:y,time:function(e=r){w(),c[e]=performance.now()},timeEnd:function(e=r){S(e),delete c[e]},timeLog:S,touch:w}},J?.__esModule?J.default:J);var J;const _=Z({label:"iframeResizer(child)"});const Q=(G="log",(...e)=>!V||_[G](...e));var G;const X=Q,{assert:Y,debug:K,endAutoGroup:ee,error:te,errorBoundary:ne,event:oe,label:re,purge:ie,warn:ae}=_,se=e=>{return _.warn((t=L,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},le=se,ce=(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)=>se(t))),de=ce("Method"),ue=ce("Method","replaced with"),fe=ce("Option"),me=e=>t=>void 0===t?void 0:e(t),pe=me((e=>"true"===e)),ge=me(Number),he="--ifr-start",ye="--ifr-end",ve=[],be=new WeakSet,ze=e=>"object"==typeof e&&be.add(e);let we={},$e=0;const Se=setInterval((()=>{if(ve.length<10)return;if(we.hasTags&&we.len<25)return;ve.sort();const e=Math.min(ve.reduce(((e,t)=>e+t),0)/ve.length,ve[Math.floor(ve.length/2)]),t=F(e);t>$e&&($e=t,oe("performanceObserver"),Q("Mean time:",F(ve[Math.floor(ve.length/2)])),Q("Median time:",F(ve.reduce(((e,t)=>e+t),0)/ve.length)),Q("Average time:",t),Q("Max time:",F(Math.max(...ve)))),e<=4||(clearInterval(Se),se(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${F(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${we.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function Oe(e){e.getEntries().forEach((e=>{if(e.name===ye){const{duration:t}=performance.measure("--ifr-measure",he,ye);we=e.detail,ve.push(t),ve.length>100&&ve.shift()}}))}function Me(){new PerformanceObserver(Oe).observe({entryTypes:["mark"]}),ze(document.documentElement),ze(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",Me):Me());const Ee=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},ke=Ee("function"),je=Ee("number"),Te=Ee("string");"undefined"!=typeof window&&function(){const o={height:()=>(ae("Custom height calculation function not defined"),St.auto()),width:()=>(ae("Custom width calculation function not defined"),Ot.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},i={},a="auto",s="[iFrameSizer]",l="scroll";let c,d,u,f,m,p,N,D=!0,Z="",J=0,G="",te="",ie=!0,ce=!1,me=!0,ve=!1,be=!1,ze=!1,we=1,$e=a,Se="",Oe=!0,Me={},Ee=!0,Ie=!1,Ae="",Pe=0,Ce=!1,xe="",Re=L,Ne=[],qe="child",Be=null,Le=!1,Fe="",We=[],De=window.parent,He="*",Ue=0,Ve=!1,Ze=1,Je=l,_e=window,Qe=()=>{ae("onMessage function not defined")},Ge=()=>{},Xe=null,Ye=null;function Ke(e){var t,n,r;!function(e){xe=e[0]??xe,J=ge(e[1])??J,ce=pe(e[2])??ce,Ie=pe(e[3])??Ie,D=pe(e[6])??D,G=e[7]??G,$e=e[8]??$e,Z=e[9]??Z,te=e[10]??te,Ue=ge(e[11])??Ue,Me.enable=pe(e[12])??!1,qe=e[13]??qe,Je=e[14]??Je,Ce=pe(e[15])??Ce,c=ge(e[16])??c,d=ge(e[17])??d,ie=pe(e[18])??ie,Ae=e[19]??Ae,p=e[20]??p,Pe=ge(e[21])??Pe,Ee=pe(e[23])??Ee}(e),t={id:xe,enabled:Ie,expand:Ee},_.label(`${t.id}`),_.expand(t.expand),V=t.enabled,Q(`Initialising iframe v${y} ${window.location.href}`),function(){function e(e){Q("Reading data from page:",e),N=ke(e,"onBeforeResize")??N,Qe=ke(e,"onMessage")??Qe,Ge=ke(e,"onReady")??Ge,"number"==typeof e?.offset&&(fe("offset","offsetSize"),ie&&(c=je(e,"offset")??c),ce&&(d=je(e,"offset")??d)),"number"==typeof e?.offsetSize&&(ie&&(c=je(e,"offsetSize")??c),ce&&(d=je(e,"offsetSize")??d)),Se=Te(e,"ignoreSelector")??Se,Fe=Te(e,"sizeSelector")??Fe,He=Te(e,"targetOrigin")??He,$e=e?.heightCalculationMethod||$e,Je=e?.widthCalculationMethod||Je}function t(e,t){return"function"==typeof e&&(se(`<rb>Deprecated Option(${t}CalculationMethod)</>\n\nThe use of <b>${t}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),o[t]=e,e="custom"),e}if(1===Pe)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),$e=t($e,"height"),Je=t(Je,"width"),X(`Set targetOrigin for parent: %c${He}`,g))}(),lt(),function(){try{Le=1===Pe||"iframeParentListener"in window.parent}catch(e){Q("Cross domain iframe detected")}}(),Pe<0?le(`${q(Pe+2)}${q(2)}`):p?.codePointAt(0)>4||Pe<2&&le(q(3)),p&&""!==p&&"false"!==p?p!==y&&se(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${p} - Child page: ${y}.\n`):se("<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"),ut(),ft(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(b,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&se("<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&&se("<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"),nt(),1!==Pe&&(_e.parentIframe=Object.freeze({autoResize:e=>(U(e,"boolean","parentIframe.autoResize(enable) enable"),!1===ce&&!1===ie?(oe(O),se("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===D?(D=!0,queueMicrotask((()=>Tt(O,"Auto Resize enabled")))):!1===e&&!0===D&&(D=!1),At(0,0,"autoResize",JSON.stringify(D)),D)),close(){At(0,0,"close")},getId:()=>xe,getOrigin:()=>(de("getOrigin()","getParentOrigin()"),u),getParentOrigin:()=>u,getPageInfo(e){if("function"==typeof e)return Xe=e,At(0,0,"pageInfo"),void ue("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Xe=null,At(0,0,"pageInfoStop")},getParentProps:e=>(U(e,"function","parentIframe.getParentProps(callback) callback"),Ye=e,At(0,0,"parentInfo"),()=>{Ye=null,At(0,0,"parentInfoStop")}),getParentProperties(e){de("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){U(e,"string","parentIframe.moveToAnchor(anchor) anchor"),Me.findTarget(e)},reset(){!function(){const e=$e;$e=a,Q("Reset trigger event: %cparentIframe.reset",g),Ve?Q("TriggerLock blocked calculation"):(Ve=!0,K("Trigger event lock on"),requestAnimationFrame((()=>{Ve=!1,K("Trigger event lock off")}))),It("reset"),$e=e}()},setOffsetSize(e){U(e,"number","parentIframe.setOffsetSize(offset) offset"),c=e,d=e,Tt(T,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){U(e,"number","parentIframe.scrollBy(x, y) x"),U(t,"number","parentIframe.scrollBy(x, y) y"),At(t,e,"scrollBy")},scrollTo(e,t){U(e,"number","parentIframe.scrollTo(x, y) x"),U(t,"number","parentIframe.scrollTo(x, y) y"),At(t,e,"scrollTo")},scrollToOffset(e,t){U(e,"number","parentIframe.scrollToOffset(x, y) x"),U(t,"number","parentIframe.scrollToOffset(x, y) y"),At(t,e,"scrollToOffset")},sendMessage(e,t){t&&U(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),At(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){$e=e,ut()},setWidthCalculationMethod(e){Je=e,ft()},setTargetOrigin(e){U(e,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),Q(`Set targetOrigin: %c${e}`,g),He=e},resize(e,t){e&&U(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&U(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),Tt(E,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){de("size()","resize()"),this.resize(e,t)}}),_e.parentIFrame=_e.parentIframe),function(){function e(e){At(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){Q(`Add event listener: %c${n}`,g),R(window.document,t,e)}!0===Ce&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Me=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,v)+parseInt(o.x,v),y:parseInt(n.top,v)+parseInt(o.y,v)}}function n(e){function n(e){const n=t(e);Q(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,g,h,g,h,g),At(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,r=decodeURIComponent(o),i=document.getElementById(r)||document.getElementsByName(r)[0];void 0===i?(Q(`In page link (#${o}) not found in iFrame, so sending to parent`),At(0,0,"inPageLink",`#${o}`)):n(i)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&R(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function i(){R(window,"hashchange",o)}function a(){setTimeout(o,128)}function s(){Q("Setting up location.hash handlers"),r(),i(),a()}return Me.enable?1===Pe?se("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):s():Q("In page linking not enabled"),{findTarget:n}}(),void 0===G&&(G=`${J}px`),at("margin",(n="margin",(r=G).includes("-")&&(ae(`Negative CSS value ignored for ${n}`),r=""),r)),at("background",Z),at("padding",te),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),Q("Set HTML & body height: %cauto !important",g)}(),!0!==D&&Q("Auto Resize disabled"),function(e){ct({method:e,eventType:"After Print",eventName:"afterprint"}),ct({method:e,eventType:"Before Print",eventName:"beforeprint"}),ct({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=new Set,t=[];let n=!1,o=0;const r=t=>{X("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)}},i=16,a=2,s=200;let l=1;function c(e){lt(),ot(e),e.forEach(gt),e.clear()}function d(){const u=performance.now(),f=u-o,m=i*l+++a;if(f>m&&f<s)return X("Backed off due to heavy workload on callStack"),Q(`Delay: %c${F(f)}ms %c> Delay limit: %c${m}ms`,g,h,g),setTimeout(d,i*l),void(o=u);l=1,t.forEach(r),t.length=0,e.size>0&&c(e),nt(),et(),n=!1,Tt(P,"Mutation Observed")}function u(e){t.push(e),n||(o=performance.now(),n=!0,requestAnimationFrame(d))}function f(){const e=new window.MutationObserver(u),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[w,b],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return Q("Setup <body> MutationObserver"),e.observe(t,n),e}f()}(),Q("Setup ResizeObserver"),Be=new ResizeObserver(mt),Be.observe(document.body),pt.add(document.body),gt(document.body),ie!==ce&&(Q("Setup OverflowObserver"),Re=(e=>{const t=e.side||$,n=e.onChange||L,o={root:e.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||L,i=(e=!1)=>n(e),a=(e,n)=>0===e||e>n[t],s=(e,t)=>e.toggleAttribute(z,t),l=new IntersectionObserver((function(e){for(const o of e){const{boundingClientRect:e,rootBounds:r,target:i}=o,l=e[t],c=a(l,r)&&!((n=i).hidden||null===n.offsetParent||"none"===n.style.display);s(i,c)}var n;r(i)}),o),c=new WeakSet;return function(e){Q("Attached overflowObservers");for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=c.has(t);!n&&e?(l.observe(t),c.add(t)):Y(!n,"Node already observed",t)}}})({onChange:tt,root:document.documentElement,side:ie?$:S})),ot(vt(document)()),"complete"===document.readyState?queueMicrotask(Ge):R(document,"readystatechange",(()=>{"complete"===document.readyState&&setTimeout(Ge)})),Q("Initialization complete"),Tt(x,"Init message from host page",void 0,void 0,y),document.title&&""!==document.title&&At(0,0,"title",document.title)}function et(){const e=document.querySelectorAll(`[${z}]`);Ne=Array.from(e).filter((e=>!e.closest(`[${w}]`))),be=Ne.length>0}function tt(e){et(),(be||e)&&(be?X("Overflowed Elements:",...Ne):X("Overflow removed"),Tt(A,"Overflow updated"))}function nt(){We=document.querySelectorAll(`[${b}]`),ze=We.length>0,Q(`Tagged elements found: %c${ze}`,g)}function ot(e){ze||Re(e)}let rt=0;function it(){const n=document.querySelectorAll(`*[${w}]`);ve=n.length>0,ve&&n.length!==rt&&(function(n){const o=1===n.length?"":"s";ae(`%c[${w}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),rt=n.length)}function at(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),X(`Set body ${e}: %c${t}`,g))}function st(e,t,n){if(""!==n){Q(`${e}: %c${n}`,g);for(const e of document.querySelectorAll(n))Q(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function lt(){st("sizeSelector",b,Fe),st("ignoreSelector",w,Se)}function ct(e){({add(t){function n(){Tt(e.eventName,e.eventType)}i[t]=n,R(window,t,n,{passive:!0})},remove(e){const t=i[e];var n,o;delete i[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),Q(`${W(e.method)} event listener: %c${e.eventType}`,g)}function dt(e,t,n,o){return t!==e&&(e in n||(ae(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r)&&se(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you ${p?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),Q(`Set ${o} calculation method: %c${e}`,g),e}function ut(){$e=dt($e,a,St,"height")}function ft(){Je=dt(Je,l,Ot,"width")}function mt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Tt(I,`Element resized <${H(t)}>`)}const pt=new WeakSet;function gt(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!pt.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Be.observe(e),pt.add(e),Q(`Attached resizeObserver: %c${H(e)}`,g))}const t=vt(e)();for(const e of t){if(pt.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Be.observe(e),pt.add(e),Q(`Attached resizeObserver: %c${H(e)}`,g))}}function ht(e){performance.mark(he);const t=W(e);let n=0,o=document.documentElement,r=ze?0:document.documentElement.getBoundingClientRect().bottom;const i=ze?We:be?Ne:vt(document)();for(const t of i)n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t);return X(`${t} position calculated from:`,o),performance.mark(ye,{detail:{hasTags:ze,len:i.length,logging:Ie,Side:t}}),r}const yt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],vt=e=>()=>{it();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 ve&&t.push(`not([${w}])`,`not([${w}] *)`),e.querySelectorAll(t.join(":"))},bt={height:0,width:0},zt={height:0,width:0},wt=[g,h,g];function $t(e){function t(){return zt[o]=r,bt[o]=s,r}const n=e===St,o=n?"height":"width",r=e.boundingClientRect(),i=Math.ceil(r),a=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${r}px %cPage: %c${s}px`;let c=0;switch(!0){case!e.enabled():return s;case ze:X("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!be&&0===zt[o]&&0===bt[o]:X(`Initial page size values: ${l}`,...wt),c=t();break;case Ve&&r===zt[o]&&s===bt[o]:X(`Size unchanged: ${l}`,...wt),c=Math.max(r,s);break;case 0===r:X(`Page is hidden: ${l}`,...wt),c=s;break;case!be&&r!==zt[o]&&s<=bt[o]:X(`New <html> size: ${l} `,...wt),X(`Previous <html> size: %c${zt[o]}px`,g),c=t();break;case!n:c=e.taggedElement();break;case!be&&r<zt[o]:X(`<html> size decreased: ${l}`,...wt),c=t();break;case s===a||s===i:X(`<html> size equals page size: ${l}`,...wt),c=t();break;case r>s:X(`Page size < <html> size: ${l}`,...wt),c=t();break;case be:X("Found element overflowing <html> "),c=e.taggedElement();break;default:X(`Using <html> size: ${l}`,...wt),c=t()}return X(`Content ${o}: %c${c}px`,g),c+=function(e){const t=e.getOffset();return 0!==t&&X(`Page offsetSize: %c${t}px`,g),t}(e),c}const St={enabled:()=>ie,getOffset:()=>c,auto:()=>$t(St),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,v)+parseInt(t.marginBottom,v)},bodyScroll:()=>document.body.scrollHeight,offset:()=>St.bodyOffset(),custom:()=>o.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...yt(St)),min:()=>Math.min(...yt(St)),grow:()=>St.max(),lowestElement:()=>ht($),taggedElement:()=>ht($)},Ot={enabled:()=>ce,getOffset:()=>d,auto:()=>$t(Ot),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>o.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...yt(Ot)),min:()=>Math.min(...yt(Ot)),rightMostElement:()=>ht(S),scroll:()=>Math.max(Ot.bodyScroll(),Ot.documentElementScroll()),taggedElement:()=>ht(S)},Mt=(e,t)=>!(Math.abs(e-t)<=Ue);function Et(e,t){const n=e[t]();return e.enabled()&&void 0!==N?function(e){const t=N(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 kt=!1;const jt=B((()=>le(q(4)))),Tt=ne(((e,t,n,o,r)=>{if(m=performance.now(),f=!0,oe(e),!0!==kt)return D||e in j?void(document.hidden?Q("Page hidden - Ignored resize request"):(kt=!0,requestAnimationFrame((()=>{kt=!1})),function(e,t,n,o,r){const i=n??Et(St,$e),a=o??Et(Ot,Je),s=ie&&Mt(we,i)||ce&&Mt(Ze,a)?M:e;switch(Q(`Resize event: %c${t}`,g),s){case x:case O:case M:we=i,Ze=a;case T:At(we,Ze,e,r);break;case I:case A:case P:Q(C);break;default:X(C)}f=!1}(e,t,n,o,r))):(X("Resizing disabled"),void ee())}));function It(e){we=St[$e](),Ze=Ot[Je](),At(we,Ze,e)}const At=ne((function(e,t,o,r,i){Pe<-1||(oe(o),void 0!==i?Q(`Message targetOrigin: %c${i}`,g):i=He,function(){const a=`${xe}:${e}:${t}:${o}${void 0===r?"":`:${r}`}`;if(Le)try{window.parent.iframeParentListener(s+a)}catch(e){if(1!==Pe)throw e;return void jt()}else De.postMessage(s+a,i);f&&Q(function(){const e=F(performance.now()-m);return o===x?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),g),X(`Sending message to parent page via ${Le?"sameOrigin":"postMessage"}: %c%c${a}`,n,g)}(),ee())})),Pt=ne((function(e){oe("onMessage");const{freeze:t}=Object,{parse:n}=JSON,o=e=>t(n(e)),r=e=>At(0,0,`${e}Stop`),i={init:function(){if("loading"===document.readyState)return void Q("Page not ready, ignoring init message");const t=e.data.slice(13).split(":");De=e.source,u=e.origin,Ke(t),me=!1,setTimeout((()=>{Oe=!1}),128)},reset(){Oe?Q("Page reset ignored by init"):(Q("Page size reset by host page"),It("resetPage"))},resize(){Q("Resize requested by host page"),Tt(k,"Parent window requested size check")},moveToAnchor(){Me.findTarget(l())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=l();Q("PageInfo received from parent:",o(e)),Xe?setTimeout((()=>Xe(n(e)))):r("pageInfo")},parentInfo(){const e=o(l());Q("ParentInfo received from parent:",e),Ye?setTimeout((()=>Ye(e))):r("parentInfo")},message(){const e=l();Q("onMessage called from parent:%c",g,o(e)),setTimeout((()=>Qe(n(e))))}},a=()=>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 d(){const t=a();oe(t),t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||c()||ae(`Unexpected message (${e.data})`)}s===`${e.data}`.slice(0,13)&&function(){if(!1!==me)return c()?(re(a()),oe(x),void i.init()):void Q(`Ignored message of type "${a()}". Received before initialization.`);d()}()}));function Ct(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?ae("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Pt({data:e,sameOrigin:!0}))),R(window,"message",Pt),R(window,"readystatechange",Ct),Ct())}()}));
20
+ !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="font-weight: normal;",t="font-weight: bold;",n="font-style: italic;",o=e+n,r="default",i=Object.freeze({assert:!0,error:!0,warn:!0}),a={expand:!0,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},s={profile:0,profileEnd:0,timeStamp:0,trace:0},l=Object.assign(console);const{fromEntries:c,keys:u}=Object,d=e=>[e,l[e]],f=e=>t=>[t,function(n){e[t]=n}],m=(e,t)=>c(u(e).map(t));const p=!(typeof window>"u"||"function"!=typeof window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches,h=p?"color: #A9C7FB;":"color: #135CD2;",g=p?"color: #E3E3E3;":"color: #1F1F1F;",y="5.4.7-beta.4",b=10,v="data-iframe-size",z="data-iframe-overflowed",w="data-iframe-ignore",$="bottom",S="right",O="autoResizeEnabled",E=Symbol("sizeChanged"),M="manualResize",k="parentResize",j={[M]:1,[k]:1},T="setOffsetSize",I="resizeObserver",C="overflowObserver",x="mutationObserver",A="none",P="No change in content size detected",R="init",N=(e,t,n,o)=>e.addEventListener(t,n,o||!1),q=["<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 B=e=>(e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(q[e]),L=(e,...t)=>setTimeout((()=>e(...t)),0),F=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},W=e=>e,D=e=>Math.round(1e3*e)/1e3,H=e=>e.charAt(0).toUpperCase()+e.slice(1),U=e=>""!=`${e}`&&void 0!==e;function V(e){switch(!0){case!U(e):return"";case U(e.id):return`${e.nodeName}#${e.id}`;case U(e.name):return`${e.nodeName} (${e.name}`;case U(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const Z=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${H(t)}`)};let J=!0;const _=(Q=function(n={}){const c={},u={},p=[],h={...a,expand:!n.collapsed||a.expanded,...n};let g="";function y(){p.length=0,g=""}function b(){delete h.event,y()}const v=()=>!!p.some((([e])=>e in i))||!!h.expand;function z(){if(0!==p.length){l[v()?"group":"groupCollapsed"](`%c${h.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(h)} %c${h.showTime?g:""}`,e,t,o);for(const[e,...t]of p)l.assert(e in l,`Unknown console method: ${e}`),e in l&&l[e](...t);l.groupEnd(),b()}else b()}function w(){""===g&&(g=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}())}function $(e,...t){0===p.length&&(w(),queueMicrotask((()=>queueMicrotask(z)))),p.push([e,...t])}function S(e=r,...t){c[e]?$("log",`${e}: ${performance.now()-c[e]} ms`,...t):$("timeLog",e,...t)}return{...m(h,f(h)),...m(console,(e=>[e,(...t)=>$(e,...t)])),...m(s,d),assert:function(e,...t){e||$("assert",e,...t)},count:function(e=r){u[e]?u[e]+=1:u[e]=1,$("log",`${e}: ${u[e]}`)},countReset:function(e=r){delete u[e]},endAutoGroup:z,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){if(!Error.prototype.isPrototypeOf(e))throw e;$("error",e)}return n},event:function(e){w(),h.event=e},purge:y,time:function(e=r){w(),c[e]=performance.now()},timeEnd:function(e=r){S(e),delete c[e]},timeLog:S,touch:w}},Q?.__esModule?Q.default:Q);var Q;const G=_({label:"iframeResizer(child)"});const Y=(X="log",(...e)=>!J||G[X](...e));var X;const K=Y,{assert:ee,debug:te,endAutoGroup:ne,error:oe,errorBoundary:re,event:ie,label:ae,purge:se,warn:le}=G,ce=e=>{return G.warn((t=W,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},ue=ce,de=(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)=>ce(t))),fe=de("Method"),me=de("Method","replaced with"),pe=de("Option"),he=["min-height","min-width","max-height","max-width"],ge=new Set,ye=e=>e.tagName?e.tagName.toLowerCase():"unknown",be=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),ve=(e,t)=>{return(n=be(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function ze({href:e}){ge.has(e)||(Y("Unable to access stylesheet:",e),ge.add(e))}const we=(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){ze(n)}return{source:"cross-origin stylesheet",value:be(e,t)}}(e,t),$e=(e,t)=>{const{source:n,value:o}=we(e,t),r=ye(e);ce(`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 Se(){for(const e of[document.documentElement,document.body])for(const t of he)Y(`Checking <${ye(e)}> for blocking CSS: ${t}`),ve(e,t)&&$e(e,t)}const Oe=e=>t=>void 0===t?void 0:e(t),Ee=Oe((e=>"true"===e)),Me=Oe(Number),ke="--ifr-start",je="--ifr-end",Te=[],Ie=new WeakSet,Ce=e=>"object"==typeof e&&Ie.add(e);let xe={},Ae=0;const Pe=setInterval((()=>{if(Te.length<10)return;if(xe.hasTags&&xe.len<25)return;Te.sort();const e=Math.min(Te.reduce(((e,t)=>e+t),0)/Te.length,Te[Math.floor(Te.length/2)]),t=D(e);t>Ae&&(Ae=t,ie("performanceObserver"),Y("Mean time:",D(Te[Math.floor(Te.length/2)])),Y("Median time:",D(Te.reduce(((e,t)=>e+t),0)/Te.length)),Y("Average time:",t),Y("Max time:",D(Math.max(...Te)))),e<=4||(clearInterval(Pe),ce(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${D(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${xe.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function Re(e){e.getEntries().forEach((e=>{if(e.name===je){const{duration:t}=performance.measure("--ifr-measure",ke,je);xe=e.detail,Te.push(t),Te.length>100&&Te.shift()}}))}function Ne(){new PerformanceObserver(Re).observe({entryTypes:["mark"]}),Ce(document.documentElement),Ce(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",Ne):Ne());const qe=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Be=qe("function"),Le=qe("number"),Fe=qe("string");"undefined"!=typeof window&&function(){const o={height:()=>(le("Custom height calculation function not defined"),jt.auto()),width:()=>(le("Custom width calculation function not defined"),Tt.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},i={},a="auto",s="[iFrameSizer]",l="scroll";let c,u,d,f,m,p,q,U=!0,_="",Q=0,X="",oe="",se=!1,de=!0,he=!1,ge=!0,ye=!1,be=!1,ve=!1,ze=1,we=a,$e="",Oe=!0,Te={},Ie=!0,Ce=!1,xe="",Ae=0,Pe=!1,Re="",Ne=W,qe=[],We="child",De=null,He=!1,Ue="",Ve=[],Ze=window.parent,Je="*",_e=0,Qe=!1,Ge=1,Ye=l,Xe=window,Ke=()=>{le("onMessage function not defined")},et=()=>{},tt=null,nt=null;function ot(e){var t,n,r;!function(e){Re=e[0]??Re,Q=Me(e[1])??Q,he=Ee(e[2])??he,Ce=Ee(e[3])??Ce,U=Ee(e[6])??U,X=e[7]??X,we=e[8]??we,_=e[9]??_,oe=e[10]??oe,_e=Me(e[11])??_e,Te.enable=Ee(e[12])??!1,We=e[13]??We,Ye=e[14]??Ye,Pe=Ee(e[15])??Pe,c=Me(e[16])??c,u=Me(e[17])??u,de=Ee(e[18])??de,xe=e[19]??xe,p=e[20]??p,Ae=Me(e[21])??Ae,Ie=Ee(e[23])??Ie}(e),t={id:Re,enabled:Ce,expand:Ie},G.label(`${t.id}`),G.expand(t.expand),J=t.enabled,Y(`Initialising iframe v${y} ${window.location.href}`),function(){function e(e){Y("Reading data from page:",e),q=Be(e,"onBeforeResize")??q,Ke=Be(e,"onMessage")??Ke,et=Be(e,"onReady")??et,"number"==typeof e?.offset&&(pe("offset","offsetSize"),de&&(c=Le(e,"offset")??c),he&&(u=Le(e,"offset")??u)),"number"==typeof e?.offsetSize&&(de&&(c=Le(e,"offsetSize")??c),he&&(u=Le(e,"offsetSize")??u)),$e=Fe(e,"ignoreSelector")??$e,Ue=Fe(e,"sizeSelector")??Ue,Je=Fe(e,"targetOrigin")??Je,we=e?.heightCalculationMethod||we,Ye=e?.widthCalculationMethod||Ye}function t(e,t){return"function"==typeof e&&(ce(`<rb>Deprecated Option(${t}CalculationMethod)</>\n\nThe use of <b>${t}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),o[t]=e,e="custom"),e}if(1===Ae)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),we=t(we,"height"),Ye=t(Ye,"width"),K(`Set targetOrigin for parent: %c${Je}`,h))}(),mt(),function(){try{He=1===Ae||"iframeParentListener"in window.parent}catch(e){Y("Cross domain iframe detected")}}(),he===de&&(se=!0),Ae<0?ue(`${B(Ae+2)}${B(2)}`):p?.codePointAt(0)>4||Ae<2&&ue(B(3)),p&&""!==p&&"false"!==p?p!==y&&ce(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${p} - Child page: ${y}.\n`):ce("<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"),gt(),yt(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(v,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&ce("<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&&ce("<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"),st(),se||Se(),1!==Ae&&(Xe.parentIframe=Object.freeze({autoResize:e=>(Z(e,"boolean","parentIframe.autoResize(enable) enable"),!1===he&&!1===de?(ie(O),ce(`Auto Resize can not be changed when <b>direction</> is set to '${A}'.`),!1):(!0===e&&!1===U?(U=!0,queueMicrotask((()=>Pt(O,"Auto Resize enabled")))):!1===e&&!0===U&&(U=!1),Nt(0,0,"autoResize",JSON.stringify(U)),U)),close(){Nt(0,0,"close")},getId:()=>Re,getOrigin:()=>(fe("getOrigin()","getParentOrigin()"),d),getParentOrigin:()=>d,getPageInfo(e){if("function"==typeof e)return tt=e,Nt(0,0,"pageInfo"),void me("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");tt=null,Nt(0,0,"pageInfoStop")},getParentProps:e=>(Z(e,"function","parentIframe.getParentProps(callback) callback"),nt=e,Nt(0,0,"parentInfo"),()=>{nt=null,Nt(0,0,"parentInfoStop")}),getParentProperties(e){fe("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){Z(e,"string","parentIframe.moveToAnchor(anchor) anchor"),Te.findTarget(e)},reset(){!function(){const e=we;we=a,Y("Reset trigger event: %cparentIframe.reset",h),Qe?Y("TriggerLock blocked calculation"):(Qe=!0,te("Trigger event lock on"),requestAnimationFrame((()=>{Qe=!1,te("Trigger event lock off")}))),Rt("reset"),we=e}()},setOffsetSize(e){Z(e,"number","parentIframe.setOffsetSize(offset) offset"),c=e,u=e,Pt(T,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){Z(e,"number","parentIframe.scrollBy(x, y) x"),Z(t,"number","parentIframe.scrollBy(x, y) y"),Nt(t,e,"scrollBy")},scrollTo(e,t){Z(e,"number","parentIframe.scrollTo(x, y) x"),Z(t,"number","parentIframe.scrollTo(x, y) y"),Nt(t,e,"scrollTo")},scrollToOffset(e,t){Z(e,"number","parentIframe.scrollToOffset(x, y) x"),Z(t,"number","parentIframe.scrollToOffset(x, y) y"),Nt(t,e,"scrollToOffset")},sendMessage(e,t){t&&Z(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Nt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){we=e,gt()},setWidthCalculationMethod(e){Ye=e,yt()},setTargetOrigin(e){Z(e,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),Y(`Set targetOrigin: %c${e}`,h),Je=e},resize(e,t){e&&Z(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&Z(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),Pt(M,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){fe("size()","resize()"),this.resize(e,t)}}),Xe.parentIFrame=Xe.parentIframe),function(){function e(e){Nt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){Y(`Add event listener: %c${n}`,h),N(window.document,t,e)}!0===Pe&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Te=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,b)+parseInt(o.x,b),y:parseInt(n.top,b)+parseInt(o.y,b)}}function n(e){function n(e){const n=t(e);Y(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,h,g,h,g,h),Nt(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,r=decodeURIComponent(o),i=document.getElementById(r)||document.getElementsByName(r)[0];void 0===i?(Y(`In page link (#${o}) not found in iFrame, so sending to parent`),Nt(0,0,"inPageLink",`#${o}`)):n(i)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&N(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function i(){N(window,"hashchange",o)}function a(){setTimeout(o,128)}function s(){Y("Setting up location.hash handlers"),r(),i(),a()}return Te.enable?1===Ae?ce("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):s():Y("In page linking not enabled"),{findTarget:n}}(),void 0===X&&(X=`${Q}px`),dt("margin",(n="margin",(r=X).includes("-")&&(le(`Negative CSS value ignored for ${n}`),r=""),r)),dt("background",_),dt("padding",oe),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),se||function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),Y("Set HTML & body height: %cauto !important",h)}(),!0!==U&&Y("Auto Resize disabled"),function(e){pt({method:e,eventType:"After Print",eventName:"afterprint"}),pt({method:e,eventType:"Before Print",eventName:"beforeprint"}),pt({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=new Set,t=[];let n=!1,o=0;const r=t=>{K("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)}},i=16,a=2,s=200;let l=1;function c(e){mt(),lt(e),e.forEach(zt),e.clear()}function u(){const d=performance.now(),f=d-o,m=i*l+++a;if(f>m&&f<s)return K("Backed off due to heavy workload on callStack"),Y(`Delay: %c${D(f)}ms %c> Delay limit: %c${m}ms`,h,g,h),setTimeout(u,i*l),void(o=d);l=1,t.forEach(r),t.length=0,e.size>0&&c(e),st(),it(),n=!1,Pt(x,"Mutation Observed")}function d(e){t.push(e),n||(o=performance.now(),n=!0,requestAnimationFrame(u))}function f(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[w,v],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return Y("Setup <body> MutationObserver"),e.observe(t,n),e}f()}(),Y("Setup ResizeObserver"),De=new ResizeObserver(bt),De.observe(document.body),vt.add(document.body),zt(document.body),de!==he&&(Y("Setup OverflowObserver"),Ne=(e=>{const t=e.side||$,n=e.onChange||W,o={root:e.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||W,i=(e=!1)=>n(e),a=(e,n)=>0===e||e>n[t],s=(e,t)=>e.toggleAttribute(z,t),l=new IntersectionObserver((function(e){for(const o of e){const{boundingClientRect:e,rootBounds:r,target:i}=o,l=e[t],c=a(l,r)&&!((n=i).hidden||null===n.offsetParent||"none"===n.style.display);s(i,c)}var n;r(i)}),o),c=new WeakSet;return function(e){Y("Attached overflowObservers");for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=c.has(t);!n&&e?(l.observe(t),c.add(t)):ee(!n,"Node already observed",t)}}})({onChange:at,root:document.documentElement,side:de?$:S})),lt(St(document)()),rt(F(et)),Y("Initialization complete"),Pt(R,"Init message from host page",void 0,void 0,y),document.title&&""!==document.title&&Nt(0,0,"title",document.title)}function rt(e){"complete"===document.readyState?L(e):N(document,"readystatechange",(()=>rt(e)))}function it(){const e=document.querySelectorAll(`[${z}]`);qe=Array.from(e).filter((e=>!e.closest(`[${w}]`))),be=qe.length>0}function at(e){it(),(be||e)&&(be?K("Overflowed Elements:",...qe):K("Overflow removed"),Pt(C,"Overflow updated"))}function st(){Ve=document.querySelectorAll(`[${v}]`),ve=Ve.length>0,Y(`Tagged elements found: %c${ve}`,h)}function lt(e){ve||Ne(e)}let ct=0;function ut(){const n=document.querySelectorAll(`*[${w}]`);ye=n.length>0,ye&&n.length!==ct&&(function(n){const o=1===n.length?"":"s";le(`%c[${w}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),ct=n.length)}function dt(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),K(`Set body ${e}: %c${t}`,h))}function ft(e,t,n){if(""!==n){Y(`${e}: %c${n}`,h);for(const e of document.querySelectorAll(n))Y(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function mt(){ft("sizeSelector",v,Ue),ft("ignoreSelector",w,$e)}function pt(e){({add(t){function n(){Pt(e.eventName,e.eventType)}i[t]=n,N(window,t,n,{passive:!0})},remove(e){const t=i[e];var n,o;delete i[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),Y(`${H(e.method)} event listener: %c${e.eventType}`,h)}function ht(e,t,n,o){return t!==e&&(e in n||(le(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r)&&ce(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you ${p?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),Y(`Set ${o} calculation method: %c${e}`,h),e}function gt(){we=ht(we,a,jt,"height")}function yt(){Ye=ht(Ye,l,Tt,"width")}function bt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Pt(I,`Element resized <${V(t)}>`)}const vt=new WeakSet;function zt(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!vt.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(De.observe(e),vt.add(e),Y(`Attached resizeObserver: %c${V(e)}`,h))}const t=St(e)();for(const e of t){if(vt.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(De.observe(e),vt.add(e),Y(`Attached resizeObserver: %c${V(e)}`,h))}}function wt(e){performance.mark(ke);const t=H(e);let n=0,o=document.documentElement,r=ve?0:document.documentElement.getBoundingClientRect().bottom;const i=ve?Ve:be?qe:St(document)();for(const t of i)n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t);return K(`${t} position calculated from:`,o),performance.mark(je,{detail:{hasTags:ve,len:i.length,logging:Ce,Side:t}}),r}const $t=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],St=e=>()=>{ut();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 ye&&t.push(`not([${w}])`,`not([${w}] *)`),e.querySelectorAll(t.join(":"))},Ot={height:0,width:0},Et={height:0,width:0},Mt=[h,g,h];function kt(e){function t(){return Et[o]=r,Ot[o]=s,r}const n=e===jt,o=n?"height":"width",r=e.boundingClientRect(),i=Math.ceil(r),a=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${r}px %cPage: %c${s}px`;let c=0;switch(!0){case!e.enabled():return s;case ve:K("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!be&&0===Et[o]&&0===Ot[o]:K(`Initial page size values: ${l}`,...Mt),c=t();break;case Qe&&r===Et[o]&&s===Ot[o]:K(`Size unchanged: ${l}`,...Mt),c=Math.max(r,s);break;case 0===r:K(`Page is hidden: ${l}`,...Mt),c=s;break;case!be&&r!==Et[o]&&s<=Ot[o]:K(`New <html> size: ${l} `,...Mt),K(`Previous <html> size: %c${Et[o]}px`,h),c=t();break;case!n:c=e.taggedElement();break;case!be&&r<Et[o]:K(`<html> size decreased: ${l}`,...Mt),c=t();break;case s===a||s===i:K(`<html> size equals page size: ${l}`,...Mt),c=t();break;case r>s:K(`Page size < <html> size: ${l}`,...Mt),c=t();break;case be:K("Found element overflowing <html> "),c=e.taggedElement();break;default:K(`Using <html> size: ${l}`,...Mt),c=t()}return K(`Content ${o}: %c${c}px`,h),c+=function(e){const t=e.getOffset();return 0!==t&&K(`Page offsetSize: %c${t}px`,h),t}(e),c}const jt={enabled:()=>de,getOffset:()=>c,auto:()=>kt(jt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,b)+parseInt(t.marginBottom,b)},bodyScroll:()=>document.body.scrollHeight,offset:()=>jt.bodyOffset(),custom:()=>o.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...$t(jt)),min:()=>Math.min(...$t(jt)),grow:()=>jt.max(),lowestElement:()=>wt($),taggedElement:()=>wt($)},Tt={enabled:()=>he,getOffset:()=>u,auto:()=>kt(Tt),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>o.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...$t(Tt)),min:()=>Math.min(...$t(Tt)),rightMostElement:()=>wt(S),scroll:()=>Math.max(Tt.bodyScroll(),Tt.documentElementScroll()),taggedElement:()=>wt(S)},It=(e,t)=>!(Math.abs(e-t)<=_e);function Ct(e,t){const n=e[t]();return e.enabled()&&void 0!==q?function(e){const t=q(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 xt=!1;const At=F((()=>ue(B(4)))),Pt=re(((e,t,n,o,r)=>{if(m=performance.now(),f=!0,ie(e),!0!==xt)return U||e in j?void(document.hidden?Y("Page hidden - Ignored resize request"):(xt=!0,requestAnimationFrame((()=>{xt=!1})),function(e,t,n,o,r){const i=n??Ct(jt,we),a=o??Ct(Tt,Ye),s=de&&It(ze,i)||he&&It(Ge,a)?E:e;switch(Y(`Resize event: %c${t}`,h),s){case R:case O:case E:ze=i,Ge=a;case T:Nt(ze,Ge,e,r);break;case I:case C:case x:Y(P);break;default:K(P)}f=!1}(e,t,n,o,r))):(K("Resizing disabled"),void ne())}));function Rt(e){ze=jt[we](),Ge=Tt[Ye](),Nt(ze,Ge,e)}const Nt=re((function(e,t,o,r,i){Ae<-1||(ie(o),void 0!==i?Y(`Message targetOrigin: %c${i}`,h):i=Je,function(){const a=`${Re}:${e}:${t}:${o}${void 0===r?"":`:${r}`}`;if(He)try{window.parent.iframeParentListener(s+a)}catch(e){if(1!==Ae)throw e;return void At()}else Ze.postMessage(s+a,i);f&&Y(function(){const e=D(performance.now()-m);return o===R?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),h),K(`Sending message to parent page via ${He?"sameOrigin":"postMessage"}: %c%c${a}`,n,h)}(),ne())})),qt=re((function(e){ie("onMessage");const{freeze:t}=Object,{parse:n}=JSON,o=e=>t(n(e)),r=e=>Nt(0,0,`${e}Stop`),i={init:function(){if("loading"===document.readyState)return void Y("Page not ready, ignoring init message");const t=e.data.slice(13).split(":");Ze=e.source,d=e.origin,ot(t),ge=!1,setTimeout((()=>{Oe=!1}),128)},reset(){Oe?Y("Page reset ignored by init"):(Y("Page size reset by host page"),Rt("resetPage"))},resize(){Y("Resize requested by host page"),Pt(k,"Parent window requested size check")},moveToAnchor(){Te.findTarget(l())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=l();Y("PageInfo received from parent:",o(e)),tt?L(tt,n(e)):r("pageInfo")},parentInfo(){const e=o(l());Y("ParentInfo received from parent:",e),nt?L(nt,e):r("parentInfo")},message(){const e=l();Y("onMessage called from parent:%c",h,o(e)),L(Ke,n(e))}},a=()=>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=a();ie(t),t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||c()||le(`Unexpected message (${e.data})`)}s===`${e.data}`.slice(0,13)&&function(){if(!1!==ge)return c()?(ae(a()),ie(R),void i.init()):void Y(`Ignored message of type "${a()}". Received before initialization.`);u()}()}));function Bt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?le("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>qt({data:e,sameOrigin:!0}))),N(window,"message",qt),N(window,"readystatechange",Bt),Bt())}()}));
21
21
  //# sourceMappingURL=index.umd.js.map