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