@iframe-resizer/core 6.0.0-beta.3 → 6.0.0-beta.5
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 +1 -1
- package/index.cjs.js +11 -13
- package/index.cjs.js.map +1 -1
- package/index.esm.js +545 -641
- package/index.esm.js.map +1 -1
- package/index.umd.js +11 -16
- package/index.umd.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
package/index.cjs.js
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
`,yt="hidden",mt="child",U="parent",J="string",bt="number",Ie="object",vt="function",V="auto",zt="font-weight: bold;",Oe="none",Te="both",F="vertical",Ee="horizontal",wt="omit",It=$.length,C="[iFrameSizer]",q=C.length,Ot=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),oe=Object.freeze({[be]:1,[j]:1,[me]:1}),H="expanded",k="collapsed",Y=0,X=1,K=2,Tt=Object.freeze({[H]:1,[k]:1}),Et="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",He=e=>typeof e===Ie&&e!==null,Q=e=>typeof e===J;function Ht(e){if(!He(e))return!1;try{return e.tagName==="IFRAME"||e instanceof HTMLIFrameElement}catch{return!1}}const kt=(e,...t)=>setTimeout(()=>e(...t),0),Lt=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},jt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),R=(e,t)=>Object.hasOwn?Object.hasOwn(e,t):jt(e,t),Mt=e=>e,St=e=>e.charAt(0).toUpperCase()+e.slice(1),$t=e=>e?.__esModule?e.default:e,Rt=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${St(t)}`)},ke={br:`
|
|
3
|
-
`,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},Gt=Object.keys(ke),At=new RegExp(`<(${Gt.join("|")})>`,"gi"),Pt=(e,t)=>ke[t]??"",Nt=e=>e.replace(At,Pt),Ct=e=>e.replaceAll("<br>",A).replaceAll(/<\/?[^>]+>/gi,""),Le=e=>t=>e(Q(t)?window.chrome?Nt(t):Ct(t):t),i={},je=$t(r);let ee=!0;const xt=je({expand:!1,label:U}),_t=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`,Ft=e=>i[e]?i[e].log:ee;function Dt({enabled:e,expand:t,iframeId:n}){const o=je({expand:t,label:_t(n)});ee=e,i[n]||(i[n]={console:o})}const T=e=>(t,...n)=>i[t]?i[t].console[e](...n):xt[e](...n),Me=e=>(t,...n)=>Ft(t)===!0?T(e)(t,...n):null,u=Me("log"),y=u,Bt=Me("debug"),z=T("warn"),Wt=T("error"),b=T("event"),Ut=T("purge"),Vt=T("endAutoGroup"),Se=T("errorBoundary");function qt(e,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,ee||t<1?zt:r.NORMAL))}const Zt=e=>(...t)=>[`${de}(${e})`,...t].join(" "),Jt=Le(Mt),m=(e,...t)=>i[e]?i[e].console.warn(...t.map(Jt)):queueMicrotask(()=>{const n=Le(Zt(e));console?.warn(...t.map(n))}),x=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:F,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(){},onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady(){},onResized(){},onScroll:()=>!0});let ie=0;function Yt(e){const t=e?.id||x.id+ie++;return document.getElementById(t)===null?t:`${t}${ie++}`}function Xt(e,t){let{id:n}=e;if(n&&!Q(n))throw new TypeError("Invalid id for iframe. Expected String");return(!n||n==="")&&(n=Yt(t),e.id=n,b(n,"assignId"),u(n,`Added missing iframe ID: ${n} (${e.src})`)),n}function Kt(e){const{search:t}=window.location;if(t.includes("ifrlog"))switch(new URLSearchParams(t).get("ifrlog")){case String(Y):{e.log=!1;break}case H:case String(K):{e.log=H;break}case k:case String(X):{e.log=k;break}default:e.log=k}}const G=(e,t,n,o)=>e.addEventListener(t,n,o||!1),se=(e,t,n)=>e.removeEventListener(t,n,!1),Qt=e=>e.split(S).filter((t,n)=>n!==19).join(S);function en(e,t,n){function o(f){const p=e in oe?Qt(t):t;y(n,f,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),y(n,`Message data: %c${p}`,r.HIGHLIGHT)}const{iframe:s,postMessageTarget:c,sameOrigin:l,targetOrigin:a}=i[n];if(l)try{s.contentWindow.iframeChildListener(C+t),o(`Sending message to iframe %c${n}%c via same origin%c`);return}catch{e in oe?(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(C+t,f)}function L(e,t,n){if(b(n,e),!i[n]?.postMessageTarget){z(n,"Iframe not found");return}en(e,t,n)}const tn=(e,t)=>Object.values(i).filter(({autoResize:n,firstRun:o})=>n&&!o).forEach(({iframe:n})=>L(e,t,n.id));function nn(){document.hidden!==!0&&tn("tabVisible",we)}function on(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 sn(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 rn(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?on(s)+sn(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 ln={true:1,false:1,undefined:1};function an(e){const{id:t,msg:n,iframe:o}=e,s=Ht(o);return s||(u(t,`Received: %c${n}`,r.HIGHLIGHT),z(t,"The target iframe was not found.")),s}function cn(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 un=e=>C===`${e}`.slice(0,q)&&e.slice(q).split(":")[0]in i;function fn(e){const{id:t,type:n}=e,o=n in ln;return o&&u(t,"Ignoring init message from meta parent page"),o}function pn(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 hn(e,t){if(t!==N){if(t===void 0){m(e,`<rb>Legacy version detected in iframe</>
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@iframe-resizer/common"),a=require("auto-console-group"),i={},F=o.esModuleInterop(a);let y=!0;const ce=F({expand:!1,label:o.PARENT}),le=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`,fe=e=>i[e]?i[e].log:y;function ue({enabled:e,expand:t,iframeId:n}){const r=F({expand:t,label:le(n)});y=e,i[n]||(i[n]={console:r})}const L=e=>(t,...n)=>i[t]?i[t].console[e](...n):ce[e](...n),B=e=>(t,...n)=>fe(t)===!0?L(e)(t,...n):null,u=B("log"),p=u,ge=B("debug"),O=L("warn"),de=L("error"),b=L("event"),he=L("purge"),me=L("endAutoGroup"),x=L("errorBoundary");function Ee(e,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,y||t<1?o.BOLD:a.NORMAL))}const Ie=e=>(...t)=>[`${o.LABEL}(${e})`,...t].join(" "),pe=o.createFormatAdvise(o.id),I=(e,...t)=>i[e]?i[e].console.warn(...t.map(pe)):queueMicrotask(()=>{const n=o.createFormatAdvise(Ie(e));console?.warn(...t.map(n))}),N=o.deprecate(I);N("Function");N("Method");N("Option");const R=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:o.VERTICAL,firstRun:!0,inPageLinks:!1,heightCalculationMethod:o.AUTO,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:o.AUTO,onBeforeClose:()=>!0,onAfterClose(){},onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady(){},onResized(){},onScroll:()=>!0});let P=0;function be(e){const t=e?.id||R.id+P++;return document.getElementById(t)===null?t:`${t}${P++}`}function Oe(e,t){let{id:n}=e;if(n&&!o.isString(n))throw new TypeError("Invalid id for iframe. Expected String");return(!n||n==="")&&(n=be(t),e.id=n,b(n,"assignId"),u(n,`Added missing iframe ID: ${n} (${e.src})`)),n}function Te(e){const{search:t}=window.location;if(t.includes("ifrlog"))switch(new URLSearchParams(t).get("ifrlog")){case String(o.LOG_DISABLED):{e.log=!1;break}case o.EXPAND:case String(o.LOG_EXPANDED):{e.log=o.EXPAND;break}case o.COLLAPSE:case String(o.LOG_COLLAPSED):{e.log=o.COLLAPSE;break}default:e.log=o.COLLAPSE}}const we=e=>e.split(o.SEPARATOR).filter((t,n)=>n!==19).join(o.SEPARATOR);function Le(e,t,n){function r(g){const d=e in o.INIT_EVENTS?we(t):t;p(n,g,a.HIGHLIGHT,a.FOREGROUND,a.HIGHLIGHT),p(n,`Message data: %c${d}`,a.HIGHLIGHT)}const{iframe:s,postMessageTarget:f,sameOrigin:c,targetOrigin:l}=i[n];if(c)try{s.contentWindow.iframeChildListener(o.MESSAGE_ID+t),r(`Sending message to iframe %c${n}%c via same origin%c`);return}catch{e in o.INIT_EVENTS?(i[n].sameOrigin=!1,u(n,"New iframe does not support same origin")):O(n,"Same origin messaging failed, falling back to postMessage")}r(`Sending message to iframe: %c${n}%c targetOrigin: %c${l.join(", ")}`);for(const g of l)f.postMessage(o.MESSAGE_ID+t,g)}function S(e,t,n){if(b(n,e),!i[n]?.postMessageTarget){O(n,"Iframe not found");return}Le(e,t,n)}const He=(e,t)=>Object.values(i).filter(({autoResize:n,firstRun:r})=>n&&!r).forEach(({iframe:n})=>S(e,t,n.id));function Se(){document.hidden!==!0&&He("tabVisible",o.RESIZE)}function Ae(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 Re(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 Ge(e){const t=e.slice(o.MESSAGE_ID_LENGTH).split(":"),n=t[1]?Number(t[1]):0,r=i[t[0]]?.iframe,s=r?getComputedStyle(r):null,f=s?Ae(s)+Re(s):0,c={iframe:r,id:t[0],height:n+f,width:Number(t[2]),type:t[3],msg:t[4],message:t[4]};return t[5]&&(c.mode=t[5]),c}const Me={true:1,false:1,undefined:1};function ye(e){const{id:t,msg:n,iframe:r}=e,s=o.isIframe(r);return s||(u(t,`Received: %c${n}`,a.HIGHLIGHT),O(t,"The target iframe was not found.")),s}function Ne(e,t){const{id:n}=e,{data:r,origin:s}=t;if("sameOrigin"in t&&t.sameOrigin)return!0;const c=i[n]?.checkOrigin;function l(){function g(){u(n,`Checking connection is from allowed list of origins: %c${c}`,a.HIGHLIGHT);for(const h of c)if(h===s)return!0;return!1}function d(){const h=i[n]?.remoteHost;return u(n,`Checking connection is from: %c${h}`,a.HIGHLIGHT),s===h}return c.constructor===Array?g():d()}if(c&&`${s}`!="null"&&!l())throw new Error(`Unexpected message received from: ${s} for ${n}. Message was: ${r}. This error can be disabled by setting the checkOrigin: false option or by providing an array of trusted domains.`);return!0}const Pe=e=>o.MESSAGE_ID===`${e}`.slice(0,o.MESSAGE_ID_LENGTH)&&e.slice(o.MESSAGE_ID_LENGTH).split(":")[0]in i;function $e(e){const{id:t,type:n}=e,r=n in Me;return r&&u(t,"Ignoring init message from meta parent page"),r}function ve(e){try{i[e].sameOrigin=!!i[e]?.iframe?.contentWindow?.iframeChildListener}catch{i[e].sameOrigin=!1}u(e,`sameOrigin: %c${i[e].sameOrigin}`,a.HIGHLIGHT)}function ke(e,t){if(t!==o.VERSION){if(t===void 0){I(e,`<rb>Legacy version detected in iframe</>
|
|
4
2
|
|
|
5
3
|
Detected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.
|
|
6
4
|
|
|
7
5
|
See <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.
|
|
8
|
-
`);return}u(e,`Version mismatch (Child: %c${t}%c !== Parent: %c${N})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT)}}function O(e,t,n){if(!i[e])return null;const o=i[e][t];if(typeof o!==vt)throw new TypeError(`${t} on iframe[${e}] is not a function`);if(t!=="onBeforeClose"&&t!=="onScroll")return kt(o,n);try{return o(n)}catch(s){return console.error(s),z(e,`Error in ${t} callback`),null}}function gn(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),O(n,"onMessage",{iframe:o,message:JSON.parse(t)})}function P(e,t){const{lastMessage:n}=i[e];return n.slice(n.indexOf(S)+It+t)}function re(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=P(n,9).split(S);a={x:f[1],y:f[0]}}else a={x:l,y:s};O(n,e,{iframe:o,screenX:Number(a.x),screenY:Number(a.y),type:c})}const g={position:null,version:N};function $e(){g.position=null}const dn=()=>g.position;function yn(e){g.position=e}function Re(e){return g.position===null&&(g.position={x:window.scrollX,y:window.scrollY}),u(e,`Get page position: %c${g.position.x}%c, %c${g.position.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),g.position}function Ge(e){g.position!==null&&(window.scrollTo(g.position.x,g.position.y),y(e,`Set page position: %c${g.position.x}%c, %c${g.position.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),$e())}function le(e,t){const{id:n}=t,o=`${t[e]}px`;i[n].iframe.style[e]=o,y(n,`Set ${e}: %c${o}`,r.HIGHLIGHT)}function Ae(e){const{id:t}=e,{sizeHeight:n,sizeWidth:o}=i[t];n&&le(pt,e),o&&le(ht,e)}function ae(e){const{id:t}=e;Ae(e),Ge(t),O(t,"onResized",e)}function Pe(e){const{id:t}=e;u(t,"Disconnected from iframe"),delete i[t],delete e.iframeResizer}function Ne(e){const{id:t}=e;if(O(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)}O(t,"onAfterClose",t),Pe(e)}function Ce(e){const{id:t,type:n}=e;u(t,`Size reset requested by ${n===j?"parent page":"child page"}`),Re(t),Ae(e),L(W,W,t)}const xe=(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(){L(`${o} (${e})`,`${e}:${t(c)}`,s)}l(a,s)}},_e=e=>t=>{e in i[t]&&(i[t][e](),delete i[t][e])},Fe=((e,t)=>n=>{let o=!1;const s=d=>()=>{i[n]?(!o||o===d)&&(e(d,n),o=d,requestAnimationFrame(()=>{o=!1})):h()},c=s(ne),l=s("resize window"),a=new ResizeObserver(s("pageObserver")),f=new ResizeObserver(s("iframeObserver"));function p(d,w){u(n,`${d}listeners for send${t}`),w(window,ne,c),w(window,we,l)}function h(){b(n,`stop${t}`),p("Remove ",se),a.disconnect(),f.disconnect(),i[n]&&se(i[n].iframe,B,h)}function E(){p("Add ",G),a.observe(document.body),f.observe(i[n].iframe)}i[n]&&(i[n][`stop${t}`]=h,G(i[n].iframe,B,h),E())});function mn(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 bn=xe(ve,mn),vn=Fe(bn,"PageInfo"),zn=_e("stopPageInfo");function wn(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 In=xe(ze,wn),On=Fe(In,"ParentInfo"),Tn=_e("stopParentInfo");function De(e){const t=e.getBoundingClientRect(),n=Re(e.id);return{x:Number(t.left)+Number(n.x),y:Number(t.top)+Number(n.y)}}function Be(e){const{x:t,y:n}=dn(),o=i[e]?.iframe;if(O(e,"onScroll",{iframe:o,top:n,left:t,x:t,y:n})===!1){$e();return}Ge(e)}function En(e){const{id:t,height:n,width:o}=e,s=window.parentIframe||window.parentIFrame||window;y(t,`scrollBy: x: %c${o}%c y: %c${n}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),s.scrollBy(o,n)}const We=e=>t=>{const{id:n,iframe:o,height:s,width:c}=t;function l(d){yn(d),Be(n)}function a(d,w){d[`scrollTo${e?"Offset":""}`](w.x,w.y)}const f=d=>({x:c+d.x,y:s+d.y}),p=e?De(o):{x:0,y:0},h=f(p),E=window.parentIframe||window.parentIFrame;y(n,`Reposition requested (offset x:%c${p.x}%c y:%c${p.y})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),E?a(E,h):l(h)},Hn=We(!1),kn=We(!0);function Ln(e,t,n){const{x:o,y:s}=De(n);y(e,`Moving to in page link: %c#${t}`,r.HIGHLIGHT),g.position={x:o,y:s},Be(e),window.location.hash=t}function jn(e,t){const n=window.parentIframe||window.parentIFrame;if(!n){u(e,`In page link #${t} not found`);return}n.moveToAnchor(t)}function Mn(e,t){const n=t.split("#")[1]||"",o=decodeURIComponent(n),s=document.getElementById(o)||document.getElementsByName(o)[0];if(s){Ln(e,n,s);return}if(window.top===window.self){u(e,`In page link #${n} not found`);return}jn(e,n)}function Sn(e){const t=i[e]?.iframe?.title;return t===""||t===void 0}function $n(e,t){i[e]?.syncTitle&&(i[e].iframe.title=t,y(e,`Set iframe title attribute: %c${t}`,r.HIGHLIGHT))}const _=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)},v=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),Rn=new Date,Ue=e=>new Set(Array.from({length:9},e)),ce=" - lewpylk",M=["spjluzl","rlf","clyzpvu","rlf2","nlaMbssFlhy"],Gn=["<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</>. 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.","<yi>Bzl dpao slnhjf jspluaz</><iy><iy>Dolu bzpun <p>pmyhtl-ylzpgly</> jopsk whjrhnl dpao hu vskly clyzpvu vm aol whylua, fvb jhu zla aol spjluzl rlf pu aol pmyhtl. Mvy klahpsz vu ovd av zla aopz bw, wslhzl zll aol kvjbtluahapvu ha:<iy><iy>oaawz://pmyhtl-ylzpgly.jvt/zlabw/jopsk/#spjluzl"],An=e=>[e[0],...e.slice(1).map(t=>`${t}${ce}`),`${e[4]}${ce}`,...e.slice(1)],Pn=An(["NWSc3","zvsv","wyv","ibzpulzz","VLT"]),ue=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","1foobarqaz","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl","igb1wzrjqr"].map((e,t)=>[e,Math.max(0,t-1)])),Ve=Rn[v(M[4])](),Nn=Ue((e,t)=>_(`${Ve+t}`)),Cn=Ue((e,t)=>_(`${Ve-++t}`)),xn=e=>Nn.has(e)?9:Cn.has(e)?5:-2,I=e=>v(Gn[e]),_n=e=>v(Pn[e]),Fn=e=>{const t=e[v(M[0])]||e[v(M[1])]||e[v(M[2])]||e[v(M[3])];if(!t)return-1;const n=t.split("-");let o=(function(s="",c=""){let l=-2;const a=_(v(s));return a in ue&&(l=ue[a]),l===9?xn(c):l})(...n);return o===0||(s=>s[2]===_(s[0]+s[1]))(n)||(o=-2),o};let Z=!1,qe=!1;function Ze(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 Ut(e),i[e].vAdvised||m(e||"Parent",`${I(n+2)}${I(2)}`),i[e].vAdvised=!0,I(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");switch(n>5&&qe||qt(`v${N} (${_n(n)})`,n),n){case 1:case 2:case 3:m("Parent",I(6));break;case 4:m("Parent",I(7));break;case 5:m("Parent",I(8));break;default:n<1&&m("Parent",I(3))}Z=!0}function Dn(e){if(Z)return;const{mode:t}=i[e];t>5&&Ze(e,t)}function Bn(e){e?.log===-1&&(e.log=!1,qe=!0)}function Wn(e,t){i[e]&&(u(e,`First run for ${e}`),Ze(e,t===void 0?void 0:Number(t)),i[e].firstRun=!1)}function Un(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&&Wn(n,s),u(n,`Received: %c${f}`,r.HIGHLIGHT),l){case ye:i[n].autoResize=JSON.parse(P(n,9));break;case et:y(n,"Ready state reset"),i[n].initialised=!1;break;case tt:Ne(o);break;case nt:Mn(n,P(n,9));break;case j:ae(e),pn(n),hn(n,c),i[n].initialised=!0,O(n,"onReady",o);break;case $:gn(e,P(n,6));break;case it:re("onMouseEnter",e);break;case st:re("onMouseLeave",e);break;case ve:vn(n);break;case ze:On(n);break;case rt:zn(n);break;case lt:Tn(n);break;case W:Ce(e);break;case at:En(e);break;case ct:Hn(e);break;case ut:kn(e);break;case ft:$n(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}ae(e)}}const Vn=e=>({initChild:t,postMessageTarget:n})=>{e===n&&t()},qn=e=>Object.values(i).forEach(Vn(e));function fe(e){const t=e.data;if(t===Qe){qn(e.source);return}if(!un(t)){if(typeof t!==J)return;b(U,"ignoredMessage"),Bt(U,t);return}const n=rn(t),{id:o,type:s}=n;switch(b(o,s),!0){case!i[o]:throw new Error(`${s} No settings for ${o}. Message was: ${t}`);case!an(n):case fn(n):case!cn(n,e):return;default:i[o].lastMessage=e.data,Se(o,Un)(n)}}const Zn=Lt(()=>{G(window,$,fe),G(document,"visibilitychange",nn),window.iframeParentListener=e=>setTimeout(()=>fe({data:e,sameOrigin:!0}))}),pe={};function Jn(e){if(pe[e]===!0)return!1;const t=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(t.length<=1)return!0;pe[e]=!0;const n=Array.from(t).flatMap(o=>[A,o,A]);return m(e,`<rb>Duplicate ID attributes detected</>
|
|
6
|
+
`);return}u(e,`Version mismatch (Child: %c${t}%c !== Parent: %c${o.VERSION})`,a.HIGHLIGHT,a.FOREGROUND,a.HIGHLIGHT)}}function w(e,t,n){if(!i[e])return null;const r=i[e][t];if(typeof r!==o.FUNCTION)throw new TypeError(`${t} on iframe[${e}] is not a function`);if(t!=="onBeforeClose"&&t!=="onScroll")return o.isolateUserCode(r,n);try{return r(n)}catch(s){return console.error(s),O(e,`Error in ${t} callback`),null}}function De(e,t){const{id:n,iframe:r}=e;u(n,`onMessage passed: {iframe: %c${n}%c, message: %c${t}%c}`,a.HIGHLIGHT,a.FOREGROUND,a.HIGHLIGHT,a.FOREGROUND),w(n,"onMessage",{iframe:r,message:JSON.parse(t)})}function A(e,t){const{lastMessage:n}=i[e];return n.slice(n.indexOf(o.SEPARATOR)+o.MESSAGE_HEADER_LENGTH+t)}function $(e,t){const{id:n,iframe:r,height:s,type:f,width:c}=t;let l={x:0,y:0};if(c===0&&s===0){const g=A(n,9).split(o.SEPARATOR);l={x:g[1],y:g[0]}}else l={x:c,y:s};w(n,e,{iframe:r,screenX:Number(l.x),screenY:Number(l.y),type:f})}const m={position:null,version:o.VERSION};function W(){m.position=null}const _e=()=>m.position;function Ce(e){m.position=e}function U(e){return m.position===null&&(m.position={x:window.scrollX,y:window.scrollY}),u(e,`Get page position: %c${m.position.x}%c, %c${m.position.y}`,a.HIGHLIGHT,a.FOREGROUND,a.HIGHLIGHT),m.position}function V(e){m.position!==null&&(window.scrollTo(m.position.x,m.position.y),p(e,`Set page position: %c${m.position.x}%c, %c${m.position.y}`,a.HIGHLIGHT,a.FOREGROUND,a.HIGHLIGHT),W())}function v(e,t){const{id:n}=t,r=`${t[e]}px`;i[n].iframe.style[e]=r,p(n,`Set ${e}: %c${r}`,a.HIGHLIGHT)}function j(e){const{id:t}=e,{sizeHeight:n,sizeWidth:r}=i[t];n&&v(o.HEIGHT,e),r&&v(o.WIDTH,e)}function k(e){const{id:t}=e;j(e),V(t),w(t,"onResized",e)}function X(e){const{id:t}=e;u(t,"Disconnected from iframe"),delete i[t],delete e.iframeResizer}function q(e){const{id:t}=e;if(w(t,"onBeforeClose",t)===!1){u(t,"Close iframe cancelled by onBeforeClose");return}u(t,`Removing iframe: %c${t}`,a.HIGHLIGHT);try{e.parentNode&&e.remove()}catch(n){O(t,n)}w(t,"onAfterClose",t),X(e)}function Z(e){const{id:t,type:n}=e;u(t,`Size reset requested by ${n===o.INIT?"parent page":"child page"}`),U(t),j(e),S(o.RESET,o.RESET,t)}const Y=(e,t)=>{const n={};return(r,s)=>{const{iframe:f}=i[s];function c(g,d){n[d]||(g(),n[d]=requestAnimationFrame(()=>{n[d]=null}))}function l(){S(`${r} (${e})`,`${e}:${t(f)}`,s)}c(l,s)}},J=e=>t=>{e in i[t]&&(i[t][e](),delete i[t][e])},K=((e,t)=>n=>{let r=!1;const s=E=>()=>{i[n]?(!r||r===E)&&(e(E,n),r=E,requestAnimationFrame(()=>{r=!1})):h()},f=s(o.SCROLL),c=s("resize window"),l=new ResizeObserver(s("pageObserver")),g=new ResizeObserver(s("iframeObserver"));function d(E,T){u(n,`${E}listeners for send${t}`),T(window,o.SCROLL,f),T(window,o.RESIZE,c)}function h(){b(n,`stop${t}`),d("Remove ",o.removeEventListener),l.disconnect(),g.disconnect(),i[n]&&o.removeEventListener(i[n].iframe,o.LOAD,h)}function H(){d("Add ",o.addEventListener),l.observe(document.body),g.observe(i[n].iframe)}i[n]&&(i[n][`stop${t}`]=h,o.addEventListener(i[n].iframe,o.LOAD,h),H())});function ze(e){const t=document.body.getBoundingClientRect(),n=e.getBoundingClientRect(),{scrollY:r,scrollX:s,innerHeight:f,innerWidth:c}=window,{clientHeight:l,clientWidth:g}=document.documentElement;return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(l,f||0),clientWidth:Math.max(g,c||0),offsetTop:Math.trunc(n.top-t.top),offsetLeft:Math.trunc(n.left-t.left),scrollTop:r,scrollLeft:s,documentHeight:l,documentWidth:g,windowHeight:f,windowWidth:c})}const Fe=Y(o.PAGE_INFO,ze),Be=K(Fe,"PageInfo"),xe=J("stopPageInfo");function We(e){const{scrollWidth:t,scrollHeight:n}=document.documentElement,r=typeof window<"u"&&window.visualViewport?window.visualViewport:{},{width:s=0,height:f=0,offsetLeft:c=0,offsetTop:l=0,pageLeft:g=0,pageTop:d=0,scale:h=1}=r;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:s,height:f,offsetLeft:c,offsetTop:l,pageLeft:g,pageTop:d,scale:h}})}const Ue=Y(o.PARENT_INFO,We),Ve=K(Ue,"ParentInfo"),je=J("stopParentInfo");function Q(e){const t=e.getBoundingClientRect(),n=U(e.id);return{x:Number(t.left)+Number(n.x),y:Number(t.top)+Number(n.y)}}function ee(e){const{x:t,y:n}=_e(),r=i[e]?.iframe;if(w(e,"onScroll",{iframe:r,top:n,left:t,x:t,y:n})===!1){W();return}V(e)}function Xe(e){const{id:t,height:n,width:r}=e,s=window.parentIframe||window.parentIFrame||window;p(t,`scrollBy: x: %c${r}%c y: %c${n}`,a.HIGHLIGHT,a.FOREGROUND,a.HIGHLIGHT),s.scrollBy(r,n)}const te=e=>t=>{const{id:n,iframe:r,height:s,width:f}=t;function c(E){Ce(E),ee(n)}function l(E,T){E[`scrollTo${e?"Offset":""}`](T.x,T.y)}const g=E=>({x:f+E.x,y:s+E.y}),d=e?Q(r):{x:0,y:0},h=g(d),H=window.parentIframe||window.parentIFrame;p(n,`Reposition requested (offset x:%c${d.x}%c y:%c${d.y})`,a.HIGHLIGHT,a.FOREGROUND,a.HIGHLIGHT),H?l(H,h):c(h)},qe=te(!1),Ze=te(!0);function Ye(e,t,n){const{x:r,y:s}=Q(n);p(e,`Moving to in page link: %c#${t}`,a.HIGHLIGHT),m.position={x:r,y:s},ee(e),window.location.hash=t}function Je(e,t){const n=window.parentIframe||window.parentIFrame;if(!n){u(e,`In page link #${t} not found`);return}n.moveToAnchor(t)}function Ke(e,t){const n=t.split("#")[1]||"",r=decodeURIComponent(n),s=document.getElementById(r)||document.getElementsByName(r)[0];if(s){Ye(e,n,s);return}if(window.top===window.self){u(e,`In page link #${n} not found`);return}Je(e,n)}function Qe(e){const t=i[e]?.iframe?.title;return t===""||t===void 0}function et(e,t){i[e]?.syncTitle&&(i[e].iframe.title=t,p(e,`Set iframe title attribute: %c${t}`,a.HIGHLIGHT))}let M=!1,ne=!1;function oe(e,t=-3){if(M)return;const n=Math.max(i[e].mode,t);if(n>i[e].mode&&(i[e].mode=n),n<0)throw he(e),i[e].vAdvised||I(e||"Parent",`${o.getModeData(n+2)}${o.getModeData(2)}`),i[e].vAdvised=!0,o.getModeData(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");switch(n>5&&ne||Ee(`v${o.VERSION} (${o.getModeLabel(n)})`,n),n){case 1:case 2:case 3:I("Parent",o.getModeData(6));break;case 4:I("Parent",o.getModeData(7));break;case 5:I("Parent",o.getModeData(8));break;default:n<1&&I("Parent",o.getModeData(3))}M=!0}function tt(e){if(M)return;const{mode:t}=i[e];t>5&&oe(e,t)}function nt(e){e?.log===-1&&(e.log=!1,ne=!0)}function ot(e,t){i[e]&&(u(e,`First run for ${e}`),oe(e,t===void 0?void 0:Number(t)),i[e].firstRun=!1)}function it(e){const{height:t,id:n,iframe:r,mode:s,message:f,type:c,width:l}=e,{lastMessage:g}=i[n];switch(i[n]?.firstRun&&ot(n,s),u(n,`Received: %c${g}`,a.HIGHLIGHT),c){case o.AUTO_RESIZE:i[n].autoResize=JSON.parse(A(n,9));break;case o.BEFORE_UNLOAD:p(n,"Ready state reset"),i[n].initialised=!1;break;case o.CLOSE:q(r);break;case o.IN_PAGE_LINK:Ke(n,A(n,9));break;case o.INIT:k(e),ve(n),ke(n,f),i[n].initialised=!0,w(n,"onReady",r);break;case o.MESSAGE:De(e,A(n,6));break;case o.MOUSE_ENTER:$("onMouseEnter",e);break;case o.MOUSE_LEAVE:$("onMouseLeave",e);break;case o.PAGE_INFO:Be(n);break;case o.PARENT_INFO:Ve(n);break;case o.PAGE_INFO_STOP:xe(n);break;case o.PARENT_INFO_STOP:je(n);break;case o.RESET:Z(e);break;case o.SCROLL_BY:Xe(e);break;case o.SCROLL_TO:qe(e);break;case o.SCROLL_TO_OFFSET:Ze(e);break;case o.TITLE:et(n,f);break;default:if(l===0&&t===0){O(n,`Unsupported message received (${c}), 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}k(e)}}const rt=e=>({initChild:t,postMessageTarget:n})=>{e===n&&t()},st=e=>Object.values(i).forEach(rt(e));function D(e){const t=e.data;if(t===o.CHILD_READY_MESSAGE){st(e.source);return}if(!Pe(t)){if(typeof t!==o.STRING)return;b(o.PARENT,"ignoredMessage"),ge(o.PARENT,t);return}const n=Ge(t),{id:r,type:s}=n;switch(b(r,s),!0){case!i[r]:throw new Error(`${s} No settings for ${r}. Message was: ${t}`);case!ye(n):case $e(n):case!Ne(n,e):return;default:i[r].lastMessage=e.data,x(r,it)(n)}}const at=o.once(()=>{o.addEventListener(window,o.MESSAGE,D),o.addEventListener(document,"visibilitychange",Se),window.iframeParentListener=e=>setTimeout(()=>D({data:e,sameOrigin:!0}))}),_={};function ct(e){if(_[e]===!0)return!1;const t=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(t.length<=1)return!0;_[e]=!0;const n=Array.from(t).flatMap(r=>[o.NEW_LINE,r,o.NEW_LINE]);return I(e,`<rb>Duplicate ID attributes detected</>
|
|
9
7
|
|
|
10
8
|
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.
|
|
11
9
|
|
|
12
|
-
Found <bb>${t.length}</> iframes with the <b>${e}</> ID:`,...n,
|
|
10
|
+
Found <bb>${t.length}</> iframes with the <b>${e}</> ID:`,...n,o.NEW_LINE),!1}function lt(e){if(i[e]){const{iframe:t}=i[e];t.iframeResizer={close:q.bind(null,t),disconnect:X.bind(null,t),moveToAnchor(n){o.typeAssert(n,o.STRING,"moveToAnchor(anchor) anchor"),S("Move to anchor",`moveToAnchor:${n}`,e)},sendMessage(n){n=JSON.stringify(n),S(o.MESSAGE,`${o.MESSAGE}:${n}`,e)}}}}const ft="8",ut="32",gt=o.CHILD,dt=!0;function ht(e){const{autoResize:t,bodyBackground:n,bodyMargin:r,bodyPadding:s,heightCalculationMethod:f,inPageLinks:c,license:l,log:g,logExpand:d,mouseEvents:h,offsetHeight:H,offsetWidth:E,mode:T,sizeHeight:ie,sizeWidth:re,tolerance:se,widthCalculationMethod:ae}=i[e];return[e,ft,re,g,ut,dt,t,r,f,n,s,se,c,gt,ae,h,H,E,ie,l,m.version,T,"",d].join(o.SEPARATOR)}const mt="0";function Et(e){const{bodyMargin:t}=i[e];(typeof t===o.NUMBER||t===mt)&&(i[e].bodyMargin=`${t}px`)}const It=e=>{try{return new URL(e).origin}catch{return null}},pt=e=>typeof e===o.OBJECT&&e.length>0&&!(e.contains("allow-scripts")&&e.contains("allow-same-origin"));function bt(e,t){const{checkOrigin:n,iframe:{src:r,sandbox:s},initialisedFirstPage:f,waitForLoad:c}=t[e],l=It(r);b(e,"noResponse"),I(e,`<rb>No response from iframe</>
|
|
13
11
|
|
|
14
12
|
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.
|
|
15
|
-
${n&&
|
|
16
|
-
The <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${
|
|
17
|
-
`:""}${
|
|
13
|
+
${n&&l?`
|
|
14
|
+
The <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${l}</>, 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.
|
|
15
|
+
`:""}${c&&!f?`
|
|
18
16
|
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</>.
|
|
19
|
-
`:""}${
|
|
17
|
+
`:""}${pt(s)?`
|
|
20
18
|
The iframe has the <b>sandbox</> attribute, please ensure it contains both the <bb>allow-same-origin</> and <bb>allow-scripts</> values.
|
|
21
19
|
`:""}
|
|
22
20
|
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.
|
|
23
|
-
`)}function
|
|
21
|
+
`)}function Ot(e,t){function n(){if(t[e]===void 0)return;const{initialised:f,loadErrorShown:c}=t[e];if(t[e].msgTimeout=void 0,f){t[e].initialisedFirstPage=!0;return}c||(t[e].loadErrorShown=!0,bt(e,t))}const{msgTimeout:r,warningTimeout:s}=t[e];s&&(r&&clearTimeout(r),t[e].msgTimeout=setTimeout(n,s))}const Tt=1,wt=e=>e.loading===o.LAZY,Lt=e=>e===o.INIT;function Ht(e){i[e]?.heightCalculationMethod in o.RESET_REQUIRED_METHODS&&Z({id:e,iframe:i[e].iframe,height:o.MIN_SIZE,width:o.MIN_SIZE,type:o.INIT})}function St(e,t){const n=()=>setTimeout(t,Tt);o.addEventListener(e,o.LOAD,n)}const At=e=>{const{src:t,srcdoc:n}=e;return!n&&(t==null||t===""||t==="about:blank")};function Rt(e,t){const{iframe:n,waitForLoad:r}=i[e];if(r!==!0){if(At(n)){setTimeout(()=>{b(e,"noContent"),p(e,"No content detected in the iframe, delaying initialisation")});return}setTimeout(t)}}function Gt(e,t){const n=s=>()=>{if(!i[e])return;const{firstRun:f,iframe:c}=i[e];S(s,t,e),Lt(s)&&wt(c)||Ot(e,i),f||Ht(e)},{iframe:r}=i[e];i[e].initChild=n(o.INIT_FROM_IFRAME),St(r,n(o.ONLOAD)),Rt(e,n(o.INIT))}function Mt(e,t){return t?(("sizeWidth"in t||"sizeHeight"in t||o.AUTO_RESIZE in t)&&I(e,`<rb>Deprecated Option</>
|
|
24
22
|
|
|
25
|
-
The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${
|
|
26
|
-
`),t):{}}function
|
|
23
|
+
The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${o.VERTICAL}</>, <bb>${o.HORIZONTAL}</>, <bb>${o.BOTH}</> or <bb>${o.NONE}</>.
|
|
24
|
+
`),t):{}}function yt(e){i[e].warningTimeout||p(e,"warningTimeout:%c disabled",a.HIGHLIGHT)}function Nt(e,{offset:t,offsetSize:n}){const r=n||t;r&&(i[e].direction===o.VERTICAL?(i[e].offsetHeight=r,u(e,`Offset height: %c${r}`,a.HIGHLIGHT)):(i[e].offsetWidth=r,u(e,`Offset width: %c${r}`,a.HIGHLIGHT)))}function Pt(e){const{direction:t}=i[e];switch(t){case o.VERTICAL:break;case o.HORIZONTAL:i[e].sizeHeight=!1;case o.BOTH:i[e].sizeWidth=!0;break;case o.NONE: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}`,a.HIGHLIGHT)}const C=e=>e===""||e.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":e;function $t(e){const{checkOrigin:t,remoteHost:n}=i[e];Array.isArray(t)&&t.length===0&&O(e,"checkOrigin is an empty array — no messages will be sent to the iframe"),i[e].targetOrigin=Array.isArray(t)?t.map(C):[t===!1?"*":C(n)]}function vt(e){const{id:t}=e;i[t].postMessageTarget===null&&(i[t].postMessageTarget=e.contentWindow)}function G(e,t,n){o.hasOwn(i[e],t)&&(I(e,`<rb>Deprecated option</>
|
|
27
25
|
|
|
28
|
-
The <b>${t}</> option has been renamed to <b>${n}</>. ${
|
|
26
|
+
The <b>${t}</> option has been renamed to <b>${n}</>. ${o.REMOVED_NEXT_VERSION}`),i[e][n]=i[e][t],delete i[e][t])}function kt(e){G(e,o.OFFSET,o.OFFSET_SIZE),G(e,"onClose","onBeforeClose"),G(e,"onClosed","onAfterClose")}const Dt=e=>o.hasOwn(e,"onMouseEnter")||o.hasOwn(e,"onMouseLeave");function _t(e,t){const{id:n}=e;i[n]={...i[n],iframe:e,remoteHost:e?.src.split("/").slice(0,3).join("/"),...R,...Mt(n,t),mouseEvents:Dt(t),mode:o.setMode(t),syncTitle:Qe(n)},kt(n),Pt(n),Nt(n,t),yt(n),vt(e),$t(n)}const Ct="yes",z="no";function zt(e){const{id:t}=e;switch(u(t,`Iframe scrolling ${i[t]?.scrolling?"enabled":"disabled"} for ${t}`),e.style.overflow=i[t]?.scrolling===!1?o.HIDDEN:o.AUTO,i[t]?.scrolling){case o.OMIT:break;case!0:e.scrolling=Ct;break;case!1:e.scrolling=z;break;default:e.scrolling=i[t]?.scrolling||z}}function Ft(e,t,n){_t(t,n),u(e,`src: %c${t.srcdoc||t.src}`,a.HIGHLIGHT),tt(e),zt(t),Et(e),Gt(e,ht(e)),lt(e),u(e,"Setup complete")}function Bt(e,t){const{id:n}=e;b(n,"setup"),ct(n)&&Ft(n,e,t),me(n)}function xt(e,t){t.log===o.LOG_DISABLED?t.log=!1:t.log===o.LOG_COLLAPSED?t.log=o.COLLAPSE:t.log===o.LOG_EXPANDED&&(t.log=o.EXPAND);const n=o.hasOwn(t,"log"),r=o.isString(t.log),s=n?r?!0:t.log:R.log;o.hasOwn(t,"logExpand")||(t.logExpand=n&&r?t.log===o.EXPAND:R.logExpand),nt(t),ue({enabled:s,expand:t.logExpand,iframeId:e}),r&&!(t.log in o.LOG_OPTIONS)&&de(e,`Invalid value for options.log: Accepted values are "${o.EXPAND}" and "${o.COLLAPSE}"`),t.log=s}function Wt(e){if(!o.isObject(e))throw new TypeError("Options is not an object");return at(),Te(e),t=>{const n=Oe(t,e);return o.LABEL in t?(b(n,"alreadySetup"),O(n,`Ignored iframe (${n}), already setup.`)):(xt(n,e),x(n,Bt)(t,e)),t?.iframeResizer}}Object.defineProperty(exports,"LOG_COLLAPSED",{enumerable:!0,get:()=>o.LOG_COLLAPSED});Object.defineProperty(exports,"LOG_DISABLED",{enumerable:!0,get:()=>o.LOG_DISABLED});Object.defineProperty(exports,"LOG_EXPANDED",{enumerable:!0,get:()=>o.LOG_EXPANDED});exports.default=Wt;
|
|
29
27
|
//# sourceMappingURL=index.cjs.js.map
|