@elliemae/ssf-guest 2.23.2 → 2.23.4
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/dist/public/creditService.html +1 -1
- package/dist/public/index.html +1 -1
- package/dist/public/js/{emuiSsfGuest.c38bb81b5e5d8254f57f.js → emuiSsfGuest.dc017a38b78ac30a1aa3.js} +2 -2
- package/dist/public/js/emuiSsfGuest.dc017a38b78ac30a1aa3.js.br +0 -0
- package/dist/public/js/emuiSsfGuest.dc017a38b78ac30a1aa3.js.gz +0 -0
- package/dist/public/js/{emuiSsfGuest.c38bb81b5e5d8254f57f.js.map → emuiSsfGuest.dc017a38b78ac30a1aa3.js.map} +1 -1
- package/dist/public/loanValidation.html +1 -1
- package/dist/public/pricingService.html +1 -1
- package/dist/public/titleService.html +1 -1
- package/dist/public/v2-guest.html +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.br +0 -0
- package/dist/umd/index.js.gz +0 -0
- package/package.json +2 -2
- package/dist/public/js/emuiSsfGuest.c38bb81b5e5d8254f57f.js.br +0 -0
- package/dist/public/js/emuiSsfGuest.c38bb81b5e5d8254f57f.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Credit Service</title><style>body{margin:0}</style><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script>window.addEventListener("DOMContentLoaded",async()=>{window.__ICE__={diagnosticsUrl:"https://int.api.ellielabs.com/diagnostics/v2/logging"};const e=new URL(window.location),i=e?.searchParams?.get?.("src");window.__ICE__.ssfGuest=new ice.guest.SSFGuest({logger:{index:"creditServiceGuest",team:"ui platform",appName:"credit-service"}}),await window.__ICE__.ssfGuest.addScript(i,document.body)})</script><script defer="defer" src="js/emuiSsfGuest.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Credit Service</title><style>body{margin:0}</style><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script>window.addEventListener("DOMContentLoaded",async()=>{window.__ICE__={diagnosticsUrl:"https://int.api.ellielabs.com/diagnostics/v2/logging"};const e=new URL(window.location),i=e?.searchParams?.get?.("src");window.__ICE__.ssfGuest=new ice.guest.SSFGuest({logger:{index:"creditServiceGuest",team:"ui platform",appName:"credit-service"}}),await window.__ICE__.ssfGuest.addScript(i,document.body)})</script><script defer="defer" src="js/emuiSsfGuest.dc017a38b78ac30a1aa3.js"></script></head><body></body></html>
|
package/dist/public/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en" style="height:100%"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Plugin</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiSsfGuest.
|
|
1
|
+
<!doctype html><html lang="en" style="height:100%"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Plugin</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiSsfGuest.dc017a38b78ac30a1aa3.js"></script></head><body class="px-2 h-full"><main class="h-full"><h1 class="text-md font-bold">Credit Score Service</h1><div class="h-full mt-2"><output id="msg" class="mt-2 p-2"></output></div></main></body></html>
|
package/dist/public/js/{emuiSsfGuest.c38bb81b5e5d8254f57f.js → emuiSsfGuest.dc017a38b78ac30a1aa3.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(q,R){typeof exports=="object"&&typeof module=="object"?module.exports=R(require("emuiDiagnostics")):typeof define=="function"&&define.amd?define(["emuiDiagnostics"],R):typeof exports=="object"?exports.ice=R(require("emuiDiagnostics")):(q.ice=q.ice||{},q.ice.guest=R(q.emuiDiagnostics))})(globalThis,Q=>(()=>{var q={572(a,l,c){var g=c(736),h=g.Symbol;a.exports=h},561(a,l,c){var g=c(572),h=c(504),y=c(567),u="[object Null]",p="[object Undefined]",T=g?g.toStringTag:void 0;function w(E){return E==null?E===void 0?p:u:T&&T in Object(E)?h(E):y(E)}a.exports=w},605(a,l,c){var g=c(327),h=/^\s+/;function y(u){return u&&u.slice(0,g(u)+1).replace(h,"")}a.exports=y},433(a){var l=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;a.exports=l},504(a,l,c){var g=c(572),h=Object.prototype,y=h.hasOwnProperty,u=h.toString,p=g?g.toStringTag:void 0;function T(w){var E=y.call(w,p),f=w[p];try{w[p]=void 0;var m=!0}catch{}var x=u.call(w);return m&&(E?w[p]=f:delete w[p]),x}a.exports=T},567(a){var l=Object.prototype,c=l.toString;function g(h){return c.call(h)}a.exports=g},736(a,l,c){var g=c(433),h=typeof self=="object"&&self&&self.Object===Object&&self,y=g||h||Function("return this")();a.exports=y},327(a){var l=/\s/;function c(g){for(var h=g.length;h--&&l.test(g.charAt(h)););return h}a.exports=c},702(a,l,c){var g=c(230),h=c(381),y=c(569),u="Expected a function",p=Math.max,T=Math.min;function w(E,f,m){var x,k,U,G,S,L,A=0,j=!1,W=!1,B=!0;if(typeof E!="function")throw new TypeError(u);f=y(f)||0,g(m)&&(j=!!m.leading,W="maxWait"in m,U=W?p(y(m.maxWait)||0,f):U,B="trailing"in m?!!m.trailing:B);function F(b){var $=x,C=k;return x=k=void 0,A=b,G=E.apply(C,$),G}function X(b){return A=b,S=setTimeout(_,f),j?F(b):G}function Z(b){var $=b-L,C=b-A,K=f-$;return W?T(K,U-C):K}function V(b){var $=b-L,C=b-A;return L===void 0||$>=f||$<0||W&&C>=U}function _(){var b=h();if(V(b))return H(b);S=setTimeout(_,Z(b))}function H(b){return S=void 0,B&&x?F(b):(x=k=void 0,G)}function z(){S!==void 0&&clearTimeout(S),A=0,x=L=k=S=void 0}function N(){return S===void 0?G:H(h())}function D(){var b=h(),$=V(b);if(x=arguments,k=this,L=b,$){if(S===void 0)return X(L);if(W)return clearTimeout(S),S=setTimeout(_,f),F(L)}return S===void 0&&(S=setTimeout(_,f)),G}return D.cancel=z,D.flush=N,D}a.exports=w},230(a){function l(c){var g=typeof c;return c!=null&&(g=="object"||g=="function")}a.exports=l},470(a){function l(c){return c!=null&&typeof c=="object"}a.exports=l},89(a,l,c){var g=c(561),h=c(470),y="[object Symbol]";function u(p){return typeof p=="symbol"||h(p)&&g(p)==y}a.exports=u},381(a,l,c){var g=c(736),h=function(){return g.Date.now()};a.exports=h},345(a,l,c){var g=c(702),h=c(230),y="Expected a function";function u(p,T,w){var E=!0,f=!0;if(typeof p!="function")throw new TypeError(y);return h(w)&&(E="leading"in w?!!w.leading:E,f="trailing"in w?!!w.trailing:f),g(p,T,{leading:E,maxWait:T,trailing:f})}a.exports=u},569(a,l,c){var g=c(605),h=c(230),y=c(89),u=NaN,p=/^[-+]0x[0-9a-f]+$/i,T=/^0b[01]+$/i,w=/^0o[0-7]+$/i,E=parseInt;function f(m){if(typeof m=="number")return m;if(y(m))return u;if(h(m)){var x=typeof m.valueOf=="function"?m.valueOf():m;m=h(x)?x+"":x}if(typeof m!="string")return m===0?m:+m;m=g(m);var k=T.test(m);return k||w.test(m)?E(m.slice(2),k?2:8):p.test(m)?u:+m}a.exports=f},388(a){"use strict";a.exports=Q}},R={};function I(a){var l=R[a];if(l!==void 0)return l.exports;var c=R[a]={exports:{}};return q[a](c,c.exports,I),c.exports}I.n=a=>{var l=a&&a.__esModule?()=>a.default:()=>a;return I.d(l,{a:l}),l},I.d=(a,l)=>{for(var c in l)I.o(l,c)&&!I.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:l[c]})},I.o=(a,l)=>Object.prototype.hasOwnProperty.call(a,l),I.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var Y={};return(()=>{"use strict";I.r(Y),I.d(Y,{SSFGuest:()=>le});const l={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let c;const g=new Uint8Array(16);function h(){if(!c&&(c=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!c))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return c(g)}var y;const u=[];for(let n=0;n<256;++n)u.push((n+256).toString(16).slice(1));function p(n,e=0){return u[n[e+0]]+u[n[e+1]]+u[n[e+2]]+u[n[e+3]]+"-"+u[n[e+4]]+u[n[e+5]]+"-"+u[n[e+6]]+u[n[e+7]]+"-"+u[n[e+8]]+u[n[e+9]]+"-"+u[n[e+10]]+u[n[e+11]]+u[n[e+12]]+u[n[e+13]]+u[n[e+14]]+u[n[e+15]]}function T(n,e=0){const t=p(n,e);if(!y(t))throw TypeError("Stringified UUID is invalid");return t}const w=null;function E(n,e,t){if(l.randomUUID&&!e&&!n)return l.randomUUID();n=n||{};const s=n.random||(n.rng||h)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=s[i];return e}return p(s)}const f=E;var m=I(345),x=I.n(m);const k="elli:remoting",U="elli:remoting:response",G="elli:remoting:exception",S=({messageType:n,messageBody:e,requestId:t,onewayMsg:s=!1})=>({requestId:t??(s?null:f()),source:k,type:n,body:e}),L=n=>{const{targetWin:e,targetOrigin:t,messageType:s,messageBody:i}=n,r=S({messageType:s,messageBody:i});e.postMessage(r,t)};class A{#i;#e;#t=new Map;#a=new Map;#n=null;#s=null;#c=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#i=t,this.#e=e}#p=()=>{this.#n=null;const e=Date.now(),t=[];let s=null;if(this.#a.forEach((i,r)=>{const{requestId:o,cancelTime:d}=i;d&&d<=e?(this.#e.debug(`Detected response timeout for requestId: ${o}...`),t.push(r),i.resolve(void 0)):d&&(s=s===null?d:Math.min(s,d))}),t.forEach(i=>{this.#a.delete(i)}),s!==null){const i=Math.max(s-Date.now(),0);this.#g(i)}};#g=e=>{this.#n===null&&(this.#n=window.setTimeout(this.#p,e))};#f=()=>{this.#n!==null&&(window.clearTimeout(this.#n),this.#n=null)};#r=e=>{const t=this.#a.get(e);return this.#e.debug(`serving requestId: ${e}`),this.#a.delete(e),t};#o=e=>{const{requestId:t}=e;this.#e.debug(`Response received for invocation requestId: ${t}`);const s=this.#r(t);return s?(s.resolve(e.body),!0):(this.#e.debug(`Received response to stale/invalid request with requestId: ${t}`),!1)};#h=e=>{this.#e.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#r(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#e.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#v=({sourceWin:e,sourceOrigin:t,message:s})=>{this.#e.debug(`Received message of type "${s.type}"`);const i=this.#t.get(s.type);return i?(i.forEach(r=>{this.#e.debug(`Invoking message handler ${r.name}`),r({sourceWin:e,sourceOrigin:t,requestId:s.requestId,type:s.type,body:s.body})}),!0):!1};#l=e=>{if(this.#c.size===0||!e.source)return!1;const t=this.#c.get(e.source);return!t||e?.data?.source!==k?!1:(this.#e.debug(`Remoting: Received message of type "${e.data.type}"`),e.data.type===U?this.#o(e.data):e.data.type===G?this.#h(e.data):this.#v({sourceWin:e.source,sourceOrigin:t,message:e.data}),!0)};addSender=e=>{const{origin:t,window:s}=e;if(!t)throw new Error("origin is required");if(!s)throw new Error("window is required");this.#c.set(s,t)};initialize=e=>{this.#s&&this.#s.removeEventListener("message",this.#l),e.addEventListener("message",this.#l),this.#s=e,this.#e.debug(`initialized remoting id: ${this.#i}`)};close=()=>{this.#s&&(this.#s.removeEventListener("message",this.#l),this.#s=null),this.#f(),this.#e.debug(`closed remoting id: ${this.#i}`)};invoke=e=>{const{targetWin:t,targetOrigin:s,messageType:i,messageBody:r,responseTimeoutMs:o}=e;return new Promise((d,O)=>{const v=S({messageType:i,messageBody:r});this.#a.set(v.requestId,{requestId:v.requestId,resolve:d,reject:O,cancelTime:o?Date.now()+o:null}),t.postMessage(v,s);const{requestId:P}=v;this.#e.debug(`Posted invocation message of type ${i} requestId: ${P||""}`),o&&(this.#e.debug(`scheduling timeout check for requestId: ${P||""} in ${o} ms`),this.#g(o))})};listen=e=>{const{messageType:t,callback:s}=e,i=this.#t.get(t)||[];i.push(s),this.#t.set(t,i)};unlisten=e=>{const{messageType:t,callback:s}=e,i=this.#t.get(t);if(!i)return;const r=i.indexOf(s);r!==-1&&i.splice(r,1)};send=e=>{const{targetWin:t,targetOrigin:s,messageType:i,messageBody:r}=e,o=S({messageType:i,messageBody:r,onewayMsg:!0});t.postMessage(o,s),this.#e.debug(`Posted one-way message of type "${i}"`)};removeSender=e=>{const{window:t}=e;t&&this.#c.delete(t)};respond=e=>{const{targetWin:t,targetOrigin:s,requestId:i,response:r}=e,o=S({messageType:U,messageBody:r,requestId:i});t.postMessage(o,s),this.#e.debug(`Response sent to caller for invocation requestId: ${i}`)};raiseException=e=>{const{targetWin:t,targetOrigin:s,requestId:i,ex:r}=e,o=r instanceof Error?r.message:r,d=S({messageType:G,messageBody:o,requestId:i});t.postMessage(d,s),this.#e.debug(`Exception sent to caller for invocation. requestId: ${i}`)}}var j=(n=>(n.GuestClose="guest:close",n.GuestEventSubscribe="guest:eventSubscribe",n.GuestEventUnsubscribe="guest:eventUnsubscribe",n.GuestFocus="guest:focus",n.GuestReady="guest:ready",n.GuestReadyComplete="guest:readyComplete",n.GuestResize="guest:resize",n.HandShake="handshake",n.HandShakeAck="handshake:ack",n.HostClose="host:close",n.HostConfig="host:config",n.ListObjects="list:objects",n.ObjectEvent="object:event",n.ObjectGet="object:get",n.ObjectInvoke="object:invoke",n))(j||{});class W{__TYPE__="Proxy";id;objectType;constructor(e,t){this.id=e,this.objectType=t}}const B=n=>n?.constructor?.name==="Proxy"||n?.constructor?.name==="ScriptingObjectProxy"||n?.__TYPE__==="Proxy";class F{name;objectId;id;constructor(e){const{name:t,objectId:s}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object id is required");this.objectId=s,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase()}}class X{static[Symbol.hasInstance](e){return typeof e=="object"&&e!==null&&"getType"in e&&typeof e.getType=="function"&&e.getType()==="ProxyEvent"}#i;objectId;name;id;getType(){return"ProxyEvent"}constructor(e){const{name:t,objectId:s,eventSrc:i}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object id is required");if(!i)throw new Error("Event source is required");this.objectId=s,this.name=t,this.#i=i,this.id=`${this.objectId}.${this.name}`.toLowerCase()}subscribe=e=>this.#i.subscribe({eventId:this.id,callback:e});unsubscribe=e=>{this.#i.unsubscribe({eventId:this.id,token:e})}}const Z=n=>n instanceof F,V=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`;var _=I(388);const H=()=>{const{parent:n}=window;try{return n?.location?.href}catch{return null}},z=n=>{if(!n||n==="about:blank")return"*";try{const{origin:e}=new URL(n);return e==="null"||!e?"*":e}catch{try{const{origin:e}=new URL(n,document.baseURI);return e==="null"||!e?"*":e}catch{return"*"}}},N=()=>window.self!==window.parent,D=(n,e)=>{const t=e||document.body,s=document.defaultView?.getComputedStyle?.(t,null),i=s?s[n]:"0";return parseInt(i,10)},b=/^https?:\/\/([a-z0-9-]+\.)*(?:elliemae\.io|ellielabs\.com|ellieservices\.com|encompassloconnect\.com|ice\.com|localhost:[0-9]+)$/i,$="elli:remoting",C=3e4,K=()=>new Promise((n,e)=>{if(N())n({origin:z(document.referrer||H()),window:window.parent});else{const t=window;let s;const i=r=>{if(b.test(r.origin)){const{source:o,type:d}=r.data||{};if(o===$&&d===j.HandShake){const{origin:O}=r,v=r.source;clearTimeout(s),L({targetWin:v,targetOrigin:O,messageType:j.HandShakeAck,messageBody:{}}),t.removeEventListener("message",i),n({origin:O,window:v})}}};s=setTimeout(()=>{t.removeEventListener("message",i),e(new Error(`Host handshake timed out after ${C}ms`))},C),t.addEventListener("message",i)}});let M=!1;const re=n=>{M=n},J=(n=null)=>{let e=n;const t=()=>{if(!e&&(e=window.ice?.guest?.SSFGuest?new window.ice.guest.SSFGuest:null,!e))throw new Error("Guest definition not found");return e};window.elli=window.elli??{},window.elli.script={guest:{create:(s,i)=>t().addScript(s,i)},connect:s=>t().connect(s),getObject:s=>t().getObject(s),setLogLevel:s=>t().setLogLevel(s),subscribe:(s,i,r,o)=>t().subscribe({eventId:`${s}.${i}`,callback:d=>r(d?.obj,d?.eventParams,d?.eventOptions),criteria:o?.criteria}),unsubscribe:(s,i,r)=>t().unsubscribe({eventId:`${s}.${i}`,token:r})}};try{J()}catch{}var oe=(n=>(n.OBJECT="object",n.VALUE="value",n))(oe||{});const ee=12e4,ce={eventFeedback:!0},te=()=>{const{document:n}=window,e=n.body,t=n.documentElement,i={height:e.offsetHeight+D("marginTop")+D("marginBottom"),width:Math.max(e.scrollWidth,t.scrollWidth)};L({targetWin:window.parent,targetOrigin:z(n.referrer||H()),messageType:j.GuestResize,messageBody:i}),window.removeEventListener("load",te)};N()&&window.addEventListener("load",te);const se={"cdn.ice.com":"https://api.elliemae.com/diagnostics/v2/logging","cdn.np.ice.com":"https://stg.api.elliemae.com/diagnostics/v2/logging","cdn.uat.ice.com":"https://concept.api.elliemae.com/diagnostics/v2/logging","cdn.pt1.ice.com":"https://pel1.api.ellielabs.com/diagnostics/v2/logging","cdn.qa1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.dev1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.ice.com":"https://api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.s1.ice.com":"https://stg.api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.uat1.ice.com":"https://concept.api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.pl1.ice.com":"https://pel1.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.q1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.d1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging",localhost:"https://int.api.ellielabs.com/diagnostics/v2/logging"},ie=["click","scroll","keypress","touchstart"],ae=()=>{const n=document.currentScript?.src||"file:///opt/jenkins/workspace/UIPlatform_pui-microfe_master/241/libs/ssf-guest/lib/guest.ts",e=n?new URL(n).hostname:"localhost";return se[e]||se["cdn.mortgagetech.q1.ice.com"]};class le{#i;#e;#t;#a=!1;#n=null;#s=!1;#c=new Map;#p=null;#g=null;#f=null;#r=null;#o=null;#h=null;#v=new Map;#l(){if(!this.#o||!this.#r)throw new Error("Guest is not connected to a host. Call connect() first.");return{hostWindow:this.#o,hostOrigin:this.#r}}#E=!1;#u=null;#m=null;#b=null;#S=!0;#j=ee;#O;#w=null;constructor(e){const{console:t=!1,url:s=window.__ICE__?.diagnosticsUrl||ae(),index:i="ssf-guest-v2",team:r="ICE",appName:o="SSF Guest V2 Application"}=e?.logger??{};this.#O=e?.logger,this.#E=e?.usesDevConnectAPI??!1,this.#S=e?.keepAlive??!0,this.#j=e?.keepAliveInterval??ee;const d=t?(0,_.Console)():(0,_.http)(s);this.#e=e?.appLogger??(0,_.logger)({transport:d,index:i,team:r,appName:o}),(0,_.webvitals)(this.#e),(0,_.logUnhandledErrors)(this.#e),this.#i=f(),this.#t=new A(this.#e,this.#i),J(this),this.#e.audit({message:"Guest created",guestUrl:window.location.href,correlationId:this.#i})}#d=()=>({guestId:this.#p,guestTitle:this.#g,guestUrl:this.#f});#y=e=>{if(!e||!e.objectId)throw this.#e.error("Deserialization of scripting object failed. Object does not have an Object ID."),new Error("Cannot deserialize object JSON into proxy.");const t=new W(e.objectId,e.objectType);return e.functions&&e.functions.forEach(s=>{Object.defineProperty(t,s,{value:async(...i)=>this.#x({objectId:t.id,functionName:s,functionParams:[...i]}),enumerable:!0})}),e.events&&e.events.forEach(s=>{Object.defineProperty(t,s,{value:new X({objectId:t.id,name:s,eventSrc:this}),enumerable:!0})}),this.#e.debug(`Created guest proxy for scripting object (id = "${t.id}")`),t};#x=async({objectId:e,functionName:t,functionParams:s})=>{this.#e.debug(`Invoking scripting object method ${e}.${t}()...`);const i=[];if(s)for(let v=0;v<s.length;v+=1){const P=s[v];P instanceof Promise&&i.push(P.then(ne=>{s[v]=ne}))}await Promise.all(i);const{hostWindow:r,hostOrigin:o}=this.#l(),d=await this.#t.invoke({targetWin:r,targetOrigin:o,messageType:j.ObjectInvoke,messageBody:{objectId:e,functionName:t,functionParams:s}}),O=this.#T(d);return this.#e.audit({message:"Guest proxy invoked Scripting Object method",scriptingObject:e,scriptingMethod:t,...this.#d()}),O};#I(e,t){return Object.entries(t).every(([s,i])=>{const r=e[s];if("eq"in i)return r===i.eq;if("in"in i)return Array.isArray(i.in)&&i.in.includes(r);if("includes"in i)return Array.isArray(r)&&r.includes(i.includes);if("gt"in i){const o=typeof r=="number"?r:Number(r);return!Number.isNaN(o)&&o>i.gt}if("lt"in i){const o=typeof r=="number"?r:Number(r);return!Number.isNaN(o)&&o<i.lt}if("regex"in i)try{let o=this.#v.get(i.regex);return o||(o=new RegExp(i.regex),this.#v.set(i.regex,o)),typeof r=="string"&&o.test(r)}catch{return!1}return!1})}#T=e=>e?.type==="object"&&"object"in e?this.#y(e.object):e?.type==="value"?e.value:e;#k=({body:e})=>{e?.logLevel&&(this.#e.setLogLevel(e.logLevel),this.#e.debug(`Log level changed by host to ${e.logLevel}`)),this.#p=e?.guestId??null,this.#g=e?.guestTitle??null,this.#f=e?.guestUrl??null,this.#e.audit({message:"Received configuration from Host",...this.#d()})};#L=()=>{window.focus()};#_=async()=>{await this.close(),window.close()};#$=()=>{N()||(this.#h=setInterval(()=>{this.#o?.closed&&this.close().then(()=>{window.close()}).catch(()=>{})},1e3))};#P=async({sourceWin:e,sourceOrigin:t,requestId:s,body:i})=>{const r=this.#y(i.object);if(r){const o=V(r.id,i.eventName);this.#e.debug(`Received event "${o}" from host`);let d;i.eventHandler?d=[{callback:window[i.eventHandler],token:f()}]:d=this.#c.get(o)||[];const O=[];if(d.forEach(v=>{if(v?.callback){if(v.criteria&&!(i.eventParams?this.#I(i.eventParams,v.criteria):!1)){this.#e.debug(`Event ${o} did not match criteria for subscriber ${v.callback.name}`);return}this.#e.debug(`Invoking event subscriber ${v.callback.name} for event ${o}`);const P=v.callback({obj:r,eventName:i.eventName,eventParams:i.eventParams,eventOptions:i.eventOptions});P instanceof Promise?O.push(P):typeof P<"u"&&O.push(Promise.resolve(P))}}),s){const v=await Promise.all(O);this.#t.respond({targetWin:e,targetOrigin:t,requestId:s,response:v}),this.#e.audit({message:"Guest proxy processed event from host and responded",scriptingEventId:o,scriptingObject:r.id,...this.#d()})}else this.#e.audit({message:"Guest proxy processed event from host",scriptingEventId:o,scriptingObject:r.id,...this.#d()})}};#G=async()=>{if(!(!this.#u||!this.#m||!this.#b))try{await fetch(`${this.#b}/oauth2/v1/token/introspection?${new URLSearchParams({token:this.#u,client_id:this.#m}).toString()}`,{headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8"},method:"POST"})}catch(e){this.#e.warn(`Failed to extend token lifetime: ${e.message}`)}};#C=async()=>{if(this.#u&&this.#m&&this.#b)try{await fetch(`${this.#b}/oauth2/v1/token/revocation?${new URLSearchParams({token:this.#u,client_id:this.#m}).toString()}`,{method:"POST"})}catch(e){this.#e.error(`Error revoking token. ${e.message}`)}finally{this.#u=null,this.#m=null}};#R=async()=>{if(this.#S)try{const e=await this.getObject("application");e?(this.#w=x()(async()=>{try{await e.keepSessionAlive(),await this.#G()}catch(t){this.#e.error(`Error keeping session alive. ${t.message}`)}},this.#j,{leading:!1}),ie.forEach(t=>{document.addEventListener(t,this.#w)})):this.#e.warn("Application object not available to send keep alive")}catch(e){this.#e.error(`Error getting application object. ${e.message}`)}};addScript=async(e,t)=>{if(!this.#a&&e){await this.connect();const s=document.createElement("script");s.setAttribute("src",e),s.setAttribute("type","module"),await new Promise((i,r)=>{let o,d;const O=()=>{s.removeEventListener("load",o),s.removeEventListener("error",d)};o=()=>{O(),this.#a=!0,re(!0),i()},d=()=>{O(),r(new Error(`Failed to load script: ${e}`))},s.addEventListener("load",o),s.addEventListener("error",d),this.#n=t.appendChild(s)})}};close=async()=>{this.#s&&(this.#o&&this.#r&&(this.#t.send({targetWin:this.#o,targetOrigin:this.#r,messageType:j.GuestClose,messageBody:{}}),this.#t.removeSender({origin:this.#r,window:this.#o})),this.#t.close(),this.#h&&(clearInterval(this.#h),this.#h=null),this.#w&&ie.forEach(e=>{document.removeEventListener(e,this.#w)}),await this.#C(),window.removeEventListener("beforeunload",this.close),this.#s=!1,this.#e.audit({message:"Guest disconnected from host",...this.#d()}),this.#p=null,this.#f=null,this.#g=null)};connect=async e=>{if(!this.#s){let t=window,s={...ce};if(e){const{window:r,...o}=e;r&&(t=r),s={...s,...o}}const i=await K();this.#r=i.origin,this.#o=i.window,this.#t.initialize(t),this.#t.addSender({origin:this.#r,window:this.#o}),this.#t.listen({messageType:j.ObjectEvent,callback:this.#P.bind(this)}),this.#t.listen({messageType:j.HostConfig,callback:this.#k.bind(this)}),this.#t.listen({messageType:j.GuestFocus,callback:this.#L.bind(this)}),this.#t.listen({messageType:j.HostClose,callback:this.#_.bind(this)}),this.#t.send({targetWin:this.#o,targetOrigin:this.#r,messageType:j.GuestReady,messageBody:s}),this.#s=!0,this.#$(),this.#E&&await this.getAuthToken(),await this.#R(),window.addEventListener("beforeunload",this.close),this.#e.audit({message:"Guest connected to host",guestUrl:window.location.href})}};getAuthToken=async()=>{if(!this.#u&&this.#s)try{const e=await this.getObject("auth");if(e){const t=await e.getAccessToken();this.#u=t?.access_token,this.#b=t?.host_name,this.#m=t?.client_id}else this.#e.warn("Auth object not available to get access token from host")}catch(e){this.#e.error(`Error getting access token from auth object. ${e.message}`)}return this.#u};getObject=async e=>{if(this.#e.debug(`Retrieving scripting object "${e}" from host...`),!this.#s)throw new Error("Not connected to host");const{hostWindow:t,hostOrigin:s}=this.#l(),i=await this.#t.invoke({targetWin:t,targetOrigin:s,messageType:j.ObjectGet,messageBody:{objectId:e}}),r=this.#y(i.object);return this.#e.audit({message:"Received scripting object from host",scriptingObject:e,...this.#d()}),r};listObjects=async()=>{if(this.#e.debug("Retrieving names of scripting objects exposed by host..."),!this.#s)throw new Error("Not connected to host");const{hostWindow:e,hostOrigin:t}=this.#l(),s=await this.#t.invoke({targetWin:e,targetOrigin:t,messageType:j.ListObjects,messageBody:{}});return this.#e.audit({message:"Received names of all scripting objects exposed by host",objects:s,...this.#d()}),s};removeScript=()=>{if(this.#a&&this.#n){const{parentNode:e}=this.#n;e?.removeChild?.(this.#n)}};setLogLevel=e=>{this.#e.setLogLevel(e),this.#e.debug(`Log level changed by guest to ${e}`)};subscribe=e=>{const{eventId:t,criteria:s,callback:i}=e;this.#e.debug(`Registering subscription for event ${t}`);const r=this.#c.get(t.toLowerCase())||[],o=f();r.push({callback:i,token:o,criteria:s}),this.#c.set(t.toLowerCase(),r);const{hostWindow:d,hostOrigin:O}=this.#l();return this.#t.send({targetWin:d,targetOrigin:O,messageType:j.GuestEventSubscribe,messageBody:{eventId:t,criteria:s,token:o}}),this.#e.debug(`Subscribed to event ${t} with token ${o}`),o};unsubscribe=e=>{const{eventId:t,token:s}=e,i=this.#c.get(t.toLowerCase());if(i){const r=i.length,o=i.filter(d=>d.token!==s);if(o.length<r){this.#c.set(t.toLowerCase(),o);const{hostWindow:d,hostOrigin:O}=this.#l();this.#t.send({targetWin:d,targetOrigin:O,messageType:j.GuestEventUnsubscribe,messageBody:{eventId:t,token:s}}),this.#e.debug(`Unsubscribed from event ${t}`)}}}}})(),Y})());
|
|
1
|
+
(function(q,R){typeof exports=="object"&&typeof module=="object"?module.exports=R(require("emuiDiagnostics")):typeof define=="function"&&define.amd?define(["emuiDiagnostics"],R):typeof exports=="object"?exports.ice=R(require("emuiDiagnostics")):(q.ice=q.ice||{},q.ice.guest=R(q.emuiDiagnostics))})(globalThis,Q=>(()=>{var q={572(a,l,c){var g=c(736),h=g.Symbol;a.exports=h},561(a,l,c){var g=c(572),h=c(504),y=c(567),u="[object Null]",p="[object Undefined]",T=g?g.toStringTag:void 0;function w(E){return E==null?E===void 0?p:u:T&&T in Object(E)?h(E):y(E)}a.exports=w},605(a,l,c){var g=c(327),h=/^\s+/;function y(u){return u&&u.slice(0,g(u)+1).replace(h,"")}a.exports=y},433(a){var l=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;a.exports=l},504(a,l,c){var g=c(572),h=Object.prototype,y=h.hasOwnProperty,u=h.toString,p=g?g.toStringTag:void 0;function T(w){var E=y.call(w,p),f=w[p];try{w[p]=void 0;var m=!0}catch{}var x=u.call(w);return m&&(E?w[p]=f:delete w[p]),x}a.exports=T},567(a){var l=Object.prototype,c=l.toString;function g(h){return c.call(h)}a.exports=g},736(a,l,c){var g=c(433),h=typeof self=="object"&&self&&self.Object===Object&&self,y=g||h||Function("return this")();a.exports=y},327(a){var l=/\s/;function c(g){for(var h=g.length;h--&&l.test(g.charAt(h)););return h}a.exports=c},702(a,l,c){var g=c(230),h=c(381),y=c(569),u="Expected a function",p=Math.max,T=Math.min;function w(E,f,m){var x,k,U,G,S,L,A=0,j=!1,W=!1,B=!0;if(typeof E!="function")throw new TypeError(u);f=y(f)||0,g(m)&&(j=!!m.leading,W="maxWait"in m,U=W?p(y(m.maxWait)||0,f):U,B="trailing"in m?!!m.trailing:B);function F(b){var $=x,C=k;return x=k=void 0,A=b,G=E.apply(C,$),G}function X(b){return A=b,S=setTimeout(_,f),j?F(b):G}function Z(b){var $=b-L,C=b-A,K=f-$;return W?T(K,U-C):K}function V(b){var $=b-L,C=b-A;return L===void 0||$>=f||$<0||W&&C>=U}function _(){var b=h();if(V(b))return H(b);S=setTimeout(_,Z(b))}function H(b){return S=void 0,B&&x?F(b):(x=k=void 0,G)}function z(){S!==void 0&&clearTimeout(S),A=0,x=L=k=S=void 0}function N(){return S===void 0?G:H(h())}function D(){var b=h(),$=V(b);if(x=arguments,k=this,L=b,$){if(S===void 0)return X(L);if(W)return clearTimeout(S),S=setTimeout(_,f),F(L)}return S===void 0&&(S=setTimeout(_,f)),G}return D.cancel=z,D.flush=N,D}a.exports=w},230(a){function l(c){var g=typeof c;return c!=null&&(g=="object"||g=="function")}a.exports=l},470(a){function l(c){return c!=null&&typeof c=="object"}a.exports=l},89(a,l,c){var g=c(561),h=c(470),y="[object Symbol]";function u(p){return typeof p=="symbol"||h(p)&&g(p)==y}a.exports=u},381(a,l,c){var g=c(736),h=function(){return g.Date.now()};a.exports=h},345(a,l,c){var g=c(702),h=c(230),y="Expected a function";function u(p,T,w){var E=!0,f=!0;if(typeof p!="function")throw new TypeError(y);return h(w)&&(E="leading"in w?!!w.leading:E,f="trailing"in w?!!w.trailing:f),g(p,T,{leading:E,maxWait:T,trailing:f})}a.exports=u},569(a,l,c){var g=c(605),h=c(230),y=c(89),u=NaN,p=/^[-+]0x[0-9a-f]+$/i,T=/^0b[01]+$/i,w=/^0o[0-7]+$/i,E=parseInt;function f(m){if(typeof m=="number")return m;if(y(m))return u;if(h(m)){var x=typeof m.valueOf=="function"?m.valueOf():m;m=h(x)?x+"":x}if(typeof m!="string")return m===0?m:+m;m=g(m);var k=T.test(m);return k||w.test(m)?E(m.slice(2),k?2:8):p.test(m)?u:+m}a.exports=f},388(a){"use strict";a.exports=Q}},R={};function I(a){var l=R[a];if(l!==void 0)return l.exports;var c=R[a]={exports:{}};return q[a](c,c.exports,I),c.exports}I.n=a=>{var l=a&&a.__esModule?()=>a.default:()=>a;return I.d(l,{a:l}),l},I.d=(a,l)=>{for(var c in l)I.o(l,c)&&!I.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:l[c]})},I.o=(a,l)=>Object.prototype.hasOwnProperty.call(a,l),I.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var Y={};return(()=>{"use strict";I.r(Y),I.d(Y,{SSFGuest:()=>le});const l={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let c;const g=new Uint8Array(16);function h(){if(!c&&(c=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!c))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return c(g)}var y;const u=[];for(let n=0;n<256;++n)u.push((n+256).toString(16).slice(1));function p(n,e=0){return u[n[e+0]]+u[n[e+1]]+u[n[e+2]]+u[n[e+3]]+"-"+u[n[e+4]]+u[n[e+5]]+"-"+u[n[e+6]]+u[n[e+7]]+"-"+u[n[e+8]]+u[n[e+9]]+"-"+u[n[e+10]]+u[n[e+11]]+u[n[e+12]]+u[n[e+13]]+u[n[e+14]]+u[n[e+15]]}function T(n,e=0){const t=p(n,e);if(!y(t))throw TypeError("Stringified UUID is invalid");return t}const w=null;function E(n,e,t){if(l.randomUUID&&!e&&!n)return l.randomUUID();n=n||{};const s=n.random||(n.rng||h)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=s[i];return e}return p(s)}const f=E;var m=I(345),x=I.n(m);const k="elli:remoting",U="elli:remoting:response",G="elli:remoting:exception",S=({messageType:n,messageBody:e,requestId:t,onewayMsg:s=!1})=>({requestId:t??(s?null:f()),source:k,type:n,body:e}),L=n=>{const{targetWin:e,targetOrigin:t,messageType:s,messageBody:i}=n,r=S({messageType:s,messageBody:i});e.postMessage(r,t)};class A{#i;#e;#t=new Map;#a=new Map;#n=null;#s=null;#c=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#i=t,this.#e=e}#p=()=>{this.#n=null;const e=Date.now(),t=[];let s=null;if(this.#a.forEach((i,r)=>{const{requestId:o,cancelTime:d}=i;d&&d<=e?(this.#e.debug(`Detected response timeout for requestId: ${o}...`),t.push(r),i.resolve(void 0)):d&&(s=s===null?d:Math.min(s,d))}),t.forEach(i=>{this.#a.delete(i)}),s!==null){const i=Math.max(s-Date.now(),0);this.#g(i)}};#g=e=>{this.#n===null&&(this.#n=window.setTimeout(this.#p,e))};#f=()=>{this.#n!==null&&(window.clearTimeout(this.#n),this.#n=null)};#r=e=>{const t=this.#a.get(e);return this.#e.debug(`serving requestId: ${e}`),this.#a.delete(e),t};#o=e=>{const{requestId:t}=e;this.#e.debug(`Response received for invocation requestId: ${t}`);const s=this.#r(t);return s?(s.resolve(e.body),!0):(this.#e.debug(`Received response to stale/invalid request with requestId: ${t}`),!1)};#h=e=>{this.#e.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#r(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#e.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#v=({sourceWin:e,sourceOrigin:t,message:s})=>{this.#e.debug(`Received message of type "${s.type}"`);const i=this.#t.get(s.type);return i?(i.forEach(r=>{this.#e.debug(`Invoking message handler ${r.name}`),r({sourceWin:e,sourceOrigin:t,requestId:s.requestId,type:s.type,body:s.body})}),!0):!1};#l=e=>{if(this.#c.size===0||!e.source)return!1;const t=this.#c.get(e.source);return!t||e?.data?.source!==k?!1:(this.#e.debug(`Remoting: Received message of type "${e.data.type}"`),e.data.type===U?this.#o(e.data):e.data.type===G?this.#h(e.data):this.#v({sourceWin:e.source,sourceOrigin:t,message:e.data}),!0)};addSender=e=>{const{origin:t,window:s}=e;if(!t)throw new Error("origin is required");if(!s)throw new Error("window is required");this.#c.set(s,t)};initialize=e=>{this.#s&&this.#s.removeEventListener("message",this.#l),e.addEventListener("message",this.#l),this.#s=e,this.#e.debug(`initialized remoting id: ${this.#i}`)};close=()=>{this.#s&&(this.#s.removeEventListener("message",this.#l),this.#s=null),this.#f(),this.#e.debug(`closed remoting id: ${this.#i}`)};invoke=e=>{const{targetWin:t,targetOrigin:s,messageType:i,messageBody:r,responseTimeoutMs:o}=e;return new Promise((d,O)=>{const v=S({messageType:i,messageBody:r});this.#a.set(v.requestId,{requestId:v.requestId,resolve:d,reject:O,cancelTime:o?Date.now()+o:null}),t.postMessage(v,s);const{requestId:P}=v;this.#e.debug(`Posted invocation message of type ${i} requestId: ${P||""}`),o&&(this.#e.debug(`scheduling timeout check for requestId: ${P||""} in ${o} ms`),this.#g(o))})};listen=e=>{const{messageType:t,callback:s}=e,i=this.#t.get(t)||[];i.push(s),this.#t.set(t,i)};unlisten=e=>{const{messageType:t,callback:s}=e,i=this.#t.get(t);if(!i)return;const r=i.indexOf(s);r!==-1&&i.splice(r,1)};send=e=>{const{targetWin:t,targetOrigin:s,messageType:i,messageBody:r}=e,o=S({messageType:i,messageBody:r,onewayMsg:!0});t.postMessage(o,s),this.#e.debug(`Posted one-way message of type "${i}"`)};removeSender=e=>{const{window:t}=e;t&&this.#c.delete(t)};respond=e=>{const{targetWin:t,targetOrigin:s,requestId:i,response:r}=e,o=S({messageType:U,messageBody:r,requestId:i});t.postMessage(o,s),this.#e.debug(`Response sent to caller for invocation requestId: ${i}`)};raiseException=e=>{const{targetWin:t,targetOrigin:s,requestId:i,ex:r}=e,o=r instanceof Error?r.message:r,d=S({messageType:G,messageBody:o,requestId:i});t.postMessage(d,s),this.#e.debug(`Exception sent to caller for invocation. requestId: ${i}`)}}var j=(n=>(n.GuestClose="guest:close",n.GuestEventSubscribe="guest:eventSubscribe",n.GuestEventUnsubscribe="guest:eventUnsubscribe",n.GuestFocus="guest:focus",n.GuestReady="guest:ready",n.GuestReadyComplete="guest:readyComplete",n.GuestResize="guest:resize",n.HandShake="handshake",n.HandShakeAck="handshake:ack",n.HostClose="host:close",n.HostConfig="host:config",n.ListObjects="list:objects",n.ObjectEvent="object:event",n.ObjectGet="object:get",n.ObjectInvoke="object:invoke",n))(j||{});class W{__TYPE__="Proxy";id;objectType;constructor(e,t){this.id=e,this.objectType=t}}const B=n=>n?.constructor?.name==="Proxy"||n?.constructor?.name==="ScriptingObjectProxy"||n?.__TYPE__==="Proxy";class F{name;objectId;id;constructor(e){const{name:t,objectId:s}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object id is required");this.objectId=s,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase()}}class X{static[Symbol.hasInstance](e){return typeof e=="object"&&e!==null&&"getType"in e&&typeof e.getType=="function"&&e.getType()==="ProxyEvent"}#i;objectId;name;id;getType(){return"ProxyEvent"}constructor(e){const{name:t,objectId:s,eventSrc:i}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object id is required");if(!i)throw new Error("Event source is required");this.objectId=s,this.name=t,this.#i=i,this.id=`${this.objectId}.${this.name}`.toLowerCase()}subscribe=e=>this.#i.subscribe({eventId:this.id,callback:e});unsubscribe=e=>{this.#i.unsubscribe({eventId:this.id,token:e})}}const Z=n=>n instanceof F,V=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`;var _=I(388);const H=()=>{const{parent:n}=window;try{return n?.location?.href}catch{return null}},z=n=>{if(!n||n==="about:blank")return"*";try{const{origin:e}=new URL(n);return e==="null"||!e?"*":e}catch{try{const{origin:e}=new URL(n,document.baseURI);return e==="null"||!e?"*":e}catch{return"*"}}},N=()=>window.self!==window.parent,D=(n,e)=>{const t=e||document.body,s=document.defaultView?.getComputedStyle?.(t,null),i=s?s[n]:"0";return parseInt(i,10)},b=/^https?:\/\/([a-z0-9-]+\.)*(?:elliemae\.io|ellielabs\.com|ellieservices\.com|encompassloconnect\.com|ice\.com|localhost:[0-9]+)$/i,$="elli:remoting",C=3e4,K=()=>new Promise((n,e)=>{if(N())n({origin:z(document.referrer||H()),window:window.parent});else{const t=window;let s;const i=r=>{if(b.test(r.origin)){const{source:o,type:d}=r.data||{};if(o===$&&d===j.HandShake){const{origin:O}=r,v=r.source;clearTimeout(s),L({targetWin:v,targetOrigin:O,messageType:j.HandShakeAck,messageBody:{}}),t.removeEventListener("message",i),n({origin:O,window:v})}}};s=setTimeout(()=>{t.removeEventListener("message",i),e(new Error(`Host handshake timed out after ${C}ms`))},C),t.addEventListener("message",i)}});let M=!1;const re=n=>{M=n},J=(n=null)=>{let e=n;const t=()=>{if(!e&&(e=window.ice?.guest?.SSFGuest?new window.ice.guest.SSFGuest:null,!e))throw new Error("Guest definition not found");return e};window.elli=window.elli??{},window.elli.script={guest:{create:(s,i)=>t().addScript(s,i)},connect:s=>t().connect(s),getObject:s=>t().getObject(s),setLogLevel:s=>t().setLogLevel(s),subscribe:(s,i,r,o)=>t().subscribe({eventId:`${s}.${i}`,callback:d=>r(d?.obj,d?.eventParams,d?.eventOptions),criteria:o?.criteria}),unsubscribe:(s,i,r)=>t().unsubscribe({eventId:`${s}.${i}`,token:r})}};try{J()}catch{}var oe=(n=>(n.OBJECT="object",n.VALUE="value",n))(oe||{});const ee=12e4,ce={eventFeedback:!0},te=()=>{const{document:n}=window,e=n.body,t=n.documentElement,i={height:e.offsetHeight+D("marginTop")+D("marginBottom"),width:Math.max(e.scrollWidth,t.scrollWidth)};L({targetWin:window.parent,targetOrigin:z(n.referrer||H()),messageType:j.GuestResize,messageBody:i}),window.removeEventListener("load",te)};N()&&window.addEventListener("load",te);const se={"cdn.ice.com":"https://api.elliemae.com/diagnostics/v2/logging","cdn.np.ice.com":"https://stg.api.elliemae.com/diagnostics/v2/logging","cdn.uat.ice.com":"https://concept.api.elliemae.com/diagnostics/v2/logging","cdn.pt1.ice.com":"https://pel1.api.ellielabs.com/diagnostics/v2/logging","cdn.qa1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.dev1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.ice.com":"https://api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.s1.ice.com":"https://stg.api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.uat1.ice.com":"https://concept.api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.pl1.ice.com":"https://pel1.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.q1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.d1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging",localhost:"https://int.api.ellielabs.com/diagnostics/v2/logging"},ie=["click","scroll","keypress","touchstart"],ae=()=>{const n=document.currentScript?.src||"file:///opt/jenkins/workspace/UIPlatform_pui-microfe_master/245/libs/ssf-guest/lib/guest.ts",e=n?new URL(n).hostname:"localhost";return se[e]||se["cdn.mortgagetech.q1.ice.com"]};class le{#i;#e;#t;#a=!1;#n=null;#s=!1;#c=new Map;#p=null;#g=null;#f=null;#r=null;#o=null;#h=null;#v=new Map;#l(){if(!this.#o||!this.#r)throw new Error("Guest is not connected to a host. Call connect() first.");return{hostWindow:this.#o,hostOrigin:this.#r}}#E=!1;#u=null;#m=null;#b=null;#S=!0;#j=ee;#O;#w=null;constructor(e){const{console:t=!1,url:s=window.__ICE__?.diagnosticsUrl||ae(),index:i="ssf-guest-v2",team:r="ICE",appName:o="SSF Guest V2 Application"}=e?.logger??{};this.#O=e?.logger,this.#E=e?.usesDevConnectAPI??!1,this.#S=e?.keepAlive??!0,this.#j=e?.keepAliveInterval??ee;const d=t?(0,_.Console)():(0,_.http)(s);this.#e=e?.appLogger??(0,_.logger)({transport:d,index:i,team:r,appName:o}),(0,_.webvitals)(this.#e),(0,_.logUnhandledErrors)(this.#e),this.#i=f(),this.#t=new A(this.#e,this.#i),J(this),this.#e.audit({message:"Guest created",guestUrl:window.location.href,correlationId:this.#i})}#d=()=>({guestId:this.#p,guestTitle:this.#g,guestUrl:this.#f});#y=e=>{if(!e||!e.objectId)throw this.#e.error("Deserialization of scripting object failed. Object does not have an Object ID."),new Error("Cannot deserialize object JSON into proxy.");const t=new W(e.objectId,e.objectType);return e.functions&&e.functions.forEach(s=>{Object.defineProperty(t,s,{value:async(...i)=>this.#x({objectId:t.id,functionName:s,functionParams:[...i]}),enumerable:!0})}),e.events&&e.events.forEach(s=>{Object.defineProperty(t,s,{value:new X({objectId:t.id,name:s,eventSrc:this}),enumerable:!0})}),this.#e.debug(`Created guest proxy for scripting object (id = "${t.id}")`),t};#x=async({objectId:e,functionName:t,functionParams:s})=>{this.#e.debug(`Invoking scripting object method ${e}.${t}()...`);const i=[];if(s)for(let v=0;v<s.length;v+=1){const P=s[v];P instanceof Promise&&i.push(P.then(ne=>{s[v]=ne}))}await Promise.all(i);const{hostWindow:r,hostOrigin:o}=this.#l(),d=await this.#t.invoke({targetWin:r,targetOrigin:o,messageType:j.ObjectInvoke,messageBody:{objectId:e,functionName:t,functionParams:s}}),O=this.#T(d);return this.#e.audit({message:"Guest proxy invoked Scripting Object method",scriptingObject:e,scriptingMethod:t,...this.#d()}),O};#I(e,t){return Object.entries(t).every(([s,i])=>{const r=e[s];if("eq"in i)return r===i.eq;if("in"in i)return Array.isArray(i.in)&&i.in.includes(r);if("includes"in i)return Array.isArray(r)&&r.includes(i.includes);if("gt"in i){const o=typeof r=="number"?r:Number(r);return!Number.isNaN(o)&&o>i.gt}if("lt"in i){const o=typeof r=="number"?r:Number(r);return!Number.isNaN(o)&&o<i.lt}if("regex"in i)try{let o=this.#v.get(i.regex);return o||(o=new RegExp(i.regex),this.#v.set(i.regex,o)),typeof r=="string"&&o.test(r)}catch{return!1}return!1})}#T=e=>e?.type==="object"&&"object"in e?this.#y(e.object):e?.type==="value"?e.value:e;#k=({body:e})=>{e?.logLevel&&(this.#e.setLogLevel(e.logLevel),this.#e.debug(`Log level changed by host to ${e.logLevel}`)),this.#p=e?.guestId??null,this.#g=e?.guestTitle??null,this.#f=e?.guestUrl??null,this.#e.audit({message:"Received configuration from Host",...this.#d()})};#L=()=>{window.focus()};#_=async()=>{await this.close(),window.close()};#$=()=>{N()||(this.#h=setInterval(()=>{this.#o?.closed&&this.close().then(()=>{window.close()}).catch(()=>{})},1e3))};#P=async({sourceWin:e,sourceOrigin:t,requestId:s,body:i})=>{const r=this.#y(i.object);if(r){const o=V(r.id,i.eventName);this.#e.debug(`Received event "${o}" from host`);let d;i.eventHandler?d=[{callback:window[i.eventHandler],token:f()}]:d=this.#c.get(o)||[];const O=[];if(d.forEach(v=>{if(v?.callback){if(v.criteria&&!(i.eventParams?this.#I(i.eventParams,v.criteria):!1)){this.#e.debug(`Event ${o} did not match criteria for subscriber ${v.callback.name}`);return}this.#e.debug(`Invoking event subscriber ${v.callback.name} for event ${o}`);const P=v.callback({obj:r,eventName:i.eventName,eventParams:i.eventParams,eventOptions:i.eventOptions});P instanceof Promise?O.push(P):typeof P<"u"&&O.push(Promise.resolve(P))}}),s){const v=await Promise.all(O);this.#t.respond({targetWin:e,targetOrigin:t,requestId:s,response:v}),this.#e.audit({message:"Guest proxy processed event from host and responded",scriptingEventId:o,scriptingObject:r.id,...this.#d()})}else this.#e.audit({message:"Guest proxy processed event from host",scriptingEventId:o,scriptingObject:r.id,...this.#d()})}};#G=async()=>{if(!(!this.#u||!this.#m||!this.#b))try{await fetch(`${this.#b}/oauth2/v1/token/introspection?${new URLSearchParams({token:this.#u,client_id:this.#m}).toString()}`,{headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8"},method:"POST"})}catch(e){this.#e.warn(`Failed to extend token lifetime: ${e.message}`)}};#C=async()=>{if(this.#u&&this.#m&&this.#b)try{await fetch(`${this.#b}/oauth2/v1/token/revocation?${new URLSearchParams({token:this.#u,client_id:this.#m}).toString()}`,{method:"POST"})}catch(e){this.#e.error(`Error revoking token. ${e.message}`)}finally{this.#u=null,this.#m=null}};#R=async()=>{if(this.#S)try{const e=await this.getObject("application");e?(this.#w=x()(async()=>{try{await e.keepSessionAlive(),await this.#G()}catch(t){this.#e.error(`Error keeping session alive. ${t.message}`)}},this.#j,{leading:!1}),ie.forEach(t=>{document.addEventListener(t,this.#w)})):this.#e.warn("Application object not available to send keep alive")}catch(e){this.#e.error(`Error getting application object. ${e.message}`)}};addScript=async(e,t)=>{if(!this.#a&&e){await this.connect();const s=document.createElement("script");s.setAttribute("src",e),s.setAttribute("type","module"),await new Promise((i,r)=>{let o,d;const O=()=>{s.removeEventListener("load",o),s.removeEventListener("error",d)};o=()=>{O(),this.#a=!0,re(!0),i()},d=()=>{O(),r(new Error(`Failed to load script: ${e}`))},s.addEventListener("load",o),s.addEventListener("error",d),this.#n=t.appendChild(s)})}};close=async()=>{this.#s&&(this.#o&&this.#r&&(this.#t.send({targetWin:this.#o,targetOrigin:this.#r,messageType:j.GuestClose,messageBody:{}}),this.#t.removeSender({origin:this.#r,window:this.#o})),this.#t.close(),this.#h&&(clearInterval(this.#h),this.#h=null),this.#w&&ie.forEach(e=>{document.removeEventListener(e,this.#w)}),await this.#C(),window.removeEventListener("beforeunload",this.close),this.#s=!1,this.#e.audit({message:"Guest disconnected from host",...this.#d()}),this.#p=null,this.#f=null,this.#g=null)};connect=async e=>{if(!this.#s){let t=window,s={...ce};if(e){const{window:r,...o}=e;r&&(t=r),s={...s,...o}}const i=await K();this.#r=i.origin,this.#o=i.window,this.#t.initialize(t),this.#t.addSender({origin:this.#r,window:this.#o}),this.#t.listen({messageType:j.ObjectEvent,callback:this.#P.bind(this)}),this.#t.listen({messageType:j.HostConfig,callback:this.#k.bind(this)}),this.#t.listen({messageType:j.GuestFocus,callback:this.#L.bind(this)}),this.#t.listen({messageType:j.HostClose,callback:this.#_.bind(this)}),this.#t.send({targetWin:this.#o,targetOrigin:this.#r,messageType:j.GuestReady,messageBody:s}),this.#s=!0,this.#$(),this.#E&&await this.getAuthToken(),await this.#R(),window.addEventListener("beforeunload",this.close),this.#e.audit({message:"Guest connected to host",guestUrl:window.location.href})}};getAuthToken=async()=>{if(!this.#u&&this.#s)try{const e=await this.getObject("auth");if(e){const t=await e.getAccessToken();this.#u=t?.access_token,this.#b=t?.host_name,this.#m=t?.client_id}else this.#e.warn("Auth object not available to get access token from host")}catch(e){this.#e.error(`Error getting access token from auth object. ${e.message}`)}return this.#u};getObject=async e=>{if(this.#e.debug(`Retrieving scripting object "${e}" from host...`),!this.#s)throw new Error("Not connected to host");const{hostWindow:t,hostOrigin:s}=this.#l(),i=await this.#t.invoke({targetWin:t,targetOrigin:s,messageType:j.ObjectGet,messageBody:{objectId:e}}),r=this.#y(i.object);return this.#e.audit({message:"Received scripting object from host",scriptingObject:e,...this.#d()}),r};listObjects=async()=>{if(this.#e.debug("Retrieving names of scripting objects exposed by host..."),!this.#s)throw new Error("Not connected to host");const{hostWindow:e,hostOrigin:t}=this.#l(),s=await this.#t.invoke({targetWin:e,targetOrigin:t,messageType:j.ListObjects,messageBody:{}});return this.#e.audit({message:"Received names of all scripting objects exposed by host",objects:s,...this.#d()}),s};removeScript=()=>{if(this.#a&&this.#n){const{parentNode:e}=this.#n;e?.removeChild?.(this.#n)}};setLogLevel=e=>{this.#e.setLogLevel(e),this.#e.debug(`Log level changed by guest to ${e}`)};subscribe=e=>{const{eventId:t,criteria:s,callback:i}=e;this.#e.debug(`Registering subscription for event ${t}`);const r=this.#c.get(t.toLowerCase())||[],o=f();r.push({callback:i,token:o,criteria:s}),this.#c.set(t.toLowerCase(),r);const{hostWindow:d,hostOrigin:O}=this.#l();return this.#t.send({targetWin:d,targetOrigin:O,messageType:j.GuestEventSubscribe,messageBody:{eventId:t,criteria:s,token:o}}),this.#e.debug(`Subscribed to event ${t} with token ${o}`),o};unsubscribe=e=>{const{eventId:t,token:s}=e,i=this.#c.get(t.toLowerCase());if(i){const r=i.length,o=i.filter(d=>d.token!==s);if(o.length<r){this.#c.set(t.toLowerCase(),o);const{hostWindow:d,hostOrigin:O}=this.#l();this.#t.send({targetWin:d,targetOrigin:O,messageType:j.GuestEventUnsubscribe,messageBody:{eventId:t,token:s}}),this.#e.debug(`Unsubscribed from event ${t}`)}}}}})(),Y})());
|
|
2
2
|
|
|
3
|
-
//# sourceMappingURL=emuiSsfGuest.
|
|
3
|
+
//# sourceMappingURL=emuiSsfGuest.dc017a38b78ac30a1aa3.js.map
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1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M,uBAAuBmJ,CAAO,eAAejG,CAAK,EAAE,EAChEA,CACT,EAMA,YACExD,GACG,CACH,KAAM,CAAE,QAAAyJ,EAAS,MAAAjG,CAAM,EAAIxD,EACrB0J,EAAY,KAAK/C,GAAgB,IAAI8C,EAAQ,YAAY,CAAC,EAChE,GAAIC,EAAW,CACb,MAAMsB,EAAiBtB,EAAU,OAC3BuB,EAAoBvB,EAAU,OACjCC,GAAiBA,EAAa,QAAUnG,CAC3C,EAGA,GAAIyH,EAAkB,OAASD,EAAgB,CAC7C,KAAKrE,GAAgB,IAAI8C,EAAQ,YAAY,EAAGwB,CAAiB,EACjE,KAAM,CAAE,WAAAnG,EAAY,WAAA4D,CAAW,EAAI,KAAKvB,GAAa,EACrD,KAAKZ,GAAU,KAAK,CAClB,UAAWzB,EACX,aAAc4D,EACd,YAAa7F,EAAY,sBACzB,YAAa,CACX,QAAA4G,EACA,MAAAjG,CACF,CACF,CAAC,EACD,KAAKlD,GAAQ,MAAM,2BAA2BmJ,CAAO,EAAE,CACzD,CACF,CACF,CACF,C","sources":["webpack://ice.guest/webpack/universalModuleDefinition","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_Symbol.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_baseGetTag.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_baseTrim.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_freeGlobal.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_getRawTag.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_objectToString.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_root.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_trimmedEndIndex.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/debounce.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/isObject.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/isObjectLike.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/isSymbol.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/now.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/throttle.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/toNumber.js","webpack://ice.guest/external umd \"emuiDiagnostics\"","webpack://ice.guest/webpack/bootstrap","webpack://ice.guest/webpack/runtime/compat get default export","webpack://ice.guest/webpack/runtime/define property getters","webpack://ice.guest/webpack/runtime/hasOwnProperty shorthand","webpack://ice.guest/webpack/runtime/make namespace object","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js","webpack://ice.guest/../common/dist/esm/remoting.js","webpack://ice.guest/../common/dist/esm/messageType.js","webpack://ice.guest/../common/dist/esm/proxy.js","webpack://ice.guest/../common/dist/esm/event.js","webpack://ice.guest/./lib/utils.ts","webpack://ice.guest/./lib/v1-adapter.ts","webpack://ice.guest/./lib/guest.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"emuiDiagnostics\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"emuiDiagnostics\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ice\"] = factory(require(\"emuiDiagnostics\"));\n\telse\n\t\troot[\"ice\"] = root[\"ice\"] || {}, root[\"ice\"][\"guest\"] = factory(root[\"emuiDiagnostics\"]);\n})(globalThis, (__WEBPACK_EXTERNAL_MODULE__388__) => {\nreturn ","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__388__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import { v4 as uuidv4 } from \"uuid\";\nconst MESSAGE_SOURCE = \"elli:remoting\";\nconst RESPONSE_MESSAGE_TYPE = \"elli:remoting:response\";\nconst EXCEPTION_MESSAGE_TYPE = \"elli:remoting:exception\";\nconst createMessage = ({\n messageType,\n messageBody,\n requestId,\n onewayMsg = false\n}) => ({\n requestId: requestId ?? (!onewayMsg ? uuidv4() : null),\n source: MESSAGE_SOURCE,\n type: messageType,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n body: messageBody\n});\nconst sendMessage = (param) => {\n const { targetWin, targetOrigin, messageType, messageBody } = param;\n const msg = createMessage({ messageType, messageBody });\n targetWin.postMessage(msg, targetOrigin);\n};\nclass Remoting {\n #correlationId;\n #logger;\n /**\n * set of listeners that are registered\n */\n #listeners = /* @__PURE__ */ new Map();\n /**\n * Represents the set of invocations that are waiting for a response\n */\n #invocations = /* @__PURE__ */ new Map();\n /**\n * The handle to the timeout monitor\n */\n #timeoutMonitorHandle = null;\n /**\n * The window that remoting was initialized on\n */\n #initializedWindow = null;\n /**\n * The set of windows that are allowed to send messages to this window\n */\n #allowedSenders = /* @__PURE__ */ new Map();\n /**\n * Create a new instance of the Remoting class\n * @param logger pui-diagnostic logger\n * @param correlationId unique id for the current session\n */\n constructor(logger, correlationId) {\n if (!logger) throw new Error(\"logger is required\");\n if (!correlationId) throw new Error(\"correlationId is required\");\n this.#correlationId = correlationId;\n this.#logger = logger;\n }\n // Evaluates the timeouts on any waiting invocations and schedules the next check\n #evaluateTimeouts = () => {\n this.#timeoutMonitorHandle = null;\n const ts = Date.now();\n const canceledItems = [];\n let nextCancelTime = null;\n this.#invocations.forEach((eventData, key) => {\n const { requestId, cancelTime } = eventData;\n if (cancelTime && cancelTime <= ts) {\n this.#logger.debug(\n `Detected response timeout for requestId: ${requestId}...`\n );\n canceledItems.push(key);\n eventData.resolve(void 0);\n } else if (cancelTime) {\n nextCancelTime = nextCancelTime === null ? cancelTime : Math.min(nextCancelTime, cancelTime);\n }\n });\n canceledItems.forEach((key) => {\n this.#invocations.delete(key);\n });\n if (nextCancelTime !== null) {\n const delay = Math.max(nextCancelTime - Date.now(), 0);\n this.#scheduleTimeoutCheck(delay);\n }\n };\n // Schedule a timeout check after a delay\n #scheduleTimeoutCheck = (delayMs) => {\n if (this.#timeoutMonitorHandle !== null) return;\n this.#timeoutMonitorHandle = window.setTimeout(\n this.#evaluateTimeouts,\n delayMs\n );\n };\n // Stops the timeout monitor\n #stopResponseMonitor = () => {\n if (this.#timeoutMonitorHandle !== null) {\n window.clearTimeout(this.#timeoutMonitorHandle);\n this.#timeoutMonitorHandle = null;\n }\n };\n // Pops an invocation from the incovation list\n #popInvocation = (requestId) => {\n const e = this.#invocations.get(requestId);\n this.#logger.debug(`serving requestId: ${requestId}`);\n this.#invocations.delete(requestId);\n return e;\n };\n // Handles a response to a prior cross-frame invocation\n #processResponse = (message) => {\n const { requestId } = message;\n this.#logger.debug(\n `Response received for invocation requestId: ${requestId}`\n );\n const eventData = this.#popInvocation(requestId);\n if (!eventData) {\n this.#logger.debug(\n `Received response to stale/invalid request with requestId: ${requestId}`\n );\n return false;\n }\n eventData.resolve(message.body);\n return true;\n };\n // Handles a response to a prior cross-frame invocation\n #processException = (message) => {\n this.#logger.debug(\n `Exception received for invocation (requestId = ${message.requestId})`\n );\n const eventData = this.#popInvocation(message.requestId);\n if (!eventData) {\n this.#logger.warn(\n `Received exception for stale/invalid request (requestId = ${message.requestId})`\n );\n return false;\n }\n eventData.reject(new Error(message.body));\n return true;\n };\n // Receives a message from another window and invokes any event handlers\n #receive = ({\n sourceWin,\n sourceOrigin,\n message\n }) => {\n this.#logger.debug(`Received message of type \"${message.type}\"`);\n const callbacks = this.#listeners.get(message.type);\n if (!callbacks) return false;\n callbacks.forEach((callback) => {\n this.#logger.debug(`Invoking message handler ${callback.name}`);\n callback({\n sourceWin,\n sourceOrigin,\n requestId: message.requestId,\n type: message.type,\n body: message.body\n });\n });\n return true;\n };\n // Processes a message received thru the window's message event\n #processMessage = (message) => {\n if (this.#allowedSenders.size === 0) return false;\n if (!message.source) return false;\n const senderOrigin = this.#allowedSenders.get(message.source);\n if (!senderOrigin) return false;\n if (message?.data?.source !== MESSAGE_SOURCE) return false;\n this.#logger.debug(\n `Remoting: Received message of type \"${message.data.type}\"`\n );\n if (message.data.type === RESPONSE_MESSAGE_TYPE)\n this.#processResponse(message.data);\n else if (message.data.type === EXCEPTION_MESSAGE_TYPE)\n this.#processException(message.data);\n else\n this.#receive({\n sourceWin: message.source,\n sourceOrigin: senderOrigin,\n message: message.data\n });\n return true;\n };\n /**\n * Adds window and its origin list of allowed senders\n * @param {AddSenderParam} param - The sender to add\n */\n addSender = (param) => {\n const { origin, window: window2 } = param;\n if (!origin) throw new Error(\"origin is required\");\n if (!window2) throw new Error(\"window is required\");\n this.#allowedSenders.set(window2, origin);\n };\n /**\n * Initializes the remoting service for a window\n * @param win The window to initialize remoting for\n */\n initialize = (win) => {\n if (this.#initializedWindow) {\n this.#initializedWindow.removeEventListener(\n \"message\",\n this.#processMessage\n );\n }\n win.addEventListener(\"message\", this.#processMessage);\n this.#initializedWindow = win;\n this.#logger.debug(`initialized remoting id: ${this.#correlationId}`);\n };\n /**\n * Closes the remoting service for a window\n */\n close = () => {\n if (this.#initializedWindow) {\n this.#initializedWindow.removeEventListener(\n \"message\",\n this.#processMessage\n );\n this.#initializedWindow = null;\n }\n this.#stopResponseMonitor();\n this.#logger.debug(`closed remoting id: ${this.#correlationId}`);\n };\n /**\n * Sends an invocation which generates a Promise to be used to get a response\n * @param {InvokeParam} param The parameters for the invocation\n * @returns promisifyed response\n */\n invoke = (param) => {\n const {\n targetWin,\n targetOrigin,\n messageType,\n messageBody,\n responseTimeoutMs\n } = param;\n return new Promise((resolve, reject) => {\n const msg = createMessage({ messageType, messageBody });\n this.#invocations.set(msg.requestId, {\n requestId: msg.requestId,\n resolve,\n reject,\n cancelTime: responseTimeoutMs ? Date.now() + responseTimeoutMs : null\n });\n targetWin.postMessage(msg, targetOrigin);\n const { requestId } = msg;\n this.#logger.debug(\n `Posted invocation message of type ${messageType} requestId: ${requestId || \"\"}`\n );\n if (responseTimeoutMs) {\n this.#logger.debug(\n `scheduling timeout check for requestId: ${requestId || \"\"} in ${responseTimeoutMs} ms`\n );\n this.#scheduleTimeoutCheck(responseTimeoutMs);\n }\n });\n };\n /**\n * Setup callback for a specific message type\n * @param {ListenParam<T>} param The parameters for the listener\n */\n listen = (param) => {\n const { messageType, callback } = param;\n const items = this.#listeners.get(messageType) || [];\n items.push(callback);\n this.#listeners.set(messageType, items);\n };\n /**\n * Remove a previously registered callback for a specific message type\n * @param {ListenParam<T>} param The parameters identifying the listener to remove\n */\n unlisten = (param) => {\n const { messageType, callback } = param;\n const items = this.#listeners.get(messageType);\n if (!items) return;\n const index = items.indexOf(callback);\n if (index !== -1) {\n items.splice(index, 1);\n }\n };\n /**\n * Send a message without any form of response. Fire and forget\n * @param {SendParam} param The parameters for the send\n */\n send = (param) => {\n const { targetWin, targetOrigin, messageType, messageBody } = param;\n const msg = createMessage({\n messageType,\n messageBody,\n onewayMsg: true\n });\n targetWin.postMessage(msg, targetOrigin);\n this.#logger.debug(`Posted one-way message of type \"${messageType}\"`);\n };\n /**\n * Removes a window from the list of allowed senders\n * @param {AddSenderParam} param - The sender to remove\n */\n removeSender = (param) => {\n const { window: window2 } = param;\n if (window2) this.#allowedSenders.delete(window2);\n };\n /**\n * Send a response message to a window\n * @param {RespondParam} param The parameters for the response\n */\n respond = (param) => {\n const { targetWin, targetOrigin, requestId, response } = param;\n const msg = createMessage({\n messageType: RESPONSE_MESSAGE_TYPE,\n messageBody: response,\n requestId\n });\n targetWin.postMessage(msg, targetOrigin);\n this.#logger.debug(\n `Response sent to caller for invocation requestId: ${requestId}`\n );\n };\n /**\n * Send an exception message to a window\n * @param {RaiseExceptionParam} param The parameters for the exception\n */\n raiseException = (param) => {\n const { targetWin, targetOrigin, requestId, ex } = param;\n const messageBody = ex instanceof Error ? ex.message : ex;\n const msg = createMessage({\n messageType: EXCEPTION_MESSAGE_TYPE,\n messageBody,\n requestId\n });\n targetWin.postMessage(msg, targetOrigin);\n this.#logger.debug(\n `Exception sent to caller for invocation. requestId: ${requestId}`\n );\n };\n}\nexport {\n Remoting,\n sendMessage\n};\n","var MessageType = /* @__PURE__ */ ((MessageType2) => {\n MessageType2[\"GuestClose\"] = \"guest:close\";\n MessageType2[\"GuestEventSubscribe\"] = \"guest:eventSubscribe\";\n MessageType2[\"GuestEventUnsubscribe\"] = \"guest:eventUnsubscribe\";\n MessageType2[\"GuestFocus\"] = \"guest:focus\";\n MessageType2[\"GuestReady\"] = \"guest:ready\";\n MessageType2[\"GuestReadyComplete\"] = \"guest:readyComplete\";\n MessageType2[\"GuestResize\"] = \"guest:resize\";\n MessageType2[\"HandShake\"] = \"handshake\";\n MessageType2[\"HandShakeAck\"] = \"handshake:ack\";\n MessageType2[\"HostClose\"] = \"host:close\";\n MessageType2[\"HostConfig\"] = \"host:config\";\n MessageType2[\"ListObjects\"] = \"list:objects\";\n MessageType2[\"ObjectEvent\"] = \"object:event\";\n MessageType2[\"ObjectGet\"] = \"object:get\";\n MessageType2[\"ObjectInvoke\"] = \"object:invoke\";\n return MessageType2;\n})(MessageType || {});\nexport {\n MessageType\n};\n","class ScriptingObjectProxy {\n /**\n * proxy type\n */\n __TYPE__ = \"Proxy\";\n /**\n * unique id of scripting object\n */\n id;\n /**\n * type of scripting object\n */\n objectType;\n /**\n * Creates a new instance of the Scripting Object Proxy\n * @param objectId unique id of scripting object\n * @param objectType type of scripting object\n */\n constructor(objectId, objectType) {\n this.id = objectId;\n this.objectType = objectType;\n }\n}\nconst isScriptingObjectProxy = (value) => (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n value?.constructor?.name === \"Proxy\" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n value?.constructor?.name === \"ScriptingObjectProxy\" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-underscore-dangle\n value?.__TYPE__ === \"Proxy\"\n);\nexport {\n ScriptingObjectProxy,\n isScriptingObjectProxy\n};\n","class Event {\n /* eslint-enable indent */\n /**\n * name of the event\n */\n name;\n /**\n * scripting object id that owns this event\n */\n objectId;\n /**\n * unique id of the event\n */\n id;\n /**\n * Create an event object\n * @param {EventParam} param - parameters for creating an event\n */\n constructor(param) {\n const { name, objectId } = param;\n if (!name) throw new Error(\"Event name is required\");\n if (!objectId) throw new Error(\"Scripting object id is required\");\n this.objectId = objectId;\n this.name = name;\n this.id = `${this.objectId}.${this.name}`.toLowerCase();\n }\n}\nclass ProxyEvent {\n /**\n * check if given object is an instance of ProxyEvent\n * @param obj object to be compared\n * @returns true if given object is an instance of ProxyEvent\n */\n static [Symbol.hasInstance](obj) {\n return typeof obj === \"object\" && obj !== null && \"getType\" in obj && typeof obj.getType === \"function\" && obj.getType() === \"ProxyEvent\";\n }\n /* eslint-enable indent */\n /**\n * module that owns this event management. SSF Guest or App Bridge host\n */\n #eventSrc;\n /**\n * unique id of scripting object\n */\n objectId;\n /**\n * name of the event\n */\n name;\n /**\n * unique id of the event\n */\n id;\n /**\n * get type of the object\n * @returns type of the object\n */\n getType() {\n return \"ProxyEvent\";\n }\n /**\n * Create a new instance of the Scripting Object Proxy Event\n * @param {ProxyEventParam} param - parameter for the constructor\n */\n constructor(param) {\n const { name, objectId, eventSrc } = param;\n if (!name) throw new Error(\"Event name is required\");\n if (!objectId) throw new Error(\"Scripting object id is required\");\n if (!eventSrc) throw new Error(\"Event source is required\");\n this.objectId = objectId;\n this.name = name;\n this.#eventSrc = eventSrc;\n this.id = `${this.objectId}.${this.name}`.toLowerCase();\n }\n /**\n * subscribe to an scripting object event\n * @param callback event listener\n * @returns subscription token\n */\n subscribe = (callback) => this.#eventSrc.subscribe({\n eventId: this.id,\n callback\n });\n /**\n * unsubscribe from an scripting object event\n * @param token subscription token\n */\n unsubscribe = (token) => {\n this.#eventSrc.unsubscribe({\n eventId: this.id,\n token\n });\n };\n}\nconst isEvent = (value) => value instanceof Event;\nconst getEventId = (objectId, eventName) => `${objectId.toLowerCase()}.${eventName.toLowerCase()}`;\nexport {\n Event,\n ProxyEvent,\n getEventId,\n isEvent\n};\n","import { MessageType, sendMessage } from '@elliemae/microfe-common';\n\nexport const getParentWindowLocation = () => {\n const { parent } = window;\n try {\n return parent?.location?.href;\n } catch (e) {\n return null;\n }\n};\n\nexport const getOrigin = (url: string | null) => {\n if (!url || url === 'about:blank') return '*';\n try {\n const { origin } = new URL(url);\n return origin === 'null' || !origin ? '*' : origin;\n } catch {\n try {\n const { origin } = new URL(url, document.baseURI);\n return origin === 'null' || !origin ? '*' : origin;\n } catch {\n return '*';\n }\n }\n};\n\nexport const isEmbedded = () => window.self !== window.parent;\n\nexport const getComputedStyle = (\n prop: Extract<keyof CSSStyleDeclaration, string>,\n el?: Element,\n) => {\n const element = el || document.body;\n const retVal = document.defaultView?.getComputedStyle?.(element, null);\n const propValue = retVal ? (retVal[prop] as string) : '0';\n return parseInt(propValue, 10);\n};\n\nconst originsRegex =\n /^https?:\\/\\/([a-z0-9-]+\\.)*(?:elliemae\\.io|ellielabs\\.com|ellieservices\\.com|encompassloconnect\\.com|ice\\.com|localhost:[0-9]+)$/i;\nconst MESSAGE_SOURCE = 'elli:remoting';\n\nconst HANDSHAKE_TIMEOUT_MS = 30000;\n\nexport const getHostDetails = () =>\n new Promise<{ origin: string; window: Window }>((resolve, reject) => {\n if (!isEmbedded()) {\n const currentWindow = window;\n let timer: ReturnType<typeof setTimeout>;\n const onMessage = (\n event: MessageEvent<{ source: string; type: string }>,\n ) => {\n if (originsRegex.test(event.origin)) {\n const { source, type } = event.data || {};\n if (source === MESSAGE_SOURCE && type === MessageType.HandShake) {\n const { origin } = event;\n const hostWindow = event.source as Window;\n clearTimeout(timer);\n // send handshake acknowledgement\n sendMessage({\n targetWin: hostWindow,\n targetOrigin: origin,\n messageType: MessageType.HandShakeAck,\n messageBody: {},\n });\n currentWindow.removeEventListener('message', onMessage);\n resolve({ origin, window: hostWindow });\n }\n }\n };\n timer = setTimeout(() => {\n currentWindow.removeEventListener('message', onMessage);\n reject(\n new Error(`Host handshake timed out after ${HANDSHAKE_TIMEOUT_MS}ms`),\n );\n }, HANDSHAKE_TIMEOUT_MS);\n currentWindow.addEventListener('message', onMessage);\n } else {\n resolve({\n origin: getOrigin(document.referrer || getParentWindowLocation()),\n window: window.parent,\n });\n }\n });\n","import type {\n Events,\n ScriptingObjectTypes,\n} from '@elliemae/pui-scripting-object';\nimport type { ISSFGuest, FilterCriteria } from '@elliemae/microfe-common';\n\nlet scriptOnlyGuest = false;\nexport const setScriptOnlyGuest = (value: boolean) => {\n scriptOnlyGuest = value;\n};\n\n/**\n * map v1 guest APIs to v2 guest API\n * @param guest\n * @param guestV2\n */\nconst setupV1Adapter = (\n guestV2: ISSFGuest<ScriptingObjectTypes, Events> | null = null,\n) => {\n let guest: ISSFGuest<ScriptingObjectTypes, Events> | null = guestV2;\n const getGuest = () => {\n if (!guest) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n guest = window.ice?.guest?.SSFGuest\n ? new window.ice.guest.SSFGuest() // eslint-disable-line @typescript-eslint/no-unsafe-call\n : null;\n if (!guest) {\n throw new Error('Guest definition not found');\n }\n }\n return guest;\n };\n\n window.elli = window.elli ?? {};\n\n window.elli.script = {\n guest: {\n create: (scriptUri: string, element: HTMLElement) =>\n getGuest().addScript(scriptUri, element),\n },\n connect: (params?: any) => {\n if (!scriptOnlyGuest)\n console.warn(\n 'elli.script.connect is deprecated. Please use connect method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); await guest.connect(params);',\n );\n return getGuest().connect(params); // eslint-disable-line @typescript-eslint/no-unsafe-argument\n },\n getObject: (objectName: any) => {\n if (!scriptOnlyGuest)\n console.warn(\n 'elli.script.getObject is deprecated. Please use getObject method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); await guest.getObject(objectName);',\n );\n return getGuest().getObject(objectName);\n },\n setLogLevel: (level: any) => {\n if (!scriptOnlyGuest)\n console.warn(\n 'elli.script.setLogLevel is deprecated. Please use setLogLevel method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); guest.setLogLevel(level);',\n );\n return getGuest().setLogLevel(level); // eslint-disable-line @typescript-eslint/no-unsafe-argument\n },\n // eslint-disable-next-line max-params\n subscribe: (\n objectId: string,\n eventName: string,\n callback: any,\n options?: { criteria?: FilterCriteria },\n ) => {\n if (!scriptOnlyGuest)\n console.warn(\n // eslint-disable-next-line no-template-curly-in-string\n 'elli.script.subscribe is deprecated. Please use subscribe method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); guest.subscribe({ eventId: `${objectId}.${eventName}`, callback: (event) => { console.log(event); });',\n );\n return getGuest().subscribe({\n eventId: `${objectId}.${eventName}` as any, // eslint-disable-line @typescript-eslint/no-unsafe-assignment\n callback: (event: { obj: any; eventParams: any; eventOptions: any }) =>\n callback(event?.obj, event?.eventParams, event?.eventOptions), // eslint-disable-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call\n criteria: options?.criteria,\n });\n },\n unsubscribe: (objectId: string, eventName: string, token: string) => {\n if (!scriptOnlyGuest)\n console.warn(\n // eslint-disable-next-line no-template-curly-in-string\n 'elli.script.unsubscribe is deprecated. Please use unsubscribe method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); guest.unsubscribe({ eventId: `${objectId}.${eventName}`, token });',\n );\n return getGuest().unsubscribe({\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n eventId: `${objectId}.${eventName}` as any,\n token,\n });\n },\n };\n};\n\ntry {\n setupV1Adapter();\n} catch {\n // Prevent module-level throw from breaking all downstream imports\n}\nexport { setupV1Adapter };\n","/* eslint-disable max-lines */\nimport { v4 as uuidv4 } from 'uuid';\nimport throttle from 'lodash/throttle';\nimport type {\n IScriptingObjectProxy,\n RemotingScriptingObject,\n Listener,\n Events,\n ScriptingObjectTypes,\n} from '@elliemae/pui-scripting-object';\nimport {\n Remoting,\n sendMessage,\n MessageType,\n getEventId,\n ProxyEvent,\n ScriptingObjectProxy,\n} from '@elliemae/microfe-common';\nimport type {\n ListenerCallbackParams,\n RemotingEventMessage,\n ConnectParam,\n SubscribeParam,\n UnsubscribeParam,\n EventListeners,\n ISSFGuest,\n ScriptingObjects,\n FilterCriteria,\n} from '@elliemae/microfe-common';\nimport {\n logger as puiLogger,\n Console,\n http,\n LogLevels,\n Logger,\n webvitals,\n logUnhandledErrors,\n} from '@elliemae/pui-diagnostics';\nimport {\n getOrigin,\n isEmbedded,\n getComputedStyle,\n getHostDetails,\n getParentWindowLocation,\n} from './utils.js';\nimport { setupV1Adapter, setScriptOnlyGuest } from './v1-adapter.js';\n\nenum ResponseType {\n OBJECT = 'object',\n VALUE = 'value',\n}\n\ntype ObjectResponse = {\n type: ResponseType.OBJECT;\n object: RemotingScriptingObject;\n};\n\ntype ValueResponse = {\n type: ResponseType.VALUE;\n value: any;\n};\n\ntype Response = ObjectResponse | ValueResponse;\ntype Config = {\n logLevel: LogLevels;\n guestId: string;\n guestTitle: string;\n guestUrl: string;\n};\n\nexport type ListenerInfo = {\n criteria?: FilterCriteria;\n callback: Listener<any, any, any, any>;\n token: string;\n};\n\n/**\n * Interval in milliseconds to extend host session and token. Default is 2 minutes.\n */\nconst KEEP_ALIVE_INTERVAL = 120000;\n\n// Provides a list of capabilities of this version of teh scripting framework\nconst capabilities = {\n eventFeedback: true,\n};\n\nconst onLoad = () => {\n const { document } = window;\n const iframeBody = document.body;\n const iframeHTML = document.documentElement;\n const bodyOffsetHeight =\n iframeBody.offsetHeight +\n getComputedStyle('marginTop') +\n getComputedStyle('marginBottom');\n const size = {\n height: bodyOffsetHeight,\n width: Math.max(iframeBody.scrollWidth, iframeHTML.scrollWidth),\n };\n sendMessage({\n targetWin: window.parent,\n targetOrigin: getOrigin(document.referrer || getParentWindowLocation()),\n messageType: MessageType.GuestResize,\n messageBody: size,\n });\n window.removeEventListener('load', onLoad);\n};\n\n// if hosted in iframe then wait for load event to send resize message\nif (isEmbedded()) {\n window.addEventListener('load', onLoad);\n}\n\n/**\n * options for the guest\n */\nexport type GuestOption = {\n /**\n * options for the logger\n */\n logger?: {\n /**\n * log to console\n */\n console?: boolean;\n /**\n * url to send logs to\n */\n url?: string;\n /**\n * index to use for logging\n */\n index: string;\n /**\n * app name to use for logging\n */\n appName: string;\n /**\n * team name that owns the app\n */\n team: string;\n };\n /**\n * logger to use for the guest\n */\n appLogger?: Logger;\n /**\n * Gets bearer token to access Dev Connect api during connect operation. Default is false.\n */\n usesDevConnectAPI?: boolean;\n /**\n * Track user activity and extend host session. Default is true.\n */\n keepAlive?: boolean;\n /**\n * Interval in milliseconds to extend host session and token. Default is 300000 (5 minutes).\n */\n keepAliveInterval?: number;\n};\n\nconst diagnosticsEndpoint = {\n 'cdn.ice.com': 'https://api.elliemae.com/diagnostics/v2/logging',\n 'cdn.np.ice.com': 'https://stg.api.elliemae.com/diagnostics/v2/logging',\n 'cdn.uat.ice.com': 'https://concept.api.elliemae.com/diagnostics/v2/logging',\n 'cdn.pt1.ice.com': 'https://pel1.api.ellielabs.com/diagnostics/v2/logging',\n 'cdn.qa1.ice.com': 'https://int.api.ellielabs.com/diagnostics/v2/logging',\n 'cdn.dev1.ice.com': 'https://int.api.ellielabs.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.ice.com': 'https://api.elliemae.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.s1.ice.com':\n 'https://stg.api.elliemae.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.uat1.ice.com':\n 'https://concept.api.elliemae.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.pl1.ice.com':\n 'https://pel1.api.ellielabs.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.q1.ice.com':\n 'https://int.api.ellielabs.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.d1.ice.com':\n 'https://int.api.ellielabs.com/diagnostics/v2/logging',\n localhost: 'https://int.api.ellielabs.com/diagnostics/v2/logging',\n};\n\nconst userInteractionEvents = ['click', 'scroll', 'keypress', 'touchstart'];\n\n/**\n * Get diagnostics api url based on env\n * @returns {string} diagnostics api url\n */\nconst getDiagnosticsAPIUrl = () => {\n const scriptUrl =\n (document.currentScript as HTMLScriptElement)?.src || import.meta.url;\n const hostName = scriptUrl\n ? (new URL(scriptUrl).hostname as keyof typeof diagnosticsEndpoint)\n : 'localhost';\n return (\n diagnosticsEndpoint[hostName] ||\n diagnosticsEndpoint['cdn.mortgagetech.q1.ice.com']\n );\n};\n\n/**\n * Creates a new guest that can be used to communicate with the parent host application\n * @template AppEvents - The events that the guest application listens\n */\n/* eslint-disable indent */\nexport class SSFGuest<\n AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>,\n AppEvents extends EventListeners = Events,\n> implements ISSFGuest<AppObjects, AppEvents>\n{\n /* eslint-enable indent */\n #correlationId: string;\n\n #logger: Logger;\n\n #remoting: Remoting;\n\n #created = false;\n\n #scriptElement: HTMLScriptElement | null = null;\n\n #isConnected = false;\n\n #eventListeners = new Map<string, ListenerInfo[]>();\n\n #id: string | null = null;\n\n #title: string | null = null;\n\n #url: string | null = null;\n\n #hostOrigin: string | null = null;\n\n #hostWindow: Window | null = null;\n\n #parentCloseMonitor: ReturnType<typeof setInterval> | null = null;\n\n #regexCache = new Map<string, RegExp>();\n\n /** Returns non-null host references or throws a descriptive error. */\n #requireHost(): { hostWindow: Window; hostOrigin: string } {\n if (!this.#hostWindow || !this.#hostOrigin) {\n throw new Error(\n 'Guest is not connected to a host. Call connect() first.',\n );\n }\n return { hostWindow: this.#hostWindow, hostOrigin: this.#hostOrigin };\n }\n\n /**\n * get bearer token to access api during connect operation\n */\n #usesDevConnectAPI = false;\n\n /**\n * auth token to access api\n */\n #authToken: string | null = null;\n\n /**\n * oauth client id\n */\n #authClientId: string | null = null;\n\n /**\n * api host domain\n */\n #hostDomain: string | null = null;\n\n /**\n * flag to keep host session alive\n */\n #keepAlive = true;\n\n /**\n * interval to keep host session alive.\n */\n #keepAliveInterval = KEEP_ALIVE_INTERVAL;\n\n /**\n * options for the logger\n */\n #loggerOptions: GuestOption['logger'];\n\n /**\n * throttled keep alive function\n */\n #throttledKeepAlive: ReturnType<typeof throttle> | null = null;\n\n /**\n * Create new guest\n * @param {GuestOption} options - options for the guest\n */\n // eslint-disable-next-line complexity\n constructor(options?: GuestOption) {\n const {\n console: logToConsole = false,\n // eslint-disable-next-line no-underscore-dangle\n url = window.__ICE__?.diagnosticsUrl || getDiagnosticsAPIUrl(),\n index = 'ssf-guest-v2',\n team = 'ICE',\n appName = 'SSF Guest V2 Application',\n } = options?.logger ?? {};\n this.#loggerOptions = options?.logger;\n this.#usesDevConnectAPI = options?.usesDevConnectAPI ?? false;\n this.#keepAlive = options?.keepAlive ?? true;\n this.#keepAliveInterval = options?.keepAliveInterval ?? KEEP_ALIVE_INTERVAL;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const transport = logToConsole ? Console() : http(url as string);\n this.#logger =\n options?.appLogger ??\n puiLogger({\n transport,\n index,\n team,\n appName,\n });\n webvitals(this.#logger);\n logUnhandledErrors(this.#logger);\n this.#correlationId = uuidv4();\n this.#remoting = new Remoting(this.#logger, this.#correlationId);\n setupV1Adapter(this as unknown as ISSFGuest<ScriptingObjectTypes, Events>);\n this.#logger.audit({\n message: 'Guest created',\n guestUrl: window.location.href,\n correlationId: this.#correlationId,\n });\n }\n\n #getGuestInfo = () => ({\n guestId: this.#id,\n guestTitle: this.#title,\n guestUrl: this.#url,\n });\n\n /**\n * Marshals scripting object JSON into a proxy object\n * @param {RemotingScriptingObject} soJSON scripting object JSON\n * @returns {IScriptingObjectProxy} marshaled proxy object\n */\n #fromJSON = (soJSON: RemotingScriptingObject): IScriptingObjectProxy => {\n // Ensure we have JSON\n if (!soJSON || !soJSON.objectId) {\n this.#logger.error(\n 'Deserialization of scripting object failed. Object does not have an Object ID.',\n );\n throw new Error('Cannot deserialize object JSON into proxy.');\n }\n\n // Create a new object\n const ctrl = new ScriptingObjectProxy(soJSON.objectId, soJSON.objectType);\n\n // Dynamically build the function set on the control\n if (soJSON.functions) {\n soJSON.functions.forEach((functionName) => {\n Object.defineProperty(ctrl, functionName, {\n value: async <T>(...args: any[]) =>\n this.#invoke<T>({\n objectId: ctrl.id,\n functionName,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n functionParams: [...args],\n }),\n enumerable: true,\n });\n });\n }\n\n // Dynamically create the event proxies\n if (soJSON.events) {\n soJSON.events.forEach((eventName) => {\n Object.defineProperty(ctrl, eventName, {\n value: new ProxyEvent<AppEvents>({\n objectId: ctrl.id,\n name: eventName,\n eventSrc: this,\n }),\n enumerable: true,\n });\n });\n }\n\n this.#logger.debug(\n `Created guest proxy for scripting object (id = \"${ctrl.id}\")`,\n );\n return ctrl;\n };\n\n /**\n * call scripting object api exposed by host\n * @param {object} param0 - The parameters object\n * @param {string} param0.objectId - The object ID to invoke\n * @param {string} param0.functionName - The function name to call\n * @param {Array<any>} param0.functionParams - The parameters for the function\n * @returns {Promise<any>} The result of the function call\n */\n #invoke = async <T>({\n objectId,\n functionName,\n functionParams,\n }: {\n objectId: string;\n functionName: string;\n functionParams: Array<any>;\n }) => {\n this.#logger.debug(\n `Invoking scripting object method ${objectId}.${functionName}()...`,\n );\n\n // Find any function params that are promises\n const promises = [];\n if (functionParams) {\n for (let i = 0; i < functionParams.length; i += 1) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const p = functionParams[i];\n if (p instanceof Promise) {\n promises.push(\n p.then((val) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n functionParams[i] = val;\n }),\n );\n }\n }\n }\n\n // Now wait to resolve all of the promises and then call our invoke\n await Promise.all(promises);\n const { hostWindow, hostOrigin } = this.#requireHost();\n const response = await this.#remoting.invoke<Response>({\n targetWin: hostWindow,\n targetOrigin: hostOrigin,\n messageType: MessageType.ObjectInvoke,\n messageBody: {\n objectId,\n functionName,\n functionParams,\n },\n });\n const retVal = this.#handleResponse<T>(response);\n this.#logger.audit({\n message: 'Guest proxy invoked Scripting Object method',\n scriptingObject: objectId,\n scriptingMethod: functionName,\n ...this.#getGuestInfo(),\n });\n return retVal;\n };\n\n /**\n * Checks if a given payload matches all specified filter criteria.\n *\n * Iterates over each entry in the criteria object and evaluates the corresponding condition\n * against the payload's value for that key. Supported condition types include:\n * - `eq`: Checks for strict equality.\n * - `in`: Checks if the value is included in a provided array.\n * - `includes`: Checks if the payload's value (an array) includes a specified element.\n * - `gt`: Checks if the value is greater than a specified number.\n * - `lt`: Checks if the value is less than a specified number.\n * - `regex`: Checks if the value (a string) matches a provided regular expression.\n * @param {Record<string, any>} payload - The object containing values to be checked against the criteria.\n * @param {FilterCriteria} criteria - An object specifying filter conditions for each key.\n * @returns {boolean} `true` if all criteria are satisfied by the payload, otherwise `false`.\n */\n #matchesCriteria(\n payload: Record<string, any>,\n criteria: FilterCriteria,\n ): boolean {\n // eslint-disable-next-line complexity\n return Object.entries(criteria).every(([key, condition]) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const value = payload[key];\n if ('eq' in condition) return value === condition.eq;\n if ('in' in condition)\n return Array.isArray(condition.in) && condition.in.includes(value);\n if ('includes' in condition)\n return Array.isArray(value) && value.includes(condition.includes);\n if ('gt' in condition) {\n const numValue = typeof value === 'number' ? value : Number(value);\n return !Number.isNaN(numValue) && numValue > condition.gt;\n }\n if ('lt' in condition) {\n const numValue = typeof value === 'number' ? value : Number(value);\n return !Number.isNaN(numValue) && numValue < condition.lt;\n }\n if ('regex' in condition) {\n try {\n let regex = this.#regexCache.get(condition.regex);\n if (!regex) {\n regex = new RegExp(condition.regex);\n this.#regexCache.set(condition.regex, regex);\n }\n return typeof value === 'string' && regex.test(value);\n } catch {\n return false;\n }\n }\n\n return false;\n });\n }\n\n /**\n * handle response from host\n * @param {ObjectResponse | ValueResponse} response - The response to handle\n * @returns {any} The handled response value or proxy object\n */\n #handleResponse = <T>(response: ObjectResponse | ValueResponse) => {\n if (response?.type === ResponseType.OBJECT && 'object' in response) {\n return this.#fromJSON(response.object);\n }\n if (response?.type === ResponseType.VALUE) {\n return response.value as T;\n }\n return response;\n };\n\n /**\n * handle config change event\n * @param {object} root0 - The event parameters\n * @param {Config} root0.body - The configuration body\n */\n #handleConfigChangeEvent = ({ body }: ListenerCallbackParams<Config>) => {\n // Handle log level changes\n if (body?.logLevel) {\n this.#logger.setLogLevel(body.logLevel);\n this.#logger.debug(`Log level changed by host to ${body.logLevel}`);\n }\n this.#id = body?.guestId ?? null;\n this.#title = body?.guestTitle ?? null;\n this.#url = body?.guestUrl ?? null;\n this.#logger.audit({\n message: 'Received configuration from Host',\n ...this.#getGuestInfo(),\n });\n };\n\n /**\n * Focus the guest window\n */\n #handleFocusEvent = () => {\n window.focus();\n };\n\n /**\n * Focus the guest window\n */\n #handleHostClose = async () => {\n await this.close();\n window.close();\n };\n\n /**\n * Check if the parent window is closed and close this popup window\n */\n #handleParentClose = () => {\n if (!isEmbedded()) {\n this.#parentCloseMonitor = setInterval(() => {\n if (this.#hostWindow?.closed) {\n this.close()\n .then(() => {\n window.close();\n })\n .catch(() => {});\n }\n }, 1000);\n }\n };\n\n /**\n * Handles an incoming object event from a remote source, deserializes the object,\n * determines the appropriate event listeners, and invokes them with the event data.\n * Collects responses from listeners (including promises) and sends them back to the source window if a requestId is provided.\n * Audits the event processing for debugging and tracking purposes.\n * @param {object} params - The parameters for the event listener callback, including source window, origin, request ID, and event body.\n * @param {Window} params.sourceWin - The window from which the event originated.\n * @param {string} params.sourceOrigin - The origin of the source window.\n * @param {string} params.requestId - The unique identifier for the request, if a response is expected.\n * @param {any} params.body - The event message body containing the object, event name, handler, parameters, and options.\n * @description\n * - If an event handler is specified in the body, only that handler is invoked.\n * - If criteria are specified for a listener, the event is only delivered if the criteria match.\n * - All listener responses are collected and returned as an array if a requestId is present.\n * - Audit logs are generated for both handled and responded events.\n */\n #handleObjectEvent = async ({\n sourceWin,\n sourceOrigin,\n requestId,\n body,\n }: ListenerCallbackParams<RemotingEventMessage>) => {\n // Deserialize the object\n const object = this.#fromJSON(body.object);\n if (object) {\n // Get the listeners for the event\n const eventId = getEventId(object.id, body.eventName);\n this.#logger.debug(`Received event \"${eventId}\" from host`);\n\n // If an event handler is specified in the request body, then we will target\n // the event to that function only.\n let listeners: Array<ListenerInfo>;\n if (body.eventHandler) {\n listeners = [\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n callback: (window as { [key: string]: any })[body.eventHandler],\n token: uuidv4(),\n },\n ];\n } else {\n listeners = this.#eventListeners.get(eventId) || [];\n }\n\n // Notify each listener, recording a promise for each response\n const promises: Array<Promise<any>> = [];\n\n listeners.forEach((callbackInfo) => {\n if (callbackInfo?.callback) {\n // If criteria is specified, ensure event matches criteria\n if (callbackInfo.criteria) {\n const criteriaMatched = body.eventParams\n ? this.#matchesCriteria(body.eventParams, callbackInfo.criteria)\n : false;\n if (!criteriaMatched) {\n this.#logger.debug(\n `Event ${eventId} did not match criteria for subscriber ${callbackInfo.callback.name}`,\n );\n return;\n }\n }\n this.#logger.debug(\n `Invoking event subscriber ${callbackInfo.callback.name} for event ${eventId}`,\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const retVal = callbackInfo.callback({\n obj: object,\n eventName: body.eventName,\n eventParams: body.eventParams,\n eventOptions: body.eventOptions,\n });\n\n if (retVal instanceof Promise) {\n promises.push(retVal);\n } else if (typeof retVal !== 'undefined') {\n promises.push(Promise.resolve(retVal));\n }\n }\n });\n\n // Resolve all promises and return a response to the calling window\n if (requestId) {\n const values = await Promise.all(promises);\n this.#remoting.respond({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n response: values,\n });\n this.#logger.audit({\n message: 'Guest proxy processed event from host and responded',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n } else {\n this.#logger.audit({\n message: 'Guest proxy processed event from host',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n }\n }\n };\n\n /**\n * Extend token lifetime\n */\n #extendTokenLifetime = async () => {\n if (!this.#authToken || !this.#authClientId || !this.#hostDomain) return;\n try {\n await fetch(\n `${\n this.#hostDomain\n }/oauth2/v1/token/introspection?${new URLSearchParams({\n token: this.#authToken,\n client_id: this.#authClientId,\n }).toString()}`,\n {\n headers: {\n 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',\n },\n method: 'POST',\n },\n );\n } catch (e) {\n this.#logger.warn(\n `Failed to extend token lifetime: ${(e as Error).message}`,\n );\n }\n };\n\n /**\n * revoke token\n */\n #revokeToken = async () => {\n if (this.#authToken && this.#authClientId && this.#hostDomain) {\n try {\n await fetch(\n `${this.#hostDomain}/oauth2/v1/token/revocation?${new URLSearchParams(\n {\n token: this.#authToken,\n client_id: this.#authClientId,\n },\n ).toString()}`,\n {\n method: 'POST',\n },\n );\n } catch (e) {\n this.#logger.error(`Error revoking token. ${(e as Error).message}`);\n } finally {\n this.#authToken = null;\n this.#authClientId = null;\n }\n }\n };\n\n /**\n * Start session keep alive\n */\n #startKeepSessionAlive = async () => {\n if (this.#keepAlive) {\n try {\n const appObj = await (\n this as unknown as SSFGuest<ScriptingObjectTypes, Events>\n ).getObject('application');\n if (appObj) {\n this.#throttledKeepAlive = throttle(\n async () => {\n try {\n await appObj.keepSessionAlive();\n await this.#extendTokenLifetime();\n } catch (e) {\n this.#logger.error(\n `Error keeping session alive. ${(e as Error).message}`,\n );\n }\n },\n this.#keepAliveInterval, // throttle time\n { leading: false },\n );\n userInteractionEvents.forEach((eventType) => {\n document.addEventListener(eventType, this.#throttledKeepAlive!);\n });\n } else {\n this.#logger.warn(\n 'Application object not available to send keep alive',\n );\n }\n } catch (e) {\n this.#logger.error(\n `Error getting application object. ${(e as Error).message}`,\n );\n }\n }\n };\n\n /**\n * Initialize guest using script\n * @param {string} scriptUri uri of the script\n * @param {HTMLElement} containerElement dom element to inject the script at\n */\n addScript = async (scriptUri: string, containerElement: HTMLElement) => {\n if (!this.#created && scriptUri) {\n await this.connect();\n // Load the script and await its load event before signaling that the window is\n // ready to receive events\n const scriptEle = document.createElement('script');\n scriptEle.setAttribute('src', scriptUri);\n scriptEle.setAttribute('type', 'module');\n await new Promise<void>((resolve, reject) => {\n let onScriptLoad: () => void;\n let onScriptError: (err: Event) => void;\n const cleanup = () => {\n scriptEle.removeEventListener('load', onScriptLoad);\n scriptEle.removeEventListener('error', onScriptError);\n };\n onScriptLoad = () => {\n cleanup();\n this.#created = true;\n setScriptOnlyGuest(true);\n resolve();\n };\n onScriptError = () => {\n cleanup();\n reject(new Error(`Failed to load script: ${scriptUri}`));\n };\n scriptEle.addEventListener('load', onScriptLoad);\n scriptEle.addEventListener('error', onScriptError);\n this.#scriptElement = containerElement.appendChild(scriptEle);\n });\n }\n };\n\n /**\n * Close the connection to the host\n */\n close = async () => {\n if (!this.#isConnected) return;\n // Notify host (best-effort — don't let failure skip local cleanup)\n if (this.#hostWindow && this.#hostOrigin) {\n this.#remoting.send({\n targetWin: this.#hostWindow,\n targetOrigin: this.#hostOrigin,\n messageType: MessageType.GuestClose,\n messageBody: {},\n });\n this.#remoting.removeSender({\n origin: this.#hostOrigin,\n window: this.#hostWindow,\n });\n }\n this.#remoting.close();\n if (this.#parentCloseMonitor) {\n clearInterval(this.#parentCloseMonitor);\n this.#parentCloseMonitor = null;\n }\n if (this.#throttledKeepAlive) {\n userInteractionEvents.forEach((eventType) => {\n document.removeEventListener(eventType, this.#throttledKeepAlive!);\n });\n }\n await this.#revokeToken();\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n window.removeEventListener('beforeunload', this.close);\n this.#isConnected = false;\n this.#logger.audit({\n message: 'Guest disconnected from host',\n ...this.#getGuestInfo(),\n });\n this.#id = null;\n this.#url = null;\n this.#title = null;\n };\n\n /**\n * Connect to the host\n * @param {ConnectParam} param - reference to the guest window or options\n */\n // eslint-disable-next-line max-statements\n connect = async (param?: ConnectParam) => {\n if (!this.#isConnected) {\n let guestWindow: Window = window;\n let guestOptions = { ...capabilities };\n\n if (param) {\n const { window: paramWindow, ...restOptions } = param;\n if (paramWindow) guestWindow = paramWindow;\n guestOptions = { ...guestOptions, ...restOptions };\n }\n\n const hostDetails = await getHostDetails();\n this.#hostOrigin = hostDetails.origin;\n this.#hostWindow = hostDetails.window;\n // Initialize messenger\n this.#remoting.initialize(guestWindow);\n this.#remoting.addSender({\n origin: this.#hostOrigin,\n window: this.#hostWindow,\n });\n // Listen for the events the guest knows how to process\n this.#remoting.listen<RemotingEventMessage>({\n messageType: MessageType.ObjectEvent,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n callback: this.#handleObjectEvent.bind(this),\n });\n this.#remoting.listen<Config>({\n messageType: MessageType.HostConfig,\n callback: this.#handleConfigChangeEvent.bind(this),\n });\n this.#remoting.listen<void>({\n messageType: MessageType.GuestFocus,\n callback: this.#handleFocusEvent.bind(this),\n });\n this.#remoting.listen<void>({\n messageType: MessageType.HostClose,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n callback: this.#handleHostClose.bind(this),\n });\n // Let the host know the guest is ready for events, and send along\n // the guests's capabilities to allow for compatibility with future\n // host versions\n this.#remoting.send({\n targetWin: this.#hostWindow,\n targetOrigin: this.#hostOrigin,\n messageType: MessageType.GuestReady,\n messageBody: guestOptions,\n });\n this.#isConnected = true;\n this.#handleParentClose();\n if (this.#usesDevConnectAPI) await this.getAuthToken();\n await this.#startKeepSessionAlive();\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n window.addEventListener('beforeunload', this.close);\n this.#logger.audit({\n message: 'Guest connected to host',\n guestUrl: window.location.href,\n });\n }\n };\n\n /**\n * Get bearer token to access dev connect api\n * @returns {Promise<string>} auth token\n */\n getAuthToken = async () => {\n if (!this.#authToken && this.#isConnected) {\n try {\n const authObj = await (\n this as unknown as SSFGuest<ScriptingObjectTypes, Events>\n ).getObject('auth');\n if (authObj) {\n const tokenInfo = await authObj.getAccessToken();\n this.#authToken = tokenInfo?.access_token;\n this.#hostDomain = tokenInfo?.host_name;\n this.#authClientId = tokenInfo?.client_id;\n } else\n this.#logger.warn(\n 'Auth object not available to get access token from host',\n );\n } catch (e) {\n this.#logger.error(\n `Error getting access token from auth object. ${\n (e as Error).message\n }`,\n );\n }\n }\n return this.#authToken;\n };\n\n /**\n * Get scripting object proxy by id\n * @param {string} objectId unique id of the scripting object\n * @returns {Promise<any>} scripting object proxy\n */\n getObject = async <Id extends Extract<keyof AppObjects, string>>(\n objectId: Id,\n ): Promise<AppObjects[Id]> => {\n this.#logger.debug(\n `Retrieving scripting object \"${objectId}\" from host...`,\n );\n if (!this.#isConnected) throw new Error('Not connected to host');\n const { hostWindow, hostOrigin } = this.#requireHost();\n const response = await this.#remoting.invoke<ObjectResponse>({\n targetWin: hostWindow,\n targetOrigin: hostOrigin,\n messageType: MessageType.ObjectGet,\n messageBody: {\n objectId,\n },\n });\n const obj = this.#fromJSON(response.object);\n this.#logger.audit({\n message: 'Received scripting object from host',\n scriptingObject: objectId,\n ...this.#getGuestInfo(),\n });\n return obj as AppObjects[Id];\n };\n\n /**\n * Get names of scripting objects exposed by the host\n * @returns {Promise<any>} scripting objects exposed by the host\n */\n listObjects = async () => {\n this.#logger.debug(\n `Retrieving names of scripting objects exposed by host...`,\n );\n if (!this.#isConnected) throw new Error('Not connected to host');\n const { hostWindow, hostOrigin } = this.#requireHost();\n const objects = await this.#remoting.invoke<\n Array<Extract<keyof AppObjects, string>>\n >({\n targetWin: hostWindow,\n targetOrigin: hostOrigin,\n messageType: MessageType.ListObjects,\n messageBody: {},\n });\n this.#logger.audit({\n message: 'Received names of all scripting objects exposed by host',\n objects,\n ...this.#getGuestInfo(),\n });\n return objects;\n };\n\n /**\n * remove the guest from the host\n */\n removeScript = () => {\n if (!this.#created) return;\n if (this.#scriptElement) {\n const { parentNode } = this.#scriptElement;\n parentNode?.removeChild?.(this.#scriptElement);\n }\n };\n\n /**\n * Set the log level\n * @param {LogLevels} level - log level\n */\n setLogLevel = (level: LogLevels) => {\n this.#logger.setLogLevel(level);\n this.#logger.debug(`Log level changed by guest to ${level}`);\n };\n\n /**\n * subscribe to an scripting object event\n * @param {any} param - parameters for subscribing to an event\n * @returns {string} subscription token\n */\n subscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: SubscribeParam<EventId, AppEvents[EventId]>,\n ) => {\n const { eventId, criteria, callback } = param;\n this.#logger.debug(`Registering subscription for event ${eventId}`);\n const listeners = this.#eventListeners.get(eventId.toLowerCase()) || [];\n const token = uuidv4();\n listeners.push({ callback, token, criteria });\n this.#eventListeners.set(eventId.toLowerCase(), listeners);\n // send message to host about the new subscription\n const { hostWindow, hostOrigin } = this.#requireHost();\n this.#remoting.send({\n targetWin: hostWindow,\n targetOrigin: hostOrigin,\n messageType: MessageType.GuestEventSubscribe,\n messageBody: {\n eventId,\n criteria,\n token,\n },\n });\n this.#logger.debug(`Subscribed to event ${eventId} with token ${token}`);\n return token;\n };\n\n /**\n * unsubscribe from an scripting object event\n * @param {any} param - parameters for unsubscribing from an event\n */\n unsubscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: UnsubscribeParam<EventId>,\n ) => {\n const { eventId, token } = param;\n const listeners = this.#eventListeners.get(eventId.toLowerCase());\n if (listeners) {\n const originalLength = listeners.length;\n const filteredListeners = listeners.filter(\n (callbackInfo) => callbackInfo.token !== token,\n );\n\n // Only send unsubscribe message if a listener was actually removed\n if (filteredListeners.length < originalLength) {\n this.#eventListeners.set(eventId.toLowerCase(), filteredListeners);\n const { hostWindow, hostOrigin } = this.#requireHost();\n this.#remoting.send({\n targetWin: hostWindow,\n targetOrigin: hostOrigin,\n messageType: MessageType.GuestEventUnsubscribe,\n messageBody: {\n eventId,\n token,\n },\n });\n this.#logger.debug(`Unsubscribed from event ${eventId}`);\n }\n }\n };\n}\n"],"names":["root","factory","__WEBPACK_EXTERNAL_MODULE__388__","Symbol","module","getRawTag","objectToString","nullTag","undefinedTag","symToStringTag","baseGetTag","value","trimmedEndIndex","reTrimStart","baseTrim","string","freeGlobal","objectProto","hasOwnProperty","nativeObjectToString","isOwn","tag","unmasked","result","freeSelf","reWhitespace","index","isObject","now","toNumber","FUNC_ERROR_TEXT","nativeMax","nativeMin","debounce","func","wait","options","lastArgs","lastThis","maxWait","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","invokeFunc","time","args","thisArg","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","type","isObjectLike","symbolTag","isSymbol","throttle","NAN","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","other","isBinary","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","exports","definition","key","obj","prop","getRandomValues","rnds8","rng","byteToHex","i","unsafeStringify","arr","offset","stringify","uuid","validate","v4","buf","rnds","MESSAGE_SOURCE","RESPONSE_MESSAGE_TYPE","EXCEPTION_MESSAGE_TYPE","createMessage","messageType","messageBody","requestId","onewayMsg","sendMessage","param","targetWin","targetOrigin","msg","Remoting","#correlationId","#logger","#listeners","#invocations","#timeoutMonitorHandle","#initializedWindow","#allowedSenders","logger","correlationId","#evaluateTimeouts","ts","canceledItems","nextCancelTime","eventData","cancelTime","delay","#scheduleTimeoutCheck","delayMs","#stopResponseMonitor","#popInvocation","e","#processResponse","message","#processException","#receive","sourceWin","sourceOrigin","callbacks","callback","#processMessage","senderOrigin","origin","window2","win","responseTimeoutMs","resolve","reject","items","response","ex","MessageType","MessageType2","ScriptingObjectProxy","objectId","objectType","isScriptingObjectProxy","Event","name","ProxyEvent","#eventSrc","eventSrc","token","isEvent","getEventId","eventName","getParentWindowLocation","parent","getOrigin","url","isEmbedded","getComputedStyle","el","element","retVal","propValue","originsRegex","HANDSHAKE_TIMEOUT_MS","getHostDetails","currentWindow","timer","onMessage","event","source","hostWindow","scriptOnlyGuest","setScriptOnlyGuest","setupV1Adapter","guestV2","guest","getGuest","scriptUri","params","objectName","level","ResponseType","KEEP_ALIVE_INTERVAL","capabilities","onLoad","document","iframeBody","iframeHTML","size","diagnosticsEndpoint","userInteractionEvents","getDiagnosticsAPIUrl","scriptUrl","hostName","SSFGuest","#remoting","#created","#scriptElement","#isConnected","#eventListeners","#id","#title","#url","#hostOrigin","#hostWindow","#parentCloseMonitor","#regexCache","#requireHost","#usesDevConnectAPI","#authToken","#authClientId","#hostDomain","#keepAlive","#keepAliveInterval","#loggerOptions","#throttledKeepAlive","logToConsole","team","appName","transport","#getGuestInfo","#fromJSON","soJSON","ctrl","functionName","#invoke","functionParams","promises","p","val","hostOrigin","#handleResponse","#matchesCriteria","payload","criteria","condition","numValue","regex","#handleConfigChangeEvent","body","#handleFocusEvent","#handleHostClose","#handleParentClose","#handleObjectEvent","object","eventId","listeners","callbackInfo","values","#extendTokenLifetime","#revokeToken","#startKeepSessionAlive","appObj","eventType","containerElement","scriptEle","onScriptLoad","onScriptError","cleanup","guestWindow","guestOptions","paramWindow","restOptions","hostDetails","authObj","tokenInfo","objects","parentNode","originalLength","filteredListeners"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"js/emuiSsfGuest.dc017a38b78ac30a1aa3.js","mappings":"CAAC,SAA0CA,EAAMC,EAAS,CACtD,OAAO,SAAY,UAAY,OAAO,QAAW,SACnD,OAAO,QAAUA,EAAQ,QAAQ,iBAAiB,CAAC,EAC5C,OAAO,QAAW,YAAc,OAAO,IAC9C,OAAO,CAAC,iBAAiB,EAAGA,CAAO,EAC5B,OAAO,SAAY,SAC1B,QAAQ,IAASA,EAAQ,QAAQ,iBAAiB,CAAC,GAEnDD,EAAK,IAASA,EAAK,KAAU,CAAC,EAAGA,EAAK,IAAO,MAAWC,EAAQD,EAAK,eAAkB,EACzF,GAAG,WAAaE,I,uBCThB,IAAIF,EAAO,EAAQ,GAAS,EAGxBG,EAASH,EAAK,OAElBI,EAAO,QAAUD,C,aCLjB,IAAIA,EAAS,EAAQ,GAAW,EAC5BE,EAAY,EAAQ,GAAc,EAClCC,EAAiB,EAAQ,GAAmB,EAG5CC,EAAU,gBACVC,EAAe,qBAGfC,EAAiBN,EAASA,EAAO,YAAc,OASnD,SAASO,EAAWC,EAAO,CACzB,OAAIA,GAAS,KACJA,IAAU,OAAYH,EAAeD,EAEtCE,GAAkBA,KAAkB,OAAOE,CAAK,EACpDN,EAAUM,CAAK,EACfL,EAAeK,CAAK,CAC1B,CAEAP,EAAO,QAAUM,C,aC3BjB,IAAIE,EAAkB,EAAQ,GAAoB,EAG9CC,EAAc,OASlB,SAASC,EAASC,EAAQ,CACxB,OAAOA,GACHA,EAAO,MAAM,EAAGH,EAAgBG,CAAM,EAAI,CAAC,EAAE,QAAQF,EAAa,EAAE,CAE1E,CAEAT,EAAO,QAAUU,C,SCjBjB,IAAIE,EAAa,OAAO,YAAU,UAAY,YAAU,WAAO,SAAW,QAAU,WAEpFZ,EAAO,QAAUY,C,aCHjB,IAAIb,EAAS,EAAQ,GAAW,EAG5B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ACX,QAAA4G,EACA,SAAAX,EACA,MAAAtF,CACF,CACF,CAAC,EACD,KAAKlD,GAAQ,MAAM,uBAAuBmJ,CAAO,eAAejG,CAAK,EAAE,EAChEA,CACT,EAMA,YACExD,GACG,CACH,KAAM,CAAE,QAAAyJ,EAAS,MAAAjG,CAAM,EAAIxD,EACrB0J,EAAY,KAAK/C,GAAgB,IAAI8C,EAAQ,YAAY,CAAC,EAChE,GAAIC,EAAW,CACb,MAAMsB,EAAiBtB,EAAU,OAC3BuB,EAAoBvB,EAAU,OACjCC,GAAiBA,EAAa,QAAUnG,CAC3C,EAGA,GAAIyH,EAAkB,OAASD,EAAgB,CAC7C,KAAKrE,GAAgB,IAAI8C,EAAQ,YAAY,EAAGwB,CAAiB,EACjE,KAAM,CAAE,WAAAnG,EAAY,WAAA4D,CAAW,EAAI,KAAKvB,GAAa,EACrD,KAAKZ,GAAU,KAAK,CAClB,UAAWzB,EACX,aAAc4D,EACd,YAAa7F,EAAY,sBACzB,YAAa,CACX,QAAA4G,EACA,MAAAjG,CACF,CACF,CAAC,EACD,KAAKlD,GAAQ,MAAM,2BAA2BmJ,CAAO,EAAE,CACzD,CACF,CACF,CACF,C","sources":["webpack://ice.guest/webpack/universalModuleDefinition","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_Symbol.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_baseGetTag.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_baseTrim.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_freeGlobal.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_getRawTag.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_objectToString.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_root.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/_trimmedEndIndex.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/debounce.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/isObject.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/isObjectLike.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/isSymbol.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/now.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/throttle.js","webpack://ice.guest/../../node_modules/.pnpm/lodash@4.17.23/node_modules/lodash/toNumber.js","webpack://ice.guest/external umd \"emuiDiagnostics\"","webpack://ice.guest/webpack/bootstrap","webpack://ice.guest/webpack/runtime/compat get default export","webpack://ice.guest/webpack/runtime/define property getters","webpack://ice.guest/webpack/runtime/hasOwnProperty shorthand","webpack://ice.guest/webpack/runtime/make namespace object","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/native.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/rng.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/stringify.js","webpack://ice.guest/../../node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-browser/v4.js","webpack://ice.guest/../common/dist/esm/remoting.js","webpack://ice.guest/../common/dist/esm/messageType.js","webpack://ice.guest/../common/dist/esm/proxy.js","webpack://ice.guest/../common/dist/esm/event.js","webpack://ice.guest/./lib/utils.ts","webpack://ice.guest/./lib/v1-adapter.ts","webpack://ice.guest/./lib/guest.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"emuiDiagnostics\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"emuiDiagnostics\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ice\"] = factory(require(\"emuiDiagnostics\"));\n\telse\n\t\troot[\"ice\"] = root[\"ice\"] || {}, root[\"ice\"][\"guest\"] = factory(root[\"emuiDiagnostics\"]);\n})(globalThis, (__WEBPACK_EXTERNAL_MODULE__388__) => {\nreturn ","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__388__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import { v4 as uuidv4 } from \"uuid\";\nconst MESSAGE_SOURCE = \"elli:remoting\";\nconst RESPONSE_MESSAGE_TYPE = \"elli:remoting:response\";\nconst EXCEPTION_MESSAGE_TYPE = \"elli:remoting:exception\";\nconst createMessage = ({\n messageType,\n messageBody,\n requestId,\n onewayMsg = false\n}) => ({\n requestId: requestId ?? (!onewayMsg ? uuidv4() : null),\n source: MESSAGE_SOURCE,\n type: messageType,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n body: messageBody\n});\nconst sendMessage = (param) => {\n const { targetWin, targetOrigin, messageType, messageBody } = param;\n const msg = createMessage({ messageType, messageBody });\n targetWin.postMessage(msg, targetOrigin);\n};\nclass Remoting {\n #correlationId;\n #logger;\n /**\n * set of listeners that are registered\n */\n #listeners = /* @__PURE__ */ new Map();\n /**\n * Represents the set of invocations that are waiting for a response\n */\n #invocations = /* @__PURE__ */ new Map();\n /**\n * The handle to the timeout monitor\n */\n #timeoutMonitorHandle = null;\n /**\n * The window that remoting was initialized on\n */\n #initializedWindow = null;\n /**\n * The set of windows that are allowed to send messages to this window\n */\n #allowedSenders = /* @__PURE__ */ new Map();\n /**\n * Create a new instance of the Remoting class\n * @param logger pui-diagnostic logger\n * @param correlationId unique id for the current session\n */\n constructor(logger, correlationId) {\n if (!logger) throw new Error(\"logger is required\");\n if (!correlationId) throw new Error(\"correlationId is required\");\n this.#correlationId = correlationId;\n this.#logger = logger;\n }\n // Evaluates the timeouts on any waiting invocations and schedules the next check\n #evaluateTimeouts = () => {\n this.#timeoutMonitorHandle = null;\n const ts = Date.now();\n const canceledItems = [];\n let nextCancelTime = null;\n this.#invocations.forEach((eventData, key) => {\n const { requestId, cancelTime } = eventData;\n if (cancelTime && cancelTime <= ts) {\n this.#logger.debug(\n `Detected response timeout for requestId: ${requestId}...`\n );\n canceledItems.push(key);\n eventData.resolve(void 0);\n } else if (cancelTime) {\n nextCancelTime = nextCancelTime === null ? cancelTime : Math.min(nextCancelTime, cancelTime);\n }\n });\n canceledItems.forEach((key) => {\n this.#invocations.delete(key);\n });\n if (nextCancelTime !== null) {\n const delay = Math.max(nextCancelTime - Date.now(), 0);\n this.#scheduleTimeoutCheck(delay);\n }\n };\n // Schedule a timeout check after a delay\n #scheduleTimeoutCheck = (delayMs) => {\n if (this.#timeoutMonitorHandle !== null) return;\n this.#timeoutMonitorHandle = window.setTimeout(\n this.#evaluateTimeouts,\n delayMs\n );\n };\n // Stops the timeout monitor\n #stopResponseMonitor = () => {\n if (this.#timeoutMonitorHandle !== null) {\n window.clearTimeout(this.#timeoutMonitorHandle);\n this.#timeoutMonitorHandle = null;\n }\n };\n // Pops an invocation from the incovation list\n #popInvocation = (requestId) => {\n const e = this.#invocations.get(requestId);\n this.#logger.debug(`serving requestId: ${requestId}`);\n this.#invocations.delete(requestId);\n return e;\n };\n // Handles a response to a prior cross-frame invocation\n #processResponse = (message) => {\n const { requestId } = message;\n this.#logger.debug(\n `Response received for invocation requestId: ${requestId}`\n );\n const eventData = this.#popInvocation(requestId);\n if (!eventData) {\n this.#logger.debug(\n `Received response to stale/invalid request with requestId: ${requestId}`\n );\n return false;\n }\n eventData.resolve(message.body);\n return true;\n };\n // Handles a response to a prior cross-frame invocation\n #processException = (message) => {\n this.#logger.debug(\n `Exception received for invocation (requestId = ${message.requestId})`\n );\n const eventData = this.#popInvocation(message.requestId);\n if (!eventData) {\n this.#logger.warn(\n `Received exception for stale/invalid request (requestId = ${message.requestId})`\n );\n return false;\n }\n eventData.reject(new Error(message.body));\n return true;\n };\n // Receives a message from another window and invokes any event handlers\n #receive = ({\n sourceWin,\n sourceOrigin,\n message\n }) => {\n this.#logger.debug(`Received message of type \"${message.type}\"`);\n const callbacks = this.#listeners.get(message.type);\n if (!callbacks) return false;\n callbacks.forEach((callback) => {\n this.#logger.debug(`Invoking message handler ${callback.name}`);\n callback({\n sourceWin,\n sourceOrigin,\n requestId: message.requestId,\n type: message.type,\n body: message.body\n });\n });\n return true;\n };\n // Processes a message received thru the window's message event\n #processMessage = (message) => {\n if (this.#allowedSenders.size === 0) return false;\n if (!message.source) return false;\n const senderOrigin = this.#allowedSenders.get(message.source);\n if (!senderOrigin) return false;\n if (message?.data?.source !== MESSAGE_SOURCE) return false;\n this.#logger.debug(\n `Remoting: Received message of type \"${message.data.type}\"`\n );\n if (message.data.type === RESPONSE_MESSAGE_TYPE)\n this.#processResponse(message.data);\n else if (message.data.type === EXCEPTION_MESSAGE_TYPE)\n this.#processException(message.data);\n else\n this.#receive({\n sourceWin: message.source,\n sourceOrigin: senderOrigin,\n message: message.data\n });\n return true;\n };\n /**\n * Adds window and its origin list of allowed senders\n * @param {AddSenderParam} param - The sender to add\n */\n addSender = (param) => {\n const { origin, window: window2 } = param;\n if (!origin) throw new Error(\"origin is required\");\n if (!window2) throw new Error(\"window is required\");\n this.#allowedSenders.set(window2, origin);\n };\n /**\n * Initializes the remoting service for a window\n * @param win The window to initialize remoting for\n */\n initialize = (win) => {\n if (this.#initializedWindow) {\n this.#initializedWindow.removeEventListener(\n \"message\",\n this.#processMessage\n );\n }\n win.addEventListener(\"message\", this.#processMessage);\n this.#initializedWindow = win;\n this.#logger.debug(`initialized remoting id: ${this.#correlationId}`);\n };\n /**\n * Closes the remoting service for a window\n */\n close = () => {\n if (this.#initializedWindow) {\n this.#initializedWindow.removeEventListener(\n \"message\",\n this.#processMessage\n );\n this.#initializedWindow = null;\n }\n this.#stopResponseMonitor();\n this.#logger.debug(`closed remoting id: ${this.#correlationId}`);\n };\n /**\n * Sends an invocation which generates a Promise to be used to get a response\n * @param {InvokeParam} param The parameters for the invocation\n * @returns promisifyed response\n */\n invoke = (param) => {\n const {\n targetWin,\n targetOrigin,\n messageType,\n messageBody,\n responseTimeoutMs\n } = param;\n return new Promise((resolve, reject) => {\n const msg = createMessage({ messageType, messageBody });\n this.#invocations.set(msg.requestId, {\n requestId: msg.requestId,\n resolve,\n reject,\n cancelTime: responseTimeoutMs ? Date.now() + responseTimeoutMs : null\n });\n targetWin.postMessage(msg, targetOrigin);\n const { requestId } = msg;\n this.#logger.debug(\n `Posted invocation message of type ${messageType} requestId: ${requestId || \"\"}`\n );\n if (responseTimeoutMs) {\n this.#logger.debug(\n `scheduling timeout check for requestId: ${requestId || \"\"} in ${responseTimeoutMs} ms`\n );\n this.#scheduleTimeoutCheck(responseTimeoutMs);\n }\n });\n };\n /**\n * Setup callback for a specific message type\n * @param {ListenParam<T>} param The parameters for the listener\n */\n listen = (param) => {\n const { messageType, callback } = param;\n const items = this.#listeners.get(messageType) || [];\n items.push(callback);\n this.#listeners.set(messageType, items);\n };\n /**\n * Remove a previously registered callback for a specific message type\n * @param {ListenParam<T>} param The parameters identifying the listener to remove\n */\n unlisten = (param) => {\n const { messageType, callback } = param;\n const items = this.#listeners.get(messageType);\n if (!items) return;\n const index = items.indexOf(callback);\n if (index !== -1) {\n items.splice(index, 1);\n }\n };\n /**\n * Send a message without any form of response. Fire and forget\n * @param {SendParam} param The parameters for the send\n */\n send = (param) => {\n const { targetWin, targetOrigin, messageType, messageBody } = param;\n const msg = createMessage({\n messageType,\n messageBody,\n onewayMsg: true\n });\n targetWin.postMessage(msg, targetOrigin);\n this.#logger.debug(`Posted one-way message of type \"${messageType}\"`);\n };\n /**\n * Removes a window from the list of allowed senders\n * @param {AddSenderParam} param - The sender to remove\n */\n removeSender = (param) => {\n const { window: window2 } = param;\n if (window2) this.#allowedSenders.delete(window2);\n };\n /**\n * Send a response message to a window\n * @param {RespondParam} param The parameters for the response\n */\n respond = (param) => {\n const { targetWin, targetOrigin, requestId, response } = param;\n const msg = createMessage({\n messageType: RESPONSE_MESSAGE_TYPE,\n messageBody: response,\n requestId\n });\n targetWin.postMessage(msg, targetOrigin);\n this.#logger.debug(\n `Response sent to caller for invocation requestId: ${requestId}`\n );\n };\n /**\n * Send an exception message to a window\n * @param {RaiseExceptionParam} param The parameters for the exception\n */\n raiseException = (param) => {\n const { targetWin, targetOrigin, requestId, ex } = param;\n const messageBody = ex instanceof Error ? ex.message : ex;\n const msg = createMessage({\n messageType: EXCEPTION_MESSAGE_TYPE,\n messageBody,\n requestId\n });\n targetWin.postMessage(msg, targetOrigin);\n this.#logger.debug(\n `Exception sent to caller for invocation. requestId: ${requestId}`\n );\n };\n}\nexport {\n Remoting,\n sendMessage\n};\n","var MessageType = /* @__PURE__ */ ((MessageType2) => {\n MessageType2[\"GuestClose\"] = \"guest:close\";\n MessageType2[\"GuestEventSubscribe\"] = \"guest:eventSubscribe\";\n MessageType2[\"GuestEventUnsubscribe\"] = \"guest:eventUnsubscribe\";\n MessageType2[\"GuestFocus\"] = \"guest:focus\";\n MessageType2[\"GuestReady\"] = \"guest:ready\";\n MessageType2[\"GuestReadyComplete\"] = \"guest:readyComplete\";\n MessageType2[\"GuestResize\"] = \"guest:resize\";\n MessageType2[\"HandShake\"] = \"handshake\";\n MessageType2[\"HandShakeAck\"] = \"handshake:ack\";\n MessageType2[\"HostClose\"] = \"host:close\";\n MessageType2[\"HostConfig\"] = \"host:config\";\n MessageType2[\"ListObjects\"] = \"list:objects\";\n MessageType2[\"ObjectEvent\"] = \"object:event\";\n MessageType2[\"ObjectGet\"] = \"object:get\";\n MessageType2[\"ObjectInvoke\"] = \"object:invoke\";\n return MessageType2;\n})(MessageType || {});\nexport {\n MessageType\n};\n","class ScriptingObjectProxy {\n /**\n * proxy type\n */\n __TYPE__ = \"Proxy\";\n /**\n * unique id of scripting object\n */\n id;\n /**\n * type of scripting object\n */\n objectType;\n /**\n * Creates a new instance of the Scripting Object Proxy\n * @param objectId unique id of scripting object\n * @param objectType type of scripting object\n */\n constructor(objectId, objectType) {\n this.id = objectId;\n this.objectType = objectType;\n }\n}\nconst isScriptingObjectProxy = (value) => (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n value?.constructor?.name === \"Proxy\" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n value?.constructor?.name === \"ScriptingObjectProxy\" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-underscore-dangle\n value?.__TYPE__ === \"Proxy\"\n);\nexport {\n ScriptingObjectProxy,\n isScriptingObjectProxy\n};\n","class Event {\n /* eslint-enable indent */\n /**\n * name of the event\n */\n name;\n /**\n * scripting object id that owns this event\n */\n objectId;\n /**\n * unique id of the event\n */\n id;\n /**\n * Create an event object\n * @param {EventParam} param - parameters for creating an event\n */\n constructor(param) {\n const { name, objectId } = param;\n if (!name) throw new Error(\"Event name is required\");\n if (!objectId) throw new Error(\"Scripting object id is required\");\n this.objectId = objectId;\n this.name = name;\n this.id = `${this.objectId}.${this.name}`.toLowerCase();\n }\n}\nclass ProxyEvent {\n /**\n * check if given object is an instance of ProxyEvent\n * @param obj object to be compared\n * @returns true if given object is an instance of ProxyEvent\n */\n static [Symbol.hasInstance](obj) {\n return typeof obj === \"object\" && obj !== null && \"getType\" in obj && typeof obj.getType === \"function\" && obj.getType() === \"ProxyEvent\";\n }\n /* eslint-enable indent */\n /**\n * module that owns this event management. SSF Guest or App Bridge host\n */\n #eventSrc;\n /**\n * unique id of scripting object\n */\n objectId;\n /**\n * name of the event\n */\n name;\n /**\n * unique id of the event\n */\n id;\n /**\n * get type of the object\n * @returns type of the object\n */\n getType() {\n return \"ProxyEvent\";\n }\n /**\n * Create a new instance of the Scripting Object Proxy Event\n * @param {ProxyEventParam} param - parameter for the constructor\n */\n constructor(param) {\n const { name, objectId, eventSrc } = param;\n if (!name) throw new Error(\"Event name is required\");\n if (!objectId) throw new Error(\"Scripting object id is required\");\n if (!eventSrc) throw new Error(\"Event source is required\");\n this.objectId = objectId;\n this.name = name;\n this.#eventSrc = eventSrc;\n this.id = `${this.objectId}.${this.name}`.toLowerCase();\n }\n /**\n * subscribe to an scripting object event\n * @param callback event listener\n * @returns subscription token\n */\n subscribe = (callback) => this.#eventSrc.subscribe({\n eventId: this.id,\n callback\n });\n /**\n * unsubscribe from an scripting object event\n * @param token subscription token\n */\n unsubscribe = (token) => {\n this.#eventSrc.unsubscribe({\n eventId: this.id,\n token\n });\n };\n}\nconst isEvent = (value) => value instanceof Event;\nconst getEventId = (objectId, eventName) => `${objectId.toLowerCase()}.${eventName.toLowerCase()}`;\nexport {\n Event,\n ProxyEvent,\n getEventId,\n isEvent\n};\n","import { MessageType, sendMessage } from '@elliemae/microfe-common';\n\nexport const getParentWindowLocation = () => {\n const { parent } = window;\n try {\n return parent?.location?.href;\n } catch (e) {\n return null;\n }\n};\n\nexport const getOrigin = (url: string | null) => {\n if (!url || url === 'about:blank') return '*';\n try {\n const { origin } = new URL(url);\n return origin === 'null' || !origin ? '*' : origin;\n } catch {\n try {\n const { origin } = new URL(url, document.baseURI);\n return origin === 'null' || !origin ? '*' : origin;\n } catch {\n return '*';\n }\n }\n};\n\nexport const isEmbedded = () => window.self !== window.parent;\n\nexport const getComputedStyle = (\n prop: Extract<keyof CSSStyleDeclaration, string>,\n el?: Element,\n) => {\n const element = el || document.body;\n const retVal = document.defaultView?.getComputedStyle?.(element, null);\n const propValue = retVal ? (retVal[prop] as string) : '0';\n return parseInt(propValue, 10);\n};\n\nconst originsRegex =\n /^https?:\\/\\/([a-z0-9-]+\\.)*(?:elliemae\\.io|ellielabs\\.com|ellieservices\\.com|encompassloconnect\\.com|ice\\.com|localhost:[0-9]+)$/i;\nconst MESSAGE_SOURCE = 'elli:remoting';\n\nconst HANDSHAKE_TIMEOUT_MS = 30000;\n\nexport const getHostDetails = () =>\n new Promise<{ origin: string; window: Window }>((resolve, reject) => {\n if (!isEmbedded()) {\n const currentWindow = window;\n let timer: ReturnType<typeof setTimeout>;\n const onMessage = (\n event: MessageEvent<{ source: string; type: string }>,\n ) => {\n if (originsRegex.test(event.origin)) {\n const { source, type } = event.data || {};\n if (source === MESSAGE_SOURCE && type === MessageType.HandShake) {\n const { origin } = event;\n const hostWindow = event.source as Window;\n clearTimeout(timer);\n // send handshake acknowledgement\n sendMessage({\n targetWin: hostWindow,\n targetOrigin: origin,\n messageType: MessageType.HandShakeAck,\n messageBody: {},\n });\n currentWindow.removeEventListener('message', onMessage);\n resolve({ origin, window: hostWindow });\n }\n }\n };\n timer = setTimeout(() => {\n currentWindow.removeEventListener('message', onMessage);\n reject(\n new Error(`Host handshake timed out after ${HANDSHAKE_TIMEOUT_MS}ms`),\n );\n }, HANDSHAKE_TIMEOUT_MS);\n currentWindow.addEventListener('message', onMessage);\n } else {\n resolve({\n origin: getOrigin(document.referrer || getParentWindowLocation()),\n window: window.parent,\n });\n }\n });\n","import type {\n Events,\n ScriptingObjectTypes,\n} from '@elliemae/pui-scripting-object';\nimport type { ISSFGuest, FilterCriteria } from '@elliemae/microfe-common';\n\nlet scriptOnlyGuest = false;\nexport const setScriptOnlyGuest = (value: boolean) => {\n scriptOnlyGuest = value;\n};\n\n/**\n * map v1 guest APIs to v2 guest API\n * @param guest\n * @param guestV2\n */\nconst setupV1Adapter = (\n guestV2: ISSFGuest<ScriptingObjectTypes, Events> | null = null,\n) => {\n let guest: ISSFGuest<ScriptingObjectTypes, Events> | null = guestV2;\n const getGuest = () => {\n if (!guest) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n guest = window.ice?.guest?.SSFGuest\n ? new window.ice.guest.SSFGuest() // eslint-disable-line @typescript-eslint/no-unsafe-call\n : null;\n if (!guest) {\n throw new Error('Guest definition not found');\n }\n }\n return guest;\n };\n\n window.elli = window.elli ?? {};\n\n window.elli.script = {\n guest: {\n create: (scriptUri: string, element: HTMLElement) =>\n getGuest().addScript(scriptUri, element),\n },\n connect: (params?: any) => {\n if (!scriptOnlyGuest)\n console.warn(\n 'elli.script.connect is deprecated. Please use connect method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); await guest.connect(params);',\n );\n return getGuest().connect(params); // eslint-disable-line @typescript-eslint/no-unsafe-argument\n },\n getObject: (objectName: any) => {\n if (!scriptOnlyGuest)\n console.warn(\n 'elli.script.getObject is deprecated. Please use getObject method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); await guest.getObject(objectName);',\n );\n return getGuest().getObject(objectName);\n },\n setLogLevel: (level: any) => {\n if (!scriptOnlyGuest)\n console.warn(\n 'elli.script.setLogLevel is deprecated. Please use setLogLevel method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); guest.setLogLevel(level);',\n );\n return getGuest().setLogLevel(level); // eslint-disable-line @typescript-eslint/no-unsafe-argument\n },\n // eslint-disable-next-line max-params\n subscribe: (\n objectId: string,\n eventName: string,\n callback: any,\n options?: { criteria?: FilterCriteria },\n ) => {\n if (!scriptOnlyGuest)\n console.warn(\n // eslint-disable-next-line no-template-curly-in-string\n 'elli.script.subscribe is deprecated. Please use subscribe method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); guest.subscribe({ eventId: `${objectId}.${eventName}`, callback: (event) => { console.log(event); });',\n );\n return getGuest().subscribe({\n eventId: `${objectId}.${eventName}` as any, // eslint-disable-line @typescript-eslint/no-unsafe-assignment\n callback: (event: { obj: any; eventParams: any; eventOptions: any }) =>\n callback(event?.obj, event?.eventParams, event?.eventOptions), // eslint-disable-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call\n criteria: options?.criteria,\n });\n },\n unsubscribe: (objectId: string, eventName: string, token: string) => {\n if (!scriptOnlyGuest)\n console.warn(\n // eslint-disable-next-line no-template-curly-in-string\n 'elli.script.unsubscribe is deprecated. Please use unsubscribe method of SSFGuest class instead, const guest = new ice.guest.SSFGuest(); guest.unsubscribe({ eventId: `${objectId}.${eventName}`, token });',\n );\n return getGuest().unsubscribe({\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n eventId: `${objectId}.${eventName}` as any,\n token,\n });\n },\n };\n};\n\ntry {\n setupV1Adapter();\n} catch {\n // Prevent module-level throw from breaking all downstream imports\n}\nexport { setupV1Adapter };\n","/* eslint-disable max-lines */\nimport { v4 as uuidv4 } from 'uuid';\nimport throttle from 'lodash/throttle';\nimport type {\n IScriptingObjectProxy,\n RemotingScriptingObject,\n Listener,\n Events,\n ScriptingObjectTypes,\n} from '@elliemae/pui-scripting-object';\nimport {\n Remoting,\n sendMessage,\n MessageType,\n getEventId,\n ProxyEvent,\n ScriptingObjectProxy,\n} from '@elliemae/microfe-common';\nimport type {\n ListenerCallbackParams,\n RemotingEventMessage,\n ConnectParam,\n SubscribeParam,\n UnsubscribeParam,\n EventListeners,\n ISSFGuest,\n ScriptingObjects,\n FilterCriteria,\n} from '@elliemae/microfe-common';\nimport {\n logger as puiLogger,\n Console,\n http,\n LogLevels,\n Logger,\n webvitals,\n logUnhandledErrors,\n} from '@elliemae/pui-diagnostics';\nimport {\n getOrigin,\n isEmbedded,\n getComputedStyle,\n getHostDetails,\n getParentWindowLocation,\n} from './utils.js';\nimport { setupV1Adapter, setScriptOnlyGuest } from './v1-adapter.js';\n\nenum ResponseType {\n OBJECT = 'object',\n VALUE = 'value',\n}\n\ntype ObjectResponse = {\n type: ResponseType.OBJECT;\n object: RemotingScriptingObject;\n};\n\ntype ValueResponse = {\n type: ResponseType.VALUE;\n value: any;\n};\n\ntype Response = ObjectResponse | ValueResponse;\ntype Config = {\n logLevel: LogLevels;\n guestId: string;\n guestTitle: string;\n guestUrl: string;\n};\n\nexport type ListenerInfo = {\n criteria?: FilterCriteria;\n callback: Listener<any, any, any, any>;\n token: string;\n};\n\n/**\n * Interval in milliseconds to extend host session and token. Default is 2 minutes.\n */\nconst KEEP_ALIVE_INTERVAL = 120000;\n\n// Provides a list of capabilities of this version of teh scripting framework\nconst capabilities = {\n eventFeedback: true,\n};\n\nconst onLoad = () => {\n const { document } = window;\n const iframeBody = document.body;\n const iframeHTML = document.documentElement;\n const bodyOffsetHeight =\n iframeBody.offsetHeight +\n getComputedStyle('marginTop') +\n getComputedStyle('marginBottom');\n const size = {\n height: bodyOffsetHeight,\n width: Math.max(iframeBody.scrollWidth, iframeHTML.scrollWidth),\n };\n sendMessage({\n targetWin: window.parent,\n targetOrigin: getOrigin(document.referrer || getParentWindowLocation()),\n messageType: MessageType.GuestResize,\n messageBody: size,\n });\n window.removeEventListener('load', onLoad);\n};\n\n// if hosted in iframe then wait for load event to send resize message\nif (isEmbedded()) {\n window.addEventListener('load', onLoad);\n}\n\n/**\n * options for the guest\n */\nexport type GuestOption = {\n /**\n * options for the logger\n */\n logger?: {\n /**\n * log to console\n */\n console?: boolean;\n /**\n * url to send logs to\n */\n url?: string;\n /**\n * index to use for logging\n */\n index: string;\n /**\n * app name to use for logging\n */\n appName: string;\n /**\n * team name that owns the app\n */\n team: string;\n };\n /**\n * logger to use for the guest\n */\n appLogger?: Logger;\n /**\n * Gets bearer token to access Dev Connect api during connect operation. Default is false.\n */\n usesDevConnectAPI?: boolean;\n /**\n * Track user activity and extend host session. Default is true.\n */\n keepAlive?: boolean;\n /**\n * Interval in milliseconds to extend host session and token. Default is 300000 (5 minutes).\n */\n keepAliveInterval?: number;\n};\n\nconst diagnosticsEndpoint = {\n 'cdn.ice.com': 'https://api.elliemae.com/diagnostics/v2/logging',\n 'cdn.np.ice.com': 'https://stg.api.elliemae.com/diagnostics/v2/logging',\n 'cdn.uat.ice.com': 'https://concept.api.elliemae.com/diagnostics/v2/logging',\n 'cdn.pt1.ice.com': 'https://pel1.api.ellielabs.com/diagnostics/v2/logging',\n 'cdn.qa1.ice.com': 'https://int.api.ellielabs.com/diagnostics/v2/logging',\n 'cdn.dev1.ice.com': 'https://int.api.ellielabs.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.ice.com': 'https://api.elliemae.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.s1.ice.com':\n 'https://stg.api.elliemae.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.uat1.ice.com':\n 'https://concept.api.elliemae.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.pl1.ice.com':\n 'https://pel1.api.ellielabs.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.q1.ice.com':\n 'https://int.api.ellielabs.com/diagnostics/v2/logging',\n 'cdn.mortgagetech.d1.ice.com':\n 'https://int.api.ellielabs.com/diagnostics/v2/logging',\n localhost: 'https://int.api.ellielabs.com/diagnostics/v2/logging',\n};\n\nconst userInteractionEvents = ['click', 'scroll', 'keypress', 'touchstart'];\n\n/**\n * Get diagnostics api url based on env\n * @returns {string} diagnostics api url\n */\nconst getDiagnosticsAPIUrl = () => {\n const scriptUrl =\n (document.currentScript as HTMLScriptElement)?.src || import.meta.url;\n const hostName = scriptUrl\n ? (new URL(scriptUrl).hostname as keyof typeof diagnosticsEndpoint)\n : 'localhost';\n return (\n diagnosticsEndpoint[hostName] ||\n diagnosticsEndpoint['cdn.mortgagetech.q1.ice.com']\n );\n};\n\n/**\n * Creates a new guest that can be used to communicate with the parent host application\n * @template AppEvents - The events that the guest application listens\n */\n/* eslint-disable indent */\nexport class SSFGuest<\n AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>,\n AppEvents extends EventListeners = Events,\n> implements ISSFGuest<AppObjects, AppEvents>\n{\n /* eslint-enable indent */\n #correlationId: string;\n\n #logger: Logger;\n\n #remoting: Remoting;\n\n #created = false;\n\n #scriptElement: HTMLScriptElement | null = null;\n\n #isConnected = false;\n\n #eventListeners = new Map<string, ListenerInfo[]>();\n\n #id: string | null = null;\n\n #title: string | null = null;\n\n #url: string | null = null;\n\n #hostOrigin: string | null = null;\n\n #hostWindow: Window | null = null;\n\n #parentCloseMonitor: ReturnType<typeof setInterval> | null = null;\n\n #regexCache = new Map<string, RegExp>();\n\n /** Returns non-null host references or throws a descriptive error. */\n #requireHost(): { hostWindow: Window; hostOrigin: string } {\n if (!this.#hostWindow || !this.#hostOrigin) {\n throw new Error(\n 'Guest is not connected to a host. Call connect() first.',\n );\n }\n return { hostWindow: this.#hostWindow, hostOrigin: this.#hostOrigin };\n }\n\n /**\n * get bearer token to access api during connect operation\n */\n #usesDevConnectAPI = false;\n\n /**\n * auth token to access api\n */\n #authToken: string | null = null;\n\n /**\n * oauth client id\n */\n #authClientId: string | null = null;\n\n /**\n * api host domain\n */\n #hostDomain: string | null = null;\n\n /**\n * flag to keep host session alive\n */\n #keepAlive = true;\n\n /**\n * interval to keep host session alive.\n */\n #keepAliveInterval = KEEP_ALIVE_INTERVAL;\n\n /**\n * options for the logger\n */\n #loggerOptions: GuestOption['logger'];\n\n /**\n * throttled keep alive function\n */\n #throttledKeepAlive: ReturnType<typeof throttle> | null = null;\n\n /**\n * Create new guest\n * @param {GuestOption} options - options for the guest\n */\n // eslint-disable-next-line complexity\n constructor(options?: GuestOption) {\n const {\n console: logToConsole = false,\n // eslint-disable-next-line no-underscore-dangle\n url = window.__ICE__?.diagnosticsUrl || getDiagnosticsAPIUrl(),\n index = 'ssf-guest-v2',\n team = 'ICE',\n appName = 'SSF Guest V2 Application',\n } = options?.logger ?? {};\n this.#loggerOptions = options?.logger;\n this.#usesDevConnectAPI = options?.usesDevConnectAPI ?? false;\n this.#keepAlive = options?.keepAlive ?? true;\n this.#keepAliveInterval = options?.keepAliveInterval ?? KEEP_ALIVE_INTERVAL;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const transport = logToConsole ? Console() : http(url as string);\n this.#logger =\n options?.appLogger ??\n puiLogger({\n transport,\n index,\n team,\n appName,\n });\n webvitals(this.#logger);\n logUnhandledErrors(this.#logger);\n this.#correlationId = uuidv4();\n this.#remoting = new Remoting(this.#logger, this.#correlationId);\n setupV1Adapter(this as unknown as ISSFGuest<ScriptingObjectTypes, Events>);\n this.#logger.audit({\n message: 'Guest created',\n guestUrl: window.location.href,\n correlationId: this.#correlationId,\n });\n }\n\n #getGuestInfo = () => ({\n guestId: this.#id,\n guestTitle: this.#title,\n guestUrl: this.#url,\n });\n\n /**\n * Marshals scripting object JSON into a proxy object\n * @param {RemotingScriptingObject} soJSON scripting object JSON\n * @returns {IScriptingObjectProxy} marshaled proxy object\n */\n #fromJSON = (soJSON: RemotingScriptingObject): IScriptingObjectProxy => {\n // Ensure we have JSON\n if (!soJSON || !soJSON.objectId) {\n this.#logger.error(\n 'Deserialization of scripting object failed. Object does not have an Object ID.',\n );\n throw new Error('Cannot deserialize object JSON into proxy.');\n }\n\n // Create a new object\n const ctrl = new ScriptingObjectProxy(soJSON.objectId, soJSON.objectType);\n\n // Dynamically build the function set on the control\n if (soJSON.functions) {\n soJSON.functions.forEach((functionName) => {\n Object.defineProperty(ctrl, functionName, {\n value: async <T>(...args: any[]) =>\n this.#invoke<T>({\n objectId: ctrl.id,\n functionName,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n functionParams: [...args],\n }),\n enumerable: true,\n });\n });\n }\n\n // Dynamically create the event proxies\n if (soJSON.events) {\n soJSON.events.forEach((eventName) => {\n Object.defineProperty(ctrl, eventName, {\n value: new ProxyEvent<AppEvents>({\n objectId: ctrl.id,\n name: eventName,\n eventSrc: this,\n }),\n enumerable: true,\n });\n });\n }\n\n this.#logger.debug(\n `Created guest proxy for scripting object (id = \"${ctrl.id}\")`,\n );\n return ctrl;\n };\n\n /**\n * call scripting object api exposed by host\n * @param {object} param0 - The parameters object\n * @param {string} param0.objectId - The object ID to invoke\n * @param {string} param0.functionName - The function name to call\n * @param {Array<any>} param0.functionParams - The parameters for the function\n * @returns {Promise<any>} The result of the function call\n */\n #invoke = async <T>({\n objectId,\n functionName,\n functionParams,\n }: {\n objectId: string;\n functionName: string;\n functionParams: Array<any>;\n }) => {\n this.#logger.debug(\n `Invoking scripting object method ${objectId}.${functionName}()...`,\n );\n\n // Find any function params that are promises\n const promises = [];\n if (functionParams) {\n for (let i = 0; i < functionParams.length; i += 1) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const p = functionParams[i];\n if (p instanceof Promise) {\n promises.push(\n p.then((val) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n functionParams[i] = val;\n }),\n );\n }\n }\n }\n\n // Now wait to resolve all of the promises and then call our invoke\n await Promise.all(promises);\n const { hostWindow, hostOrigin } = this.#requireHost();\n const response = await this.#remoting.invoke<Response>({\n targetWin: hostWindow,\n targetOrigin: hostOrigin,\n messageType: MessageType.ObjectInvoke,\n messageBody: {\n objectId,\n functionName,\n functionParams,\n },\n });\n const retVal = this.#handleResponse<T>(response);\n this.#logger.audit({\n message: 'Guest proxy invoked Scripting Object method',\n scriptingObject: objectId,\n scriptingMethod: functionName,\n ...this.#getGuestInfo(),\n });\n return retVal;\n };\n\n /**\n * Checks if a given payload matches all specified filter criteria.\n *\n * Iterates over each entry in the criteria object and evaluates the corresponding condition\n * against the payload's value for that key. Supported condition types include:\n * - `eq`: Checks for strict equality.\n * - `in`: Checks if the value is included in a provided array.\n * - `includes`: Checks if the payload's value (an array) includes a specified element.\n * - `gt`: Checks if the value is greater than a specified number.\n * - `lt`: Checks if the value is less than a specified number.\n * - `regex`: Checks if the value (a string) matches a provided regular expression.\n * @param {Record<string, any>} payload - The object containing values to be checked against the criteria.\n * @param {FilterCriteria} criteria - An object specifying filter conditions for each key.\n * @returns {boolean} `true` if all criteria are satisfied by the payload, otherwise `false`.\n */\n #matchesCriteria(\n payload: Record<string, any>,\n criteria: FilterCriteria,\n ): boolean {\n // eslint-disable-next-line complexity\n return Object.entries(criteria).every(([key, condition]) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const value = payload[key];\n if ('eq' in condition) return value === condition.eq;\n if ('in' in condition)\n return Array.isArray(condition.in) && condition.in.includes(value);\n if ('includes' in condition)\n return Array.isArray(value) && value.includes(condition.includes);\n if ('gt' in condition) {\n const numValue = typeof value === 'number' ? value : Number(value);\n return !Number.isNaN(numValue) && numValue > condition.gt;\n }\n if ('lt' in condition) {\n const numValue = typeof value === 'number' ? value : Number(value);\n return !Number.isNaN(numValue) && numValue < condition.lt;\n }\n if ('regex' in condition) {\n try {\n let regex = this.#regexCache.get(condition.regex);\n if (!regex) {\n regex = new RegExp(condition.regex);\n this.#regexCache.set(condition.regex, regex);\n }\n return typeof value === 'string' && regex.test(value);\n } catch {\n return false;\n }\n }\n\n return false;\n });\n }\n\n /**\n * handle response from host\n * @param {ObjectResponse | ValueResponse} response - The response to handle\n * @returns {any} The handled response value or proxy object\n */\n #handleResponse = <T>(response: ObjectResponse | ValueResponse) => {\n if (response?.type === ResponseType.OBJECT && 'object' in response) {\n return this.#fromJSON(response.object);\n }\n if (response?.type === ResponseType.VALUE) {\n return response.value as T;\n }\n return response;\n };\n\n /**\n * handle config change event\n * @param {object} root0 - The event parameters\n * @param {Config} root0.body - The configuration body\n */\n #handleConfigChangeEvent = ({ body }: ListenerCallbackParams<Config>) => {\n // Handle log level changes\n if (body?.logLevel) {\n this.#logger.setLogLevel(body.logLevel);\n this.#logger.debug(`Log level changed by host to ${body.logLevel}`);\n }\n this.#id = body?.guestId ?? null;\n this.#title = body?.guestTitle ?? null;\n this.#url = body?.guestUrl ?? null;\n this.#logger.audit({\n message: 'Received configuration from Host',\n ...this.#getGuestInfo(),\n });\n };\n\n /**\n * Focus the guest window\n */\n #handleFocusEvent = () => {\n window.focus();\n };\n\n /**\n * Focus the guest window\n */\n #handleHostClose = async () => {\n await this.close();\n window.close();\n };\n\n /**\n * Check if the parent window is closed and close this popup window\n */\n #handleParentClose = () => {\n if (!isEmbedded()) {\n this.#parentCloseMonitor = setInterval(() => {\n if (this.#hostWindow?.closed) {\n this.close()\n .then(() => {\n window.close();\n })\n .catch(() => {});\n }\n }, 1000);\n }\n };\n\n /**\n * Handles an incoming object event from a remote source, deserializes the object,\n * determines the appropriate event listeners, and invokes them with the event data.\n * Collects responses from listeners (including promises) and sends them back to the source window if a requestId is provided.\n * Audits the event processing for debugging and tracking purposes.\n * @param {object} params - The parameters for the event listener callback, including source window, origin, request ID, and event body.\n * @param {Window} params.sourceWin - The window from which the event originated.\n * @param {string} params.sourceOrigin - The origin of the source window.\n * @param {string} params.requestId - The unique identifier for the request, if a response is expected.\n * @param {any} params.body - The event message body containing the object, event name, handler, parameters, and options.\n * @description\n * - If an event handler is specified in the body, only that handler is invoked.\n * - If criteria are specified for a listener, the event is only delivered if the criteria match.\n * - All listener responses are collected and returned as an array if a requestId is present.\n * - Audit logs are generated for both handled and responded events.\n */\n #handleObjectEvent = async ({\n sourceWin,\n sourceOrigin,\n requestId,\n body,\n }: ListenerCallbackParams<RemotingEventMessage>) => {\n // Deserialize the object\n const object = this.#fromJSON(body.object);\n if (object) {\n // Get the listeners for the event\n const eventId = getEventId(object.id, body.eventName);\n this.#logger.debug(`Received event \"${eventId}\" from host`);\n\n // If an event handler is specified in the request body, then we will target\n // the event to that function only.\n let listeners: Array<ListenerInfo>;\n if (body.eventHandler) {\n listeners = [\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n callback: (window as { [key: string]: any })[body.eventHandler],\n token: uuidv4(),\n },\n ];\n } else {\n listeners = this.#eventListeners.get(eventId) || [];\n }\n\n // Notify each listener, recording a promise for each response\n const promises: Array<Promise<any>> = [];\n\n listeners.forEach((callbackInfo) => {\n if (callbackInfo?.callback) {\n // If criteria is specified, ensure event matches criteria\n if (callbackInfo.criteria) {\n const criteriaMatched = body.eventParams\n ? this.#matchesCriteria(body.eventParams, callbackInfo.criteria)\n : false;\n if (!criteriaMatched) {\n this.#logger.debug(\n `Event ${eventId} did not match criteria for subscriber ${callbackInfo.callback.name}`,\n );\n return;\n }\n }\n this.#logger.debug(\n `Invoking event subscriber ${callbackInfo.callback.name} for event ${eventId}`,\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const retVal = callbackInfo.callback({\n obj: object,\n eventName: body.eventName,\n eventParams: body.eventParams,\n eventOptions: body.eventOptions,\n });\n\n if (retVal instanceof Promise) {\n promises.push(retVal);\n } else if (typeof retVal !== 'undefined') {\n promises.push(Promise.resolve(retVal));\n }\n }\n });\n\n // Resolve all promises and return a response to the calling window\n if (requestId) {\n const values = await Promise.all(promises);\n this.#remoting.respond({\n targetWin: sourceWin,\n targetOrigin: sourceOrigin,\n requestId,\n response: values,\n });\n this.#logger.audit({\n message: 'Guest proxy processed event from host and responded',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n } else {\n this.#logger.audit({\n message: 'Guest proxy processed event from host',\n scriptingEventId: eventId,\n scriptingObject: object.id,\n ...this.#getGuestInfo(),\n });\n }\n }\n };\n\n /**\n * Extend token lifetime\n */\n #extendTokenLifetime = async () => {\n if (!this.#authToken || !this.#authClientId || !this.#hostDomain) return;\n try {\n await fetch(\n `${\n this.#hostDomain\n }/oauth2/v1/token/introspection?${new URLSearchParams({\n token: this.#authToken,\n client_id: this.#authClientId,\n }).toString()}`,\n {\n headers: {\n 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8',\n },\n method: 'POST',\n },\n );\n } catch (e) {\n this.#logger.warn(\n `Failed to extend token lifetime: ${(e as Error).message}`,\n );\n }\n };\n\n /**\n * revoke token\n */\n #revokeToken = async () => {\n if (this.#authToken && this.#authClientId && this.#hostDomain) {\n try {\n await fetch(\n `${this.#hostDomain}/oauth2/v1/token/revocation?${new URLSearchParams(\n {\n token: this.#authToken,\n client_id: this.#authClientId,\n },\n ).toString()}`,\n {\n method: 'POST',\n },\n );\n } catch (e) {\n this.#logger.error(`Error revoking token. ${(e as Error).message}`);\n } finally {\n this.#authToken = null;\n this.#authClientId = null;\n }\n }\n };\n\n /**\n * Start session keep alive\n */\n #startKeepSessionAlive = async () => {\n if (this.#keepAlive) {\n try {\n const appObj = await (\n this as unknown as SSFGuest<ScriptingObjectTypes, Events>\n ).getObject('application');\n if (appObj) {\n this.#throttledKeepAlive = throttle(\n async () => {\n try {\n await appObj.keepSessionAlive();\n await this.#extendTokenLifetime();\n } catch (e) {\n this.#logger.error(\n `Error keeping session alive. ${(e as Error).message}`,\n );\n }\n },\n this.#keepAliveInterval, // throttle time\n { leading: false },\n );\n userInteractionEvents.forEach((eventType) => {\n document.addEventListener(eventType, this.#throttledKeepAlive!);\n });\n } else {\n this.#logger.warn(\n 'Application object not available to send keep alive',\n );\n }\n } catch (e) {\n this.#logger.error(\n `Error getting application object. ${(e as Error).message}`,\n );\n }\n }\n };\n\n /**\n * Initialize guest using script\n * @param {string} scriptUri uri of the script\n * @param {HTMLElement} containerElement dom element to inject the script at\n */\n addScript = async (scriptUri: string, containerElement: HTMLElement) => {\n if (!this.#created && scriptUri) {\n await this.connect();\n // Load the script and await its load event before signaling that the window is\n // ready to receive events\n const scriptEle = document.createElement('script');\n scriptEle.setAttribute('src', scriptUri);\n scriptEle.setAttribute('type', 'module');\n await new Promise<void>((resolve, reject) => {\n let onScriptLoad: () => void;\n let onScriptError: (err: Event) => void;\n const cleanup = () => {\n scriptEle.removeEventListener('load', onScriptLoad);\n scriptEle.removeEventListener('error', onScriptError);\n };\n onScriptLoad = () => {\n cleanup();\n this.#created = true;\n setScriptOnlyGuest(true);\n resolve();\n };\n onScriptError = () => {\n cleanup();\n reject(new Error(`Failed to load script: ${scriptUri}`));\n };\n scriptEle.addEventListener('load', onScriptLoad);\n scriptEle.addEventListener('error', onScriptError);\n this.#scriptElement = containerElement.appendChild(scriptEle);\n });\n }\n };\n\n /**\n * Close the connection to the host\n */\n close = async () => {\n if (!this.#isConnected) return;\n // Notify host (best-effort — don't let failure skip local cleanup)\n if (this.#hostWindow && this.#hostOrigin) {\n this.#remoting.send({\n targetWin: this.#hostWindow,\n targetOrigin: this.#hostOrigin,\n messageType: MessageType.GuestClose,\n messageBody: {},\n });\n this.#remoting.removeSender({\n origin: this.#hostOrigin,\n window: this.#hostWindow,\n });\n }\n this.#remoting.close();\n if (this.#parentCloseMonitor) {\n clearInterval(this.#parentCloseMonitor);\n this.#parentCloseMonitor = null;\n }\n if (this.#throttledKeepAlive) {\n userInteractionEvents.forEach((eventType) => {\n document.removeEventListener(eventType, this.#throttledKeepAlive!);\n });\n }\n await this.#revokeToken();\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n window.removeEventListener('beforeunload', this.close);\n this.#isConnected = false;\n this.#logger.audit({\n message: 'Guest disconnected from host',\n ...this.#getGuestInfo(),\n });\n this.#id = null;\n this.#url = null;\n this.#title = null;\n };\n\n /**\n * Connect to the host\n * @param {ConnectParam} param - reference to the guest window or options\n */\n // eslint-disable-next-line max-statements\n connect = async (param?: ConnectParam) => {\n if (!this.#isConnected) {\n let guestWindow: Window = window;\n let guestOptions = { ...capabilities };\n\n if (param) {\n const { window: paramWindow, ...restOptions } = param;\n if (paramWindow) guestWindow = paramWindow;\n guestOptions = { ...guestOptions, ...restOptions };\n }\n\n const hostDetails = await getHostDetails();\n this.#hostOrigin = hostDetails.origin;\n this.#hostWindow = hostDetails.window;\n // Initialize messenger\n this.#remoting.initialize(guestWindow);\n this.#remoting.addSender({\n origin: this.#hostOrigin,\n window: this.#hostWindow,\n });\n // Listen for the events the guest knows how to process\n this.#remoting.listen<RemotingEventMessage>({\n messageType: MessageType.ObjectEvent,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n callback: this.#handleObjectEvent.bind(this),\n });\n this.#remoting.listen<Config>({\n messageType: MessageType.HostConfig,\n callback: this.#handleConfigChangeEvent.bind(this),\n });\n this.#remoting.listen<void>({\n messageType: MessageType.GuestFocus,\n callback: this.#handleFocusEvent.bind(this),\n });\n this.#remoting.listen<void>({\n messageType: MessageType.HostClose,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n callback: this.#handleHostClose.bind(this),\n });\n // Let the host know the guest is ready for events, and send along\n // the guests's capabilities to allow for compatibility with future\n // host versions\n this.#remoting.send({\n targetWin: this.#hostWindow,\n targetOrigin: this.#hostOrigin,\n messageType: MessageType.GuestReady,\n messageBody: guestOptions,\n });\n this.#isConnected = true;\n this.#handleParentClose();\n if (this.#usesDevConnectAPI) await this.getAuthToken();\n await this.#startKeepSessionAlive();\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n window.addEventListener('beforeunload', this.close);\n this.#logger.audit({\n message: 'Guest connected to host',\n guestUrl: window.location.href,\n });\n }\n };\n\n /**\n * Get bearer token to access dev connect api\n * @returns {Promise<string>} auth token\n */\n getAuthToken = async () => {\n if (!this.#authToken && this.#isConnected) {\n try {\n const authObj = await (\n this as unknown as SSFGuest<ScriptingObjectTypes, Events>\n ).getObject('auth');\n if (authObj) {\n const tokenInfo = await authObj.getAccessToken();\n this.#authToken = tokenInfo?.access_token;\n this.#hostDomain = tokenInfo?.host_name;\n this.#authClientId = tokenInfo?.client_id;\n } else\n this.#logger.warn(\n 'Auth object not available to get access token from host',\n );\n } catch (e) {\n this.#logger.error(\n `Error getting access token from auth object. ${\n (e as Error).message\n }`,\n );\n }\n }\n return this.#authToken;\n };\n\n /**\n * Get scripting object proxy by id\n * @param {string} objectId unique id of the scripting object\n * @returns {Promise<any>} scripting object proxy\n */\n getObject = async <Id extends Extract<keyof AppObjects, string>>(\n objectId: Id,\n ): Promise<AppObjects[Id]> => {\n this.#logger.debug(\n `Retrieving scripting object \"${objectId}\" from host...`,\n );\n if (!this.#isConnected) throw new Error('Not connected to host');\n const { hostWindow, hostOrigin } = this.#requireHost();\n const response = await this.#remoting.invoke<ObjectResponse>({\n targetWin: hostWindow,\n targetOrigin: hostOrigin,\n messageType: MessageType.ObjectGet,\n messageBody: {\n objectId,\n },\n });\n const obj = this.#fromJSON(response.object);\n this.#logger.audit({\n message: 'Received scripting object from host',\n scriptingObject: objectId,\n ...this.#getGuestInfo(),\n });\n return obj as AppObjects[Id];\n };\n\n /**\n * Get names of scripting objects exposed by the host\n * @returns {Promise<any>} scripting objects exposed by the host\n */\n listObjects = async () => {\n this.#logger.debug(\n `Retrieving names of scripting objects exposed by host...`,\n );\n if (!this.#isConnected) throw new Error('Not connected to host');\n const { hostWindow, hostOrigin } = this.#requireHost();\n const objects = await this.#remoting.invoke<\n Array<Extract<keyof AppObjects, string>>\n >({\n targetWin: hostWindow,\n targetOrigin: hostOrigin,\n messageType: MessageType.ListObjects,\n messageBody: {},\n });\n this.#logger.audit({\n message: 'Received names of all scripting objects exposed by host',\n objects,\n ...this.#getGuestInfo(),\n });\n return objects;\n };\n\n /**\n * remove the guest from the host\n */\n removeScript = () => {\n if (!this.#created) return;\n if (this.#scriptElement) {\n const { parentNode } = this.#scriptElement;\n parentNode?.removeChild?.(this.#scriptElement);\n }\n };\n\n /**\n * Set the log level\n * @param {LogLevels} level - log level\n */\n setLogLevel = (level: LogLevels) => {\n this.#logger.setLogLevel(level);\n this.#logger.debug(`Log level changed by guest to ${level}`);\n };\n\n /**\n * subscribe to an scripting object event\n * @param {any} param - parameters for subscribing to an event\n * @returns {string} subscription token\n */\n subscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: SubscribeParam<EventId, AppEvents[EventId]>,\n ) => {\n const { eventId, criteria, callback } = param;\n this.#logger.debug(`Registering subscription for event ${eventId}`);\n const listeners = this.#eventListeners.get(eventId.toLowerCase()) || [];\n const token = uuidv4();\n listeners.push({ callback, token, criteria });\n this.#eventListeners.set(eventId.toLowerCase(), listeners);\n // send message to host about the new subscription\n const { hostWindow, hostOrigin } = this.#requireHost();\n this.#remoting.send({\n targetWin: hostWindow,\n targetOrigin: hostOrigin,\n messageType: MessageType.GuestEventSubscribe,\n messageBody: {\n eventId,\n criteria,\n token,\n },\n });\n this.#logger.debug(`Subscribed to event ${eventId} with token ${token}`);\n return token;\n };\n\n /**\n * unsubscribe from an scripting object event\n * @param {any} param - parameters for unsubscribing from an event\n */\n unsubscribe = <EventId extends Extract<keyof AppEvents, string>>(\n param: UnsubscribeParam<EventId>,\n ) => {\n const { eventId, token } = param;\n const listeners = this.#eventListeners.get(eventId.toLowerCase());\n if (listeners) {\n const originalLength = listeners.length;\n const filteredListeners = listeners.filter(\n (callbackInfo) => callbackInfo.token !== token,\n );\n\n // Only send unsubscribe message if a listener was actually removed\n if (filteredListeners.length < originalLength) {\n this.#eventListeners.set(eventId.toLowerCase(), filteredListeners);\n const { hostWindow, hostOrigin } = this.#requireHost();\n this.#remoting.send({\n targetWin: hostWindow,\n targetOrigin: hostOrigin,\n messageType: MessageType.GuestEventUnsubscribe,\n messageBody: {\n eventId,\n token,\n },\n });\n this.#logger.debug(`Unsubscribed from event ${eventId}`);\n }\n }\n };\n}\n"],"names":["root","factory","__WEBPACK_EXTERNAL_MODULE__388__","Symbol","module","getRawTag","objectToString","nullTag","undefinedTag","symToStringTag","baseGetTag","value","trimmedEndIndex","reTrimStart","baseTrim","string","freeGlobal","objectProto","hasOwnProperty","nativeObjectToString","isOwn","tag","unmasked","result","freeSelf","reWhitespace","index","isObject","now","toNumber","FUNC_ERROR_TEXT","nativeMax","nativeMin","debounce","func","wait","options","lastArgs","lastThis","maxWait","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","invokeFunc","time","args","thisArg","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","type","isObjectLike","symbolTag","isSymbol","throttle","NAN","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","other","isBinary","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","exports","definition","key","obj","prop","getRandomValues","rnds8","rng","byteToHex","i","unsafeStringify","arr","offset","stringify","uuid","validate","v4","buf","rnds","MESSAGE_SOURCE","RESPONSE_MESSAGE_TYPE","EXCEPTION_MESSAGE_TYPE","createMessage","messageType","messageBody","requestId","onewayMsg","sendMessage","param","targetWin","targetOrigin","msg","Remoting","#correlationId","#logger","#listeners","#invocations","#timeoutMonitorHandle","#initializedWindow","#allowedSenders","logger","correlationId","#evaluateTimeouts","ts","canceledItems","nextCancelTime","eventData","cancelTime","delay","#scheduleTimeoutCheck","delayMs","#stopResponseMonitor","#popInvocation","e","#processResponse","message","#processException","#receive","sourceWin","sourceOrigin","callbacks","callback","#processMessage","senderOrigin","origin","window2","win","responseTimeoutMs","resolve","reject","items","response","ex","MessageType","MessageType2","ScriptingObjectProxy","objectId","objectType","isScriptingObjectProxy","Event","name","ProxyEvent","#eventSrc","eventSrc","token","isEvent","getEventId","eventName","getParentWindowLocation","parent","getOrigin","url","isEmbedded","getComputedStyle","el","element","retVal","propValue","originsRegex","HANDSHAKE_TIMEOUT_MS","getHostDetails","currentWindow","timer","onMessage","event","source","hostWindow","scriptOnlyGuest","setScriptOnlyGuest","setupV1Adapter","guestV2","guest","getGuest","scriptUri","params","objectName","level","ResponseType","KEEP_ALIVE_INTERVAL","capabilities","onLoad","document","iframeBody","iframeHTML","size","diagnosticsEndpoint","userInteractionEvents","getDiagnosticsAPIUrl","scriptUrl","hostName","SSFGuest","#remoting","#created","#scriptElement","#isConnected","#eventListeners","#id","#title","#url","#hostOrigin","#hostWindow","#parentCloseMonitor","#regexCache","#requireHost","#usesDevConnectAPI","#authToken","#authClientId","#hostDomain","#keepAlive","#keepAliveInterval","#loggerOptions","#throttledKeepAlive","logToConsole","team","appName","transport","#getGuestInfo","#fromJSON","soJSON","ctrl","functionName","#invoke","functionParams","promises","p","val","hostOrigin","#handleResponse","#matchesCriteria","payload","criteria","condition","numValue","regex","#handleConfigChangeEvent","body","#handleFocusEvent","#handleHostClose","#handleParentClose","#handleObjectEvent","object","eventId","listeners","callbackInfo","values","#extendTokenLifetime","#revokeToken","#startKeepSessionAlive","appObj","eventType","containerElement","scriptEle","onScriptLoad","onScriptError","cleanup","guestWindow","guestOptions","paramWindow","restOptions","hostDetails","authObj","tokenInfo","objects","parentNode","originalLength","filteredListeners"],"sourceRoot":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Loan Validation</title><style>body{margin:0}</style><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Loan Validation</title><style>body{margin:0}</style><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.dc017a38b78ac30a1aa3.js"></script></head><body class="px-2"><script src="./loanValidation.js" type="module"></script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Pricing Service</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Pricing Service</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.dc017a38b78ac30a1aa3.js"></script></head><body class="px-2"><main><h3 class="text-lg font-medium leading-6 text-gray-900">Mortgage Pricing</h3><div class="mt-5 bg-orange-100 shadow sm:rounded-lg"><div class="px-4 py-5 sm:px-6"><h3 class="text-lg font-medium leading-6 text-gray-900">Average Rates</h3><p class="mt-1 max-w-2xl text-sm text-gray-500">for $<span id="loanAmount"></span>; Term: <span id="term"></span> years; Down Payment: $<span id="downPayment"></span></p></div><div class="border-t border-gray-200"><dl><div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"><dt class="text-sm font-medium text-gray-500">30-yr fixed</dt><dd id="30yearRate" class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">7.01%</dd></div><div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"><dt class="text-sm font-medium text-gray-500">15-yr fixed</dt><dd id="15yearRate" class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">5.61%</dd></div><div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"><dt class="text-sm font-medium text-gray-500">10/6 ARM</dt><dd id="106ARMRate" class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">6.42%</dd></div></dl></div></div></main><script src="./pricingService.js" type="module"></script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Title Service</title><style>body{margin:0}</style><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Title Service</title><style>body{margin:0}</style><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.dc017a38b78ac30a1aa3.js"></script></head><body class="px-2"><h3 class="text-lg font-medium leading-6 text-gray-900">Title</h3><div class="mt-5 flex flex-col"><button id="order" type="button" class="rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Order</button></div><script src="./titleService.js" type="module"></script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Guest V2</title><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Guest V2</title><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfGuest.dc017a38b78ac30a1aa3.js"></script></head><body><h2>Guest V2</h2><div id="result"><p id="loan-details"></p><p id="loan-pre-save-event-details"></p></div><script type="module">window.addEventListener("load",async()=>{const e=new ice.guest.SSFGuest({logger:{index:"v2-guest",team:"ui platform",appName:"v2 guest app"}});await e.connect();const t=await e.getObject("Loan"),a=await t.getLoanDetails();document.getElementById("loan-details").innerText=`Loan Data: ${JSON.stringify(a)}`,e.subscribe({eventId:t.onPreSave.id,callback:({eventParams:e})=>(document.getElementById("loan-pre-save-event-details").innerText=`Presave event data: ${JSON.stringify(e)}`,!1)})})</script></body></html>
|
package/dist/umd/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(q,R){typeof exports=="object"&&typeof module=="object"?module.exports=R(require("emuiDiagnostics")):typeof define=="function"&&define.amd?define(["emuiDiagnostics"],R):typeof exports=="object"?exports.ice=R(require("emuiDiagnostics")):(q.ice=q.ice||{},q.ice.guest=R(q.emuiDiagnostics))})(globalThis,Q=>(()=>{var q={572(a,l,c){var g=c(736),h=g.Symbol;a.exports=h},561(a,l,c){var g=c(572),h=c(504),y=c(567),u="[object Null]",p="[object Undefined]",T=g?g.toStringTag:void 0;function w(E){return E==null?E===void 0?p:u:T&&T in Object(E)?h(E):y(E)}a.exports=w},605(a,l,c){var g=c(327),h=/^\s+/;function y(u){return u&&u.slice(0,g(u)+1).replace(h,"")}a.exports=y},433(a){var l=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;a.exports=l},504(a,l,c){var g=c(572),h=Object.prototype,y=h.hasOwnProperty,u=h.toString,p=g?g.toStringTag:void 0;function T(w){var E=y.call(w,p),f=w[p];try{w[p]=void 0;var m=!0}catch{}var x=u.call(w);return m&&(E?w[p]=f:delete w[p]),x}a.exports=T},567(a){var l=Object.prototype,c=l.toString;function g(h){return c.call(h)}a.exports=g},736(a,l,c){var g=c(433),h=typeof self=="object"&&self&&self.Object===Object&&self,y=g||h||Function("return this")();a.exports=y},327(a){var l=/\s/;function c(g){for(var h=g.length;h--&&l.test(g.charAt(h)););return h}a.exports=c},702(a,l,c){var g=c(230),h=c(381),y=c(569),u="Expected a function",p=Math.max,T=Math.min;function w(E,f,m){var x,k,U,G,S,L,A=0,j=!1,W=!1,B=!0;if(typeof E!="function")throw new TypeError(u);f=y(f)||0,g(m)&&(j=!!m.leading,W="maxWait"in m,U=W?p(y(m.maxWait)||0,f):U,B="trailing"in m?!!m.trailing:B);function F(b){var $=x,C=k;return x=k=void 0,A=b,G=E.apply(C,$),G}function X(b){return A=b,S=setTimeout(_,f),j?F(b):G}function Z(b){var $=b-L,C=b-A,K=f-$;return W?T(K,U-C):K}function V(b){var $=b-L,C=b-A;return L===void 0||$>=f||$<0||W&&C>=U}function _(){var b=h();if(V(b))return H(b);S=setTimeout(_,Z(b))}function H(b){return S=void 0,B&&x?F(b):(x=k=void 0,G)}function z(){S!==void 0&&clearTimeout(S),A=0,x=L=k=S=void 0}function N(){return S===void 0?G:H(h())}function D(){var b=h(),$=V(b);if(x=arguments,k=this,L=b,$){if(S===void 0)return X(L);if(W)return clearTimeout(S),S=setTimeout(_,f),F(L)}return S===void 0&&(S=setTimeout(_,f)),G}return D.cancel=z,D.flush=N,D}a.exports=w},230(a){function l(c){var g=typeof c;return c!=null&&(g=="object"||g=="function")}a.exports=l},470(a){function l(c){return c!=null&&typeof c=="object"}a.exports=l},89(a,l,c){var g=c(561),h=c(470),y="[object Symbol]";function u(p){return typeof p=="symbol"||h(p)&&g(p)==y}a.exports=u},381(a,l,c){var g=c(736),h=function(){return g.Date.now()};a.exports=h},345(a,l,c){var g=c(702),h=c(230),y="Expected a function";function u(p,T,w){var E=!0,f=!0;if(typeof p!="function")throw new TypeError(y);return h(w)&&(E="leading"in w?!!w.leading:E,f="trailing"in w?!!w.trailing:f),g(p,T,{leading:E,maxWait:T,trailing:f})}a.exports=u},569(a,l,c){var g=c(605),h=c(230),y=c(89),u=NaN,p=/^[-+]0x[0-9a-f]+$/i,T=/^0b[01]+$/i,w=/^0o[0-7]+$/i,E=parseInt;function f(m){if(typeof m=="number")return m;if(y(m))return u;if(h(m)){var x=typeof m.valueOf=="function"?m.valueOf():m;m=h(x)?x+"":x}if(typeof m!="string")return m===0?m:+m;m=g(m);var k=T.test(m);return k||w.test(m)?E(m.slice(2),k?2:8):p.test(m)?u:+m}a.exports=f},388(a){"use strict";a.exports=Q}},R={};function I(a){var l=R[a];if(l!==void 0)return l.exports;var c=R[a]={exports:{}};return q[a](c,c.exports,I),c.exports}I.n=a=>{var l=a&&a.__esModule?()=>a.default:()=>a;return I.d(l,{a:l}),l},I.d=(a,l)=>{for(var c in l)I.o(l,c)&&!I.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:l[c]})},I.o=(a,l)=>Object.prototype.hasOwnProperty.call(a,l),I.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var Y={};return(()=>{"use strict";I.r(Y),I.d(Y,{SSFGuest:()=>le});const l={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let c;const g=new Uint8Array(16);function h(){if(!c&&(c=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!c))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return c(g)}var y;const u=[];for(let n=0;n<256;++n)u.push((n+256).toString(16).slice(1));function p(n,e=0){return u[n[e+0]]+u[n[e+1]]+u[n[e+2]]+u[n[e+3]]+"-"+u[n[e+4]]+u[n[e+5]]+"-"+u[n[e+6]]+u[n[e+7]]+"-"+u[n[e+8]]+u[n[e+9]]+"-"+u[n[e+10]]+u[n[e+11]]+u[n[e+12]]+u[n[e+13]]+u[n[e+14]]+u[n[e+15]]}function T(n,e=0){const t=p(n,e);if(!y(t))throw TypeError("Stringified UUID is invalid");return t}const w=null;function E(n,e,t){if(l.randomUUID&&!e&&!n)return l.randomUUID();n=n||{};const s=n.random||(n.rng||h)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=s[i];return e}return p(s)}const f=E;var m=I(345),x=I.n(m);const k="elli:remoting",U="elli:remoting:response",G="elli:remoting:exception",S=({messageType:n,messageBody:e,requestId:t,onewayMsg:s=!1})=>({requestId:t??(s?null:f()),source:k,type:n,body:e}),L=n=>{const{targetWin:e,targetOrigin:t,messageType:s,messageBody:i}=n,r=S({messageType:s,messageBody:i});e.postMessage(r,t)};class A{#i;#e;#t=new Map;#a=new Map;#n=null;#s=null;#c=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#i=t,this.#e=e}#p=()=>{this.#n=null;const e=Date.now(),t=[];let s=null;if(this.#a.forEach((i,r)=>{const{requestId:o,cancelTime:d}=i;d&&d<=e?(this.#e.debug(`Detected response timeout for requestId: ${o}...`),t.push(r),i.resolve(void 0)):d&&(s=s===null?d:Math.min(s,d))}),t.forEach(i=>{this.#a.delete(i)}),s!==null){const i=Math.max(s-Date.now(),0);this.#g(i)}};#g=e=>{this.#n===null&&(this.#n=window.setTimeout(this.#p,e))};#f=()=>{this.#n!==null&&(window.clearTimeout(this.#n),this.#n=null)};#r=e=>{const t=this.#a.get(e);return this.#e.debug(`serving requestId: ${e}`),this.#a.delete(e),t};#o=e=>{const{requestId:t}=e;this.#e.debug(`Response received for invocation requestId: ${t}`);const s=this.#r(t);return s?(s.resolve(e.body),!0):(this.#e.debug(`Received response to stale/invalid request with requestId: ${t}`),!1)};#h=e=>{this.#e.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#r(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#e.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#v=({sourceWin:e,sourceOrigin:t,message:s})=>{this.#e.debug(`Received message of type "${s.type}"`);const i=this.#t.get(s.type);return i?(i.forEach(r=>{this.#e.debug(`Invoking message handler ${r.name}`),r({sourceWin:e,sourceOrigin:t,requestId:s.requestId,type:s.type,body:s.body})}),!0):!1};#l=e=>{if(this.#c.size===0||!e.source)return!1;const t=this.#c.get(e.source);return!t||e?.data?.source!==k?!1:(this.#e.debug(`Remoting: Received message of type "${e.data.type}"`),e.data.type===U?this.#o(e.data):e.data.type===G?this.#h(e.data):this.#v({sourceWin:e.source,sourceOrigin:t,message:e.data}),!0)};addSender=e=>{const{origin:t,window:s}=e;if(!t)throw new Error("origin is required");if(!s)throw new Error("window is required");this.#c.set(s,t)};initialize=e=>{this.#s&&this.#s.removeEventListener("message",this.#l),e.addEventListener("message",this.#l),this.#s=e,this.#e.debug(`initialized remoting id: ${this.#i}`)};close=()=>{this.#s&&(this.#s.removeEventListener("message",this.#l),this.#s=null),this.#f(),this.#e.debug(`closed remoting id: ${this.#i}`)};invoke=e=>{const{targetWin:t,targetOrigin:s,messageType:i,messageBody:r,responseTimeoutMs:o}=e;return new Promise((d,O)=>{const v=S({messageType:i,messageBody:r});this.#a.set(v.requestId,{requestId:v.requestId,resolve:d,reject:O,cancelTime:o?Date.now()+o:null}),t.postMessage(v,s);const{requestId:P}=v;this.#e.debug(`Posted invocation message of type ${i} requestId: ${P||""}`),o&&(this.#e.debug(`scheduling timeout check for requestId: ${P||""} in ${o} ms`),this.#g(o))})};listen=e=>{const{messageType:t,callback:s}=e,i=this.#t.get(t)||[];i.push(s),this.#t.set(t,i)};unlisten=e=>{const{messageType:t,callback:s}=e,i=this.#t.get(t);if(!i)return;const r=i.indexOf(s);r!==-1&&i.splice(r,1)};send=e=>{const{targetWin:t,targetOrigin:s,messageType:i,messageBody:r}=e,o=S({messageType:i,messageBody:r,onewayMsg:!0});t.postMessage(o,s),this.#e.debug(`Posted one-way message of type "${i}"`)};removeSender=e=>{const{window:t}=e;t&&this.#c.delete(t)};respond=e=>{const{targetWin:t,targetOrigin:s,requestId:i,response:r}=e,o=S({messageType:U,messageBody:r,requestId:i});t.postMessage(o,s),this.#e.debug(`Response sent to caller for invocation requestId: ${i}`)};raiseException=e=>{const{targetWin:t,targetOrigin:s,requestId:i,ex:r}=e,o=r instanceof Error?r.message:r,d=S({messageType:G,messageBody:o,requestId:i});t.postMessage(d,s),this.#e.debug(`Exception sent to caller for invocation. requestId: ${i}`)}}var j=(n=>(n.GuestClose="guest:close",n.GuestEventSubscribe="guest:eventSubscribe",n.GuestEventUnsubscribe="guest:eventUnsubscribe",n.GuestFocus="guest:focus",n.GuestReady="guest:ready",n.GuestReadyComplete="guest:readyComplete",n.GuestResize="guest:resize",n.HandShake="handshake",n.HandShakeAck="handshake:ack",n.HostClose="host:close",n.HostConfig="host:config",n.ListObjects="list:objects",n.ObjectEvent="object:event",n.ObjectGet="object:get",n.ObjectInvoke="object:invoke",n))(j||{});class W{__TYPE__="Proxy";id;objectType;constructor(e,t){this.id=e,this.objectType=t}}const B=n=>n?.constructor?.name==="Proxy"||n?.constructor?.name==="ScriptingObjectProxy"||n?.__TYPE__==="Proxy";class F{name;objectId;id;constructor(e){const{name:t,objectId:s}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object id is required");this.objectId=s,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase()}}class X{static[Symbol.hasInstance](e){return typeof e=="object"&&e!==null&&"getType"in e&&typeof e.getType=="function"&&e.getType()==="ProxyEvent"}#i;objectId;name;id;getType(){return"ProxyEvent"}constructor(e){const{name:t,objectId:s,eventSrc:i}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object id is required");if(!i)throw new Error("Event source is required");this.objectId=s,this.name=t,this.#i=i,this.id=`${this.objectId}.${this.name}`.toLowerCase()}subscribe=e=>this.#i.subscribe({eventId:this.id,callback:e});unsubscribe=e=>{this.#i.unsubscribe({eventId:this.id,token:e})}}const Z=n=>n instanceof F,V=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`;var _=I(388);const H=()=>{const{parent:n}=window;try{return n?.location?.href}catch{return null}},z=n=>{if(!n||n==="about:blank")return"*";try{const{origin:e}=new URL(n);return e==="null"||!e?"*":e}catch{try{const{origin:e}=new URL(n,document.baseURI);return e==="null"||!e?"*":e}catch{return"*"}}},N=()=>window.self!==window.parent,D=(n,e)=>{const t=e||document.body,s=document.defaultView?.getComputedStyle?.(t,null),i=s?s[n]:"0";return parseInt(i,10)},b=/^https?:\/\/([a-z0-9-]+\.)*(?:elliemae\.io|ellielabs\.com|ellieservices\.com|encompassloconnect\.com|ice\.com|localhost:[0-9]+)$/i,$="elli:remoting",C=3e4,K=()=>new Promise((n,e)=>{if(N())n({origin:z(document.referrer||H()),window:window.parent});else{const t=window;let s;const i=r=>{if(b.test(r.origin)){const{source:o,type:d}=r.data||{};if(o===$&&d===j.HandShake){const{origin:O}=r,v=r.source;clearTimeout(s),L({targetWin:v,targetOrigin:O,messageType:j.HandShakeAck,messageBody:{}}),t.removeEventListener("message",i),n({origin:O,window:v})}}};s=setTimeout(()=>{t.removeEventListener("message",i),e(new Error(`Host handshake timed out after ${C}ms`))},C),t.addEventListener("message",i)}});let M=!1;const re=n=>{M=n},J=(n=null)=>{let e=n;const t=()=>{if(!e&&(e=window.ice?.guest?.SSFGuest?new window.ice.guest.SSFGuest:null,!e))throw new Error("Guest definition not found");return e};window.elli=window.elli??{},window.elli.script={guest:{create:(s,i)=>t().addScript(s,i)},connect:s=>t().connect(s),getObject:s=>t().getObject(s),setLogLevel:s=>t().setLogLevel(s),subscribe:(s,i,r,o)=>t().subscribe({eventId:`${s}.${i}`,callback:d=>r(d?.obj,d?.eventParams,d?.eventOptions),criteria:o?.criteria}),unsubscribe:(s,i,r)=>t().unsubscribe({eventId:`${s}.${i}`,token:r})}};try{J()}catch{}var oe=(n=>(n.OBJECT="object",n.VALUE="value",n))(oe||{});const ee=12e4,ce={eventFeedback:!0},te=()=>{const{document:n}=window,e=n.body,t=n.documentElement,i={height:e.offsetHeight+D("marginTop")+D("marginBottom"),width:Math.max(e.scrollWidth,t.scrollWidth)};L({targetWin:window.parent,targetOrigin:z(n.referrer||H()),messageType:j.GuestResize,messageBody:i}),window.removeEventListener("load",te)};N()&&window.addEventListener("load",te);const se={"cdn.ice.com":"https://api.elliemae.com/diagnostics/v2/logging","cdn.np.ice.com":"https://stg.api.elliemae.com/diagnostics/v2/logging","cdn.uat.ice.com":"https://concept.api.elliemae.com/diagnostics/v2/logging","cdn.pt1.ice.com":"https://pel1.api.ellielabs.com/diagnostics/v2/logging","cdn.qa1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.dev1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.ice.com":"https://api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.s1.ice.com":"https://stg.api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.uat1.ice.com":"https://concept.api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.pl1.ice.com":"https://pel1.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.q1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.d1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging",localhost:"https://int.api.ellielabs.com/diagnostics/v2/logging"},ie=["click","scroll","keypress","touchstart"],ae=()=>{const n=document.currentScript?.src||"file:///opt/jenkins/workspace/UIPlatform_pui-microfe_master/241/libs/ssf-guest/lib/guest.ts",e=n?new URL(n).hostname:"localhost";return se[e]||se["cdn.mortgagetech.q1.ice.com"]};class le{#i;#e;#t;#a=!1;#n=null;#s=!1;#c=new Map;#p=null;#g=null;#f=null;#r=null;#o=null;#h=null;#v=new Map;#l(){if(!this.#o||!this.#r)throw new Error("Guest is not connected to a host. Call connect() first.");return{hostWindow:this.#o,hostOrigin:this.#r}}#E=!1;#u=null;#m=null;#b=null;#S=!0;#j=ee;#O;#w=null;constructor(e){const{console:t=!1,url:s=window.__ICE__?.diagnosticsUrl||ae(),index:i="ssf-guest-v2",team:r="ICE",appName:o="SSF Guest V2 Application"}=e?.logger??{};this.#O=e?.logger,this.#E=e?.usesDevConnectAPI??!1,this.#S=e?.keepAlive??!0,this.#j=e?.keepAliveInterval??ee;const d=t?(0,_.Console)():(0,_.http)(s);this.#e=e?.appLogger??(0,_.logger)({transport:d,index:i,team:r,appName:o}),(0,_.webvitals)(this.#e),(0,_.logUnhandledErrors)(this.#e),this.#i=f(),this.#t=new A(this.#e,this.#i),J(this),this.#e.audit({message:"Guest created",guestUrl:window.location.href,correlationId:this.#i})}#d=()=>({guestId:this.#p,guestTitle:this.#g,guestUrl:this.#f});#y=e=>{if(!e||!e.objectId)throw this.#e.error("Deserialization of scripting object failed. Object does not have an Object ID."),new Error("Cannot deserialize object JSON into proxy.");const t=new W(e.objectId,e.objectType);return e.functions&&e.functions.forEach(s=>{Object.defineProperty(t,s,{value:async(...i)=>this.#x({objectId:t.id,functionName:s,functionParams:[...i]}),enumerable:!0})}),e.events&&e.events.forEach(s=>{Object.defineProperty(t,s,{value:new X({objectId:t.id,name:s,eventSrc:this}),enumerable:!0})}),this.#e.debug(`Created guest proxy for scripting object (id = "${t.id}")`),t};#x=async({objectId:e,functionName:t,functionParams:s})=>{this.#e.debug(`Invoking scripting object method ${e}.${t}()...`);const i=[];if(s)for(let v=0;v<s.length;v+=1){const P=s[v];P instanceof Promise&&i.push(P.then(ne=>{s[v]=ne}))}await Promise.all(i);const{hostWindow:r,hostOrigin:o}=this.#l(),d=await this.#t.invoke({targetWin:r,targetOrigin:o,messageType:j.ObjectInvoke,messageBody:{objectId:e,functionName:t,functionParams:s}}),O=this.#T(d);return this.#e.audit({message:"Guest proxy invoked Scripting Object method",scriptingObject:e,scriptingMethod:t,...this.#d()}),O};#I(e,t){return Object.entries(t).every(([s,i])=>{const r=e[s];if("eq"in i)return r===i.eq;if("in"in i)return Array.isArray(i.in)&&i.in.includes(r);if("includes"in i)return Array.isArray(r)&&r.includes(i.includes);if("gt"in i){const o=typeof r=="number"?r:Number(r);return!Number.isNaN(o)&&o>i.gt}if("lt"in i){const o=typeof r=="number"?r:Number(r);return!Number.isNaN(o)&&o<i.lt}if("regex"in i)try{let o=this.#v.get(i.regex);return o||(o=new RegExp(i.regex),this.#v.set(i.regex,o)),typeof r=="string"&&o.test(r)}catch{return!1}return!1})}#T=e=>e?.type==="object"&&"object"in e?this.#y(e.object):e?.type==="value"?e.value:e;#k=({body:e})=>{e?.logLevel&&(this.#e.setLogLevel(e.logLevel),this.#e.debug(`Log level changed by host to ${e.logLevel}`)),this.#p=e?.guestId??null,this.#g=e?.guestTitle??null,this.#f=e?.guestUrl??null,this.#e.audit({message:"Received configuration from Host",...this.#d()})};#L=()=>{window.focus()};#_=async()=>{await this.close(),window.close()};#$=()=>{N()||(this.#h=setInterval(()=>{this.#o?.closed&&this.close().then(()=>{window.close()}).catch(()=>{})},1e3))};#P=async({sourceWin:e,sourceOrigin:t,requestId:s,body:i})=>{const r=this.#y(i.object);if(r){const o=V(r.id,i.eventName);this.#e.debug(`Received event "${o}" from host`);let d;i.eventHandler?d=[{callback:window[i.eventHandler],token:f()}]:d=this.#c.get(o)||[];const O=[];if(d.forEach(v=>{if(v?.callback){if(v.criteria&&!(i.eventParams?this.#I(i.eventParams,v.criteria):!1)){this.#e.debug(`Event ${o} did not match criteria for subscriber ${v.callback.name}`);return}this.#e.debug(`Invoking event subscriber ${v.callback.name} for event ${o}`);const P=v.callback({obj:r,eventName:i.eventName,eventParams:i.eventParams,eventOptions:i.eventOptions});P instanceof Promise?O.push(P):typeof P<"u"&&O.push(Promise.resolve(P))}}),s){const v=await Promise.all(O);this.#t.respond({targetWin:e,targetOrigin:t,requestId:s,response:v}),this.#e.audit({message:"Guest proxy processed event from host and responded",scriptingEventId:o,scriptingObject:r.id,...this.#d()})}else this.#e.audit({message:"Guest proxy processed event from host",scriptingEventId:o,scriptingObject:r.id,...this.#d()})}};#G=async()=>{if(!(!this.#u||!this.#m||!this.#b))try{await fetch(`${this.#b}/oauth2/v1/token/introspection?${new URLSearchParams({token:this.#u,client_id:this.#m}).toString()}`,{headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8"},method:"POST"})}catch(e){this.#e.warn(`Failed to extend token lifetime: ${e.message}`)}};#C=async()=>{if(this.#u&&this.#m&&this.#b)try{await fetch(`${this.#b}/oauth2/v1/token/revocation?${new URLSearchParams({token:this.#u,client_id:this.#m}).toString()}`,{method:"POST"})}catch(e){this.#e.error(`Error revoking token. ${e.message}`)}finally{this.#u=null,this.#m=null}};#R=async()=>{if(this.#S)try{const e=await this.getObject("application");e?(this.#w=x()(async()=>{try{await e.keepSessionAlive(),await this.#G()}catch(t){this.#e.error(`Error keeping session alive. ${t.message}`)}},this.#j,{leading:!1}),ie.forEach(t=>{document.addEventListener(t,this.#w)})):this.#e.warn("Application object not available to send keep alive")}catch(e){this.#e.error(`Error getting application object. ${e.message}`)}};addScript=async(e,t)=>{if(!this.#a&&e){await this.connect();const s=document.createElement("script");s.setAttribute("src",e),s.setAttribute("type","module"),await new Promise((i,r)=>{let o,d;const O=()=>{s.removeEventListener("load",o),s.removeEventListener("error",d)};o=()=>{O(),this.#a=!0,re(!0),i()},d=()=>{O(),r(new Error(`Failed to load script: ${e}`))},s.addEventListener("load",o),s.addEventListener("error",d),this.#n=t.appendChild(s)})}};close=async()=>{this.#s&&(this.#o&&this.#r&&(this.#t.send({targetWin:this.#o,targetOrigin:this.#r,messageType:j.GuestClose,messageBody:{}}),this.#t.removeSender({origin:this.#r,window:this.#o})),this.#t.close(),this.#h&&(clearInterval(this.#h),this.#h=null),this.#w&&ie.forEach(e=>{document.removeEventListener(e,this.#w)}),await this.#C(),window.removeEventListener("beforeunload",this.close),this.#s=!1,this.#e.audit({message:"Guest disconnected from host",...this.#d()}),this.#p=null,this.#f=null,this.#g=null)};connect=async e=>{if(!this.#s){let t=window,s={...ce};if(e){const{window:r,...o}=e;r&&(t=r),s={...s,...o}}const i=await K();this.#r=i.origin,this.#o=i.window,this.#t.initialize(t),this.#t.addSender({origin:this.#r,window:this.#o}),this.#t.listen({messageType:j.ObjectEvent,callback:this.#P.bind(this)}),this.#t.listen({messageType:j.HostConfig,callback:this.#k.bind(this)}),this.#t.listen({messageType:j.GuestFocus,callback:this.#L.bind(this)}),this.#t.listen({messageType:j.HostClose,callback:this.#_.bind(this)}),this.#t.send({targetWin:this.#o,targetOrigin:this.#r,messageType:j.GuestReady,messageBody:s}),this.#s=!0,this.#$(),this.#E&&await this.getAuthToken(),await this.#R(),window.addEventListener("beforeunload",this.close),this.#e.audit({message:"Guest connected to host",guestUrl:window.location.href})}};getAuthToken=async()=>{if(!this.#u&&this.#s)try{const e=await this.getObject("auth");if(e){const t=await e.getAccessToken();this.#u=t?.access_token,this.#b=t?.host_name,this.#m=t?.client_id}else this.#e.warn("Auth object not available to get access token from host")}catch(e){this.#e.error(`Error getting access token from auth object. ${e.message}`)}return this.#u};getObject=async e=>{if(this.#e.debug(`Retrieving scripting object "${e}" from host...`),!this.#s)throw new Error("Not connected to host");const{hostWindow:t,hostOrigin:s}=this.#l(),i=await this.#t.invoke({targetWin:t,targetOrigin:s,messageType:j.ObjectGet,messageBody:{objectId:e}}),r=this.#y(i.object);return this.#e.audit({message:"Received scripting object from host",scriptingObject:e,...this.#d()}),r};listObjects=async()=>{if(this.#e.debug("Retrieving names of scripting objects exposed by host..."),!this.#s)throw new Error("Not connected to host");const{hostWindow:e,hostOrigin:t}=this.#l(),s=await this.#t.invoke({targetWin:e,targetOrigin:t,messageType:j.ListObjects,messageBody:{}});return this.#e.audit({message:"Received names of all scripting objects exposed by host",objects:s,...this.#d()}),s};removeScript=()=>{if(this.#a&&this.#n){const{parentNode:e}=this.#n;e?.removeChild?.(this.#n)}};setLogLevel=e=>{this.#e.setLogLevel(e),this.#e.debug(`Log level changed by guest to ${e}`)};subscribe=e=>{const{eventId:t,criteria:s,callback:i}=e;this.#e.debug(`Registering subscription for event ${t}`);const r=this.#c.get(t.toLowerCase())||[],o=f();r.push({callback:i,token:o,criteria:s}),this.#c.set(t.toLowerCase(),r);const{hostWindow:d,hostOrigin:O}=this.#l();return this.#t.send({targetWin:d,targetOrigin:O,messageType:j.GuestEventSubscribe,messageBody:{eventId:t,criteria:s,token:o}}),this.#e.debug(`Subscribed to event ${t} with token ${o}`),o};unsubscribe=e=>{const{eventId:t,token:s}=e,i=this.#c.get(t.toLowerCase());if(i){const r=i.length,o=i.filter(d=>d.token!==s);if(o.length<r){this.#c.set(t.toLowerCase(),o);const{hostWindow:d,hostOrigin:O}=this.#l();this.#t.send({targetWin:d,targetOrigin:O,messageType:j.GuestEventUnsubscribe,messageBody:{eventId:t,token:s}}),this.#e.debug(`Unsubscribed from event ${t}`)}}}}})(),Y})());
|
|
1
|
+
(function(q,R){typeof exports=="object"&&typeof module=="object"?module.exports=R(require("emuiDiagnostics")):typeof define=="function"&&define.amd?define(["emuiDiagnostics"],R):typeof exports=="object"?exports.ice=R(require("emuiDiagnostics")):(q.ice=q.ice||{},q.ice.guest=R(q.emuiDiagnostics))})(globalThis,Q=>(()=>{var q={572(a,l,c){var g=c(736),h=g.Symbol;a.exports=h},561(a,l,c){var g=c(572),h=c(504),y=c(567),u="[object Null]",p="[object Undefined]",T=g?g.toStringTag:void 0;function w(E){return E==null?E===void 0?p:u:T&&T in Object(E)?h(E):y(E)}a.exports=w},605(a,l,c){var g=c(327),h=/^\s+/;function y(u){return u&&u.slice(0,g(u)+1).replace(h,"")}a.exports=y},433(a){var l=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis;a.exports=l},504(a,l,c){var g=c(572),h=Object.prototype,y=h.hasOwnProperty,u=h.toString,p=g?g.toStringTag:void 0;function T(w){var E=y.call(w,p),f=w[p];try{w[p]=void 0;var m=!0}catch{}var x=u.call(w);return m&&(E?w[p]=f:delete w[p]),x}a.exports=T},567(a){var l=Object.prototype,c=l.toString;function g(h){return c.call(h)}a.exports=g},736(a,l,c){var g=c(433),h=typeof self=="object"&&self&&self.Object===Object&&self,y=g||h||Function("return this")();a.exports=y},327(a){var l=/\s/;function c(g){for(var h=g.length;h--&&l.test(g.charAt(h)););return h}a.exports=c},702(a,l,c){var g=c(230),h=c(381),y=c(569),u="Expected a function",p=Math.max,T=Math.min;function w(E,f,m){var x,k,U,G,S,L,A=0,j=!1,W=!1,B=!0;if(typeof E!="function")throw new TypeError(u);f=y(f)||0,g(m)&&(j=!!m.leading,W="maxWait"in m,U=W?p(y(m.maxWait)||0,f):U,B="trailing"in m?!!m.trailing:B);function F(b){var $=x,C=k;return x=k=void 0,A=b,G=E.apply(C,$),G}function X(b){return A=b,S=setTimeout(_,f),j?F(b):G}function Z(b){var $=b-L,C=b-A,K=f-$;return W?T(K,U-C):K}function V(b){var $=b-L,C=b-A;return L===void 0||$>=f||$<0||W&&C>=U}function _(){var b=h();if(V(b))return H(b);S=setTimeout(_,Z(b))}function H(b){return S=void 0,B&&x?F(b):(x=k=void 0,G)}function z(){S!==void 0&&clearTimeout(S),A=0,x=L=k=S=void 0}function N(){return S===void 0?G:H(h())}function D(){var b=h(),$=V(b);if(x=arguments,k=this,L=b,$){if(S===void 0)return X(L);if(W)return clearTimeout(S),S=setTimeout(_,f),F(L)}return S===void 0&&(S=setTimeout(_,f)),G}return D.cancel=z,D.flush=N,D}a.exports=w},230(a){function l(c){var g=typeof c;return c!=null&&(g=="object"||g=="function")}a.exports=l},470(a){function l(c){return c!=null&&typeof c=="object"}a.exports=l},89(a,l,c){var g=c(561),h=c(470),y="[object Symbol]";function u(p){return typeof p=="symbol"||h(p)&&g(p)==y}a.exports=u},381(a,l,c){var g=c(736),h=function(){return g.Date.now()};a.exports=h},345(a,l,c){var g=c(702),h=c(230),y="Expected a function";function u(p,T,w){var E=!0,f=!0;if(typeof p!="function")throw new TypeError(y);return h(w)&&(E="leading"in w?!!w.leading:E,f="trailing"in w?!!w.trailing:f),g(p,T,{leading:E,maxWait:T,trailing:f})}a.exports=u},569(a,l,c){var g=c(605),h=c(230),y=c(89),u=NaN,p=/^[-+]0x[0-9a-f]+$/i,T=/^0b[01]+$/i,w=/^0o[0-7]+$/i,E=parseInt;function f(m){if(typeof m=="number")return m;if(y(m))return u;if(h(m)){var x=typeof m.valueOf=="function"?m.valueOf():m;m=h(x)?x+"":x}if(typeof m!="string")return m===0?m:+m;m=g(m);var k=T.test(m);return k||w.test(m)?E(m.slice(2),k?2:8):p.test(m)?u:+m}a.exports=f},388(a){"use strict";a.exports=Q}},R={};function I(a){var l=R[a];if(l!==void 0)return l.exports;var c=R[a]={exports:{}};return q[a](c,c.exports,I),c.exports}I.n=a=>{var l=a&&a.__esModule?()=>a.default:()=>a;return I.d(l,{a:l}),l},I.d=(a,l)=>{for(var c in l)I.o(l,c)&&!I.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:l[c]})},I.o=(a,l)=>Object.prototype.hasOwnProperty.call(a,l),I.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var Y={};return(()=>{"use strict";I.r(Y),I.d(Y,{SSFGuest:()=>le});const l={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let c;const g=new Uint8Array(16);function h(){if(!c&&(c=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!c))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return c(g)}var y;const u=[];for(let n=0;n<256;++n)u.push((n+256).toString(16).slice(1));function p(n,e=0){return u[n[e+0]]+u[n[e+1]]+u[n[e+2]]+u[n[e+3]]+"-"+u[n[e+4]]+u[n[e+5]]+"-"+u[n[e+6]]+u[n[e+7]]+"-"+u[n[e+8]]+u[n[e+9]]+"-"+u[n[e+10]]+u[n[e+11]]+u[n[e+12]]+u[n[e+13]]+u[n[e+14]]+u[n[e+15]]}function T(n,e=0){const t=p(n,e);if(!y(t))throw TypeError("Stringified UUID is invalid");return t}const w=null;function E(n,e,t){if(l.randomUUID&&!e&&!n)return l.randomUUID();n=n||{};const s=n.random||(n.rng||h)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=s[i];return e}return p(s)}const f=E;var m=I(345),x=I.n(m);const k="elli:remoting",U="elli:remoting:response",G="elli:remoting:exception",S=({messageType:n,messageBody:e,requestId:t,onewayMsg:s=!1})=>({requestId:t??(s?null:f()),source:k,type:n,body:e}),L=n=>{const{targetWin:e,targetOrigin:t,messageType:s,messageBody:i}=n,r=S({messageType:s,messageBody:i});e.postMessage(r,t)};class A{#i;#e;#t=new Map;#a=new Map;#n=null;#s=null;#c=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#i=t,this.#e=e}#p=()=>{this.#n=null;const e=Date.now(),t=[];let s=null;if(this.#a.forEach((i,r)=>{const{requestId:o,cancelTime:d}=i;d&&d<=e?(this.#e.debug(`Detected response timeout for requestId: ${o}...`),t.push(r),i.resolve(void 0)):d&&(s=s===null?d:Math.min(s,d))}),t.forEach(i=>{this.#a.delete(i)}),s!==null){const i=Math.max(s-Date.now(),0);this.#g(i)}};#g=e=>{this.#n===null&&(this.#n=window.setTimeout(this.#p,e))};#f=()=>{this.#n!==null&&(window.clearTimeout(this.#n),this.#n=null)};#r=e=>{const t=this.#a.get(e);return this.#e.debug(`serving requestId: ${e}`),this.#a.delete(e),t};#o=e=>{const{requestId:t}=e;this.#e.debug(`Response received for invocation requestId: ${t}`);const s=this.#r(t);return s?(s.resolve(e.body),!0):(this.#e.debug(`Received response to stale/invalid request with requestId: ${t}`),!1)};#h=e=>{this.#e.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#r(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#e.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#v=({sourceWin:e,sourceOrigin:t,message:s})=>{this.#e.debug(`Received message of type "${s.type}"`);const i=this.#t.get(s.type);return i?(i.forEach(r=>{this.#e.debug(`Invoking message handler ${r.name}`),r({sourceWin:e,sourceOrigin:t,requestId:s.requestId,type:s.type,body:s.body})}),!0):!1};#l=e=>{if(this.#c.size===0||!e.source)return!1;const t=this.#c.get(e.source);return!t||e?.data?.source!==k?!1:(this.#e.debug(`Remoting: Received message of type "${e.data.type}"`),e.data.type===U?this.#o(e.data):e.data.type===G?this.#h(e.data):this.#v({sourceWin:e.source,sourceOrigin:t,message:e.data}),!0)};addSender=e=>{const{origin:t,window:s}=e;if(!t)throw new Error("origin is required");if(!s)throw new Error("window is required");this.#c.set(s,t)};initialize=e=>{this.#s&&this.#s.removeEventListener("message",this.#l),e.addEventListener("message",this.#l),this.#s=e,this.#e.debug(`initialized remoting id: ${this.#i}`)};close=()=>{this.#s&&(this.#s.removeEventListener("message",this.#l),this.#s=null),this.#f(),this.#e.debug(`closed remoting id: ${this.#i}`)};invoke=e=>{const{targetWin:t,targetOrigin:s,messageType:i,messageBody:r,responseTimeoutMs:o}=e;return new Promise((d,O)=>{const v=S({messageType:i,messageBody:r});this.#a.set(v.requestId,{requestId:v.requestId,resolve:d,reject:O,cancelTime:o?Date.now()+o:null}),t.postMessage(v,s);const{requestId:P}=v;this.#e.debug(`Posted invocation message of type ${i} requestId: ${P||""}`),o&&(this.#e.debug(`scheduling timeout check for requestId: ${P||""} in ${o} ms`),this.#g(o))})};listen=e=>{const{messageType:t,callback:s}=e,i=this.#t.get(t)||[];i.push(s),this.#t.set(t,i)};unlisten=e=>{const{messageType:t,callback:s}=e,i=this.#t.get(t);if(!i)return;const r=i.indexOf(s);r!==-1&&i.splice(r,1)};send=e=>{const{targetWin:t,targetOrigin:s,messageType:i,messageBody:r}=e,o=S({messageType:i,messageBody:r,onewayMsg:!0});t.postMessage(o,s),this.#e.debug(`Posted one-way message of type "${i}"`)};removeSender=e=>{const{window:t}=e;t&&this.#c.delete(t)};respond=e=>{const{targetWin:t,targetOrigin:s,requestId:i,response:r}=e,o=S({messageType:U,messageBody:r,requestId:i});t.postMessage(o,s),this.#e.debug(`Response sent to caller for invocation requestId: ${i}`)};raiseException=e=>{const{targetWin:t,targetOrigin:s,requestId:i,ex:r}=e,o=r instanceof Error?r.message:r,d=S({messageType:G,messageBody:o,requestId:i});t.postMessage(d,s),this.#e.debug(`Exception sent to caller for invocation. requestId: ${i}`)}}var j=(n=>(n.GuestClose="guest:close",n.GuestEventSubscribe="guest:eventSubscribe",n.GuestEventUnsubscribe="guest:eventUnsubscribe",n.GuestFocus="guest:focus",n.GuestReady="guest:ready",n.GuestReadyComplete="guest:readyComplete",n.GuestResize="guest:resize",n.HandShake="handshake",n.HandShakeAck="handshake:ack",n.HostClose="host:close",n.HostConfig="host:config",n.ListObjects="list:objects",n.ObjectEvent="object:event",n.ObjectGet="object:get",n.ObjectInvoke="object:invoke",n))(j||{});class W{__TYPE__="Proxy";id;objectType;constructor(e,t){this.id=e,this.objectType=t}}const B=n=>n?.constructor?.name==="Proxy"||n?.constructor?.name==="ScriptingObjectProxy"||n?.__TYPE__==="Proxy";class F{name;objectId;id;constructor(e){const{name:t,objectId:s}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object id is required");this.objectId=s,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase()}}class X{static[Symbol.hasInstance](e){return typeof e=="object"&&e!==null&&"getType"in e&&typeof e.getType=="function"&&e.getType()==="ProxyEvent"}#i;objectId;name;id;getType(){return"ProxyEvent"}constructor(e){const{name:t,objectId:s,eventSrc:i}=e;if(!t)throw new Error("Event name is required");if(!s)throw new Error("Scripting object id is required");if(!i)throw new Error("Event source is required");this.objectId=s,this.name=t,this.#i=i,this.id=`${this.objectId}.${this.name}`.toLowerCase()}subscribe=e=>this.#i.subscribe({eventId:this.id,callback:e});unsubscribe=e=>{this.#i.unsubscribe({eventId:this.id,token:e})}}const Z=n=>n instanceof F,V=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`;var _=I(388);const H=()=>{const{parent:n}=window;try{return n?.location?.href}catch{return null}},z=n=>{if(!n||n==="about:blank")return"*";try{const{origin:e}=new URL(n);return e==="null"||!e?"*":e}catch{try{const{origin:e}=new URL(n,document.baseURI);return e==="null"||!e?"*":e}catch{return"*"}}},N=()=>window.self!==window.parent,D=(n,e)=>{const t=e||document.body,s=document.defaultView?.getComputedStyle?.(t,null),i=s?s[n]:"0";return parseInt(i,10)},b=/^https?:\/\/([a-z0-9-]+\.)*(?:elliemae\.io|ellielabs\.com|ellieservices\.com|encompassloconnect\.com|ice\.com|localhost:[0-9]+)$/i,$="elli:remoting",C=3e4,K=()=>new Promise((n,e)=>{if(N())n({origin:z(document.referrer||H()),window:window.parent});else{const t=window;let s;const i=r=>{if(b.test(r.origin)){const{source:o,type:d}=r.data||{};if(o===$&&d===j.HandShake){const{origin:O}=r,v=r.source;clearTimeout(s),L({targetWin:v,targetOrigin:O,messageType:j.HandShakeAck,messageBody:{}}),t.removeEventListener("message",i),n({origin:O,window:v})}}};s=setTimeout(()=>{t.removeEventListener("message",i),e(new Error(`Host handshake timed out after ${C}ms`))},C),t.addEventListener("message",i)}});let M=!1;const re=n=>{M=n},J=(n=null)=>{let e=n;const t=()=>{if(!e&&(e=window.ice?.guest?.SSFGuest?new window.ice.guest.SSFGuest:null,!e))throw new Error("Guest definition not found");return e};window.elli=window.elli??{},window.elli.script={guest:{create:(s,i)=>t().addScript(s,i)},connect:s=>t().connect(s),getObject:s=>t().getObject(s),setLogLevel:s=>t().setLogLevel(s),subscribe:(s,i,r,o)=>t().subscribe({eventId:`${s}.${i}`,callback:d=>r(d?.obj,d?.eventParams,d?.eventOptions),criteria:o?.criteria}),unsubscribe:(s,i,r)=>t().unsubscribe({eventId:`${s}.${i}`,token:r})}};try{J()}catch{}var oe=(n=>(n.OBJECT="object",n.VALUE="value",n))(oe||{});const ee=12e4,ce={eventFeedback:!0},te=()=>{const{document:n}=window,e=n.body,t=n.documentElement,i={height:e.offsetHeight+D("marginTop")+D("marginBottom"),width:Math.max(e.scrollWidth,t.scrollWidth)};L({targetWin:window.parent,targetOrigin:z(n.referrer||H()),messageType:j.GuestResize,messageBody:i}),window.removeEventListener("load",te)};N()&&window.addEventListener("load",te);const se={"cdn.ice.com":"https://api.elliemae.com/diagnostics/v2/logging","cdn.np.ice.com":"https://stg.api.elliemae.com/diagnostics/v2/logging","cdn.uat.ice.com":"https://concept.api.elliemae.com/diagnostics/v2/logging","cdn.pt1.ice.com":"https://pel1.api.ellielabs.com/diagnostics/v2/logging","cdn.qa1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.dev1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.ice.com":"https://api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.s1.ice.com":"https://stg.api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.uat1.ice.com":"https://concept.api.elliemae.com/diagnostics/v2/logging","cdn.mortgagetech.pl1.ice.com":"https://pel1.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.q1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging","cdn.mortgagetech.d1.ice.com":"https://int.api.ellielabs.com/diagnostics/v2/logging",localhost:"https://int.api.ellielabs.com/diagnostics/v2/logging"},ie=["click","scroll","keypress","touchstart"],ae=()=>{const n=document.currentScript?.src||"file:///opt/jenkins/workspace/UIPlatform_pui-microfe_master/245/libs/ssf-guest/lib/guest.ts",e=n?new URL(n).hostname:"localhost";return se[e]||se["cdn.mortgagetech.q1.ice.com"]};class le{#i;#e;#t;#a=!1;#n=null;#s=!1;#c=new Map;#p=null;#g=null;#f=null;#r=null;#o=null;#h=null;#v=new Map;#l(){if(!this.#o||!this.#r)throw new Error("Guest is not connected to a host. Call connect() first.");return{hostWindow:this.#o,hostOrigin:this.#r}}#E=!1;#u=null;#m=null;#b=null;#S=!0;#j=ee;#O;#w=null;constructor(e){const{console:t=!1,url:s=window.__ICE__?.diagnosticsUrl||ae(),index:i="ssf-guest-v2",team:r="ICE",appName:o="SSF Guest V2 Application"}=e?.logger??{};this.#O=e?.logger,this.#E=e?.usesDevConnectAPI??!1,this.#S=e?.keepAlive??!0,this.#j=e?.keepAliveInterval??ee;const d=t?(0,_.Console)():(0,_.http)(s);this.#e=e?.appLogger??(0,_.logger)({transport:d,index:i,team:r,appName:o}),(0,_.webvitals)(this.#e),(0,_.logUnhandledErrors)(this.#e),this.#i=f(),this.#t=new A(this.#e,this.#i),J(this),this.#e.audit({message:"Guest created",guestUrl:window.location.href,correlationId:this.#i})}#d=()=>({guestId:this.#p,guestTitle:this.#g,guestUrl:this.#f});#y=e=>{if(!e||!e.objectId)throw this.#e.error("Deserialization of scripting object failed. Object does not have an Object ID."),new Error("Cannot deserialize object JSON into proxy.");const t=new W(e.objectId,e.objectType);return e.functions&&e.functions.forEach(s=>{Object.defineProperty(t,s,{value:async(...i)=>this.#x({objectId:t.id,functionName:s,functionParams:[...i]}),enumerable:!0})}),e.events&&e.events.forEach(s=>{Object.defineProperty(t,s,{value:new X({objectId:t.id,name:s,eventSrc:this}),enumerable:!0})}),this.#e.debug(`Created guest proxy for scripting object (id = "${t.id}")`),t};#x=async({objectId:e,functionName:t,functionParams:s})=>{this.#e.debug(`Invoking scripting object method ${e}.${t}()...`);const i=[];if(s)for(let v=0;v<s.length;v+=1){const P=s[v];P instanceof Promise&&i.push(P.then(ne=>{s[v]=ne}))}await Promise.all(i);const{hostWindow:r,hostOrigin:o}=this.#l(),d=await this.#t.invoke({targetWin:r,targetOrigin:o,messageType:j.ObjectInvoke,messageBody:{objectId:e,functionName:t,functionParams:s}}),O=this.#T(d);return this.#e.audit({message:"Guest proxy invoked Scripting Object method",scriptingObject:e,scriptingMethod:t,...this.#d()}),O};#I(e,t){return Object.entries(t).every(([s,i])=>{const r=e[s];if("eq"in i)return r===i.eq;if("in"in i)return Array.isArray(i.in)&&i.in.includes(r);if("includes"in i)return Array.isArray(r)&&r.includes(i.includes);if("gt"in i){const o=typeof r=="number"?r:Number(r);return!Number.isNaN(o)&&o>i.gt}if("lt"in i){const o=typeof r=="number"?r:Number(r);return!Number.isNaN(o)&&o<i.lt}if("regex"in i)try{let o=this.#v.get(i.regex);return o||(o=new RegExp(i.regex),this.#v.set(i.regex,o)),typeof r=="string"&&o.test(r)}catch{return!1}return!1})}#T=e=>e?.type==="object"&&"object"in e?this.#y(e.object):e?.type==="value"?e.value:e;#k=({body:e})=>{e?.logLevel&&(this.#e.setLogLevel(e.logLevel),this.#e.debug(`Log level changed by host to ${e.logLevel}`)),this.#p=e?.guestId??null,this.#g=e?.guestTitle??null,this.#f=e?.guestUrl??null,this.#e.audit({message:"Received configuration from Host",...this.#d()})};#L=()=>{window.focus()};#_=async()=>{await this.close(),window.close()};#$=()=>{N()||(this.#h=setInterval(()=>{this.#o?.closed&&this.close().then(()=>{window.close()}).catch(()=>{})},1e3))};#P=async({sourceWin:e,sourceOrigin:t,requestId:s,body:i})=>{const r=this.#y(i.object);if(r){const o=V(r.id,i.eventName);this.#e.debug(`Received event "${o}" from host`);let d;i.eventHandler?d=[{callback:window[i.eventHandler],token:f()}]:d=this.#c.get(o)||[];const O=[];if(d.forEach(v=>{if(v?.callback){if(v.criteria&&!(i.eventParams?this.#I(i.eventParams,v.criteria):!1)){this.#e.debug(`Event ${o} did not match criteria for subscriber ${v.callback.name}`);return}this.#e.debug(`Invoking event subscriber ${v.callback.name} for event ${o}`);const P=v.callback({obj:r,eventName:i.eventName,eventParams:i.eventParams,eventOptions:i.eventOptions});P instanceof Promise?O.push(P):typeof P<"u"&&O.push(Promise.resolve(P))}}),s){const v=await Promise.all(O);this.#t.respond({targetWin:e,targetOrigin:t,requestId:s,response:v}),this.#e.audit({message:"Guest proxy processed event from host and responded",scriptingEventId:o,scriptingObject:r.id,...this.#d()})}else this.#e.audit({message:"Guest proxy processed event from host",scriptingEventId:o,scriptingObject:r.id,...this.#d()})}};#G=async()=>{if(!(!this.#u||!this.#m||!this.#b))try{await fetch(`${this.#b}/oauth2/v1/token/introspection?${new URLSearchParams({token:this.#u,client_id:this.#m}).toString()}`,{headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8"},method:"POST"})}catch(e){this.#e.warn(`Failed to extend token lifetime: ${e.message}`)}};#C=async()=>{if(this.#u&&this.#m&&this.#b)try{await fetch(`${this.#b}/oauth2/v1/token/revocation?${new URLSearchParams({token:this.#u,client_id:this.#m}).toString()}`,{method:"POST"})}catch(e){this.#e.error(`Error revoking token. ${e.message}`)}finally{this.#u=null,this.#m=null}};#R=async()=>{if(this.#S)try{const e=await this.getObject("application");e?(this.#w=x()(async()=>{try{await e.keepSessionAlive(),await this.#G()}catch(t){this.#e.error(`Error keeping session alive. ${t.message}`)}},this.#j,{leading:!1}),ie.forEach(t=>{document.addEventListener(t,this.#w)})):this.#e.warn("Application object not available to send keep alive")}catch(e){this.#e.error(`Error getting application object. ${e.message}`)}};addScript=async(e,t)=>{if(!this.#a&&e){await this.connect();const s=document.createElement("script");s.setAttribute("src",e),s.setAttribute("type","module"),await new Promise((i,r)=>{let o,d;const O=()=>{s.removeEventListener("load",o),s.removeEventListener("error",d)};o=()=>{O(),this.#a=!0,re(!0),i()},d=()=>{O(),r(new Error(`Failed to load script: ${e}`))},s.addEventListener("load",o),s.addEventListener("error",d),this.#n=t.appendChild(s)})}};close=async()=>{this.#s&&(this.#o&&this.#r&&(this.#t.send({targetWin:this.#o,targetOrigin:this.#r,messageType:j.GuestClose,messageBody:{}}),this.#t.removeSender({origin:this.#r,window:this.#o})),this.#t.close(),this.#h&&(clearInterval(this.#h),this.#h=null),this.#w&&ie.forEach(e=>{document.removeEventListener(e,this.#w)}),await this.#C(),window.removeEventListener("beforeunload",this.close),this.#s=!1,this.#e.audit({message:"Guest disconnected from host",...this.#d()}),this.#p=null,this.#f=null,this.#g=null)};connect=async e=>{if(!this.#s){let t=window,s={...ce};if(e){const{window:r,...o}=e;r&&(t=r),s={...s,...o}}const i=await K();this.#r=i.origin,this.#o=i.window,this.#t.initialize(t),this.#t.addSender({origin:this.#r,window:this.#o}),this.#t.listen({messageType:j.ObjectEvent,callback:this.#P.bind(this)}),this.#t.listen({messageType:j.HostConfig,callback:this.#k.bind(this)}),this.#t.listen({messageType:j.GuestFocus,callback:this.#L.bind(this)}),this.#t.listen({messageType:j.HostClose,callback:this.#_.bind(this)}),this.#t.send({targetWin:this.#o,targetOrigin:this.#r,messageType:j.GuestReady,messageBody:s}),this.#s=!0,this.#$(),this.#E&&await this.getAuthToken(),await this.#R(),window.addEventListener("beforeunload",this.close),this.#e.audit({message:"Guest connected to host",guestUrl:window.location.href})}};getAuthToken=async()=>{if(!this.#u&&this.#s)try{const e=await this.getObject("auth");if(e){const t=await e.getAccessToken();this.#u=t?.access_token,this.#b=t?.host_name,this.#m=t?.client_id}else this.#e.warn("Auth object not available to get access token from host")}catch(e){this.#e.error(`Error getting access token from auth object. ${e.message}`)}return this.#u};getObject=async e=>{if(this.#e.debug(`Retrieving scripting object "${e}" from host...`),!this.#s)throw new Error("Not connected to host");const{hostWindow:t,hostOrigin:s}=this.#l(),i=await this.#t.invoke({targetWin:t,targetOrigin:s,messageType:j.ObjectGet,messageBody:{objectId:e}}),r=this.#y(i.object);return this.#e.audit({message:"Received scripting object from host",scriptingObject:e,...this.#d()}),r};listObjects=async()=>{if(this.#e.debug("Retrieving names of scripting objects exposed by host..."),!this.#s)throw new Error("Not connected to host");const{hostWindow:e,hostOrigin:t}=this.#l(),s=await this.#t.invoke({targetWin:e,targetOrigin:t,messageType:j.ListObjects,messageBody:{}});return this.#e.audit({message:"Received names of all scripting objects exposed by host",objects:s,...this.#d()}),s};removeScript=()=>{if(this.#a&&this.#n){const{parentNode:e}=this.#n;e?.removeChild?.(this.#n)}};setLogLevel=e=>{this.#e.setLogLevel(e),this.#e.debug(`Log level changed by guest to ${e}`)};subscribe=e=>{const{eventId:t,criteria:s,callback:i}=e;this.#e.debug(`Registering subscription for event ${t}`);const r=this.#c.get(t.toLowerCase())||[],o=f();r.push({callback:i,token:o,criteria:s}),this.#c.set(t.toLowerCase(),r);const{hostWindow:d,hostOrigin:O}=this.#l();return this.#t.send({targetWin:d,targetOrigin:O,messageType:j.GuestEventSubscribe,messageBody:{eventId:t,criteria:s,token:o}}),this.#e.debug(`Subscribed to event ${t} with token ${o}`),o};unsubscribe=e=>{const{eventId:t,token:s}=e,i=this.#c.get(t.toLowerCase());if(i){const r=i.length,o=i.filter(d=>d.token!==s);if(o.length<r){this.#c.set(t.toLowerCase(),o);const{hostWindow:d,hostOrigin:O}=this.#l();this.#t.send({targetWin:d,targetOrigin:O,messageType:j.GuestEventUnsubscribe,messageBody:{eventId:t,token:s}}),this.#e.debug(`Unsubscribed from event ${t}`)}}}}})(),Y})());
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/umd/index.js.br
CHANGED
|
Binary file
|
package/dist/umd/index.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ssf-guest",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.4",
|
|
4
4
|
"description": "ICE MT SSF Guest Library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@elliemae/pui-diagnostics": "^3.11.3",
|
|
42
42
|
"uuid": "~9.0.1",
|
|
43
|
-
"@elliemae/microfe-common": "2.23.
|
|
43
|
+
"@elliemae/microfe-common": "2.23.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@elliemae/browserslist-config-elliemae-latest-browsers": "~1.14.4",
|
|
Binary file
|
|
Binary file
|