@genesislcap/foundation-rapid-cdn 14.433.0 → 14.434.0-moreRowsPolling.1
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.
|
@@ -52,7 +52,7 @@ function Dd(e,t,i,c){var o,s=arguments.length,n=s<3?t:c;if("object"==typeof Refl
|
|
|
52
52
|
Click "Continue Session" to stay logged in, or "Logout Now" to end your session immediately.
|
|
53
53
|
</p></div><div class="dialog-actions"><${e}-button appearance="accent" @click=${e=>e.handleContinue()}class="continue-button">
|
|
54
54
|
Continue Session </${e}-button><${e}-button appearance="outline" @click=${e=>e.handleLogout()}class="logout-button">
|
|
55
|
-
Logout Now </${e}-button></div></div></${e}-card></div>`)(Zm(e,"rapid").prefix)} `,styles:xe` .inactivity-overlay{position: fixed;inset: 0;width: 100vw;height: 100vh;background-color: rgba(0, 0, 0, 0.6);display: flex;align-items: center;justify-content: center;z-index: 9999;backdrop-filter: blur(2px)}.dialog-card{height: 260px;max-height: 260px;max-width: 520px;width: 92%}.card-body{padding: 24px;box-sizing: border-box}.dialog-header{display: flex;align-items: center;gap: 12px;margin-bottom: 16px}.warning-icon{color: var(--accent-fill-rest);font-size: 24px}.dialog-header h2{margin: 0;color: var(--neutral-foreground-rest);font-size: 20px;font-weight: 600}.dialog-content{margin-bottom: 24px}.dialog-content p{margin: 0 0 12px 0;color: var(--neutral-foreground-rest);line-height: 1.5}.dialog-content p:last-child{margin-bottom: 0}.dialog-content strong{color: var(--accent-foreground-rest);font-weight: 600}.dialog-actions{display: flex;gap: 12px;justify-content: flex-end}.continue-button{min-width: 140px}.logout-button{min-width: 120px}@media (max-width: 480px){.card-body{padding: 20px}.dialog-actions{flex-direction: column}.continue-button, .logout-button{width: 100%}}`})],xz);class Lz{constructor(){this.pathHistory=[],this.actionHistory=[],this.isAuthenticated=!1,this.authenticationChangeListeners=Wm()}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:i}=location,c=`${`${"/"!==e?e:""}`}${t}${i}`;if(!this.config.trackPathExclusions.includes(c))return this.pathHistory.push(c),c}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=ft.getOrCreateDOMContainer().get(Gm);t.postMessage("user-authentication-change",this.isAuthenticated),t.close()}userNameChanged(){m.notify(this,"username")}get username(){return m.track(this,"username"),this.userName}permissionChanged(){m.notify(this,"permissions")}get permissions(){return m.track(this,"permissions"),this.permission}profileChanged(){m.notify(this,"profiles")}get profiles(){return m.track(this,"profiles"),this.profile}hasAdminProfile(){return this.isAdmin()}}Eu([qm],Lz.prototype,"config",void 0),Eu([g],Lz.prototype,"pathHistory",void 0),Eu([g],Lz.prototype,"actionHistory",void 0),Eu([g],Lz.prototype,"isAuthenticated",void 0),Eu([g],Lz.prototype,"userKVs",void 0),Eu([g],Lz.prototype,"details",void 0),Eu([g],Lz.prototype,"permission",void 0),Eu([g],Lz.prototype,"profile",void 0),Eu([g],Lz.prototype,"sourceRef",void 0),Eu([g],Lz.prototype,"userName",void 0),Eu([g],Lz.prototype,"rawProperties",void 0);const Mz=ft.createInterface(e=>e.singleton(Lz));class wz{constructor(){this.cachedMetadata=new Map,this.cachedJsonSchema=new Map,this.cachedResources=null}getMetadataFor(e){return this.cachedMetadata.get(e)}getJsonSchemaFor(e){return this.cachedJsonSchema.get(e)}getResources(){return this.cachedResources}hasMetadataFor(e){return this.cachedMetadata.has(e)}hasJsonSchemaFor(e){return this.cachedJsonSchema.has(e)}hasResources(){return null!==this.cachedResources}setMetadataFor(e,t){this.cachedMetadata.set(e,t)}setJsonSchemaFor(e,t){this.cachedJsonSchema.set(e,t)}setResources(e){this.cachedResources=e}}const Sz=ft.createInterface(e=>e.singleton(wz));var kz;!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"}(kz||(kz={}));const $z={STRING:kz.STRING,ENUM:kz.ENUM,BOOLEAN:kz.BOOLEAN,INT:kz.NUMBER,LONG:kz.NUMBER,DOUBLE:kz.NUMBER,BIGDECIMAL:kz.NUMBER,DATE:kz.DATE,DATETIME:kz.DATETIME,NANO_TIMESTAMP:kz.NANO_TIMESTAMP};var Ez;!function(e){e.DATASERVER="DATASERVER",e.EVENT_HANDLER="EVENT_HANDLER",e.REQUEST_SERVER="REQUEST_SERVER"}(Ez||(Ez={}));const Nz="datasource-status-changed",Az=e=>e?e.map(e=>{const t={name:e.NAME,type:$z[e.TYPE]||kz.STRING};if(e.TYPE===kz.ENUM&&e.VALID_VALUES)try{t.enumOptions=Array.isArray(e.VALID_VALUES)?e.VALID_VALUES:e.VALID_VALUES.split("|")}catch(e){Dm.error(e),t.enumOptions=[]}return t}):null,Tz=e=>{var t;const i=null==e?void 0:e.TYPE;if(i===Ez.DATASERVER)return e.FIELD||[];if(i===Ez.REQUEST_SERVER)return e.REPLY_FIELD||(null===(t=e.REPLY)||void 0===t?void 0:t.FIELD)||[];throw new Error(`Unsupported resource type: ${i}`)};class Oz{constructor(){this.streamListeners=Wm(),this.streamCompleteListeners=Wm(),this.streamErrorListeners=Wm(),this.commitListeners=Wm(),this.metadataListeners=Wm(),this.commitResponseListeners=Wm()}addStreamListener(e,t,i){var c,o,s;const n=null===(c=this.streamListeners)||void 0===c?void 0:c.subscribe(e),a=null===(o=this.streamCompleteListeners)||void 0===o?void 0:o.subscribe(t),r=null===(s=this.streamErrorListeners)||void 0===s?void 0:s.subscribe(i);return()=>{n(),a(),r()}}onStreamEvent(e,t,i,c){var o;null===(o=this.streamListeners)||void 0===o||o.publish(new CustomEvent("connect-stream-event",{detail:{functions:c,message:t,resourceName:e,stream:i}}))}onStreamErrorEvent(e,t,i){var c;null===(c=this.streamErrorListeners)||void 0===c||c.publish(new CustomEvent("connect-stream-error-event",{detail:{resourceName:e,stream:t,error:i}}))}onStreamCompleteEvent(e,t){var i;null===(i=this.streamCompleteListeners)||void 0===i||i.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 i;null===(i=this.commitListeners)||void 0===i||i.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,i){var c;null===(c=this.metadataListeners)||void 0===c||c.publish(new CustomEvent("connect-metadata-event",{detail:{resourceName:e,message:t,error:i}}))}addCommitResponseListener(e){var t;return null===(t=this.commitResponseListeners)||void 0===t?void 0:t.subscribe(e)}onCommitResponseEvent(e,t){var i;null===(i=this.commitResponseListeners)||void 0===i||i.publish(new CustomEvent("connect-commit-response-event",{detail:{eventName:e,response:t}}))}}const Iz=ft.createInterface(e=>e.singleton(Oz)),Rz=ft.createInterface(e=>e.aliasTo(Iz)),Dz={connect:{alwaysOn:!1,enableHeartbeat:!0,enableHeartbeatLogging:!1,heartbeatInterval:1e4,verboseHeartbeat:!1,enableMessageLogging:!1},reconnect:{reconnectAttempts:10,reconnectInterval:1e4,reconnectStreams:!0},isWebSocketExpression:Fm},Fz=ft.createInterface(e=>e.instance(Dz));var _z={ACCEPTED:202,BAD_GATEWAY:502,BAD_REQUEST:400,CONFLICT:409,CONTINUE:100,CREATED:201,EXPECTATION_FAILED:417,FORBIDDEN:403,GATEWAY_TIMEOUT:504,GONE:410,HTTP_VERSION_NOT_SUPPORTED:505,IM_A_TEAPOT:418,INSUFFICIENT_SPACE_ON_RESOURCE:419,INSUFFICIENT_STORAGE:507,INTERNAL_SERVER_ERROR:500,LENGTH_REQUIRED:411,LOCKED:423,METHOD_FAILURE:420,METHOD_NOT_ALLOWED:405,MOVED_PERMANENTLY:301,MOVED_TEMPORARILY:302,MULTI_STATUS:207,MULTIPLE_CHOICES:300,NETWORK_AUTHENTICATION_REQUIRED:511,NO_CONTENT:204,NON_AUTHORITATIVE_INFORMATION:203,NOT_ACCEPTABLE:406,NOT_FOUND:404,NOT_IMPLEMENTED:501,NOT_MODIFIED:304,OK:200,PARTIAL_CONTENT:206,PAYMENT_REQUIRED:402,PERMANENT_REDIRECT:308,PRECONDITION_FAILED:412,PRECONDITION_REQUIRED:428,PROCESSING:102,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_HEADER_FIELDS_TOO_LARGE:431,REQUEST_TIMEOUT:408,REQUEST_TOO_LONG:413,REQUEST_URI_TOO_LONG:414,REQUESTED_RANGE_NOT_SATISFIABLE:416,RESET_CONTENT:205,SEE_OTHER:303,SERVICE_UNAVAILABLE:503,SWITCHING_PROTOCOLS:101,TEMPORARY_REDIRECT:307,TOO_MANY_REQUESTS:429,UNAUTHORIZED:401,UNPROCESSABLE_ENTITY:422,UNSUPPORTED_MEDIA_TYPE:415,USE_PROXY:305},Hz={202:"Accepted",502:"Bad Gateway",400:"Bad Request",409:"Conflict",100:"Continue",201:"Created",417:"Expectation Failed",424:"Failed Dependency",403:"Forbidden",504:"Gateway Timeout",410:"Gone",505:"HTTP Version Not Supported",418:"I'm a teapot",419:"Insufficient Space on Resource",507:"Insufficient Storage",500:"Internal Server Error",411:"Length Required",423:"Locked",420:"Method Failure",405:"Method Not Allowed",301:"Moved Permanently",302:"Moved Temporarily",207:"Multi-Status",300:"Multiple Choices",511:"Network Authentication Required",204:"No Content",203:"Non Authoritative Information",406:"Not Acceptable",404:"Not Found",501:"Not Implemented",304:"Not Modified",200:"OK",206:"Partial Content",402:"Payment Required",308:"Permanent Redirect",412:"Precondition Failed",428:"Precondition Required",102:"Processing",103:"Early Hints",426:"Upgrade Required",407:"Proxy Authentication Required",431:"Request Header Fields Too Large",408:"Request Timeout",413:"Request Entity Too Large",414:"Request-URI Too Long",416:"Requested Range Not Satisfiable",205:"Reset Content",303:"See Other",503:"Service Unavailable",101:"Switching Protocols",307:"Temporary Redirect",429:"Too Many Requests",401:"Unauthorized",451:"Unavailable For Legal Reasons",422:"Unprocessable Entity",415:"Unsupported Media Type",305:"Use Proxy",421:"Misdirected Request"},Pz={Accepted:202,"Bad Gateway":502,"Bad Request":400,Conflict:409,Continue:100,Created:201,"Expectation Failed":417,"Failed Dependency":424,Forbidden:403,"Gateway Timeout":504,Gone:410,"HTTP Version Not Supported":505,"I'm a teapot":418,"Insufficient Space on Resource":419,"Insufficient Storage":507,"Internal Server Error":500,"Length Required":411,Locked:423,"Method Failure":420,"Method Not Allowed":405,"Moved Permanently":301,"Moved Temporarily":302,"Multi-Status":207,"Multiple Choices":300,"Network Authentication Required":511,"No Content":204,"Non Authoritative Information":203,"Not Acceptable":406,"Not Found":404,"Not Implemented":501,"Not Modified":304,OK:200,"Partial Content":206,"Payment Required":402,"Permanent Redirect":308,"Precondition Failed":412,"Precondition Required":428,Processing:102,"Early Hints":103,"Upgrade Required":426,"Proxy Authentication Required":407,"Request Header Fields Too Large":431,"Request Timeout":408,"Request Entity Too Large":413,"Request-URI Too Long":414,"Requested Range Not Satisfiable":416,"Reset Content":205,"See Other":303,"Service Unavailable":503,"Switching Protocols":101,"Temporary Redirect":307,"Too Many Requests":429,Unauthorized:401,"Unavailable For Legal Reasons":451,"Unprocessable Entity":422,"Unsupported Media Type":415,"Use Proxy":305,"Misdirected Request":421};var Vz,Bz,Uz=function(e){var t=Hz[e.toString()];if(!t)throw new Error("Status code does not exist: "+e);return t};!function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",e[e.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",e[e.METHOD_FAILURE=420]="METHOD_FAILURE",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(Vz||(Vz={})),function(e){e.ACCEPTED="Accepted",e.BAD_GATEWAY="Bad Gateway",e.BAD_REQUEST="Bad Request",e.CONFLICT="Conflict",e.CONTINUE="Continue",e.CREATED="Created",e.EXPECTATION_FAILED="Expectation Failed",e.FAILED_DEPENDENCY="Failed Dependency",e.FORBIDDEN="Forbidden",e.GATEWAY_TIMEOUT="Gateway Timeout",e.GONE="Gone",e.HTTP_VERSION_NOT_SUPPORTED="HTTP Version Not Supported",e.IM_A_TEAPOT="I'm a teapot",e.INSUFFICIENT_SPACE_ON_RESOURCE="Insufficient Space on Resource",e.INSUFFICIENT_STORAGE="Insufficient Storage",e.INTERNAL_SERVER_ERROR="Internal Server Error",e.LENGTH_REQUIRED="Length Required",e.LOCKED="Locked",e.METHOD_FAILURE="Method Failure",e.METHOD_NOT_ALLOWED="Method Not Allowed",e.MOVED_PERMANENTLY="Moved Permanently",e.MOVED_TEMPORARILY="Moved Temporarily",e.MULTI_STATUS="Multi-Status",e.MULTIPLE_CHOICES="Multiple Choices",e.NETWORK_AUTHENTICATION_REQUIRED="Network Authentication Required",e.NO_CONTENT="No Content",e.NON_AUTHORITATIVE_INFORMATION="Non Authoritative Information",e.NOT_ACCEPTABLE="Not Acceptable",e.NOT_FOUND="Not Found",e.NOT_IMPLEMENTED="Not Implemented",e.NOT_MODIFIED="Not Modified",e.OK="OK",e.PARTIAL_CONTENT="Partial Content",e.PAYMENT_REQUIRED="Payment Required",e.PERMANENT_REDIRECT="Permanent Redirect",e.PRECONDITION_FAILED="Precondition Failed",e.PRECONDITION_REQUIRED="Precondition Required",e.PROCESSING="Processing",e.EARLY_HINTS="Early Hints",e.UPGRADE_REQUIRED="Upgrade Required",e.PROXY_AUTHENTICATION_REQUIRED="Proxy Authentication Required",e.REQUEST_HEADER_FIELDS_TOO_LARGE="Request Header Fields Too Large",e.REQUEST_TIMEOUT="Request Timeout",e.REQUEST_TOO_LONG="Request Entity Too Large",e.REQUEST_URI_TOO_LONG="Request-URI Too Long",e.REQUESTED_RANGE_NOT_SATISFIABLE="Requested Range Not Satisfiable",e.RESET_CONTENT="Reset Content",e.SEE_OTHER="See Other",e.SERVICE_UNAVAILABLE="Service Unavailable",e.SWITCHING_PROTOCOLS="Switching Protocols",e.TEMPORARY_REDIRECT="Temporary Redirect",e.TOO_MANY_REQUESTS="Too Many Requests",e.UNAUTHORIZED="Unauthorized",e.UNAVAILABLE_FOR_LEGAL_REASONS="Unavailable For Legal Reasons",e.UNPROCESSABLE_ENTITY="Unprocessable Entity",e.UNSUPPORTED_MEDIA_TYPE="Unsupported Media Type",e.USE_PROXY="Use Proxy",e.MISDIRECTED_REQUEST="Misdirected Request"}(Bz||(Bz={}));var jz=this&&this.__assign||function(){return jz=Object.assign||function(e){for(var t,i=1,c=arguments.length;i<c;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},jz.apply(this,arguments)};jz(jz({},_z),{getStatusCode:function(e){var t=Pz[e];if(!t)throw new Error("Reason phrase does not exist: "+e);return t},getStatusText:Uz});class qz{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:i}=location;if(e&&(e.includes("/login")||e.includes("/auth")))return;const c=`${"/"!==e?e:""}`;this.returnUrl=`${c}${t}${i}`,this.setSessionStorageItem("returnUrl",this.returnUrl)}setItem(e,t,i){"local"===i?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 Gz=ft.createInterface(e=>e.singleton(qz));function Wz(e){const t=new Error(`HTTP error: ${e.status} ${e.statusText}`);return t.status=e.status,t.message=e.statusText,t}let Yz=class{constructor(e){this.serializer=e}get(e,t){return Au(this,void 0,void 0,function*(){const i=yield fetch(e,Object.assign(Object.assign({credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"}},t),{method:"GET"}));if(i.redirected)return window.location.href=i.url,new Promise(()=>{});if(!i.ok)throw Wz(i);return(t.serializer||this.serializer).deserialize(i)})}post(e,t){return Au(this,void 0,void 0,function*(){const i=yield fetch(e,Object.assign(Object.assign({credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"}},t),{method:"POST"}));if(i.redirected)return window.location.href=i.url,new Promise(()=>{});if(!i.ok)throw Wz(i);return(t.serializer||this.serializer).deserialize(i)})}};Yz=Eu([Nu(0,Kv)],Yz);const Kz=ft.createInterface(e=>e.singleton(Yz)),Zz={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},bg&&bg.length?JSON.parse(bg):{})},Qz=ft.createInterface(e=>e.instance(Zz));var Xz,Jz,eC,tC;!function(e){e.BASIC="BASIC",e.SSO="SSO",e.JWT="JWT",e.REFRESH="REFRESH"}(Xz||(Xz={}));class iC extends Error{constructor(e,t,i="Auth Failed \n"){super(i),this.sent=e,this.received=t,Object.setPrototypeOf(this,iC.prototype)}isIgnorableError(){var e,t,i,c,o,s,n,a;return!!(null===(c=null===(i=null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)||void 0===i?void 0:i.toLowerCase())||void 0===c?void 0:c.includes("request needs the user to be logged"))||!!(null===(a=null===(n=null===(s=null===(o=this.received)||void 0===o?void 0:o.DETAILS)||void 0===s?void 0:s.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,i,c;return Array.isArray(null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)?null===(c=null===(i=this.received)||void 0===i?void 0:i.DETAILS)||void 0===c?void 0:c.ERROR.map(e=>this.errorDetailFormatter(e)).join("\n"):""}hasPasswordExpiredError(){return this.hasErrorCode("PASSWORD_EXPIRED")}hasMFAError(){return this.hasErrorCode("MFA_REQUIRED")||this.hasErrorCode("MFA_FAILED")}requiresTermsAndConditions(){return this.hasErrorCode("TERMS_ACCEPTANCE_REQUIRED")}hasErrorCode(e){var t,i;return!!Array.isArray(null===(t=this.received)||void 0===t?void 0:t.ERROR)&&(null===(i=this.received)||void 0===i?void 0:i.ERROR.some(t=>t.CODE===e))}errorDetailFormatter(e){return`\n ${e.CODE}: \n ${e.TEXT}`}}!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"}(Jz||(Jz={})),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"}(eC||(eC={})),function(e){e.SESSION_NOT_FOUND="SESSION_NOT_FOUND",e.UNKNOWN_MESSAGE_TYPE="UNKNOWN_MESSAGE_TYPE"}(tC||(tC={}));const cC=(e,t)=>!!Array.isArray(null==e?void 0:e.ERROR)&&(null==e?void 0:e.ERROR.some(e=>{var i,c;return(null===(i=e.CODE)||void 0===i?void 0:i.includes(`${t}`))||(null===(c=e.STATUS_CODE)||void 0===c?void 0:c.includes(`${t}`))}));let oC=class{constructor(e,t){this.session=e,this.uuid=t}createLoginMessage(e){let t;switch(e.type){case Xz.BASIC:t={USER_NAME:e.username,PASSWORD:e.password,MFA_CODE:e.mfaToken};break;case Xz.REFRESH:t={USER_NAME:e.username,REFRESH_AUTH_TOKEN:e.refreshToken,MFA_CODE:e.mfaToken};break;case Xz.SSO:t={SSO_TOKEN:e.ssoToken};break;case Xz.JWT:t={JWT:e.jwt,DOMAIN:e.domain}}return{DETAILS:t,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.EVENT_LOGIN_AUTH}}createLogoutMessage(e){var t,i;return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.EVENT_LOGOUT,SESSION_AUTH_TOKEN:null!==(t=e.authToken)&&void 0!==t?t:this.session.getSessionStorageItem("authToken"),SESSION_ID:null!==(i=e.sessionId)&&void 0!==i?i:this.session.getSessionStorageItem("sessionId")}}createDataLogonMessage(e,t){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.DATA_LOGON,DETAILS:Object.assign({DATASOURCE_NAME:e},t),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createDataLogoffMessage(e){return{SOURCE_REF:e,MESSAGE_TYPE:eC.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:eC.RESOURCES_REQUEST},e)}createMetaRequestMessage(e,t=eC.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:eC.EVENT_LOGIN_AUTH,DETAILS:{REFRESH_AUTH_TOKEN:this.session.getSessionStorageItem("refreshToken"),MFA_CODE:this.session.getSessionStorageItem("mfaToken")}}}createChangePasswordMessage(e,t,i){return{USER_NAME:e,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.EVENT_CHANGE_USER_PASSWORD,DETAILS:{OLD_PASSWORD:t,NEW_PASSWORD:i}}}createForgotPasswordMessage(e,t,i=e){return{USER_NAME:i,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.EVENT_SELF_SERVICE_PASSWORD_RESET,DETAILS:{USER_NAME:e,RETURN_URL:t}}}createForgotPasswordTokenMessage(e,t,i,c=e){return{USER_NAME:c,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.EVENT_PASSWORD_RESET_ACTION,DETAILS:{USER_NAME:e,RESET_TOKEN:t,NEW_PASSWORD:i}}}createMoreRowsMessage(e,t){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:Jz.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:Jz.MORE_COLUMNS})}createHTTPHeadersFromMessage(e,t="application/json; charset=UTF-8"){const i={"Content-type":t};return e.SOURCE_REF&&(i["source-ref"]=e.SOURCE_REF,i.SOURCE_REF=e.SOURCE_REF),e.SESSION_AUTH_TOKEN&&(i["SESSION-AUTH-TOKEN"]=e.SESSION_AUTH_TOKEN),e.MESSAGE_TYPE===eC.EVENT_LOGOUT&&(i["SESSION-ID"]=e.SESSION_ID),i}createHeartbeatPingMessage(e=!1){return{MESSAGE_TYPE:Jz.HEARTBEAT_PING,SOURCE_REF:this.uuid.createId(),VERBOSE:e,DETAILS:{},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}};oC=Eu([Nu(0,Gz),Nu(1,Cz)],oC);const sC=ft.createInterface(e=>e.singleton(oC));function nC(e,t,i){const c=e=>"function"==typeof e?e:()=>e,o=c(t),s=c(i);return(t,i)=>e(t,i)?o(t,i):s(t,i)}class aC{constructor(e){this.path=e}}const rC=new Set,lC=Object.freeze({register(e){rC.add(e)},unregister(e){rC.delete(e)}}),dC=/^([a-z][a-z0-9+\-.]*:)?\/\//i,hC=Object.freeze({path:Object.freeze({get current(){return location.pathname+location.search},generateRoute(e,t,i={}){return Au(this,void 0,void 0,function*(){let c="config"in e?e:VC.find(e);for(;null!==c;){const e=yield c.config.generateRouteFromPath(t,i);if(null!==e)return e;c=c.parent}return null})},push(e,t=!0){e&&dC.test(e)?location.href=e:(history.pushState({},document.title,e),t&&hC.path.trigger(e))},replace(e,t=!0){e&&dC.test(e)?location.href=e:(history.replaceState({},document.title,e),t&&hC.path.trigger(e))},trigger(e){const t=new aC(e);for(const e of rC)e.enqueue(t)}}),name:Object.freeze({generateRoute(e,t,i={}){return Au(this,void 0,void 0,function*(){let c="config"in e?e:VC.find(e);for(;null!==c;){const e=yield c.config.generateRouteFromName(t,i);if(null!==e)return e;c=c.parent}return null})},push(e,t,i={},c=!0){return Au(this,void 0,void 0,function*(){const o=yield hC.name.generateRoute(e,t,i);null!==o&&hC.path.push(o,c)})},replace(e,t,i={},c=!0){return Au(this,void 0,void 0,function*(){const o=yield hC.name.generateRoute(e,t,i);null!==o&&hC.path.replace(o,c)})},trigger(e,t,i={}){return Au(this,void 0,void 0,function*(){const c=yield hC.name.generateRoute(e,t,i);null!==c&&hC.path.trigger(c)})}})});class uC{constructor(){this.queue=[],this.promise=null,this.resolve=null}connect(){this.enqueue(new aC(hC.path.current)),window.addEventListener("popstate",this),lC.register(this)}disconnect(){this.queue=[],this.promise=null,this.resolve=null,window.removeEventListener("popstate",this),lC.unregister(this)}receive(){return null!==this.promise||(this.promise=new Promise(e=>this.resolve=e),Promise.resolve().then(()=>this.tryDequeue())),this.promise}enqueue(e){this.queue.push(e),this.tryDequeue()}tryDequeue(){if(null===this.resolve||0===this.queue.length)return;const e=this.queue[this.queue.length-1],t=this.resolve;this.queue.length=0,this.promise=null,this.resolve=null,t(e)}handleEvent(e){this.enqueue(new aC(hC.path.current))}}const fC=encodeURIComponent,pC=e=>fC(e).replace("%24","$");function mC(e,t,i){let c=[];if(null==t)return c;if(Array.isArray(t))for(let o=0,s=t.length;o<s;o++)if(i)c.push(`${pC(e)}=${fC(t[o])}`);else{const i=e+"["+("object"==typeof t[o]&&null!==t[o]?o:"")+"]";c=c.concat(mC(i,t[o]))}else if("object"!=typeof t||i)c.push(`${pC(e)}=${fC(t)}`);else for(const i in t)c=c.concat(mC(e+"["+i+"]",t[i]));return c}function gC(e,t){return Array.isArray(e)?(e.push(t),e):void 0!==e?[e,t]:t}function vC(e,t,i){let c=e;const o=t.length-1;for(let e=0;e<=o;e++){const s=""===t[e]?c.length:t[e];if(e<o){const i=c[s]&&"object"!=typeof c[s]?[c[s]]:c[s];c=c[s]=i||(isNaN(t[e+1])?{}:[])}else c=c[s]=i}}const bC=Object.freeze({get current(){return location.search},build(e,t){let i=[];const c=Object.keys(e||{}).sort();for(let o=0,s=c.length;o<s;o++){const s=c[o];i=i.concat(mC(s,e[s],t))}return 0===i.length?"":i.join("&")},separate(e){const t=e.indexOf("?");let i="";return-1!==t&&(i=e.substr(t+1,e.length),e=e.substr(0,t)),{path:e,queryString:i}},parse(e){const t={};if(!e||"string"!=typeof e)return t;let i=e;"?"===i.charAt(0)&&(i=i.substr(1));const c=i.replace(/\+/g," ").split("&");for(let e=0;e<c.length;e++){const i=c[e].split("="),o=decodeURIComponent(i[0]);if(!o)continue;let s=o.split("]["),n=s.length-1;if(/\[/.test(s[0])&&/\]$/.test(s[n])?(s[n]=s[n].replace(/\]$/,""),s=s.shift().split("[").concat(s),n=s.length-1):n=0,i.length>=2){const e=i[1]?decodeURIComponent(i[1]):"";n?vC(t,s,e):t[o]=gC(t[o],e)}else t[o]=!0}return t}}),yC=e=>e;class zC{constructor(e,t,i){this.path=e,this.name=t,this.caseSensitive=i}}class CC{constructor(e,t,i,c){this.route=e,this.paramNames=t,this.paramTypes=i,this.settings=c}get path(){return this.route.path}}class xC{constructor(e,t,i,c){this.endpoint=e,this.params=t,this.typedParams=i,this.queryParams=c,this.allParams=Object.assign(Object.assign({},t),c),this.allTypedParams=Object.assign(Object.assign({},i),c)}get settings(){return this.endpoint.settings}}class LC{constructor(e,t,i,c){var o;this.chars=e,this.states=t,this.skippedStates=i,this.result=c,this.head=t[t.length-1],this.endpoint=null===(o=this.head)||void 0===o?void 0:o.endpoint}advance(e){const{chars:t,states:i,skippedStates:c,result:o}=this;let s=null,n=0;const a=i[i.length-1];function r(l,d){if(l.isMatch(e)&&(1===++n?s=l:o.add(new LC(t.concat(e),i.concat(l),null===d?c:c.concat(d),o))),null===a.segment&&l.isOptional&&null!==l.nextStates){if(l.nextStates.length>1)throw new Error(`${l.nextStates.length} nextStates`);const e=l.nextStates[0];if(!e.isSeparator)throw new Error("Not a separator");if(null!==e.nextStates)for(const t of e.nextStates)r(t,l)}}if(a.isDynamic&&r(a,null),null!==a.nextStates)for(const e of a.nextStates)r(e,null);null!==s&&(i.push(this.head=s),t.push(e),null!==s.endpoint&&(this.endpoint=s.endpoint)),0===n&&o.remove(this)}finalize(){!function e(t,i){const c=i.nextStates;if(null!==c)if(1===c.length&&null===c[0].segment)e(t,c[0]);else for(const i of c)if(i.isOptional&&null!==i.endpoint){if(t.push(i),null!==i.nextStates)for(const c of i.nextStates)e(t,c);break}}(this.skippedStates,this.head)}getParams(){const{states:e,chars:t,endpoint:i}=this,c={};for(const e of i.paramNames)c[e]=void 0;for(let i=0,o=e.length;i<o;++i){const o=e[i];if(o.isDynamic){const e=o.segment.name;void 0===c[e]?c[e]=t[i]:c[e]+=t[i]}}return c}compareTo(e){const t=this.states,i=e.states;for(let e=0,c=0,o=Math.max(t.length,i.length);e<o;++e){let o=t[e];if(void 0===o)return 1;let s=i[c];if(void 0===s)return-1;let n=o.segment,a=s.segment;if(null===n){if(null===a){++c;continue}if(void 0===(o=t[++e]))return 1;n=o.segment}else if(null===a){if(void 0===(s=i[++c]))return-1;a=s.segment}if(n.kind<a.kind)return 1;if(n.kind>a.kind)return-1;++c}const c=this.skippedStates,o=e.skippedStates,s=c.length,n=o.length;if(s<n)return 1;if(s>n)return-1;for(let e=0;e<s;++e){const t=c[e],i=o[e];if(t.length<i.length)return 1;if(t.length>i.length)return-1}return 0}}function MC(e){return null!==e.head.endpoint}function wC(e,t){return e.compareTo(t)}class SC{constructor(e){this.candidates=[],this.candidates=[new LC([""],[e],[],this)]}get isEmpty(){return 0===this.candidates.length}getSolution(){const e=this.candidates.filter(MC);if(0===e.length)return null;for(const t of e)t.finalize();return e.sort(wC),e[0]}add(e){this.candidates.push(e)}remove(e){this.candidates.splice(this.candidates.indexOf(e),1)}advance(e){const t=this.candidates.slice();for(const i of t)i.advance(e)}}class kC{constructor(){this.names=new Map,this.paths=new Map,this.rootState=new $C(null,null,"")}add(e,t){if(e instanceof Array)for(const i of e)this.$add(i,t);else this.$add(e,t)}$add(e,t){const i=e.path,c=new zC(e.path,e.name||"",!0===e.caseSensitive),o=""===i?[""]:i.split("/").filter(EC),s=[],n=[];let a=this.rootState;const r=[];for(const e of o)switch(a=a.append(null,"/"),e.charAt(0)){case"{":{const t=e.slice(1,-1).split(":").map(e=>e.trim());2===t.length?n.push(t[1]):n.push("string");const i=t[0].endsWith("?"),c=i?t[0].slice(0,-1):t[0];s.push(c);const o=new AC(c,i);r.push(o),a=o.appendTo(a);break}case"*":{const t=e.slice(1);s.push(t),n.push("string");const i=new TC(t);r.push(i),a=i.appendTo(a);break}default:{const t=new NC(e,c.caseSensitive);r.push(t),a=t.appendTo(a);break}}const l=new CC(c,s,n,t||null);a.setEndpoint(l),this.paths.set(i,r),e.name&&this.names.set(e.name,r)}recognize(e,t={}){return Au(this,void 0,void 0,function*(){const i=bC.separate(e),c=bC.parse(i.queryString);(e=decodeURI(i.path)).startsWith("/")||(e=`/${e}`),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1));const o=new SC(this.rootState);for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(o.advance(i),o.isEmpty)return null}const s=o.getSolution();if(null===s)return null;const{endpoint:n}=s,a=n.paramNames,r=n.paramTypes,l=s.getParams(),d={};for(let e=0,i=a.length;e<i;++e){const i=a[e],c=t[r[e]]||yC,o=l[i],s=yield c(o);d[i]=s}return new xC(n,l,d,c)})}generateFromName(e,t){return this.generate(this.names.get(e),t)}generateFromPath(e,t){return this.generate(this.paths.get(e),t)}generate(e,t){if(!e)return null;const i=Object.assign({},t),c={};let o="";for(let t=0,s=e.length;t<s;t++){const s=e[t],n=s.generate(i,c);if(null==n){if(s instanceof AC&&!s.optional)throw new Error(`A value is required for route parameter '${s.name}'.`)}else o+="/",o+=n}"/"!==o.charAt(0)&&(o="/"+o);for(const e in c)delete i[e];const s=bC.build(i);return o+=s?`?${s}`:"",o}}class $C{constructor(e,t,i){switch(this.prevState=e,this.segment=t,this.value=i,this.nextStates=null,this.endpoint=null,null==t?void 0:t.kind){case 2:this.length=e.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=t.optional;break;case 1:this.length=e.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=!1;break;case 3:this.length=e.length+1,this.isSeparator=!1,this.isDynamic=!1,this.isOptional=!1;break;case void 0:this.length=null===e?0:e.length,this.isSeparator=!0,this.isDynamic=!1,this.isOptional=!1}}append(e,t){let i,c=this.nextStates;return null===c?(i=void 0,c=this.nextStates=[]):i=null===e?c.find(e=>e.value===t):c.find(t=>{var i;return null===(i=t.segment)||void 0===i?void 0:i.equals(e)}),void 0===i&&c.push(i=new $C(this,e,t)),i}setEndpoint(e){if(null!==this.endpoint)throw new Error(`Cannot add ambiguous route. The pattern '${e.route.path}' clashes with '${this.endpoint.route.path}'`);this.endpoint=e,this.isOptional&&(this.prevState.setEndpoint(e),this.prevState.isSeparator&&null!==this.prevState.prevState&&this.prevState.prevState.setEndpoint(e))}isMatch(e){const t=this.segment;switch(null==t?void 0:t.kind){case 2:return!this.value.includes(e);case 1:return!0;case 3:case void 0:return this.value.includes(e)}}}function EC(e){return e.length>0}class NC{constructor(e,t){this.value=e,this.caseSensitive=t}get kind(){return 3}appendTo(e){const{value:t,value:{length:i}}=this;if(this.caseSensitive)for(let c=0;c<i;++c)e=e.append(this,t.charAt(c));else for(let c=0;c<i;++c){const i=t.charAt(c);e=e.append(this,i.toUpperCase()+i.toLowerCase())}return e}generate(){return this.value}equals(e){return 3===e.kind&&e.caseSensitive===this.caseSensitive&&e.value===this.value}}class AC{constructor(e,t){this.name=e,this.optional=t}get kind(){return 2}appendTo(e){return e=e.append(this,"/")}generate(e,t){return t[this.name]=!0,e[this.name]}equals(e){return 2===e.kind&&e.optional===this.optional&&e.name===this.name}}class TC{constructor(e){this.name=e}get kind(){return 1}appendTo(e){return e=e.append(this,"")}generate(e,t){return t[this.name]=!0,e[this.name]}equals(e){return 1===e.kind&&e.name===this.name}}const OC="fast-child-route";function IC(e,t){return"command"in t?t.command:"redirect"in t?new JC(t.redirect):cx.fromDefinition(e,t)}const RC=e=>{if(null==e)return!1;switch(e.toLowerCase().trim()){case"true":case"yes":case"1":return!0;default:return!1}},DC={number:e=>void 0===e?NaN:parseFloat(e),float:e=>void 0===e?NaN:parseFloat(e),int:e=>void 0===e?NaN:parseInt(e),integer:e=>void 0===e?NaN:parseInt(e),Date:e=>void 0===e?new Date(Date.now()):new Date(e),boolean:RC,bool:RC};class FC{constructor(e){this.owner=e,this._recognizer=null,this.pathToCommand=new Map,this.fallbackCommand=null,this.fallbackSettings=null,this.converters={}}get recognizer(){return null===this._recognizer&&(this._recognizer=this.owner.createRouteRecognizer()),this._recognizer}ignore(e){"string"==typeof e&&(e={path:e}),this.pathToCommand.set(e.path,new XC),this.recognizer.add(e,e.settings)}map(...e){for(const t of e){if("children"in t){const e=this.owner.createTitleBuilder(),i=t.children.map(i=>{const c=Object.assign(Object.assign(Object.assign({},t),i),{path:`${t.path}/${i.path}`});if("title"in t||"title"in i){const o=t.title||"",s=i.title||"";c.title=e.joinTitles(o,s)}if("name"in i){const e=t.name?t.name+"/":"";c.name=e+i.name}return c.children===t.children&&delete c.children,c});this.map(...i);continue}let e;if(e="command"in t?t.command:"redirect"in t?new JC(t.redirect):cx.fromDefinition(this.owner,t),this.pathToCommand.set(t.path,e),this.recognizer.add(t,t.settings),"childRouters"in t&&t.childRouters){const i=Object.assign(Object.assign({},t),{path:t.path+`/*${OC}`});this.pathToCommand.set(i.path,e),this.recognizer.add(i,i.settings)}}}fallback(e){const t=this.owner;this.fallbackCommand="function"==typeof e?{createContributor(i,c){return Au(this,void 0,void 0,function*(){const o=yield e();return IC(t,o).createContributor(i,c)})}}:IC(t,e)}converter(e,t){let i;i="convert"in t?t.convert.bind(t):t.prototype&&"convert"in t.prototype?e=>this.owner.construct(t).convert(e):t,this.converters[e]=i}recognize(e){return Au(this,void 0,void 0,function*(){const t=yield this.recognizer.recognize(e,this.aggregateConverters());if(null!==t)return{route:t,command:this.pathToCommand.get(t.endpoint.path)};if(null!==this.fallbackCommand){const t=bC.separate(e),i=bC.parse(t.queryString);return{route:new xC(new CC(new zC("*","",!1),[],[],this.fallbackSettings),{},{},i),command:this.fallbackCommand}}return null})}generateFromName(e,t){return this.recognizer.generateFromName(e,t)}generateFromPath(e,t){return this.recognizer.generateFromPath(e,t)}aggregateConverters(){return null===this.owner.parent?Object.assign(Object.assign({},DC),this.converters):Object.assign(Object.assign({},this.owner.parent.routes.aggregateConverters()),this.converters)}}const _C="$router";function HC(e){const t=e.parentElement;if(t)return t;{const t=e.getRootNode();if(t.host instanceof HTMLElement)return t.host}return null}function PC(e){let t=e;for(;t=HC(t);)if(_C in t)return t[_C];return null}const VC=Object.freeze({getOrCreateFor(e){const t=e[_C];return void 0!==t?t:e[_C]=new BC(e)},find:e=>e[_C]||PC(e),from(e){class t extends e{constructor(){super(),VC.getOrCreateFor(this)}get config(){return this[_C].config}set config(e){this[_C].config=e}}const i=t.prototype;if("connectedCallback"in i){const e=i.connectedCallback;i.connectedCallback=function(){e.call(this),this[_C].connect()}}else i.connectedCallback=function(){this[_C].connect()};if("disconnectedCallback"in i){const e=i.disconnectedCallback;i.disconnectedCallback=function(){e.call(this),this[_C].disconnect()}}else i.disconnectedCallback=function(){this[_C].disconnect()};return t}});let BC=class{constructor(e){this.host=e,this.parentRouter=void 0,this.contributors=new Set,this.navigationQueue=null,this.linkHandler=null,this.newView=null,this.newRoute=null,this.childCommandContributor=null,this.childRoute=null,this.isConnected=!1,this.routerConfig=null,this.view=null,this.route=null,this.onNavigationMessage=e=>Au(this,void 0,void 0,function*(){const t=this.config.createNavigationProcess();yield t.run(this,e),this.navigationQueue.receive().then(this.onNavigationMessage)}),e[_C]=this}get config(){return this.routerConfig}set config(e){this.routerConfig=e,this.tryConnect()}get parent(){if(void 0===this.parentRouter){if(!this.isConnected)return null;this.parentRouter=PC(this.host)}return this.parentRouter||null}get level(){return null===this.parent?0:this.parent.level+1}shouldRender(e){var t;if(this.route&&this.route.endpoint.path===e.endpoint.path){const i=null==e?void 0:e.allParams,c=null===(t=this.route)||void 0===t?void 0:t.allParams;if(JSON.stringify(c)===JSON.stringify(i))return!1}return!0}beginRender(e,t){return Au(this,void 0,void 0,function*(){return this.newRoute=e,this.newView=yield t.createView(),this.newView.bind(e.allTypedParams,UC.create(this)),this.newView.appendTo(this.host),yield t.transition.begin(this.host,this.view,this.newView),{commit:this.renderOperationCommit.bind(this,t.layout,t.transition),rollback:this.renderOperationRollback.bind(this,t.transition)}})}connect(){this.isConnected=!0,this.tryConnect()}disconnect(){null===this.parent?(null!==this.navigationQueue&&(this.navigationQueue.disconnect(),this.navigationQueue=null),null!==this.linkHandler&&(this.linkHandler.disconnect(),this.linkHandler=null)):this.parent.removeContributor(this),this.isConnected=!1,this.parentRouter=void 0}addContributor(e){this.contributors.add(e)}removeContributor(e){this.contributors.delete(e)}tryConnect(){null!==this.config&&this.isConnected&&(null===this.parent?(null!==this.navigationQueue&&this.navigationQueue.disconnect(),this.navigationQueue=this.config.createNavigationQueue(),this.navigationQueue.connect(),this.navigationQueue.receive().then(this.onNavigationMessage),null!==this.linkHandler&&this.linkHandler.disconnect(),this.linkHandler=this.config.createLinkHandler(),this.linkHandler.connect()):(this.config.parent=this.parent.config,this.parent.addContributor(this)))}renderOperationCommit(e,t){return Au(this,void 0,void 0,function*(){yield e.beforeCommit(this.host),yield t.commit(this.host,this.view,this.newView),yield e.afterCommit(this.host),null!==this.view&&this.view.dispose(),this.route=this.newRoute,this.view=this.newView,this.newRoute=null,this.newView=null})}renderOperationRollback(e){return Au(this,void 0,void 0,function*(){null!==this.newView&&(yield e.rollback(this.host,this.view,this.newView),this.newView.dispose(),this.newRoute=null,this.newView=null)})}navigate(e){return Au(this,void 0,void 0,function*(){yield this.tunnel(e)})}leave(e){return Au(this,void 0,void 0,function*(){if(yield this.tunnel(e),!e.canceled){const t=this.contributors;this.contributors=new Set,e.onCancel(()=>this.contributors=t)}})}construct(e){return Au(this,void 0,void 0,function*(){if(null!==this.parent){const t=e.route.allParams[OC]||"",i=yield this.config.recognizeRoute(t);if(null===i){return this.config.createEventSink().onUnhandledNavigationMessage(this,new aC(t)),void e.cancel()}this.childRoute=i.route,this.childCommandContributor=yield i.command.createContributor(this,i.route)}yield this.tunnel(e)})}enter(e){return Au(this,void 0,void 0,function*(){yield this.tunnel(e)})}commit(e){return Au(this,void 0,void 0,function*(){yield this.tunnel(e)})}tunnel(e){return Au(this,void 0,void 0,function*(){const t=this.childRoute,i=this.childCommandContributor;if(t&&i&&(yield e.evaluateContributor(i,t,this)),e.canceled)return;const c=[...this.config.findContributors(e.name),...Array.from(this.contributors)];for(const t of c)if(yield e.evaluateContributor(t,void 0,this),e.canceled)return})}};const UC=Object.freeze({create:e=>Object.create(z,{router:{value:e}})}),jC=Object.freeze({default:Object.freeze({begin(e,t,i){return Au(this,void 0,void 0,function*(){})},rollback(e,t,i){return Au(this,void 0,void 0,function*(){})},commit(e,t,i){return Au(this,void 0,void 0,function*(){})}})});class qC{constructor(e=null,t=null,i=!0){this.template=e,this.runBeforeCommit=i,this.styles=null==t?null:Array.isArray(t)?Y.create(t):t instanceof Y?t:Y.create([t])}beforeCommit(e){return Au(this,void 0,void 0,function*(){this.runBeforeCommit&&this.apply(e)})}afterCommit(e){return Au(this,void 0,void 0,function*(){this.runBeforeCommit||this.apply(e)})}apply(e){e instanceof be&&(e.$fastController.template!==this.template&&(e.$fastController.template=this.template),e.$fastController.styles!==this.styles&&(e.$fastController.styles=this.styles))}}const GC=Object.freeze({default:new qC(W`<slot></slot>`)});function WC(e,t){return t in e}const YC={lifecycle:!0,parameters:!0};class KC extends C{constructor(e){super(),this.options=e}createPlaceholder(e){return u.createCustomAttributePlaceholder("fast-navigation-contributor",e)}createBehavior(e){return new ZC(e,this.options)}}class ZC{constructor(e,t){this.contributor=e,this.options=t,this.router=null}bind(e,t){if(this.options.lifecycle&&(this.router=t.router||VC.find(this.contributor),this.router.addContributor(this.contributor)),this.options.parameters){const t=this.contributor,i=e;for(const e in i)t[e]=i[e]}}unbind(e){null!==this.router&&this.router.removeContributor(this.contributor)}}function QC(e){return new KC(Object.assign({},YC,e))}class XC{createContributor(){return Au(this,void 0,void 0,function*(){return{navigate(e){return Au(this,void 0,void 0,function*(){e.cancel()})}}})}}class JC{constructor(e){this.redirect=e}createContributor(){return Au(this,void 0,void 0,function*(){const e=this.redirect;return{navigate(t){return Au(this,void 0,void 0,function*(){const i=t.router.config,c=(yield i.generateRouteFromName(e,t.route.allParams))||(yield i.generateRouteFromPath(e,t.route.allParams));if(null===c)throw new Error(`Invalid redirect. Name or path not found: ${e}`);t.cancel(()=>Au(this,void 0,void 0,function*(){return hC.path.replace(c)}))})}}})}}function ex(e){return W`<${e} ${QC()}></${e}>`}function tx(e){const t=document.createDocumentFragment();t.appendChild(e);const i=new j(t,[QC().createBehavior(e)]);return{create:()=>i}}class ix{constructor(e,t,i){this.router=e,this.route=t,this.command=i}construct(e){return Au(this,void 0,void 0,function*(){this.router.shouldRender(this.route)?(this.operation=yield this.router.beginRender(this.route,this.command),e.onCancel(()=>this.operation.rollback())):e.cancel()})}commit(e){return Au(this,void 0,void 0,function*(){yield this.operation.commit(),this.command.title&&e.setTitle(this.command.title)})}}class cx{constructor(e,t){this.owner=e,this.createView=t,this._layout=null,this._transition=null,this.title=""}get transition(){return this._transition||this.owner.defaultTransition}set transition(e){this._transition=e}get layout(){return this._layout||this.owner.defaultLayout}set layout(e){this._layout=e}createContributor(e,t){return Au(this,void 0,void 0,function*(){return new ix(e,t,this)})}static fromDefinition(e,t){let i;i="template"in t?()=>Au(this,void 0,void 0,function*(){let e=t.template;return"function"==typeof e&&(e=yield e()),e.create()}):()=>Au(this,void 0,void 0,function*(){let e=t.element,i=null;if(t.factory)i=t.factory;else if("function"==typeof e){let t=ue.forType(e);if(t)i=ex(t.name);else if(e=yield e(),"string"==typeof e)i=ex(e);else if(e instanceof HTMLElement)i=tx(e);else{if(t=ue.forType(e),!t)throw new Error("Invalid value for element in route config.");i=ex(t.name)}}else e instanceof HTMLElement?t.factory=i=tx(e):t.factory=i=ex(e);return i.create()});const c=new cx(e,i);return t.layout&&(t.layout instanceof q?c.layout=new qC(t.layout):c.layout=t.layout),t.transition&&(c.transition=t.transition),t.title&&(c.title=t.title),c}}class ox{constructor(){this.handler=e=>{const{shouldHandleEvent:t,href:i}=this.getEventInfo(e);t&&(e.preventDefault(),hC.path.push(i))}}connect(){window.addEventListener("click",this.handler,!0)}disconnect(){window.removeEventListener("click",this.handler)}getEventInfo(e){const t={shouldHandleEvent:!1,href:null,anchor:null},i=this.findClosestAnchor(e);if(!i||!this.targetIsThisWindow(i))return t;if(i.hasAttribute("download")||i.hasAttribute("router-ignore")||i.hasAttribute("data-router-ignore"))return t;if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return t;const c=i.getAttribute("href");t.anchor=i,t.href=c;const o=1===e.which,s=c&&!("#"===c.charAt(0)||/^[a-z]+:/i.test(c));return t.shouldHandleEvent=o&&!!s,t}findClosestAnchor(e){const t=e.composedPath();for(let e=0,i=t.length;e<i;++e){const i=t[e];if("A"===i.tagName)return i}return e.target}targetIsThisWindow(e){const t=e.getAttribute("target");return!t||t===window.name||"_self"===t}}class sx{constructor(e,t,i,c,o){this.name=e,this.commitActions=c,this.cancelActions=o,this.routes=[],this.routers=[],this.canceled=!1,this.titles=[],this.routes.push(t),this.routers.push(i)}get route(){return this.routes[this.routes.length-1]}get router(){return this.routers[this.routers.length-1]}cancel(e){this.canceled=!0,e&&this.cancelActions.push(e)}onCommit(e){this.commitActions.push(e)}onCancel(e){this.cancelActions.push(e)}setTitle(e){const t=this.router.level;for(;this.titles.length<t+1;)this.titles.push([]);this.titles[t].push(e)}evaluateContributor(e,t=this.route,i=this.router){return Au(this,void 0,void 0,function*(){WC(e,this.name)&&(this.routes.push(t),this.routers.push(i),yield e[this.name](this),this.routes.pop(),this.routers.pop())})}}class nx{constructor(){this.phases=["navigate","leave","construct","enter","commit"]}run(e,t){return Au(this,void 0,void 0,function*(){const i=e.config.createEventSink(),c=yield e.config.recognizeRoute(t.path);if(null===c)return void i.onUnhandledNavigationMessage(e,t);const o=c.route,s=c.command;i.onNavigationBegin(e,o,s);const n=[],a=[];let r=n;const l=[yield s.createContributor(e,o),e,this];for(const t of this.phases){const c=new sx(t,o,e,n,a);if(i.onPhaseBegin(c),c.canceled)r=a;else for(const e of l)if(yield c.evaluateContributor(e),c.canceled){r=a;break}if(i.onPhaseEnd(c),c.canceled)break}yield Promise.all(r.map(e=>e())).then(()=>i.onNavigationEnd(e,o,s))})}commit(e){const t=e.router.config.createTitleBuilder();document.title=t.buildTitle(e.router.config.title,e.titles)}}class ax{constructor(e=" - ",t=":"){this.segmentSeparator=e,this.fragmentSeparator=t}joinTitles(e,t){return""===e?t:""===t?e:`${e}${this.segmentSeparator}${t}`}buildTitle(e,t){let i=e;for(const e of t){i&&(i+=this.segmentSeparator);let t="";for(const i of e)t&&(t+=this.fragmentSeparator),t+=i;i+=t}return i}}class rx{onUnhandledNavigationMessage(e,t){}onNavigationBegin(e,t,i){}onPhaseBegin(e){}onPhaseEnd(e){}onNavigationEnd(e,t,i){}}class lx{constructor(){this.isConfigured=!1,this.routes=new FC(this),this.contributors=[],this.defaultLayout=GC.default,this.defaultTransition=jC.default,this.title="",this.parent=null}createNavigationQueue(){return this.construct(uC)}createLinkHandler(){return this.construct(ox)}createNavigationProcess(){return new nx}createEventSink(){return this.construct(rx)}createTitleBuilder(){return this.construct(ax)}createRouteRecognizer(){return this.construct(kC)}construct(e){return null!==this.parent?this.parent.construct(e):new e}recognizeRoute(e){return Au(this,void 0,void 0,function*(){return yield this.ensureConfigured(),this.routes.recognize(e)})}generateRouteFromName(e,t){return Au(this,void 0,void 0,function*(){return yield this.ensureConfigured(),this.routes.generateFromName(e,t)})}generateRouteFromPath(e,t){return Au(this,void 0,void 0,function*(){return yield this.ensureConfigured(),this.routes.generateFromPath(e,t)})}findContributors(e){return this.contributors.filter(t=>WC(t,e))}cached(e){let t=null;return()=>Au(this,void 0,void 0,function*(){return null===t&&(t=new e),t})}ensureConfigured(){return Au(this,void 0,void 0,function*(){this.isConfigured||(yield this.configure(),this.isConfigured=!0)})}}let dx=class extends(VC.from(be)){};dx=Eu([ye("fast-router")],dx);const hx=[];setTimeout(()=>{hx.length&&console.warn(`${hx.length} attribute deprecation notice(s):\n ${hx.join("\n")}`)},5e3);const ux="reauthActionLock";var fx;function px(){return Au(this,arguments,void 0,function*(e={}){const{reloadOnFailure:t=!0}=e;if(function(){const e=parseInt(localStorage.getItem(ux)||"0");Date.now()-e>3e4&&localStorage.removeItem(ux)}(),localStorage.getItem(ux)||(localStorage.setItem(ux,Date.now().toString()),0))return fx.HANDLED_BY_OTHER_TAB;try{if(yield function(){return Au(this,void 0,void 0,function*(){const e=yield fetch(Mg,{credentials:"include"});return"EVENT_LOGIN_DETAILS_ACK"===(yield e.json()).MESSAGE_TYPE})}())return fx.ALREADY_VALID;return(yield function(){return Au(this,void 0,void 0,function*(){const e=ft.getOrCreateDOMContainer().get(Kz);return"EVENT_LOGIN_AUTH_ACK"===(yield e.post(Lg,{body:JSON.stringify({DETAILS:{},MESSAGE_TYPE:"EVENT_LOGIN_AUTH"})})).MESSAGE_TYPE})}())?fx.SUCCESS:(t&&window.location.reload(),fx.FAILED)}finally{localStorage.removeItem(ux)}})}!function(e){e.SUCCESS="SUCCESS",e.FAILED="FAILED",e.HANDLED_BY_OTHER_TAB="HANDLED_BY_OTHER_TAB",e.ALREADY_VALID="ALREADY_VALID"}(fx||(fx={}));const mx=(e,t)=>((null==t?void 0:t.ROW)&&e&&e.length>0?t.ROW.forEach(t=>{const i=t;if(i&&i.DETAILS){const c=i.DETAILS.ROW_REF,o=i.DETAILS.OPERATION;"INSERT"===o&&(e.find(e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===c})||e.unshift(i)),"DELETE"===o&&(e=e.filter(e=>{var i,c;return(null===(i=t.DETAILS)||void 0===i?void 0:i.ROW_REF)!==(null===(c=e.DETAILS)||void 0===c?void 0:c.ROW_REF)})),"MODIFY"===o&&(e=e.map(e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===c?Object.assign(Object.assign({},e),i):e}))}}):!t||e&&0!==e.length||(e=[...new Set(t.ROW)]),e);var gx;let vx=gx=class{get isConnected(){return this._isConnected}set isConnected(e){this._isConnected=e,this.isConnectedSubject.next(this._isConnected)}constructor(e,t,i,c,o,s){var n;this.http=e,this.messageBuilder=t,this.session=i,this.metaCache=c,this.serializer=o,this.config=s,this.isWorking=!1,this._isConnected=!1,this.isConnectedSubject=new Sb(this._isConnected),this.isConnected$=null===(n=this.isConnectedSubject)||void 0===n?void 0:n.asObservable(),this.ongoingTurbo={},this.streams=new Map,this.ongoingRefresh=null}handleSessionRefresh(){return this.ongoingRefresh||(this.ongoingRefresh=(()=>Au(this,void 0,void 0,function*(){const e=this.host;this.disconnect();let t=yield px();return t===fx.HANDLED_BY_OTHER_TAB&&(yield new Promise(e=>{setTimeout(e,gx.REAUTH_WAIT_MS)}),t=yield px()),(t===fx.SUCCESS||t===fx.ALREADY_VALID)&&(this.connect(e),!0)}))().finally(()=>{this.ongoingRefresh=null})),this.ongoingRefresh}checkHost(){return Au(this,void 0,void 0,function*(){try{return this.getMessage({MESSAGE_TYPE:Jz.HEARTBEAT_PING,SOURCE_REF:"host check"}).then(e=>e.MESSAGE_TYPE===Jz.HEARTBEAT_PONG)}catch(e){return Dm.error(e),!1}})}send(e,t){return Au(this,void 0,void 0,function*(){if(this.ongoingRefresh){if(!(yield this.ongoingRefresh))throw new Error("Cannot send message: session refresh failed")}return this.http.post(gx.getUrl(this.host,e),{body:gx.getBody(e),headers:this.messageBuilder.createHTTPHeadersFromMessage(e)})})}httpMode(){return!0}setValidSession(e){Dm.deprecated("setValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}connect(e){return Au(this,void 0,void 0,function*(){return this.host=e,this.host.startsWith("ws")&&(this.host=this.host.replace("ws","http")),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 Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createDataLogonMessage(e,t);return Dm.debug(`HTTP MODE - ${i.MESSAGE_TYPE} (snapshot) message created -> `,i),this.send(i).then(e=>(this.dataLogoff(i.SOURCE_REF).catch(e=>Dm.error(e)),e))})}stream(e,t,i,c){var o,s;const n=this.messageBuilder.createDataLogonMessage(e,c);Dm.debug(`HTTP MODE - ${n.MESSAGE_TYPE} (stream) message created -> `,n);const a=n.SOURCE_REF,r=(null===(s=null===(o=this.config.polling)||void 0===o?void 0:o.POLLING_INTERVAL_MAP)||void 0===s?void 0:s[e])||this.config.polling.POLLING_FREQUENCY;this.streams.set(a,{SOURCE_REF:a,POLLING_FREQUENCY:new Sb(r),RESOURCE_NAME:e});const l=this.streams.get(a).POLLING_FREQUENCY,d=Oy(by(this.send(n)),l.pipe(Ry(()=>"visible"===document.visibilityState)).pipe(_y(e=>{return void 0===(t=e)&&(t=0),void 0===i&&(i=qb),t<0&&(t=0),Iy(t,t,i);var t,i})).pipe(_y(()=>by(this.getMessage(n))))).pipe(Hy(()=>this.streams.has(a)),function(e){var t;void 0===e&&(e=1/0);var i=(t=e&&"object"==typeof e?e:{count:e}).count,c=void 0===i?1/0:i,o=t.delay,s=t.resetOnSuccess,n=void 0!==s&&s;return c<=0?mb:yb(function(e,t){var i,s=0,a=function(){var r=!1;i=e.subscribe(zb(t,function(e){n&&(s=0),t.next(e)},void 0,function(e){if(s++<c){var n=function(){i?(i.unsubscribe(),i=null,a()):r=!0};if(null!=o){var l="number"==typeof o?Iy(o):hy(o(e,s)),d=zb(t,function(){d.unsubscribe(),n()},function(){t.complete()});l.subscribe(d)}else n()}else t.error(e)})),r&&(i.unsubscribe(),i=null,a())};a()})}({count:gx.MAX_RETRIES,delay:(e,t)=>{const i=e;Dm.error(`Retry ${t}/${gx.MAX_RETRIES}:`,i.status,i);if(!(0===i.status||i.status&&i.status>=Vz.BAD_REQUEST&&i.status<Vz.INTERNAL_SERVER_ERROR))throw e;return i.status===Vz.NOT_FOUND&&this.streams.delete(a),i.status===Vz.UNAUTHORIZED?by(this.handleSessionRefresh()):Iy(gx.RETRY_DELAY_MS)}}),(h=()=>{Dm.debug(`Terminating stream for ${e} - ${a}`),this.dataLogoff(a)},yb(function(e,t){try{e.subscribe(t)}finally{t.add(h)}})));var h;return this.streams.get(a).STREAM=d,d}streamState(e,t=()=>{},i=()=>{},c,o=[]){return this.stream(e,t,i,c).pipe(Dy(mx,o))}streamWithoutAutoTeardown(e,t,i,c){return Dm.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0"),this.stream(e,t,i,c)}getMessage(e){return Au(this,void 0,void 0,function*(){if(this.ongoingRefresh){if(!(yield this.ongoingRefresh))throw new Error("Cannot get message: session refresh failed")}return this.http.get(gx.getUrl(this.host,e),{headers:this.messageBuilder.createHTTPHeadersFromMessage(e)})})}getMoreRows(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreRowsMessage(e);return Dm.debug(`HTTP MODE - ${t.MESSAGE_TYPE} message created -> `,t),this.send(t)})}getMoreColumns(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.send(t)})}dataLogoff(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return this.send(t).then(t=>(this.streams.has(e)&&(Dm.debug(`Removing stream ${e}`),this.streams.delete(e)),t))})}getMetadata(e){return Au(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasMetadataFor(e))return Dm.debug(`HTTP MODE - Cached metadata retrieved for ${e}`),this.metaCache.getMetadataFor(e);const i=this.messageBuilder.createMetaRequestMessage(e);Dm.debug(`HTTP MODE - ${i.MESSAGE_TYPE} (metadata) message created -> `,i);const c=yield this.send(i).then(e=>e.DETAILS);return Object.keys(c).length&&this.metaCache.setMetadataFor(e,c),c})}getJSONSchema(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createMetaRequestMessage(e,eC.JSON_SCHEMA_REQUEST);return Dm.debug(`HTTP MODE! - ${t.MESSAGE_TYPE} (json schema) message created -> `,t),this.send(t)})}request(e,t){const i=this.messageBuilder.createRequestMessage(e,t);Dm.debug(`HTTP MODE! - ${i.MESSAGE_TYPE} (request server) message created -> `,i);let c=gx.getUrl(this.host,i);const o=[];return i.REQUEST&&Object.keys(i.REQUEST).length>0&&Object.keys(i.REQUEST).forEach(e=>{const t=i.REQUEST[e];null==t||Number.isNaN(t)||o.push(`REQUEST.${e}=${encodeURIComponent(String(t))}`)}),i.DETAILS&&Object.keys(i.DETAILS).forEach(e=>{const t=i.DETAILS[e];null==t||Number.isNaN(t)||o.push(`${e}=${encodeURIComponent(String(t))}`)}),o.length>0&&(c=`${c}?${o.join("&")}`),Dm.debug(`HTTP MODE! - REQUEST_SERVER GET URL: ${c}`),this.http.get(c,{headers:this.messageBuilder.createHTTPHeadersFromMessage(i)})}getAvailableResources(e){return Au(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasResources())return Dm.debug("HTTP MODE - Cached resources retrieved"),this.metaCache.getResources();const i=this.messageBuilder.createResourcesMessage(e);Dm.debug(`HTTP MODE! - ${i.MESSAGE_TYPE} (getResources) message created -> `,i);const c=yield this.send(i);return this.metaCache.setResources(c),c})}commitEvent(e,t){return Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createCommitMessage(e,t);return Dm.debug(`HTTP MODE! - ${i.MESSAGE_TYPE} (commit) message created -> `,i),this.send(i).then(t=>(this.maybeTurbo(e,t),t))})}maybeTurbo(e,t){var i;if(!(null===(i=null==t?void 0:t.MESSAGE_TYPE)||void 0===i?void 0:i.endsWith("_ACK")))return;if(this.ongoingTurbo[e])return void Dm.debug(`${e} polling frequency is already accelerated.`);const c=this.config.polling.POLLING_MAP[e];if(!(null==c?void 0:c.TEMP_FREQUENCY)||!c.AMOUNT_OF_POLLS)return;const o=c.TEMP_FREQUENCY,s=o*c.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 c.QUERIES)a[e]=o,n[e]||(n[e]=this.config.polling.POLLING_FREQUENCY);Dm.debug(`${e} TRIGGERED -> ENFORCING TURBO | FREQUENCY=${o}ms DURATION=${s}`),this.ongoingTurbo[e]=!0,this.updateIntervals({polling:{POLLING_INTERVAL_MAP:a}}),setTimeout(()=>{Dm.debug(`RESTORED ORIGINAL POLLING INTERVALS FOR ${e}`),this.updateIntervals({polling:{POLLING_INTERVAL_MAP:n}}),this.ongoingTurbo[e]=!1},s)}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 i=e[t];this.config.polling.POLLING_INTERVAL_MAP[t]=i,Dm.debug(`Setting polling frequency for ${t} = ${i}`),[...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(i)})}}static getBody(e){return JSON.stringify(e)}static getUrl(e,t){const i=t.MESSAGE_TYPE;let c=t.MESSAGE_TYPE.replace(/_/g,"-").toLowerCase();return i===eC.DATA_LOGON&&(c=t.DETAILS.DATASOURCE_NAME.replace(/_/g,"-").toLowerCase()),`${e}${c}`}};vx.REAUTH_WAIT_MS=5e3,vx.RETRY_DELAY_MS=1e3,vx.MAX_RETRIES=3,Eu([g],vx.prototype,"host",void 0),Eu([g],vx.prototype,"isWorking",void 0),Eu([g],vx.prototype,"_isConnected",void 0),Eu([v],vx.prototype,"isConnected",null),vx=gx=Eu([Nu(0,Kz),Nu(1,sC),Nu(2,Gz),Nu(3,Sz),Nu(4,Kv),Nu(5,Qz)],vx);const bx=ft.createInterface(e=>e.singleton(vx));var yx={url:"",deserializer:function(e){return JSON.parse(e.data)},serializer:function(e){return JSON.stringify(e)}},zx=function(e){function t(t,i){var c=e.call(this)||this;if(c._socket=null,t instanceof gb)c.destination=i,c.source=t;else{var o=c._config=ku({},yx);if(c._output=new Mb,"string"==typeof t)o.url=t;else for(var s in t)t.hasOwnProperty(s)&&(o[s]=t[s]);if(!o.WebSocketCtor&&WebSocket)o.WebSocketCtor=WebSocket;else if(!o.WebSocketCtor)throw new Error("no WebSocket constructor can be found");c.destination=new $b}return c}return Su(t,e),t.prototype.lift=function(e){var i=new t(this._config,this.destination);return i.operator=e,i.source=this,i},t.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new $b),this._output=new Mb},t.prototype.multiplex=function(e,t,i){var c=this;return new gb(function(o){try{c.next(e())}catch(e){o.error(e)}var s=c.subscribe({next:function(e){try{i(e)&&o.next(e)}catch(e){o.error(e)}},error:function(e){return o.error(e)},complete:function(){return o.complete()}});return function(){try{c.next(t())}catch(e){o.error(e)}s.unsubscribe()}})},t.prototype._connectSocket=function(){var e=this,t=this._config,i=t.WebSocketCtor,c=t.protocol,o=t.url,s=t.binaryType,n=this._output,a=null;try{a=c?new i(o,c):new i(o),this._socket=a,s&&(this._socket.binaryType=s)}catch(e){return void n.error(e)}var r=new eb(function(){e._socket=null,a&&1===a.readyState&&a.close()});a.onopen=function(t){if(!e._socket)return a.close(),void e._resetState();var i=e._config.openObserver;i&&i.next(t);var c=e.destination;e.destination=lb.create(function(t){if(1===a.readyState)try{var i=e._config.serializer;a.send(i(t))}catch(t){e.destination.error(t)}},function(t){var i=e._config.closingObserver;i&&i.next(void 0),t&&t.code?a.close(t.code,t.reason):n.error(new TypeError("WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }")),e._resetState()},function(){var t=e._config.closingObserver;t&&t.next(void 0),a.close(),e._resetState()}),c&&c instanceof $b&&r.add(c.subscribe(e.destination))},a.onerror=function(t){e._resetState(),n.error(t)},a.onclose=function(t){a===e._socket&&e._resetState();var i=e._config.closeObserver;i&&i.next(t),t.wasClean?n.complete():n.error(t)},a.onmessage=function(t){try{var i=e._config.deserializer;n.next(i(t))}catch(e){n.error(e)}}},t.prototype._subscribe=function(e){var t=this,i=this.source;return i?i.subscribe(e):(this._socket||this._connectSocket(),this._output.subscribe(e),e.add(function(){var e=t._socket;0===t._output.observers.length&&(!e||1!==e.readyState&&0!==e.readyState||e.close(),t._resetState())}),e)},t.prototype.unsubscribe=function(){var t=this._socket;!t||1!==t.readyState&&0!==t.readyState||t.close(),this._resetState(),e.prototype.unsubscribe.call(this)},t}(wb);const Cx=1e4,xx=6e4;var Lx;!function(e){e.Linear="linear",e.Exponential="exponential"}(Lx||(Lx={}));const Mx=(e,t)=>{const{reconnectInterval:i=Cx}=e,c=i>xx?xx:i,o=Math.round(Math.log2(xx/c));return c*Math.pow(2,t%o)},wx=e=>{const{reconnectInterval:t=Cx}=e;return t>xx?xx:t};class Sx{constructor(){this.isConfigured=!1,this.isConnecting=!1,this.isConnected=!1,this.isReconnecting=!1,this.reconnectionLimitReached=!1,this.isConnectedSubject=new Sb(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}}Eu([g],Sx.prototype,"isConfigured",void 0),Eu([g],Sx.prototype,"isConnecting",void 0),Eu([g],Sx.prototype,"isConnected",void 0),Eu([g],Sx.prototype,"isReconnecting",void 0),Eu([g],Sx.prototype,"reconnectionLimitReached",void 0),Eu([g],Sx.prototype,"closedCode",void 0),Eu([g],Sx.prototype,"closedReason",void 0),Eu([g],Sx.prototype,"closedClean",void 0),Eu([Mz],Sx.prototype,"user",void 0);const kx=ft.createInterface(e=>e.singleton(Sx));class $x{constructor(e){this.interval=e}get workerScript(){return`\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 Ex extends Mb{constructor(){super()}}class Nx{constructor(e,t,i,c){this._message=e,this._onMessage=t,this._onError=i,this._isSubscription=c}get sentMessage(){return this._message}get onReceivedMessage(){return this._onMessage}get onReceivedError(){return this._onError}get isSubscription(){return this._isSubscription}}let Ax=class{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 Dm.deprecated("get hasValidSession","Use `User.isAuthenticated` from `@genesislcap/foundation-user` instead.","15.0.0"),this.user.isAuthenticated}set hasValidSession(e){Dm.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:vg}constructor(e,t,i,c,o,s,n){this.messageBuilder=e,this.session=t,this.serializer=i,this.uuid=c,this.status=o,this.user=s,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=vg,t,i){var c;return this.url=e,this.connectOptions=null!=t?t:this.config.connect,this.reconnectOptions=null!=i?i:this.config.reconnect,(null===(c=this.config.isWebSocketExpression)||void 0===c?void 0:c.test(this.host))?new Promise(e=>{var t,i,c,o;Dm.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===(i=this.socketSubscription)||void 0===i||i.unsubscribe(),this.websocket=new zx({url:this.url,openObserver:{next:()=>{this.session.setSessionStorageItem("hostUrl",this.url),this.status.isConnected=!0,this.prepareHeartbeat(),Dm.info("WebSocket connection is now open"),e(this.isConnected)}},closeObserver:{next:t=>{this.status.onClose(t),this.isDisconnectedByServer&&Dm.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===(c=this.connectOptions)||void 0===c?void 0:c.connectObserver)&&void 0!==o?o:{next:e=>Au(this,void 0,void 0,function*(){var t;const i=`Response Message received for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,Dm.info,i);const{SOURCE_REF:c,MESSAGE_TYPE:o}=e,s=this.getMessageHandler(c,o);if(!s)return void(e.MESSAGE_TYPE===Jz.MSG_NACK&&e.ERROR&&e.ERROR.forEach(t=>{Dm.error(`MessageType: ${e.MESSAGE_TYPE} | Error Details:`,t)}));let n=!1;switch(e.MESSAGE_TYPE){case eC.EVENT_LOGIN_AUTH_ACK:{const i=e.DETAILS;i.HEARTBEAT_INTERVAL_SECS&&void 0===(null===(t=this.connectOptions)||void 0===t?void 0:t.heartbeatInterval)&&(this.heartbeatInterval=i.HEARTBEAT_INTERVAL_SECS*this.secondsMultiplier,this.prepareHeartbeat());break}case Jz.LOGOUT_ACK:return s.onReceivedMessage.call(this,e),void this.cleanMessages();case Jz.LOGON_ACK:return;case Jz.LOGOFF_ACK:break;case Jz.QUERY_UPDATE:s.isSubscription||this.sendDataLogoff(c);break;case Jz.MSG_NACK:case Jz.LOGON_NACK:n=!0}n?s.onReceivedError.call(this,{receivedMessage:e,sentMessage:s.sentMessage}):s.onReceivedMessage.call(this,e),this.wsMessages.next(e),s.isSubscription||this.removeMessageHandler(c)}),error:e=>{Dm.debug("Error found: ",e),this.reconnect()},complete:()=>{var e;this.isDisconnectedByServer&&(null===(e=this.connectOptions)||void 0===e?void 0:e.alwaysOn)?this.reconnect():Dm.info("Connection is now closed")}}),this.status.isConfigured=!0}):(Dm.error(`Specified host (${this.host}) is not valid WebSocket url. Connection will not proceed.`),void Dm.warn("Make sure the host url starts with wss:// or ws://"))}handleExpiredSession(){return Au(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 Au(this,void 0,void 0,function*(){const e=yield px();e!==fx.HANDLED_BY_OTHER_TAB?e!==fx.FAILED&&(yield this.connect()):function(e){const t=i=>{i.key===ux&&null===i.newValue&&(e(),window.removeEventListener("storage",t))};window.addEventListener("storage",t)}(()=>this.connect())})}updateSessionAndSubscriptions(e){(null==e?void 0:e.MESSAGE_TYPE)===eC.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,i,c;this.heartbeatTicker&&this.heartbeatTicker.stop();const o=()=>Au(this,void 0,void 0,function*(){var e,t,i;if(!this.isConnected)return;const c=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(c);const o=yield this.send(c);this.user.isAuthenticated&&!o.IS_AUTHENTICATED&&this.handleExpiredSession(),(null===(i=this.connectOptions)||void 0===i?void 0:i.heartbeatPongCallback)&&this.connectOptions.heartbeatPongCallback(o),this.heartbeatIsEnabled=o.MESSAGE_TYPE===Jz.HEARTBEAT_PONG&&o.SOURCE_REF===c.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!==(c=null===(i=this.connectOptions)||void 0===i?void 0:i.heartbeatInterval)&&void 0!==c?c:this.heartbeatInterval;this.heartbeatTicker=new $x(e),this.heartbeatTicker.start(()=>{this.websocket&&this.isConnected&&(o(),this.heartbeatLoggingIsEnabled&&Dm.debug(`Sending a heartbeat ping every ${e} ms`))})}}reconnect(){var e,t,i,c,o;const s=!(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||s)return;this.status.isReconnecting=!0;const n=(null===(i=this.reconnectOptions)||void 0===i?void 0:i.reconnectStrategy)===Lx.Exponential?Mx:wx,a=this.isConnectedSubject.asObservable().pipe(_y(e=>e?yy(-1):((e,t)=>new gb(i=>{let c,o=0;return function s(){i.next(o),clearTimeout(c),c=setTimeout(s,t(e,o)),o+=1}(),()=>{clearTimeout(c)}}))(this.reconnectOptions,n).pipe(Ay(e=>{var t,i,c;let o;return o=(null===(t=this.connectOptions)||void 0===t?void 0:t.alwaysOn)?e+1:null!==(c=null===(i=this.reconnectOptions)||void 0===i?void 0:i.reconnectAttempts)&&void 0!==c?c:10,e<o?yy(e):(this.status.reconnectionLimitReached=!0,zy(()=>new Error(`Max reconnect attempts ${o} reached.`)))}))),Hy(()=>this.websocket&&!this.isConnected));a.subscribe(null!==(o=null===(c=this.reconnectOptions)||void 0===c?void 0:c.reconnectObserver)&&void 0!==o?o:{next:e=>{Dm.debug(`Attempt no. ${e+1} to reconnect`),this.websocket.complete(),this.connect(this.url,this.connectOptions,this.reconnectOptions)},error:e=>{var t;Dm.debug(e),null===(t=this.socketSubscription)||void 0===t||t.unsubscribe(),this.status.isReconnecting=!1},complete:()=>{Dm.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 Ex,this.wsMessageHandlers=new Map}send(e,t=!0){if(!this.isConnected)return Promise.reject(new Error("WebSocket connection is closed"));const i=`Sending Message for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,Dm.info,i),new Promise((i,c)=>{const o=e=>{i(e)},s=e=>{c(e)};t&&this.setMessageHandler(e,o,s),this.websocket.next(e)})}sendForStream(e,t,i,c){if(!this.isConnected)return zy(()=>new Error("WebSocket connection is closed"));const o=`Sending Message (stream) for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,Dm.info,o),this.setMessageHandler(e,t,i,!0),u.queueUpdate(()=>this.websocket.next(e)),new gb(t=>{const i=new Mb;var o;return this.wsMessages.pipe(Ry(t=>t.SOURCE_REF===e.SOURCE_REF),(o=i,yb(function(e,t){hy(o).subscribe(zb(t,function(){return t.complete()},ab)),!t.closed&&e.subscribe(t)}))).subscribe({next:e=>{t.next(e)},error:e=>{t.error(e)},complete:()=>{t.complete()}}),()=>{i.complete(),this.sendDataLogoff(e.SOURCE_REF),this.removeMessageHandler(e.SOURCE_REF),c&&c()}})}sendForStreamWithoutTeardown(e,t,i){if(!this.isConnected)return zy(()=>new Error("WebSocket connection is closed"));const c=`Sending Message (stream) for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,Dm.info,c),this.setMessageHandler(e,t,i,!0),this.websocket.next(e),this.wsMessages.pipe(Ry(t=>t.SOURCE_REF===e.SOURCE_REF))}setMessageHandler(e,t,i,c=!1){const o=`Setting Message Handler for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,Dm.debug,o),this.wsMessageHandlers.set(e.SOURCE_REF,new Nx(e,t,i,c))}sendDataLogoff(e){this.send(this.messageBuilder.createDataLogoffMessage(e),!1)}removeMessageHandler(e){this.wsMessageHandlers.delete(e)}getMessageHandler(e,t){const i=`Getting Message Handler for SourceRef: ${e} | MessageType: ${t}`;return this.logMessageTypeFlow(t,Dm.debug,i),this.wsMessageHandlers.get(e)}logMessageTypeFlow(e,t,i){switch(e){case eC.DATA_LOGOFF:t(i);break;case Jz.HEARTBEAT_PING:case Jz.HEARTBEAT_PONG:this.heartbeatLoggingIsEnabled&&t(i);break;default:this.messageLoggingIsEnabled&&t(i)}}};Eu([g],Ax.prototype,"websocket",void 0),Eu([g],Ax.prototype,"wsMessages",void 0),Eu([g],Ax.prototype,"wsMessageHandlers",void 0),Eu([Kz],Ax.prototype,"http",void 0),Eu([g],Ax.prototype,"heartbeatIsEnabled",void 0),Ax=Eu([Nu(0,sC),Nu(1,Gz),Nu(2,Kv),Nu(3,Cz),Nu(4,kx),Nu(5,Mz),Nu(6,Fz)],Ax);const Tx=ft.createInterface(e=>e.singleton(Ax));let Ox=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,i,c,o){this.socket=e,this.messageBuilder=t,this.metaCache=i,this.events=c,this.config=o,this.isWorking=!1}httpMode(){return!1}setValidSession(e){Dm.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(){return Au(this,arguments,void 0,function*(e=vg){return this.socket.reset(),this.socket.connect(e,this.config.connect,this.config.reconnect)})}disconnect(){this.socket.reset()}snapshot(e,t){return Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createDataLogonMessage(e,t);return Dm.debug(`${i.MESSAGE_TYPE} (snapshot) message created -> `,i),this.socket.send(i)})}stream(e,t,i,c){const o=this.messageBuilder.createDataLogonMessage(e,c);Dm.debug(`${o.MESSAGE_TYPE} (stream) message created -> `,o);const s=this.socket.sendForStream(o,t,t=>{i(t),this.events.onStreamErrorEvent(e,s,t)},()=>{this.events.onStreamCompleteEvent(e,s)});return this.events.onStreamEvent(e,o,s,{onMessage:t,onError:i}),s}streamState(e,t=()=>{},i=()=>{},c,o=[]){return this.stream(e,t,i,c).pipe(Dy(mx,o))}streamWithoutAutoTeardown(e,t,i,c){Dm.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0");const o=this.messageBuilder.createDataLogonMessage(e,c);Dm.debug(`${o.MESSAGE_TYPE} (stream without auto-teardown) message created -> `,o);const s=this.socket.sendForStreamWithoutTeardown(o,t,t=>{i(t),this.events.onStreamErrorEvent(e,s,t)});return this.events.onStreamEvent(e,o,s,{onMessage:t,onError:i}),s}getMoreRows(e,t){return Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createMoreRowsMessage(e,t);return Dm.debug(`${i.MESSAGE_TYPE} message created -> `,i),this.socket.send(i,!1)})}getMoreColumns(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.socket.send(t)})}dataLogoff(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return Dm.debug(`${t.MESSAGE_TYPE} message created -> `,t),this.socket.send(t)})}getMetadata(e){return Au(this,arguments,void 0,function*(e,t=!0){var i;if(t&&this.metaCache.hasMetadataFor(e))return Dm.debug(`Cached metadata retrieved for ${e}`),this.metaCache.getMetadataFor(e);const c=this.messageBuilder.createMetaRequestMessage(e);let o,s;Dm.debug(`${c.MESSAGE_TYPE} (metadata) message created -> `,c);try{this.isWorking=!0;const t=yield this.socket.send(c);o=null!==(i=null==t?void 0:t.DETAILS)&&void 0!==i?i:{},Object.keys(o).length&&this.metaCache.setMetadataFor(e,o)}catch(e){throw s=e,Dm.error(e),s}finally{this.events.onMetadataEvent(e,c,s),this.isWorking=!1}return o})}getJSONSchema(e){return Au(this,arguments,void 0,function*(e,t=!0){var i;if(t&&this.metaCache.hasJsonSchemaFor(e))return Dm.debug(`Cached JsonSchema retrieved for ${e}`),this.metaCache.getJsonSchemaFor(e);const c=this.messageBuilder.createMetaRequestMessage(e,eC.JSON_SCHEMA_REQUEST);let o;Dm.debug(`${c.MESSAGE_TYPE} (json schema) message created -> `,c);try{this.isWorking=!0,o=null!==(i=yield this.socket.send(c))&&void 0!==i?i:{},Object.keys(o).length&&this.metaCache.setJsonSchemaFor(e,o)}catch(e){Dm.error(e)}finally{this.isWorking=!1}return o})}request(e,t){const i=this.messageBuilder.createRequestMessage(e,t);return Dm.debug(`${i.MESSAGE_TYPE} (request server) message created -> `,i),this.socket.send(i)}getAvailableResources(e){return Au(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasResources())return Dm.debug("Cached resources retrieved"),this.metaCache.getResources();const i=this.messageBuilder.createResourcesMessage(e);Dm.debug(`${i.MESSAGE_TYPE} (resources) message created -> `,i);const c=yield this.socket.send(i);return this.metaCache.setResources(c),c})}commitEvent(e,t){return Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createCommitMessage(e,t);Dm.debug(`${i.MESSAGE_TYPE} (commit) message created -> `,i);const c=this.socket.send(i);return this.events.onCommitEvent(e,i),c.then(t=>(this.events.onCommitResponseEvent(e,t),t))})}};Eu([g],Ox.prototype,"isWorking",void 0),Ox=Eu([Nu(0,Tx),Nu(1,sC),Nu(2,Sz),Nu(3,Rz),Nu(4,Fz)],Ox);const Ix="true"===mg||ug("forceHttp"),Rx=ft.createInterface(e=>e.singleton(Ox)),Dx=ft.createInterface(e=>Ix?e.aliasTo(bx):e.aliasTo(Rx));class Fx{serialize(e){return Dm.deprecated("serialize","Use `serialize` from `JSONSerializer` from `@genesislcap/foundation-utils` instead."),JSON.stringify(e)}deserialize(e){return Dm.deprecated("deserialize","Use `deserialize` from `JSONSerializer` from `@genesislcap/foundation-utils` instead."),e?"string"==typeof e?JSON.parse(e):e.data?JSON.parse(e.data):e.text().then(e=>JSON.parse(e)):Promise.resolve({})}}
|
|
55
|
+
Logout Now </${e}-button></div></div></${e}-card></div>`)(Zm(e,"rapid").prefix)} `,styles:xe` .inactivity-overlay{position: fixed;inset: 0;width: 100vw;height: 100vh;background-color: rgba(0, 0, 0, 0.6);display: flex;align-items: center;justify-content: center;z-index: 9999;backdrop-filter: blur(2px)}.dialog-card{height: 260px;max-height: 260px;max-width: 520px;width: 92%}.card-body{padding: 24px;box-sizing: border-box}.dialog-header{display: flex;align-items: center;gap: 12px;margin-bottom: 16px}.warning-icon{color: var(--accent-fill-rest);font-size: 24px}.dialog-header h2{margin: 0;color: var(--neutral-foreground-rest);font-size: 20px;font-weight: 600}.dialog-content{margin-bottom: 24px}.dialog-content p{margin: 0 0 12px 0;color: var(--neutral-foreground-rest);line-height: 1.5}.dialog-content p:last-child{margin-bottom: 0}.dialog-content strong{color: var(--accent-foreground-rest);font-weight: 600}.dialog-actions{display: flex;gap: 12px;justify-content: flex-end}.continue-button{min-width: 140px}.logout-button{min-width: 120px}@media (max-width: 480px){.card-body{padding: 20px}.dialog-actions{flex-direction: column}.continue-button, .logout-button{width: 100%}}`})],xz);class Lz{constructor(){this.pathHistory=[],this.actionHistory=[],this.isAuthenticated=!1,this.authenticationChangeListeners=Wm()}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:i}=location,c=`${`${"/"!==e?e:""}`}${t}${i}`;if(!this.config.trackPathExclusions.includes(c))return this.pathHistory.push(c),c}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=ft.getOrCreateDOMContainer().get(Gm);t.postMessage("user-authentication-change",this.isAuthenticated),t.close()}userNameChanged(){m.notify(this,"username")}get username(){return m.track(this,"username"),this.userName}permissionChanged(){m.notify(this,"permissions")}get permissions(){return m.track(this,"permissions"),this.permission}profileChanged(){m.notify(this,"profiles")}get profiles(){return m.track(this,"profiles"),this.profile}hasAdminProfile(){return this.isAdmin()}}Eu([qm],Lz.prototype,"config",void 0),Eu([g],Lz.prototype,"pathHistory",void 0),Eu([g],Lz.prototype,"actionHistory",void 0),Eu([g],Lz.prototype,"isAuthenticated",void 0),Eu([g],Lz.prototype,"userKVs",void 0),Eu([g],Lz.prototype,"details",void 0),Eu([g],Lz.prototype,"permission",void 0),Eu([g],Lz.prototype,"profile",void 0),Eu([g],Lz.prototype,"sourceRef",void 0),Eu([g],Lz.prototype,"userName",void 0),Eu([g],Lz.prototype,"rawProperties",void 0);const Mz=ft.createInterface(e=>e.singleton(Lz));class wz{constructor(){this.cachedMetadata=new Map,this.cachedJsonSchema=new Map,this.cachedResources=null}getMetadataFor(e){return this.cachedMetadata.get(e)}getJsonSchemaFor(e){return this.cachedJsonSchema.get(e)}getResources(){return this.cachedResources}hasMetadataFor(e){return this.cachedMetadata.has(e)}hasJsonSchemaFor(e){return this.cachedJsonSchema.has(e)}hasResources(){return null!==this.cachedResources}setMetadataFor(e,t){this.cachedMetadata.set(e,t)}setJsonSchemaFor(e,t){this.cachedJsonSchema.set(e,t)}setResources(e){this.cachedResources=e}}const Sz=ft.createInterface(e=>e.singleton(wz));var kz;!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"}(kz||(kz={}));const $z={STRING:kz.STRING,ENUM:kz.ENUM,BOOLEAN:kz.BOOLEAN,INT:kz.NUMBER,LONG:kz.NUMBER,DOUBLE:kz.NUMBER,BIGDECIMAL:kz.NUMBER,DATE:kz.DATE,DATETIME:kz.DATETIME,NANO_TIMESTAMP:kz.NANO_TIMESTAMP};var Ez;!function(e){e.DATASERVER="DATASERVER",e.EVENT_HANDLER="EVENT_HANDLER",e.REQUEST_SERVER="REQUEST_SERVER"}(Ez||(Ez={}));const Nz="datasource-status-changed",Az=e=>e?e.map(e=>{const t={name:e.NAME,type:$z[e.TYPE]||kz.STRING};if(e.TYPE===kz.ENUM&&e.VALID_VALUES)try{t.enumOptions=Array.isArray(e.VALID_VALUES)?e.VALID_VALUES:e.VALID_VALUES.split("|")}catch(e){Dm.error(e),t.enumOptions=[]}return t}):null,Tz=e=>{var t;const i=null==e?void 0:e.TYPE;if(i===Ez.DATASERVER)return e.FIELD||[];if(i===Ez.REQUEST_SERVER)return e.REPLY_FIELD||(null===(t=e.REPLY)||void 0===t?void 0:t.FIELD)||[];throw new Error(`Unsupported resource type: ${i}`)};class Oz{constructor(){this.streamListeners=Wm(),this.streamCompleteListeners=Wm(),this.streamErrorListeners=Wm(),this.commitListeners=Wm(),this.metadataListeners=Wm(),this.commitResponseListeners=Wm()}addStreamListener(e,t,i){var c,o,s;const n=null===(c=this.streamListeners)||void 0===c?void 0:c.subscribe(e),a=null===(o=this.streamCompleteListeners)||void 0===o?void 0:o.subscribe(t),r=null===(s=this.streamErrorListeners)||void 0===s?void 0:s.subscribe(i);return()=>{n(),a(),r()}}onStreamEvent(e,t,i,c){var o;null===(o=this.streamListeners)||void 0===o||o.publish(new CustomEvent("connect-stream-event",{detail:{functions:c,message:t,resourceName:e,stream:i}}))}onStreamErrorEvent(e,t,i){var c;null===(c=this.streamErrorListeners)||void 0===c||c.publish(new CustomEvent("connect-stream-error-event",{detail:{resourceName:e,stream:t,error:i}}))}onStreamCompleteEvent(e,t){var i;null===(i=this.streamCompleteListeners)||void 0===i||i.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 i;null===(i=this.commitListeners)||void 0===i||i.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,i){var c;null===(c=this.metadataListeners)||void 0===c||c.publish(new CustomEvent("connect-metadata-event",{detail:{resourceName:e,message:t,error:i}}))}addCommitResponseListener(e){var t;return null===(t=this.commitResponseListeners)||void 0===t?void 0:t.subscribe(e)}onCommitResponseEvent(e,t){var i;null===(i=this.commitResponseListeners)||void 0===i||i.publish(new CustomEvent("connect-commit-response-event",{detail:{eventName:e,response:t}}))}}const Iz=ft.createInterface(e=>e.singleton(Oz)),Rz=ft.createInterface(e=>e.aliasTo(Iz)),Dz={connect:{alwaysOn:!1,enableHeartbeat:!0,enableHeartbeatLogging:!1,heartbeatInterval:1e4,verboseHeartbeat:!1,enableMessageLogging:!1},reconnect:{reconnectAttempts:10,reconnectInterval:1e4,reconnectStreams:!0},isWebSocketExpression:Fm},Fz=ft.createInterface(e=>e.instance(Dz));var _z={ACCEPTED:202,BAD_GATEWAY:502,BAD_REQUEST:400,CONFLICT:409,CONTINUE:100,CREATED:201,EXPECTATION_FAILED:417,FORBIDDEN:403,GATEWAY_TIMEOUT:504,GONE:410,HTTP_VERSION_NOT_SUPPORTED:505,IM_A_TEAPOT:418,INSUFFICIENT_SPACE_ON_RESOURCE:419,INSUFFICIENT_STORAGE:507,INTERNAL_SERVER_ERROR:500,LENGTH_REQUIRED:411,LOCKED:423,METHOD_FAILURE:420,METHOD_NOT_ALLOWED:405,MOVED_PERMANENTLY:301,MOVED_TEMPORARILY:302,MULTI_STATUS:207,MULTIPLE_CHOICES:300,NETWORK_AUTHENTICATION_REQUIRED:511,NO_CONTENT:204,NON_AUTHORITATIVE_INFORMATION:203,NOT_ACCEPTABLE:406,NOT_FOUND:404,NOT_IMPLEMENTED:501,NOT_MODIFIED:304,OK:200,PARTIAL_CONTENT:206,PAYMENT_REQUIRED:402,PERMANENT_REDIRECT:308,PRECONDITION_FAILED:412,PRECONDITION_REQUIRED:428,PROCESSING:102,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_HEADER_FIELDS_TOO_LARGE:431,REQUEST_TIMEOUT:408,REQUEST_TOO_LONG:413,REQUEST_URI_TOO_LONG:414,REQUESTED_RANGE_NOT_SATISFIABLE:416,RESET_CONTENT:205,SEE_OTHER:303,SERVICE_UNAVAILABLE:503,SWITCHING_PROTOCOLS:101,TEMPORARY_REDIRECT:307,TOO_MANY_REQUESTS:429,UNAUTHORIZED:401,UNPROCESSABLE_ENTITY:422,UNSUPPORTED_MEDIA_TYPE:415,USE_PROXY:305},Hz={202:"Accepted",502:"Bad Gateway",400:"Bad Request",409:"Conflict",100:"Continue",201:"Created",417:"Expectation Failed",424:"Failed Dependency",403:"Forbidden",504:"Gateway Timeout",410:"Gone",505:"HTTP Version Not Supported",418:"I'm a teapot",419:"Insufficient Space on Resource",507:"Insufficient Storage",500:"Internal Server Error",411:"Length Required",423:"Locked",420:"Method Failure",405:"Method Not Allowed",301:"Moved Permanently",302:"Moved Temporarily",207:"Multi-Status",300:"Multiple Choices",511:"Network Authentication Required",204:"No Content",203:"Non Authoritative Information",406:"Not Acceptable",404:"Not Found",501:"Not Implemented",304:"Not Modified",200:"OK",206:"Partial Content",402:"Payment Required",308:"Permanent Redirect",412:"Precondition Failed",428:"Precondition Required",102:"Processing",103:"Early Hints",426:"Upgrade Required",407:"Proxy Authentication Required",431:"Request Header Fields Too Large",408:"Request Timeout",413:"Request Entity Too Large",414:"Request-URI Too Long",416:"Requested Range Not Satisfiable",205:"Reset Content",303:"See Other",503:"Service Unavailable",101:"Switching Protocols",307:"Temporary Redirect",429:"Too Many Requests",401:"Unauthorized",451:"Unavailable For Legal Reasons",422:"Unprocessable Entity",415:"Unsupported Media Type",305:"Use Proxy",421:"Misdirected Request"},Pz={Accepted:202,"Bad Gateway":502,"Bad Request":400,Conflict:409,Continue:100,Created:201,"Expectation Failed":417,"Failed Dependency":424,Forbidden:403,"Gateway Timeout":504,Gone:410,"HTTP Version Not Supported":505,"I'm a teapot":418,"Insufficient Space on Resource":419,"Insufficient Storage":507,"Internal Server Error":500,"Length Required":411,Locked:423,"Method Failure":420,"Method Not Allowed":405,"Moved Permanently":301,"Moved Temporarily":302,"Multi-Status":207,"Multiple Choices":300,"Network Authentication Required":511,"No Content":204,"Non Authoritative Information":203,"Not Acceptable":406,"Not Found":404,"Not Implemented":501,"Not Modified":304,OK:200,"Partial Content":206,"Payment Required":402,"Permanent Redirect":308,"Precondition Failed":412,"Precondition Required":428,Processing:102,"Early Hints":103,"Upgrade Required":426,"Proxy Authentication Required":407,"Request Header Fields Too Large":431,"Request Timeout":408,"Request Entity Too Large":413,"Request-URI Too Long":414,"Requested Range Not Satisfiable":416,"Reset Content":205,"See Other":303,"Service Unavailable":503,"Switching Protocols":101,"Temporary Redirect":307,"Too Many Requests":429,Unauthorized:401,"Unavailable For Legal Reasons":451,"Unprocessable Entity":422,"Unsupported Media Type":415,"Use Proxy":305,"Misdirected Request":421};var Vz,Bz,Uz=function(e){var t=Hz[e.toString()];if(!t)throw new Error("Status code does not exist: "+e);return t};!function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",e[e.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",e[e.METHOD_FAILURE=420]="METHOD_FAILURE",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(Vz||(Vz={})),function(e){e.ACCEPTED="Accepted",e.BAD_GATEWAY="Bad Gateway",e.BAD_REQUEST="Bad Request",e.CONFLICT="Conflict",e.CONTINUE="Continue",e.CREATED="Created",e.EXPECTATION_FAILED="Expectation Failed",e.FAILED_DEPENDENCY="Failed Dependency",e.FORBIDDEN="Forbidden",e.GATEWAY_TIMEOUT="Gateway Timeout",e.GONE="Gone",e.HTTP_VERSION_NOT_SUPPORTED="HTTP Version Not Supported",e.IM_A_TEAPOT="I'm a teapot",e.INSUFFICIENT_SPACE_ON_RESOURCE="Insufficient Space on Resource",e.INSUFFICIENT_STORAGE="Insufficient Storage",e.INTERNAL_SERVER_ERROR="Internal Server Error",e.LENGTH_REQUIRED="Length Required",e.LOCKED="Locked",e.METHOD_FAILURE="Method Failure",e.METHOD_NOT_ALLOWED="Method Not Allowed",e.MOVED_PERMANENTLY="Moved Permanently",e.MOVED_TEMPORARILY="Moved Temporarily",e.MULTI_STATUS="Multi-Status",e.MULTIPLE_CHOICES="Multiple Choices",e.NETWORK_AUTHENTICATION_REQUIRED="Network Authentication Required",e.NO_CONTENT="No Content",e.NON_AUTHORITATIVE_INFORMATION="Non Authoritative Information",e.NOT_ACCEPTABLE="Not Acceptable",e.NOT_FOUND="Not Found",e.NOT_IMPLEMENTED="Not Implemented",e.NOT_MODIFIED="Not Modified",e.OK="OK",e.PARTIAL_CONTENT="Partial Content",e.PAYMENT_REQUIRED="Payment Required",e.PERMANENT_REDIRECT="Permanent Redirect",e.PRECONDITION_FAILED="Precondition Failed",e.PRECONDITION_REQUIRED="Precondition Required",e.PROCESSING="Processing",e.EARLY_HINTS="Early Hints",e.UPGRADE_REQUIRED="Upgrade Required",e.PROXY_AUTHENTICATION_REQUIRED="Proxy Authentication Required",e.REQUEST_HEADER_FIELDS_TOO_LARGE="Request Header Fields Too Large",e.REQUEST_TIMEOUT="Request Timeout",e.REQUEST_TOO_LONG="Request Entity Too Large",e.REQUEST_URI_TOO_LONG="Request-URI Too Long",e.REQUESTED_RANGE_NOT_SATISFIABLE="Requested Range Not Satisfiable",e.RESET_CONTENT="Reset Content",e.SEE_OTHER="See Other",e.SERVICE_UNAVAILABLE="Service Unavailable",e.SWITCHING_PROTOCOLS="Switching Protocols",e.TEMPORARY_REDIRECT="Temporary Redirect",e.TOO_MANY_REQUESTS="Too Many Requests",e.UNAUTHORIZED="Unauthorized",e.UNAVAILABLE_FOR_LEGAL_REASONS="Unavailable For Legal Reasons",e.UNPROCESSABLE_ENTITY="Unprocessable Entity",e.UNSUPPORTED_MEDIA_TYPE="Unsupported Media Type",e.USE_PROXY="Use Proxy",e.MISDIRECTED_REQUEST="Misdirected Request"}(Bz||(Bz={}));var jz=this&&this.__assign||function(){return jz=Object.assign||function(e){for(var t,i=1,c=arguments.length;i<c;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},jz.apply(this,arguments)};jz(jz({},_z),{getStatusCode:function(e){var t=Pz[e];if(!t)throw new Error("Reason phrase does not exist: "+e);return t},getStatusText:Uz});class qz{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:i}=location;if(e&&(e.includes("/login")||e.includes("/auth")))return;const c=`${"/"!==e?e:""}`;this.returnUrl=`${c}${t}${i}`,this.setSessionStorageItem("returnUrl",this.returnUrl)}setItem(e,t,i){"local"===i?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 Gz=ft.createInterface(e=>e.singleton(qz));function Wz(e){const t=new Error(`HTTP error: ${e.status} ${e.statusText}`);return t.status=e.status,t.message=e.statusText,t}let Yz=class{constructor(e){this.serializer=e}get(e,t){return Au(this,void 0,void 0,function*(){const i=yield fetch(e,Object.assign(Object.assign({credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"}},t),{method:"GET"}));if(i.redirected)return window.location.href=i.url,new Promise(()=>{});if(!i.ok)throw Wz(i);return(t.serializer||this.serializer).deserialize(i)})}post(e,t){return Au(this,void 0,void 0,function*(){const i=yield fetch(e,Object.assign(Object.assign({credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"}},t),{method:"POST"}));if(i.redirected)return window.location.href=i.url,new Promise(()=>{});if(!i.ok)throw Wz(i);return(t.serializer||this.serializer).deserialize(i)})}};Yz=Eu([Nu(0,Kv)],Yz);const Kz=ft.createInterface(e=>e.singleton(Yz)),Zz={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},bg&&bg.length?JSON.parse(bg):{})},Qz=ft.createInterface(e=>e.instance(Zz));var Xz,Jz,eC,tC;!function(e){e.BASIC="BASIC",e.SSO="SSO",e.JWT="JWT",e.REFRESH="REFRESH"}(Xz||(Xz={}));class iC extends Error{constructor(e,t,i="Auth Failed \n"){super(i),this.sent=e,this.received=t,Object.setPrototypeOf(this,iC.prototype)}isIgnorableError(){var e,t,i,c,o,s,n,a;return!!(null===(c=null===(i=null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)||void 0===i?void 0:i.toLowerCase())||void 0===c?void 0:c.includes("request needs the user to be logged"))||!!(null===(a=null===(n=null===(s=null===(o=this.received)||void 0===o?void 0:o.DETAILS)||void 0===s?void 0:s.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,i,c;return Array.isArray(null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)?null===(c=null===(i=this.received)||void 0===i?void 0:i.DETAILS)||void 0===c?void 0:c.ERROR.map(e=>this.errorDetailFormatter(e)).join("\n"):""}hasPasswordExpiredError(){return this.hasErrorCode("PASSWORD_EXPIRED")}hasMFAError(){return this.hasErrorCode("MFA_REQUIRED")||this.hasErrorCode("MFA_FAILED")}requiresTermsAndConditions(){return this.hasErrorCode("TERMS_ACCEPTANCE_REQUIRED")}hasErrorCode(e){var t,i;return!!Array.isArray(null===(t=this.received)||void 0===t?void 0:t.ERROR)&&(null===(i=this.received)||void 0===i?void 0:i.ERROR.some(t=>t.CODE===e))}errorDetailFormatter(e){return`\n ${e.CODE}: \n ${e.TEXT}`}}!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"}(Jz||(Jz={})),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"}(eC||(eC={})),function(e){e.SESSION_NOT_FOUND="SESSION_NOT_FOUND",e.UNKNOWN_MESSAGE_TYPE="UNKNOWN_MESSAGE_TYPE"}(tC||(tC={}));const cC=(e,t)=>!!Array.isArray(null==e?void 0:e.ERROR)&&(null==e?void 0:e.ERROR.some(e=>{var i,c;return(null===(i=e.CODE)||void 0===i?void 0:i.includes(`${t}`))||(null===(c=e.STATUS_CODE)||void 0===c?void 0:c.includes(`${t}`))}));let oC=class{constructor(e,t){this.session=e,this.uuid=t}createLoginMessage(e){let t;switch(e.type){case Xz.BASIC:t={USER_NAME:e.username,PASSWORD:e.password,MFA_CODE:e.mfaToken};break;case Xz.REFRESH:t={USER_NAME:e.username,REFRESH_AUTH_TOKEN:e.refreshToken,MFA_CODE:e.mfaToken};break;case Xz.SSO:t={SSO_TOKEN:e.ssoToken};break;case Xz.JWT:t={JWT:e.jwt,DOMAIN:e.domain}}return{DETAILS:t,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.EVENT_LOGIN_AUTH}}createLogoutMessage(e){var t,i;return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.EVENT_LOGOUT,SESSION_AUTH_TOKEN:null!==(t=e.authToken)&&void 0!==t?t:this.session.getSessionStorageItem("authToken"),SESSION_ID:null!==(i=e.sessionId)&&void 0!==i?i:this.session.getSessionStorageItem("sessionId")}}createDataLogonMessage(e,t){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.DATA_LOGON,DETAILS:Object.assign({DATASOURCE_NAME:e},t),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createDataLogoffMessage(e){return{SOURCE_REF:e,MESSAGE_TYPE:eC.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:eC.RESOURCES_REQUEST},e)}createMetaRequestMessage(e,t=eC.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:eC.EVENT_LOGIN_AUTH,DETAILS:{REFRESH_AUTH_TOKEN:this.session.getSessionStorageItem("refreshToken"),MFA_CODE:this.session.getSessionStorageItem("mfaToken")}}}createChangePasswordMessage(e,t,i){return{USER_NAME:e,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.EVENT_CHANGE_USER_PASSWORD,DETAILS:{OLD_PASSWORD:t,NEW_PASSWORD:i}}}createForgotPasswordMessage(e,t,i=e){return{USER_NAME:i,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.EVENT_SELF_SERVICE_PASSWORD_RESET,DETAILS:{USER_NAME:e,RETURN_URL:t}}}createForgotPasswordTokenMessage(e,t,i,c=e){return{USER_NAME:c,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:eC.EVENT_PASSWORD_RESET_ACTION,DETAILS:{USER_NAME:e,RESET_TOKEN:t,NEW_PASSWORD:i}}}createMoreRowsMessage(e,t){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:Jz.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:Jz.MORE_COLUMNS})}createHTTPHeadersFromMessage(e,t="application/json; charset=UTF-8"){const i={"Content-type":t};return e.SOURCE_REF&&(i["source-ref"]=e.SOURCE_REF,i.SOURCE_REF=e.SOURCE_REF),e.SESSION_AUTH_TOKEN&&(i["SESSION-AUTH-TOKEN"]=e.SESSION_AUTH_TOKEN),e.MESSAGE_TYPE===eC.EVENT_LOGOUT&&(i["SESSION-ID"]=e.SESSION_ID),i}createHeartbeatPingMessage(e=!1){return{MESSAGE_TYPE:Jz.HEARTBEAT_PING,SOURCE_REF:this.uuid.createId(),VERBOSE:e,DETAILS:{},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}};oC=Eu([Nu(0,Gz),Nu(1,Cz)],oC);const sC=ft.createInterface(e=>e.singleton(oC));function nC(e,t,i){const c=e=>"function"==typeof e?e:()=>e,o=c(t),s=c(i);return(t,i)=>e(t,i)?o(t,i):s(t,i)}class aC{constructor(e){this.path=e}}const rC=new Set,lC=Object.freeze({register(e){rC.add(e)},unregister(e){rC.delete(e)}}),dC=/^([a-z][a-z0-9+\-.]*:)?\/\//i,hC=Object.freeze({path:Object.freeze({get current(){return location.pathname+location.search},generateRoute(e,t,i={}){return Au(this,void 0,void 0,function*(){let c="config"in e?e:VC.find(e);for(;null!==c;){const e=yield c.config.generateRouteFromPath(t,i);if(null!==e)return e;c=c.parent}return null})},push(e,t=!0){e&&dC.test(e)?location.href=e:(history.pushState({},document.title,e),t&&hC.path.trigger(e))},replace(e,t=!0){e&&dC.test(e)?location.href=e:(history.replaceState({},document.title,e),t&&hC.path.trigger(e))},trigger(e){const t=new aC(e);for(const e of rC)e.enqueue(t)}}),name:Object.freeze({generateRoute(e,t,i={}){return Au(this,void 0,void 0,function*(){let c="config"in e?e:VC.find(e);for(;null!==c;){const e=yield c.config.generateRouteFromName(t,i);if(null!==e)return e;c=c.parent}return null})},push(e,t,i={},c=!0){return Au(this,void 0,void 0,function*(){const o=yield hC.name.generateRoute(e,t,i);null!==o&&hC.path.push(o,c)})},replace(e,t,i={},c=!0){return Au(this,void 0,void 0,function*(){const o=yield hC.name.generateRoute(e,t,i);null!==o&&hC.path.replace(o,c)})},trigger(e,t,i={}){return Au(this,void 0,void 0,function*(){const c=yield hC.name.generateRoute(e,t,i);null!==c&&hC.path.trigger(c)})}})});class uC{constructor(){this.queue=[],this.promise=null,this.resolve=null}connect(){this.enqueue(new aC(hC.path.current)),window.addEventListener("popstate",this),lC.register(this)}disconnect(){this.queue=[],this.promise=null,this.resolve=null,window.removeEventListener("popstate",this),lC.unregister(this)}receive(){return null!==this.promise||(this.promise=new Promise(e=>this.resolve=e),Promise.resolve().then(()=>this.tryDequeue())),this.promise}enqueue(e){this.queue.push(e),this.tryDequeue()}tryDequeue(){if(null===this.resolve||0===this.queue.length)return;const e=this.queue[this.queue.length-1],t=this.resolve;this.queue.length=0,this.promise=null,this.resolve=null,t(e)}handleEvent(e){this.enqueue(new aC(hC.path.current))}}const fC=encodeURIComponent,pC=e=>fC(e).replace("%24","$");function mC(e,t,i){let c=[];if(null==t)return c;if(Array.isArray(t))for(let o=0,s=t.length;o<s;o++)if(i)c.push(`${pC(e)}=${fC(t[o])}`);else{const i=e+"["+("object"==typeof t[o]&&null!==t[o]?o:"")+"]";c=c.concat(mC(i,t[o]))}else if("object"!=typeof t||i)c.push(`${pC(e)}=${fC(t)}`);else for(const i in t)c=c.concat(mC(e+"["+i+"]",t[i]));return c}function gC(e,t){return Array.isArray(e)?(e.push(t),e):void 0!==e?[e,t]:t}function vC(e,t,i){let c=e;const o=t.length-1;for(let e=0;e<=o;e++){const s=""===t[e]?c.length:t[e];if(e<o){const i=c[s]&&"object"!=typeof c[s]?[c[s]]:c[s];c=c[s]=i||(isNaN(t[e+1])?{}:[])}else c=c[s]=i}}const bC=Object.freeze({get current(){return location.search},build(e,t){let i=[];const c=Object.keys(e||{}).sort();for(let o=0,s=c.length;o<s;o++){const s=c[o];i=i.concat(mC(s,e[s],t))}return 0===i.length?"":i.join("&")},separate(e){const t=e.indexOf("?");let i="";return-1!==t&&(i=e.substr(t+1,e.length),e=e.substr(0,t)),{path:e,queryString:i}},parse(e){const t={};if(!e||"string"!=typeof e)return t;let i=e;"?"===i.charAt(0)&&(i=i.substr(1));const c=i.replace(/\+/g," ").split("&");for(let e=0;e<c.length;e++){const i=c[e].split("="),o=decodeURIComponent(i[0]);if(!o)continue;let s=o.split("]["),n=s.length-1;if(/\[/.test(s[0])&&/\]$/.test(s[n])?(s[n]=s[n].replace(/\]$/,""),s=s.shift().split("[").concat(s),n=s.length-1):n=0,i.length>=2){const e=i[1]?decodeURIComponent(i[1]):"";n?vC(t,s,e):t[o]=gC(t[o],e)}else t[o]=!0}return t}}),yC=e=>e;class zC{constructor(e,t,i){this.path=e,this.name=t,this.caseSensitive=i}}class CC{constructor(e,t,i,c){this.route=e,this.paramNames=t,this.paramTypes=i,this.settings=c}get path(){return this.route.path}}class xC{constructor(e,t,i,c){this.endpoint=e,this.params=t,this.typedParams=i,this.queryParams=c,this.allParams=Object.assign(Object.assign({},t),c),this.allTypedParams=Object.assign(Object.assign({},i),c)}get settings(){return this.endpoint.settings}}class LC{constructor(e,t,i,c){var o;this.chars=e,this.states=t,this.skippedStates=i,this.result=c,this.head=t[t.length-1],this.endpoint=null===(o=this.head)||void 0===o?void 0:o.endpoint}advance(e){const{chars:t,states:i,skippedStates:c,result:o}=this;let s=null,n=0;const a=i[i.length-1];function r(l,d){if(l.isMatch(e)&&(1===++n?s=l:o.add(new LC(t.concat(e),i.concat(l),null===d?c:c.concat(d),o))),null===a.segment&&l.isOptional&&null!==l.nextStates){if(l.nextStates.length>1)throw new Error(`${l.nextStates.length} nextStates`);const e=l.nextStates[0];if(!e.isSeparator)throw new Error("Not a separator");if(null!==e.nextStates)for(const t of e.nextStates)r(t,l)}}if(a.isDynamic&&r(a,null),null!==a.nextStates)for(const e of a.nextStates)r(e,null);null!==s&&(i.push(this.head=s),t.push(e),null!==s.endpoint&&(this.endpoint=s.endpoint)),0===n&&o.remove(this)}finalize(){!function e(t,i){const c=i.nextStates;if(null!==c)if(1===c.length&&null===c[0].segment)e(t,c[0]);else for(const i of c)if(i.isOptional&&null!==i.endpoint){if(t.push(i),null!==i.nextStates)for(const c of i.nextStates)e(t,c);break}}(this.skippedStates,this.head)}getParams(){const{states:e,chars:t,endpoint:i}=this,c={};for(const e of i.paramNames)c[e]=void 0;for(let i=0,o=e.length;i<o;++i){const o=e[i];if(o.isDynamic){const e=o.segment.name;void 0===c[e]?c[e]=t[i]:c[e]+=t[i]}}return c}compareTo(e){const t=this.states,i=e.states;for(let e=0,c=0,o=Math.max(t.length,i.length);e<o;++e){let o=t[e];if(void 0===o)return 1;let s=i[c];if(void 0===s)return-1;let n=o.segment,a=s.segment;if(null===n){if(null===a){++c;continue}if(void 0===(o=t[++e]))return 1;n=o.segment}else if(null===a){if(void 0===(s=i[++c]))return-1;a=s.segment}if(n.kind<a.kind)return 1;if(n.kind>a.kind)return-1;++c}const c=this.skippedStates,o=e.skippedStates,s=c.length,n=o.length;if(s<n)return 1;if(s>n)return-1;for(let e=0;e<s;++e){const t=c[e],i=o[e];if(t.length<i.length)return 1;if(t.length>i.length)return-1}return 0}}function MC(e){return null!==e.head.endpoint}function wC(e,t){return e.compareTo(t)}class SC{constructor(e){this.candidates=[],this.candidates=[new LC([""],[e],[],this)]}get isEmpty(){return 0===this.candidates.length}getSolution(){const e=this.candidates.filter(MC);if(0===e.length)return null;for(const t of e)t.finalize();return e.sort(wC),e[0]}add(e){this.candidates.push(e)}remove(e){this.candidates.splice(this.candidates.indexOf(e),1)}advance(e){const t=this.candidates.slice();for(const i of t)i.advance(e)}}class kC{constructor(){this.names=new Map,this.paths=new Map,this.rootState=new $C(null,null,"")}add(e,t){if(e instanceof Array)for(const i of e)this.$add(i,t);else this.$add(e,t)}$add(e,t){const i=e.path,c=new zC(e.path,e.name||"",!0===e.caseSensitive),o=""===i?[""]:i.split("/").filter(EC),s=[],n=[];let a=this.rootState;const r=[];for(const e of o)switch(a=a.append(null,"/"),e.charAt(0)){case"{":{const t=e.slice(1,-1).split(":").map(e=>e.trim());2===t.length?n.push(t[1]):n.push("string");const i=t[0].endsWith("?"),c=i?t[0].slice(0,-1):t[0];s.push(c);const o=new AC(c,i);r.push(o),a=o.appendTo(a);break}case"*":{const t=e.slice(1);s.push(t),n.push("string");const i=new TC(t);r.push(i),a=i.appendTo(a);break}default:{const t=new NC(e,c.caseSensitive);r.push(t),a=t.appendTo(a);break}}const l=new CC(c,s,n,t||null);a.setEndpoint(l),this.paths.set(i,r),e.name&&this.names.set(e.name,r)}recognize(e,t={}){return Au(this,void 0,void 0,function*(){const i=bC.separate(e),c=bC.parse(i.queryString);(e=decodeURI(i.path)).startsWith("/")||(e=`/${e}`),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1));const o=new SC(this.rootState);for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(o.advance(i),o.isEmpty)return null}const s=o.getSolution();if(null===s)return null;const{endpoint:n}=s,a=n.paramNames,r=n.paramTypes,l=s.getParams(),d={};for(let e=0,i=a.length;e<i;++e){const i=a[e],c=t[r[e]]||yC,o=l[i],s=yield c(o);d[i]=s}return new xC(n,l,d,c)})}generateFromName(e,t){return this.generate(this.names.get(e),t)}generateFromPath(e,t){return this.generate(this.paths.get(e),t)}generate(e,t){if(!e)return null;const i=Object.assign({},t),c={};let o="";for(let t=0,s=e.length;t<s;t++){const s=e[t],n=s.generate(i,c);if(null==n){if(s instanceof AC&&!s.optional)throw new Error(`A value is required for route parameter '${s.name}'.`)}else o+="/",o+=n}"/"!==o.charAt(0)&&(o="/"+o);for(const e in c)delete i[e];const s=bC.build(i);return o+=s?`?${s}`:"",o}}class $C{constructor(e,t,i){switch(this.prevState=e,this.segment=t,this.value=i,this.nextStates=null,this.endpoint=null,null==t?void 0:t.kind){case 2:this.length=e.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=t.optional;break;case 1:this.length=e.length+1,this.isSeparator=!1,this.isDynamic=!0,this.isOptional=!1;break;case 3:this.length=e.length+1,this.isSeparator=!1,this.isDynamic=!1,this.isOptional=!1;break;case void 0:this.length=null===e?0:e.length,this.isSeparator=!0,this.isDynamic=!1,this.isOptional=!1}}append(e,t){let i,c=this.nextStates;return null===c?(i=void 0,c=this.nextStates=[]):i=null===e?c.find(e=>e.value===t):c.find(t=>{var i;return null===(i=t.segment)||void 0===i?void 0:i.equals(e)}),void 0===i&&c.push(i=new $C(this,e,t)),i}setEndpoint(e){if(null!==this.endpoint)throw new Error(`Cannot add ambiguous route. The pattern '${e.route.path}' clashes with '${this.endpoint.route.path}'`);this.endpoint=e,this.isOptional&&(this.prevState.setEndpoint(e),this.prevState.isSeparator&&null!==this.prevState.prevState&&this.prevState.prevState.setEndpoint(e))}isMatch(e){const t=this.segment;switch(null==t?void 0:t.kind){case 2:return!this.value.includes(e);case 1:return!0;case 3:case void 0:return this.value.includes(e)}}}function EC(e){return e.length>0}class NC{constructor(e,t){this.value=e,this.caseSensitive=t}get kind(){return 3}appendTo(e){const{value:t,value:{length:i}}=this;if(this.caseSensitive)for(let c=0;c<i;++c)e=e.append(this,t.charAt(c));else for(let c=0;c<i;++c){const i=t.charAt(c);e=e.append(this,i.toUpperCase()+i.toLowerCase())}return e}generate(){return this.value}equals(e){return 3===e.kind&&e.caseSensitive===this.caseSensitive&&e.value===this.value}}class AC{constructor(e,t){this.name=e,this.optional=t}get kind(){return 2}appendTo(e){return e=e.append(this,"/")}generate(e,t){return t[this.name]=!0,e[this.name]}equals(e){return 2===e.kind&&e.optional===this.optional&&e.name===this.name}}class TC{constructor(e){this.name=e}get kind(){return 1}appendTo(e){return e=e.append(this,"")}generate(e,t){return t[this.name]=!0,e[this.name]}equals(e){return 1===e.kind&&e.name===this.name}}const OC="fast-child-route";function IC(e,t){return"command"in t?t.command:"redirect"in t?new JC(t.redirect):cx.fromDefinition(e,t)}const RC=e=>{if(null==e)return!1;switch(e.toLowerCase().trim()){case"true":case"yes":case"1":return!0;default:return!1}},DC={number:e=>void 0===e?NaN:parseFloat(e),float:e=>void 0===e?NaN:parseFloat(e),int:e=>void 0===e?NaN:parseInt(e),integer:e=>void 0===e?NaN:parseInt(e),Date:e=>void 0===e?new Date(Date.now()):new Date(e),boolean:RC,bool:RC};class FC{constructor(e){this.owner=e,this._recognizer=null,this.pathToCommand=new Map,this.fallbackCommand=null,this.fallbackSettings=null,this.converters={}}get recognizer(){return null===this._recognizer&&(this._recognizer=this.owner.createRouteRecognizer()),this._recognizer}ignore(e){"string"==typeof e&&(e={path:e}),this.pathToCommand.set(e.path,new XC),this.recognizer.add(e,e.settings)}map(...e){for(const t of e){if("children"in t){const e=this.owner.createTitleBuilder(),i=t.children.map(i=>{const c=Object.assign(Object.assign(Object.assign({},t),i),{path:`${t.path}/${i.path}`});if("title"in t||"title"in i){const o=t.title||"",s=i.title||"";c.title=e.joinTitles(o,s)}if("name"in i){const e=t.name?t.name+"/":"";c.name=e+i.name}return c.children===t.children&&delete c.children,c});this.map(...i);continue}let e;if(e="command"in t?t.command:"redirect"in t?new JC(t.redirect):cx.fromDefinition(this.owner,t),this.pathToCommand.set(t.path,e),this.recognizer.add(t,t.settings),"childRouters"in t&&t.childRouters){const i=Object.assign(Object.assign({},t),{path:t.path+`/*${OC}`});this.pathToCommand.set(i.path,e),this.recognizer.add(i,i.settings)}}}fallback(e){const t=this.owner;this.fallbackCommand="function"==typeof e?{createContributor(i,c){return Au(this,void 0,void 0,function*(){const o=yield e();return IC(t,o).createContributor(i,c)})}}:IC(t,e)}converter(e,t){let i;i="convert"in t?t.convert.bind(t):t.prototype&&"convert"in t.prototype?e=>this.owner.construct(t).convert(e):t,this.converters[e]=i}recognize(e){return Au(this,void 0,void 0,function*(){const t=yield this.recognizer.recognize(e,this.aggregateConverters());if(null!==t)return{route:t,command:this.pathToCommand.get(t.endpoint.path)};if(null!==this.fallbackCommand){const t=bC.separate(e),i=bC.parse(t.queryString);return{route:new xC(new CC(new zC("*","",!1),[],[],this.fallbackSettings),{},{},i),command:this.fallbackCommand}}return null})}generateFromName(e,t){return this.recognizer.generateFromName(e,t)}generateFromPath(e,t){return this.recognizer.generateFromPath(e,t)}aggregateConverters(){return null===this.owner.parent?Object.assign(Object.assign({},DC),this.converters):Object.assign(Object.assign({},this.owner.parent.routes.aggregateConverters()),this.converters)}}const _C="$router";function HC(e){const t=e.parentElement;if(t)return t;{const t=e.getRootNode();if(t.host instanceof HTMLElement)return t.host}return null}function PC(e){let t=e;for(;t=HC(t);)if(_C in t)return t[_C];return null}const VC=Object.freeze({getOrCreateFor(e){const t=e[_C];return void 0!==t?t:e[_C]=new BC(e)},find:e=>e[_C]||PC(e),from(e){class t extends e{constructor(){super(),VC.getOrCreateFor(this)}get config(){return this[_C].config}set config(e){this[_C].config=e}}const i=t.prototype;if("connectedCallback"in i){const e=i.connectedCallback;i.connectedCallback=function(){e.call(this),this[_C].connect()}}else i.connectedCallback=function(){this[_C].connect()};if("disconnectedCallback"in i){const e=i.disconnectedCallback;i.disconnectedCallback=function(){e.call(this),this[_C].disconnect()}}else i.disconnectedCallback=function(){this[_C].disconnect()};return t}});let BC=class{constructor(e){this.host=e,this.parentRouter=void 0,this.contributors=new Set,this.navigationQueue=null,this.linkHandler=null,this.newView=null,this.newRoute=null,this.childCommandContributor=null,this.childRoute=null,this.isConnected=!1,this.routerConfig=null,this.view=null,this.route=null,this.onNavigationMessage=e=>Au(this,void 0,void 0,function*(){const t=this.config.createNavigationProcess();yield t.run(this,e),this.navigationQueue.receive().then(this.onNavigationMessage)}),e[_C]=this}get config(){return this.routerConfig}set config(e){this.routerConfig=e,this.tryConnect()}get parent(){if(void 0===this.parentRouter){if(!this.isConnected)return null;this.parentRouter=PC(this.host)}return this.parentRouter||null}get level(){return null===this.parent?0:this.parent.level+1}shouldRender(e){var t;if(this.route&&this.route.endpoint.path===e.endpoint.path){const i=null==e?void 0:e.allParams,c=null===(t=this.route)||void 0===t?void 0:t.allParams;if(JSON.stringify(c)===JSON.stringify(i))return!1}return!0}beginRender(e,t){return Au(this,void 0,void 0,function*(){return this.newRoute=e,this.newView=yield t.createView(),this.newView.bind(e.allTypedParams,UC.create(this)),this.newView.appendTo(this.host),yield t.transition.begin(this.host,this.view,this.newView),{commit:this.renderOperationCommit.bind(this,t.layout,t.transition),rollback:this.renderOperationRollback.bind(this,t.transition)}})}connect(){this.isConnected=!0,this.tryConnect()}disconnect(){null===this.parent?(null!==this.navigationQueue&&(this.navigationQueue.disconnect(),this.navigationQueue=null),null!==this.linkHandler&&(this.linkHandler.disconnect(),this.linkHandler=null)):this.parent.removeContributor(this),this.isConnected=!1,this.parentRouter=void 0}addContributor(e){this.contributors.add(e)}removeContributor(e){this.contributors.delete(e)}tryConnect(){null!==this.config&&this.isConnected&&(null===this.parent?(null!==this.navigationQueue&&this.navigationQueue.disconnect(),this.navigationQueue=this.config.createNavigationQueue(),this.navigationQueue.connect(),this.navigationQueue.receive().then(this.onNavigationMessage),null!==this.linkHandler&&this.linkHandler.disconnect(),this.linkHandler=this.config.createLinkHandler(),this.linkHandler.connect()):(this.config.parent=this.parent.config,this.parent.addContributor(this)))}renderOperationCommit(e,t){return Au(this,void 0,void 0,function*(){yield e.beforeCommit(this.host),yield t.commit(this.host,this.view,this.newView),yield e.afterCommit(this.host),null!==this.view&&this.view.dispose(),this.route=this.newRoute,this.view=this.newView,this.newRoute=null,this.newView=null})}renderOperationRollback(e){return Au(this,void 0,void 0,function*(){null!==this.newView&&(yield e.rollback(this.host,this.view,this.newView),this.newView.dispose(),this.newRoute=null,this.newView=null)})}navigate(e){return Au(this,void 0,void 0,function*(){yield this.tunnel(e)})}leave(e){return Au(this,void 0,void 0,function*(){if(yield this.tunnel(e),!e.canceled){const t=this.contributors;this.contributors=new Set,e.onCancel(()=>this.contributors=t)}})}construct(e){return Au(this,void 0,void 0,function*(){if(null!==this.parent){const t=e.route.allParams[OC]||"",i=yield this.config.recognizeRoute(t);if(null===i){return this.config.createEventSink().onUnhandledNavigationMessage(this,new aC(t)),void e.cancel()}this.childRoute=i.route,this.childCommandContributor=yield i.command.createContributor(this,i.route)}yield this.tunnel(e)})}enter(e){return Au(this,void 0,void 0,function*(){yield this.tunnel(e)})}commit(e){return Au(this,void 0,void 0,function*(){yield this.tunnel(e)})}tunnel(e){return Au(this,void 0,void 0,function*(){const t=this.childRoute,i=this.childCommandContributor;if(t&&i&&(yield e.evaluateContributor(i,t,this)),e.canceled)return;const c=[...this.config.findContributors(e.name),...Array.from(this.contributors)];for(const t of c)if(yield e.evaluateContributor(t,void 0,this),e.canceled)return})}};const UC=Object.freeze({create:e=>Object.create(z,{router:{value:e}})}),jC=Object.freeze({default:Object.freeze({begin(e,t,i){return Au(this,void 0,void 0,function*(){})},rollback(e,t,i){return Au(this,void 0,void 0,function*(){})},commit(e,t,i){return Au(this,void 0,void 0,function*(){})}})});class qC{constructor(e=null,t=null,i=!0){this.template=e,this.runBeforeCommit=i,this.styles=null==t?null:Array.isArray(t)?Y.create(t):t instanceof Y?t:Y.create([t])}beforeCommit(e){return Au(this,void 0,void 0,function*(){this.runBeforeCommit&&this.apply(e)})}afterCommit(e){return Au(this,void 0,void 0,function*(){this.runBeforeCommit||this.apply(e)})}apply(e){e instanceof be&&(e.$fastController.template!==this.template&&(e.$fastController.template=this.template),e.$fastController.styles!==this.styles&&(e.$fastController.styles=this.styles))}}const GC=Object.freeze({default:new qC(W`<slot></slot>`)});function WC(e,t){return t in e}const YC={lifecycle:!0,parameters:!0};class KC extends C{constructor(e){super(),this.options=e}createPlaceholder(e){return u.createCustomAttributePlaceholder("fast-navigation-contributor",e)}createBehavior(e){return new ZC(e,this.options)}}class ZC{constructor(e,t){this.contributor=e,this.options=t,this.router=null}bind(e,t){if(this.options.lifecycle&&(this.router=t.router||VC.find(this.contributor),this.router.addContributor(this.contributor)),this.options.parameters){const t=this.contributor,i=e;for(const e in i)t[e]=i[e]}}unbind(e){null!==this.router&&this.router.removeContributor(this.contributor)}}function QC(e){return new KC(Object.assign({},YC,e))}class XC{createContributor(){return Au(this,void 0,void 0,function*(){return{navigate(e){return Au(this,void 0,void 0,function*(){e.cancel()})}}})}}class JC{constructor(e){this.redirect=e}createContributor(){return Au(this,void 0,void 0,function*(){const e=this.redirect;return{navigate(t){return Au(this,void 0,void 0,function*(){const i=t.router.config,c=(yield i.generateRouteFromName(e,t.route.allParams))||(yield i.generateRouteFromPath(e,t.route.allParams));if(null===c)throw new Error(`Invalid redirect. Name or path not found: ${e}`);t.cancel(()=>Au(this,void 0,void 0,function*(){return hC.path.replace(c)}))})}}})}}function ex(e){return W`<${e} ${QC()}></${e}>`}function tx(e){const t=document.createDocumentFragment();t.appendChild(e);const i=new j(t,[QC().createBehavior(e)]);return{create:()=>i}}class ix{constructor(e,t,i){this.router=e,this.route=t,this.command=i}construct(e){return Au(this,void 0,void 0,function*(){this.router.shouldRender(this.route)?(this.operation=yield this.router.beginRender(this.route,this.command),e.onCancel(()=>this.operation.rollback())):e.cancel()})}commit(e){return Au(this,void 0,void 0,function*(){yield this.operation.commit(),this.command.title&&e.setTitle(this.command.title)})}}class cx{constructor(e,t){this.owner=e,this.createView=t,this._layout=null,this._transition=null,this.title=""}get transition(){return this._transition||this.owner.defaultTransition}set transition(e){this._transition=e}get layout(){return this._layout||this.owner.defaultLayout}set layout(e){this._layout=e}createContributor(e,t){return Au(this,void 0,void 0,function*(){return new ix(e,t,this)})}static fromDefinition(e,t){let i;i="template"in t?()=>Au(this,void 0,void 0,function*(){let e=t.template;return"function"==typeof e&&(e=yield e()),e.create()}):()=>Au(this,void 0,void 0,function*(){let e=t.element,i=null;if(t.factory)i=t.factory;else if("function"==typeof e){let t=ue.forType(e);if(t)i=ex(t.name);else if(e=yield e(),"string"==typeof e)i=ex(e);else if(e instanceof HTMLElement)i=tx(e);else{if(t=ue.forType(e),!t)throw new Error("Invalid value for element in route config.");i=ex(t.name)}}else e instanceof HTMLElement?t.factory=i=tx(e):t.factory=i=ex(e);return i.create()});const c=new cx(e,i);return t.layout&&(t.layout instanceof q?c.layout=new qC(t.layout):c.layout=t.layout),t.transition&&(c.transition=t.transition),t.title&&(c.title=t.title),c}}class ox{constructor(){this.handler=e=>{const{shouldHandleEvent:t,href:i}=this.getEventInfo(e);t&&(e.preventDefault(),hC.path.push(i))}}connect(){window.addEventListener("click",this.handler,!0)}disconnect(){window.removeEventListener("click",this.handler)}getEventInfo(e){const t={shouldHandleEvent:!1,href:null,anchor:null},i=this.findClosestAnchor(e);if(!i||!this.targetIsThisWindow(i))return t;if(i.hasAttribute("download")||i.hasAttribute("router-ignore")||i.hasAttribute("data-router-ignore"))return t;if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return t;const c=i.getAttribute("href");t.anchor=i,t.href=c;const o=1===e.which,s=c&&!("#"===c.charAt(0)||/^[a-z]+:/i.test(c));return t.shouldHandleEvent=o&&!!s,t}findClosestAnchor(e){const t=e.composedPath();for(let e=0,i=t.length;e<i;++e){const i=t[e];if("A"===i.tagName)return i}return e.target}targetIsThisWindow(e){const t=e.getAttribute("target");return!t||t===window.name||"_self"===t}}class sx{constructor(e,t,i,c,o){this.name=e,this.commitActions=c,this.cancelActions=o,this.routes=[],this.routers=[],this.canceled=!1,this.titles=[],this.routes.push(t),this.routers.push(i)}get route(){return this.routes[this.routes.length-1]}get router(){return this.routers[this.routers.length-1]}cancel(e){this.canceled=!0,e&&this.cancelActions.push(e)}onCommit(e){this.commitActions.push(e)}onCancel(e){this.cancelActions.push(e)}setTitle(e){const t=this.router.level;for(;this.titles.length<t+1;)this.titles.push([]);this.titles[t].push(e)}evaluateContributor(e,t=this.route,i=this.router){return Au(this,void 0,void 0,function*(){WC(e,this.name)&&(this.routes.push(t),this.routers.push(i),yield e[this.name](this),this.routes.pop(),this.routers.pop())})}}class nx{constructor(){this.phases=["navigate","leave","construct","enter","commit"]}run(e,t){return Au(this,void 0,void 0,function*(){const i=e.config.createEventSink(),c=yield e.config.recognizeRoute(t.path);if(null===c)return void i.onUnhandledNavigationMessage(e,t);const o=c.route,s=c.command;i.onNavigationBegin(e,o,s);const n=[],a=[];let r=n;const l=[yield s.createContributor(e,o),e,this];for(const t of this.phases){const c=new sx(t,o,e,n,a);if(i.onPhaseBegin(c),c.canceled)r=a;else for(const e of l)if(yield c.evaluateContributor(e),c.canceled){r=a;break}if(i.onPhaseEnd(c),c.canceled)break}yield Promise.all(r.map(e=>e())).then(()=>i.onNavigationEnd(e,o,s))})}commit(e){const t=e.router.config.createTitleBuilder();document.title=t.buildTitle(e.router.config.title,e.titles)}}class ax{constructor(e=" - ",t=":"){this.segmentSeparator=e,this.fragmentSeparator=t}joinTitles(e,t){return""===e?t:""===t?e:`${e}${this.segmentSeparator}${t}`}buildTitle(e,t){let i=e;for(const e of t){i&&(i+=this.segmentSeparator);let t="";for(const i of e)t&&(t+=this.fragmentSeparator),t+=i;i+=t}return i}}class rx{onUnhandledNavigationMessage(e,t){}onNavigationBegin(e,t,i){}onPhaseBegin(e){}onPhaseEnd(e){}onNavigationEnd(e,t,i){}}class lx{constructor(){this.isConfigured=!1,this.routes=new FC(this),this.contributors=[],this.defaultLayout=GC.default,this.defaultTransition=jC.default,this.title="",this.parent=null}createNavigationQueue(){return this.construct(uC)}createLinkHandler(){return this.construct(ox)}createNavigationProcess(){return new nx}createEventSink(){return this.construct(rx)}createTitleBuilder(){return this.construct(ax)}createRouteRecognizer(){return this.construct(kC)}construct(e){return null!==this.parent?this.parent.construct(e):new e}recognizeRoute(e){return Au(this,void 0,void 0,function*(){return yield this.ensureConfigured(),this.routes.recognize(e)})}generateRouteFromName(e,t){return Au(this,void 0,void 0,function*(){return yield this.ensureConfigured(),this.routes.generateFromName(e,t)})}generateRouteFromPath(e,t){return Au(this,void 0,void 0,function*(){return yield this.ensureConfigured(),this.routes.generateFromPath(e,t)})}findContributors(e){return this.contributors.filter(t=>WC(t,e))}cached(e){let t=null;return()=>Au(this,void 0,void 0,function*(){return null===t&&(t=new e),t})}ensureConfigured(){return Au(this,void 0,void 0,function*(){this.isConfigured||(yield this.configure(),this.isConfigured=!0)})}}let dx=class extends(VC.from(be)){};dx=Eu([ye("fast-router")],dx);const hx=[];setTimeout(()=>{hx.length&&console.warn(`${hx.length} attribute deprecation notice(s):\n ${hx.join("\n")}`)},5e3);const ux="reauthActionLock";var fx;function px(){return Au(this,arguments,void 0,function*(e={}){const{reloadOnFailure:t=!0}=e;if(function(){const e=parseInt(localStorage.getItem(ux)||"0");Date.now()-e>3e4&&localStorage.removeItem(ux)}(),localStorage.getItem(ux)||(localStorage.setItem(ux,Date.now().toString()),0))return fx.HANDLED_BY_OTHER_TAB;try{if(yield function(){return Au(this,void 0,void 0,function*(){const e=yield fetch(Mg,{credentials:"include"});return"EVENT_LOGIN_DETAILS_ACK"===(yield e.json()).MESSAGE_TYPE})}())return fx.ALREADY_VALID;return(yield function(){return Au(this,void 0,void 0,function*(){const e=ft.getOrCreateDOMContainer().get(Kz);return"EVENT_LOGIN_AUTH_ACK"===(yield e.post(Lg,{body:JSON.stringify({DETAILS:{},MESSAGE_TYPE:"EVENT_LOGIN_AUTH"})})).MESSAGE_TYPE})}())?fx.SUCCESS:(t&&window.location.reload(),fx.FAILED)}finally{localStorage.removeItem(ux)}})}!function(e){e.SUCCESS="SUCCESS",e.FAILED="FAILED",e.HANDLED_BY_OTHER_TAB="HANDLED_BY_OTHER_TAB",e.ALREADY_VALID="ALREADY_VALID"}(fx||(fx={}));const mx=(e,t)=>((null==t?void 0:t.ROW)&&e&&e.length>0?t.ROW.forEach(t=>{const i=t;if(i&&i.DETAILS){const c=i.DETAILS.ROW_REF,o=i.DETAILS.OPERATION;"INSERT"===o&&(e.find(e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===c})||e.unshift(i)),"DELETE"===o&&(e=e.filter(e=>{var i,c;return(null===(i=t.DETAILS)||void 0===i?void 0:i.ROW_REF)!==(null===(c=e.DETAILS)||void 0===c?void 0:c.ROW_REF)})),"MODIFY"===o&&(e=e.map(e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===c?Object.assign(Object.assign({},e),i):e}))}}):!t||e&&0!==e.length||(e=[...new Set(t.ROW)]),e);var gx;let vx=gx=class{get isConnected(){return this._isConnected}set isConnected(e){this._isConnected=e,this.isConnectedSubject.next(this._isConnected)}constructor(e,t,i,c,o,s){var n;this.http=e,this.messageBuilder=t,this.session=i,this.metaCache=c,this.serializer=o,this.config=s,this.isWorking=!1,this._isConnected=!1,this.isConnectedSubject=new Sb(this._isConnected),this.isConnected$=null===(n=this.isConnectedSubject)||void 0===n?void 0:n.asObservable(),this.ongoingTurbo={},this.streams=new Map,this.ongoingRefresh=null}handleSessionRefresh(){return this.ongoingRefresh||(this.ongoingRefresh=(()=>Au(this,void 0,void 0,function*(){const e=this.host;this.disconnect();let t=yield px();return t===fx.HANDLED_BY_OTHER_TAB&&(yield new Promise(e=>{setTimeout(e,gx.REAUTH_WAIT_MS)}),t=yield px()),(t===fx.SUCCESS||t===fx.ALREADY_VALID)&&(this.connect(e),!0)}))().finally(()=>{this.ongoingRefresh=null})),this.ongoingRefresh}checkHost(){return Au(this,void 0,void 0,function*(){try{return this.getMessage({MESSAGE_TYPE:Jz.HEARTBEAT_PING,SOURCE_REF:"host check"}).then(e=>e.MESSAGE_TYPE===Jz.HEARTBEAT_PONG)}catch(e){return Dm.error(e),!1}})}send(e,t){return Au(this,void 0,void 0,function*(){if(this.ongoingRefresh){if(!(yield this.ongoingRefresh))throw new Error("Cannot send message: session refresh failed")}return this.http.post(gx.getUrl(this.host,e),{body:gx.getBody(e),headers:this.messageBuilder.createHTTPHeadersFromMessage(e)})})}httpMode(){return!0}setValidSession(e){Dm.deprecated("setValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}connect(e){return Au(this,void 0,void 0,function*(){return this.host=e,this.host.startsWith("ws")&&(this.host=this.host.replace("ws","http")),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 Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createDataLogonMessage(e,t);return Dm.debug(`HTTP MODE - ${i.MESSAGE_TYPE} (snapshot) message created -> `,i),this.send(i).then(e=>(this.dataLogoff(i.SOURCE_REF).catch(e=>Dm.error(e)),e))})}stream(e,t,i,c){var o,s;const n=this.messageBuilder.createDataLogonMessage(e,c);Dm.debug(`HTTP MODE - ${n.MESSAGE_TYPE} (stream) message created -> `,n);const a=n.SOURCE_REF,r=(null===(s=null===(o=this.config.polling)||void 0===o?void 0:o.POLLING_INTERVAL_MAP)||void 0===s?void 0:s[e])||this.config.polling.POLLING_FREQUENCY;this.streams.set(a,{SOURCE_REF:a,POLLING_FREQUENCY:new Sb(r),RESOURCE_NAME:e});const l=this.streams.get(a).POLLING_FREQUENCY,d=Oy(by(this.send(n)),l.pipe(Ry(()=>"visible"===document.visibilityState)).pipe(_y(e=>{return void 0===(t=e)&&(t=0),void 0===i&&(i=qb),t<0&&(t=0),Iy(t,t,i);var t,i})).pipe(_y(()=>by(this.getMessage(n))))).pipe(Hy(()=>this.streams.has(a)),function(e){var t;void 0===e&&(e=1/0);var i=(t=e&&"object"==typeof e?e:{count:e}).count,c=void 0===i?1/0:i,o=t.delay,s=t.resetOnSuccess,n=void 0!==s&&s;return c<=0?mb:yb(function(e,t){var i,s=0,a=function(){var r=!1;i=e.subscribe(zb(t,function(e){n&&(s=0),t.next(e)},void 0,function(e){if(s++<c){var n=function(){i?(i.unsubscribe(),i=null,a()):r=!0};if(null!=o){var l="number"==typeof o?Iy(o):hy(o(e,s)),d=zb(t,function(){d.unsubscribe(),n()},function(){t.complete()});l.subscribe(d)}else n()}else t.error(e)})),r&&(i.unsubscribe(),i=null,a())};a()})}({count:gx.MAX_RETRIES,delay:(e,t)=>{const i=e;Dm.error(`Retry ${t}/${gx.MAX_RETRIES}:`,i.status,i);if(!(0===i.status||i.status&&i.status>=Vz.BAD_REQUEST&&i.status<Vz.INTERNAL_SERVER_ERROR))throw e;return i.status===Vz.NOT_FOUND&&this.streams.delete(a),i.status===Vz.UNAUTHORIZED?by(this.handleSessionRefresh()):Iy(gx.RETRY_DELAY_MS)}}),(h=()=>{Dm.debug(`Terminating stream for ${e} - ${a}`),this.dataLogoff(a)},yb(function(e,t){try{e.subscribe(t)}finally{t.add(h)}})));var h;return this.streams.get(a).STREAM=d,d}streamState(e,t=()=>{},i=()=>{},c,o=[]){return this.stream(e,t,i,c).pipe(Dy(mx,o))}streamWithoutAutoTeardown(e,t,i,c){return Dm.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0"),this.stream(e,t,i,c)}getMessage(e){return Au(this,void 0,void 0,function*(){if(this.ongoingRefresh){if(!(yield this.ongoingRefresh))throw new Error("Cannot get message: session refresh failed")}return this.http.get(gx.getUrl(this.host,e),{headers:this.messageBuilder.createHTTPHeadersFromMessage(e)})})}getMoreRows(e,t){return Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createMoreRowsMessage(e,t);return Dm.debug(`HTTP MODE - ${i.MESSAGE_TYPE} message created -> `,i),this.send(i)})}getMoreColumns(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.send(t)})}dataLogoff(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return this.send(t).then(t=>(this.streams.has(e)&&(Dm.debug(`Removing stream ${e}`),this.streams.delete(e)),t))})}getMetadata(e){return Au(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasMetadataFor(e))return Dm.debug(`HTTP MODE - Cached metadata retrieved for ${e}`),this.metaCache.getMetadataFor(e);const i=this.messageBuilder.createMetaRequestMessage(e);Dm.debug(`HTTP MODE - ${i.MESSAGE_TYPE} (metadata) message created -> `,i);const c=yield this.send(i).then(e=>e.DETAILS);return Object.keys(c).length&&this.metaCache.setMetadataFor(e,c),c})}getJSONSchema(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createMetaRequestMessage(e,eC.JSON_SCHEMA_REQUEST);return Dm.debug(`HTTP MODE! - ${t.MESSAGE_TYPE} (json schema) message created -> `,t),this.send(t)})}request(e,t){const i=this.messageBuilder.createRequestMessage(e,t);Dm.debug(`HTTP MODE! - ${i.MESSAGE_TYPE} (request server) message created -> `,i);let c=gx.getUrl(this.host,i);const o=[];return i.REQUEST&&Object.keys(i.REQUEST).length>0&&Object.keys(i.REQUEST).forEach(e=>{const t=i.REQUEST[e];null==t||Number.isNaN(t)||o.push(`REQUEST.${e}=${encodeURIComponent(String(t))}`)}),i.DETAILS&&Object.keys(i.DETAILS).forEach(e=>{const t=i.DETAILS[e];null==t||Number.isNaN(t)||o.push(`${e}=${encodeURIComponent(String(t))}`)}),o.length>0&&(c=`${c}?${o.join("&")}`),Dm.debug(`HTTP MODE! - REQUEST_SERVER GET URL: ${c}`),this.http.get(c,{headers:this.messageBuilder.createHTTPHeadersFromMessage(i)})}getAvailableResources(e){return Au(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasResources())return Dm.debug("HTTP MODE - Cached resources retrieved"),this.metaCache.getResources();const i=this.messageBuilder.createResourcesMessage(e);Dm.debug(`HTTP MODE! - ${i.MESSAGE_TYPE} (getResources) message created -> `,i);const c=yield this.send(i);return this.metaCache.setResources(c),c})}commitEvent(e,t){return Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createCommitMessage(e,t);return Dm.debug(`HTTP MODE! - ${i.MESSAGE_TYPE} (commit) message created -> `,i),this.send(i).then(t=>(this.maybeTurbo(e,t),t))})}maybeTurbo(e,t){var i;if(!(null===(i=null==t?void 0:t.MESSAGE_TYPE)||void 0===i?void 0:i.endsWith("_ACK")))return;if(this.ongoingTurbo[e])return void Dm.debug(`${e} polling frequency is already accelerated.`);const c=this.config.polling.POLLING_MAP[e];if(!(null==c?void 0:c.TEMP_FREQUENCY)||!c.AMOUNT_OF_POLLS)return;const o=c.TEMP_FREQUENCY,s=o*c.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 c.QUERIES)a[e]=o,n[e]||(n[e]=this.config.polling.POLLING_FREQUENCY);Dm.debug(`${e} TRIGGERED -> ENFORCING TURBO | FREQUENCY=${o}ms DURATION=${s}`),this.ongoingTurbo[e]=!0,this.updateIntervals({polling:{POLLING_INTERVAL_MAP:a}}),setTimeout(()=>{Dm.debug(`RESTORED ORIGINAL POLLING INTERVALS FOR ${e}`),this.updateIntervals({polling:{POLLING_INTERVAL_MAP:n}}),this.ongoingTurbo[e]=!1},s)}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 i=e[t];this.config.polling.POLLING_INTERVAL_MAP[t]=i,Dm.debug(`Setting polling frequency for ${t} = ${i}`),[...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(i)})}}static getBody(e){return JSON.stringify(e)}static getUrl(e,t){const i=t.MESSAGE_TYPE;let c=t.MESSAGE_TYPE.replace(/_/g,"-").toLowerCase();return i===eC.DATA_LOGON&&(c=t.DETAILS.DATASOURCE_NAME.replace(/_/g,"-").toLowerCase()),`${e}${c}`}};vx.REAUTH_WAIT_MS=5e3,vx.RETRY_DELAY_MS=1e3,vx.MAX_RETRIES=3,Eu([g],vx.prototype,"host",void 0),Eu([g],vx.prototype,"isWorking",void 0),Eu([g],vx.prototype,"_isConnected",void 0),Eu([v],vx.prototype,"isConnected",null),vx=gx=Eu([Nu(0,Kz),Nu(1,sC),Nu(2,Gz),Nu(3,Sz),Nu(4,Kv),Nu(5,Qz)],vx);const bx=ft.createInterface(e=>e.singleton(vx));var yx={url:"",deserializer:function(e){return JSON.parse(e.data)},serializer:function(e){return JSON.stringify(e)}},zx=function(e){function t(t,i){var c=e.call(this)||this;if(c._socket=null,t instanceof gb)c.destination=i,c.source=t;else{var o=c._config=ku({},yx);if(c._output=new Mb,"string"==typeof t)o.url=t;else for(var s in t)t.hasOwnProperty(s)&&(o[s]=t[s]);if(!o.WebSocketCtor&&WebSocket)o.WebSocketCtor=WebSocket;else if(!o.WebSocketCtor)throw new Error("no WebSocket constructor can be found");c.destination=new $b}return c}return Su(t,e),t.prototype.lift=function(e){var i=new t(this._config,this.destination);return i.operator=e,i.source=this,i},t.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new $b),this._output=new Mb},t.prototype.multiplex=function(e,t,i){var c=this;return new gb(function(o){try{c.next(e())}catch(e){o.error(e)}var s=c.subscribe({next:function(e){try{i(e)&&o.next(e)}catch(e){o.error(e)}},error:function(e){return o.error(e)},complete:function(){return o.complete()}});return function(){try{c.next(t())}catch(e){o.error(e)}s.unsubscribe()}})},t.prototype._connectSocket=function(){var e=this,t=this._config,i=t.WebSocketCtor,c=t.protocol,o=t.url,s=t.binaryType,n=this._output,a=null;try{a=c?new i(o,c):new i(o),this._socket=a,s&&(this._socket.binaryType=s)}catch(e){return void n.error(e)}var r=new eb(function(){e._socket=null,a&&1===a.readyState&&a.close()});a.onopen=function(t){if(!e._socket)return a.close(),void e._resetState();var i=e._config.openObserver;i&&i.next(t);var c=e.destination;e.destination=lb.create(function(t){if(1===a.readyState)try{var i=e._config.serializer;a.send(i(t))}catch(t){e.destination.error(t)}},function(t){var i=e._config.closingObserver;i&&i.next(void 0),t&&t.code?a.close(t.code,t.reason):n.error(new TypeError("WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }")),e._resetState()},function(){var t=e._config.closingObserver;t&&t.next(void 0),a.close(),e._resetState()}),c&&c instanceof $b&&r.add(c.subscribe(e.destination))},a.onerror=function(t){e._resetState(),n.error(t)},a.onclose=function(t){a===e._socket&&e._resetState();var i=e._config.closeObserver;i&&i.next(t),t.wasClean?n.complete():n.error(t)},a.onmessage=function(t){try{var i=e._config.deserializer;n.next(i(t))}catch(e){n.error(e)}}},t.prototype._subscribe=function(e){var t=this,i=this.source;return i?i.subscribe(e):(this._socket||this._connectSocket(),this._output.subscribe(e),e.add(function(){var e=t._socket;0===t._output.observers.length&&(!e||1!==e.readyState&&0!==e.readyState||e.close(),t._resetState())}),e)},t.prototype.unsubscribe=function(){var t=this._socket;!t||1!==t.readyState&&0!==t.readyState||t.close(),this._resetState(),e.prototype.unsubscribe.call(this)},t}(wb);const Cx=1e4,xx=6e4;var Lx;!function(e){e.Linear="linear",e.Exponential="exponential"}(Lx||(Lx={}));const Mx=(e,t)=>{const{reconnectInterval:i=Cx}=e,c=i>xx?xx:i,o=Math.round(Math.log2(xx/c));return c*Math.pow(2,t%o)},wx=e=>{const{reconnectInterval:t=Cx}=e;return t>xx?xx:t};class Sx{constructor(){this.isConfigured=!1,this.isConnecting=!1,this.isConnected=!1,this.isReconnecting=!1,this.reconnectionLimitReached=!1,this.isConnectedSubject=new Sb(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}}Eu([g],Sx.prototype,"isConfigured",void 0),Eu([g],Sx.prototype,"isConnecting",void 0),Eu([g],Sx.prototype,"isConnected",void 0),Eu([g],Sx.prototype,"isReconnecting",void 0),Eu([g],Sx.prototype,"reconnectionLimitReached",void 0),Eu([g],Sx.prototype,"closedCode",void 0),Eu([g],Sx.prototype,"closedReason",void 0),Eu([g],Sx.prototype,"closedClean",void 0),Eu([Mz],Sx.prototype,"user",void 0);const kx=ft.createInterface(e=>e.singleton(Sx));class $x{constructor(e){this.interval=e}get workerScript(){return`\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 Ex extends Mb{constructor(){super()}}class Nx{constructor(e,t,i,c){this._message=e,this._onMessage=t,this._onError=i,this._isSubscription=c}get sentMessage(){return this._message}get onReceivedMessage(){return this._onMessage}get onReceivedError(){return this._onError}get isSubscription(){return this._isSubscription}}let Ax=class{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 Dm.deprecated("get hasValidSession","Use `User.isAuthenticated` from `@genesislcap/foundation-user` instead.","15.0.0"),this.user.isAuthenticated}set hasValidSession(e){Dm.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:vg}constructor(e,t,i,c,o,s,n){this.messageBuilder=e,this.session=t,this.serializer=i,this.uuid=c,this.status=o,this.user=s,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=vg,t,i){var c;return this.url=e,this.connectOptions=null!=t?t:this.config.connect,this.reconnectOptions=null!=i?i:this.config.reconnect,(null===(c=this.config.isWebSocketExpression)||void 0===c?void 0:c.test(this.host))?new Promise(e=>{var t,i,c,o;Dm.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===(i=this.socketSubscription)||void 0===i||i.unsubscribe(),this.websocket=new zx({url:this.url,openObserver:{next:()=>{this.session.setSessionStorageItem("hostUrl",this.url),this.status.isConnected=!0,this.prepareHeartbeat(),Dm.info("WebSocket connection is now open"),e(this.isConnected)}},closeObserver:{next:t=>{this.status.onClose(t),this.isDisconnectedByServer&&Dm.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===(c=this.connectOptions)||void 0===c?void 0:c.connectObserver)&&void 0!==o?o:{next:e=>Au(this,void 0,void 0,function*(){var t;const i=`Response Message received for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,Dm.info,i);const{SOURCE_REF:c,MESSAGE_TYPE:o}=e,s=this.getMessageHandler(c,o);if(!s)return void(e.MESSAGE_TYPE===Jz.MSG_NACK&&e.ERROR&&e.ERROR.forEach(t=>{Dm.error(`MessageType: ${e.MESSAGE_TYPE} | Error Details:`,t)}));let n=!1;switch(e.MESSAGE_TYPE){case eC.EVENT_LOGIN_AUTH_ACK:{const i=e.DETAILS;i.HEARTBEAT_INTERVAL_SECS&&void 0===(null===(t=this.connectOptions)||void 0===t?void 0:t.heartbeatInterval)&&(this.heartbeatInterval=i.HEARTBEAT_INTERVAL_SECS*this.secondsMultiplier,this.prepareHeartbeat());break}case Jz.LOGOUT_ACK:return s.onReceivedMessage.call(this,e),void this.cleanMessages();case Jz.LOGON_ACK:return;case Jz.LOGOFF_ACK:break;case Jz.QUERY_UPDATE:s.isSubscription||this.sendDataLogoff(c);break;case Jz.MSG_NACK:case Jz.LOGON_NACK:n=!0}n?s.onReceivedError.call(this,{receivedMessage:e,sentMessage:s.sentMessage}):s.onReceivedMessage.call(this,e),this.wsMessages.next(e),s.isSubscription||this.removeMessageHandler(c)}),error:e=>{Dm.debug("Error found: ",e),this.reconnect()},complete:()=>{var e;this.isDisconnectedByServer&&(null===(e=this.connectOptions)||void 0===e?void 0:e.alwaysOn)?this.reconnect():Dm.info("Connection is now closed")}}),this.status.isConfigured=!0}):(Dm.error(`Specified host (${this.host}) is not valid WebSocket url. Connection will not proceed.`),void Dm.warn("Make sure the host url starts with wss:// or ws://"))}handleExpiredSession(){return Au(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 Au(this,void 0,void 0,function*(){const e=yield px();e!==fx.HANDLED_BY_OTHER_TAB?e!==fx.FAILED&&(yield this.connect()):function(e){const t=i=>{i.key===ux&&null===i.newValue&&(e(),window.removeEventListener("storage",t))};window.addEventListener("storage",t)}(()=>this.connect())})}updateSessionAndSubscriptions(e){(null==e?void 0:e.MESSAGE_TYPE)===eC.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,i,c;this.heartbeatTicker&&this.heartbeatTicker.stop();const o=()=>Au(this,void 0,void 0,function*(){var e,t,i;if(!this.isConnected)return;const c=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(c);const o=yield this.send(c);this.user.isAuthenticated&&!o.IS_AUTHENTICATED&&this.handleExpiredSession(),(null===(i=this.connectOptions)||void 0===i?void 0:i.heartbeatPongCallback)&&this.connectOptions.heartbeatPongCallback(o),this.heartbeatIsEnabled=o.MESSAGE_TYPE===Jz.HEARTBEAT_PONG&&o.SOURCE_REF===c.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!==(c=null===(i=this.connectOptions)||void 0===i?void 0:i.heartbeatInterval)&&void 0!==c?c:this.heartbeatInterval;this.heartbeatTicker=new $x(e),this.heartbeatTicker.start(()=>{this.websocket&&this.isConnected&&(o(),this.heartbeatLoggingIsEnabled&&Dm.debug(`Sending a heartbeat ping every ${e} ms`))})}}reconnect(){var e,t,i,c,o;const s=!(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||s)return;this.status.isReconnecting=!0;const n=(null===(i=this.reconnectOptions)||void 0===i?void 0:i.reconnectStrategy)===Lx.Exponential?Mx:wx,a=this.isConnectedSubject.asObservable().pipe(_y(e=>e?yy(-1):((e,t)=>new gb(i=>{let c,o=0;return function s(){i.next(o),clearTimeout(c),c=setTimeout(s,t(e,o)),o+=1}(),()=>{clearTimeout(c)}}))(this.reconnectOptions,n).pipe(Ay(e=>{var t,i,c;let o;return o=(null===(t=this.connectOptions)||void 0===t?void 0:t.alwaysOn)?e+1:null!==(c=null===(i=this.reconnectOptions)||void 0===i?void 0:i.reconnectAttempts)&&void 0!==c?c:10,e<o?yy(e):(this.status.reconnectionLimitReached=!0,zy(()=>new Error(`Max reconnect attempts ${o} reached.`)))}))),Hy(()=>this.websocket&&!this.isConnected));a.subscribe(null!==(o=null===(c=this.reconnectOptions)||void 0===c?void 0:c.reconnectObserver)&&void 0!==o?o:{next:e=>{Dm.debug(`Attempt no. ${e+1} to reconnect`),this.websocket.complete(),this.connect(this.url,this.connectOptions,this.reconnectOptions)},error:e=>{var t;Dm.debug(e),null===(t=this.socketSubscription)||void 0===t||t.unsubscribe(),this.status.isReconnecting=!1},complete:()=>{Dm.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 Ex,this.wsMessageHandlers=new Map}send(e,t=!0){if(!this.isConnected)return Promise.reject(new Error("WebSocket connection is closed"));const i=`Sending Message for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,Dm.info,i),new Promise((i,c)=>{const o=e=>{i(e)},s=e=>{c(e)};t&&this.setMessageHandler(e,o,s),this.websocket.next(e)})}sendForStream(e,t,i,c){if(!this.isConnected)return zy(()=>new Error("WebSocket connection is closed"));const o=`Sending Message (stream) for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,Dm.info,o),this.setMessageHandler(e,t,i,!0),u.queueUpdate(()=>this.websocket.next(e)),new gb(t=>{const i=new Mb;var o;return this.wsMessages.pipe(Ry(t=>t.SOURCE_REF===e.SOURCE_REF),(o=i,yb(function(e,t){hy(o).subscribe(zb(t,function(){return t.complete()},ab)),!t.closed&&e.subscribe(t)}))).subscribe({next:e=>{t.next(e)},error:e=>{t.error(e)},complete:()=>{t.complete()}}),()=>{i.complete(),this.sendDataLogoff(e.SOURCE_REF),this.removeMessageHandler(e.SOURCE_REF),c&&c()}})}sendForStreamWithoutTeardown(e,t,i){if(!this.isConnected)return zy(()=>new Error("WebSocket connection is closed"));const c=`Sending Message (stream) for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,Dm.info,c),this.setMessageHandler(e,t,i,!0),this.websocket.next(e),this.wsMessages.pipe(Ry(t=>t.SOURCE_REF===e.SOURCE_REF))}setMessageHandler(e,t,i,c=!1){const o=`Setting Message Handler for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,Dm.debug,o),this.wsMessageHandlers.set(e.SOURCE_REF,new Nx(e,t,i,c))}sendDataLogoff(e){this.send(this.messageBuilder.createDataLogoffMessage(e),!1)}removeMessageHandler(e){this.wsMessageHandlers.delete(e)}getMessageHandler(e,t){const i=`Getting Message Handler for SourceRef: ${e} | MessageType: ${t}`;return this.logMessageTypeFlow(t,Dm.debug,i),this.wsMessageHandlers.get(e)}logMessageTypeFlow(e,t,i){switch(e){case eC.DATA_LOGOFF:t(i);break;case Jz.HEARTBEAT_PING:case Jz.HEARTBEAT_PONG:this.heartbeatLoggingIsEnabled&&t(i);break;default:this.messageLoggingIsEnabled&&t(i)}}};Eu([g],Ax.prototype,"websocket",void 0),Eu([g],Ax.prototype,"wsMessages",void 0),Eu([g],Ax.prototype,"wsMessageHandlers",void 0),Eu([Kz],Ax.prototype,"http",void 0),Eu([g],Ax.prototype,"heartbeatIsEnabled",void 0),Ax=Eu([Nu(0,sC),Nu(1,Gz),Nu(2,Kv),Nu(3,Cz),Nu(4,kx),Nu(5,Mz),Nu(6,Fz)],Ax);const Tx=ft.createInterface(e=>e.singleton(Ax));let Ox=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,i,c,o){this.socket=e,this.messageBuilder=t,this.metaCache=i,this.events=c,this.config=o,this.isWorking=!1}httpMode(){return!1}setValidSession(e){Dm.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(){return Au(this,arguments,void 0,function*(e=vg){return this.socket.reset(),this.socket.connect(e,this.config.connect,this.config.reconnect)})}disconnect(){this.socket.reset()}snapshot(e,t){return Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createDataLogonMessage(e,t);return Dm.debug(`${i.MESSAGE_TYPE} (snapshot) message created -> `,i),this.socket.send(i)})}stream(e,t,i,c){const o=this.messageBuilder.createDataLogonMessage(e,c);Dm.debug(`${o.MESSAGE_TYPE} (stream) message created -> `,o);const s=this.socket.sendForStream(o,t,t=>{i(t),this.events.onStreamErrorEvent(e,s,t)},()=>{this.events.onStreamCompleteEvent(e,s)});return this.events.onStreamEvent(e,o,s,{onMessage:t,onError:i}),s}streamState(e,t=()=>{},i=()=>{},c,o=[]){return this.stream(e,t,i,c).pipe(Dy(mx,o))}streamWithoutAutoTeardown(e,t,i,c){Dm.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0");const o=this.messageBuilder.createDataLogonMessage(e,c);Dm.debug(`${o.MESSAGE_TYPE} (stream without auto-teardown) message created -> `,o);const s=this.socket.sendForStreamWithoutTeardown(o,t,t=>{i(t),this.events.onStreamErrorEvent(e,s,t)});return this.events.onStreamEvent(e,o,s,{onMessage:t,onError:i}),s}getMoreRows(e,t){return Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createMoreRowsMessage(e,t);return Dm.debug(`${i.MESSAGE_TYPE} message created -> `,i),this.socket.send(i,!1)})}getMoreColumns(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.socket.send(t)})}dataLogoff(e){return Au(this,void 0,void 0,function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return Dm.debug(`${t.MESSAGE_TYPE} message created -> `,t),this.socket.send(t)})}getMetadata(e){return Au(this,arguments,void 0,function*(e,t=!0){var i;if(t&&this.metaCache.hasMetadataFor(e))return Dm.debug(`Cached metadata retrieved for ${e}`),this.metaCache.getMetadataFor(e);const c=this.messageBuilder.createMetaRequestMessage(e);let o,s;Dm.debug(`${c.MESSAGE_TYPE} (metadata) message created -> `,c);try{this.isWorking=!0;const t=yield this.socket.send(c);o=null!==(i=null==t?void 0:t.DETAILS)&&void 0!==i?i:{},Object.keys(o).length&&this.metaCache.setMetadataFor(e,o)}catch(e){throw s=e,Dm.error(e),s}finally{this.events.onMetadataEvent(e,c,s),this.isWorking=!1}return o})}getJSONSchema(e){return Au(this,arguments,void 0,function*(e,t=!0){var i;if(t&&this.metaCache.hasJsonSchemaFor(e))return Dm.debug(`Cached JsonSchema retrieved for ${e}`),this.metaCache.getJsonSchemaFor(e);const c=this.messageBuilder.createMetaRequestMessage(e,eC.JSON_SCHEMA_REQUEST);let o;Dm.debug(`${c.MESSAGE_TYPE} (json schema) message created -> `,c);try{this.isWorking=!0,o=null!==(i=yield this.socket.send(c))&&void 0!==i?i:{},Object.keys(o).length&&this.metaCache.setJsonSchemaFor(e,o)}catch(e){Dm.error(e)}finally{this.isWorking=!1}return o})}request(e,t){const i=this.messageBuilder.createRequestMessage(e,t);return Dm.debug(`${i.MESSAGE_TYPE} (request server) message created -> `,i),this.socket.send(i)}getAvailableResources(e){return Au(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasResources())return Dm.debug("Cached resources retrieved"),this.metaCache.getResources();const i=this.messageBuilder.createResourcesMessage(e);Dm.debug(`${i.MESSAGE_TYPE} (resources) message created -> `,i);const c=yield this.socket.send(i);return this.metaCache.setResources(c),c})}commitEvent(e,t){return Au(this,void 0,void 0,function*(){const i=this.messageBuilder.createCommitMessage(e,t);Dm.debug(`${i.MESSAGE_TYPE} (commit) message created -> `,i);const c=this.socket.send(i);return this.events.onCommitEvent(e,i),c.then(t=>(this.events.onCommitResponseEvent(e,t),t))})}};Eu([g],Ox.prototype,"isWorking",void 0),Ox=Eu([Nu(0,Tx),Nu(1,sC),Nu(2,Sz),Nu(3,Rz),Nu(4,Fz)],Ox);const Ix="true"===mg||ug("forceHttp"),Rx=ft.createInterface(e=>e.singleton(Ox)),Dx=ft.createInterface(e=>Ix?e.aliasTo(bx):e.aliasTo(Rx));class Fx{serialize(e){return Dm.deprecated("serialize","Use `serialize` from `JSONSerializer` from `@genesislcap/foundation-utils` instead."),JSON.stringify(e)}deserialize(e){return Dm.deprecated("deserialize","Use `deserialize` from `JSONSerializer` from `@genesislcap/foundation-utils` instead."),e?"string"==typeof e?JSON.parse(e):e.data?JSON.parse(e.data):e.text().then(e=>JSON.parse(e)):Promise.resolve({})}}
|
|
56
56
|
/*! js-cookie v3.0.5 | MIT */
|
|
57
57
|
function _x(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var c in i)e[c]=i[c]}return e}ft.createInterface(e=>e.singleton(Fx));var Hx={read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};var Px=function e(t,i){function c(e,c,o){if("undefined"!=typeof document){"number"==typeof(o=_x({},i,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var n in o)o[n]&&(s+="; "+n,!0!==o[n]&&(s+="="+o[n].split(";")[0]));return document.cookie=e+"="+t.write(c,e)+s}}return Object.create({set:c,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],c={},o=0;o<i.length;o++){var s=i[o].split("="),n=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);if(c[a]=t.read(n,a),e===a)break}catch(e){}}return e?c[e]:c}},remove:function(e,t){c(e,"",_x({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,_x({},this.attributes,t))},withConverter:function(t){return e(_x({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(i)},converter:{value:Object.freeze(t)}})}(Hx,{path:"/"});const Vx=ft.createInterface();function Bx(){return(null===navigator||void 0===navigator?void 0:navigator.credentials)?"PasswordCredential"in window||(Dm.warn("PasswordCredential not available in this browser."),!1):(Dm.warn("CredentialsContainer not available in this browser."),!1)}const Ux=":";function jx(e="",t=Ux,i){return e.split(t,i).map(e=>e.trim()).filter(e=>""!==e)}function qx(e,t=Ux){const i="string"==typeof e&&e.trim();return!!i&&i.includes(t)}function Gx(e,t=Ux){return"string"==typeof e&&e.trim()?(e.match(new RegExp(t,"g"))||[]).length:0}function Wx(e,t=Ux){for(const i of e)if(qx(i,t))return i;return e.find(e=>"string"==typeof e&&!!e.trim())}function Yx(e,t,i){const c="string"==typeof e&&e.trim();return!c||i&&!c.includes(i)||Gx(c)>1?i&&t&&i!==t?`${t}:${i}`:t||i:c}function Kx(e="credential"){Dm.warn(`Unable to migrate legacy ${e} to latest format. Please remove from your browser.`)}const Zx={password:!0,mediation:"optional"},Qx={cookie:{path:"/",name:"credentials",expires:7300,storePasswords:!1}};let Xx=class{constructor(e,t=Qx){this.session=e,this.config=t}createBasicCredentials(e){return{type:Xz.BASIC,username:e.username,password:e.password,mfaToken:this.getMFAToken()}}createRefreshCredentials(e){var t,i,c;return{type:Xz.REFRESH,username:null!==(t=null==e?void 0:e.username)&&void 0!==t?t:this.getUsername(),refreshToken:null!==(i=null==e?void 0:e.refreshToken)&&void 0!==i?i:this.getRefreshToken(),mfaToken:null!==(c=null==e?void 0:e.mfaToken)&&void 0!==c?c:this.getMFAToken()}}createSSOCredentials(e){var t;return{type:Xz.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 i=e&&!!e.id&&!!e.name&&!e.name.includes(Ux)&&Gx(e.id)<=1;return t?i&&!!e.password:i}normaliseLegacyCredentialData(e,t){if(this.validateUserCredentialData(e,!0))return[e,!0];if(this.validateUserCredentialData(t))return[t,!1];if(e)try{const t=e,[i]=jx(t.name||t.id),[c,o]=jx(Wx([t.id,t.name]));return[{id:Yx(t.id||t.name,i,o),name:i,password:t.password||""},!0]}catch(e){Kx("PasswordCredential")}if(t)try{const e=t,[i]=jx(e.name||e.username||e.organisation),[c,o]=jx(Wx([e.organisation||e.username||e.name]));return[{id:Yx(e.id||e.username||e.name,i,o),name:i,password:e.password||""},!1]}catch(e){Kx("cookie")}return[void 0,!1]}storeCredentialsInContainer(e){return Au(this,void 0,void 0,function*(){if(!Bx())return;const t=new PasswordCredential(e);return Dm.debug("Storing credentials in CredentialsContainer"),navigator.credentials.store(t)})}getCredentialsFromContainer(){return Au(this,arguments,void 0,function*(e=Zx){if(Bx())return Dm.debug("Getting credentials from CredentialsContainer"),yield navigator.credentials.get(e)})}storeCredentialsInCookie(e){const{password:t}=e,i=$u(e,["password"]),c=this.config.cookie.storePasswords?e:i;return Dm.debug("Storing credentials in cookie"),!!Px.set(this.config.cookie.name,JSON.stringify(c),{expires:this.config.cookie.expires,domain:location.hostname,path:this.config.cookie.path,secure:!0})}getCredentialsFromCookie(){Dm.debug("Getting credentials from cookie");const e=Px.get(this.config.cookie.name);return e?JSON.parse(e):void 0}storeCredentials(e){return Au(this,void 0,void 0,function*(){if(Bx()){const t=yield this.storeCredentialsInContainer(e);return Promise.resolve(!!t)}return Promise.resolve(this.storeCredentialsInCookie(e))})}getCredentials(e){return Au(this,void 0,void 0,function*(){return Bx()?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(){Px.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 Bx()&&navigator.credentials.preventSilentAccess()}};Xx=Eu([Nu(0,Gz),Nu(1,vt(Vx))],Xx);const Jx=ft.createInterface(e=>e.singleton(Xx)),eL=e=>Array.isArray(e)?e.map(e=>null!=e?e:""):[],tL=e=>{try{if("EVENT_LOGIN_AUTH_ACK"===(null==e?void 0:e.MESSAGE_TYPE)){const{DETAILS:c}=e,o={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:c?{system:(i=c.SYSTEM,i?{date:i.DATE}:null),heartbeatIntervalSecs:c.HEARTBEAT_INTERVAL_SECS,failedLoginAttempts:c.FAILED_LOGIN_ATTEMPTS,rejectedLoginAttempts:c.REJECTED_LOGIN_ATTEMPTS,lastLoginDatetime:c.LAST_LOGIN_DATETIME,daysToPasswordExpiry:c.DAYS_TO_PASSWORD_EXPIRY,product:(t=c.PRODUCT,t?t.map(e=>({name:e.NAME,version:e.VERSION})):[])}:null,permission:eL(e.PERMISSION),profile:eL(e.PROFILE)};return o}throw new Error("No Entity mapping implementation for provided DTO")}catch(e){throw Dm.error(e),e}var t,i};let iL=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,i,c,o){this.session=e,this.connect=t,this.messageBuilder=i,this.credentialManager=c,this.currentUser=o,this.isWorking=!1,this.isLoggedInSubject=new Sb(this.isLoggedIn),this.currentUser.addAuthenticationChangeListener(e=>{var t;null===(t=this.isLoggedInSubject)||void 0===t||t.next(e.detail)})}login(e){return Au(this,void 0,void 0,function*(){var t;this.isWorking=!0;try{const i=this.messageBuilder.createLoginMessage(e),c=yield this.connect.send(i);if(!c||c.ERROR||(null===(t=c.DETAILS)||void 0===t?void 0:t.ERROR))throw new iC(i,c);this.applyAuthResults({authToken:c.SESSION_AUTH_TOKEN,refreshToken:c.REFRESH_AUTH_TOKEN,profiles:c.PROFILE,username:c.USER_NAME,permissions:c.PERMISSION,sessionId:c.SESSION_ID}),this.currentUser.set(tL(c)),this.session.setAuthResult(c),Dm.debug("Login Authentication Result:",c)}catch(e){if(Dm.error("Login Authentication Error:",e),!(e instanceof iC&&e.isIgnorableError()))throw this.removeAuthResults(),this.currentUser.unset(),e;Dm.warn("Ignoring authentication error as it is a known edge case.")}finally{this.isWorking=!1}return this.loggedUserResult})}logout(){return Au(this,void 0,void 0,function*(){var e;this.isWorking=!0;let t={success:!1};try{const i=this.messageBuilder.createLogoutMessage(this.loggedUserResult);this.session.deleteUserFromSessionStorage();const{CODE:c,DETAILS:o,ERROR:s,MESSAGE_TYPE:n,OIDC_LOGOUT_URL:a}=yield this.connect.send(i),r=null!==(e=null==o?void 0:o.ERROR)&&void 0!==e?e:s,l=n===Jz.LOGOUT_NACK;l&&Dm.warn("Unexpected Logout NACK received during logout.",r),t={success:n===Jz.LOGOUT_ACK||c===tC.SESSION_NOT_FOUND||!l,error:r},a&&window.open(a,"_self")}catch(e){const i=new iC(e.sentMessage,e.receivedMessage);if(Dm.error("Logout Authentication Error:",i),!i.isIgnorableError())throw e;Dm.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 Au(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)===eC.EVENT_LOGIN_AUTH_ACK)return this.session.setAuthResult(t),this.currentUser.set(tL(t)),this.applyAuthResults(this.getLoggedUserFromMessage(t)),!0}return this.session.deleteUserFromSessionStorage(),this.currentUser.unset(),!1})}ensureConnection(){return Au(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,i=e.SESSION_AUTH_TOKEN,c=e.REFRESH_AUTH_TOKEN;return t&&i&&c?{username:t,authToken:i,refreshToken:c,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}};Eu([g],iL.prototype,"isWorking",void 0),Eu([g],iL.prototype,"loggedUserResult",void 0),iL=Eu([Nu(0,Gz),Nu(1,Dx),Nu(2,sC),Nu(3,Jx),Nu(4,Mz)],iL);const cL=ft.createInterface(e=>e.singleton(iL));function oL(e,t){const i=new Date(e),c=i.getUTCFullYear(),o=String(i.getUTCMonth()+1).padStart(2,"0"),s=String(i.getUTCDate()).padStart(2,"0");if(t)return`${c}${o}${s}`;return`${c}${o}${s}-${String(i.getUTCHours()).padStart(2,"0")}:${String(i.getUTCMinutes()).padStart(2,"0")}`}function sL(e,t="ROW_REF"){const i=e=>{const i=Object.assign(Object.assign({},e),{[t]:e.DETAILS[t]});return delete i.DETAILS,i},c=[],o=[],s=[];for(const t of e.ROW)if(t.DETAILS)switch(t.DETAILS.OPERATION){case"INSERT":c.push(i(t));break;case"MODIFY":s.push(i(t));break;case"DELETE":o.push(i(t));break;default:Dm.error(`Unsupported operation type: '${t.DETAILS.OPERATION}'`)}return{inserts:c,deletes:o,updates:s,SOURCE_REF:e.SOURCE_REF}}class nL{}nL.MAX_ROWS_250=250,nL.MAX_VIEW_1000=1e3,nL.REQ_REP_POLLING_INTERVAL_MS=1e4,nL.DATASERVER_ROW_ID="ROW_REF",nL.REQUEST_SERVER_ROW_ID="RECORD_ID",nL.DEFAULT_PAGINATION_PAGE_SIZE=25,nL.DEFAULT_REQ_REP_OFFSET=0;const aL={options:{criteria:"",isSnapshot:!1,maxRows:nL.MAX_ROWS_250,maxView:nL.MAX_VIEW_1000,pollingInterval:nL.REQ_REP_POLLING_INTERVAL_MS,movingView:!1,orderBy:"",resourceName:"",reverse:!1,pollTriggerEvents:[]},criteriaToFields:function(e){if(!e)return{};const t=e.split("&&").map(e=>e.trim()),i={};return t.forEach(e=>{if(e)if(e.startsWith("Expr"))!function(e,t){const i=e.match(/Expr\.(\w+)\(/);if(i)switch(i[1]){case"dateIsToday":{const i=/Expr\.dateIsToday\((\w+)\)/,c=e.match(i);if(c){const[,e]=c,i=new Date;t[`${e}_FROM`]=`${i.toISOString().replace(/-/g,"").split("T")[0]}-00:00`,i.setDate(i.getDate()+1),t[`${e}_TO`]=`${i.toISOString().replace(/-/g,"").split("T")[0]}-00:00`}break}case"dateTimeIsGreaterEqual":{const i=/Expr\.dateTimeIsGreaterEqual\((\w+), ?['"](.+)['"]\)/,c=e.match(i);if(c){const[,e,i]=c;t[`${e}_FROM`]=i}break}case"dateTimeIsLessEqual":{const i=/Expr\.dateTimeIsLessEqual\((\w+), ?['"](.+)['"]\)/,c=e.match(i);if(c){const[,e,i]=c;t[`${e}_TO`]=i}break}case"dateIsGreaterEqual":{const i=/Expr\.dateIsGreaterEqual\((\w+), ?['"](.+)['"]\)/,c=e.match(i);if(c){const[,e,i]=c;t[`${e}_FROM`]=i}break}case"dateIsLessEqual":{const i=/Expr\.dateIsLessEqual\((\w+), ?['"](.+)['"]\)/,c=e.match(i);if(c){const[,e,i]=c;t[`${e}_TO`]=i}break}case"containsIgnoreCase":{const i=/Expr\.containsIgnoreCase\((\w+), ?['"](.+)['"]\)/,c=e.match(i);if(c){const[,e,i]=c;t[e]=`*${i}*`}break}}}(e,i);else if(/[A-Z_]+\s*(>=|<=)\s*\d+/.test(e)){const t=e.match(/([A-Z_]+)\s*>=\s*(\d+)/);if(t){const[,e,c]=t,o=parseInt(c,10),s=e.toUpperCase(),n=s.includes("DATE")&&!s.includes("DATETIME");i[`${e}_FROM`]=oL(o,n)}const c=e.match(/([A-Z_]+)\s*<=\s*(\d+)/);if(c){const[,e,t]=c,o=parseInt(t,10),s=e.toUpperCase(),n=s.includes("DATE")&&!s.includes("DATETIME");i[`${e}_TO`]=oL(o,n)}}else!function(e,t){const i=e.substr(0,e.indexOf("=")).trim().replace(/["']/g,""),c=e.substr(e.lastIndexOf("=")+1,e.length).trim().replace(/["']/g,"");t[i]=c}(e,i)}),i},dataServerResultFilter:sL},rL=ft.createInterface(e=>e.instance(aL)),lL=e=>{class t extends e{constructor(){super(),this.hasOwnProperty("onDatasourceStatusChanged")||(this.onDatasourceStatusChanged=e=>{var t;const i=void 0!==this.data;this.resourceName||i||Dm.warn("Target classes must have a resourceName or data property to use the DatasourceEventHandler mixin.");const c=e.detail;if(c.name===this.resourceName){const e=null!==(t=this.datasourceStatus)&&void 0!==t?t:{isInitialized:!1,hasMetadata:!1};(e.isInitialized!==c.isInitialized||c.metadataRequired&&e.hasMetadata!==c.hasMetadata)&&(this.datasourceStatus=c)}})}datasourceStatusChanged(e,t){Dm.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(Nz,this.onDatasourceStatusChanged,{passive:!0,capture:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(Nz,this.onDatasourceStatusChanged,{capture:!0})}}return Eu([g],t.prototype,"datasourceStatus",void 0),t},dL={throwWhenUnavailable:!0,throwWhenUnknown:!1},hL=ft.createInterface(e=>e.instance(dL)),uL=Bm("genesis-resources");let fL=class{constructor(e,t){this.connect=e,this.config=t}isValidResource(e){return Au(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 Au(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 i=`${e} resource does not exist.`;if(Dm.error(i),this.config.throwWhenUnknown)throw new Error(i)})}getAllResources(){return Au(this,void 0,void 0,function*(){return this.resources||(yield this.fetchResources()),this.resources})}destroy(){this.resources=void 0,this.resourcesPromise=void 0}fetchResources(){return Au(this,void 0,void 0,function*(){var e;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(Dm.error(e),this.config.throwWhenUnavailable)throw new Error(e)}this.postLoadedMessage(),this.resourcesPromise=void 0}})}postLoadedMessage(){const e=ft.getOrCreateDOMContainer().get(uL);e.postMessage("resources-loaded",this.resources),e.close()}};fL=Eu([Nu(0,Dx),Nu(1,hL)],fL);const pL=ft.createInterface(e=>e.singleton(fL));let mL=class{get initialized(){var e;return!!(null===(e=this.status)||void 0===e?void 0:e.isInitialized)}constructor(e,t,i,c,o){this.connect=e,this.auth=t,this.resources=i,this.config=c,this.connectEvents=o,this.fetchMetadataRequired=!0,this.startStreamRequired=!0,this.originalFieldDef=[],this.fieldMetadata=[],this.requestFields=[],this.customRequestFields=[],this.availableIndexes=[],this.availableSortableFields=[],this.availableCriteriaFields=[],this.criteriaOnlyRequest=!1,this.loadMoreCount=0,this.readOnly=!0,this._allParams=null,this.pollTrigger$=new Mb}triggerPoll(){this.pollTrigger$.next()}validResourceName(e){return Dm.deprecated("Datasource.validResourceName","Use `GenesisResources.isValidResource` instead."),!!e&&!!e.trim().length}init(e){return Au(this,arguments,void 0,function*(e,t=this.fetchMetadataRequired,i=this.startStreamRequired){this.fetchMetadataRequired=t,this.options=Object.assign(Object.assign({},this.config.options),e),this.invalidateCache();const c=this.options.resourceName;if(!(this.connect.isConnected||(yield this.connect.connect())))return Dm.error(`Unable to connect to ${this.connect.host} to get ${c} datasource`),this.reportStatus(),!1;return(yield this.resources.isValidResource(c))?(this.resourceType=yield this.resources.getResourceTypeFor(c),this.resourceType?(this.fetchMetadataRequired&&(yield this.fetchAndApplyMetadata(this.options.resourceName),this._allParams=null),Dm.debug(`Initializing ${c} datasource from ${this.connect.host}`),!this.options.isSnapshot&&i&&(this.pollTrigger$=new Mb,this.stream=yield this.createStream()),Dm.debug(`${c} datasource initialization ${this.initialized?"was successful.":"has failed."}`),this.reportStatus(),this.initialized):(Dm.error(`Unable to get the resource type for ${c} datasource from ${this.connect.host}`),this.reportStatus(),!1)):(Dm.error(`${c} datasource does not exist on ${this.connect.host}`),this.reportStatus(),!1)})}startStream(){return Au(this,void 0,void 0,function*(){this.options.isSnapshot||void 0!==this.stream||(this.stream=yield this.createStream())})}destroy(){var e,t;Dm.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=!0,this.options={},this.resourceType=void 0,this.availableIndexes=[],this.availableSortableFields=[],this.availableCriteriaFields=[],this.originalFieldDef=[],this.fieldMetadata=[],this.requestFields=[],this.criteriaOnlyRequest=!1,this.loadMoreCount=0,this.stream=void 0}get allResourceParams(){var e;if(this._allParams)return this._allParams;let t;if(this.options.orderBy)if(this.criteriaOnlyRequest||(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);Dm.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,ORDER_BY:t,VIEW_NUMBER:this.options.viewNumber,FIELDS:this.options.fields,MAX_VIEW:this.options.maxView,MOVING_VIEW:this.options.movingView,REVERSE:this.options.reverse,DISABLE_POLLING:this.options.disablePolling,OFFSET:this.options.offset,POLLING_INTERVAL:this.options.pollingInterval,REQUEST:this.options.request},Dm.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(){const e=this.allResourceParams,{REQUEST:t}=e,i=$u(e,["REQUEST"]);return{DETAILS:{CRITERIA_MATCH:this.options.requestAutoSetup?void 0:i.CRITERIA_MATCH,MAX_ROWS:i.MAX_ROWS,OFFSET:i.OFFSET,ORDER_BY:i.ORDER_BY,VIEW_NUMBER:i.VIEW_NUMBER},REQUEST:this.criteriaOnlyRequest?{}:null!=t?t:this.buildRequestFields()}}buildRequestFields(){if(!this.options.requestAutoSetup)return{};const e=Object.assign({},Object.fromEntries(this.requestFields.map(e=>[e.NAME,"*"]))),t=this.options.criteria?this.config.criteriaToFields(this.options.criteria):{};return Object.assign(Object.assign({},e),t)}updateLoadMoreCount(e){this.loadMoreCount=e}snapshot(e){return Au(this,void 0,void 0,function*(){switch(Dm.debug(`Requesting snapshot for ${this.options.resourceName} (${this.resourceType}).`),this.resourceType){case Ez.DATASERVER:return this.connect.snapshot(this.options.resourceName,Object.assign(Object.assign({},this.dataserverOnlyParams),e));case Ez.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(){return Au(this,arguments,void 0,function*(e="ROW_REF"){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 Au(this,void 0,void 0,function*(){if(![Ez.DATASERVER,Ez.REQUEST_SERVER].includes(this.resourceType))throw new Error(`Streaming not supported for selected resource type: ${this.resourceType}`);return this.resourceType===Ez.DATASERVER?this.createDataserverStream():(Dm.debug(`Creating fake stream by polling ${this.options.resourceName} REQUEST_SERVER`),this.createReqRepStream())})}createDataserverStream(){return Au(this,void 0,void 0,function*(){return this.connect.stream(this.options.resourceName,e=>{},e=>Dm.error(e),this.dataserverOnlyParams)})}createReqRepStream(){this.commitResponseUnsubscribe=this.connectEvents.addCommitResponseListener(e=>{var t;const{eventName:i,response:c}=e.detail;this.options.pollTriggerEvents&&this.options.pollTriggerEvents.includes(i)&&(null===(t=c.MESSAGE_TYPE)||void 0===t?void 0:t.endsWith("_ACK"))&&(Dm.debug(`Received commit response for ${i}, triggering poll.`),this.triggerPoll())});const e=this.allResourceParams.DISABLE_POLLING?void 0:this.allResourceParams.POLLING_INTERVAL,t=()=>{const e=this.requestOnlyParams;if(this.resourceType===Ez.REQUEST_SERVER&&this.loadMoreCount>0){const t=25,i=(this.options.maxRows||t)*(this.loadMoreCount+1);e.DETAILS.MAX_ROWS=i}return Ey([this.connect.isConnected$,this.auth.isLoggedIn$]).pipe(Hy(()=>this.connect.isConnected&&this.auth.isLoggedIn),_y(()=>by(this.snapshot(e))))};return e?this.pollTrigger$.pipe(Fy(0),_y(()=>Iy(0,e).pipe(_y(t)))):this.pollTrigger$.pipe(Fy(0),_y(t))}fetchAndApplyMetadata(e){return Au(this,void 0,void 0,function*(){var t,i,c,o;try{Dm.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.availableSortableFields=null!==(i=e.SORTABLE_FIELDS)&&void 0!==i?i:[],this.availableCriteriaFields=null!==(c=e.CRITERIA_FIELDS)&&void 0!==c?c:[],this.originalFieldDef=Tz(e),this.fieldMetadata=Az(this.originalFieldDef),this.requestFields=e.REQUEST_FIELD||[],this.customRequestFields=e.FIELD||[],this.criteriaOnlyRequest=e.CRITERIA_ONLY_REQUEST||!1,this.fetchMetadataRequired=!1),this.status=this.normaliseStatus({isInitialized:!0,metadataRequired:!0,hasMetadata:(null===(o=this.fieldMetadata)||void 0===o?void 0:o.length)>0})}catch(t){Dm.error(`Metadata Fetch failed for ${e}:`,t),this.status=this.normaliseStatus({isInitialized:!1,metadataRequired:!0,hasMetadata:!1})}})}reportStatus(e={}){var t;const i=null!==(t=this.config.eventEmitter)&&void 0!==t?t:document;this.status=this.normaliseStatus(e),Dm.debug(`Dispatching '${Nz}'`,this.status),null==i||i.dispatchEvent(new CustomEvent(Nz,{detail:this.status,bubbles:i!==document,composed:!0}))}normaliseStatus(e){var t,i,c,o,s;const n=null!==(t=e.isInitialized)&&void 0!==t?t:this.initialized,a=null!==(i=e.metadataRequired)&&void 0!==i?i:this.fetchMetadataRequired,r=null!==(c=e.hasMetadata)&&void 0!==c?c:(null===(o=this.fieldMetadata)||void 0===o?void 0:o.length)>0;return{name:null===(s=this.options)||void 0===s?void 0:s.resourceName,type:this.resourceType,isInitialized:n,metadataRequired:a,hasMetadata:r}}invalidateCache(){this._allParams=null}};Eu([g],mL.prototype,"status",void 0),Eu([g],mL.prototype,"fetchMetadataRequired",void 0),Eu([g],mL.prototype,"startStreamRequired",void 0),Eu([g],mL.prototype,"originalFieldDef",void 0),Eu([g],mL.prototype,"fieldMetadata",void 0),Eu([g],mL.prototype,"requestFields",void 0),Eu([g],mL.prototype,"customRequestFields",void 0),Eu([g],mL.prototype,"availableIndexes",void 0),Eu([g],mL.prototype,"availableSortableFields",void 0),Eu([g],mL.prototype,"availableCriteriaFields",void 0),Eu([g],mL.prototype,"criteriaOnlyRequest",void 0),Eu([g],mL.prototype,"loadMoreCount",void 0),Eu([g],mL.prototype,"readOnly",void 0),Eu([g],mL.prototype,"stream",void 0),mL=Eu([Nu(0,Dx),Nu(1,cL),Nu(2,pL),Nu(3,rL),Nu(4,Iz)],mL);const gL=ft.createInterface(e=>e.transient(mL));class vL extends mL{constructor(){super(...arguments),this.entityCache=[],this.entityMap=new Map,this.rowId="ROW_REF",this.initialize=e=>Au(this,void 0,void 0,function*(){return this.disconnect(),this.options=Object.assign({},e.options),this.mapper=e.mapper,this.initialized=yield this.init(this.options,e.fetchMeta),this.initialized?(this.subscription=this.stream.subscribe(e=>{this.sourceRef=e.SOURCE_REF,this.subscriptionLoggedOff=e.MESSAGE_TYPE===Jz.LOGOFF_ACK;const t=e.ROW;!this.subscriptionLoggedOff&&t&&this.updateCache(this.config.dataServerResultFilter(e,this.rowId))}),!0):(Dm.debug(`EntityDatasource init failed for ${this.options.resourceName}`),!1)}),this.disconnect=()=>{var e;null===(e=this.subscription)||void 0===e||e.unsubscribe(),this.entityCache=[]}}get initialized(){return this._initialized}set initialized(e){this._initialized=e}get cache(){if(!this.initialized)throw new Error("Please initialize EntityDatasource before querying.");return this.entityCache}get isEmpty(){return 0===this.entityCache.length}updateCache(e){var t;this.isEmpty,null===(t=e.deletes)||void 0===t||t.forEach(e=>{const t=e[this.rowId];this.entityMap.delete(t)}),this.processRowDataUpdate(e.inserts,!0),this.processRowDataUpdate(e.updates);this.entityCache=[{}].map(e=>this.mapper.fromDTO(e))}processRowDataUpdate(e,t=!1){e.forEach(e=>{const i=e[this.rowId],c=this.entityMap.get(i);if(c&&t)throw new Error("Existing entity found in map while inserting.");const o=this.mapper.fromDTO(e),s=c?Object.assign(Object.assign({},c),o):o;this.entityMap.set(i,s)})}}function bL(e,t=";"){return e?e.split(t).map(e=>e.trim()).sort((e,t)=>e.localeCompare(t)).join(t):e}ft.createInterface(e=>e.transient(vL));const yL="system-health-changed",zL={windowEvents:["online","offline","pageshow"],documentEvents:["visibilitychange"],genesisConnectEvents:["stream","commit"],ignoredGenesisResources:[],startDelay:5e3,checkInterval:1e4,checkTimeout:3e3,resourceChecks:e=>Au(void 0,void 0,void 0,function*(){const t=ft.getOrCreateDOMContainer().get(Dx),i=yield t.getMoreColumns(e),c=Date.now(),o=i;return{isConnected:i.MESSAGE_TYPE===Jz.MORE_COLUMNS_ACK,lastUpdated:c,lastMessage:o}}),resourceDataLogon:({message:e,functions:t})=>{const{onMessage:i,onError:c}=t;ft.getOrCreateDOMContainer().get(Tx).sendForStream(e,i,c)}},CL=ft.createInterface(e=>e.instance(zL));var xL,LL={exports:{}};var ML,wL,SL=(xL||(xL=1,function(e){e.exports=function(e){var t={};function i(c){if(t[c])return t[c].exports;var o=t[c]={i:c,l:!1,exports:{}};return e[c].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=t,i.d=function(e,t,c){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(i.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(c,o,function(t){return e[t]}.bind(null,o));return c},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=90)}({17:function(e,t,i){t.__esModule=!0,t.default=void 0;var c=i(18),o=function(){function e(){}return e.getFirstMatch=function(e,t){var i=t.match(e);return i&&i.length>0&&i[1]||""},e.getSecondMatch=function(e,t){var i=t.match(e);return i&&i.length>1&&i[2]||""},e.matchAndReturnConst=function(e,t,i){if(e.test(t))return i},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,i,c){void 0===c&&(c=!1);var o=e.getVersionPrecision(t),s=e.getVersionPrecision(i),n=Math.max(o,s),a=0,r=e.map([t,i],function(t){var i=n-e.getVersionPrecision(t),c=t+new Array(i+1).join(".0");return e.map(c.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});for(c&&(a=n-Math.min(o,s)),n-=1;n>=a;){if(r[0][n]>r[1][n])return 1;if(r[0][n]===r[1][n]){if(n===a)return 0;n-=1}else if(r[0][n]<r[1][n])return-1}},e.map=function(e,t){var i,c=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(i=0;i<e.length;i+=1)c.push(t(e[i]));return c},e.find=function(e,t){var i,c;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(i=0,c=e.length;i<c;i+=1){var o=e[i];if(t(o,i))return o}},e.assign=function(e){for(var t,i,c=e,o=arguments.length,s=new Array(o>1?o-1:0),n=1;n<o;n++)s[n-1]=arguments[n];if(Object.assign)return Object.assign.apply(Object,[e].concat(s));var a=function(){var e=s[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach(function(t){c[t]=e[t]})};for(t=0,i=s.length;t<i;t+=1)a();return e},e.getBrowserAlias=function(e){return c.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return c.BROWSER_MAP[e]||""},e}();t.default=o,e.exports=t.default},18:function(e,t,i){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv",bot:"bot"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,i){t.__esModule=!0,t.default=void 0;var c,o=(c=i(91))&&c.__esModule?c:{default:c},s=i(18);function n(e,t){for(var i=0;i<t.length;i++){var c=t[i];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(e,c.key,c)}}var a=function(){function e(){}var t,i,c;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new o.default(e,t)},e.parse=function(e){return new o.default(e).getResult()},t=e,c=[{key:"BROWSER_MAP",get:function(){return s.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return s.ENGINE_MAP}},{key:"OS_MAP",get:function(){return s.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return s.PLATFORMS_MAP}}],(i=null)&&n(t.prototype,i),c&&n(t,c),e}();t.default=a,e.exports=t.default},91:function(e,t,i){t.__esModule=!0,t.default=void 0;var c=r(i(92)),o=r(i(93)),s=r(i(94)),n=r(i(95)),a=r(i(17));function r(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(c.default,function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(o.default,function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(s.default,function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(n.default,function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,i={},c=0,o={},s=0;if(Object.keys(e).forEach(function(t){var n=e[t];"string"==typeof n?(o[t]=n,s+=1):"object"==typeof n&&(i[t]=n,c+=1)}),c>0){var n=Object.keys(i),r=a.default.find(n,function(e){return t.isOS(e)});if(r){var l=this.satisfies(i[r]);if(void 0!==l)return l}var d=a.default.find(n,function(e){return t.isPlatform(e)});if(d){var h=this.satisfies(i[d]);if(void 0!==h)return h}}if(s>0){var u=Object.keys(o),f=a.default.find(u,function(e){return t.isBrowser(e,!0)});if(void 0!==f)return this.compareVersion(o[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var i=this.getBrowserName().toLowerCase(),c=e.toLowerCase(),o=a.default.getBrowserTypeByAlias(c);return t&&o&&(c=o.toLowerCase()),c===i},t.compareVersion=function(e){var t=[0],i=e,c=!1,o=this.getBrowserVersion();if("string"==typeof o)return">"===e[0]||"<"===e[0]?(i=e.substr(1),"="===e[1]?(c=!0,i=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?i=e.substr(1):"~"===e[0]&&(c=!0,i=e.substr(1)),t.indexOf(a.default.compareVersions(o,i,c))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e)})},e}();t.default=l,e.exports=t.default},92:function(e,t,i){t.__esModule=!0,t.default=void 0;var c,o=(c=i(17))&&c.__esModule?c:{default:c},s=/version\/(\d+(\.?_?\d+)+)/i,n=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},i=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},i=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/PaleMoon/i],describe:function(e){var t={name:"Pale Moon"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},i=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},i=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},i=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},i=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},i=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},i=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},i=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},i=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},i=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},i=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},i=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},i=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},i=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return i&&(t.version=i),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},i=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},i=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},i=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},i=o.default.getFirstMatch(s,e)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},i=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},i=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},i=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},i=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},i=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},i=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},i=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},i=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},i=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){var t=!e.test(/like android/i),i=e.test(/android/i);return t&&i},describe:function(e){var t={name:"Android Browser"},i=o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},i=o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},i=o.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(t,e),version:o.default.getSecondMatch(t,e)}}}];t.default=n,e.exports=t.default},93:function(e,t,i){t.__esModule=!0,t.default=void 0;var c,o=(c=i(17))&&c.__esModule?c:{default:c},s=i(18),n=[{test:[/Roku\/DVP/],describe:function(e){var t=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:s.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),i=o.default.getWindowsVersionName(t);return{name:s.OS_MAP.Windows,version:t,versionName:i}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:s.OS_MAP.iOS},i=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return i&&(t.version=i),t}},{test:[/macintosh/i],describe:function(e){var t=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),i=o.default.getMacOSVersionName(t),c={name:s.OS_MAP.MacOS,version:t};return i&&(c.versionName=i),c}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:s.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),i=e.test(/android/i);return t&&i},describe:function(e){var t=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),i=o.default.getAndroidVersionName(t),c={name:s.OS_MAP.Android,version:t};return i&&(c.versionName=i),c}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),i={name:s.OS_MAP.WebOS};return t&&t.length&&(i.version=t),i}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||o.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:s.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:s.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:s.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.PlayStation4,version:t}}}];t.default=n,e.exports=t.default},94:function(e,t,i){t.__esModule=!0,t.default=void 0;var c,o=(c=i(17))&&c.__esModule?c:{default:c},s=i(18),n=[{test:[/googlebot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=o.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",i={type:s.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(i.model=t),i}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),i=e.test(/like (ipod|iphone)/i);return t&&!i},describe:function(e){var t=o.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:s.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe:function(e){var t=o.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),i={type:s.PLATFORMS_MAP.mobile,vendor:"Nokia"};return t&&(i.model=t),i}},{test:[/[^-]mobi/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}}];t.default=n,e.exports=t.default},95:function(e,t,i){t.__esModule=!0,t.default=void 0;var c,o=(c=i(17))&&c.__esModule?c:{default:c},s=i(18),n=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:s.ENGINE_MAP.Blink};var t=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:s.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:s.ENGINE_MAP.Trident},i=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:s.ENGINE_MAP.Presto},i=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){var t=e.test(/gecko/i),i=e.test(/like gecko/i);return t&&!i},describe:function(e){var t={name:s.ENGINE_MAP.Gecko},i=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:s.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:s.ENGINE_MAP.WebKit},i=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}}];t.default=n,e.exports=t.default}})}(LL)),LL.exports),kL=Bu(SL);var $L,EL=function(){if(wL)return ML;wL=1,ML=s,s.default=s,s.stable=l,s.stableStringify=l;var e="[...]",t="[Circular]",i=[],c=[];function o(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(e,t,s,n){var r;void 0===n&&(n=o()),a(e,"",0,[],void 0,0,n);try{r=0===c.length?JSON.stringify(e,t,s):JSON.stringify(e,h(t),s)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==i.length;){var l=i.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return r}function n(e,t,o,s){var n=Object.getOwnPropertyDescriptor(s,o);void 0!==n.get?n.configurable?(Object.defineProperty(s,o,{value:e}),i.push([s,o,t,n])):c.push([t,o,e]):(s[o]=e,i.push([s,o,t]))}function a(i,c,o,s,r,l,d){var h;if(l+=1,"object"==typeof i&&null!==i){for(h=0;h<s.length;h++)if(s[h]===i)return void n(t,i,c,r);if(void 0!==d.depthLimit&&l>d.depthLimit)return void n(e,i,c,r);if(void 0!==d.edgesLimit&&o+1>d.edgesLimit)return void n(e,i,c,r);if(s.push(i),Array.isArray(i))for(h=0;h<i.length;h++)a(i[h],h,h,s,i,l,d);else{var u=Object.keys(i);for(h=0;h<u.length;h++){var f=u[h];a(i[f],f,h,s,i,l,d)}}s.pop()}}function r(e,t){return e<t?-1:e>t?1:0}function l(e,t,s,n){void 0===n&&(n=o());var a,r=d(e,"",0,[],void 0,0,n)||e;try{a=0===c.length?JSON.stringify(r,t,s):JSON.stringify(r,h(t),s)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==i.length;){var l=i.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return a}function d(c,o,s,a,l,h,u){var f;if(h+=1,"object"==typeof c&&null!==c){for(f=0;f<a.length;f++)if(a[f]===c)return void n(t,c,o,l);try{if("function"==typeof c.toJSON)return}catch(e){return}if(void 0!==u.depthLimit&&h>u.depthLimit)return void n(e,c,o,l);if(void 0!==u.edgesLimit&&s+1>u.edgesLimit)return void n(e,c,o,l);if(a.push(c),Array.isArray(c))for(f=0;f<c.length;f++)d(c[f],f,f,a,c,h,u);else{var p={},m=Object.keys(c).sort(r);for(f=0;f<m.length;f++){var g=m[f];d(c[g],g,f,a,c,h,u),p[g]=c[g]}if(void 0===l)return p;i.push([l,o,c]),l[o]=p}a.pop()}}function h(e){return e=void 0!==e?e:function(e,t){return t},function(t,i){if(c.length>0)for(var o=0;o<c.length;o++){var s=c[o];if(s[1]===t&&s[0]===i){i=s[2],c.splice(o,1);break}}return e.call(this,t,i)}}return ML}(),NL=Bu(EL);const AL=Rm("network-monitor",{level:wm.LogLevel.Info}),TL=Date.now(),OL=(null===($L=window.navigator)||void 0===$L?void 0:$L.userAgent)?kL.parse(window.navigator.userAgent):void 0,IL=(e,t={depthLimit:10,edgesLimit:10})=>e instanceof Event?`'${e.type}' Event`:"string"==typeof e?e:NL(e,void 0,2,t);class RL{constructor(){this.unsubscribableObservers=[],this.runAllChecks=(e,t)=>Au(this,void 0,void 0,function*(){if(!this.isReady||this.isRunningChecks&&!t)return;AL.info("Run health checks, triggered by",IL(e),"| Active resources",this.resources.size),this.isRunningChecks=!0,this.synchroniseCheckInterval();let i=this.getFormattedTimestamp(this.getNowTimestamp());const c=yield this.isOnlineCheck();c?AL.debug(`Network connected at ${i}`):AL.warn(`Network disconnected at ${i}`);const o=this.normaliseSerializedSocketStatus(this.socketStatus.serialize(),c),s=this.preFlightSocketChecks(o);if(s||AL.debug("Socket pre-flight checks failed"),!c||!s){AL.debug("Aborting remaining health checks");const e=[...this.resources].reduce((e,[t,i])=>{const o=e[i.resourceName];return o?(o.sourceRef=[...o.sourceRef,i.message.SOURCE_REF],e):Object.assign(Object.assign({},e),{[i.resourceName]:this.normaliseResourceHealth({name:i.resourceName,sourceRef:[i.message.SOURCE_REF],isConnected:i.isConnected,lastUpdated:i.lastUpdated},c)})},{});return this.reportSystemHealth({isAuthenticated:this.user.isAuthenticated,isOnline:c,resources:e,resourcesAllConnected:!1,socket:o}),void(this.isRunningChecks=!1)}let n=!0;const a=[];this.resources.forEach((e,t)=>{const{resourceName:c,message:o,functions:s}=e,{resourceChecks:r=this.config.resourceChecks,resourceDataLogon:l=this.config.resourceDataLogon}=s,{SOURCE_REF:d}=o;let h,u,f,p,m,g=!1;a.push((()=>Au(this,void 0,void 0,function*(){var o,s,a;try{AL.debug(`Running health check against ${c}`);const e=yield Promise.race([r(d,t),(s=this.config.checkTimeout,a=()=>({isConnected:!1,lastUpdated:this.getNowTimestamp(),timeout:!0}),new Promise(e=>{setTimeout(()=>{e(a())},s)}))]);g=e.isConnected,h=e.lastUpdated,u=e.lastMessage,p=e.timeout}catch(e){g=!1,h=this.getNowTimestamp(),f=e,u=null!==(o=null==e?void 0:e.receivedMessage)&&void 0!==o?o:e}return m=(null==u?void 0:u.MESSAGE_TYPE)===Jz.MSG_NACK||cC(u,Vz.NOT_FOUND),i=this.getFormattedTimestamp(null!=h?h:this.getNowTimestamp()),g?AL.debug(`${c} is healthy at ${i}`):AL.warn(`${c} is not healthy at ${i}`),u&&AL.debug(`${c} messaged at ${i}`,IL(u)),f&&AL.error(`${c} errored at ${i}`,IL(f)),p&&AL.warn(`${c} timed out at ${i}`),m&&(AL.error(`${c} issue, re-attempting data logon at ${i}`),l(e)),n&&(n=g),{name:c,sourceRef:[d],isConnected:g,lastUpdated:h,lastError:f}}))())});const r=(yield Promise.allSettled(a)).reduce((e,t)=>{if("fulfilled"===t.status){const i=e[t.value.name];return i?(i.sourceRef=[...i.sourceRef,...t.value.sourceRef],e):Object.assign(Object.assign({},e),{[t.value.name]:this.normaliseResourceHealth(t.value)})}return AL.warn("Unexpected promise rejection occurred. Please check any custom resourceChecks return MonitoredResourceChecksResult."),e},{});AL.debug("Health checks complete"),this.reportSystemHealth({isAuthenticated:this.user.isAuthenticated,isOnline:c,resources:r,resourcesAllConnected:n,socket:o}),this.isRunningChecks=!1}),void 0!==this.config.logLevel&&(AL.level=this.config.logLevel)}create(){this.resources?AL.warn("NetworkMonitor already created. If this is intentional, please call NetworkMonitor.destroy first."):(this.addListeners(),this.resources=new Map,setTimeout(()=>{this.isReady=!0,this.synchroniseCheckInterval(),this.runAllChecks("NetworkMonitor.create()")},this.config.startDelay))}destroy(){this.removeListeners(),clearInterval(this.internalId),this.resources.clear(),this.resources=void 0,this.status=void 0,this.isReady=void 0}isOnlineCheck(){return Promise.resolve(navigator.onLine)}addResource(e,t){this.resources||this.create(),this.resources.set(e,t)}removeResource(e){this.resources.delete(e)}addListeners(){var e,t;null===(e=this.config.windowEvents)||void 0===e||e.forEach(e=>window.addEventListener(e,this.runAllChecks)),null===(t=this.config.documentEvents)||void 0===t||t.forEach(e=>document.addEventListener(e,this.runAllChecks)),this.config.genesisConnectEvents.includes("stream")&&this.unsubscribableObservers.push(this.connectEvents.addStreamListener(({detail:e})=>{const{functions:t,message:i,resourceName:c,stream:o}=e;this.config.ignoredGenesisResources.includes(c)||this.addResource(o,{functions:t,message:i,resourceName:c})},({detail:e})=>{const{resourceName:t,stream:i}=e;this.config.ignoredGenesisResources.includes(t)||this.removeResource(i)},({detail:e})=>{var t;const{resourceName:i,stream:c,error:o}=e,s=null!==(t=o.receivedMessage)&&void 0!==t?t:o;let n="";cC(s,Vz.NOT_FOUND)?n="Please check the resource is running.":cC(s,Vz.FORBIDDEN)&&(n="You are not authorised to access this resource, removing it from monitoring.",this.removeResource(c)),AL.error(`${i} errored at ${this.getFormattedTimestamp(this.getNowTimestamp())}.`,n,o)})),this.config.genesisConnectEvents.includes("commit")&&this.unsubscribableObservers.push(this.connectEvents.addCommitListener(e=>{this.config.ignoredGenesisResources.includes(e.detail.eventName)||this.runAllChecks(e)})),this.unsubscribableObservers.push(this.connectEvents.addMetadataListener(({detail:e})=>{const{resourceName:t,error:i}=e;i&&AL.error(`${t} had an unrecoverable error at ${this.getFormattedTimestamp(this.getNowTimestamp())}.`,"Please check the resource is running.",i)}))}removeListeners(){var e,t;null===(e=this.config.windowEvents)||void 0===e||e.forEach(e=>window.removeEventListener(e,this.runAllChecks)),null===(t=this.config.documentEvents)||void 0===t||t.forEach(e=>document.removeEventListener(e,this.runAllChecks)),this.unsubscribableObservers.forEach(e=>e()),this.unsubscribableObservers.length=0}reportSystemHealth(e){var t;const i=null!==(t=this.config.eventEmitter)&&void 0!==t?t:document;this.status=this.normaliseEventDetail(e);(this.status.isHealthy?AL.debug:AL.warn)("Emitting 'system-health-changed' event",IL(this.status)),null==i||i.dispatchEvent(new CustomEvent(yL,{detail:this.status,bubbles:i!==document,composed:!0})),this.status.socket.reconnectionLimitReached&&(AL.debug("Network monitoring no longer required. Please check your network and reload your application."),this.destroy())}reportStabilityToGenesis(e){return Au(this,void 0,void 0,function*(){return AL.debug("User requested report stability to Genesis."),AL.info("Please attach this data to your Genesis Support request: \n",JSON.stringify(e,null,2)),!0})}normaliseResourceHealth(e,t=!0){var i;const c=!!t&&e.isConnected,o=null!==(i=e.lastUpdated)&&void 0!==i?i:this.getNowTimestamp();return Object.assign(Object.assign({},e),{isConnected:c,lastUpdated:o})}normaliseSerializedSocketStatus(e,t=!0){const i=!!t&&e.isConnected,c=!i;return Object.assign(Object.assign({},e),{isConnected:i,isDisconnected:c})}normaliseEventDetail(e){var t,i,c,o;const s=!!((null===(t=e.socket)||void 0===t?void 0:t.isConfigured)?e.isOnline&&(null===(i=e.socket)||void 0===i?void 0:i.isConnected)&&e.resourcesAllConnected:e.isOnline),n=null!==(c=e.lastUpdated)&&void 0!==c?c:this.getNowTimestamp(),a=null!==(o=e.nextUpdate)&&void 0!==o?o:this.getNextTimestamp(),r=e.isAuthenticated&&this.user?this.user.username:void 0,l=Object.assign(Object.assign({},e),{browserInformation:OL,username:r,isHealthy:s,lastUpdated:n,nextUpdate:a,firstUpdated:TL,runAllChecks:()=>{AL.debug("User activated run checks command starting."),this.runAllChecks("user requested")},reportStabilityToGenesis:()=>this.reportStabilityToGenesis(l)});return l}preFlightSocketChecks(e){if(!e.isConfigured)return AL.debug("Socket not configured"),!1;if(e.isReconnecting)return AL.debug("Socket reconnecting"),!1;if(e.isConnecting)return AL.debug("Socket connecting"),!1;if(e.isDisconnected){const t=e.isDisconnectedByServer?`by the server, code: ${e.closedCode}, reason: ${e.closedReason}`:"";return AL.debug(`Socket disconnected ${t}`),e.reconnectionLimitReached&&AL.debug("Socket reconnection limit reached"),!1}const t=this.user.isAuthenticated?"with":"without";return AL.debug(`Socket connected ${t} valid session`),!0}getFormattedTimestamp(e){return kg(e)}getNowTimestamp(){return Date.now()}getNextTimestamp(){return new Date(Date.now()+this.config.checkInterval).getTime()}synchroniseCheckInterval(){clearInterval(this.internalId),this.internalId=setInterval(()=>this.runAllChecks("check interval"),this.config.checkInterval)}}Eu([CL],RL.prototype,"config",void 0),Eu([kx],RL.prototype,"socketStatus",void 0),Eu([Iz],RL.prototype,"connectEvents",void 0),Eu([Mz],RL.prototype,"user",void 0),Eu([g],RL.prototype,"status",void 0);const DL=ft.createInterface(e=>e.singleton(RL)),FL={account:"genesis",namespace:"default",authKey:"kv-default",authEmail:void 0},_L=ft.createInterface();var HL,PL;!function(e){e.REQ_KEY_VALUE_LIST="REQ_KEY_VALUE_LIST",e.REQ_KEY_VALUE_READ="REQ_KEY_VALUE_READ"}(HL||(HL={})),function(e){e.EVENT_KEY_VALUE_PUT="EVENT_KEY_VALUE_PUT",e.EVENT_KEY_VALUE_DELETE="EVENT_KEY_VALUE_DELETE"}(PL||(PL={}));let VL=class{constructor(e,t,i=FL){this.connect=e,this.user=t,this.kvStorageConfig=i}delete(e){return Au(this,void 0,void 0,function*(){const t={DETAILS:{KEYS:e}},i=yield this.connect.commitEvent(PL.EVENT_KEY_VALUE_DELETE,t);return!(!i||"EVENT_ACK"!==i.MESSAGE_TYPE)||{ERROR:i.ERROR,WARNING:i.WARNING}})}get(e){return Au(this,void 0,void 0,function*(){var t;const i={REQUEST:{USER_NAME:null!==(t=this.kvStorageConfig.authEmail)&&void 0!==t?t:this.user.userName,KEY:e}},c=yield this.connect.request(HL.REQ_KEY_VALUE_READ,i);if(c&&c.REPLY&&c.REPLY.length>0){const t=c.REPLY.map(e=>{const t=this.getDecodedValue(e.VALUE);return{kv:{key:e.KEY,value:t}}});return e?t[0]:t}return e?void 0:[]})}getDecodedValue(e){e.startsWith("str:")||e.startsWith("bin:")||(e=`str:${e}`);let t=dg(e);return"string"==typeof t&&t.startsWith("str:")&&(t=dg(t)),"string"==typeof t&&t.startsWith("bin:")&&(t=dg(t)),t}list(){return Au(this,void 0,void 0,function*(){var e;const t={REQUEST:{USER_NAME:null!==(e=this.kvStorageConfig.authEmail)&&void 0!==e?e:this.user.userName}},i=yield this.connect.request(HL.REQ_KEY_VALUE_LIST,t);if(i&&i.REPLY&&i.REPLY.length>0){return i.REPLY.map(e=>e.KEY)}return[]})}put(e){return Au(this,void 0,void 0,function*(){const t={DETAILS:{RECORDS:e.map(e=>({KEY:e.key,VALUE:e.base64?hg(e.value):e.value}))}},i=yield this.connect.commitEvent(PL.EVENT_KEY_VALUE_PUT,t);return!(!i||"EVENT_ACK"!==i.MESSAGE_TYPE)||{ERROR:i.ERROR,WARNING:i.WARNING}})}};VL=Eu([Nu(0,Dx),Nu(1,Mz),Nu(2,vt(_L))],VL),ft.createInterface(e=>e.singleton(VL));class BL{constructor(){this.isWorking=!1,this.loggedUserResult=null,this.currentUser=null,this.isLoggedIn=!1,this.isLoggedInSubject=new Sb(!1)}get isLoggedIn$(){return this.isLoggedInSubject.asObservable()}login(e){return Au(this,void 0,void 0,function*(){return Promise.resolve(this.nextLoginResult)})}logout(){return Au(this,void 0,void 0,function*(){return Promise.resolve(this.nextLogoutResult)})}reAuthFromSession(){return Au(this,void 0,void 0,function*(){return Promise.resolve(this.nextReAuthResult)})}setTestUser(e={}){this.currentUser=new Lz,this.currentUser.set(Object.assign({userName:"JaneDee",profile:["USER"],permission:["CreateRules"]},e)),this.isLoggedIn=!0,this.isLoggedInSubject.next(!0)}resetTestUser(){this.currentUser=null,this.isLoggedIn=!1,this.isLoggedInSubject.next(!1)}}Eu([g],BL.prototype,"isWorking",void 0),Eu([g],BL.prototype,"loggedUserResult",void 0),Eu([g],BL.prototype,"currentUser",void 0),Eu([g],BL.prototype,"isLoggedIn",void 0);class UL{constructor(){this.fetchMetadataRequired=!0,this.fetchingMetadata=!1,this.originalFieldDef=[],this.fieldMetadata=[],this.requestFields=[],this.customRequestFields=[],this.availableIndexes=[],this.availableSortableFields=[],this.availableCriteriaFields=[],this.criteriaOnlyRequest=!1}init(e,t){return Promise.resolve(this.initialized)}startStream(){return Promise.resolve()}setMetadata(e){var t,i,c;this.availableIndexes=null!==(t=e.INDEXES)&&void 0!==t?t:[],this.availableSortableFields=null!==(i=e.SORTABLE_FIELDS)&&void 0!==i?i:[],this.availableCriteriaFields=null!==(c=e.CRITERIA_FIELDS)&&void 0!==c?c:[],this.originalFieldDef=Tz(e),this.fieldMetadata=Az(this.originalFieldDef),this.requestFields=e.REQUEST_FIELD||[],this.customRequestFields=e.FIELD||[],this.fetchMetadataRequired=!1}unsetMedata(){this.availableIndexes=[],this.availableSortableFields=[],this.availableCriteriaFields=[],this.originalFieldDef=[],this.fieldMetadata=[],this.requestFields=[],this.fetchMetadataRequired=!0}setStream(e){this.stream=by(Promise.resolve(e))}unsetStream(){this.stream=void 0}deinit(){}destroy(){}validResourceName(e){return!!e&&!!e.trim().length}getMetadata(e){return Promise.resolve(this.fieldMetadata)}snapshot(e){return Promise.resolve(null)}snapshotFiltered(e){return Promise.resolve(null)}updateData(e){return Promise.resolve()}dataHandler(e){return[]}addView(e){}dropView(e){}setFilter(e,t,i){return Promise.resolve()}clearFilter(e){return Promise.resolve()}createItem(e){return Promise.resolve("")}deleteItem(e){return Promise.resolve()}updateItem(e,t){return Promise.resolve()}get dataserverOnlyParams(){return{}}get requestOnlyParams(){return{}}updateLoadMoreCount(e){}}Eu([g],UL.prototype,"status",void 0),Eu([g],UL.prototype,"fetchMetadataRequired",void 0),Eu([g],UL.prototype,"originalFieldDef",void 0),Eu([g],UL.prototype,"fieldMetadata",void 0),Eu([g],UL.prototype,"requestFields",void 0),Eu([g],UL.prototype,"customRequestFields",void 0),Eu([g],UL.prototype,"availableIndexes",void 0),Eu([g],UL.prototype,"availableSortableFields",void 0),Eu([g],UL.prototype,"availableCriteriaFields",void 0),Eu([g],UL.prototype,"criteriaOnlyRequest",void 0),ft.createInterface(e=>e.aliasTo(Mz));const jL=Rm("foundation-ui");class qL extends(lL(qt)){constructor(){super(...arguments),this.withGridInit=!0,this.isSnapshot=!1,this.maxRows=nL.MAX_ROWS_250,this.maxView=nL.MAX_VIEW_1000,this.resourceName="",this.reverse=!1,this.rowId="ROW_REF",this.withTimestampFormatting=!0,this.requiresFullDataRefresh=!0,this.rowsSyncedWithStream=new Map,this.dataSubWasLoggedOff=!1,this.criteriaFromFilters=new Map,this.update=new Sb(new Map),this.fetchGeneration=0}criteriaChanged(e,t){const i=e!==bL(t,";");this.refetchIfInitializedAndChanged(i)}dataChanged(e){e&&(this.clearData(),this.reset())}requestChanged(e,t){const i=JSON.stringify(e)!==JSON.stringify(t);this.refetchIfInitializedAndChanged(i)}refetchIfInitializedAndChanged(e){this.datasource.initialized&&e&&this.fetchGenesisData(null)}set datasourceConfig(e){e&&Object.keys(e).forEach(t=>{void 0!==e[t]&&(this[t]=e[t])})}disconnectedCallback(){var e,t;super.disconnectedCallback(),this.clearData(),null===(e=this.dataSub)||void 0===e||e.unsubscribe(),null===(t=this.update)||void 0===t||t.unsubscribe(),delete this.dataSub,delete this.update,this.datasource.destroy(),delete this.datasource}reset(){this.requiresFullDataRefresh=!0,this.fetchGenesisData()}fetchGenesisData(){return Au(this,arguments,void 0,function*(e=!0){var t;null===(t=this.dataSub)||void 0===t||t.unsubscribe(),this.dataSub=void 0,this.fetchGeneration+=1;const i=this.fetchGeneration,c=()=>i!==this.fetchGeneration;if(this.data)return void this.syncComponentData(this.data);const o=e||!this.datasource.initialized;o||(this.connect.dataLogoff(this.sourceRef),this.clearData());const s=yield this.datasource.init(this.datasourceOptions(),o);if(!c())if(s){if(this.isSnapshot){const e=yield this.datasource.snapshotFiltered();if(c())return;return void this.syncComponentData(e)}jL.debug(`requesting stream for ${this.resourceName}`),this.dataSub=this.datasource.stream.subscribe(e=>{if(c())return;e.DISCONNECTED&&this.handleError({message:`Genesis Datasource disconnected for ${this.resourceName}`,loggerType:"error"}),this.sourceRef=e.SOURCE_REF;const t=e.MESSAGE_TYPE;if(t&&t===Jz.LOGOFF_ACK)this.dataSubWasLoggedOff=!0;else if(this.dataSubWasLoggedOff=!1,e.ROW){const t=sL(e);this.handleStreamUpdate(t)}else this.handleStreamUpdate(e)})}else this.handleError({message:`Genesis Datasource init failed for ${this.resourceName}`,loggerType:"error"})})}initDatasource(){return Au(this,void 0,void 0,function*(){yield this.datasource.init(this.datasourceOptions(),!0)})}datasourceOptions(){return{criteria:this.buildCriteria(),fields:this.fields,isSnapshot:this.isSnapshot,orderBy:this.orderBy,resourceName:this.resourceName,request:this.request,reverse:this.reverse,maxRows:this.maxRows,maxView:this.maxView}}handleStreamUpdate(e){if(!e)return;e.hasOwnProperty("REPLY")?this.applyRequestServerData(e):this.applyDataserverData(e)}applyRequestServerData(e){var t,i;if(!Array.isArray(e.REPLY)||!(null===(t=e.MESSAGE_TYPE)||void 0===t?void 0:t.startsWith("REP_")))return void this.handleError({message:"received invalid RequestServerResult",loggerType:"error",loggerArgs:[e]});if(this.requiresFullDataRefresh){"ROW_REF"!==this.rowId&&(null===(i=e.REPLY)||void 0===i||i.forEach(e=>{this.rowsSyncedWithStream.set(e[this.rowId],e)}));const t=this.rowsSyncedWithStream.size>0?Array.from(this.rowsSyncedWithStream.values()):e.REPLY;return void this.syncComponentData(t)}this.handleStreamInserts(e.REPLY);const c=Array.from(this.rowsSyncedWithStream.values()).filter(t=>!e.REPLY.includes(t));this.handleStreamDeletes(c)}applyDataserverData(e){var t,i,c,o;if(this.requiresFullDataRefresh){null===(t=e.inserts)||void 0===t||t.forEach(e=>{this.rowsSyncedWithStream.set(e[this.rowId],e)});const i=Array.from(this.rowsSyncedWithStream.values());return void this.syncComponentData(i)}(null===(i=e.inserts)||void 0===i?void 0:i.length)>0&&this.handleStreamInserts(e.inserts),(null===(c=e.deletes)||void 0===c?void 0:c.length)>0&&this.handleStreamDeletes(e.deletes),(null===(o=e.updates)||void 0===o?void 0:o.length)>0&&this.handleStreamUpdates(e.updates)}buildCriteria(){var e;return bL(((null===(e=this.criteria)||void 0===e?void 0:e.split(";"))||[]).join(" && "),";")}setFilter(e,t){this.criteriaFromFilters.set(e,t),this.update.next(this.criteriaFromFilters)}removeFilter(e){this.criteriaFromFilters.delete(e),this.update.next(this.criteriaFromFilters)}handleError(e={}){const{message:t,loggerType:i,loggerArgs:c=[]}=e;t&&jL[i](t,...c)}getFieldMetadata(e){var t;return null===(t=this.datasource.fieldMetadata)||void 0===t?void 0:t.find(t=>t.name===e)}getDefaultLabelFormat(e,t){return t===kz.DATE||t===kz.DATETIME?$g(e,t===kz.DATETIME):e}}Eu([Dx],qL.prototype,"connect",void 0),Eu([gL],qL.prototype,"datasource",void 0),Eu([re({mode:"boolean"})],qL.prototype,"withGridInit",void 0),Eu([re],qL.prototype,"criteria",void 0),Eu([g],qL.prototype,"data",void 0),Eu([re],qL.prototype,"fields",void 0),Eu([re({mode:"boolean"})],qL.prototype,"isSnapshot",void 0),Eu([re],qL.prototype,"maxRows",void 0),Eu([re],qL.prototype,"maxView",void 0),Eu([re],qL.prototype,"orderBy",void 0),Eu([re],qL.prototype,"request",void 0),Eu([re],qL.prototype,"resourceName",void 0),Eu([re({mode:"boolean"})],qL.prototype,"reverse",void 0),Eu([re],qL.prototype,"rowId",void 0),Eu([re({mode:"boolean",attribute:"with-timestamp-formatting"})],qL.prototype,"withTimestampFormatting",void 0);const GL=(e,t)=>!e.composedPath().includes(t),WL=(e,t)=>e.composedPath().includes(t),YL=e=>e.tagName.toLowerCase().split("-")[0];const KL=Rm("foundation-criteria");var ZL;!function(e){e.AND="&&",e.OR="||",e.NOT="!",e.GT=">",e.GE=">=",e.LT="<",e.LE="<=",e.NE="!=",e.EQ="=="}(ZL||(ZL={}));class QL{constructor(e){this.$$operator=e}static And(){return new QL(ZL.AND)}static Or(){return new QL(ZL.OR)}static Not(){return new QL(ZL.NOT)}static GreaterThan(){return new QL(ZL.GT)}static GreaterThanOrEqual(){return new QL(ZL.GE)}static LessThan(){return new QL(ZL.LT)}static LessThanOrEqual(){return new QL(ZL.LE)}static NotEqual(){return new QL(ZL.NE)}static Equal(){return new QL(ZL.EQ)}get operator(){return this.$$operator}}const XL=e=>{const{value:t}=e;return e.valueGetter?e.valueGetter(t):"function"==typeof t?t(e):Array.isArray(t)?t.join(","):"string"==typeof t?`"${t}"`:t},JL=e=>t=>`${t.field} ${e} ${XL(t)}`,eM={GT:e=>JL(ZL.GT)(e),GE:e=>JL(ZL.GE)(e),LT:e=>JL(ZL.LT)(e),LE:e=>JL(ZL.LE)(e),NE:e=>JL(ZL.NE)(e),EQ:e=>JL(ZL.EQ)(e),containsIgnoreCase:e=>`Expr.containsIgnoreCase(${e.field}, ${XL(e)})`,startsWith:e=>`${e.field}.startsWith(${XL(e)})`,endsWith:e=>`${e.field}.endsWith(${XL(e)})`,dateIsToday:e=>`Expr.dateIsToday(${e.field})`,dateIsEqual:e=>`Expr.dateIsEqual(${e.field}, ${XL(e)})`,dateIsGreaterEqual:e=>`Expr.dateIsGreaterEqual(${e.field}, ${XL(e)})`,dateIsLessEqual:e=>`Expr.dateIsLessEqual(${e.field}, ${XL(e)})`,dateTimeIsGreaterEqual:e=>`Expr.dateTimeIsGreaterEqual(${e.field}, ${XL(e)})`,dateTimeIsLessEqual:e=>`Expr.dateTimeIsLessEqual(${e.field}, ${XL(e)})`},tM=e=>Array.isArray(e)?e:[e],iM="default";class cM{constructor(){this.expressions={},this.And=(e,t={})=>this.withExpression(e,t,QL.And()),this.Or=(e,t={})=>this.withExpression(e,t,QL.Or()),this.Not=(e,t={})=>this.withExpression(e,t,QL.Not())}withExpression(e,t={},i=QL.And()){const{condition:c,join:o,groupName:s}=t,n=(e,t=iM)=>{var s;const n=null!==(s=this.expressions[t])&&void 0!==s?s:[];this.expressions[t]=[...n,{join:i||o,condition:c,expression:e}]};if(Array.isArray(e))if(o){const t=e.filter(e=>{const t=e instanceof QL;return t&&KL.warn("Inline joins will be discarded when join is defined in ExpressionOptions"),!t});if(s)t.forEach(e=>{n(e,s)});else{const e=(a=o,t.flat().flatMap((e,t,i)=>i.length-1!==t?[e,a]:e));n(e,iM)}}else n(e,iM);else n(e,"string"==typeof e?iM:e.group);var a;return this}build(e){const t=Object.entries(this.expressions).reduce((e,[t,i])=>Object.assign(Object.assign({},e),{[t]:`(${i.filter(({condition:e})=>!e||e()).map(({expression:e,join:t},i,c)=>this.parseExpression(e,c[i-1],t)).join("")})`}),{});return e?e(t):`(${Object.values(t).join(" && ")})`}reset(){this.expressions={}}parseExpression(e,t,i){const c=[];return i&&t&&c.push(` ${i.operator} `),"string"==typeof e?c.push(e):Array.isArray(e)?(e.forEach((e,t,i)=>{if(e instanceof QL){if(i[t-1]instanceof QL)throw new Error("Adjacent Join operations detected")}}),c.push(`(${e.map(e=>this.parseExpression(e,void 0)).join("")})`)):e instanceof QL?c.push(` ${e.operator} `):e&&c.push(e.serialiser(e)),c.join("")}}let oM=class{constructor(e){this.serialiser=eM.EQ,this.build=()=>{if(!this.field)throw new Error("Missing required param 'field'");if(void 0===this.value)throw new Error("Missing required param 'value'");if(!this.serialiser)throw new Error("Missing required param 'serialise'");return{field:this.field,value:this.value,serialiser:this.serialiser,params:this.params,valueGetter:this.valueGetter,group:this.group}},e&&(this.field=e.field,this.value=e.value,this.serialiser=e.serialiser,this.params=e.params,this.valueGetter=e.valueGetter,this.group=e.group)}withField(e){return this.field=e,this}withValue(e){return this.value=e,this}withSerialiser(e){return this.serialiser=e,this}withParams(e){return this.params=e,this}withValueGetter(e){return this.valueGetter=e,this}withGroup(e){return this.group=e,this}};let sM=class extends be{constructor(){super(...arguments),this.criteriaOptions=[],this.createCriteria=e=>{const t=new cM,{field:i,serialiser:c,value:o}=e;return Array.isArray(i)||Array.isArray(o)?t.And(tM(o).map(e=>tM(i).map(t=>(new oM).withField(t).withValue(e).withSerialiser(c).build())),{join:QL.Or()}):t.And((new oM).withField(i).withValue(o).withSerialiser(c).build()),t}}valueChanged(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}selectedLabelChanged(){const e=this.criteriaOptions.find(e=>e.label===this.selectedLabel);this.value=e?this.createCriteria(e).build():""}itemClickHandler(e){this.selectedLabel===e&&(this.selectedLabel=void 0)}};function nM(e,t){var i;const c=new cM;c.withExpression((new oM).withField(null!==(i=e.labelField)&&void 0!==i?i:e.valueField).withValue(t).withSerialiser(eM.containsIgnoreCase).build()),e.baseCriteria?e.criteria=`${e.baseCriteria} && ${c.build()}`:e.criteria=c.build()}Eu([g],sM.prototype,"criteriaOptions",void 0),Eu([g],sM.prototype,"prefix",void 0),Eu([g],sM.prototype,"value",void 0),Eu([g],sM.prototype,"selectedLabel",void 0),sM=Eu([ye({name:"criteria-segmented-control",template:((e="rapid")=>W`<${e}-segmented-control :value="${ag(e=>e.selectedLabel)}"><slot name="label" slot='label'></slot>${qe(e=>e.criteriaOptions,W`<${e}-segmented-item @click=${(e,t)=>t.parent.itemClickHandler(e.label)}value=${e=>e.label}>${e=>e.label}</${e}-segmented-item>`)}</${e}-segmented-control>`)(),styles:xe``})],sM);const aM=(e,t,i)=>W`<${t}-icon tooltip="${()=>e}" name="${()=>i}"></${t}-icon>`,rM=e=>W`<${e}-button id="actiosnMenuTrigger" class="actions-opener${e=>e.open?" opened":""}" appearance="${e=>e.buttonAppearance}" part="actions-opener" @click=${e=>e.toggleActionsMenuVisibility()}>${e=>e.open?"✖":W` ${e.name} `}</${e}-button><${e}-menu ${Re("actionsMenu")}class="actions-menu ${e=>e.classNames}" part="actions-menu">${qe(e=>e.allActions,W` ${He((e,t)=>e.isDisabled&&e.isDisabled(t.parent.rowData),W`<${e}-menu-item class="menu-item" tabindex="${(e,t)=>t.index}" disabled style=${(e,t)=>t.parent.hideDisabled?"display:none":""}>${(e,t)=>t.parent.getLabel(e.name)}</${e}-menu-item>`)} ${He((e,t)=>!e.isDisabled||!e.isDisabled(t.parent.rowData),W`<${e}-menu-item class="menu-item" tabindex="${(e,t)=>t.index}" @click=${(e,t)=>t.parent.onActionMenuItemClick(e.callback)}style="${e=>e.color?`color: ${e.color};`:""}">${(e,t)=>t.parent.getLabel(e.name)}</${e}-menu-item>`)} `,{positioning:!0})}</${e}-menu>`,lM=W`<div class="actions-container${e=>e.isVertical?" actions-vertical":""}" part="actions-container">${e=>e.getTemplate(YL(e))}</div>`;let dM=class extends qt{constructor(){super(...arguments),this.isVertical=!1,this.addDefaultActions=!0,this.autoCloseOnAction=!0,this.name="Actions",this.open=!1,this.hideDisabled=!1,this.hideMenuSingleOption=!1}definitionChanged(e,t){var i;this.actions=null!==(i=null==t?void 0:t.actions)&&void 0!==i?i:[],delete this.definition.actions,t.buttonText&&(this.name=t.buttonText,delete this.definition.customButtonText),t.isVertical&&(this.isVertical=t.isVertical,delete this.definition.isVertical),t.buttonAppearance&&(this.buttonAppearance=t.buttonAppearance,delete this.definition.buttonAppearance),t.hideMenuSingleOption&&(this.hideMenuSingleOption=t.hideMenuSingleOption,delete this.definition.hideMenuSingleOption)}openChanged(){this.classNames=Jt(["visible",this.open],["hidden",!this.open])}toggleActionsMenuVisibility(){this.open=!this.open}onActionMenuItemClick(e){this.autoCloseOnAction&&(this.open=!1),e(this.rowData)}get allActions(){var e;const t=[{name:"✖",callback:()=>this.open=!1}];return this.addDefaultActions?[...null!==(e=this.actions)&&void 0!==e?e:[],...t]:this.actions}get rowData(){if(!this.definition)return;const{node:e,data:t}=this.definition;return(null==e?void 0:e.data)||t}getLabel(e){return"function"==typeof e?e(this.rowData):e}getTemplate(e){if(!this.hideMenuSingleOption)return rM(e);const t=this.actions.filter(e=>!e.isDisabled||!e.isDisabled(this.rowData));return this.singleOption=null,0!==t.length?1===t.length?(this.singleOption=t[0],(e=>W`<${e}-button appearance="${e=>e.buttonAppearance}" part="actions-opener" class="actions-opener" @click=${e=>null==e?void 0:e.singleOption.callback(e.rowData)}?disabled=${e=>(null==e?void 0:e.singleOption.isDisabled)&&(null==e?void 0:e.singleOption.isDisabled(e.rowData))}>${e=>e.getLabel(null==e?void 0:e.singleOption.name)}</${e}-button>`)(e)):rM(e):void 0}};Eu([g],dM.prototype,"actions",void 0),Eu([re({attribute:"is-vertical",mode:"boolean"})],dM.prototype,"isVertical",void 0),Eu([re({attribute:"add-default-actions",mode:"boolean"})],dM.prototype,"addDefaultActions",void 0),Eu([re({attribute:"auto-close-on-action",mode:"boolean"})],dM.prototype,"autoCloseOnAction",void 0),Eu([g],dM.prototype,"classNames",void 0),Eu([g],dM.prototype,"definition",void 0),Eu([re],dM.prototype,"name",void 0),Eu([re({attribute:"open",mode:"boolean"})],dM.prototype,"open",void 0),Eu([re],dM.prototype,"buttonAppearance",void 0),Eu([re({attribute:"hide-disabled",mode:"boolean"})],dM.prototype,"hideDisabled",void 0),Eu([re({attribute:"hide-menu-single-option",mode:"boolean"})],dM.prototype,"hideMenuSingleOption",void 0),Eu([g],dM.prototype,"singleOption",void 0),dM.compose({baseName:"actions-menu",styles:(e,t)=>xe` ${Mu()}`,template:lM});let hM=!1;try{"undefined"!=typeof GENX_ENABLE_AI&&(hM="true"===GENX_ENABLE_AI)}catch($L){}const uM=()=>hM||ug("ai");function fM(){return"undefined"!=typeof window&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)}Rm("foundation-ai");class pM{getStatus(){return Au(this,void 0,void 0,function*(){return{provider:"none",model:""}})}interpretCriteria(e,t){return Au(this,void 0,void 0,function*(){return null})}}const mM=ft.createInterface(e=>e.singleton(pM)),gM=xe` :host{display: block;width: 800px}.ai-criteria-search{display: flex;flex-direction: column;gap: calc(${dr} * 2px)}.ai-criteria-search-row{display: flex;flex-direction: row;gap: calc(${dr} * 2px);align-items: center}.criteria-input{height: calc(((var(--base-height-multiplier) + var(--density)) * var(--design-unit) - 4) * 1px);flex: 1;min-width: 0}.criteria-chips-inline{height: calc(((var(--base-height-multiplier) + var(--density)) * var(--design-unit) - 4) * 1px);flex: 1;min-width: 0;display: flex;align-items: center;gap: calc(${dr} * 1px);overflow-x: auto;padding: 0 calc(${dr} * 2px);background: var(--neutral-fill-input-rest);border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-rest);border-radius: calc(var(--control-corner-radius) * 1px);scrollbar-width: none}.criteria-chips-inline::-webkit-scrollbar{display: none}.mic-icon{color: var(--neutral-foreground-rest);fill: currentColor}.criteria-toggle-button, .criteria-clear-button{flex-shrink: 0}.criteria-chip{display: inline-flex;align-items: center;flex-shrink: 0;gap: calc(${dr} * 1px);padding: calc(${dr} * 0.5px) calc(${dr} * 2px);background: var(--neutral-fill-rest);border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-rest);border-radius: calc(${dr} * 4px);font-size: var(--type-ramp-minus-1-font-size);color: var(--neutral-foreground-rest);white-space: nowrap}.criteria-chip-field{font-weight: 600}.criteria-chip-operator{color: var(--neutral-foreground-hint, var(--neutral-foreground-rest));font-style: italic}.criteria-chip-remove{display: inline-flex;align-items: center;justify-content: center;width: 14px;height: 14px;padding: 0;margin-left: calc(${dr} * 0.5px);background: none;border: none;cursor: pointer;color: var(--neutral-foreground-hint, var(--neutral-foreground-rest));font-size: 10px;border-radius: 50%;line-height: 1}.criteria-chip-remove:hover{background: var(--neutral-fill-hover);color: var(--neutral-foreground-rest)}`,vM=W` ${e=>(e=>W` ${He(()=>uM(),W`<div class="ai-criteria-search"><div class="ai-criteria-search-row">${He(e=>!e.showingChips,W`<${e}-text-area ${Re("textAreaRef")}class="criteria-input" placeholder="${e=>e.placeholder}" ?disabled=${e=>e.disabled||e.isInterpreting}:value=${ag(e=>e.inputValue,"string","input")}@blur=${e=>e.handleBlur()}rows="1"></${e}-text-area>`)} ${He(e=>e.showingChips,W`<div class="criteria-chips-inline">${qe(e=>e.criteriaChips,W`<span class="criteria-chip"><span class="criteria-chip-field">${e=>e.fieldLabel}</span><span class="criteria-chip-operator">${e=>e.operatorLabel}</span>${He(e=>!!e.valueLabel,W`<span class="criteria-chip-value">${e=>e.valueLabel}</span>`)}<button class="criteria-chip-remove" aria-label="Remove filter" @click=${(e,t)=>t.parent.removeChip(e.groupIndex,e.clauseIndex)}>
|
|
58
58
|
✕
|