@iframe-resizer/child 6.0.0-beta.6 → 6.0.0-beta.8

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 6.0.0-beta.6 (esm) - 2026-04-10
4
+ * @module iframe-resizer/child 6.0.0-beta.8 (esm) - 2026-04-13
5
5
  *
6
6
  * @license GPL-3.0 For use with GPL compliant sites (fully published front & backend source code)
7
7
  * Alternatively for commercial use, you can purchase a license from
@@ -17,5 +17,5 @@
17
17
  */
18
18
 
19
19
 
20
- import{esModuleInterop as e,LABEL as t,createFormatAdvise as n,id as o,deprecate as r,BOLD as i,CHILD_READY_MESSAGE as a,MESSAGE_ID as s,MESSAGE_ID_LENGTH as c,SEPARATOR as d,AUTO as l,NONE as u,IGNORE_ATTR as f,isDef as m,setMode as g,getModeData as h,VERSION as p,getModeLabel as b,isolateUserCode as w,READY_STATE_CHANGE as v,SIZE_ATTR as y,FALSE as $,once as z,checkMode as O,round as S,INIT as k,MOUSE_ENTER as M,MOUSE_LEAVE as E,lower as R,PAGE_HIDE as T,invoke as I,BEFORE_UNLOAD as P,MIN_SIZE as A,HEIGHT as x,IGNORE_TAGS as L,capitalizeFirstLetter as C,HEIGHT_EDGE as N,WIDTH as B,WIDTH_EDGE as H,NO_CHANGE as W,VISIBILITY_OBSERVER as q,RESIZE_OBSERVER as D,MUTATION_OBSERVER as F,OVERFLOW_OBSERVER as V,SET_OFFSET_SIZE as j,PARENT_RESIZE_REQUEST as U,MANUAL_RESIZE_REQUEST as Q,SIZE_CHANGE_DETECTED as J,ENABLE as Y,IGNORE_DISABLE_RESIZE as X,HEIGHT_CALC_MODE_DEFAULT as G,typeAssert as _,BOOLEAN as K,AUTO_RESIZE as Z,STRING as ee,NUMBER as te,FUNCTION as ne,PARENT_INFO as oe,PARENT_INFO_STOP as re,SCROLL_BY as ie,SCROLL_TO as ae,SCROLL_TO_OFFSET as se,MESSAGE as ce,CLOSE as de,NEW_LINE as le,OVERFLOW_ATTR as ue,getElementName as fe,TITLE as me,NULL as ge,EVENT_CANCEL_TIMER as he,IN_PAGE_LINK as pe,OBJECT as be,getKey as we,OFFSET_SIZE as ve,PAGE_INFO as ye,UNDEFINED as $e}from"@iframe-resizer/common";import ze,{NORMAL as Oe,HIGHLIGHT as Se,FOREGROUND as ke,BOLD as Me,ITALIC as Ee}from"auto-console-group";let Re=!0,Te=t;const Ie=e(ze)({label:`${t}(child)`,expand:!1});const Pe=e=>(...t)=>!Re||Ie[e](...t),Ae=Pe("log"),xe=Ae,Le=Pe("debug");const{assert:Ce,endAutoGroup:Ne,error:Be,errorBoundary:He,event:We,label:qe,purge:De,warn:Fe}=Ie,Ve=n(o),je=(...e)=>Ie.warn(...e.map(Ve)),Ue=r((e,t)=>je(t));Ue("Method"),Ue("Method","replaced with"),Ue("Option");const Qe=[];function Je(e,t){Ae(`${e} event listener: %c${t}`,Se)}const Ye=(e,t,n,o)=>{e.removeEventListener(t,n,o),Je("Removed",t)},Xe=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),Qe.push(()=>Ye(e,t,n,o)),Je("Added",t)},Ge={applySelectors:null,firstRun:!0,hasTags:!1,hasOverflow:!1,height:0,isHidden:!1,initLock:!0,inPageLinks:{},origin:void 0,hasOverflowUpdated:!0,overflowedNodeSet:/* @__PURE__ */new Set,sameOrigin:!1,taggedElements:[],target:window?.parent,timerActive:!1,totalTime:0,triggerLocked:!1,width:0,win:window,onPageInfo:null,onParentInfo:null};let _e=!1;function Ke(e){const t=window?.iframeResizer?.targetOrigin||"*",n=Array.isArray(t)?t:[t];for(const o of n)e.postMessage(a,o)}function Ze(){if("loading"===document.readyState||!Ge.firstRun||_e)return;const{parent:e,top:t}=window;We("ready"),Ae("Sending%c ready%c to parent from",Se,ke,window.location.href),Ke(e),e!==t&&Ke(t),_e=!0}const et="iframeResize",tt=["min-height","min-width","max-height","max-width"],nt=/* @__PURE__ */new Set,ot=e=>e.tagName?e.tagName.toLowerCase():"unknown",rt=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),it=(e,t)=>{return!!(n=rt(e,t))&&"0px"!==n&&n!==l&&n!==u;var n};function at({href:e}){nt.has(e)||(Ae("Unable to access stylesheet:",e),nt.add(e))}const st=(e,t)=>function(e,t){const n=e.style.getPropertyValue(t);return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const o of document.styleSheets)try{for(const n of o.cssRules||[]){if(!("selectorText"in n))continue;const r=n;if(!e.matches(r.selectorText))continue;const i=r.style.getPropertyValue(t);if(!i)continue;const{ownerNode:a}=o;return{source:a instanceof Element&&"STYLE"===a.tagName?"an inline <style> block":`stylesheet (${o.href})`,value:i}}}catch(n){at(o)}return{source:"cross-origin stylesheet",value:rt(e,t)}}(e,t),ct=(e,t)=>{const{source:n,value:o}=st(e,t),r=ot(e);je(`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 dt(){for(const e of[document.documentElement,document.body])for(const t of tt)Ae(`Checking <${ot(e)}> for blocking CSS: ${t}`),it(e,t)&&ct(e,t)}const lt={autoResize:!0,bodyBackground:"",bodyMargin:0,bodyMarginStr:"",bodyPadding:"",calculateHeight:!0,calculateWidth:!1,heightCalcMode:l,ignoreSelector:"",inPageLinks:!1,logging:!1,logExpand:!1,mode:0,mouseEvents:!1,offsetHeight:0,offsetWidth:0,parentId:void 0,sizeSelector:"",targetOrigin:"*",tolerance:0,widthCalcMode:l,onBeforeResize:void 0,onMessage:()=>{Fe("onMessage function not defined")},onReady:()=>{}};function ut(){try{Ge.sameOrigin=1===lt.mode||"iframeParentListener"in window.parent}catch(e){Ae("Cross domain iframe detected")}}let ft=0;function mt(){const e=document.querySelectorAll(`*[${f}]`),t=e.length>0;return t&&e.length!==ft&&(!function(e){const t=1===e.length?"":"s";Fe(`%c[${f}]%c found on %c${e.length}%c element${t}`,Me,Oe,Me,Oe)}(e),ft=e.length),t}function gt(e,t,n){(!m(n)||t>-1&&e>t)&&(function(e,t){console.info(`%ciframe-resizer ${e}`,Re||t<1?i:Oe)}(`v${p} (${b(e)})`,e),0===e&&((...e)=>{console.warn(...e.map(Ve))})(h(3)))}function ht(){"BackCompat"===document.compatMode&&je("<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")}let pt=!1;function bt(e){"complete"===document.readyState?w(e):pt||Xe(document,v,()=>bt(e)),pt=!0}const wt=()=>{xe(`Set targetOrigin for parent: %c${lt.targetOrigin}`,Se),!0!==lt.autoResize&&Ae("Auto Resize disabled")};function vt(){Ge.taggedElements=document.querySelectorAll(`[${y}]`),Ge.hasTags=Ge.taggedElements.length>0,Ae(`Tagged elements found: %c${Ge.hasTags}`,Se)}function yt({version:e}){e&&""!==e&&e!==$?e!==p&&je((e=>`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${e} - Child page: ${p}.\n`)(e)):je("<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")}const $t=z(()=>je(h(4)));function zt(e,t){const{mode:n}=lt,{sameOrigin:o,target:r}=Ge;if(o)try{window.parent.iframeParentListener(s+e)}catch(i){if(!O(n))throw new Error(i);return $t(),!1}else{Ce(r,"Internal error: postMessage target is undefined");const n=function(e){return void 0===e?e=lt.targetOrigin:Ae(`Message targetOrigin: %c${e}`,Se),e}(t),o=Array.isArray(n)?n:[n];for(const t of o)r.postMessage(s+e,t)}return!0}function Ot(e,t,n,o,r){const{parentId:i}=lt,{sameOrigin:a}=Ge,s=`${i}:${`${e}:${t}`}:${n}${void 0===o?"":`:${o}`}`;if(lt.mode<-1)return;zt(s,r)&&(!function(e){if(!Ge.timerActive)return;const t=S(performance.now()-Ge.totalTime);Ae(e===k?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`,Se)}(n),xe(`Sending message to parent page via ${a?"sameOrigin":"postMessage"}: %c%c${s}`,Ee,Se))}const St=He((e,t,n,o,r)=>{We(n),Ot(e,t,n,o,r),Ne()}),kt=e=>St(0,0,e.type,`${e.screenY}:${e.screenX}`);function Mt(e,t){Ae(`Add event listener: %c${t}`,Se),Xe(window.document,e,kt)}function Et({persisted:e}){e||St(0,0,P),We(T),xe("Page persisted:",e),e||Qe.forEach(I)}const Rt=()=>Xe(window,R(T),Et),Tt=(e,t)=>!(Math.abs(e-t)<=lt.tolerance);const It=[Se,ke,Se],Pt={height:0,width:0},At={height:0,width:0};function xt(e,t,n){return At[e]=t,Pt[e]=n,t}function Lt(e){const{hasOverflow:t,hasTags:n,triggerLocked:o}=Ge,r=e.label,i=r===x,a=e.boundingClientRect(),s=Math.ceil(a),c=Math.floor(a),d=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${a}px %cPage: %c${d}px`;let u;switch(!0){case!e.enabled():return Math.max(d,A);case n:xe("Found element with data-iframe-size attribute"),u=e.taggedElement();break;case!t&&Ge.firstRun&&0===At[r]&&0===Pt[r]:xe(`Initial page size values: ${l}`,...It),u=xt(r,a,d);break;case o&&a===At[r]&&d===Pt[r]:xe(`Size unchanged: ${l}`,...It),u=Math.max(a,d);break;case 0===a&&0!==d:xe(`Page is hidden: ${l}`,...It),u=d;break;case!t&&a!==At[r]&&d<=Pt[r]:xe(`New <html> size: ${l} `,...It),xe(`Previous <html> size: %c${At[r]}px`,Se),u=xt(r,a,d);break;case!i:u=e.taggedElement();break;case!t&&a<At[r]:xe(`<html> size decreased: ${l}`,...It),u=xt(r,a,d);break;case d===c||d===s:xe(`<html> size equals page size: ${l}`,...It),u=xt(r,a,d);break;case a>d:xe(`Page size < <html> size: ${l}`,...It),u=xt(r,a,d);break;case t:xe("Found elements possibly overflowing <html> "),u=e.taggedElement();break;default:xe(`Using <html> size: ${l}`,...It),u=xt(r,a,d)}return xe(`Content ${r}: %c${u}px`,Se),u+=function(e){const t=e.getOffset();return 0!==t&&xe(`Page offsetSize: %c${t}px`,Se),t}(e),Math.max(u,A)}const Ct="--ifr-start",Nt="--ifr-end",Bt="--ifr-measure",Ht=[];let Wt,qt={},Dt=0;function Ft(){try{performance.clearMarks(Ct),performance.clearMarks(Nt),performance.clearMeasures(Bt)}catch{}}function Vt(e){e.getEntries().forEach(e=>{if(e.name===Nt)try{const{duration:t}=performance.measure(Bt,Ct,Nt);qt=e.detail,Ht.push(t),Ht.length>100&&Ht.shift()}catch{}})}function jt(){xe("Attached%c PerformanceObserver%c to page",Se,ke);const e=new PerformanceObserver(Vt);return e.observe({entryTypes:["mark"]}),Wt=setInterval(()=>{if(Ht.length<10)return;if(qt.hasTags&&qt.len<25)return;Ht.sort();const e=Math.min(Ht.reduce((e,t)=>e+t,0)/Ht.length,Ht[Math.floor(Ht.length/2)]),t=S(e);t>Dt&&(Dt=t,We("performanceObserver"),Ae("Mean time:",S(Ht[Math.floor(Ht.length/2)])),Ae("Median time:",S(Ht.reduce((e,t)=>e+t,0)/Ht.length)),Ae("Average time:",t),Ae("Max time:",S(Math.max(...Ht)))),Ft(),e<=4||(clearInterval(Wt),je(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${S(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${qt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{Ft(),clearInterval(Wt),e.disconnect(),xe("Detached%c PerformanceObserver",Se)}}}const Ut=`* ${Array.from(L).map(e=>`:not(${e})`).join("")}`,Qt=e=>e.querySelectorAll(Ut);function Jt(e){performance.mark(Ct);const t=C(e),{logging:n}=lt,{hasTags:o}=Ge,r=function(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:n,taggedElements:o}=Ge;return t?o:e?Array.from(n):Qt(document.documentElement)}(),{maxEl:i,maxVal:a}=function(e,t){const n=`margin-${t}`;let o,r=document.documentElement,i=Ge.hasTags?A:document.documentElement.getBoundingClientRect().bottom;for(const a of e)o=a.getBoundingClientRect()[t]+parseFloat(getComputedStyle(a).getPropertyValue(n)),o>i&&(i=o,r=a);return{maxEl:r,maxVal:i}}(r,e);return xe(`${t} position calculated from:`,i),xe(`Checked %c${r.length}%c elements`,Se,ke),performance.mark(Nt,{detail:{hasTags:o,len:r.length,logging:n,Side:t}}),a}const Yt={label:x,enabled:()=>lt.calculateHeight,getOffset:()=>lt.offsetHeight,auto:()=>Lt(Yt),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),documentElementScroll:()=>document.documentElement.scrollHeight,taggedElement:()=>Jt(N)},Xt={label:B,enabled:()=>lt.calculateWidth,getOffset:()=>lt.offsetWidth,auto:()=>Lt(Xt),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),documentElementScroll:()=>document.documentElement.scrollWidth,taggedElement:()=>Jt(H)};const Gt=(e,t)=>(n,o)=>{const r=e[n]();return e.enabled()&&void 0!==lt.onBeforeResize?function(e,t,n){const o=lt.onBeforeResize(e,t,n);if(void 0===o)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(o))throw new TypeError(`Invalid value returned from onBeforeResize(): ${o}, expected Number`);if(o<A)throw new RangeError(`Out of range value returned from onBeforeResize(): ${o}, must be at least ${A}`);return o}(r,o,t):r},_t=Gt(Yt,x),Kt=Gt(Xt,B);function Zt(e,t,n,o){const{heightCalcMode:r,widthCalcMode:i}=lt;0===window.scrollY&&0===window.scrollX||(xe("Reset iframe scroll position to (0, 0)"),window.scrollTo(0,0));const a=n??_t(r,e),s=o??Kt(i,e),c=function(e,t){const{calculateHeight:n,calculateWidth:o}=lt,{height:r,width:i}=Ge;return n&&Tt(r,e)||o&&Tt(i,t)}(a,s)?J:e;switch(Ae(`Resize event: %c${t}`,Se),c){case k:case Y:case J:case Q:case U:Ge.height=a,Ge.width=s;case j:return Ge;case V:case F:case D:case q:Ae(W);break;default:xe(W)}return null}let en=!1,tn=!1,nn=null;const on=He(function(e,t,n,o,r){const{autoResize:i}=lt,{isHidden:a}=Ge;switch(We(e),!0){case!0===a&&!(e in X):if(!0===tn)break;Ae("Iframe hidden - Ignored resize request"),tn=!0,en=!1,cancelAnimationFrame(nn),nn=null;break;case!0===en&&e!==V&&!(e in X):Ae("Resize already pending - Ignored resize request");break;case!i&&!(e in X):xe("Resizing disabled");break;default:{tn=!1,en=!0,Ge.totalTime=performance.now(),Ge.timerActive=!0;const i=Zt(e,t,n,o);i&&Ot(i.height,i.width,e,r),nn||(nn=requestAnimationFrame(()=>{en=!1,nn=null,We("requestAnimationFrame"),Le(`Reset sendPending: %c${e}`,Se)})),Ge.timerActive=!1}}Ne()});function rn({eventType:e,eventName:t}){Xe(window,t,()=>on(t,e),{passive:!0})}function an(){rn({eventType:"After Print",eventName:"afterprint"}),rn({eventType:"Before Print",eventName:"beforeprint"})}function sn(e){const{heightCalcMode:t,widthCalcMode:n}=lt,o=Yt[t](),r=Xt[n]();Ae(`Reset trigger event: %c${e}`,Se),St(o,r,e)}function cn(e){const t=lt.heightCalcMode;Ae(`Reset trigger event: %c${e}`,Se),lt.heightCalcMode=G,Ge.triggerLocked?Ae("TriggerLock blocked calculation"):(Ge.triggerLocked=!0,Le("Trigger event lock on"),requestAnimationFrame(()=>{Ge.triggerLocked=!1,Le("Trigger event lock off")})),sn("reset"),lt.heightCalcMode=t}const dn=`Auto Resize can not be changed when <b>direction</> is set to '${u}'.`;function ln(e){_(e,K,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:n,calculateWidth:o}=lt;return!1===o&&!1===n?(We(Y),je(dn),!1):(!0===e&&!1===t?(lt.autoResize=!0,queueMicrotask(()=>on(Y,"Auto Resize enabled"))):!1===e&&!0===t&&(lt.autoResize=!1),St(0,0,Z,JSON.stringify(lt.autoResize)),lt.autoResize)}function un(e){_(e,ee,"parentIframe.moveToAnchor(anchor) anchor"),Ge.inPageLinks.findTarget(e)}function fn(e){_(e,te,"parentIframe.setOffsetSize(offset) offset"),lt.offsetHeight=e,lt.offsetWidth=e,on(j,`parentIframe.setOffsetSize(${e})`)}const mn=()=>Ge.origin;function gn(e){_(e,ee,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),Ae(`Set targetOrigin: %c${e}`,Se),lt.targetOrigin=e}function hn(e){return _(e,ne,"parentIframe.getParentProps(callback) callback"),Ge.onParentInfo=e,St(0,0,oe),()=>{Ge.onParentInfo=null,St(0,0,re)}}function pn(e,t){void 0!==e&&_(e,te,"parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&_(t,te,"parentIframe.resize(customHeight, customWidth) customWidth");on(Q,`parentIframe.resize(${`${void 0===e?"":e}${void 0===t?"":`,${t}`}`})`,e,t)}const bn=e=>(t,n)=>{_(t,te,`parentIframe.${e}(x, y) x`),_(n,te,`parentIframe.${e}(x, y) y`),St(n,t,e)},wn=bn(ie),vn=bn(ae),yn=bn(se);function $n(e,t){t&&_(t,ee,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),St(0,0,ce,JSON.stringify(e),t)}const zn=()=>St(0,0,de),On=()=>lt.parentId,Sn=()=>cn("parentIframe.reset");const kn=(e="")=>t=>n=>{n.size>0&&Le(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>[le,e]))},Mn=kn("attached to"),En=((e="")=>t=>n=>{n.size>0&&Be(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>[le,e]))})("already attached"),Rn=kn("detached from"),Tn=(e,t=!0)=>n=>{n>0&&xe(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${n}%c element${1===n?"":"s"}`,Se,Oe,Se,Oe)},In=(e,t,n,o)=>{const r=Rn(e);return e=>{const i=/* @__PURE__ */new Set;let a=0;for(const o of e)n.has(o)&&(t.unobserve(o),n.delete(o),i.add(o),a+=1);r(i),o(a),i.clear()}},Pn="Mutation",An=/* @__PURE__ */new Set,xn=/* @__PURE__ */new Set,Ln=/* @__PURE__ */new Set,Cn=[],Nn={attributes:!0,attributeFilter:[f,y],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Bn,Hn=1,Wn=!1,qn=0;const Dn=kn("added")(Pn),Fn=kn("removed (page)")(Pn),Vn=kn("removed (added)")(Pn),jn=e=>e.nodeType!==Node.ELEMENT_NODE||L.has(e.tagName.toLowerCase());function Un(e){const t=e.addedNodes;for(const n of t)jn(n)||An.add(n)}function Qn(e){const t=e.removedNodes;for(const n of t)jn(n)||(An.has(n)?(An.delete(n),Ln.add(n)):xn.add(n))}const Jn=e=>{xe("Mutations:",e);for(const t of e)Un(t),Qn(t);Dn(An),Fn(xn),Vn(Ln),Ln.clear()};const Yn=e=>()=>{const t=performance.now(),n=t-qn,o=16*Hn+++2;if(n>o&&n<200)return We("mutationThrottled"),xe("Update delayed due to heavy workload on the callStack"),xe(`EventLoop busy time: %c${S(n)}ms %c> Max wait: %c${o-2}ms`,Se,ke,Se),setTimeout(Bn,16*Hn),void(qn=t);Hn=1,Cn.forEach(Jn),Cn.length=0,Wn=!1,xn.size>0&&Ae(`Detected %c${xn.size} %cremoved element${xn.size>1?"s":""}`,Se,ke),An.size>0&&Ae(`Found %c${An.size} %cnew element${An.size>1?"s":""}`,Se,ke),e({addedNodes:An,removedNodes:xn}),An.clear(),xn.clear()};function Xn(e){Cn.push(e),Wn||(qn=performance.now(),Wn=!0,requestAnimationFrame(Bn))}function Gn(e){const t=new window.MutationObserver(Xn),n=document.body||document.documentElement;return Bn=Yn(e),t.observe(n,Nn),xe("Attached%c MutationObserver%c to body",Se,ke),{disconnect:()=>{An.clear(),xn.clear(),Cn.length=0,t.disconnect(),xe("Detached%c MutationObserver",Se)}}}const _n={characterData:!0,childList:!0,subtree:!0};function Kn(e){const t=document.querySelector("title")??document.head??document.documentElement,n=new MutationObserver(e);return n.observe(t,_n),xe("Attached%c TitleObserver%c to head",Se,ke),setTimeout(e),{disconnect:()=>{n.disconnect(),xe("Detached%c TitleObserver",Se)}}}function Zn(e){const t=new IntersectionObserver(t=>e(t.at(-1)?.isIntersecting??!1),{threshold:0}),n=document.documentElement;return t.observe(n),xe("Attached%c VisibilityObserver%c to page",Se,ke),{disconnect:()=>{t.disconnect(),xe("Detached%c VisibilityObserver",Se)}}}let eo=/* @__PURE__ */new Set;function to(){const e=function(e){const t=/* @__PURE__ */new Set,n=/* @__PURE__ */new Set;for(const o of e)o.closest(`[${f}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{We("overflowIgnored"),xe("Ignoring elements with [data-iframe-ignore] > *:\n",n),Ne()}),t}(document.querySelectorAll(`[${ue}]`));let t=!0;return typeof Set.prototype.symmetricDifference===ne&&(t=e.symmetricDifference(eo).size>0),eo=e,Ge.overflowedNodeSet=e,Ge.hasOverflow=e.size>0,{hasOverflowUpdated:t,overflowedNodeSet:e}}const no={},oo=e=>{const t=/* @__PURE__ */new Set;for(const n of e)if(n instanceof Element){t.add(n);for(const e of Qt(n))t.add(e)}return xe("Inspecting:\n",t),t};function ro({addedNodes:e,removedNodes:t}){We("contentMutated"),Ge.applySelectors(),vt(),to(),Ne(),(e=>{if(0===e.size)return;We("removeObservers");const t=oo(e);no.overflow.detachObservers(t),no.resize.detachObservers(t),Ne()})(t),(e=>{if(0===e.size)return;We("addObservers");const t=oo(e);no.overflow.attachObservers(t),no.resize.attachObserverToNonStaticElements(t),Ne()})(e)}function io(e){ro(e),on(F,"Mutation Observed")}const ao="Overflow",so=Tn(ao),co=Tn(ao,!1),lo=Mn(ao),uo=En(ao),fo=e=>e instanceof HTMLElement&&(!!e.hidden||null===e.offsetParent||e.style.display===u);function mo(){const{hasOverflow:e}=Ge,{hasOverflowUpdated:t,overflowedNodeSet:n}=to();switch(!0){case!t:return;case n.size>1:xe("Overflowed Elements:",n);break;case e:break;default:xe("No overflow detected")}on(V,"Overflow updated")}function go(e){const t={root:document.documentElement,side:lt.calculateHeight?N:H};return no.overflow=((e,t)=>{const n=t.side||N,r={root:t.root,rootMargin:"0px",threshold:1},i=window?.requestAnimationFrame||o,a=(t=!1)=>e(t),s=(e,t)=>0===e||e>t[n],c=(e,t)=>{e.toggleAttribute(ue,t)},d=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t;if(!o)continue;const i=e[n],a=s(i,o)&&!(r instanceof HTMLElement&&fo(r));c(r,a)}i(a)},r),l=/* @__PURE__ */new WeakSet;return{attachObservers:function(e){const t=/* @__PURE__ */new Set,n=/* @__PURE__ */new Set;let o=0;for(const r of e)r instanceof Element&&(l.has(r)?t.add(r):(d.observe(r),l.add(r),n.add(r),o+=1));uo(t),lo(n),so(o),n.clear(),t.clear()},detachObservers:In(ao,d,l,co),disconnect:()=>{d.disconnect(),xe("Detached%c OverflowObserver",Se)}}})(mo,t),no.overflow.attachObservers(e),no.overflow}const ho="Resize",po=Tn(ho),bo=Tn(ho,!1),wo=Mn(ho),vo=En(ho),yo=/* @__PURE__ */new WeakSet,$o=/* @__PURE__ */new Set,zo=/* @__PURE__ */new Set;let Oo;function So(e){let t=0;for(const n of e){if(!(n instanceof Element))continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&(yo.has(n)?$o.add(n):(Oo.observe(n),yo.add(n),zo.add(n),t+=1))}vo($o),wo(zo),po(t),zo.clear(),$o.clear()}function ko(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;on(D,`Element resized <${fe(t)}>`)}function Mo(e){return no.resize=(Oo=new ResizeObserver(ko),Oo.observe(document.body),yo.add(document.body),xe("Attached%c ResizeObserver%c to body",Se,ke),{attachObserverToNonStaticElements:So,detachObservers:In(ho,Oo,yo,bo),disconnect:()=>{Oo.disconnect(),xe("Detached%c ResizeObserver",Se)}}),no.resize.attachObserverToNonStaticElements(e),no.resize}let Eo;function Ro(){const e=document.title;e!==Eo&&(Eo=e,Ae(`Title: %c${e}`,Se),e&&St(0,0,me,e))}function To(e){Ae(`Visible: %c${e}`,Se),Ge.isHidden=!e,on(q,"Visibility changed")}function Io(){We("attachObservers");const e=Qt(document.documentElement);!function(e){Qe.push(...e.map(e=>e.disconnect))}([Gn(io),go(e),jt(),Mo(e),Kn(Ro),Zn(To)])}const Po=(e,t,n)=>{if(""!==n){Ae(`${e}: %c${n}`,Se);for(const e of document.querySelectorAll(n))Ae(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}};function Ao(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function xo(e,t){void 0!==t&&""!==t&&t!==ge&&(document.body.style.setProperty(e,t),xe(`Set body ${e}: %c${t}`,Se))}function Lo({bodyMarginStr:e,bodyMargin:t}){var n,o;void 0===e&&(e=`${t}px`),xo("margin",(n="margin",(o=e).includes("-")&&(Fe(`Negative CSS value ignored for ${n}`),o=""),o))}function Co(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:Math.round(t.left+n.x),y:Math.round(t.top+n.y)}}function No(e){const t=e.split("#")[1]||e,n=decodeURIComponent(t),o=document.getElementById(n)||document.getElementsByName(n)[0];void 0===o?(Ae(`In page link (#${t}) not found in iframe, so sending to parent`),St(0,0,pe,`#${t}`)):function(e,t){const n=Co(t);Ae(`Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,Se,ke,Se,ke,Se),St(n.y,n.x,se)}(t,o)}function Bo(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&No(t)}function Ho(){Ae("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&Xe(e,"click",t=>{t.preventDefault(),No(e.getAttribute("href"))})}(),Xe(window,"hashchange",Bo),setTimeout(Bo,he),Ge.inPageLinks={findTarget:No}}function Wo(){const e=e=>e.style.setProperty(x,l,"important");e(document.documentElement),e(document.body),Ae("Set HTML & body height: %cauto !important",Se)}const qo=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Do=qo(ne),Fo=qo(te),Vo=qo(ee);function jo(e){Ae("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=function(e){const{calculateHeight:t,calculateWidth:n}=lt;let o,r;return typeof e?.offsetSize===te&&(t&&(o=Fo(e,ve)),n&&(r=Fo(e,ve))),{offsetHeight:o,offsetWidth:r}}(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:Vo(e,"ignoreSelector"),[we(3)]:Vo(e,we(0)),sizeSelector:Vo(e,"sizeSelector"),targetOrigin:Vo(e,"targetOrigin"),onBeforeResize:Do(e,"onBeforeResize"),onMessage:Do(e,"onMessage"),onReady:Do(e,"onReady")}}function Uo(){const{mode:e}=lt;if(O(e))return{};const t=window.iframeResizer||window.iFrameResizer;return null===(n=t)||typeof n!==be||Array.isArray(n)?{}:jo(t);var n}const Qo=e=>t=>void 0===t?void 0:e(t),Jo=Qo(e=>"true"===e),Yo=Qo(Number);function Xo(e){for(const[t,n]of Object.entries(e))void 0!==n&&(lt[t]=n)}function Go({logExpand:e,logging:n,parentId:o=""}){var r;Te=(r={id:o,enabled:n,expand:e}).id||t,Ie.label(`${Te}`),Ie.expand(r.expand),Re=r.enabled,We("initReceived"),Ae(`Initialising iframe v${p} ${window.location.href}`)}function _o(e){We("ready"),bt(z(e)),Ae("Initialization complete",(({key:e,key2:t,...n})=>n)(lt))}function Ko({bodyBackground:e,bodyPadding:t,inPageLinks:n,onReady:r}){const i=(({calculateWidth:e,calculateHeight:t})=>e===t)(lt),a=[mt,ut,ht,vt,wt,i?o:dt,()=>Lo(lt),()=>xo("background",e),()=>xo("padding",t),i?o:Wo,Ao,Ge.applySelectors,()=>function(e){const{mode:t}=lt;e?O(t)?je(h(5)):Ho():Ae("In page linking not enabled")}(n),an,()=>function({mouseEvents:e}){!0===e&&(Mt(M,"Mouse Enter"),Mt(E,"Mouse Leave"))}(lt),Rt,()=>function(){const{win:e}=Ge;1!==lt.mode&&(e.parentIframe=Object.freeze({autoResize:ln,close:zn,getId:On,getParentOrigin:mn,getParentProps:hn,moveToAnchor:un,reset:Sn,setOffsetSize:fn,scrollBy:wn,scrollTo:vn,scrollToOffset:yn,sendMessage:$n,setTargetOrigin:gn,resize:pn}))}(),()=>on(k,"Init message from host page",void 0,void 0,`${p}:${lt.mode}`),Io,Ne];yt(lt),function({key:e,key2:t,mode:n,version:o}){const r=n,i=m(e)?g({key:e}):-1,a=m(t)?g({key:t}):-1;let s;switch(n=Math.max(i,a)){case-2:case-1:s=`${h(Math.min(i,a)+2)}${h(2)}`,Ge.firstRun=!1;break;case 1:case 2:case 3:s=h(6);break;case 4:s=h(7);break;case 5:s=h(8)}if(n>=0&&gt(n,r,o),(!m(o)||!Ge.firstRun)&&(s&&je(s),n<0))throw je(h(9)),s.split("<br>")[0].replace(/<\/?[a-z][^>]*>|<\/>/gi,"");lt.mode=n}(lt),function(e){const{mode:t}=lt;e.forEach(e=>{try{e()}catch(n){if(t<0)throw n;je("<rb>Error in setup function</>\n<i>iframe-resizer</> detected an error during setup.\n\nPlease report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>"),Be(n)}})}(a),_o(r)}function Zo(e){Ge.firstRun&&(Xo((e=>({parentId:e[0],bodyMargin:Yo(e[1]),calculateWidth:Jo(e[2]),logging:Jo(e[3]),autoResize:Jo(e[6]),bodyMarginStr:e[7],bodyBackground:e[9],bodyPadding:e[10],tolerance:Yo(e[11]),inPageLinks:Jo(e[12]),mouseEvents:Jo(e[15]),offsetHeight:Yo(e[16]),offsetWidth:Yo(e[17]),calculateHeight:Jo(e[18]),key:e[19],version:e[20],mode:Yo(e[21]),logExpand:Jo(e[23])}))(e)),Go(lt),Xo(Uo()),Ge.applySelectors=function({sizeSelector:e,ignoreSelector:t}){return()=>{Po("sizeSelector",y,e),Po("ignoreSelector",f,t)}}(lt),Ko(lt))}const{freeze:er}=Object,{parse:tr}=JSON,nr=e=>er(tr(e)),or=e=>St(0,0,`${e}Stop`),rr=e=>e.data.slice(e.data.indexOf(d)+1),ir=e=>(e=>e.data.split(d)[2]in{true:1,false:1})(e)?k:e.data.split("]")[1].split(d)[0];const ar=e=>Ge.inPageLinks.findTarget(rr(e)),sr={init:function(e){if("loading"===document.readyState)return void Ae("Page not ready, ignoring init message");const t=e.data.slice(c).split(d);Ge.target=e.source,Ge.origin=e.origin,Zo(t),Ge.firstRun=!1,setTimeout(()=>{Ge.initLock=!1},he)},reset:function(){Ge.initLock?Ae("Page reset ignored by init"):(Ae("Page size reset by host page"),sn("resetPage"))},resize:function(){Ae("Resize requested by host page"),on(U,"Parent window requested size check")},moveToAnchor:ar,inPageLink:ar,pageInfo:function(e){const{onPageInfo:t}=Ge,n=rr(e);Ae("PageInfo received from parent:",nr(n)),t?w(t,tr(n)):or(ye)},parentInfo:function(e){const{onParentInfo:t}=Ge,n=nr(rr(e));Ae("ParentInfo received from parent:",n),t?w(t,n):or(oe)},message:function(e){const t=rr(e);Ae("onMessage called from parent:%c",Se,nr(t)),w(lt.onMessage,tr(t))}};function cr(e){const{firstRun:t}=Ge,n=ir(e);switch(We(n),!0){case n in sr:sr[n](e);break;case t&&(et in window||void 0!==window.jQuery&&et in window.jQuery.prototype):Fe(`Ignored message of type "${n}". Received before initialization.`);break;default:Fe(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const dr=He(e=>{(e=>s===`${e.data}`.slice(0,c))(e)&&cr(e)});typeof window!==$e&&function(){if("iframeChildListener"in window)Fe("Already setup");else{window.iframeChildListener=e=>{setTimeout(()=>dr({data:e,sameOrigin:!0}))},We("listen"),Xe(window,ce,dr),Xe(document,v,Ze),Ze();try{top?.document?.getElementById("banner")&&(Ge.win={},window.mockMsgListener=e,Ye(window,ce,dr),"function"==typeof window.define&&window.define([],()=>e))}catch(t){}}function e(e){return dr(e),Ge.win}}();
20
+ import{LABEL as e,BOLD as t,CHILD_READY_MESSAGE as n,MESSAGE_ID as o,MESSAGE_ID_LENGTH as r,SEPARATOR as i,AUTO as a,NONE as s,IGNORE_ATTR as c,VERSION as d,READY_STATE_CHANGE as l,SIZE_ATTR as u,FALSE as f,INIT as m,MOUSE_ENTER as g,MOUSE_LEAVE as h,PAGE_HIDE as p,BEFORE_UNLOAD as b,MIN_SIZE as w,HEIGHT as v,IGNORE_TAGS as y,HEIGHT_EDGE as $,WIDTH as z,WIDTH_EDGE as O,NO_CHANGE as S,VISIBILITY_OBSERVER as k,RESIZE_OBSERVER as M,MUTATION_OBSERVER as E,OVERFLOW_OBSERVER as R,SET_OFFSET_SIZE as T,PARENT_RESIZE_REQUEST as I,MANUAL_RESIZE_REQUEST as P,SIZE_CHANGE_DETECTED as A,ENABLE as x,IGNORE_DISABLE_RESIZE as L,HEIGHT_CALC_MODE_DEFAULT as C,BOOLEAN as N,AUTO_RESIZE as B,STRING as H,NUMBER as W,FUNCTION as q,PARENT_INFO as D,PARENT_INFO_STOP as F,SCROLL_BY as V,SCROLL_TO as j,SCROLL_TO_OFFSET as U,MESSAGE as Q,CLOSE as J,NEW_LINE as Y,OVERFLOW_ATTR as X,TITLE as G,NULL as _,EVENT_CANCEL_TIMER as K,IN_PAGE_LINK as Z,OBJECT as ee,OFFSET_SIZE as te,PAGE_INFO as ne,UNDEFINED as oe}from"@iframe-resizer/common/consts";import{esModuleInterop as re,createFormatAdvise as ie,id as ae,deprecate as se,isDef as ce,setMode as de,getModeData as le,getModeLabel as ue,isolateUserCode as fe,once as me,checkMode as ge,round as he,lower as pe,invoke as be,capitalizeFirstLetter as we,typeAssert as ve,getElementName as ye,getKey as $e}from"@iframe-resizer/common";import ze,{NORMAL as Oe,HIGHLIGHT as Se,FOREGROUND as ke,BOLD as Me,ITALIC as Ee}from"auto-console-group";let Re=!0,Te=e;const Ie=re(ze)({label:`${e}(child)`,expand:!1});const Pe=e=>(...t)=>!Re||Ie[e](...t),Ae=Pe("log"),xe=Ae,Le=Pe("debug");const{assert:Ce,endAutoGroup:Ne,error:Be,errorBoundary:He,event:We,label:qe,purge:De,warn:Fe}=Ie,Ve=ie(ae),je=(...e)=>Ie.warn(...e.map(Ve)),Ue=se((e,t)=>je(t));Ue("Method"),Ue("Method","replaced with"),Ue("Option");const Qe=[];function Je(e,t){Ae(`${e} event listener: %c${t}`,Se)}const Ye=(e,t,n,o)=>{e.removeEventListener(t,n,o),Je("Removed",t)},Xe=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),Qe.push(()=>Ye(e,t,n,o)),Je("Added",t)},Ge={applySelectors:null,firstRun:!0,hasTags:!1,hasOverflow:!1,height:0,isHidden:!1,initLock:!0,inPageLinks:{},origin:void 0,hasOverflowUpdated:!0,overflowedNodeSet:/* @__PURE__ */new Set,sameOrigin:!1,taggedElements:[],target:window?.parent,timerActive:!1,totalTime:0,triggerLocked:!1,width:0,win:window,onPageInfo:null,onParentInfo:null};let _e=!1;function Ke(e){const t=window?.iframeResizer?.targetOrigin||"*",o=Array.isArray(t)?t:[t];for(const r of o)e.postMessage(n,r)}function Ze(){if("loading"===document.readyState||!Ge.firstRun||_e)return;const{parent:e,top:t}=window;We("ready"),Ae("Sending%c ready%c to parent from",Se,ke,window.location.href),Ke(e),e!==t&&Ke(t),_e=!0}const et="iframeResize",tt=["min-height","min-width","max-height","max-width"],nt=/* @__PURE__ */new Set,ot=e=>e.tagName?e.tagName.toLowerCase():"unknown",rt=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),it=(e,t)=>{return!!(n=rt(e,t))&&"0px"!==n&&n!==a&&n!==s;var n};function at({href:e}){nt.has(e)||(Ae("Unable to access stylesheet:",e),nt.add(e))}const st=(e,t)=>function(e,t){const n=e.style.getPropertyValue(t);return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const o of document.styleSheets)try{for(const n of o.cssRules||[]){if(!("selectorText"in n))continue;const r=n;if(!e.matches(r.selectorText))continue;const i=r.style.getPropertyValue(t);if(!i)continue;const{ownerNode:a}=o;return{source:a instanceof Element&&"STYLE"===a.tagName?"an inline <style> block":`stylesheet (${o.href})`,value:i}}}catch(n){at(o)}return{source:"cross-origin stylesheet",value:rt(e,t)}}(e,t),ct=(e,t)=>{const{source:n,value:o}=st(e,t),r=ot(e);je(`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 dt(){for(const e of[document.documentElement,document.body])for(const t of tt)Ae(`Checking <${ot(e)}> for blocking CSS: ${t}`),it(e,t)&&ct(e,t)}const lt={autoResize:!0,bodyBackground:"",bodyMargin:0,bodyMarginStr:"",bodyPadding:"",calculateHeight:!0,calculateWidth:!1,heightCalcMode:a,ignoreSelector:"",inPageLinks:!1,logging:!1,logExpand:!1,mode:0,mouseEvents:!1,offsetHeight:0,offsetWidth:0,parentId:void 0,sizeSelector:"",targetOrigin:"*",tolerance:0,widthCalcMode:a,onBeforeResize:void 0,onMessage:()=>{Fe("onMessage function not defined")},onReady:()=>{}};function ut(){try{Ge.sameOrigin=1===lt.mode||"iframeParentListener"in window.parent}catch(e){Ae("Cross domain iframe detected")}}let ft=0;function mt(){const e=document.querySelectorAll(`*[${c}]`),t=e.length>0;return t&&e.length!==ft&&(!function(e){const t=1===e.length?"":"s";Fe(`%c[${c}]%c found on %c${e.length}%c element${t}`,Me,Oe,Me,Oe)}(e),ft=e.length),t}function gt(e,n,o){(!ce(o)||n>-1&&e>n)&&(function(e,n){console.info(`%ciframe-resizer ${e}`,Re||n<1?t:Oe)}(`v${d} (${ue(e)})`,e),0===e&&((...e)=>{console.warn(...e.map(Ve))})(le(3)))}function ht(){"BackCompat"===document.compatMode&&je("<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")}let pt=!1;function bt(e){"complete"===document.readyState?fe(e):pt||Xe(document,l,()=>bt(e)),pt=!0}const wt=()=>{xe(`Set targetOrigin for parent: %c${lt.targetOrigin}`,Se),!0!==lt.autoResize&&Ae("Auto Resize disabled")};function vt(){Ge.taggedElements=document.querySelectorAll(`[${u}]`),Ge.hasTags=Ge.taggedElements.length>0,Ae(`Tagged elements found: %c${Ge.hasTags}`,Se)}function yt({version:e}){e&&""!==e&&e!==f?e!==d&&je((e=>`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${e} - Child page: ${d}.\n`)(e)):je("<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")}const $t=me(()=>je(le(4)));function zt(e,t){const{mode:n}=lt,{sameOrigin:r,target:i}=Ge;if(r)try{window.parent.iframeParentListener(o+e)}catch(a){if(!ge(n))throw new Error(a);return $t(),!1}else{Ce(i,"Internal error: postMessage target is undefined");const n=function(e){return void 0===e?e=lt.targetOrigin:Ae(`Message targetOrigin: %c${e}`,Se),e}(t),r=Array.isArray(n)?n:[n];for(const t of r)i.postMessage(o+e,t)}return!0}function Ot(e,t,n,o,r){const{parentId:i}=lt,{sameOrigin:a}=Ge,s=`${i}:${`${e}:${t}`}:${n}${void 0===o?"":`:${o}`}`;if(lt.mode<-1)return;zt(s,r)&&(!function(e){if(!Ge.timerActive)return;const t=he(performance.now()-Ge.totalTime);Ae(e===m?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`,Se)}(n),xe(`Sending message to parent page via ${a?"sameOrigin":"postMessage"}: %c%c${s}`,Ee,Se))}const St=He((e,t,n,o,r)=>{We(n),Ot(e,t,n,o,r),Ne()}),kt=e=>St(0,0,e.type,`${e.screenY}:${e.screenX}`);function Mt(e,t){Ae(`Add event listener: %c${t}`,Se),Xe(window.document,e,kt)}function Et({persisted:e}){e||St(0,0,b),We(p),xe("Page persisted:",e),e||Qe.forEach(be)}const Rt=()=>Xe(window,pe(p),Et),Tt=(e,t)=>!(Math.abs(e-t)<=lt.tolerance);const It=[Se,ke,Se],Pt={height:0,width:0},At={height:0,width:0};function xt(e,t,n){return At[e]=t,Pt[e]=n,t}function Lt(e){const{hasOverflow:t,hasTags:n,triggerLocked:o}=Ge,r=e.label,i=r===v,a=e.boundingClientRect(),s=Math.ceil(a),c=Math.floor(a),d=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${a}px %cPage: %c${d}px`;let u;switch(!0){case!e.enabled():return Math.max(d,w);case n:xe("Found element with data-iframe-size attribute"),u=e.taggedElement();break;case!t&&Ge.firstRun&&0===At[r]&&0===Pt[r]:xe(`Initial page size values: ${l}`,...It),u=xt(r,a,d);break;case o&&a===At[r]&&d===Pt[r]:xe(`Size unchanged: ${l}`,...It),u=Math.max(a,d);break;case 0===a&&0!==d:xe(`Page is hidden: ${l}`,...It),u=d;break;case!t&&a!==At[r]&&d<=Pt[r]:xe(`New <html> size: ${l} `,...It),xe(`Previous <html> size: %c${At[r]}px`,Se),u=xt(r,a,d);break;case!i:u=e.taggedElement();break;case!t&&a<At[r]:xe(`<html> size decreased: ${l}`,...It),u=xt(r,a,d);break;case d===c||d===s:xe(`<html> size equals page size: ${l}`,...It),u=xt(r,a,d);break;case a>d:xe(`Page size < <html> size: ${l}`,...It),u=xt(r,a,d);break;case t:xe("Found elements possibly overflowing <html> "),u=e.taggedElement();break;default:xe(`Using <html> size: ${l}`,...It),u=xt(r,a,d)}return xe(`Content ${r}: %c${u}px`,Se),u+=function(e){const t=e.getOffset();return 0!==t&&xe(`Page offsetSize: %c${t}px`,Se),t}(e),Math.max(u,w)}const Ct="--ifr-start",Nt="--ifr-end",Bt="--ifr-measure",Ht=[];let Wt,qt={},Dt=0;function Ft(){try{performance.clearMarks(Ct),performance.clearMarks(Nt),performance.clearMeasures(Bt)}catch{}}function Vt(e){e.getEntries().forEach(e=>{if(e.name===Nt)try{const{duration:t}=performance.measure(Bt,Ct,Nt);qt=e.detail,Ht.push(t),Ht.length>100&&Ht.shift()}catch{}})}function jt(){xe("Attached%c PerformanceObserver%c to page",Se,ke);const e=new PerformanceObserver(Vt);return e.observe({entryTypes:["mark"]}),Wt=setInterval(()=>{if(Ht.length<10)return;if(qt.hasTags&&qt.len<25)return;Ht.sort();const e=Math.min(Ht.reduce((e,t)=>e+t,0)/Ht.length,Ht[Math.floor(Ht.length/2)]),t=he(e);t>Dt&&(Dt=t,We("performanceObserver"),Ae("Mean time:",he(Ht[Math.floor(Ht.length/2)])),Ae("Median time:",he(Ht.reduce((e,t)=>e+t,0)/Ht.length)),Ae("Average time:",t),Ae("Max time:",he(Math.max(...Ht)))),Ft(),e<=4||(clearInterval(Wt),je(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${he(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${qt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{Ft(),clearInterval(Wt),e.disconnect(),xe("Detached%c PerformanceObserver",Se)}}}const Ut=`* ${Array.from(y).map(e=>`:not(${e})`).join("")}`,Qt=e=>e.querySelectorAll(Ut);function Jt(e){performance.mark(Ct);const t=we(e),{logging:n}=lt,{hasTags:o}=Ge,r=function(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:n,taggedElements:o}=Ge;return t?o:e?Array.from(n):Qt(document.documentElement)}(),{maxEl:i,maxVal:a}=function(e,t){const n=`margin-${t}`;let o,r=document.documentElement,i=Ge.hasTags?w:document.documentElement.getBoundingClientRect().bottom;for(const a of e)o=a.getBoundingClientRect()[t]+parseFloat(getComputedStyle(a).getPropertyValue(n)),o>i&&(i=o,r=a);return{maxEl:r,maxVal:i}}(r,e);return xe(`${t} position calculated from:`,i),xe(`Checked %c${r.length}%c elements`,Se,ke),performance.mark(Nt,{detail:{hasTags:o,len:r.length,logging:n,Side:t}}),a}const Yt={label:v,enabled:()=>lt.calculateHeight,getOffset:()=>lt.offsetHeight,auto:()=>Lt(Yt),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),documentElementScroll:()=>document.documentElement.scrollHeight,taggedElement:()=>Jt($)},Xt={label:z,enabled:()=>lt.calculateWidth,getOffset:()=>lt.offsetWidth,auto:()=>Lt(Xt),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),documentElementScroll:()=>document.documentElement.scrollWidth,taggedElement:()=>Jt(O)};const Gt=(e,t)=>(n,o)=>{const r=e[n]();return e.enabled()&&void 0!==lt.onBeforeResize?function(e,t,n){const o=lt.onBeforeResize(e,t,n);if(void 0===o)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(o))throw new TypeError(`Invalid value returned from onBeforeResize(): ${o}, expected Number`);if(o<w)throw new RangeError(`Out of range value returned from onBeforeResize(): ${o}, must be at least ${w}`);return o}(r,o,t):r},_t=Gt(Yt,v),Kt=Gt(Xt,z);function Zt(e,t,n,o){const{heightCalcMode:r,widthCalcMode:i}=lt;0===window.scrollY&&0===window.scrollX||(xe("Reset iframe scroll position to (0, 0)"),window.scrollTo(0,0));const a=n??_t(r,e),s=o??Kt(i,e),c=function(e,t){const{calculateHeight:n,calculateWidth:o}=lt,{height:r,width:i}=Ge;return n&&Tt(r,e)||o&&Tt(i,t)}(a,s)?A:e;switch(Ae(`Resize event: %c${t}`,Se),c){case m:case x:case A:case P:case I:Ge.height=a,Ge.width=s;case T:return Ge;case R:case E:case M:case k:Ae(S);break;default:xe(S)}return null}let en=!1,tn=!1,nn=null;const on=He(function(e,t,n,o,r){const{autoResize:i}=lt,{isHidden:a}=Ge;switch(We(e),!0){case!0===a&&!(e in L):if(!0===tn)break;Ae("Iframe hidden - Ignored resize request"),tn=!0,en=!1,cancelAnimationFrame(nn),nn=null;break;case!0===en&&e!==R&&!(e in L):Ae("Resize already pending - Ignored resize request");break;case!i&&!(e in L):xe("Resizing disabled");break;default:{tn=!1,en=!0,Ge.totalTime=performance.now(),Ge.timerActive=!0;const i=Zt(e,t,n,o);i&&Ot(i.height,i.width,e,r),nn||(nn=requestAnimationFrame(()=>{en=!1,nn=null,We("requestAnimationFrame"),Le(`Reset sendPending: %c${e}`,Se)})),Ge.timerActive=!1}}Ne()});function rn({eventType:e,eventName:t}){Xe(window,t,()=>on(t,e),{passive:!0})}function an(){rn({eventType:"After Print",eventName:"afterprint"}),rn({eventType:"Before Print",eventName:"beforeprint"})}function sn(e){const{heightCalcMode:t,widthCalcMode:n}=lt,o=Yt[t](),r=Xt[n]();Ae(`Reset trigger event: %c${e}`,Se),St(o,r,e)}function cn(e){const t=lt.heightCalcMode;Ae(`Reset trigger event: %c${e}`,Se),lt.heightCalcMode=C,Ge.triggerLocked?Ae("TriggerLock blocked calculation"):(Ge.triggerLocked=!0,Le("Trigger event lock on"),requestAnimationFrame(()=>{Ge.triggerLocked=!1,Le("Trigger event lock off")})),sn("reset"),lt.heightCalcMode=t}const dn=`Auto Resize can not be changed when <b>direction</> is set to '${s}'.`;function ln(e){ve(e,N,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:n,calculateWidth:o}=lt;return!1===o&&!1===n?(We(x),je(dn),!1):(!0===e&&!1===t?(lt.autoResize=!0,queueMicrotask(()=>on(x,"Auto Resize enabled"))):!1===e&&!0===t&&(lt.autoResize=!1),St(0,0,B,JSON.stringify(lt.autoResize)),lt.autoResize)}function un(e){ve(e,H,"parentIframe.moveToAnchor(anchor) anchor"),Ge.inPageLinks.findTarget(e)}function fn(e){ve(e,W,"parentIframe.setOffsetSize(offset) offset"),lt.offsetHeight=e,lt.offsetWidth=e,on(T,`parentIframe.setOffsetSize(${e})`)}const mn=()=>Ge.origin;function gn(e){ve(e,H,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),Ae(`Set targetOrigin: %c${e}`,Se),lt.targetOrigin=e}function hn(e){return ve(e,q,"parentIframe.getParentProps(callback) callback"),Ge.onParentInfo=e,St(0,0,D),()=>{Ge.onParentInfo=null,St(0,0,F)}}function pn(e,t){void 0!==e&&ve(e,W,"parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&ve(t,W,"parentIframe.resize(customHeight, customWidth) customWidth");on(P,`parentIframe.resize(${`${void 0===e?"":e}${void 0===t?"":`,${t}`}`})`,e,t)}const bn=e=>(t,n)=>{ve(t,W,`parentIframe.${e}(x, y) x`),ve(n,W,`parentIframe.${e}(x, y) y`),St(n,t,e)},wn=bn(V),vn=bn(j),yn=bn(U);function $n(e,t){t&&ve(t,H,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),St(0,0,Q,JSON.stringify(e),t)}const zn=()=>St(0,0,J),On=()=>lt.parentId,Sn=()=>cn("parentIframe.reset");const kn=(e="")=>t=>n=>{n.size>0&&Le(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>[Y,e]))},Mn=kn("attached to"),En=((e="")=>t=>n=>{n.size>0&&Be(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>[Y,e]))})("already attached"),Rn=kn("detached from"),Tn=(e,t=!0)=>n=>{n>0&&xe(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${n}%c element${1===n?"":"s"}`,Se,Oe,Se,Oe)},In=(e,t,n,o)=>{const r=Rn(e);return e=>{const i=/* @__PURE__ */new Set;let a=0;for(const o of e)n.has(o)&&(t.unobserve(o),n.delete(o),i.add(o),a+=1);r(i),o(a),i.clear()}},Pn="Mutation",An=/* @__PURE__ */new Set,xn=/* @__PURE__ */new Set,Ln=/* @__PURE__ */new Set,Cn=[],Nn={attributes:!0,attributeFilter:[c,u],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Bn,Hn=1,Wn=!1,qn=0;const Dn=kn("added")(Pn),Fn=kn("removed (page)")(Pn),Vn=kn("removed (added)")(Pn),jn=e=>e.nodeType!==Node.ELEMENT_NODE||y.has(e.tagName.toLowerCase());function Un(e){const t=e.addedNodes;for(const n of t)jn(n)||An.add(n)}function Qn(e){const t=e.removedNodes;for(const n of t)jn(n)||(An.has(n)?(An.delete(n),Ln.add(n)):xn.add(n))}const Jn=e=>{xe("Mutations:",e);for(const t of e)Un(t),Qn(t);Dn(An),Fn(xn),Vn(Ln),Ln.clear()};const Yn=e=>()=>{const t=performance.now(),n=t-qn,o=16*Hn+++2;if(n>o&&n<200)return We("mutationThrottled"),xe("Update delayed due to heavy workload on the callStack"),xe(`EventLoop busy time: %c${he(n)}ms %c> Max wait: %c${o-2}ms`,Se,ke,Se),setTimeout(Bn,16*Hn),void(qn=t);Hn=1,Cn.forEach(Jn),Cn.length=0,Wn=!1,xn.size>0&&Ae(`Detected %c${xn.size} %cremoved element${xn.size>1?"s":""}`,Se,ke),An.size>0&&Ae(`Found %c${An.size} %cnew element${An.size>1?"s":""}`,Se,ke),e({addedNodes:An,removedNodes:xn}),An.clear(),xn.clear()};function Xn(e){Cn.push(e),Wn||(qn=performance.now(),Wn=!0,requestAnimationFrame(Bn))}function Gn(e){const t=new window.MutationObserver(Xn),n=document.body||document.documentElement;return Bn=Yn(e),t.observe(n,Nn),xe("Attached%c MutationObserver%c to body",Se,ke),{disconnect:()=>{An.clear(),xn.clear(),Cn.length=0,t.disconnect(),xe("Detached%c MutationObserver",Se)}}}const _n={characterData:!0,childList:!0,subtree:!0};function Kn(e){const t=document.querySelector("title")??document.head??document.documentElement,n=new MutationObserver(e);return n.observe(t,_n),xe("Attached%c TitleObserver%c to head",Se,ke),setTimeout(e),{disconnect:()=>{n.disconnect(),xe("Detached%c TitleObserver",Se)}}}function Zn(e){const t=new IntersectionObserver(t=>e(t.at(-1)?.isIntersecting??!1),{threshold:0}),n=document.documentElement;return t.observe(n),xe("Attached%c VisibilityObserver%c to page",Se,ke),{disconnect:()=>{t.disconnect(),xe("Detached%c VisibilityObserver",Se)}}}let eo=/* @__PURE__ */new Set;function to(){const e=function(e){const t=/* @__PURE__ */new Set,n=/* @__PURE__ */new Set;for(const o of e)o.closest(`[${c}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{We("overflowIgnored"),xe("Ignoring elements with [data-iframe-ignore] > *:\n",n),Ne()}),t}(document.querySelectorAll(`[${X}]`));let t=!0;return typeof Set.prototype.symmetricDifference===q&&(t=e.symmetricDifference(eo).size>0),eo=e,Ge.overflowedNodeSet=e,Ge.hasOverflow=e.size>0,{hasOverflowUpdated:t,overflowedNodeSet:e}}const no={},oo=e=>{const t=/* @__PURE__ */new Set;for(const n of e)if(n instanceof Element){t.add(n);for(const e of Qt(n))t.add(e)}return xe("Inspecting:\n",t),t};function ro({addedNodes:e,removedNodes:t}){We("contentMutated"),Ge.applySelectors(),vt(),to(),Ne(),(e=>{if(0===e.size)return;We("removeObservers");const t=oo(e);no.overflow.detachObservers(t),no.resize.detachObservers(t),Ne()})(t),(e=>{if(0===e.size)return;We("addObservers");const t=oo(e);no.overflow.attachObservers(t),no.resize.attachObserverToNonStaticElements(t),Ne()})(e)}function io(e){ro(e),on(E,"Mutation Observed")}const ao="Overflow",so=Tn(ao),co=Tn(ao,!1),lo=Mn(ao),uo=En(ao),fo=e=>e instanceof HTMLElement&&(!!e.hidden||null===e.offsetParent||e.style.display===s);function mo(){const{hasOverflow:e}=Ge,{hasOverflowUpdated:t,overflowedNodeSet:n}=to();switch(!0){case!t:return;case n.size>1:xe("Overflowed Elements:",n);break;case e:break;default:xe("No overflow detected")}on(R,"Overflow updated")}function go(e){const t={root:document.documentElement,side:lt.calculateHeight?$:O};return no.overflow=((e,t)=>{const n=t.side||$,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||ae,i=(t=!1)=>e(t),a=(e,t)=>0===e||e>t[n],s=(e,t)=>{e.toggleAttribute(X,t)},c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t;if(!o)continue;const i=e[n],c=a(i,o)&&!(r instanceof HTMLElement&&fo(r));s(r,c)}r(i)},o),d=/* @__PURE__ */new WeakSet;return{attachObservers:function(e){const t=/* @__PURE__ */new Set,n=/* @__PURE__ */new Set;let o=0;for(const r of e)r instanceof Element&&(d.has(r)?t.add(r):(c.observe(r),d.add(r),n.add(r),o+=1));uo(t),lo(n),so(o),n.clear(),t.clear()},detachObservers:In(ao,c,d,co),disconnect:()=>{c.disconnect(),xe("Detached%c OverflowObserver",Se)}}})(mo,t),no.overflow.attachObservers(e),no.overflow}const ho="Resize",po=Tn(ho),bo=Tn(ho,!1),wo=Mn(ho),vo=En(ho),yo=/* @__PURE__ */new WeakSet,$o=/* @__PURE__ */new Set,zo=/* @__PURE__ */new Set;let Oo;function So(e){let t=0;for(const n of e){if(!(n instanceof Element))continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&(yo.has(n)?$o.add(n):(Oo.observe(n),yo.add(n),zo.add(n),t+=1))}vo($o),wo(zo),po(t),zo.clear(),$o.clear()}function ko(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;on(M,`Element resized <${ye(t)}>`)}function Mo(e){return no.resize=(Oo=new ResizeObserver(ko),Oo.observe(document.body),yo.add(document.body),xe("Attached%c ResizeObserver%c to body",Se,ke),{attachObserverToNonStaticElements:So,detachObservers:In(ho,Oo,yo,bo),disconnect:()=>{Oo.disconnect(),xe("Detached%c ResizeObserver",Se)}}),no.resize.attachObserverToNonStaticElements(e),no.resize}let Eo;function Ro(){const e=document.title;e!==Eo&&(Eo=e,Ae(`Title: %c${e}`,Se),e&&St(0,0,G,e))}function To(e){Ae(`Visible: %c${e}`,Se),Ge.isHidden=!e,on(k,"Visibility changed")}function Io(){We("attachObservers");const e=Qt(document.documentElement);!function(e){Qe.push(...e.map(e=>e.disconnect))}([Gn(io),go(e),jt(),Mo(e),Kn(Ro),Zn(To)])}const Po=(e,t,n)=>{if(""!==n){Ae(`${e}: %c${n}`,Se);for(const e of document.querySelectorAll(n))Ae(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}};function Ao(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function xo(e,t){void 0!==t&&""!==t&&t!==_&&(document.body.style.setProperty(e,t),xe(`Set body ${e}: %c${t}`,Se))}function Lo({bodyMarginStr:e,bodyMargin:t}){var n,o;void 0===e&&(e=`${t}px`),xo("margin",(n="margin",(o=e).includes("-")&&(Fe(`Negative CSS value ignored for ${n}`),o=""),o))}function Co(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:Math.round(t.left+n.x),y:Math.round(t.top+n.y)}}function No(e){const t=e.split("#")[1]||e,n=decodeURIComponent(t),o=document.getElementById(n)||document.getElementsByName(n)[0];void 0===o?(Ae(`In page link (#${t}) not found in iframe, so sending to parent`),St(0,0,Z,`#${t}`)):function(e,t){const n=Co(t);Ae(`Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,Se,ke,Se,ke,Se),St(n.y,n.x,U)}(t,o)}function Bo(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&No(t)}function Ho(){Ae("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&Xe(e,"click",t=>{t.preventDefault(),No(e.getAttribute("href"))})}(),Xe(window,"hashchange",Bo),setTimeout(Bo,K),Ge.inPageLinks={findTarget:No}}function Wo(){const e=e=>e.style.setProperty(v,a,"important");e(document.documentElement),e(document.body),Ae("Set HTML & body height: %cauto !important",Se)}const qo=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Do=qo(q),Fo=qo(W),Vo=qo(H);function jo(e){Ae("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=function(e){const{calculateHeight:t,calculateWidth:n}=lt;let o,r;return typeof e?.offsetSize===W&&(t&&(o=Fo(e,te)),n&&(r=Fo(e,te))),{offsetHeight:o,offsetWidth:r}}(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:Vo(e,"ignoreSelector"),[$e(3)]:Vo(e,$e(0)),sizeSelector:Vo(e,"sizeSelector"),targetOrigin:Vo(e,"targetOrigin"),onBeforeResize:Do(e,"onBeforeResize"),onMessage:Do(e,"onMessage"),onReady:Do(e,"onReady")}}function Uo(){const{mode:e}=lt;if(ge(e))return{};const t=window.iframeResizer||window.iFrameResizer;return null===(n=t)||typeof n!==ee||Array.isArray(n)?{}:jo(t);var n}const Qo=e=>t=>void 0===t?void 0:e(t),Jo=Qo(e=>"true"===e),Yo=Qo(Number);function Xo(e){for(const[t,n]of Object.entries(e))void 0!==n&&(lt[t]=n)}function Go({logExpand:t,logging:n,parentId:o=""}){var r;Te=(r={id:o,enabled:n,expand:t}).id||e,Ie.label(`${Te}`),Ie.expand(r.expand),Re=r.enabled,We("initReceived"),Ae(`Initialising iframe v${d} ${window.location.href}`)}function _o(e){We("ready"),bt(me(e)),Ae("Initialization complete",(({key:e,key2:t,...n})=>n)(lt))}function Ko({bodyBackground:e,bodyPadding:t,inPageLinks:n,onReady:o}){const r=(({calculateWidth:e,calculateHeight:t})=>e===t)(lt),i=[mt,ut,ht,vt,wt,r?ae:dt,()=>Lo(lt),()=>xo("background",e),()=>xo("padding",t),r?ae:Wo,Ao,Ge.applySelectors,()=>function(e){const{mode:t}=lt;e?ge(t)?je(le(5)):Ho():Ae("In page linking not enabled")}(n),an,()=>function({mouseEvents:e}){!0===e&&(Mt(g,"Mouse Enter"),Mt(h,"Mouse Leave"))}(lt),Rt,()=>function(){const{win:e}=Ge;1!==lt.mode&&(e.parentIframe=Object.freeze({autoResize:ln,close:zn,getId:On,getParentOrigin:mn,getParentProps:hn,moveToAnchor:un,reset:Sn,setOffsetSize:fn,scrollBy:wn,scrollTo:vn,scrollToOffset:yn,sendMessage:$n,setTargetOrigin:gn,resize:pn}))}(),()=>on(m,"Init message from host page",void 0,void 0,`${d}:${lt.mode}`),Io,Ne];yt(lt),function({key:e,key2:t,mode:n,version:o}){const r=n,i=ce(e)?de({key:e}):-1,a=ce(t)?de({key:t}):-1;let s;switch(n=Math.max(i,a)){case-2:case-1:s=`${le(Math.min(i,a)+2)}${le(2)}`,Ge.firstRun=!1;break;case 1:case 2:case 3:s=le(6);break;case 4:s=le(7);break;case 5:s=le(8)}if(n>=0&&gt(n,r,o),(!ce(o)||!Ge.firstRun)&&(s&&je(s),n<0))throw je(le(9)),s.split("<br>")[0].replace(/<\/?[a-z][^>]*>|<\/>/gi,"");lt.mode=n}(lt),function(e){const{mode:t}=lt;e.forEach(e=>{try{e()}catch(n){if(t<0)throw n;je("<rb>Error in setup function</>\n<i>iframe-resizer</> detected an error during setup.\n\nPlease report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>"),Be(n)}})}(i),_o(o)}function Zo(e){Ge.firstRun&&(Xo((e=>({parentId:e[0],bodyMargin:Yo(e[1]),calculateWidth:Jo(e[2]),logging:Jo(e[3]),autoResize:Jo(e[6]),bodyMarginStr:e[7],bodyBackground:e[9],bodyPadding:e[10],tolerance:Yo(e[11]),inPageLinks:Jo(e[12]),mouseEvents:Jo(e[15]),offsetHeight:Yo(e[16]),offsetWidth:Yo(e[17]),calculateHeight:Jo(e[18]),key:e[19],version:e[20],mode:Yo(e[21]),logExpand:Jo(e[23])}))(e)),Go(lt),Xo(Uo()),Ge.applySelectors=function({sizeSelector:e,ignoreSelector:t}){return()=>{Po("sizeSelector",u,e),Po("ignoreSelector",c,t)}}(lt),Ko(lt))}const{freeze:er}=Object,{parse:tr}=JSON,nr=e=>er(tr(e)),or=e=>St(0,0,`${e}Stop`),rr=e=>e.data.slice(e.data.indexOf(i)+1),ir=e=>(e=>e.data.split(i)[2]in{true:1,false:1})(e)?m:e.data.split("]")[1].split(i)[0];const ar=e=>Ge.inPageLinks.findTarget(rr(e)),sr={init:function(e){if("loading"===document.readyState)return void Ae("Page not ready, ignoring init message");const t=e.data.slice(r).split(i);Ge.target=e.source,Ge.origin=e.origin,Zo(t),Ge.firstRun=!1,setTimeout(()=>{Ge.initLock=!1},K)},reset:function(){Ge.initLock?Ae("Page reset ignored by init"):(Ae("Page size reset by host page"),sn("resetPage"))},resize:function(){Ae("Resize requested by host page"),on(I,"Parent window requested size check")},moveToAnchor:ar,inPageLink:ar,pageInfo:function(e){const{onPageInfo:t}=Ge,n=rr(e);Ae("PageInfo received from parent:",nr(n)),t?fe(t,tr(n)):or(ne)},parentInfo:function(e){const{onParentInfo:t}=Ge,n=nr(rr(e));Ae("ParentInfo received from parent:",n),t?fe(t,n):or(D)},message:function(e){const t=rr(e);Ae("onMessage called from parent:%c",Se,nr(t)),fe(lt.onMessage,tr(t))}};function cr(e){const{firstRun:t}=Ge,n=ir(e);switch(We(n),!0){case n in sr:sr[n](e);break;case t&&(et in window||void 0!==window.jQuery&&et in window.jQuery.prototype):Fe(`Ignored message of type "${n}". Received before initialization.`);break;default:Fe(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const dr=He(e=>{(e=>o===`${e.data}`.slice(0,r))(e)&&cr(e)});typeof window!==oe&&function(){if("iframeChildListener"in window)Fe("Already setup");else{window.iframeChildListener=e=>{setTimeout(()=>dr({data:e,sameOrigin:!0}))},We("listen"),Xe(window,Q,dr),Xe(document,l,Ze),Ze();try{top?.document?.getElementById("banner")&&(Ge.win={},window.mockMsgListener=e,Ye(window,Q,dr),"function"==typeof window.define&&window.define([],()=>e))}catch(t){}}function e(e){return dr(e),Ge.win}}();
21
21
  //# sourceMappingURL=index.esm.js.map