@iframe-resizer/core 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/index.cjs.js +14 -14
- package/index.cjs.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.esm.js +530 -456
- package/index.esm.js.map +1 -1
- package/index.umd.js +17 -17
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +7 -7
package/index.umd.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
(function(r
|
|
1
|
+
(function(b,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("auto-console-group")):typeof define=="function"&&define.amd?define(["exports","auto-console-group"],r):(b=typeof globalThis<"u"?globalThis:b||self,r(b.connectResizer={},b.acg))})(this,(function(b,r){"use strict";const G="6.0.0-beta.2",te="iframeResizer",Je="[iFrameResizerChild]Ready",ne="autoResize",Ye="beforeUnload",Xe="close",Ke="inPageLink",H="init",oe="iframeReady",Qe="lazy",F="load",M="message",et="mouseenter",tt="mouseleave",ie="onload",se="pageInfo",re="parentInfo",nt="pageInfoStop",ot="parentInfoStop",D="reset",B="resize",it="scrollBy",st="scrollTo",rt="scrollToOffset",lt="title",ct="height",at="width",ut="offset",ft="offsetSize",le="scroll",pt="hidden",ht="child",W="parent",U="string",dt="number",ce="object",ae="function",V="auto",yt="font-weight: bold;",ue="none",fe="both",P="vertical",pe="horizontal",gt="omit",mt=M.length,N="[iFrameSizer]",q=N.length,bt=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),he=Object.freeze({[ie]:1,[H]:1,[oe]:1}),R="expanded",k="collapsed",Z=0,J=1,Y=2,vt=Object.freeze({[R]:1,[k]:1}),de="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",ye=e=>typeof e===ce&&e!==null,X=e=>typeof e===U;function zt(e){if(!ye(e))return!1;try{return e.tagName==="IFRAME"||e instanceof HTMLIFrameElement}catch{return!1}}const wt=(e,...t)=>setTimeout(()=>e(...t),0),It=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},Et=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),$=(e,t)=>Object.hasOwn?Object.hasOwn(e,t):Et(e,t),Tt=e=>e,Ot=e=>e.charAt(0).toUpperCase()+e.slice(1),Lt=e=>e?.__esModule?e.default:e,Ht=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${Ot(t)}`)},Rt=e=>(t,n="renamed to")=>(o,s,c="",l="")=>e(l,`<rb>Deprecated ${t}(${o.replace("()","")})</>
|
|
2
2
|
|
|
3
|
-
The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${s}</>. ${c}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`),
|
|
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>${s}</>. ${c}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`),ge={br:`
|
|
4
|
+
`,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},kt=Object.keys(ge),St=new RegExp(`<(${kt.join("|")})>`,"gi"),Mt=(e,t)=>ge[t]??"",$t=e=>e.replace(St,Mt),At=e=>e.replaceAll("<br>",`
|
|
5
|
+
`).replaceAll(/<\/?[^>]+>/gi,""),me=e=>t=>e(X(t)?window.chrome?$t(t):At(t):t),i={},be=Lt(r);let K=!0;const jt=be({expand:!1,label:W}),Gt=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`,Pt=e=>i[e]?i[e].log:K;function Nt({enabled:e,expand:t,iframeId:n}){const o=be({expand:t,label:Gt(n)});K=e,i[n]||(i[n]={console:o})}const I=e=>(t,...n)=>i[t]?i[t].console[e](...n):jt[e](...n),ve=e=>(t,...n)=>Pt(t)===!0?I(e)(t,...n):null,u=ve("log"),m=u,Ct=ve("debug"),z=I("warn"),_t=I("error"),v=I("event"),xt=I("purge"),Ft=I("endAutoGroup"),ze=I("errorBoundary");function Dt(e,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,K||t<1?yt:r.NORMAL))}const Bt=e=>(...t)=>[`${te}(${e})`,...t].join(" "),Wt=me(Tt),g=(e,...t)=>i[e]?i[e].console.warn(...t.map(Wt)):queueMicrotask(()=>{const n=me(Bt(e));console?.warn(...t.map(n))}),Ut=Rt(g)("Option"),C=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:P,firstRun:!0,inPageLinks:!1,heightCalculationMethod:V,id:"iFrameResizer",log:!1,logExpand:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,waitForLoad:!1,warningTimeout:5e3,widthCalculationMethod:V,onBeforeClose:()=>!0,onAfterClose(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{typeof i[e.id].onInit===ae&&(Ut("init()","onReady()","",e.id),i[e.id].onInit(e))},onResized(){},onScroll:()=>!0});let we=0;function Vt(e){const t=e?.id||C.id+we++;return document.getElementById(t)===null?t:`${t}${we++}`}function qt(e,t){let{id:n}=e;if(n&&!X(n))throw new TypeError("Invalid id for iFrame. Expected String");return(!n||n==="")&&(n=Vt(t),e.id=n,v(n,"assignId"),u(n,`Added missing iframe ID: ${n} (${e.src})`)),n}function Zt(e){const{search:t}=window.location;if(t.includes("ifrlog"))switch(new URLSearchParams(t).get("ifrlog")){case String(Z):{e.log=!1;break}case R:case String(Y):{e.log=R;break}case k:case String(J):{e.log=k;break}default:e.log=k}}const A=(e,t,n,o)=>e.addEventListener(t,n,o||!1),Ie=(e,t,n)=>e.removeEventListener(t,n,!1),Jt=e=>e.split(":").filter((t,n)=>n!==19).join(":");function Yt(e,t,n){function o(f){const p=e in he?Jt(t):t;m(n,f,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),m(n,`Message data: %c${p}`,r.HIGHLIGHT)}const{iframe:s,postMessageTarget:c,sameOrigin:l,targetOrigin:a}=i[n];if(l)try{s.contentWindow.iframeChildListener(N+t),o(`Sending message to iframe %c${n}%c via same origin%c`);return}catch{e in he?(i[n].sameOrigin=!1,u(n,"New iframe does not support same origin")):z(n,"Same origin messaging failed, falling back to postMessage")}o(`Sending message to iframe: %c${n}%c targetOrigin: %c${a.join(", ")}`);for(const f of a)c.postMessage(N+t,f)}function E(e,t,n){if(v(n,e),!i[n]?.postMessageTarget){z(n,"Iframe not found");return}Yt(e,t,n)}const Xt=(e,t)=>Object.values(i).filter(({autoResize:n,firstRun:o})=>n&&!o).forEach(({iframe:n})=>E(e,t,n.id));function Kt(){document.hidden!==!0&&Xt("tabVisible",B)}function Qt(e){if(e.boxSizing!=="border-box")return 0;const t=e.paddingTop?parseInt(e.paddingTop,10):0,n=e.paddingBottom?parseInt(e.paddingBottom,10):0;return t+n}function en(e){if(e.boxSizing!=="border-box")return 0;const t=e.borderTopWidth?parseInt(e.borderTopWidth,10):0,n=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0;return t+n}function tn(e){const t=e.slice(q).split(":"),n=t[1]?Number(t[1]):0,o=i[t[0]]?.iframe,s=o?getComputedStyle(o):null,c=s?Qt(s)+en(s):0,l={iframe:o,id:t[0],height:n+c,width:Number(t[2]),type:t[3],msg:t[4],message:t[4]};return t[5]&&(l.mode=t[5]),l}const nn={true:1,false:1,undefined:1};function on(e){const{id:t,msg:n,iframe:o}=e,s=zt(o);return s||(u(t,`Received: %c${n}`,r.HIGHLIGHT),z(t,"The target iframe was not found.")),s}function sn(e,t){const{id:n}=e,{data:o,origin:s}=t;if("sameOrigin"in t&&t.sameOrigin)return!0;const l=i[n]?.checkOrigin;function a(){function f(){u(n,`Checking connection is from allowed list of origins: %c${l}`,r.HIGHLIGHT);for(const h of l)if(h===s)return!0;return!1}function p(){const h=i[n]?.remoteHost;return u(n,`Checking connection is from: %c${h}`,r.HIGHLIGHT),s===h}return l.constructor===Array?f():p()}if(l&&`${s}`!="null"&&!a())throw new Error(`Unexpected message received from: ${s} for ${n}. Message was: ${o}. This error can be disabled by setting the checkOrigin: false option or by providing an array of trusted domains.`);return!0}const rn=e=>N===`${e}`.slice(0,q)&&e.slice(q).split(":")[0]in i;function ln(e){const{id:t,type:n}=e,o=n in nn;return o&&u(t,"Ignoring init message from meta parent page"),o}function cn(e){try{i[e].sameOrigin=!!i[e]?.iframe?.contentWindow?.iframeChildListener}catch{i[e].sameOrigin=!1}u(e,`sameOrigin: %c${i[e].sameOrigin}`,r.HIGHLIGHT)}function an(e,t){if(t!==G){if(t===void 0){g(e,`<rb>Legacy version detected in iframe</>
|
|
6
6
|
|
|
7
7
|
Detected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.
|
|
8
8
|
|
|
9
9
|
See <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.
|
|
10
|
-
`);return}u(e,`Version mismatch (Child: %c${t}%c !== Parent: %c${v})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT)}}function E(e,t,n){if(!i[e])return null;const o=i[e][t];if(typeof o!==ie)throw new TypeError(`${t} on iframe[${e}] is not a function`);if(t!=="onBeforeClose"&&t!=="onScroll")return dt(o,n);try{return o(n)}catch(s){return console.error(s),z(e,`Error in ${t} callback`),null}}function en(e,t){const{id:n,iframe:o}=e;u(n,`onMessage passed: {iframe: %c${n}%c, message: %c${t}%c}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT,r.FOREGROUND),E(n,"onMessage",{iframe:o,message:JSON.parse(t)})}function G(e,t){const{lastMessage:n}=i[e];return n.slice(n.indexOf(":")+at+t)}function ye(e,t){const{id:n,iframe:o,height:s,type:c,width:a}=t;let l={x:0,y:0};if(a===0&&s===0){const f=G(n,9).split(":");l={x:f[1],y:f[0]}}else l={x:a,y:s};E(n,e,{iframe:o,screenX:Number(l.x),screenY:Number(l.y),type:c})}const p={position:null,version:v};function ve(){p.position=null}const tn=()=>p.position;function nn(e){p.position=e}function we(e){return p.position===null&&(p.position={x:window.scrollX,y:window.scrollY}),u(e,`Get page position: %c${p.position.x}%c, %c${p.position.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),p.position}function ze(e){p.position!==null&&(window.scrollTo(p.position.x,p.position.y),m(e,`Set page position: %c${p.position.x}%c, %c${p.position.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),ve())}function Ie(e,t){const{id:n}=t,o=`${t[e]}px`;i[n].iframe.style[e]=o,m(n,`Set ${e}: %c${o}`,r.HIGHLIGHT)}function Ee(e){const{id:t}=e,{sizeHeight:n,sizeWidth:o}=i[t];n&&Ie(et,e),o&&Ie(tt,e)}function Te(e){const{id:t}=e;Ee(e),ze(t),E(t,"onResized",e)}function Oe(e){const{id:t}=e;u(t,"Disconnected from iframe"),delete i[t],delete e.iframeResizer}function He(e){const{id:t}=e;if(E(t,"onBeforeClose",t)===!1){u(t,"Close iframe cancelled by onBeforeClose");return}u(t,`Removing iFrame: %c${t}`,r.HIGHLIGHT);try{e.parentNode&&e.remove()}catch(n){z(t,n)}E(t,"onAfterClose",t),Oe(e)}function Re(e){const{id:t,type:n}=e;u(t,`Size reset requested by ${n===R?"parent page":"child page"}`),we(t),Ee(e),I(x,x,t)}const Le=(e,t)=>{const n={};return(o,s)=>{const{iframe:c}=i[s];function a(f,d){n[d]||(f(),n[d]=requestAnimationFrame(()=>{n[d]=null}))}function l(){I(`${o} (${e})`,`${e}:${t(c)}`,s)}a(l,s)}},Me=e=>t=>{e in i[t]&&(i[t][e](),delete i[t][e])},Se=(e,t)=>n=>{let o=!1;const s=h=>()=>{i[n]?(!o||o===h)&&(e(h,n),o=h,requestAnimationFrame(()=>{o=!1})):f()},c=s(ne),a=s("resize window");function l(h,H){u(n,`${h}listeners for send${t}`),H(window,ne,c),H(window,C,a)}function f(){y(n,`stop${t}`),l("Remove ",be),g.disconnect(),O.disconnect(),i[n]&&be(i[n].iframe,P,f)}function d(){l("Add ",S),g.observe(document.body),O.observe(i[n].iframe)}const g=new ResizeObserver(s("pageObserver")),O=new ResizeObserver(s("iframeObserver"));i[n]&&(i[n][`stop${t}`]=f,S(i[n].iframe,P,f),d())};function on(e){const t=document.body.getBoundingClientRect(),n=e.getBoundingClientRect(),{scrollY:o,scrollX:s,innerHeight:c,innerWidth:a}=window,{clientHeight:l,clientWidth:f}=document.documentElement;return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(l,c||0),clientWidth:Math.max(f,a||0),offsetTop:Math.trunc(n.top-t.top),offsetLeft:Math.trunc(n.left-t.left),scrollTop:o,scrollLeft:s,documentHeight:l,documentWidth:f,windowHeight:c,windowWidth:a})}const sn=Le(ee,on),rn=Se(sn,"PageInfo"),cn=Me("stopPageInfo");function an(e){const{scrollWidth:t,scrollHeight:n}=document.documentElement,{width:o,height:s,offsetLeft:c,offsetTop:a,pageLeft:l,pageTop:f,scale:d}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:o,height:s,offsetLeft:c,offsetTop:a,pageLeft:l,pageTop:f,scale:d}})}const ln=Le(te,an),un=Se(ln,"ParentInfo"),fn=Me("stopParentInfo");function $e(e){const t=e.getBoundingClientRect(),n=we(e.id);return{x:Number(t.left)+Number(n.x),y:Number(t.top)+Number(n.y)}}function ke(e){const{x:t,y:n}=tn(),o=i[e]?.iframe;if(E(e,"onScroll",{iframe:o,top:n,left:t,x:t,y:n})===!1){ve();return}ze(e)}function dn(e){const{id:t,height:n,width:o}=e,s=window.parentIframe||window.parentIFrame||window;m(t,`scrollBy: x: %c${o}%c y: %c${n}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),s.scrollBy(o,n)}const Ae=e=>t=>{function n(h){nn(h),ke(c)}function o(h,H){h[`scrollTo${e?"Offset":""}`](H.x,H.y)}const s=h=>({x:f+h.x,y:l+h.y}),{id:c,iframe:a,height:l,width:f}=t,d=e?$e(a):{x:0,y:0},g=s(d),O=window.parentIframe||window.parentIFrame;m(c,`Reposition requested (offset x:%c${d.x}%c y:%c${d.y})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),O?o(O,g):n(g)},pn=Ae(!1),hn=Ae(!0);function gn(e,t,n){const{x:o,y:s}=$e(n);m(e,`Moving to in page link: %c#${t}`,r.HIGHLIGHT),p.position={x:o,y:s},ke(e),window.location.hash=t}function mn(e,t){const n=window.parentIframe||window.parentIFrame;if(!n){u(e,`In page link #${t} not found`);return}n.moveToAnchor(t)}function bn(e,t){const n=t.split("#")[1]||"",o=decodeURIComponent(n),s=document.getElementById(o)||document.getElementsByName(o)[0];if(s){gn(e,n,s);return}if(window.top===window.self){u(e,`In page link #${n} not found`);return}mn(e,n)}function yn(e){const t=i[e]?.iframe?.title;return t===""||t===void 0}function vn(e,t){i[e]?.syncTitle&&(i[e].iframe.title=t,m(e,`Set iframe title attribute: %c${t}`,r.HIGHLIGHT))}const Ge=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,s=0;s<e.length;s++)o=e.codePointAt(s),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)},T=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),j=["spjluzl","rlf","clyzpvu","rlf2"],wn=["<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."],zn=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],je=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl"].map((e,t)=>[e,Math.max(0,t-1)])),N=e=>T(wn[e]),In=e=>T(zn[e]),En=e=>{const t=e[T(j[0])]||e[T(j[1])]||e[T(j[2])]||e[T(j[3])];if(!t)return-1;const n=t.split("-");let o=(function(s=""){let c=-2;const a=Ge(T(s));return a in je&&(c=je[a]),c>4?c-4:c})(n[0]);return o===0||(s=>s[2]===Ge(s[0]+s[1]))(n)||(o=-2),o};let Z=!1,Ne=!1;function Pe(e,t=-3){if(Z)return;const n=Math.max(i[e].mode,t);if(n>i[e].mode&&(i[e].mode=n),n<0)throw $t(e),i[e].vAdvised||b(e||"Parent",`${N(n+2)}${N(2)}`),i[e].vAdvised=!0,N(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");n>0&&Ne||At(`v${v} (${In(n)})`,n),n<1&&b("Parent",N(3)),Z=!0}function Tn(e){if(Z)return;const{mode:t}=i[e];t!==-1&&Pe(e,t)}function On(e){e?.log===-1&&(e.log=!1,Ne=!0)}function Hn(e,t){i[e]&&(u(e,`First run for ${e}`),Pe(e,t!==void 0?Number(t):void 0),i[e].firstRun=!1)}function Rn(e){const{height:t,id:n,iframe:o,mode:s,message:c,type:a,width:l}=e,{lastMessage:f}=i[n];switch(i[n]?.firstRun&&Hn(n,s),u(n,`Received: %c${f}`,r.HIGHLIGHT),a){case X:i[n].autoResize=JSON.parse(G(n,9));break;case We:m(n,"Ready state reset"),i[n].initialised=!1;break;case Be:He(o);break;case De:bn(n,G(n,9));break;case R:Te(e),Kt(n),Qt(n,c),i[n].initialised=!0,E(n,"onReady",o);break;case L:en(e,G(n,6));break;case Ve:ye("onMouseEnter",e);break;case qe:ye("onMouseLeave",e);break;case ee:rn(n);break;case te:un(n);break;case Ze:cn(n);break;case Je:fn(n);break;case x:Re(e);break;case Ye:dn(e);break;case Xe:pn(e);break;case Ke:hn(e);break;case Qe:vn(n,c);break;default:if(l===0&&t===0){z(n,`Unsupported message received (${a}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);return}if(l===0||t===0){u(n,"Ignoring message with 0 height or width");return}if(document.hidden){u(n,"Page hidden - ignored resize request");return}Te(e)}}const Ln=e=>({initChild:t,postMessageTarget:n})=>{e===n&&t()},Mn=e=>Object.values(i).forEach(Ln(e));function xe(e){const t=e.data;if(t===_e){Mn(e.source);return}if(!Yt(t)){if(typeof t!==_)return;y(F,"ignoredMessage"),Mt(F,t);return}const n=Vt(t),{id:o,type:s}=n;switch(y(o,s),!0){case!i[o]:throw new Error(`${s} No settings for ${o}. Message was: ${t}`);case!Zt(n):case Xt(n):case!Jt(n,e):return;default:i[o].lastMessage=e.data,ge(o,Rn)(n)}}const Sn=pt(()=>{S(window,L,xe),S(document,"visibilitychange",Bt),window.iframeParentListener=e=>setTimeout(()=>xe({data:e,sameOrigin:!0}))}),Ce={};function $n(e){if(Ce[e]===!0)return!1;const t=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(t.length<=1)return!0;Ce[e]=!0;const n=Array.from(t).flatMap(o=>[`
|
|
10
|
+
`);return}u(e,`Version mismatch (Child: %c${t}%c !== Parent: %c${G})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT)}}function T(e,t,n){if(!i[e])return null;const o=i[e][t];if(typeof o!==ae)throw new TypeError(`${t} on iframe[${e}] is not a function`);if(t!=="onBeforeClose"&&t!=="onScroll")return wt(o,n);try{return o(n)}catch(s){return console.error(s),z(e,`Error in ${t} callback`),null}}function un(e,t){const{id:n,iframe:o}=e;u(n,`onMessage passed: {iframe: %c${n}%c, message: %c${t}%c}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT,r.FOREGROUND),T(n,"onMessage",{iframe:o,message:JSON.parse(t)})}function _(e,t){const{lastMessage:n}=i[e];return n.slice(n.indexOf(":")+mt+t)}function Ee(e,t){const{id:n,iframe:o,height:s,type:c,width:l}=t;let a={x:0,y:0};if(l===0&&s===0){const f=_(n,9).split(":");a={x:f[1],y:f[0]}}else a={x:l,y:s};T(n,e,{iframe:o,screenX:Number(a.x),screenY:Number(a.y),type:c})}const d={position:null,version:G};function Te(){d.position=null}const fn=()=>d.position;function pn(e){d.position=e}function Oe(e){return d.position===null&&(d.position={x:window.scrollX,y:window.scrollY}),u(e,`Get page position: %c${d.position.x}%c, %c${d.position.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),d.position}function Le(e){d.position!==null&&(window.scrollTo(d.position.x,d.position.y),m(e,`Set page position: %c${d.position.x}%c, %c${d.position.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),Te())}function He(e,t){const{id:n}=t,o=`${t[e]}px`;i[n].iframe.style[e]=o,m(n,`Set ${e}: %c${o}`,r.HIGHLIGHT)}function Re(e){const{id:t}=e,{sizeHeight:n,sizeWidth:o}=i[t];n&&He(ct,e),o&&He(at,e)}function ke(e){const{id:t}=e;Re(e),Le(t),T(t,"onResized",e)}function Se(e){const{id:t}=e;u(t,"Disconnected from iframe"),delete i[t],delete e.iframeResizer}function Me(e){const{id:t}=e;if(T(t,"onBeforeClose",t)===!1){u(t,"Close iframe cancelled by onBeforeClose");return}u(t,`Removing iFrame: %c${t}`,r.HIGHLIGHT);try{e.parentNode&&e.remove()}catch(n){z(t,n)}T(t,"onAfterClose",t),Se(e)}function $e(e){const{id:t,type:n}=e;u(t,`Size reset requested by ${n===H?"parent page":"child page"}`),Oe(t),Re(e),E(D,D,t)}const Ae=(e,t)=>{const n={};return(o,s)=>{const{iframe:c}=i[s];function l(f,p){n[p]||(f(),n[p]=requestAnimationFrame(()=>{n[p]=null}))}function a(){E(`${o} (${e})`,`${e}:${t(c)}`,s)}l(a,s)}},je=e=>t=>{e in i[t]&&(i[t][e](),delete i[t][e])},Ge=((e,t)=>n=>{let o=!1;const s=y=>()=>{i[n]?(!o||o===y)&&(e(y,n),o=y,requestAnimationFrame(()=>{o=!1})):h()},c=s(le),l=s("resize window"),a=new ResizeObserver(s("pageObserver")),f=new ResizeObserver(s("iframeObserver"));function p(y,L){u(n,`${y}listeners for send${t}`),L(window,le,c),L(window,B,l)}function h(){v(n,`stop${t}`),p("Remove ",Ie),a.disconnect(),f.disconnect(),i[n]&&Ie(i[n].iframe,F,h)}function S(){p("Add ",A),a.observe(document.body),f.observe(i[n].iframe)}i[n]&&(i[n][`stop${t}`]=h,A(i[n].iframe,F,h),S())});function hn(e){const t=document.body.getBoundingClientRect(),n=e.getBoundingClientRect(),{scrollY:o,scrollX:s,innerHeight:c,innerWidth:l}=window,{clientHeight:a,clientWidth:f}=document.documentElement;return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(a,c||0),clientWidth:Math.max(f,l||0),offsetTop:Math.trunc(n.top-t.top),offsetLeft:Math.trunc(n.left-t.left),scrollTop:o,scrollLeft:s,documentHeight:a,documentWidth:f,windowHeight:c,windowWidth:l})}const dn=Ae(se,hn),yn=Ge(dn,"PageInfo"),gn=je("stopPageInfo");function mn(e){const{scrollWidth:t,scrollHeight:n}=document.documentElement,o=typeof window<"u"&&window.visualViewport?window.visualViewport:{},{width:s=0,height:c=0,offsetLeft:l=0,offsetTop:a=0,pageLeft:f=0,pageTop:p=0,scale:h=1}=o;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:s,height:c,offsetLeft:l,offsetTop:a,pageLeft:f,pageTop:p,scale:h}})}const bn=Ae(re,mn),vn=Ge(bn,"ParentInfo"),zn=je("stopParentInfo");function Pe(e){const t=e.getBoundingClientRect(),n=Oe(e.id);return{x:Number(t.left)+Number(n.x),y:Number(t.top)+Number(n.y)}}function Ne(e){const{x:t,y:n}=fn(),o=i[e]?.iframe;if(T(e,"onScroll",{iframe:o,top:n,left:t,x:t,y:n})===!1){Te();return}Le(e)}function wn(e){const{id:t,height:n,width:o}=e,s=window.parentIframe||window.parentIFrame||window;m(t,`scrollBy: x: %c${o}%c y: %c${n}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),s.scrollBy(o,n)}const Ce=e=>t=>{const{id:n,iframe:o,height:s,width:c}=t;function l(y){pn(y),Ne(n)}function a(y,L){y[`scrollTo${e?"Offset":""}`](L.x,L.y)}const f=y=>({x:c+y.x,y:s+y.y}),p=e?Pe(o):{x:0,y:0},h=f(p),S=window.parentIframe||window.parentIFrame;m(n,`Reposition requested (offset x:%c${p.x}%c y:%c${p.y})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),S?a(S,h):l(h)},In=Ce(!1),En=Ce(!0);function Tn(e,t,n){const{x:o,y:s}=Pe(n);m(e,`Moving to in page link: %c#${t}`,r.HIGHLIGHT),d.position={x:o,y:s},Ne(e),window.location.hash=t}function On(e,t){const n=window.parentIframe||window.parentIFrame;if(!n){u(e,`In page link #${t} not found`);return}n.moveToAnchor(t)}function Ln(e,t){const n=t.split("#")[1]||"",o=decodeURIComponent(n),s=document.getElementById(o)||document.getElementsByName(o)[0];if(s){Tn(e,n,s);return}if(window.top===window.self){u(e,`In page link #${n} not found`);return}On(e,n)}function Hn(e){const t=i[e]?.iframe?.title;return t===""||t===void 0}function Rn(e,t){i[e]?.syncTitle&&(i[e].iframe.title=t,m(e,`Set iframe title attribute: %c${t}`,r.HIGHLIGHT))}const x=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,s=0;s<e.length;s++)o=e.codePointAt(s),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)},w=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),kn=new Date,_e=e=>new Set(Array.from({length:9},e)),xe=" - lewpylk",j=["spjluzl","rlf","clyzpvu","rlf2","nlaMbssFlhy"],Sn=["<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."],Mn=e=>[e[0],...e.slice(1).map(t=>`${t}${xe}`),`${e[4]}${xe}`,...e.slice(1)],$n=Mn(["NWSc3","zvsv","wyv","ibzpulzz","VLT"]),Fe=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","1foobarqaz","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl","igb1wzrjqr"].map((e,t)=>[e,Math.max(0,t-1)])),De=kn[w(j[4])](),An=_e((e,t)=>x(`${De+t}`)),jn=_e((e,t)=>x(`${De-++t}`)),Gn=e=>An.has(e)?9:jn.has(e)?5:-2,O=e=>w(Sn[e]),Pn=e=>w($n[e]),Nn=e=>{const t=e[w(j[0])]||e[w(j[1])]||e[w(j[2])]||e[w(j[3])];if(!t)return-1;const n=t.split("-");let o=(function(s="",c=""){let l=-2;const a=x(w(s));return a in Fe&&(l=Fe[a]),l===9?Gn(c):l})(...n);return o===0||(s=>s[2]===x(s[0]+s[1]))(n)||(o=-2),o};let Q=!1,Be=!1;function We(e,t=-3){if(Q)return;const n=Math.max(i[e].mode,t);if(n>i[e].mode&&(i[e].mode=n),n<0)throw xt(e),i[e].vAdvised||g(e||"Parent",`${O(n+2)}${O(2)}`),i[e].vAdvised=!0,O(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");switch(n>5&&Be||Dt(`v${G} (${Pn(n)})`,n),n){case 1:case 2:case 3:g("Parent",O(6));break;case 4:g("Parent",O(7));break;case 5:g("Parent",O(8));break;default:n<1&&g("Parent",O(3))}Q=!0}function Cn(e){if(Q)return;const{mode:t}=i[e];t>5&&We(e,t)}function _n(e){e?.log===-1&&(e.log=!1,Be=!0)}function xn(e,t){i[e]&&(u(e,`First run for ${e}`),We(e,t===void 0?void 0:Number(t)),i[e].firstRun=!1)}function Fn(e){const{height:t,id:n,iframe:o,mode:s,message:c,type:l,width:a}=e,{lastMessage:f}=i[n];switch(i[n]?.firstRun&&xn(n,s),u(n,`Received: %c${f}`,r.HIGHLIGHT),l){case ne:i[n].autoResize=JSON.parse(_(n,9));break;case Ye:m(n,"Ready state reset"),i[n].initialised=!1;break;case Xe:Me(o);break;case Ke:Ln(n,_(n,9));break;case H:ke(e),cn(n),an(n,c),i[n].initialised=!0,T(n,"onReady",o);break;case M:un(e,_(n,6));break;case et:Ee("onMouseEnter",e);break;case tt:Ee("onMouseLeave",e);break;case se:yn(n);break;case re:vn(n);break;case nt:gn(n);break;case ot:zn(n);break;case D:$e(e);break;case it:wn(e);break;case st:In(e);break;case rt:En(e);break;case lt:Rn(n,c);break;default:if(a===0&&t===0){z(n,`Unsupported message received (${l}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);return}if(a===0||t===0){u(n,"Ignoring message with 0 height or width");return}if(document.hidden){u(n,"Page hidden - ignored resize request");return}ke(e)}}const Dn=e=>({initChild:t,postMessageTarget:n})=>{e===n&&t()},Bn=e=>Object.values(i).forEach(Dn(e));function Ue(e){const t=e.data;if(t===Je){Bn(e.source);return}if(!rn(t)){if(typeof t!==U)return;v(W,"ignoredMessage"),Ct(W,t);return}const n=tn(t),{id:o,type:s}=n;switch(v(o,s),!0){case!i[o]:throw new Error(`${s} No settings for ${o}. Message was: ${t}`);case!on(n):case ln(n):case!sn(n,e):return;default:i[o].lastMessage=e.data,ze(o,Fn)(n)}}const Wn=It(()=>{A(window,M,Ue),A(document,"visibilitychange",Kt),window.iframeParentListener=e=>setTimeout(()=>Ue({data:e,sameOrigin:!0}))}),Ve={};function Un(e){if(Ve[e]===!0)return!1;const t=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(t.length<=1)return!0;Ve[e]=!0;const n=Array.from(t).flatMap(o=>[`
|
|
11
11
|
`,o,`
|
|
12
|
-
`]);return
|
|
12
|
+
`]);return g(e,`<rb>Duplicate ID attributes detected</>
|
|
13
13
|
|
|
14
14
|
The <b>${e}</> ID is not unique. Having multiple iframes on the same page with the same ID causes problems with communication between the iframe and parent page. Please ensure that the ID of each iframe has a unique value.
|
|
15
15
|
|
|
16
16
|
Found <bb>${t.length}</> iframes with the <b>${e}</> ID:`,...n,`
|
|
17
|
-
`),!1}const
|
|
17
|
+
`),!1}const Vn=`<rb>Deprecated Method Name</>
|
|
18
18
|
|
|
19
|
-
The <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${
|
|
19
|
+
The <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${de}`,qn=`<rb>Deprecated Method</>
|
|
20
20
|
|
|
21
|
-
Use of the <b>resize()</> method from the parent page is deprecated and will be removed in a future version of <i>iframe-resizer</>. As there are no longer any edge cases that require triggering a resize from the parent page, it is recommended to remove this method from your code.`;function
|
|
21
|
+
Use of the <b>resize()</> method from the parent page is deprecated and will be removed in a future version of <i>iframe-resizer</>. As there are no longer any edge cases that require triggering a resize from the parent page, it is recommended to remove this method from your code.`;function Zn(e){if(i[e]){const{iframe:t}=i[e],n={close:Me.bind(null,t),disconnect:Se.bind(null,t),moveToAnchor(o){Ht(o,U,"moveToAnchor(anchor) anchor"),E("Move to anchor",`moveToAnchor:${o}`,e)},removeListeners(){g(e,Vn),this.disconnect()},resize(){g(e,qn),E("Window resize",B,e)},sendMessage(o){o=JSON.stringify(o),E(M,`${M}:${o}`,e)}};t.iframeResizer=n,t.iFrameResizer=n}}const Jn="8",Yn="32",Xn=ht,Kn=!0;function Qn(e){const{autoResize:t,bodyBackground:n,bodyMargin:o,bodyPadding:s,heightCalculationMethod:c,inPageLinks:l,license:a,log:f,logExpand:p,mouseEvents:h,offsetHeight:S,offsetWidth:y,mode:L,sizeHeight:So,sizeWidth:Mo,tolerance:$o,widthCalculationMethod:Ao}=i[e];return[e,Jn,Mo,f,Yn,Kn,t,o,c,n,s,$o,l,Xn,Ao,h,S,y,So,a,d.version,L,"",p].join(":")}const eo="0";function to(e){const{bodyMargin:t}=i[e];(typeof t===dt||t===eo)&&(i[e].bodyMargin=`${t}px`)}const no=e=>{try{return new URL(e).origin}catch{return null}},oo=e=>typeof e===ce&&e.length>0&&!(e.contains("allow-scripts")&&e.contains("allow-same-origin"));function io(e,t){const{checkOrigin:n,iframe:{src:o,sandbox:s},initialisedFirstPage:c,waitForLoad:l}=t[e],a=no(o);v(e,"noResponse"),g(e,`<rb>No response from iframe</>
|
|
22
22
|
|
|
23
23
|
The iframe (<i>${e}</>) has not responded within ${t[e].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.
|
|
24
|
-
${n&&
|
|
25
|
-
The <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${
|
|
26
|
-
`:""}${
|
|
24
|
+
${n&&a?`
|
|
25
|
+
The <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${a}</>, then the connection to the iframe may be blocked by the browser. To disable this option, set <b>checkOrigin</> to <bb>false</> or an array of allowed origins. See <u>https://iframe-resizer.com/checkorigin</> for more information.
|
|
26
|
+
`:""}${l&&!c?`
|
|
27
27
|
The <b>waitForLoad</> option is currently set to <bb>true</>. If the iframe loads before <i>iframe-resizer</> runs, this option will prevent <i>iframe-resizer</> initialising. To disable this option, set <b>waitForLoad</> to <bb>false</>.
|
|
28
|
-
`:""}${
|
|
28
|
+
`:""}${oo(s)?`
|
|
29
29
|
The iframe has the <b>sandbox</> attribute, please ensure it contains both the <bb>allow-same-origin</> and <bb>allow-scripts</> values.
|
|
30
30
|
`:""}
|
|
31
31
|
This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.
|
|
32
|
-
`)}function
|
|
32
|
+
`)}function so(e,t){function n(){if(t[e]===void 0)return;const{initialised:c,loadErrorShown:l}=t[e];if(t[e].msgTimeout=void 0,c){t[e].initialisedFirstPage=!0;return}l||(t[e].loadErrorShown=!0,io(e,t))}const{msgTimeout:o,warningTimeout:s}=t[e];s&&(o&&clearTimeout(o),t[e].msgTimeout=setTimeout(n,s))}const ro=1,lo=e=>e.loading===Qe,co=e=>e===H;function ao(e){i[e]?.heightCalculationMethod in bt&&$e({id:e,iframe:i[e].iframe,height:1,width:1,type:H})}function uo(e,t){A(e,F,()=>setTimeout(t,ro))}const fo=e=>{const{src:t,srcdoc:n}=e;return!n&&(t==null||t===""||t==="about:blank")};function po(e,t){const{iframe:n,waitForLoad:o}=i[e];if(o!==!0){if(fo(n)){setTimeout(()=>{v(e,"noContent"),m(e,"No content detected in the iframe, delaying initialisation")});return}setTimeout(t)}}function ho(e,t){const n=s=>()=>{if(!i[e])return;const{firstRun:c,iframe:l}=i[e];E(s,t,e),co(s)&&lo(l)||so(e,i),c||ao(e)},{iframe:o}=i[e];i[e].initChild=n(oe),uo(o,n(ie)),po(e,n(H))}function yo(e,t){return t?(("sizeWidth"in t||"sizeHeight"in t||ne in t)&&g(e,`<rb>Deprecated Option</>
|
|
33
33
|
|
|
34
|
-
The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${
|
|
35
|
-
`),t):{}}function
|
|
34
|
+
The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${P}</>, <bb>${pe}</>, <bb>${fe}</> or <bb>${ue}</>.
|
|
35
|
+
`),t):{}}function go(e){i[e].warningTimeout||m(e,"warningTimeout:%c disabled",r.HIGHLIGHT)}function mo(e,{offset:t,offsetSize:n}){const o=n||t;o&&(i[e].direction===P?(i[e].offsetHeight=o,u(e,`Offset height: %c${o}`,r.HIGHLIGHT)):(i[e].offsetWidth=o,u(e,`Offset width: %c${o}`,r.HIGHLIGHT)))}function bo(e){const{direction:t}=i[e];switch(t){case P:break;case pe:i[e].sizeHeight=!1;case fe:i[e].sizeWidth=!0;break;case ue:i[e].sizeWidth=!1,i[e].sizeHeight=!1,i[e].autoResize=!1;break;default:throw new TypeError(`Direction value of "${t}" is not valid`)}u(e,`direction: %c${t}`,r.HIGHLIGHT)}const qe=e=>e===""||e.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":e;function vo(e){const{checkOrigin:t,remoteHost:n}=i[e];Array.isArray(t)&&t.length===0&&z(e,"checkOrigin is an empty array — no messages will be sent to the iframe"),i[e].targetOrigin=Array.isArray(t)?t.map(qe):[t===!1?"*":qe(n)]}function zo(e){const{id:t}=e;i[t].postMessageTarget===null&&(i[t].postMessageTarget=e.contentWindow)}function ee(e,t,n){$(i[e],t)&&(g(e,`<rb>Deprecated option</>
|
|
36
36
|
|
|
37
|
-
The <b>${t}</> option has been renamed to <b>${n}</>. ${
|
|
37
|
+
The <b>${t}</> option has been renamed to <b>${n}</>. ${de}`),i[e][n]=i[e][t],delete i[e][t])}function wo(e){ee(e,ut,ft),ee(e,"onClose","onBeforeClose"),ee(e,"onClosed","onAfterClose")}const Io=e=>$(e,"onMouseEnter")||$(e,"onMouseLeave");function Eo(e,t){const{id:n}=e;i[n]={...i[n],iframe:e,remoteHost:e?.src.split("/").slice(0,3).join("/"),...C,...yo(n,t),mouseEvents:Io(t),mode:Nn(t),syncTitle:Hn(n)},wo(n),bo(n),mo(n,t),go(n),zo(e),vo(n)}const To="yes",Ze="no";function Oo(e){const{id:t}=e;switch(u(t,`Iframe scrolling ${i[t]?.scrolling?"enabled":"disabled"} for ${t}`),e.style.overflow=i[t]?.scrolling===!1?pt:V,i[t]?.scrolling){case gt:break;case!0:e.scrolling=To;break;case!1:e.scrolling=Ze;break;default:e.scrolling=i[t]?.scrolling||Ze}}function Lo(e,t,n){Eo(t,n),u(e,`src: %c${t.srcdoc||t.src}`,r.HIGHLIGHT),Cn(e),Oo(t),to(e),ho(e,Qn(e)),Zn(e),u(e,"Setup complete")}function Ho(e,t){const{id:n}=e;v(n,"setup"),Un(n)&&Lo(n,e,t),Ft(n)}function Ro(e,t){t.log===Z?t.log=!1:t.log===J?t.log=k:t.log===Y&&(t.log=R);const n=$(t,"log"),o=X(t.log),s=n?o?!0:t.log:C.log;$(t,"logExpand")||(t.logExpand=n&&o?t.log===R:C.logExpand),_n(t),Nt({enabled:s,expand:t.logExpand,iframeId:e}),o&&!(t.log in vt)&&_t(e,`Invalid value for options.log: Accepted values are "${R}" and "${k}"`),t.log=s}function ko(e){if(!ye(e))throw new TypeError("Options is not an object");return Wn(),Zt(e),t=>{const n=qt(t,e);return te in t?(v(n,"alreadySetup"),z(n,`Ignored iframe (${n}), already setup.`)):(Ro(n,e),ze(n,Ho)(t,e)),t?.iframeResizer}}b.LOG_COLLAPSED=J,b.LOG_DISABLED=Z,b.LOG_EXPANDED=Y,b.default=ko,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
38
38
|
//# sourceMappingURL=index.umd.js.map
|