@genesislcap/design-system-configurator 14.299.0 → 14.301.0
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/{1530.1530.30ad8cf631b303b90464.js → 1530.1530.c6b34b63120fc9c3ec23.js} +1 -1
- package/dist/{1656.1656.a8eb1d9d5ec0ade06cbb.js → 1656.1656.970f0f972a0aa5f84fb3.js} +1 -1
- package/dist/{2024.2024.149808db7503e311c5f1.js → 2024.2024.c7f1dbbf9d5e794572dc.js} +8 -8
- package/dist/2024.7709bad93d744a972b8bb787fee3c0fc.js.map +1 -0
- package/dist/{3600.3600.a58e00d814f254ae47fa.js → 3600.3600.4e7d34a621e3fcb145fe.js} +2 -2
- package/dist/{4665.4665.28482f1e31955364d0e9.js → 4665.4665.7b622f4db9ec46483a0f.js} +1 -1
- package/dist/{4871.4871.08d5a6f27c9cfd43cb5f.js → 4871.4871.7f39413210e9af26745d.js} +1 -1
- package/dist/{653.653.a1eedc398dbc96a83c98.js → 653.653.86875df08c7dc957e2f1.js} +1 -1
- package/dist/{6548.6548.8bc53797ca7cadd71239.js → 6548.6548.a20716cc82fa8408a186.js} +1 -1
- package/dist/{7038.7038.72646c58907a62d3d721.js → 7038.7038.d1098b99bbea48730611.js} +2 -2
- package/dist/{designSystemConfigurator.9f7308b5083fb40a3aa2ce780ac0f3c4.js.map → designSystemConfigurator.afd3732ca3fd62335a709c3fa6c318bf.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist/{main.42872e3a4c9f88698dee.js → main.250727087ff8c79e3b5a.js} +2 -2
- package/dist/{main.7299b5bd60328fb25bedf88b56cc5f26.js.map → main.d2dc65f264bb3d3a5694d33ecf7ba0ec.js.map} +1 -1
- package/dist/remoteEntry.js +2 -2
- package/package.json +13 -13
- package/dist/2024.94801a646fa273bc885b834f2fa296b2.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_genesislcap_design_system_configurator=self.webpackChunk_genesislcap_design_system_configurator||[]).push([[1530],{21530:(e,t,n)=>{n.d(t,{O:()=>d});var s=n(28745);const d=(e,t)=>{var n;let d=document.getElementById(t);if(d)return void s.v.debug(`\n An element with the id of '${t}' already exists and likely has the css rules applied.\n `);const l=null!==(n=document.head)&&void 0!==n?n:document.getElementsByTagName("head")[0];d=document.createElement("style"),d.id=t,l.appendChild(d);if((e.match(/}/g)||[]).length>1)return d.textContent=e,()=>{d&&l.removeChild(d)};{const t=d.sheet.insertRule(e);return()=>{d&&(d.sheet.deleteRule(t),l.removeChild(d))}}}},28745:(e,t,n)=>{n.d(t,{v:()=>d});var s=n(
|
|
1
|
+
"use strict";(self.webpackChunk_genesislcap_design_system_configurator=self.webpackChunk_genesislcap_design_system_configurator||[]).push([[1530],{21530:(e,t,n)=>{n.d(t,{O:()=>d});var s=n(28745);const d=(e,t)=>{var n;let d=document.getElementById(t);if(d)return void s.v.debug(`\n An element with the id of '${t}' already exists and likely has the css rules applied.\n `);const l=null!==(n=document.head)&&void 0!==n?n:document.getElementsByTagName("head")[0];d=document.createElement("style"),d.id=t,l.appendChild(d);if((e.match(/}/g)||[]).length>1)return d.textContent=e,()=>{d&&l.removeChild(d)};{const t=d.sheet.insertRule(e);return()=>{d&&(d.sheet.deleteRule(t),l.removeChild(d))}}}},28745:(e,t,n)=>{n.d(t,{v:()=>d});var s=n(35158);const d=(0,s.createLogger)("foundation-utils")}}]);
|
|
2
2
|
//# sourceMappingURL=1530.d71663f51a41cea69e912330e991ddc1.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_genesislcap_design_system_configurator=self.webpackChunk_genesislcap_design_system_configurator||[]).push([[1656],{79780:(e,t,s)=>{s.d(t,{Es:()=>o});var i=s(84674);class r extends BroadcastChannel{constructor(){super(...arguments),this.postMessage=(...e)=>{const[t,s]=e;super.postMessage({type:t,detail:s})},this.isMessageType=(e,t)=>{var s;return(null===(s=t.data)||void 0===s?void 0:s.type)===e}}}const o=e=>{class t extends r{constructor(){super(e)}}return i.DI.createInterface((e=>e.transient(t)))}},40113:(e,t,s)=>{s.d(t,{N:()=>L});var i=s(8202),r=s(92277),o=s(33681),n=s(84674),a=s(97156),c=s(26347),d=s(21281),h=s(10447),l=s(56653),u=s(98316),E=s(17465);const g=n.DI.createInterface();function _(){return(null===navigator||void 0===navigator?void 0:navigator.credentials)?"PasswordCredential"in window||(E.v.warn("PasswordCredential not available in this browser."),!1):(E.v.warn("CredentialsContainer not available in this browser."),!1)}const v=":";function S(e="",t=v,s){return e.split(t,s).map((e=>e.trim())).filter((e=>""!==e))}function m(e,t=v){const s="string"==typeof e&&e.trim();return!!s&&s.includes(t)}function p(e,t=v){return"string"==typeof e&&e.trim()?(e.match(new RegExp(t,"g"))||[]).length:0}function R(e,t=v){for(const s of e)if(m(s,t))return s;return e.find((e=>"string"==typeof e&&!!e.trim()))}function T(e,t,s){const i="string"==typeof e&&e.trim();return!i||s&&!i.includes(s)||p(i)>1?s&&t&&s!==t?`${t}:${s}`:t||s:i}function O(e="credential"){E.v.warn(`Unable to migrate legacy ${e} to latest format. Please remove from your browser.`)}const A={password:!0,mediation:"optional"},f={cookie:{path:"/",name:"credentials",expires:7300,storePasswords:!1}};let I=class{constructor(e,t=f){this.session=e,this.config=t}createBasicCredentials(e){return{type:l.h.BASIC,username:e.username,password:e.password,mfaToken:this.getMFAToken()}}createRefreshCredentials(e){var t,s,i;return{type:l.h.REFRESH,username:null!==(t=null==e?void 0:e.username)&&void 0!==t?t:this.getUsername(),refreshToken:null!==(s=null==e?void 0:e.refreshToken)&&void 0!==s?s:this.getRefreshToken(),mfaToken:null!==(i=null==e?void 0:e.mfaToken)&&void 0!==i?i:this.getMFAToken()}}createSSOCredentials(e){var t;return{type:l.h.SSO,ssoToken:null!==(t=null==e?void 0:e.ssoToken)&&void 0!==t?t:this.getSSOToken()}}validateBasicCredentials(e){return e&&!!e.username&&!!e.password}validateRefreshCredentials(e){return e&&!!e.refreshToken&&!!e.username}validateSSOCredentials(e){return e&&!!e.ssoToken}validateUserCredentialData(e,t){const s=e&&!!e.id&&!!e.name&&!e.name.includes(v)&&p(e.id)<=1;return t?s&&!!e.password:s}normaliseLegacyCredentialData(e,t){if(this.validateUserCredentialData(e,!0))return[e,!0];if(this.validateUserCredentialData(t))return[t,!1];if(e)try{const t=e,[s]=S(t.name||t.id),[i,r]=S(R([t.id,t.name]));return[{id:T(t.id||t.name,s,r),name:s,password:t.password||""},!0]}catch(e){O("PasswordCredential")}if(t)try{const e=t,[s]=S(e.name||e.username||e.organisation),[i,r]=S(R([e.organisation||e.username||e.name]));return[{id:T(e.id||e.username||e.name,s,r),name:s,password:e.password||""},!1]}catch(e){O("cookie")}return[void 0,!1]}storeCredentialsInContainer(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(!_())return;const t=new PasswordCredential(e);return E.v.debug("Storing credentials in CredentialsContainer"),navigator.credentials.store(t)}))}getCredentialsFromContainer(e=A){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(_())return E.v.debug("Getting credentials from CredentialsContainer"),yield navigator.credentials.get(e)}))}storeCredentialsInCookie(e){const{password:t}=e,s=(0,i.__rest)(e,["password"]),r=this.config.cookie.storePasswords?e:s;return E.v.debug("Storing credentials in cookie"),!!h.A.set(this.config.cookie.name,JSON.stringify(r),{expires:this.config.cookie.expires,domain:location.hostname,path:this.config.cookie.path,secure:!0})}getCredentialsFromCookie(){E.v.debug("Getting credentials from cookie");const e=h.A.get(this.config.cookie.name);return e?JSON.parse(e):void 0}storeCredentials(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(_()){const t=yield this.storeCredentialsInContainer(e);return Promise.resolve(!!t)}return Promise.resolve(this.storeCredentialsInCookie(e))}))}getCredentials(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return _()?this.getCredentialsFromContainer(e):Promise.resolve(this.getCredentialsFromCookie())}))}getSSOToken(){return this.session.getSessionStorageItem("ssoToken")}getUsername(){return this.session.getSessionStorageItem("username")||this.session.getLocalStorageItem("username")}getRefreshToken(){return this.session.getSessionStorageItem("refreshToken")||this.session.getLocalStorageItem("refreshToken")}getMFAToken(){return this.session.getSessionStorageItem("mfaToken")}removeCookie(){h.A.remove(this.config.cookie.name,{domain:location.hostname,path:this.config.cookie.path})}removeSSOToken(){this.session.removeSessionStorageItem("ssoToken")}removeUsername(){this.session.removeSessionStorageItem("username"),this.session.removeLocalStorageItem("username")}removeRefreshToken(){this.session.removeSessionStorageItem("refreshToken"),this.session.removeLocalStorageItem("refreshToken")}removeMFAToken(){this.session.removeSessionStorageItem("mfaToken")}removeAll(){this.removeCookie(),this.removeSSOToken(),this.removeUsername(),this.removeRefreshToken(),this.removeMFAToken()}preventSilentAccess(){return _()&&navigator.credentials.preventSilentAccess()}};I=(0,i.__decorate)([(0,i.__param)(0,u.N),(0,i.__param)(1,(0,n.optional)(g))],I);const M=n.DI.createInterface((e=>e.singleton(I))),b=e=>Array.isArray(e)?e.map((e=>null!=e?e:"")):[],N=e=>{try{if("EVENT_LOGIN_AUTH_ACK"===(null==e?void 0:e.MESSAGE_TYPE)){const{DETAILS:i}=e;return{messageType:e.MESSAGE_TYPE,sourceRef:e.SOURCE_REF,userName:e.USER_NAME,updateQueue:e.UPDATE_QUEUE,zeroMqProxyModeEnabled:e.ZERO_MQ_PROXY_MODE_ENABLED,zeroMqProxyInboundPort:e.ZERO_MQ_PROXY_INBOUND_PORT,zeroMqProxyOutboundPort:e.ZERO_MQ_PROXY_OUTBOUND_PORT,userKVs:e.USER,details:i?{system:(s=i.SYSTEM,s?{date:s.DATE}:null),heartbeatIntervalSecs:i.HEARTBEAT_INTERVAL_SECS,failedLoginAttempts:i.FAILED_LOGIN_ATTEMPTS,rejectedLoginAttempts:i.REJECTED_LOGIN_ATTEMPTS,lastLoginDatetime:i.LAST_LOGIN_DATETIME,daysToPasswordExpiry:i.DAYS_TO_PASSWORD_EXPIRY,product:(t=i.PRODUCT,t?t.map((e=>({name:e.NAME,version:e.VERSION}))):[])}:null,permission:b(e.PERMISSION),profile:b(e.PROFILE)}}throw new Error("No Entity mapping implementation for provided DTO")}catch(e){throw E.v.error(e),e}var t,s};let C=class{loggedUserResultChanged(){var e;null===(e=this.isLoggedInSubject)||void 0===e||e.next(this.isLoggedIn)}get isLoggedIn$(){return this.isLoggedInSubject.asObservable()}get isLoggedIn(){return this.currentUser.isAuthenticated}constructor(e,t,s,i,r){this.session=e,this.connect=t,this.messageBuilder=s,this.credentialManager=i,this.currentUser=r,this.isWorking=!1,this.isLoggedInSubject=new a.t(this.isLoggedIn),this.currentUser.addAuthenticationChangeListener((e=>{var t;null===(t=this.isLoggedInSubject)||void 0===t||t.next(e.detail)}))}login(e){var t;return(0,i.__awaiter)(this,void 0,void 0,(function*(){this.isWorking=!0;try{const s=this.messageBuilder.createLoginMessage(e),i=yield this.connect.send(s);if(!i||i.ERROR||(null===(t=i.DETAILS)||void 0===t?void 0:t.ERROR))throw new l.l(s,i);this.applyAuthResults({authToken:i.SESSION_AUTH_TOKEN,refreshToken:i.REFRESH_AUTH_TOKEN,profiles:i.PROFILE,username:i.USER_NAME,permissions:i.PERMISSION,sessionId:i.SESSION_ID}),this.currentUser.set(N(i)),this.session.setAuthResult(i),E.v.debug("Login Authentication Result:",i)}catch(e){if(E.v.error("Login Authentication Error:",e),!(e instanceof l.l&&e.isIgnorableError()))throw this.removeAuthResults(),this.currentUser.unset(),e;E.v.warn("Ignoring authentication error as it is a known edge case.")}finally{this.isWorking=!1}return this.loggedUserResult}))}logout(){var e;return(0,i.__awaiter)(this,void 0,void 0,(function*(){this.isWorking=!0;let t={success:!1};try{const s=this.messageBuilder.createLogoutMessage(this.loggedUserResult);this.session.deleteUserFromSessionStorage();const{CODE:i,DETAILS:r,ERROR:o,MESSAGE_TYPE:n,OIDC_LOGOUT_URL:a}=yield this.connect.send(s),c=null!==(e=null==r?void 0:r.ERROR)&&void 0!==e?e:o,h=n===d.Go.LOGOUT_NACK;h&&E.v.warn("Unexpected Logout NACK received during logout.",c),t={success:n===d.Go.LOGOUT_ACK||i===d.x6.SESSION_NOT_FOUND||!h,error:c},a&&window.open(a,"_self")}catch(e){const s=new l.l(e.sentMessage,e.receivedMessage);if(E.v.error("Logout Authentication Error:",s),!s.isIgnorableError())throw e;E.v.warn("Ignoring authentication error as it is a known edge case."),t.success=!0}finally{this.removeAuthResults(),this.currentUser.unset(),this.isWorking=!1}return t}))}reAuthFromSession(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const e=yield this.ensureConnection(),t=this.credentialManager.createRefreshCredentials();if(e&&this.credentialManager.validateRefreshCredentials(t)){const e=this.messageBuilder.createRefreshTokenMessage(),t=yield this.connect.send(e);if((null==t?void 0:t.MESSAGE_TYPE)===d.Gp.EVENT_LOGIN_AUTH_ACK)return this.session.setAuthResult(t),this.currentUser.set(N(t)),this.applyAuthResults(this.getLoggedUserFromMessage(t)),!0}return this.session.deleteUserFromSessionStorage(),this.currentUser.unset(),!1}))}ensureConnection(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(this.connect.isConnected)return!0;const e=this.session.getSessionStorageItem("hostUrl");return!!e&&this.connect.connect(e)}))}getLoggedUserFromMessage(e){const t=e.USER_NAME,s=e.SESSION_AUTH_TOKEN,i=e.REFRESH_AUTH_TOKEN;return t&&s&&i?{username:t,authToken:s,refreshToken:i,profiles:e.PROFILE,permissions:e.PERMISSION,sessionId:e.SESSION_ID}:null}applyAuthResults(e){e?this.loggedUserResult={authToken:e.authToken,refreshToken:e.refreshToken,profiles:e.profiles,username:e.username,permissions:e.permissions,sessionId:e.sessionId}:this.removeAuthResults()}removeAuthResults(){this.loggedUserResult=null}};(0,i.__decorate)([o.observable],C.prototype,"isWorking",void 0),(0,i.__decorate)([o.observable],C.prototype,"loggedUserResult",void 0),C=(0,i.__decorate)([(0,i.__param)(0,u.N),(0,i.__param)(1,c.dm),(0,i.__param)(2,d.lT),(0,i.__param)(3,M),(0,i.__param)(4,r.KJ)],C);const L=n.DI.createInterface((e=>e.singleton(C)))},56653:(e,t,s)=>{var i;s.d(t,{h:()=>i,l:()=>r}),function(e){e.BASIC="BASIC",e.SSO="SSO",e.JWT="JWT",e.REFRESH="REFRESH"}(i||(i={}));class r extends Error{constructor(e,t,s="Auth Failed \n"){super(s),this.sent=e,this.received=t,Object.setPrototypeOf(this,r.prototype)}isIgnorableError(){var e,t,s,i,r,o,n,a;return!!(null===(i=null===(s=null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)||void 0===s?void 0:s.toLowerCase())||void 0===i?void 0:i.includes("request needs the user to be logged"))||!!(null===(a=null===(n=null===(o=null===(r=this.received)||void 0===r?void 0:r.DETAILS)||void 0===o?void 0:o.ERROR)||void 0===n?void 0:n.toLowerCase())||void 0===a?void 0:a.includes("is not logged in"))}getMessageError(){var e,t;return Array.isArray(null===(e=this.received)||void 0===e?void 0:e.ERROR)?null===(t=this.received)||void 0===t?void 0:t.ERROR.map((e=>this.errorDetailFormatter(e))).join("\n"):""}getDetailsError(){var e,t,s,i;return Array.isArray(null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)?null===(i=null===(s=this.received)||void 0===s?void 0:s.DETAILS)||void 0===i?void 0:i.ERROR.map((e=>this.errorDetailFormatter(e))).join("\n"):""}hasPasswordExpiredError(){return this.hasErrorCode("PASSWORD_EXPIRED")}hasMFAError(){return this.hasErrorCode("MFA_REQUIRED")||this.hasErrorCode("MFA_FAILED")}hasErrorCode(e){var t,s;return!!Array.isArray(null===(t=this.received)||void 0===t?void 0:t.ERROR)&&(null===(s=this.received)||void 0===s?void 0:s.ERROR.some((t=>t.CODE===e)))}errorDetailFormatter(e){return`\n ${e.CODE}: \n ${e.TEXT}`}}},24669:(e,t,s)=>{s.d(t,{EQ:()=>a,a4:()=>n});var i=s(17190),r=s(84674);class o{constructor(){this.streamListeners=(0,i.r)(),this.streamCompleteListeners=(0,i.r)(),this.streamErrorListeners=(0,i.r)(),this.commitListeners=(0,i.r)(),this.metadataListeners=(0,i.r)(),this.commitResponseListeners=(0,i.r)()}addStreamListener(e,t,s){var i,r,o;const n=null===(i=this.streamListeners)||void 0===i?void 0:i.subscribe(e),a=null===(r=this.streamCompleteListeners)||void 0===r?void 0:r.subscribe(t),c=null===(o=this.streamErrorListeners)||void 0===o?void 0:o.subscribe(s);return()=>{n(),a(),c()}}onStreamEvent(e,t,s,i){var r;null===(r=this.streamListeners)||void 0===r||r.publish(new CustomEvent("connect-stream-event",{detail:{functions:i,message:t,resourceName:e,stream:s}}))}onStreamErrorEvent(e,t,s){var i;null===(i=this.streamErrorListeners)||void 0===i||i.publish(new CustomEvent("connect-stream-error-event",{detail:{resourceName:e,stream:t,error:s}}))}onStreamCompleteEvent(e,t){var s;null===(s=this.streamCompleteListeners)||void 0===s||s.publish(new CustomEvent("connect-stream-complete-event",{detail:{resourceName:e,stream:t}}))}addCommitListener(e){var t;return null===(t=this.commitListeners)||void 0===t?void 0:t.subscribe(e)}onCommitEvent(e,t){var s;null===(s=this.commitListeners)||void 0===s||s.publish(new CustomEvent("connect-commit-event",{detail:{eventName:e,message:t}}))}addMetadataListener(e){var t;return null===(t=this.metadataListeners)||void 0===t?void 0:t.subscribe(e)}onMetadataEvent(e,t,s){var i;null===(i=this.metadataListeners)||void 0===i||i.publish(new CustomEvent("connect-metadata-event",{detail:{resourceName:e,message:t,error:s}}))}addCommitResponseListener(e){var t;return null===(t=this.commitResponseListeners)||void 0===t?void 0:t.subscribe(e)}onCommitResponseEvent(e,t){var s;null===(s=this.commitResponseListeners)||void 0===s||s.publish(new CustomEvent("connect-commit-response-event",{detail:{eventName:e,response:t}}))}}const n=r.DI.createInterface((e=>e.singleton(o))),a=r.DI.createInterface((e=>e.aliasTo(n)))},26347:(e,t,s)=>{s.d(t,{dm:()=>w,tn:()=>P});var i=s(8202),r=s(84686),o=s(33681),n=s(84674),a=s(77909);class c{constructor(){this.cachedMetadata=new Map,this.cachedJsonSchema=new Map}getMetadataFor(e){return this.cachedMetadata.get(e)}getJsonSchemaFor(e){return this.cachedJsonSchema.get(e)}hasMetadataFor(e){return this.cachedMetadata.has(e)}hasJsonSchemaFor(e){return this.cachedJsonSchema.has(e)}setMetadataFor(e,t){this.cachedMetadata.set(e,t)}setJsonSchemaFor(e,t){this.cachedJsonSchema.set(e,t)}}const d=n.DI.createInterface((e=>e.singleton(c)));var h=s(17465),l=s(24669),u=s(49587),E=s(49229),g=s(97156),_=s(7827),v=s(1762),S=s(84190),m=s(78213),p=s(66640),R=s(16220),T=s(98316),O=s(32748);const A={polling:Object.assign({POLLING_MAP:{EVENT_AMEND_USER:{TEMP_FREQUENCY:500,AMOUNT_OF_POLLS:5,QUERIES:["ALL_USERS"]}},POLLING_INTERVAL_MAP:{ALL_TRADES:5e3,ALL_USERS:5e3,ALL_PROCESSES_STATUS:1e4},POLLING_FREQUENCY:5e3},{})},f=n.DI.createInterface((e=>e.instance(A)));var I=s(21281);const M=(e,t)=>((null==t?void 0:t.ROW)&&e&&e.length>0?t.ROW.forEach((t=>{const s=t;if(s&&s.DETAILS){const i=s.DETAILS.ROW_REF,r=s.DETAILS.OPERATION;"INSERT"===r&&(e.find((e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===i}))||e.unshift(s)),"DELETE"===r&&(e=e.filter((e=>{var s,i;return(null===(s=t.DETAILS)||void 0===s?void 0:s.ROW_REF)!==(null===(i=e.DETAILS)||void 0===i?void 0:i.ROW_REF)}))),"MODIFY"===r&&(e=e.map((e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===i?Object.assign(Object.assign({},e),s):e})))}})):!t||e&&0!==e.length||(e=[...new Set(t.ROW)]),e);let b=class e{get isConnected(){return this._isConnected}set isConnected(e){this._isConnected=e,this.isConnectedSubject.next(this._isConnected)}constructor(e,t,s,i,r,o){var n;this.http=e,this.messageBuilder=t,this.session=s,this.metaCache=i,this.serializer=r,this.config=o,this.isWorking=!1,this._isConnected=!1,this.isConnectedSubject=new g.t(this._isConnected),this.isConnected$=null===(n=this.isConnectedSubject)||void 0===n?void 0:n.asObservable(),this.ongoingTurbo={},this.streams=new Map}checkHost(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){try{return this.getMessage({MESSAGE_TYPE:I.Go.HEARTBEAT_PING,SOURCE_REF:"host check"}).then((e=>e.MESSAGE_TYPE===I.Go.HEARTBEAT_PONG))}catch(e){return h.v.error(e),!1}}))}send(t,s){return this.http.post(e.getUrl(this.host,t),{body:e.getBody(t),headers:this.messageBuilder.createHTTPHeadersFromMessage(t)})}httpMode(){return!0}setValidSession(e){h.v.deprecated("setValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}connect(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return this.host=e,this.host.endsWith("/")||(this.host=this.host.concat("/")),this.checkHost().then((e=>(this.isConnected=e,this.session.setSessionStorageItem("hostUrl",this.host),e)))}))}disconnect(){this.isConnected=!1,this.streams.clear(),this.ongoingTurbo={},this.host=void 0}snapshot(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=this.messageBuilder.createDataLogonMessage(e,t);return h.v.debug(`HTTP MODE - ${s.MESSAGE_TYPE} (snapshot) message created -> `,s),this.send(s).then((e=>(this.dataLogoff(s.SOURCE_REF).catch((e=>h.v.error(e))),e)))}))}stream(e,t,s,i){const r=this.messageBuilder.createDataLogonMessage(e,i);h.v.debug(`HTTP MODE - ${r.MESSAGE_TYPE} (stream) message created -> `,r);const o=r.SOURCE_REF;this.streams.set(o,{SOURCE_REF:o,POLLING_FREQUENCY:new g.t(this.config.polling.POLLING_FREQUENCY),RESOURCE_NAME:e});const n=this.streams.get(o).POLLING_FREQUENCY,a=(0,_.x)((0,v.H)(this.send(r)),n.pipe((0,S.n)((e=>(0,m.Y)(e)))).pipe((0,S.n)((()=>(0,v.H)(this.getMessage(r)))))).pipe((0,p.v)((()=>this.streams.has(o))),(0,R.j)((()=>{h.v.debug(`Terminating stream for ${e} - ${o}`),this.dataLogoff(o)})));return this.streams.get(o).STREAM=a,a}streamState(e,t=(()=>{}),s=(()=>{}),i,r=[]){return this.stream(e,t,s,i).pipe((0,a.S)(M,r))}streamWithoutAutoTeardown(e,t,s,i){return h.v.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0"),this.stream(e,t,s,i)}getMessage(t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return this.http.get(e.getUrl(this.host,t),{headers:this.messageBuilder.createHTTPHeadersFromMessage(t)})}))}getMoreRows(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createMoreRowsMessage(e);return h.v.debug(`HTTP MODE - ${t.MESSAGE_TYPE} message created -> `,t),this.send(t)}))}getMoreColumns(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.send(t)}))}dataLogoff(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return this.send(t).then((t=>(this.streams.has(e)&&(h.v.debug(`Removing stream ${e}`),this.streams.delete(e)),t)))}))}getMetadata(e,t=!0){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createMetaRequestMessage(e);return h.v.debug(`HTTP MODE - ${t.MESSAGE_TYPE} (metadata) message created -> `,t),this.send(t).then((e=>e.DETAILS))}))}getJSONSchema(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createMetaRequestMessage(e,I.Gp.JSON_SCHEMA_REQUEST);return h.v.debug(`HTTP MODE! - ${t.MESSAGE_TYPE} (json schema) message created -> `,t),this.send(t)}))}request(e,t){const s=this.messageBuilder.createRequestMessage(e,t);return h.v.debug(`HTTP MODE! - ${s.MESSAGE_TYPE} (request server) message created -> `,s),this.send(s)}getAvailableResources(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createResourcesMessage(e);return h.v.debug(`HTTP MODE! - ${t.MESSAGE_TYPE} (getResources) message created -> `,t),this.send(t)}))}commitEvent(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=this.messageBuilder.createCommitMessage(e,t);return h.v.debug(`HTTP MODE! - ${s.MESSAGE_TYPE} (commit) message created -> `,s),this.send(s).then((t=>(this.maybeTurbo(e,t),t)))}))}maybeTurbo(e,t){var s;if(!(null===(s=null==t?void 0:t.MESSAGE_TYPE)||void 0===s?void 0:s.endsWith("_ACK")))return;if(this.ongoingTurbo[e])return void h.v.debug(`${e} polling frequency is already accelerated.`);const i=this.config.polling.POLLING_MAP[e];if(!(null==i?void 0:i.TEMP_FREQUENCY)||!i.AMOUNT_OF_POLLS)return;const r=i.TEMP_FREQUENCY,o=r*i.AMOUNT_OF_POLLS,n=JSON.parse(JSON.stringify(this.config.polling.POLLING_INTERVAL_MAP)),a=JSON.parse(JSON.stringify(this.config.polling.POLLING_INTERVAL_MAP));for(const e of i.QUERIES)a[e]=r,n[e]||(n[e]=this.config.polling.POLLING_FREQUENCY);h.v.debug(`${e} TRIGGERED -> ENFORCING TURBO | FREQUENCY=${r}ms DURATION=${o}`),this.ongoingTurbo[e]=!0,this.updateIntervals({polling:{POLLING_INTERVAL_MAP:a}}),setTimeout((()=>{h.v.debug(`RESTORED ORIGINAL POLLING INTERVALS FOR ${e}`),this.updateIntervals({polling:{POLLING_INTERVAL_MAP:n}}),this.ongoingTurbo[e]=!1}),o)}updateIntervals(e){const{POLLING_INTERVAL_MAP:t}=e.polling;t&&(this.config.polling.POLLING_INTERVAL_MAP=t,this.handlePollingIntervalMapUpdate(t))}handlePollingIntervalMapUpdate(e){if(e)for(const t in e){if(!e.hasOwnProperty(t))continue;const s=e[t];this.config.polling.POLLING_INTERVAL_MAP[t]=s,h.v.debug(`Setting polling frequency for ${t} = ${s}`),[...this.streams.values()].filter((e=>e.RESOURCE_NAME===t)).forEach((e=>{var t;return null===(t=null==e?void 0:e.POLLING_FREQUENCY)||void 0===t?void 0:t.next(s)}))}}static getBody(e){return JSON.stringify(e)}static getUrl(e,t){const s=t.MESSAGE_TYPE;let i=t.MESSAGE_TYPE.replace(/_/g,"-").toLowerCase();return s===I.Gp.DATA_LOGON&&(i=t.DETAILS.DATASOURCE_NAME.replace(/_/g,"-").toLowerCase()),`${e}${i}`}};(0,i.__decorate)([o.observable],b.prototype,"host",void 0),(0,i.__decorate)([o.observable],b.prototype,"isWorking",void 0),(0,i.__decorate)([o.observable],b.prototype,"_isConnected",void 0),(0,i.__decorate)([o.volatile],b.prototype,"isConnected",null),b=(0,i.__decorate)([(0,i.__param)(0,O.l),(0,i.__param)(1,I.lT),(0,i.__param)(2,T.N),(0,i.__param)(3,d),(0,i.__param)(4,E.b_),(0,i.__param)(5,f)],b);const N=n.DI.createInterface((e=>e.singleton(b)));var C=s(45230);let L=class{get isConnected(){return this.socket.isConnected}get isConnectedSubject(){return this.socket.isConnectedSubject}get isConnected$(){var e;return null===(e=this.socket.isConnectedSubject)||void 0===e?void 0:e.asObservable()}get host(){return this.socket.host}constructor(e,t,s,i,r){this.socket=e,this.messageBuilder=t,this.metaCache=s,this.events=i,this.config=r,this.isWorking=!1}httpMode(){return!1}setValidSession(e){h.v.deprecated("setValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}send(e,t){return this.socket.send(e,t)}connect(e=r.vN){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return this.socket.reset(),this.socket.connect(e,this.config.connect,this.config.reconnect)}))}disconnect(){this.socket.reset()}snapshot(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=this.messageBuilder.createDataLogonMessage(e,t);return h.v.debug(`${s.MESSAGE_TYPE} (snapshot) message created -> `,s),this.socket.send(s)}))}stream(e,t,s,i){const r=this.messageBuilder.createDataLogonMessage(e,i);h.v.debug(`${r.MESSAGE_TYPE} (stream) message created -> `,r);const o=this.socket.sendForStream(r,t,(t=>{s(t),this.events.onStreamErrorEvent(e,o,t)}),(()=>{this.events.onStreamCompleteEvent(e,o)}));return this.events.onStreamEvent(e,r,o,{onMessage:t,onError:s}),o}streamState(e,t=(()=>{}),s=(()=>{}),i,r=[]){return this.stream(e,t,s,i).pipe((0,a.S)(M,r))}streamWithoutAutoTeardown(e,t,s,i){h.v.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0");const r=this.messageBuilder.createDataLogonMessage(e,i);h.v.debug(`${r.MESSAGE_TYPE} (stream without auto-teardown) message created -> `,r);const o=this.socket.sendForStreamWithoutTeardown(r,t,(t=>{s(t),this.events.onStreamErrorEvent(e,o,t)}));return this.events.onStreamEvent(e,r,o,{onMessage:t,onError:s}),o}getMoreRows(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=this.messageBuilder.createMoreRowsMessage(e,t);return h.v.debug(`${s.MESSAGE_TYPE} message created -> `,s),this.socket.send(s,!1)}))}getMoreColumns(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.socket.send(t)}))}dataLogoff(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return h.v.debug(`${t.MESSAGE_TYPE} message created -> `,t),this.socket.send(t)}))}getMetadata(e,t=!0){var s;return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(t&&this.metaCache.hasMetadataFor(e))return h.v.debug(`Cached metadata retrieved for ${e}`),this.metaCache.getMetadataFor(e);const i=this.messageBuilder.createMetaRequestMessage(e);let r,o;h.v.debug(`${i.MESSAGE_TYPE} (metadata) message created -> `,i);try{this.isWorking=!0;const t=yield this.socket.send(i);r=null!==(s=null==t?void 0:t.DETAILS)&&void 0!==s?s:{},Object.keys(r).length&&this.metaCache.setMetadataFor(e,r)}catch(e){throw o=e,h.v.error(e),o}finally{this.events.onMetadataEvent(e,i,o),this.isWorking=!1}return r}))}getJSONSchema(e,t=!0){var s;return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(t&&this.metaCache.hasJsonSchemaFor(e))return h.v.debug(`Cached JsonSchema retrieved for ${e}`),this.metaCache.getJsonSchemaFor(e);const i=this.messageBuilder.createMetaRequestMessage(e,I.Gp.JSON_SCHEMA_REQUEST);let r;h.v.debug(`${i.MESSAGE_TYPE} (json schema) message created -> `,i);try{this.isWorking=!0,r=null!==(s=yield this.socket.send(i))&&void 0!==s?s:{},Object.keys(r).length&&this.metaCache.setJsonSchemaFor(e,r)}catch(e){h.v.error(e)}finally{this.isWorking=!1}return r}))}request(e,t){const s=this.messageBuilder.createRequestMessage(e,t);return h.v.debug(`${s.MESSAGE_TYPE} (request server) message created -> `,s),this.socket.send(s)}getAvailableResources(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createResourcesMessage(e);return h.v.debug(`${t.MESSAGE_TYPE} (resources) message created -> `,t),this.socket.send(t)}))}commitEvent(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=this.messageBuilder.createCommitMessage(e,t);h.v.debug(`${s.MESSAGE_TYPE} (commit) message created -> `,s);const i=this.socket.send(s);return this.events.onCommitEvent(e,s),i.then((t=>(this.events.onCommitResponseEvent(e,t),t)))}))}};(0,i.__decorate)([o.observable],L.prototype,"isWorking",void 0),L=(0,i.__decorate)([(0,i.__param)(0,C.yQ),(0,i.__param)(1,I.lT),(0,i.__param)(2,d),(0,i.__param)(3,l.EQ),(0,i.__param)(4,u.R)],L);const U="true"===r.PF||!1,y=n.DI.createInterface((e=>e.singleton(L))),w=n.DI.createInterface((e=>U?e.aliasTo(N):e.aliasTo(y)));function P(){return n.DI.getOrCreateDOMContainer().get(w)}},49587:(e,t,s)=>{s.d(t,{R:()=>o});var i=s(84674);const r={connect:{alwaysOn:!1,enableHeartbeat:!0,enableHeartbeatLogging:!1,heartbeatInterval:1e4,verboseHeartbeat:!1,enableMessageLogging:!1},reconnect:{reconnectAttempts:10,reconnectInterval:1e4,reconnectStreams:!0},isWebSocketExpression:new RegExp(/wss?:\/\/[-a-zA-Z0-9@:%._\+~#=]{1,256}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*)\b\/*$/,"i")},o=i.DI.createInterface((e=>e.instance(r)))},32748:(e,t,s)=>{s.d(t,{l:()=>a});var i=s(8202),r=s(49229),o=s(84674);let n=class{constructor(e){this.serializer=e}get(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=yield fetch(e,Object.assign(Object.assign({credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"}},t),{method:"GET"}));return(t.serializer||this.serializer).deserialize(s)}))}post(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=yield fetch(e,Object.assign(Object.assign({credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"}},t),{method:"POST"}));return(t.serializer||this.serializer).deserialize(s)}))}};n=(0,i.__decorate)([(0,i.__param)(0,r.b_)],n);const a=o.DI.createInterface((e=>e.singleton(n)))},21281:(e,t,s)=>{s.d(t,{Go:()=>i,Gp:()=>r,lT:()=>E,x6:()=>o,z2:()=>l});var i,r,o,n=s(8202),a=s(32808),c=s(84674),d=s(56653),h=s(98316);!function(e){e.LOGON_ACK="LOGON_ACK",e.LOGON_NACK="LOGON_NACK",e.LOGOFF_ACK="LOGOFF_ACK",e.LOGOFF_NACK="LOGOFF_NACK",e.HEARTBEAT_PING="HEARTBEAT_PING",e.HEARTBEAT_PONG="HEARTBEAT_PONG",e.MORE_ROWS="MORE_ROWS",e.MORE_COLUMNS="MORE_COLUMNS",e.MORE_COLUMNS_ACK="MORE_COLUMNS_ACK",e.MSG_ACK="MSG_ACK",e.MSG_NACK="MSG_NACK",e.LOGOUT_ACK="LOGOUT_ACK",e.LOGOUT_NACK="LOGOUT_NACK",e.QUERY_UPDATE="QUERY_UPDATE"}(i||(i={})),function(e){e.EVENT_LOGIN_AUTH="EVENT_LOGIN_AUTH",e.EVENT_LOGIN_AUTH_ACK="EVENT_LOGIN_AUTH_ACK",e.EVENT_LOGIN_AUTH_NACK="EVENT_LOGIN_AUTH_NACK",e.EVENT_LOGOUT="EVENT_LOGOUT",e.DATA_LOGON="DATA_LOGON",e.DATA_LOGOFF="DATA_LOGOFF",e.META_REQUEST="META_REQUEST",e.JSON_SCHEMA_REQUEST="JSON_SCHEMA_REQUEST",e.RESOURCES_REQUEST="RESOURCES_REQUEST",e.RESOURCES_REQUEST_ACK="RESOURCES_REQUEST_ACK",e.RESOURCES_REQUEST_NACK="RESOURCES_REQUEST_NACK",e.EVENT_CHANGE_USER_PASSWORD="EVENT_CHANGE_USER_PASSWORD",e.EVENT_SELF_SERVICE_PASSWORD_RESET="EVENT_SELF_SERVICE_PASSWORD_RESET",e.EVENT_PASSWORD_RESET_ACTION="EVENT_PASSWORD_RESET_ACTION"}(r||(r={})),function(e){e.SESSION_NOT_FOUND="SESSION_NOT_FOUND",e.UNKNOWN_MESSAGE_TYPE="UNKNOWN_MESSAGE_TYPE"}(o||(o={}));const l=(e,t)=>!!Array.isArray(null==e?void 0:e.ERROR)&&(null==e?void 0:e.ERROR.some((e=>{var s,i;return(null===(s=e.CODE)||void 0===s?void 0:s.includes(`${t}`))||(null===(i=e.STATUS_CODE)||void 0===i?void 0:i.includes(`${t}`))})));let u=class{constructor(e,t){this.session=e,this.uuid=t}createLoginMessage(e){let t;switch(e.type){case d.h.BASIC:t={USER_NAME:e.username,PASSWORD:e.password,MFA_CODE:e.mfaToken};break;case d.h.REFRESH:t={USER_NAME:e.username,REFRESH_AUTH_TOKEN:e.refreshToken,MFA_CODE:e.mfaToken};break;case d.h.SSO:t={SSO_TOKEN:e.ssoToken};break;case d.h.JWT:t={JWT:e.jwt,DOMAIN:e.domain}}return{DETAILS:t,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.EVENT_LOGIN_AUTH}}createLogoutMessage(e){var t,s;return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.EVENT_LOGOUT,SESSION_AUTH_TOKEN:null!==(t=e.authToken)&&void 0!==t?t:this.session.getSessionStorageItem("authToken"),SESSION_ID:null!==(s=e.sessionId)&&void 0!==s?s:this.session.getSessionStorageItem("sessionId")}}createDataLogonMessage(e,t){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.DATA_LOGON,DETAILS:Object.assign({DATASOURCE_NAME:e},t),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createDataLogoffMessage(e){return{SOURCE_REF:e,MESSAGE_TYPE:r.DATA_LOGOFF,SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createRequestMessage(e,t){return Object.assign({SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:e.startsWith("REQ_")?e:`REQ_${e}`},t)}createResourcesMessage(e){return Object.assign({SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:r.RESOURCES_REQUEST},e)}createMetaRequestMessage(e,t=r.META_REQUEST){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:t,DETAILS:{FEATURE:e},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createCommitMessage(e,t){return Object.assign({SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:e},t)}createRefreshTokenMessage(){return{SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:r.EVENT_LOGIN_AUTH,DETAILS:{REFRESH_AUTH_TOKEN:this.session.getSessionStorageItem("refreshToken"),MFA_CODE:this.session.getSessionStorageItem("mfaToken")}}}createChangePasswordMessage(e,t,s){return{USER_NAME:e,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.EVENT_CHANGE_USER_PASSWORD,DETAILS:{OLD_PASSWORD:t,NEW_PASSWORD:s}}}createForgotPasswordMessage(e,t,s=e){return{USER_NAME:s,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.EVENT_SELF_SERVICE_PASSWORD_RESET,DETAILS:{USER_NAME:e,RETURN_URL:t}}}createForgotPasswordTokenMessage(e,t,s,i=e){return{USER_NAME:i,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.EVENT_PASSWORD_RESET_ACTION,DETAILS:{USER_NAME:e,RESET_TOKEN:t,NEW_PASSWORD:s}}}createMoreRowsMessage(e,t){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:i.MORE_ROWS,DETAILS:{SOURCE_REF:e,VIEW_NUMBER:t},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createMoreColumnsMessage(e){return Object.assign(Object.assign({},this.createMoreRowsMessage(e)),{MESSAGE_TYPE:i.MORE_COLUMNS})}createHTTPHeadersFromMessage(e,t="application/json; charset=UTF-8"){const s={"Content-type":t};return e.SOURCE_REF&&(s["source-ref"]=e.SOURCE_REF,s.SOURCE_REF=e.SOURCE_REF),e.SESSION_AUTH_TOKEN&&(s["SESSION-AUTH-TOKEN"]=e.SESSION_AUTH_TOKEN),e.MESSAGE_TYPE===r.EVENT_LOGOUT&&(s["SESSION-ID"]=e.SESSION_ID),s}createHeartbeatPingMessage(e=!1){return{MESSAGE_TYPE:i.HEARTBEAT_PING,SOURCE_REF:this.uuid.createId(),VERBOSE:e,DETAILS:{},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}};u=(0,n.__decorate)([(0,n.__param)(0,h.N),(0,n.__param)(1,a.k)],u);const E=c.DI.createInterface((e=>e.singleton(u)))},45230:(e,t,s)=>{s.d(t,{yQ:()=>D,Ol:()=>G});var i=s(8202),r=s(92277),o=s(84686),n=s(49229),a=s(32808),c=s(33681),d=s(84674),h=s(50049),l=s(37970),u=s(75841),E=s(26274),g=s(53193),_=s(84190),v=s(82834),S=s(66640),m=s(53940),p=s(48653),R=s(98316),T=s(17465),O=s(49587),A=s(32748),f=s(21281);const I=1e4,M=6e4;var b;!function(e){e.Linear="linear",e.Exponential="exponential"}(b||(b={}));const N=(e,t)=>{const{reconnectInterval:s=I}=e,i=s>M?M:s,r=Math.round(Math.log2(M/i));return i*Math.pow(2,t%r)},C=e=>{const{reconnectInterval:t=I}=e;return t>M?M:t};var L=s(5709);class U{constructor(e){this.interval=e,this.workerScript=`\n const startTime = Date.now();\n setInterval(function() {\n self.postMessage(Date.now() - startTime);\n }, ${this.interval});\n `}start(e){this.stop(),this.runWorker(e)}stop(){this.worker&&(this.worker.terminate(),delete this.worker)}runWorker(e){this.worker||(this.worker=new Worker(URL.createObjectURL(new Blob([this.workerScript],{type:"text/javascript"}))),this.worker.onmessage=t=>e(t.data))}}class y extends h.B{constructor(){super()}}l.c;class w{constructor(e,t,s,i){this._message=e,this._onMessage=t,this._onError=s,this._isSubscription=i}get sentMessage(){return this._message}get onReceivedMessage(){return this._onMessage}get onReceivedError(){return this._onError}get isSubscription(){return this._isSubscription}}let P=class e{get isConfigured(){return this.status.isConfigured}get isConnecting(){return this.status.isConnecting}get isConnected(){return this.status.isConnected}get isConnectedSubject(){return this.status.isConnectedSubject}get isDisconnected(){return this.status.isDisconnected}get isDisconnectedByServer(){return this.status.isDisconnectedByServer}get isReconnecting(){return this.status.isReconnecting}get hasValidSession(){return T.v.deprecated("get hasValidSession","Use `User.isAuthenticated` from `@genesislcap/foundation-user` instead.","15.0.0"),this.user.isAuthenticated}set hasValidSession(e){T.v.deprecated("set hasValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}get host(){var e;return null!==(e=this.url)&&void 0!==e?e:o.vN}constructor(e,t,s,i,r,o,n){this.messageBuilder=e,this.session=t,this.serializer=s,this.uuid=i,this.status=r,this.user=o,this.config=n,this.defaultInterval=1e4,this.secondsMultiplier=1e3,this.heartbeatIsEnabled=!0,this.heartbeatInterval=this.defaultInterval,this.socketMessages=()=>this.wsMessages}get heartbeatLoggingIsEnabled(){var e,t;return null!==(t=null===(e=this.connectOptions)||void 0===e?void 0:e.enableHeartbeatLogging)&&void 0!==t&&t}get messageLoggingIsEnabled(){var e,t;return null!==(t=null===(e=this.connectOptions)||void 0===e?void 0:e.enableMessageLogging)&&void 0!==t&&t}connect(e=o.vN,t,s){var r;return this.url=e,this.connectOptions=null!=t?t:this.config.connect,this.reconnectOptions=null!=s?s:this.config.reconnect,(null===(r=this.config.isWebSocketExpression)||void 0===r?void 0:r.test(this.host))?new Promise((e=>{var t,s,r,o;T.v.info(`${this.isReconnecting?"Reconnecting":"Connecting"} to ${this.url}`),this.status.isConnecting=!this.isReconnecting;(!this.isReconnecting||!(null===(t=this.reconnectOptions)||void 0===t?void 0:t.reconnectStreams))&&this.cleanMessages(),null===(s=this.socketSubscription)||void 0===s||s.unsubscribe(),this.websocket=new p.Q({url:this.url,openObserver:{next:()=>{this.session.setSessionStorageItem("hostUrl",this.url),this.status.isConnected=!0,this.prepareHeartbeat(),T.v.info("WebSocket connection is now open"),e(this.isConnected)}},closeObserver:{next:t=>{this.status.onClose(t),this.isDisconnectedByServer&&T.v.info(`WebSocket connection was closed due an error - Code: ${t.code} ${t.reason?" | Reason: "+t.reason:""}`),e(this.isConnected)}},serializer:e=>this.serializer.serialize(e),deserializer:e=>this.serializer.deserialize(e)});this.socketSubscription=this.websocket.subscribe(null!==(o=null===(r=this.connectOptions)||void 0===r?void 0:r.connectObserver)&&void 0!==o?o:{next:e=>(0,i.__awaiter)(this,void 0,void 0,(function*(){var t;const s=`Response Message received for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,T.v.info,s);const{SOURCE_REF:i,MESSAGE_TYPE:r}=e,o=this.getMessageHandler(i,r);if(!o)return void(e.MESSAGE_TYPE===f.Go.MSG_NACK&&e.ERROR&&e.ERROR.forEach((t=>{T.v.error(`MessageType: ${e.MESSAGE_TYPE} | Error Details:`,t)})));let n=!1;switch(e.MESSAGE_TYPE){case f.Gp.EVENT_LOGIN_AUTH_ACK:{const s=e.DETAILS;s.HEARTBEAT_INTERVAL_SECS&&void 0===(null===(t=this.connectOptions)||void 0===t?void 0:t.heartbeatInterval)&&(this.heartbeatInterval=s.HEARTBEAT_INTERVAL_SECS*this.secondsMultiplier,this.prepareHeartbeat());break}case f.Go.LOGOUT_ACK:return o.onReceivedMessage.call(this,e),void this.cleanMessages();case f.Go.LOGON_ACK:return;case f.Go.LOGOFF_ACK:break;case f.Go.QUERY_UPDATE:o.isSubscription||this.sendDataLogoff(i);break;case f.Go.MSG_NACK:case f.Go.LOGON_NACK:n=!0}n?o.onReceivedError.call(this,{receivedMessage:e,sentMessage:o.sentMessage}):o.onReceivedMessage.call(this,e),this.wsMessages.next(e),o.isSubscription||this.removeMessageHandler(i)})),error:e=>{T.v.debug("Error found: ",e),this.reconnect()},complete:()=>{var e;this.isDisconnectedByServer&&(null===(e=this.connectOptions)||void 0===e?void 0:e.alwaysOn)?this.reconnect():T.v.info("Connection is now closed")}}),this.status.isConfigured=!0})):(T.v.error(`Specified host (${this.host}) is not valid WebSocket url. Connection will not proceed.`),void T.v.warn("Make sure the host url starts with wss:// or ws://"))}handleExpiredSession(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(this.session.getSessionStorageItem("refreshToken")){const e=this.messageBuilder.createRefreshTokenMessage(),t=yield this.send(e);this.session.setAuthResult(t),this.updateSessionAndSubscriptions(t)}else yield this.handleCookieBasedReauth()}))}handleCookieBasedReauth(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=parseInt(localStorage.getItem(e.REAUTH_ACTION_LOCK_KEY)||"0");if(Date.now()-t>3e4&&localStorage.removeItem(e.REAUTH_ACTION_LOCK_KEY),localStorage.getItem(e.REAUTH_ACTION_LOCK_KEY))window.addEventListener("storage",this.onStorageEvent.bind(this));else{localStorage.setItem(e.REAUTH_ACTION_LOCK_KEY,Date.now().toString());const t=yield fetch(o.Be,{credentials:"include"});if("EVENT_LOGIN_DETAILS_ACK"!==(yield t.json()).MESSAGE_TYPE){(yield fetch(o.aW,{credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"},method:"POST",body:JSON.stringify({DETAILS:{},MESSAGE_TYPE:"EVENT_LOGIN_AUTH"})})).ok||window.location.reload()}localStorage.removeItem(e.REAUTH_ACTION_LOCK_KEY),yield this.connect()}}))}onStorageEvent(t){t.key===e.REAUTH_ACTION_LOCK_KEY&&null===t.newValue&&(this.connect(),window.removeEventListener("storage",this.onStorageEvent))}updateSessionAndSubscriptions(e){(null==e?void 0:e.MESSAGE_TYPE)===f.Gp.EVENT_LOGIN_AUTH_ACK&&this.wsMessageHandlers.forEach((t=>{t.isSubscription&&(t.sentMessage.SESSION_AUTH_TOKEN=e.SESSION_AUTH_TOKEN,this.websocket.next(t.sentMessage))}))}prepareHeartbeat(){var e,t,s,r;this.heartbeatTicker&&this.heartbeatTicker.stop();const o=()=>(0,i.__awaiter)(this,void 0,void 0,(function*(){var e,t,s;if(!this.isConnected)return;const i=this.messageBuilder.createHeartbeatPingMessage(null===(e=this.connectOptions)||void 0===e?void 0:e.verboseHeartbeat);(null===(t=this.connectOptions)||void 0===t?void 0:t.heartbeatPingCallback)&&this.connectOptions.heartbeatPingCallback(i);const r=yield this.send(i);this.user.isAuthenticated&&!r.IS_AUTHENTICATED&&this.handleExpiredSession(),(null===(s=this.connectOptions)||void 0===s?void 0:s.heartbeatPongCallback)&&this.connectOptions.heartbeatPongCallback(r),this.heartbeatIsEnabled=r.MESSAGE_TYPE===f.Go.HEARTBEAT_PONG&&r.SOURCE_REF===i.SOURCE_REF}));if(null!==(t=null===(e=this.connectOptions)||void 0===e?void 0:e.enableHeartbeat)&&void 0!==t?t:this.heartbeatIsEnabled){const e=null!==(r=null===(s=this.connectOptions)||void 0===s?void 0:s.heartbeatInterval)&&void 0!==r?r:this.heartbeatInterval;this.heartbeatTicker=new U(e),this.heartbeatTicker.start((()=>{this.websocket&&this.isConnected&&(o(),this.heartbeatLoggingIsEnabled&&T.v.debug(`Sending a heartbeat ping every ${e} ms`))}))}}reconnect(){var e,t,s,i,r;const o=!(null===(e=this.connectOptions)||void 0===e?void 0:e.alwaysOn)&&!1===(null===(t=this.connectOptions)||void 0===t?void 0:t.enableHeartbeat);if(this.isReconnecting||o)return;this.status.isReconnecting=!0;const n=(null===(s=this.reconnectOptions)||void 0===s?void 0:s.reconnectStrategy)===b.Exponential?N:C,a=this.isConnectedSubject.asObservable().pipe((0,_.n)((e=>e?(0,u.of)(-1):((e,t)=>new l.c((s=>{let i,r=0;return function o(){s.next(r),clearTimeout(i),i=setTimeout(o,t(e,r)),r+=1}(),()=>{clearTimeout(i)}})))(this.reconnectOptions,n).pipe((0,v.Z)((e=>{var t,s,i;let r;return r=(null===(t=this.connectOptions)||void 0===t?void 0:t.alwaysOn)?e+1:null!==(i=null===(s=this.reconnectOptions)||void 0===s?void 0:s.reconnectAttempts)&&void 0!==i?i:10,e<r?(0,u.of)(e):(this.status.reconnectionLimitReached=!0,(0,E.$)((()=>new Error(`Max reconnect attempts ${r} reached.`))))}))))),(0,S.v)((()=>this.websocket&&!this.isConnected)));a.subscribe(null!==(r=null===(i=this.reconnectOptions)||void 0===i?void 0:i.reconnectObserver)&&void 0!==r?r:{next:e=>{T.v.debug(`Attempt no. ${e+1} to reconnect`),this.websocket.complete(),this.connect(this.url,this.connectOptions,this.reconnectOptions)},error:e=>{var t;T.v.debug(e),null===(t=this.socketSubscription)||void 0===t||t.unsubscribe(),this.status.isReconnecting=!1},complete:()=>{T.v.info(this.isConnected?"Reconnected":"Disconnected"),this.status.isReconnecting=!1,this.wsMessageHandlers.forEach((e=>{e.isSubscription&&this.websocket.next(e.sentMessage)}))}})}reset(){this.status.isConnected=!1,this.status.isConfigured=!1,this.websocket&&this.websocket.complete(),this.websocket=null,this.cleanMessages()}cleanMessages(){this.wsMessages&&this.wsMessages.complete(),this.wsMessages=new y,this.wsMessageHandlers=new Map}send(e,t=!0){if(!this.isConnected)return Promise.reject(new Error("WebSocket connection is closed"));const s=`Sending Message for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,T.v.info,s),new Promise(((s,i)=>{const r=e=>{s(e)},o=e=>{i(e)};t&&this.setMessageHandler(e,r,o),this.websocket.next(e)}))}sendForStream(e,t,s,i){if(!this.isConnected)return(0,E.$)((()=>new Error("WebSocket connection is closed")));const r=`Sending Message (stream) for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,T.v.info,r),this.setMessageHandler(e,t,s,!0),c.DOM.queueUpdate((()=>this.websocket.next(e))),new l.c((t=>{const s=new h.B;return this.wsMessages.pipe((0,m.p)((t=>t.SOURCE_REF===e.SOURCE_REF)),(0,g.Q)(s)).subscribe({next:e=>{t.next(e)},error:e=>{t.error(e)},complete:()=>{t.complete()}}),()=>{s.complete(),this.sendDataLogoff(e.SOURCE_REF),this.removeMessageHandler(e.SOURCE_REF),i&&i()}}))}sendForStreamWithoutTeardown(e,t,s){if(!this.isConnected)return(0,E.$)((()=>new Error("WebSocket connection is closed")));const i=`Sending Message (stream) for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,T.v.info,i),this.setMessageHandler(e,t,s,!0),this.websocket.next(e),this.wsMessages.pipe((0,m.p)((t=>t.SOURCE_REF===e.SOURCE_REF)))}setMessageHandler(e,t,s,i=!1){const r=`Setting Message Handler for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,T.v.debug,r),this.wsMessageHandlers.set(e.SOURCE_REF,new w(e,t,s,i))}sendDataLogoff(e){this.send(this.messageBuilder.createDataLogoffMessage(e),!1)}removeMessageHandler(e){this.wsMessageHandlers.delete(e)}getMessageHandler(e,t){const s=`Getting Message Handler for SourceRef: ${e} | MessageType: ${t}`;return this.logMessageTypeFlow(t,T.v.debug,s),this.wsMessageHandlers.get(e)}logMessageTypeFlow(e,t,s){switch(e){case f.Gp.DATA_LOGOFF:t(s);break;case f.Go.HEARTBEAT_PING:case f.Go.HEARTBEAT_PONG:this.heartbeatLoggingIsEnabled&&t(s);break;default:this.messageLoggingIsEnabled&&t(s)}}};P.REAUTH_ACTION_LOCK_KEY="reauthActionLock",(0,i.__decorate)([c.observable],P.prototype,"websocket",void 0),(0,i.__decorate)([c.observable],P.prototype,"wsMessages",void 0),(0,i.__decorate)([c.observable],P.prototype,"wsMessageHandlers",void 0),(0,i.__decorate)([A.l],P.prototype,"http",void 0),(0,i.__decorate)([c.observable],P.prototype,"heartbeatIsEnabled",void 0),P=(0,i.__decorate)([(0,i.__param)(0,f.lT),(0,i.__param)(1,R.N),(0,i.__param)(2,n.b_),(0,i.__param)(3,a.k),(0,i.__param)(4,L.S5),(0,i.__param)(5,r.KJ),(0,i.__param)(6,O.R)],P);const D=d.DI.createInterface((e=>e.singleton(P)));function G(){return d.DI.getOrCreateDOMContainer().get(D)}},5709:(e,t,s)=>{s.d(t,{S5:()=>d});var i=s(8202),r=s(92277),o=s(33681),n=s(84674),a=s(97156);class c{constructor(){this.isConfigured=!1,this.isConnecting=!1,this.isConnected=!1,this.isReconnecting=!1,this.reconnectionLimitReached=!1,this.isConnectedSubject=new a.t(this.isConnected)}get hasValidSession(){return this.user.isAuthenticated}get isDisconnected(){return!this.isConnected}get isDisconnectedByServer(){return void 0!==this.closedClean&&!this.closedClean}isConnectedChanged(){var e;this.isConnected&&this.resetClosedState(),this.isConnecting=!1,this.isReconnecting=!1,null===(e=this.isConnectedSubject)||void 0===e||e.next(this.isConnected)}isReconnectingChanged(){this.isReconnecting&&(this.reconnectionLimitReached=!1)}resetClosedState(){this.closedCode=void 0,this.closedReason=void 0,this.closedClean=void 0}serialize(){return{isConfigured:this.isConfigured,isConnecting:this.isConnecting,isConnected:this.isConnected,isDisconnected:this.isDisconnected,isDisconnectedByServer:this.isDisconnectedByServer,isReconnecting:this.isReconnecting,reconnectionLimitReached:this.reconnectionLimitReached,hasValidSession:this.hasValidSession,closedCode:this.closedCode,closedReason:this.closedReason,closedClean:this.closedClean}}onClose(e){this.isConnected=!1,this.closedCode=e.code,this.closedReason=e.reason,this.closedClean=e.wasClean}}(0,i.__decorate)([o.observable],c.prototype,"isConfigured",void 0),(0,i.__decorate)([o.observable],c.prototype,"isConnecting",void 0),(0,i.__decorate)([o.observable],c.prototype,"isConnected",void 0),(0,i.__decorate)([o.observable],c.prototype,"isReconnecting",void 0),(0,i.__decorate)([o.observable],c.prototype,"reconnectionLimitReached",void 0),(0,i.__decorate)([o.observable],c.prototype,"closedCode",void 0),(0,i.__decorate)([o.observable],c.prototype,"closedReason",void 0),(0,i.__decorate)([o.observable],c.prototype,"closedClean",void 0),(0,i.__decorate)([r.KJ],c.prototype,"user",void 0);const d=n.DI.createInterface((e=>e.singleton(c)))},34193:(e,t,s)=>{s.d(t,{d:()=>r});var i=s(17465);function r(e,t="ROW_REF"){const s=e=>{const s=Object.assign(Object.assign({},e),{[t]:e.DETAILS[t]});return delete s.DETAILS,s},r=[],o=[],n=[];for(const t of e.ROW)if(t.DETAILS)switch(t.DETAILS.OPERATION){case"INSERT":r.push(s(t));break;case"MODIFY":n.push(s(t));break;case"DELETE":o.push(s(t));break;default:i.v.error(`Unsupported operation type: '${t.DETAILS.OPERATION}'`)}return{inserts:r,deletes:o,updates:n,SOURCE_REF:e.SOURCE_REF}}},6884:(e,t,s)=>{s.d(t,{aB:()=>a,OD:()=>o});var i=s(84674);var r=s(34193);class o{}o.MAX_ROWS_250=250,o.MAX_VIEW_1000=1e3,o.REQ_REP_POLLING_INTERVAL_MS=1e4,o.DATASERVER_ROW_ID="ROW_REF",o.REQUEST_SERVER_ROW_ID="RECORD_ID",o.DEFAULT_PAGINATION_PAGE_SIZE=25;const n={options:{criteria:"",isSnapshot:!1,maxRows:o.MAX_ROWS_250,maxView:o.MAX_VIEW_1000,pollingInterval:o.REQ_REP_POLLING_INTERVAL_MS,movingView:!1,orderBy:"",resourceName:"",reverse:!1,pollTriggerEvents:[]},criteriaToFields:function(e){const t=e.split("&&").map((e=>e.trim())),s={};return t.forEach((e=>{if(e.startsWith("Expr"))switch(e.match(/Expr\.(\w+)\(/)[1]){case"dateIsToday":{const t=/Expr\.dateIsToday\((\w+)\)/,[,i]=e.match(t),r=new Date;s[`${i}_FROM`]=`${r.toISOString().replace(/-/g,"").split("T")[0]}-00:00`,r.setDate(r.getDate()+1),s[`${i}_TO`]=`${r.toISOString().replace(/-/g,"").split("T")[0]}-00:00`}break;case"dateTimeIsGreaterEqual":{const t=/Expr\.dateTimeIsGreaterEqual\((\w+), ?['"](.+)['"]\)/,[,i,r]=e.match(t);s[`${i}_FROM`]=r}break;case"dateTimeIsLessEqual":{const t=/Expr\.dateTimeIsLessEqual\((\w+), ?['"](.+)['"]\)/,[,i,r]=e.match(t);s[`${i}_TO`]=r}break;case"dateIsGreaterEqual":{const t=/Expr\.dateIsGreaterEqual\((\w+), ?['"](.+)['"]\)/,[,i,r]=e.match(t);s[`${i}_FROM`]=r}break;case"dateIsLessEqual":{const t=/Expr\.dateIsLessEqual\((\w+), ?['"](.+)['"]\)/,[,i,r]=e.match(t);s[`${i}_TO`]=r}break;case"containsIgnoreCase":{const t=/Expr\.containsIgnoreCase\((\w+), ?['"](.+)['"]\)/,[,i,r]=e.match(t);s[i]=`*${r}*`}}else{const t=e.substr(0,e.indexOf("=")).trim().replace(/["']/g,""),i=e.substr(e.lastIndexOf("=")+1,e.length).trim().replace(/["']/g,"");s[t]=i}})),s},dataServerResultFilter:r.d},a=i.DI.createInterface((e=>e.instance(n)))},9033:(e,t,s)=>{s.d(t,{yW:()=>b});var i=s(8202),r=s(33681),o=s(84674),n=s(50049),a=s(8790),c=s(1762),d=s(51046),h=s(66640),l=s(84190),u=s(65052),E=s(40113),g=s(26347),_=s(24669),v=s(48707),S=s(17465),m=s(79780);const p={throwWhenUnavailable:!0,throwWhenUnknown:!1},R=o.DI.createInterface((e=>e.instance(p))),T=(0,m.Es)("genesis-resources");let O=class{constructor(e,t){this.connect=e,this.config=t}isValidResource(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(!(e=null==e?void 0:e.trim()))return!1;yield this.fetchResources();return!!this.resources.find((t=>t.RESOURCE_NAME===e))}))}getResourceTypeFor(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){yield this.fetchResources();const t=this.resources.find((t=>t.RESOURCE_NAME===e));if(t)return t.RESOURCE_TYPE;const s=`${e} resource does not exist.`;if(S.v.error(s),this.config.throwWhenUnknown)throw new Error(s)}))}getAllResources(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return this.resources||(yield this.fetchResources()),this.resources}))}destroy(){this.resources=void 0,this.resourcesPromise=void 0}fetchResources(){var e;return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(this.resources)return Promise.resolve();if(this.resourcesPromise)yield this.resourcesPromise;else{this.resourcesPromise=this.connect.getAvailableResources();const t=yield this.resourcesPromise;if(this.resources=null==t?void 0:t.RESOURCES,!(null===(e=this.resources)||void 0===e?void 0:e.length)){const e="Genesis resources unavailable.";if(S.v.error(e),this.config.throwWhenUnavailable)throw new Error(e)}this.postLoadedMessage(),this.resourcesPromise=void 0}}))}postLoadedMessage(){const e=o.DI.getOrCreateDOMContainer().get(T);e.postMessage("resources-loaded",this.resources),e.close()}};O=(0,i.__decorate)([(0,i.__param)(0,g.dm),(0,i.__param)(1,R)],O);const A=o.DI.createInterface((e=>e.singleton(O)));var f=s(6884),I=s(39087);let M=class{get initialized(){var e;return!!(null===(e=this.status)||void 0===e?void 0:e.isInitialized)}constructor(e,t,s,i,r){this.connect=e,this.auth=t,this.resources=s,this.config=i,this.connectEvents=r,this.fetchMetadataRequired=!0,this.startStreamRequired=!0,this.originalFieldDef=[],this.fieldMetadata=[],this.requestFields=[],this.customRequestFields=[],this.availableIndexes=[],this.readOnly=!0,this._allParams=null,this.pollTrigger$=new n.B}triggerPoll(){this.pollTrigger$.next()}validResourceName(e){return S.v.deprecated("Datasource.validResourceName","Use `GenesisResources.isValidResource` instead."),!!e&&!!e.trim().length}init(e,t=this.fetchMetadataRequired,s=this.startStreamRequired){return(0,i.__awaiter)(this,void 0,void 0,(function*(){this.fetchMetadataRequired=t,this.options=Object.assign(Object.assign({},this.config.options),e),this.invalidateCache();const i=this.options.resourceName;if(!(this.connect.isConnected||(yield this.connect.connect())))return S.v.error(`Unable to connect to ${this.connect.host} to get ${i} datasource`),this.reportStatus(),!1;return(yield this.resources.isValidResource(i))?(this.resourceType=yield this.resources.getResourceTypeFor(i),this.resourceType?(this.fetchMetadataRequired&&(yield this.fetchAndApplyMetadata(this.options.resourceName),this._allParams=null),S.v.debug(`Initializing ${i} datasource from ${this.connect.host}`),!this.options.isSnapshot&&s&&(this.stream=yield this.createStream()),S.v.debug(`${i} datasource initialization ${this.initialized?"was successful.":"has failed."}`),this.reportStatus(),this.initialized):(S.v.error(`Unable to get the resource type for ${i} datasource from ${this.connect.host}`),this.reportStatus(),!1)):(S.v.error(`${i} datasource does not exist on ${this.connect.host}`),this.reportStatus(),!1)}))}startStream(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){this.options.isSnapshot||void 0!==this.stream||(this.stream=yield this.createStream())}))}destroy(){var e,t;S.v.debug("Datasource.destroy",null===(e=this.options)||void 0===e?void 0:e.resourceName),this.commitResponseUnsubscribe&&(this.commitResponseUnsubscribe(),this.commitResponseUnsubscribe=void 0),null===(t=this.pollTrigger$)||void 0===t||t.complete(),this.status=void 0,this.fetchMetadataRequired=void 0,this.options={},this.resourceType=void 0,this.availableIndexes=[],this.originalFieldDef=[],this.fieldMetadata=[],this.requestFields=[],this.stream=void 0}get allResourceParams(){var e;if(this._allParams)return this._allParams;let t;if(this.options.orderBy)if((null===(e=this.availableIndexes)||void 0===e?void 0:e.findIndex((e=>e.NAME===this.options.orderBy)))>-1)t=this.options.orderBy;else{const e=this.availableIndexes.map((e=>e.NAME));S.v.warn("Specified [orderBy] index is not valid and will not be used. See https://learn.genesis.global/docs/database/data-types/index-entities/ - Available indexes:",e)}return this._allParams={CRITERIA_MATCH:this.options.criteria,MAX_ROWS:this.options.maxRows,VIEW_NUMBER:this.options.viewNumber,FIELDS:this.options.fields,MAX_VIEW:this.options.maxView,MOVING_VIEW:this.options.movingView,ORDER_BY:t,REVERSE:this.options.reverse,DISABLE_POLLING:this.options.disablePolling,POLLING_INTERVAL:this.options.pollingInterval,REQUEST:this.options.request},S.v.debug("Getting configured params:",this._allParams),this._allParams}get dataserverOnlyParams(){return{CRITERIA_MATCH:this.allResourceParams.CRITERIA_MATCH,MAX_ROWS:this.allResourceParams.MAX_ROWS,VIEW_NUMBER:this.allResourceParams.VIEW_NUMBER,FIELDS:this.allResourceParams.FIELDS,MAX_VIEW:this.allResourceParams.MAX_VIEW,MOVING_VIEW:this.allResourceParams.MOVING_VIEW,ORDER_BY:this.allResourceParams.ORDER_BY,REVERSE:this.allResourceParams.REVERSE}}get requestOnlyParams(){var e;const t=this.allResourceParams,{REQUEST:s}=t,r=(0,i.__rest)(t,["REQUEST"]),o={DETAILS:{CRITERIA_MATCH:this.options.requestAutoSetup?void 0:r.CRITERIA_MATCH,MAX_ROWS:r.MAX_ROWS,VIEW_NUMBER:r.VIEW_NUMBER},REQUEST:s};return o.REQUEST||(this.options.requestAutoSetup?o.REQUEST=Object.assign(Object.assign({},Object.fromEntries(this.requestFields.map((e=>[e.NAME,"*"])))),(null===(e=null==this?void 0:this.options)||void 0===e?void 0:e.criteria)?this.config.criteriaToFields(this.options.criteria):{}):o.REQUEST={}),o}snapshot(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){switch(S.v.debug(`Requesting snapshot for ${this.options.resourceName} (${this.resourceType}).`),this.resourceType){case I.v.DATASERVER:return this.connect.snapshot(this.options.resourceName,Object.assign(Object.assign({},this.dataserverOnlyParams),e));case I.v.REQUEST_SERVER:return this.connect.request(this.options.resourceName,Object.assign(Object.assign({},this.requestOnlyParams),e));default:throw new Error(`Snapshot not supported for selected resource type: ${this.resourceType}`)}}))}snapshotFiltered(e="ROW_REF"){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=yield this.snapshot();return Array.isArray(t)?t:t.REPLY?t.REPLY:t.ROW?this.config.dataServerResultFilter(t,e).inserts:void 0}))}createStream(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(![I.v.DATASERVER,I.v.REQUEST_SERVER].includes(this.resourceType))throw new Error(`Streaming not supported for selected resource type: ${this.resourceType}`);return this.resourceType===I.v.DATASERVER?this.createDataserverStream():(S.v.debug(`Creating fake stream by polling ${this.options.resourceName} REQUEST_SERVER`),this.createReqRepStream())}))}createDataserverStream(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return this.connect.stream(this.options.resourceName,(e=>{}),(e=>S.v.error(e)),this.dataserverOnlyParams)}))}createReqRepStream(){this.commitResponseUnsubscribe=this.connectEvents.addCommitResponseListener((e=>{var t;const{eventName:s,response:i}=e.detail;this.options.pollTriggerEvents&&this.options.pollTriggerEvents.includes(s)&&(null===(t=i.MESSAGE_TYPE)||void 0===t?void 0:t.endsWith("_ACK"))&&(S.v.debug(`Received commit response for ${s}, triggering poll.`),this.triggerPoll())}));const e=this.allResourceParams.DISABLE_POLLING?void 0:this.allResourceParams.POLLING_INTERVAL,t=()=>(0,a.z)([this.connect.isConnected$,this.auth.isLoggedIn$]).pipe((0,h.v)((()=>this.connect.isConnected&&this.auth.isLoggedIn)),(0,l.n)((()=>(0,c.H)(this.snapshot()))));return e?this.pollTrigger$.pipe((0,u.Z)(0),(0,l.n)((()=>(0,d.O)(0,e).pipe((0,l.n)(t))))):this.pollTrigger$.pipe((0,l.n)(t))}fetchAndApplyMetadata(e){var t,s;return(0,i.__awaiter)(this,void 0,void 0,(function*(){try{S.v.debug(`Requesting metadata for ${this.options.resourceName} Datasource`);const e=yield this.connect.getMetadata(this.options.resourceName);e&&(this.availableIndexes=null!==(t=e.INDEXES)&&void 0!==t?t:[],this.originalFieldDef=(0,v.a)(e),this.fieldMetadata=(0,v.X)(this.originalFieldDef),this.requestFields=e.REQUEST_FIELD||[],this.customRequestFields=e.FIELD||[],this.fetchMetadataRequired=!1),this.status=this.normaliseStatus({isInitialized:!0,metadataRequired:!0,hasMetadata:(null===(s=this.fieldMetadata)||void 0===s?void 0:s.length)>0})}catch(t){S.v.error(`Metadata Fetch failed for ${e}:`,t),this.status=this.normaliseStatus({isInitialized:!1,metadataRequired:!0,hasMetadata:!1})}}))}reportStatus(e={}){var t;const s=null!==(t=this.config.eventEmitter)&&void 0!==t?t:document;this.status=this.normaliseStatus(e),S.v.debug(`Dispatching '${I.w}'`,this.status),null==s||s.dispatchEvent(new CustomEvent(I.w,{detail:this.status,bubbles:s!==document,composed:!0}))}normaliseStatus(e){var t,s,i,r,o;const n=null!==(t=e.isInitialized)&&void 0!==t?t:this.initialized,a=null!==(s=e.metadataRequired)&&void 0!==s?s:this.fetchMetadataRequired,c=null!==(i=e.hasMetadata)&&void 0!==i?i:(null===(r=this.fieldMetadata)||void 0===r?void 0:r.length)>0;return{name:null===(o=this.options)||void 0===o?void 0:o.resourceName,type:this.resourceType,isInitialized:n,metadataRequired:a,hasMetadata:c}}invalidateCache(){this._allParams=null}};(0,i.__decorate)([r.observable],M.prototype,"status",void 0),(0,i.__decorate)([r.observable],M.prototype,"fetchMetadataRequired",void 0),(0,i.__decorate)([r.observable],M.prototype,"startStreamRequired",void 0),(0,i.__decorate)([r.observable],M.prototype,"originalFieldDef",void 0),(0,i.__decorate)([r.observable],M.prototype,"fieldMetadata",void 0),(0,i.__decorate)([r.observable],M.prototype,"requestFields",void 0),(0,i.__decorate)([r.observable],M.prototype,"customRequestFields",void 0),(0,i.__decorate)([r.observable],M.prototype,"availableIndexes",void 0),(0,i.__decorate)([r.observable],M.prototype,"readOnly",void 0),(0,i.__decorate)([r.observable],M.prototype,"stream",void 0),M=(0,i.__decorate)([(0,i.__param)(0,g.dm),(0,i.__param)(1,E.N),(0,i.__param)(2,A),(0,i.__param)(3,f.aB),(0,i.__param)(4,_.a4)],M);const b=o.DI.createInterface((e=>e.transient(M)))},40370:(e,t,s)=>{s.d(t,{C:()=>a});var i=s(8202),r=s(33681),o=s(17465),n=s(39087);const a=e=>{class t extends e{constructor(){super(),this.hasOwnProperty("onDatasourceStatusChanged")||(this.onDatasourceStatusChanged=e=>{var t;this.resourceName||o.v.warn("Target classes must have a resourceName property to use the DatasourceEventHandler mixin.");const s=e.detail;if(s.name===this.resourceName){const e=null!==(t=this.datasourceStatus)&&void 0!==t?t:{isInitialized:!1,hasMetadata:!1};(e.isInitialized!==s.isInitialized||s.metadataRequired&&e.hasMetadata!==s.hasMetadata)&&(this.datasourceStatus=s)}})}datasourceStatusChanged(e,t){o.v.debug("Target classes should override the datasourceStatusChanged method of the DatasourceEventHandler mixin to respond to changes in the target datasource.")}connectedCallback(){super.connectedCallback(),document.addEventListener(n.w,this.onDatasourceStatusChanged,{passive:!0,capture:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(n.w,this.onDatasourceStatusChanged,{capture:!0})}}return(0,i.__decorate)([r.observable],t.prototype,"datasourceStatus",void 0),t}},39087:(e,t,s)=>{var i;s.d(t,{v:()=>i,w:()=>r}),function(e){e.DATASERVER="DATASERVER",e.EVENT_HANDLER="EVENT_HANDLER",e.REQUEST_SERVER="REQUEST_SERVER"}(i||(i={}));const r="datasource-status-changed"},96730:(e,t,s)=>{function i(e,t=";"){return e?e.split(t).map((e=>e.trim())).sort(((e,t)=>e.localeCompare(t))).join(t):e}s.d(t,{Q:()=>i})},41119:(e,t,s)=>{var i;s.d(t,{v:()=>r,w:()=>i}),function(e){e.STRING="STRING",e.NUMBER="NUMBER",e.BOOLEAN="BOOLEAN",e.ENUM="ENUM",e.DATE="DATE",e.DATETIME="DATETIME",e.CUSTOM="CUSTOM",e.NANO_TIMESTAMP="NANO_TIMESTAMP"}(i||(i={}));const r={STRING:i.STRING,ENUM:i.ENUM,BOOLEAN:i.BOOLEAN,INT:i.NUMBER,LONG:i.NUMBER,DOUBLE:i.NUMBER,BIGDECIMAL:i.NUMBER,DATE:i.DATE,DATETIME:i.DATETIME,NANO_TIMESTAMP:i.NANO_TIMESTAMP}},48707:(e,t,s)=>{s.d(t,{X:()=>n,a:()=>a});var i=s(39087),r=s(17465),o=s(41119);const n=e=>e?e.map((e=>{const t={name:e.NAME,type:o.v[e.TYPE]||o.w.STRING};if(e.TYPE===o.w.ENUM&&e.VALID_VALUES)try{t.enumOptions=Array.isArray(e.VALID_VALUES)?e.VALID_VALUES:e.VALID_VALUES.split("|")}catch(e){r.v.error(e),t.enumOptions=[]}return t})):null,a=e=>{var t;const s=null==e?void 0:e.TYPE;if(s===i.v.DATASERVER)return e.FIELD||[];if(s===i.v.REQUEST_SERVER)return e.REPLY_FIELD||(null===(t=e.REPLY)||void 0===t?void 0:t.FIELD)||[];throw new Error(`Unsupported resource type: ${s}`)}},98316:(e,t,s)=>{s.d(t,{N:()=>o});var i=s(84674);class r{constructor(){this.storageKeyPrefix="",this.returnUrl=this.getSessionStorageItem("returnUrl")||""}deleteUserFromSessionStorage(){["authToken","refreshToken","sessionId","ssoToken"].forEach((e=>this.removeSessionStorageItem(e))),this.removeLocalStorageItem("refreshToken")}setStorageKeyPrefix(e){this.storageKeyPrefix=`${e.replace(/\s/g,"")}/`}setAuthResult(e){var t;this.setSessionStorageItem("authToken",e.SESSION_AUTH_TOKEN),this.setSessionStorageItem("refreshToken",e.REFRESH_AUTH_TOKEN),this.setSessionStorageItem("username",e.USER_NAME),this.setSessionStorageItem("sessionId",e.SESSION_ID),(null===(t=e.DETAILS)||void 0===t?void 0:t.MFA_CODE)&&this.setSessionStorageItem("mfaToken",e.DETAILS.MFA_CODE)}captureReturnUrl(){const{pathname:e,search:t,hash:s}=location;if(e&&(e.includes("/login")||e.includes("/auth")))return;const i=`${"/"!==e?e:""}`;this.returnUrl=`${i}${t}${s}`,this.setSessionStorageItem("returnUrl",this.returnUrl)}setItem(e,t,s){"local"===s?localStorage.setItem(this.storageKeyPrefix+e,t):sessionStorage.setItem(this.storageKeyPrefix+e,t)}getItem(e,t){return"local"===t?localStorage.getItem(this.storageKeyPrefix+e):sessionStorage.getItem(this.storageKeyPrefix+e)}removeItem(e,t){"local"===t?localStorage.removeItem(this.storageKeyPrefix+e):sessionStorage.removeItem(this.storageKeyPrefix+e)}setLocalStorageItem(e,t){this.setItem(e,t,"local")}setSessionStorageItem(e,t){this.setItem(e,t,"session")}getLocalStorageItem(e){return this.getItem(e,"local")}getSessionStorageItem(e){return this.getItem(e,"session")}removeLocalStorageItem(e){this.removeItem(e,"local")}removeSessionStorageItem(e){this.removeItem(e,"session")}}const o=i.DI.createInterface((e=>e.singleton(r)))},17465:(e,t,s)=>{s.d(t,{v:()=>r});var i=s(57343);const r=(0,i.createLogger)("foundation-comms")},92277:(e,t,s)=>{s.d(t,{KJ:()=>E});var i=s(84225),r=s(17190),o=s(33681),n=s(84674),a=s(79780);const c=(0,s(57343).createLogger)("foundation-user"),d={trackActionExclusions:[],trackPathExclusions:[""],setUser(e,t){if(e.isAuthenticated)throw new Error("User already set. If this is intentional, please call User.unset first.");return c.debug("setUser",t),e.rawProperties=structuredClone(t),e.userKVs=t.userKVs,e.details=t.details,e.permission=t.permission,e.profile=t.profile,e.sourceRef=t.sourceRef,e.userName=t.userName,e.isAuthenticated=!0,e},unsetUser:e=>(c.debug("unsetUser"),e.rawProperties=void 0,e.userKVs=void 0,e.details=void 0,e.permission=void 0,e.profile=void 0,e.sourceRef=void 0,e.userName=void 0,e.isAuthenticated=!1,e)},h=n.DI.createInterface((e=>e.instance(d))),l=(0,a.Es)("genesis-user");class u{constructor(){this.pathHistory=[],this.actionHistory=[],this.isAuthenticated=!1,this.authenticationChangeListeners=(0,r.r)()}set(e){return this.config.setUser(this,e)}unset(){return this.config.unsetUser(this)}get isAnonymous(){return!this.isAuthenticated}isAdmin(){return this.hasProfile("ADMIN")}isBanned(){return this.hasProfile("BANNED")}hasPermission(e){return this.hasKey(this.permission,e)}hasProfile(e){return this.hasKey(this.profile,e)}trackPath(){const{pathname:e,search:t,hash:s}=location,i=`${`${"/"!==e?e:""}`}${t}${s}`;if(!this.config.trackPathExclusions.includes(i))return this.pathHistory.push(i),i}clearPaths(){this.pathHistory=[]}lastPath(){const e=this.pathHistory.length;return e>0?this.pathHistory[e-1]:void 0}trackAction(e){this.config.trackActionExclusions.includes(e)||this.actionHistory.push(e)}clearActions(){this.actionHistory=[]}lastAction(){const e=this.actionHistory.length;return e>0?this.actionHistory[e-1]:void 0}clearTrackingHistory(){this.clearPaths(),this.clearActions()}hasKey(e,t){return!!(e&&e.length&&t)&&(Array.isArray(t)||(t=[t]),t.some((t=>e.includes(t))))}addAuthenticationChangeListener(e){var t;return null===(t=this.authenticationChangeListeners)||void 0===t?void 0:t.subscribe(e)}isAuthenticatedChanged(){var e;null===(e=this.authenticationChangeListeners)||void 0===e||e.publish(new CustomEvent("user-authentication-change",{detail:this.isAuthenticated}));const t=n.DI.getOrCreateDOMContainer().get(l);t.postMessage("user-authentication-change",this.isAuthenticated),t.close()}userNameChanged(){o.Observable.notify(this,"username")}get username(){return o.Observable.track(this,"username"),this.userName}permissionChanged(){o.Observable.notify(this,"permissions")}get permissions(){return o.Observable.track(this,"permissions"),this.permission}profileChanged(){o.Observable.notify(this,"profiles")}get profiles(){return o.Observable.track(this,"profiles"),this.profile}hasAdminProfile(){return this.isAdmin()}}(0,i.__decorate)([h],u.prototype,"config",void 0),(0,i.__decorate)([o.observable],u.prototype,"pathHistory",void 0),(0,i.__decorate)([o.observable],u.prototype,"actionHistory",void 0),(0,i.__decorate)([o.observable],u.prototype,"isAuthenticated",void 0),(0,i.__decorate)([o.observable],u.prototype,"userKVs",void 0),(0,i.__decorate)([o.observable],u.prototype,"details",void 0),(0,i.__decorate)([o.observable],u.prototype,"permission",void 0),(0,i.__decorate)([o.observable],u.prototype,"profile",void 0),(0,i.__decorate)([o.observable],u.prototype,"sourceRef",void 0),(0,i.__decorate)([o.observable],u.prototype,"userName",void 0),(0,i.__decorate)([o.observable],u.prototype,"rawProperties",void 0);const E=n.DI.createInterface((e=>e.singleton(u)))},68424:(e,t,s)=>{s.d(t,{J:()=>o});var i=s(28745);function r(e){const t=[],s=new Set;return function e(i){const r=Array.from(i.querySelectorAll("*"));t.push(...r),r.forEach((t=>{t.shadowRoot&&!s.has(t.shadowRoot)&&(s.add(t.shadowRoot),e(t.shadowRoot))}))}(e),t}function o(e,t){let s=e;for(;s;){const e=s.tagName.toLowerCase();if(e.endsWith("-design-system-provider")){const t=e.split("-design-system-provider")[0];if(t)return i.v.debug(`Found provider by ancestor search: ${e}, prefix: ${t}`),t}s=s.parentElement?s.parentElement:s.getRootNode&&s.getRootNode()instanceof ShadowRoot?s.getRootNode().host:null}const o=document.querySelectorAll('[class*="-design-system-provider"],[id*="-design-system-provider"]'),n=Array.from(o),a=r(document).filter((e=>{var t;const s=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();return(null==s?void 0:s.endsWith("-design-system-provider"))||!1}));if(n.push(...a),n.length>0){const e=n[0].tagName.toLowerCase(),t=e.split("-design-system-provider")[0];if(t)return i.v.debug(`Found provider by document search: ${e}, prefix: ${t}`),t}return i.v.debug(`No provider found. Falling back to ${t}.`),t}},40729:(e,t,s)=>{s.d(t,{O:()=>d});var i=s(33681);const r=new Map([["FAST-TEXT-AREA","input"],["FAST-TEXT-FIELD","input"],["FOUNDATION-TEXT-AREA","input"],["FOUNDATION-TEXT-FIELD","input"],["INPUT","input"],["ZERO-TEXT-FIELD","input"]]);function o(e){this.keyAttr||(this.target[this.targetName]=e)}function n(e,t){this.keyAttr&&(this.updateTarget=o),this.originalBind.call(this,e,t),this.target.addEventListener(this.changeEvent,this.changeHandler)}function a(){this.originalUnbind.call(this),this.target.removeEventListener(this.changeEvent,this.changeHandler)}class c extends i.HTMLBindingDirective{constructor(e,t,s,i){super(e),this.keyAttr=i,this.conversionType=t,this.eventName=s}createBehavior(e){const t=super.createBehavior(e);return t.originalBind=t.bind,t.originalUnbind=t.unbind,t.keyAttr=this.keyAttr,t.bind=n,t.unbind=a,t.changeEvent=function(e,t){var s;const i=e.tagName;return"default"===t?null!==(s=r.get(i))&&void 0!==s?s:"change":t}(e,this.eventName),t.changeHandler=()=>{const e="boolean"===this.conversionType?t.target.checked:t.target.value;if(this.keyAttr){const s=t.bindingObserver.last,i=t.target[this.keyAttr];s.propertySource[s.propertyName][i]=this.convert(e)}else{const s=t.bindingObserver.last;s.propertySource[s.propertyName]=this.convert(e)}},t}convert(e){if(null==e)return e;switch(this.conversionType){case"time":const t=new Date(e).getTime();return isNaN(t)?void 0:t;case"number":return e.length?Number(e):void 0;case"string":return String(e);case"boolean":return Boolean(e);default:return e}}}function d(e,t="string",s="default",i){return new c(e,t,s,i)}},84686:(e,t,s)=>{s.d(t,{Be:()=>_,H6:()=>O,OB:()=>r,PF:()=>o,aW:()=>E,vN:()=>a});let i="webpack";try{i="webpack"}catch(e){}let r="/";try{r="auto".replace(/\/$/,"")}catch(e){}let o,n="gwf";try{"undefined"!=typeof SOCKET_EXT&&(n=SOCKET_EXT)}catch(e){}try{o=FORCE_HTTP}catch(e){}const a=`${location.protocol.replace("http","ws")}//${location.host}${r}/${n}/`;"true"===o?location.protocol:location.protocol.replace("http","ws");let c,d,h,l,u=null;try{"undefined"!=typeof API_HOST&&(u=API_HOST)}catch(e){}try{c=""}catch(e){}try{d=DEFAULT_ORGANISATION}catch(e){}try{h=DEFAULT_PASSWORD}catch(e){}try{l=DEFAULT_USER}catch(e){}let E="gwf/event-login-auth";"undefined"!=typeof GENX_LOGIN_URL&&(E=GENX_LOGIN_URL);let g="gwf/event-login-auth";"undefined"!=typeof GENX_LOGIN_REFRESH_URL&&(g=GENX_LOGIN_REFRESH_URL);let _="gwf/event-login-details";"undefined"!=typeof GENX_LOGIN_DETAILS_URL&&(_=GENX_LOGIN_DETAILS_URL);let v="gwf/event-logout";"undefined"!=typeof GENX_LOGOUT_URL&&(v=GENX_LOGOUT_URL);let S="gwf/event-change-user-password";"undefined"!=typeof GENX_CHANGE_PASSWORD_URL&&(S=GENX_CHANGE_PASSWORD_URL);let m="gwf/event-self-service-password-reset";"undefined"!=typeof GENX_FORGOT_PASSWORD_URL&&(m=GENX_FORGOT_PASSWORD_URL);let p="gwf/event-password-reset-action";"undefined"!=typeof GENX_RESET_PASSWORD_URL&&(p=GENX_RESET_PASSWORD_URL);let R="gwf/sso/list";"undefined"!=typeof GENX_SSO_LIST_URL&&(R=GENX_SSO_LIST_URL);let T="gwf/{type}/login?idp={id}";"undefined"!=typeof GENX_SSO_LOGIN_URL&&(T=GENX_SSO_LOGIN_URL);let O="default";"undefined"!=typeof GENX_ENVIRONMENT_LEVEL&&(O=GENX_ENVIRONMENT_LEVEL)},12066:(e,t,s)=>{s.d(t,{CL:()=>r,Ey:()=>a,zT:()=>n});const i=10;function r(e){return!e||isNaN(e)?null:new Date(e).toISOString().slice(0,i)}const o=19;function n(e){return!e||isNaN(e)?null:new Date(e).toISOString().slice(0,o).replace("T"," ")}function a(e,t){return t?n(e):r(e)}},17190:(e,t,s)=>{s.d(t,{j:()=>r,r:()=>i});const i=()=>{let e=[];return{subscribe:t=>(e.push(t),()=>e=e.filter((e=>e!==t))),publish(t){e.forEach((e=>e(t)))}}},r=(e,t)=>{const s={root:document.documentElement};new IntersectionObserver((e=>{e.forEach((e=>{t(e.intersectionRatio>0)}))}),s).observe(e)}},49229:(e,t,s)=>{s.d(t,{b_:()=>h});var i=s(17914),r=s(84674),o=s(61455);const n=r.DI.createInterface();function a(e){return Number.isSafeInteger(+e)?Number(e):(0,o.Fq)(e)?BigInt.asIntN(64,e):parseFloat(e)}const c={parse:e=>(0,o.qg)(e,null,a),stringify:e=>(0,o.As)(e)};let d=class{constructor(e=c){this.config=e,this.serialize=e=>this.config.stringify(e)}deserialize(e){return e?"string"==typeof e?this.config.parse(e):e&&e.ok?e.text().then((e=>this.config.parse(e))):(e&&e.data&&(e=e.data),this.config.parse(e)):Promise.resolve({})}};d=(0,i.__decorate)([(0,i.__param)(0,(0,r.optional)(n))],d);const h=r.DI.createInterface((e=>e.singleton(d)))},32808:(e,t,s)=>{s.d(t,{k:()=>c});var i=s(17914),r=s(84674),o=s(31261),n=s(28745);class a{constructor(){}createId(e=!1){const t=(0,o.A)();return e&&n.v.debug(`UUID.createID ${t}`),t}createRemoteId(e=!1){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=(0,o.A)();return e&&n.v.debug(`UUID.createRemoteID ${t}`),t}))}}const c=r.DI.createInterface((e=>e.singleton(a)))}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_genesislcap_design_system_configurator=self.webpackChunk_genesislcap_design_system_configurator||[]).push([[1656],{79780:(e,t,s)=>{s.d(t,{Es:()=>o});var i=s(84674);class r extends BroadcastChannel{constructor(){super(...arguments),this.postMessage=(...e)=>{const[t,s]=e;super.postMessage({type:t,detail:s})},this.isMessageType=(e,t)=>{var s;return(null===(s=t.data)||void 0===s?void 0:s.type)===e}}}const o=e=>{class t extends r{constructor(){super(e)}}return i.DI.createInterface((e=>e.transient(t)))}},40113:(e,t,s)=>{s.d(t,{N:()=>L});var i=s(8202),r=s(92277),o=s(33681),n=s(84674),a=s(97156),c=s(26347),d=s(21281),h=s(10447),l=s(56653),u=s(98316),E=s(17465);const g=n.DI.createInterface();function _(){return(null===navigator||void 0===navigator?void 0:navigator.credentials)?"PasswordCredential"in window||(E.v.warn("PasswordCredential not available in this browser."),!1):(E.v.warn("CredentialsContainer not available in this browser."),!1)}const v=":";function S(e="",t=v,s){return e.split(t,s).map((e=>e.trim())).filter((e=>""!==e))}function m(e,t=v){const s="string"==typeof e&&e.trim();return!!s&&s.includes(t)}function p(e,t=v){return"string"==typeof e&&e.trim()?(e.match(new RegExp(t,"g"))||[]).length:0}function R(e,t=v){for(const s of e)if(m(s,t))return s;return e.find((e=>"string"==typeof e&&!!e.trim()))}function T(e,t,s){const i="string"==typeof e&&e.trim();return!i||s&&!i.includes(s)||p(i)>1?s&&t&&s!==t?`${t}:${s}`:t||s:i}function O(e="credential"){E.v.warn(`Unable to migrate legacy ${e} to latest format. Please remove from your browser.`)}const A={password:!0,mediation:"optional"},f={cookie:{path:"/",name:"credentials",expires:7300,storePasswords:!1}};let I=class{constructor(e,t=f){this.session=e,this.config=t}createBasicCredentials(e){return{type:l.h.BASIC,username:e.username,password:e.password,mfaToken:this.getMFAToken()}}createRefreshCredentials(e){var t,s,i;return{type:l.h.REFRESH,username:null!==(t=null==e?void 0:e.username)&&void 0!==t?t:this.getUsername(),refreshToken:null!==(s=null==e?void 0:e.refreshToken)&&void 0!==s?s:this.getRefreshToken(),mfaToken:null!==(i=null==e?void 0:e.mfaToken)&&void 0!==i?i:this.getMFAToken()}}createSSOCredentials(e){var t;return{type:l.h.SSO,ssoToken:null!==(t=null==e?void 0:e.ssoToken)&&void 0!==t?t:this.getSSOToken()}}validateBasicCredentials(e){return e&&!!e.username&&!!e.password}validateRefreshCredentials(e){return e&&!!e.refreshToken&&!!e.username}validateSSOCredentials(e){return e&&!!e.ssoToken}validateUserCredentialData(e,t){const s=e&&!!e.id&&!!e.name&&!e.name.includes(v)&&p(e.id)<=1;return t?s&&!!e.password:s}normaliseLegacyCredentialData(e,t){if(this.validateUserCredentialData(e,!0))return[e,!0];if(this.validateUserCredentialData(t))return[t,!1];if(e)try{const t=e,[s]=S(t.name||t.id),[i,r]=S(R([t.id,t.name]));return[{id:T(t.id||t.name,s,r),name:s,password:t.password||""},!0]}catch(e){O("PasswordCredential")}if(t)try{const e=t,[s]=S(e.name||e.username||e.organisation),[i,r]=S(R([e.organisation||e.username||e.name]));return[{id:T(e.id||e.username||e.name,s,r),name:s,password:e.password||""},!1]}catch(e){O("cookie")}return[void 0,!1]}storeCredentialsInContainer(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(!_())return;const t=new PasswordCredential(e);return E.v.debug("Storing credentials in CredentialsContainer"),navigator.credentials.store(t)}))}getCredentialsFromContainer(e=A){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(_())return E.v.debug("Getting credentials from CredentialsContainer"),yield navigator.credentials.get(e)}))}storeCredentialsInCookie(e){const{password:t}=e,s=(0,i.__rest)(e,["password"]),r=this.config.cookie.storePasswords?e:s;return E.v.debug("Storing credentials in cookie"),!!h.A.set(this.config.cookie.name,JSON.stringify(r),{expires:this.config.cookie.expires,domain:location.hostname,path:this.config.cookie.path,secure:!0})}getCredentialsFromCookie(){E.v.debug("Getting credentials from cookie");const e=h.A.get(this.config.cookie.name);return e?JSON.parse(e):void 0}storeCredentials(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(_()){const t=yield this.storeCredentialsInContainer(e);return Promise.resolve(!!t)}return Promise.resolve(this.storeCredentialsInCookie(e))}))}getCredentials(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return _()?this.getCredentialsFromContainer(e):Promise.resolve(this.getCredentialsFromCookie())}))}getSSOToken(){return this.session.getSessionStorageItem("ssoToken")}getUsername(){return this.session.getSessionStorageItem("username")||this.session.getLocalStorageItem("username")}getRefreshToken(){return this.session.getSessionStorageItem("refreshToken")||this.session.getLocalStorageItem("refreshToken")}getMFAToken(){return this.session.getSessionStorageItem("mfaToken")}removeCookie(){h.A.remove(this.config.cookie.name,{domain:location.hostname,path:this.config.cookie.path})}removeSSOToken(){this.session.removeSessionStorageItem("ssoToken")}removeUsername(){this.session.removeSessionStorageItem("username"),this.session.removeLocalStorageItem("username")}removeRefreshToken(){this.session.removeSessionStorageItem("refreshToken"),this.session.removeLocalStorageItem("refreshToken")}removeMFAToken(){this.session.removeSessionStorageItem("mfaToken")}removeAll(){this.removeCookie(),this.removeSSOToken(),this.removeUsername(),this.removeRefreshToken(),this.removeMFAToken()}preventSilentAccess(){return _()&&navigator.credentials.preventSilentAccess()}};I=(0,i.__decorate)([(0,i.__param)(0,u.N),(0,i.__param)(1,(0,n.optional)(g))],I);const M=n.DI.createInterface((e=>e.singleton(I))),b=e=>Array.isArray(e)?e.map((e=>null!=e?e:"")):[],N=e=>{try{if("EVENT_LOGIN_AUTH_ACK"===(null==e?void 0:e.MESSAGE_TYPE)){const{DETAILS:i}=e;return{messageType:e.MESSAGE_TYPE,sourceRef:e.SOURCE_REF,userName:e.USER_NAME,updateQueue:e.UPDATE_QUEUE,zeroMqProxyModeEnabled:e.ZERO_MQ_PROXY_MODE_ENABLED,zeroMqProxyInboundPort:e.ZERO_MQ_PROXY_INBOUND_PORT,zeroMqProxyOutboundPort:e.ZERO_MQ_PROXY_OUTBOUND_PORT,userKVs:e.USER,details:i?{system:(s=i.SYSTEM,s?{date:s.DATE}:null),heartbeatIntervalSecs:i.HEARTBEAT_INTERVAL_SECS,failedLoginAttempts:i.FAILED_LOGIN_ATTEMPTS,rejectedLoginAttempts:i.REJECTED_LOGIN_ATTEMPTS,lastLoginDatetime:i.LAST_LOGIN_DATETIME,daysToPasswordExpiry:i.DAYS_TO_PASSWORD_EXPIRY,product:(t=i.PRODUCT,t?t.map((e=>({name:e.NAME,version:e.VERSION}))):[])}:null,permission:b(e.PERMISSION),profile:b(e.PROFILE)}}throw new Error("No Entity mapping implementation for provided DTO")}catch(e){throw E.v.error(e),e}var t,s};let C=class{loggedUserResultChanged(){var e;null===(e=this.isLoggedInSubject)||void 0===e||e.next(this.isLoggedIn)}get isLoggedIn$(){return this.isLoggedInSubject.asObservable()}get isLoggedIn(){return this.currentUser.isAuthenticated}constructor(e,t,s,i,r){this.session=e,this.connect=t,this.messageBuilder=s,this.credentialManager=i,this.currentUser=r,this.isWorking=!1,this.isLoggedInSubject=new a.t(this.isLoggedIn),this.currentUser.addAuthenticationChangeListener((e=>{var t;null===(t=this.isLoggedInSubject)||void 0===t||t.next(e.detail)}))}login(e){var t;return(0,i.__awaiter)(this,void 0,void 0,(function*(){this.isWorking=!0;try{const s=this.messageBuilder.createLoginMessage(e),i=yield this.connect.send(s);if(!i||i.ERROR||(null===(t=i.DETAILS)||void 0===t?void 0:t.ERROR))throw new l.l(s,i);this.applyAuthResults({authToken:i.SESSION_AUTH_TOKEN,refreshToken:i.REFRESH_AUTH_TOKEN,profiles:i.PROFILE,username:i.USER_NAME,permissions:i.PERMISSION,sessionId:i.SESSION_ID}),this.currentUser.set(N(i)),this.session.setAuthResult(i),E.v.debug("Login Authentication Result:",i)}catch(e){if(E.v.error("Login Authentication Error:",e),!(e instanceof l.l&&e.isIgnorableError()))throw this.removeAuthResults(),this.currentUser.unset(),e;E.v.warn("Ignoring authentication error as it is a known edge case.")}finally{this.isWorking=!1}return this.loggedUserResult}))}logout(){var e;return(0,i.__awaiter)(this,void 0,void 0,(function*(){this.isWorking=!0;let t={success:!1};try{const s=this.messageBuilder.createLogoutMessage(this.loggedUserResult);this.session.deleteUserFromSessionStorage();const{CODE:i,DETAILS:r,ERROR:o,MESSAGE_TYPE:n,OIDC_LOGOUT_URL:a}=yield this.connect.send(s),c=null!==(e=null==r?void 0:r.ERROR)&&void 0!==e?e:o,h=n===d.Go.LOGOUT_NACK;h&&E.v.warn("Unexpected Logout NACK received during logout.",c),t={success:n===d.Go.LOGOUT_ACK||i===d.x6.SESSION_NOT_FOUND||!h,error:c},a&&window.open(a,"_self")}catch(e){const s=new l.l(e.sentMessage,e.receivedMessage);if(E.v.error("Logout Authentication Error:",s),!s.isIgnorableError())throw e;E.v.warn("Ignoring authentication error as it is a known edge case."),t.success=!0}finally{this.removeAuthResults(),this.currentUser.unset(),this.isWorking=!1}return t}))}reAuthFromSession(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const e=yield this.ensureConnection(),t=this.credentialManager.createRefreshCredentials();if(e&&this.credentialManager.validateRefreshCredentials(t)){const e=this.messageBuilder.createRefreshTokenMessage(),t=yield this.connect.send(e);if((null==t?void 0:t.MESSAGE_TYPE)===d.Gp.EVENT_LOGIN_AUTH_ACK)return this.session.setAuthResult(t),this.currentUser.set(N(t)),this.applyAuthResults(this.getLoggedUserFromMessage(t)),!0}return this.session.deleteUserFromSessionStorage(),this.currentUser.unset(),!1}))}ensureConnection(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(this.connect.isConnected)return!0;const e=this.session.getSessionStorageItem("hostUrl");return!!e&&this.connect.connect(e)}))}getLoggedUserFromMessage(e){const t=e.USER_NAME,s=e.SESSION_AUTH_TOKEN,i=e.REFRESH_AUTH_TOKEN;return t&&s&&i?{username:t,authToken:s,refreshToken:i,profiles:e.PROFILE,permissions:e.PERMISSION,sessionId:e.SESSION_ID}:null}applyAuthResults(e){e?this.loggedUserResult={authToken:e.authToken,refreshToken:e.refreshToken,profiles:e.profiles,username:e.username,permissions:e.permissions,sessionId:e.sessionId}:this.removeAuthResults()}removeAuthResults(){this.loggedUserResult=null}};(0,i.__decorate)([o.observable],C.prototype,"isWorking",void 0),(0,i.__decorate)([o.observable],C.prototype,"loggedUserResult",void 0),C=(0,i.__decorate)([(0,i.__param)(0,u.N),(0,i.__param)(1,c.dm),(0,i.__param)(2,d.lT),(0,i.__param)(3,M),(0,i.__param)(4,r.KJ)],C);const L=n.DI.createInterface((e=>e.singleton(C)))},56653:(e,t,s)=>{var i;s.d(t,{h:()=>i,l:()=>r}),function(e){e.BASIC="BASIC",e.SSO="SSO",e.JWT="JWT",e.REFRESH="REFRESH"}(i||(i={}));class r extends Error{constructor(e,t,s="Auth Failed \n"){super(s),this.sent=e,this.received=t,Object.setPrototypeOf(this,r.prototype)}isIgnorableError(){var e,t,s,i,r,o,n,a;return!!(null===(i=null===(s=null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)||void 0===s?void 0:s.toLowerCase())||void 0===i?void 0:i.includes("request needs the user to be logged"))||!!(null===(a=null===(n=null===(o=null===(r=this.received)||void 0===r?void 0:r.DETAILS)||void 0===o?void 0:o.ERROR)||void 0===n?void 0:n.toLowerCase())||void 0===a?void 0:a.includes("is not logged in"))}getMessageError(){var e,t;return Array.isArray(null===(e=this.received)||void 0===e?void 0:e.ERROR)?null===(t=this.received)||void 0===t?void 0:t.ERROR.map((e=>this.errorDetailFormatter(e))).join("\n"):""}getDetailsError(){var e,t,s,i;return Array.isArray(null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)?null===(i=null===(s=this.received)||void 0===s?void 0:s.DETAILS)||void 0===i?void 0:i.ERROR.map((e=>this.errorDetailFormatter(e))).join("\n"):""}hasPasswordExpiredError(){return this.hasErrorCode("PASSWORD_EXPIRED")}hasMFAError(){return this.hasErrorCode("MFA_REQUIRED")||this.hasErrorCode("MFA_FAILED")}hasErrorCode(e){var t,s;return!!Array.isArray(null===(t=this.received)||void 0===t?void 0:t.ERROR)&&(null===(s=this.received)||void 0===s?void 0:s.ERROR.some((t=>t.CODE===e)))}errorDetailFormatter(e){return`\n ${e.CODE}: \n ${e.TEXT}`}}},24669:(e,t,s)=>{s.d(t,{EQ:()=>a,a4:()=>n});var i=s(17190),r=s(84674);class o{constructor(){this.streamListeners=(0,i.r)(),this.streamCompleteListeners=(0,i.r)(),this.streamErrorListeners=(0,i.r)(),this.commitListeners=(0,i.r)(),this.metadataListeners=(0,i.r)(),this.commitResponseListeners=(0,i.r)()}addStreamListener(e,t,s){var i,r,o;const n=null===(i=this.streamListeners)||void 0===i?void 0:i.subscribe(e),a=null===(r=this.streamCompleteListeners)||void 0===r?void 0:r.subscribe(t),c=null===(o=this.streamErrorListeners)||void 0===o?void 0:o.subscribe(s);return()=>{n(),a(),c()}}onStreamEvent(e,t,s,i){var r;null===(r=this.streamListeners)||void 0===r||r.publish(new CustomEvent("connect-stream-event",{detail:{functions:i,message:t,resourceName:e,stream:s}}))}onStreamErrorEvent(e,t,s){var i;null===(i=this.streamErrorListeners)||void 0===i||i.publish(new CustomEvent("connect-stream-error-event",{detail:{resourceName:e,stream:t,error:s}}))}onStreamCompleteEvent(e,t){var s;null===(s=this.streamCompleteListeners)||void 0===s||s.publish(new CustomEvent("connect-stream-complete-event",{detail:{resourceName:e,stream:t}}))}addCommitListener(e){var t;return null===(t=this.commitListeners)||void 0===t?void 0:t.subscribe(e)}onCommitEvent(e,t){var s;null===(s=this.commitListeners)||void 0===s||s.publish(new CustomEvent("connect-commit-event",{detail:{eventName:e,message:t}}))}addMetadataListener(e){var t;return null===(t=this.metadataListeners)||void 0===t?void 0:t.subscribe(e)}onMetadataEvent(e,t,s){var i;null===(i=this.metadataListeners)||void 0===i||i.publish(new CustomEvent("connect-metadata-event",{detail:{resourceName:e,message:t,error:s}}))}addCommitResponseListener(e){var t;return null===(t=this.commitResponseListeners)||void 0===t?void 0:t.subscribe(e)}onCommitResponseEvent(e,t){var s;null===(s=this.commitResponseListeners)||void 0===s||s.publish(new CustomEvent("connect-commit-response-event",{detail:{eventName:e,response:t}}))}}const n=r.DI.createInterface((e=>e.singleton(o))),a=r.DI.createInterface((e=>e.aliasTo(n)))},26347:(e,t,s)=>{s.d(t,{dm:()=>w,tn:()=>P});var i=s(8202),r=s(84686),o=s(33681),n=s(84674),a=s(77909);class c{constructor(){this.cachedMetadata=new Map,this.cachedJsonSchema=new Map}getMetadataFor(e){return this.cachedMetadata.get(e)}getJsonSchemaFor(e){return this.cachedJsonSchema.get(e)}hasMetadataFor(e){return this.cachedMetadata.has(e)}hasJsonSchemaFor(e){return this.cachedJsonSchema.has(e)}setMetadataFor(e,t){this.cachedMetadata.set(e,t)}setJsonSchemaFor(e,t){this.cachedJsonSchema.set(e,t)}}const d=n.DI.createInterface((e=>e.singleton(c)));var h=s(17465),l=s(24669),u=s(49587),E=s(49229),g=s(97156),_=s(7827),v=s(1762),S=s(84190),m=s(78213),p=s(66640),R=s(16220),T=s(98316),O=s(32748);const A={polling:Object.assign({POLLING_MAP:{EVENT_AMEND_USER:{TEMP_FREQUENCY:500,AMOUNT_OF_POLLS:5,QUERIES:["ALL_USERS"]}},POLLING_INTERVAL_MAP:{ALL_TRADES:5e3,ALL_USERS:5e3,ALL_PROCESSES_STATUS:1e4},POLLING_FREQUENCY:5e3},{})},f=n.DI.createInterface((e=>e.instance(A)));var I=s(21281);const M=(e,t)=>((null==t?void 0:t.ROW)&&e&&e.length>0?t.ROW.forEach((t=>{const s=t;if(s&&s.DETAILS){const i=s.DETAILS.ROW_REF,r=s.DETAILS.OPERATION;"INSERT"===r&&(e.find((e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===i}))||e.unshift(s)),"DELETE"===r&&(e=e.filter((e=>{var s,i;return(null===(s=t.DETAILS)||void 0===s?void 0:s.ROW_REF)!==(null===(i=e.DETAILS)||void 0===i?void 0:i.ROW_REF)}))),"MODIFY"===r&&(e=e.map((e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===i?Object.assign(Object.assign({},e),s):e})))}})):!t||e&&0!==e.length||(e=[...new Set(t.ROW)]),e);let b=class e{get isConnected(){return this._isConnected}set isConnected(e){this._isConnected=e,this.isConnectedSubject.next(this._isConnected)}constructor(e,t,s,i,r,o){var n;this.http=e,this.messageBuilder=t,this.session=s,this.metaCache=i,this.serializer=r,this.config=o,this.isWorking=!1,this._isConnected=!1,this.isConnectedSubject=new g.t(this._isConnected),this.isConnected$=null===(n=this.isConnectedSubject)||void 0===n?void 0:n.asObservable(),this.ongoingTurbo={},this.streams=new Map}checkHost(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){try{return this.getMessage({MESSAGE_TYPE:I.Go.HEARTBEAT_PING,SOURCE_REF:"host check"}).then((e=>e.MESSAGE_TYPE===I.Go.HEARTBEAT_PONG))}catch(e){return h.v.error(e),!1}}))}send(t,s){return this.http.post(e.getUrl(this.host,t),{body:e.getBody(t),headers:this.messageBuilder.createHTTPHeadersFromMessage(t)})}httpMode(){return!0}setValidSession(e){h.v.deprecated("setValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}connect(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return this.host=e,this.host.endsWith("/")||(this.host=this.host.concat("/")),this.checkHost().then((e=>(this.isConnected=e,this.session.setSessionStorageItem("hostUrl",this.host),e)))}))}disconnect(){this.isConnected=!1,this.streams.clear(),this.ongoingTurbo={},this.host=void 0}snapshot(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=this.messageBuilder.createDataLogonMessage(e,t);return h.v.debug(`HTTP MODE - ${s.MESSAGE_TYPE} (snapshot) message created -> `,s),this.send(s).then((e=>(this.dataLogoff(s.SOURCE_REF).catch((e=>h.v.error(e))),e)))}))}stream(e,t,s,i){const r=this.messageBuilder.createDataLogonMessage(e,i);h.v.debug(`HTTP MODE - ${r.MESSAGE_TYPE} (stream) message created -> `,r);const o=r.SOURCE_REF;this.streams.set(o,{SOURCE_REF:o,POLLING_FREQUENCY:new g.t(this.config.polling.POLLING_FREQUENCY),RESOURCE_NAME:e});const n=this.streams.get(o).POLLING_FREQUENCY,a=(0,_.x)((0,v.H)(this.send(r)),n.pipe((0,S.n)((e=>(0,m.Y)(e)))).pipe((0,S.n)((()=>(0,v.H)(this.getMessage(r)))))).pipe((0,p.v)((()=>this.streams.has(o))),(0,R.j)((()=>{h.v.debug(`Terminating stream for ${e} - ${o}`),this.dataLogoff(o)})));return this.streams.get(o).STREAM=a,a}streamState(e,t=(()=>{}),s=(()=>{}),i,r=[]){return this.stream(e,t,s,i).pipe((0,a.S)(M,r))}streamWithoutAutoTeardown(e,t,s,i){return h.v.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0"),this.stream(e,t,s,i)}getMessage(t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return this.http.get(e.getUrl(this.host,t),{headers:this.messageBuilder.createHTTPHeadersFromMessage(t)})}))}getMoreRows(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createMoreRowsMessage(e);return h.v.debug(`HTTP MODE - ${t.MESSAGE_TYPE} message created -> `,t),this.send(t)}))}getMoreColumns(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.send(t)}))}dataLogoff(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return this.send(t).then((t=>(this.streams.has(e)&&(h.v.debug(`Removing stream ${e}`),this.streams.delete(e)),t)))}))}getMetadata(e,t=!0){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createMetaRequestMessage(e);return h.v.debug(`HTTP MODE - ${t.MESSAGE_TYPE} (metadata) message created -> `,t),this.send(t).then((e=>e.DETAILS))}))}getJSONSchema(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createMetaRequestMessage(e,I.Gp.JSON_SCHEMA_REQUEST);return h.v.debug(`HTTP MODE! - ${t.MESSAGE_TYPE} (json schema) message created -> `,t),this.send(t)}))}request(e,t){const s=this.messageBuilder.createRequestMessage(e,t);return h.v.debug(`HTTP MODE! - ${s.MESSAGE_TYPE} (request server) message created -> `,s),this.send(s)}getAvailableResources(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createResourcesMessage(e);return h.v.debug(`HTTP MODE! - ${t.MESSAGE_TYPE} (getResources) message created -> `,t),this.send(t)}))}commitEvent(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=this.messageBuilder.createCommitMessage(e,t);return h.v.debug(`HTTP MODE! - ${s.MESSAGE_TYPE} (commit) message created -> `,s),this.send(s).then((t=>(this.maybeTurbo(e,t),t)))}))}maybeTurbo(e,t){var s;if(!(null===(s=null==t?void 0:t.MESSAGE_TYPE)||void 0===s?void 0:s.endsWith("_ACK")))return;if(this.ongoingTurbo[e])return void h.v.debug(`${e} polling frequency is already accelerated.`);const i=this.config.polling.POLLING_MAP[e];if(!(null==i?void 0:i.TEMP_FREQUENCY)||!i.AMOUNT_OF_POLLS)return;const r=i.TEMP_FREQUENCY,o=r*i.AMOUNT_OF_POLLS,n=JSON.parse(JSON.stringify(this.config.polling.POLLING_INTERVAL_MAP)),a=JSON.parse(JSON.stringify(this.config.polling.POLLING_INTERVAL_MAP));for(const e of i.QUERIES)a[e]=r,n[e]||(n[e]=this.config.polling.POLLING_FREQUENCY);h.v.debug(`${e} TRIGGERED -> ENFORCING TURBO | FREQUENCY=${r}ms DURATION=${o}`),this.ongoingTurbo[e]=!0,this.updateIntervals({polling:{POLLING_INTERVAL_MAP:a}}),setTimeout((()=>{h.v.debug(`RESTORED ORIGINAL POLLING INTERVALS FOR ${e}`),this.updateIntervals({polling:{POLLING_INTERVAL_MAP:n}}),this.ongoingTurbo[e]=!1}),o)}updateIntervals(e){const{POLLING_INTERVAL_MAP:t}=e.polling;t&&(this.config.polling.POLLING_INTERVAL_MAP=t,this.handlePollingIntervalMapUpdate(t))}handlePollingIntervalMapUpdate(e){if(e)for(const t in e){if(!e.hasOwnProperty(t))continue;const s=e[t];this.config.polling.POLLING_INTERVAL_MAP[t]=s,h.v.debug(`Setting polling frequency for ${t} = ${s}`),[...this.streams.values()].filter((e=>e.RESOURCE_NAME===t)).forEach((e=>{var t;return null===(t=null==e?void 0:e.POLLING_FREQUENCY)||void 0===t?void 0:t.next(s)}))}}static getBody(e){return JSON.stringify(e)}static getUrl(e,t){const s=t.MESSAGE_TYPE;let i=t.MESSAGE_TYPE.replace(/_/g,"-").toLowerCase();return s===I.Gp.DATA_LOGON&&(i=t.DETAILS.DATASOURCE_NAME.replace(/_/g,"-").toLowerCase()),`${e}${i}`}};(0,i.__decorate)([o.observable],b.prototype,"host",void 0),(0,i.__decorate)([o.observable],b.prototype,"isWorking",void 0),(0,i.__decorate)([o.observable],b.prototype,"_isConnected",void 0),(0,i.__decorate)([o.volatile],b.prototype,"isConnected",null),b=(0,i.__decorate)([(0,i.__param)(0,O.l),(0,i.__param)(1,I.lT),(0,i.__param)(2,T.N),(0,i.__param)(3,d),(0,i.__param)(4,E.b_),(0,i.__param)(5,f)],b);const N=n.DI.createInterface((e=>e.singleton(b)));var C=s(45230);let L=class{get isConnected(){return this.socket.isConnected}get isConnectedSubject(){return this.socket.isConnectedSubject}get isConnected$(){var e;return null===(e=this.socket.isConnectedSubject)||void 0===e?void 0:e.asObservable()}get host(){return this.socket.host}constructor(e,t,s,i,r){this.socket=e,this.messageBuilder=t,this.metaCache=s,this.events=i,this.config=r,this.isWorking=!1}httpMode(){return!1}setValidSession(e){h.v.deprecated("setValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}send(e,t){return this.socket.send(e,t)}connect(e=r.vN){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return this.socket.reset(),this.socket.connect(e,this.config.connect,this.config.reconnect)}))}disconnect(){this.socket.reset()}snapshot(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=this.messageBuilder.createDataLogonMessage(e,t);return h.v.debug(`${s.MESSAGE_TYPE} (snapshot) message created -> `,s),this.socket.send(s)}))}stream(e,t,s,i){const r=this.messageBuilder.createDataLogonMessage(e,i);h.v.debug(`${r.MESSAGE_TYPE} (stream) message created -> `,r);const o=this.socket.sendForStream(r,t,(t=>{s(t),this.events.onStreamErrorEvent(e,o,t)}),(()=>{this.events.onStreamCompleteEvent(e,o)}));return this.events.onStreamEvent(e,r,o,{onMessage:t,onError:s}),o}streamState(e,t=(()=>{}),s=(()=>{}),i,r=[]){return this.stream(e,t,s,i).pipe((0,a.S)(M,r))}streamWithoutAutoTeardown(e,t,s,i){h.v.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0");const r=this.messageBuilder.createDataLogonMessage(e,i);h.v.debug(`${r.MESSAGE_TYPE} (stream without auto-teardown) message created -> `,r);const o=this.socket.sendForStreamWithoutTeardown(r,t,(t=>{s(t),this.events.onStreamErrorEvent(e,o,t)}));return this.events.onStreamEvent(e,r,o,{onMessage:t,onError:s}),o}getMoreRows(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=this.messageBuilder.createMoreRowsMessage(e,t);return h.v.debug(`${s.MESSAGE_TYPE} message created -> `,s),this.socket.send(s,!1)}))}getMoreColumns(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.socket.send(t)}))}dataLogoff(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return h.v.debug(`${t.MESSAGE_TYPE} message created -> `,t),this.socket.send(t)}))}getMetadata(e,t=!0){var s;return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(t&&this.metaCache.hasMetadataFor(e))return h.v.debug(`Cached metadata retrieved for ${e}`),this.metaCache.getMetadataFor(e);const i=this.messageBuilder.createMetaRequestMessage(e);let r,o;h.v.debug(`${i.MESSAGE_TYPE} (metadata) message created -> `,i);try{this.isWorking=!0;const t=yield this.socket.send(i);r=null!==(s=null==t?void 0:t.DETAILS)&&void 0!==s?s:{},Object.keys(r).length&&this.metaCache.setMetadataFor(e,r)}catch(e){throw o=e,h.v.error(e),o}finally{this.events.onMetadataEvent(e,i,o),this.isWorking=!1}return r}))}getJSONSchema(e,t=!0){var s;return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(t&&this.metaCache.hasJsonSchemaFor(e))return h.v.debug(`Cached JsonSchema retrieved for ${e}`),this.metaCache.getJsonSchemaFor(e);const i=this.messageBuilder.createMetaRequestMessage(e,I.Gp.JSON_SCHEMA_REQUEST);let r;h.v.debug(`${i.MESSAGE_TYPE} (json schema) message created -> `,i);try{this.isWorking=!0,r=null!==(s=yield this.socket.send(i))&&void 0!==s?s:{},Object.keys(r).length&&this.metaCache.setJsonSchemaFor(e,r)}catch(e){h.v.error(e)}finally{this.isWorking=!1}return r}))}request(e,t){const s=this.messageBuilder.createRequestMessage(e,t);return h.v.debug(`${s.MESSAGE_TYPE} (request server) message created -> `,s),this.socket.send(s)}getAvailableResources(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=this.messageBuilder.createResourcesMessage(e);return h.v.debug(`${t.MESSAGE_TYPE} (resources) message created -> `,t),this.socket.send(t)}))}commitEvent(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=this.messageBuilder.createCommitMessage(e,t);h.v.debug(`${s.MESSAGE_TYPE} (commit) message created -> `,s);const i=this.socket.send(s);return this.events.onCommitEvent(e,s),i.then((t=>(this.events.onCommitResponseEvent(e,t),t)))}))}};(0,i.__decorate)([o.observable],L.prototype,"isWorking",void 0),L=(0,i.__decorate)([(0,i.__param)(0,C.yQ),(0,i.__param)(1,I.lT),(0,i.__param)(2,d),(0,i.__param)(3,l.EQ),(0,i.__param)(4,u.R)],L);const U="true"===r.PF||!1,y=n.DI.createInterface((e=>e.singleton(L))),w=n.DI.createInterface((e=>U?e.aliasTo(N):e.aliasTo(y)));function P(){return n.DI.getOrCreateDOMContainer().get(w)}},49587:(e,t,s)=>{s.d(t,{R:()=>o});var i=s(84674);const r={connect:{alwaysOn:!1,enableHeartbeat:!0,enableHeartbeatLogging:!1,heartbeatInterval:1e4,verboseHeartbeat:!1,enableMessageLogging:!1},reconnect:{reconnectAttempts:10,reconnectInterval:1e4,reconnectStreams:!0},isWebSocketExpression:new RegExp(/wss?:\/\/[-a-zA-Z0-9@:%._\+~#=]{1,256}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*)\b\/*$/,"i")},o=i.DI.createInterface((e=>e.instance(r)))},32748:(e,t,s)=>{s.d(t,{l:()=>a});var i=s(8202),r=s(49229),o=s(84674);let n=class{constructor(e){this.serializer=e}get(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=yield fetch(e,Object.assign(Object.assign({credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"}},t),{method:"GET"}));return(t.serializer||this.serializer).deserialize(s)}))}post(e,t){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const s=yield fetch(e,Object.assign(Object.assign({credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"}},t),{method:"POST"}));return(t.serializer||this.serializer).deserialize(s)}))}};n=(0,i.__decorate)([(0,i.__param)(0,r.b_)],n);const a=o.DI.createInterface((e=>e.singleton(n)))},21281:(e,t,s)=>{s.d(t,{Go:()=>i,Gp:()=>r,lT:()=>E,x6:()=>o,z2:()=>l});var i,r,o,n=s(8202),a=s(32808),c=s(84674),d=s(56653),h=s(98316);!function(e){e.LOGON_ACK="LOGON_ACK",e.LOGON_NACK="LOGON_NACK",e.LOGOFF_ACK="LOGOFF_ACK",e.LOGOFF_NACK="LOGOFF_NACK",e.HEARTBEAT_PING="HEARTBEAT_PING",e.HEARTBEAT_PONG="HEARTBEAT_PONG",e.MORE_ROWS="MORE_ROWS",e.MORE_COLUMNS="MORE_COLUMNS",e.MORE_COLUMNS_ACK="MORE_COLUMNS_ACK",e.MSG_ACK="MSG_ACK",e.MSG_NACK="MSG_NACK",e.LOGOUT_ACK="LOGOUT_ACK",e.LOGOUT_NACK="LOGOUT_NACK",e.QUERY_UPDATE="QUERY_UPDATE"}(i||(i={})),function(e){e.EVENT_LOGIN_AUTH="EVENT_LOGIN_AUTH",e.EVENT_LOGIN_AUTH_ACK="EVENT_LOGIN_AUTH_ACK",e.EVENT_LOGIN_AUTH_NACK="EVENT_LOGIN_AUTH_NACK",e.EVENT_LOGOUT="EVENT_LOGOUT",e.DATA_LOGON="DATA_LOGON",e.DATA_LOGOFF="DATA_LOGOFF",e.META_REQUEST="META_REQUEST",e.JSON_SCHEMA_REQUEST="JSON_SCHEMA_REQUEST",e.RESOURCES_REQUEST="RESOURCES_REQUEST",e.RESOURCES_REQUEST_ACK="RESOURCES_REQUEST_ACK",e.RESOURCES_REQUEST_NACK="RESOURCES_REQUEST_NACK",e.EVENT_CHANGE_USER_PASSWORD="EVENT_CHANGE_USER_PASSWORD",e.EVENT_SELF_SERVICE_PASSWORD_RESET="EVENT_SELF_SERVICE_PASSWORD_RESET",e.EVENT_PASSWORD_RESET_ACTION="EVENT_PASSWORD_RESET_ACTION"}(r||(r={})),function(e){e.SESSION_NOT_FOUND="SESSION_NOT_FOUND",e.UNKNOWN_MESSAGE_TYPE="UNKNOWN_MESSAGE_TYPE"}(o||(o={}));const l=(e,t)=>!!Array.isArray(null==e?void 0:e.ERROR)&&(null==e?void 0:e.ERROR.some((e=>{var s,i;return(null===(s=e.CODE)||void 0===s?void 0:s.includes(`${t}`))||(null===(i=e.STATUS_CODE)||void 0===i?void 0:i.includes(`${t}`))})));let u=class{constructor(e,t){this.session=e,this.uuid=t}createLoginMessage(e){let t;switch(e.type){case d.h.BASIC:t={USER_NAME:e.username,PASSWORD:e.password,MFA_CODE:e.mfaToken};break;case d.h.REFRESH:t={USER_NAME:e.username,REFRESH_AUTH_TOKEN:e.refreshToken,MFA_CODE:e.mfaToken};break;case d.h.SSO:t={SSO_TOKEN:e.ssoToken};break;case d.h.JWT:t={JWT:e.jwt,DOMAIN:e.domain}}return{DETAILS:t,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.EVENT_LOGIN_AUTH}}createLogoutMessage(e){var t,s;return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.EVENT_LOGOUT,SESSION_AUTH_TOKEN:null!==(t=e.authToken)&&void 0!==t?t:this.session.getSessionStorageItem("authToken"),SESSION_ID:null!==(s=e.sessionId)&&void 0!==s?s:this.session.getSessionStorageItem("sessionId")}}createDataLogonMessage(e,t){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.DATA_LOGON,DETAILS:Object.assign({DATASOURCE_NAME:e},t),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createDataLogoffMessage(e){return{SOURCE_REF:e,MESSAGE_TYPE:r.DATA_LOGOFF,SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createRequestMessage(e,t){return Object.assign({SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:e.startsWith("REQ_")?e:`REQ_${e}`},t)}createResourcesMessage(e){return Object.assign({SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:r.RESOURCES_REQUEST},e)}createMetaRequestMessage(e,t=r.META_REQUEST){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:t,DETAILS:{FEATURE:e},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createCommitMessage(e,t){return Object.assign({SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:e},t)}createRefreshTokenMessage(){return{SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:r.EVENT_LOGIN_AUTH,DETAILS:{REFRESH_AUTH_TOKEN:this.session.getSessionStorageItem("refreshToken"),MFA_CODE:this.session.getSessionStorageItem("mfaToken")}}}createChangePasswordMessage(e,t,s){return{USER_NAME:e,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.EVENT_CHANGE_USER_PASSWORD,DETAILS:{OLD_PASSWORD:t,NEW_PASSWORD:s}}}createForgotPasswordMessage(e,t,s=e){return{USER_NAME:s,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.EVENT_SELF_SERVICE_PASSWORD_RESET,DETAILS:{USER_NAME:e,RETURN_URL:t}}}createForgotPasswordTokenMessage(e,t,s,i=e){return{USER_NAME:i,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.EVENT_PASSWORD_RESET_ACTION,DETAILS:{USER_NAME:e,RESET_TOKEN:t,NEW_PASSWORD:s}}}createMoreRowsMessage(e,t){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:i.MORE_ROWS,DETAILS:{SOURCE_REF:e,VIEW_NUMBER:t},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createMoreColumnsMessage(e){return Object.assign(Object.assign({},this.createMoreRowsMessage(e)),{MESSAGE_TYPE:i.MORE_COLUMNS})}createHTTPHeadersFromMessage(e,t="application/json; charset=UTF-8"){const s={"Content-type":t};return e.SOURCE_REF&&(s["source-ref"]=e.SOURCE_REF,s.SOURCE_REF=e.SOURCE_REF),e.SESSION_AUTH_TOKEN&&(s["SESSION-AUTH-TOKEN"]=e.SESSION_AUTH_TOKEN),e.MESSAGE_TYPE===r.EVENT_LOGOUT&&(s["SESSION-ID"]=e.SESSION_ID),s}createHeartbeatPingMessage(e=!1){return{MESSAGE_TYPE:i.HEARTBEAT_PING,SOURCE_REF:this.uuid.createId(),VERBOSE:e,DETAILS:{},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}};u=(0,n.__decorate)([(0,n.__param)(0,h.N),(0,n.__param)(1,a.k)],u);const E=c.DI.createInterface((e=>e.singleton(u)))},45230:(e,t,s)=>{s.d(t,{yQ:()=>D,Ol:()=>G});var i=s(8202),r=s(92277),o=s(84686),n=s(49229),a=s(32808),c=s(33681),d=s(84674),h=s(50049),l=s(37970),u=s(75841),E=s(26274),g=s(53193),_=s(84190),v=s(82834),S=s(66640),m=s(53940),p=s(48653),R=s(98316),T=s(17465),O=s(49587),A=s(32748),f=s(21281);const I=1e4,M=6e4;var b;!function(e){e.Linear="linear",e.Exponential="exponential"}(b||(b={}));const N=(e,t)=>{const{reconnectInterval:s=I}=e,i=s>M?M:s,r=Math.round(Math.log2(M/i));return i*Math.pow(2,t%r)},C=e=>{const{reconnectInterval:t=I}=e;return t>M?M:t};var L=s(5709);class U{constructor(e){this.interval=e,this.workerScript=`\n const startTime = Date.now();\n setInterval(function() {\n self.postMessage(Date.now() - startTime);\n }, ${this.interval});\n `}start(e){this.stop(),this.runWorker(e)}stop(){this.worker&&(this.worker.terminate(),delete this.worker)}runWorker(e){this.worker||(this.worker=new Worker(URL.createObjectURL(new Blob([this.workerScript],{type:"text/javascript"}))),this.worker.onmessage=t=>e(t.data))}}class y extends h.B{constructor(){super()}}l.c;class w{constructor(e,t,s,i){this._message=e,this._onMessage=t,this._onError=s,this._isSubscription=i}get sentMessage(){return this._message}get onReceivedMessage(){return this._onMessage}get onReceivedError(){return this._onError}get isSubscription(){return this._isSubscription}}let P=class e{get isConfigured(){return this.status.isConfigured}get isConnecting(){return this.status.isConnecting}get isConnected(){return this.status.isConnected}get isConnectedSubject(){return this.status.isConnectedSubject}get isDisconnected(){return this.status.isDisconnected}get isDisconnectedByServer(){return this.status.isDisconnectedByServer}get isReconnecting(){return this.status.isReconnecting}get hasValidSession(){return T.v.deprecated("get hasValidSession","Use `User.isAuthenticated` from `@genesislcap/foundation-user` instead.","15.0.0"),this.user.isAuthenticated}set hasValidSession(e){T.v.deprecated("set hasValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}get host(){var e;return null!==(e=this.url)&&void 0!==e?e:o.vN}constructor(e,t,s,i,r,o,n){this.messageBuilder=e,this.session=t,this.serializer=s,this.uuid=i,this.status=r,this.user=o,this.config=n,this.defaultInterval=1e4,this.secondsMultiplier=1e3,this.heartbeatIsEnabled=!0,this.heartbeatInterval=this.defaultInterval,this.socketMessages=()=>this.wsMessages}get heartbeatLoggingIsEnabled(){var e,t;return null!==(t=null===(e=this.connectOptions)||void 0===e?void 0:e.enableHeartbeatLogging)&&void 0!==t&&t}get messageLoggingIsEnabled(){var e,t;return null!==(t=null===(e=this.connectOptions)||void 0===e?void 0:e.enableMessageLogging)&&void 0!==t&&t}connect(e=o.vN,t,s){var r;return this.url=e,this.connectOptions=null!=t?t:this.config.connect,this.reconnectOptions=null!=s?s:this.config.reconnect,(null===(r=this.config.isWebSocketExpression)||void 0===r?void 0:r.test(this.host))?new Promise((e=>{var t,s,r,o;T.v.info(`${this.isReconnecting?"Reconnecting":"Connecting"} to ${this.url}`),this.status.isConnecting=!this.isReconnecting;(!this.isReconnecting||!(null===(t=this.reconnectOptions)||void 0===t?void 0:t.reconnectStreams))&&this.cleanMessages(),null===(s=this.socketSubscription)||void 0===s||s.unsubscribe(),this.websocket=new p.Q({url:this.url,openObserver:{next:()=>{this.session.setSessionStorageItem("hostUrl",this.url),this.status.isConnected=!0,this.prepareHeartbeat(),T.v.info("WebSocket connection is now open"),e(this.isConnected)}},closeObserver:{next:t=>{this.status.onClose(t),this.isDisconnectedByServer&&T.v.info(`WebSocket connection was closed due an error - Code: ${t.code} ${t.reason?" | Reason: "+t.reason:""}`),e(this.isConnected)}},serializer:e=>this.serializer.serialize(e),deserializer:e=>this.serializer.deserialize(e)});this.socketSubscription=this.websocket.subscribe(null!==(o=null===(r=this.connectOptions)||void 0===r?void 0:r.connectObserver)&&void 0!==o?o:{next:e=>(0,i.__awaiter)(this,void 0,void 0,(function*(){var t;const s=`Response Message received for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,T.v.info,s);const{SOURCE_REF:i,MESSAGE_TYPE:r}=e,o=this.getMessageHandler(i,r);if(!o)return void(e.MESSAGE_TYPE===f.Go.MSG_NACK&&e.ERROR&&e.ERROR.forEach((t=>{T.v.error(`MessageType: ${e.MESSAGE_TYPE} | Error Details:`,t)})));let n=!1;switch(e.MESSAGE_TYPE){case f.Gp.EVENT_LOGIN_AUTH_ACK:{const s=e.DETAILS;s.HEARTBEAT_INTERVAL_SECS&&void 0===(null===(t=this.connectOptions)||void 0===t?void 0:t.heartbeatInterval)&&(this.heartbeatInterval=s.HEARTBEAT_INTERVAL_SECS*this.secondsMultiplier,this.prepareHeartbeat());break}case f.Go.LOGOUT_ACK:return o.onReceivedMessage.call(this,e),void this.cleanMessages();case f.Go.LOGON_ACK:return;case f.Go.LOGOFF_ACK:break;case f.Go.QUERY_UPDATE:o.isSubscription||this.sendDataLogoff(i);break;case f.Go.MSG_NACK:case f.Go.LOGON_NACK:n=!0}n?o.onReceivedError.call(this,{receivedMessage:e,sentMessage:o.sentMessage}):o.onReceivedMessage.call(this,e),this.wsMessages.next(e),o.isSubscription||this.removeMessageHandler(i)})),error:e=>{T.v.debug("Error found: ",e),this.reconnect()},complete:()=>{var e;this.isDisconnectedByServer&&(null===(e=this.connectOptions)||void 0===e?void 0:e.alwaysOn)?this.reconnect():T.v.info("Connection is now closed")}}),this.status.isConfigured=!0})):(T.v.error(`Specified host (${this.host}) is not valid WebSocket url. Connection will not proceed.`),void T.v.warn("Make sure the host url starts with wss:// or ws://"))}handleExpiredSession(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(this.session.getSessionStorageItem("refreshToken")){const e=this.messageBuilder.createRefreshTokenMessage(),t=yield this.send(e);this.session.setAuthResult(t),this.updateSessionAndSubscriptions(t)}else yield this.handleCookieBasedReauth()}))}handleCookieBasedReauth(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=parseInt(localStorage.getItem(e.REAUTH_ACTION_LOCK_KEY)||"0");if(Date.now()-t>3e4&&localStorage.removeItem(e.REAUTH_ACTION_LOCK_KEY),localStorage.getItem(e.REAUTH_ACTION_LOCK_KEY))window.addEventListener("storage",this.onStorageEvent.bind(this));else{localStorage.setItem(e.REAUTH_ACTION_LOCK_KEY,Date.now().toString());const t=yield fetch(o.Be,{credentials:"include"});if("EVENT_LOGIN_DETAILS_ACK"!==(yield t.json()).MESSAGE_TYPE){(yield fetch(o.aW,{credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"},method:"POST",body:JSON.stringify({DETAILS:{},MESSAGE_TYPE:"EVENT_LOGIN_AUTH"})})).ok||window.location.reload()}localStorage.removeItem(e.REAUTH_ACTION_LOCK_KEY),yield this.connect()}}))}onStorageEvent(t){t.key===e.REAUTH_ACTION_LOCK_KEY&&null===t.newValue&&(this.connect(),window.removeEventListener("storage",this.onStorageEvent))}updateSessionAndSubscriptions(e){(null==e?void 0:e.MESSAGE_TYPE)===f.Gp.EVENT_LOGIN_AUTH_ACK&&this.wsMessageHandlers.forEach((t=>{t.isSubscription&&(t.sentMessage.SESSION_AUTH_TOKEN=e.SESSION_AUTH_TOKEN,this.websocket.next(t.sentMessage))}))}prepareHeartbeat(){var e,t,s,r;this.heartbeatTicker&&this.heartbeatTicker.stop();const o=()=>(0,i.__awaiter)(this,void 0,void 0,(function*(){var e,t,s;if(!this.isConnected)return;const i=this.messageBuilder.createHeartbeatPingMessage(null===(e=this.connectOptions)||void 0===e?void 0:e.verboseHeartbeat);(null===(t=this.connectOptions)||void 0===t?void 0:t.heartbeatPingCallback)&&this.connectOptions.heartbeatPingCallback(i);const r=yield this.send(i);this.user.isAuthenticated&&!r.IS_AUTHENTICATED&&this.handleExpiredSession(),(null===(s=this.connectOptions)||void 0===s?void 0:s.heartbeatPongCallback)&&this.connectOptions.heartbeatPongCallback(r),this.heartbeatIsEnabled=r.MESSAGE_TYPE===f.Go.HEARTBEAT_PONG&&r.SOURCE_REF===i.SOURCE_REF}));if(null!==(t=null===(e=this.connectOptions)||void 0===e?void 0:e.enableHeartbeat)&&void 0!==t?t:this.heartbeatIsEnabled){const e=null!==(r=null===(s=this.connectOptions)||void 0===s?void 0:s.heartbeatInterval)&&void 0!==r?r:this.heartbeatInterval;this.heartbeatTicker=new U(e),this.heartbeatTicker.start((()=>{this.websocket&&this.isConnected&&(o(),this.heartbeatLoggingIsEnabled&&T.v.debug(`Sending a heartbeat ping every ${e} ms`))}))}}reconnect(){var e,t,s,i,r;const o=!(null===(e=this.connectOptions)||void 0===e?void 0:e.alwaysOn)&&!1===(null===(t=this.connectOptions)||void 0===t?void 0:t.enableHeartbeat);if(this.isReconnecting||o)return;this.status.isReconnecting=!0;const n=(null===(s=this.reconnectOptions)||void 0===s?void 0:s.reconnectStrategy)===b.Exponential?N:C,a=this.isConnectedSubject.asObservable().pipe((0,_.n)((e=>e?(0,u.of)(-1):((e,t)=>new l.c((s=>{let i,r=0;return function o(){s.next(r),clearTimeout(i),i=setTimeout(o,t(e,r)),r+=1}(),()=>{clearTimeout(i)}})))(this.reconnectOptions,n).pipe((0,v.Z)((e=>{var t,s,i;let r;return r=(null===(t=this.connectOptions)||void 0===t?void 0:t.alwaysOn)?e+1:null!==(i=null===(s=this.reconnectOptions)||void 0===s?void 0:s.reconnectAttempts)&&void 0!==i?i:10,e<r?(0,u.of)(e):(this.status.reconnectionLimitReached=!0,(0,E.$)((()=>new Error(`Max reconnect attempts ${r} reached.`))))}))))),(0,S.v)((()=>this.websocket&&!this.isConnected)));a.subscribe(null!==(r=null===(i=this.reconnectOptions)||void 0===i?void 0:i.reconnectObserver)&&void 0!==r?r:{next:e=>{T.v.debug(`Attempt no. ${e+1} to reconnect`),this.websocket.complete(),this.connect(this.url,this.connectOptions,this.reconnectOptions)},error:e=>{var t;T.v.debug(e),null===(t=this.socketSubscription)||void 0===t||t.unsubscribe(),this.status.isReconnecting=!1},complete:()=>{T.v.info(this.isConnected?"Reconnected":"Disconnected"),this.status.isReconnecting=!1,this.wsMessageHandlers.forEach((e=>{e.isSubscription&&this.websocket.next(e.sentMessage)}))}})}reset(){this.status.isConnected=!1,this.status.isConfigured=!1,this.websocket&&this.websocket.complete(),this.websocket=null,this.cleanMessages()}cleanMessages(){this.wsMessages&&this.wsMessages.complete(),this.wsMessages=new y,this.wsMessageHandlers=new Map}send(e,t=!0){if(!this.isConnected)return Promise.reject(new Error("WebSocket connection is closed"));const s=`Sending Message for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,T.v.info,s),new Promise(((s,i)=>{const r=e=>{s(e)},o=e=>{i(e)};t&&this.setMessageHandler(e,r,o),this.websocket.next(e)}))}sendForStream(e,t,s,i){if(!this.isConnected)return(0,E.$)((()=>new Error("WebSocket connection is closed")));const r=`Sending Message (stream) for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,T.v.info,r),this.setMessageHandler(e,t,s,!0),c.DOM.queueUpdate((()=>this.websocket.next(e))),new l.c((t=>{const s=new h.B;return this.wsMessages.pipe((0,m.p)((t=>t.SOURCE_REF===e.SOURCE_REF)),(0,g.Q)(s)).subscribe({next:e=>{t.next(e)},error:e=>{t.error(e)},complete:()=>{t.complete()}}),()=>{s.complete(),this.sendDataLogoff(e.SOURCE_REF),this.removeMessageHandler(e.SOURCE_REF),i&&i()}}))}sendForStreamWithoutTeardown(e,t,s){if(!this.isConnected)return(0,E.$)((()=>new Error("WebSocket connection is closed")));const i=`Sending Message (stream) for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,T.v.info,i),this.setMessageHandler(e,t,s,!0),this.websocket.next(e),this.wsMessages.pipe((0,m.p)((t=>t.SOURCE_REF===e.SOURCE_REF)))}setMessageHandler(e,t,s,i=!1){const r=`Setting Message Handler for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,T.v.debug,r),this.wsMessageHandlers.set(e.SOURCE_REF,new w(e,t,s,i))}sendDataLogoff(e){this.send(this.messageBuilder.createDataLogoffMessage(e),!1)}removeMessageHandler(e){this.wsMessageHandlers.delete(e)}getMessageHandler(e,t){const s=`Getting Message Handler for SourceRef: ${e} | MessageType: ${t}`;return this.logMessageTypeFlow(t,T.v.debug,s),this.wsMessageHandlers.get(e)}logMessageTypeFlow(e,t,s){switch(e){case f.Gp.DATA_LOGOFF:t(s);break;case f.Go.HEARTBEAT_PING:case f.Go.HEARTBEAT_PONG:this.heartbeatLoggingIsEnabled&&t(s);break;default:this.messageLoggingIsEnabled&&t(s)}}};P.REAUTH_ACTION_LOCK_KEY="reauthActionLock",(0,i.__decorate)([c.observable],P.prototype,"websocket",void 0),(0,i.__decorate)([c.observable],P.prototype,"wsMessages",void 0),(0,i.__decorate)([c.observable],P.prototype,"wsMessageHandlers",void 0),(0,i.__decorate)([A.l],P.prototype,"http",void 0),(0,i.__decorate)([c.observable],P.prototype,"heartbeatIsEnabled",void 0),P=(0,i.__decorate)([(0,i.__param)(0,f.lT),(0,i.__param)(1,R.N),(0,i.__param)(2,n.b_),(0,i.__param)(3,a.k),(0,i.__param)(4,L.S5),(0,i.__param)(5,r.KJ),(0,i.__param)(6,O.R)],P);const D=d.DI.createInterface((e=>e.singleton(P)));function G(){return d.DI.getOrCreateDOMContainer().get(D)}},5709:(e,t,s)=>{s.d(t,{S5:()=>d});var i=s(8202),r=s(92277),o=s(33681),n=s(84674),a=s(97156);class c{constructor(){this.isConfigured=!1,this.isConnecting=!1,this.isConnected=!1,this.isReconnecting=!1,this.reconnectionLimitReached=!1,this.isConnectedSubject=new a.t(this.isConnected)}get hasValidSession(){return this.user.isAuthenticated}get isDisconnected(){return!this.isConnected}get isDisconnectedByServer(){return void 0!==this.closedClean&&!this.closedClean}isConnectedChanged(){var e;this.isConnected&&this.resetClosedState(),this.isConnecting=!1,this.isReconnecting=!1,null===(e=this.isConnectedSubject)||void 0===e||e.next(this.isConnected)}isReconnectingChanged(){this.isReconnecting&&(this.reconnectionLimitReached=!1)}resetClosedState(){this.closedCode=void 0,this.closedReason=void 0,this.closedClean=void 0}serialize(){return{isConfigured:this.isConfigured,isConnecting:this.isConnecting,isConnected:this.isConnected,isDisconnected:this.isDisconnected,isDisconnectedByServer:this.isDisconnectedByServer,isReconnecting:this.isReconnecting,reconnectionLimitReached:this.reconnectionLimitReached,hasValidSession:this.hasValidSession,closedCode:this.closedCode,closedReason:this.closedReason,closedClean:this.closedClean}}onClose(e){this.isConnected=!1,this.closedCode=e.code,this.closedReason=e.reason,this.closedClean=e.wasClean}}(0,i.__decorate)([o.observable],c.prototype,"isConfigured",void 0),(0,i.__decorate)([o.observable],c.prototype,"isConnecting",void 0),(0,i.__decorate)([o.observable],c.prototype,"isConnected",void 0),(0,i.__decorate)([o.observable],c.prototype,"isReconnecting",void 0),(0,i.__decorate)([o.observable],c.prototype,"reconnectionLimitReached",void 0),(0,i.__decorate)([o.observable],c.prototype,"closedCode",void 0),(0,i.__decorate)([o.observable],c.prototype,"closedReason",void 0),(0,i.__decorate)([o.observable],c.prototype,"closedClean",void 0),(0,i.__decorate)([r.KJ],c.prototype,"user",void 0);const d=n.DI.createInterface((e=>e.singleton(c)))},34193:(e,t,s)=>{s.d(t,{d:()=>r});var i=s(17465);function r(e,t="ROW_REF"){const s=e=>{const s=Object.assign(Object.assign({},e),{[t]:e.DETAILS[t]});return delete s.DETAILS,s},r=[],o=[],n=[];for(const t of e.ROW)if(t.DETAILS)switch(t.DETAILS.OPERATION){case"INSERT":r.push(s(t));break;case"MODIFY":n.push(s(t));break;case"DELETE":o.push(s(t));break;default:i.v.error(`Unsupported operation type: '${t.DETAILS.OPERATION}'`)}return{inserts:r,deletes:o,updates:n,SOURCE_REF:e.SOURCE_REF}}},6884:(e,t,s)=>{s.d(t,{aB:()=>a,OD:()=>o});var i=s(84674);var r=s(34193);class o{}o.MAX_ROWS_250=250,o.MAX_VIEW_1000=1e3,o.REQ_REP_POLLING_INTERVAL_MS=1e4,o.DATASERVER_ROW_ID="ROW_REF",o.REQUEST_SERVER_ROW_ID="RECORD_ID",o.DEFAULT_PAGINATION_PAGE_SIZE=25;const n={options:{criteria:"",isSnapshot:!1,maxRows:o.MAX_ROWS_250,maxView:o.MAX_VIEW_1000,pollingInterval:o.REQ_REP_POLLING_INTERVAL_MS,movingView:!1,orderBy:"",resourceName:"",reverse:!1,pollTriggerEvents:[]},criteriaToFields:function(e){const t=e.split("&&").map((e=>e.trim())),s={};return t.forEach((e=>{if(e.startsWith("Expr"))switch(e.match(/Expr\.(\w+)\(/)[1]){case"dateIsToday":{const t=/Expr\.dateIsToday\((\w+)\)/,[,i]=e.match(t),r=new Date;s[`${i}_FROM`]=`${r.toISOString().replace(/-/g,"").split("T")[0]}-00:00`,r.setDate(r.getDate()+1),s[`${i}_TO`]=`${r.toISOString().replace(/-/g,"").split("T")[0]}-00:00`}break;case"dateTimeIsGreaterEqual":{const t=/Expr\.dateTimeIsGreaterEqual\((\w+), ?['"](.+)['"]\)/,[,i,r]=e.match(t);s[`${i}_FROM`]=r}break;case"dateTimeIsLessEqual":{const t=/Expr\.dateTimeIsLessEqual\((\w+), ?['"](.+)['"]\)/,[,i,r]=e.match(t);s[`${i}_TO`]=r}break;case"dateIsGreaterEqual":{const t=/Expr\.dateIsGreaterEqual\((\w+), ?['"](.+)['"]\)/,[,i,r]=e.match(t);s[`${i}_FROM`]=r}break;case"dateIsLessEqual":{const t=/Expr\.dateIsLessEqual\((\w+), ?['"](.+)['"]\)/,[,i,r]=e.match(t);s[`${i}_TO`]=r}break;case"containsIgnoreCase":{const t=/Expr\.containsIgnoreCase\((\w+), ?['"](.+)['"]\)/,[,i,r]=e.match(t);s[i]=`*${r}*`}}else{const t=e.substr(0,e.indexOf("=")).trim().replace(/["']/g,""),i=e.substr(e.lastIndexOf("=")+1,e.length).trim().replace(/["']/g,"");s[t]=i}})),s},dataServerResultFilter:r.d},a=i.DI.createInterface((e=>e.instance(n)))},9033:(e,t,s)=>{s.d(t,{yW:()=>b});var i=s(8202),r=s(33681),o=s(84674),n=s(50049),a=s(8790),c=s(1762),d=s(51046),h=s(66640),l=s(84190),u=s(65052),E=s(40113),g=s(26347),_=s(24669),v=s(48707),S=s(17465),m=s(79780);const p={throwWhenUnavailable:!0,throwWhenUnknown:!1},R=o.DI.createInterface((e=>e.instance(p))),T=(0,m.Es)("genesis-resources");let O=class{constructor(e,t){this.connect=e,this.config=t}isValidResource(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(!(e=null==e?void 0:e.trim()))return!1;yield this.fetchResources();return!!this.resources.find((t=>t.RESOURCE_NAME===e))}))}getResourceTypeFor(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){yield this.fetchResources();const t=this.resources.find((t=>t.RESOURCE_NAME===e));if(t)return t.RESOURCE_TYPE;const s=`${e} resource does not exist.`;if(S.v.error(s),this.config.throwWhenUnknown)throw new Error(s)}))}getAllResources(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return this.resources||(yield this.fetchResources()),this.resources}))}destroy(){this.resources=void 0,this.resourcesPromise=void 0}fetchResources(){var e;return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(this.resources)return Promise.resolve();if(this.resourcesPromise)yield this.resourcesPromise;else{this.resourcesPromise=this.connect.getAvailableResources();const t=yield this.resourcesPromise;if(this.resources=null==t?void 0:t.RESOURCES,!(null===(e=this.resources)||void 0===e?void 0:e.length)){const e="Genesis resources unavailable.";if(S.v.error(e),this.config.throwWhenUnavailable)throw new Error(e)}this.postLoadedMessage(),this.resourcesPromise=void 0}}))}postLoadedMessage(){const e=o.DI.getOrCreateDOMContainer().get(T);e.postMessage("resources-loaded",this.resources),e.close()}};O=(0,i.__decorate)([(0,i.__param)(0,g.dm),(0,i.__param)(1,R)],O);const A=o.DI.createInterface((e=>e.singleton(O)));var f=s(6884),I=s(39087);let M=class{get initialized(){var e;return!!(null===(e=this.status)||void 0===e?void 0:e.isInitialized)}constructor(e,t,s,i,r){this.connect=e,this.auth=t,this.resources=s,this.config=i,this.connectEvents=r,this.fetchMetadataRequired=!0,this.startStreamRequired=!0,this.originalFieldDef=[],this.fieldMetadata=[],this.requestFields=[],this.customRequestFields=[],this.availableIndexes=[],this.readOnly=!0,this._allParams=null,this.pollTrigger$=new n.B}triggerPoll(){this.pollTrigger$.next()}validResourceName(e){return S.v.deprecated("Datasource.validResourceName","Use `GenesisResources.isValidResource` instead."),!!e&&!!e.trim().length}init(e,t=this.fetchMetadataRequired,s=this.startStreamRequired){return(0,i.__awaiter)(this,void 0,void 0,(function*(){this.fetchMetadataRequired=t,this.options=Object.assign(Object.assign({},this.config.options),e),this.invalidateCache();const i=this.options.resourceName;if(!(this.connect.isConnected||(yield this.connect.connect())))return S.v.error(`Unable to connect to ${this.connect.host} to get ${i} datasource`),this.reportStatus(),!1;return(yield this.resources.isValidResource(i))?(this.resourceType=yield this.resources.getResourceTypeFor(i),this.resourceType?(this.fetchMetadataRequired&&(yield this.fetchAndApplyMetadata(this.options.resourceName),this._allParams=null),S.v.debug(`Initializing ${i} datasource from ${this.connect.host}`),!this.options.isSnapshot&&s&&(this.stream=yield this.createStream()),S.v.debug(`${i} datasource initialization ${this.initialized?"was successful.":"has failed."}`),this.reportStatus(),this.initialized):(S.v.error(`Unable to get the resource type for ${i} datasource from ${this.connect.host}`),this.reportStatus(),!1)):(S.v.error(`${i} datasource does not exist on ${this.connect.host}`),this.reportStatus(),!1)}))}startStream(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){this.options.isSnapshot||void 0!==this.stream||(this.stream=yield this.createStream())}))}destroy(){var e,t;S.v.debug("Datasource.destroy",null===(e=this.options)||void 0===e?void 0:e.resourceName),this.commitResponseUnsubscribe&&(this.commitResponseUnsubscribe(),this.commitResponseUnsubscribe=void 0),null===(t=this.pollTrigger$)||void 0===t||t.complete(),this.status=void 0,this.fetchMetadataRequired=void 0,this.options={},this.resourceType=void 0,this.availableIndexes=[],this.originalFieldDef=[],this.fieldMetadata=[],this.requestFields=[],this.stream=void 0}get allResourceParams(){var e;if(this._allParams)return this._allParams;let t;if(this.options.orderBy)if((null===(e=this.availableIndexes)||void 0===e?void 0:e.findIndex((e=>e.NAME===this.options.orderBy)))>-1)t=this.options.orderBy;else{const e=this.availableIndexes.map((e=>e.NAME));S.v.warn("Specified [orderBy] index is not valid and will not be used. See https://learn.genesis.global/docs/database/data-types/index-entities/ - Available indexes:",e)}return this._allParams={CRITERIA_MATCH:this.options.criteria,MAX_ROWS:this.options.maxRows,VIEW_NUMBER:this.options.viewNumber,FIELDS:this.options.fields,MAX_VIEW:this.options.maxView,MOVING_VIEW:this.options.movingView,ORDER_BY:t,REVERSE:this.options.reverse,DISABLE_POLLING:this.options.disablePolling,POLLING_INTERVAL:this.options.pollingInterval,REQUEST:this.options.request},S.v.debug("Getting configured params:",this._allParams),this._allParams}get dataserverOnlyParams(){return{CRITERIA_MATCH:this.allResourceParams.CRITERIA_MATCH,MAX_ROWS:this.allResourceParams.MAX_ROWS,VIEW_NUMBER:this.allResourceParams.VIEW_NUMBER,FIELDS:this.allResourceParams.FIELDS,MAX_VIEW:this.allResourceParams.MAX_VIEW,MOVING_VIEW:this.allResourceParams.MOVING_VIEW,ORDER_BY:this.allResourceParams.ORDER_BY,REVERSE:this.allResourceParams.REVERSE}}get requestOnlyParams(){var e;const t=this.allResourceParams,{REQUEST:s}=t,r=(0,i.__rest)(t,["REQUEST"]),o={DETAILS:{CRITERIA_MATCH:this.options.requestAutoSetup?void 0:r.CRITERIA_MATCH,MAX_ROWS:r.MAX_ROWS,VIEW_NUMBER:r.VIEW_NUMBER},REQUEST:s};return o.REQUEST||(this.options.requestAutoSetup?o.REQUEST=Object.assign(Object.assign({},Object.fromEntries(this.requestFields.map((e=>[e.NAME,"*"])))),(null===(e=null==this?void 0:this.options)||void 0===e?void 0:e.criteria)?this.config.criteriaToFields(this.options.criteria):{}):o.REQUEST={}),o}snapshot(e){return(0,i.__awaiter)(this,void 0,void 0,(function*(){switch(S.v.debug(`Requesting snapshot for ${this.options.resourceName} (${this.resourceType}).`),this.resourceType){case I.v.DATASERVER:return this.connect.snapshot(this.options.resourceName,Object.assign(Object.assign({},this.dataserverOnlyParams),e));case I.v.REQUEST_SERVER:return this.connect.request(this.options.resourceName,Object.assign(Object.assign({},this.requestOnlyParams),e));default:throw new Error(`Snapshot not supported for selected resource type: ${this.resourceType}`)}}))}snapshotFiltered(e="ROW_REF"){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=yield this.snapshot();return Array.isArray(t)?t:t.REPLY?t.REPLY:t.ROW?this.config.dataServerResultFilter(t,e).inserts:void 0}))}createStream(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){if(![I.v.DATASERVER,I.v.REQUEST_SERVER].includes(this.resourceType))throw new Error(`Streaming not supported for selected resource type: ${this.resourceType}`);return this.resourceType===I.v.DATASERVER?this.createDataserverStream():(S.v.debug(`Creating fake stream by polling ${this.options.resourceName} REQUEST_SERVER`),this.createReqRepStream())}))}createDataserverStream(){return(0,i.__awaiter)(this,void 0,void 0,(function*(){return this.connect.stream(this.options.resourceName,(e=>{}),(e=>S.v.error(e)),this.dataserverOnlyParams)}))}createReqRepStream(){this.commitResponseUnsubscribe=this.connectEvents.addCommitResponseListener((e=>{var t;const{eventName:s,response:i}=e.detail;this.options.pollTriggerEvents&&this.options.pollTriggerEvents.includes(s)&&(null===(t=i.MESSAGE_TYPE)||void 0===t?void 0:t.endsWith("_ACK"))&&(S.v.debug(`Received commit response for ${s}, triggering poll.`),this.triggerPoll())}));const e=this.allResourceParams.DISABLE_POLLING?void 0:this.allResourceParams.POLLING_INTERVAL,t=()=>(0,a.z)([this.connect.isConnected$,this.auth.isLoggedIn$]).pipe((0,h.v)((()=>this.connect.isConnected&&this.auth.isLoggedIn)),(0,l.n)((()=>(0,c.H)(this.snapshot()))));return e?this.pollTrigger$.pipe((0,u.Z)(0),(0,l.n)((()=>(0,d.O)(0,e).pipe((0,l.n)(t))))):this.pollTrigger$.pipe((0,l.n)(t))}fetchAndApplyMetadata(e){var t,s;return(0,i.__awaiter)(this,void 0,void 0,(function*(){try{S.v.debug(`Requesting metadata for ${this.options.resourceName} Datasource`);const e=yield this.connect.getMetadata(this.options.resourceName);e&&(this.availableIndexes=null!==(t=e.INDEXES)&&void 0!==t?t:[],this.originalFieldDef=(0,v.a)(e),this.fieldMetadata=(0,v.X)(this.originalFieldDef),this.requestFields=e.REQUEST_FIELD||[],this.customRequestFields=e.FIELD||[],this.fetchMetadataRequired=!1),this.status=this.normaliseStatus({isInitialized:!0,metadataRequired:!0,hasMetadata:(null===(s=this.fieldMetadata)||void 0===s?void 0:s.length)>0})}catch(t){S.v.error(`Metadata Fetch failed for ${e}:`,t),this.status=this.normaliseStatus({isInitialized:!1,metadataRequired:!0,hasMetadata:!1})}}))}reportStatus(e={}){var t;const s=null!==(t=this.config.eventEmitter)&&void 0!==t?t:document;this.status=this.normaliseStatus(e),S.v.debug(`Dispatching '${I.w}'`,this.status),null==s||s.dispatchEvent(new CustomEvent(I.w,{detail:this.status,bubbles:s!==document,composed:!0}))}normaliseStatus(e){var t,s,i,r,o;const n=null!==(t=e.isInitialized)&&void 0!==t?t:this.initialized,a=null!==(s=e.metadataRequired)&&void 0!==s?s:this.fetchMetadataRequired,c=null!==(i=e.hasMetadata)&&void 0!==i?i:(null===(r=this.fieldMetadata)||void 0===r?void 0:r.length)>0;return{name:null===(o=this.options)||void 0===o?void 0:o.resourceName,type:this.resourceType,isInitialized:n,metadataRequired:a,hasMetadata:c}}invalidateCache(){this._allParams=null}};(0,i.__decorate)([r.observable],M.prototype,"status",void 0),(0,i.__decorate)([r.observable],M.prototype,"fetchMetadataRequired",void 0),(0,i.__decorate)([r.observable],M.prototype,"startStreamRequired",void 0),(0,i.__decorate)([r.observable],M.prototype,"originalFieldDef",void 0),(0,i.__decorate)([r.observable],M.prototype,"fieldMetadata",void 0),(0,i.__decorate)([r.observable],M.prototype,"requestFields",void 0),(0,i.__decorate)([r.observable],M.prototype,"customRequestFields",void 0),(0,i.__decorate)([r.observable],M.prototype,"availableIndexes",void 0),(0,i.__decorate)([r.observable],M.prototype,"readOnly",void 0),(0,i.__decorate)([r.observable],M.prototype,"stream",void 0),M=(0,i.__decorate)([(0,i.__param)(0,g.dm),(0,i.__param)(1,E.N),(0,i.__param)(2,A),(0,i.__param)(3,f.aB),(0,i.__param)(4,_.a4)],M);const b=o.DI.createInterface((e=>e.transient(M)))},40370:(e,t,s)=>{s.d(t,{C:()=>a});var i=s(8202),r=s(33681),o=s(17465),n=s(39087);const a=e=>{class t extends e{constructor(){super(),this.hasOwnProperty("onDatasourceStatusChanged")||(this.onDatasourceStatusChanged=e=>{var t;this.resourceName||o.v.warn("Target classes must have a resourceName property to use the DatasourceEventHandler mixin.");const s=e.detail;if(s.name===this.resourceName){const e=null!==(t=this.datasourceStatus)&&void 0!==t?t:{isInitialized:!1,hasMetadata:!1};(e.isInitialized!==s.isInitialized||s.metadataRequired&&e.hasMetadata!==s.hasMetadata)&&(this.datasourceStatus=s)}})}datasourceStatusChanged(e,t){o.v.debug("Target classes should override the datasourceStatusChanged method of the DatasourceEventHandler mixin to respond to changes in the target datasource.")}connectedCallback(){super.connectedCallback(),document.addEventListener(n.w,this.onDatasourceStatusChanged,{passive:!0,capture:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(n.w,this.onDatasourceStatusChanged,{capture:!0})}}return(0,i.__decorate)([r.observable],t.prototype,"datasourceStatus",void 0),t}},39087:(e,t,s)=>{var i;s.d(t,{v:()=>i,w:()=>r}),function(e){e.DATASERVER="DATASERVER",e.EVENT_HANDLER="EVENT_HANDLER",e.REQUEST_SERVER="REQUEST_SERVER"}(i||(i={}));const r="datasource-status-changed"},96730:(e,t,s)=>{function i(e,t=";"){return e?e.split(t).map((e=>e.trim())).sort(((e,t)=>e.localeCompare(t))).join(t):e}s.d(t,{Q:()=>i})},41119:(e,t,s)=>{var i;s.d(t,{v:()=>r,w:()=>i}),function(e){e.STRING="STRING",e.NUMBER="NUMBER",e.BOOLEAN="BOOLEAN",e.ENUM="ENUM",e.DATE="DATE",e.DATETIME="DATETIME",e.CUSTOM="CUSTOM",e.NANO_TIMESTAMP="NANO_TIMESTAMP"}(i||(i={}));const r={STRING:i.STRING,ENUM:i.ENUM,BOOLEAN:i.BOOLEAN,INT:i.NUMBER,LONG:i.NUMBER,DOUBLE:i.NUMBER,BIGDECIMAL:i.NUMBER,DATE:i.DATE,DATETIME:i.DATETIME,NANO_TIMESTAMP:i.NANO_TIMESTAMP}},48707:(e,t,s)=>{s.d(t,{X:()=>n,a:()=>a});var i=s(39087),r=s(17465),o=s(41119);const n=e=>e?e.map((e=>{const t={name:e.NAME,type:o.v[e.TYPE]||o.w.STRING};if(e.TYPE===o.w.ENUM&&e.VALID_VALUES)try{t.enumOptions=Array.isArray(e.VALID_VALUES)?e.VALID_VALUES:e.VALID_VALUES.split("|")}catch(e){r.v.error(e),t.enumOptions=[]}return t})):null,a=e=>{var t;const s=null==e?void 0:e.TYPE;if(s===i.v.DATASERVER)return e.FIELD||[];if(s===i.v.REQUEST_SERVER)return e.REPLY_FIELD||(null===(t=e.REPLY)||void 0===t?void 0:t.FIELD)||[];throw new Error(`Unsupported resource type: ${s}`)}},98316:(e,t,s)=>{s.d(t,{N:()=>o});var i=s(84674);class r{constructor(){this.storageKeyPrefix="",this.returnUrl=this.getSessionStorageItem("returnUrl")||""}deleteUserFromSessionStorage(){["authToken","refreshToken","sessionId","ssoToken"].forEach((e=>this.removeSessionStorageItem(e))),this.removeLocalStorageItem("refreshToken")}setStorageKeyPrefix(e){this.storageKeyPrefix=`${e.replace(/\s/g,"")}/`}setAuthResult(e){var t;this.setSessionStorageItem("authToken",e.SESSION_AUTH_TOKEN),this.setSessionStorageItem("refreshToken",e.REFRESH_AUTH_TOKEN),this.setSessionStorageItem("username",e.USER_NAME),this.setSessionStorageItem("sessionId",e.SESSION_ID),(null===(t=e.DETAILS)||void 0===t?void 0:t.MFA_CODE)&&this.setSessionStorageItem("mfaToken",e.DETAILS.MFA_CODE)}captureReturnUrl(){const{pathname:e,search:t,hash:s}=location;if(e&&(e.includes("/login")||e.includes("/auth")))return;const i=`${"/"!==e?e:""}`;this.returnUrl=`${i}${t}${s}`,this.setSessionStorageItem("returnUrl",this.returnUrl)}setItem(e,t,s){"local"===s?localStorage.setItem(this.storageKeyPrefix+e,t):sessionStorage.setItem(this.storageKeyPrefix+e,t)}getItem(e,t){return"local"===t?localStorage.getItem(this.storageKeyPrefix+e):sessionStorage.getItem(this.storageKeyPrefix+e)}removeItem(e,t){"local"===t?localStorage.removeItem(this.storageKeyPrefix+e):sessionStorage.removeItem(this.storageKeyPrefix+e)}setLocalStorageItem(e,t){this.setItem(e,t,"local")}setSessionStorageItem(e,t){this.setItem(e,t,"session")}getLocalStorageItem(e){return this.getItem(e,"local")}getSessionStorageItem(e){return this.getItem(e,"session")}removeLocalStorageItem(e){this.removeItem(e,"local")}removeSessionStorageItem(e){this.removeItem(e,"session")}}const o=i.DI.createInterface((e=>e.singleton(r)))},17465:(e,t,s)=>{s.d(t,{v:()=>r});var i=s(35158);const r=(0,i.createLogger)("foundation-comms")},92277:(e,t,s)=>{s.d(t,{KJ:()=>E});var i=s(84225),r=s(17190),o=s(33681),n=s(84674),a=s(79780);const c=(0,s(35158).createLogger)("foundation-user"),d={trackActionExclusions:[],trackPathExclusions:[""],setUser(e,t){if(e.isAuthenticated)throw new Error("User already set. If this is intentional, please call User.unset first.");return c.debug("setUser",t),e.rawProperties=structuredClone(t),e.userKVs=t.userKVs,e.details=t.details,e.permission=t.permission,e.profile=t.profile,e.sourceRef=t.sourceRef,e.userName=t.userName,e.isAuthenticated=!0,e},unsetUser:e=>(c.debug("unsetUser"),e.rawProperties=void 0,e.userKVs=void 0,e.details=void 0,e.permission=void 0,e.profile=void 0,e.sourceRef=void 0,e.userName=void 0,e.isAuthenticated=!1,e)},h=n.DI.createInterface((e=>e.instance(d))),l=(0,a.Es)("genesis-user");class u{constructor(){this.pathHistory=[],this.actionHistory=[],this.isAuthenticated=!1,this.authenticationChangeListeners=(0,r.r)()}set(e){return this.config.setUser(this,e)}unset(){return this.config.unsetUser(this)}get isAnonymous(){return!this.isAuthenticated}isAdmin(){return this.hasProfile("ADMIN")}isBanned(){return this.hasProfile("BANNED")}hasPermission(e){return this.hasKey(this.permission,e)}hasProfile(e){return this.hasKey(this.profile,e)}trackPath(){const{pathname:e,search:t,hash:s}=location,i=`${`${"/"!==e?e:""}`}${t}${s}`;if(!this.config.trackPathExclusions.includes(i))return this.pathHistory.push(i),i}clearPaths(){this.pathHistory=[]}lastPath(){const e=this.pathHistory.length;return e>0?this.pathHistory[e-1]:void 0}trackAction(e){this.config.trackActionExclusions.includes(e)||this.actionHistory.push(e)}clearActions(){this.actionHistory=[]}lastAction(){const e=this.actionHistory.length;return e>0?this.actionHistory[e-1]:void 0}clearTrackingHistory(){this.clearPaths(),this.clearActions()}hasKey(e,t){return!!(e&&e.length&&t)&&(Array.isArray(t)||(t=[t]),t.some((t=>e.includes(t))))}addAuthenticationChangeListener(e){var t;return null===(t=this.authenticationChangeListeners)||void 0===t?void 0:t.subscribe(e)}isAuthenticatedChanged(){var e;null===(e=this.authenticationChangeListeners)||void 0===e||e.publish(new CustomEvent("user-authentication-change",{detail:this.isAuthenticated}));const t=n.DI.getOrCreateDOMContainer().get(l);t.postMessage("user-authentication-change",this.isAuthenticated),t.close()}userNameChanged(){o.Observable.notify(this,"username")}get username(){return o.Observable.track(this,"username"),this.userName}permissionChanged(){o.Observable.notify(this,"permissions")}get permissions(){return o.Observable.track(this,"permissions"),this.permission}profileChanged(){o.Observable.notify(this,"profiles")}get profiles(){return o.Observable.track(this,"profiles"),this.profile}hasAdminProfile(){return this.isAdmin()}}(0,i.__decorate)([h],u.prototype,"config",void 0),(0,i.__decorate)([o.observable],u.prototype,"pathHistory",void 0),(0,i.__decorate)([o.observable],u.prototype,"actionHistory",void 0),(0,i.__decorate)([o.observable],u.prototype,"isAuthenticated",void 0),(0,i.__decorate)([o.observable],u.prototype,"userKVs",void 0),(0,i.__decorate)([o.observable],u.prototype,"details",void 0),(0,i.__decorate)([o.observable],u.prototype,"permission",void 0),(0,i.__decorate)([o.observable],u.prototype,"profile",void 0),(0,i.__decorate)([o.observable],u.prototype,"sourceRef",void 0),(0,i.__decorate)([o.observable],u.prototype,"userName",void 0),(0,i.__decorate)([o.observable],u.prototype,"rawProperties",void 0);const E=n.DI.createInterface((e=>e.singleton(u)))},68424:(e,t,s)=>{s.d(t,{J:()=>o});var i=s(28745);function r(e){const t=[],s=new Set;return function e(i){const r=Array.from(i.querySelectorAll("*"));t.push(...r),r.forEach((t=>{t.shadowRoot&&!s.has(t.shadowRoot)&&(s.add(t.shadowRoot),e(t.shadowRoot))}))}(e),t}function o(e,t){let s=e;for(;s;){const e=s.tagName.toLowerCase();if(e.endsWith("-design-system-provider")){const t=e.split("-design-system-provider")[0];if(t)return i.v.debug(`Found provider by ancestor search: ${e}, prefix: ${t}`),t}s=s.parentElement?s.parentElement:s.getRootNode&&s.getRootNode()instanceof ShadowRoot?s.getRootNode().host:null}const o=document.querySelectorAll('[class*="-design-system-provider"],[id*="-design-system-provider"]'),n=Array.from(o),a=r(document).filter((e=>{var t;const s=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();return(null==s?void 0:s.endsWith("-design-system-provider"))||!1}));if(n.push(...a),n.length>0){const e=n[0].tagName.toLowerCase(),t=e.split("-design-system-provider")[0];if(t)return i.v.debug(`Found provider by document search: ${e}, prefix: ${t}`),t}return i.v.debug(`No provider found. Falling back to ${t}.`),t}},40729:(e,t,s)=>{s.d(t,{O:()=>d});var i=s(33681);const r=new Map([["FAST-TEXT-AREA","input"],["FAST-TEXT-FIELD","input"],["FOUNDATION-TEXT-AREA","input"],["FOUNDATION-TEXT-FIELD","input"],["INPUT","input"],["ZERO-TEXT-FIELD","input"]]);function o(e){this.keyAttr||(this.target[this.targetName]=e)}function n(e,t){this.keyAttr&&(this.updateTarget=o),this.originalBind.call(this,e,t),this.target.addEventListener(this.changeEvent,this.changeHandler)}function a(){this.originalUnbind.call(this),this.target.removeEventListener(this.changeEvent,this.changeHandler)}class c extends i.HTMLBindingDirective{constructor(e,t,s,i){super(e),this.keyAttr=i,this.conversionType=t,this.eventName=s}createBehavior(e){const t=super.createBehavior(e);return t.originalBind=t.bind,t.originalUnbind=t.unbind,t.keyAttr=this.keyAttr,t.bind=n,t.unbind=a,t.changeEvent=function(e,t){var s;const i=e.tagName;return"default"===t?null!==(s=r.get(i))&&void 0!==s?s:"change":t}(e,this.eventName),t.changeHandler=()=>{const e="boolean"===this.conversionType?t.target.checked:t.target.value;if(this.keyAttr){const s=t.bindingObserver.last,i=t.target[this.keyAttr];s.propertySource[s.propertyName][i]=this.convert(e)}else{const s=t.bindingObserver.last;s.propertySource[s.propertyName]=this.convert(e)}},t}convert(e){if(null==e)return e;switch(this.conversionType){case"time":const t=new Date(e).getTime();return isNaN(t)?void 0:t;case"number":return e.length?Number(e):void 0;case"string":return String(e);case"boolean":return Boolean(e);default:return e}}}function d(e,t="string",s="default",i){return new c(e,t,s,i)}},84686:(e,t,s)=>{s.d(t,{Be:()=>_,H6:()=>O,OB:()=>r,PF:()=>o,aW:()=>E,vN:()=>a});let i="webpack";try{i="webpack"}catch(e){}let r="/";try{r="auto".replace(/\/$/,"")}catch(e){}let o,n="gwf";try{"undefined"!=typeof SOCKET_EXT&&(n=SOCKET_EXT)}catch(e){}try{o=FORCE_HTTP}catch(e){}const a=`${location.protocol.replace("http","ws")}//${location.host}${r}/${n}/`;"true"===o?location.protocol:location.protocol.replace("http","ws");let c,d,h,l,u=null;try{"undefined"!=typeof API_HOST&&(u=API_HOST)}catch(e){}try{c=""}catch(e){}try{d=DEFAULT_ORGANISATION}catch(e){}try{h=DEFAULT_PASSWORD}catch(e){}try{l=DEFAULT_USER}catch(e){}let E="gwf/event-login-auth";"undefined"!=typeof GENX_LOGIN_URL&&(E=GENX_LOGIN_URL);let g="gwf/event-login-auth";"undefined"!=typeof GENX_LOGIN_REFRESH_URL&&(g=GENX_LOGIN_REFRESH_URL);let _="gwf/event-login-details";"undefined"!=typeof GENX_LOGIN_DETAILS_URL&&(_=GENX_LOGIN_DETAILS_URL);let v="gwf/event-logout";"undefined"!=typeof GENX_LOGOUT_URL&&(v=GENX_LOGOUT_URL);let S="gwf/event-change-user-password";"undefined"!=typeof GENX_CHANGE_PASSWORD_URL&&(S=GENX_CHANGE_PASSWORD_URL);let m="gwf/event-self-service-password-reset";"undefined"!=typeof GENX_FORGOT_PASSWORD_URL&&(m=GENX_FORGOT_PASSWORD_URL);let p="gwf/event-password-reset-action";"undefined"!=typeof GENX_RESET_PASSWORD_URL&&(p=GENX_RESET_PASSWORD_URL);let R="gwf/sso/list";"undefined"!=typeof GENX_SSO_LIST_URL&&(R=GENX_SSO_LIST_URL);let T="gwf/{type}/login?idp={id}";"undefined"!=typeof GENX_SSO_LOGIN_URL&&(T=GENX_SSO_LOGIN_URL);let O="default";"undefined"!=typeof GENX_ENVIRONMENT_LEVEL&&(O=GENX_ENVIRONMENT_LEVEL)},12066:(e,t,s)=>{s.d(t,{CL:()=>r,Ey:()=>a,zT:()=>n});const i=10;function r(e){return!e||isNaN(e)?null:new Date(e).toISOString().slice(0,i)}const o=19;function n(e){return!e||isNaN(e)?null:new Date(e).toISOString().slice(0,o).replace("T"," ")}function a(e,t){return t?n(e):r(e)}},17190:(e,t,s)=>{s.d(t,{j:()=>r,r:()=>i});const i=()=>{let e=[];return{subscribe:t=>(e.push(t),()=>e=e.filter((e=>e!==t))),publish(t){e.forEach((e=>e(t)))}}},r=(e,t)=>{const s={root:document.documentElement};new IntersectionObserver((e=>{e.forEach((e=>{t(e.intersectionRatio>0)}))}),s).observe(e)}},49229:(e,t,s)=>{s.d(t,{b_:()=>h});var i=s(17914),r=s(84674),o=s(61455);const n=r.DI.createInterface();function a(e){return Number.isSafeInteger(+e)?Number(e):(0,o.Fq)(e)?BigInt.asIntN(64,e):parseFloat(e)}const c={parse:e=>(0,o.qg)(e,null,a),stringify:e=>(0,o.As)(e)};let d=class{constructor(e=c){this.config=e,this.serialize=e=>this.config.stringify(e)}deserialize(e){return e?"string"==typeof e?this.config.parse(e):e&&e.ok?e.text().then((e=>this.config.parse(e))):(e&&e.data&&(e=e.data),this.config.parse(e)):Promise.resolve({})}};d=(0,i.__decorate)([(0,i.__param)(0,(0,r.optional)(n))],d);const h=r.DI.createInterface((e=>e.singleton(d)))},32808:(e,t,s)=>{s.d(t,{k:()=>c});var i=s(17914),r=s(84674),o=s(31261),n=s(28745);class a{constructor(){}createId(e=!1){const t=(0,o.A)();return e&&n.v.debug(`UUID.createID ${t}`),t}createRemoteId(e=!1){return(0,i.__awaiter)(this,void 0,void 0,(function*(){const t=(0,o.A)();return e&&n.v.debug(`UUID.createRemoteID ${t}`),t}))}}const c=r.DI.createInterface((e=>e.singleton(a)))}}]);
|
|
2
2
|
//# sourceMappingURL=1656.4cc5587050b5a7a10fe7f0136306f9b0.js.map
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
background: ${m.A.Canvas};
|
|
57
57
|
border-color: ${m.A.CanvasText};
|
|
58
58
|
}
|
|
59
|
-
`)),v={"^[\\+]?[(]?[0-9]{3}[)]?[-\\s\\.]?[0-9]{3}[-\\s\\.]?[0-9]{4,6}$":"Invalid phone number. Must match +###-###-######"};var f=a(
|
|
59
|
+
`)),v={"^[\\+]?[(]?[0-9]{3}[)]?[-\\s\\.]?[0-9]{3}[-\\s\\.]?[0-9]{4,6}$":"Invalid phone number. Must match +###-###-######"};var f=a(35158);const y=(0,f.createLogger)("foundation-form"),x=p.html`
|
|
60
60
|
<template>
|
|
61
61
|
${(0,p.when)((e=>!1),p.html`
|
|
62
62
|
<rapid-button class="clipboard-button" @click=${e=>e.copyUISchemaToClipboard()}>
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
</control-wrapper>
|
|
330
330
|
</template>
|
|
331
331
|
`)(e.prefix)}
|
|
332
|
-
`,tester:(0,c.Hc7)(3,N),mapper:c.kOB};var G=a(
|
|
332
|
+
`,tester:(0,c.Hc7)(3,N),mapper:c.kOB};var G=a(31334);const V=e=>t=>{if(!t||!(0,c.c0N)(t))return!1;const a=t.options;return!(!a||!a[e])},q=(0,c.Uo6)((0,c.or)(V("allOptionsResourceName"),V("data")),(0,c.or)((0,c.f4S)((e=>(0,c.dfR)(e,"array"))),(0,c.f4S)((e=>e.hasOwnProperty("oneOf")&&e.oneOf.some((e=>(0,c.dfR)(e,"array")))))));G.MultiselectDatasource;const U={renderer:p.html`
|
|
333
333
|
${e=>((e="zero")=>p.html`
|
|
334
334
|
<template>
|
|
335
335
|
<control-wrapper
|
|
@@ -372,8 +372,8 @@
|
|
|
372
372
|
style="width: 100%; min-width: 200px;"
|
|
373
373
|
async=${e=>{var t;return null===(t=e.control.uischema.options)||void 0===t?void 0:t.async}}
|
|
374
374
|
placeholder=${e=>e.control.uischema.placeholder||e.control.label}
|
|
375
|
-
autocomplete="list"
|
|
376
|
-
filter-mode="contains"
|
|
375
|
+
autocomplete=${e=>{var t;return"startsWith"===(null===(t=e.control.uischema.options)||void 0===t?void 0:t.filterMode)?"both":"list"}}
|
|
376
|
+
filter-mode=${e=>{var t;return(null===(t=e.control.uischema.options)||void 0===t?void 0:t.filterMode)||"contains"}}
|
|
377
377
|
?disabled=${e=>!e.control.enabled}
|
|
378
378
|
:value=${e=>(e=>{var t;const a=e.control.data;if(!a)return"";const o=((null===(t=e.control.uischema.options)||void 0===t?void 0:t.data)||[]).find((e=>e.value===a));return String((null==o?void 0:o.label)||a)})(e)}
|
|
379
379
|
@value-change=${(e,t)=>{var a;const o=null===(a=t.event.detail)||void 0===a?void 0:a.value;e.control.handleChange(e.control.path,o),e.onBlur()}}
|
|
@@ -430,8 +430,8 @@
|
|
|
430
430
|
>
|
|
431
431
|
<${e}-combobox
|
|
432
432
|
style="width: 100%; min-width: 200px;"
|
|
433
|
-
autocomplete="list"
|
|
434
|
-
filter-mode="contains"
|
|
433
|
+
autocomplete=${e=>{var t;return"startsWith"===(null===(t=e.control.uischema.options)||void 0===t?void 0:t.filterMode)?"both":"list"}}
|
|
434
|
+
filter-mode=${e=>{var t;return(null===(t=e.control.uischema.options)||void 0===t?void 0:t.filterMode)||"contains"}}
|
|
435
435
|
?disabled=${e=>!e.control.enabled}
|
|
436
436
|
:value=${e=>(e=>{var t,a,o,r;let n=e.control.data;if(!n){const r=null===(o=null===(a=null===(t=e.control.schema)||void 0===t?void 0:t.oneOf)||void 0===a?void 0:a.find((e=>e.hasOwnProperty("default"))))||void 0===o?void 0:o.default;r&&(n=(0,$.D)(r),ee(e,n))}return(null===(r=e.control.options.find((e=>e.value===n)))||void 0===r?void 0:r.label)||""})(e)}
|
|
437
437
|
@change=${(e,t)=>ee(e,t.event.target.value)}
|
|
@@ -2756,7 +2756,7 @@
|
|
|
2756
2756
|
${vs}
|
|
2757
2757
|
${ys}
|
|
2758
2758
|
${Ss}
|
|
2759
|
-
`;const ws=(0,a(82128).U)("zero"),As="ag-theme-genesis-rapid-dark",Cs="ag-theme-genesis-rapid-light";class Fs extends ss.cF{constructor(){super(...arguments),this.theme="light"===localStorage.getItem("luminance")?Cs:As}connectedCallback(){super.connectedCallback(),g.baseLayerLuminance.subscribe({handleChange:e=>{const t=g.baseLayerLuminance.getValueFor(e.target);this.theme=t===g.StandardLuminance.DarkMode?As:Cs}},this.provider)}themeChanged(e,t){(e||t===As)&&super.themeChanged(e,t)}set gridOptions(e){var t,a,o;e.components=Object.assign({[ls.IX.action]:qi,[ls.IX.actionsMenu]:Ji,[ls.IX.boolean]:Zi,[ls.IX.editable]:Ii,[ls.IX.statusPill]:rs,[ls.IX.select]:ts,[ls.IX.selectEditor]:Ti,[ls.IX.numberEditor]:Ei,[ls.IX.multiselectEditor]:zi,[ls.IX.dateEditor]:Ci,[ls.IX.stringEditor]:Bi},null!==(t=e.components)&&void 0!==t?t:{});(this.theme===bs||this.theme===fs||this.theme===xs)&&(this.headerHeight=null!==(a=e.headerHeight)&&void 0!==a?a:32,this.rowHeight=null!==(o=e.rowHeight)&&void 0!==o?o:32),super.gridOptions=e}}(0,is.__decorate)([p.observable],Fs.prototype,"provider",void 0);const Rs=ss.LU,zs=ss.Z$,Os={zeroAgEditableRenderer:Gi,zeroAgActionRenderer:Ui,zeroAgActionsMenuRenderer:Yi,zeroAgBooleanRenderer:Xi,zeroAgTextRenderer:_i,zeroAgSelectRenderer:as,zeroStatusPillRenderer:ns,zeroAgDateEditor:Fi,zeroAgMultiselectEditor:Oi,zeroAgSelectEditor:Li,zeroAgNumberEditor:Mi,zeroAgStringEditor:Hi,zeroGridPro:Fs.compose(Object.assign({baseName:"grid-pro",template:ws,styles:ks,shadowOptions:Rs},zs)),register(e,...t){if(e)for(const a in this)"register"!==a&&this[a]().register(e,...t)}};var Ds,Ts=a(
|
|
2759
|
+
`;const ws=(0,a(82128).U)("zero"),As="ag-theme-genesis-rapid-dark",Cs="ag-theme-genesis-rapid-light";class Fs extends ss.cF{constructor(){super(...arguments),this.theme="light"===localStorage.getItem("luminance")?Cs:As}connectedCallback(){super.connectedCallback(),g.baseLayerLuminance.subscribe({handleChange:e=>{const t=g.baseLayerLuminance.getValueFor(e.target);this.theme=t===g.StandardLuminance.DarkMode?As:Cs}},this.provider)}themeChanged(e,t){(e||t===As)&&super.themeChanged(e,t)}set gridOptions(e){var t,a,o;e.components=Object.assign({[ls.IX.action]:qi,[ls.IX.actionsMenu]:Ji,[ls.IX.boolean]:Zi,[ls.IX.editable]:Ii,[ls.IX.statusPill]:rs,[ls.IX.select]:ts,[ls.IX.selectEditor]:Ti,[ls.IX.numberEditor]:Ei,[ls.IX.multiselectEditor]:zi,[ls.IX.dateEditor]:Ci,[ls.IX.stringEditor]:Bi},null!==(t=e.components)&&void 0!==t?t:{});(this.theme===bs||this.theme===fs||this.theme===xs)&&(this.headerHeight=null!==(a=e.headerHeight)&&void 0!==a?a:32,this.rowHeight=null!==(o=e.rowHeight)&&void 0!==o?o:32),super.gridOptions=e}}(0,is.__decorate)([p.observable],Fs.prototype,"provider",void 0);const Rs=ss.LU,zs=ss.Z$,Os={zeroAgEditableRenderer:Gi,zeroAgActionRenderer:Ui,zeroAgActionsMenuRenderer:Yi,zeroAgBooleanRenderer:Xi,zeroAgTextRenderer:_i,zeroAgSelectRenderer:as,zeroStatusPillRenderer:ns,zeroAgDateEditor:Fi,zeroAgMultiselectEditor:Oi,zeroAgSelectEditor:Li,zeroAgNumberEditor:Mi,zeroAgStringEditor:Hi,zeroGridPro:Fs.compose(Object.assign({baseName:"grid-pro",template:ws,styles:ks,shadowOptions:Rs},zs)),register(e,...t){if(e)for(const a in this)"register"!==a&&this[a]().register(e,...t)}};var Ds,Ts=a(22168),Ls=a(39232),Ps=a(91510);!function(e){e.STYLES_CHANGED="styles-changed",e.DS_CHANGED="design-system-changed",e.APPLY_CUSTOM_DESIGN="apply-custom-design"}(Ds||(Ds={}));const Es={Roboto:ct,"Segoe UI":'"Segoe UI", Arial, Helvetica, sans-serif',Monospace:'Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace',"Times New Roman":'Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif',Garamond:'"Palatino Linotype", Palatino, Palladio, "URW Palladio L", "Book Antiqua", Baskerville, "Bookman Old Style", "Bitstream Charter", "Nimbus Roman No9 L", Garamond, "Apple Garamond", "ITC Garamond Narrow", "New Century Schoolbook", "Century Schoolbook", "Century Schoolbook L", Georgia, serif',Georgia:'Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif',Helvetica:'Frutiger, "Frutiger Linotype", Univers, Calibri, "Gill Sans", "Gill Sans MT", "Myriad Pro", Myriad, "DejaVu Sans Condensed", "Liberation Sans", "Nimbus Sans L", Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif',Verdana:'Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif'},Ms=Es["Segoe UI"],js=p.css`
|
|
2760
2760
|
${(0,u.display)("block")} :host {
|
|
2761
2761
|
width: 100%;
|
|
2762
2762
|
display: inline-flex;
|
|
@@ -4136,4 +4136,4 @@
|
|
|
4136
4136
|
</rapid-tabs>
|
|
4137
4137
|
</template>
|
|
4138
4138
|
`;let Ol=class extends p.FASTElement{};Ol=(0,Ps.__decorate)([(0,p.customElement)({name:"design-system-preview",template:zl,styles:bl})],Ol),((e,t="zero")=>(0,G.provideDesignSystem)(e,t,r,o))().register(wi,Os),(0,Ts.provideDesignSystem)().register(Ts.baseComponents,Ls.rapidGridComponents)}}]);
|
|
4139
|
-
//# sourceMappingURL=2024.
|
|
4139
|
+
//# sourceMappingURL=2024.7709bad93d744a972b8bb787fee3c0fc.js.map
|