@iframe-resizer/child 6.0.0-beta.0 → 6.0.0-beta.2
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/README.md +2 -2
- package/iframe-resizer.child.d.ts +5 -1
- package/index.cjs.js +19 -28
- package/index.cjs.js.map +1 -1
- package/index.esm.js +834 -821
- package/index.esm.js.map +1 -1
- package/index.umd.js +21 -30
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
package/index.umd.js
CHANGED
|
@@ -1,54 +1,45 @@
|
|
|
1
|
-
(function(s,
|
|
1
|
+
(function(s,w){typeof exports=="object"&&typeof module<"u"?w(require("auto-console-group")):typeof define=="function"&&define.amd?define(["auto-console-group"],w):(s=typeof globalThis<"u"?globalThis:s||self,w(s.acg))})(this,(function(s){"use strict";const w="6.0.0-beta.2",Ee="iframeResizer",Sn="[iFrameResizerChild]Ready",Tn="autoResize",Rn="beforeUnload",Hn="close",Mn="inPageLink",te="init",Oe="message",$n="mouseenter",An="mouseleave",rt="pageHide",st="pageInfo",it="parentInfo",Ln="pageInfoStop",kn="parentInfoStop",Nn="scrollBy",Gn="scrollTo",ct="scrollToOffset",Pn="title",ne="data-iframe-size",at="data-iframe-overflowed",U="data-iframe-ignore",oe="height",lt="width",Se="offset",Te="offsetSize",W="string",$="number",Cn="boolean",jn="object",re="function",Dn="undefined",_n="false",Fn="null",A="auto",dt="readystatechange",ut="bottom",ft="right",Re="autoResizeEnabled",mt=Symbol("sizeChanged"),He="manualResize",Me="parentResize",$e={[He]:1,[Me]:1},ht="setOffsetSize",pt="resizeObserver",Ae="overflowObserver",gt="mutationObserver",yt="visibilityObserver",xn="font-weight: bold;",Le="none",vt="No change in content size detected",se="[iFrameSizer]",bt=se.length,Bn=A,zt=128,wt=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),Un=e=>(t,n="renamed to")=>(o,r,d="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>
|
|
2
2
|
|
|
3
|
-
The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${
|
|
4
|
-
`,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},
|
|
5
|
-
`).replaceAll(/<\/?[^>]+>/gi,""),
|
|
3
|
+
The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${d}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`),Wn=e=>typeof e===W,ie=(e,...t)=>setTimeout(()=>e(...t),0),It=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},ce=e=>e,Et=1e3,C=e=>Math.round(e*Et)/Et,Ot=e=>e.charAt(0).toUpperCase()+e.slice(1),L=e=>`${e}`!=""&&e!==void 0,Vn=e=>e(),qn=e=>e.toLowerCase();function Zn(e){switch(!0){case!L(e):return"";case L(e.id):return`${e.nodeName}#${e.id}`;case L(e.name):return`${e.nodeName} (${e.name}`;case L(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const Yn=e=>e?.__esModule?e.default:e,I=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${Ot(t)}`)},St={br:`
|
|
4
|
+
`,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},Qn=Object.keys(St),Jn=new RegExp(`<(${Qn.join("|")})>`,"gi"),Kn=(e,t)=>St[t]??"",Xn=e=>e.replace(Jn,Kn),eo=e=>e.replaceAll("<br>",`
|
|
5
|
+
`).replaceAll(/<\/?[^>]+>/gi,""),to=e=>t=>e(Wn(t)?window.chrome?Xn(t):eo(t):t);let ke=!0,Ne=Ee;const V=Yn(s)({label:`${Ee}(child)`,expand:!1});function no(e){Ne=e.id||Ee,V.label(`${Ne}`),V.expand(e.expand),ke=e.enabled}const Tt=e=>(...t)=>ke?V[e](...t):!0,l=Tt("log"),u=l,ae=Tt("debug");function oo(e,t){console.info(`${Ne} %ciframe-resizer ${e}`,ke||t<1?xn:s.NORMAL)}const{assert:ro,endAutoGroup:j,error:Rt,errorBoundary:Ge,event:h,label:Ei,purge:Oi,warn:D}=V,so=to(ce),g=(...e)=>V.warn(...e.map(so)),Pe=Un((e,t)=>g(t)),Ht=Pe("Method"),io=Pe("Method","replaced with"),co=Pe("Option"),Ce=[];function Mt(e,t){l(`${e} event listener: %c${t}`,s.HIGHLIGHT)}const $t=(e,t,n,o)=>{e.removeEventListener(t,n,o),Mt("Removed",t)},k=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),Ce.push(()=>$t(e,t,n,o)),Mt("Added",t)},i={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 At=!1;function Lt(e){const t=window?.iframeResizer?.targetOrigin||"*",n=Array.isArray(t)?t:[t];for(const o of n)e.postMessage(Sn,o)}function kt(){if(document.readyState==="loading"||!i.firstRun||At)return;const{parent:e,top:t}=window;h("ready"),l("Sending%c ready%c to parent from",s.HIGHLIGHT,s.FOREGROUND,window.location.href),Lt(e),e!==t&&Lt(t),At=!0}const Nt="iframeResize",ao=e=>se===`${e.data}`.slice(0,bt),lo=()=>Nt in window||window.jQuery!==void 0&&Nt in window.jQuery.prototype,uo=e=>e.data.split(":")[2]in{true:1,false:1},fo=()=>[document.documentElement,document.body],mo=["min-height","min-width","max-height","max-width"],Gt=new Set,ho=e=>!!e&&e!=="0px"&&e!==A&&e!==Le,Pt=e=>e.tagName?e.tagName.toLowerCase():"unknown",Ct=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),po=(e,t)=>ho(Ct(e,t));function go(e,t){const n=e.style.getPropertyValue(t);return n?{source:"an inline style attribute",value:n}:null}function yo({href:e}){Gt.has(e)||(l("Unable to access stylesheet:",e),Gt.add(e))}function vo(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[]){if(!("selectorText"in o))continue;const r=o;if(!e.matches(r.selectorText))continue;const d=r.style.getPropertyValue(t);if(!d)continue;const{ownerNode:a}=n;return{source:a instanceof Element&&a.tagName==="STYLE"?"an inline <style> block":`stylesheet (${n.href})`,value:d}}}catch{yo(n)}return{source:"cross-origin stylesheet",value:Ct(e,t)}}const bo=(e,t)=>go(e,t)||vo(e,t),zo=(e,t)=>{const{source:n,value:o}=bo(e,t),r=Pt(e);g(`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</>.
|
|
6
6
|
|
|
7
|
-
If 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
|
|
7
|
+
If 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 wo(){for(const e of fo())for(const t of mo)l(`Checking <${Pt(e)}> for blocking CSS: ${t}`),po(e,t)&&zo(e,t)}const Io=({calculateWidth:e,calculateHeight:t})=>e===t,c={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:()=>{D("onMessage function not defined")},onReady:()=>{}},N=[s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT],le={height:0,width:0},F={height:0,width:0};function x(e,t,n){return F[e]=t,le[e]=n,t}function Eo(e){const t=e.getOffset();return t!==0&&u(`Page offsetSize: %c${t}px`,s.HIGHLIGHT),t}const Oo=e=>e.documentElementScroll()+Math.max(0,e.getOffset());function jt(e){const{hasOverflow:t,hasTags:n,triggerLocked:o}=i,r=e.label,d=r===oe,a=e.boundingClientRect(),f=Math.ceil(a),b=Math.floor(a),m=Oo(e),z=`HTML: %c${a}px %cPage: %c${m}px`;let p;switch(!0){case!e.enabled():return Math.max(m,1);case n:u("Found element with data-iframe-size attribute"),p=e.taggedElement();break;case(!t&&i.firstRun&&F[r]===0&&le[r]===0):u(`Initial page size values: ${z}`,...N),p=x(r,a,m);break;case(o&&a===F[r]&&m===le[r]):u(`Size unchanged: ${z}`,...N),p=Math.max(a,m);break;case(a===0&&m!==0):u(`Page is hidden: ${z}`,...N),p=m;break;case(!t&&a!==F[r]&&m<=le[r]):u(`New <html> size: ${z} `,...N),u(`Previous <html> size: %c${F[r]}px`,s.HIGHLIGHT),p=x(r,a,m);break;case!d:p=e.taggedElement();break;case(!t&&a<F[r]):u(`<html> size decreased: ${z}`,...N),p=x(r,a,m);break;case(m===b||m===f):u(`<html> size equals page size: ${z}`,...N),p=x(r,a,m);break;case a>m:u(`Page size < <html> size: ${z}`,...N),p=x(r,a,m);break;case t:u("Found elements possibly overflowing <html> "),p=e.taggedElement();break;default:u(`Using <html> size: ${z}`,...N),p=x(r,a,m)}return u(`Content ${r}: %c${p}px`,s.HIGHLIGHT),p+=Eo(e),Math.max(p,1)}const So=5*1e3,To=4,Ro=10,Ho=100,je="--ifr-start",de="--ifr-end",Dt="--ifr-measure",v=[];let ue={},_t=0,De;function Ft(){try{performance.clearMarks(je),performance.clearMarks(de),performance.clearMeasures(Dt)}catch{}}function Mo(){De=setInterval(()=>{if(v.length<Ro||ue.hasTags&&ue.len<25)return;v.sort();const e=Math.min(v.reduce((n,o)=>n+o,0)/v.length,v[Math.floor(v.length/2)]),t=C(e);t>_t&&(_t=t,h("performanceObserver"),l("Mean time:",C(v[Math.floor(v.length/2)])),l("Median time:",C(v.reduce((n,o)=>n+o,0)/v.length)),l("Average time:",t),l("Max time:",C(Math.max(...v)))),Ft(),!(e<=To)&&(clearInterval(De),g(`<rb>Performance Warning</>
|
|
8
8
|
|
|
9
|
-
Calculating the page size is taking an excessive amount of time (${
|
|
9
|
+
Calculating the page size is taking an excessive amount of time (${C(e)}ms).
|
|
10
10
|
|
|
11
|
-
To improve performance add the <b>data-iframe-size</> attribute to the ${
|
|
11
|
+
To improve performance add the <b>data-iframe-size</> attribute to the ${ue.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},So)}function $o(e){e.getEntries().forEach(t=>{if(t.name===de)try{const{duration:n}=performance.measure(Dt,je,de);ue=t.detail,v.push(n),v.length>Ho&&v.shift()}catch{}})}function Ao(){u("Attached%c PerformanceObserver%c to page",s.HIGHLIGHT,s.FOREGROUND);const e=new PerformanceObserver($o);return e.observe({entryTypes:["mark"]}),Mo(),{disconnect:()=>{Ft(),clearInterval(De),e.disconnect(),u("Detached%c PerformanceObserver",s.HIGHLIGHT)}}}const Lo=e=>`:not(${e})`,ko=`* ${Array.from(wt).map(Lo).join("")}`,_e=e=>e.querySelectorAll(ko);function No(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:n,taggedElements:o}=i;return t?o:e?Array.from(n):_e(document.documentElement)}function Go(e,t){const n=`margin-${t}`;let o,r=document.documentElement,d=i.hasTags?1:document.documentElement.getBoundingClientRect().bottom;for(const a of e)o=a.getBoundingClientRect()[t]+parseFloat(getComputedStyle(a).getPropertyValue(n)),o>d&&(d=o,r=a);return{maxEl:r,maxVal:d}}function xt(e){performance.mark(je);const t=Ot(e),{logging:n}=c,{hasTags:o}=i,r=No(),{maxEl:d,maxVal:a}=Go(r,e);return u(`${t} position calculated from:`,d),u(`Checked %c${r.length}%c elements`,s.HIGHLIGHT,s.FOREGROUND),performance.mark(de,{detail:{hasTags:o,len:r.length,logging:n,Side:t}}),a}const fe={label:oe,enabled:()=>c.calculateHeight,getOffset:()=>c.offsetHeight,auto:()=>jt(fe),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),documentElementScroll:()=>document.documentElement.scrollHeight,taggedElement:()=>xt(ut)},me={label:lt,enabled:()=>c.calculateWidth,getOffset:()=>c.offsetWidth,auto:()=>jt(me),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),documentElementScroll:()=>document.documentElement.scrollWidth,taggedElement:()=>xt(ft)};function Bt(e,t){const{label:n}=t;return e&&e!==A&&g(`<rb>Ignored ${n}CalculationMethod (${e})</>
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
license: 'xxxx',
|
|
15
|
-
${e}CalculationMethod: '${ie}',
|
|
16
|
-
}
|
|
17
|
-
`;function _o(e,t){const n=i.version?"remove this option.":Do(e);h(`<rb>Deprecated ${e}CalculationMethod (${t})</>
|
|
13
|
+
This version of <i>iframe-resizer</> auto detects the most suitable ${n} calculation method. The <b>${n}CalculationMethod</> option is no longer supported and has been ignored.
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
`)
|
|
15
|
+
To remove this warning, delete the <b>${n}CalculationMethod</> option from your parent page config and/or the <i>window.iframeResizer</> config on the child page.
|
|
16
|
+
`),l(`Set ${n} calculation method: %c${A}`,s.HIGHLIGHT),A}function Po(){c.heightCalcMode=Bt(c.heightCalcMode,fe)}function Co(){c.widthCalcMode=Bt(c.widthCalcMode,me)}function jo(){try{i.sameOrigin=c.mode===1||"iframeParentListener"in window.parent}catch{l("Cross domain iframe detected")}}const Do=`<rb>Deprecated Attributes</>
|
|
21
17
|
|
|
22
|
-
The <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.`;function
|
|
18
|
+
The <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.`;function _o(){let e=!1;const t=n=>document.querySelectorAll(`[${n}]`).forEach(o=>{o.toggleAttribute(ne,!0),o.removeAttribute(n),e=!0});t("data-iframe-height"),t("data-iframe-width"),e&&g(Do)}let Ut=0;function Fo(e){const t=e.length===1?"":"s";D(`%c[${U}]%c found on %c${e.length}%c element${t}`,s.BOLD,s.NORMAL,s.BOLD,s.NORMAL)}function xo(){const e=document.querySelectorAll(`*[${U}]`),t=e.length>0;return t&&e.length!==Ut&&(Fo(e),Ut=e.length),t}const he=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,r=0;r<e.length;r++)o=e.codePointAt(r),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);return t^=Math.imul(t^n>>>15,1935289751),n^=Math.imul(n^t>>>15,3405138345),t^=n>>>16,n^=t>>>16,(2097152*(n>>>0)+(t>>>11)).toString(36)},H=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),Bo=new Date,Wt=e=>new Set(Array.from({length:9},e)),Vt=" - lewpylk",B=["spjluzl","rlf","clyzpvu","rlf2","nlaMbssFlhy"],Uo=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.</><iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> fvb jhu bzl aol <i>mpyza 11 johyhjalyz vm fvb spjluzl rlf</> av nla h 60% kpzjvbua ha oaawz://pmyhtl-ylzpgly.jvt/wypjpun.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.<iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> vm <p>pmyhtl-ylzpgly</> wslhzl kvdusvhk aol shalza rlf myvt oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz.","<yi> VLT rlf lewpylk</><iy><iy>Aol spjluzl rlf fvb hyl bzpun mvy <p>pmyhtl-ylzpgly</> pz myvt h wypvy flhy huk ohz lewpylk. Hu bwkhalk rlf pz ylslhzlk vu aol mpyza vm Uvcltily lhjo flhy.<iy><iy>Wslhzl kvdusvhk aol shalza rlf myvt oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz."],Wo=e=>[e[0],...e.slice(1).map(t=>`${t}${Vt}`),`${e[4]}${Vt}`,...e.slice(1)],Vo=Wo(["NWSc3","zvsv","wyv","ibzpulzz","VLT"]),qt=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","1foobarqaz","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl","igb1wzrjqr"].map((e,t)=>[e,Math.max(0,t-1)])),qo=new Set([1,6]),Zt=Bo[H(B[4])](),Zo=Wt((e,t)=>he(`${Zt+t}`)),Yo=Wt((e,t)=>he(`${Zt-++t}`)),Qo=e=>Zo.has(e)?9:Yo.has(e)?5:-2,Fe=e=>qo.has(e),G=e=>H(Uo[e]),Jo=e=>H(Vo[e]),Yt=e=>H(B[e]),Qt=e=>{const t=e[H(B[0])]||e[H(B[1])]||e[H(B[2])]||e[H(B[3])];if(!t)return-1;const n=t.split("-");let o=(function(r="",d=""){let a=-2;const f=he(H(r));return f in qt&&(a=qt[f]),a===9?Qo(d):a})(...n);return o===0||(r=>r[2]===he(r[0]+r[1]))(n)||(o=-2),o};function Ko(e,t,n){if(!L(n)||t>-1&&e>t){try{if(sessionStorage.getItem("ifr")===w)return}catch{}oo(`v${w} (${Jo(e)})`,e),e<2&&g(G(3));try{sessionStorage.setItem("ifr",w)}catch{}}}function Xo({key:e,key2:t,mode:n,version:o}){const r=n,d=L(e)?Qt({key:e}):-1,a=L(t)?Qt({key:t}):-1;let f;switch(n=Math.max(d,a),n){case-2:case-1:f=`${G(Math.min(d,a)+2)}${G(2)}`,i.firstRun=!1;break;case 1:case 2:case 3:f=G(6);break;case 4:f=G(7);break;case 5:f=G(8);break}if(Ko(n,r,o),(!L(o)||!i.firstRun)&&(f&&g(f),n<0))throw f.split("<br>")[0].replace(/<\/?[a-z][^>]*>|<\/>/gi,"");c.mode=n}const er="BackCompat",tr=`<rb>Quirks Mode Detected</>
|
|
23
19
|
|
|
24
20
|
This 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</>.
|
|
25
21
|
|
|
26
22
|
For more information see <u>https://iframe-resizer.com/quirks-mode</>.
|
|
27
|
-
`;function
|
|
23
|
+
`;function nr(){document.compatMode===er&&g(tr)}const or="complete";let Jt=!1;function Kt(e){document.readyState===or?ie(e):Jt||k(document,dt,()=>Kt(e)),Jt=!0}const rr=()=>{u(`Set targetOrigin for parent: %c${c.targetOrigin}`,s.HIGHLIGHT),c.autoResize!==!0&&l("Auto Resize disabled")};function Xt(){i.taggedElements=document.querySelectorAll(`[${ne}]`),i.hasTags=i.taggedElements.length>0,l(`Tagged elements found: %c${i.hasTags}`,s.HIGHLIGHT)}const sr=`<rb>Legacy version detected on parent page</>
|
|
28
24
|
|
|
29
25
|
Detected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.
|
|
30
26
|
|
|
31
27
|
See <u>https://iframe-resizer.com/setup/</> for more details.
|
|
32
|
-
`,
|
|
28
|
+
`,ir=e=>`<b>Version mismatch</>
|
|
33
29
|
|
|
34
30
|
The parent and child pages are running different versions of <i>iframe resizer</>.
|
|
35
31
|
|
|
36
|
-
Parent page: ${e} - Child page: ${
|
|
37
|
-
`;function
|
|
32
|
+
Parent page: ${e} - Child page: ${w}.
|
|
33
|
+
`;function cr({version:e}){!e||e===""||e===_n?g(sr):e!==w&&g(ir(e))}const ar=It(()=>g(G(4)));function lr(e){if(!i.timerActive)return;const t=C(performance.now()-i.totalTime),n=e===te?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`;l(n,s.HIGHLIGHT)}function dr(e){return e===void 0?e=c.targetOrigin:l(`Message targetOrigin: %c${e}`,s.HIGHLIGHT),e}function ur(e,t){const{mode:n}=c,{sameOrigin:o,target:r}=i;if(o)try{window.parent.iframeParentListener(se+e)}catch(d){if(Fe(n))ar();else throw d;return!1}else{ro(r,"Internal error: postMessage target is undefined");const d=dr(t),a=Array.isArray(d)?d:[d];for(const f of a)r.postMessage(se+e,f)}return!0}function en(e,t,n,o,r){const{parentId:d}=c,{sameOrigin:a}=i,f=`${e}:${t}`,b=`${d}:${f}:${n}${o===void 0?"":`:${o}`}`;c.mode<-1||!ur(b,r)||(lr(n),u(`Sending message to parent page via ${a?"sameOrigin":"postMessage"}: %c%c${b}`,s.ITALIC,s.HIGHLIGHT))}const y=Ge((e,t,n,o,r)=>{h(n),en(e,t,n,o,r),j()}),fr=e=>y(0,0,e.type,`${e.screenY}:${e.screenX}`);function tn(e,t){l(`Add event listener: %c${t}`,s.HIGHLIGHT),k(window.document,e,fr)}function mr({mouseEvents:e}){e===!0&&(tn($n,"Mouse Enter"),tn(An,"Mouse Leave"))}const hr=()=>y(0,0,Rn);function pr({persisted:e}){e||hr(),h(rt),u("Page persisted:",e),!e&&Ce.forEach(Vn)}const gr=()=>k(window,qn(rt),pr),nn=(e,t)=>!(Math.abs(e-t)<=c.tolerance);function yr(e,t){const{calculateHeight:n,calculateWidth:o}=c,{height:r,width:d}=i;return n&&nn(r,e)||o&&nn(d,t)}function vr(e,t,n){const o=c.onBeforeResize(e,t,n);if(o===void 0)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<1)throw new RangeError(`Out of range value returned from onBeforeResize(): ${o}, must be at least 1`);return o}const on=(e,t)=>(n,o)=>{const r=e[n]();return e.enabled()&&c.onBeforeResize!==void 0?vr(r,o,t):r},br=on(fe,oe),zr=on(me,lt);function wr(){(window.scrollY!==0||window.scrollX!==0)&&(u("Reset iframe scroll position to (0, 0)"),window.scrollTo(0,0))}function Ir(e,t,n,o){const{heightCalcMode:r,widthCalcMode:d}=c;wr();const a=n??br(r,e),f=o??zr(d,e),b=yr(a,f)?mt:e;switch(l(`Resize event: %c${t}`,s.HIGHLIGHT),b){case te:case Re:case mt:case He:case Me:i.height=a,i.width=f;case ht:return i;case Ae:case gt:case pt:case yt:{l(vt);break}default:u(vt)}return null}let pe=!1,xe=!1,q=null;function Er(e,t,n,o,r){const{autoResize:d}=c,{isHidden:a}=i;switch(h(e),!0){case(a===!0&&!(e in $e)):{if(xe===!0)break;l("Iframe hidden - Ignored resize request"),xe=!0,pe=!1,cancelAnimationFrame(q),q=null;break}case(pe===!0&&e!==Ae&&!(e in $e)):{l("Resize already pending - Ignored resize request");break}case(!d&&!(e in $e)):{u("Resizing disabled");break}default:{xe=!1,pe=!0,i.totalTime=performance.now(),i.timerActive=!0;const f=Ir(e,t,n,o);f&&en(f.height,f.width,e,r),q||(q=requestAnimationFrame(()=>{pe=!1,q=null,h("requestAnimationFrame"),ae(`Reset sendPending: %c${e}`,s.HIGHLIGHT)})),i.timerActive=!1}}j()}const E=Ge(Er);function rn({eventType:e,eventName:t}){k(window,t,()=>E(t,e),{passive:!0})}function Or(){rn({eventType:"After Print",eventName:"afterprint"}),rn({eventType:"Before Print",eventName:"beforeprint"})}function Sr(){if(i.triggerLocked){l("TriggerLock blocked calculation");return}i.triggerLocked=!0,ae("Trigger event lock on"),requestAnimationFrame(()=>{i.triggerLocked=!1,ae("Trigger event lock off")})}function sn(e){const{heightCalcMode:t,widthCalcMode:n}=c,o=fe[t](),r=me[n]();l(`Reset trigger event: %c${e}`,s.HIGHLIGHT),y(o,r,e)}function Tr(e){const t=c.heightCalcMode;l(`Reset trigger event: %c${e}`,s.HIGHLIGHT),c.heightCalcMode=Bn,Sr(),sn("reset"),c.heightCalcMode=t}const Rr=`Auto Resize can not be changed when <b>direction</> is set to '${Le}'.`;function Hr(e){I(e,Cn,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:n,calculateWidth:o}=c;return o===!1&&n===!1?(h(Re),g(Rr),!1):(e===!0&&t===!1?(c.autoResize=!0,queueMicrotask(()=>E(Re,"Auto Resize enabled"))):e===!1&&t===!0&&(c.autoResize=!1),y(0,0,Tn,JSON.stringify(c.autoResize)),c.autoResize)}function Mr(e){I(e,W,"parentIframe.moveToAnchor(anchor) anchor"),i.inPageLinks.findTarget(e)}function $r(e){I(e,$,"parentIframe.setOffsetSize(offset) offset"),c.offsetHeight=e,c.offsetWidth=e,E(ht,`parentIframe.setOffsetSize(${e})`)}function Ar(){return h("getOrigin"),Ht("getOrigin()","getParentOrigin()"),i.origin}const Lr=()=>i.origin;function kr(e){I(e,W,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),l(`Set targetOrigin: %c${e}`,s.HIGHLIGHT),c.targetOrigin=e}function Nr(e){if(typeof e===re){i.onPageInfo=e,y(0,0,st),io("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");return}i.onPageInfo=null,y(0,0,Ln)}function cn(e){return I(e,re,"parentIframe.getParentProps(callback) callback"),i.onParentInfo=e,y(0,0,it),()=>{i.onParentInfo=null,y(0,0,kn)}}function Gr(e){return Ht("getParentProperties()","getParentProps()"),cn(e)}const Pr=e=>`<rb>Deprecated API object name</>
|
|
38
34
|
The <b>window.parentIFrame</> object has been renamed to <b>window.parentIframe</>. Please update your code as the old object will be removed in a future version.
|
|
39
35
|
|
|
40
36
|
Called property: '${String(e)}'
|
|
41
|
-
`;function Cr(e){const t=new Set;return new Proxy(e,{get(n,o){t.has(o)||(
|
|
42
|
-
`,o]))},
|
|
43
|
-
`,o]))},an=
|
|
44
|
-
`,n),
|
|
45
|
-
`,t),t},
|
|
46
|
-
|
|
47
|
-
The use of <b>${e}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.
|
|
48
|
-
|
|
49
|
-
See <u>https://iframe-resizer.com/api/child</> for more details.
|
|
50
|
-
`;function wn(e,t){return typeof e!==q?e:(h(Zs(t)),t===W?O.custom=e:S.custom=e,qs)}const nt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},ot=nt(q),we=nt(L),Ee=nt(V),Ys=e=>e!==null&&typeof e===jn&&!Array.isArray(e);function Qs(e){const{calculateHeight:t,calculateWidth:n}=i;let o,r;return typeof e?.offset===L&&(co(Te,Re),t&&(o=we(e,Te)),n&&(r=we(e,Te))),typeof e?.offsetSize===L&&(t&&(o=we(e,Re)),n&&(r=we(e,Re))),{offsetHeight:o,offsetWidth:r}}function Js(e){a("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=Qs(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:Ee(e,"ignoreSelector"),key2:Ee(e,Zo(0)),sizeSelector:Ee(e,"sizeSelector"),targetOrigin:Ee(e,"targetOrigin"),heightCalcMode:wn(e?.heightCalculationMethod,W),widthCalcMode:wn(e?.widthCalculationMethod,ut),onBeforeResize:ot(e,"onBeforeResize"),onMessage:ot(e,"onMessage"),onReady:ot(e,"onReady")}}function Ks(){const{mode:e}=i;if(e===1)return{};const t=window.iframeResizer||window.iFrameResizer;return Ys(t)?Js(t):{}}const Xs=e=>e==="true",En=e=>t=>t===void 0?void 0:e(t),_=En(Xs),te=En(Number),ei=e=>({parentId:e[0],bodyMargin:te(e[1]),calculateWidth:_(e[2]),logging:_(e[3]),autoResize:_(e[6]),bodyMarginStr:e[7],heightCalcMode:e[8],bodyBackground:e[9],bodyPadding:e[10],tolerance:te(e[11]),inPageLinks:_(e[12]),widthCalcMode:e[14],mouseEvents:_(e[15]),offsetHeight:te(e[16]),offsetWidth:te(e[17]),calculateHeight:_(e[18]),key:e[19],version:e[20],mode:te(e[21]),logExpand:_(e[23])});function ti(e){const{mode:t}=i;e.forEach(n=>{try{n()}catch(o){if(t<0)throw o;h(`<rb>Error in setup function</>
|
|
37
|
+
`;function Cr(e){const t=new Set;return new Proxy(e,{get(n,o,r){t.has(o)||(g(Pr(o)),t.add(o));const d=Reflect.get(n,o,r),a=Object.getOwnPropertyDescriptor(n,o);return a&&!a.configurable&&!a.writable?d:typeof d=="function"?d.bind(n):d}})}function jr(e,t){e!==void 0&&I(e,$,"parentIframe.resize(customHeight, customWidth) customHeight"),t!==void 0&&I(t,$,"parentIframe.resize(customHeight, customWidth) customWidth");const n=e===void 0?"":e,o=t===void 0?"":`,${t}`,r=`${n}${o}`;E(He,`parentIframe.resize(${r})`,e,t)}const Be=e=>(t,n)=>{I(t,$,`parentIframe.${e}(x, y) x`),I(n,$,`parentIframe.${e}(x, y) y`),y(n,t,e)},Dr=Be(Nn),_r=Be(Gn),Fr=Be(ct);function xr(e,t){t&&I(t,W,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),y(0,0,Oe,JSON.stringify(e),t)}const Br=()=>y(0,0,Hn),Ur=()=>c.parentId,Wr=()=>Tr("parentIframe.reset"),Vr=()=>D("parentIframe.size() has been renamed parentIframe.resize()");function qr(){const{win:e}=i;c.mode!==1&&(e.parentIframe=Object.freeze({autoResize:Hr,close:Br,getId:Ur,getOrigin:Ar,getParentOrigin:Lr,getPageInfo:Nr,getParentProps:cn,getParentProperties:Gr,moveToAnchor:Mr,reset:Wr,setOffsetSize:$r,scrollBy:Dr,scrollTo:_r,scrollToOffset:Fr,sendMessage:xr,setTargetOrigin:kr,resize:jr,size:Vr}),e.parentIFrame=Cr(e.parentIframe))}const Z=(e="")=>t=>n=>{n.size>0&&ae(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[`
|
|
38
|
+
`,o]))},Zr=(e="")=>t=>n=>{n.size>0&&Rt(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[`
|
|
39
|
+
`,o]))},an=Z("attached to"),ln=Zr("already attached"),Yr=Z("detached from"),ge=(e,t=!0)=>n=>{n>0&&u(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${n}%c element${n===1?"":"s"}`,s.HIGHLIGHT,s.NORMAL,s.HIGHLIGHT,s.NORMAL)},dn=(e,t,n,o)=>{const r=Yr(e);return d=>{const a=new Set;let f=0;for(const b of d)n.has(b)&&(t.unobserve(b),n.delete(b),a.add(b),f+=1);r(a),o(f),a.clear()}},un=16,fn=2,Qr=200,Ue="Mutation",O=new Set,P=new Set,We=new Set,ye=[],Jr={attributes:!0,attributeFilter:[U,ne],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Ve=1,qe,Ze=!1,Ye=0;const Kr=Z("added")(Ue),Xr=Z("removed (page)")(Ue),es=Z("removed (added)")(Ue),mn=e=>e.nodeType!==Node.ELEMENT_NODE||wt.has(e.tagName.toLowerCase());function ts(e){const t=e.addedNodes;for(const n of t)mn(n)||O.add(n)}function ns(e){const t=e.removedNodes;for(const n of t)mn(n)||(O.has(n)?(O.delete(n),We.add(n)):P.add(n))}const os=e=>{u("Mutations:",e);for(const t of e)ts(t),ns(t);Kr(O),Xr(P),es(We),We.clear()};function rs(){P.size>0&&l(`Detected %c${P.size} %cremoved element${P.size>1?"s":""}`,s.HIGHLIGHT,s.FOREGROUND),O.size>0&&l(`Found %c${O.size} %cnew element${O.size>1?"s":""}`,s.HIGHLIGHT,s.FOREGROUND)}const ss=e=>()=>{const t=performance.now(),n=t-Ye,o=un*Ve+++fn;if(n>o&&n<Qr){h("mutationThrottled"),u("Update delayed due to heavy workload on the callStack"),u(`EventLoop busy time: %c${C(n)}ms %c> Max wait: %c${o-fn}ms`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),setTimeout(qe,un*Ve),Ye=t;return}Ve=1,ye.forEach(os),ye.length=0,Ze=!1,rs(),e({addedNodes:O,removedNodes:P}),O.clear(),P.clear()};function is(e){ye.push(e),!Ze&&(Ye=performance.now(),Ze=!0,requestAnimationFrame(qe))}function cs(e){const t=new window.MutationObserver(is),n=document.body||document.documentElement;return qe=ss(e),t.observe(n,Jr),u("Attached%c MutationObserver%c to body",s.HIGHLIGHT,s.FOREGROUND),{disconnect:()=>{O.clear(),P.clear(),ye.length=0,t.disconnect(),u("Detached%c MutationObserver",s.HIGHLIGHT)}}}const as={characterData:!0,childList:!0,subtree:!0};function ls(e){const t=document.querySelector("title")??document.head??document.documentElement,n=new MutationObserver(e);return n.observe(t,as),u("Attached%c TitleObserver%c to head",s.HIGHLIGHT,s.FOREGROUND),setTimeout(e),{disconnect:()=>{n.disconnect(),u("Detached%c TitleObserver",s.HIGHLIGHT)}}}function ds(e){const t=new IntersectionObserver(o=>e(o.at(-1)?.isIntersecting??!1),{threshold:0}),n=document.documentElement;return t.observe(n),u("Attached%c VisibilityObserver%c to page",s.HIGHLIGHT,s.FOREGROUND),{disconnect:()=>{t.disconnect(),u("Detached%c VisibilityObserver",s.HIGHLIGHT)}}}let hn=new Set;function us(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${U}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{h("overflowIgnored"),u(`Ignoring elements with [data-iframe-ignore] > *:
|
|
40
|
+
`,n),j()}),t}function pn(){const e=document.querySelectorAll(`[${at}]`),t=us(e);let n=!0;return typeof Set.prototype.symmetricDifference===re&&(n=t.symmetricDifference(hn).size>0),hn=t,i.overflowedNodeSet=t,i.hasOverflow=t.size>0,{hasOverflowUpdated:n,overflowedNodeSet:t}}const S={},gn=e=>{const t=new Set;for(const n of e)if(n instanceof Element){t.add(n);for(const o of _e(n))t.add(o)}return u(`Inspecting:
|
|
41
|
+
`,t),t},fs=e=>{if(e.size===0)return;h("addObservers");const t=gn(e);S.overflow.attachObservers(t),S.resize.attachObserverToNonStaticElements(t),j()},ms=e=>{if(e.size===0)return;h("removeObservers");const t=gn(e);S.overflow.detachObservers(t),S.resize.detachObservers(t),j()};function hs({addedNodes:e,removedNodes:t}){h("contentMutated"),i.applySelectors(),Xt(),pn(),j(),ms(t),fs(e)}function ps(e){hs(e),E(gt,"Mutation Observed")}const Y="Overflow",gs=ge(Y),ys=ge(Y,!1),vs=an(Y),bs=ln(Y),zs=e=>e instanceof HTMLElement&&(!!e.hidden||e.offsetParent===null||e.style.display===Le),ws=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||ce,d=(T=!1)=>e(T),a=(T,M)=>T===0||T>M[n],f=(T,M)=>{T.toggleAttribute(at,M)};function b(T){for(const M of T){const{boundingClientRect:X,rootBounds:ee,target:R}=M;if(!ee)continue;const yi=X[n],vi=a(yi,ee)&&!(R instanceof HTMLElement&&zs(R));f(R,vi)}r(d)}const m=new IntersectionObserver(b,o),z=new WeakSet;function p(T){const M=new Set,X=new Set;let ee=0;for(const R of T)if(R instanceof Element){if(z.has(R)){M.add(R);continue}m.observe(R),z.add(R),X.add(R),ee+=1}bs(M),vs(X),gs(ee),X.clear(),M.clear()}return{attachObservers:p,detachObservers:dn(Y,m,z,ys),disconnect:()=>{m.disconnect(),u("Detached%c OverflowObserver",s.HIGHLIGHT)}}};function Is(){const{hasOverflow:e}=i,{hasOverflowUpdated:t,overflowedNodeSet:n}=pn();switch(!0){case!t:return;case n.size>1:u("Overflowed Elements:",n);break;case e:break;default:u("No overflow detected")}E(Ae,"Overflow updated")}function Es(e){const t={root:document.documentElement,side:c.calculateHeight?ut:ft};return S.overflow=ws(Is,t),S.overflow.attachObservers(e),S.overflow}const Q="Resize",Os=ge(Q),Ss=ge(Q,!1),Ts=an(Q),Rs=ln(Q),ve=new WeakSet,Qe=new Set,Je=new Set;let J;function Hs(e){let t=0;for(const n of e){if(!(n instanceof Element))continue;const o=getComputedStyle(n)?.position;if(!(o===""||o==="static")){if(ve.has(n)){Qe.add(n);continue}J.observe(n),ve.add(n),Je.add(n),t+=1}}Rs(Qe),Ts(Je),Os(t),Je.clear(),Qe.clear()}const Ms=e=>(J=new ResizeObserver(e),J.observe(document.body),ve.add(document.body),u("Attached%c ResizeObserver%c to body",s.HIGHLIGHT,s.FOREGROUND),{attachObserverToNonStaticElements:Hs,detachObservers:dn(Q,J,ve,Ss),disconnect:()=>{J.disconnect(),u("Detached%c ResizeObserver",s.HIGHLIGHT)}});function $s(e){if(!Array.isArray(e)||e.length===0)return;const t=e[0].target;E(pt,`Element resized <${Zn(t)}>`)}function As(e){return S.resize=Ms($s),S.resize.attachObserverToNonStaticElements(e),S.resize}let yn;function Ls(){const e=document.title;e!==yn&&(yn=e,l(`Title: %c${e}`,s.HIGHLIGHT),e&&y(0,0,Pn,e))}function ks(e){l(`Visible: %c${e}`,s.HIGHLIGHT),i.isHidden=!e,E(yt,"Visibility changed")}function Ns(e){Ce.push(...e.map(t=>t.disconnect))}function Gs(){h("attachObservers");const e=_e(document.documentElement),t=[cs(ps),Es(e),Ao(),As(e),ls(Ls),ds(ks)];Ns(t)}const vn=(e,t,n)=>{if(n!==""){l(`${e}: %c${n}`,s.HIGHLIGHT);for(const o of document.querySelectorAll(n))l(`Applying ${t} to:`,o),o.toggleAttribute(t,!0)}};function Ps({sizeSelector:e,ignoreSelector:t}){return()=>{vn("sizeSelector",ne,e),vn("ignoreSelector",U,t)}}function Cs(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function js(e,t){return t.includes("-")&&(D(`Negative CSS value ignored for ${e}`),t=""),t}function Ke(e,t){t===void 0||t===""||t===Fn||(document.body.style.setProperty(e,t),u(`Set body ${e}: %c${t}`,s.HIGHLIGHT))}function Ds({bodyMarginStr:e,bodyMargin:t}){e===void 0&&(e=`${t}px`),Ke("margin",js("margin",e))}const _s=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function Fs(e){const t=e.getBoundingClientRect(),n=_s();return{x:Math.round(t.left+n.x),y:Math.round(t.top+n.y)}}function xs(e,t){const n=Fs(t);l(`Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),y(n.y,n.x,ct)}function Xe(e){const t=e.split("#")[1]||e,n=decodeURIComponent(t),o=document.getElementById(n)||document.getElementsByName(n)[0];if(o!==void 0){xs(t,o);return}l(`In page link (#${t}) not found in iframe, so sending to parent`),y(0,0,Mn,`#${t}`)}function bn(){const{hash:e,href:t}=window.location;e!==""&&e!=="#"&&Xe(t)}function Bs(){for(const e of document.querySelectorAll('a[href^="#"]'))e.getAttribute("href")!=="#"&&k(e,"click",t=>{t.preventDefault(),Xe(e.getAttribute("href"))})}function Us(){k(window,"hashchange",bn)}function Ws(){setTimeout(bn,zt)}function Vs(){l("Setting up location.hash handlers"),Bs(),Us(),Ws(),i.inPageLinks={findTarget:Xe}}function qs(e){const{mode:t}=c;e?Fe(t)?g(G(5)):Vs():l("In page linking not enabled")}const Zs="important";function Ys(){const e=t=>t.style.setProperty(oe,A,Zs);e(document.documentElement),e(document.body),l("Set HTML & body height: %cauto !important",s.HIGHLIGHT)}const et=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},tt=et(re),be=et($),ze=et(W),Qs=e=>e!==null&&typeof e===jn&&!Array.isArray(e);function Js(e){const{calculateHeight:t,calculateWidth:n}=c;let o,r;return typeof e?.offset===$&&(co(Se,Te),t&&(o=be(e,Se)),n&&(r=be(e,Se))),typeof e?.offsetSize===$&&(t&&(o=be(e,Te)),n&&(r=be(e,Te))),{offsetHeight:o,offsetWidth:r}}function Ks(e){l("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=Js(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:ze(e,"ignoreSelector"),[Yt(3)]:ze(e,Yt(0)),sizeSelector:ze(e,"sizeSelector"),targetOrigin:ze(e,"targetOrigin"),onBeforeResize:tt(e,"onBeforeResize"),onMessage:tt(e,"onMessage"),onReady:tt(e,"onReady")}}function Xs(){const{mode:e}=c;if(Fe(e))return{};const t=window.iframeResizer||window.iFrameResizer;return Qs(t)?Ks(t):{}}const ei=e=>e==="true",zn=e=>t=>t===void 0?void 0:e(t),_=zn(ei),K=zn(Number),ti=e=>({parentId:e[0],bodyMargin:K(e[1]),calculateWidth:_(e[2]),logging:_(e[3]),autoResize:_(e[6]),bodyMarginStr:e[7],heightCalcMode:e[8],bodyBackground:e[9],bodyPadding:e[10],tolerance:K(e[11]),inPageLinks:_(e[12]),widthCalcMode:e[14],mouseEvents:_(e[15]),offsetHeight:K(e[16]),offsetWidth:K(e[17]),calculateHeight:_(e[18]),key:e[19],version:e[20],mode:K(e[21]),logExpand:_(e[23])});function ni(e){const{mode:t}=c;e.forEach(n=>{try{n()}catch(o){if(t<0)throw o;g(`<rb>Error in setup function</>
|
|
51
42
|
<i>iframe-resizer</> detected an error during setup.
|
|
52
43
|
|
|
53
|
-
Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),
|
|
44
|
+
Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),Rt(o)}})}function wn(e){for(const[t,n]of Object.entries(e))n!==void 0&&(c[t]=n)}function oi({logExpand:e,logging:t,parentId:n=""}){no({id:n,enabled:t,expand:e}),h("initReceived"),l(`Initialising iframe v${w} ${window.location.href}`)}function ri(e){h("ready"),Kt(It(e)),l("Initialization complete",(({key:t,key2:n,...o})=>o)(c))}function si({bodyBackground:e,bodyPadding:t,inPageLinks:n,onReady:o}){const r=Io(c),d=[xo,jo,Po,Co,_o,nr,Xt,rr,r?ce:wo,()=>Ds(c),()=>Ke("background",e),()=>Ke("padding",t),r?ce:Ys,Cs,i.applySelectors,()=>qs(n),Or,()=>mr(c),gr,()=>qr(),()=>E(te,"Init message from host page",void 0,void 0,`${w}:${c.mode}`),Gs,j];cr(c),Xo(c),ni(d),ri(o)}function ii(e){i.firstRun&&(wn(ti(e)),oi(c),wn(Xs()),i.applySelectors=Ps(c),si(c))}function ci(e){if(document.readyState==="loading"){l("Page not ready, ignoring init message");return}const t=e.data.slice(bt).split(":");i.target=e.source,i.origin=e.origin,ii(t),i.firstRun=!1,setTimeout(()=>{i.initLock=!1},zt)}const{freeze:ai}=Object,{parse:nt}=JSON,ot=e=>ai(nt(e)),In=e=>y(0,0,`${e}Stop`),we=e=>e.data.slice(e.data.indexOf(":")+1),li=e=>uo(e)?te:e.data.split("]")[1].split(":")[0];function di(e){const t=we(e);l("onMessage called from parent:%c",s.HIGHLIGHT,ot(t)),ie(c.onMessage,nt(t))}function ui(e){const{onPageInfo:t}=i,n=we(e);l("PageInfo received from parent:",ot(n)),t?ie(t,nt(n)):In(st)}function fi(e){const{onParentInfo:t}=i,n=ot(we(e));l("ParentInfo received from parent:",n),t?ie(t,n):In(it)}function mi(){if(i.initLock){l("Page reset ignored by init");return}l("Page size reset by host page"),sn("resetPage")}function hi(){l("Resize requested by host page"),E(Me,"Parent window requested size check")}const En=e=>i.inPageLinks.findTarget(we(e)),On={init:ci,reset:mi,resize:hi,moveToAnchor:En,inPageLink:En,pageInfo:ui,parentInfo:fi,message:di};function pi(e){const{firstRun:t}=i,n=li(e);switch(h(n),!0){case n in On:On[n](e);break;case(t&&lo()):D(`Ignored message of type "${n}". Received before initialization.`);break;default:D(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const Ie=Ge(e=>{ao(e)&&pi(e)});function gi(){if("iframeChildListener"in window){D("Already setup");return}window.iframeChildListener=(t=>setTimeout(()=>Ie({data:t,sameOrigin:!0}))),h("listen"),k(window,Oe,Ie),k(document,dt,kt),kt();function e(t){return Ie(t),i.win}try{top?.document?.getElementById("banner")&&(i.win={},window.mockMsgListener=e,$t(window,Oe,Ie),typeof window.define=="function"&&window.define([],()=>e))}catch{}}typeof window!==Dn&&gi()}));
|
|
54
45
|
//# sourceMappingURL=index.umd.js.map
|