@genesislcap/foundation-rapid-cdn 15.10.4 → 15.10.6

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.
@@ -54,11 +54,11 @@ function Fd(e,t,i,o){var c,s=arguments.length,n=s<3?t:null===o?o=Object.getOwnPr
54
54
  Continue Session </${e}-button><${e}-button appearance="outline" @click=${e=>e.handleLogout()}class="logout-button">
55
55
  Logout Now </${e}-button></div></div></${e}-card></div>`)(bp(e,"rapid").prefix)} `,styles:Ce` .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%}}`})],Xv);class Jv{constructor(){this.pathHistory=[],this.actionHistory=[],this.isAuthenticated=!1,this.authenticationChangeListeners=mp()}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,o=`${`${"/"!==e?e:""}`}${t}${i}`;if(!this.config.trackPathExclusions.includes(o))return this.pathHistory.push(o),o}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=pt.getOrCreateDOMContainer().get(fp);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()}}Nu([pp],Jv.prototype,"config",void 0),Nu([g],Jv.prototype,"pathHistory",void 0),Nu([g],Jv.prototype,"actionHistory",void 0),Nu([g],Jv.prototype,"isAuthenticated",void 0),Nu([g],Jv.prototype,"userKVs",void 0),Nu([g],Jv.prototype,"details",void 0),Nu([g],Jv.prototype,"permission",void 0),Nu([g],Jv.prototype,"profile",void 0),Nu([g],Jv.prototype,"sourceRef",void 0),Nu([g],Jv.prototype,"userName",void 0),Nu([g],Jv.prototype,"rawProperties",void 0);const eb=pt.createInterface(e=>e.singleton(Jv));class tb{constructor(){this.cachedMetadata=new Map,this.cachedJsonSchema=new Map,this.cachedResources=null,this.cachedRequests=new Map}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}getRequestFor(e){return this.cachedRequests.get(e)}hasRequestFor(e){return this.cachedRequests.has(e)}setRequestFor(e,t){this.cachedRequests.set(e,t)}}const ib=pt.createInterface(e=>e.singleton(tb));var ob;!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"}(ob||(ob={}));const cb={STRING:ob.STRING,ENUM:ob.ENUM,BOOLEAN:ob.BOOLEAN,INT:ob.NUMBER,LONG:ob.NUMBER,DOUBLE:ob.NUMBER,BIGDECIMAL:ob.NUMBER,DATE:ob.DATE,DATETIME:ob.DATETIME,NANO_TIMESTAMP:ob.NANO_TIMESTAMP};var sb;!function(e){e.DATASERVER="DATASERVER",e.EVENT_HANDLER="EVENT_HANDLER",e.REQUEST_SERVER="REQUEST_SERVER"}(sb||(sb={}));const nb="datasource-status-changed",ab=e=>e?e.map(e=>{const t={name:e.NAME,type:cb[e.TYPE]||ob.STRING};if(e.TYPE===ob.ENUM&&e.VALID_VALUES)try{t.enumOptions=Array.isArray(e.VALID_VALUES)?e.VALID_VALUES:e.VALID_VALUES.split("|")}catch(e){cp.error(e),t.enumOptions=[]}return t}):null,rb=e=>{var t;const i=null==e?void 0:e.TYPE;if(i===sb.DATASERVER)return e.FIELD||[];if(i===sb.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 lb{constructor(){this.streamListeners=mp(),this.streamCompleteListeners=mp(),this.streamErrorListeners=mp(),this.commitListeners=mp(),this.metadataListeners=mp(),this.commitResponseListeners=mp()}addStreamListener(e,t,i){var o,c,s;const n=null===(o=this.streamListeners)||void 0===o?void 0:o.subscribe(e),a=null===(c=this.streamCompleteListeners)||void 0===c?void 0:c.subscribe(t),r=null===(s=this.streamErrorListeners)||void 0===s?void 0:s.subscribe(i);return()=>{n(),a(),r()}}onStreamEvent(e,t,i,o){var c;null===(c=this.streamListeners)||void 0===c||c.publish(new CustomEvent("connect-stream-event",{detail:{functions:o,message:t,resourceName:e,stream:i}}))}onStreamErrorEvent(e,t,i){var o;null===(o=this.streamErrorListeners)||void 0===o||o.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 o;null===(o=this.metadataListeners)||void 0===o||o.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 db=pt.createInterface(e=>e.singleton(lb)),hb=pt.createInterface(e=>e.aliasTo(db)),ub={connect:{alwaysOn:!1,enableHeartbeat:!0,enableHeartbeatLogging:!1,heartbeatInterval:1e4,verboseHeartbeat:!1,enableMessageLogging:!1},reconnect:{reconnectAttempts:10,reconnectInterval:1e4,reconnectStreams:!0},isWebSocketExpression:sp},pb=pt.createInterface(e=>e.instance(ub));var fb={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},mb={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"},gb={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 vb,bb,yb=function(e){var t=mb[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"}(vb||(vb={})),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"}(bb||(bb={}));var zb=this&&this.__assign||function(){return zb=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var c in t=arguments[i])Object.prototype.hasOwnProperty.call(t,c)&&(e[c]=t[c]);return e},zb.apply(this,arguments)};zb(zb({},fb),{getStatusCode:function(e){var t=gb[e];if(!t)throw new Error("Reason phrase does not exist: "+e);return t},getStatusText:yb});class xb{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 o=`${"/"!==e?e:""}`;this.returnUrl=`${o}${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 Cb=pt.createInterface(e=>e.singleton(xb));let Lb=class{constructor(e){this.serializer=e}get(e,t){return Ou(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"}));return this.handleResponse(i,t)})}post(e,t){return Ou(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"}));return this.handleResponse(i,t)})}handleResponse(e,t){return Ou(this,void 0,void 0,function*(){var i;if(e.redirected)return window.location.href=e.url,new Promise(()=>{});if(null===(i=t.onResponse)||void 0===i||i.call(t,e),304===e.status)return;if(!e.ok)throw function(e){const t=new Error(`HTTP error: ${e.status} ${e.statusText}`);return t.status=e.status,t.message=e.statusText,t}(e);return(t.serializer||this.serializer).deserialize(e)})}};Lb=Nu([Au(0,xm)],Lb);const Mb=pt.createInterface(e=>e.singleton(Lb)),wb={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},Vp&&Vp.length?JSON.parse(Vp):{})},kb=pt.createInterface(e=>e.instance(wb));var Sb,$b,Eb,Nb;!function(e){e.BASIC="BASIC",e.SSO="SSO",e.JWT="JWT",e.REFRESH="REFRESH"}(Sb||(Sb={}));class Ab extends Error{constructor(e,t,i="Auth Failed \n"){super(i),this.sent=e,this.received=t,Object.setPrototypeOf(this,Ab.prototype)}isIgnorableError(){var e,t,i,o,c,s,n,a;return!!(null===(o=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===o?void 0:o.includes("request needs the user to be logged"))||!!(null===(a=null===(n=null===(s=null===(c=this.received)||void 0===c?void 0:c.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,o;return Array.isArray(null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)?null===(o=null===(i=this.received)||void 0===i?void 0:i.DETAILS)||void 0===o?void 0:o.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"}($b||($b={})),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"}(Eb||(Eb={})),function(e){e.SESSION_NOT_FOUND="SESSION_NOT_FOUND",e.UNKNOWN_MESSAGE_TYPE="UNKNOWN_MESSAGE_TYPE"}(Nb||(Nb={}));const Ob=e=>Array.isArray(e)?e.map(Ob):e&&"object"==typeof e&&e.constructor===Object?Object.keys(e).sort().reduce((t,i)=>(t[i]=Ob(e[i]),t),{}):e;function Tb(e,t){return`${e}::${JSON.stringify(Ob(null!=t?t:{}))}`}const Rb=(e,t)=>!!Array.isArray(null==e?void 0:e.ERROR)&&(null==e?void 0:e.ERROR.some(e=>{var i,o;return(null===(i=e.CODE)||void 0===i?void 0:i.includes(`${t}`))||(null===(o=e.STATUS_CODE)||void 0===o?void 0:o.includes(`${t}`))}));let Ib=class{constructor(e,t){this.session=e,this.uuid=t}createLoginMessage(e){let t;switch(e.type){case Sb.BASIC:t={USER_NAME:e.username,PASSWORD:e.password,MFA_CODE:e.mfaToken};break;case Sb.REFRESH:t={USER_NAME:e.username,REFRESH_AUTH_TOKEN:e.refreshToken,MFA_CODE:e.mfaToken};break;case Sb.SSO:t={SSO_TOKEN:e.ssoToken};break;case Sb.JWT:t={JWT:e.jwt,DOMAIN:e.domain}}return{DETAILS:t,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:Eb.EVENT_LOGIN_AUTH}}createLogoutMessage(e){var t,i;return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:Eb.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:Eb.DATA_LOGON,DETAILS:Object.assign({DATASOURCE_NAME:e},t),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createDataLogoffMessage(e){return{SOURCE_REF:e,MESSAGE_TYPE:Eb.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:Eb.RESOURCES_REQUEST},e)}createMetaRequestMessage(e,t=Eb.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:Eb.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:Eb.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:Eb.EVENT_SELF_SERVICE_PASSWORD_RESET,DETAILS:{USER_NAME:e,RETURN_URL:t}}}createForgotPasswordTokenMessage(e,t,i,o=e){return{USER_NAME:o,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:Eb.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:$b.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:$b.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===Eb.EVENT_LOGOUT&&(i["SESSION-ID"]=e.SESSION_ID),i}createHeartbeatPingMessage(e=!1){return{MESSAGE_TYPE:$b.HEARTBEAT_PING,SOURCE_REF:this.uuid.createId(),VERBOSE:e,DETAILS:{},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}};Ib=Nu([Au(0,Cb),Au(1,Qv)],Ib);const Db=pt.createInterface(e=>e.singleton(Ib));var Fb;let _b=Fb=class{constructor(e,t){this.http=e,this.messageBuilder=t}toHttpHost(e){if(!e)return"";let t=e;return t.startsWith("ws")&&(t=t.replace("ws","http")),t.endsWith("/")||(t=t.concat("/")),t}post(e,t){return this.http.post(Fb.getUrl(e,t),{body:Fb.getBody(t),headers:this.messageBuilder.createHTTPHeadersFromMessage(t)})}get(e,t){return this.http.get(Fb.getUrl(e,t),{headers:this.messageBuilder.createHTTPHeadersFromMessage(t)})}requestServer(e,t){let i=Fb.getUrl(e,t);const o=[];return t.REQUEST&&Object.keys(t.REQUEST).length>0&&Object.keys(t.REQUEST).forEach(e=>{const i=t.REQUEST[e];null==i||Number.isNaN(i)||o.push(`REQUEST.${e}=${encodeURIComponent(String(i))}`)}),t.DETAILS&&Object.keys(t.DETAILS).forEach(e=>{const i=t.DETAILS[e];null==i||Number.isNaN(i)||o.push(`${e}=${encodeURIComponent(String(i))}`)}),o.length>0&&(i=`${i}?${o.join("&")}`),cp.debug(`HTTP transport - REQUEST_SERVER GET URL: ${i}`),this.http.get(i,{headers:this.messageBuilder.createHTTPHeadersFromMessage(t)})}static getBody(e){return JSON.stringify(e)}static getUrl(e,t){const i=t.MESSAGE_TYPE;let o=t.MESSAGE_TYPE.replace(/_/g,"-").toLowerCase();return i===Eb.DATA_LOGON&&(o=t.DETAILS.DATASOURCE_NAME.replace(/_/g,"-").toLowerCase()),`${e}${o}`}};_b=Fb=Nu([Au(0,Mb),Au(1,Db)],_b);const Hb=pt.createInterface(e=>e.singleton(_b));function Pb(e,t,i){const o=e=>"function"==typeof e?e:()=>e,c=o(t),s=o(i);return(t,i)=>e(t,i)?c(t,i):s(t,i)}class Vb{constructor(e){this.path=e}}const Bb=new Set,Ub=Object.freeze({register(e){Bb.add(e)},unregister(e){Bb.delete(e)}}),jb=/^([a-z][a-z0-9+\-.]*:)?\/\//i,qb=Object.freeze({path:Object.freeze({get current(){return location.pathname+location.search},generateRoute(e,t,i={}){return Ou(this,void 0,void 0,function*(){let o="config"in e?e:xy.find(e);for(;null!==o;){const e=yield o.config.generateRouteFromPath(t,i);if(null!==e)return e;o=o.parent}return null})},push(e,t=!0){e&&jb.test(e)?location.href=e:(history.pushState({},document.title,e),t&&qb.path.trigger(e))},replace(e,t=!0){e&&jb.test(e)?location.href=e:(history.replaceState({},document.title,e),t&&qb.path.trigger(e))},trigger(e){const t=new Vb(e);for(const e of Bb)e.enqueue(t)}}),name:Object.freeze({generateRoute(e,t,i={}){return Ou(this,void 0,void 0,function*(){let o="config"in e?e:xy.find(e);for(;null!==o;){const e=yield o.config.generateRouteFromName(t,i);if(null!==e)return e;o=o.parent}return null})},push(e,t,i={},o=!0){return Ou(this,void 0,void 0,function*(){const c=yield qb.name.generateRoute(e,t,i);null!==c&&qb.path.push(c,o)})},replace(e,t,i={},o=!0){return Ou(this,void 0,void 0,function*(){const c=yield qb.name.generateRoute(e,t,i);null!==c&&qb.path.replace(c,o)})},trigger(e,t,i={}){return Ou(this,void 0,void 0,function*(){const o=yield qb.name.generateRoute(e,t,i);null!==o&&qb.path.trigger(o)})}})});class Gb{constructor(){this.queue=[],this.promise=null,this.resolve=null}connect(){this.enqueue(new Vb(qb.path.current)),window.addEventListener("popstate",this),Ub.register(this)}disconnect(){this.queue=[],this.promise=null,this.resolve=null,window.removeEventListener("popstate",this),Ub.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 Vb(qb.path.current))}}const Wb=encodeURIComponent,Yb=e=>Wb(e).replace("%24","$");function Kb(e,t,i){let o=[];if(null==t)return o;if(Array.isArray(t))for(let c=0,s=t.length;c<s;c++)if(i)o.push(`${Yb(e)}=${Wb(t[c])}`);else{const i=e+"["+("object"==typeof t[c]&&null!==t[c]?c:"")+"]";o=o.concat(Kb(i,t[c]))}else if("object"!=typeof t||i)o.push(`${Yb(e)}=${Wb(t)}`);else for(const i in t)o=o.concat(Kb(e+"["+i+"]",t[i]));return o}function Zb(e,t){return Array.isArray(e)?(e.push(t),e):void 0!==e?[e,t]:t}function Qb(e,t,i){let o=e;const c=t.length-1;for(let e=0;e<=c;e++){const s=""===t[e]?o.length:t[e];if(e<c){const i=o[s]&&"object"!=typeof o[s]?[o[s]]:o[s];o=o[s]=i||(isNaN(t[e+1])?{}:[])}else o=o[s]=i}}const Xb=Object.freeze({get current(){return location.search},build(e,t){let i=[];const o=Object.keys(e||{}).sort();for(let c=0,s=o.length;c<s;c++){const s=o[c];i=i.concat(Kb(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 o=i.replace(/\+/g," ").split("&");for(let e=0;e<o.length;e++){const i=o[e].split("="),c=decodeURIComponent(i[0]);if(!c)continue;let s=c.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?Qb(t,s,e):t[c]=Zb(t[c],e)}else t[c]=!0}return t}}),Jb=e=>e;class ey{constructor(e,t,i){this.path=e,this.name=t,this.caseSensitive=i}}class ty{constructor(e,t,i,o){this.route=e,this.paramNames=t,this.paramTypes=i,this.settings=o}get path(){return this.route.path}}class iy{constructor(e,t,i,o){this.endpoint=e,this.params=t,this.typedParams=i,this.queryParams=o,this.allParams=Object.assign(Object.assign({},t),o),this.allTypedParams=Object.assign(Object.assign({},i),o)}get settings(){return this.endpoint.settings}}class oy{constructor(e,t,i,o){var c;this.chars=e,this.states=t,this.skippedStates=i,this.result=o,this.head=t[t.length-1],this.endpoint=null===(c=this.head)||void 0===c?void 0:c.endpoint}advance(e){const{chars:t,states:i,skippedStates:o,result:c}=this;let s=null,n=0;const a=i[i.length-1];function r(l,d){if(l.isMatch(e)&&(1===++n?s=l:c.add(new oy(t.concat(e),i.concat(l),null===d?o:o.concat(d),c))),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&&c.remove(this)}finalize(){!function e(t,i){const o=i.nextStates;if(null!==o)if(1===o.length&&null===o[0].segment)e(t,o[0]);else for(const i of o)if(i.isOptional&&null!==i.endpoint){if(t.push(i),null!==i.nextStates)for(const o of i.nextStates)e(t,o);break}}(this.skippedStates,this.head)}getParams(){const{states:e,chars:t,endpoint:i}=this,o={};for(const e of i.paramNames)o[e]=void 0;for(let i=0,c=e.length;i<c;++i){const c=e[i];if(c.isDynamic){const e=c.segment.name;void 0===o[e]?o[e]=t[i]:o[e]+=t[i]}}return o}compareTo(e){const t=this.states,i=e.states;for(let e=0,o=0,c=Math.max(t.length,i.length);e<c;++e){let c=t[e];if(void 0===c)return 1;let s=i[o];if(void 0===s)return-1;let n=c.segment,a=s.segment;if(null===n){if(null===a){++o;continue}if(void 0===(c=t[++e]))return 1;n=c.segment}else if(null===a){if(void 0===(s=i[++o]))return-1;a=s.segment}if(n.kind<a.kind)return 1;if(n.kind>a.kind)return-1;++o}const o=this.skippedStates,c=e.skippedStates,s=o.length,n=c.length;if(s<n)return 1;if(s>n)return-1;for(let e=0;e<s;++e){const t=o[e],i=c[e];if(t.length<i.length)return 1;if(t.length>i.length)return-1}return 0}}function cy(e){return null!==e.head.endpoint}function sy(e,t){return e.compareTo(t)}class ny{constructor(e){this.candidates=[],this.candidates=[new oy([""],[e],[],this)]}get isEmpty(){return 0===this.candidates.length}getSolution(){const e=this.candidates.filter(cy);if(0===e.length)return null;for(const t of e)t.finalize();return e.sort(sy),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 ay{constructor(){this.names=new Map,this.paths=new Map,this.rootState=new ry(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,o=new ey(e.path,e.name||"",!0===e.caseSensitive),c=""===i?[""]:i.split("/").filter(ly),s=[],n=[];let a=this.rootState;const r=[];for(const e of c)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("?"),o=i?t[0].slice(0,-1):t[0];s.push(o);const c=new hy(o,i);r.push(c),a=c.appendTo(a);break}case"*":{const t=e.slice(1);s.push(t),n.push("string");const i=new uy(t);r.push(i),a=i.appendTo(a);break}default:{const t=new dy(e,o.caseSensitive);r.push(t),a=t.appendTo(a);break}}const l=new ty(o,s,n,t||null);a.setEndpoint(l),this.paths.set(i,r),e.name&&this.names.set(e.name,r)}recognize(e,t={}){return Ou(this,void 0,void 0,function*(){const i=Xb.separate(e),o=Xb.parse(i.queryString);(e=decodeURI(i.path)).startsWith("/")||(e=`/${e}`),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1));const c=new ny(this.rootState);for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(c.advance(i),c.isEmpty)return null}const s=c.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],o=t[r[e]]||Jb,c=l[i],s=yield o(c);d[i]=s}return new iy(n,l,d,o)})}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),o={};let c="";for(let t=0,s=e.length;t<s;t++){const s=e[t],n=s.generate(i,o);if(null==n){if(s instanceof hy&&!s.optional)throw new Error(`A value is required for route parameter '${s.name}'.`)}else c+="/",c+=n}"/"!==c.charAt(0)&&(c="/"+c);for(const e in o)delete i[e];const s=Xb.build(i);return c+=s?`?${s}`:"",c}}class ry{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,o=this.nextStates;return null===o?(i=void 0,o=this.nextStates=[]):i=null===e?o.find(e=>e.value===t):o.find(t=>{var i;return null===(i=t.segment)||void 0===i?void 0:i.equals(e)}),void 0===i&&o.push(i=new ry(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 ly(e){return e.length>0}class dy{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 o=0;o<i;++o)e=e.append(this,t.charAt(o));else for(let o=0;o<i;++o){const i=t.charAt(o);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 hy{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 uy{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 py="fast-child-route";function fy(e,t){return"command"in t?t.command:"redirect"in t?new Ty(t.redirect):Fy.fromDefinition(e,t)}const my=e=>{if(null==e)return!1;switch(e.toLowerCase().trim()){case"true":case"yes":case"1":return!0;default:return!1}},gy={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:my,bool:my};class vy{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 Oy),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 o=Object.assign(Object.assign(Object.assign({},t),i),{path:`${t.path}/${i.path}`});if("title"in t||"title"in i){const c=t.title||"",s=i.title||"";o.title=e.joinTitles(c,s)}if("name"in i){const e=t.name?t.name+"/":"";o.name=e+i.name}return o.children===t.children&&delete o.children,o});this.map(...i);continue}let e;if(e="command"in t?t.command:"redirect"in t?new Ty(t.redirect):Fy.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+`/*${py}`});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,o){return Ou(this,void 0,void 0,function*(){const c=yield e();return fy(t,c).createContributor(i,o)})}}:fy(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 Ou(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=Xb.separate(e),i=Xb.parse(t.queryString);return{route:new iy(new ty(new ey("*","",!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({},gy),this.converters):Object.assign(Object.assign({},this.owner.parent.routes.aggregateConverters()),this.converters)}}const by="$router";function yy(e){const t=e.parentElement;if(t)return t;{const t=e.getRootNode();if(t.host instanceof HTMLElement)return t.host}return null}function zy(e){let t=e;for(;t=yy(t);)if(by in t)return t[by];return null}const xy=Object.freeze({getOrCreateFor(e){const t=e[by];return void 0!==t?t:e[by]=new Cy(e)},find:e=>e[by]||zy(e),from(e){class t extends e{constructor(){super(),xy.getOrCreateFor(this)}get config(){return this[by].config}set config(e){this[by].config=e}}const i=t.prototype;if("connectedCallback"in i){const e=i.connectedCallback;i.connectedCallback=function(){e.call(this),this[by].connect()}}else i.connectedCallback=function(){this[by].connect()};if("disconnectedCallback"in i){const e=i.disconnectedCallback;i.disconnectedCallback=function(){e.call(this),this[by].disconnect()}}else i.disconnectedCallback=function(){this[by].disconnect()};return t}});class Cy{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=>Ou(this,void 0,void 0,function*(){const t=this.config.createNavigationProcess();yield t.run(this,e),this.navigationQueue.receive().then(this.onNavigationMessage)}),e[by]=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=zy(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,o=null===(t=this.route)||void 0===t?void 0:t.allParams;if(JSON.stringify(o)===JSON.stringify(i))return!1}return!0}beginRender(e,t){return Ou(this,void 0,void 0,function*(){return this.newRoute=e,this.newView=yield t.createView(),this.newView.bind(e.allTypedParams,Ly.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 Ou(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 Ou(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 Ou(this,void 0,void 0,function*(){yield this.tunnel(e)})}leave(e){return Ou(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 Ou(this,void 0,void 0,function*(){if(null!==this.parent){const t=e.route.allParams[py]||"",i=yield this.config.recognizeRoute(t);if(null===i){return this.config.createEventSink().onUnhandledNavigationMessage(this,new Vb(t)),void e.cancel()}this.childRoute=i.route,this.childCommandContributor=yield i.command.createContributor(this,i.route)}yield this.tunnel(e)})}enter(e){return Ou(this,void 0,void 0,function*(){yield this.tunnel(e)})}commit(e){return Ou(this,void 0,void 0,function*(){yield this.tunnel(e)})}tunnel(e){return Ou(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 o=[...this.config.findContributors(e.name),...Array.from(this.contributors)];for(const t of o)if(yield e.evaluateContributor(t,void 0,this),e.canceled)return})}}const Ly=Object.freeze({create:e=>Object.create(z,{router:{value:e}})}),My=Object.freeze({default:Object.freeze({begin(e,t,i){return Ou(this,void 0,void 0,function*(){})},rollback(e,t,i){return Ou(this,void 0,void 0,function*(){})},commit(e,t,i){return Ou(this,void 0,void 0,function*(){})}})});class wy{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 Ou(this,void 0,void 0,function*(){this.runBeforeCommit&&this.apply(e)})}afterCommit(e){return Ou(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 ky=Object.freeze({default:new wy(W`<slot></slot>`)});function Sy(e,t){return t in e}const $y={lifecycle:!0,parameters:!0};class Ey extends x{constructor(e){super(),this.options=e}createPlaceholder(e){return u.createCustomAttributePlaceholder("fast-navigation-contributor",e)}createBehavior(e){return new Ny(e,this.options)}}class Ny{constructor(e,t){this.contributor=e,this.options=t,this.router=null}bind(e,t){if(this.options.lifecycle&&(this.router=t.router||xy.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 Ay(e){return new Ey(Object.assign({},$y,e))}class Oy{createContributor(){return Ou(this,void 0,void 0,function*(){return{navigate(e){return Ou(this,void 0,void 0,function*(){e.cancel()})}}})}}class Ty{constructor(e){this.redirect=e}createContributor(){return Ou(this,void 0,void 0,function*(){const e=this.redirect;return{navigate(t){return Ou(this,void 0,void 0,function*(){const i=t.router.config,o=(yield i.generateRouteFromName(e,t.route.allParams))||(yield i.generateRouteFromPath(e,t.route.allParams));if(null===o)throw new Error(`Invalid redirect. Name or path not found: ${e}`);t.cancel(()=>Ou(this,void 0,void 0,function*(){return qb.path.replace(o)}))})}}})}}function Ry(e){return W`<${e} ${Ay()}></${e}>`}function Iy(e){const t=document.createDocumentFragment();t.appendChild(e);const i=new j(t,[Ay().createBehavior(e)]);return{create:()=>i}}class Dy{constructor(e,t,i){this.router=e,this.route=t,this.command=i}construct(e){return Ou(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 Ou(this,void 0,void 0,function*(){yield this.operation.commit(),this.command.title&&e.setTitle(this.command.title)})}}class Fy{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 Ou(this,void 0,void 0,function*(){return new Dy(e,t,this)})}static fromDefinition(e,t){let i;i="template"in t?()=>Ou(this,void 0,void 0,function*(){let e=t.template;return"function"==typeof e&&(e=yield e()),e.create()}):()=>Ou(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=Ry(t.name);else if(e=yield e(),"string"==typeof e)i=Ry(e);else if(e instanceof HTMLElement)i=Iy(e);else{if(t=ue.forType(e),!t)throw new Error("Invalid value for element in route config.");i=Ry(t.name)}}else e instanceof HTMLElement?t.factory=i=Iy(e):t.factory=i=Ry(e);return i.create()});const o=new Fy(e,i);return t.layout&&(t.layout instanceof q?o.layout=new wy(t.layout):o.layout=t.layout),t.transition&&(o.transition=t.transition),t.title&&(o.title=t.title),o}}class _y{constructor(){this.handler=e=>{const{shouldHandleEvent:t,href:i}=this.getEventInfo(e);t&&(e.preventDefault(),qb.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 o=i.getAttribute("href");t.anchor=i,t.href=o;const c=1===e.which,s=o&&!("#"===o.charAt(0)||/^[a-z]+:/i.test(o));return t.shouldHandleEvent=c&&!!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 Hy{constructor(e,t,i,o,c){this.name=e,this.commitActions=o,this.cancelActions=c,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 Ou(this,void 0,void 0,function*(){Sy(e,this.name)&&(this.routes.push(t),this.routers.push(i),yield e[this.name](this),this.routes.pop(),this.routers.pop())})}}class Py{constructor(){this.phases=["navigate","leave","construct","enter","commit"]}run(e,t){return Ou(this,void 0,void 0,function*(){const i=e.config.createEventSink(),o=yield e.config.recognizeRoute(t.path);if(null===o)return void i.onUnhandledNavigationMessage(e,t);const c=o.route,s=o.command;i.onNavigationBegin(e,c,s);const n=[],a=[];let r=n;const l=[yield s.createContributor(e,c),e,this];for(const t of this.phases){const o=new Hy(t,c,e,n,a);if(i.onPhaseBegin(o),o.canceled)r=a;else for(const e of l)if(yield o.evaluateContributor(e),o.canceled){r=a;break}if(i.onPhaseEnd(o),o.canceled)break}yield Promise.all(r.map(e=>e())).then(()=>i.onNavigationEnd(e,c,s))})}commit(e){const t=e.router.config.createTitleBuilder();document.title=t.buildTitle(e.router.config.title,e.titles)}}class Vy{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 By{onUnhandledNavigationMessage(e,t){}onNavigationBegin(e,t,i){}onPhaseBegin(e){}onPhaseEnd(e){}onNavigationEnd(e,t,i){}}class Uy{constructor(){this.isConfigured=!1,this.routes=new vy(this),this.contributors=[],this.defaultLayout=ky.default,this.defaultTransition=My.default,this.title="",this.parent=null}createNavigationQueue(){return this.construct(Gb)}createLinkHandler(){return this.construct(_y)}createNavigationProcess(){return new Py}createEventSink(){return this.construct(By)}createTitleBuilder(){return this.construct(Vy)}createRouteRecognizer(){return this.construct(ay)}construct(e){return null!==this.parent?this.parent.construct(e):new e}recognizeRoute(e){return Ou(this,void 0,void 0,function*(){return yield this.ensureConfigured(),this.routes.recognize(e)})}generateRouteFromName(e,t){return Ou(this,void 0,void 0,function*(){return yield this.ensureConfigured(),this.routes.generateFromName(e,t)})}generateRouteFromPath(e,t){return Ou(this,void 0,void 0,function*(){return yield this.ensureConfigured(),this.routes.generateFromPath(e,t)})}findContributors(e){return this.contributors.filter(t=>Sy(t,e))}cached(e){let t=null;return()=>Ou(this,void 0,void 0,function*(){return null===t&&(t=new e),t})}ensureConfigured(){return Ou(this,void 0,void 0,function*(){this.isConfigured||(yield this.configure(),this.isConfigured=!0)})}}let jy=class extends(xy.from(be)){};jy=Nu([ye("fast-router")],jy);const qy=[];setTimeout(()=>{qy.length&&console.warn(`${qy.length} attribute deprecation notice(s):\n ${qy.join("\n")}`)},5e3);const Gy="reauthActionLock";var Wy;function Yy(){return Ou(this,arguments,void 0,function*(e={}){const{reloadOnFailure:t=!0}=e;if(function(){const e=parseInt(localStorage.getItem(Gy)||"0");Date.now()-e>3e4&&localStorage.removeItem(Gy)}(),localStorage.getItem(Gy)||(localStorage.setItem(Gy,Date.now().toString()),0))return Wy.HANDLED_BY_OTHER_TAB;try{if(yield function(){return Ou(this,void 0,void 0,function*(){const e=yield fetch(Wp,{credentials:"include"});return"EVENT_LOGIN_DETAILS_ACK"===(yield e.json()).MESSAGE_TYPE})}())return Wy.ALREADY_VALID;return(yield function(){return Ou(this,void 0,void 0,function*(){const e=pt.getOrCreateDOMContainer().get(Mb);return"EVENT_LOGIN_AUTH_ACK"===(yield e.post(Gp,{body:JSON.stringify({DETAILS:{},MESSAGE_TYPE:"EVENT_LOGIN_AUTH"})})).MESSAGE_TYPE})}())?Wy.SUCCESS:(t&&window.location.reload(),Wy.FAILED)}finally{localStorage.removeItem(Gy)}})}!function(e){e.SUCCESS="SUCCESS",e.FAILED="FAILED",e.HANDLED_BY_OTHER_TAB="HANDLED_BY_OTHER_TAB",e.ALREADY_VALID="ALREADY_VALID"}(Wy||(Wy={}));const Ky=(e,t)=>((null==t?void 0:t.ROW)&&e&&e.length>0?t.ROW.forEach(t=>{const i=t;if(i&&i.DETAILS){const o=i.DETAILS.ROW_REF,c=i.DETAILS.OPERATION;"INSERT"===c&&(e.find(e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===o})||e.unshift(i)),"DELETE"===c&&(e=e.filter(e=>{var i,o;return(null===(i=t.DETAILS)||void 0===i?void 0:i.ROW_REF)!==(null===(o=e.DETAILS)||void 0===o?void 0:o.ROW_REF)})),"MODIFY"===c&&(e=e.map(e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===o?Object.assign(Object.assign({},e),i):e}))}}):!t||e&&0!==e.length||(e=[...new Set(t.ROW)]),e);var Zy;let Qy=Zy=class{get isConnected(){return this._isConnected}set isConnected(e){this._isConnected=e,this.isConnectedSubject.next(this._isConnected)}constructor(e,t,i,o,c,s,n){var a;this.http=e,this.messageBuilder=t,this.session=i,this.metaCache=o,this.serializer=c,this.config=s,this.transport=n,this.isWorking=!1,this._isConnected=!1,this.isConnectedSubject=new ig(this._isConnected),this.isConnected$=null===(a=this.isConnectedSubject)||void 0===a?void 0:a.asObservable(),this.ongoingTurbo={},this.streams=new Map,this.inFlightRequests=new Map,this.ongoingRefresh=null}handleSessionRefresh(){return this.ongoingRefresh||(this.ongoingRefresh=(()=>Ou(this,void 0,void 0,function*(){const e=this.host;this.disconnect();let t=yield Yy();return t===Wy.HANDLED_BY_OTHER_TAB&&(yield new Promise(e=>{setTimeout(e,Zy.REAUTH_WAIT_MS)}),t=yield Yy()),(t===Wy.SUCCESS||t===Wy.ALREADY_VALID)&&(this.connect(e),!0)}))().finally(()=>{this.ongoingRefresh=null})),this.ongoingRefresh}checkHost(){return Ou(this,void 0,void 0,function*(){try{return this.getMessage({MESSAGE_TYPE:$b.HEARTBEAT_PING,SOURCE_REF:"host check"}).then(e=>e.MESSAGE_TYPE===$b.HEARTBEAT_PONG)}catch(e){return cp.error(e),!1}})}send(e,t){return Ou(this,void 0,void 0,function*(){if(this.ongoingRefresh){if(!(yield this.ongoingRefresh))throw new Error("Cannot send message: session refresh failed")}return this.transport.post(this.host,e)})}httpMode(){return!0}setValidSession(e){cp.deprecated("setValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}connect(e){return Ou(this,void 0,void 0,function*(){return this.host=this.transport.toHttpHost(e),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 Ou(this,void 0,void 0,function*(){const i=this.messageBuilder.createDataLogonMessage(e,t);return cp.debug(`HTTP MODE - ${i.MESSAGE_TYPE} (snapshot) message created -> `,i),this.send(i).then(e=>(this.dataLogoff(i.SOURCE_REF).catch(e=>cp.error(e)),e))})}stream(e,t,i,o){var c,s;const n=this.messageBuilder.createDataLogonMessage(e,o);cp.debug(`HTTP MODE - ${n.MESSAGE_TYPE} (stream) message created -> `,n);const a=n.SOURCE_REF,r=(null===(s=null===(c=this.config.polling)||void 0===c?void 0:c.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 ig(r),RESOURCE_NAME:e});const l=this.streams.get(a).POLLING_FREQUENCY,d=lv(Yg(this.send(n)),l.pipe(hv(()=>"visible"===document.visibilityState)).pipe(fv(e=>{return void 0===(t=e)&&(t=0),void 0===i&&(i=xg),t<0&&(t=0),dv(t,t,i);var t,i})).pipe(fv(()=>Yg(this.getMessage(n))))).pipe(mv(()=>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,o=void 0===i?1/0:i,c=t.delay,s=t.resetOnSuccess,n=void 0!==s&&s;return o<=0?Um:Wm(function(e,t){var i,s=0,a=function(){var r=!1;i=e.subscribe(Ym(t,function(e){n&&(s=0),t.next(e)},void 0,function(e){if(s++<o){var n=function(){i?(i.unsubscribe(),i=null,a()):r=!0};if(null!=c){var l="number"==typeof c?dv(c):Vg(c(e,s)),d=Ym(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:Zy.MAX_RETRIES,delay:(e,t)=>{const i=e;cp.error(`Retry ${t}/${Zy.MAX_RETRIES}:`,i.status,i);if(!(0===i.status||i.status&&i.status>=vb.BAD_REQUEST&&i.status<vb.INTERNAL_SERVER_ERROR))throw e;return i.status===vb.NOT_FOUND&&this.streams.delete(a),i.status===vb.UNAUTHORIZED?Yg(this.handleSessionRefresh()):dv(Zy.RETRY_DELAY_MS)}}),(h=()=>{cp.debug(`Terminating stream for ${e} - ${a}`),this.dataLogoff(a)},Wm(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=()=>{},o,c=[]){return this.stream(e,t,i,o).pipe(uv(Ky,c))}streamWithoutAutoTeardown(e,t,i,o){return cp.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0"),this.stream(e,t,i,o)}getMessage(e){return Ou(this,void 0,void 0,function*(){if(this.ongoingRefresh){if(!(yield this.ongoingRefresh))throw new Error("Cannot get message: session refresh failed")}return this.transport.get(this.host,e)})}getMoreRows(e){return Ou(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreRowsMessage(e);return cp.debug(`HTTP MODE - ${t.MESSAGE_TYPE} message created -> `,t),this.send(t)})}getMoreColumns(e){return Ou(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.send(t)})}dataLogoff(e){return Ou(this,void 0,void 0,function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return this.send(t).then(t=>(this.streams.has(e)&&(cp.debug(`Removing stream ${e}`),this.streams.delete(e)),t))})}getMetadata(e){return Ou(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasMetadataFor(e))return cp.debug(`HTTP MODE - Cached metadata retrieved for ${e}`),this.metaCache.getMetadataFor(e);const i=this.messageBuilder.createMetaRequestMessage(e);cp.debug(`HTTP MODE - ${i.MESSAGE_TYPE} (metadata) message created -> `,i);const o=yield this.send(i).then(e=>e.DETAILS);return Object.keys(o).length&&this.metaCache.setMetadataFor(e,o),o})}getJSONSchema(e){return Ou(this,void 0,void 0,function*(){const t=this.messageBuilder.createMetaRequestMessage(e,Eb.JSON_SCHEMA_REQUEST);return cp.debug(`HTTP MODE! - ${t.MESSAGE_TYPE} (json schema) message created -> `,t),this.send(t)})}request(e,t){return Ou(this,arguments,void 0,function*(e,t,i=!1){const o=Tb(e,t);if(i&&this.metaCache.hasRequestFor(o))return cp.debug(`HTTP MODE - Cached request response retrieved for ${o}`),this.metaCache.getRequestFor(o);const c=this.inFlightRequests.get(o);if(c)return cp.debug(`HTTP MODE - In-flight request collapsed for ${o}`),c;const s=this.messageBuilder.createRequestMessage(e,t);cp.debug(`HTTP MODE! - ${s.MESSAGE_TYPE} (request server) message created -> `,s);const n=this.transport.requestServer(this.host,s).finally(()=>{this.inFlightRequests.delete(o)});this.inFlightRequests.set(o,n);const a=yield n;return i&&a&&this.metaCache.setRequestFor(o,a),a})}getAvailableResources(e){return Ou(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasResources())return cp.debug("HTTP MODE - Cached resources retrieved"),this.metaCache.getResources();const i=this.messageBuilder.createResourcesMessage(e);cp.debug(`HTTP MODE! - ${i.MESSAGE_TYPE} (getResources) message created -> `,i);const o=yield this.send(i);return this.metaCache.setResources(o),o})}commitEvent(e,t){return Ou(this,void 0,void 0,function*(){const i=this.messageBuilder.createCommitMessage(e,t);return cp.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 cp.debug(`${e} polling frequency is already accelerated.`);const o=this.config.polling.POLLING_MAP[e];if(!(null==o?void 0:o.TEMP_FREQUENCY)||!o.AMOUNT_OF_POLLS)return;const c=o.TEMP_FREQUENCY,s=c*o.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 o.QUERIES)a[e]=c,n[e]||(n[e]=this.config.polling.POLLING_FREQUENCY);cp.debug(`${e} TRIGGERED -> ENFORCING TURBO | FREQUENCY=${c}ms DURATION=${s}`),this.ongoingTurbo[e]=!0,this.updateIntervals({polling:{POLLING_INTERVAL_MAP:a}}),setTimeout(()=>{cp.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,cp.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)})}}};Qy.REAUTH_WAIT_MS=5e3,Qy.RETRY_DELAY_MS=1e3,Qy.MAX_RETRIES=3,Nu([g],Qy.prototype,"host",void 0),Nu([g],Qy.prototype,"isWorking",void 0),Nu([g],Qy.prototype,"_isConnected",void 0),Nu([v],Qy.prototype,"isConnected",null),Qy=Zy=Nu([Au(0,Mb),Au(1,Db),Au(2,Cb),Au(3,ib),Au(4,xm),Au(5,kb),Au(6,Hb)],Qy);const Xy=pt.createInterface(e=>e.singleton(Qy));var Jy={url:"",deserializer:function(e){return JSON.parse(e.data)},serializer:function(e){return JSON.stringify(e)}},ez=function(e){function t(t,i){var o=e.call(this)||this;if(o._socket=null,t instanceof jm)o.destination=i,o.source=t;else{var c=o._config=$u({},Jy);if(o._output=new eg,"string"==typeof t)c.url=t;else for(var s in t)t.hasOwnProperty(s)&&(c[s]=t[s]);if(!c.WebSocketCtor&&WebSocket)c.WebSocketCtor=WebSocket;else if(!c.WebSocketCtor)throw new Error("no WebSocket constructor can be found");o.destination=new cg}return o}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 cg),this._output=new eg},t.prototype.multiplex=function(e,t,i){var o=this;return new jm(function(c){try{o.next(e())}catch(e){c.error(e)}var s=o.subscribe({next:function(e){try{i(e)&&c.next(e)}catch(e){c.error(e)}},error:function(e){return c.error(e)},complete:function(){return c.complete()}});return function(){try{o.next(t())}catch(e){c.error(e)}s.unsubscribe()}})},t.prototype._connectSocket=function(){var e=this,t=this._config,i=t.WebSocketCtor,o=t.protocol,c=t.url,s=t.binaryType,n=this._output,a=null;try{a=o?new i(c,o):new i(c),this._socket=a,s&&(this._socket.binaryType=s)}catch(e){return void n.error(e)}var r=new km(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 o=e.destination;e.destination=Im.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()}),o&&o instanceof cg&&r.add(o.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}(tg);const tz=1e4,iz=6e4;var oz;!function(e){e.Linear="linear",e.Exponential="exponential"}(oz||(oz={}));const cz=(e,t)=>{const{reconnectInterval:i=tz}=e,o=i>iz?iz:i,c=Math.round(Math.log2(iz/o));return o*Math.pow(2,t%c)},sz=e=>{const{reconnectInterval:t=tz}=e;return t>iz?iz:t};class nz{constructor(){this.isConfigured=!1,this.isConnecting=!1,this.isConnected=!1,this.isReconnecting=!1,this.reconnectionLimitReached=!1,this.isConnectedSubject=new ig(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}}Nu([g],nz.prototype,"isConfigured",void 0),Nu([g],nz.prototype,"isConnecting",void 0),Nu([g],nz.prototype,"isConnected",void 0),Nu([g],nz.prototype,"isReconnecting",void 0),Nu([g],nz.prototype,"reconnectionLimitReached",void 0),Nu([g],nz.prototype,"closedCode",void 0),Nu([g],nz.prototype,"closedReason",void 0),Nu([g],nz.prototype,"closedClean",void 0),Nu([eb],nz.prototype,"user",void 0);const az=pt.createInterface(e=>e.singleton(nz));class rz{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 lz extends eg{constructor(){super()}}class dz{constructor(e,t,i,o){this._message=e,this._onMessage=t,this._onError=i,this._isSubscription=o}get sentMessage(){return this._message}get onReceivedMessage(){return this._onMessage}get onReceivedError(){return this._onError}get isSubscription(){return this._isSubscription}}let hz=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 cp.deprecated("get hasValidSession","Use `User.isAuthenticated` from `@genesislcap/foundation-user` instead.","15.0.0"),this.user.isAuthenticated}set hasValidSession(e){cp.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:Pp}constructor(e,t,i,o,c,s,n){this.messageBuilder=e,this.session=t,this.serializer=i,this.uuid=o,this.status=c,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=Pp,t,i){var o;return this.url=e,this.connectOptions=null!=t?t:this.config.connect,this.reconnectOptions=null!=i?i:this.config.reconnect,(null===(o=this.config.isWebSocketExpression)||void 0===o?void 0:o.test(this.host))?new Promise(e=>{var t,i,o,c;cp.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 ez({url:this.url,openObserver:{next:()=>{this.session.setSessionStorageItem("hostUrl",this.url),this.status.isConnected=!0,this.prepareHeartbeat(),cp.info("WebSocket connection is now open"),e(this.isConnected)}},closeObserver:{next:t=>{this.status.onClose(t),this.isDisconnectedByServer&&cp.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!==(c=null===(o=this.connectOptions)||void 0===o?void 0:o.connectObserver)&&void 0!==c?c:{next:e=>Ou(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,cp.info,i);const{SOURCE_REF:o,MESSAGE_TYPE:c}=e,s=this.getMessageHandler(o,c);if(!s)return void(e.MESSAGE_TYPE===$b.MSG_NACK&&e.ERROR&&e.ERROR.forEach(t=>{cp.error(`MessageType: ${e.MESSAGE_TYPE} | Error Details:`,t)}));let n=!1;switch(e.MESSAGE_TYPE){case Eb.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 $b.LOGOUT_ACK:return s.onReceivedMessage.call(this,e),void this.cleanMessages();case $b.LOGON_ACK:return;case $b.LOGOFF_ACK:break;case $b.QUERY_UPDATE:s.isSubscription||this.sendDataLogoff(o);break;case $b.MSG_NACK:case $b.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(o)}),error:e=>{cp.debug("Error found: ",e),this.reconnect()},complete:()=>{var e;this.isDisconnectedByServer&&(null===(e=this.connectOptions)||void 0===e?void 0:e.alwaysOn)?this.reconnect():cp.info("Connection is now closed")}}),this.status.isConfigured=!0}):(cp.error(`Specified host (${this.host}) is not valid WebSocket url. Connection will not proceed.`),void cp.warn("Make sure the host url starts with wss:// or ws://"))}handleExpiredSession(){return Ou(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 Ou(this,void 0,void 0,function*(){const e=yield Yy();e!==Wy.HANDLED_BY_OTHER_TAB?e!==Wy.FAILED&&(yield this.connect()):function(e){const t=i=>{i.key===Gy&&null===i.newValue&&(e(),window.removeEventListener("storage",t))};window.addEventListener("storage",t)}(()=>this.connect())})}updateSessionAndSubscriptions(e){(null==e?void 0:e.MESSAGE_TYPE)===Eb.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,o;this.heartbeatTicker&&this.heartbeatTicker.stop();const c=()=>Ou(this,void 0,void 0,function*(){var e,t,i;if(!this.isConnected)return;const o=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(o);const c=yield this.send(o);this.user.isAuthenticated&&!c.IS_AUTHENTICATED&&this.handleExpiredSession(),(null===(i=this.connectOptions)||void 0===i?void 0:i.heartbeatPongCallback)&&this.connectOptions.heartbeatPongCallback(c),this.heartbeatIsEnabled=c.MESSAGE_TYPE===$b.HEARTBEAT_PONG&&c.SOURCE_REF===o.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!==(o=null===(i=this.connectOptions)||void 0===i?void 0:i.heartbeatInterval)&&void 0!==o?o:this.heartbeatInterval;this.heartbeatTicker=new rz(e),this.heartbeatTicker.start(()=>{this.websocket&&this.isConnected&&(c(),this.heartbeatLoggingIsEnabled&&cp.debug(`Sending a heartbeat ping every ${e} ms`))})}}reconnect(){var e,t,i,o,c;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)===oz.Exponential?cz:sz,a=this.isConnectedSubject.asObservable().pipe(fv(e=>e?Kg(-1):((e,t)=>new jm(i=>{let o,c=0;return function s(){i.next(c),clearTimeout(o),o=setTimeout(s,t(e,c)),c+=1}(),()=>{clearTimeout(o)}}))(this.reconnectOptions,n).pipe(av(e=>{var t,i,o;let c;return c=(null===(t=this.connectOptions)||void 0===t?void 0:t.alwaysOn)?e+1:null!==(o=null===(i=this.reconnectOptions)||void 0===i?void 0:i.reconnectAttempts)&&void 0!==o?o:10,e<c?Kg(e):(this.status.reconnectionLimitReached=!0,Zg(()=>new Error(`Max reconnect attempts ${c} reached.`)))}))),mv(()=>this.websocket&&!this.isConnected));a.subscribe(null!==(c=null===(o=this.reconnectOptions)||void 0===o?void 0:o.reconnectObserver)&&void 0!==c?c:{next:e=>{cp.debug(`Attempt no. ${e+1} to reconnect`),this.websocket.complete(),this.connect(this.url,this.connectOptions,this.reconnectOptions)},error:e=>{var t;cp.debug(e),null===(t=this.socketSubscription)||void 0===t||t.unsubscribe(),this.status.isReconnecting=!1},complete:()=>{cp.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 lz,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,cp.info,i),new Promise((i,o)=>{const c=e=>{i(e)},s=e=>{o(e)};t&&this.setMessageHandler(e,c,s),this.websocket.next(e)})}sendForStream(e,t,i,o){if(!this.isConnected)return Zg(()=>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,cp.info,c),this.setMessageHandler(e,t,i,!0),u.queueUpdate(()=>this.websocket.next(e)),new jm(t=>{const i=this.wsMessages.pipe(hv(t=>t.SOURCE_REF===e.SOURCE_REF)).subscribe({next:e=>{t.next(e)},error:e=>{t.error(e)},complete:()=>{t.complete()}});return()=>{i.unsubscribe(),this.sendDataLogoff(e.SOURCE_REF),this.removeMessageHandler(e.SOURCE_REF),o&&o()}})}sendForStreamWithoutTeardown(e,t,i){if(!this.isConnected)return Zg(()=>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,cp.info,o),this.setMessageHandler(e,t,i,!0),this.websocket.next(e),this.wsMessages.pipe(hv(t=>t.SOURCE_REF===e.SOURCE_REF))}setMessageHandler(e,t,i,o=!1){const c=`Setting Message Handler for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,cp.debug,c),this.wsMessageHandlers.set(e.SOURCE_REF,new dz(e,t,i,o))}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,cp.debug,i),this.wsMessageHandlers.get(e)}logMessageTypeFlow(e,t,i){switch(e){case Eb.DATA_LOGOFF:t(i);break;case $b.HEARTBEAT_PING:case $b.HEARTBEAT_PONG:this.heartbeatLoggingIsEnabled&&t(i);break;default:this.messageLoggingIsEnabled&&t(i)}}};Nu([g],hz.prototype,"websocket",void 0),Nu([g],hz.prototype,"wsMessages",void 0),Nu([g],hz.prototype,"wsMessageHandlers",void 0),Nu([Mb],hz.prototype,"http",void 0),Nu([g],hz.prototype,"heartbeatIsEnabled",void 0),hz=Nu([Au(0,Db),Au(1,Cb),Au(2,xm),Au(3,Qv),Au(4,az),Au(5,eb),Au(6,pb)],hz);const uz=pt.createInterface(e=>e.singleton(hz));let pz=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,o,c,s){this.socket=e,this.messageBuilder=t,this.metaCache=i,this.events=o,this.config=c,this.transport=s,this.isWorking=!1,this.inFlightRequests=new Map}httpMode(){return!1}get useHttpReqRep(){return"true"===_p||Rp("forceHttpReqRep")}get httpHost(){return this.transport.toHttpHost(this.socket.host)}sendReqRep(e){return this.useHttpReqRep?this.transport.post(this.httpHost,e):this.socket.send(e)}setValidSession(e){cp.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 Ou(this,arguments,void 0,function*(e=Pp){return this.socket.reset(),this.socket.connect(e,this.config.connect,this.config.reconnect)})}disconnect(){this.socket.reset()}snapshot(e,t){return Ou(this,void 0,void 0,function*(){const i=this.messageBuilder.createDataLogonMessage(e,t);return cp.debug(`${i.MESSAGE_TYPE} (snapshot) message created -> `,i),this.socket.send(i)})}stream(e,t,i,o){const c=this.messageBuilder.createDataLogonMessage(e,o);cp.debug(`${c.MESSAGE_TYPE} (stream) message created -> `,c);const s=performance.now();let n=null;const a=this.socket.sendForStream(c,(...i)=>{null===n&&(n=performance.now(),cp.debug(`[stream:${e}] time to initial response: ${(n-s).toFixed(2)}ms`)),t(...i)},t=>{i(t),this.events.onStreamErrorEvent(e,a,t)},()=>{this.events.onStreamCompleteEvent(e,a)});return this.events.onStreamEvent(e,c,a,{onMessage:t,onError:i}),a}streamState(e,t=()=>{},i=()=>{},o,c=[]){return this.stream(e,t,i,o).pipe(uv(Ky,c))}streamWithoutAutoTeardown(e,t,i,o){cp.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0");const c=this.messageBuilder.createDataLogonMessage(e,o);cp.debug(`${c.MESSAGE_TYPE} (stream without auto-teardown) message created -> `,c);const s=this.socket.sendForStreamWithoutTeardown(c,t,t=>{i(t),this.events.onStreamErrorEvent(e,s,t)});return this.events.onStreamEvent(e,c,s,{onMessage:t,onError:i}),s}getMoreRows(e,t){return Ou(this,void 0,void 0,function*(){const i=this.messageBuilder.createMoreRowsMessage(e,t);return cp.debug(`${i.MESSAGE_TYPE} message created -> `,i),this.socket.send(i,!1)})}getMoreColumns(e){return Ou(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.socket.send(t)})}dataLogoff(e){return Ou(this,void 0,void 0,function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return cp.debug(`${t.MESSAGE_TYPE} message created -> `,t),this.socket.send(t)})}getMetadata(e){return Ou(this,arguments,void 0,function*(e,t=!0){var i;if(t&&this.metaCache.hasMetadataFor(e))return cp.debug(`Cached metadata retrieved for ${e}`),this.metaCache.getMetadataFor(e);const o=this.messageBuilder.createMetaRequestMessage(e);let c,s;cp.debug(`${o.MESSAGE_TYPE} (metadata) message created -> `,o);try{this.isWorking=!0;const t=yield this.sendReqRep(o);c=null!==(i=null==t?void 0:t.DETAILS)&&void 0!==i?i:{},Object.keys(c).length&&this.metaCache.setMetadataFor(e,c)}catch(e){throw s=e,cp.error(e),e instanceof Error?e:new Error(String(e))}finally{this.events.onMetadataEvent(e,o,s),this.isWorking=!1}return c})}getJSONSchema(e){return Ou(this,arguments,void 0,function*(e,t=!0){var i;if(t&&this.metaCache.hasJsonSchemaFor(e))return cp.debug(`Cached JsonSchema retrieved for ${e}`),this.metaCache.getJsonSchemaFor(e);const o=this.messageBuilder.createMetaRequestMessage(e,Eb.JSON_SCHEMA_REQUEST);let c;cp.debug(`${o.MESSAGE_TYPE} (json schema) message created -> `,o);try{this.isWorking=!0,c=null!==(i=yield this.sendReqRep(o))&&void 0!==i?i:{},Object.keys(c).length&&this.metaCache.setJsonSchemaFor(e,c)}catch(e){cp.error(e)}finally{this.isWorking=!1}return c})}request(e,t){return Ou(this,arguments,void 0,function*(e,t,i=!1){const o=Tb(e,t);if(i&&this.metaCache.hasRequestFor(o))return cp.debug(`Cached request response retrieved for ${o}`),this.metaCache.getRequestFor(o);const c=this.inFlightRequests.get(o);if(c)return cp.debug(`In-flight request collapsed for ${o}`),c;const s=this.messageBuilder.createRequestMessage(e,t);cp.debug(`${s.MESSAGE_TYPE} (request server) message created -> `,s);const n=(this.useHttpReqRep?this.transport.requestServer(this.httpHost,s):this.socket.send(s)).finally(()=>{this.inFlightRequests.delete(o)});this.inFlightRequests.set(o,n);const a=yield n;return i&&a&&this.metaCache.setRequestFor(o,a),a})}getAvailableResources(e){return Ou(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasResources())return cp.debug("Cached resources retrieved"),this.metaCache.getResources();const i=this.messageBuilder.createResourcesMessage(e);cp.debug(`${i.MESSAGE_TYPE} (resources) message created -> `,i);const o=yield this.sendReqRep(i);return this.metaCache.setResources(o),o})}commitEvent(e,t){return Ou(this,void 0,void 0,function*(){const i=this.messageBuilder.createCommitMessage(e,t);cp.debug(`${i.MESSAGE_TYPE} (commit) message created -> `,i);const o=this.sendReqRep(i);return this.events.onCommitEvent(e,i),o.then(t=>(this.events.onCommitResponseEvent(e,t),t))})}};Nu([g],pz.prototype,"isWorking",void 0),pz=Nu([Au(0,uz),Au(1,Db),Au(2,ib),Au(3,hb),Au(4,pb),Au(5,Hb)],pz);const fz="true"===Fp||Rp("forceHttp"),mz=pt.createInterface(e=>e.singleton(pz)),gz=pt.createInterface(e=>fz?e.aliasTo(Xy):e.aliasTo(mz));class vz{serialize(e){return cp.deprecated("serialize","Use `serialize` from `JSONSerializer` from `@genesislcap/foundation-utils` instead."),JSON.stringify(e)}deserialize(e){return cp.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.7 | MIT */
57
- function bz(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)"__proto__"!==o&&(e[o]=i[o])}return e}pt.createInterface(e=>e.singleton(vz));var yz={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 zz=function e(t,i){function o(e,o,c){if("undefined"!=typeof document){"number"==typeof(c=bz({},i,c)).expires&&(c.expires=new Date(Date.now()+864e5*c.expires)),c.expires&&(c.expires=c.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var n in c)c[n]&&(s+="; "+n,!0!==c[n]&&(s+="="+c[n].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+s}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],o={},c=0;c<i.length;c++){var s=i[c].split("="),n=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);if(a in o||(o[a]=t.read(n,a)),e===a)break}catch{}}return e?o[e]:o}},remove:function(e,t){o(e,"",bz({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,bz({},this.attributes,t))},withConverter:function(t){return e(bz({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(i)},converter:{value:Object.freeze(t)}})}(yz,{path:"/"});const xz=pt.createInterface();function Cz(){return(null===navigator||void 0===navigator?void 0:navigator.credentials)?"PasswordCredential"in window||(cp.warn("PasswordCredential not available in this browser."),!1):(cp.warn("CredentialsContainer not available in this browser."),!1)}const Lz=":";function Mz(e="",t=Lz,i){return e.split(t,i).map(e=>e.trim()).filter(e=>""!==e)}function wz(e,t=Lz){const i="string"==typeof e&&e.trim();return!!i&&i.includes(t)}function kz(e,t=Lz){return"string"==typeof e&&e.trim()?(e.match(new RegExp(t,"g"))||[]).length:0}function Sz(e,t=Lz){for(const i of e)if(wz(i,t))return i;return e.find(e=>"string"==typeof e&&""!==e.trim())}function $z(e,t,i){const o="string"==typeof e&&e.trim();return!o||i&&!o.includes(i)||kz(o)>1?i&&t&&i!==t?`${t}:${i}`:t||i:o}function Ez(e="credential"){cp.warn(`Unable to migrate legacy ${e} to latest format. Please remove from your browser.`)}const Nz={password:!0,mediation:"optional"},Az={cookie:{path:"/",name:"credentials",expires:7300,storePasswords:!1}};let Oz=class{constructor(e,t=Az){this.session=e,this.config=t}createBasicCredentials(e){return{type:Sb.BASIC,username:e.username,password:e.password,mfaToken:this.getMFAToken()}}createRefreshCredentials(e){var t,i,o;return{type:Sb.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!==(o=null==e?void 0:e.mfaToken)&&void 0!==o?o:this.getMFAToken()}}createSSOCredentials(e){var t;return{type:Sb.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(Lz)&&kz(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]=Mz(t.name||t.id),[o,c]=Mz(Sz([t.id,t.name]));return[{id:$z(t.id||t.name,i,c),name:i,password:t.password||""},!0]}catch(e){Ez("PasswordCredential")}if(t)try{const e=t,[i]=Mz(e.name||e.username||e.organisation),[o,c]=Mz(Sz([e.organisation||e.username||e.name]));return[{id:$z(e.id||e.username||e.name,i,c),name:i,password:e.password||""},!1]}catch(e){Ez("cookie")}return[void 0,!1]}storeCredentialsInContainer(e){return Ou(this,void 0,void 0,function*(){if(!Cz())return;const t=new PasswordCredential(e);return cp.debug("Storing credentials in CredentialsContainer"),navigator.credentials.store(t)})}getCredentialsFromContainer(){return Ou(this,arguments,void 0,function*(e=Nz){if(Cz())return cp.debug("Getting credentials from CredentialsContainer"),yield navigator.credentials.get(e)})}storeCredentialsInCookie(e){const t=Eu(e,["password"]),i=this.config.cookie.storePasswords?e:t;return cp.debug("Storing credentials in cookie"),!!zz.set(this.config.cookie.name,JSON.stringify(i),{expires:this.config.cookie.expires,domain:location.hostname,path:this.config.cookie.path,secure:!0})}getCredentialsFromCookie(){cp.debug("Getting credentials from cookie");const e=zz.get(this.config.cookie.name);return e?JSON.parse(e):void 0}storeCredentials(e){return Ou(this,void 0,void 0,function*(){if(Cz()){const t=yield this.storeCredentialsInContainer(e);return Promise.resolve(!!t)}return Promise.resolve(this.storeCredentialsInCookie(e))})}getCredentials(e){return Ou(this,void 0,void 0,function*(){return Cz()?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(){zz.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 Cz()&&navigator.credentials.preventSilentAccess()}};Oz=Nu([Au(0,Cb),Au(1,vt(xz))],Oz);const Tz=pt.createInterface(e=>e.singleton(Oz)),Rz=e=>Array.isArray(e)?e.map(e=>null!=e?e:""):[],Iz=e=>{try{if("EVENT_LOGIN_AUTH_ACK"===(null==e?void 0:e.MESSAGE_TYPE)){const{DETAILS:o}=e,c={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:o?{system:(i=o.SYSTEM,i?{date:i.DATE}:null),heartbeatIntervalSecs:o.HEARTBEAT_INTERVAL_SECS,failedLoginAttempts:o.FAILED_LOGIN_ATTEMPTS,rejectedLoginAttempts:o.REJECTED_LOGIN_ATTEMPTS,lastLoginDatetime:o.LAST_LOGIN_DATETIME,daysToPasswordExpiry:o.DAYS_TO_PASSWORD_EXPIRY,product:(t=o.PRODUCT,t?t.map(e=>({name:e.NAME,version:e.VERSION})):[])}:null,permission:Rz(e.PERMISSION),profile:Rz(e.PROFILE)};return c}throw new Error("No Entity mapping implementation for provided DTO")}catch(e){throw cp.error(e),e}var t,i};let Dz=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,o,c){this.session=e,this.connect=t,this.messageBuilder=i,this.credentialManager=o,this.currentUser=c,this.isWorking=!1,this.isLoggedInSubject=new ig(this.isLoggedIn),this.currentUser.addAuthenticationChangeListener(e=>{var t;null===(t=this.isLoggedInSubject)||void 0===t||t.next(e.detail)})}login(e){return Ou(this,void 0,void 0,function*(){var t;this.isWorking=!0;try{const i=this.messageBuilder.createLoginMessage(e),o=yield this.connect.send(i);if(!o||o.ERROR||(null===(t=o.DETAILS)||void 0===t?void 0:t.ERROR))throw new Ab(i,o);this.applyAuthResults({authToken:o.SESSION_AUTH_TOKEN,refreshToken:o.REFRESH_AUTH_TOKEN,profiles:o.PROFILE,username:o.USER_NAME,permissions:o.PERMISSION,sessionId:o.SESSION_ID}),this.currentUser.set(Iz(o)),this.session.setAuthResult(o),cp.debug("Login Authentication Result:",o)}catch(e){if(cp.error("Login Authentication Error:",e),!(e instanceof Ab&&e.isIgnorableError()))throw this.removeAuthResults(),this.currentUser.unset(),e;cp.warn("Ignoring authentication error as it is a known edge case.")}finally{this.isWorking=!1}return this.loggedUserResult})}logout(){return Ou(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:o,DETAILS:c,ERROR:s,MESSAGE_TYPE:n,OIDC_LOGOUT_URL:a}=yield this.connect.send(i),r=null!==(e=null==c?void 0:c.ERROR)&&void 0!==e?e:s,l=n===$b.LOGOUT_NACK;l&&cp.warn("Unexpected Logout NACK received during logout.",r),t={success:n===$b.LOGOUT_ACK||o===Nb.SESSION_NOT_FOUND||!l,error:r},a&&window.open(a,"_self")}catch(e){const i=new Ab(e.sentMessage,e.receivedMessage);if(cp.error("Logout Authentication Error:",i),!i.isIgnorableError())throw e;cp.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 Ou(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)===Eb.EVENT_LOGIN_AUTH_ACK)return this.session.setAuthResult(t),this.currentUser.set(Iz(t)),this.applyAuthResults(this.getLoggedUserFromMessage(t)),!0}return this.session.deleteUserFromSessionStorage(),this.currentUser.unset(),!1})}ensureConnection(){return Ou(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,o=e.REFRESH_AUTH_TOKEN;return t&&i&&o?{username:t,authToken:i,refreshToken:o,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}};Nu([g],Dz.prototype,"isWorking",void 0),Nu([g],Dz.prototype,"loggedUserResult",void 0),Dz=Nu([Au(0,Cb),Au(1,gz),Au(2,Db),Au(3,Tz),Au(4,eb)],Dz);const Fz=pt.createInterface(e=>e.singleton(Dz));function _z(e,t){const i=new Date(e),o=i.getUTCFullYear(),c=String(i.getUTCMonth()+1).padStart(2,"0"),s=String(i.getUTCDate()).padStart(2,"0");if(t)return`${o}${c}${s}`;return`${o}${c}${s}-${String(i.getUTCHours()).padStart(2,"0")}:${String(i.getUTCMinutes()).padStart(2,"0")}`}function Hz(e,t="ROW_REF"){const i=e=>{var i;const o=null!==(i=e.DETAILS[t])&&void 0!==i?i:e[t],c=Object.assign(Object.assign({},e),{[t]:o});return delete c.DETAILS,c},o=[],c=[],s=[];for(const t of e.ROW)if(t.DETAILS)switch(t.DETAILS.OPERATION){case"INSERT":o.push(i(t));break;case"MODIFY":s.push(i(t));break;case"DELETE":c.push(i(t));break;default:cp.error(`Unsupported operation type: '${t.DETAILS.OPERATION}'`)}return{inserts:o,deletes:c,updates:s,SOURCE_REF:e.SOURCE_REF}}class Pz{}Pz.MAX_ROWS_250=250,Pz.MAX_VIEW_1000=1e3,Pz.REQ_REP_POLLING_INTERVAL_MS=1e4,Pz.DATASERVER_ROW_ID="ROW_REF",Pz.REQUEST_SERVER_ROW_ID="RECORD_ID",Pz.DEFAULT_PAGINATION_PAGE_SIZE=25,Pz.DEFAULT_REQ_REP_OFFSET=0;const Vz={options:{criteria:"",isSnapshot:!1,maxRows:Pz.MAX_ROWS_250,maxView:Pz.MAX_VIEW_1000,pollingInterval:Pz.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+)\)/,o=e.match(i);if(o){const[,e]=o,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+), ?['"](.+)['"]\)/,o=e.match(i);if(o){const[,e,i]=o;t[`${e}_FROM`]=i}break}case"dateTimeIsLessEqual":{const i=/Expr\.dateTimeIsLessEqual\((\w+), ?['"](.+)['"]\)/,o=e.match(i);if(o){const[,e,i]=o;t[`${e}_TO`]=i}break}case"dateIsGreaterEqual":{const i=/Expr\.dateIsGreaterEqual\((\w+), ?['"](.+)['"]\)/,o=e.match(i);if(o){const[,e,i]=o;t[`${e}_FROM`]=i}break}case"dateIsLessEqual":{const i=/Expr\.dateIsLessEqual\((\w+), ?['"](.+)['"]\)/,o=e.match(i);if(o){const[,e,i]=o;t[`${e}_TO`]=i}break}case"containsIgnoreCase":{const i=/Expr\.containsIgnoreCase\((\w+), ?['"](.+)['"]\)/,o=e.match(i);if(o){const[,e,i]=o;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,o]=t,c=parseInt(o,10),s=e.toUpperCase(),n=s.includes("DATE")&&!s.includes("DATETIME");i[`${e}_FROM`]=_z(c,n)}const o=e.match(/([A-Z_]+)\s*<=\s*(\d+)/);if(o){const[,e,t]=o,c=parseInt(t,10),s=e.toUpperCase(),n=s.includes("DATE")&&!s.includes("DATETIME");i[`${e}_TO`]=_z(c,n)}}else!function(e,t){const i=e.substr(0,e.indexOf("=")).trim().replace(/["']/g,""),o=e.substr(e.lastIndexOf("=")+1,e.length).trim().replace(/["']/g,"");t[i]=o}(e,i)}),i},dataServerResultFilter:Hz},Bz=pt.createInterface(e=>e.instance(Vz)),Uz=e=>{class t extends e{constructor(){super(),this.hasOwnProperty("onDatasourceStatusChanged")||(this.onDatasourceStatusChanged=e=>{var t;const i=void 0!==this.data;this.resourceName||i||cp.warn("Target classes must have a resourceName or data property to use the DatasourceEventHandler mixin.");const o=e.detail;if(o.name===this.resourceName){const e=null!==(t=this.datasourceStatus)&&void 0!==t?t:{isInitialized:!1,hasMetadata:!1};(e.isInitialized!==o.isInitialized||o.metadataRequired&&e.hasMetadata!==o.hasMetadata)&&(this.datasourceStatus=o)}})}datasourceStatusChanged(e,t){cp.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(nb,this.onDatasourceStatusChanged,{passive:!0,capture:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(nb,this.onDatasourceStatusChanged,{capture:!0})}}return Nu([g],t.prototype,"datasourceStatus",void 0),t},jz={throwWhenUnavailable:!0,throwWhenUnknown:!1},qz=pt.createInterface(e=>e.instance(jz)),Gz=dp("genesis-resources");let Wz=class{constructor(e,t){this.connect=e,this.config=t}isValidResource(e){return Ou(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 Ou(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(cp.error(i),this.config.throwWhenUnknown)throw new Error(i)})}getAllResources(){return Ou(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 Ou(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(cp.error(e),this.config.throwWhenUnavailable)throw new Error(e)}this.postLoadedMessage(),this.resourcesPromise=void 0}})}postLoadedMessage(){const e=pt.getOrCreateDOMContainer().get(Gz);e.postMessage("resources-loaded",this.resources),e.close()}};Wz=Nu([Au(0,gz),Au(1,qz)],Wz);const Yz=pt.createInterface(e=>e.singleton(Wz));let Kz=class{get initialized(){var e;return!!(null===(e=this.status)||void 0===e?void 0:e.isInitialized)}constructor(e,t,i,o,c){this.connect=e,this.auth=t,this.resources=i,this.config=o,this.connectEvents=c,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 eg}triggerPoll(){this.pollTrigger$.next()}validResourceName(e){return cp.deprecated("Datasource.validResourceName","Use `GenesisResources.isValidResource` instead."),!!e&&!!e.trim().length}init(e){return Ou(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 o=this.options.resourceName;if(!(this.connect.isConnected||(yield this.connect.connect())))return cp.error(`Unable to connect to ${this.connect.host} to get ${o} datasource`),this.reportStatus(),!1;return(yield this.resources.isValidResource(o))?(this.resourceType=yield this.resources.getResourceTypeFor(o),this.resourceType?(this.fetchMetadataRequired&&(yield this.fetchAndApplyMetadata(this.options.resourceName),this._allParams=null),cp.debug(`Initializing ${o} datasource from ${this.connect.host}`),!this.options.isSnapshot&&i&&(this.pollTrigger$=new eg,this.stream=yield this.createStream()),cp.debug(`${o} datasource initialization ${this.initialized?"was successful.":"has failed."}`),this.reportStatus(),this.initialized):(cp.error(`Unable to get the resource type for ${o} datasource from ${this.connect.host}`),this.reportStatus(),!1)):(cp.error(`${o} datasource does not exist on ${this.connect.host}`),this.reportStatus(),!1)})}startStream(){return Ou(this,void 0,void 0,function*(){this.options.isSnapshot||void 0!==this.stream||(this.stream=yield this.createStream())})}destroy(){var e,t;cp.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);cp.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},cp.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=Eu(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.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 Ou(this,void 0,void 0,function*(){switch(cp.debug(`Requesting snapshot for ${this.options.resourceName} (${this.resourceType}).`),this.resourceType){case sb.DATASERVER:return this.connect.snapshot(this.options.resourceName,Object.assign(Object.assign({},this.dataserverOnlyParams),e));case sb.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 Ou(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 Ou(this,void 0,void 0,function*(){if(![sb.DATASERVER,sb.REQUEST_SERVER].includes(this.resourceType))throw new Error(`Streaming not supported for selected resource type: ${this.resourceType}`);return this.resourceType===sb.DATASERVER?this.createDataserverStream():(cp.debug(`Creating fake stream by polling ${this.options.resourceName} REQUEST_SERVER`),this.createReqRepStream())})}createDataserverStream(){return Ou(this,void 0,void 0,function*(){return this.connect.stream(this.options.resourceName,e=>{},e=>cp.error(e),this.dataserverOnlyParams)})}createReqRepStream(){this.commitResponseUnsubscribe=this.connectEvents.addCommitResponseListener(e=>{var t;const{eventName:i,response:o}=e.detail;this.options.pollTriggerEvents&&this.options.pollTriggerEvents.includes(i)&&(null===(t=o.MESSAGE_TYPE)||void 0===t?void 0:t.endsWith("_ACK"))&&(cp.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===sb.REQUEST_SERVER&&this.loadMoreCount>0){const t=25,i=(this.options.maxRows||t)*(this.loadMoreCount+1);e.DETAILS.MAX_ROWS=i}return sv([this.connect.isConnected$,this.auth.isLoggedIn$]).pipe(mv(()=>this.connect.isConnected&&this.auth.isLoggedIn),fv(()=>Yg(this.snapshot(e))))};return e?this.pollTrigger$.pipe(pv(0),fv(()=>dv(0,e).pipe(fv(t)))):this.pollTrigger$.pipe(pv(0),fv(t))}fetchAndApplyMetadata(e){return Ou(this,void 0,void 0,function*(){var t,i,o,c;try{cp.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!==(o=e.CRITERIA_FIELDS)&&void 0!==o?o:[],this.originalFieldDef=rb(e),this.fieldMetadata=ab(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===(c=this.fieldMetadata)||void 0===c?void 0:c.length)>0})}catch(t){cp.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),cp.debug(`Dispatching '${nb}'`,this.status),null==i||i.dispatchEvent(new CustomEvent(nb,{detail:this.status,bubbles:i!==document,composed:!0}))}normaliseStatus(e){var t,i,o,c,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!==(o=e.hasMetadata)&&void 0!==o?o:(null===(c=this.fieldMetadata)||void 0===c?void 0:c.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}};Nu([g],Kz.prototype,"status",void 0),Nu([g],Kz.prototype,"fetchMetadataRequired",void 0),Nu([g],Kz.prototype,"startStreamRequired",void 0),Nu([g],Kz.prototype,"originalFieldDef",void 0),Nu([g],Kz.prototype,"fieldMetadata",void 0),Nu([g],Kz.prototype,"requestFields",void 0),Nu([g],Kz.prototype,"customRequestFields",void 0),Nu([g],Kz.prototype,"availableIndexes",void 0),Nu([g],Kz.prototype,"availableSortableFields",void 0),Nu([g],Kz.prototype,"availableCriteriaFields",void 0),Nu([g],Kz.prototype,"criteriaOnlyRequest",void 0),Nu([g],Kz.prototype,"loadMoreCount",void 0),Nu([g],Kz.prototype,"readOnly",void 0),Nu([g],Kz.prototype,"stream",void 0),Kz=Nu([Au(0,gz),Au(1,Fz),Au(2,Yz),Au(3,Bz),Au(4,db)],Kz);const Zz=pt.createInterface(e=>e.transient(Kz));class Qz extends Kz{constructor(){super(...arguments),this.entityCache=[],this.entityMap=new Map,this.rowId="ROW_REF",this.initialize=e=>Ou(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===$b.LOGOFF_ACK;const t=e.ROW;!this.subscriptionLoggedOff&&t&&this.updateCache(this.config.dataServerResultFilter(e,this.rowId))}),!0):(cp.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],o=this.entityMap.get(i);if(o&&t)throw new Error("Existing entity found in map while inserting.");const c=this.mapper.fromDTO(e),s=o?Object.assign(Object.assign({},o),c):c;this.entityMap.set(i,s)})}}function Xz(e,t=";"){return e?e.split(t).map(e=>e.trim()).sort((e,t)=>e.localeCompare(t)).join(t):e}pt.createInterface(e=>e.transient(Qz));const Jz="system-health-changed",ex={windowEvents:["online","offline","pageshow"],documentEvents:["visibilitychange"],genesisConnectEvents:["stream","commit"],ignoredGenesisResources:[],startDelay:5e3,checkInterval:1e4,checkTimeout:3e3,resourceChecks:e=>Ou(void 0,void 0,void 0,function*(){const t=pt.getOrCreateDOMContainer().get(gz),i=yield t.getMoreColumns(e),o=Date.now(),c=i;return{isConnected:i.MESSAGE_TYPE===$b.MORE_COLUMNS_ACK,lastUpdated:o,lastMessage:c}}),resourceDataLogon:({message:e,functions:t})=>{const{onMessage:i,onError:o}=t;pt.getOrCreateDOMContainer().get(uz).sendForStream(e,i,o)}},tx=pt.createInterface(e=>e.instance(ex));var ix,ox={exports:{}};var cx,sx,nx=(ix||(ix=1,function(e){e.exports=function(e){var t={};function i(o){if(t[o])return t[o].exports;var c=t[o]={i:o,l:!1,exports:{}};return e[o].call(c.exports,c,c.exports,i),c.l=!0,c.exports}return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)i.d(o,c,function(t){return e[t]}.bind(null,c));return o},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 o=i(18),c=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});t.push(0);var i=t[0],o=t[1];if(10===i)switch(o){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}switch(i){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";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,o){void 0===o&&(o=!1);var c=e.getVersionPrecision(t),s=e.getVersionPrecision(i),n=Math.max(c,s),a=0,r=e.map([t,i],function(t){var i=n-e.getVersionPrecision(t),o=t+new Array(i+1).join(".0");return e.map(o.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});for(o&&(a=n-Math.min(c,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,o=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(i=0;i<e.length;i+=1)o.push(t(e[i]));return o},e.find=function(e,t){var i,o;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(i=0,o=e.length;i<o;i+=1){var c=e[i];if(t(c,i))return c}},e.assign=function(e){for(var t,i,o=e,c=arguments.length,s=new Array(c>1?c-1:0),n=1;n<c;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){o[t]=e[t]})};for(t=0,i=s.length;t<i;t+=1)a();return e},e.getBrowserAlias=function(e){return o.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return o.BROWSER_MAP[e]||""},e}();t.default=c,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={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},t.BROWSER_MAP={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},t.PLATFORMS_MAP={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},t.OS_MAP={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},t.ENGINE_MAP={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"}},90:function(e,t,i){t.__esModule=!0,t.default=void 0;var o,c=(o=i(91))&&o.__esModule?o:{default:o},s=i(18);function n(e,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var a=function(){function e(){}var t,i,o;return e.getParser=function(e,t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"string"!=typeof e)throw new Error("UserAgent should be a string");return new c.default(e,t,i)},e.parse=function(e,t){return void 0===t&&(t=null),new c.default(e,t).getResult()},t=e,o=[{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),o&&n(t,o),e}();t.default=a,e.exports=t.default},91:function(e,t,i){t.__esModule=!0,t.default=void 0;var o=r(i(92)),c=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,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e;var o=!1;"boolean"==typeof t?(o=t,this._hints=i):this._hints=null!=t&&"object"==typeof t?t:null,this.parsedResult={},!0!==o&&this.parse()}var t=e.prototype;return t.getHints=function(){return this._hints},t.hasBrand=function(e){if(!this._hints||!Array.isArray(this._hints.brands))return!1;var t=e.toLowerCase();return this._hints.brands.some(function(e){return e.brand&&e.brand.toLowerCase()===t})},t.getBrandVersion=function(e){if(this._hints&&Array.isArray(this._hints.brands)){var t=e.toLowerCase(),i=this._hints.brands.find(function(e){return e.brand&&e.brand.toLowerCase()===t});return i?i.version:void 0}},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(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.browser=t.describe(this.getUA(),this)),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(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.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={},o=0,c={},s=0;if(Object.keys(e).forEach(function(t){var n=e[t];"string"==typeof n?(c[t]=n,s+=1):"object"==typeof n&&(i[t]=n,o+=1)}),o>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(c),p=a.default.find(u,function(e){return t.isBrowser(e,!0)});if(void 0!==p)return this.compareVersion(c[p])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var i=this.getBrowserName().toLowerCase(),o=e.toLowerCase(),c=a.default.getBrowserTypeByAlias(o);return t&&c&&(o=c.toLowerCase()),o===i},t.compareVersion=function(e){var t=[0],i=e,o=!1,c=this.getBrowserVersion();if("string"==typeof c)return">"===e[0]||"<"===e[0]?(i=e.substr(1),"="===e[1]?(o=!0,i=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?i=e.substr(1):"~"===e[0]&&(o=!0,i=e.substr(1)),t.indexOf(a.default.compareVersions(c,i,o))>-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 o,c=(o=i(17))&&o.__esModule?o:{default:o},s=/version\/(\d+(\.?_?\d+)+)/i,n=[{test:[/gptbot/i],describe:function(e){var t={name:"GPTBot"},i=c.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/chatgpt-user/i],describe:function(e){var t={name:"ChatGPT-User"},i=c.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/oai-searchbot/i],describe:function(e){var t={name:"OAI-SearchBot"},i=c.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(e){var t={name:"ClaudeBot"},i=c.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(e){var t={name:"Omgilibot"},i=c.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/diffbot/i],describe:function(e){var t={name:"Diffbot"},i=c.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/perplexitybot/i],describe:function(e){var t={name:"PerplexityBot"},i=c.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/perplexity-user/i],describe:function(e){var t={name:"Perplexity-User"},i=c.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/youbot/i],describe:function(e){var t={name:"YouBot"},i=c.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-webindexer/i],describe:function(e){var t={name:"Meta-WebIndexer"},i=c.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-externalads/i],describe:function(e){var t={name:"Meta-ExternalAds"},i=c.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-externalagent/i],describe:function(e){var t={name:"Meta-ExternalAgent"},i=c.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-externalfetcher/i],describe:function(e){var t={name:"Meta-ExternalFetcher"},i=c.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},i=c.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/linespider/i],describe:function(e){var t={name:"Linespider"},i=c.default.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/amazonbot/i],describe:function(e){var t={name:"AmazonBot"},i=c.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/bingbot/i],describe:function(e){var t={name:"BingCrawler"},i=c.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/baiduspider/i],describe:function(e){var t={name:"BaiduSpider"},i=c.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/duckduckbot/i],describe:function(e){var t={name:"DuckDuckBot"},i=c.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/ia_archiver/i],describe:function(e){var t={name:"InternetArchiveCrawler"},i=c.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(e){var t={name:"SlackBot"},i=c.default.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return{name:"PingdomBot"}}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},i=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},i=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},i=c.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},i=c.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},i=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},i=c.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},i=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||c.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=c.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},i=c.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=c.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=c.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=c.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},i=c.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},i=c.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=c.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},i=c.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},i=c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},i=c.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},i=c.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/librewolf/i],describe:function(e){var t={name:"LibreWolf"},i=c.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},i=c.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=c.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(e){var t={name:"Sogou Browser"},i=c.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,e),o=c.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),s=c.default.getFirstMatch(/se ([\d.]+)x/i,e),n=i||o||s;return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},i=c.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){return!!e.hasBrand("DuckDuckGo")||e.test(/\sDdg\/[\d.]+$/i)},describe:function(e,t){var i={name:"DuckDuckGo"};if(t){var o=t.getBrandVersion("DuckDuckGo");if(o)return i.version=o,i}var s=c.default.getFirstMatch(/\sDdg\/([\d.]+)$/i,e);return s&&(i.version=s),i}},{test:function(e){return e.hasBrand("Brave")},describe:function(e,t){var i={name:"Brave"};if(t){var o=t.getBrandVersion("Brave");if(o)return i.version=o,i}return i}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},i=c.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},i=c.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=c.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=c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},i=c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},i=c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:c.default.getFirstMatch(t,e),version:c.default.getSecondMatch(t,e)}}}];t.default=n,e.exports=t.default},93:function(e,t,i){t.__esModule=!0,t.default=void 0;var o,c=(o=i(17))&&o.__esModule?o:{default:o},s=i(18),n=[{test:[/Roku\/DVP/],describe:function(e){var t=c.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=c.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=c.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),i=c.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=c.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return i&&(t.version=i),t}},{test:[/macintosh/i],describe:function(e){var t=c.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),i=c.default.getMacOSVersionName(t),o={name:s.OS_MAP.MacOS,version:t};return i&&(o.versionName=i),o}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=c.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:s.OS_MAP.iOS,version:t}}},{test:[/OpenHarmony/i],describe:function(e){var t=c.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.HarmonyOS,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=c.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),i=c.default.getAndroidVersionName(t),o={name:s.OS_MAP.Android,version:t};return i&&(o.versionName=i),o}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=c.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=c.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||c.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||c.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:s.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=c.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=c.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=c.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 o,c=(o=i(17))&&o.__esModule?o:{default:o},s=i(18),n=[{test:[/googlebot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/linespider/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(e){var t=c.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=c.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=c.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:[/smart-?tv|smarttv/i],describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:[/netcast/i],describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{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 o,c=(o=i(17))&&o.__esModule?o:{default:o},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=c.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=c.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=c.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=c.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=c.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}}];t.default=n,e.exports=t.default}})}(ox)),ox.exports),ax=of(nx);var rx,lx=function(){if(sx)return cx;sx=1,cx=s,s.default=s,s.stable=l,s.stableStringify=l;var e="[...]",t="[Circular]",i=[],o=[];function c(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(e,t,s,n){var r;void 0===n&&(n=c()),a(e,"",0,[],void 0,0,n);try{r=0===o.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,c,s){var n=Object.getOwnPropertyDescriptor(s,c);void 0!==n.get?n.configurable?(Object.defineProperty(s,c,{value:e}),i.push([s,c,t,n])):o.push([t,c,e]):(s[c]=e,i.push([s,c,t]))}function a(i,o,c,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,o,r);if(void 0!==d.depthLimit&&l>d.depthLimit)return void n(e,i,o,r);if(void 0!==d.edgesLimit&&c+1>d.edgesLimit)return void n(e,i,o,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 p=u[h];a(i[p],p,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=c());var a,r=d(e,"",0,[],void 0,0,n)||e;try{a=0===o.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(o,c,s,a,l,h,u){var p;if(h+=1,"object"==typeof o&&null!==o){for(p=0;p<a.length;p++)if(a[p]===o)return void n(t,o,c,l);try{if("function"==typeof o.toJSON)return}catch(e){return}if(void 0!==u.depthLimit&&h>u.depthLimit)return void n(e,o,c,l);if(void 0!==u.edgesLimit&&s+1>u.edgesLimit)return void n(e,o,c,l);if(a.push(o),Array.isArray(o))for(p=0;p<o.length;p++)d(o[p],p,p,a,o,h,u);else{var f={},m=Object.keys(o).sort(r);for(p=0;p<m.length;p++){var g=m[p];d(o[g],g,p,a,o,h,u),f[g]=o[g]}if(void 0===l)return f;i.push([l,c,o]),l[c]=f}a.pop()}}function h(e){return e=void 0!==e?e:function(e,t){return t},function(t,i){if(o.length>0)for(var c=0;c<o.length;c++){var s=o[c];if(s[1]===t&&s[0]===i){i=s[2],o.splice(c,1);break}}return e.call(this,t,i)}}return cx}(),dx=of(lx);const hx=op("network-monitor",{level:Bu.info}),ux=Date.now(),px=(null===(rx=window.navigator)||void 0===rx?void 0:rx.userAgent)?ax.parse(window.navigator.userAgent):void 0,fx=(e,t={depthLimit:10,edgesLimit:10})=>e instanceof Event?`'${e.type}' Event`:"string"==typeof e?e:dx(e,void 0,2,t);class mx{constructor(){this.unsubscribableObservers=[],this.runAllChecks=(e,t)=>Ou(this,void 0,void 0,function*(){if(!this.isReady||this.isRunningChecks&&!t)return;hx.info("Run health checks, triggered by",fx(e),"| Active resources",this.resources.size),this.isRunningChecks=!0,this.synchroniseCheckInterval();let i=this.getFormattedTimestamp(this.getNowTimestamp());const o=yield this.isOnlineCheck();o?hx.debug(`Network connected at ${i}`):hx.warn(`Network disconnected at ${i}`);const c=this.normaliseSerializedSocketStatus(this.socketStatus.serialize(),o),s=this.preFlightSocketChecks(c);if(s||hx.debug("Socket pre-flight checks failed"),!o||!s){hx.debug("Aborting remaining health checks");const e=[...this.resources].reduce((e,[t,i])=>{const c=e[i.resourceName];return c?(c.sourceRef=[...c.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},o)})},{});return this.reportSystemHealth({isAuthenticated:this.user.isAuthenticated,isOnline:o,resources:e,resourcesAllConnected:!1,socket:c}),void(this.isRunningChecks=!1)}let n=!0;const a=[];this.resources.forEach((e,t)=>{const{resourceName:o,message:c,functions:s}=e,{resourceChecks:r=this.config.resourceChecks,resourceDataLogon:l=this.config.resourceDataLogon}=s,{SOURCE_REF:d}=c;let h,u,p,f,m,g=!1;a.push((()=>Ou(this,void 0,void 0,function*(){var c,s,a;try{hx.debug(`Running health check against ${o}`);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,f=e.timeout}catch(e){g=!1,h=this.getNowTimestamp(),p=e,u=null!==(c=null==e?void 0:e.receivedMessage)&&void 0!==c?c:e}return m=(null==u?void 0:u.MESSAGE_TYPE)===$b.MSG_NACK||Rb(u,vb.NOT_FOUND),i=this.getFormattedTimestamp(null!=h?h:this.getNowTimestamp()),g?hx.debug(`${o} is healthy at ${i}`):hx.warn(`${o} is not healthy at ${i}`),u&&hx.debug(`${o} messaged at ${i}`,fx(u)),p&&hx.error(`${o} errored at ${i}`,fx(p)),f&&hx.warn(`${o} timed out at ${i}`),m&&(hx.error(`${o} issue, re-attempting data logon at ${i}`),l(e)),n&&(n=g),{name:o,sourceRef:[d],isConnected:g,lastUpdated:h,lastError:p}}))())});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 hx.warn("Unexpected promise rejection occurred. Please check any custom resourceChecks return MonitoredResourceChecksResult."),e},{});hx.debug("Health checks complete"),this.reportSystemHealth({isAuthenticated:this.user.isAuthenticated,isOnline:o,resources:r,resourcesAllConnected:n,socket:c}),this.isRunningChecks=!1}),void 0!==this.config.logLevel&&(hx.level=this.config.logLevel)}create(){this.resources?hx.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:o,stream:c}=e;this.config.ignoredGenesisResources.includes(o)||this.addResource(c,{functions:t,message:i,resourceName:o})},({detail:e})=>{const{resourceName:t,stream:i}=e;this.config.ignoredGenesisResources.includes(t)||this.removeResource(i)},({detail:e})=>{var t;const{resourceName:i,stream:o,error:c}=e,s=null!==(t=c.receivedMessage)&&void 0!==t?t:c;let n="";Rb(s,vb.NOT_FOUND)?n="Please check the resource is running.":Rb(s,vb.FORBIDDEN)&&(n="You are not authorised to access this resource, removing it from monitoring.",this.removeResource(o)),hx.error(`${i} errored at ${this.getFormattedTimestamp(this.getNowTimestamp())}.`,n,c)})),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&&hx.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?hx.debug:hx.warn)("Emitting 'system-health-changed' event",fx(this.status)),null==i||i.dispatchEvent(new CustomEvent(Jz,{detail:this.status,bubbles:i!==document,composed:!0})),this.status.socket.reconnectionLimitReached&&(hx.debug("Network monitoring no longer required. Please check your network and reload your application."),this.destroy())}reportStabilityToGenesis(e){return Ou(this,void 0,void 0,function*(){return hx.debug("User requested report stability to Genesis."),hx.info("Please attach this data to your Genesis Support request: \n",JSON.stringify(e,null,2)),!0})}normaliseResourceHealth(e,t=!0){var i;const o=!!t&&e.isConnected,c=null!==(i=e.lastUpdated)&&void 0!==i?i:this.getNowTimestamp();return Object.assign(Object.assign({},e),{isConnected:o,lastUpdated:c})}normaliseSerializedSocketStatus(e,t=!0){const i=!!t&&e.isConnected,o=!i;return Object.assign(Object.assign({},e),{isConnected:i,isDisconnected:o})}normaliseEventDetail(e){var t,i,o,c;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!==(o=e.lastUpdated)&&void 0!==o?o:this.getNowTimestamp(),a=null!==(c=e.nextUpdate)&&void 0!==c?c:this.getNextTimestamp(),r=e.isAuthenticated&&this.user?this.user.username:void 0,l=Object.assign(Object.assign({},e),{browserInformation:px,username:r,isHealthy:s,lastUpdated:n,nextUpdate:a,firstUpdated:ux,runAllChecks:()=>{hx.debug("User activated run checks command starting."),this.runAllChecks("user requested")},reportStabilityToGenesis:()=>this.reportStabilityToGenesis(l)});return l}preFlightSocketChecks(e){if(!e.isConfigured)return hx.debug("Socket not configured"),!1;if(e.isReconnecting)return hx.debug("Socket reconnecting"),!1;if(e.isConnecting)return hx.debug("Socket connecting"),!1;if(e.isDisconnected){const t=e.isDisconnectedByServer?`by the server, code: ${e.closedCode}, reason: ${e.closedReason}`:"";return hx.debug(`Socket disconnected ${t}`),e.reconnectionLimitReached&&hx.debug("Socket reconnection limit reached"),!1}const t=this.user.isAuthenticated?"with":"without";return hx.debug(`Socket connected ${t} valid session`),!0}getFormattedTimestamp(e){return Zp(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)}}Nu([tx],mx.prototype,"config",void 0),Nu([az],mx.prototype,"socketStatus",void 0),Nu([db],mx.prototype,"connectEvents",void 0),Nu([eb],mx.prototype,"user",void 0),Nu([g],mx.prototype,"status",void 0);const gx=pt.createInterface(e=>e.singleton(mx)),vx={account:"genesis",namespace:"default",authKey:"kv-default",authEmail:void 0},bx=pt.createInterface();var yx,zx;!function(e){e.REQ_KEY_VALUE_LIST="REQ_KEY_VALUE_LIST",e.REQ_KEY_VALUE_READ="REQ_KEY_VALUE_READ"}(yx||(yx={})),function(e){e.EVENT_KEY_VALUE_PUT="EVENT_KEY_VALUE_PUT",e.EVENT_KEY_VALUE_DELETE="EVENT_KEY_VALUE_DELETE"}(zx||(zx={}));let xx=class{constructor(e,t,i=vx){this.connect=e,this.user=t,this.kvStorageConfig=i}delete(e){return Ou(this,void 0,void 0,function*(){const t={DETAILS:{KEYS:e}},i=yield this.connect.commitEvent(zx.EVENT_KEY_VALUE_DELETE,t);return!(!i||"EVENT_ACK"!==i.MESSAGE_TYPE)||{ERROR:i.ERROR,WARNING:i.WARNING}})}get(e){return Ou(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}},o=yield this.connect.request(yx.REQ_KEY_VALUE_READ,i);if(o&&o.REPLY&&o.REPLY.length>0){const t=o.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=Op(e);return"string"==typeof t&&t.startsWith("str:")&&(t=Op(t)),"string"==typeof t&&t.startsWith("bin:")&&(t=Op(t)),t}list(){return Ou(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(yx.REQ_KEY_VALUE_LIST,t);if(i&&i.REPLY&&i.REPLY.length>0){return i.REPLY.map(e=>e.KEY)}return[]})}put(e){return Ou(this,void 0,void 0,function*(){const t={DETAILS:{RECORDS:e.map(e=>({KEY:e.key,VALUE:e.base64?Tp(e.value):e.value}))}},i=yield this.connect.commitEvent(zx.EVENT_KEY_VALUE_PUT,t);return!(!i||"EVENT_ACK"!==i.MESSAGE_TYPE)||{ERROR:i.ERROR,WARNING:i.WARNING}})}};xx=Nu([Au(0,gz),Au(1,eb),Au(2,vt(bx))],xx),pt.createInterface(e=>e.singleton(xx));class Cx{constructor(){this.isWorking=!1,this.loggedUserResult=null,this.currentUser=null,this.isLoggedIn=!1,this.isLoggedInSubject=new ig(!1)}get isLoggedIn$(){return this.isLoggedInSubject.asObservable()}login(e){return Ou(this,void 0,void 0,function*(){return Promise.resolve(this.nextLoginResult)})}logout(){return Ou(this,void 0,void 0,function*(){return Promise.resolve(this.nextLogoutResult)})}reAuthFromSession(){return Ou(this,void 0,void 0,function*(){return Promise.resolve(this.nextReAuthResult)})}setTestUser(e={}){this.currentUser=new Jv,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)}}Nu([g],Cx.prototype,"isWorking",void 0),Nu([g],Cx.prototype,"loggedUserResult",void 0),Nu([g],Cx.prototype,"currentUser",void 0),Nu([g],Cx.prototype,"isLoggedIn",void 0);class Lx{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,o;this.availableIndexes=null!==(t=e.INDEXES)&&void 0!==t?t:[],this.availableSortableFields=null!==(i=e.SORTABLE_FIELDS)&&void 0!==i?i:[],this.availableCriteriaFields=null!==(o=e.CRITERIA_FIELDS)&&void 0!==o?o:[],this.originalFieldDef=rb(e),this.fieldMetadata=ab(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=Yg(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){}}Nu([g],Lx.prototype,"status",void 0),Nu([g],Lx.prototype,"fetchMetadataRequired",void 0),Nu([g],Lx.prototype,"originalFieldDef",void 0),Nu([g],Lx.prototype,"fieldMetadata",void 0),Nu([g],Lx.prototype,"requestFields",void 0),Nu([g],Lx.prototype,"customRequestFields",void 0),Nu([g],Lx.prototype,"availableIndexes",void 0),Nu([g],Lx.prototype,"availableSortableFields",void 0),Nu([g],Lx.prototype,"availableCriteriaFields",void 0),Nu([g],Lx.prototype,"criteriaOnlyRequest",void 0),pt.createInterface(e=>e.aliasTo(eb));const Mx=op("foundation-ui");class wx extends(Uz(qt)){constructor(){super(...arguments),this.withGridInit=!0,this.isSnapshot=!1,this.maxRows=Pz.MAX_ROWS_250,this.maxView=Pz.MAX_VIEW_1000,this.resourceName="",this.reverse=!1,this.withTimestampFormatting=!0,this.requiresFullDataRefresh=!0,this.moreRowsAvailable=!1,this.nextRequestOffset=0,this.rowsSyncedWithStream=new Map,this.dataSubWasLoggedOff=!1,this.criteriaFromFilters=new Map,this.update=new ig(new Map),this.fetchGeneration=0}criteriaChanged(e,t){const i=e!==Xz(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}get effectiveRowId(){var e;return this.rowId?this.rowId:(null===(e=this.datasource)||void 0===e?void 0:e.resourceType)===sb.REQUEST_SERVER?Pz.REQUEST_SERVER_ROW_ID:Pz.DATASERVER_ROW_ID}reset(){this.requiresFullDataRefresh=!0,this.fetchGenesisData()}fetchGenesisData(){return Ou(this,arguments,void 0,function*(e=!0){var t,i;null===(t=this.dataSub)||void 0===t||t.unsubscribe(),this.dataSub=void 0,this.moreRowsAvailable=!1,this.nextRequestOffset=0,this.fetchGeneration+=1;const o=this.fetchGeneration,c=()=>o!==this.fetchGeneration;if(this.data)return void this.syncComponentData(this.data);const s=e||!this.datasource.initialized;s||(this.connect.dataLogoff(this.sourceRef),this.clearData()),this.sourceRef=void 0;const n=yield this.datasource.init(this.datasourceOptions(),s);if(!c())if(n){if(this.isSnapshot){const e=yield this.datasource.snapshot();if(c())return;const t=this.filterSnapshotResult(e);return this.updateRequestPagingState(e,null!==(i=null==t?void 0:t.length)&&void 0!==i?i:0,this.initialRequestOffset()),void this.syncComponentData(t)}Mx.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,"boolean"==typeof e.MORE_ROWS&&(this.moreRowsAvailable=e.MORE_ROWS);const t=e.MESSAGE_TYPE;if(t&&t===$b.LOGOFF_ACK)this.dataSubWasLoggedOff=!0;else if(this.dataSubWasLoggedOff=!1,e.ROW){const t=Hz(e);this.handleStreamUpdate(t)}else this.handleStreamUpdate(e)})}else this.handleError({message:`Genesis Datasource init failed for ${this.resourceName}`,loggerType:"error"})})}initDatasource(){return Ou(this,void 0,void 0,function*(){yield this.datasource.init(this.datasourceOptions(),!0)})}canRequestMoreRows(){if(!this.isConnected||!this.datasource||!this.moreRowsAvailable)return!1;switch(this.datasource.resourceType){case sb.REQUEST_SERVER:return!0;case sb.DATASERVER:return!!this.sourceRef&&!this.dataSubWasLoggedOff;default:return!1}}requestMoreRows(){return Ou(this,void 0,void 0,function*(){var e;if(this.canRequestMoreRows())try{if(this.datasource.resourceType===sb.DATASERVER)return void(yield this.connect.getMoreRows(this.sourceRef));const t=this.fetchGeneration,i=this.nextRequestOffset;this.moreRowsAvailable=!1;const o=yield this.datasource.snapshot({DETAILS:Object.assign(Object.assign({},null===(e=this.datasource.requestOnlyParams)||void 0===e?void 0:e.DETAILS),{OFFSET:i})});if(t!==this.fetchGeneration)return;const c=Array.isArray(null==o?void 0:o.REPLY)?o.REPLY:[];this.updateRequestPagingState(o,c.length,i),c.length>0&&this.handleStreamInserts(c)}catch(e){throw this.moreRowsAvailable=!0,this.handleError({message:`Failed to request more rows for ${this.resourceName}`,loggerType:"error",loggerArgs:[e]}),e}})}filterSnapshotResult(e){if(e)return Array.isArray(e)?e:e.REPLY?e.REPLY:e.ROW?Hz(e).inserts:void 0}updateRequestPagingState(e,t,i){if(Array.isArray(e)||!e)return void(this.moreRowsAvailable=!1);const o=e,c=Number(this.maxRows)||0;this.moreRowsAvailable="boolean"==typeof o.MORE_ROWS?o.MORE_ROWS:t>0&&c>0&&t>=c,this.nextRequestOffset="number"==typeof o.NEXT_OFFSET&&o.NEXT_OFFSET>0?o.NEXT_OFFSET:i+t}initialRequestOffset(){var e,t;return Number(null===(t=null===(e=this.datasource.requestOnlyParams)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.OFFSET)||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)return null===(i=e.REPLY)||void 0===i||i.forEach(e=>{this.rowsSyncedWithStream.set(e[this.effectiveRowId],e)}),void this.syncComponentData(Array.from(this.rowsSyncedWithStream.values()));this.handleStreamInserts(e.REPLY);const o=Array.from(this.rowsSyncedWithStream.values()).filter(t=>!e.REPLY.includes(t));this.handleStreamDeletes(o)}applyDataserverData(e){var t,i,o,c;if(this.requiresFullDataRefresh){null===(t=e.inserts)||void 0===t||t.forEach(e=>{this.rowsSyncedWithStream.set(e[this.effectiveRowId],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===(o=e.deletes)||void 0===o?void 0:o.length)>0&&this.handleStreamDeletes(e.deletes),(null===(c=e.updates)||void 0===c?void 0:c.length)>0&&this.handleStreamUpdates(e.updates)}buildCriteria(){var e;return Xz(((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:o=[]}=e;t&&Mx[i](t,...o)}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===ob.DATE||t===ob.DATETIME?Qp(e,t===ob.DATETIME):e}}Nu([gz],wx.prototype,"connect",void 0),Nu([Zz],wx.prototype,"datasource",void 0),Nu([re({mode:"boolean"})],wx.prototype,"withGridInit",void 0),Nu([re],wx.prototype,"criteria",void 0),Nu([g],wx.prototype,"data",void 0),Nu([re],wx.prototype,"fields",void 0),Nu([re({mode:"boolean"})],wx.prototype,"isSnapshot",void 0),Nu([re],wx.prototype,"maxRows",void 0),Nu([re],wx.prototype,"maxView",void 0),Nu([re],wx.prototype,"orderBy",void 0),Nu([re],wx.prototype,"request",void 0),Nu([re],wx.prototype,"resourceName",void 0),Nu([re({mode:"boolean"})],wx.prototype,"reverse",void 0),Nu([re],wx.prototype,"rowId",void 0),Nu([re({mode:"boolean",attribute:"with-timestamp-formatting"})],wx.prototype,"withTimestampFormatting",void 0);const kx=(e,t)=>!e.composedPath().includes(t),Sx=(e,t)=>e.composedPath().includes(t),$x=e=>e.tagName.toLowerCase().split("-")[0];const Ex=op("foundation-criteria");var Nx;!function(e){e.AND="&&",e.OR="||",e.NOT="!",e.GT=">",e.GE=">=",e.LT="<",e.LE="<=",e.NE="!=",e.EQ="=="}(Nx||(Nx={}));class Ax{constructor(e){this.$$operator=e}static And(){return new Ax(Nx.AND)}static Or(){return new Ax(Nx.OR)}static Not(){return new Ax(Nx.NOT)}static GreaterThan(){return new Ax(Nx.GT)}static GreaterThanOrEqual(){return new Ax(Nx.GE)}static LessThan(){return new Ax(Nx.LT)}static LessThanOrEqual(){return new Ax(Nx.LE)}static NotEqual(){return new Ax(Nx.NE)}static Equal(){return new Ax(Nx.EQ)}get operator(){return this.$$operator}}const Ox=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},Tx=e=>t=>`${t.field} ${e} ${Ox(t)}`,Rx={AND:e=>Tx(Nx.AND)(e),OR:e=>Tx(Nx.OR)(e),NOT:e=>Tx(Nx.NOT)(e),GT:e=>Tx(Nx.GT)(e),GE:e=>Tx(Nx.GE)(e),LT:e=>Tx(Nx.LT)(e),LE:e=>Tx(Nx.LE)(e),NE:e=>Tx(Nx.NE)(e),EQ:e=>Tx(Nx.EQ)(e),equals:e=>`${e.field}.equals(${Ox(e)})`,equalsIgnoreCase:e=>`${e.field}.equalsIgnoreCase(${Ox(e)})`,contains:e=>`Expr.contains(${e.field}, ${Ox(e)})`,fieldContains:e=>`${e.field}.contains(${Ox(e)})`,containsIgnoreCase:e=>`Expr.containsIgnoreCase(${e.field}, ${Ox(e)})`,startsWith:e=>`${e.field}.startsWith(${Ox(e)})`,endsWith:e=>`${e.field}.endsWith(${Ox(e)})`,dateIsToday:e=>`Expr.dateIsToday(${e.field})`,dateIsEqual:e=>`Expr.dateIsEqual(${e.field}, ${Ox(e)})`,dateIsGreaterEqual:e=>`Expr.dateIsGreaterEqual(${e.field}, ${Ox(e)})`,dateIsLessEqual:e=>`Expr.dateIsLessEqual(${e.field}, ${Ox(e)})`,dateTimeIsGreaterEqual:e=>`Expr.dateTimeIsGreaterEqual(${e.field}, ${Ox(e)})`,dateTimeIsLessEqual:e=>`Expr.dateTimeIsLessEqual(${e.field}, ${Ox(e)})`},Ix=e=>Array.isArray(e)?e:[e],Dx="default";class Fx{constructor(){this.expressions={},this.And=(e,t={})=>this.withExpression(e,t,Ax.And()),this.Or=(e,t={})=>this.withExpression(e,t,Ax.Or()),this.Not=(e,t={})=>this.withExpression(e,t,Ax.Not())}withExpression(e,t={},i=Ax.And()){const{condition:o,join:c,groupName:s}=t,n=(e,t=Dx)=>{var s;const n=null!==(s=this.expressions[t])&&void 0!==s?s:[];this.expressions[t]=[...n,{join:i||c,condition:o,expression:e}]};if(Array.isArray(e))if(c){const t=e.filter(e=>{const t=e instanceof Ax;return t&&Ex.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=c,t.flat().flatMap((e,t,i)=>i.length-1!==t?[e,a]:e));n(e,Dx)}}else n(e,Dx);else n(e,"string"==typeof e?Dx: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,o)=>this.parseExpression(e,o[i-1],t)).join("")})`}),{});return e?e(t):`(${Object.values(t).join(" && ")})`}reset(){this.expressions={}}parseExpression(e,t,i){const o=[];return i&&t&&o.push(` ${i.operator} `),"string"==typeof e?o.push(e):Array.isArray(e)?(e.forEach((e,t,i)=>{if(e instanceof Ax){if(i[t-1]instanceof Ax)throw new Error("Adjacent Join operations detected")}}),o.push(`(${e.map(e=>this.parseExpression(e,void 0)).join("")})`)):e instanceof Ax?o.push(` ${e.operator} `):e&&o.push(e.serialiser(e)),o.join("")}}class _x{constructor(e){this.serialiser=Rx.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 Hx=class extends be{constructor(){super(...arguments),this.criteriaOptions=[],this.createCriteria=e=>{const t=new Fx,{field:i,serialiser:o,value:c}=e;return Array.isArray(i)||Array.isArray(c)?t.And(Ix(c).map(e=>Ix(i).map(t=>(new _x).withField(t).withValue(e).withSerialiser(o).build())),{join:Ax.Or()}):t.And((new _x).withField(i).withValue(c).withSerialiser(o).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 Px(e,t){var i;const o=new Fx;o.withExpression((new _x).withField(null!==(i=e.labelField)&&void 0!==i?i:e.valueField).withValue(t).withSerialiser(Rx.containsIgnoreCase).build()),e.baseCriteria?e.criteria=`${e.baseCriteria} && ${o.build()}`:e.criteria=o.build()}Nu([g],Hx.prototype,"criteriaOptions",void 0),Nu([g],Hx.prototype,"prefix",void 0),Nu([g],Hx.prototype,"value",void 0),Nu([g],Hx.prototype,"selectedLabel",void 0),Hx=Nu([ye({name:"criteria-segmented-control",template:((e="rapid")=>W`<${e}-segmented-control :value="${Ep(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:Ce``})],Hx);const Vx=(e,t,i)=>W`<${t}-icon tooltip="${()=>e}" name="${()=>i}"></${t}-icon>`,Bx=e=>W`<${e}-button ${Ie("actionsOpener")}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 ${Ie("actionsMenu")}popover="manual" 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>`,Ux=W`<div class="actions-container${e=>e.isVertical?" actions-vertical":""}" part="actions-container">${e=>e.getTemplate($x(e))}</div>`;class jx 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}disconnectedCallback(){var e;(null===(e=this.actionsMenu)||void 0===e?void 0:e.matches(":popover-open"))&&this.actionsMenu.hidePopover(),super.disconnectedCallback()}updateMenuPosition(){const e=this.actionsOpener.getBoundingClientRect();this.actionsMenu.style.position="fixed",this.actionsMenu.style.top=`${e.top}px`,this.actionsMenu.style.left="auto",this.actionsMenu.style.right=window.innerWidth-e.right+"px"}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(){var e;this.classNames=Jt(["visible",this.open],["hidden",!this.open]),this.open?(this.updateMenuPosition(),this.actionsMenu.showPopover()):(null===(e=this.actionsMenu)||void 0===e?void 0:e.matches(":popover-open"))&&this.actionsMenu.hidePopover()}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 Bx(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)):Bx(e):void 0}}Nu([g],jx.prototype,"actions",void 0),Nu([re({attribute:"is-vertical",mode:"boolean"})],jx.prototype,"isVertical",void 0),Nu([re({attribute:"add-default-actions",mode:"boolean"})],jx.prototype,"addDefaultActions",void 0),Nu([re({attribute:"auto-close-on-action",mode:"boolean"})],jx.prototype,"autoCloseOnAction",void 0),Nu([g],jx.prototype,"classNames",void 0),Nu([g],jx.prototype,"definition",void 0),Nu([re],jx.prototype,"name",void 0),Nu([re({attribute:"open",mode:"boolean"})],jx.prototype,"open",void 0),Nu([re],jx.prototype,"buttonAppearance",void 0),Nu([re({attribute:"hide-disabled",mode:"boolean"})],jx.prototype,"hideDisabled",void 0),Nu([re({attribute:"hide-menu-single-option",mode:"boolean"})],jx.prototype,"hideMenuSingleOption",void 0),Nu([g],jx.prototype,"singleOption",void 0),jx.compose({baseName:"actions-menu",styles:(e,t)=>Ce` ${wu()}`,template:Ux});let qx=!1;try{"undefined"!=typeof GENX_ENABLE_AI&&(qx="true"===GENX_ENABLE_AI)}catch(rx){}const Gx=()=>qx||Rp("ai");function Wx(){return"undefined"!=typeof window&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)}op("foundation-ai");class Yx{getStatus(){return Ou(this,void 0,void 0,function*(){return{provider:"none",model:""}})}interpretCriteria(e,t){return Ou(this,void 0,void 0,function*(){return null})}}const Kx=Object.freeze({anthropic:"Anthropic",gemini:"Gemini",openai:"OpenAI",chrome:"Chrome"});Object.freeze(["anthropic","gemini"]),new Map(Object.entries(Kx).map(([e,t])=>[t.toLowerCase(),e]));class Zx{constructor(){this.noopProvider=new Yx}get(e){return e===Zx.DEFAULT_NAME?this.noopProvider:void 0}default(){return this.noopProvider}defaultName(){return Zx.DEFAULT_NAME}names(){return[Zx.DEFAULT_NAME]}getStatus(e){return Ou(this,void 0,void 0,function*(){var t,i,o;return void 0!==e&&e!==Zx.DEFAULT_NAME?null:null!==(o=yield null===(i=(t=this.noopProvider).getStatus)||void 0===i?void 0:i.call(t))&&void 0!==o?o:null})}listStatuses(){return Ou(this,void 0,void 0,function*(){var e,t,i;const o=null!==(i=yield null===(t=(e=this.noopProvider).getStatus)||void 0===t?void 0:t.call(e))&&void 0!==i?i:null;return[{name:Zx.DEFAULT_NAME,isDefault:!0,status:o}]})}}Zx.DEFAULT_NAME="default";const Qx=pt.createInterface(e=>e.singleton(Zx)),Xx=Ce` :host{display: block;width: 800px}.ai-criteria-search{display: flex;flex-direction: column;gap: calc(${hr} * 2px)}.ai-criteria-search-row{display: flex;flex-direction: row;gap: calc(${hr} * 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(${hr} * 1px);overflow-x: auto;padding: 0 calc(${hr} * 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(${hr} * 1px);padding: calc(${hr} * 0.5px) calc(${hr} * 2px);background: var(--neutral-fill-rest);border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-rest);border-radius: calc(${hr} * 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(${hr} * 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)}`,Jx=W` ${e=>(e=>W` ${He(()=>Gx(),W`<div class="ai-criteria-search"><div class="ai-criteria-search-row">${He(e=>!e.showingChips,W`<${e}-text-area ${Ie("textAreaRef")}class="criteria-input" placeholder="${e=>e.placeholder}" ?disabled=${e=>e.disabled||e.isInterpreting}:value=${Ep(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)}>
57
+ function bz(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)"__proto__"!==o&&(e[o]=i[o])}return e}pt.createInterface(e=>e.singleton(vz));var yz={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 zz=function e(t,i){function o(e,o,c){if("undefined"!=typeof document){"number"==typeof(c=bz({},i,c)).expires&&(c.expires=new Date(Date.now()+864e5*c.expires)),c.expires&&(c.expires=c.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var n in c)c[n]&&(s+="; "+n,!0!==c[n]&&(s+="="+c[n].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+s}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var i=document.cookie?document.cookie.split("; "):[],o={},c=0;c<i.length;c++){var s=i[c].split("="),n=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);if(a in o||(o[a]=t.read(n,a)),e===a)break}catch{}}return e?o[e]:o}},remove:function(e,t){o(e,"",bz({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,bz({},this.attributes,t))},withConverter:function(t){return e(bz({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(i)},converter:{value:Object.freeze(t)}})}(yz,{path:"/"});const xz=pt.createInterface();function Cz(){return(null===navigator||void 0===navigator?void 0:navigator.credentials)?"PasswordCredential"in window||(cp.warn("PasswordCredential not available in this browser."),!1):(cp.warn("CredentialsContainer not available in this browser."),!1)}const Lz=":";function Mz(e="",t=Lz,i){return e.split(t,i).map(e=>e.trim()).filter(e=>""!==e)}function wz(e,t=Lz){const i="string"==typeof e&&e.trim();return!!i&&i.includes(t)}function kz(e,t=Lz){return"string"==typeof e&&e.trim()?(e.match(new RegExp(t,"g"))||[]).length:0}function Sz(e,t=Lz){for(const i of e)if(wz(i,t))return i;return e.find(e=>"string"==typeof e&&""!==e.trim())}function $z(e,t,i){const o="string"==typeof e&&e.trim();return!o||i&&!o.includes(i)||kz(o)>1?i&&t&&i!==t?`${t}:${i}`:t||i:o}function Ez(e="credential"){cp.warn(`Unable to migrate legacy ${e} to latest format. Please remove from your browser.`)}const Nz={password:!0,mediation:"optional"},Az={cookie:{path:"/",name:"credentials",expires:7300,storePasswords:!1}};let Oz=class{constructor(e,t=Az){this.session=e,this.config=t}createBasicCredentials(e){return{type:Sb.BASIC,username:e.username,password:e.password,mfaToken:this.getMFAToken()}}createRefreshCredentials(e){var t,i,o;return{type:Sb.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!==(o=null==e?void 0:e.mfaToken)&&void 0!==o?o:this.getMFAToken()}}createSSOCredentials(e){var t;return{type:Sb.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(Lz)&&kz(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]=Mz(t.name||t.id),[o,c]=Mz(Sz([t.id,t.name]));return[{id:$z(t.id||t.name,i,c),name:i,password:t.password||""},!0]}catch(e){Ez("PasswordCredential")}if(t)try{const e=t,[i]=Mz(e.name||e.username||e.organisation),[o,c]=Mz(Sz([e.organisation||e.username||e.name]));return[{id:$z(e.id||e.username||e.name,i,c),name:i,password:e.password||""},!1]}catch(e){Ez("cookie")}return[void 0,!1]}storeCredentialsInContainer(e){return Ou(this,void 0,void 0,function*(){if(!Cz())return;const t=new PasswordCredential(e);return cp.debug("Storing credentials in CredentialsContainer"),navigator.credentials.store(t)})}getCredentialsFromContainer(){return Ou(this,arguments,void 0,function*(e=Nz){if(Cz())return cp.debug("Getting credentials from CredentialsContainer"),yield navigator.credentials.get(e)})}storeCredentialsInCookie(e){const t=Eu(e,["password"]),i=this.config.cookie.storePasswords?e:t;return cp.debug("Storing credentials in cookie"),!!zz.set(this.config.cookie.name,JSON.stringify(i),{expires:this.config.cookie.expires,domain:location.hostname,path:this.config.cookie.path,secure:!0})}getCredentialsFromCookie(){cp.debug("Getting credentials from cookie");const e=zz.get(this.config.cookie.name);return e?JSON.parse(e):void 0}storeCredentials(e){return Ou(this,void 0,void 0,function*(){if(Cz()){const t=yield this.storeCredentialsInContainer(e);return Promise.resolve(!!t)}return Promise.resolve(this.storeCredentialsInCookie(e))})}getCredentials(e){return Ou(this,void 0,void 0,function*(){return Cz()?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(){zz.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 Cz()&&navigator.credentials.preventSilentAccess()}};Oz=Nu([Au(0,Cb),Au(1,vt(xz))],Oz);const Tz=pt.createInterface(e=>e.singleton(Oz)),Rz=e=>Array.isArray(e)?e.map(e=>null!=e?e:""):[],Iz=e=>{try{if("EVENT_LOGIN_AUTH_ACK"===(null==e?void 0:e.MESSAGE_TYPE)){const{DETAILS:o}=e,c={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:o?{system:(i=o.SYSTEM,i?{date:i.DATE}:null),heartbeatIntervalSecs:o.HEARTBEAT_INTERVAL_SECS,failedLoginAttempts:o.FAILED_LOGIN_ATTEMPTS,rejectedLoginAttempts:o.REJECTED_LOGIN_ATTEMPTS,lastLoginDatetime:o.LAST_LOGIN_DATETIME,daysToPasswordExpiry:o.DAYS_TO_PASSWORD_EXPIRY,product:(t=o.PRODUCT,t?t.map(e=>({name:e.NAME,version:e.VERSION})):[])}:null,permission:Rz(e.PERMISSION),profile:Rz(e.PROFILE)};return c}throw new Error("No Entity mapping implementation for provided DTO")}catch(e){throw cp.error(e),e}var t,i};let Dz=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,o,c){this.session=e,this.connect=t,this.messageBuilder=i,this.credentialManager=o,this.currentUser=c,this.isWorking=!1,this.isLoggedInSubject=new ig(this.isLoggedIn),this.currentUser.addAuthenticationChangeListener(e=>{var t;null===(t=this.isLoggedInSubject)||void 0===t||t.next(e.detail)})}login(e){return Ou(this,void 0,void 0,function*(){var t;this.isWorking=!0;try{const i=this.messageBuilder.createLoginMessage(e),o=yield this.connect.send(i);if(!o||o.ERROR||(null===(t=o.DETAILS)||void 0===t?void 0:t.ERROR))throw new Ab(i,o);this.applyAuthResults({authToken:o.SESSION_AUTH_TOKEN,refreshToken:o.REFRESH_AUTH_TOKEN,profiles:o.PROFILE,username:o.USER_NAME,permissions:o.PERMISSION,sessionId:o.SESSION_ID}),this.currentUser.set(Iz(o)),this.session.setAuthResult(o),cp.debug("Login Authentication Result:",o)}catch(e){if(cp.error("Login Authentication Error:",e),!(e instanceof Ab&&e.isIgnorableError()))throw this.removeAuthResults(),this.currentUser.unset(),e;cp.warn("Ignoring authentication error as it is a known edge case.")}finally{this.isWorking=!1}return this.loggedUserResult})}logout(){return Ou(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:o,DETAILS:c,ERROR:s,MESSAGE_TYPE:n,OIDC_LOGOUT_URL:a}=yield this.connect.send(i),r=null!==(e=null==c?void 0:c.ERROR)&&void 0!==e?e:s,l=n===$b.LOGOUT_NACK;l&&cp.warn("Unexpected Logout NACK received during logout.",r),t={success:n===$b.LOGOUT_ACK||o===Nb.SESSION_NOT_FOUND||!l,error:r},a&&window.open(a,"_self")}catch(e){const i=new Ab(e.sentMessage,e.receivedMessage);if(cp.error("Logout Authentication Error:",i),!i.isIgnorableError())throw e;cp.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 Ou(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)===Eb.EVENT_LOGIN_AUTH_ACK)return this.session.setAuthResult(t),this.currentUser.set(Iz(t)),this.applyAuthResults(this.getLoggedUserFromMessage(t)),!0}return this.session.deleteUserFromSessionStorage(),this.currentUser.unset(),!1})}ensureConnection(){return Ou(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,o=e.REFRESH_AUTH_TOKEN;return t&&i&&o?{username:t,authToken:i,refreshToken:o,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}};Nu([g],Dz.prototype,"isWorking",void 0),Nu([g],Dz.prototype,"loggedUserResult",void 0),Dz=Nu([Au(0,Cb),Au(1,gz),Au(2,Db),Au(3,Tz),Au(4,eb)],Dz);const Fz=pt.createInterface(e=>e.singleton(Dz));function _z(e,t){const i=new Date(e),o=i.getUTCFullYear(),c=String(i.getUTCMonth()+1).padStart(2,"0"),s=String(i.getUTCDate()).padStart(2,"0");if(t)return`${o}${c}${s}`;return`${o}${c}${s}-${String(i.getUTCHours()).padStart(2,"0")}:${String(i.getUTCMinutes()).padStart(2,"0")}`}function Hz(e,t="ROW_REF"){const i=e=>{var i;const o=null!==(i=e.DETAILS[t])&&void 0!==i?i:e[t],c=Object.assign(Object.assign({},e),{[t]:o});return delete c.DETAILS,c},o=[],c=[],s=[];for(const t of e.ROW)if(t.DETAILS)switch(t.DETAILS.OPERATION){case"INSERT":o.push(i(t));break;case"MODIFY":s.push(i(t));break;case"DELETE":c.push(i(t));break;default:cp.error(`Unsupported operation type: '${t.DETAILS.OPERATION}'`)}return{inserts:o,deletes:c,updates:s,SOURCE_REF:e.SOURCE_REF}}class Pz{}Pz.MAX_ROWS_250=250,Pz.MAX_VIEW_1000=1e3,Pz.REQ_REP_POLLING_INTERVAL_MS=1e4,Pz.DATASERVER_ROW_ID="ROW_REF",Pz.REQUEST_SERVER_ROW_ID="RECORD_ID",Pz.DEFAULT_PAGINATION_PAGE_SIZE=25,Pz.DEFAULT_REQ_REP_OFFSET=0;const Vz={options:{criteria:"",isSnapshot:!1,maxRows:Pz.MAX_ROWS_250,maxView:Pz.MAX_VIEW_1000,pollingInterval:Pz.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+)\)/,o=e.match(i);if(o){const[,e]=o,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+), ?['"](.+)['"]\)/,o=e.match(i);if(o){const[,e,i]=o;t[`${e}_FROM`]=i}break}case"dateTimeIsLessEqual":{const i=/Expr\.dateTimeIsLessEqual\((\w+), ?['"](.+)['"]\)/,o=e.match(i);if(o){const[,e,i]=o;t[`${e}_TO`]=i}break}case"dateIsGreaterEqual":{const i=/Expr\.dateIsGreaterEqual\((\w+), ?['"](.+)['"]\)/,o=e.match(i);if(o){const[,e,i]=o;t[`${e}_FROM`]=i}break}case"dateIsLessEqual":{const i=/Expr\.dateIsLessEqual\((\w+), ?['"](.+)['"]\)/,o=e.match(i);if(o){const[,e,i]=o;t[`${e}_TO`]=i}break}case"containsIgnoreCase":{const i=/Expr\.containsIgnoreCase\((\w+), ?['"](.+)['"]\)/,o=e.match(i);if(o){const[,e,i]=o;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,o]=t,c=parseInt(o,10),s=e.toUpperCase(),n=s.includes("DATE")&&!s.includes("DATETIME");i[`${e}_FROM`]=_z(c,n)}const o=e.match(/([A-Z_]+)\s*<=\s*(\d+)/);if(o){const[,e,t]=o,c=parseInt(t,10),s=e.toUpperCase(),n=s.includes("DATE")&&!s.includes("DATETIME");i[`${e}_TO`]=_z(c,n)}}else!function(e,t){const i=e.substr(0,e.indexOf("=")).trim().replace(/["']/g,""),o=e.substr(e.lastIndexOf("=")+1,e.length).trim().replace(/["']/g,"");t[i]=o}(e,i)}),i},dataServerResultFilter:Hz},Bz=pt.createInterface(e=>e.instance(Vz)),Uz=e=>{class t extends e{constructor(){super(),this.hasOwnProperty("onDatasourceStatusChanged")||(this.onDatasourceStatusChanged=e=>{var t;const i=void 0!==this.data;this.resourceName||i||cp.warn("Target classes must have a resourceName or data property to use the DatasourceEventHandler mixin.");const o=e.detail;if(o.name===this.resourceName){const e=null!==(t=this.datasourceStatus)&&void 0!==t?t:{isInitialized:!1,hasMetadata:!1};(e.isInitialized!==o.isInitialized||o.metadataRequired&&e.hasMetadata!==o.hasMetadata)&&(this.datasourceStatus=o)}})}datasourceStatusChanged(e,t){cp.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(nb,this.onDatasourceStatusChanged,{passive:!0,capture:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(nb,this.onDatasourceStatusChanged,{capture:!0})}}return Nu([g],t.prototype,"datasourceStatus",void 0),t},jz={throwWhenUnavailable:!0,throwWhenUnknown:!1},qz=pt.createInterface(e=>e.instance(jz)),Gz=dp("genesis-resources");let Wz=class{constructor(e,t){this.connect=e,this.config=t}isValidResource(e){return Ou(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 Ou(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(cp.error(i),this.config.throwWhenUnknown)throw new Error(i)})}getAllResources(){return Ou(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 Ou(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(cp.error(e),this.config.throwWhenUnavailable)throw new Error(e)}this.postLoadedMessage(),this.resourcesPromise=void 0}})}postLoadedMessage(){const e=pt.getOrCreateDOMContainer().get(Gz);e.postMessage("resources-loaded",this.resources),e.close()}};Wz=Nu([Au(0,gz),Au(1,qz)],Wz);const Yz=pt.createInterface(e=>e.singleton(Wz));let Kz=class{get initialized(){var e;return!!(null===(e=this.status)||void 0===e?void 0:e.isInitialized)}constructor(e,t,i,o,c){this.connect=e,this.auth=t,this.resources=i,this.config=o,this.connectEvents=c,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 eg}triggerPoll(){this.pollTrigger$.next()}validResourceName(e){return cp.deprecated("Datasource.validResourceName","Use `GenesisResources.isValidResource` instead."),!!e&&!!e.trim().length}init(e){return Ou(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 o=this.options.resourceName;if(!(this.connect.isConnected||(yield this.connect.connect())))return cp.error(`Unable to connect to ${this.connect.host} to get ${o} datasource`),this.reportStatus(),!1;return(yield this.resources.isValidResource(o))?(this.resourceType=yield this.resources.getResourceTypeFor(o),this.resourceType?(this.fetchMetadataRequired&&(yield this.fetchAndApplyMetadata(this.options.resourceName),this._allParams=null),cp.debug(`Initializing ${o} datasource from ${this.connect.host}`),!this.options.isSnapshot&&i&&(this.pollTrigger$=new eg,this.stream=yield this.createStream()),cp.debug(`${o} datasource initialization ${this.initialized?"was successful.":"has failed."}`),this.reportStatus(),this.initialized):(cp.error(`Unable to get the resource type for ${o} datasource from ${this.connect.host}`),this.reportStatus(),!1)):(cp.error(`${o} datasource does not exist on ${this.connect.host}`),this.reportStatus(),!1)})}startStream(){return Ou(this,void 0,void 0,function*(){this.options.isSnapshot||void 0!==this.stream||(this.stream=yield this.createStream())})}destroy(){var e,t;cp.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);cp.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},cp.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=Eu(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.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 Ou(this,void 0,void 0,function*(){switch(cp.debug(`Requesting snapshot for ${this.options.resourceName} (${this.resourceType}).`),this.resourceType){case sb.DATASERVER:return this.connect.snapshot(this.options.resourceName,Object.assign(Object.assign({},this.dataserverOnlyParams),e));case sb.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 Ou(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 Ou(this,void 0,void 0,function*(){if(![sb.DATASERVER,sb.REQUEST_SERVER].includes(this.resourceType))throw new Error(`Streaming not supported for selected resource type: ${this.resourceType}`);return this.resourceType===sb.DATASERVER?this.createDataserverStream():(cp.debug(`Creating fake stream by polling ${this.options.resourceName} REQUEST_SERVER`),this.createReqRepStream())})}createDataserverStream(){return Ou(this,void 0,void 0,function*(){return this.connect.stream(this.options.resourceName,e=>{},e=>cp.error(e),this.dataserverOnlyParams)})}createReqRepStream(){this.commitResponseUnsubscribe=this.connectEvents.addCommitResponseListener(e=>{var t;const{eventName:i,response:o}=e.detail;this.options.pollTriggerEvents&&this.options.pollTriggerEvents.includes(i)&&(null===(t=o.MESSAGE_TYPE)||void 0===t?void 0:t.endsWith("_ACK"))&&(cp.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===sb.REQUEST_SERVER&&this.loadMoreCount>0){const t=25,i=(this.options.maxRows||t)*(this.loadMoreCount+1);e.DETAILS.MAX_ROWS=i}return sv([this.connect.isConnected$,this.auth.isLoggedIn$]).pipe(mv(()=>this.connect.isConnected&&this.auth.isLoggedIn),fv(()=>Yg(this.snapshot(e))))};return e?this.pollTrigger$.pipe(pv(0),fv(()=>dv(0,e).pipe(fv(t)))):this.pollTrigger$.pipe(pv(0),fv(t))}fetchAndApplyMetadata(e){return Ou(this,void 0,void 0,function*(){var t,i,o,c;try{cp.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!==(o=e.CRITERIA_FIELDS)&&void 0!==o?o:[],this.originalFieldDef=rb(e),this.fieldMetadata=ab(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===(c=this.fieldMetadata)||void 0===c?void 0:c.length)>0})}catch(t){cp.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),cp.debug(`Dispatching '${nb}'`,this.status),null==i||i.dispatchEvent(new CustomEvent(nb,{detail:this.status,bubbles:i!==document,composed:!0}))}normaliseStatus(e){var t,i,o,c,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!==(o=e.hasMetadata)&&void 0!==o?o:(null===(c=this.fieldMetadata)||void 0===c?void 0:c.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}};Nu([g],Kz.prototype,"status",void 0),Nu([g],Kz.prototype,"fetchMetadataRequired",void 0),Nu([g],Kz.prototype,"startStreamRequired",void 0),Nu([g],Kz.prototype,"originalFieldDef",void 0),Nu([g],Kz.prototype,"fieldMetadata",void 0),Nu([g],Kz.prototype,"requestFields",void 0),Nu([g],Kz.prototype,"customRequestFields",void 0),Nu([g],Kz.prototype,"availableIndexes",void 0),Nu([g],Kz.prototype,"availableSortableFields",void 0),Nu([g],Kz.prototype,"availableCriteriaFields",void 0),Nu([g],Kz.prototype,"criteriaOnlyRequest",void 0),Nu([g],Kz.prototype,"loadMoreCount",void 0),Nu([g],Kz.prototype,"readOnly",void 0),Nu([g],Kz.prototype,"stream",void 0),Kz=Nu([Au(0,gz),Au(1,Fz),Au(2,Yz),Au(3,Bz),Au(4,db)],Kz);const Zz=pt.createInterface(e=>e.transient(Kz));class Qz extends Kz{constructor(){super(...arguments),this.entityCache=[],this.entityMap=new Map,this.rowId="ROW_REF",this.initialize=e=>Ou(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===$b.LOGOFF_ACK;const t=e.ROW;!this.subscriptionLoggedOff&&t&&this.updateCache(this.config.dataServerResultFilter(e,this.rowId))}),!0):(cp.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],o=this.entityMap.get(i);if(o&&t)throw new Error("Existing entity found in map while inserting.");const c=this.mapper.fromDTO(e),s=o?Object.assign(Object.assign({},o),c):c;this.entityMap.set(i,s)})}}function Xz(e,t=";"){return e?e.split(t).map(e=>e.trim()).sort((e,t)=>e.localeCompare(t)).join(t):e}pt.createInterface(e=>e.transient(Qz));const Jz="system-health-changed",ex={windowEvents:["online","offline","pageshow"],documentEvents:["visibilitychange"],genesisConnectEvents:["stream","commit"],ignoredGenesisResources:[],startDelay:5e3,checkInterval:1e4,checkTimeout:3e3,resourceChecks:e=>Ou(void 0,void 0,void 0,function*(){const t=pt.getOrCreateDOMContainer().get(gz),i=yield t.getMoreColumns(e),o=Date.now(),c=i;return{isConnected:i.MESSAGE_TYPE===$b.MORE_COLUMNS_ACK,lastUpdated:o,lastMessage:c}}),resourceDataLogon:({message:e,functions:t})=>{const{onMessage:i,onError:o}=t;pt.getOrCreateDOMContainer().get(uz).sendForStream(e,i,o)}},tx=pt.createInterface(e=>e.instance(ex));var ix,ox={exports:{}};var cx,sx,nx=(ix||(ix=1,function(e){e.exports=function(e){var t={};function i(o){if(t[o])return t[o].exports;var c=t[o]={i:o,l:!1,exports:{}};return e[o].call(c.exports,c,c.exports,i),c.l=!0,c.exports}return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)i.d(o,c,function(t){return e[t]}.bind(null,c));return o},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 o=i(18),c=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});t.push(0);var i=t[0],o=t[1];if(10===i)switch(o){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}switch(i){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";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,o){void 0===o&&(o=!1);var c=e.getVersionPrecision(t),s=e.getVersionPrecision(i),n=Math.max(c,s),a=0,r=e.map([t,i],function(t){var i=n-e.getVersionPrecision(t),o=t+new Array(i+1).join(".0");return e.map(o.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});for(o&&(a=n-Math.min(c,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,o=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(i=0;i<e.length;i+=1)o.push(t(e[i]));return o},e.find=function(e,t){var i,o;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(i=0,o=e.length;i<o;i+=1){var c=e[i];if(t(c,i))return c}},e.assign=function(e){for(var t,i,o=e,c=arguments.length,s=new Array(c>1?c-1:0),n=1;n<c;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){o[t]=e[t]})};for(t=0,i=s.length;t<i;t+=1)a();return e},e.getBrowserAlias=function(e){return o.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return o.BROWSER_MAP[e]||""},e}();t.default=c,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={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},t.BROWSER_MAP={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},t.PLATFORMS_MAP={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},t.OS_MAP={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},t.ENGINE_MAP={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"}},90:function(e,t,i){t.__esModule=!0,t.default=void 0;var o,c=(o=i(91))&&o.__esModule?o:{default:o},s=i(18);function n(e,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var a=function(){function e(){}var t,i,o;return e.getParser=function(e,t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"string"!=typeof e)throw new Error("UserAgent should be a string");return new c.default(e,t,i)},e.parse=function(e,t){return void 0===t&&(t=null),new c.default(e,t).getResult()},t=e,o=[{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),o&&n(t,o),e}();t.default=a,e.exports=t.default},91:function(e,t,i){t.__esModule=!0,t.default=void 0;var o=r(i(92)),c=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,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e;var o=!1;"boolean"==typeof t?(o=t,this._hints=i):this._hints=null!=t&&"object"==typeof t?t:null,this.parsedResult={},!0!==o&&this.parse()}var t=e.prototype;return t.getHints=function(){return this._hints},t.hasBrand=function(e){if(!this._hints||!Array.isArray(this._hints.brands))return!1;var t=e.toLowerCase();return this._hints.brands.some(function(e){return e.brand&&e.brand.toLowerCase()===t})},t.getBrandVersion=function(e){if(this._hints&&Array.isArray(this._hints.brands)){var t=e.toLowerCase(),i=this._hints.brands.find(function(e){return e.brand&&e.brand.toLowerCase()===t});return i?i.version:void 0}},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(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.browser=t.describe(this.getUA(),this)),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(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.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={},o=0,c={},s=0;if(Object.keys(e).forEach(function(t){var n=e[t];"string"==typeof n?(c[t]=n,s+=1):"object"==typeof n&&(i[t]=n,o+=1)}),o>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(c),p=a.default.find(u,function(e){return t.isBrowser(e,!0)});if(void 0!==p)return this.compareVersion(c[p])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var i=this.getBrowserName().toLowerCase(),o=e.toLowerCase(),c=a.default.getBrowserTypeByAlias(o);return t&&c&&(o=c.toLowerCase()),o===i},t.compareVersion=function(e){var t=[0],i=e,o=!1,c=this.getBrowserVersion();if("string"==typeof c)return">"===e[0]||"<"===e[0]?(i=e.substr(1),"="===e[1]?(o=!0,i=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?i=e.substr(1):"~"===e[0]&&(o=!0,i=e.substr(1)),t.indexOf(a.default.compareVersions(c,i,o))>-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 o,c=(o=i(17))&&o.__esModule?o:{default:o},s=/version\/(\d+(\.?_?\d+)+)/i,n=[{test:[/gptbot/i],describe:function(e){var t={name:"GPTBot"},i=c.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/chatgpt-user/i],describe:function(e){var t={name:"ChatGPT-User"},i=c.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/oai-searchbot/i],describe:function(e){var t={name:"OAI-SearchBot"},i=c.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(e){var t={name:"ClaudeBot"},i=c.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(e){var t={name:"Omgilibot"},i=c.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/diffbot/i],describe:function(e){var t={name:"Diffbot"},i=c.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/perplexitybot/i],describe:function(e){var t={name:"PerplexityBot"},i=c.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/perplexity-user/i],describe:function(e){var t={name:"Perplexity-User"},i=c.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/youbot/i],describe:function(e){var t={name:"YouBot"},i=c.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-webindexer/i],describe:function(e){var t={name:"Meta-WebIndexer"},i=c.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-externalads/i],describe:function(e){var t={name:"Meta-ExternalAds"},i=c.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-externalagent/i],describe:function(e){var t={name:"Meta-ExternalAgent"},i=c.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/meta-externalfetcher/i],describe:function(e){var t={name:"Meta-ExternalFetcher"},i=c.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},i=c.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/linespider/i],describe:function(e){var t={name:"Linespider"},i=c.default.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/amazonbot/i],describe:function(e){var t={name:"AmazonBot"},i=c.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/bingbot/i],describe:function(e){var t={name:"BingCrawler"},i=c.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/baiduspider/i],describe:function(e){var t={name:"BaiduSpider"},i=c.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/duckduckbot/i],describe:function(e){var t={name:"DuckDuckBot"},i=c.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/ia_archiver/i],describe:function(e){var t={name:"InternetArchiveCrawler"},i=c.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(e){var t={name:"SlackBot"},i=c.default.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return{name:"PingdomBot"}}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},i=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},i=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},i=c.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},i=c.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},i=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},i=c.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},i=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||c.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=c.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},i=c.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=c.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=c.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=c.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},i=c.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},i=c.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=c.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},i=c.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},i=c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(s,e)||c.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=c.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},i=c.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},i=c.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/librewolf/i],describe:function(e){var t={name:"LibreWolf"},i=c.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},i=c.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=c.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(e){var t={name:"Sogou Browser"},i=c.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,e),o=c.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),s=c.default.getFirstMatch(/se ([\d.]+)x/i,e),n=i||o||s;return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},i=c.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}},{test:function(e){return!!e.hasBrand("DuckDuckGo")||e.test(/\sDdg\/[\d.]+$/i)},describe:function(e,t){var i={name:"DuckDuckGo"};if(t){var o=t.getBrandVersion("DuckDuckGo");if(o)return i.version=o,i}var s=c.default.getFirstMatch(/\sDdg\/([\d.]+)$/i,e);return s&&(i.version=s),i}},{test:function(e){return e.hasBrand("Brave")},describe:function(e,t){var i={name:"Brave"};if(t){var o=t.getBrandVersion("Brave");if(o)return i.version=o,i}return i}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},i=c.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},i=c.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=c.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=c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},i=c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},i=c.default.getFirstMatch(s,e);return i&&(t.version=i),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:c.default.getFirstMatch(t,e),version:c.default.getSecondMatch(t,e)}}}];t.default=n,e.exports=t.default},93:function(e,t,i){t.__esModule=!0,t.default=void 0;var o,c=(o=i(17))&&o.__esModule?o:{default:o},s=i(18),n=[{test:[/Roku\/DVP/],describe:function(e){var t=c.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=c.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=c.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),i=c.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=c.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return i&&(t.version=i),t}},{test:[/macintosh/i],describe:function(e){var t=c.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),i=c.default.getMacOSVersionName(t),o={name:s.OS_MAP.MacOS,version:t};return i&&(o.versionName=i),o}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=c.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:s.OS_MAP.iOS,version:t}}},{test:[/OpenHarmony/i],describe:function(e){var t=c.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.HarmonyOS,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=c.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),i=c.default.getAndroidVersionName(t),o={name:s.OS_MAP.Android,version:t};return i&&(o.versionName=i),o}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=c.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=c.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||c.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||c.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:s.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=c.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=c.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=c.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 o,c=(o=i(17))&&o.__esModule?o:{default:o},s=i(18),n=[{test:[/googlebot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/linespider/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return{type:s.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(e){var t=c.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=c.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=c.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:[/smart-?tv|smarttv/i],describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:[/netcast/i],describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{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 o,c=(o=i(17))&&o.__esModule?o:{default:o},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=c.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=c.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=c.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=c.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=c.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return i&&(t.version=i),t}}];t.default=n,e.exports=t.default}})}(ox)),ox.exports),ax=of(nx);var rx,lx=function(){if(sx)return cx;sx=1,cx=s,s.default=s,s.stable=l,s.stableStringify=l;var e="[...]",t="[Circular]",i=[],o=[];function c(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(e,t,s,n){var r;void 0===n&&(n=c()),a(e,"",0,[],void 0,0,n);try{r=0===o.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,c,s){var n=Object.getOwnPropertyDescriptor(s,c);void 0!==n.get?n.configurable?(Object.defineProperty(s,c,{value:e}),i.push([s,c,t,n])):o.push([t,c,e]):(s[c]=e,i.push([s,c,t]))}function a(i,o,c,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,o,r);if(void 0!==d.depthLimit&&l>d.depthLimit)return void n(e,i,o,r);if(void 0!==d.edgesLimit&&c+1>d.edgesLimit)return void n(e,i,o,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 p=u[h];a(i[p],p,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=c());var a,r=d(e,"",0,[],void 0,0,n)||e;try{a=0===o.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(o,c,s,a,l,h,u){var p;if(h+=1,"object"==typeof o&&null!==o){for(p=0;p<a.length;p++)if(a[p]===o)return void n(t,o,c,l);try{if("function"==typeof o.toJSON)return}catch(e){return}if(void 0!==u.depthLimit&&h>u.depthLimit)return void n(e,o,c,l);if(void 0!==u.edgesLimit&&s+1>u.edgesLimit)return void n(e,o,c,l);if(a.push(o),Array.isArray(o))for(p=0;p<o.length;p++)d(o[p],p,p,a,o,h,u);else{var f={},m=Object.keys(o).sort(r);for(p=0;p<m.length;p++){var g=m[p];d(o[g],g,p,a,o,h,u),f[g]=o[g]}if(void 0===l)return f;i.push([l,c,o]),l[c]=f}a.pop()}}function h(e){return e=void 0!==e?e:function(e,t){return t},function(t,i){if(o.length>0)for(var c=0;c<o.length;c++){var s=o[c];if(s[1]===t&&s[0]===i){i=s[2],o.splice(c,1);break}}return e.call(this,t,i)}}return cx}(),dx=of(lx);const hx=op("network-monitor",{level:Bu.info}),ux=Date.now(),px=(null===(rx=window.navigator)||void 0===rx?void 0:rx.userAgent)?ax.parse(window.navigator.userAgent):void 0,fx=(e,t={depthLimit:10,edgesLimit:10})=>e instanceof Event?`'${e.type}' Event`:"string"==typeof e?e:dx(e,void 0,2,t);class mx{constructor(){this.unsubscribableObservers=[],this.runAllChecks=(e,t)=>Ou(this,void 0,void 0,function*(){if(!this.isReady||this.isRunningChecks&&!t)return;hx.info("Run health checks, triggered by",fx(e),"| Active resources",this.resources.size),this.isRunningChecks=!0,this.synchroniseCheckInterval();let i=this.getFormattedTimestamp(this.getNowTimestamp());const o=yield this.isOnlineCheck();o?hx.debug(`Network connected at ${i}`):hx.warn(`Network disconnected at ${i}`);const c=this.normaliseSerializedSocketStatus(this.socketStatus.serialize(),o),s=this.preFlightSocketChecks(c);if(s||hx.debug("Socket pre-flight checks failed"),!o||!s){hx.debug("Aborting remaining health checks");const e=[...this.resources].reduce((e,[t,i])=>{const c=e[i.resourceName];return c?(c.sourceRef=[...c.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},o)})},{});return this.reportSystemHealth({isAuthenticated:this.user.isAuthenticated,isOnline:o,resources:e,resourcesAllConnected:!1,socket:c}),void(this.isRunningChecks=!1)}let n=!0;const a=[];this.resources.forEach((e,t)=>{const{resourceName:o,message:c,functions:s}=e,{resourceChecks:r=this.config.resourceChecks,resourceDataLogon:l=this.config.resourceDataLogon}=s,{SOURCE_REF:d}=c;let h,u,p,f,m,g=!1;a.push((()=>Ou(this,void 0,void 0,function*(){var c,s,a;try{hx.debug(`Running health check against ${o}`);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,f=e.timeout}catch(e){g=!1,h=this.getNowTimestamp(),p=e,u=null!==(c=null==e?void 0:e.receivedMessage)&&void 0!==c?c:e}return m=(null==u?void 0:u.MESSAGE_TYPE)===$b.MSG_NACK||Rb(u,vb.NOT_FOUND),i=this.getFormattedTimestamp(null!=h?h:this.getNowTimestamp()),g?hx.debug(`${o} is healthy at ${i}`):hx.warn(`${o} is not healthy at ${i}`),u&&hx.debug(`${o} messaged at ${i}`,fx(u)),p&&hx.error(`${o} errored at ${i}`,fx(p)),f&&hx.warn(`${o} timed out at ${i}`),m&&(hx.error(`${o} issue, re-attempting data logon at ${i}`),l(e)),n&&(n=g),{name:o,sourceRef:[d],isConnected:g,lastUpdated:h,lastError:p}}))())});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 hx.warn("Unexpected promise rejection occurred. Please check any custom resourceChecks return MonitoredResourceChecksResult."),e},{});hx.debug("Health checks complete"),this.reportSystemHealth({isAuthenticated:this.user.isAuthenticated,isOnline:o,resources:r,resourcesAllConnected:n,socket:c}),this.isRunningChecks=!1}),void 0!==this.config.logLevel&&(hx.level=this.config.logLevel)}create(){this.resources?hx.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:o,stream:c}=e;this.config.ignoredGenesisResources.includes(o)||this.addResource(c,{functions:t,message:i,resourceName:o})},({detail:e})=>{const{resourceName:t,stream:i}=e;this.config.ignoredGenesisResources.includes(t)||this.removeResource(i)},({detail:e})=>{var t;const{resourceName:i,stream:o,error:c}=e,s=null!==(t=c.receivedMessage)&&void 0!==t?t:c;let n="";Rb(s,vb.NOT_FOUND)?n="Please check the resource is running.":Rb(s,vb.FORBIDDEN)&&(n="You are not authorised to access this resource, removing it from monitoring.",this.removeResource(o)),hx.error(`${i} errored at ${this.getFormattedTimestamp(this.getNowTimestamp())}.`,n,c)})),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&&hx.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?hx.debug:hx.warn)("Emitting 'system-health-changed' event",fx(this.status)),null==i||i.dispatchEvent(new CustomEvent(Jz,{detail:this.status,bubbles:i!==document,composed:!0})),this.status.socket.reconnectionLimitReached&&(hx.debug("Network monitoring no longer required. Please check your network and reload your application."),this.destroy())}reportStabilityToGenesis(e){return Ou(this,void 0,void 0,function*(){return hx.debug("User requested report stability to Genesis."),hx.info("Please attach this data to your Genesis Support request: \n",JSON.stringify(e,null,2)),!0})}normaliseResourceHealth(e,t=!0){var i;const o=!!t&&e.isConnected,c=null!==(i=e.lastUpdated)&&void 0!==i?i:this.getNowTimestamp();return Object.assign(Object.assign({},e),{isConnected:o,lastUpdated:c})}normaliseSerializedSocketStatus(e,t=!0){const i=!!t&&e.isConnected,o=!i;return Object.assign(Object.assign({},e),{isConnected:i,isDisconnected:o})}normaliseEventDetail(e){var t,i,o,c;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!==(o=e.lastUpdated)&&void 0!==o?o:this.getNowTimestamp(),a=null!==(c=e.nextUpdate)&&void 0!==c?c:this.getNextTimestamp(),r=e.isAuthenticated&&this.user?this.user.username:void 0,l=Object.assign(Object.assign({},e),{browserInformation:px,username:r,isHealthy:s,lastUpdated:n,nextUpdate:a,firstUpdated:ux,runAllChecks:()=>{hx.debug("User activated run checks command starting."),this.runAllChecks("user requested")},reportStabilityToGenesis:()=>this.reportStabilityToGenesis(l)});return l}preFlightSocketChecks(e){if(!e.isConfigured)return hx.debug("Socket not configured"),!1;if(e.isReconnecting)return hx.debug("Socket reconnecting"),!1;if(e.isConnecting)return hx.debug("Socket connecting"),!1;if(e.isDisconnected){const t=e.isDisconnectedByServer?`by the server, code: ${e.closedCode}, reason: ${e.closedReason}`:"";return hx.debug(`Socket disconnected ${t}`),e.reconnectionLimitReached&&hx.debug("Socket reconnection limit reached"),!1}const t=this.user.isAuthenticated?"with":"without";return hx.debug(`Socket connected ${t} valid session`),!0}getFormattedTimestamp(e){return Zp(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)}}Nu([tx],mx.prototype,"config",void 0),Nu([az],mx.prototype,"socketStatus",void 0),Nu([db],mx.prototype,"connectEvents",void 0),Nu([eb],mx.prototype,"user",void 0),Nu([g],mx.prototype,"status",void 0);const gx=pt.createInterface(e=>e.singleton(mx)),vx={account:"genesis",namespace:"default",authKey:"kv-default",authEmail:void 0},bx=pt.createInterface();var yx,zx;!function(e){e.REQ_KEY_VALUE_LIST="REQ_KEY_VALUE_LIST",e.REQ_KEY_VALUE_READ="REQ_KEY_VALUE_READ"}(yx||(yx={})),function(e){e.EVENT_KEY_VALUE_PUT="EVENT_KEY_VALUE_PUT",e.EVENT_KEY_VALUE_DELETE="EVENT_KEY_VALUE_DELETE"}(zx||(zx={}));let xx=class{constructor(e,t,i=vx){this.connect=e,this.user=t,this.kvStorageConfig=i}delete(e){return Ou(this,void 0,void 0,function*(){const t={DETAILS:{KEYS:e}},i=yield this.connect.commitEvent(zx.EVENT_KEY_VALUE_DELETE,t);return!(!i||"EVENT_ACK"!==i.MESSAGE_TYPE)||{ERROR:i.ERROR,WARNING:i.WARNING}})}get(e){return Ou(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}},o=yield this.connect.request(yx.REQ_KEY_VALUE_READ,i);if(o&&o.REPLY&&o.REPLY.length>0){const t=o.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=Op(e);return"string"==typeof t&&t.startsWith("str:")&&(t=Op(t)),"string"==typeof t&&t.startsWith("bin:")&&(t=Op(t)),t}list(){return Ou(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(yx.REQ_KEY_VALUE_LIST,t);if(i&&i.REPLY&&i.REPLY.length>0){return i.REPLY.map(e=>e.KEY)}return[]})}put(e){return Ou(this,void 0,void 0,function*(){const t={DETAILS:{RECORDS:e.map(e=>({KEY:e.key,VALUE:e.base64?Tp(e.value):e.value}))}},i=yield this.connect.commitEvent(zx.EVENT_KEY_VALUE_PUT,t);return!(!i||"EVENT_ACK"!==i.MESSAGE_TYPE)||{ERROR:i.ERROR,WARNING:i.WARNING}})}};xx=Nu([Au(0,gz),Au(1,eb),Au(2,vt(bx))],xx),pt.createInterface(e=>e.singleton(xx));class Cx{constructor(){this.isWorking=!1,this.loggedUserResult=null,this.currentUser=null,this.isLoggedIn=!1,this.isLoggedInSubject=new ig(!1)}get isLoggedIn$(){return this.isLoggedInSubject.asObservable()}login(e){return Ou(this,void 0,void 0,function*(){return Promise.resolve(this.nextLoginResult)})}logout(){return Ou(this,void 0,void 0,function*(){return Promise.resolve(this.nextLogoutResult)})}reAuthFromSession(){return Ou(this,void 0,void 0,function*(){return Promise.resolve(this.nextReAuthResult)})}setTestUser(e={}){this.currentUser=new Jv,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)}}Nu([g],Cx.prototype,"isWorking",void 0),Nu([g],Cx.prototype,"loggedUserResult",void 0),Nu([g],Cx.prototype,"currentUser",void 0),Nu([g],Cx.prototype,"isLoggedIn",void 0);class Lx{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,o;this.availableIndexes=null!==(t=e.INDEXES)&&void 0!==t?t:[],this.availableSortableFields=null!==(i=e.SORTABLE_FIELDS)&&void 0!==i?i:[],this.availableCriteriaFields=null!==(o=e.CRITERIA_FIELDS)&&void 0!==o?o:[],this.originalFieldDef=rb(e),this.fieldMetadata=ab(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=Yg(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){}}Nu([g],Lx.prototype,"status",void 0),Nu([g],Lx.prototype,"fetchMetadataRequired",void 0),Nu([g],Lx.prototype,"originalFieldDef",void 0),Nu([g],Lx.prototype,"fieldMetadata",void 0),Nu([g],Lx.prototype,"requestFields",void 0),Nu([g],Lx.prototype,"customRequestFields",void 0),Nu([g],Lx.prototype,"availableIndexes",void 0),Nu([g],Lx.prototype,"availableSortableFields",void 0),Nu([g],Lx.prototype,"availableCriteriaFields",void 0),Nu([g],Lx.prototype,"criteriaOnlyRequest",void 0),pt.createInterface(e=>e.aliasTo(eb));const Mx=op("foundation-ui");class wx extends(Uz(qt)){constructor(){super(...arguments),this.withGridInit=!0,this.isSnapshot=!1,this.maxRows=Pz.MAX_ROWS_250,this.maxView=Pz.MAX_VIEW_1000,this.resourceName="",this.reverse=!1,this.withTimestampFormatting=!0,this.requiresFullDataRefresh=!0,this.moreRowsAvailable=!1,this.nextRequestOffset=0,this.rowsSyncedWithStream=new Map,this.dataSubWasLoggedOff=!1,this.criteriaFromFilters=new Map,this.update=new ig(new Map),this.fetchGeneration=0}criteriaChanged(e,t){const i=e!==Xz(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}get effectiveRowId(){var e;return this.rowId?this.rowId:(null===(e=this.datasource)||void 0===e?void 0:e.resourceType)===sb.REQUEST_SERVER?Pz.REQUEST_SERVER_ROW_ID:Pz.DATASERVER_ROW_ID}reset(){this.requiresFullDataRefresh=!0,this.fetchGenesisData()}fetchGenesisData(){return Ou(this,arguments,void 0,function*(e=!0){var t,i;null===(t=this.dataSub)||void 0===t||t.unsubscribe(),this.dataSub=void 0,this.moreRowsAvailable=!1,this.nextRequestOffset=0,this.fetchGeneration+=1;const o=this.fetchGeneration,c=()=>o!==this.fetchGeneration;if(this.data)return void this.syncComponentData(this.data);const s=e||!this.datasource.initialized;s||(this.connect.dataLogoff(this.sourceRef),this.clearData()),this.sourceRef=void 0;const n=yield this.datasource.init(this.datasourceOptions(),s);if(!c())if(n){if(this.isSnapshot){const e=yield this.datasource.snapshot();if(c())return;const t=this.filterSnapshotResult(e);return this.updateRequestPagingState(e,null!==(i=null==t?void 0:t.length)&&void 0!==i?i:0,this.initialRequestOffset()),void this.syncComponentData(t)}Mx.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,"boolean"==typeof e.MORE_ROWS&&(this.moreRowsAvailable=e.MORE_ROWS);const t=e.MESSAGE_TYPE;if(t&&t===$b.LOGOFF_ACK)this.dataSubWasLoggedOff=!0;else if(this.dataSubWasLoggedOff=!1,e.ROW){const t=Hz(e);this.handleStreamUpdate(t)}else this.handleStreamUpdate(e)})}else this.handleError({message:`Genesis Datasource init failed for ${this.resourceName}`,loggerType:"error"})})}initDatasource(){return Ou(this,void 0,void 0,function*(){yield this.datasource.init(this.datasourceOptions(),!0)})}canRequestMoreRows(){if(!this.isConnected||!this.datasource||!this.moreRowsAvailable)return!1;switch(this.datasource.resourceType){case sb.REQUEST_SERVER:return!0;case sb.DATASERVER:return!!this.sourceRef&&!this.dataSubWasLoggedOff;default:return!1}}requestMoreRows(){return Ou(this,void 0,void 0,function*(){var e;if(this.canRequestMoreRows())try{if(this.datasource.resourceType===sb.DATASERVER)return void(yield this.connect.getMoreRows(this.sourceRef));const t=this.fetchGeneration,i=this.nextRequestOffset;this.moreRowsAvailable=!1;const o=yield this.datasource.snapshot({DETAILS:Object.assign(Object.assign({},null===(e=this.datasource.requestOnlyParams)||void 0===e?void 0:e.DETAILS),{OFFSET:i})});if(t!==this.fetchGeneration)return;const c=Array.isArray(null==o?void 0:o.REPLY)?o.REPLY:[];this.updateRequestPagingState(o,c.length,i),c.length>0&&this.handleStreamInserts(c)}catch(e){throw this.moreRowsAvailable=!0,this.handleError({message:`Failed to request more rows for ${this.resourceName}`,loggerType:"error",loggerArgs:[e]}),e}})}filterSnapshotResult(e){if(e)return Array.isArray(e)?e:e.REPLY?e.REPLY:e.ROW?Hz(e).inserts:void 0}updateRequestPagingState(e,t,i){if(Array.isArray(e)||!e)return void(this.moreRowsAvailable=!1);const o=e,c=o.NEXT_OFFSET,s="number"==typeof c&&c>i,n=Number(this.maxRows)||0,a=t>0&&n>0&&t>=n;this.moreRowsAvailable="boolean"==typeof o.MORE_ROWS?o.MORE_ROWS:-1!==c&&(s||a),this.nextRequestOffset=s?c:i+t}initialRequestOffset(){var e,t;return Number(null===(t=null===(e=this.datasource.requestOnlyParams)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.OFFSET)||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)return null===(i=e.REPLY)||void 0===i||i.forEach(e=>{this.rowsSyncedWithStream.set(e[this.effectiveRowId],e)}),void this.syncComponentData(Array.from(this.rowsSyncedWithStream.values()));this.handleStreamInserts(e.REPLY);const o=Array.from(this.rowsSyncedWithStream.values()).filter(t=>!e.REPLY.includes(t));this.handleStreamDeletes(o)}applyDataserverData(e){var t,i,o,c;if(this.requiresFullDataRefresh){null===(t=e.inserts)||void 0===t||t.forEach(e=>{this.rowsSyncedWithStream.set(e[this.effectiveRowId],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===(o=e.deletes)||void 0===o?void 0:o.length)>0&&this.handleStreamDeletes(e.deletes),(null===(c=e.updates)||void 0===c?void 0:c.length)>0&&this.handleStreamUpdates(e.updates)}buildCriteria(){var e;return Xz(((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:o=[]}=e;t&&Mx[i](t,...o)}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===ob.DATE||t===ob.DATETIME?Qp(e,t===ob.DATETIME):e}}Nu([gz],wx.prototype,"connect",void 0),Nu([Zz],wx.prototype,"datasource",void 0),Nu([re({mode:"boolean"})],wx.prototype,"withGridInit",void 0),Nu([re],wx.prototype,"criteria",void 0),Nu([g],wx.prototype,"data",void 0),Nu([re],wx.prototype,"fields",void 0),Nu([re({mode:"boolean"})],wx.prototype,"isSnapshot",void 0),Nu([re],wx.prototype,"maxRows",void 0),Nu([re],wx.prototype,"maxView",void 0),Nu([re],wx.prototype,"orderBy",void 0),Nu([re],wx.prototype,"request",void 0),Nu([re],wx.prototype,"resourceName",void 0),Nu([re({mode:"boolean"})],wx.prototype,"reverse",void 0),Nu([re],wx.prototype,"rowId",void 0),Nu([re({mode:"boolean",attribute:"with-timestamp-formatting"})],wx.prototype,"withTimestampFormatting",void 0);const kx=(e,t)=>!e.composedPath().includes(t),Sx=(e,t)=>e.composedPath().includes(t),$x=e=>e.tagName.toLowerCase().split("-")[0];const Ex=op("foundation-criteria");var Nx;!function(e){e.AND="&&",e.OR="||",e.NOT="!",e.GT=">",e.GE=">=",e.LT="<",e.LE="<=",e.NE="!=",e.EQ="=="}(Nx||(Nx={}));class Ax{constructor(e){this.$$operator=e}static And(){return new Ax(Nx.AND)}static Or(){return new Ax(Nx.OR)}static Not(){return new Ax(Nx.NOT)}static GreaterThan(){return new Ax(Nx.GT)}static GreaterThanOrEqual(){return new Ax(Nx.GE)}static LessThan(){return new Ax(Nx.LT)}static LessThanOrEqual(){return new Ax(Nx.LE)}static NotEqual(){return new Ax(Nx.NE)}static Equal(){return new Ax(Nx.EQ)}get operator(){return this.$$operator}}const Ox=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},Tx=e=>t=>`${t.field} ${e} ${Ox(t)}`,Rx={AND:e=>Tx(Nx.AND)(e),OR:e=>Tx(Nx.OR)(e),NOT:e=>Tx(Nx.NOT)(e),GT:e=>Tx(Nx.GT)(e),GE:e=>Tx(Nx.GE)(e),LT:e=>Tx(Nx.LT)(e),LE:e=>Tx(Nx.LE)(e),NE:e=>Tx(Nx.NE)(e),EQ:e=>Tx(Nx.EQ)(e),equals:e=>`${e.field}.equals(${Ox(e)})`,equalsIgnoreCase:e=>`${e.field}.equalsIgnoreCase(${Ox(e)})`,contains:e=>`Expr.contains(${e.field}, ${Ox(e)})`,fieldContains:e=>`${e.field}.contains(${Ox(e)})`,containsIgnoreCase:e=>`Expr.containsIgnoreCase(${e.field}, ${Ox(e)})`,startsWith:e=>`${e.field}.startsWith(${Ox(e)})`,endsWith:e=>`${e.field}.endsWith(${Ox(e)})`,dateIsToday:e=>`Expr.dateIsToday(${e.field})`,dateIsEqual:e=>`Expr.dateIsEqual(${e.field}, ${Ox(e)})`,dateIsGreaterEqual:e=>`Expr.dateIsGreaterEqual(${e.field}, ${Ox(e)})`,dateIsLessEqual:e=>`Expr.dateIsLessEqual(${e.field}, ${Ox(e)})`,dateTimeIsGreaterEqual:e=>`Expr.dateTimeIsGreaterEqual(${e.field}, ${Ox(e)})`,dateTimeIsLessEqual:e=>`Expr.dateTimeIsLessEqual(${e.field}, ${Ox(e)})`},Ix=e=>Array.isArray(e)?e:[e],Dx="default";class Fx{constructor(){this.expressions={},this.And=(e,t={})=>this.withExpression(e,t,Ax.And()),this.Or=(e,t={})=>this.withExpression(e,t,Ax.Or()),this.Not=(e,t={})=>this.withExpression(e,t,Ax.Not())}withExpression(e,t={},i=Ax.And()){const{condition:o,join:c,groupName:s}=t,n=(e,t=Dx)=>{var s;const n=null!==(s=this.expressions[t])&&void 0!==s?s:[];this.expressions[t]=[...n,{join:i||c,condition:o,expression:e}]};if(Array.isArray(e))if(c){const t=e.filter(e=>{const t=e instanceof Ax;return t&&Ex.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=c,t.flat().flatMap((e,t,i)=>i.length-1!==t?[e,a]:e));n(e,Dx)}}else n(e,Dx);else n(e,"string"==typeof e?Dx: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,o)=>this.parseExpression(e,o[i-1],t)).join("")})`}),{});return e?e(t):`(${Object.values(t).join(" && ")})`}reset(){this.expressions={}}parseExpression(e,t,i){const o=[];return i&&t&&o.push(` ${i.operator} `),"string"==typeof e?o.push(e):Array.isArray(e)?(e.forEach((e,t,i)=>{if(e instanceof Ax){if(i[t-1]instanceof Ax)throw new Error("Adjacent Join operations detected")}}),o.push(`(${e.map(e=>this.parseExpression(e,void 0)).join("")})`)):e instanceof Ax?o.push(` ${e.operator} `):e&&o.push(e.serialiser(e)),o.join("")}}class _x{constructor(e){this.serialiser=Rx.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 Hx=class extends be{constructor(){super(...arguments),this.criteriaOptions=[],this.createCriteria=e=>{const t=new Fx,{field:i,serialiser:o,value:c}=e;return Array.isArray(i)||Array.isArray(c)?t.And(Ix(c).map(e=>Ix(i).map(t=>(new _x).withField(t).withValue(e).withSerialiser(o).build())),{join:Ax.Or()}):t.And((new _x).withField(i).withValue(c).withSerialiser(o).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 Px(e,t){var i;const o=new Fx;o.withExpression((new _x).withField(null!==(i=e.labelField)&&void 0!==i?i:e.valueField).withValue(t).withSerialiser(Rx.containsIgnoreCase).build()),e.baseCriteria?e.criteria=`${e.baseCriteria} && ${o.build()}`:e.criteria=o.build()}Nu([g],Hx.prototype,"criteriaOptions",void 0),Nu([g],Hx.prototype,"prefix",void 0),Nu([g],Hx.prototype,"value",void 0),Nu([g],Hx.prototype,"selectedLabel",void 0),Hx=Nu([ye({name:"criteria-segmented-control",template:((e="rapid")=>W`<${e}-segmented-control :value="${Ep(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:Ce``})],Hx);const Vx=(e,t,i)=>W`<${t}-icon tooltip="${()=>e}" name="${()=>i}"></${t}-icon>`,Bx=e=>W`<${e}-button ${Ie("actionsOpener")}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 ${Ie("actionsMenu")}popover="manual" 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>`,Ux=W`<div class="actions-container${e=>e.isVertical?" actions-vertical":""}" part="actions-container">${e=>e.getTemplate($x(e))}</div>`;class jx 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}disconnectedCallback(){var e;(null===(e=this.actionsMenu)||void 0===e?void 0:e.matches(":popover-open"))&&this.actionsMenu.hidePopover(),super.disconnectedCallback()}updateMenuPosition(){const e=this.actionsOpener.getBoundingClientRect();this.actionsMenu.style.position="fixed",this.actionsMenu.style.top=`${e.top}px`,this.actionsMenu.style.left="auto",this.actionsMenu.style.right=window.innerWidth-e.right+"px"}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(){var e;this.classNames=Jt(["visible",this.open],["hidden",!this.open]),this.open?(this.updateMenuPosition(),this.actionsMenu.showPopover()):(null===(e=this.actionsMenu)||void 0===e?void 0:e.matches(":popover-open"))&&this.actionsMenu.hidePopover()}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 Bx(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)):Bx(e):void 0}}Nu([g],jx.prototype,"actions",void 0),Nu([re({attribute:"is-vertical",mode:"boolean"})],jx.prototype,"isVertical",void 0),Nu([re({attribute:"add-default-actions",mode:"boolean"})],jx.prototype,"addDefaultActions",void 0),Nu([re({attribute:"auto-close-on-action",mode:"boolean"})],jx.prototype,"autoCloseOnAction",void 0),Nu([g],jx.prototype,"classNames",void 0),Nu([g],jx.prototype,"definition",void 0),Nu([re],jx.prototype,"name",void 0),Nu([re({attribute:"open",mode:"boolean"})],jx.prototype,"open",void 0),Nu([re],jx.prototype,"buttonAppearance",void 0),Nu([re({attribute:"hide-disabled",mode:"boolean"})],jx.prototype,"hideDisabled",void 0),Nu([re({attribute:"hide-menu-single-option",mode:"boolean"})],jx.prototype,"hideMenuSingleOption",void 0),Nu([g],jx.prototype,"singleOption",void 0),jx.compose({baseName:"actions-menu",styles:(e,t)=>Ce` ${wu()}`,template:Ux});let qx=!1;try{"undefined"!=typeof GENX_ENABLE_AI&&(qx="true"===GENX_ENABLE_AI)}catch(rx){}const Gx=()=>qx||Rp("ai");function Wx(){return"undefined"!=typeof window&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)}op("foundation-ai");class Yx{getStatus(){return Ou(this,void 0,void 0,function*(){return{provider:"none",model:""}})}interpretCriteria(e,t){return Ou(this,void 0,void 0,function*(){return null})}}const Kx=Object.freeze({anthropic:"Anthropic",gemini:"Gemini",openai:"OpenAI",chrome:"Chrome"});Object.freeze(["anthropic","gemini"]),new Map(Object.entries(Kx).map(([e,t])=>[t.toLowerCase(),e]));class Zx{constructor(){this.noopProvider=new Yx}get(e){return e===Zx.DEFAULT_NAME?this.noopProvider:void 0}default(){return this.noopProvider}defaultName(){return Zx.DEFAULT_NAME}names(){return[Zx.DEFAULT_NAME]}getStatus(e){return Ou(this,void 0,void 0,function*(){var t,i,o;return void 0!==e&&e!==Zx.DEFAULT_NAME?null:null!==(o=yield null===(i=(t=this.noopProvider).getStatus)||void 0===i?void 0:i.call(t))&&void 0!==o?o:null})}listStatuses(){return Ou(this,void 0,void 0,function*(){var e,t,i;const o=null!==(i=yield null===(t=(e=this.noopProvider).getStatus)||void 0===t?void 0:t.call(e))&&void 0!==i?i:null;return[{name:Zx.DEFAULT_NAME,isDefault:!0,status:o}]})}}Zx.DEFAULT_NAME="default";const Qx=pt.createInterface(e=>e.singleton(Zx)),Xx=Ce` :host{display: block;width: 800px}.ai-criteria-search{display: flex;flex-direction: column;gap: calc(${hr} * 2px)}.ai-criteria-search-row{display: flex;flex-direction: row;gap: calc(${hr} * 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(${hr} * 1px);overflow-x: auto;padding: 0 calc(${hr} * 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(${hr} * 1px);padding: calc(${hr} * 0.5px) calc(${hr} * 2px);background: var(--neutral-fill-rest);border: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-rest);border-radius: calc(${hr} * 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(${hr} * 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)}`,Jx=W` ${e=>(e=>W` ${He(()=>Gx(),W`<div class="ai-criteria-search"><div class="ai-criteria-search-row">${He(e=>!e.showingChips,W`<${e}-text-area ${Ie("textAreaRef")}class="criteria-input" placeholder="${e=>e.placeholder}" ?disabled=${e=>e.disabled||e.isInterpreting}:value=${Ep(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
  &#x2715;
59
59
  </button></span>`)}</div>`)}<${e}-button class="criteria-toggle-button" appearance="outline" title=${e=>e.showingChips?"Add more criteria":"View active filters"}?disabled=${e=>0===e.activeGroups.length||e.isInterpreting}@click=${e=>e.toggleCriteriaView()}><${e}-icon name="pen" size="sm"></${e}-icon></${e}-button><${e}-button class="criteria-clear-button" appearance="outline" title="Clear all filters" ?disabled=${e=>0===e.activeGroups.length||e.isInterpreting}@click=${e=>e.clearChips()}><${e}-icon name="trash-alt" size="sm"></${e}-icon></${e}-button>${He(e=>e.speechAvailable,W`<${e}-button class="mic-button" appearance="${e=>e.isRecording?"accent":"outline"}" ?disabled=${e=>e.disabled||e.isInterpreting}@click=${e=>e.toggleSpeechInput()}title=${e=>e.isRecording?"Stop recording":"Start voice input"}><${e}-icon class="mic-icon" name="microphone" size="lg" variant="solid"></${e}-icon></${e}-button>`)}</div></div>`)} `)($x(e))} `,eC={contains:Rx.containsIgnoreCase,equals:Rx.EQ,startsWith:Rx.startsWith,endsWith:Rx.endsWith,greaterThan:Rx.GT,lessThan:Rx.LT,greaterThanOrEqual:Rx.GE,lessThanOrEqual:Rx.LE,notEqual:Rx.NE,dateIsToday:Rx.dateIsToday,dateIsAfter:Rx.dateIsGreaterEqual,dateIsGreaterEqual:Rx.dateIsGreaterEqual,dateIsBefore:Rx.dateIsLessEqual,dateIsLessEqual:Rx.dateIsLessEqual,dateIsEqual:Rx.dateIsEqual,dateTimeIsAfter:Rx.dateTimeIsGreaterEqual,dateTimeIsGreaterEqual:Rx.dateTimeIsGreaterEqual,dateTimeIsBefore:Rx.dateTimeIsLessEqual,dateTimeIsLessEqual:Rx.dateTimeIsLessEqual};function tC(e){var t,i;const o=null!==(t=eC[e.operator])&&void 0!==t?t:Rx.containsIgnoreCase;return(new _x).withField(e.field).withValue(null!==(i=e.value)&&void 0!==i?i:null).withSerialiser(o).withGroup("default").build()}function iC(e,t){return 1===e.length?e[0]:e.reduce((e,i,o)=>0===o?[i]:[...e,t,i],[])}function oC(e){var t;const i=new Fx;let o=!1;for(const c of e){if(!(null===(t=c.clauses)||void 0===t?void 0:t.length))continue;const e=c.clauses.map(tC),s="or"===c.logic?Ax.Or():Ax.And(),n=iC(e,s),a=e.length>1?{join:s}:{};c.negated?i.And([Ax.Not(),n]):i.And(1===e.length?e[0]:e,a),o=!0}return o?i.build():""}const cC=["contains","equals","startsWith","endsWith","notEqual"],sC=["equals","greaterThan","lessThan","greaterThanOrEqual","lessThanOrEqual","notEqual"],nC=["dateIsToday","dateIsAfter","dateIsBefore","dateIsEqual","dateIsGreaterEqual","dateIsLessEqual"],aC=["dateTimeIsAfter","dateTimeIsBefore","dateTimeIsGreaterEqual","dateTimeIsLessEqual"],rC={contains:"contains",equals:"=",startsWith:"starts with",endsWith:"ends with",notEqual:"≠",greaterThan:">",lessThan:"<",greaterThanOrEqual:"≥",lessThanOrEqual:"≤",dateIsToday:"is today",dateIsAfter:"after",dateIsBefore:"before",dateIsEqual:"=",dateIsGreaterEqual:"≥",dateIsLessEqual:"≤",dateTimeIsAfter:"after",dateTimeIsBefore:"before",dateTimeIsGreaterEqual:"≥",dateTimeIsLessEqual:"≤"},lC=new Set(["DATE","LOCALDATE"]),dC=new Set(["DATETIME","NANO_TIMESTAMP","LOCALDATETIME","TIMESTAMP"]),hC=new Set(["INT","INTEGER","LONG","SHORT","DOUBLE","BIGDECIMAL","DECIMAL"]);function uC(e){return(e||"").toUpperCase().trim().split("(")[0].trim()}function pC(e){const t=uC(e);return lC.has(t)?nC:dC.has(t)?aC:hC.has(t)?sC:cC}function fC(e){return hC.has(uC(e))}function mC(e){return null!=e&&("number"==typeof e?!Number.isNaN(e)&&e>0:"string"==typeof e&&(/^\d{8}$/.test(e)||/^\d{4}-\d{2}-\d{2}$/.test(e)||/^\d{8}-\d{2}:\d{2}(:\d{2})?$/.test(e)))}function gC(e){return null!=e&&("number"==typeof e?!Number.isNaN(e):"string"==typeof e&&!Number.isNaN(Number(e)))}function vC(e,t){const i=[],o=[],c=new Map;if(Array.isArray(t)&&t.length>0){"string"==typeof t[0]?t.forEach(e=>c.set(e,void 0)):t.forEach(e=>c.set(e.NAME,e))}for(const t of e){const{field:e,operator:s,value:n}=t;if(!e||"string"!=typeof e){o.push({field:String(e),message:"Field name is required"});continue}const a=c.get(e),r=a&&"TYPE"in a?a.TYPE:"STRING";pC(r).includes(s)?!nC.includes(s)&&!aC.includes(s)||"dateIsToday"===s||mC(n)?fC(r)&&sC.includes(s)&&!gC(n)?o.push({field:e,operator:s,value:n,message:"Invalid numeric value"}):c.size>0&&!c.has(e)?o.push({field:e,operator:s,value:n,message:`Unknown field '${e}'`}):i.push(t):o.push({field:e,operator:s,value:n,message:"Invalid date/datetime value; use yyyyMMdd, yyyy-MM-dd, or epoch"}):o.push({field:e,operator:s,value:n,message:`Operator '${s}' is not allowed for field type ${r}`})}return{valid:i,invalid:o}}const bC=op("foundation-notifications");let yC=null;const zC=new Map,xC=e=>{var t,i;return`${null!==(t=null==e?void 0:e.title)&&void 0!==t?t:"Error"}: ${null!==(i=null==e?void 0:e.body)&&void 0!==i?i:"Something went wrong"}`},CC=e=>{var t;return(null==e?void 0:e.logLevel)||(null===(t=null==e?void 0:e.config)||void 0===t?void 0:t.logLevel)||Bu.debug},LC=e=>{bC.log({message:xC(e),level:CC(e)})},MC=(e,t)=>{let i=document.querySelector(`#${e}`);if(!i)if(zC.has(e))i=zC.get(e);else{const t=vp(document).find(t=>t.id===e);t&&(i=t,zC.set(e,t))}if(!i){i=document.createElement("div"),i.setAttribute("id",e),i.style.zIndex="9999";const{element:t,prefix:o}=bp(document.body,"rapid");if(t)t.appendChild(i),yC=t;else if(yC)yC.appendChild(i);else{const e=document.createElement(`${o}-design-system-provider`);e.appendChild(i),document.body.appendChild(e),yC=e}}return i},wC=()=>{const e=document.createElement("div");return e.setAttribute("id","banner-anchor"),e.style.position="relative",document.body.insertBefore(e,document.body.firstChild),e};var kC,SC,$C;!function(e){e.NOTIFICATION_EVENT="notification-event"}(kC||(kC={})),function(e){e.Top="top",e.Bottom="bottom"}(SC||(SC={})),function(e){e.Left="left",e.Right="right"}($C||($C={}));const EC="12px";const NC=(e,t,i)=>{var o,c,s,n,a,r,l,d,h,u,p,f,m,g,v,b,y,z,x;LC(e);const C=t.split("-")[0],L=(null===(c=null===(o=null==e?void 0:e.config)||void 0===o?void 0:o.toast)||void 0===c?void 0:c.position)||"top-right",M=null!==(s=null!=i?i:(e=>vp(document.body).find(t=>"notify-container"===t.tagName.toLowerCase()&&t.position===e))(L))&&void 0!==s?s:MC("notify-container");M&&"notify-container"!==M.tagName.toLowerCase()&&function(e,t){var i,o;switch(t.style.position="fixed",null===(o=null===(i=null==e?void 0:e.config)||void 0===i?void 0:i.toast)||void 0===o?void 0:o.position){case"top-left":t.style.top="var(--nav-height, 0)",t.style.left="0";break;case"bottom-left":t.style.bottom="0",t.style.left="0";break;case"bottom-right":t.style.bottom="0",t.style.right="0";break;default:t.style.top="var(--nav-height, 0)",t.style.right="0"}}(e,M);const w=document.createElement(`${C}-toast`),k=document.createElement("div");k.setAttribute("slot","top"),k.textContent=e.title;const S=document.createElement("div");S.setAttribute("slot","content"),S.textContent=(null==e?void 0:e.body)||"";const $=document.createElement("div");let E;$.setAttribute("slot","date"),$.textContent=(null===(n=null==e?void 0:e.createdAt)||void 0===n?void 0:n.toLocaleTimeString())||"",(null===(r=null===(a=null==e?void 0:e.config)||void 0===a?void 0:a.toast)||void 0===r?void 0:r.buttons)&&(null===(h=null===(d=null===(l=null==e?void 0:e.config)||void 0===l?void 0:l.toast)||void 0===d?void 0:d.buttons)||void 0===h?void 0:h.length)&&(E=document.createElement("div"),E.setAttribute("slot","bottom"),e.config.toast.buttons.forEach(t=>{const i=document.createElement(`${C}-button`);i.textContent=t.placeholder||"example placeholder",i.addEventListener("click",()=>{const{details:o}=e.config.toast;if(t.action)return t.action({details:o,buttonElement:i,toastElement:w})}),t.appearance&&i.setAttribute("appearance",t.appearance),E.appendChild(i)})),w.setAttribute("notify",(null===(p=null===(u=null==e?void 0:e.config)||void 0===u?void 0:u.toast)||void 0===p?void 0:p.type)||""),e.iconName&&w.setAttribute("notification-icon",e.iconName),(null===(m=null===(f=null==e?void 0:e.config)||void 0===f?void 0:f.toast)||void 0===m?void 0:m.autoClose)&&w.setAttribute("auto-close",`${null===(v=null===(g=null==e?void 0:e.config)||void 0===g?void 0:g.toast)||void 0===v?void 0:v.autoClose}`),(null===(y=null===(b=null==e?void 0:e.config)||void 0===b?void 0:b.toast)||void 0===y?void 0:y.closeTimeout)&&w.setAttribute("close-timeout",`${null===(x=null===(z=null==e?void 0:e.config)||void 0===z?void 0:z.toast)||void 0===x?void 0:x.closeTimeout}`),w.appendChild(k),w.appendChild(S),w.appendChild($),E&&w.appendChild(E),M.prepend(w)},AC=(e,t,i)=>{if(!e.title)throw new Error("Title is required");if(!e.body)throw new Error("Missing required param 'body'");let o={title:e.title,body:e.body,iconName:e.iconName},c={};e.createdAt&&(o=Object.assign({createdAt:e.createdAt},o)),null!=e.logLevel&&(o=Object.assign({logLevel:e.logLevel},o)),e.toast&&(c=Object.assign({toast:e.toast},c),o=Object.assign({config:c},o)),NC(o,t,i)},OC=Ce` :host{position: fixed;z-index: 9999;display: flex;flex-direction: column;gap: 4px;box-sizing: border-box;pointer-events: none;/* Allow clicks to pass through empty space */ width: 415px}.toast-container{padding: 0 8px 12px 12px;position: relative}/* Expanded / List State: Allow scrolling if too many items */ :host(:not([stack-collapsed])){max-height: calc(100% - var(--nav-height));overflow: hidden;pointer-events: auto;/* Enable pointer events for scrolling */ slot{display: block;height: calc(100vh - var(--nav-height) - 54px);position: relative}.toast-container{flex: 1;height: 100%;overflow-y: auto;overflow-x: hidden;scrollbar-color: var(--neutral-layer-3) transparent;&:hover{scrollbar-color: var(--neutral-layer-4) transparent}}}.header{display: flex;gap: 12px;pointer-events: none;margin: 5px 24px;justify-content: space-between;visibility: hidden;align-items: center;box-sizing: border-box;.header-title{text-shadow: 0 0 10px #000}.notification-header-buttons{display: flex;gap: 4px;rapid-icon{color: var(--neutral-foreground-hint);margin-left: 4px;display: inline-flex;font-size: 14px;&.chevron-up.collapse{transform: rotate(180deg);transition: transform 0.3s ease}}}--base-height-multiplier: 8;*[appearance='neutral']{font-size: 11px;cursor: pointer;background: var(--neutral-fill-rest)}}.header.visible{visibility: visible;pointer-events: auto;/* Enable clicks on header buttons */}:host([position$='left']) .header{justify-content: space-between}:host([position^='bottom']) .header{margin-bottom: 0;margin-top: 4px}/* Ensure children (toasts) are clickable */ ::slotted(*){pointer-events: auto}:host([position='top-right']){top: var(--nav-height, 0);right: 0}:host([position='top-left']){top: var(--nav-height, 0);left: 0}:host([position='bottom-right']){bottom: 0;right: 0;flex-direction: column-reverse}:host([position='bottom-left']){bottom: 0;left: 0;flex-direction: column-reverse}/* Stacked / Collapsed State */ :host([stack-collapsed]){height: min-content;/* Host allows pointer events so they can reach the slot */ pointer-events: auto;cursor: pointer}/* Apply the grid layout to the slot itself so it acts as the container and click target */ :host([stack-collapsed]) slot{display: grid;grid-template-columns: auto;grid-template-rows: auto;align-items: end;/* Default to bottom-up stacking */ justify-items: center;/* The slot catches the click */ pointer-events: auto}/* Rotate when the collapse class is present */ :host([stack-collapsed][position^='top']) slot{align-items: start}:host([stack-collapsed][position$='right']) slot{justify-items: end}:host([stack-collapsed][position$='left']) slot{justify-items: start}:host([stack-collapsed]) ::slotted(*){grid-area: 1 / 1;transition: transform 0.3s ease, top 0.3s ease, opacity 0.3s ease;opacity: 0%;pointer-events: none !important;/* Disable interaction with toasts in collapsed state */ transform: scale(0.9);top: 0 !important}/* Show and offset the top 3 items in the stack */ :host([stack-collapsed]) ::slotted([data-stack-index='0']){opacity: 100%;pointer-events: auto;transform: translateY(0) scale(1);z-index: 3;position: relative !important}:host([stack-collapsed]) ::slotted([data-stack-index='1']){opacity: 100%;transform: translateY(var(--stack-offset-y, 8px)) scale(0.95);z-index: 2;position: relative !important}:host([stack-collapsed]) ::slotted([data-stack-index='2']){opacity: 100%;transform: translateY(var(--stack-offset-y-2, 16px)) scale(0.9);z-index: 1;position: relative !important}/* Adjust offset direction based on position */ :host([stack-collapsed][position^='top']){--stack-offset-y: 8px;--stack-offset-y-2: 16px}:host([stack-collapsed][position^='bottom']){--stack-offset-y: -8px;--stack-offset-y-2: -16px}`,TC=W` ${He(e=>e.allowCloseAll||e.allowManualCollapse,W` ${e=>(e=>W`<div class="header ${e=>Jt(["visible",e.slottedNodes.length>1])}">${He(e=>e.showCount,W`<span class="header-title">${e=>e.slottedNodes.length}Notifications</span>`)}<div class="notification-header-buttons">${He(e=>e.allowManualCollapse,W`<${e}-button @click=${e=>e.handleToggleCollapse()}>${e=>e.stackCollapsed?"Expand":"Collapse"}<${e}-icon class="chevron-up ${e=>Jt(["collapse",e.stackCollapsed])}" name="chevron-up"></${e}-icon></${e}-button>`)} ${He(e=>e.allowCloseAll,W`<${e}-button @click=${e=>e.handleCloseAll()}>
60
60
  Close All <${e}-icon name="xmark"></${e}-icon></${e}-button>`)}</div></div>`)(e.designSystemPrefix)} `)}<div class="toast-container"><slot ${Ke("slottedNodes")}@click="${e=>e.handleContainerClick()}"></slot></div>`;let RC=class extends be{constructor(){super(...arguments),this.position="top-right",this.stackThreshold=5,this.allowManualCollapse=!0,this.allowCloseAll=!0,this.designSystemPrefix="rapid",this.showCount=!0,this.stackCollapsed=!1,this.notificationInterval=0,this.manuallyExpanded=!1,this.pendingQueue=[],this.queueTimer=null,this.queuedNodes=new Set,this.mutationObserver=null,this.knownNodes=new Set,this.peekingNode=null,this.peekTimer=null,this.routeSubscriber={handleChange:()=>this.checkRoute(mf.shared.pathName)},this.slottedNodes=[]}connectedCallback(){super.connectedCallback(),"bottom-left"!==this.position&&"bottom-right"!==this.position||bC.error("NotifyContainer doesn't currently support bottom corner placements"),m.getNotifier(mf.shared).subscribe(this.routeSubscriber,"pathName"),this.checkRoute(mf.shared.pathName),this.mutationObserver=new MutationObserver(e=>this.handleMutation(e)),this.mutationObserver.observe(this,{childList:!0})}disconnectedCallback(){var e;super.disconnectedCallback(),m.getNotifier(mf.shared).unsubscribe(this.routeSubscriber,"pathName"),null===(e=this.mutationObserver)||void 0===e||e.disconnect(),this.mutationObserver=null}checkRoute(e){(e.includes("/login")||e.includes("/logout"))&&(this.pendingQueue=[],this.queuedNodes.clear(),clearTimeout(this.queueTimer),this.queueTimer=null,this.handleCloseAll())}slottedNodesChanged(){if(!this.manuallyExpanded&&!this.stackCollapsed&&this.slottedNodes.length>this.stackThreshold&&(this.stackCollapsed=!0),this.stackCollapsed&&this.slottedNodes.length<=1&&(this.stackCollapsed=!1,this.manuallyExpanded=!1,this.cancelPeek()),this.stackCollapsed){const e=this.slottedNodes.filter(e=>e instanceof HTMLElement&&!this.knownNodes.has(e)).shift();e&&this.maybePeek(e)}this.knownNodes=new Set(this.slottedNodes),this.applySort()}handleContainerClick(){this.stackCollapsed&&(this.stackCollapsed=!1,this.manuallyExpanded=!0,this.cancelPeek())}handleToggleCollapse(){this.stackCollapsed=!this.stackCollapsed,this.manuallyExpanded=!this.stackCollapsed,this.stackCollapsed||this.cancelPeek()}handleCloseAll(){for(this.cancelPeek();this.firstChild;)this.removeChild(this.firstChild);this.stackCollapsed=!1,this.manuallyExpanded=!1}notificationIntervalChanged(e,t){!t&&this.pendingQueue&&this.flushQueue()}handleMutation(e){this.notificationInterval&&(e.forEach(e=>{e.addedNodes.forEach(e=>{e instanceof HTMLElement&&(this.queuedNodes.has(e)?this.queuedNodes.delete(e):(this.removeChild(e),this.pendingQueue.push(e)))})}),this.queueTimer||this.processQueue())}processQueue(){if(!this.pendingQueue.length)return void(this.queueTimer=null);const e=this.pendingQueue.shift();this.queuedNodes.add(e),this.prepend(e),this.queueTimer=setTimeout(()=>{this.queueTimer=null,this.processQueue()},this.notificationInterval)}flushQueue(){for(clearTimeout(this.queueTimer),this.queueTimer=null;this.pendingQueue.length;){const e=this.pendingQueue.shift();this.queuedNodes.add(e),this.prepend(e)}}sortFnChanged(){this.applySort()}applySort(){const e=this.slottedNodes.filter(e=>e instanceof HTMLElement);if(!e.length)return;const t=this.sortFn&&e.length>1?[...e].sort(this.sortFn):e;this.peekingNode&&t.includes(this.peekingNode)?this.handlePosition([this.peekingNode,...t.filter(e=>e!==this.peekingNode)]):this.handlePosition(t)}maybePeek(e){const t=this.slottedNodes.filter(e=>e instanceof HTMLElement);if(0===(this.sortFn&&t.length>1?[...t].sort(this.sortFn):t).indexOf(e))return;this.cancelPeek(),this.peekingNode=e;const i=this.notificationInterval?this.notificationInterval/2:1500;this.peekTimer=setTimeout(()=>{this.peekingNode=null,this.peekTimer=null,this.applySort()},i)}cancelPeek(){clearTimeout(this.peekTimer),this.peekTimer=null,this.peekingNode=null}handlePosition(e){if(!e.length)return;e.forEach((t,i)=>{t.style.position="absolute",t.style.transition="all 0.3s ease-in",t.style.right="0px",t.style.zIndex=(e.length-i).toString(),t.dataset.stackIndex=i.toString()});const t=e.map(e=>e.offsetHeight);e.reduce((e,i,o)=>(i.style.top=`${e}px`,e+t[o]),0)}};Nu([re],RC.prototype,"position",void 0),Nu([re({attribute:"stack-threshold"})],RC.prototype,"stackThreshold",void 0),Nu([re({attribute:"allow-manual-collapse",mode:"boolean"})],RC.prototype,"allowManualCollapse",void 0),Nu([re({attribute:"allow-close-all",mode:"boolean"})],RC.prototype,"allowCloseAll",void 0),Nu([re({attribute:"design-system-prefix"})],RC.prototype,"designSystemPrefix",void 0),Nu([re({attribute:"show-count",mode:"boolean"})],RC.prototype,"showCount",void 0),Nu([re({attribute:"stack-collapsed",mode:"boolean"})],RC.prototype,"stackCollapsed",void 0),Nu([re({attribute:"notification-interval"})],RC.prototype,"notificationInterval",void 0),Nu([g],RC.prototype,"sortFn",void 0),Nu([g],RC.prototype,"slottedNodes",void 0),RC=Nu([ye({name:"notify-container",template:TC,styles:OC})],RC);const IC={alert:e=>{LC(e),alert(xC(e))},toast:NC,dialog:(e,t,i)=>{LC(e);const o=t.split("-")[0],c=document.createElement(`${o}-dialog`),s=i?(e=>{let t=e.querySelector("#dialog-container");return t||(t=document.createElement("div"),t.setAttribute("id","dialog-container"),t.style.position="relative",e.appendChild(t)),t})(i):MC("dialog-container");s.appendChild(c),c.notification=e,c.show()},snackbar:(e,t)=>{var i,o,c,s,n,a;LC(e);const r=t.split("-")[0],l=document.createElement(`${r}-snackbar`),d=null!==(c=null===(o=null===(i=e.config)||void 0===i?void 0:i.snackbar)||void 0===o?void 0:o.verticalEdge)&&void 0!==c?c:SC.Bottom,h=null!==(a=null===(n=null===(s=e.config)||void 0===s?void 0:s.snackbar)||void 0===n?void 0:n.horizontalEdge)&&void 0!==a?a:$C.Left,u=MC(`snack-container-${d}-${h}`);u&&((e,t,i)=>{e.style.position="fixed",e.style.top=t===SC.Top?EC:"",e.style.bottom=t===SC.Bottom?EC:"",e.style.left=i===$C.Left?EC:"",e.style.right=i===$C.Right?EC:""})(u,d,h),u.appendChild(l),l.notification=e},banner:(e,t,i)=>{var o;LC(e);const c=t.split("-")[0],s=document.createElement(`${c}-banner`),n=(e=>{for(var t,i;e&&!(e instanceof ShadowRoot);){const o=null===(t=null==e?void 0:e.getRootNode())||void 0===t?void 0:t.getElementById("banner-anchor");if(o)return o.style.position="relative",o;e=null===(i=null==e?void 0:e.getRootNode())||void 0===i?void 0:i.host}return wC()})(i);(null===(o=null==n?void 0:n.children)||void 0===o?void 0:o.length)>0&&(s.style.position="absolute",s.style.top="0",s.style.left="0",s.style.width="100%"),n.appendChild(s),s.notification=e}},DC=(e,t,i)=>{Object.keys((null==e?void 0:e.config)||{}).forEach(o=>{IC[o]&&IC[o](e,t,i)})};function FC(e,t,i){(null==t?void 0:t.trim())&&DC({title:e,body:t,config:{toast:{autoClose:!0,closeTimeout:4e3,type:"error"}}},i)}class _C extends qt{constructor(){super(...arguments),this.placeholder="Describe your search criteria in natural language...",this.inputValue="",this.isInterpreting=!1,this.lastValidCriteria=null,this.activeGroups=[],this.showingChips=!1,this.fieldMetadata=[],this.isRecording=!1,this.stopRecording=null,this.speechApplyDebounceTimer=null}get speechAvailable(){return Wx()}get criteriaChips(){return this.activeGroups.flatMap((e,t)=>e.clauses.map((e,i)=>{var o,c;return{groupIndex:t,clauseIndex:i,fieldLabel:this.getFieldLabel(e.field),operatorLabel:null!==(o=rC[e.operator])&&void 0!==o?o:e.operator,valueLabel:"dateIsToday"===e.operator?"":String(null!==(c=e.value)&&void 0!==c?c:"")}}))}getFieldLabel(e){var t,i;if(!Array.isArray(this.fieldMetadata)||0===this.fieldMetadata.length)return e;if("string"==typeof this.fieldMetadata[0])return e;const o=this.fieldMetadata.find(t=>t.NAME===e);return null!==(i=null!==(t=null==o?void 0:o.UI_LABEL)&&void 0!==t?t:null==o?void 0:o.NAME)&&void 0!==i?i:e}toggleCriteriaView(){this.showingChips?(this.inputValue="",this.showingChips=!1):this.showingChips=!0}removeChip(e,t){var i;const o=this.activeGroups.map(e=>Object.assign(Object.assign({},e),{clauses:[...e.clauses]}));null===(i=o[e])||void 0===i||i.clauses.splice(t,1);const c=o.filter(e=>e.clauses.length>0);if(this.activeGroups=c,0===c.length)this.showingChips=!1,this.lastValidCriteria=null,this.$emit("criteria-changed",null);else{const e=oC(c);this.lastValidCriteria=e,this.$emit("criteria-changed",e)}}clearChips(){this.activeGroups=[],this.showingChips=!1,this.lastValidCriteria=null,this.$emit("criteria-changed",null)}handleSubmit(){return Ou(this,void 0,void 0,function*(){var e,t,i;const o=null===(e=this.inputValue)||void 0===e?void 0:e.trim();if(!o||this.isInterpreting)return;const c=null===(t=this.providerRegistry)||void 0===t?void 0:t.default();if(null==c?void 0:c.interpretCriteria){this.isInterpreting=!0;try{const e=Array.isArray(this.fieldMetadata)?this.fieldMetadata:[],t=yield c.interpretCriteria(o,{fields:e});if(!(null===(i=null==t?void 0:t.groups)||void 0===i?void 0:i.some(e=>{var t;return null===(t=e.clauses)||void 0===t?void 0:t.length})))return FC("AI criteria search","AI could not interpret the criteria",$x(this)),void(this.isInterpreting=!1);const{valid:n,invalid:a}=function(e,t){var i;const o=[],c=[];for(const s of e){if(!(null==s?void 0:s.clauses)||!Array.isArray(s.clauses)){c.push({field:"",message:"Group must have a clauses array"});continue}const{valid:e,invalid:n}=vC(s.clauses,t);c.push(...n),e.length>0&&o.push({logic:null!==(i=s.logic)&&void 0!==i?i:"and",negated:s.negated,clauses:e})}return{valid:o,invalid:c}}(t.groups,this.fieldMetadata);if(a.length>0&&(FC("Criteria validation error",0===(s=a).length?"":1===s.length?s[0].message:s.map(e=>e.message).join("; "),$x(this)),this.$emit("validation-errors",a)),n.length>0){const e=[...this.activeGroups,...n],t=oC(e);this.lastValidCriteria=t,this.activeGroups=e,this.inputValue="",this.showingChips=!0,this.$emit("criteria-changed",t)}}catch(e){FC("AI criteria search",e instanceof Error?e.message:"Interpretation failed",$x(this))}finally{this.isInterpreting=!1}var s}else FC("AI criteria search","AI provider not configured",$x(this))})}handleBlur(){var e;if(this.isRecording)return;(null===(e=this.inputValue)||void 0===e?void 0:e.trim())?this.handleSubmit():this.activeGroups.length>0&&(this.showingChips=!0)}clear(){this.inputValue="",this.lastValidCriteria=null,this.activeGroups=[],this.showingChips=!1,this.$emit("criteria-changed",null)}toggleSpeechInput(){if(this.isRecording&&this.stopRecording)return this.clearSpeechApplyDebounce(),this.stopRecording(),this.stopRecording=null,void(this.isRecording=!1);this.inputValue="",this.showingChips=!1,this.stopRecording=function(e,t){if(!Wx())return null;const i=new(window.SpeechRecognition||window.webkitSpeechRecognition);i.continuous=!0,i.interimResults=!0,i.lang="en-US";let o="";return i.onresult=t=>{let i="",c="";for(let e=t.resultIndex;e<t.results.length;e+=1){const o=t.results[e][0].transcript;t.results[e].isFinal?c+=o:i+=o}c?(o+=c,e(o,!0)):i&&e(o+i,!1)},i.onerror=e=>{"aborted"!==e.error&&(null==t||t(e.error||"Speech recognition error"))},i.start(),()=>{try{i.stop()}catch(e){}}}((e,t)=>{this.inputValue=e,t&&(null==e?void 0:e.trim())&&(this.clearSpeechApplyDebounce(),this.stopRecording&&(this.stopRecording(),this.stopRecording=null,this.isRecording=!1),this.speechApplyDebounceTimer=setTimeout(()=>{this.speechApplyDebounceTimer=null,this.handleSubmit()},700))},()=>{this.clearSpeechApplyDebounce(),this.isRecording=!1,this.stopRecording=null}),this.stopRecording&&(this.isRecording=!0)}clearSpeechApplyDebounce(){this.speechApplyDebounceTimer&&(clearTimeout(this.speechApplyDebounceTimer),this.speechApplyDebounceTimer=null)}}Nu([Qx],_C.prototype,"providerRegistry",void 0),Nu([re],_C.prototype,"placeholder",void 0),Nu([re({mode:"boolean"})],_C.prototype,"disabled",void 0),Nu([g],_C.prototype,"inputValue",void 0),Nu([g],_C.prototype,"isInterpreting",void 0),Nu([g],_C.prototype,"lastValidCriteria",void 0),Nu([g],_C.prototype,"activeGroups",void 0),Nu([g],_C.prototype,"showingChips",void 0),Nu([g],_C.prototype,"fieldMetadata",void 0),Nu([g],_C.prototype,"isRecording",void 0),Nu([v],_C.prototype,"speechAvailable",null),Nu([v],_C.prototype,"criteriaChips",null);const HC=void 0,PC={};_C.compose(Object.assign({baseName:"ai-criteria-search",template:Jx,styles:Xx,shadowOptions:HC},PC));const VC=(e,t)=>Ce` :host{display: flex;justify-content: center;align-items: center;width: 100%;margin: calc(var(--design-unit) * 2px) 0;position: relative;/* Same as connection indicator */ --green: 50 164 49;--trafic-light-green: rgb(var(--green));--red: 187 30 16;--trafic-light-red: rgb(var(--red));--amber: 230 160 20;--trafic-light-amber: rgb(var(--amber))}.ai-indicator-container{display: flex;flex-direction: column;align-items: center;position: relative}.ai-indicator-badge{display: inline-flex;align-items: center;gap: calc(var(--design-unit) * 1.4px);font-size: 12px;line-height: 1;font-weight: 600;text-transform: uppercase;height: calc(var(--design-unit) * 6px);padding: calc(var(--design-unit) * 0.5px) calc(var(--design-unit) * 2px);border-radius: calc(var(--design-unit) * 1px);cursor: pointer;color: #fff}.ai-indicator-badge:hover{opacity: 90%}.ai-indicator-badge.green{background: var(--trafic-light-green)}.ai-indicator-badge.amber{background: var(--trafic-light-amber)}.ai-indicator-badge.red{background: var(--trafic-light-red)}.ai-indicator-badge .ai-indicator-icon{flex-shrink: 0;color: inherit}.ai-indicator-badge.pulsing{animation: ai-indicator-pulse 1.5s ease-in-out infinite}@keyframes ai-indicator-pulse{0%, 100%{opacity: 100%}50%{opacity: 50%}}.ai-indicator-dropdown{position: absolute;top: 100%;right: 0;margin-top: calc(var(--design-unit) * 2px);min-width: 200px;padding: calc(var(--design-unit) * 4px);background: var(--neutral-layer-floating, #fff);border: 1px solid var(--neutral-stroke-rest, #e0e0e0);border-radius: calc(var(--design-unit) * 2px);box-shadow: 0 calc(var(--design-unit) * 1px) calc(var(--design-unit) * 4px) rgb(0 0 0 / 12%);z-index: 1000}.ai-indicator-info{display: flex;flex-direction: column;gap: 0;margin: 0;padding: 0}.ai-indicator-info .info-row{display: grid;grid-template-columns: 72px 1fr;gap: calc(var(--design-unit) * 4px);align-items: baseline;padding: calc(var(--design-unit) * 1.5px) 0;border-bottom: 1px solid var(--neutral-stroke-subtle, #eee)}.ai-indicator-info .info-row:last-child{border-bottom: none}.ai-indicator-info .info-label{margin: 0;font-size: var(--type-ramp-base-font-size);font-weight: 500;color: var(--neutral-foreground-hint, #666)}.ai-indicator-info .info-value{margin: 0;font-size: var(--type-ramp-base-font-size);color: var(--neutral-foreground-rest, #333);text-transform: capitalize;word-break: break-word}.install-button{margin-top: calc(var(--design-unit) * 3px);width: 100%}`,BC=W` ${e=>(e=>W` ${He(()=>Gx(),W`<div class="ai-indicator-container" part="ai-indicator-container"><div class=${e=>Jt("ai-indicator-badge",["green","available"===e.state||"server"===e.state],["amber","downloading"===e.state||"downloadable"===e.state],["red","unavailable"===e.state||"none"===e.state],["pulsing","downloading"===e.state||e.isInstalling])}data-test-id="ai-indicator-badge" part="ai-indicator-badge" role="button" tabindex="0" aria-label="AI status" aria-haspopup="true" aria-expanded="${e=>e.open}" @click=${e=>e.toggleDropdown()}@keydown=${(e,t)=>{const i=t.event;"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),e.toggleDropdown())}}><${e}-icon class="ai-indicator-icon" name="wand-magic-sparkles" size="xs" variant="solid" part="ai-indicator-icon"></${e}-icon><span class="ai-indicator-text" data-test-id="ai-indicator-text" part="ai-indicator-text">AI</span></div>${He(e=>e.open,W`<div class="ai-indicator-dropdown" part="ai-indicator-dropdown"><dl class="ai-indicator-info"><div class="info-row"><dt class="info-label">Provider</dt><dd class="info-value">${e=>{var t,i;return null!==(i=null===(t=e.status)||void 0===t?void 0:t.provider)&&void 0!==i?i:"none"}}</dd></div><div class="info-row"><dt class="info-label">Model</dt><dd class="info-value">${e=>{var t;return(null===(t=e.status)||void 0===t?void 0:t.model)||"—"}}</dd></div>${He(e=>e.chromeStatusLabel,W`<div class="info-row"><dt class="info-label">Status</dt><dd class="info-value">${e=>e.chromeStatusLabel}</dd></div>`)}</dl>${He(e=>e.canInstall,W`<${e}-button class="install-button" appearance="accent" @click=${(e,t)=>{t.event.preventDefault(),e.onInstall()}}>
61
- Install model </${e}-button>`)}</div>`)}</div>`)} `)($x(e))} `;class UC extends qt{constructor(){super(...arguments),this.status=null,this.open=!1,this.state="none",this.isInstalling=!1,this.pollTimer=null,this.clickOutside=e=>this.handleClickOutside(e)}get aiProvider(){var e;return null===(e=this.providerRegistry)||void 0===e?void 0:e.default()}get chromeStatusLabel(){var e,t;if("chrome"!==(null===(e=this.status)||void 0===e?void 0:e.provider))return null;const i=null===(t=this.status)||void 0===t?void 0:t.chromeAvailability;return"available"===i?"Installed":"downloading"===i||this.isInstalling?"Downloading…":"downloadable"===i?"Downloadable":"unavailable"===i?"Unavailable":null}get canInstall(){var e,t,i;return!!(null===(e=this.aiProvider)||void 0===e?void 0:e.triggerDownload)&&"chrome"===(null===(t=this.status)||void 0===t?void 0:t.provider)&&"downloadable"===(null===(i=this.status)||void 0===i?void 0:i.chromeAvailability)&&!this.isInstalling}get isDownloading(){var e;return"downloading"===(null===(e=this.status)||void 0===e?void 0:e.chromeAvailability)||this.isInstalling}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return Ou(this,void 0,void 0,function*(){e.connectedCallback.call(this),yield this.refreshStatus(),this.maybeStartPolling()})}disconnectedCallback(){this.stopPolling(),document.removeEventListener("mousedown",this.clickOutside)}openChanged(){this.open?(document.addEventListener("mousedown",this.clickOutside),this.refreshStatus()):document.removeEventListener("mousedown",this.clickOutside)}handleClickOutside(e){kx(e,this)&&(this.open=!1)}toggleDropdown(){this.open=!this.open}refreshStatus(){return Ou(this,void 0,void 0,function*(){var e;if(!(null===(e=this.aiProvider)||void 0===e?void 0:e.getStatus))return this.status=null,void(this.state="none");try{const e=yield this.aiProvider.getStatus();this.status=e,this.state=this.deriveState(e),"available"===this.state&&(this.isInstalling=!1)}catch(e){this.status=null,this.state="none",this.isInstalling=!1}})}deriveState(e){if(!e||"none"===e.provider)return"none";if("chrome"===e.provider){const t=e.chromeAvailability;return"available"===t?"available":"downloading"===t?"downloading":"downloadable"===t?"downloadable":"unavailable"}return"server"}maybeStartPolling(){var e;"downloading"===(null===(e=this.status)||void 0===e?void 0:e.chromeAvailability)||this.isInstalling?this.startPolling():this.stopPolling()}startPolling(){this.pollTimer||(this.pollTimer=setInterval(()=>{this.refreshStatus().then(()=>{this.maybeStartPolling()})},2500))}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}onInstall(){return Ou(this,void 0,void 0,function*(){var e;if(this.canInstall&&(null===(e=this.aiProvider)||void 0===e?void 0:e.triggerDownload)){this.isInstalling=!0;try{yield this.aiProvider.triggerDownload(),this.startPolling()}catch(e){this.isInstalling=!1}finally{yield this.refreshStatus()}}})}}Nu([Qx],UC.prototype,"providerRegistry",void 0),Nu([g],UC.prototype,"status",void 0),Nu([g],UC.prototype,"open",void 0),Nu([g],UC.prototype,"state",void 0),Nu([g],UC.prototype,"isInstalling",void 0),Nu([v],UC.prototype,"chromeStatusLabel",null),Nu([v],UC.prototype,"canInstall",null),Nu([v],UC.prototype,"isDownloading",null),UC.compose({baseName:"ai-indicator",template:BC,styles:VC});const jC=(e,t)=>Ni(0,t),qC=(e,t)=>Ce` ${Yd()}`;class GC extends Kd{}const WC={delegatesFocus:!0,mode:"open"},YC={};GC.compose(Object.assign({baseName:"anchor",template:jC,styles:qC,shadowOptions:WC},YC));const KC=(e,t)=>Ri(),ZC=(e,t)=>Ce` ${Zd()}`;class QC extends Di{}const XC={delegatesFocus:!0,mode:"open"},JC={};QC.compose(Object.assign({baseName:"anchored-region",template:KC,styles:ZC,shadowOptions:XC},JC));const eL=(e,t)=>ji(0,t),tL=W` ${He(e=>e.imgSrc,W`<img src="${e=>e.imgSrc}" alt="${e=>e.alt}" slot="media" class="media" part="media" />`)} `,iL=(e,t)=>Ce` ${Qd(e)}`;class oL extends Xd{}const cL={delegatesFocus:!0,mode:"open"},sL={media:tL};oL.compose(Object.assign({baseName:"avatar",template:eL,styles:iL,shadowOptions:cL},sL));const nL=(e,t)=>Gi(),aL=(e,t)=>Ce` ${eh()}`;class rL extends Wi{}const lL=void 0,dL={};rL.compose(Object.assign({baseName:"badge",template:nL,styles:aL,shadowOptions:lL},dL));const hL=Ce` @keyframes delete-animate{from{height: 100px;opacity: 100%}to{height: 0;opacity: 0%}}@keyframes append-animate{from{height: 0;opacity: 0%}to{height: var(--banner-height);opacity: 100%}}:host{--banner-width: 100%;--banner-height: 65px;--flow: row}@media screen and (max-width: 640px){:host{--flow: column;--banner-height: 100px}}.banner{animation: append-animate 0.3s linear;width: var(--banner-width);height: var(--banner-height);background-color: var(--fill-color);display: flex;flex-direction: var(--flow);padding: 5px 8px;box-sizing: border-box;overflow: hidden}.banner-delete{animation: delete-animate 0.3s linear;opacity: 0%}.content{display: flex;align-items: center;flex: 2;font-size: 12px;overflow: hidden;white-space: pre-line}.action{display: flex;flex-direction: row-reverse;align-items: center;gap: 10px;flex: 1;overflow: hidden}`,uL=W` ${e=>(e=>W`<div role="alert" aria-live="polite" class="banner ${e=>e.dismissAnimation}" ${Ie("banner")}><div part="content" class="content"><slot name="content">${He(e=>e.notification,W`<div><div>${e=>{var t;return(null===(t=e.notification)||void 0===t?void 0:t.body)||"Place holder for notification message"}}</div></div>`)}</slot></div><div part="action" class="action"><slot name="action" class="action">${He(e=>e.notification,W`<${e}-button slot="action" appearance="lightweight" @click=${e=>e.dismiss()}>${e=>{var t,i,o,c;return(null===(c=null===(o=null===(i=null===(t=e.notification)||void 0===t?void 0:t.config)||void 0===i?void 0:i.banner)||void 0===o?void 0:o.dismissingAction)||void 0===c?void 0:c.label)||"Ignore"}}</${e}-button>`)} ${qe(e=>{var t,i;return null===(i=null===(t=e.notification)||void 0===t?void 0:t.config)||void 0===i?void 0:i.banner.confirmingActions},W`<${e}-button slot="action" appearance="lightweight" @click=${(e,t)=>{var i;null==e||e.action(),null===(i=t.parent)||void 0===i||i.dismissNotification()}}>${e=>e.label}</${e}-button>`)}</slot></div></div>`)($x(e))} `,pL={mode:"open",delegatesFocus:!0};class fL extends qt{constructor(){super(...arguments),this.dismissAnimation=""}connectedCallback(){super.connectedCallback()}dismiss(){return this.dismissAnimation="banner-delete",new Promise(e=>{this.banner.onanimationend=()=>{this.remove(),e()}})}dismissNotification(){return Ou(this,void 0,void 0,function*(){try{yield this.dismiss(),this.remove()}catch(e){Mx.error(e)}})}}Nu([g],fL.prototype,"dismissAnimation",void 0),Nu([g],fL.prototype,"notification",void 0),fL.compose({baseName:"banner",styles:hL,template:uL,shadowOptions:pL});const mL=(e,t)=>Zi(),gL=(e,t)=>Ce` ${ih()}`;class vL extends Qi{}vL.compose(Object.assign({baseName:"breadcrumb",template:mL,styles:gL,shadowOptions:void 0},{}));const bL=(e,t)=>Yi(0,t),yL=(e,t)=>Ce` ${th()}`;class zL extends Ki{}const xL=void 0,CL={separator:"/"};zL.compose(Object.assign({baseName:"breadcrumb-item",template:bL,styles:yL,shadowOptions:xL},CL));const LL=(e,t)=>Xi(0,t),ML=(e,t)=>Ce` ${oh()}`;class wL extends ch{}const kL={delegatesFocus:!0,mode:"open"},SL={};wL.compose(Object.assign({baseName:"button",template:LL,styles:ML,shadowOptions:kL},SL));const $L=()=>Ce` ${sh}`,EL=(e,t)=>Oo(e,t);class NL extends ho{}const AL={delegatesFocus:!0,mode:"open"},OL={};NL.compose(Object.assign({baseName:"calendar",template:EL,styles:$L,shadowOptions:AL},OL));const TL=(e,t)=>To(),RL=(e,t)=>Ce` ${nh()} :host{background-color: var(--fui-card-fill-color);color: var(--fui-card-foreground-color)}`;class IL extends ah{}const DL=void 0,FL={};var _L,HL,PL;IL.compose(Object.assign({baseName:"card",template:TL,styles:RL,shadowOptions:DL},FL)),function(e){e.BELOW="below",e.ABOVE="above"}(_L||(_L={}));var VL=function(){if(PL)return HL;PL=1;var e=/^\s+|\s+$/g,t=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,c=parseInt,s="object"==typeof tf&&tf&&tf.Object===Object&&tf,n="object"==typeof self&&self&&self.Object===Object&&self,a=s||n||Function("return this")(),r=Object.prototype.toString,l=Math.max,d=Math.min,h=function(){return a.Date.now()};function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function p(s){if("number"==typeof s)return s;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==r.call(e)}(s))return NaN;if(u(s)){var n="function"==typeof s.valueOf?s.valueOf():s;s=u(n)?n+"":n}if("string"!=typeof s)return 0===s?s:+s;s=s.replace(e,"");var a=i.test(s);return a||o.test(s)?c(s.slice(2),a?2:8):t.test(s)?NaN:+s}return HL=function(e,t,i){var o,c,s,n,a,r,f=0,m=!1,g=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var i=o,s=c;return o=c=void 0,f=t,n=e.apply(s,i)}function y(e){var i=e-r;return void 0===r||i>=t||i<0||g&&e-f>=s}function z(){var e=h();if(y(e))return x(e);a=setTimeout(z,function(e){var i=t-(e-r);return g?d(i,s-(e-f)):i}(e))}function x(e){return a=void 0,v&&o?b(e):(o=c=void 0,n)}function C(){var e=h(),i=y(e);if(o=arguments,c=this,r=e,i){if(void 0===a)return function(e){return f=e,a=setTimeout(z,t),m?b(e):n}(r);if(g)return a=setTimeout(z,t),b(r)}return void 0===a&&(a=setTimeout(z,t)),n}return t=p(t)||0,u(i)&&(m=!!i.leading,s=(g="maxWait"in i)?l(p(i.maxWait)||0,t):s,v="trailing"in i?!!i.trailing:v),C.cancel=function(){void 0!==a&&clearTimeout(a),f=0,o=r=c=a=void 0},C.flush=function(){return void 0===a?n:x(h())},C},HL}(),BL=of(VL);const UL=Ce` :host{--scrollbar-width: 12px;--scrollbar-thumb-width: 8px}.root{position: relative;width: inherit;min-width: 250px}.control{cursor: pointer;position: relative;display: flex;align-items: center;width: 100%;border-radius: calc(var(--control-corner-radius) * 1px)}#display-field{width: 100%;cursor: pointer;color: var(--neutral-foreground-rest);min-height: 40px;padding: 0 calc(var(--design-unit) * 2.25px);border-width: 0;background-color: var(--neutral-fill-input-rest);border-radius: calc(var(--control-corner-radius) * 1px)}#display-field[disabled]{cursor: not-allowed;opacity: 30%}#display-field:focus{outline: 1px solid var(--accent-fill-rest);background: var(--neutral-fill-input-rest);border-style: none;box-shadow: none}#display-field:hover:not(:focus):not([disabled]){outline: 1px solid var(--neutral-stroke-hover)}button{pointer-events: none}.indicator{position: absolute;left: calc(100% - 26px);padding: 0;cursor: pointer}#arrow-icon{width: 16px;fill: white;transform: rotate(0deg);transition: transform 0.2s linear 0s}#arrow-icon.flipped{transform: rotate(180deg)}.disabled-svg{pointer-events: none;opacity: 30%}.position-above{bottom: 100%}::-webkit-scrollbar{width: var(--scrollbar-width)}::-webkit-scrollbar-track{background: var(--neutral-layer-4)}::-webkit-scrollbar-thumb{width: var(--scrollbar-thumb-width);border-radius: 10px;box-shadow: inset 0 0 6px rgba(0 0 0 / 30%);background-color: var(--neutral-layer-2);border: 3px solid var(--neutral-layer-4)}::-webkit-scrollbar-corner{background: var(--neutral-layer-4)}.multiselect-dropdown{display: flex;flex-direction: column;position: absolute;height: max-content;overflow: hidden;margin-top: calc(var(--design-unit) * 1px);border: calc(var(--stroke-width) * 1px) solid var(--neutral-layer-2);border-radius: 4px;background: var(--neutral-fill-input-rest);width: 100%;max-height: 0;visibility: hidden;z-index: 999}.multiselect-dropdown:not(.is-resizing){transition: max-height 0.4s ease 0s, visibility 0.4s ease 0s}.checkbox-container{display: flex;flex-direction: column;list-style: none;overflow-y: auto;height: 100%}.is-resizing .checkbox-container{overflow-y: hidden}.checkbox-container zero-checkbox{min-width: fit-content}.checkbox-container zero-checkbox[disabled], .checkbox-container foundation-checkbox[disabled]{cursor: not-allowed}.visible{visibility: visible;max-height: var(--custom-max-height, ${230..toString()}px);overflow: hidden}::slotted(foundation-checkbox), foundation-checkbox{border-bottom: 1px solid var(--neutral-layer-4);padding: 5px 0 5px 5px;margin: 0}::slotted(foundation-checkbox:hover), foundation-checkbox:hover{background-color: var(--neutral-layer-3);cursor: pointer}::slotted(foundation-checkbox)::part(label), foundation-checkbox::part(label){overflow-x: hidden;text-overflow: ellipsis;white-space: nowrap}.label{display: block;cursor: pointer;font-size: var(--type-ramp-base-font-size);line-height: var(--type-ramp-base-line-height);font-style: normal;margin: calc(var(--design-unit) * 2px) 0}.label-hidden{display: none}ol, li{margin: 0;padding: 0}.checkbox{width: 100%}.select-all{width: 100%;margin-left: 0;margin-right: 0}.display-value{position: absolute;right: 40px;color: var(--neutral-foreground-rest);font-size: var(--type-ramp-base-font-size);line-height: var(--type-ramp-base-line-height);font-family: var(--body-font)}.options-header-item-hidden{display: none}.resize-button{position: absolute;bottom: 0;right: 0;width: 12px;height: 12px;cursor: nw-resize;background: linear-gradient( -45deg, transparent 30%, var(--neutral-foreground-rest) 30%, var(--neutral-foreground-rest) 40%, transparent 40%, transparent 60%, var(--neutral-foreground-rest) 60%, var(--neutral-foreground-rest) 70%, transparent 70% );z-index: 1000;opacity: 60%;transition: opacity 0.2s ease}.resize-button:hover{opacity: 100%}.multiselect-dropdown.resizable{resize: none;overflow: hidden}`;var jL;let qL=jL=class extends wx{constructor(){super(...arguments),this.emptyDataLabel="No matching records",this.allowCustomOptions=!1,this.infiniteScroll=!1,this.pageSize=jL.defaultPageSize,this.initalSelectedValueInitialized=!1,this.isSnapshot=!0,this.baseCriteria="",this.listboxElement=null,this.loadingMoreRows=!1,this.renderedOptionsCount=0,this.lastTopUpScrollHeight=-1,this.emptyDataOption=null,this.selectOpenChangeHandler=e=>{var t;(null===(t=e.detail)||void 0===t?void 0:t.open)&&(this.listboxElement||this.attachListboxScrollListener(),this.topUpVisibleListbox())},this.listboxScrollHandler=()=>{const e=this.listboxElement;if(!e)return;e.scrollTop+e.clientHeight>=e.scrollHeight-jL.scrollLoadThresholdPx&&this.loadNextPage()},this.resizeObserverCallback=e=>{e.forEach(e=>{this.checkOverflow(e.target)})},this.selectChangeHandler=e=>{var t;const i=e.target.value,o=null===(t=this.options)||void 0===t?void 0:t.find(e=>String(e.label)===i);!o&&this.allowCustomOptions&&this.select instanceof uh?this.select.$emit("value-change",{label:i,value:i}):this.select.$emit("value-change",o)}}initialSelectedValueChanged(e,t){t&&t!==e&&(this.select&&this.getDisplayForValue(t)===String(this.select.value||"")||(this.initalSelectedValueInitialized=!1,this.clearData(),this.fetchData()))}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return Ou(this,void 0,void 0,function*(){var t,i;if(e.connectedCallback.call(this),this.baseCriteria=this.criteria,this.fields=this.labelField?null===(t=this.valueField)||void 0===t?void 0:t.concat(" ",this.labelField):this.valueField,this.select=this.parentElement,this.optionElement=null!==(i=this.optionElement)&&void 0!==i?i:`${$x(this.select)}-option`,this.select.addEventListener("change",this.selectChangeHandler),this.resizeObserver=new ResizeObserver(this.resizeObserverCallback),this.infiniteScroll){if(this.maxRows=this.pageSize>0?this.pageSize:jL.defaultPageSize,this.select.addEventListener("open-change",this.selectOpenChangeHandler),yield this.applyInfiniteScrollFetchMode(),!this.isConnected)return;u.queueUpdate(()=>this.attachListboxScrollListener())}this.fetchData(),this.valueField||Mx.warn('Specify field for values in options (e.g value-field="VALUE") and optionally field for label (e.g label-field="NAME")')})}disconnectedCallback(){var e;super.disconnectedCallback(),this.resizeObserver.disconnect(),null===(e=this.listboxElement)||void 0===e||e.removeEventListener("scroll",this.listboxScrollHandler),this.listboxElement=null,this.select.removeEventListener("open-change",this.selectOpenChangeHandler),this.select.removeEventListener("change",this.selectChangeHandler)}applyInfiniteScrollFetchMode(){return Ou(this,void 0,void 0,function*(){if(this.resourceName&&this.connect.isConnected)try{const e=yield this.resources.getResourceTypeFor(this.resourceName);this.isSnapshot=e!==sb.DATASERVER}catch(e){Mx.warn(`Unable to determine the resource type for ${this.resourceName}`,e)}})}attachListboxScrollListener(){var e,t,i,o,c,s,n;this.isConnected&&(null===(e=this.listboxElement)||void 0===e||e.removeEventListener("scroll",this.listboxScrollHandler),this.listboxElement=null!==(c=null!==(i=null===(t=this.select)||void 0===t?void 0:t.scrollableListbox)&&void 0!==i?i:null===(o=this.select)||void 0===o?void 0:o.listbox)&&void 0!==c?c:null===(n=null===(s=this.select)||void 0===s?void 0:s.shadowRoot)||void 0===n?void 0:n.querySelector(".listbox"),this.listboxElement?this.listboxElement.addEventListener("scroll",this.listboxScrollHandler):Mx.warn("Unable to locate listbox element, infinite scroll will not be available."))}loadNextPage(){return Ou(this,void 0,void 0,function*(){if(this.loadingMoreRows||!this.canRequestMoreRows())return;this.loadingMoreRows=!0;const e=this.datasource.resourceType===sb.REQUEST_SERVER;try{yield this.requestMoreRows()}catch(e){return void(this.loadingMoreRows=!1)}e&&(this.loadingMoreRows=!1)})}topUpVisibleListbox(){this.infiniteScroll&&requestAnimationFrame(()=>{if(!this.isConnected)return;const e=this.listboxElement;e&&0!==e.clientHeight&&(e.scrollHeight>e.clientHeight||e.scrollHeight!==this.lastTopUpScrollHeight&&(this.lastTopUpScrollHeight=e.scrollHeight,this.loadNextPage()))})}fetchData(){this.select&&this.valueField&&(this.resourceName&&this.connect.isConnected||this.data)&&(this.select instanceof uh&&this.select.async&&this.initialSelectedValue?this.asyncModeIntialization():this.fetchGenesisData())}asyncModeIntialization(){return Ou(this,void 0,void 0,function*(){(yield this.datasource.init(this.datasourceOptions(),!0))?Px(this,this.initialSelectedValue):this.handleError({message:`Genesis Datasource async mode initialization failed for ${this.resourceName}`,loggerType:"error"})})}clearData(){this.rowsSyncedWithStream.clear(),this.renderedOptionsCount=0,this.lastTopUpScrollHeight=-1,this.emptyDataOption=null,this.loadingMoreRows=!1,this.select&&(Array.from(this.select.children).forEach(e=>{e instanceof jL||this.select.removeChild(e)}),this.select.value="",this.select.initialValue="")}checkOverflow(e){const t=e.shadowRoot.querySelector(".content");t&&(t.scrollWidth>t.clientWidth?e.setAttribute("title",e.textContent):e.removeAttribute("title"))}rowToOption(e){var t;return{value:e[this.valueField],label:this.labelRowFormatter?this.labelRowFormatter(e):this.labelFormatter?this.labelFormatter(e[this.labelField]):this.getDefaultLabelFormat(e[this.labelField],null===(t=this.getFieldMetadata(this.labelField))||void 0===t?void 0:t.type)}}renderListboxOptions(e){e.forEach(({value:e,label:t})=>{const i=document.createElement(this.optionElement);i.textContent=t||e,i.value=e,this.select.appendChild(i),this.resizeObserver.observe(i)})}removeEmptyDataOption(){this.emptyDataOption&&(this.emptyDataOption.remove(),this.emptyDataOption=null)}syncComponentData(e){this.loadingMoreRows=!1;const t=null!=e?e:Array.from(this.rowsSyncedWithStream.values());if(t.length>0){this.removeEmptyDataOption(),this.options=t.map(e=>this.rowToOption(e));const e=0===this.renderedOptionsCount;if(this.renderListboxOptions(this.options.slice(this.renderedOptionsCount)),this.renderedOptionsCount=this.options.length,this.topUpVisibleListbox(),!this.initalSelectedValueInitialized||this.select instanceof uh&&!this.select.async&&e){this.resetCombobox();const e=this.getInitialLabel();u.queueUpdate(()=>{this.select.value=String(e),this.select instanceof uh&&this.select.async&&this.selectChangeHandler({target:{value:e}})}),this.initalSelectedValueInitialized=!0}}else if(this.allowCustomOptions&&this.initialSelectedValue&&(!this.initalSelectedValueInitialized||this.select instanceof uh&&!this.select.async)&&(this.resetCombobox(),u.queueUpdate(()=>{this.select.value=String(this.initialSelectedValue)}),this.initalSelectedValueInitialized=!0),this.select&&!this.emptyDataOption){const e=document.createElement(this.optionElement);e.textContent=this.emptyDataLabel,e.value="",e.disabled=!0,this.select.appendChild(e),this.emptyDataOption=e}}getInitialLabel(){return this.getDisplayForValue(this.initialSelectedValue)}getDisplayForValue(e){var t;if(null==e||0!==e&&!e)return"";const i=null===(t=this.options)||void 0===t?void 0:t.find(t=>t.value===e);return this.allowCustomOptions&&this.select instanceof uh?String(i?i.label:e):i?String(i.label):""}resetCombobox(){this.select&&this.select instanceof uh&&this.select.resetCombobox()}handleStreamInserts(e){var t;if(this.loadingMoreRows=!1,!(null==e?void 0:e.length))return;this.removeEmptyDataOption();const i=e.map(e=>this.rowToOption(e));this.options=[...null!==(t=this.options)&&void 0!==t?t:[],...i],this.renderListboxOptions(i),this.renderedOptionsCount=this.options.length,this.topUpVisibleListbox()}handleStreamDeletes(e){Mx.debug("handleStreamDeletes - Method not implemented.")}handleStreamUpdates(e){Mx.debug("handleStreamUpdates - Method not implemented.")}};qL.defaultPageSize=20,qL.scrollLoadThresholdPx=32,Nu([Yz],qL.prototype,"resources",void 0),Nu([re({attribute:"label-field"})],qL.prototype,"labelField",void 0),Nu([re({attribute:"option-element"})],qL.prototype,"optionElement",void 0),Nu([re({attribute:"value-field"})],qL.prototype,"valueField",void 0),Nu([re({attribute:"empty-data-label"})],qL.prototype,"emptyDataLabel",void 0),Nu([re({mode:"boolean",attribute:"allow-custom-options"})],qL.prototype,"allowCustomOptions",void 0),Nu([re({mode:"boolean",attribute:"infinite-scroll"})],qL.prototype,"infiniteScroll",void 0),Nu([re({attribute:"page-size",converter:ne})],qL.prototype,"pageSize",void 0),Nu([g],qL.prototype,"labelFormatter",void 0),Nu([g],qL.prototype,"labelRowFormatter",void 0),Nu([g],qL.prototype,"initialSelectedValue",void 0),qL=jL=Nu([ye({name:"options-datasource"})],qL);let GL=class extends wx{constructor(){super(...arguments),this.isSnapshot=!0,this.baseCriteria=""}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return Ou(this,void 0,void 0,function*(){var t;e.connectedCallback.call(this),this.baseCriteria=this.criteria,this.fields=this.labelField?null===(t=this.valueField)||void 0===t?void 0:t.concat(" ",this.labelField):this.valueField,this.select=this.parentElement,this.select&&this.valueField&&(this.resourceName&&this.connect.isConnected||this.data)&&this.fetchGenesisData(),this.valueField||Mx.warn('Specify field for values in options (e.g value-field="VALUE") and optionally field for label which is supported only in select and combobox (e.g label-field="NAME")')})}clearData(){this.select.options=[]}syncComponentData(e){var t;const i=(null!=e?e:Array.from(this.rowsSyncedWithStream.values())).map(e=>{var t;return{value:e[this.valueField],label:this.getDefaultLabelFormat(e[this.labelField],null===(t=this.getFieldMetadata(this.labelField))||void 0===t?void 0:t.type)}});(null===(t=this.select)||void 0===t?void 0:t.async)&&(this.select.loading=!1),this.select.options=i}handleStreamInserts(e){Mx.debug("handleStreamInserts - Method not implemented.")}handleStreamDeletes(e){Mx.debug("handleStreamDeletes - Method not implemented.")}handleStreamUpdates(e){Mx.debug("handleStreamUpdates - Method not implemented.")}};Nu([re({attribute:"value-field"})],GL.prototype,"valueField",void 0),Nu([re({attribute:"label-field"})],GL.prototype,"labelField",void 0),GL=Nu([ye({name:"multiselect-datasource"})],GL);const WL=(e="foundation")=>W`<label part="label" for="display-field" class=${e=>{var t;return Jt("label",["label-hidden",!(null===(t=e.defaultSlottedNodes)||void 0===t?void 0:t.length)])}}><slot name="label" ${Ke({property:"defaultSlottedNodes",filter:Fs})}></slot></label><div class="root" part="root" @keydown="${(e,t)=>e.keydownHandler(t.event)}"><div class="control" part="control"><input id="display-field" part="filter-search" role="combobox" aria-haspopup="listbox" aria-controls="checkbox-container" aria-expanded=${e=>e.open?"true":"false"}tabindex="${e=>e.tabindex}" ?readonly=${e=>!e.search}@click=${e=>e.toggle()}?disabled="${e=>e.disabled}" ${Ie("filterSearchInput")}value=${Ep(e=>e.filterSearchValue,"string","input")}placeholder="${e=>e.getDisplayValue}" autocomplete="off" @input=${(e,t)=>e.inputHandler()}@change=${(e,t)=>e.changeHandler(t.event)}/><div part="indicator" class="indicator" @click=${e=>!e.disabled&&e.toggle()}><svg viewBox="0 0 12 7" ${Ie("arrowIcon")}id="arrow-icon" class="${e=>Jt(["disabled-svg",e.disabled])}" xmlns="http://www.w3.org/2000/svg"><path d="${"M11.85.65c.2.2.2.5 0 .7L6.4 6.84a.55.55 0 01-.78 0L.14 1.35a.5.5 0 11.71-.7L6 5.8 11.15.65c.2-.2.5-.2.7 0z"}" /></svg></div>${He(e=>e.filterSearchValue&&e.selectedOptions.length,W`<div class="display-value">${e=>e.getDisplayValue}</div>`)}</div>${He(e=>e.loading,W`<${e}-progress slot="indicator"></${e}-progress>`)}<section class=${e=>Jt("multiselect-dropdown",["resizable",e.resizable])} ${Ie("multiselectDropdown")}part="multiselect-dropdown">${He(e=>e.resizable,W`<div class="resize-button" @mousedown=${(e,t)=>e.handleResizeStart(t.event)}></div>`)} ${He(e=>e.all,W`<${e}-button class="select-all" @click=${e=>e.selectCheckboxAll()}?disabled="${(e,t)=>e.isAllOptionsDisabled}">${e=>e.areAllOptionsSelected?"Deselect All":"Select All"} ${e=>e.name}</${e}-button>`)}<ol id="checkbox-container" class="checkbox-container options" aria-multiselectable="true" part="options-ol"><li part="options-header-item" class=${e=>{var t;return Jt("options-header-item",["options-header-item-hidden",!(null===(t=e.optionsHeaderSlottedNodes)||void 0===t?void 0:t.length)])}}><slot name="options-header" ${Ke({property:"optionsHeaderSlottedNodes",filter:Fs})}></slot></li>${qe(e=>e.filteredAvailableOptions,W`<li role="option" value=${(e,t)=>t.parent.getItemLabel(e)}part="option"><${e}-checkbox part="checkbox" class="checkbox" exportparts="label:checkbox-label" @keydown=${(e,t)=>t.parent.checkboxKeyDown(e,t.event)}@click=${(e,t)=>t.parent.selectCheckboxOne(e)}@change=${(e,t)=>t.parent.changeHandler(t.event)}?current-checked="${(e,t)=>t.parent.isOptionSelected(e)}" ?disabled="${(e,t)=>t.parent.isOptionDisabled(e)}">${(e,t)=>{var i,o;return null===(o=null===(i=t.parent)||void 0===i?void 0:i.itemRenderer)||void 0===o?void 0:o.call(i,e,t.parent)}}</${e}-checkbox></li>`)}</ol>${He(e=>e.showCreatable,W`<${e}-button @click=${e=>e.addOption()}>Create&nbsp;"${e=>e.filterSearchValue}"</${e}-button>`)}</section></div><slot ${Ke({property:"slottedDatasource",filter:e=>e instanceof GL})}></slot>`,YL=W` ${WL()} `,KL=void 0,ZL={};class QL extends qt{constructor(){super(...arguments),this.name="",this.autoPosition=!0,this.all=!0,this.allSelected=!1,this.search=!0,this.disabled=!1,this.creatable=!1,this.async=!1,this.debounce=500,this.resizable=!1,this.filterByContains=!1,this.filterSearchValue="",this.clickOutside=e=>this.handleClickOutside(e),this.open=!1,this.options=[],this.selectedOptions=[],this.filteredAvailableOptions=[...this.options],this.position=_L.BELOW,this.itemRenderer=this.defaultItemRenderer,this.initialisedOptions=!1,this.isResizing=!1,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.handleResizeStart=e=>{this.resizable&&this.multiselectDropdown&&(e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.startX=e.clientX,this.startY=e.clientY,this.startWidth=this.multiselectDropdown.offsetWidth,this.startHeight=this.multiselectDropdown.offsetHeight,this.multiselectDropdown.classList.add("is-resizing"),document.addEventListener("mousemove",this.handleResizeMove),document.addEventListener("mouseup",this.handleResizeEnd))},this.handleResizeMove=e=>{if(!this.isResizing||!this.multiselectDropdown)return;e.preventDefault();const t=e.clientX-this.startX,i=e.clientY-this.startY,o=Math.max(250,this.startWidth+t),c=Math.max(100,this.startHeight+i);this.multiselectDropdown&&(this.multiselectDropdown.style.width=`${o}px`,this.multiselectDropdown.style.maxHeight=`${c}px`)},this.handleResizeEnd=()=>{this.isResizing=!1,document.removeEventListener("mousemove",this.handleResizeMove),document.removeEventListener("mouseup",this.handleResizeEnd),this.multiselectDropdown&&(this.multiselectDropdown.classList.remove("is-resizing"),this.multiselectDropdown.style.setProperty("--custom-max-height",this.multiselectDropdown.style.maxHeight),this.multiselectDropdown.style.removeProperty("max-height"))}}debounceChanged(e,t){this.debouncedInputHandler=BL(this.asyncSetFilter,t)}openChanged(e,t){var i,o,c,s;t?(document.addEventListener("mousedown",this.clickOutside),null===(i=this.arrowIcon)||void 0===i||i.classList.add("flipped"),null===(o=this.multiselectDropdown)||void 0===o||o.classList.add("visible")):(document.removeEventListener("mousedown",this.clickOutside),null===(c=this.arrowIcon)||void 0===c||c.classList.remove("flipped"),null===(s=this.multiselectDropdown)||void 0===s||s.classList.remove("visible"))}connectedCallback(){var e;super.connectedCallback(),this.position===_L.ABOVE&&(null===(e=this.multiselectDropdown)||void 0===e||e.classList.add("position-above"))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this.clickOutside),document.removeEventListener("mousemove",this.handleResizeMove),document.removeEventListener("mouseup",this.handleResizeEnd)}defaultItemRenderer(e,t){return W` ${"string"==typeof e?W`<span part="option-label">${()=>t.getItemLabel(e)}</span>`:W`<span data-option-label-text=${()=>e.optionLabelText}style=${()=>e.labelStyle}part="option-label">${()=>t.getItemLabel(e)}</span>`} `}toggle(){this.open||this.setDropdownPosition(),this.open=!this.open}optionsChanged(){this.allSelected&&!this.initialisedOptions&&(this.selectedOptions=this.options.map(e=>this.optionValueGetter(e))),this.filteredAvailableOptions=[...this.options]}selectedOptionsChanged(){this.$fastController.isConnected&&(this.initialisedOptions=!0)}setDropdownPosition(){let e=this.position;if(this.autoPosition){const t=this.getBoundingClientRect(),i=window.innerHeight,o=t.top,c=i-t.bottom;e=c<230&&o>c?_L.ABOVE:_L.BELOW}this.multiselectDropdown.classList.toggle("position-above",e===_L.ABOVE),this.multiselectDropdown.classList.toggle("position-below",e===_L.BELOW)}optionValueGetter(e){return"string"==typeof e?e:e.value}optionLabelGetter(e){return"string"==typeof e?e:e.label}getItemLabel(e){let t;return e?(t="string"==typeof e?e:this.optionLabelGetter(e)||this.optionValueGetter(e)||"",this.valueFormatter?this.valueFormatter(t):t):""}isOptionDisabled(e){return e&&"string"!=typeof e&&e.disabled||!1}get getDisplayValue(){let e="";switch(this.selectedOptions.length){case 0:e=this.getPlaceholder;break;case 1:{const t=this.options.find(e=>this.optionValueGetter(e)===this.selectedOptions[0]);e=this.getItemLabel(t);break}case this.options.length:e=`All ${this.name}`.trim();break;default:e=`${this.selectedOptions.length} Selected`}return e}get getPlaceholder(){return`Search ${this.name}`.trim().concat("...")}get isAllOptionsDisabled(){return this.options.length===this.options.filter(this.isOptionDisabled).length}get areAllOptionsSelected(){const e=this.getEnabledOptionsCount();return e>0&&this.selectedOptions.length===e}get showCreatable(){return this.creatable&&this.filterSearchValue.length>0&&0===this.findExactMatchOptions().length}isOptionSelected(e){const t=this.optionValueGetter(e);return this.selectedOptions.some(i=>{if("object"==typeof e&&"object"==typeof e.value)try{return JSON.stringify(i)===JSON.stringify(t)}catch(e){return i===t}return i===t})}selectCheckboxOne(e){const t=this.optionValueGetter(e),i=this.selectedOptions.includes(t);this.selectedOptions=i?this.selectedOptions.filter(e=>e!==t):[...this.selectedOptions,t],this.$emit("selectionChange",this.selectedOptions)}checkboxKeyDown(e,t){return" "===t.key&&(t.preventDefault(),this.selectCheckboxOne(e)),!0}getEnabledOptionsCount(){return this.options.length-this.options.filter(this.isOptionDisabled).length}selectCheckboxAll(){const e=this.selectedOptions.length===this.getEnabledOptionsCount();this.selectedOptions=e?[]:this.options.filter(e=>!this.isOptionDisabled(e)).map(e=>this.optionValueGetter(e)),this.onAllSelectedCallback&&this.onAllSelectedCallback(!e),this.$emit("selectionChange",this.selectedOptions)}inputHandler(){this.open||(this.open=!0),this.async?(this.loading=!0,this.filteredAvailableOptions=[],this.debouncedInputHandler()):this.setFilter()}findExactMatchOptions(){const e=this.filterSearchValue.toLowerCase();return this.filteredAvailableOptions.filter(t=>{var i,o;const c="string"==typeof t?t:null!==(i=this.optionLabelGetter(t))&&void 0!==i?i:this.optionValueGetter(t);return(null!==(o=null==c?void 0:c.toLowerCase())&&void 0!==o?o:"")===e})}setFilter(){const e=this.filterSearchValue.toLowerCase();this.filteredAvailableOptions=this.options.filter(t=>{if(!e)return!0;if("string"==typeof t)return t.toLowerCase().includes(e);const i=t.label.toLowerCase(),o="object"==typeof t.value?(c=t.value,Object.values(c).some(t=>t.toLowerCase().includes(e))):String(t.value).toLowerCase().includes(e);var c;return i.includes(e)||o})}addOption(){this.options=[{value:this.filterSearchValue,label:this.filterSearchValue},...this.options],this.setFilter(),this.selectedOptions=[...this.selectedOptions,this.filterSearchValue]}asyncSetFilter(){this.slottedDatasource.length>0?Px(this.slottedDatasource[0],this.filterSearchValue):(this.loading=!1,Mx.warn("Multiselect-datasource is not connected. Please add a datasource to use this functionality."))}changeHandler(e){e.preventDefault(),e.stopImmediatePropagation()}handleClickOutside(e){kx(e,this)&&(this.open=!1)}keydownHandler(e){const t=e.key;if(e.ctrlKey||e.shiftKey)return!0;switch(t){case"Escape":if(this.open){this.open=!1;break}break;case"ArrowUp":case"ArrowDown":if(!this.open){this.open=!0;break}break;default:return!0}}clear(e={}){const{clearSelectedValues:t=!0,clearFilterText:i=!0}=e;t&&(this.selectedOptions=[],this.$emit("selectionChange",this.selectedOptions)),i&&(this.filterSearchValue="",this.setFilter(),this.filterSearchInput&&(this.filterSearchInput.value="")),this.$emit("clear",{clearSelectedValues:t,clearFilterText:i})}}Nu([re],QL.prototype,"name",void 0),Nu([re({mode:"boolean",attribute:"auto-position"})],QL.prototype,"autoPosition",void 0),Nu([re({mode:"boolean"})],QL.prototype,"all",void 0),Nu([re({mode:"boolean"})],QL.prototype,"allSelected",void 0),Nu([re({mode:"boolean"})],QL.prototype,"search",void 0),Nu([re({mode:"boolean"})],QL.prototype,"disabled",void 0),Nu([re({mode:"boolean"})],QL.prototype,"creatable",void 0),Nu([re({mode:"boolean"})],QL.prototype,"async",void 0),Nu([re],QL.prototype,"debounce",void 0),Nu([re({mode:"boolean"})],QL.prototype,"resizable",void 0),Nu([re],QL.prototype,"tabindex",void 0),Nu([re({mode:"boolean",attribute:"filter-by-contains"})],QL.prototype,"filterByContains",void 0),Nu([g],QL.prototype,"defaultSlottedNodes",void 0),Nu([g],QL.prototype,"slottedDatasource",void 0),Nu([g],QL.prototype,"valueFormatter",void 0),Nu([g],QL.prototype,"loading",void 0),Nu([g],QL.prototype,"filterSearchValue",void 0),Nu([g],QL.prototype,"open",void 0),Nu([g],QL.prototype,"options",void 0),Nu([g],QL.prototype,"selectedOptions",void 0),Nu([g],QL.prototype,"filteredAvailableOptions",void 0),Nu([g],QL.prototype,"scrollContainer",void 0),Nu([re],QL.prototype,"position",void 0),Nu([g],QL.prototype,"onAllSelectedCallback",void 0),Nu([g],QL.prototype,"itemRenderer",void 0),Nu([v],QL.prototype,"getDisplayValue",null),Nu([v],QL.prototype,"getPlaceholder",null),Nu([v],QL.prototype,"isAllOptionsDisabled",null),Nu([v],QL.prototype,"areAllOptionsSelected",null),Nu([v],QL.prototype,"showCreatable",null),Nu([g],QL.prototype,"optionsHeaderSlottedNodes",void 0),QL.compose(Object.assign({baseName:"multiselect",template:YL,styles:UL,shadowOptions:KL},ZL));const XL=Ce` .root{position: relative;width: 100%;min-width: 250px}.control-button{display: flex;justify-content: center;min-width: 31px;width: 31px;height: 31px;margin-left: calc(var(--design-unit) * 2px);color: var(--neutral-foreground-hint)}.control{cursor: pointer;position: relative;display: flex;justify-content: end;align-items: center;width: 100%;border-radius: calc(var(--control-corner-radius) * 1px)}.label{display: block;cursor: pointer;font-size: var(--type-ramp-base-font-size);line-height: var(--type-ramp-base-line-height);font-style: normal;font-weight: 700;margin: calc(var(--design-unit) * 2px) 0}.label-hidden{display: none}.control:hover .control-button, .control:hover .label{color: var(--neutral-foreground-rest)}button{pointer-events: none}.options{display: flex;flex-direction: column;position: absolute;height: max-content;overflow-y: hidden;margin-top: 5px;padding: calc((var(--design-unit) + 3) * 2px) calc((var(--design-unit) + 3) * 1px);border: 1px solid rgba(46 51 57 / 100%);border-radius: 4px;background: var(--neutral-fill-input-rest);width: 100%;max-height: 0;visibility: hidden;transition: max-height 0.4s ease 0s, visibility 0.4s ease 0s;z-index: 999}.option-content{display: flex;align-items: center;gap: calc(var(--design-unit) * 4px);width: 100%}.icon-container{display: flex;align-items: center;justify-content: center;width: calc( ((var(--base-height-multiplier) * var(--design-unit)) + (var(--design-unit) * 2)) * 1px + 4px );height: calc( ((var(--base-height-multiplier) * var(--design-unit)) + (var(--design-unit) * 2)) * 1px );border-radius: calc((var(--control-corner-radius) - 1) * 2px);background: var(--neutral-layer-2);box-sizing: border-box;box-shadow: 0 0 5px 0 rgba(0 0 0 / 35%);flex-shrink: 0}.text-content{display: flex;flex-direction: column;flex: 1}.svg-icon{height: 2em}.position-above{bottom: 100%}.checkbox-container{display: flex;flex-direction: column;overflow-y: scroll;scrollbar-width: thin;scrollbar-color: rgb(46 48 53) rgb(31 33 38)}span{border-bottom: calc(var(--stroke-width) * 1px) solid;border-color: color-mix(in srgb, var(--neutral-fill-rest), transparent 50%);padding: calc((var(--design-unit) + 2) * 2px) calc((var(--design-unit) + 3) * 1px);font-size: calc((var(--type-ramp-base-font-size) - 1px));color: var(--neutral-foreground-hint)}.multiselect-checkbox{min-width: fit-content;flex-direction: row-reverse;justify-content: space-between;align-items: flex-start;border-bottom: 1px solid;border-color: color-mix(in srgb, var(--neutral-fill-rest), transparent 50%);padding: calc((var(--design-unit) + 3) * 1px) calc((var(--design-unit) + 3) * 1px) calc((var(--design-unit) + 3) * 1px) 0;margin: 0}.multiselect-checkbox:hover{background-color: rgb(45 47 51);cursor: pointer}.multiselect-checkbox::part(label){overflow-x: hidden;text-overflow: ellipsis}.multiselect-checkbox::part(control){min-width: calc( ( (var(--base-height-multiplier) + var(--density)) * var(--design-unit) / 2 + var(--design-unit) ) * 1px )}.checkbox-container .multiselect-checkbox[disabled]{cursor: not-allowed}.description{text-wrap: wrap;font-size: calc((var(--type-ramp-base-font-size) - 1px));margin: calc((var(--design-unit) + 3) * 1px) 0}#filter-search{padding: 5px}::-webkit-scrollbar{width: 12px}::-webkit-scrollbar-track{background: rgb(31 33 38)}::-webkit-scrollbar-thumb{width: 8px;border-radius: 10px;box-shadow: inset 0 0 6px rgba(0 0 0 / 30%);background-color: rgb(46 48 53);border: 3px solid rgb(31 33 38)}.visible{visibility: visible;max-height: ${450..toString()}px}`,JL=(e="foundation")=>W`<div class="root" part="root"><div class="control" part="control" @click=${e=>!e.disabled&&e.toggle()}><label part="label" for="control" class=${e=>{var t;return Jt("label",["label-hidden",!(null===(t=e.defaultSlottedNodes)||void 0===t?void 0:t.length)])}}><slot ${Ke({property:"defaultSlottedNodes",filter:Fs})}></slot></label><${e}-button class="control-button" part="control-button"><slot name="button-content"><${e}-icon name="plus" variant="solid" size="lg"></${e}-icon></slot></${e}-button></div><div ${Ie("optionsElement")}class="options" part="options">${He(e=>e.search,W`<${e}-text-field id="filter-search" part="filter-search" value=${Ep(e=>e.filterSearchValue,"string","input")}placeholder="${e=>e.getPlaceholder}" @input=${(e,t)=>e.setFilter()}@change=${(e,t)=>e.changeHandler(t.event)}></${e}-text-field>`)}<div class="checkbox-container" part="checkbox-container">${qe(e=>e.filteredAvailableOptions,W`<span>${e=>e.type}</span>${qe(e=>e.options,W`<${e}-checkbox class="multiselect-checkbox" part="multiselect-checkbox" @click=${(e,t)=>t.parentContext.parent.selectCheckboxOne(e)}@change=${(e,t)=>t.parentContext.parent.changeHandler(t.event)}?current-checked="${(e,t)=>t.parentContext.parent.isOptionSelected(e)}" ?disabled="${(e,t)=>t.parentContext.parent.isOptionDisabled(e)}"><div class="option-content">${He(e=>e.icon||e.svg,W`<div class="icon-container">${He(e=>e.icon,W`<${e}-icon style="color:${e=>e.iconColor||"#fff"}" name="${e=>e.icon}" size="xl"></${e}-icon>`)} ${He(e=>e.svg,W`<img class="svg-icon" src="${e=>e.svg}" alt="${e=>e.label}" />`)}</div>`)}<div class="text-content"><div class="option-label">${(e,t)=>t.parentContext.parent.getItemLabel(e)}</div>${He(e=>e.description,W`<p class="description">${e=>e.description}</p>`)}</div></div></${e}-checkbox>`)} `)}</div></div></div>`,eM=W` ${JL()} `,tM=void 0,iM={};class oM extends qt{constructor(){super(...arguments),this.name="",this.autoPosition=!0,this.search=!0,this.disabled=!1,this.clickOutside=e=>this.handleClickOutside(e),this.open=!1,this.options=[],this.selectedOptions=[],this.position=_L.BELOW}openChanged(e,t){var i,o;t?(document.addEventListener("mousedown",this.clickOutside),null===(i=this.optionsElement)||void 0===i||i.classList.add("visible")):(document.removeEventListener("mousedown",this.clickOutside),null===(o=this.optionsElement)||void 0===o||o.classList.remove("visible"))}connectedCallback(){var e;super.connectedCallback(),this.position===_L.ABOVE&&(null===(e=this.optionsElement)||void 0===e||e.classList.add("position-above"))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this.clickOutside)}toggle(){this.open||this.setDropdownPosition(),this.open=!this.open}sortFilteredOptions(e){const t=(null!=e?e:this.options).reduce((e,t)=>{const i=t.type||"Other";return e[i]?e[i].options.push(t):e[i]={type:i,options:[t]},e},{});return Object.values(t)}optionsChanged(){this.filteredAvailableOptions=this.sortFilteredOptions()}setDropdownPosition(){let e=this.position;if(this.autoPosition){let t=this.assignedSlot?this.assignedSlot.parentElement:this.parentElement;for(;t&&!t.classList.contains("content-wrapper");)t=t.parentElement;if(t){const i=t.getBoundingClientRect(),o=this.getBoundingClientRect(),c=i.top+i.height/2;e=o.top<c?_L.BELOW:_L.ABOVE}else{const t=this.getBoundingClientRect(),i=window.innerHeight,o=t.top,c=i-t.bottom;e=c<t.height&&o>c?_L.ABOVE:_L.BELOW}}e===_L.ABOVE?(this.optionsElement.classList.add("position-above"),this.optionsElement.classList.remove("position-below")):e===_L.BELOW&&(this.optionsElement.classList.add("position-below"),this.optionsElement.classList.remove("position-above"))}optionGetter(e){return e.value}getItemLabel(e){let t;return e?(t=e.label||e.value||"",this.valueFormatter?this.valueFormatter(t):t):""}isOptionDisabled(e){return e&&"string"!=typeof e&&e.disabled||!1}get getPlaceholder(){return`Search ${this.name}`.trim().concat("...")}isOptionSelected(e){return this.selectedOptions.includes(this.optionGetter(e))}selectCheckboxOne(e){const t=this.optionGetter(e);this.selectedOptions.includes(t)?(this.selectedOptions=[...this.selectedOptions],this.selectedOptions.splice(this.selectedOptions.indexOf(t),1)):this.selectedOptions=[...this.selectedOptions,t],this.$emit("selectionChange",this.selectedOptions)}setFilter(){const e=this.options.filter(e=>{var t;const i=e.description,o=null!==(t=e.label)&&void 0!==t?t:e.value;return(null==i?void 0:i.toLowerCase().includes(this.filterSearchValue.toLowerCase()))||o.toLowerCase().includes(this.filterSearchValue.toLowerCase())?e:void 0});this.filteredAvailableOptions=this.sortFilteredOptions(e)}changeHandler(e){e.preventDefault(),e.stopImmediatePropagation()}handleClickOutside(e){kx(e,this)&&(this.open=!1)}}Nu([re],oM.prototype,"name",void 0),Nu([re({mode:"boolean",attribute:"auto-position"})],oM.prototype,"autoPosition",void 0),Nu([re({mode:"boolean"})],oM.prototype,"search",void 0),Nu([re({mode:"boolean"})],oM.prototype,"disabled",void 0),Nu([g],oM.prototype,"defaultSlottedNodes",void 0),Nu([g],oM.prototype,"valueFormatter",void 0),Nu([g],oM.prototype,"filterSearchValue",void 0),Nu([g],oM.prototype,"open",void 0),Nu([g],oM.prototype,"options",void 0),Nu([g],oM.prototype,"selectedOptions",void 0),Nu([g],oM.prototype,"filteredAvailableOptions",void 0),Nu([g],oM.prototype,"position",void 0),Nu([v],oM.prototype,"getPlaceholder",null),oM.compose(Object.assign({baseName:"categorized-multiselect",template:eM,styles:XL,shadowOptions:tM},iM));const cM=(e,t)=>Io(0,t),sM=(e,t)=>Ce` ${rh()}`;class nM extends _o{}const aM=void 0,rM={checkedIndicator:'\n <svg\n aria-hidden="true"\n part="checked-indicator"\n class="checked-indicator"\n viewBox="0 0 20 20"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n fill-rule="evenodd"\n clip-rule="evenodd"\n d="M8.143 12.6697L15.235 4.5L16.8 5.90363L8.23812 15.7667L3.80005 11.2556L5.27591 9.7555L8.143 12.6697Z"\n />\n </svg>\n ',indeterminateIndicator:'\n <div part="indeterminate-indicator" class="indeterminate-indicator"></div>\n '};nM.compose(Object.assign({baseName:"checkbox",template:cM,styles:sM,shadowOptions:aM},rM));const lM=(e,t)=>Ce` .combo-box-indicator{transition-property: transform;transition-duration: 0.2s;transition-timing-function: ease-out}:host([open]) .combo-box-indicator{transform: rotate(180deg)}${hh(e)}`,dM=(e,t)=>W`<template aria-activedescendant="${e=>e.activeDescendant}" class="${e=>e.open?"open":""} ${e=>e.disabled?"disabled":""} ${e=>e.position}" ?open="${e=>e.open}" @click="${(e,t)=>e.clickHandler(t.event)}" @focusout="${(e,t)=>e.focusoutHandler(t.event)}" @keydown="${(e,t)=>e.keydownHandler(t.event)}"><div class="control" part="control">${et(0,t)}<slot name="control"><input aria-activedescendant="${e=>e.activeDescendant}" aria-autocomplete="${e=>e.ariaAutoComplete||e.autocomplete}" aria-controls="${e=>e.ariaControls||e.listboxId}" aria-disabled="${e=>e.disabled?"true":"false"}" aria-expanded="${e=>e.open?"true":"false"}" aria-haspopup="listbox" aria-labelledby="${e=>e.ariaLabelledby}" aria-label="${e=>e.ariaLabel}" autocomplete="${e=>e.autocomplete}" class="selected-value" part="selected-value" placeholder="${e=>e.placeholder}" role="combobox" type="text" ?disabled="${e=>e.disabled}" :value="${e=>e.value}" @input="${(e,t)=>e.inputHandler(t.event)}" @keyup="${(e,t)=>e.keyupHandler(t.event)}" ${Ie("control")}/><div class="indicator" part="indicator" aria-hidden="true"><slot name="indicator">${t.indicator||""}</slot></div></slot>${Je(0,t)}</div><div class="listbox" id="${e=>e.listboxId}" part="listbox" role="listbox" ?disabled="${e=>e.disabled}" ?hidden="${e=>!e.open}" ${Ie("listbox")}><slot ${Ie("slottedDatasource")} ${Ke({filter:Bo.slottedOptionFilter,flatten:!0,property:"slottedOptions"})}></slot></div></template>`;var hM,uM;class pM extends uh{constructor(){super(...arguments),hM.set(this,void 0),uM.set(this,!1),this.needManualChangeEventDispatch=!1,this.async=!1,this.debounce=500,this.caseSensitive=!1,this.ignoreInputClick=!1,this.filterMode="startsWith",this.scrollToSelectedWhenOpening=!1,this.scrollToSelectedWhenOpeningOptions={behavior:"auto",block:"nearest"},this.scrollWhenSelectionChanges=!1,this.scrollWhenSelectionChangesOptions={behavior:"auto",block:"center"},this.resetCombobox=()=>{this.selectedOptions=[],this.selectedIndex=-1,this.value="",this.control.value="",this.filter="",this.filterOptions()}}get activeDescendant(){var e,t;if(this.selectedOptions&&0!==this.selectedOptions.length)return this.ariaActiveDescendant=null===(e=this.selectedOptions[0])||void 0===e?void 0:e.id,null===(t=this.selectedOptions[0])||void 0===t?void 0:t.id}debounceChanged(e,t){this.debouncedInputHandler=BL(this.asyncSetFilter,t)}get scrollableListbox(){var e,t;return null!==(e=this.listbox)&&void 0!==e?e:null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".listbox")}openChanged(){super.openChanged(),this.$emit("open-change",{open:this.open}),this.open?this.scrollToSelectedWhenOpening&&setTimeout(()=>{const e=this.options[this.selectedIndex];null==e||e.scrollIntoView(this.scrollToSelectedWhenOpeningOptions)},500):(this.manuallyDispatchChangeEvent(),this.filter="",this.filterOptions())}get value(){return m.track(this,"value"),this._ourValue}set value(e){var t,i,o;if(void 0===e)return;const c=`${this._ourValue}`;if(this.$fastController.isConnected&&this.options){const c=this.caseSensitive?t=>t.text===e:t=>t.text.toLowerCase()===String(e).toLowerCase(),s=this.options?this.options.findIndex(c):-1,n=null===(t=this.options[this.selectedIndex])||void 0===t?void 0:t.text,a=null===(i=this.options[s])||void 0===i?void 0:i.text;this.selectedIndex=a&&a!==n?s:this.selectedIndex,e&&""!==e.trim()&&-1===s&&(e=(null===(o=this.firstSelectedOption)||void 0===o?void 0:o.text)||e)}c!==e&&(this._ourValue=e,super.valueChanged(c,e),m.notify(this,"value"))}slottedOptionsChanged(e,t){this.enableAsyncForInfiniteScrollDatasource();const i=!!this.async;super.slottedOptionsChanged(e,t),this.updateValue(i)}enableAsyncForInfiniteScrollDatasource(){var e;if(this.async)return;const t=null===(e=this.slottedDatasource)||void 0===e?void 0:e.assignedNodes().find(e=>e instanceof qL);(null==t?void 0:t.infiniteScroll)&&(this.async=!0)}filterOptions(){this.autocomplete&&this.autocomplete!==Qo||(this.filter="");const e=this.filter,t=this.caseSensitive?e:e.toLowerCase();this.filteredOptions=this._options.filter(e=>{const i=this.caseSensitive?e.text:e.text.toLowerCase();return"contains"===this.filterMode?i.includes(t):i.startsWith(t)}),this.isAutocompleteList&&(this.filteredOptions.length||t||(this.filteredOptions=this._options),this._options.forEach(e=>e.hidden=!this.filteredOptions.includes(e)))}clickHandler(e){if(!this.disabled)if(kx(e,this))this.open=!1;else{if(Sx(e,this.indicator))return this.open=!this.open,void(this.open&&this.control.focus());if(!this.ignoreInputClick||!Sx(e,this.control))return super.clickHandler(e)}}keydownHandler(e){const t=e.key;if(e.ctrlKey||e.shiftKey)return!0;switch(t){case"Enter":if(Vu(this,uM,this.open,"f"),!this.open)return this.open=!0,!0;break;case"ArrowDown":case"ArrowUp":if(!this.open)return this.open=!0,!0;if(this.scrollWhenSelectionChanges){const e=this.options[this.selectedIndex];null==e||e.scrollIntoView(this.scrollWhenSelectionChangesOptions)}break;case"Escape":if(this.control.value!==this.currentValue)return this.filter="",this.filterOptions(),this.control.value=this.currentValue,this.selectItemByValue(this.currentValue),void(this.open=!1);if(!this.open)return!0}const i=super.keydownHandler(e);return"Enter"!==t?i:void 0}keyupHandler(e){var t;const i=e.key;if(e.ctrlKey||e.shiftKey)return!0;switch(i){case"Enter":return!Pu(this,uM,"f");case"ArrowDown":case"ArrowUp":this.open&&this.firstSelectedOption&&this.autocomplete===Zo&&(this.needManualChangeEventDispatch=!0,this.currentValue=null===(t=this.firstSelectedOption)||void 0===t?void 0:t.value);break;case"Home":case"End":return;case"Backspace":case"Delete":const i=super.keyupHandler(e);return this.selectItemByValue(this.control.value),i}return super.keyupHandler(e)}get indicator(){return Pu(this,hM,"f")||Vu(this,hM,this.shadowRoot.querySelector('[part="indicator"]'),"f"),Pu(this,hM,"f")}selectItemByValue(e){var t,i,o;this.selectedIndex=null!==(i=null===(t=this.options)||void 0===t?void 0:t.findIndex(t=>t.text===e))&&void 0!==i?i:-1,null===(o=this.options)||void 0===o||o.forEach((e,t)=>e.selected=t===this.selectedIndex)}inputHandler(e){this.async?this.debouncedInputHandler():super.inputHandler(e)}asyncSetFilter(){const e=this.control.value,t=this.slottedDatasource.assignedNodes().filter(e=>e instanceof qL);t.length>0?(Px(t[0],this.control.value),u.queueUpdate(()=>{this.control.value=e})):Mx.warn("Options-datasource is not connected. Please add a datasource to use this functionality.")}manuallyDispatchChangeEvent(){this.needManualChangeEventDispatch&&this.firstSelectedOption&&this.autocomplete===Zo&&(this.dispatchEvent(new Event("change",{bubbles:!0})),this.needManualChangeEventDispatch=!1)}}hM=new WeakMap,uM=new WeakMap,Nu([g],pM.prototype,"activeDescendant",null),Nu([g],pM.prototype,"slottedDatasource",void 0),Nu([re({mode:"boolean"})],pM.prototype,"async",void 0),Nu([re],pM.prototype,"debounce",void 0),Nu([re({mode:"boolean",attribute:"case-sensitive"})],pM.prototype,"caseSensitive",void 0),Nu([re({mode:"boolean",attribute:"ignore-input-click"})],pM.prototype,"ignoreInputClick",void 0),Nu([re({attribute:"filter-mode"})],pM.prototype,"filterMode",void 0),Nu([re({mode:"boolean",attribute:"scroll-to-selected-when-opening"})],pM.prototype,"scrollToSelectedWhenOpening",void 0),Nu([g],pM.prototype,"scrollToSelectedWhenOpeningOptions",void 0),Nu([re({mode:"boolean",attribute:"scroll-when-selection-changes"})],pM.prototype,"scrollWhenSelectionChanges",void 0),Nu([g],pM.prototype,"scrollWhenSelectionChangesOptions",void 0);const fM={delegatesFocus:!0,mode:"open"},mM={indicator:'\n <svg\n class="combo-box-indicator"\n part="combo-box-indicator"\n viewBox="0 0 12 7"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n d="M11.85.65c.2.2.2.5 0 .7L6.4 6.84a.55.55 0 01-.78 0L.14 1.35a.5.5 0 11.71-.7L6 5.8 11.15.65c.2-.2.5-.2.7 0z"\n />\n </svg>\n '};pM.compose(Object.assign({baseName:"combobox",template:dM,styles:lM,shadowOptions:fM},mM));const gM=(e,t)=>Ce` :host{--light-size: 12px;--height: calc(var(--design-unit) * 2px + var(--light-size));display: flex;justify-content: center;align-items: center;width: 100%;height: var(--height);margin: calc(var(--design-unit) * 2px) 0;/* https://www.colorxs.com/color/traffic-light-green-2032-20 */ --green: 50 164 49;--trafic-light-green: rgb(var(--green));--trafic-light-green-glow: rgb(var(--green) / 40%) 0 0 4px 4px, rgb(var(--green) / 20%) 0 0 8px 8px;/* https://www.colorxs.com/color/ral-3020-traffic-red */ --red: 187 30 16;--trafic-light-red: rgb(var(--red));--trafic-light-red-glow: rgb(var(--red) / 40%) 0 0 4px 4px, rgb(var(--red) / 20%) 0 0 8px 8px}.light{height: var(--light-size);width: var(--light-size);margin: 1rem;border-radius: 100%}.green{background: var(--trafic-light-green);box-shadow: var(--trafic-light-green-glow)}.red{background: var(--trafic-light-red);box-shadow: var(--trafic-light-red-glow)}.label{font-size: small;color: grey;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}`,vM=W`<div class=${e=>Jt(["light",!0],[e.colour,!0])}></div>${He(e=>e.showLabel,W`<div class="label">${e=>e.label}</div>`)} `;class bM extends qt{constructor(){super(...arguments),this.showLabel=!1,this.label="disconnected",this.colour="red"}connectedCallback(){super.connectedCallback(),this.subscription=this.connect.isConnectedSubject.subscribe(e=>{this.label=this.getLabel(e),this.colour=e?"green":"red"})}disconnectedCallback(){var e;null===(e=this.subscription)||void 0===e||e.unsubscribe()}getLabel(e){if(!e)return"disconnected";return`${this.session.getSessionStorageItem("hostUrl")} ✔`}}Nu([gz],bM.prototype,"connect",void 0),Nu([Cb],bM.prototype,"session",void 0),Nu([re({mode:"boolean",attribute:"show-label"})],bM.prototype,"showLabel",void 0),Nu([g],bM.prototype,"label",void 0),Nu([g],bM.prototype,"colour",void 0),bM.compose({baseName:"connection-indicator",template:vM,styles:gM});const yM=class extends Lo{}.compose(Object.assign({baseName:"data-grid",template:(e,t)=>Co(e),styles:(e,t)=>Ce` ${ph()}`,shadowOptions:void 0},{}));const zM=class extends ko{}.compose(Object.assign({baseName:"data-grid-cell",template:$o,styles:(e,t)=>Ce` ${mh()}`,shadowOptions:void 0},{}));const xM=class extends xo{}.compose(Object.assign({baseName:"data-grid-row",template:So,styles:(e,t)=>Ce` ${fh()}`,shadowOptions:void 0},{})),CM=Ce` :host{position: relative}.date-toggle::part(control){cursor: pointer}.date-toggle::part(label){cursor: pointer}.calendar-dropdown{display: none;width: 300px;z-index: 999;position: absolute;top: 100%;left: 50%;transform: translate(-50%, 8px);margin: 10px 0 0;padding: 20px;background: var(--neutral-fill-rest);border-radius: calc(var(--control-corner-radius) * 1px);box-shadow: 0 0 8px rgb(0 0 0 / 20%)}.calendar-dropdown.hide-weekends{width: 215px}.calendar-dropdown.top{top: auto;bottom: 100%;margin: 0 0 5px;transform: translate(-50%, -8px)}.calendar-dropdown.left{top: 50%;left: 0;margin: 0 0 0 5px;transform: translate(calc(-8px + -100%), -50%)}.calendar-dropdown.right{top: 50%;left: 100%;transform: translate(8px, -50%)}.calendar-dropdown.visible{display: block}.calendar-dropdown.inline{display: block;position: static;z-index: auto;margin-top: 5px;transform: none}.header{display: flex;justify-content: space-between;align-items: center;margin: 0 0 10px}.header h3{margin: 0;text-transform: capitalize;font-weight: bold;color: var(--neutral-foreground-rest)}.header .icon-button{height: auto;padding: 0;min-width: auto}.header .months-arrows{display: flex;gap: calc(var(--design-unit) * 2px)}.week-days{display: grid;grid-template-columns: repeat(7, 1fr);grid-gap: 5px;margin-bottom: 10px;color: var(--neutral-foreground-rest)}.week-days span{display: flex;justify-content: center;align-items: center;font-size: 14px;font-weight: bold;text-transform: capitalize}.week-days span.disabled{opacity: 60%}.month-days{display: grid;grid-template-columns: repeat(7, 1fr);grid-gap: 5px}.week-days.hide-weekends, .month-days.hide-weekends{grid-template-columns: repeat(5, 1fr)}.month-day{padding: 8px 5px;color: #808080;background: none;display: flex;justify-content: center;align-items: center;border-radius: calc(var(--control-corner-radius) * 4px);cursor: pointer;border: none}.month-day.current{opacity: 100%;color: var(--neutral-foreground-hint)}.month-day.selected{background: var(--accent-foreground-rest);color: var(--neutral-foreground-rest)}.month-day:hover:not(:disabled){background: var(--neutral-stroke-hover);color: var(--neutral-foreground-rest)}.month-day[disabled]{opacity: 50%;cursor: not-allowed}.date-toggle[readonly] .label{cursor: pointer}`,LM=[1,7],MM=e=>W`<${e}-text-field data-test-id="date-picker" readonly :value="${e=>e.inputValue}" placeholder="${e=>e.inputPlaceholder}" part="date-toggle" class="date-toggle" @click="${e=>e.toggleCalendar()}">${e=>e.label}<div class="input-icon-container" part="input-icon-container" slot="end"><${e}-icon variant="regular" name="calendar-alt" size="sm"></${e}-icon></div></${e}-text-field><div class="calendar-dropdown ${e=>e.calendarDropdownClasses} ${e=>e.position}"><div class="header"><h3>${e=>e.currentMonth} ${e=>e.currentYear}</h3><div class="months-arrows"><${e}-button class="icon-button" appearance="accent" @click="${e=>e.prevMonth()}" aria-label="previous month"><${e}-icon name="angle-left"></${e}-icon></${e}-button><${e}-button class="icon-button" appearance="accent" @click="${e=>e.nextMonth()}" aria-label="next month"><${e}-icon name="angle-right"></${e}-icon></${e}-button></div></div><div class="week-days ${e=>Jt(["hide-weekends",e.hideWeekends])}">${qe(e=>{var t;return null===(t=e.calendar)||void 0===t?void 0:t.weekDays},W` ${He((e,t)=>!t.parent.hideWeekends||-1===LM.indexOf(t.index+1),W`<span class="${(e,t)=>Jt(["disabled",-1!==t.parent.disabledDaysOfWeek.indexOf(t.index+1)])}">${(e,t)=>e.substring(0,t.parent.substringNumber)}</span>`)} `,{positioning:!0})}</div><div class="month-days ${e=>Jt(["hide-weekends",e.hideWeekends])}">${qe(e=>e.monthList,W` ${He((e,t)=>!t.parent.hideWeekends||-1===LM.indexOf(e.dayNumber),W`<button ?disabled="${(e,t)=>-1!==t.parent.disabledDaysOfWeek.indexOf(e.dayNumber)}" class="month-day ${(e,t)=>t.parent.isSelectedDate(e)?"selected":""} ${(e,t)=>e.monthNumber===t.parent.calendar.month.number?"current":""}" @click=${(e,t)=>t.parent.selectDay(e)}>${e=>e.date}</button>`)} `)}</div><slot name="bottom"></slot></div>`,wM=W` ${e=>MM($x(e))} `;var kM,SM={exports:{}};function $M(){return kM||(kM=1,function(e){e.exports=function(){var e=1e3,t=6e4,i=36e5,o="millisecond",c="second",s="minute",n="hour",a="day",r="week",l="month",d="quarter",h="year",u="date",p="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],i=e%100;return"["+e+(t[(i-20)%10]||t[i]||t[0])+"]"}},v=function(e,t,i){var o=String(e);return!o||o.length>=t?e:""+Array(t+1-o.length).join(i)+e},b={s:v,z:function(e){var t=-e.utcOffset(),i=Math.abs(t),o=Math.floor(i/60),c=i%60;return(t<=0?"+":"-")+v(o,2,"0")+":"+v(c,2,"0")},m:function e(t,i){if(t.date()<i.date())return-e(i,t);var o=12*(i.year()-t.year())+(i.month()-t.month()),c=t.clone().add(o,l),s=i-c<0,n=t.clone().add(o+(s?-1:1),l);return+(-(o+(i-c)/(s?c-n:n-c))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:h,w:r,d:a,D:u,h:n,m:s,s:c,ms:o,Q:d}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},y="en",z={};z[y]=g;var x="$isDayjsObject",C=function(e){return e instanceof k||!(!e||!e[x])},L=function e(t,i,o){var c;if(!t)return y;if("string"==typeof t){var s=t.toLowerCase();z[s]&&(c=s),i&&(z[s]=i,c=s);var n=t.split("-");if(!c&&n.length>1)return e(n[0])}else{var a=t.name;z[a]=t,c=a}return!o&&c&&(y=c),c||!o&&y},M=function(e,t){if(C(e))return e.clone();var i="object"==typeof t?t:{};return i.date=e,i.args=arguments,new k(i)},w=b;w.l=L,w.i=C,w.w=function(e,t){return M(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var k=function(){function g(e){this.$L=L(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var v=g.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,i=e.utc;if(null===t)return new Date(NaN);if(w.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var o=t.match(f);if(o){var c=o[2]-1||0,s=(o[7]||"0").substring(0,3);return i?new Date(Date.UTC(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,s)):new Date(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,s)}}return new Date(t)}(e),this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return w},v.isValid=function(){return!(this.$d.toString()===p)},v.isSame=function(e,t){var i=M(e);return this.startOf(t)<=i&&i<=this.endOf(t)},v.isAfter=function(e,t){return M(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<M(e)},v.$g=function(e,t,i){return w.u(e)?this[t]:this.set(i,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var i=this,o=!!w.u(t)||t,d=w.p(e),p=function(e,t){var c=w.w(i.$u?Date.UTC(i.$y,t,e):new Date(i.$y,t,e),i);return o?c:c.endOf(a)},f=function(e,t){return w.w(i.toDate()[e].apply(i.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(t)),i)},m=this.$W,g=this.$M,v=this.$D,b="set"+(this.$u?"UTC":"");switch(d){case h:return o?p(1,0):p(31,11);case l:return o?p(1,g):p(0,g+1);case r:var y=this.$locale().weekStart||0,z=(m<y?m+7:m)-y;return p(o?v-z:v+(6-z),g);case a:case u:return f(b+"Hours",0);case n:return f(b+"Minutes",1);case s:return f(b+"Seconds",2);case c:return f(b+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var i,r=w.p(e),d="set"+(this.$u?"UTC":""),p=(i={},i[a]=d+"Date",i[u]=d+"Date",i[l]=d+"Month",i[h]=d+"FullYear",i[n]=d+"Hours",i[s]=d+"Minutes",i[c]=d+"Seconds",i[o]=d+"Milliseconds",i)[r],f=r===a?this.$D+(t-this.$W):t;if(r===l||r===h){var m=this.clone().set(u,1);m.$d[p](f),m.init(),this.$d=m.set(u,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[w.p(e)]()},v.add=function(o,d){var u,p=this;o=Number(o);var f=w.p(d),m=function(e){var t=M(p);return w.w(t.date(t.date()+Math.round(e*o)),p)};if(f===l)return this.set(l,this.$M+o);if(f===h)return this.set(h,this.$y+o);if(f===a)return m(1);if(f===r)return m(7);var g=(u={},u[s]=t,u[n]=i,u[c]=e,u)[f]||1,v=this.$d.getTime()+o*g;return w.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,i=this.$locale();if(!this.isValid())return i.invalidDate||p;var o=e||"YYYY-MM-DDTHH:mm:ssZ",c=w.z(this),s=this.$H,n=this.$m,a=this.$M,r=i.weekdays,l=i.months,d=i.meridiem,h=function(e,i,c,s){return e&&(e[i]||e(t,o))||c[i].slice(0,s)},u=function(e){return w.s(s%12||12,e,"0")},f=d||function(e,t,i){var o=e<12?"AM":"PM";return i?o.toLowerCase():o};return o.replace(m,function(e,o){return o||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return w.s(t.$y,4,"0");case"M":return a+1;case"MM":return w.s(a+1,2,"0");case"MMM":return h(i.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return t.$D;case"DD":return w.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return h(i.weekdaysMin,t.$W,r,2);case"ddd":return h(i.weekdaysShort,t.$W,r,3);case"dddd":return r[t.$W];case"H":return String(s);case"HH":return w.s(s,2,"0");case"h":return u(1);case"hh":return u(2);case"a":return f(s,n,!0);case"A":return f(s,n,!1);case"m":return String(n);case"mm":return w.s(n,2,"0");case"s":return String(t.$s);case"ss":return w.s(t.$s,2,"0");case"SSS":return w.s(t.$ms,3,"0");case"Z":return c}return null}(e)||c.replace(":","")})},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(o,u,p){var f,m=this,g=w.p(u),v=M(o),b=(v.utcOffset()-this.utcOffset())*t,y=this-v,z=function(){return w.m(m,v)};switch(g){case h:f=z()/12;break;case l:f=z();break;case d:f=z()/3;break;case r:f=(y-b)/6048e5;break;case a:f=(y-b)/864e5;break;case n:f=y/i;break;case s:f=y/t;break;case c:f=y/e;break;default:f=y}return p?f:w.a(f)},v.daysInMonth=function(){return this.endOf(l).$D},v.$locale=function(){return z[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var i=this.clone(),o=L(e,t,!0);return o&&(i.$L=o),i},v.clone=function(){return w.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},g}(),S=k.prototype;return M.prototype=S,[["$ms",o],["$s",c],["$m",s],["$H",n],["$W",a],["$M",l],["$y",h],["$D",u]].forEach(function(e){S[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),M.extend=function(e,t){return e.$i||(e(t,k,M),e.$i=!0),M},M.locale=L,M.isDayjs=C,M.unix=function(e){return M(1e3*e)},M.en=z[y],M.Ls=z,M.p={},M}()}(SM)),SM.exports}var EM,NM=of($M()),AM={exports:{}};var OM,TM=(EM||(EM=1,function(e){e.exports=function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,o=/\d\d/,c=/\d\d?/,s=/\d*[^-_:/,()\s\d]+/,n={},a=function(e){return(e=+e)+(e>68?1900:2e3)},r=function(e){return function(t){this[e]=+t}},l=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),i=60*t[1]+(+t[2]||0);return 0===i?0:"+"===t[0]?-i:i}(e)}],d=function(e){var t=n[e];return t&&(t.indexOf?t:t.s.concat(t.f))},h=function(e,t){var i,o=n.meridiem;if(o){for(var c=1;c<=24;c+=1)if(e.indexOf(o(c,0,t))>-1){i=c>12;break}}else i=e===(t?"pm":"PM");return i},u={A:[s,function(e){this.afternoon=h(e,!1)}],a:[s,function(e){this.afternoon=h(e,!0)}],Q:[i,function(e){this.month=3*(e-1)+1}],S:[i,function(e){this.milliseconds=100*+e}],SS:[o,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[c,r("seconds")],ss:[c,r("seconds")],m:[c,r("minutes")],mm:[c,r("minutes")],H:[c,r("hours")],h:[c,r("hours")],HH:[c,r("hours")],hh:[c,r("hours")],D:[c,r("day")],DD:[o,r("day")],Do:[s,function(e){var t=n.ordinal,i=e.match(/\d+/);if(this.day=i[0],t)for(var o=1;o<=31;o+=1)t(o).replace(/\[|\]/g,"")===e&&(this.day=o)}],w:[c,r("week")],ww:[o,r("week")],M:[c,r("month")],MM:[o,r("month")],MMM:[s,function(e){var t=d("months"),i=(d("monthsShort")||t.map(function(e){return e.slice(0,3)})).indexOf(e)+1;if(i<1)throw new Error;this.month=i%12||i}],MMMM:[s,function(e){var t=d("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,r("year")],YY:[o,function(e){this.year=a(e)}],YYYY:[/\d{4}/,r("year")],Z:l,ZZ:l};function p(i){var o,c;o=i,c=n&&n.formats;for(var s=(i=o.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t,i,o){var s=o&&o.toUpperCase();return i||c[o]||e[o]||c[s].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,i){return t||i.slice(1)})})).match(t),a=s.length,r=0;r<a;r+=1){var l=s[r],d=u[l],h=d&&d[0],p=d&&d[1];s[r]=p?{regex:h,parser:p}:l.replace(/^\[|\]$/g,"")}return function(e){for(var t={},i=0,o=0;i<a;i+=1){var c=s[i];if("string"==typeof c)o+=c.length;else{var n=c.regex,r=c.parser,l=e.slice(o),d=n.exec(l)[0];r.call(t,d),e=e.replace(d,"")}}return function(e){var t=e.afternoon;if(void 0!==t){var i=e.hours;t?i<12&&(e.hours+=12):12===i&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,i){i.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(a=e.parseTwoDigitYear);var o=t.prototype,c=o.parse;o.parse=function(e){var t=e.date,o=e.utc,s=e.args;this.$u=o;var a=s[1];if("string"==typeof a){var r=!0===s[2],l=!0===s[3],d=r||l,h=s[2];l&&(h=s[2]),n=this.$locale(),!r&&h&&(n=i.Ls[h]),this.$d=function(e,t,i,o){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var c=p(t)(e),s=c.year,n=c.month,a=c.day,r=c.hours,l=c.minutes,d=c.seconds,h=c.milliseconds,u=c.zone,f=c.week,m=new Date,g=a||(s||n?1:m.getDate()),v=s||m.getFullYear(),b=0;s&&!n||(b=n>0?n-1:m.getMonth());var y,z=r||0,x=l||0,C=d||0,L=h||0;return u?new Date(Date.UTC(v,b,g,z,x,C,L+60*u.offset*1e3)):i?new Date(Date.UTC(v,b,g,z,x,C,L)):(y=new Date(v,b,g,z,x,C,L),f&&(y=o(y).week(f).toDate()),y)}catch(e){return new Date("")}}(t,a,o,i),this.init(),h&&!0!==h&&(this.$L=this.locale(h).$L),d&&t!=this.format(a)&&(this.$d=new Date("")),n={}}else if(a instanceof Array)for(var u=a.length,f=1;f<=u;f+=1){s[1]=a[f-1];var m=i.apply(this,s);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}f===u&&(this.$d=new Date(""))}else c.call(this,e)}}}()}(AM)),AM.exports),RM=of(TM),IM={exports:{}};var DM,FM=(OM||(OM=1,function(e){e.exports=function(e,t,i){var o=t.prototype,c=function(e){return e&&(e.indexOf?e:e.s)},s=function(e,t,i,o,s){var n=e.name?e:e.$locale(),a=c(n[t]),r=c(n[i]),l=a||r.map(function(e){return e.slice(0,o)});if(!s)return l;var d=n.weekStart;return l.map(function(e,t){return l[(t+(d||0))%7]})},n=function(){return i.Ls[i.locale()]},a=function(e,t){return e.formats[t]||function(e){return e.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,i){return t||i.slice(1)})}(e.formats[t.toUpperCase()])},r=function(){var e=this;return{months:function(t){return t?t.format("MMMM"):s(e,"months")},monthsShort:function(t){return t?t.format("MMM"):s(e,"monthsShort","months",3)},firstDayOfWeek:function(){return e.$locale().weekStart||0},weekdays:function(t){return t?t.format("dddd"):s(e,"weekdays")},weekdaysMin:function(t){return t?t.format("dd"):s(e,"weekdaysMin","weekdays",2)},weekdaysShort:function(t){return t?t.format("ddd"):s(e,"weekdaysShort","weekdays",3)},longDateFormat:function(t){return a(e.$locale(),t)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return r.bind(this)()},i.localeData=function(){var e=n();return{firstDayOfWeek:function(){return e.weekStart||0},weekdays:function(){return i.weekdays()},weekdaysShort:function(){return i.weekdaysShort()},weekdaysMin:function(){return i.weekdaysMin()},months:function(){return i.months()},monthsShort:function(){return i.monthsShort()},longDateFormat:function(t){return a(e,t)},meridiem:e.meridiem,ordinal:e.ordinal}},i.months=function(){return s(n(),"months")},i.monthsShort=function(){return s(n(),"monthsShort","months",3)},i.weekdays=function(e){return s(n(),"weekdays",null,null,e)},i.weekdaysShort=function(e){return s(n(),"weekdaysShort","weekdays",3,e)},i.weekdaysMin=function(e){return s(n(),"weekdaysMin","weekdays",2,e)}}}(IM)),IM.exports),_M=of(FM),HM={exports:{}};var PM,VM=(DM||(DM=1,function(e){var t;e.exports=(t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},function(e,i,o){var c=i.prototype,s=c.format;o.en.formats=t,c.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var i=this.$locale().formats,o=function(e,i){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(e,o,c){var s=c&&c.toUpperCase();return o||i[c]||t[c]||i[s].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,i){return t||i.slice(1)})})}(e,void 0===i?{}:i);return s.call(this,o)}})}(HM)),HM.exports),BM=of(VM),UM={exports:{}};var jM=(PM||(PM=1,function(e){e.exports=function(e,t){t.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}}(UM)),UM.exports),qM=of(jM);class GM{constructor(e,t="default"){e=null!=e?e:new Date,this.Date=e,this.date=e.getDate(),this.day=e.toLocaleString(t,{weekday:"long"}),this.dayNumber=e.getDay()+1,this.dayShort=e.toLocaleString(t,{weekday:"short"}),this.year=e.getFullYear(),this.yearShort=Number(e.toLocaleString(t,{year:"2-digit"})),this.month=e.toLocaleString(t,{month:"long"}),this.monthShort=e.toLocaleString(t,{month:"short"}),this.monthNumber=e.getMonth()+1,this.timestamp=e.getTime()}}NM.extend(qM);class WM{constructor(e=null,t="default"){const i=new GM(e,t);this.lang=t,this.name=i.month,this.number=i.monthNumber,this.year=i.year,this.numberOfDays=[31,28,31,30,31,30,31,31,30,31,30,31][this.number-1],2===this.number&&(this.numberOfDays+=NM(i.date).isLeapYear()?1:0)}getDay(e){return new GM(new Date(this.year,this.number-1,e),this.lang)}}NM.extend(qM);class YM{constructor(e=null,t=null,i="default"){this.weekDays=Array.from({length:7}),this.today=new GM(null,i),this.year=null!=e?e:this.today.year,this.month=new WM(new Date(this.year,(t||this.today.monthNumber)-1),i),this.lang=i,this.weekDays.forEach((e,t)=>{const i=this.month.getDay(t);this.weekDays[i.dayNumber-1]=i.day})}getMonth(e){return new WM(new Date(this.year,e-1),this.lang)}getPreviousMonth(){return 1===this.month.number?new WM(new Date(this.year-1,11),this.lang):new WM(new Date(this.year,this.month.number-2),this.lang)}getNextMonth(){return 1===this.month.number?new WM(new Date(this.year+1,0),this.lang):new WM(new Date(this.year,this.month.number+2),this.lang)}goToDate(e,t){this.month=new WM(new Date(t,e-1),this.lang),this.year=t}goToNextYear(){this.year+=1,this.month=new WM(new Date(this.year,0),this.lang)}goToPreviousYear(){this.year-=1,this.month=new WM(new Date(this.year,11),this.lang)}goToNextMonth(){if(12===this.month.number)return this.goToNextYear();this.month=new WM(new Date(this.year,this.month.number+1-1),this.lang)}goToPreviousMonth(){if(1===this.month.number)return this.goToPreviousYear();this.month=new WM(new Date(this.year,this.month.number-1-1),this.lang)}}var KM,ZM={exports:{}};function QM(e){return null!=e&&""!==String(e).trim()}KM||(KM=1,function(e){e.exports=function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=t(e),o={name:"en-gb",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekStart:1,yearStart:4,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},ordinal:function(e){var t=["th","st","nd","rd"],i=e%100;return"["+e+(t[(i-20)%10]||t[i]||t[0])+"]"}};return i.default.locale(o,null,!0),o}($M())}(ZM)),NM.extend(RM),NM.extend(_M),NM.extend(BM);const XM="MM-DD-YYYY";const JM=[1,2,3,4,5,6,7],ew=(e,t,i)=>{if(o=t,-1===e.indexOf(o.dayNumber))return t;var o;const c=JM.filter(t=>-1===e.indexOf(t));let s=c.find(e=>e>t.dayNumber);s||(s=Math.min(...c));const n=t.dayNumber<s?s-t.dayNumber:s-t.dayNumber+7;return c.length?new GM(((e,t=1)=>{const i=new Date(e);return i.setDate(e.getDate()+t),i})(t.Date,n),i):(gp.warn("Date picker disabled days - all days of week have been disabled"),t)};class tw extends qt{constructor(){super(...arguments),this.format=XM,this.lang="en-US",this.visible=!1,this.position="bottom",this.disabledDaysOfWeek=[],this.suppressValueChanged=!1,this.cachedFormat=XM,this.clickOutside=e=>this.handleClickOutside(e),this.keydownOutside=e=>this.handleKeydownOutside(e)}formatChanged(e,t){!this.useLocaleFormat&&t&&this.cacheUserFormat(t),t&&this.calendar&&QM(this.value)&&(this.formatDate=NM(this.currentDate.Date).format(t))}langChanged(){this.applyEffectiveLangChange()}useLocaleFormatChanged(e,t){this.calendar&&(t&&!e?this.cacheUserFormat(this.format):!t&&e&&this.restoreUserFormat(),this.applyEffectiveLangChange())}inlineCalendarChanged(){this.inlineCalendar?(document.removeEventListener("mousedown",this.clickOutside),document.removeEventListener("keydown",this.keydownOutside)):this.visible&&(document.addEventListener("mousedown",this.clickOutside),document.addEventListener("keydown",this.keydownOutside)),this.toggleVisibility()}hideWeekendsCalendarChanged(){this.toggleVisibility()}valueChanged(e,t){this.suppressValueChanged||this.calendar&&(QM(t)?this.applyValue(t):this.allowEmpty?this.clearToEmpty(!1):this.resetToDefaultDate())}disconnectedCallback(){document.removeEventListener("mousedown",this.clickOutside),document.removeEventListener("keydown",this.keydownOutside),super.disconnectedCallback()}connectedCallback(){super.connectedCallback(),NM.extend(RM),NM.extend(BM),NM.extend(_M),this.substringNumber=3,this.useLocaleFormat&&(this.cacheUserFormat(this.format),this.applyLocaleFormat());const e=this.value;!this.allowEmpty||QM(e)?QM(e)?this.applyValue(e):this.initializeWithDefaultDate():this.initializeEmpty()}clear(){this.allowEmpty&&this.clearToEmpty(!0)}get inputValue(){return QM(this.value)?this.formatDate:""}get inputPlaceholder(){var e;return!this.allowEmpty||QM(this.value)?"":(null===(e=this.placeholder)||void 0===e?void 0:e.trim())||this.format.replace(/YYYY/g,"yyyy").replace(/YY(?!Y)/g,"yy").replace(/DD/g,"dd").replace(/D(?!D)/g,"d").replace(/MM/g,"mm").replace(/M(?!M)/g,"m")}get effectiveLang(){return this.useLocaleFormat&&!this.hasAttribute("lang")?"undefined"!=typeof navigator&&navigator.language?navigator.language:"en":this.lang}applyLocaleFormat(){this.format=function(e="en"){const t=function(e){const t=((null==e?void 0:e.trim())||"en").toLowerCase().replace(/_/g,"-");return"en-us"===t||"en"===t?"en":"en-gb"===t?"en-gb":t}(e),i=NM().locale(t),o=i.locale();return(c=t)!==(s=o)&&s!==c.split("-")[0]?NM().locale("en").localeData().longDateFormat("L")||"MM/DD/YYYY":i.localeData().longDateFormat("L")||"MM/DD/YYYY";var c,s}(this.effectiveLang)}cacheUserFormat(e){const t=null==e?void 0:e.trim();t&&(this.cachedFormat=t)}restoreUserFormat(){this.format=this.cachedFormat}applyEffectiveLangChange(){var e,t;if(!this.calendar)return;this.useLocaleFormat&&this.applyLocaleFormat();const i=this.calendar.year,o=this.calendar.month.number,c=null!==(t=null===(e=this.currentDate)||void 0===e?void 0:e.Date)&&void 0!==t?t:NM().toDate();this.currentDate=new GM(c,this.effectiveLang),this.calendar=new YM(i,o,this.effectiveLang),QM(this.value)&&(this.formatDate=NM(this.currentDate.Date).format(this.format)),this.updateHeaderText(),this.monthList=this.getMonthDaysGrid()}syncValueAttribute(e){this.suppressValueChanged=!0,this.value=e,this.suppressValueChanged=!1}initializeEmpty(){const e=NM();this.currentDate=new GM(e.toDate(),this.effectiveLang),this.calendar=new YM(this.currentDate.year,this.currentDate.monthNumber,this.effectiveLang),this.formatDate="",this.syncValueAttribute(""),this.currentMonth=this.calendar.month.name,this.currentYear=this.calendar.year,this.monthList=this.getMonthDaysGrid()}initializeWithDefaultDate(){this.resetToDefaultDate(!0)}resetToDefaultDate(e=!1){var t;let i=new GM(NM().toDate(),this.effectiveLang);(null===(t=this.disabledDaysOfWeek)||void 0===t?void 0:t.length)&&(i=ew(this.disabledDaysOfWeek,i,this.effectiveLang)),this.currentDate=i,e||!this.calendar?this.calendar=new YM(this.currentDate.year,this.currentDate.monthNumber,this.effectiveLang):this.calendar.goToDate(this.currentDate.monthNumber,this.currentDate.year),this.formatDate=NM(this.currentDate.Date).format(this.format),this.syncValueAttribute(NM(this.currentDate.Date).format(XM)),this.currentMonth=this.calendar.month.name,this.currentYear=this.calendar.year,this.monthList=this.getMonthDaysGrid()}applyValue(e){const t=function(e,t){const i=String(e).trim(),o=NM(i,t,!0);if(o.isValid())return o;const c=NM(i,XM,!0);return c.isValid()?c:null}(e,this.format);t?(this.currentDate=new GM(t.toDate(),this.effectiveLang),this.calendar?this.calendar.goToDate(this.currentDate.monthNumber,this.currentDate.year):this.calendar=new YM(this.currentDate.year,this.currentDate.monthNumber,this.effectiveLang),this.formatDate=NM(this.currentDate.Date).format(this.format),this.syncValueAttribute(NM(this.currentDate.Date).format(XM)),this.updateHeaderText(),this.monthList=this.getMonthDaysGrid()):this.allowEmpty?this.clearToEmpty(!1):this.resetToDefaultDate()}clearToEmpty(e){const t=NM();this.currentDate=new GM(t.toDate(),this.effectiveLang),this.calendar&&(this.calendar.goToDate(this.currentDate.monthNumber,this.currentDate.year),this.updateHeaderText(),this.monthList=this.getMonthDaysGrid()),this.formatDate="",this.syncValueAttribute(""),e&&this.$emit("value-changed",void 0)}updateHeaderText(){this.currentMonth=this.calendar.month.name,this.currentYear=this.calendar.year}visibleChanged(e,t){this.inlineCalendar||(t?(document.addEventListener("mousedown",this.clickOutside),document.addEventListener("keydown",this.keydownOutside)):(document.removeEventListener("mousedown",this.clickOutside),document.removeEventListener("keydown",this.keydownOutside)))}handleKeydownOutside(e){!this.inlineCalendar&&this.visible&&"Escape"===e.key&&(e.preventDefault(),this.closeCalendar())}handleClickOutside(e){!this.inlineCalendar&&this.visible&&kx(e,this)&&this.closeCalendar()}closeCalendar(){this.visible&&(this.visible=!1,this.toggleVisibility())}toggleCalendar(){this.visible=!this.visible,this.toggleVisibility(),this.isCurrentCalendarMonth()||(this.calendar.goToDate(this.currentDate.monthNumber,this.currentDate.year),this.updateHeaderText())}toggleVisibility(){this.calendarDropdownClasses=Jt(["visible",this.visible],this.position,["inline",this.inlineCalendar],["hide-weekends",this.hideWeekends])}isSelectedDate(e){return!(this.allowEmpty&&!QM(this.value))&&NM(e.Date).isSame(this.currentDate.Date,"day")}isCurrentCalendarMonth(){return this.currentMonth===this.currentDate.monthNumber&&this.currentYear===this.currentDate.year}prevMonth(){this.calendar.goToPreviousMonth(),this.updateHeaderText(),this.monthList=this.getMonthDaysGrid()}nextMonth(){this.calendar.goToNextMonth(),this.updateHeaderText(),this.monthList=this.getMonthDaysGrid()}selectDay(e){NM(e.Date).isSame(this.currentDate.Date,"day")&&QM(this.value)||(this.currentDate=e,e.monthNumber!==this.calendar.month.number&&this.prevMonth(),this.formatDate=NM(this.currentDate.Date).format(this.format),this.syncValueAttribute(NM(e.Date).format(XM)),this.$emit("value-changed",this.value),this.toggleCalendar())}getMonthDaysGrid(){const e=this.calendar.month.getDay(1),t=this.calendar.getPreviousMonth(),i=e.dayNumber-1,o=this.calendar.month.numberOfDays+i,c=Array.from({length:o});for(let e=i;e<o;e+=1)c[e]=this.calendar.month.getDay(e+1-i);for(let e=0;e<i;e+=1){const o=i-(e+1);c[e]=t.getDay(t.numberOfDays-o)}return c}}Nu([re],tw.prototype,"format",void 0),Nu([re],tw.prototype,"lang",void 0),Nu([re({attribute:"use-locale-format",mode:"boolean"})],tw.prototype,"useLocaleFormat",void 0),Nu([re],tw.prototype,"visible",void 0),Nu([re({attribute:"inline-calendar",mode:"boolean"})],tw.prototype,"inlineCalendar",void 0),Nu([re({attribute:"hide-weekends",mode:"boolean"})],tw.prototype,"hideWeekends",void 0),Nu([re],tw.prototype,"position",void 0),Nu([re],tw.prototype,"label",void 0),Nu([re({attribute:"allow-empty",mode:"boolean"})],tw.prototype,"allowEmpty",void 0),Nu([re],tw.prototype,"placeholder",void 0),Nu([re],tw.prototype,"value",void 0),Nu([g],tw.prototype,"currentDate",void 0),Nu([g],tw.prototype,"currentMonth",void 0),Nu([g],tw.prototype,"currentYear",void 0),Nu([g],tw.prototype,"calendarDropdownClasses",void 0),Nu([g],tw.prototype,"formatDate",void 0),Nu([g],tw.prototype,"monthList",void 0),Nu([g],tw.prototype,"disabledDaysOfWeek",void 0),Nu([g],tw.prototype,"calendar",void 0),tw.compose(Object.assign({baseName:"date-picker",styles:CM,template:wM,shadowOptions:void 0},{}));class iw{constructor(){this.value=null}}Nu([g],iw.prototype,"value",void 0),new iw;const ow=(e,t,i)=>{const o=i?(e,t)=>e.setValueFor(i,t):(e,t)=>e.withDefault(t);Object.keys(e).forEach(i=>{const c=`${i}Value`;t[c]&&o(e[i],t[c])})};function cw(e){return(t,i)=>{t[i+"Changed"]=function(t,i){null!=i?e.setValueFor(this,i):e.deleteValueFor(this)}}}const sw={toView:e=>null==e?null:null==e?void 0:e.toColorString(),fromView(e){if(null==e)return null;const t=Fa(e);return t?Va.create(t.r,t.g,t.b):null}},nw=e=>Wa.from(Va.from(Fa(e)));Va.create(1,1,1),Va.create(0,0,0);const aw=Fa("#585858"),rw=Va.create(aw.r,aw.g,aw.b),lw=Fa("#ffffff"),dw=Va.create(lw.r,lw.g,lw.b),hw=Wa.from(dw),uw=Fa("#eeeeee"),pw=Va.create(uw.r,uw.g,uw.b);Wa.from(pw);const fw=Fa("#08c3a5"),mw=Va.create(fw.r,fw.g,fw.b);Wa.from(mw);const{create:gw}=vc,vw=gw("fui-fill-color").withDefault(rw),bw=gw({name:"card-fill-color",cssCustomPropertyName:"fui-card-fill-color"}).withDefault(dw);function yw(e,t){return e.colorContrast(t,14)}const zw=gw({name:"card-foreground-color",cssCustomPropertyName:"fui-card-foreground-color"}).withDefault(e=>yw(gw("fui-card-palette").withDefault(hw).getValueFor(e),bw.getValueFor(e)));var xw=Object.freeze({__proto__:null,fuiFillColor:vw,fuiCardFillColor:bw,defaultNeutralForegroundContrast:14,neutralForeground:yw,fuiCardForegroundColor:zw,accentFillActive:Al,accentFillActiveDelta:Dr,accentFillFocus:Ol,accentFillFocusDelta:Fr,accentFillHover:Nl,accentFillHoverDelta:Ir,accentFillRest:El,accentFillRestDelta:Rr,accentForegroundActive:Yl,accentForegroundActiveDelta:Pr,accentForegroundFocus:Kl,accentForegroundFocusDelta:Vr,accentForegroundHover:Wl,accentForegroundHoverDelta:Hr,accentForegroundRest:Gl,accentForegroundRestDelta:_r,accentPalette:pl,baseHeightMultiplier:nr,baseLayerLuminance:rr,bodyFont:sr,controlCornerRadius:lr,density:dr,designUnit:hr,direction:ur,disabledOpacity:pr,fillColor:kl,focusStrokeInner:xd,focusStrokeOuter:yd,focusStrokeWidth:mr,foregroundOnAccentActive:Fl,foregroundOnAccentActiveLarge:Bl,foregroundOnAccentFocus:_l,foregroundOnAccentFocusLarge:Ul,foregroundOnAccentHover:Dl,foregroundOnAccentHoverLarge:Vl,foregroundOnAccentRest:Il,foregroundOnAccentRestLarge:Pl,neutralFillActive:Jl,neutralFillActiveDelta:jr,neutralFillFocus:ed,neutralFillFocusDelta:qr,neutralFillHover:Xl,neutralFillHoverDelta:Ur,neutralFillInputActive:cd,neutralFillInputActiveDelta:Yr,neutralFillInputFocus:sd,neutralFillInputFocusDelta:Kr,neutralFillInputHover:od,neutralFillInputHoverDelta:Wr,neutralFillInputRest:id,neutralFillInputRestDelta:Gr,neutralFillLayerRest:vd,neutralFillLayerRestDelta:cl,neutralFillRest:Ql,neutralFillRestDelta:Br,neutralFillStealthActive:ld,neutralFillStealthActiveDelta:Xr,neutralFillStealthFocus:dd,neutralFillStealthFocusDelta:Jr,neutralFillStealthHover:rd,neutralFillStealthHoverDelta:Qr,neutralFillStealthRest:ad,neutralFillStealthRestDelta:Zr,neutralFillStrongActive:fd,neutralFillStrongActiveDelta:il,neutralFillStrongFocus:md,neutralFillStrongFocusDelta:ol,neutralFillStrongHover:pd,neutralFillStrongHoverDelta:tl,neutralFillStrongRest:ud,neutralFillStrongRestDelta:el,neutralForegroundHint:Ld,neutralForegroundRest:wd,neutralLayer1:yl,neutralLayer2:xl,neutralLayer3:Ll,neutralLayer4:wl,neutralLayerCardContainer:ml,neutralLayerFloating:vl,neutralPalette:hl,neutralStrokeActive:Ed,neutralStrokeActiveDelta:al,neutralStrokeDividerRest:Od,neutralStrokeDividerRestDelta:ll,neutralStrokeFocus:Nd,neutralStrokeFocusDelta:rl,neutralStrokeHover:$d,neutralStrokeHoverDelta:nl,neutralStrokeRest:Sd,neutralStrokeRestDelta:sl,strokeWidth:fr,typeRampBaseFontSize:gr,typeRampBaseLineHeight:vr,typeRampMinus1FontSize:br,typeRampMinus1LineHeight:yr,typeRampMinus2FontSize:zr,typeRampMinus2LineHeight:xr,typeRampPlus1FontSize:Cr,typeRampPlus1LineHeight:Lr,typeRampPlus2FontSize:Mr,typeRampPlus2LineHeight:wr,typeRampPlus3FontSize:kr,typeRampPlus3LineHeight:Sr,typeRampPlus4FontSize:$r,typeRampPlus4LineHeight:Er,typeRampPlus5FontSize:Nr,typeRampPlus5LineHeight:Ar,typeRampPlus6FontSize:Or,typeRampPlus6LineHeight:Tr});const Cw=nw("#08c3a5"),Lw=nw("#eeeeee"),Mw=tr,ww=zi.ltr;var kw=Object.freeze({__proto__:null,accentPaletteValue:Cw,neutralPaletteValue:Lw,baseLayerLuminanceValue:Mw,directionValue:ww,controlCornerRadiusValue:4,designUnitValue:4});
61
+ Install model </${e}-button>`)}</div>`)}</div>`)} `)($x(e))} `;class UC extends qt{constructor(){super(...arguments),this.status=null,this.open=!1,this.state="none",this.isInstalling=!1,this.pollTimer=null,this.clickOutside=e=>this.handleClickOutside(e)}get aiProvider(){var e;return null===(e=this.providerRegistry)||void 0===e?void 0:e.default()}get chromeStatusLabel(){var e,t;if("chrome"!==(null===(e=this.status)||void 0===e?void 0:e.provider))return null;const i=null===(t=this.status)||void 0===t?void 0:t.chromeAvailability;return"available"===i?"Installed":"downloading"===i||this.isInstalling?"Downloading…":"downloadable"===i?"Downloadable":"unavailable"===i?"Unavailable":null}get canInstall(){var e,t,i;return!!(null===(e=this.aiProvider)||void 0===e?void 0:e.triggerDownload)&&"chrome"===(null===(t=this.status)||void 0===t?void 0:t.provider)&&"downloadable"===(null===(i=this.status)||void 0===i?void 0:i.chromeAvailability)&&!this.isInstalling}get isDownloading(){var e;return"downloading"===(null===(e=this.status)||void 0===e?void 0:e.chromeAvailability)||this.isInstalling}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return Ou(this,void 0,void 0,function*(){e.connectedCallback.call(this),yield this.refreshStatus(),this.maybeStartPolling()})}disconnectedCallback(){this.stopPolling(),document.removeEventListener("mousedown",this.clickOutside)}openChanged(){this.open?(document.addEventListener("mousedown",this.clickOutside),this.refreshStatus()):document.removeEventListener("mousedown",this.clickOutside)}handleClickOutside(e){kx(e,this)&&(this.open=!1)}toggleDropdown(){this.open=!this.open}refreshStatus(){return Ou(this,void 0,void 0,function*(){var e;if(!(null===(e=this.aiProvider)||void 0===e?void 0:e.getStatus))return this.status=null,void(this.state="none");try{const e=yield this.aiProvider.getStatus();this.status=e,this.state=this.deriveState(e),"available"===this.state&&(this.isInstalling=!1)}catch(e){this.status=null,this.state="none",this.isInstalling=!1}})}deriveState(e){if(!e||"none"===e.provider)return"none";if("chrome"===e.provider){const t=e.chromeAvailability;return"available"===t?"available":"downloading"===t?"downloading":"downloadable"===t?"downloadable":"unavailable"}return"server"}maybeStartPolling(){var e;"downloading"===(null===(e=this.status)||void 0===e?void 0:e.chromeAvailability)||this.isInstalling?this.startPolling():this.stopPolling()}startPolling(){this.pollTimer||(this.pollTimer=setInterval(()=>{this.refreshStatus().then(()=>{this.maybeStartPolling()})},2500))}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}onInstall(){return Ou(this,void 0,void 0,function*(){var e;if(this.canInstall&&(null===(e=this.aiProvider)||void 0===e?void 0:e.triggerDownload)){this.isInstalling=!0;try{yield this.aiProvider.triggerDownload(),this.startPolling()}catch(e){this.isInstalling=!1}finally{yield this.refreshStatus()}}})}}Nu([Qx],UC.prototype,"providerRegistry",void 0),Nu([g],UC.prototype,"status",void 0),Nu([g],UC.prototype,"open",void 0),Nu([g],UC.prototype,"state",void 0),Nu([g],UC.prototype,"isInstalling",void 0),Nu([v],UC.prototype,"chromeStatusLabel",null),Nu([v],UC.prototype,"canInstall",null),Nu([v],UC.prototype,"isDownloading",null),UC.compose({baseName:"ai-indicator",template:BC,styles:VC});const jC=(e,t)=>Ni(0,t),qC=(e,t)=>Ce` ${Yd()}`;class GC extends Kd{}const WC={delegatesFocus:!0,mode:"open"},YC={};GC.compose(Object.assign({baseName:"anchor",template:jC,styles:qC,shadowOptions:WC},YC));const KC=(e,t)=>Ri(),ZC=(e,t)=>Ce` ${Zd()}`;class QC extends Di{}const XC={delegatesFocus:!0,mode:"open"},JC={};QC.compose(Object.assign({baseName:"anchored-region",template:KC,styles:ZC,shadowOptions:XC},JC));const eL=(e,t)=>ji(0,t),tL=W` ${He(e=>e.imgSrc,W`<img src="${e=>e.imgSrc}" alt="${e=>e.alt}" slot="media" class="media" part="media" />`)} `,iL=(e,t)=>Ce` ${Qd(e)}`;class oL extends Xd{}const cL={delegatesFocus:!0,mode:"open"},sL={media:tL};oL.compose(Object.assign({baseName:"avatar",template:eL,styles:iL,shadowOptions:cL},sL));const nL=(e,t)=>Gi(),aL=(e,t)=>Ce` ${eh()}`;class rL extends Wi{}const lL=void 0,dL={};rL.compose(Object.assign({baseName:"badge",template:nL,styles:aL,shadowOptions:lL},dL));const hL=Ce` @keyframes delete-animate{from{height: 100px;opacity: 100%}to{height: 0;opacity: 0%}}@keyframes append-animate{from{height: 0;opacity: 0%}to{height: var(--banner-height);opacity: 100%}}:host{--banner-width: 100%;--banner-height: 65px;--flow: row}@media screen and (max-width: 640px){:host{--flow: column;--banner-height: 100px}}.banner{animation: append-animate 0.3s linear;width: var(--banner-width);height: var(--banner-height);background-color: var(--fill-color);display: flex;flex-direction: var(--flow);padding: 5px 8px;box-sizing: border-box;overflow: hidden}.banner-delete{animation: delete-animate 0.3s linear;opacity: 0%}.content{display: flex;align-items: center;flex: 2;font-size: 12px;overflow: hidden;white-space: pre-line}.action{display: flex;flex-direction: row-reverse;align-items: center;gap: 10px;flex: 1;overflow: hidden}`,uL=W` ${e=>(e=>W`<div role="alert" aria-live="polite" class="banner ${e=>e.dismissAnimation}" ${Ie("banner")}><div part="content" class="content"><slot name="content">${He(e=>e.notification,W`<div><div>${e=>{var t;return(null===(t=e.notification)||void 0===t?void 0:t.body)||"Place holder for notification message"}}</div></div>`)}</slot></div><div part="action" class="action"><slot name="action" class="action">${He(e=>e.notification,W`<${e}-button slot="action" appearance="lightweight" @click=${e=>e.dismiss()}>${e=>{var t,i,o,c;return(null===(c=null===(o=null===(i=null===(t=e.notification)||void 0===t?void 0:t.config)||void 0===i?void 0:i.banner)||void 0===o?void 0:o.dismissingAction)||void 0===c?void 0:c.label)||"Ignore"}}</${e}-button>`)} ${qe(e=>{var t,i;return null===(i=null===(t=e.notification)||void 0===t?void 0:t.config)||void 0===i?void 0:i.banner.confirmingActions},W`<${e}-button slot="action" appearance="lightweight" @click=${(e,t)=>{var i;null==e||e.action(),null===(i=t.parent)||void 0===i||i.dismissNotification()}}>${e=>e.label}</${e}-button>`)}</slot></div></div>`)($x(e))} `,pL={mode:"open",delegatesFocus:!0};class fL extends qt{constructor(){super(...arguments),this.dismissAnimation=""}connectedCallback(){super.connectedCallback()}dismiss(){return this.dismissAnimation="banner-delete",new Promise(e=>{this.banner.onanimationend=()=>{this.remove(),e()}})}dismissNotification(){return Ou(this,void 0,void 0,function*(){try{yield this.dismiss(),this.remove()}catch(e){Mx.error(e)}})}}Nu([g],fL.prototype,"dismissAnimation",void 0),Nu([g],fL.prototype,"notification",void 0),fL.compose({baseName:"banner",styles:hL,template:uL,shadowOptions:pL});const mL=(e,t)=>Zi(),gL=(e,t)=>Ce` ${ih()}`;class vL extends Qi{}vL.compose(Object.assign({baseName:"breadcrumb",template:mL,styles:gL,shadowOptions:void 0},{}));const bL=(e,t)=>Yi(0,t),yL=(e,t)=>Ce` ${th()}`;class zL extends Ki{}const xL=void 0,CL={separator:"/"};zL.compose(Object.assign({baseName:"breadcrumb-item",template:bL,styles:yL,shadowOptions:xL},CL));const LL=(e,t)=>Xi(0,t),ML=(e,t)=>Ce` ${oh()}`;class wL extends ch{}const kL={delegatesFocus:!0,mode:"open"},SL={};wL.compose(Object.assign({baseName:"button",template:LL,styles:ML,shadowOptions:kL},SL));const $L=()=>Ce` ${sh}`,EL=(e,t)=>Oo(e,t);class NL extends ho{}const AL={delegatesFocus:!0,mode:"open"},OL={};NL.compose(Object.assign({baseName:"calendar",template:EL,styles:$L,shadowOptions:AL},OL));const TL=(e,t)=>To(),RL=(e,t)=>Ce` ${nh()} :host{background-color: var(--fui-card-fill-color);color: var(--fui-card-foreground-color)}`;class IL extends ah{}const DL=void 0,FL={};var _L,HL,PL;IL.compose(Object.assign({baseName:"card",template:TL,styles:RL,shadowOptions:DL},FL)),function(e){e.BELOW="below",e.ABOVE="above"}(_L||(_L={}));var VL=function(){if(PL)return HL;PL=1;var e=/^\s+|\s+$/g,t=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,c=parseInt,s="object"==typeof tf&&tf&&tf.Object===Object&&tf,n="object"==typeof self&&self&&self.Object===Object&&self,a=s||n||Function("return this")(),r=Object.prototype.toString,l=Math.max,d=Math.min,h=function(){return a.Date.now()};function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function p(s){if("number"==typeof s)return s;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==r.call(e)}(s))return NaN;if(u(s)){var n="function"==typeof s.valueOf?s.valueOf():s;s=u(n)?n+"":n}if("string"!=typeof s)return 0===s?s:+s;s=s.replace(e,"");var a=i.test(s);return a||o.test(s)?c(s.slice(2),a?2:8):t.test(s)?NaN:+s}return HL=function(e,t,i){var o,c,s,n,a,r,f=0,m=!1,g=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var i=o,s=c;return o=c=void 0,f=t,n=e.apply(s,i)}function y(e){var i=e-r;return void 0===r||i>=t||i<0||g&&e-f>=s}function z(){var e=h();if(y(e))return x(e);a=setTimeout(z,function(e){var i=t-(e-r);return g?d(i,s-(e-f)):i}(e))}function x(e){return a=void 0,v&&o?b(e):(o=c=void 0,n)}function C(){var e=h(),i=y(e);if(o=arguments,c=this,r=e,i){if(void 0===a)return function(e){return f=e,a=setTimeout(z,t),m?b(e):n}(r);if(g)return a=setTimeout(z,t),b(r)}return void 0===a&&(a=setTimeout(z,t)),n}return t=p(t)||0,u(i)&&(m=!!i.leading,s=(g="maxWait"in i)?l(p(i.maxWait)||0,t):s,v="trailing"in i?!!i.trailing:v),C.cancel=function(){void 0!==a&&clearTimeout(a),f=0,o=r=c=a=void 0},C.flush=function(){return void 0===a?n:x(h())},C},HL}(),BL=of(VL);const UL=Ce` :host{--scrollbar-width: 12px;--scrollbar-thumb-width: 8px}.root{position: relative;width: inherit;min-width: 250px}.control{cursor: pointer;position: relative;display: flex;align-items: center;width: 100%;border-radius: calc(var(--control-corner-radius) * 1px)}#display-field{width: 100%;cursor: pointer;color: var(--neutral-foreground-rest);min-height: 40px;padding: 0 calc(var(--design-unit) * 2.25px);border-width: 0;background-color: var(--neutral-fill-input-rest);border-radius: calc(var(--control-corner-radius) * 1px)}#display-field[disabled]{cursor: not-allowed;opacity: 30%}#display-field:focus{outline: 1px solid var(--accent-fill-rest);background: var(--neutral-fill-input-rest);border-style: none;box-shadow: none}#display-field:hover:not(:focus):not([disabled]){outline: 1px solid var(--neutral-stroke-hover)}button{pointer-events: none}.indicator{position: absolute;left: calc(100% - 26px);padding: 0;cursor: pointer}#arrow-icon{width: 16px;fill: white;transform: rotate(0deg);transition: transform 0.2s linear 0s}#arrow-icon.flipped{transform: rotate(180deg)}.disabled-svg{pointer-events: none;opacity: 30%}.position-above{bottom: 100%}::-webkit-scrollbar{width: var(--scrollbar-width)}::-webkit-scrollbar-track{background: var(--neutral-layer-4)}::-webkit-scrollbar-thumb{width: var(--scrollbar-thumb-width);border-radius: 10px;box-shadow: inset 0 0 6px rgba(0 0 0 / 30%);background-color: var(--neutral-layer-2);border: 3px solid var(--neutral-layer-4)}::-webkit-scrollbar-corner{background: var(--neutral-layer-4)}.multiselect-dropdown{display: flex;flex-direction: column;position: absolute;height: max-content;overflow: hidden;margin-top: calc(var(--design-unit) * 1px);border: calc(var(--stroke-width) * 1px) solid var(--neutral-layer-2);border-radius: 4px;background: var(--neutral-fill-input-rest);width: 100%;max-height: 0;visibility: hidden;z-index: 999}.multiselect-dropdown:not(.is-resizing){transition: max-height 0.4s ease 0s, visibility 0.4s ease 0s}.checkbox-container{display: flex;flex-direction: column;list-style: none;overflow-y: auto;height: 100%}.is-resizing .checkbox-container{overflow-y: hidden}.checkbox-container zero-checkbox{min-width: fit-content}.checkbox-container zero-checkbox[disabled], .checkbox-container foundation-checkbox[disabled]{cursor: not-allowed}.visible{visibility: visible;max-height: var(--custom-max-height, ${230..toString()}px);overflow: hidden}::slotted(foundation-checkbox), foundation-checkbox{border-bottom: 1px solid var(--neutral-layer-4);padding: 5px 0 5px 5px;margin: 0}::slotted(foundation-checkbox:hover), foundation-checkbox:hover{background-color: var(--neutral-layer-3);cursor: pointer}::slotted(foundation-checkbox)::part(label), foundation-checkbox::part(label){overflow-x: hidden;text-overflow: ellipsis;white-space: nowrap}.label{display: block;cursor: pointer;font-size: var(--type-ramp-base-font-size);line-height: var(--type-ramp-base-line-height);font-style: normal;margin: calc(var(--design-unit) * 2px) 0}.label-hidden{display: none}ol, li{margin: 0;padding: 0}.checkbox{width: 100%}.select-all{width: 100%;margin-left: 0;margin-right: 0}.display-value{position: absolute;right: 40px;color: var(--neutral-foreground-rest);font-size: var(--type-ramp-base-font-size);line-height: var(--type-ramp-base-line-height);font-family: var(--body-font)}.options-header-item-hidden{display: none}.resize-button{position: absolute;bottom: 0;right: 0;width: 12px;height: 12px;cursor: nw-resize;background: linear-gradient( -45deg, transparent 30%, var(--neutral-foreground-rest) 30%, var(--neutral-foreground-rest) 40%, transparent 40%, transparent 60%, var(--neutral-foreground-rest) 60%, var(--neutral-foreground-rest) 70%, transparent 70% );z-index: 1000;opacity: 60%;transition: opacity 0.2s ease}.resize-button:hover{opacity: 100%}.multiselect-dropdown.resizable{resize: none;overflow: hidden}`;var jL;let qL=jL=class extends wx{constructor(){super(...arguments),this.emptyDataLabel="No matching records",this.allowCustomOptions=!1,this.infiniteScroll=!1,this.pageSize=jL.defaultPageSize,this.initalSelectedValueInitialized=!1,this.isSnapshot=!0,this.baseCriteria="",this.listboxElement=null,this.loadingMoreRows=!1,this.renderedOptionsCount=0,this.lastTopUpScrollHeight=-1,this.emptyDataOption=null,this.selectOpenChangeHandler=e=>{var t;(null===(t=e.detail)||void 0===t?void 0:t.open)&&(this.listboxElement||this.attachListboxScrollListener(),this.topUpVisibleListbox())},this.listboxScrollHandler=()=>{const e=this.listboxElement;e&&this.isNearListboxBottom(e)&&this.loadNextPage()},this.resizeObserverCallback=e=>{e.forEach(e=>{this.checkOverflow(e.target)})},this.selectChangeHandler=e=>{var t;const i=e.target.value,o=null===(t=this.options)||void 0===t?void 0:t.find(e=>String(e.label)===i);!o&&this.allowCustomOptions&&this.select instanceof uh?this.select.$emit("value-change",{label:i,value:i}):this.select.$emit("value-change",o)}}initialSelectedValueChanged(e,t){t&&t!==e&&(this.select&&this.getDisplayForValue(t)===String(this.select.value||"")||(this.initalSelectedValueInitialized=!1,this.clearData(),this.fetchData()))}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return Ou(this,void 0,void 0,function*(){var t,i;if(e.connectedCallback.call(this),this.baseCriteria=this.criteria,this.fields=this.labelField?null===(t=this.valueField)||void 0===t?void 0:t.concat(" ",this.labelField):this.valueField,this.select=this.parentElement,this.optionElement=null!==(i=this.optionElement)&&void 0!==i?i:`${$x(this.select)}-option`,this.select.addEventListener("change",this.selectChangeHandler),this.resizeObserver=new ResizeObserver(this.resizeObserverCallback),this.infiniteScroll){if(this.isSnapshot=!0,this.maxRows=this.pageSize>0?this.pageSize:jL.defaultPageSize,this.select.addEventListener("open-change",this.selectOpenChangeHandler),yield this.applyInfiniteScrollFetchMode(),!this.isConnected)return;u.queueUpdate(()=>this.attachListboxScrollListener())}this.fetchData(),this.valueField||Mx.warn('Specify field for values in options (e.g value-field="VALUE") and optionally field for label (e.g label-field="NAME")')})}disconnectedCallback(){var e;super.disconnectedCallback(),this.resizeObserver.disconnect(),null===(e=this.listboxElement)||void 0===e||e.removeEventListener("scroll",this.listboxScrollHandler),this.listboxElement=null,this.select.removeEventListener("open-change",this.selectOpenChangeHandler),this.select.removeEventListener("change",this.selectChangeHandler)}applyInfiniteScrollFetchMode(){return Ou(this,void 0,void 0,function*(){if(this.resourceName&&this.connect.isConnected)try{const e=yield this.resources.getResourceTypeFor(this.resourceName);this.isSnapshot=e!==sb.DATASERVER}catch(e){Mx.warn(`Unable to determine the resource type for ${this.resourceName}`,e)}})}attachListboxScrollListener(){var e,t,i,o,c,s,n;this.isConnected&&(null===(e=this.listboxElement)||void 0===e||e.removeEventListener("scroll",this.listboxScrollHandler),this.listboxElement=null!==(c=null!==(i=null===(t=this.select)||void 0===t?void 0:t.scrollableListbox)&&void 0!==i?i:null===(o=this.select)||void 0===o?void 0:o.listbox)&&void 0!==c?c:null===(n=null===(s=this.select)||void 0===s?void 0:s.shadowRoot)||void 0===n?void 0:n.querySelector(".listbox"),this.listboxElement?this.listboxElement.addEventListener("scroll",this.listboxScrollHandler):Mx.warn("Unable to locate listbox element, infinite scroll will not be available."))}isNearListboxBottom(e){return e.scrollTop+e.clientHeight>=e.scrollHeight-jL.scrollLoadThresholdPx}loadNextPage(){return Ou(this,void 0,void 0,function*(){if(this.loadingMoreRows||!this.canRequestMoreRows())return;this.loadingMoreRows=!0;const e=this.datasource.resourceType===sb.REQUEST_SERVER;try{yield this.requestMoreRows()}catch(e){return void(this.loadingMoreRows=!1)}e&&(this.loadingMoreRows=!1)})}topUpVisibleListbox(){this.infiniteScroll&&requestAnimationFrame(()=>{if(!this.isConnected)return;const e=this.listboxElement;e&&0!==e.clientHeight&&this.isNearListboxBottom(e)&&e.scrollHeight!==this.lastTopUpScrollHeight&&(this.lastTopUpScrollHeight=e.scrollHeight,this.loadNextPage())})}fetchData(){this.select&&this.valueField&&(this.resourceName&&this.connect.isConnected||this.data)&&(this.select instanceof uh&&this.select.async&&this.initialSelectedValue?this.asyncModeIntialization():this.fetchGenesisData())}asyncModeIntialization(){return Ou(this,void 0,void 0,function*(){(yield this.datasource.init(this.datasourceOptions(),!0))?Px(this,this.initialSelectedValue):this.handleError({message:`Genesis Datasource async mode initialization failed for ${this.resourceName}`,loggerType:"error"})})}clearData(){this.rowsSyncedWithStream.clear(),this.options=[],this.renderedOptionsCount=0,this.lastTopUpScrollHeight=-1,this.emptyDataOption=null,this.loadingMoreRows=!1,this.select&&(Array.from(this.select.children).forEach(e=>{e instanceof jL||this.select.removeChild(e)}),this.select.value="",this.select.initialValue="")}checkOverflow(e){const t=e.shadowRoot.querySelector(".content");t&&(t.scrollWidth>t.clientWidth?e.setAttribute("title",e.textContent):e.removeAttribute("title"))}rowToOption(e){var t;return{value:e[this.valueField],label:this.labelRowFormatter?this.labelRowFormatter(e):this.labelFormatter?this.labelFormatter(e[this.labelField]):this.getDefaultLabelFormat(e[this.labelField],null===(t=this.getFieldMetadata(this.labelField))||void 0===t?void 0:t.type)}}renderListboxOptions(e){e.forEach(({value:e,label:t})=>{const i=document.createElement(this.optionElement);i.textContent=t||e,i.value=e,this.select.appendChild(i),this.resizeObserver.observe(i)})}removeEmptyDataOption(){this.emptyDataOption&&(this.emptyDataOption.remove(),this.emptyDataOption=null)}syncComponentData(e){this.loadingMoreRows=!1;const t=null!=e?e:Array.from(this.rowsSyncedWithStream.values());if(t.length>0){this.removeEmptyDataOption(),this.options=t.map(e=>this.rowToOption(e));const e=0===this.renderedOptionsCount;if(this.renderListboxOptions(this.options.slice(this.renderedOptionsCount)),this.renderedOptionsCount=this.options.length,this.nextRequestOffset=Math.max(this.nextRequestOffset,this.renderedOptionsCount),this.topUpVisibleListbox(),!this.initalSelectedValueInitialized||this.select instanceof uh&&!this.select.async&&e){this.resetCombobox();const e=this.getInitialLabel();u.queueUpdate(()=>{this.select.value=String(e),e&&this.select instanceof uh&&this.select.async&&this.selectChangeHandler({target:{value:e}})}),this.initalSelectedValueInitialized=!0}}else if(this.allowCustomOptions&&this.initialSelectedValue&&(!this.initalSelectedValueInitialized||this.select instanceof uh&&!this.select.async)&&(this.resetCombobox(),u.queueUpdate(()=>{this.select.value=String(this.initialSelectedValue)}),this.initalSelectedValueInitialized=!0),this.select&&!this.emptyDataOption){const e=document.createElement(this.optionElement);e.textContent=this.emptyDataLabel,e.value="",e.disabled=!0,this.select.appendChild(e),this.emptyDataOption=e}}getInitialLabel(){return this.getDisplayForValue(this.initialSelectedValue)}getDisplayForValue(e){var t;if(null==e||0!==e&&!e)return"";const i=null===(t=this.options)||void 0===t?void 0:t.find(t=>t.value===e);return this.allowCustomOptions&&this.select instanceof uh?String(i?i.label:e):i?String(i.label):""}resetCombobox(){this.select&&this.select instanceof uh&&this.select.resetCombobox()}handleStreamInserts(e){var t,i;if(this.loadingMoreRows=!1,!(null==e?void 0:e.length))return;this.removeEmptyDataOption();const o=new Set((null!==(t=this.options)&&void 0!==t?t:[]).map(e=>String(e.value))),c=e.filter(e=>!o.has(String(e[this.valueField])));if(!c.length)return Mx.warn(`Infinite scroll for ${this.resourceName} received a page of options that were all already loaded, so paging has stopped. Request Server resources only honour OFFSET when declared with criteriaOnlyRequest; otherwise every page returns the same rows. Also set a stable order-by so pages cannot overlap.`),void(this.moreRowsAvailable=!1);const s=c.map(e=>this.rowToOption(e));this.options=[...null!==(i=this.options)&&void 0!==i?i:[],...s],this.renderListboxOptions(s),this.renderedOptionsCount=this.options.length,this.nextRequestOffset=Math.max(this.nextRequestOffset,this.renderedOptionsCount),this.topUpVisibleListbox()}handleStreamDeletes(e){Mx.debug("handleStreamDeletes - Method not implemented.")}handleStreamUpdates(e){Mx.debug("handleStreamUpdates - Method not implemented.")}};qL.defaultPageSize=20,qL.scrollLoadThresholdPx=32,Nu([Yz],qL.prototype,"resources",void 0),Nu([re({attribute:"label-field"})],qL.prototype,"labelField",void 0),Nu([re({attribute:"option-element"})],qL.prototype,"optionElement",void 0),Nu([re({attribute:"value-field"})],qL.prototype,"valueField",void 0),Nu([re({attribute:"empty-data-label"})],qL.prototype,"emptyDataLabel",void 0),Nu([re({mode:"boolean",attribute:"allow-custom-options"})],qL.prototype,"allowCustomOptions",void 0),Nu([re({mode:"boolean",attribute:"infinite-scroll"})],qL.prototype,"infiniteScroll",void 0),Nu([re({attribute:"page-size",converter:ne})],qL.prototype,"pageSize",void 0),Nu([g],qL.prototype,"labelFormatter",void 0),Nu([g],qL.prototype,"labelRowFormatter",void 0),Nu([g],qL.prototype,"initialSelectedValue",void 0),qL=jL=Nu([ye({name:"options-datasource"})],qL);let GL=class extends wx{constructor(){super(...arguments),this.isSnapshot=!0,this.baseCriteria=""}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return Ou(this,void 0,void 0,function*(){var t;e.connectedCallback.call(this),this.baseCriteria=this.criteria,this.fields=this.labelField?null===(t=this.valueField)||void 0===t?void 0:t.concat(" ",this.labelField):this.valueField,this.select=this.parentElement,this.select&&this.valueField&&(this.resourceName&&this.connect.isConnected||this.data)&&this.fetchGenesisData(),this.valueField||Mx.warn('Specify field for values in options (e.g value-field="VALUE") and optionally field for label which is supported only in select and combobox (e.g label-field="NAME")')})}clearData(){this.select.options=[]}syncComponentData(e){var t;const i=(null!=e?e:Array.from(this.rowsSyncedWithStream.values())).map(e=>{var t;return{value:e[this.valueField],label:this.getDefaultLabelFormat(e[this.labelField],null===(t=this.getFieldMetadata(this.labelField))||void 0===t?void 0:t.type)}});(null===(t=this.select)||void 0===t?void 0:t.async)&&(this.select.loading=!1),this.select.options=i}handleStreamInserts(e){Mx.debug("handleStreamInserts - Method not implemented.")}handleStreamDeletes(e){Mx.debug("handleStreamDeletes - Method not implemented.")}handleStreamUpdates(e){Mx.debug("handleStreamUpdates - Method not implemented.")}};Nu([re({attribute:"value-field"})],GL.prototype,"valueField",void 0),Nu([re({attribute:"label-field"})],GL.prototype,"labelField",void 0),GL=Nu([ye({name:"multiselect-datasource"})],GL);const WL=(e="foundation")=>W`<label part="label" for="display-field" class=${e=>{var t;return Jt("label",["label-hidden",!(null===(t=e.defaultSlottedNodes)||void 0===t?void 0:t.length)])}}><slot name="label" ${Ke({property:"defaultSlottedNodes",filter:Fs})}></slot></label><div class="root" part="root" @keydown="${(e,t)=>e.keydownHandler(t.event)}"><div class="control" part="control"><input id="display-field" part="filter-search" role="combobox" aria-haspopup="listbox" aria-controls="checkbox-container" aria-expanded=${e=>e.open?"true":"false"}tabindex="${e=>e.tabindex}" ?readonly=${e=>!e.search}@click=${e=>e.toggle()}?disabled="${e=>e.disabled}" ${Ie("filterSearchInput")}value=${Ep(e=>e.filterSearchValue,"string","input")}placeholder="${e=>e.getDisplayValue}" autocomplete="off" @input=${(e,t)=>e.inputHandler()}@change=${(e,t)=>e.changeHandler(t.event)}/><div part="indicator" class="indicator" @click=${e=>!e.disabled&&e.toggle()}><svg viewBox="0 0 12 7" ${Ie("arrowIcon")}id="arrow-icon" class="${e=>Jt(["disabled-svg",e.disabled])}" xmlns="http://www.w3.org/2000/svg"><path d="${"M11.85.65c.2.2.2.5 0 .7L6.4 6.84a.55.55 0 01-.78 0L.14 1.35a.5.5 0 11.71-.7L6 5.8 11.15.65c.2-.2.5-.2.7 0z"}" /></svg></div>${He(e=>e.filterSearchValue&&e.selectedOptions.length,W`<div class="display-value">${e=>e.getDisplayValue}</div>`)}</div>${He(e=>e.loading,W`<${e}-progress slot="indicator"></${e}-progress>`)}<section class=${e=>Jt("multiselect-dropdown",["resizable",e.resizable])} ${Ie("multiselectDropdown")}part="multiselect-dropdown">${He(e=>e.resizable,W`<div class="resize-button" @mousedown=${(e,t)=>e.handleResizeStart(t.event)}></div>`)} ${He(e=>e.all,W`<${e}-button class="select-all" @click=${e=>e.selectCheckboxAll()}?disabled="${(e,t)=>e.isAllOptionsDisabled}">${e=>e.areAllOptionsSelected?"Deselect All":"Select All"} ${e=>e.name}</${e}-button>`)}<ol id="checkbox-container" class="checkbox-container options" aria-multiselectable="true" part="options-ol"><li part="options-header-item" class=${e=>{var t;return Jt("options-header-item",["options-header-item-hidden",!(null===(t=e.optionsHeaderSlottedNodes)||void 0===t?void 0:t.length)])}}><slot name="options-header" ${Ke({property:"optionsHeaderSlottedNodes",filter:Fs})}></slot></li>${qe(e=>e.filteredAvailableOptions,W`<li role="option" value=${(e,t)=>t.parent.getItemLabel(e)}part="option"><${e}-checkbox part="checkbox" class="checkbox" exportparts="label:checkbox-label" @keydown=${(e,t)=>t.parent.checkboxKeyDown(e,t.event)}@click=${(e,t)=>t.parent.selectCheckboxOne(e)}@change=${(e,t)=>t.parent.changeHandler(t.event)}?current-checked="${(e,t)=>t.parent.isOptionSelected(e)}" ?disabled="${(e,t)=>t.parent.isOptionDisabled(e)}">${(e,t)=>{var i,o;return null===(o=null===(i=t.parent)||void 0===i?void 0:i.itemRenderer)||void 0===o?void 0:o.call(i,e,t.parent)}}</${e}-checkbox></li>`)}</ol>${He(e=>e.showCreatable,W`<${e}-button @click=${e=>e.addOption()}>Create&nbsp;"${e=>e.filterSearchValue}"</${e}-button>`)}</section></div><slot ${Ke({property:"slottedDatasource",filter:e=>e instanceof GL})}></slot>`,YL=W` ${WL()} `,KL=void 0,ZL={};class QL extends qt{constructor(){super(...arguments),this.name="",this.autoPosition=!0,this.all=!0,this.allSelected=!1,this.search=!0,this.disabled=!1,this.creatable=!1,this.async=!1,this.debounce=500,this.resizable=!1,this.filterByContains=!1,this.filterSearchValue="",this.clickOutside=e=>this.handleClickOutside(e),this.open=!1,this.options=[],this.selectedOptions=[],this.filteredAvailableOptions=[...this.options],this.position=_L.BELOW,this.itemRenderer=this.defaultItemRenderer,this.initialisedOptions=!1,this.isResizing=!1,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.handleResizeStart=e=>{this.resizable&&this.multiselectDropdown&&(e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.startX=e.clientX,this.startY=e.clientY,this.startWidth=this.multiselectDropdown.offsetWidth,this.startHeight=this.multiselectDropdown.offsetHeight,this.multiselectDropdown.classList.add("is-resizing"),document.addEventListener("mousemove",this.handleResizeMove),document.addEventListener("mouseup",this.handleResizeEnd))},this.handleResizeMove=e=>{if(!this.isResizing||!this.multiselectDropdown)return;e.preventDefault();const t=e.clientX-this.startX,i=e.clientY-this.startY,o=Math.max(250,this.startWidth+t),c=Math.max(100,this.startHeight+i);this.multiselectDropdown&&(this.multiselectDropdown.style.width=`${o}px`,this.multiselectDropdown.style.maxHeight=`${c}px`)},this.handleResizeEnd=()=>{this.isResizing=!1,document.removeEventListener("mousemove",this.handleResizeMove),document.removeEventListener("mouseup",this.handleResizeEnd),this.multiselectDropdown&&(this.multiselectDropdown.classList.remove("is-resizing"),this.multiselectDropdown.style.setProperty("--custom-max-height",this.multiselectDropdown.style.maxHeight),this.multiselectDropdown.style.removeProperty("max-height"))}}debounceChanged(e,t){this.debouncedInputHandler=BL(this.asyncSetFilter,t)}openChanged(e,t){var i,o,c,s;t?(document.addEventListener("mousedown",this.clickOutside),null===(i=this.arrowIcon)||void 0===i||i.classList.add("flipped"),null===(o=this.multiselectDropdown)||void 0===o||o.classList.add("visible")):(document.removeEventListener("mousedown",this.clickOutside),null===(c=this.arrowIcon)||void 0===c||c.classList.remove("flipped"),null===(s=this.multiselectDropdown)||void 0===s||s.classList.remove("visible"))}connectedCallback(){var e;super.connectedCallback(),this.position===_L.ABOVE&&(null===(e=this.multiselectDropdown)||void 0===e||e.classList.add("position-above"))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this.clickOutside),document.removeEventListener("mousemove",this.handleResizeMove),document.removeEventListener("mouseup",this.handleResizeEnd)}defaultItemRenderer(e,t){return W` ${"string"==typeof e?W`<span part="option-label">${()=>t.getItemLabel(e)}</span>`:W`<span data-option-label-text=${()=>e.optionLabelText}style=${()=>e.labelStyle}part="option-label">${()=>t.getItemLabel(e)}</span>`} `}toggle(){this.open||this.setDropdownPosition(),this.open=!this.open}optionsChanged(){this.allSelected&&!this.initialisedOptions&&(this.selectedOptions=this.options.map(e=>this.optionValueGetter(e))),this.filteredAvailableOptions=[...this.options]}selectedOptionsChanged(){this.$fastController.isConnected&&(this.initialisedOptions=!0)}setDropdownPosition(){let e=this.position;if(this.autoPosition){const t=this.getBoundingClientRect(),i=window.innerHeight,o=t.top,c=i-t.bottom;e=c<230&&o>c?_L.ABOVE:_L.BELOW}this.multiselectDropdown.classList.toggle("position-above",e===_L.ABOVE),this.multiselectDropdown.classList.toggle("position-below",e===_L.BELOW)}optionValueGetter(e){return"string"==typeof e?e:e.value}optionLabelGetter(e){return"string"==typeof e?e:e.label}getItemLabel(e){let t;return e?(t="string"==typeof e?e:this.optionLabelGetter(e)||this.optionValueGetter(e)||"",this.valueFormatter?this.valueFormatter(t):t):""}isOptionDisabled(e){return e&&"string"!=typeof e&&e.disabled||!1}get getDisplayValue(){let e="";switch(this.selectedOptions.length){case 0:e=this.getPlaceholder;break;case 1:{const t=this.options.find(e=>this.optionValueGetter(e)===this.selectedOptions[0]);e=this.getItemLabel(t);break}case this.options.length:e=`All ${this.name}`.trim();break;default:e=`${this.selectedOptions.length} Selected`}return e}get getPlaceholder(){return`Search ${this.name}`.trim().concat("...")}get isAllOptionsDisabled(){return this.options.length===this.options.filter(this.isOptionDisabled).length}get areAllOptionsSelected(){const e=this.getEnabledOptionsCount();return e>0&&this.selectedOptions.length===e}get showCreatable(){return this.creatable&&this.filterSearchValue.length>0&&0===this.findExactMatchOptions().length}isOptionSelected(e){const t=this.optionValueGetter(e);return this.selectedOptions.some(i=>{if("object"==typeof e&&"object"==typeof e.value)try{return JSON.stringify(i)===JSON.stringify(t)}catch(e){return i===t}return i===t})}selectCheckboxOne(e){const t=this.optionValueGetter(e),i=this.selectedOptions.includes(t);this.selectedOptions=i?this.selectedOptions.filter(e=>e!==t):[...this.selectedOptions,t],this.$emit("selectionChange",this.selectedOptions)}checkboxKeyDown(e,t){return" "===t.key&&(t.preventDefault(),this.selectCheckboxOne(e)),!0}getEnabledOptionsCount(){return this.options.length-this.options.filter(this.isOptionDisabled).length}selectCheckboxAll(){const e=this.selectedOptions.length===this.getEnabledOptionsCount();this.selectedOptions=e?[]:this.options.filter(e=>!this.isOptionDisabled(e)).map(e=>this.optionValueGetter(e)),this.onAllSelectedCallback&&this.onAllSelectedCallback(!e),this.$emit("selectionChange",this.selectedOptions)}inputHandler(){this.open||(this.open=!0),this.async?(this.loading=!0,this.filteredAvailableOptions=[],this.debouncedInputHandler()):this.setFilter()}findExactMatchOptions(){const e=this.filterSearchValue.toLowerCase();return this.filteredAvailableOptions.filter(t=>{var i,o;const c="string"==typeof t?t:null!==(i=this.optionLabelGetter(t))&&void 0!==i?i:this.optionValueGetter(t);return(null!==(o=null==c?void 0:c.toLowerCase())&&void 0!==o?o:"")===e})}setFilter(){const e=this.filterSearchValue.toLowerCase();this.filteredAvailableOptions=this.options.filter(t=>{if(!e)return!0;if("string"==typeof t)return t.toLowerCase().includes(e);const i=t.label.toLowerCase(),o="object"==typeof t.value?(c=t.value,Object.values(c).some(t=>t.toLowerCase().includes(e))):String(t.value).toLowerCase().includes(e);var c;return i.includes(e)||o})}addOption(){this.options=[{value:this.filterSearchValue,label:this.filterSearchValue},...this.options],this.setFilter(),this.selectedOptions=[...this.selectedOptions,this.filterSearchValue]}asyncSetFilter(){this.slottedDatasource.length>0?Px(this.slottedDatasource[0],this.filterSearchValue):(this.loading=!1,Mx.warn("Multiselect-datasource is not connected. Please add a datasource to use this functionality."))}changeHandler(e){e.preventDefault(),e.stopImmediatePropagation()}handleClickOutside(e){kx(e,this)&&(this.open=!1)}keydownHandler(e){const t=e.key;if(e.ctrlKey||e.shiftKey)return!0;switch(t){case"Escape":if(this.open){this.open=!1;break}break;case"ArrowUp":case"ArrowDown":if(!this.open){this.open=!0;break}break;default:return!0}}clear(e={}){const{clearSelectedValues:t=!0,clearFilterText:i=!0}=e;t&&(this.selectedOptions=[],this.$emit("selectionChange",this.selectedOptions)),i&&(this.filterSearchValue="",this.setFilter(),this.filterSearchInput&&(this.filterSearchInput.value="")),this.$emit("clear",{clearSelectedValues:t,clearFilterText:i})}}Nu([re],QL.prototype,"name",void 0),Nu([re({mode:"boolean",attribute:"auto-position"})],QL.prototype,"autoPosition",void 0),Nu([re({mode:"boolean"})],QL.prototype,"all",void 0),Nu([re({mode:"boolean"})],QL.prototype,"allSelected",void 0),Nu([re({mode:"boolean"})],QL.prototype,"search",void 0),Nu([re({mode:"boolean"})],QL.prototype,"disabled",void 0),Nu([re({mode:"boolean"})],QL.prototype,"creatable",void 0),Nu([re({mode:"boolean"})],QL.prototype,"async",void 0),Nu([re],QL.prototype,"debounce",void 0),Nu([re({mode:"boolean"})],QL.prototype,"resizable",void 0),Nu([re],QL.prototype,"tabindex",void 0),Nu([re({mode:"boolean",attribute:"filter-by-contains"})],QL.prototype,"filterByContains",void 0),Nu([g],QL.prototype,"defaultSlottedNodes",void 0),Nu([g],QL.prototype,"slottedDatasource",void 0),Nu([g],QL.prototype,"valueFormatter",void 0),Nu([g],QL.prototype,"loading",void 0),Nu([g],QL.prototype,"filterSearchValue",void 0),Nu([g],QL.prototype,"open",void 0),Nu([g],QL.prototype,"options",void 0),Nu([g],QL.prototype,"selectedOptions",void 0),Nu([g],QL.prototype,"filteredAvailableOptions",void 0),Nu([g],QL.prototype,"scrollContainer",void 0),Nu([re],QL.prototype,"position",void 0),Nu([g],QL.prototype,"onAllSelectedCallback",void 0),Nu([g],QL.prototype,"itemRenderer",void 0),Nu([v],QL.prototype,"getDisplayValue",null),Nu([v],QL.prototype,"getPlaceholder",null),Nu([v],QL.prototype,"isAllOptionsDisabled",null),Nu([v],QL.prototype,"areAllOptionsSelected",null),Nu([v],QL.prototype,"showCreatable",null),Nu([g],QL.prototype,"optionsHeaderSlottedNodes",void 0),QL.compose(Object.assign({baseName:"multiselect",template:YL,styles:UL,shadowOptions:KL},ZL));const XL=Ce` .root{position: relative;width: 100%;min-width: 250px}.control-button{display: flex;justify-content: center;min-width: 31px;width: 31px;height: 31px;margin-left: calc(var(--design-unit) * 2px);color: var(--neutral-foreground-hint)}.control{cursor: pointer;position: relative;display: flex;justify-content: end;align-items: center;width: 100%;border-radius: calc(var(--control-corner-radius) * 1px)}.label{display: block;cursor: pointer;font-size: var(--type-ramp-base-font-size);line-height: var(--type-ramp-base-line-height);font-style: normal;font-weight: 700;margin: calc(var(--design-unit) * 2px) 0}.label-hidden{display: none}.control:hover .control-button, .control:hover .label{color: var(--neutral-foreground-rest)}button{pointer-events: none}.options{display: flex;flex-direction: column;position: absolute;height: max-content;overflow-y: hidden;margin-top: 5px;padding: calc((var(--design-unit) + 3) * 2px) calc((var(--design-unit) + 3) * 1px);border: 1px solid rgba(46 51 57 / 100%);border-radius: 4px;background: var(--neutral-fill-input-rest);width: 100%;max-height: 0;visibility: hidden;transition: max-height 0.4s ease 0s, visibility 0.4s ease 0s;z-index: 999}.option-content{display: flex;align-items: center;gap: calc(var(--design-unit) * 4px);width: 100%}.icon-container{display: flex;align-items: center;justify-content: center;width: calc( ((var(--base-height-multiplier) * var(--design-unit)) + (var(--design-unit) * 2)) * 1px + 4px );height: calc( ((var(--base-height-multiplier) * var(--design-unit)) + (var(--design-unit) * 2)) * 1px );border-radius: calc((var(--control-corner-radius) - 1) * 2px);background: var(--neutral-layer-2);box-sizing: border-box;box-shadow: 0 0 5px 0 rgba(0 0 0 / 35%);flex-shrink: 0}.text-content{display: flex;flex-direction: column;flex: 1}.svg-icon{height: 2em}.position-above{bottom: 100%}.checkbox-container{display: flex;flex-direction: column;overflow-y: scroll;scrollbar-width: thin;scrollbar-color: rgb(46 48 53) rgb(31 33 38)}span{border-bottom: calc(var(--stroke-width) * 1px) solid;border-color: color-mix(in srgb, var(--neutral-fill-rest), transparent 50%);padding: calc((var(--design-unit) + 2) * 2px) calc((var(--design-unit) + 3) * 1px);font-size: calc((var(--type-ramp-base-font-size) - 1px));color: var(--neutral-foreground-hint)}.multiselect-checkbox{min-width: fit-content;flex-direction: row-reverse;justify-content: space-between;align-items: flex-start;border-bottom: 1px solid;border-color: color-mix(in srgb, var(--neutral-fill-rest), transparent 50%);padding: calc((var(--design-unit) + 3) * 1px) calc((var(--design-unit) + 3) * 1px) calc((var(--design-unit) + 3) * 1px) 0;margin: 0}.multiselect-checkbox:hover{background-color: rgb(45 47 51);cursor: pointer}.multiselect-checkbox::part(label){overflow-x: hidden;text-overflow: ellipsis}.multiselect-checkbox::part(control){min-width: calc( ( (var(--base-height-multiplier) + var(--density)) * var(--design-unit) / 2 + var(--design-unit) ) * 1px )}.checkbox-container .multiselect-checkbox[disabled]{cursor: not-allowed}.description{text-wrap: wrap;font-size: calc((var(--type-ramp-base-font-size) - 1px));margin: calc((var(--design-unit) + 3) * 1px) 0}#filter-search{padding: 5px}::-webkit-scrollbar{width: 12px}::-webkit-scrollbar-track{background: rgb(31 33 38)}::-webkit-scrollbar-thumb{width: 8px;border-radius: 10px;box-shadow: inset 0 0 6px rgba(0 0 0 / 30%);background-color: rgb(46 48 53);border: 3px solid rgb(31 33 38)}.visible{visibility: visible;max-height: ${450..toString()}px}`,JL=(e="foundation")=>W`<div class="root" part="root"><div class="control" part="control" @click=${e=>!e.disabled&&e.toggle()}><label part="label" for="control" class=${e=>{var t;return Jt("label",["label-hidden",!(null===(t=e.defaultSlottedNodes)||void 0===t?void 0:t.length)])}}><slot ${Ke({property:"defaultSlottedNodes",filter:Fs})}></slot></label><${e}-button class="control-button" part="control-button"><slot name="button-content"><${e}-icon name="plus" variant="solid" size="lg"></${e}-icon></slot></${e}-button></div><div ${Ie("optionsElement")}class="options" part="options">${He(e=>e.search,W`<${e}-text-field id="filter-search" part="filter-search" value=${Ep(e=>e.filterSearchValue,"string","input")}placeholder="${e=>e.getPlaceholder}" @input=${(e,t)=>e.setFilter()}@change=${(e,t)=>e.changeHandler(t.event)}></${e}-text-field>`)}<div class="checkbox-container" part="checkbox-container">${qe(e=>e.filteredAvailableOptions,W`<span>${e=>e.type}</span>${qe(e=>e.options,W`<${e}-checkbox class="multiselect-checkbox" part="multiselect-checkbox" @click=${(e,t)=>t.parentContext.parent.selectCheckboxOne(e)}@change=${(e,t)=>t.parentContext.parent.changeHandler(t.event)}?current-checked="${(e,t)=>t.parentContext.parent.isOptionSelected(e)}" ?disabled="${(e,t)=>t.parentContext.parent.isOptionDisabled(e)}"><div class="option-content">${He(e=>e.icon||e.svg,W`<div class="icon-container">${He(e=>e.icon,W`<${e}-icon style="color:${e=>e.iconColor||"#fff"}" name="${e=>e.icon}" size="xl"></${e}-icon>`)} ${He(e=>e.svg,W`<img class="svg-icon" src="${e=>e.svg}" alt="${e=>e.label}" />`)}</div>`)}<div class="text-content"><div class="option-label">${(e,t)=>t.parentContext.parent.getItemLabel(e)}</div>${He(e=>e.description,W`<p class="description">${e=>e.description}</p>`)}</div></div></${e}-checkbox>`)} `)}</div></div></div>`,eM=W` ${JL()} `,tM=void 0,iM={};class oM extends qt{constructor(){super(...arguments),this.name="",this.autoPosition=!0,this.search=!0,this.disabled=!1,this.clickOutside=e=>this.handleClickOutside(e),this.open=!1,this.options=[],this.selectedOptions=[],this.position=_L.BELOW}openChanged(e,t){var i,o;t?(document.addEventListener("mousedown",this.clickOutside),null===(i=this.optionsElement)||void 0===i||i.classList.add("visible")):(document.removeEventListener("mousedown",this.clickOutside),null===(o=this.optionsElement)||void 0===o||o.classList.remove("visible"))}connectedCallback(){var e;super.connectedCallback(),this.position===_L.ABOVE&&(null===(e=this.optionsElement)||void 0===e||e.classList.add("position-above"))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this.clickOutside)}toggle(){this.open||this.setDropdownPosition(),this.open=!this.open}sortFilteredOptions(e){const t=(null!=e?e:this.options).reduce((e,t)=>{const i=t.type||"Other";return e[i]?e[i].options.push(t):e[i]={type:i,options:[t]},e},{});return Object.values(t)}optionsChanged(){this.filteredAvailableOptions=this.sortFilteredOptions()}setDropdownPosition(){let e=this.position;if(this.autoPosition){let t=this.assignedSlot?this.assignedSlot.parentElement:this.parentElement;for(;t&&!t.classList.contains("content-wrapper");)t=t.parentElement;if(t){const i=t.getBoundingClientRect(),o=this.getBoundingClientRect(),c=i.top+i.height/2;e=o.top<c?_L.BELOW:_L.ABOVE}else{const t=this.getBoundingClientRect(),i=window.innerHeight,o=t.top,c=i-t.bottom;e=c<t.height&&o>c?_L.ABOVE:_L.BELOW}}e===_L.ABOVE?(this.optionsElement.classList.add("position-above"),this.optionsElement.classList.remove("position-below")):e===_L.BELOW&&(this.optionsElement.classList.add("position-below"),this.optionsElement.classList.remove("position-above"))}optionGetter(e){return e.value}getItemLabel(e){let t;return e?(t=e.label||e.value||"",this.valueFormatter?this.valueFormatter(t):t):""}isOptionDisabled(e){return e&&"string"!=typeof e&&e.disabled||!1}get getPlaceholder(){return`Search ${this.name}`.trim().concat("...")}isOptionSelected(e){return this.selectedOptions.includes(this.optionGetter(e))}selectCheckboxOne(e){const t=this.optionGetter(e);this.selectedOptions.includes(t)?(this.selectedOptions=[...this.selectedOptions],this.selectedOptions.splice(this.selectedOptions.indexOf(t),1)):this.selectedOptions=[...this.selectedOptions,t],this.$emit("selectionChange",this.selectedOptions)}setFilter(){const e=this.options.filter(e=>{var t;const i=e.description,o=null!==(t=e.label)&&void 0!==t?t:e.value;return(null==i?void 0:i.toLowerCase().includes(this.filterSearchValue.toLowerCase()))||o.toLowerCase().includes(this.filterSearchValue.toLowerCase())?e:void 0});this.filteredAvailableOptions=this.sortFilteredOptions(e)}changeHandler(e){e.preventDefault(),e.stopImmediatePropagation()}handleClickOutside(e){kx(e,this)&&(this.open=!1)}}Nu([re],oM.prototype,"name",void 0),Nu([re({mode:"boolean",attribute:"auto-position"})],oM.prototype,"autoPosition",void 0),Nu([re({mode:"boolean"})],oM.prototype,"search",void 0),Nu([re({mode:"boolean"})],oM.prototype,"disabled",void 0),Nu([g],oM.prototype,"defaultSlottedNodes",void 0),Nu([g],oM.prototype,"valueFormatter",void 0),Nu([g],oM.prototype,"filterSearchValue",void 0),Nu([g],oM.prototype,"open",void 0),Nu([g],oM.prototype,"options",void 0),Nu([g],oM.prototype,"selectedOptions",void 0),Nu([g],oM.prototype,"filteredAvailableOptions",void 0),Nu([g],oM.prototype,"position",void 0),Nu([v],oM.prototype,"getPlaceholder",null),oM.compose(Object.assign({baseName:"categorized-multiselect",template:eM,styles:XL,shadowOptions:tM},iM));const cM=(e,t)=>Io(0,t),sM=(e,t)=>Ce` ${rh()}`;class nM extends _o{}const aM=void 0,rM={checkedIndicator:'\n <svg\n aria-hidden="true"\n part="checked-indicator"\n class="checked-indicator"\n viewBox="0 0 20 20"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n fill-rule="evenodd"\n clip-rule="evenodd"\n d="M8.143 12.6697L15.235 4.5L16.8 5.90363L8.23812 15.7667L3.80005 11.2556L5.27591 9.7555L8.143 12.6697Z"\n />\n </svg>\n ',indeterminateIndicator:'\n <div part="indeterminate-indicator" class="indeterminate-indicator"></div>\n '};nM.compose(Object.assign({baseName:"checkbox",template:cM,styles:sM,shadowOptions:aM},rM));const lM=(e,t)=>Ce` .combo-box-indicator{transition-property: transform;transition-duration: 0.2s;transition-timing-function: ease-out}:host([open]) .combo-box-indicator{transform: rotate(180deg)}${hh(e)}`,dM=(e,t)=>W`<template aria-activedescendant="${e=>e.activeDescendant}" class="${e=>e.open?"open":""} ${e=>e.disabled?"disabled":""} ${e=>e.position}" ?open="${e=>e.open}" @click="${(e,t)=>e.clickHandler(t.event)}" @focusout="${(e,t)=>e.focusoutHandler(t.event)}" @keydown="${(e,t)=>e.keydownHandler(t.event)}"><div class="control" part="control">${et(0,t)}<slot name="control"><input aria-activedescendant="${e=>e.activeDescendant}" aria-autocomplete="${e=>e.ariaAutoComplete||e.autocomplete}" aria-controls="${e=>e.ariaControls||e.listboxId}" aria-disabled="${e=>e.disabled?"true":"false"}" aria-expanded="${e=>e.open?"true":"false"}" aria-haspopup="listbox" aria-labelledby="${e=>e.ariaLabelledby}" aria-label="${e=>e.ariaLabel}" autocomplete="${e=>e.autocomplete}" class="selected-value" part="selected-value" placeholder="${e=>e.placeholder}" role="combobox" type="text" ?disabled="${e=>e.disabled}" :value="${e=>e.value}" @input="${(e,t)=>e.inputHandler(t.event)}" @keyup="${(e,t)=>e.keyupHandler(t.event)}" ${Ie("control")}/><div class="indicator" part="indicator" aria-hidden="true"><slot name="indicator">${t.indicator||""}</slot></div></slot>${Je(0,t)}</div><div class="listbox" id="${e=>e.listboxId}" part="listbox" role="listbox" ?disabled="${e=>e.disabled}" ?hidden="${e=>!e.open}" ${Ie("listbox")}><slot ${Ie("slottedDatasource")} ${Ke({filter:Bo.slottedOptionFilter,flatten:!0,property:"slottedOptions"})}></slot></div></template>`;var hM,uM;class pM extends uh{constructor(){super(...arguments),hM.set(this,void 0),uM.set(this,!1),this.needManualChangeEventDispatch=!1,this.async=!1,this.debounce=500,this.caseSensitive=!1,this.ignoreInputClick=!1,this.filterMode="startsWith",this.scrollToSelectedWhenOpening=!1,this.scrollToSelectedWhenOpeningOptions={behavior:"auto",block:"nearest"},this.scrollWhenSelectionChanges=!1,this.scrollWhenSelectionChangesOptions={behavior:"auto",block:"center"},this.resetCombobox=()=>{this.selectedOptions=[],this.selectedIndex=-1,this.value="",this.control.value="",this.filter="",this.filterOptions()}}get activeDescendant(){var e,t;if(this.selectedOptions&&0!==this.selectedOptions.length)return this.ariaActiveDescendant=null===(e=this.selectedOptions[0])||void 0===e?void 0:e.id,null===(t=this.selectedOptions[0])||void 0===t?void 0:t.id}debounceChanged(e,t){this.debouncedInputHandler=BL(this.asyncSetFilter,t)}get scrollableListbox(){var e,t;return null!==(e=this.listbox)&&void 0!==e?e:null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".listbox")}openChanged(){super.openChanged(),this.$emit("open-change",{open:this.open}),this.open?this.scrollToSelectedWhenOpening&&setTimeout(()=>{const e=this.options[this.selectedIndex];null==e||e.scrollIntoView(this.scrollToSelectedWhenOpeningOptions)},500):(this.manuallyDispatchChangeEvent(),this.filter="",this.filterOptions())}get value(){return m.track(this,"value"),this._ourValue}set value(e){var t,i,o;if(void 0===e)return;const c=`${this._ourValue}`;if(this.$fastController.isConnected&&this.options){const c=this.caseSensitive?t=>t.text===e:t=>t.text.toLowerCase()===String(e).toLowerCase(),s=this.options?this.options.findIndex(c):-1,n=null===(t=this.options[this.selectedIndex])||void 0===t?void 0:t.text,a=null===(i=this.options[s])||void 0===i?void 0:i.text;this.selectedIndex=a&&a!==n?s:this.selectedIndex,e&&""!==e.trim()&&-1===s&&(e=(null===(o=this.firstSelectedOption)||void 0===o?void 0:o.text)||e)}c!==e&&(this._ourValue=e,super.valueChanged(c,e),m.notify(this,"value"))}slottedOptionsChanged(e,t){this.enableAsyncForInfiniteScrollDatasource(),super.slottedOptionsChanged(e,t),this.updateValue(!1)}enableAsyncForInfiniteScrollDatasource(){var e;if(this.async)return;const t=null===(e=this.slottedDatasource)||void 0===e?void 0:e.assignedNodes().find(e=>e instanceof qL);(null==t?void 0:t.infiniteScroll)&&(this.async=!0)}filterOptions(){if(this.async)return this.filteredOptions=[...this._options],void this._options.forEach(e=>e.hidden=!1);this.autocomplete&&this.autocomplete!==Qo||(this.filter="");const e=this.filter,t=this.caseSensitive?e:e.toLowerCase();this.filteredOptions=this._options.filter(e=>{const i=this.caseSensitive?e.text:e.text.toLowerCase();return"contains"===this.filterMode?i.includes(t):i.startsWith(t)}),this.isAutocompleteList&&(this.filteredOptions.length||t||(this.filteredOptions=this._options),this._options.forEach(e=>e.hidden=!this.filteredOptions.includes(e)))}clickHandler(e){if(!this.disabled)if(kx(e,this))this.open=!1;else{if(Sx(e,this.indicator))return this.open=!this.open,void(this.open&&this.control.focus());if(!this.ignoreInputClick||!Sx(e,this.control))return super.clickHandler(e)}}keydownHandler(e){const t=e.key;if(e.ctrlKey||e.shiftKey)return!0;switch(t){case"Enter":if(Vu(this,uM,this.open,"f"),!this.open)return this.open=!0,!0;break;case"ArrowDown":case"ArrowUp":if(!this.open)return this.open=!0,!0;if(this.scrollWhenSelectionChanges){const e=this.options[this.selectedIndex];null==e||e.scrollIntoView(this.scrollWhenSelectionChangesOptions)}break;case"Escape":if(this.control.value!==this.currentValue)return this.filter="",this.filterOptions(),this.control.value=this.currentValue,this.selectItemByValue(this.currentValue),void(this.open=!1);if(!this.open)return!0}const i=super.keydownHandler(e);return"Enter"!==t?i:void 0}keyupHandler(e){var t;const i=e.key;if(e.ctrlKey||e.shiftKey)return!0;switch(i){case"Enter":return!Pu(this,uM,"f");case"ArrowDown":case"ArrowUp":this.open&&this.firstSelectedOption&&this.autocomplete===Zo&&(this.needManualChangeEventDispatch=!0,this.currentValue=null===(t=this.firstSelectedOption)||void 0===t?void 0:t.value);break;case"Home":case"End":return;case"Backspace":case"Delete":const i=super.keyupHandler(e);return this.selectItemByValue(this.control.value),i}return super.keyupHandler(e)}get indicator(){return Pu(this,hM,"f")||Vu(this,hM,this.shadowRoot.querySelector('[part="indicator"]'),"f"),Pu(this,hM,"f")}selectItemByValue(e){var t,i,o;this.selectedIndex=null!==(i=null===(t=this.options)||void 0===t?void 0:t.findIndex(t=>t.text===e))&&void 0!==i?i:-1,null===(o=this.options)||void 0===o||o.forEach((e,t)=>e.selected=t===this.selectedIndex)}inputHandler(e){this.async?this.debouncedInputHandler():super.inputHandler(e)}asyncSetFilter(){const e=this.control.value,t=this.slottedDatasource.assignedNodes().filter(e=>e instanceof qL);if(t.length>0){const i=t[0];null==e||""===e?i.criteria=i.baseCriteria||"":Px(i,e),u.queueUpdate(()=>{this.control.value=e})}else Mx.warn("Options-datasource is not connected. Please add a datasource to use this functionality.")}manuallyDispatchChangeEvent(){this.needManualChangeEventDispatch&&this.firstSelectedOption&&this.autocomplete===Zo&&(this.dispatchEvent(new Event("change",{bubbles:!0})),this.needManualChangeEventDispatch=!1)}}hM=new WeakMap,uM=new WeakMap,Nu([g],pM.prototype,"activeDescendant",null),Nu([g],pM.prototype,"slottedDatasource",void 0),Nu([re({mode:"boolean"})],pM.prototype,"async",void 0),Nu([re],pM.prototype,"debounce",void 0),Nu([re({mode:"boolean",attribute:"case-sensitive"})],pM.prototype,"caseSensitive",void 0),Nu([re({mode:"boolean",attribute:"ignore-input-click"})],pM.prototype,"ignoreInputClick",void 0),Nu([re({attribute:"filter-mode"})],pM.prototype,"filterMode",void 0),Nu([re({mode:"boolean",attribute:"scroll-to-selected-when-opening"})],pM.prototype,"scrollToSelectedWhenOpening",void 0),Nu([g],pM.prototype,"scrollToSelectedWhenOpeningOptions",void 0),Nu([re({mode:"boolean",attribute:"scroll-when-selection-changes"})],pM.prototype,"scrollWhenSelectionChanges",void 0),Nu([g],pM.prototype,"scrollWhenSelectionChangesOptions",void 0);const fM={delegatesFocus:!0,mode:"open"},mM={indicator:'\n <svg\n class="combo-box-indicator"\n part="combo-box-indicator"\n viewBox="0 0 12 7"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n d="M11.85.65c.2.2.2.5 0 .7L6.4 6.84a.55.55 0 01-.78 0L.14 1.35a.5.5 0 11.71-.7L6 5.8 11.15.65c.2-.2.5-.2.7 0z"\n />\n </svg>\n '};pM.compose(Object.assign({baseName:"combobox",template:dM,styles:lM,shadowOptions:fM},mM));const gM=(e,t)=>Ce` :host{--light-size: 12px;--height: calc(var(--design-unit) * 2px + var(--light-size));display: flex;justify-content: center;align-items: center;width: 100%;height: var(--height);margin: calc(var(--design-unit) * 2px) 0;/* https://www.colorxs.com/color/traffic-light-green-2032-20 */ --green: 50 164 49;--trafic-light-green: rgb(var(--green));--trafic-light-green-glow: rgb(var(--green) / 40%) 0 0 4px 4px, rgb(var(--green) / 20%) 0 0 8px 8px;/* https://www.colorxs.com/color/ral-3020-traffic-red */ --red: 187 30 16;--trafic-light-red: rgb(var(--red));--trafic-light-red-glow: rgb(var(--red) / 40%) 0 0 4px 4px, rgb(var(--red) / 20%) 0 0 8px 8px}.light{height: var(--light-size);width: var(--light-size);margin: 1rem;border-radius: 100%}.green{background: var(--trafic-light-green);box-shadow: var(--trafic-light-green-glow)}.red{background: var(--trafic-light-red);box-shadow: var(--trafic-light-red-glow)}.label{font-size: small;color: grey;overflow: hidden;text-overflow: ellipsis;white-space: nowrap}`,vM=W`<div class=${e=>Jt(["light",!0],[e.colour,!0])}></div>${He(e=>e.showLabel,W`<div class="label">${e=>e.label}</div>`)} `;class bM extends qt{constructor(){super(...arguments),this.showLabel=!1,this.label="disconnected",this.colour="red"}connectedCallback(){super.connectedCallback(),this.subscription=this.connect.isConnectedSubject.subscribe(e=>{this.label=this.getLabel(e),this.colour=e?"green":"red"})}disconnectedCallback(){var e;null===(e=this.subscription)||void 0===e||e.unsubscribe()}getLabel(e){if(!e)return"disconnected";return`${this.session.getSessionStorageItem("hostUrl")} ✔`}}Nu([gz],bM.prototype,"connect",void 0),Nu([Cb],bM.prototype,"session",void 0),Nu([re({mode:"boolean",attribute:"show-label"})],bM.prototype,"showLabel",void 0),Nu([g],bM.prototype,"label",void 0),Nu([g],bM.prototype,"colour",void 0),bM.compose({baseName:"connection-indicator",template:vM,styles:gM});const yM=class extends Lo{}.compose(Object.assign({baseName:"data-grid",template:(e,t)=>Co(e),styles:(e,t)=>Ce` ${ph()}`,shadowOptions:void 0},{}));const zM=class extends ko{}.compose(Object.assign({baseName:"data-grid-cell",template:$o,styles:(e,t)=>Ce` ${mh()}`,shadowOptions:void 0},{}));const xM=class extends xo{}.compose(Object.assign({baseName:"data-grid-row",template:So,styles:(e,t)=>Ce` ${fh()}`,shadowOptions:void 0},{})),CM=Ce` :host{position: relative}.date-toggle::part(control){cursor: pointer}.date-toggle::part(label){cursor: pointer}.calendar-dropdown{display: none;width: 300px;z-index: 999;position: absolute;top: 100%;left: 50%;transform: translate(-50%, 8px);margin: 10px 0 0;padding: 20px;background: var(--neutral-fill-rest);border-radius: calc(var(--control-corner-radius) * 1px);box-shadow: 0 0 8px rgb(0 0 0 / 20%)}.calendar-dropdown.hide-weekends{width: 215px}.calendar-dropdown.top{top: auto;bottom: 100%;margin: 0 0 5px;transform: translate(-50%, -8px)}.calendar-dropdown.left{top: 50%;left: 0;margin: 0 0 0 5px;transform: translate(calc(-8px + -100%), -50%)}.calendar-dropdown.right{top: 50%;left: 100%;transform: translate(8px, -50%)}.calendar-dropdown.visible{display: block}.calendar-dropdown.inline{display: block;position: static;z-index: auto;margin-top: 5px;transform: none}.header{display: flex;justify-content: space-between;align-items: center;margin: 0 0 10px}.header h3{margin: 0;text-transform: capitalize;font-weight: bold;color: var(--neutral-foreground-rest)}.header .icon-button{height: auto;padding: 0;min-width: auto}.header .months-arrows{display: flex;gap: calc(var(--design-unit) * 2px)}.week-days{display: grid;grid-template-columns: repeat(7, 1fr);grid-gap: 5px;margin-bottom: 10px;color: var(--neutral-foreground-rest)}.week-days span{display: flex;justify-content: center;align-items: center;font-size: 14px;font-weight: bold;text-transform: capitalize}.week-days span.disabled{opacity: 60%}.month-days{display: grid;grid-template-columns: repeat(7, 1fr);grid-gap: 5px}.week-days.hide-weekends, .month-days.hide-weekends{grid-template-columns: repeat(5, 1fr)}.month-day{padding: 8px 5px;color: #808080;background: none;display: flex;justify-content: center;align-items: center;border-radius: calc(var(--control-corner-radius) * 4px);cursor: pointer;border: none}.month-day.current{opacity: 100%;color: var(--neutral-foreground-hint)}.month-day.selected{background: var(--accent-foreground-rest);color: var(--neutral-foreground-rest)}.month-day:hover:not(:disabled){background: var(--neutral-stroke-hover);color: var(--neutral-foreground-rest)}.month-day[disabled]{opacity: 50%;cursor: not-allowed}.date-toggle[readonly] .label{cursor: pointer}`,LM=[1,7],MM=e=>W`<${e}-text-field data-test-id="date-picker" readonly :value="${e=>e.inputValue}" placeholder="${e=>e.inputPlaceholder}" part="date-toggle" class="date-toggle" @click="${e=>e.toggleCalendar()}">${e=>e.label}<div class="input-icon-container" part="input-icon-container" slot="end"><${e}-icon variant="regular" name="calendar-alt" size="sm"></${e}-icon></div></${e}-text-field><div class="calendar-dropdown ${e=>e.calendarDropdownClasses} ${e=>e.position}"><div class="header"><h3>${e=>e.currentMonth} ${e=>e.currentYear}</h3><div class="months-arrows"><${e}-button class="icon-button" appearance="accent" @click="${e=>e.prevMonth()}" aria-label="previous month"><${e}-icon name="angle-left"></${e}-icon></${e}-button><${e}-button class="icon-button" appearance="accent" @click="${e=>e.nextMonth()}" aria-label="next month"><${e}-icon name="angle-right"></${e}-icon></${e}-button></div></div><div class="week-days ${e=>Jt(["hide-weekends",e.hideWeekends])}">${qe(e=>{var t;return null===(t=e.calendar)||void 0===t?void 0:t.weekDays},W` ${He((e,t)=>!t.parent.hideWeekends||-1===LM.indexOf(t.index+1),W`<span class="${(e,t)=>Jt(["disabled",-1!==t.parent.disabledDaysOfWeek.indexOf(t.index+1)])}">${(e,t)=>e.substring(0,t.parent.substringNumber)}</span>`)} `,{positioning:!0})}</div><div class="month-days ${e=>Jt(["hide-weekends",e.hideWeekends])}">${qe(e=>e.monthList,W` ${He((e,t)=>!t.parent.hideWeekends||-1===LM.indexOf(e.dayNumber),W`<button ?disabled="${(e,t)=>-1!==t.parent.disabledDaysOfWeek.indexOf(e.dayNumber)}" class="month-day ${(e,t)=>t.parent.isSelectedDate(e)?"selected":""} ${(e,t)=>e.monthNumber===t.parent.calendar.month.number?"current":""}" @click=${(e,t)=>t.parent.selectDay(e)}>${e=>e.date}</button>`)} `)}</div><slot name="bottom"></slot></div>`,wM=W` ${e=>MM($x(e))} `;var kM,SM={exports:{}};function $M(){return kM||(kM=1,function(e){e.exports=function(){var e=1e3,t=6e4,i=36e5,o="millisecond",c="second",s="minute",n="hour",a="day",r="week",l="month",d="quarter",h="year",u="date",p="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],i=e%100;return"["+e+(t[(i-20)%10]||t[i]||t[0])+"]"}},v=function(e,t,i){var o=String(e);return!o||o.length>=t?e:""+Array(t+1-o.length).join(i)+e},b={s:v,z:function(e){var t=-e.utcOffset(),i=Math.abs(t),o=Math.floor(i/60),c=i%60;return(t<=0?"+":"-")+v(o,2,"0")+":"+v(c,2,"0")},m:function e(t,i){if(t.date()<i.date())return-e(i,t);var o=12*(i.year()-t.year())+(i.month()-t.month()),c=t.clone().add(o,l),s=i-c<0,n=t.clone().add(o+(s?-1:1),l);return+(-(o+(i-c)/(s?c-n:n-c))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:h,w:r,d:a,D:u,h:n,m:s,s:c,ms:o,Q:d}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},y="en",z={};z[y]=g;var x="$isDayjsObject",C=function(e){return e instanceof k||!(!e||!e[x])},L=function e(t,i,o){var c;if(!t)return y;if("string"==typeof t){var s=t.toLowerCase();z[s]&&(c=s),i&&(z[s]=i,c=s);var n=t.split("-");if(!c&&n.length>1)return e(n[0])}else{var a=t.name;z[a]=t,c=a}return!o&&c&&(y=c),c||!o&&y},M=function(e,t){if(C(e))return e.clone();var i="object"==typeof t?t:{};return i.date=e,i.args=arguments,new k(i)},w=b;w.l=L,w.i=C,w.w=function(e,t){return M(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var k=function(){function g(e){this.$L=L(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var v=g.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,i=e.utc;if(null===t)return new Date(NaN);if(w.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var o=t.match(f);if(o){var c=o[2]-1||0,s=(o[7]||"0").substring(0,3);return i?new Date(Date.UTC(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,s)):new Date(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,s)}}return new Date(t)}(e),this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return w},v.isValid=function(){return!(this.$d.toString()===p)},v.isSame=function(e,t){var i=M(e);return this.startOf(t)<=i&&i<=this.endOf(t)},v.isAfter=function(e,t){return M(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<M(e)},v.$g=function(e,t,i){return w.u(e)?this[t]:this.set(i,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var i=this,o=!!w.u(t)||t,d=w.p(e),p=function(e,t){var c=w.w(i.$u?Date.UTC(i.$y,t,e):new Date(i.$y,t,e),i);return o?c:c.endOf(a)},f=function(e,t){return w.w(i.toDate()[e].apply(i.toDate("s"),(o?[0,0,0,0]:[23,59,59,999]).slice(t)),i)},m=this.$W,g=this.$M,v=this.$D,b="set"+(this.$u?"UTC":"");switch(d){case h:return o?p(1,0):p(31,11);case l:return o?p(1,g):p(0,g+1);case r:var y=this.$locale().weekStart||0,z=(m<y?m+7:m)-y;return p(o?v-z:v+(6-z),g);case a:case u:return f(b+"Hours",0);case n:return f(b+"Minutes",1);case s:return f(b+"Seconds",2);case c:return f(b+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var i,r=w.p(e),d="set"+(this.$u?"UTC":""),p=(i={},i[a]=d+"Date",i[u]=d+"Date",i[l]=d+"Month",i[h]=d+"FullYear",i[n]=d+"Hours",i[s]=d+"Minutes",i[c]=d+"Seconds",i[o]=d+"Milliseconds",i)[r],f=r===a?this.$D+(t-this.$W):t;if(r===l||r===h){var m=this.clone().set(u,1);m.$d[p](f),m.init(),this.$d=m.set(u,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[w.p(e)]()},v.add=function(o,d){var u,p=this;o=Number(o);var f=w.p(d),m=function(e){var t=M(p);return w.w(t.date(t.date()+Math.round(e*o)),p)};if(f===l)return this.set(l,this.$M+o);if(f===h)return this.set(h,this.$y+o);if(f===a)return m(1);if(f===r)return m(7);var g=(u={},u[s]=t,u[n]=i,u[c]=e,u)[f]||1,v=this.$d.getTime()+o*g;return w.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,i=this.$locale();if(!this.isValid())return i.invalidDate||p;var o=e||"YYYY-MM-DDTHH:mm:ssZ",c=w.z(this),s=this.$H,n=this.$m,a=this.$M,r=i.weekdays,l=i.months,d=i.meridiem,h=function(e,i,c,s){return e&&(e[i]||e(t,o))||c[i].slice(0,s)},u=function(e){return w.s(s%12||12,e,"0")},f=d||function(e,t,i){var o=e<12?"AM":"PM";return i?o.toLowerCase():o};return o.replace(m,function(e,o){return o||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return w.s(t.$y,4,"0");case"M":return a+1;case"MM":return w.s(a+1,2,"0");case"MMM":return h(i.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return t.$D;case"DD":return w.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return h(i.weekdaysMin,t.$W,r,2);case"ddd":return h(i.weekdaysShort,t.$W,r,3);case"dddd":return r[t.$W];case"H":return String(s);case"HH":return w.s(s,2,"0");case"h":return u(1);case"hh":return u(2);case"a":return f(s,n,!0);case"A":return f(s,n,!1);case"m":return String(n);case"mm":return w.s(n,2,"0");case"s":return String(t.$s);case"ss":return w.s(t.$s,2,"0");case"SSS":return w.s(t.$ms,3,"0");case"Z":return c}return null}(e)||c.replace(":","")})},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(o,u,p){var f,m=this,g=w.p(u),v=M(o),b=(v.utcOffset()-this.utcOffset())*t,y=this-v,z=function(){return w.m(m,v)};switch(g){case h:f=z()/12;break;case l:f=z();break;case d:f=z()/3;break;case r:f=(y-b)/6048e5;break;case a:f=(y-b)/864e5;break;case n:f=y/i;break;case s:f=y/t;break;case c:f=y/e;break;default:f=y}return p?f:w.a(f)},v.daysInMonth=function(){return this.endOf(l).$D},v.$locale=function(){return z[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var i=this.clone(),o=L(e,t,!0);return o&&(i.$L=o),i},v.clone=function(){return w.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},g}(),S=k.prototype;return M.prototype=S,[["$ms",o],["$s",c],["$m",s],["$H",n],["$W",a],["$M",l],["$y",h],["$D",u]].forEach(function(e){S[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),M.extend=function(e,t){return e.$i||(e(t,k,M),e.$i=!0),M},M.locale=L,M.isDayjs=C,M.unix=function(e){return M(1e3*e)},M.en=z[y],M.Ls=z,M.p={},M}()}(SM)),SM.exports}var EM,NM=of($M()),AM={exports:{}};var OM,TM=(EM||(EM=1,function(e){e.exports=function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,o=/\d\d/,c=/\d\d?/,s=/\d*[^-_:/,()\s\d]+/,n={},a=function(e){return(e=+e)+(e>68?1900:2e3)},r=function(e){return function(t){this[e]=+t}},l=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),i=60*t[1]+(+t[2]||0);return 0===i?0:"+"===t[0]?-i:i}(e)}],d=function(e){var t=n[e];return t&&(t.indexOf?t:t.s.concat(t.f))},h=function(e,t){var i,o=n.meridiem;if(o){for(var c=1;c<=24;c+=1)if(e.indexOf(o(c,0,t))>-1){i=c>12;break}}else i=e===(t?"pm":"PM");return i},u={A:[s,function(e){this.afternoon=h(e,!1)}],a:[s,function(e){this.afternoon=h(e,!0)}],Q:[i,function(e){this.month=3*(e-1)+1}],S:[i,function(e){this.milliseconds=100*+e}],SS:[o,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[c,r("seconds")],ss:[c,r("seconds")],m:[c,r("minutes")],mm:[c,r("minutes")],H:[c,r("hours")],h:[c,r("hours")],HH:[c,r("hours")],hh:[c,r("hours")],D:[c,r("day")],DD:[o,r("day")],Do:[s,function(e){var t=n.ordinal,i=e.match(/\d+/);if(this.day=i[0],t)for(var o=1;o<=31;o+=1)t(o).replace(/\[|\]/g,"")===e&&(this.day=o)}],w:[c,r("week")],ww:[o,r("week")],M:[c,r("month")],MM:[o,r("month")],MMM:[s,function(e){var t=d("months"),i=(d("monthsShort")||t.map(function(e){return e.slice(0,3)})).indexOf(e)+1;if(i<1)throw new Error;this.month=i%12||i}],MMMM:[s,function(e){var t=d("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,r("year")],YY:[o,function(e){this.year=a(e)}],YYYY:[/\d{4}/,r("year")],Z:l,ZZ:l};function p(i){var o,c;o=i,c=n&&n.formats;for(var s=(i=o.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t,i,o){var s=o&&o.toUpperCase();return i||c[o]||e[o]||c[s].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,i){return t||i.slice(1)})})).match(t),a=s.length,r=0;r<a;r+=1){var l=s[r],d=u[l],h=d&&d[0],p=d&&d[1];s[r]=p?{regex:h,parser:p}:l.replace(/^\[|\]$/g,"")}return function(e){for(var t={},i=0,o=0;i<a;i+=1){var c=s[i];if("string"==typeof c)o+=c.length;else{var n=c.regex,r=c.parser,l=e.slice(o),d=n.exec(l)[0];r.call(t,d),e=e.replace(d,"")}}return function(e){var t=e.afternoon;if(void 0!==t){var i=e.hours;t?i<12&&(e.hours+=12):12===i&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,i){i.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(a=e.parseTwoDigitYear);var o=t.prototype,c=o.parse;o.parse=function(e){var t=e.date,o=e.utc,s=e.args;this.$u=o;var a=s[1];if("string"==typeof a){var r=!0===s[2],l=!0===s[3],d=r||l,h=s[2];l&&(h=s[2]),n=this.$locale(),!r&&h&&(n=i.Ls[h]),this.$d=function(e,t,i,o){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var c=p(t)(e),s=c.year,n=c.month,a=c.day,r=c.hours,l=c.minutes,d=c.seconds,h=c.milliseconds,u=c.zone,f=c.week,m=new Date,g=a||(s||n?1:m.getDate()),v=s||m.getFullYear(),b=0;s&&!n||(b=n>0?n-1:m.getMonth());var y,z=r||0,x=l||0,C=d||0,L=h||0;return u?new Date(Date.UTC(v,b,g,z,x,C,L+60*u.offset*1e3)):i?new Date(Date.UTC(v,b,g,z,x,C,L)):(y=new Date(v,b,g,z,x,C,L),f&&(y=o(y).week(f).toDate()),y)}catch(e){return new Date("")}}(t,a,o,i),this.init(),h&&!0!==h&&(this.$L=this.locale(h).$L),d&&t!=this.format(a)&&(this.$d=new Date("")),n={}}else if(a instanceof Array)for(var u=a.length,f=1;f<=u;f+=1){s[1]=a[f-1];var m=i.apply(this,s);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}f===u&&(this.$d=new Date(""))}else c.call(this,e)}}}()}(AM)),AM.exports),RM=of(TM),IM={exports:{}};var DM,FM=(OM||(OM=1,function(e){e.exports=function(e,t,i){var o=t.prototype,c=function(e){return e&&(e.indexOf?e:e.s)},s=function(e,t,i,o,s){var n=e.name?e:e.$locale(),a=c(n[t]),r=c(n[i]),l=a||r.map(function(e){return e.slice(0,o)});if(!s)return l;var d=n.weekStart;return l.map(function(e,t){return l[(t+(d||0))%7]})},n=function(){return i.Ls[i.locale()]},a=function(e,t){return e.formats[t]||function(e){return e.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,i){return t||i.slice(1)})}(e.formats[t.toUpperCase()])},r=function(){var e=this;return{months:function(t){return t?t.format("MMMM"):s(e,"months")},monthsShort:function(t){return t?t.format("MMM"):s(e,"monthsShort","months",3)},firstDayOfWeek:function(){return e.$locale().weekStart||0},weekdays:function(t){return t?t.format("dddd"):s(e,"weekdays")},weekdaysMin:function(t){return t?t.format("dd"):s(e,"weekdaysMin","weekdays",2)},weekdaysShort:function(t){return t?t.format("ddd"):s(e,"weekdaysShort","weekdays",3)},longDateFormat:function(t){return a(e.$locale(),t)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return r.bind(this)()},i.localeData=function(){var e=n();return{firstDayOfWeek:function(){return e.weekStart||0},weekdays:function(){return i.weekdays()},weekdaysShort:function(){return i.weekdaysShort()},weekdaysMin:function(){return i.weekdaysMin()},months:function(){return i.months()},monthsShort:function(){return i.monthsShort()},longDateFormat:function(t){return a(e,t)},meridiem:e.meridiem,ordinal:e.ordinal}},i.months=function(){return s(n(),"months")},i.monthsShort=function(){return s(n(),"monthsShort","months",3)},i.weekdays=function(e){return s(n(),"weekdays",null,null,e)},i.weekdaysShort=function(e){return s(n(),"weekdaysShort","weekdays",3,e)},i.weekdaysMin=function(e){return s(n(),"weekdaysMin","weekdays",2,e)}}}(IM)),IM.exports),_M=of(FM),HM={exports:{}};var PM,VM=(DM||(DM=1,function(e){var t;e.exports=(t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},function(e,i,o){var c=i.prototype,s=c.format;o.en.formats=t,c.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var i=this.$locale().formats,o=function(e,i){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(e,o,c){var s=c&&c.toUpperCase();return o||i[c]||t[c]||i[s].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,i){return t||i.slice(1)})})}(e,void 0===i?{}:i);return s.call(this,o)}})}(HM)),HM.exports),BM=of(VM),UM={exports:{}};var jM=(PM||(PM=1,function(e){e.exports=function(e,t){t.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}}(UM)),UM.exports),qM=of(jM);class GM{constructor(e,t="default"){e=null!=e?e:new Date,this.Date=e,this.date=e.getDate(),this.day=e.toLocaleString(t,{weekday:"long"}),this.dayNumber=e.getDay()+1,this.dayShort=e.toLocaleString(t,{weekday:"short"}),this.year=e.getFullYear(),this.yearShort=Number(e.toLocaleString(t,{year:"2-digit"})),this.month=e.toLocaleString(t,{month:"long"}),this.monthShort=e.toLocaleString(t,{month:"short"}),this.monthNumber=e.getMonth()+1,this.timestamp=e.getTime()}}NM.extend(qM);class WM{constructor(e=null,t="default"){const i=new GM(e,t);this.lang=t,this.name=i.month,this.number=i.monthNumber,this.year=i.year,this.numberOfDays=[31,28,31,30,31,30,31,31,30,31,30,31][this.number-1],2===this.number&&(this.numberOfDays+=NM(i.date).isLeapYear()?1:0)}getDay(e){return new GM(new Date(this.year,this.number-1,e),this.lang)}}NM.extend(qM);class YM{constructor(e=null,t=null,i="default"){this.weekDays=Array.from({length:7}),this.today=new GM(null,i),this.year=null!=e?e:this.today.year,this.month=new WM(new Date(this.year,(t||this.today.monthNumber)-1),i),this.lang=i,this.weekDays.forEach((e,t)=>{const i=this.month.getDay(t);this.weekDays[i.dayNumber-1]=i.day})}getMonth(e){return new WM(new Date(this.year,e-1),this.lang)}getPreviousMonth(){return 1===this.month.number?new WM(new Date(this.year-1,11),this.lang):new WM(new Date(this.year,this.month.number-2),this.lang)}getNextMonth(){return 1===this.month.number?new WM(new Date(this.year+1,0),this.lang):new WM(new Date(this.year,this.month.number+2),this.lang)}goToDate(e,t){this.month=new WM(new Date(t,e-1),this.lang),this.year=t}goToNextYear(){this.year+=1,this.month=new WM(new Date(this.year,0),this.lang)}goToPreviousYear(){this.year-=1,this.month=new WM(new Date(this.year,11),this.lang)}goToNextMonth(){if(12===this.month.number)return this.goToNextYear();this.month=new WM(new Date(this.year,this.month.number+1-1),this.lang)}goToPreviousMonth(){if(1===this.month.number)return this.goToPreviousYear();this.month=new WM(new Date(this.year,this.month.number-1-1),this.lang)}}var KM,ZM={exports:{}};function QM(e){return null!=e&&""!==String(e).trim()}KM||(KM=1,function(e){e.exports=function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=t(e),o={name:"en-gb",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekStart:1,yearStart:4,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},ordinal:function(e){var t=["th","st","nd","rd"],i=e%100;return"["+e+(t[(i-20)%10]||t[i]||t[0])+"]"}};return i.default.locale(o,null,!0),o}($M())}(ZM)),NM.extend(RM),NM.extend(_M),NM.extend(BM);const XM="MM-DD-YYYY";const JM=[1,2,3,4,5,6,7],ew=(e,t,i)=>{if(o=t,-1===e.indexOf(o.dayNumber))return t;var o;const c=JM.filter(t=>-1===e.indexOf(t));let s=c.find(e=>e>t.dayNumber);s||(s=Math.min(...c));const n=t.dayNumber<s?s-t.dayNumber:s-t.dayNumber+7;return c.length?new GM(((e,t=1)=>{const i=new Date(e);return i.setDate(e.getDate()+t),i})(t.Date,n),i):(gp.warn("Date picker disabled days - all days of week have been disabled"),t)};class tw extends qt{constructor(){super(...arguments),this.format=XM,this.lang="en-US",this.visible=!1,this.position="bottom",this.disabledDaysOfWeek=[],this.suppressValueChanged=!1,this.cachedFormat=XM,this.clickOutside=e=>this.handleClickOutside(e),this.keydownOutside=e=>this.handleKeydownOutside(e)}formatChanged(e,t){!this.useLocaleFormat&&t&&this.cacheUserFormat(t),t&&this.calendar&&QM(this.value)&&(this.formatDate=NM(this.currentDate.Date).format(t))}langChanged(){this.applyEffectiveLangChange()}useLocaleFormatChanged(e,t){this.calendar&&(t&&!e?this.cacheUserFormat(this.format):!t&&e&&this.restoreUserFormat(),this.applyEffectiveLangChange())}inlineCalendarChanged(){this.inlineCalendar?(document.removeEventListener("mousedown",this.clickOutside),document.removeEventListener("keydown",this.keydownOutside)):this.visible&&(document.addEventListener("mousedown",this.clickOutside),document.addEventListener("keydown",this.keydownOutside)),this.toggleVisibility()}hideWeekendsCalendarChanged(){this.toggleVisibility()}valueChanged(e,t){this.suppressValueChanged||this.calendar&&(QM(t)?this.applyValue(t):this.allowEmpty?this.clearToEmpty(!1):this.resetToDefaultDate())}disconnectedCallback(){document.removeEventListener("mousedown",this.clickOutside),document.removeEventListener("keydown",this.keydownOutside),super.disconnectedCallback()}connectedCallback(){super.connectedCallback(),NM.extend(RM),NM.extend(BM),NM.extend(_M),this.substringNumber=3,this.useLocaleFormat&&(this.cacheUserFormat(this.format),this.applyLocaleFormat());const e=this.value;!this.allowEmpty||QM(e)?QM(e)?this.applyValue(e):this.initializeWithDefaultDate():this.initializeEmpty()}clear(){this.allowEmpty&&this.clearToEmpty(!0)}get inputValue(){return QM(this.value)?this.formatDate:""}get inputPlaceholder(){var e;return!this.allowEmpty||QM(this.value)?"":(null===(e=this.placeholder)||void 0===e?void 0:e.trim())||this.format.replace(/YYYY/g,"yyyy").replace(/YY(?!Y)/g,"yy").replace(/DD/g,"dd").replace(/D(?!D)/g,"d").replace(/MM/g,"mm").replace(/M(?!M)/g,"m")}get effectiveLang(){return this.useLocaleFormat&&!this.hasAttribute("lang")?"undefined"!=typeof navigator&&navigator.language?navigator.language:"en":this.lang}applyLocaleFormat(){this.format=function(e="en"){const t=function(e){const t=((null==e?void 0:e.trim())||"en").toLowerCase().replace(/_/g,"-");return"en-us"===t||"en"===t?"en":"en-gb"===t?"en-gb":t}(e),i=NM().locale(t),o=i.locale();return(c=t)!==(s=o)&&s!==c.split("-")[0]?NM().locale("en").localeData().longDateFormat("L")||"MM/DD/YYYY":i.localeData().longDateFormat("L")||"MM/DD/YYYY";var c,s}(this.effectiveLang)}cacheUserFormat(e){const t=null==e?void 0:e.trim();t&&(this.cachedFormat=t)}restoreUserFormat(){this.format=this.cachedFormat}applyEffectiveLangChange(){var e,t;if(!this.calendar)return;this.useLocaleFormat&&this.applyLocaleFormat();const i=this.calendar.year,o=this.calendar.month.number,c=null!==(t=null===(e=this.currentDate)||void 0===e?void 0:e.Date)&&void 0!==t?t:NM().toDate();this.currentDate=new GM(c,this.effectiveLang),this.calendar=new YM(i,o,this.effectiveLang),QM(this.value)&&(this.formatDate=NM(this.currentDate.Date).format(this.format)),this.updateHeaderText(),this.monthList=this.getMonthDaysGrid()}syncValueAttribute(e){this.suppressValueChanged=!0,this.value=e,this.suppressValueChanged=!1}initializeEmpty(){const e=NM();this.currentDate=new GM(e.toDate(),this.effectiveLang),this.calendar=new YM(this.currentDate.year,this.currentDate.monthNumber,this.effectiveLang),this.formatDate="",this.syncValueAttribute(""),this.currentMonth=this.calendar.month.name,this.currentYear=this.calendar.year,this.monthList=this.getMonthDaysGrid()}initializeWithDefaultDate(){this.resetToDefaultDate(!0)}resetToDefaultDate(e=!1){var t;let i=new GM(NM().toDate(),this.effectiveLang);(null===(t=this.disabledDaysOfWeek)||void 0===t?void 0:t.length)&&(i=ew(this.disabledDaysOfWeek,i,this.effectiveLang)),this.currentDate=i,e||!this.calendar?this.calendar=new YM(this.currentDate.year,this.currentDate.monthNumber,this.effectiveLang):this.calendar.goToDate(this.currentDate.monthNumber,this.currentDate.year),this.formatDate=NM(this.currentDate.Date).format(this.format),this.syncValueAttribute(NM(this.currentDate.Date).format(XM)),this.currentMonth=this.calendar.month.name,this.currentYear=this.calendar.year,this.monthList=this.getMonthDaysGrid()}applyValue(e){const t=function(e,t){const i=String(e).trim(),o=NM(i,t,!0);if(o.isValid())return o;const c=NM(i,XM,!0);return c.isValid()?c:null}(e,this.format);t?(this.currentDate=new GM(t.toDate(),this.effectiveLang),this.calendar?this.calendar.goToDate(this.currentDate.monthNumber,this.currentDate.year):this.calendar=new YM(this.currentDate.year,this.currentDate.monthNumber,this.effectiveLang),this.formatDate=NM(this.currentDate.Date).format(this.format),this.syncValueAttribute(NM(this.currentDate.Date).format(XM)),this.updateHeaderText(),this.monthList=this.getMonthDaysGrid()):this.allowEmpty?this.clearToEmpty(!1):this.resetToDefaultDate()}clearToEmpty(e){const t=NM();this.currentDate=new GM(t.toDate(),this.effectiveLang),this.calendar&&(this.calendar.goToDate(this.currentDate.monthNumber,this.currentDate.year),this.updateHeaderText(),this.monthList=this.getMonthDaysGrid()),this.formatDate="",this.syncValueAttribute(""),e&&this.$emit("value-changed",void 0)}updateHeaderText(){this.currentMonth=this.calendar.month.name,this.currentYear=this.calendar.year}visibleChanged(e,t){this.inlineCalendar||(t?(document.addEventListener("mousedown",this.clickOutside),document.addEventListener("keydown",this.keydownOutside)):(document.removeEventListener("mousedown",this.clickOutside),document.removeEventListener("keydown",this.keydownOutside)))}handleKeydownOutside(e){!this.inlineCalendar&&this.visible&&"Escape"===e.key&&(e.preventDefault(),this.closeCalendar())}handleClickOutside(e){!this.inlineCalendar&&this.visible&&kx(e,this)&&this.closeCalendar()}closeCalendar(){this.visible&&(this.visible=!1,this.toggleVisibility())}toggleCalendar(){this.visible=!this.visible,this.toggleVisibility(),this.isCurrentCalendarMonth()||(this.calendar.goToDate(this.currentDate.monthNumber,this.currentDate.year),this.updateHeaderText())}toggleVisibility(){this.calendarDropdownClasses=Jt(["visible",this.visible],this.position,["inline",this.inlineCalendar],["hide-weekends",this.hideWeekends])}isSelectedDate(e){return!(this.allowEmpty&&!QM(this.value))&&NM(e.Date).isSame(this.currentDate.Date,"day")}isCurrentCalendarMonth(){return this.currentMonth===this.currentDate.monthNumber&&this.currentYear===this.currentDate.year}prevMonth(){this.calendar.goToPreviousMonth(),this.updateHeaderText(),this.monthList=this.getMonthDaysGrid()}nextMonth(){this.calendar.goToNextMonth(),this.updateHeaderText(),this.monthList=this.getMonthDaysGrid()}selectDay(e){NM(e.Date).isSame(this.currentDate.Date,"day")&&QM(this.value)||(this.currentDate=e,e.monthNumber!==this.calendar.month.number&&this.prevMonth(),this.formatDate=NM(this.currentDate.Date).format(this.format),this.syncValueAttribute(NM(e.Date).format(XM)),this.$emit("value-changed",this.value),this.toggleCalendar())}getMonthDaysGrid(){const e=this.calendar.month.getDay(1),t=this.calendar.getPreviousMonth(),i=e.dayNumber-1,o=this.calendar.month.numberOfDays+i,c=Array.from({length:o});for(let e=i;e<o;e+=1)c[e]=this.calendar.month.getDay(e+1-i);for(let e=0;e<i;e+=1){const o=i-(e+1);c[e]=t.getDay(t.numberOfDays-o)}return c}}Nu([re],tw.prototype,"format",void 0),Nu([re],tw.prototype,"lang",void 0),Nu([re({attribute:"use-locale-format",mode:"boolean"})],tw.prototype,"useLocaleFormat",void 0),Nu([re],tw.prototype,"visible",void 0),Nu([re({attribute:"inline-calendar",mode:"boolean"})],tw.prototype,"inlineCalendar",void 0),Nu([re({attribute:"hide-weekends",mode:"boolean"})],tw.prototype,"hideWeekends",void 0),Nu([re],tw.prototype,"position",void 0),Nu([re],tw.prototype,"label",void 0),Nu([re({attribute:"allow-empty",mode:"boolean"})],tw.prototype,"allowEmpty",void 0),Nu([re],tw.prototype,"placeholder",void 0),Nu([re],tw.prototype,"value",void 0),Nu([g],tw.prototype,"currentDate",void 0),Nu([g],tw.prototype,"currentMonth",void 0),Nu([g],tw.prototype,"currentYear",void 0),Nu([g],tw.prototype,"calendarDropdownClasses",void 0),Nu([g],tw.prototype,"formatDate",void 0),Nu([g],tw.prototype,"monthList",void 0),Nu([g],tw.prototype,"disabledDaysOfWeek",void 0),Nu([g],tw.prototype,"calendar",void 0),tw.compose(Object.assign({baseName:"date-picker",styles:CM,template:wM,shadowOptions:void 0},{}));class iw{constructor(){this.value=null}}Nu([g],iw.prototype,"value",void 0),new iw;const ow=(e,t,i)=>{const o=i?(e,t)=>e.setValueFor(i,t):(e,t)=>e.withDefault(t);Object.keys(e).forEach(i=>{const c=`${i}Value`;t[c]&&o(e[i],t[c])})};function cw(e){return(t,i)=>{t[i+"Changed"]=function(t,i){null!=i?e.setValueFor(this,i):e.deleteValueFor(this)}}}const sw={toView:e=>null==e?null:null==e?void 0:e.toColorString(),fromView(e){if(null==e)return null;const t=Fa(e);return t?Va.create(t.r,t.g,t.b):null}},nw=e=>Wa.from(Va.from(Fa(e)));Va.create(1,1,1),Va.create(0,0,0);const aw=Fa("#585858"),rw=Va.create(aw.r,aw.g,aw.b),lw=Fa("#ffffff"),dw=Va.create(lw.r,lw.g,lw.b),hw=Wa.from(dw),uw=Fa("#eeeeee"),pw=Va.create(uw.r,uw.g,uw.b);Wa.from(pw);const fw=Fa("#08c3a5"),mw=Va.create(fw.r,fw.g,fw.b);Wa.from(mw);const{create:gw}=vc,vw=gw("fui-fill-color").withDefault(rw),bw=gw({name:"card-fill-color",cssCustomPropertyName:"fui-card-fill-color"}).withDefault(dw);function yw(e,t){return e.colorContrast(t,14)}const zw=gw({name:"card-foreground-color",cssCustomPropertyName:"fui-card-foreground-color"}).withDefault(e=>yw(gw("fui-card-palette").withDefault(hw).getValueFor(e),bw.getValueFor(e)));var xw=Object.freeze({__proto__:null,fuiFillColor:vw,fuiCardFillColor:bw,defaultNeutralForegroundContrast:14,neutralForeground:yw,fuiCardForegroundColor:zw,accentFillActive:Al,accentFillActiveDelta:Dr,accentFillFocus:Ol,accentFillFocusDelta:Fr,accentFillHover:Nl,accentFillHoverDelta:Ir,accentFillRest:El,accentFillRestDelta:Rr,accentForegroundActive:Yl,accentForegroundActiveDelta:Pr,accentForegroundFocus:Kl,accentForegroundFocusDelta:Vr,accentForegroundHover:Wl,accentForegroundHoverDelta:Hr,accentForegroundRest:Gl,accentForegroundRestDelta:_r,accentPalette:pl,baseHeightMultiplier:nr,baseLayerLuminance:rr,bodyFont:sr,controlCornerRadius:lr,density:dr,designUnit:hr,direction:ur,disabledOpacity:pr,fillColor:kl,focusStrokeInner:xd,focusStrokeOuter:yd,focusStrokeWidth:mr,foregroundOnAccentActive:Fl,foregroundOnAccentActiveLarge:Bl,foregroundOnAccentFocus:_l,foregroundOnAccentFocusLarge:Ul,foregroundOnAccentHover:Dl,foregroundOnAccentHoverLarge:Vl,foregroundOnAccentRest:Il,foregroundOnAccentRestLarge:Pl,neutralFillActive:Jl,neutralFillActiveDelta:jr,neutralFillFocus:ed,neutralFillFocusDelta:qr,neutralFillHover:Xl,neutralFillHoverDelta:Ur,neutralFillInputActive:cd,neutralFillInputActiveDelta:Yr,neutralFillInputFocus:sd,neutralFillInputFocusDelta:Kr,neutralFillInputHover:od,neutralFillInputHoverDelta:Wr,neutralFillInputRest:id,neutralFillInputRestDelta:Gr,neutralFillLayerRest:vd,neutralFillLayerRestDelta:cl,neutralFillRest:Ql,neutralFillRestDelta:Br,neutralFillStealthActive:ld,neutralFillStealthActiveDelta:Xr,neutralFillStealthFocus:dd,neutralFillStealthFocusDelta:Jr,neutralFillStealthHover:rd,neutralFillStealthHoverDelta:Qr,neutralFillStealthRest:ad,neutralFillStealthRestDelta:Zr,neutralFillStrongActive:fd,neutralFillStrongActiveDelta:il,neutralFillStrongFocus:md,neutralFillStrongFocusDelta:ol,neutralFillStrongHover:pd,neutralFillStrongHoverDelta:tl,neutralFillStrongRest:ud,neutralFillStrongRestDelta:el,neutralForegroundHint:Ld,neutralForegroundRest:wd,neutralLayer1:yl,neutralLayer2:xl,neutralLayer3:Ll,neutralLayer4:wl,neutralLayerCardContainer:ml,neutralLayerFloating:vl,neutralPalette:hl,neutralStrokeActive:Ed,neutralStrokeActiveDelta:al,neutralStrokeDividerRest:Od,neutralStrokeDividerRestDelta:ll,neutralStrokeFocus:Nd,neutralStrokeFocusDelta:rl,neutralStrokeHover:$d,neutralStrokeHoverDelta:nl,neutralStrokeRest:Sd,neutralStrokeRestDelta:sl,strokeWidth:fr,typeRampBaseFontSize:gr,typeRampBaseLineHeight:vr,typeRampMinus1FontSize:br,typeRampMinus1LineHeight:yr,typeRampMinus2FontSize:zr,typeRampMinus2LineHeight:xr,typeRampPlus1FontSize:Cr,typeRampPlus1LineHeight:Lr,typeRampPlus2FontSize:Mr,typeRampPlus2LineHeight:wr,typeRampPlus3FontSize:kr,typeRampPlus3LineHeight:Sr,typeRampPlus4FontSize:$r,typeRampPlus4LineHeight:Er,typeRampPlus5FontSize:Nr,typeRampPlus5LineHeight:Ar,typeRampPlus6FontSize:Or,typeRampPlus6LineHeight:Tr});const Cw=nw("#08c3a5"),Lw=nw("#eeeeee"),Mw=tr,ww=zi.ltr;var kw=Object.freeze({__proto__:null,accentPaletteValue:Cw,neutralPaletteValue:Lw,baseLayerLuminanceValue:Mw,directionValue:ww,controlCornerRadiusValue:4,designUnitValue:4});
62
62
  /*!
63
63
  * Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
64
64
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)