@digital-realty/ui-user-management 12.0.5 → 12.0.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.
package/dist/sw.js CHANGED
@@ -1,2 +1,2 @@
1
- if(!self.define){let e,n={};const i=(i,r)=>(i=new URL(i+".js",r).href,n[i]||new Promise(n=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=n,document.head.appendChild(e)}else e=i,importScripts(i),n()}).then(()=>{let e=n[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(r,s)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(n[t])return;let f={};const u=e=>i(e,t),o={module:{uri:t},exports:f,require:u};n[t]=Promise.all(r.map(e=>o[e]||u(e))).then(e=>(s(...e),f))}}define(["./workbox-a523fd56"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"d89f572522c250fdce8f56d27a121caf"},{url:"ui-user-management.js",revision:"2fd170ea4f07ce59165e4f2fa078cc8b"},{url:"ui-user-management2.js",revision:"316ac10fe8019571dfa5a19b236f7851"},{url:"ui-user-management3.js",revision:"b20607b1c178e0996b0e050bb382822d"},{url:"ui-user-management4.js",revision:"2621a040807bc53b1b8f8bef6d26aab5"},{url:"ui-user-management5.js",revision:"1d60f32bc9923e5f21c4651eb85a6913"},{url:"ui-user-management6.js",revision:"dff5996f4bd4d7abc4f789a9fe302e3a"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")});
1
+ if(!self.define){let e,n={};const i=(i,r)=>(i=new URL(i+".js",r).href,n[i]||new Promise(n=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=n,document.head.appendChild(e)}else e=i,importScripts(i),n()}).then(()=>{let e=n[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(r,s)=>{const f=e||("document"in self?document.currentScript.src:"")||location.href;if(n[f])return;let t={};const u=e=>i(e,f),o={module:{uri:f},exports:t,require:u};n[f]=Promise.all(r.map(e=>o[e]||u(e))).then(e=>(s(...e),t))}}define(["./workbox-a523fd56"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"d89f572522c250fdce8f56d27a121caf"},{url:"ui-user-management.js",revision:"07086445f035503c243ff08f0fae5365"},{url:"ui-user-management2.js",revision:"316ac10fe8019571dfa5a19b236f7851"},{url:"ui-user-management3.js",revision:"b20607b1c178e0996b0e050bb382822d"},{url:"ui-user-management4.js",revision:"2621a040807bc53b1b8f8bef6d26aab5"},{url:"ui-user-management5.js",revision:"1d60f32bc9923e5f21c4651eb85a6913"},{url:"ui-user-management6.js",revision:"dff5996f4bd4d7abc4f789a9fe302e3a"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")});
2
2
  //# sourceMappingURL=sw.js.map
package/dist/sw.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sw.js","sources":["../../../../../../tmp/3910e9bd21c19cd61133ab033ef5ae5a/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"index.html\",\n \"revision\": \"d89f572522c250fdce8f56d27a121caf\"\n },\n {\n \"url\": \"ui-user-management.js\",\n \"revision\": \"2fd170ea4f07ce59165e4f2fa078cc8b\"\n },\n {\n \"url\": \"ui-user-management2.js\",\n \"revision\": \"316ac10fe8019571dfa5a19b236f7851\"\n },\n {\n \"url\": \"ui-user-management3.js\",\n \"revision\": \"b20607b1c178e0996b0e050bb382822d\"\n },\n {\n \"url\": \"ui-user-management4.js\",\n \"revision\": \"2621a040807bc53b1b8f8bef6d26aab5\"\n },\n {\n \"url\": \"ui-user-management5.js\",\n \"revision\": \"1d60f32bc9923e5f21c4651eb85a6913\"\n },\n {\n \"url\": \"ui-user-management6.js\",\n \"revision\": \"dff5996f4bd4d7abc4f789a9fe302e3a\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"inBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,aACPC,SAAY,oCAEd,CACED,IAAO,wBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
1
+ {"version":3,"file":"sw.js","sources":["../../../../../../tmp/0435046ffa4408252ef7cd8fced03a4c/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/home/vsts/work/1/s/ui-user-management/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"index.html\",\n \"revision\": \"d89f572522c250fdce8f56d27a121caf\"\n },\n {\n \"url\": \"ui-user-management.js\",\n \"revision\": \"07086445f035503c243ff08f0fae5365\"\n },\n {\n \"url\": \"ui-user-management2.js\",\n \"revision\": \"316ac10fe8019571dfa5a19b236f7851\"\n },\n {\n \"url\": \"ui-user-management3.js\",\n \"revision\": \"b20607b1c178e0996b0e050bb382822d\"\n },\n {\n \"url\": \"ui-user-management4.js\",\n \"revision\": \"2621a040807bc53b1b8f8bef6d26aab5\"\n },\n {\n \"url\": \"ui-user-management5.js\",\n \"revision\": \"1d60f32bc9923e5f21c4651eb85a6913\"\n },\n {\n \"url\": \"ui-user-management6.js\",\n \"revision\": \"dff5996f4bd4d7abc4f789a9fe302e3a\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"inBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,aACPC,SAAY,oCAEd,CACED,IAAO,wBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
@@ -2002,4 +2002,4 @@ video {
2002
2002
  width: 100%;
2003
2003
  }
2004
2004
  }
2005
- `;class nt{}nt.BTN_ADD_ROLE="user-details-tab-roles-btn-add-role",nt.BTN_REMOVE_ROLE="user-details-tab-roles-btn-remove-role";const Rt={RoleSelect:"role-select",OpenRoleMenu:"open-role-menu",RemoveRoleMenu:"open-remove-role-menu"};let X=class extends I{constructor(){super(...arguments),this.disableEscapeKeyBinding=this.disableEscapeKey.bind(this),this.assignedRoles=[],this.activeRoleId="",this.canAddRoles=!1,this.addRolesDisabled=!1,this.canRemoveRoles=!1,this.removeRolesDisabled=!1}connectedCallback(){super.connectedCallback(),this.tabs&&this.tabs.addEventListener("keydown",this.disableEscapeKeyBinding)}disconnectedCallback(){super.disconnectedCallback(),this.tabs&&this.tabs.removeEventListener("keydown",this.disableEscapeKeyBinding)}disableEscapeKey(e){return e.which===27?!1:null}handleRoleClick(e,t){this.dispatchEvent(new CustomEvent(Rt.RoleSelect,{detail:{roleId:t},bubbles:!0,composed:!0})),e.target.scrollIntoView({inline:"center",behavior:"smooth",block:"nearest"})}dispatchOpenRoleMenu(){this.dispatchEvent(new CustomEvent(Rt.OpenRoleMenu,{bubbles:!0,composed:!0}))}dispatchOpenRemoveRoleMeu(){this.dispatchEvent(new CustomEvent(Rt.RemoveRoleMenu,{bubbles:!0,composed:!0}))}setActiveRole(e){this.tabs&&(this.tabs.activeTabIndex=this.assignedRoles.findIndex(t=>t.id===e))}renderAddRoleButton(){return this.canAddRoles?l` <ix-button data-testid="${nt.BTN_ADD_ROLE}" appearance="text" @click="${()=>this.dispatchOpenRoleMenu()}" class="primary" aria-label="Add Role" ?disabled="${this.addRolesDisabled}" has-icon> <md-icon slot="icon">add</md-icon> Add Role </ix-button> `:x}renderRemoveRoleButton(){return this.canRemoveRoles?l` <ix-button data-testid="${nt.BTN_REMOVE_ROLE}" appearance="outlined" .disabled="${this.removeRolesDisabled}" @click="${()=>this.dispatchOpenRemoveRoleMeu()}" class="cancel"> <span>REMOVE ROLE</span> </ix-button> `:x}renderRole(e){return e?l`<ix-primary-tab data-testid="ix-tab-role-${e.id}" @click="${t=>this.handleRoleClick(t,e.id)}" ?activeDisabled="${e.id===this.activeRoleId}"><span id="${`role-tab-${e.id}`}" class="font-bold flex items-center uppercase">${e.name}</span> </ix-primary-tab>`:x}render(){return l` <div class="tab-container"> <div class="flex gap-4 max-w-full overflow-hidden tab-outer-wrapper"> <div class="flex-1 overflow-auto tab-inner-wrapper"> <ix-tabs data-testid="ix-tabs-roles" id="roles-tabs" .scrollButtons="${this.assignedRoles.length>1}" hideScrollBar left-align="true"> ${this.assignedRoles.map(e=>this.renderRole(e))} </ix-tabs> </div> <div class="flex items-center gap-4 shrink-0 tab-inner-wrapper"> ${this.renderAddRoleButton()} ${this.renderRemoveRoleButton()} </div> </div> </div> `}};X.styles=[tt,ot,A,ue,As],s([d({type:Array,attribute:!1})],X.prototype,"assignedRoles",void 0),s([d({type:String,attribute:!1})],X.prototype,"activeRoleId",void 0),s([d({type:Boolean})],X.prototype,"canAddRoles",void 0),s([d({type:Boolean})],X.prototype,"addRolesDisabled",void 0),s([d({type:Boolean})],X.prototype,"canRemoveRoles",void 0),s([d({type:Boolean})],X.prototype,"removeRolesDisabled",void 0),s([N("#roles-tabs")],X.prototype,"tabs",void 0),X=s([b("user-details-tab-roles")],X);const Lo=e=>U.getAccounts().find(t=>t.accountNumber===e),Oo=(e,t)=>{const o=e.filter(i=>i.parentAccountNumber===t);return o.length?o.flatMap(i=>({id:i.accountNumber,name:i.name,displayName:i.displayName,subaccounts:Oo(e,i.accountNumber)})):[]},at=e=>{try{const t=e.map(i=>i.accountNumber),o=e.filter(i=>!t.includes(i.parentAccountNumber||""));if(!o)throw new Error("Failed to get nested account structure");return o.map(i=>({id:i.accountNumber,name:i.name,displayName:i.displayName,subaccounts:Oo(e,i.accountNumber)}))}catch(t){return console.error("Could not get nested account structure",t),[]}},St=()=>U.getAccounts().sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:"base"})),zo=e=>me.get().find(t=>t.id===e)||null,Cs=e=>{const t=[],o=[...new Set(e.map(i=>i.roleId))];for(const i of o){const n=zo(i);n&&t.push(n)}return t},qo=e=>{var t;return{label:(t=e.displayName)!==null&&t!==void 0?t:e.name,id:e.id,children:e.subaccounts.map(o=>qo(o))}},Ho=(e,t)=>{e.children&&e.children.length&&e.children.forEach(i=>Ho(i,t));const o=t.filter(i=>e.id===i.accountNumber).map(i=>({label:i.name,id:i.id,children:void 0}));e.children&&(e.children=o.concat(e.children))},Ts=e=>{const t=[],o=St().filter(r=>M.hasCustomRolesRead(r.accountNumber)||M.hasCustomRolesCreate(r.accountNumber)||M.hasCustomRolesUpdate(r.accountNumber)||M.hasCustomRolesApprove(r.accountNumber)),i=at(o);i.forEach(r=>t.push(qo(r)));const n=me.get().filter(r=>r.roleType===V.Custom);t.forEach(r=>{Ho(r,n),r.expanded=e.includes(r.id)});const a=i.some(r=>!!r.subaccounts.length);return{tree:{label:"root",id:"root",children:t},isEndChild:!a&&o.length<=1}},Ut=(e,t,o=!1)=>{let i=t.filter(n=>n.accountNumber===e||n.roleType===V.Default||n.roleType===V.Internal||n.roleType===V.GlobalAccess);return o||(i=i.filter(n=>n.roleType!==V.Internal&&n.roleType!==V.GlobalAccess)),i};class J{}J.HEADING="add-account-role-dialog-heading",J.ROLE_SELECTOR="add-account-role-dialog-role-selector",J.ROLE_OPTION=e=>`add-account-role-dialog-role-option-${e}`,J.BTN_CANCEL="add-account-role-dialog-cancel-button",J.BTN_ADD="add-account-role-dialog-add-role-button",J.SUCCESS_MESSAGE="add-account-role-dialog-success-message";function Le(e){return P().InternalUserDomainWhitelist.split(",").some(t=>e==null?void 0:e.includes(t))}let j=class extends I{constructor(){super(...arguments),this.roles=[],this.assignedRoles=[],this.isOpen=!1,this.loading=!1,this.roleId="",this.disabled=!0,this.handleEscapeKeyBinding=this.handleEscapeKey.bind(this),this.handleCancelChangesBinding=this.handleCancelChanges.bind(this)}get name(){var e,t;return`${(e=this.contact)===null||e===void 0?void 0:e.firstName} ${(t=this.contact)===null||t===void 0?void 0:t.lastName}`}get addableRoles(){var e,t,o;if(!(!((e=this.account)===null||e===void 0)&&e.accountNumber))return[];const i=Le((t=this.contact)===null||t===void 0?void 0:t.email)&&M.hasAssignInternalRoleCreate((o=this.account)===null||o===void 0?void 0:o.accountNumber);return Ut(this.account.accountNumber,this.roles,i)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleEscapeKeyBinding),this.addEventListener("blur",this.handleCancelChangesBinding)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleEscapeKeyBinding),this.removeEventListener("blur",this.handleCancelChangesBinding)}handleEscapeKey(e){return e.which===27&&(this.isOpen=!1),null}async handleOpenDialog(){this.isOpen=!0;const e=await this.rolesMenu;e==null||e.reset(),this.disabled=!0}async handleConfirmChanges(){this.dispatchEvent(new CustomEvent(_.AddRole,{detail:{roleId:this.roleId}}))}async handleCancelChanges(){this.isOpen=!1}handleRoleSelect(e){e&&(this.disabled=!1)}renderRoleOptions(){return l` ${this.addableRoles.map((e,t)=>l` <ix-select-option class="option" value="${t}" ?disabled="${this.assignedRoles.some(o=>o.id===e.id)}" @click="${()=>{this.roleId=this.addableRoles[t].id}}" data-testid="${J.ROLE_OPTION(e.name)}"> <div slot="headline">${e.name}</div> </ix-select-option>`)} `}renderHeader(){var e;return l` <div id="confirmation-header" slot="headline" style="max-width:560px" data-testid="${J.HEADING}"> <h1 class="dlr-text-heading break-words"> Add Role to ${this.name} for ${(e=this.account)===null||e===void 0?void 0:e.name} </h1> </div>`}renderContent(){return l` <div slot="content" method="dialog"> <form slot="content" style="padding-top:0" id="add-role-to-roles" method="dialog"> <ix-select quick menu-below class="thick" id="roles-menu" menu-positioning="fixed" @input="${e=>this.handleRoleSelect(e.target.value)}" data-testid="${J.ROLE_SELECTOR}"> ${this.renderRoleOptions()} </ix-select> </form> </div>`}renderFooter(){return l` <div class="add-roles-dialog-actions" slot="actions"> <ix-button form="confirm-updates" appearance="text" text="Cancel" ?disabled="${this.loading}" @click="${()=>this.handleCancelChanges()}" data-testid="${J.BTN_CANCEL}"> Cancel </ix-button> <ix-button id="add-account-button" form="confirm-updates" appearance="text" text="Add Role" ?disabled="${this.disabled}" ?submitting="${this.loading}" @click="${this.handleConfirmChanges}" data-testid="${J.BTN_ADD}">Add Role </ix-button> </div> `}render(){return l` <ix-dialog class="z-50 relative" id="add-role-to-account" ?open="${this.isOpen}"> ${this.renderHeader()} ${this.renderContent()} ${this.renderFooter()} </ix-dialog>`}};j.styles=[tt,ot,A],s([d({type:Object})],j.prototype,"contact",void 0),s([d({type:Object})],j.prototype,"account",void 0),s([d({type:Array})],j.prototype,"roles",void 0),s([d({type:Array})],j.prototype,"assignedRoles",void 0),s([d({type:Boolean,reflect:!0})],j.prototype,"isOpen",void 0),s([u()],j.prototype,"loading",void 0),s([u()],j.prototype,"roleId",void 0),s([u()],j.prototype,"disabled",void 0),s([ai("#roles-menu")],j.prototype,"rolesMenu",void 0),j=s([b("add-account-role")],j);const $t=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.cards-container{display:flex;flex-wrap:wrap}.cards-container>:first-child{padding:8px 8px 8px 0}.cards-container>:not(:first-child){padding:8px}.tree-role-locations-count{margin:0;color:rgba(9,34,65,.3);padding-right:20px;text-transform:uppercase;font-weight:700}.tree-role-locations-count-active{margin:0;padding-right:40px;text-transform:uppercase;font-weight:700;font-size:.875rem;font-family:var(--root-secondary-font)}.assign-portal-access-text{font-family:Open Sans;font-weight:400;font-size:12px;line-height:16px;letter-spacing:.4px;color:#092241B2;margin-top:.25rem;margin-bottom:1rem}ix-button{font-family:var(--root-secondary-font)}.remove{color:#db0028}.permissions-content{width:800px}.dismiss-btn{color:#1456e0}@media only screen and (max-width:600px){#next-button{display:inline-block}.next-control{text-align:center}.tree-view-container-footer{padding-bottom:1rem}.permissions-content{width:auto}.cards-container{display:flex;flex-wrap:nowrap;max-width:100%;overflow-x:auto}}@media only screen and (min-width:601px){.permissions-locations{display:flex;justify-content:space-between;align-items:center;width:100%}.controls{display:flex;justify-content:space-between;align-items:center}}@media only screen and (max-width:600px){.cards-container{flex-wrap:unset;overflow-x:auto}.tree-role-locations{margin-top:-3px!important}.tree-role-locations-count,.tree-role-locations-count-active{font-size:.875rem!important}}`,Is={ToggleActiveCard:"toggle-active-card"};let _e=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.isRoles=!1}dispatchToggleActiveCard(e){this.dispatchEvent(new CustomEvent(Is.ToggleActiveCard,{detail:{accountId:e},bubbles:!0,composed:!0}))}renderCards(){return this.dataForAccounts.map(e=>{if(this.isRoles){const o=e.rolesData.filter(i=>i.role.removed===!1).map(i=>i.role.name);return l` <ix-card data-testid="ix-card-${e.accountId}" .itemId="${e.accountId}" .name="${e.accountName}" .names="${o}" .type="${"roles"}" ?isActive="${this.selectedAccountId===e.accountId}" @toggle-card="${i=>{this.dispatchToggleActiveCard(i.detail)}}"></ix-card> `}const t=ne.map(o=>o.text);return l` <ix-card data-testid="ix-card-${e.accountId}" .itemId="${e.accountId}" .name="${e.accountName}" .names="${t}" .type="${"flags"}" .isActive="${this.selectedAccountId===e.accountId}" @toggle-card="${o=>{this.dispatchToggleActiveCard(o.detail)}}"></ix-card> `})}render(){return l`<div class="cards-container">${this.renderCards()}</div> `}};_e.styles=[$t,A,Ee,ue],s([d({type:Array})],_e.prototype,"dataForAccounts",void 0),s([d({type:String})],_e.prototype,"selectedAccountId",void 0),s([d({type:Boolean})],_e.prototype,"isRoles",void 0),_e=s([b("account-tabbing-card")],_e);class st{constructor(){this.updates=[]}get nodeUpdates(){return this.updates}update(t){this.updates=[];let o=[];t&&(o=yi(t));for(const i of o)i.originalCheckedStatus!==i.checked&&this.updates.push(i)}}class Vo{constructor(){this._nodeUpdates=[]}create(t){if(this._nodeUpdates.find(i=>i.key===t))return;const o=new st;this._nodeUpdates.push({key:t,item:o})}update(t,o){const i=this._nodeUpdates.find(n=>n.key===t);i==null||i.item.update(o)}get nodeUpdates(){return this._nodeUpdates}get isDirty(){let t=0;return this._nodeUpdates.forEach(o=>{t+=o.item.nodeUpdates.length}),t>0}get nodeChanges(){const t=[];return this._nodeUpdates.forEach(o=>{o.item.nodeUpdates.length>0&&o.item.nodeUpdates.forEach(i=>{const n=t.find(a=>a.key===o.key);n?n.items.push(i):t.push({key:o.key,items:[i]})})}),t}reset(){this._nodeUpdates=[]}remove(t){this._nodeUpdates=this._nodeUpdates.filter(o=>o.key!==t)}}function Nt(e,t){var o,i;const n=[],a=t.toLowerCase().trim();if(a.length<2||((!((o=e.label)===null||o===void 0)&&o.toLowerCase().includes(a)||!((i=e.secondaryLabel)===null||i===void 0)&&i.toLowerCase().includes(a))&&n.push(e),!e.children))return n;for(const r of e.children){const c=Nt(r,t);n.push(...c)}return n}function jo(e,t,o){if(e==="previous"){const i=o.indexOf(t)-1,n=i<0?o.length-1:i;return o[n]}if(e==="next"){const i=o.indexOf(t)+1,n=i>=o.length?0:i;return o[n]}}function Go(e,t){const o=[];for(const i of t){o.push(i.id),i.selected=!0;let n=He(e,i.id);for(;n!=null&&n.parentId;)n=He(e,n.parentId),n&&(n.expanded=!0)}return o}function Ft(e){e.selected=!1,e.children&&e.children.forEach(t=>{Ft(t)})}class _s{constructor(){this._dataCollection=new Map}capture(t){var o;let i;const n=this._dataCollection.get(t);return n&&(i=xo(n.data),!((o=n.options)===null||o===void 0)&&o.consume&&this._dataCollection.delete(t)),i}emit(t,o){o.options={lock:!1,consume:!0,...o.options},this._store(t,o)}lock(t){const o=this._dataCollection.get(t);o&&(o.options.lock=!0)}remove(t){this._dataCollection.delete(t)}_store(t,o){var i;const n=this._dataCollection.get(t);return n&&!((i=n.options)===null||i===void 0)&&i.lock?!1:(this._dataCollection.set(t,xo(o)),!0)}}const rt=new _s;class ks extends Te{}const Dt=new ks({});let F=class extends I{constructor(){super(...arguments),this.searching=!1,this.disableTree=!1,this.readonly=!1,this.activeRoleId="",this.searchResultCount=0,this.searchResultIndex=0,this.selectedIds=[],this.loadingNodes=!1,this.assignmentUpdateManagers=[],this.searchText="",this.onSearchTextChange=Zt(async e=>{var t;this.searchText=e.detail.searchText;const o=(t=this.assignment)===null||t===void 0?void 0:t.rootNode;Ft(o);const i=Nt(o,this.searchText);i.length&&Ve(o),this.searchResultCount=i.length;const n=Go(o,i);[this.selectedId]=n,this.selectedIds=[...n],this.searchResultIndex=n.indexOf(this.selectedId)+1,this.requestUpdate()},500)}updated(e){super.updated(e),e.has("activeRoleId")&&this.handleNonLocationTrees()}disconnectedCallback(){super.disconnectedCallback(),this.emitUpdates()}emitUpdates(){var e,t;const o=Dt.get(),i=(e=this.assignmentUpdateManagers.find(c=>c.accountId===o.accountNumber))===null||e===void 0?void 0:e.nodeManager,n=i==null?void 0:i.nodeUpdates.flatMap(c=>c.item.nodeUpdates);if(!(o!=null&&o.accountNumber)&&!i)return;const a={data:n||[],options:{consume:!1}},r=`${o.accountNumber}:${(t=this.contact)===null||t===void 0?void 0:t.id}`;rt.emit(r,a)}dispatchCheckToggleEvent(e){this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{updates:structuredClone(e)}}}))}handleNonLocationTrees(){const e=me.get().find(n=>{var a;return n.id===((a=this.assignment)===null||a===void 0?void 0:a.role)});if(!e||!this.assignment)return;if(!e.permissions.every(n=>n.isNonLocation)){this.disableTree=!1;return}const t=this.assignment.rootNode.children[0];t.checked=!0,this.disableTree=!0,fe(t,this.assignment.rootNode);const o=this.getOrCreateNodeManager();if(!o)return;const i=o.nodeUpdates.find(n=>{var a;return n.key===((a=this.assignment)===null||a===void 0?void 0:a.role)});i&&(i.item.update(this.assignment.rootNode),this.dispatchCheckToggleEvent(o.nodeChanges))}onTreeCheckToggle(e){var t;try{const o=this.getOrCreateNodeManager();if(!o)throw new Error("Node manager is missing.");const i=o.nodeUpdates.find(n=>{var a;return n.key===((a=this.assignment)===null||a===void 0?void 0:a.role)});i&&i.item.update(e.detail.message.rootNode),!((t=this.assignment)===null||t===void 0)&&t.rootNode&&(this.assignment.rootNode=structuredClone(e.detail.message.rootNode)),this.dispatchCheckToggleEvent(o.nodeChanges)}catch(o){g.handleError(o,"Failed to toggle tree check.")}}async onTreeExpandToggle(e){var t,o;try{const i=e.detail.message.update,n=e.detail.message.node;if(n.children&&n.children.length)return;if(!this.contact.id||!this.accountNumber)throw new Error("Contact ID or Account Number is missing.");n.loading=!0;const a=await Xa((t=this.assignment)===null||t===void 0?void 0:t.role,this.contact.id,this.accountNumber,n.id,void 0,!0,Le((o=this.contact)===null||o===void 0?void 0:o.email));n.loading=!1,a[0].inventoryItems&&a[0].inventoryItems.length&&(a[0].inventoryItems.forEach(r=>{ce(r,n),n.originalCheckedStatus!==n.checked&&fe(n,n)}),i())}catch(i){g.handleError(i,"Failed to expand tree node.")}}destroyRoleManager(){const e=this.assignmentUpdateManagers.find(t=>t.accountId===this.accountNumber);e&&(e.nodeManager.reset(),this.assignmentUpdateManagers=this.assignmentUpdateManagers.filter(t=>t.accountId!==this.accountNumber))}getOrCreateNodeManager(){var e;let t;try{if(!this.accountNumber)throw new Error("Account number is missing.");t=(e=this.assignmentUpdateManagers.find(o=>o.accountId===this.accountNumber))===null||e===void 0?void 0:e.nodeManager,t||(this.assignmentUpdateManagers.push({accountId:this.accountNumber,nodeManager:new Vo}),t=this.assignmentUpdateManagers.find(o=>o.accountId===this.accountNumber).nodeManager)}catch(o){g.handleError(o,"Failed to get or create node manager.")}return t}disableCheckboxes(){return this.readonly?!0:this.disableTree}onSearchNavigation(e){if(!this.selectedIds.length)return;const t=jo(e.detail.direction,this.selectedId,this.selectedIds);this.selectedId=t!=null?t:this.selectedId,this.searchResultIndex=this.selectedIds.indexOf(this.selectedId)+1,this.requestUpdate()}render(){var e;const t=this.getOrCreateNodeManager();return t&&this.assignment&&t.create(this.assignment.role),l` <div class="flex items-center py-[0.75rem]"> <h1 class="dlr-text-heading">Portal Access</h1> <ix-progress .linear="${!1}" .indeterminate="${!0}" style="visibility:${this.searching?"visible":"hidden"}"></ix-progress> </div> <ix-generic-tree data-testid="location-treeview" .rootNode="${(e=this.assignment)===null||e===void 0?void 0:e.rootNode}" .searchText="${this.searchText}" .selectedId="${this.selectedId}" .showCheckboxes="${!0}" .disableCheckboxes="${this.disableCheckboxes()}" @search-text-change="${this.onSearchTextChange}" @search-navigation="${o=>this.onSearchNavigation(o)}" @check-toggle="${o=>this.onTreeCheckToggle(o)}" @expand-toggle="${o=>this.onTreeExpandToggle(o)}" searchEnabled .searchResultCount="${this.searchResultCount}" .searchResultIndex="${this.searchResultIndex}" searchPlaceholder="Search by Site or Asset Name.."></ix-generic-tree> `}};F.styles=[A,E`:host{--md-circular-progress-size:28px}`],s([d({type:Object,attribute:!1})],F.prototype,"assignment",void 0),s([d({type:Object})],F.prototype,"contact",void 0),s([d({type:String})],F.prototype,"accountNumber",void 0),s([d({type:String})],F.prototype,"selectedId",void 0),s([d({type:Boolean})],F.prototype,"searching",void 0),s([d({type:Boolean})],F.prototype,"disableTree",void 0),s([d({type:Boolean})],F.prototype,"readonly",void 0),s([d({type:String})],F.prototype,"activeRoleId",void 0),s([u()],F.prototype,"searchResultCount",void 0),s([u()],F.prototype,"searchResultIndex",void 0),s([u()],F.prototype,"selectedIds",void 0),s([u()],F.prototype,"loadingNodes",void 0),s([u()],F.prototype,"assignmentUpdateManagers",void 0),s([u()],F.prototype,"searchText",void 0),F=s([b("user-details-assignments")],F);let D=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.permissions=[],this._dataForAccounts=[],this.showPermissionsDialog=!1,this.removeRoleDialogOpen=!1,this._nextButtonEnabled=!1}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._selectedAccountId=this.selectedAccountId,this._selectedRoleId=this.selectedRoleId,this.validateStep(),this.dispatchValidateStepEvent(),this.setInitialRole()}get noOfLocations(){var e;return jt((e=this.selectedRoleData)===null||e===void 0?void 0:e.genericTreeView)}get canAddRolesDisabled(){return this.unAvailableRoles&&this.unAvailableRoles.length<=0}get availableRoles(){const e=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.filter(o=>o.role.removed===!1);return t==null?void 0:t.flatMap(o=>o.role)}get unAvailableRoles(){const e=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.filter(o=>o.role.removed===!0);return t==null?void 0:t.flatMap(o=>o.role)}get roles(){const e=this._dataForAccounts.find(t=>t.accountId===this._selectedAccountId);return e==null?void 0:e.rolesData.flatMap(t=>t.role)}get selectedAccount(){return this._dataForAccounts.find(e=>e.accountId===this._selectedAccountId)}get selectedRole(){return this.selectedAccount.rolesData.find(e=>e.role.id===this._selectedRoleId).role}get selectedRolePermissions(){var e,t;return(t=(e=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId))===null||e===void 0?void 0:e.rolesData.find(o=>o.role.id===this._selectedRoleId))===null||t===void 0?void 0:t.role.permissions}get selectedRoleData(){return this.selectedAccount.rolesData.find(e=>e.role.id===this._selectedRoleId)}toggleActiveCard(e){var t;this._selectedAccountId=e,this._selectedRoleId=(t=this._dataForAccounts.find(o=>o.accountId===e))===null||t===void 0?void 0:t.rolesData[0].role.id,this._dataForAccounts.forEach(o=>{o.accountId!==e?o.active=!1:o.active=!0}),this.roleTabComponent.setActiveRole(this._selectedRoleId),this.setInitialRole(),this.requestUpdate()}setInitialRole(){this.availableRoles&&this.availableRoles.length>0&&(this._selectedRoleId=this.availableRoles[0].id)}dispatchOpenAddAccountRole(){this.addRoleDialog.handleOpenDialog()}dispatchTabControl(e){this._selectedRoleId=this.roles[e].id,this.roleTabComponent.setActiveRole(this._selectedRoleId)}addRole(e){var t;const o=this.selectedAccount.rolesData.findIndex(i=>i.role.id===e);if(this.selectedAccount.rolesData[o].role.permissions.every(i=>i.isNonLocation)){const i=this.selectedAccount.rolesData[o].genericTreeView;if(!(!((t=i==null?void 0:i.children)===null||t===void 0)&&t.length))return;const n=i.children[0];n.checked=!0,fe(n,i),this.selectedAccount.rolesData[o].locations.push(n)}else this.selectedAccount.rolesData[o].locations=[];this.selectedAccount.rolesData[o].role.removed=!1,this.requestUpdate(),this.dispatchTabControl(o),this.addRoleDialog.handleCancelChanges()}dispatchRemoveRoleEvent(){const e=this.roles.findIndex(o=>o.id===this._selectedRoleId);this.roles[e].removed=!0;const t=this.selectedAccount.rolesData.findIndex(o=>o.role.id===this._selectedRoleId);this.selectedAccount.rolesData[t].locations=[],this.selectedAccount.rolesData[t].role.removed=!0,this.selectedAccount.rolesData[t].genericTreeView&&At(this.selectedAccount.rolesData[t].genericTreeView),this.validateStep(),this.setInitialRole(),this.requestUpdate()}renderTree(){const e=this._dataForAccounts.find(n=>n.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.find(n=>n.role.id===this._selectedRoleId);if(!t)return x;const o={role:t.role.id,rootNode:t.genericTreeView},i=n=>{this.requestUpdate();const{updates:a}=n.detail.message,r=a.find(c=>c.key===t.role.id);r!=null&&r.items?t.locations=r.items.filter(c=>c.checked):t.locations=[],this.validateStep(),this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()};if(o&&o.rootNode){const n=t==null?void 0:t.role.permissions.every(a=>a.isNonLocation);return l`<user-details-assignments .assignment="${o}" .contact="${this.contact}" .accountNumber="${e==null?void 0:e.accountId}" @check-toggle="${i}" ?disableTree="${n}"></user-details-assignments>`}return x}validateStep(){let e=!0;for(const t of this._dataForAccounts)if(!t.rolesData.filter(o=>o.role.removed===!1).every(o=>o.locations.length)){e=!1;break}this._nextButtonEnabled=e}renderRoles(){var e,t;return l` <user-details-tab-roles id="role-data-element" .assignedRoles="${this.availableRoles}" .activeRoleId="${(e=this._selectedRoleId)!==null&&e!==void 0?e:""}" .canRemoveRoles="${!0}" .removeRolesDisabled="${((t=this.availableRoles)===null||t===void 0?void 0:t.length)<=1}" .canAddRoles="${!0}" .addRolesDisabled="${this.canAddRolesDisabled}" @role-select="${o=>this._selectedRoleId=o.detail.roleId}" @open-role-menu="${()=>this.dispatchOpenAddAccountRole()}" @open-remove-role-menu="${()=>this.removeRoleDialogOpen=!0}"></user-details-tab-roles> `}renderAddAccountRoleConfirmation(){var e;return l`<add-account-role id="add-role-dialog" .contact="${this.contact}" .account="${Lo((e=this.selectedAccount)===null||e===void 0?void 0:e.accountId)||""}" .assignedRoles="${this.availableRoles}" .roles="${this.roles}" @add-role="${t=>this.addRole(t.detail.roleId)}"> </add-account-role>`}renderRemoveRoleConfirmation(){return l`<changes-confirmation id="remove-role-dialog" ?isOpen="${this.removeRoleDialogOpen}" .headerText="${"Are you sure you want to remove this role?"}" .bodyText="${"The user will no longer be able to perform the permissions of this role for this account."}" .confirmationButtonText="${"Remove Role"}" @confirm="${()=>{this.dispatchRemoveRoleEvent(),this.validateStep(),this.removeRoleDialogOpen=!1}}" @cancel="${()=>this.removeRoleDialogOpen=!1}"> </changes-confirmation>`}renderControls(){return l` <div class="controls"> <div class="flex justify-between py-2 items-center permissions-locations"> ${this.renderViewPermissionsButton()} <div class="flex items-center">${this.renderLocationsCount()}</div> </div> <div class="next-control"> <ix-button id="next-button" type="submit" has-icon trailing-icon ?disabled="${!this._nextButtonEnabled}" @click="${()=>{this.dispatchNextStepEvent()}}" data-testid="step-four-next-button"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}renderPermissionsDialog(){var e,t;return l` <ix-dialog ?open="${this.showPermissionsDialog}" @close="${()=>this.showPermissionsDialog=!1}"> <div class="dlr-text-heading" slot="headline">${this.selectedRole.name}</div> <div class="permissions-content" slot="content"> <user-details-permission inPermissionsDialog .permissionData="${(t=_t((e=this.selectedRolePermissions)!==null&&e!==void 0?e:[]))!==null&&t!==void 0?t:[]}"> </user-details-permission> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.togglePermissionsDialog}" slot="secondary"><span class="dismiss-btn">Dismiss</span></ix-button> </div> </ix-dialog> `}togglePermissionsDialog(){this.showPermissionsDialog=!this.showPermissionsDialog}renderViewPermissionsButton(){return l` <div class="tree-view-permissions"> <ix-button class="temp-button view-permissions" appearance="text" @click="${this.togglePermissionsDialog}"> View Permissions </ix-button> </div> `}renderLocationsCount(){const e=`dlr-text-default font-bold uppercase ${this.noOfLocations?"tree-role-locations-count-active":"tree-role-locations-count"}`;return l`<div class="tree-role-locations"> <span class="${e}"> ${this.noOfLocations?l`${this.noOfLocations} locations`:l`Select Locations`} </span> </div>`}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(w.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(w.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchUpdateDFAEvent(){const e=new CustomEvent(w.UpdateDFA,{detail:{dataForAccounts:this._dataForAccounts},bubbles:!0,composed:!0});this.dispatchEvent(e)}renderAccountTabbingCard(){return l` <account-tabbing-card data-testid="step-four-account-cards" isRoles .dataForAccounts="${this._dataForAccounts}" .selectedAccountId="${this._selectedAccountId}" @toggle-active-card="${e=>this.toggleActiveCard(e.detail.accountId)}"> </account-tabbing-card> `}render(){return l` <div class="wizard-step-content overflow-y-auto h-full max-h-screen md:p-1"> ${this.renderAccountTabbingCard()} <div class="tree-view-container-content">${this.renderRoles()}</div> <div class="controls-container">${this.renderControls()}</div> <div class="tree-view-container-footer">${this.renderTree()}</div> </div> ${this.renderAddAccountRoleConfirmation()} ${this.renderRemoveRoleConfirmation()} ${this.renderPermissionsDialog()} `}};D.styles=[$t,A,ue],s([d({type:Array})],D.prototype,"dataForAccounts",void 0),s([d({type:Array})],D.prototype,"permissions",void 0),s([d({type:String})],D.prototype,"selectedAccountId",void 0),s([d({type:String})],D.prototype,"selectedRoleId",void 0),s([d({type:Object})],D.prototype,"contact",void 0),s([u()],D.prototype,"_dataForAccounts",void 0),s([u()],D.prototype,"_selectedAccountId",void 0),s([u()],D.prototype,"_selectedRoleId",void 0),s([u()],D.prototype,"showPermissionsDialog",void 0),s([u()],D.prototype,"removeRoleDialogOpen",void 0),s([u()],D.prototype,"_nextButtonEnabled",void 0),s([N("#add-role-dialog")],D.prototype,"addRoleDialog",void 0),s([N("#role-data-element")],D.prototype,"roleTabComponent",void 0),s([N("user-details-assignments")],D.prototype,"assignmentTreeComponent",void 0),D=s([b("create-user-step-four")],D);const Ko=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}ix-icon-button{--md-sys-color-on-surface-variant:black}`;class se{}se.ACCORDION=e=>`user-flags-accordion-${e}`,se.COMPONENT=e=>`user-flags-${e}`,se.TREE=e=>`user-flags-tree-${e}`,se.ASSIGNMENT_COUNT=e=>`user-flags-assignment-count-${e}`,se.SEARCH_BOX=()=>"search-box";let B=class extends I{constructor(){super(...arguments),this.searchEnabled=!1,this.showCheckboxes=!1,this.disableCheckboxes=!1,this.filledIcons=!1,this.searching=!1,this.searchText="",this.selectedIds=[],this.searchResultCount=0,this.searchResultIndex=0,this.onSearchTextChange=Zt(async e=>{Ft(this.flagTree.rootNode),this.searchText=e.detail.searchText;const t=Nt(this.flagTree.rootNode,e.detail.searchText);t.length&&Ve(this.flagTree.rootNode),this.searchResultCount=t.length;const o=Go(this.flagTree.rootNode,t);[this.selectedId]=o,this.selectedIds=[...o],this.searchResultIndex=o.indexOf(this.selectedId)+1,this.requestUpdate()},500)}onTreeCheckToggle(e){var t;this.flagTree.updateService&&this.flagTree.updateService.update(e.detail.message.rootNode);const o=this.flagUpdateManager.nodeUpdates.find(i=>i.key===this.flagTree.label);o&&o.item.update(e.detail.message.rootNode),this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{...e.detail.message,flagLabel:this.flagTree.label,updates:this.flagUpdateManager.nodeChanges,rootNode:(t=this.flagTree.updateService)===null||t===void 0?void 0:t.nodeUpdates[0]}}})),this.flagTree.rootNode=structuredClone(e.detail.message.rootNode),this.requestUpdate("flagTree")}onSearchNavigation(e){if(!this.selectedIds.length)return;const t=jo(e.detail.direction,this.selectedId,this.selectedIds);this.selectedId=t!=null?t:this.selectedId,this.searchResultIndex=this.selectedIds.indexOf(this.selectedId)+1,this.requestUpdate()}render(){var e;return l` <ix-generic-tree data-testid="${se.TREE(this.flagTree.label)}" ?showCheckboxes="${this.showCheckboxes}" ?filledIcons="${this.filledIcons}" ?disableCheckboxes="${this.disableCheckboxes}" .rootNode="${this.flagTree.rootNode}" .selectedId="${this.selectedId}" .searchText="${this.searchText}" @check-toggle="${t=>this.onTreeCheckToggle(t)}" @search-text-change="${t=>this.onSearchTextChange(t)}" @search-navigation="${t=>this.onSearchNavigation(t)}" ?searchEnabled="${this.searchEnabled&&(((e=this.flagTree.rootNode.children)===null||e===void 0?void 0:e.length)||0)>0}" .searchResultCount="${this.searchResultCount}" .searchResultIndex="${this.searchResultIndex}" searchPlaceholder="Search by Site or Asset Name.."></ix-generic-tree> `}};B.styles=[Ko,A],s([d({type:Object,attribute:!1})],B.prototype,"flagTree",void 0),s([d({type:Boolean})],B.prototype,"searchEnabled",void 0),s([d({type:Boolean})],B.prototype,"showCheckboxes",void 0),s([d({type:Boolean})],B.prototype,"disableCheckboxes",void 0),s([d({type:Boolean})],B.prototype,"filledIcons",void 0),s([d({type:Boolean})],B.prototype,"searching",void 0),s([d({type:String})],B.prototype,"selectedId",void 0),s([d({type:Object})],B.prototype,"flagUpdateManager",void 0),s([u()],B.prototype,"searchText",void 0),s([u()],B.prototype,"selectedIds",void 0),s([u()],B.prototype,"searchResultCount",void 0),s([u()],B.prototype,"searchResultIndex",void 0),B=s([b("user-flag")],B);let G=class extends I{constructor(){super(...arguments),this.searchEnabled=!1,this.showCheckboxes=!1,this.disableCheckboxes=!1,this.filledIcons=!1,this.searching=!1,this.flags=[],this.flagUpdateManager=new Vo,this._defaultUpdates=[]}reset(){this._defaultUpdates=[],this.flagUpdateManager.reset()}onAccordionToggle(e){!e.detail.isOpen||!this.flags.length||(this.flags.forEach(t=>{t.label!==e.detail.accordionId?t.isOpen=!1:t.isOpen=!0}),this.requestUpdate())}connectedCallback(){var e;if(super.connectedCallback(),this._defaultUpdates=[],!this.contact)return;const t=Dt.get();if(!(!((e=this._defaultUpdates)===null||e===void 0)&&e.length)&&t!=null&&t.accountNumber){const o=`${t.accountNumber}:${this.contact.id}`,i=rt.capture(o);i&&rt.lock(o),this._defaultUpdates=i}}disconnectedCallback(){this.reset()}onTreeCheckToggle(e){this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{...e.detail.message,flagLabel:e.detail.message.flagLabel,updates:e.detail.message.updates,rootNode:e.detail.message.rootNode}}}))}getUserFlagAssignmentCount(e){var t;const o=(t=e.rootNode.children)===null||t===void 0?void 0:t.at(0);o&&(o.checkedChildrenCount=jt(o),this.renderAssignmentCount(e))}renderAssignmentCount(e){var t;const o=(t=e.rootNode.children)===null||t===void 0?void 0:t.at(0);return o!=null&&o.checkedChildrenCount?l` <span style="color:#53657a;margin-left:8px" data-testid="${se.ASSIGNMENT_COUNT(e.label)}">${o.checkedChildrenCount}</span> `:x}renderUserFlag(e){var t,o;this.flagUpdateManager.create(e.label);const i=this.flagUpdateManager.nodeUpdates.find(n=>n.key===e.label);return!((t=this._defaultUpdates)===null||t===void 0)&&t.length&&!e.defaultsApplied&&(this._defaultUpdates.forEach(n=>{const a=He(e.rootNode,n.id);a&&(a.checked=!0,fe(a,e.rootNode),i==null||i.item.update(e.rootNode))}),e.defaultsApplied=!0),this.getUserFlagAssignmentCount(e),l` <div class="mb-2"> <ix-accordion ?isOpen="${e.isOpen}" .accordionId="${e.label}" @toggle="${this.onAccordionToggle}" data-testid="${se.ACCORDION(e.label)}"> <p slot="title" class="m-0 pl-1"> ${e.label} ${this.renderAssignmentCount(e)} </p> <div style="padding-left:30px"> <div class="flex items-center"> <p class="dlr-text-small"> ${((o=ne.find(n=>n.text===e.label))===null||o===void 0?void 0:o.desc)||""} </p> <ix-progress .linear="${!1}" .indeterminate="${!0}" style="visibility:${this.searching?"visible":"hidden"}"></ix-progress> </div> <user-flag data-testid="${se.COMPONENT(e.label)}" ?showCheckboxes="${this.showCheckboxes}" ?filledIcons="${this.filledIcons}" ?disableCheckboxes="${this.disableCheckboxes}" ?searchEnabled="${this.searchEnabled}" .flagTree="${e}" .flagUpdateManager="${this.flagUpdateManager}" @check-toggle="${n=>this.onTreeCheckToggle(n)}"></user-flag> </div> </ix-accordion> </div> `}render(){return l` ${this.flags.map(e=>this.renderUserFlag(e))}`}};G.styles=[Ko,A],s([d({type:Boolean})],G.prototype,"searchEnabled",void 0),s([d({type:Boolean})],G.prototype,"showCheckboxes",void 0),s([d({type:Boolean})],G.prototype,"disableCheckboxes",void 0),s([d({type:Boolean})],G.prototype,"filledIcons",void 0),s([d({type:Boolean})],G.prototype,"searching",void 0),s([d({type:Array,attribute:!1})],G.prototype,"flags",void 0),s([d({type:Object})],G.prototype,"contact",void 0),s([u()],G.prototype,"flagUpdateManager",void 0),s([u()],G.prototype,"_defaultUpdates",void 0),G=s([b("user-flags")],G);const Jo=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.user-details-header-text{margin-bottom:10px}.user-details-row{display:grid;grid-template-columns:1fr 1fr}.row-label{color:rgba(9,34,65,.7);word-break:break-word;width:192px}.row-value{color:#092241;overflow-wrap:anywhere}.user-details-body{display:flex;gap:10px;flex-direction:column}.arrow-forward-icon{padding-left:6px}.access-summary-header,.user-details-header{display:flex;flex-direction:row;align-items:center;justify-content:space-between}ix-divider{margin-top:30px;margin-bottom:30px}.user-flag-information{margin-left:5px}.user-flag-learn-text{padding-bottom:20px}.user-flag-learn-text-link{color:#1456e0}.user-flag-evacuation{vertical-align:top;line-height:18px}.evacuation-label{padding-left:8px;vertical-align:top}.evacuation-text{text-align:justify;padding-left:5px;padding-top:10px;padding-bottom:30px;color:#092241;margin-right:40px}.flags-description ix-button{margin-top:.5rem;width:112px}ix-button{font-family:var(--root-secondary-font)}@media only screen and (max-width:600px){.flags-description{flex-direction:column-reverse;text-align:center}.flags-description p{text-align:left}.evacuation-text{margin-right:0}.flags-description ix-button{display:block}.subheading-container{flex-direction:column;align-items:start;gap:.75rem}.submit-btn{width:100%}.user-details-row{grid-template-columns:1fr}.step-five-next-container{display:flex;justify-content:center}}ix-phone-number{--ix-phone-number-font-size:16px;--ix-phone-number-text-color:#092241}`;let ee=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.evacAssistanceRequired=!1,this._dataForAccounts=[]}get selectedAccount(){return this._dataForAccounts.find(e=>e.accountId===this._selectedAccountId)}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._selectedAccountId=this.selectedAccountId}setSelectedFlag(e){this._selectedFlagId=e}setInitialFlag(){this._selectedFlagId=ne[0].key}toggleActiveCard(e){this._selectedAccountId=e;const t=this._dataForAccounts.find(o=>o.accountId===e);t&&t.genericFlagsData&&(this._selectedFlagId=Ct(t.genericFlagsData[0].label)),this.setSelectedFlag(this._selectedFlagId),this.setInitialFlag(),this.requestUpdate()}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}renderAccountTabbingCard(){return l` <account-tabbing-card data-testid="step-five-account-cards" .dataForAccounts="${this._dataForAccounts}" .selectedAccountId="${this._selectedAccountId}" @toggle-active-card="${e=>this.toggleActiveCard(e.detail.accountId)}"> </account-tabbing-card> `}renderElevatedNextButton(){return l` <div class="flex justify-between flags-description"> <p style="max-width:550px" class="dlr-text-caption evacuation-text"> The locations chosen for this account's Portal access will automatically default selections for the user flags listed below. You have the flexibility to modify these selections by deselecting specific locations and choosing others as needed. </p> <div class="step-five-next-container"> <ix-button type="submit" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" data-testid="step-five-next-button"> <span class="uppercase font-bold tracking-wider">Next</span> <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}renderUserFlags(){var e,t;const o=i=>{var n;const a=(n=structuredClone(i.detail.message.updates))!==null&&n!==void 0?n:[];this.selectedAccount&&a.forEach(r=>{const c=this.selectedAccount.flagData.findIndex(p=>p.key===r.key);c>-1?this.selectedAccount.flagData[c]=structuredClone(r):this.selectedAccount.flagData.push(r)}),this.dispatchEvent(new CustomEvent(w.UpdateFlags,{bubbles:!0}))};return l` <user-flags class="grid grid-cols-1 gap-3" showCheckboxes filledIcons searchEnabled .flags="${(t=(e=this.selectedAccount)===null||e===void 0?void 0:e.genericFlagsData)!==null&&t!==void 0?t:[]}" @check-toggle="${o}" data-testid="step-five-user-flags"></user-flags> `}render(){return l` <div class="wizard-step-content"> ${this.renderAccountTabbingCard()} ${this.renderElevatedNextButton()} ${this.renderUserFlags()} </div> `}};ee.styles=[Jo,A,ue],s([d({type:Object})],ee.prototype,"newContact",void 0),s([d({type:Array})],ee.prototype,"dataForAccounts",void 0),s([d({type:String})],ee.prototype,"selectedAccountId",void 0),s([d({type:Boolean,reflect:!0})],ee.prototype,"evacAssistanceRequired",void 0),s([u()],ee.prototype,"_dataForAccounts",void 0),s([u()],ee.prototype,"_selectedAccountId",void 0),s([u()],ee.prototype,"_selectedFlagId",void 0),ee=s([b("create-user-step-five")],ee);class k{}k.SUCCESS_CREATED="create-user-success",k.SUCCESS_ICON="create-user-success-icon",k.USER_DETAILS="create-user-success-details",k.SUCCESS_MESSAGE="create-user-success-message",k.VIEW_USER="view-user-button",k.BACK_TO_USERS="back-to-users-button",k.S6={DETAILS_HEADER:"s6-details-header",DETAILS_BODY:"s6-details-body",DETAILS_FIRST_NAME:"s6-details-first-name",DETAILS_LAST_NAME:"s6-details-last-name",DETAILS_EMAIL:"s6-details-email",DETAILS_PHONE:"s6-details-phone",PORTAL_TREE:"s6-portal-tree",FLAG_TREE:"s6-flag-tree",TAB_PORTAL:"s6-tab-portal",TAB_FLAGS:"s6-tab-flags"};let Z=class extends I{constructor(){super(...arguments),this.newContact={},this.dataForAccounts=[],this.submitting=!1,this.hideContactDetails=!1,this._readonlyTreeViews=[],this._readonlyUserFlags=[],this._selectedTab="roles-and-portal-access",this._isFirstLoad=!0}connectedCallback(){super.connectedCallback(),this._readonlyTreeViews=this.generateReadOnlyTreeViews(),this._readonlyUserFlags=this.generateReadOnlyUserFlags()}isTabActive(e){return this._isFirstLoad?x:this._selectedTab===e}generateReadOnlyTreeViews(){const e=[];return this.dataForAccounts.forEach(t=>{let o=[];t.rolesData.forEach(i=>{if(!i.role.removed){const n=Gt(i.genericTreeView),a=Kt(structuredClone(n));Jt(a),o.push({role:i.role.name,tree:a})}}),e.push({accountName:t.accountName,roleTrees:o}),o=[]}),e}generateReadOnlyUserFlags(){const e=[];return this.dataForAccounts.forEach(t=>{let o=[];t.genericFlagsData&&(t.genericFlagsData.forEach(i=>{const n=Gt(i.rootNode),a=Kt(structuredClone(n));Jt(a),o.push({label:i.label,rootNode:a,isOpen:!1})}),e.push({accountName:t.accountName,flagTrees:o}),o=[])}),e}renderUserDetails(){return l` <div class="user-details"> <div class="user-details-header" data-testid="${k.S6.DETAILS_HEADER}"> <div class="user-details-header-text">User Details</div> <ix-icon-button class="icon-btn_primary" filledIcon icon="edit" ?disabled="${this.submitting}" @click="${()=>this.dispatchSetStepEvent(1)}"></ix-icon-button> </div> <div class="user-details-body" data-testid="${k.S6.DETAILS_BODY}"> <div class="user-details-row"> <div class="dlr-text-default row-label">First Name</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_FIRST_NAME}"> ${this.newContact.firstName} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Last Name</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_LAST_NAME}"> ${this.newContact.lastName} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Email Address</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_EMAIL}"> ${this.newContact.email} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Phone</div> <ix-phone-number data-testid="${k.S6.DETAILS_PHONE}" .number="${this.newContact.phone}"></ix-phone-number> </div> </div> </div> `}renderTabs(){return l` <ix-tabs> <ix-primary-tab @click="${()=>{this._selectedTab="roles-and-portal-access",this._isFirstLoad=!1}}" ?active="${this.isTabActive("roles-and-portal-access")}" data-testid="${k.S6.TAB_PORTAL}"> <span style="${this._selectedTab==="roles-and-portal-access"?"":"color: #092241; opacity: 60%;"}" class="flex items-center uppercase font-bold tracking-wide"> Roles and Portal Access </span> </ix-primary-tab> <ix-primary-tab @click="${()=>{this._selectedTab="user-flags",this._isFirstLoad=!1}}" ?active="${this.isTabActive("user-flags")}" data-testid="${k.S6.TAB_FLAGS}"> <span style="${this._selectedTab==="user-flags"?"":"color: #092241; opacity: 60%;"}" class="flex items-center uppercase font-bold tracking-wide">User Flags</span></ix-primary-tab> </ix-tabs> `}renderRolesAndPortalAccessSummary(){return this._selectedTab!=="roles-and-portal-access"?x:l` <div class="py-4"> ${this._readonlyTreeViews.map(e=>l` <div> <h4 style="color:#092241;opacity:60%" class="pt-1 pb-3">${e.accountName}</h4> ${e.roleTrees.map(t=>l` <div class="pb-2"> <div class="pb-1">${t.role}</div> <ix-generic-tree filledIcons .rootNode="${t.tree}" data-testid="${k.S6.PORTAL_TREE}"></ix-generic-tree> </div> `)} </div>`)} </div> `}renderUserFlagsSummary(){return this._selectedTab!=="user-flags"?x:l`<div> ${this._readonlyUserFlags.map(e=>l` <div class="py-2"> <h4 class="font-bold pb-2">${e.accountName}</h4> <user-flags filledIcons disableCheckboxes .flags="${e.flagTrees}" data-testid="${k.S6.FLAG_TREE}"></user-flags> </div>`)} </div>`}renderLearnMoreText(){return this._selectedTab==="user-flags"?l` <div style="padding-top:15px"> Learn more about user flags <a class="user-flag-learn-text-link" href="#">here.</a> </div> `:l` <div style="padding-top:15px" class="text-black roles-and-portal-access-text"> Learn more about roles and portal access <a class="user-flag-learn-text-link" href="#">here.</a> </div> `}dispatchSetStepEvent(e){this.dispatchEvent(new CustomEvent(w.SetStep,{detail:{step:e},bubbles:!0,composed:!0}))}render(){return l` <div class="wizard-step-content overflow-y-auto overflow-x-hidden md:p-1"> ${this.hideContactDetails?x:l`${this.renderUserDetails()}<ix-divider></ix-divider>`} ${this.renderTabs()} ${this.renderLearnMoreText()} ${this.renderRolesAndPortalAccessSummary()} ${this.renderUserFlagsSummary()} </div> `}};Z.styles=[Jo,A,ue],s([d({type:Object})],Z.prototype,"newContact",void 0),s([d({type:Array})],Z.prototype,"dataForAccounts",void 0),s([d({type:Boolean})],Z.prototype,"submitting",void 0),s([d({type:Boolean})],Z.prototype,"hideContactDetails",void 0),s([u()],Z.prototype,"_readonlyTreeViews",void 0),s([u()],Z.prototype,"_readonlyUserFlags",void 0),s([u()],Z.prototype,"_selectedTab",void 0),s([u()],Z.prototype,"_isFirstLoad",void 0),Z=s([b("create-user-step-six")],Z);const Es=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.drawer-container{z-index:100;display:flex;flex-direction:row;position:fixed;width:100%;height:100%;top:var(--intraportal-nav-height,0);right:0;background-color:rgba(0,0,0,.5);animation-duration:.25s;animation-name:fadeIn;animation-timing-function:ease-out}.drawer-container-hide{z-index:100;display:flex;flex-direction:row;flex:0 0 auto;position:fixed;width:100vw;height:100vh;top:0;right:0;background-color:rgba(0,0,0,.5);animation-duration:.25s;animation-name:fadeOut;animation-timing-function:ease-out}.drawer-filler{flex:1}aside{padding:32px 40px 40px;border-radius:1rem 0 0 1rem}.drawer-slide-in{width:100vw;max-width:816px;height:calc(100% - var(--intraportal-nav-height,0px));float:right;display:flex;flex-direction:column;background-color:#fff;box-sizing:border-box;animation-duration:.25s;animation-name:slideInFromRight}.drawer-slide-out{width:100vw;max-width:810px;height:100vh;float:right;background-color:#fff;box-sizing:border-box;animation-duration:.25s;animation-name:slideOutToRight}@media screen and (min-width:1024px){.drawer{width:45%}}.drawer-header{display:flex;justify-content:space-between;align-items:center}.drawer-body{flex-grow:1;overflow:hidden}.drawer-header__hide-btn{flex:1}.drawer-header__title{flex:1;text-align:center;flex-grow:1;flex-shrink:0}.drawer-header__close-btn{flex:1}.hide-text{cursor:pointer;user-select:none}.hide-icon{font-weight:700}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}@keyframes slideInFromRight{from{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slideOutToRight{from{transform:translateX(0)}to{transform:translateX(100%)}}@media screen and (max-width:600px){aside{border-radius:0;padding:1rem}}`,lt={ToggleDialog:"toggle-dialog",ToggleDraft:"toggle-draft",CloseSuccess:"close-success",BlurDrawer:"blur-drawer"};let de=class extends I{constructor(){super(...arguments),this.isVisible=!1,this.summaryScreen=!1,this.submitting=!1,this.showMinimiseButton=!1}static get styles(){return[Es,A]}dispatchDialogToggleEvent(){this.submitting||this.dispatchEvent(new CustomEvent(lt.ToggleDialog,{composed:!0,bubbles:!0}))}dispatchDraftToggleEvent(){var e,t;(e=this.drawer)===null||e===void 0||e.setAttribute("class","drawer-slide-out"),(t=this.drawerContainer)===null||t===void 0||t.setAttribute("class","drawer-container-hide"),setTimeout(()=>{this.dispatchEvent(new CustomEvent(lt.ToggleDraft,{bubbles:!0,composed:!0}))},250)}dispatchBlurEvent(){this.dispatchEvent(new CustomEvent(lt.BlurDrawer,{bubbles:!0,composed:!0}))}dispatchDrawerCloseEvent(){this.dispatchEvent(new CustomEvent(lt.CloseSuccess,{bubbles:!0,composed:!0}))}render(){const e=this.isVisible?"slide-in":"slide-out";return this.isVisible?(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",l` <div class="drawer-container" data-testid="ui-um-drawer-container"> <div class="drawer-filler" @click="${this.dispatchBlurEvent}" @keypress="${this.dispatchBlurEvent}"></div> <aside class="drawer-${e}"> <div class="drawer-header"> <div class="drawer-header__hide-btn"> ${!this.summaryScreen&&this.showMinimiseButton?l` <ix-button class="flex w-24" appearance="text" has-icon @click="${this.dispatchDraftToggleEvent}" ?disabled="${this.submitting}" data-testid="hide-drawer-button"> <md-icon class="hide-icon" slot="icon">fullscreen_exit</md-icon> <p class="dlr-text-small hide-text font-bold uppercase">Hide</p> </ix-button> `:x} </div> <div> <slot name="centre-top"></slot> </div> <div class="drawer-header__close-btn"> <div class="float-right"> <ix-icon-button aria-label="Close" icon="close" @click="${this.summaryScreen?this.dispatchDrawerCloseEvent:this.dispatchDialogToggleEvent}" data-testid="close-drawer-icon"></ix-icon-button> </div> </div> </div> <div class="drawer-body"> <slot name="content"></slot> </div> </aside> </div> `):(document.body.style.overflow="auto",document.documentElement.style.overflow="initial",x)}};s([d({type:Boolean})],de.prototype,"isVisible",void 0),s([d({type:Boolean})],de.prototype,"summaryScreen",void 0),s([d({type:Boolean})],de.prototype,"submitting",void 0),s([d({type:Boolean})],de.prototype,"showMinimiseButton",void 0),s([N("aside")],de.prototype,"drawer",void 0),s([N(".drawer-container")],de.prototype,"drawerContainer",void 0),de=s([b("ui-um-drawer")],de);const Rs=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.wizard-body{overflow:hidden;height:100%}.wizard-footer{float:right}.form{height:100%}`,Pt={UpdateForm:"update-form",NextStepWizard:"next-step-wizard",PrevStep:"prev-step-wizard",ButtonToggle:"button-toggle"};let Mt=class extends I{constructor(){super(...arguments),this.updateFormBinding=this.updateForm.bind(this),this.handleSlotChangeBinding=this.handleSlotChange.bind(this),this.wizardForm=new FormData}static get styles(){return[Rs,A]}connectedCallback(){super.connectedCallback(),window.addEventListener(Pt.UpdateForm,this.updateFormBinding)}disconnectedCallback(){var e;super.disconnectedCallback(),window.removeEventListener(Pt.UpdateForm,this.updateFormBinding);const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.removeEventListener("slotchange",this.handleSlotChangeBinding)}firstUpdated(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.addEventListener("slotchange",this.handleSlotChangeBinding)}updateForm(e){e.detail.forEach((t,o)=>this.wizardForm.set(o,t))}handleSlotChange(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.assignedElements().forEach(o=>{o.wizardForm=this.wizardForm})}dispatchButtonToggleEvent(e){this.dispatchEvent(new CustomEvent(Pt.ButtonToggle,{detail:e,bubbles:!0,composed:!0}))}render(){return l` <div class="wizard-body"> <form class="form"> <slot name="wizard-content"></slot> </form> </div> `}};s([d({type:Object})],Mt.prototype,"wizardForm",void 0),Mt=s([b("ui-um-wizard")],Mt);const Ss=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.wizard-step-form{display:flex;flex-direction:column;height:100%}.step{overflow:auto}.wizard-step__btn-group{padding:20px 0;float:right}.input-group{display:flex;flex-direction:row;gap:20px;margin-bottom:20px}.input-group ix-phone-input,.input-group ix-textbox{flex:1}.textfield{width:100%}.subheading-container{display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:36px;margin-top:24px}.submit-btn{width:167.44px}.submit-btn-content{display:flex;align-items:center;flex-direction:row;justify-content:space-between}@media screen and (max-width:600px){.input-group{display:block;flex-direction:row;gap:20px;margin-bottom:20px}.input-group ix-phone-input,.input-group ix-textbox{flex:1}}`;let re=class extends I{constructor(){super(...arguments),this.handleSlotChangeBinding=this.handleSlotChange.bind(this),this.stepTitle="",this.stepSubTitle="",this.isRequired=!1,this.isLastStep=!1,this.submitting=!1}static get styles(){return[Ss,Ee,A]}disconnectedCallback(){var e;super.disconnectedCallback();const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.removeEventListener("slotchange",this.handleSlotChangeBinding)}firstUpdated(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.addEventListener("slotchange",this.handleSlotChangeBinding),this.firstFocusableElement.focus()}handleSlotChange(){var e,t;const o=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");for(const i of o.assignedNodes())(t=this.form)===null||t===void 0||t.insertBefore(i,o)}dispatchSubmitEvent(e){e.preventDefault(),this.dispatchEvent(new CustomEvent(w.CreateContact,{bubbles:!0,composed:!0}))}render(){return l` <form class="wizard-step-form" @keydown="${e=>{e.key==="Escape"&&(e.stopPropagation(),e.preventDefault(),this.dispatchEvent(new CustomEvent("close-wizard",{detail:{originElement:this.firstFocusableElement},bubbles:!0,composed:!0})))}}"> <div class="wizard-step-heading pt-6"> <h2 class="dlr-text-page-title" data-testid="dlr-text-page-title" tabindex="-1"> ${this.stepTitle} </h2> <div class="subheading-container"> <h3 class="dlr-text-heading" data-testid="dlr-text-heading">${this.stepSubTitle}</h3> ${this.isRequired?l` <span class="dlr-text-small italic required-field">*denotes required field</span> `:x} ${this.isLastStep?l` <ix-button class="submit-btn" has-icon ?submitting="${this.submitting}" @click="${e=>this.dispatchSubmitEvent(e)}" data-testid="wizard-submit-button"> <div class="submit-btn-content"> Yes, Submit <md-icon class="arrow-forward-icon" slot="icon">arrow_forward</md-icon> </div> </ix-button> `:x} </div> </div> <slot></slot> </form> <div tabindex="-1" @focus="${()=>{this.firstFocusableElement.focus()}}"></div> `}};s([N('[tabindex="-1"]')],re.prototype,"firstFocusableElement",void 0),s([d({type:String})],re.prototype,"stepTitle",void 0),s([d({type:String})],re.prototype,"stepSubTitle",void 0),s([d({type:Boolean})],re.prototype,"isRequired",void 0),s([d({type:Boolean})],re.prototype,"isLastStep",void 0),s([d({type:Boolean})],re.prototype,"submitting",void 0),s([N("form")],re.prototype,"form",void 0),re=s([b("ui-um-wizard-step")],re);const Zo=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}ix-dialog{position:absolute;z-index:101}.create-user-wizard{height:100%;display:flex;flex-direction:column}.dlr-text-small.step-progress{letter-spacing:1.25px}ix-button{font-family:var(--root-secondary-font)}@media only screen and (max-width:600px){.success-actions{flex-direction:column;width:100%}.success-actions ix-button{display:block;width:100%}}`;function Wo(e,t){const o={id:"root",label:"",children:[],customerKnownSpaceName:""},i=new st,n=structuredClone(e.rolesData.filter(m=>m.locations.length>0).filter(m=>!m.role.removed).flatMap(m=>m.locations)),a=t.data;a&&a.length&&ce(a[0],o),n.forEach(m=>{const h=He(o,m.id);h&&(h.checked=!0,fe(h,o),i.update(o))});const r={label:"",isOpen:!1,rootNode:o},c=[],p=ne.map(m=>{const h=structuredClone(r);return h.updateService=new st,h.updateService.updates=structuredClone(i.nodeUpdates),h.label=m.text,c.push({key:m.text,items:[]}),h});e.genericFlagsData=[...p],e.flagData=c}const Us=e=>({id:e.id,name:e.account_name,status:e.status,accountNumber:e.account_number,displayName:e.account_friendly_name,statusUpdateAt:e.updated_at,statusUpdateBy:e.updated_by}),Bt=e=>{var t;const o=[];return(t=e.account_associations)===null||t===void 0||t.forEach(i=>{o.push(Us(i))}),{id:e.id,firstName:e.first_name,lastName:e.last_name,email:e.email,phone:e.phone,evacAssistance:e.evacuation_assistance_required,accounts:o,status:"Active"}},$s=e=>{var t;const o=[];return(t=e.accounts)===null||t===void 0||t.forEach(i=>{o.includes(i.accountNumber)||o.push(i.accountNumber)}),{first_name:e.firstName,last_name:e.lastName,email:e.email,phone:e.phone,account_numbers:o,evacuation_assistance_required:e.evacAssistance}},Ns=e=>({id:e.id,first_name:e.firstName,last_name:e.lastName,email:e.email,phone:e.phone,evacuation_assistance_required:e.evacAssistance}),Fs=e=>({accountNumber:e.accountNumber,includeChildAccounts:!0,page:e.page,size:e.size,firstName:e.firstName,lastName:e.lastName,email:e.email,sort:e.sort,order:e.order}),Ds=e=>{var t,o;const i=[];return(t=e.content)===null||t===void 0||t.forEach(n=>{i.push(Bt(n))}),{contacts:i,recordCount:(o=e.pageable)===null||o===void 0?void 0:o.total_elements}},Ps=e=>({id:e.id}),Ms=e=>({id:e.id,userProfile:Ns(e.contactInput)}),Bs=e=>({userInput:$s(e.contactInput)});class Ls{async update(t){try{const o=Ms(t);return f.UsersApi.updateUser(o)}catch(o){return g.handleError("Failed to update user.")}}async create(t){try{const o=Bs(t),i=await f.UsersApi.createUser(o);return Bt(i)}catch(o){return g.handleError(o,`Failed to create user for ${t.contactInput.email}`),{}}}async search(t){try{const o=Fs(t),i=await f.UsersApi.getUsers(o);return Ds(i)}catch(o){return g.handleError(o,"Failed to get users."),{}}}async get(t){try{const o=Ps(t),i=await f.UsersApi.getUserById(o);return Bt(i)}catch(o){return g.handleError(o,"Failed to get user."),{}}}async getUsersReport(t){try{const o={accountNumber:t.accountNumber,includeChildAccounts:t.includeChildAccounts,firstName:t.firstName,lastName:t.lastName,email:t.email};return await f.UsersApi.getUserReport(o)}catch(o){throw g.handleError(o,"Failed to download users report."),o}}}const Lt=new Ls,Qo=(e,t)=>{var o;const i={expanded:!1,id:e.id,label:(o=e.displayName)!==null&&o!==void 0?o:e.name,parentId:t.id};return e.subaccounts&&(i.children=e.subaccounts.map(n=>Qo(n,i))),i},Os=e=>{const t={expanded:!1,id:"root",label:"",parentId:"",children:[],disabled:!1};return t.children=e.map(o=>Qo(o,t)),t};function Yo(e,t){var o;const i={id:e.id,label:(o=e.displayName)!==null&&o!==void 0?o:e.name,parentId:t.id,expanded:!1,checked:!1,indeterminate:!1,children:[]};return e.subaccounts&&(i.children=e.subaccounts.map(n=>Yo(n,i))),i}function Xo(e){const t={id:"root",parentId:"",label:"",expanded:!1,checked:!1,children:[]};return e.forEach(o=>t.children.push(Yo(o,t))),t}const zs=e=>{const t=at(e);return Os(t)};let T=class extends I{constructor(){super(...arguments),this.showDrawer=!1,this.success=!1,this.submitting=!1,this.newUserId="",this.permissions=[],this.roles=[],this.treeData=[],this.loading=!1,this.selectedAccountId="",this.selectedRoleId="",this.step=1,this.validatingStepOne=!1,this.newContact={firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},this.dataForAccounts=[],this.showManageUserDialog=!1,this.userId="",this.stepTitle="Add New User",this.isNextButtonEnabled=!1,this.canQuickNavigateSteps={1:!1,2:!1,3:!1,4:!1,5:!1},this.maxQuickStep=1}connectedCallback(){super.connectedCallback(),this.setupAccountSelector()}get stepOne(){var e,t;return(t=(e=this.renderRoot.querySelector("#step-1"))===null||e===void 0?void 0:e.shadowRoot)===null||t===void 0?void 0:t.querySelector("create-user-step-one")}setupAccountSelector(){const e=St().filter(t=>M.hasExternalUserCreate(t.accountNumber));this.accounts=at(e),this.accountTree=Xo(this.accounts),this.permissions=U.getPermissions()}resetStep(){this.handleDialogReset("close")}setStep(e){this.step=e,this.canQuickNavigateSteps={1:!0,2:!0,3:!0,4:!0,5:!0}}resetSteps(e){Object.keys(this.canQuickNavigateSteps).forEach(t=>{e.includes(t)||(this.canQuickNavigateSteps={...this.canQuickNavigateSteps,[t]:!1})})}onNextButtonToggle(e){this.isNextButtonEnabled=e.detail,this.step===1?this.canQuickNavigateSteps={...this.canQuickNavigateSteps,1:!1}:this.step===2?this.resetSteps(["1"]):this.step===3?this.resetSteps(["1","2"]):this.step===4?this.resetSteps(["1","2","3"]):this.canQuickNavigateSteps={...this.canQuickNavigateSteps,[this.step]:!1},this.maxQuickStep=this.step}onPrevStep(){this.step!==1&&(this.step===3&&this.collapseAccountTree(),(this.step===5||this.step===6)&&this.collapseLocationTrees(),this.step===6&&(this.isNextButtonEnabled=!0),this.canQuickNavigateSteps[(this.step-1).toString()]=!0,this.maxQuickStep=Math.max(this.maxQuickStep,this.step),this.step-=1)}onQuickNextStep(){this.canQuickNavigateSteps[this.step]&&this.onNextStep()}async onNextStep(){var e;if(this.isNextButtonEnabled){if(this.loading=!0,this.step===1){if(this.collapseAccountTree(),!this.canQuickNavigateSteps[1]){this.validatingStepOne=!0;const t=await this.validateEmail();if(this.validatingStepOne=!1,!t){this.loading=!1;return}}}else if(this.step===2&&!this.canQuickNavigateSteps[2]){if(!this.accountTree)return;const t=((e=this.checkedAccounts)===null||e===void 0?void 0:e.map(a=>a.id))||[],o=await et.getAccountData(t),i=me.get(),n=Le(this.newContact.email)&&M.hasAssignInternalRoleCreate(U.getAccountNumber());this.roles=[],this.treeData=[];for(let a=0;a<t.length;a+=1){const r=Ut(t[a],i,n),c=t[a];this.roles.push({accountId:c,roles:structuredClone(r)}),this.treeData.push({contactId:"",accountNumber:c,roleId:"",data:o[a]})}}else if(this.step===3)this.selectedAccountId=this.dataForAccounts[0].accountId,this.selectedRoleId=this.dataForAccounts[0].rolesData[0].role.id;else if(this.step===4){for(const t of this.dataForAccounts){const o=this.treeData.find(i=>i.accountNumber===t.accountId);o&&Wo(t,o)}this.collapseLocationTrees()}else this.step===5&&this.collapseLocationTrees();this.step!==4&&(this.isNextButtonEnabled=!1),this.step+1===this.maxQuickStep&&(this.canQuickNavigateSteps[this.step]=!1),this.loading=!1,this.step+=1}}collapseAccountTree(){this.accountTree&&(this.accountTree.expanded=!1,this.accountTree.children&&this.accountTree.children.forEach(e=>{e.expanded=!1,e.children&&e.children.forEach(t=>{t.expanded=!1})}))}collapseLocationTrees(){this.dataForAccounts.forEach(e=>{var t;e.rolesData.forEach(o=>{Ve(o.genericTreeView)}),(t=e.genericFlagsData)===null||t===void 0||t.forEach(o=>{Ve(o.rootNode)})})}async validateEmail(){const e=await Lt.search({email:this.newContact.email.split("@")[0]});return e.contacts.find(t=>t.email===this.newContact.email)?(this.userId=e.contacts[0].id,this.toggleManageUserDialog(),!1):!0}handleDialogReset(e){this.step=1,this.newContact={id:"",firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},this.setupAccountSelector(),this.stepOne&&(this.stepOne.clearTextFields(),this.stepOne.resetErrorStates(),this.stepOne._nextButtonEnabled=!1),this.dataForAccounts=[],this.selectedAccountId="",this.selectedRoleId="",this.canQuickNavigateSteps={1:!1,2:!1,3:!1,4:!1,5:!1},this.maxQuickStep=1,this.isNextButtonEnabled=!1,this.dispatchResetSuccessEvent(),e==="toggle"?this.dispatchToggleDrawerEvent():this.dispatchDrawerCloseEvent()}updateAccounts(e){var t;this.accountTree=e.detail.rootNode,!((t=this.accountTree)===null||t===void 0)&&t.children&&(this.checkedAccounts=wt(this.accountTree.children,Co(this.accounts||[])),this.dataForAccounts=[])}onUpdateContact(e){const t=e.detail.newContact;this.newContact.email!==t.email&&this.newContact.email!==""&&(this.resetSteps(["1"]),this.dataForAccounts=[]),this.newContact=t}renderWizardStep(){switch(this.step){case 1:return l` <ui-um-wizard-step id="step-1" slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"User Information"}" data-testid="create-user-step-one"> <create-user-step-one .newContact="${this.newContact}" .validatingForm="${this.validatingStepOne}" @update-contact="${e=>this.onUpdateContact(e)}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-one> </ui-um-wizard-step> `;case 2:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Accounts*"}" data-testid="create-user-step-two"> <create-user-step-two class="flex flex-col overflow-auto grow" .accountTree="${this.accountTree}" @update-accounts="${e=>this.updateAccounts(e)}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-two> </ui-um-wizard-step> `;case 3:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Roles"}" data-testid="create-user-step-three"> <create-user-step-three class="flex flex-col overflow-auto grow" .checkedAccounts="${this.checkedAccounts||[]}" .roles="${this.roles}" .dataForAccounts="${this.dataForAccounts}" .treeData="${this.treeData}" @update-dfa="${e=>{this.dataForAccounts=e.detail.dataForAccounts}}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-three> </ui-um-wizard-step> `;case 4:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Portal Access"}" data-testid="create-user-step-four"> <create-user-step-four class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .selectedRoleId="${this.selectedRoleId}" .permissions="${this.permissions}" .contact="${this.newContact}" @update-dfa="${e=>this.dataForAccounts=e.detail.dataForAccounts}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-four> </ui-um-wizard-step> `;case 5:return l` <ui-um-wizard-step slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"User Flags"}" data-testid="create-user-step-five"> <create-user-step-five class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .evacAssistanceRequired="${this.newContact.evacAssistance}" @evac-assistance-required="${e=>this.newContact.evacAssistance=e.detail}" @update-flags="${()=>this.canQuickNavigateSteps={...this.canQuickNavigateSteps,5:!1}}" @next-step="${this.onNextStep}"> </create-user-step-five> </ui-um-wizard-step> `;case 6:return l` <ui-um-wizard-step isLastStep slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"Are these details correct?"}" ?submitting="${this.submitting}" @create-contact="${this.dispatchCreateNewContactEvent}" data-testid="create-user-step-six"> <create-user-step-six class="step" .dataForAccounts="${this.dataForAccounts}" .newContact="${this.newContact}" ?submitting="${this.submitting}" @set-step="${e=>this.setStep(e.detail.step)}"></create-user-step-six> </ui-um-wizard-step> `}return x}renderProgress(){return l`<ix-progress slot="wizard-content" indeterminate></ix-progress>`}renderSuccessMessage(){return l` <div data-testid="${k.SUCCESS_CREATED}" slot="content" class="flex flex-col justify-between items-center pt-40 h-96"> <ix-icon data-testid="${k.SUCCESS_ICON}" style="color:#4caf50;font-size:75px;font-weight:700">check_circle</ix-icon> <span data-testid="${k.USER_DETAILS}" class="text-2xl font-bold pb-5">${this.newContact.firstName} ${this.newContact.lastName} Created</span> <div data-testid="${k.SUCCESS_MESSAGE}" class="pb-5"> ${this.newContact.firstName} ${this.newContact.lastName} has been successfully created. </div> <div class="flex justify-between w-400 success-actions"> <ix-button data-testid="${k.VIEW_USER}" appearance="outlined" @click="${this.handleViewUserRedirect}" class="p-1"><span class="font-bold text-sm tracking-wider uppercase">View user</span></ix-button> <ix-button data-testid="${k.BACK_TO_USERS}" appearance="filled" class="p-1" @click="${()=>this.handleDialogReset("close")}"><span class="font-bold uppercase text-sm tracking-wider">Back to users</span></ix-button> </div> </div> `}handleViewUserRedirect(){this.handleDialogReset("close"),Je(z.UserManagementDetails,`?id=${this.newUserId}`),this.newUserId=""}renderManageUserDialog(){return l` <ix-dialog ?open="${this.showManageUserDialog}"> <div class="dlr-text-heading" slot="headline"> This user already exists for your Master Account </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.handleManageUserDialogClose}" slot="secondary"> Cancel </ix-button> <ix-button appearance="text" @click="${this.handleManageUserRedirect}" slot="primary"> Manage User </ix-button> </div> </ix-dialog> `}toggleManageUserDialog(){this.showManageUserDialog=!this.showManageUserDialog}handleManageUserDialogClose(){this.toggleManageUserDialog(),this.handleDialogReset("close")}handleManageUserRedirect(){this.toggleManageUserDialog(),this.handleDialogReset("close"),Je(z.UserManagementDetails,`?id=${this.userId}`),this.userId=""}dispatchToggleDrawerEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDrawer,{bubbles:!0,composed:!0}))}dispatchDrawerCloseEvent(){this.dispatchEvent(new CustomEvent(w.CloseDrawer,{bubbles:!0,composed:!0}))}dispatchResetSuccessEvent(){this.dispatchEvent(new CustomEvent(w.ResetSuccess,{bubbles:!0,composed:!0}))}dispatchCreateNewContactEvent(){this.dispatchEvent(new CustomEvent(w.CreateNewContact,{detail:{newContact:this.newContact,dataForAccounts:this.dataForAccounts},bubbles:!0,composed:!0}))}renderDrawerControls(){return l` <div slot="centre-top"> <div class="flex"> ${this.success?x:l` <ix-icon-button class="icon-btn_primary" ?disabled="${this.step===1||this.loading}" @click="${()=>this.onPrevStep()}" icon="chevron_left" data-testid="prev-step-icon"> </ix-icon-button> <span class="dlr-text-small uppercase font-bold pt-[10px] px-2 step-progress" data-testid="step-progress"> ${this.step} of 6 </span> <ix-icon-button style="${this.step===6?"visibility: hidden":""}" class="icon-btn_primary ${this.step===6||!this.isNextButtonEnabled||this.loading?"disabled":""}" ?disabled="${!this.canQuickNavigateSteps[this.step]||this.loading}" @click="${()=>this.onQuickNextStep()}" icon="chevron_right" data-testid="next-step-icon"> </ix-icon-button> `} </div> </div> `}render(){return l` <ui-um-drawer ?isVisible="${this.showDrawer}" ?summaryScreen="${this.success}" ?submitting="${this.submitting}" @close-success="${()=>this.handleDialogReset("close")}" data-testid="ui-um-drawer"> ${this.renderDrawerControls()} ${this.success?this.renderSuccessMessage():l` <ui-um-wizard class="create-user-wizard" slot="content" data-testid="create-user-wizard"> ${this.loading?this.renderProgress():this.renderWizardStep()} </ui-um-wizard> `} </ui-um-drawer> ${this.renderManageUserDialog()} `}};T.styles=[Zo,A,Ee],s([d({type:Boolean})],T.prototype,"showDrawer",void 0),s([d({type:Boolean})],T.prototype,"success",void 0),s([d({type:Boolean})],T.prototype,"submitting",void 0),s([d({type:String})],T.prototype,"newUserId",void 0),s([u()],T.prototype,"accounts",void 0),s([u()],T.prototype,"accountTree",void 0),s([u()],T.prototype,"permissions",void 0),s([u()],T.prototype,"roles",void 0),s([u()],T.prototype,"treeData",void 0),s([u()],T.prototype,"loading",void 0),s([u()],T.prototype,"selectedAccountId",void 0),s([u()],T.prototype,"selectedRoleId",void 0),s([u()],T.prototype,"step",void 0),s([u()],T.prototype,"validatingStepOne",void 0),s([u()],T.prototype,"newContact",void 0),s([u()],T.prototype,"dataForAccounts",void 0),s([u()],T.prototype,"showManageUserDialog",void 0),s([u()],T.prototype,"userId",void 0),s([u()],T.prototype,"stepTitle",void 0),s([u()],T.prototype,"isNextButtonEnabled",void 0),s([u()],T.prototype,"canQuickNavigateSteps",void 0),s([u()],T.prototype,"maxQuickStep",void 0),s([u()],T.prototype,"checkedAccounts",void 0),T=s([b("create-user")],T);const qs=E`.draft-container{display:flex;flex-direction:row;justify-content:space-between;bottom:24px;position:fixed;right:24px;z-index:1200;gap:8px;background-color:#fff;border-radius:16px;box-shadow:rgba(0,0,0,.12) 0 12px 20px -12px,#e1e4e8 0 0 0 1px inset;align-items:center;padding:16px 24px;width:250px}`;let Oe=class extends I{constructor(){super(...arguments),this.header="",this.subText="",this.isVisible=!1}static get styles(){return[qs]}dispatchDraftToggleEvent(){this.dispatchEvent(new CustomEvent(_.ToggleDraft,{bubbles:!0,composed:!0}))}dispatchDialogToggleEvent(){this.dispatchEvent(new CustomEvent(_.ToggleDialog,{composed:!0}))}render(){return this.isVisible?(document.body.style.overflow="hidden",l` <div class="draft-container"> <div class="draft-text"> <p class="dlr-text-caption text-on-surface-variant">${this.header}</p> <p class="dlr-text-small font-bold">${this.subText}</p> </div> <div class="draft-buttons"> <ix-icon-button filledIcon @click="${this.dispatchDialogToggleEvent}"> <ix-icon filled slot="default" style="color:red">delete</ix-icon> </ix-icon-button> <ix-icon-button appearance="filled" @click="${this.dispatchDraftToggleEvent}"> <ix-icon slot="default">fullscreen</ix-icon> </ix-icon-button> </div> </div> `):(document.body.style.overflow="auto",x)}};s([d({type:String})],Oe.prototype,"header",void 0),s([d({type:String})],Oe.prototype,"subText",void 0),s([d({type:Boolean})],Oe.prototype,"isVisible",void 0),Oe=s([b("ix-draft")],Oe);const ei=E`ix-dialog .dialog-content{max-width:560px}`;let te=class extends ke{constructor(){super(...arguments),this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1,this.success=!1,this.newUserId="",this.submittingNewUser=!1,this.cancellingCreateUser=!1}static get styles(){return[ei,ue,A]}async createNewContact(e){this.submittingNewUser=!0;const t=e.detail.newContact,o=e.detail.dataForAccounts;o.forEach(({accountId:i})=>{t.accounts.some(({accountNumber:n})=>n===i)||t.accounts.push({accountNumber:i})});try{this.newUserId=await this.createContact(t);const i=[this.createRoleAssignments(o,t.email),this.createUserFlags(o)];(await Promise.allSettled(i)).forEach(n=>{if(n.status==="rejected")throw new Error(n.reason)}),this.dispatchTableRefreshEvent(),this.success=!0}catch(i){this.success=!1}finally{this.submittingNewUser=!1}}async createContact(e){const t=await Lt.create({contactInput:e});if(!(t!=null&&t.id))throw new Error("Failed to create the new user.");return t.id}async createRoleAssignments(e,t){const o=[],i=Le(t);if(e.forEach(({rolesData:n})=>{n.filter(a=>a.role.removed===!1).forEach(a=>{a.locations.forEach(r=>{o.push({roleId:a.role.id,location:r.customerKnownSpaceName,accountNumber:a.accountId,contactId:this.newUserId,isInternal:i})})})}),o.length&&!(await Me.create({roleAssignmentInput:o})).length)throw new Error("Failed to assign role(s) to the new user.")}async createUserFlags(e){var t;const o=[];for(const i of e)i.flagData&&((t=i.genericFlagsData)===null||t===void 0||t.forEach(n=>{n.updateService&&n.updateService.updates.forEach(a=>{const r={accountNumber:i.accountId,contactId:this.newUserId,userFlagType:Ct(n.label),location:a.customerKnownSpaceName||""};o.push(r)})}));if(o.length&&!(await Be.create({userFlagAssignmentInput:o})).length)throw new Error("We could not assign the selected flags to the new user.")}dispatchDraftToggleEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDraft,{composed:!0})),this.dispatchDrawerToggleEvent()}dispatchDrawerToggleEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDrawer,{composed:!0}))}dispatchTableRefreshEvent(){document.dispatchEvent(new CustomEvent(_.RefreshTable,{composed:!0}))}toggleDialog(){this.dispatchEvent(new CustomEvent(w.ToggleDialog,{composed:!0,bubbles:!0}))}toggleSuccess(){this.success=!this.success}resetSuccess(){this.success=!1}cancelCreateUser(){this.cancellingCreateUser=!0,setTimeout(()=>{var e;(e=this.createUser)===null||e===void 0||e.resetStep(),this.dispatchEvent(new CustomEvent(w.CancelCreateUser,{composed:!0})),this.cancellingCreateUser=!1},50)}renderCancelDialog(){return l` <ix-dialog ?open="${this.showCancelDialog}" @cancel="${this.toggleDialog}" data-testid="dialog-cancel-add-user"> <div class="dlr-text-heading md:w-[560px]" slot="headline"> Are you sure you want to cancel? </div> <div class="dialog-content" slot="content"> <p>All the details provided will be lost.</p> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" ?disabled="${this.cancellingCreateUser}" @click="${this.toggleDialog}" slot="secondary" data-testid="dismiss-close-create-user-button"> Dismiss </ix-button> <ix-button appearance="text" ?submitting="${this.cancellingCreateUser}" @click="${this.cancelCreateUser}" slot="primary" data-testid="cancel-create-user-button"> Cancel adding user </ix-button> </div> </ix-dialog> `}render(){return l` <create-user .newUserId="${this.newUserId}" ?showDrawer="${this.showDrawer}" ?submitting="${this.submittingNewUser}" ?success="${this.success}" @toggle-drawer="${this.dispatchDrawerToggleEvent}" @create-new-contact="${e=>this.createNewContact(e)}" @toggle-success="${this.toggleSuccess}" @reset-success="${this.resetSuccess}" data-testid="um-create-user"></create-user> <ix-draft header="Draft" subText="Add New User" ?isVisible="${this.showDraft}" @toggle-dialog="${this.toggleDialog}"></ix-draft> ${this.renderCancelDialog()} `}};s([d({type:Boolean})],te.prototype,"showDrawer",void 0),s([d({type:Boolean})],te.prototype,"showDraft",void 0),s([d({type:Boolean})],te.prototype,"showCancelDialog",void 0),s([u()],te.prototype,"success",void 0),s([u()],te.prototype,"newUserId",void 0),s([u()],te.prototype,"submittingNewUser",void 0),s([u()],te.prototype,"cancellingCreateUser",void 0),s([N("create-user")],te.prototype,"createUser",void 0),te=s([b("create-user-container")],te);const ti=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.user-details-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem}.edit-icon{font-size:22px;align-items:center;padding-right:1px}.email,.first-name,.last-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#edit-profile-id{display:flex;flex-direction:column}.single-row-textbox{width:100%}#edit-profile-id>*{margin:5px 0}ix-textbox,md-textfield{--md-outlined-text-field-width:100%;--md-outlined-text-field-focus-width:100%;width:inherit}.user-profile-name-input-group{display:flex;justify-content:space-between;gap:10px}.user-profile-input{padding-bottom:10px;width:100%}ix-phone-number{--ix-phone-number-font-size:16px;--ix-phone-number-text-color:#092241}`;class Hs{async getUserProfile(){try{return await f.UserProfileSettingsApi.getUserSettings()}catch(t){g.handleError(t,"Failed to get user profile.");return}}async updateUserProfile(t){try{return await f.UserProfileSettingsApi.userProfilePatch(t)}catch(o){g.handleError(o,"Failed to update user profile.");return}}}const oi=new Hs;class Vs{constructor(t){(this._host=t).addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}getUserProfile(){return oi.getUserProfile()}updateUserProfile(t){return oi.updateUserProfile(t)}}var js=[{key:"Etc/GMT+12",value:"(UTC-12:00) International Date Line West"},{key:"Etc/GMT+11",value:"(UTC-11:00) Coordinated Universal Time-11"},{key:"America/Adak",value:"(UTC-10:00) Aleutian Islands"},{key:"Pacific/Honolulu",value:"(UTC-10:00) Hawaii"},{key:"Pacific/Marquesas",value:"(UTC-09:30) Marquesas Islands"},{key:"America/Anchorage",value:"(UTC-09:00) Alaska"},{key:"Etc/GMT+9",value:"(UTC-09:00) Coordinated Universal Time-09"},{key:"America/Tijuana",value:"(UTC-08:00) Baja California"},{key:"Etc/GMT+8",value:"(UTC-08:00) Coordinated Universal Time-08"},{key:"America/Los_Angeles",value:"(UTC-08:00) Pacific Time (US, Canada)"},{key:"America/Phoenix",value:"(UTC-07:00) Arizona"},{key:"America/Chihuahua",value:"(UTC-07:00) Chihuahua, La Paz, Mazatlan"},{key:"America/Denver",value:"(UTC-07:00) Mountain Time (US, Canada)"},{key:"America/Whitehorse",value:"(UTC-07:00) Yukon"},{key:"America/Guatemala",value:"(UTC-06:00) Central America"},{key:"America/Chicago",value:"(UTC-06:00) Central Time (US, Canada)"},{key:"Pacific/Easter",value:"(UTC-06:00) Easter Island"},{key:"America/Mexico_City",value:"(UTC-06:00) Guadalajara, Mexico City, Monterrey"},{key:"America/Regina",value:"(UTC-06:00) Saskatchewan"},{key:"America/Bogota",value:"(UTC-05:00) Bogota, Lima, Quito, Rio Branco"},{key:"America/Cancun",value:"(UTC-05:00) Chetumal"},{key:"America/New_York",value:"(UTC-05:00) Eastern Time (US, Canada)"},{key:"America/Port-au-Prince",value:"(UTC-05:00) Haiti"},{key:"America/Havana",value:"(UTC-05:00) Havana"},{key:"America/Indiana/Indianapolis",value:"(UTC-05:00) Indiana (East)"},{key:"America/Grand_Turk",value:"(UTC-05:00) Turks and Caicos"},{key:"America/Asuncion",value:"(UTC-04:00) Asuncion"},{key:"America/Halifax",value:"(UTC-04:00) Atlantic Time (Canada)"},{key:"America/Caracas",value:"(UTC-04:00) Caracas"},{key:"America/Cuiaba",value:"(UTC-04:00) Cuiaba"},{key:"America/La_Paz",value:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan"},{key:"America/Santiago",value:"(UTC-04:00) Santiago"},{key:"America/St_Johns",value:"(UTC-03:30) Newfoundland"},{key:"America/Araguaina",value:"(UTC-03:00) Araguaina"},{key:"America/Sao_Paulo",value:"(UTC-03:00) Brasilia"},{key:"America/Cayenne",value:"(UTC-03:00) Cayenne, Fortaleza"},{key:"America/Argentina/Buenos_Aires",value:"(UTC-03:00) City of Buenos Aires"},{key:"America/Nuuk",value:"(UTC-03:00) Greenland"},{key:"America/Montevideo",value:"(UTC-03:00) Montevideo"},{key:"America/Punta_Arenas",value:"(UTC-03:00) Punta Arenas"},{key:"America/Miquelon",value:"(UTC-03:00) Saint Pierre and Miquelon"},{key:"America/Bahia",value:"(UTC-03:00) Salvador"},{key:"Etc/GMT+2",value:"(UTC-02:00) Coordinated Universal Time-02"},{key:"Atlantic/Azores",value:"(UTC-01:00) Azores"},{key:"Atlantic/Cape_Verde",value:"(UTC-01:00) Cabo Verde Is."},{key:"Etc/UTC",value:"(UTC) Coordinated Universal Time"},{key:"Europe/London",value:"(UTC+00:00) Dublin, Edinburgh, Lisbon, London"},{key:"Atlantic/Reykjavik",value:"(UTC+00:00) Monrovia, Reykjavik"},{key:"Africa/Sao_Tome",value:"(UTC+00:00) Sao Tome"},{key:"Africa/Casablanca",value:"(UTC+01:00) Casablanca"},{key:"Europe/Berlin",value:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"},{key:"Europe/Budapest",value:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague"},{key:"Europe/Paris",value:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris"},{key:"Europe/Warsaw",value:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb"},{key:"Africa/Lagos",value:"(UTC+01:00) West Central Africa"},{key:"Asia/Amman",value:"(UTC+02:00) Amman"},{key:"Europe/Bucharest",value:"(UTC+02:00) Athens, Bucharest"},{key:"Asia/Beirut",value:"(UTC+02:00) Beirut"},{key:"Africa/Cairo",value:"(UTC+02:00) Cairo"},{key:"Europe/Chisinau",value:"(UTC+02:00) Chisinau"},{key:"Asia/Damascus",value:"(UTC+02:00) Damascus"},{key:"Asia/Hebron",value:"(UTC+02:00) Gaza, Hebron"},{key:"Africa/Johannesburg",value:"(UTC+02:00) Harare, Pretoria"},{key:"Europe/Kiev",value:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius"},{key:"Asia/Jerusalem",value:"(UTC+02:00) Jerusalem"},{key:"Africa/Juba",value:"(UTC+02:00) Juba"},{key:"Europe/Kaliningrad",value:"(UTC+02:00) Kaliningrad"},{key:"Africa/Khartoum",value:"(UTC+02:00) Khartoum"},{key:"Africa/Tripoli",value:"(UTC+02:00) Tripoli"},{key:"Africa/Windhoek",value:"(UTC+02:00) Windhoek"},{key:"Asia/Baghdad",value:"(UTC+03:00) Baghdad"},{key:"Europe/Istanbul",value:"(UTC+03:00) Istanbul"},{key:"Asia/Riyadh",value:"(UTC+03:00) Kuwait, Riyadh"},{key:"Europe/Minsk",value:"(UTC+03:00) Minsk"},{key:"Europe/Moscow",value:"(UTC+03:00) Moscow, St. Petersburg"},{key:"Africa/Nairobi",value:"(UTC+03:00) Nairobi"},{key:"Europe/Volgograd",value:"(UTC+04:00) Volgograd"},{key:"Asia/Tehran",value:"(UTC+03:30) Tehran"},{key:"Asia/Dubai",value:"(UTC+04:00) Abu Dhabi, Muscat"},{key:"Europe/Astrakhan",value:"(UTC+04:00) Astrakhan, Ulyanovsk"},{key:"Asia/Baku",value:"(UTC+04:00) Baku"},{key:"Europe/Samara",value:"(UTC+04:00) Izhevsk, Samara"},{key:"Indian/Mauritius",value:"(UTC+04:00) Port Louis"},{key:"Europe/Saratov",value:"(UTC+04:00) Saratov"},{key:"Asia/Tbilisi",value:"(UTC+04:00) Tbilisi"},{key:"Asia/Yerevan",value:"(UTC+04:00) Yerevan"},{key:"Asia/Kabul",value:"(UTC+04:30) Kabul"},{key:"Asia/Tashkent",value:"(UTC+05:00) Ashgabat, Tashkent"},{key:"Asia/Yekaterinburg",value:"(UTC+05:00) Ekaterinburg"},{key:"Asia/Karachi",value:"(UTC+05:00) Islamabad, Karachi"},{key:"Asia/Qyzylorda",value:"(UTC+05:00) Qyzylorda"},{key:"Asia/Kolkata",value:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi"},{key:"Asia/Colombo",value:"(UTC+05:30) Sri Jayawardenepura"},{key:"Asia/Kathmandu",value:"(UTC+05:45) Kathmandu"},{key:"Asia/Almaty",value:"(UTC+06:00) Astana"},{key:"Asia/Dhaka",value:"(UTC+06:00) Dhaka"},{key:"Asia/Omsk",value:"(UTC+06:00) Omsk"},{key:"Asia/Yangon",value:"(UTC+06:30) Yangon (Rangoon)"},{key:"Asia/Bangkok",value:"(UTC+07:00) Bangkok, Hanoi, Jakarta"},{key:"Asia/Barnaul",value:"(UTC+07:00) Barnaul, Gorno-Altaysk"},{key:"Asia/Hovd",value:"(UTC+07:00) Hovd"},{key:"Asia/Krasnoyarsk",value:"(UTC+07:00) Krasnoyarsk"},{key:"Asia/Novosibirsk",value:"(UTC+07:00) Novosibirsk"},{key:"Asia/Tomsk",value:"(UTC+07:00) Tomsk"},{key:"Asia/Shanghai",value:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi"},{key:"Asia/Irkutsk",value:"(UTC+08:00) Irkutsk"},{key:"Asia/Singapore",value:"(UTC+08:00) Kuala Lumpur, Singapore"},{key:"Australia/Perth",value:"(UTC+08:00) Perth"},{key:"Asia/Taipei",value:"(UTC+08:00) Taipei"},{key:"Asia/Ulaanbaatar",value:"(UTC+08:00) Ulaanbaatar"},{key:"Australia/Eucla",value:"(UTC+08:45) Eucla"},{key:"Asia/Chita",value:"(UTC+09:00) Chita"},{key:"Asia/Tokyo",value:"(UTC+09:00) Osaka, Sapporo, Tokyo"},{key:"Asia/Pyongyang",value:"(UTC+09:00) Pyongyang"},{key:"Asia/Seoul",value:"(UTC+09:00) Seoul"},{key:"Asia/Yakutsk",value:"(UTC+09:00) Yakutsk"},{key:"Australia/Adelaide",value:"(UTC+09:30) Adelaide"},{key:"Australia/Darwin",value:"(UTC+09:30) Darwin"},{key:"Australia/Brisbane",value:"(UTC+10:00) Brisbane"},{key:"Australia/Sydney",value:"(UTC+10:00) Canberra, Melbourne, Sydney"},{key:"Pacific/Port_Moresby",value:"(UTC+10:00) Guam, Port Moresby"},{key:"Australia/Hobart",value:"(UTC+10:00) Hobart"},{key:"Asia/Vladivostok",value:"(UTC+10:00) Vladivostok"},{key:"Australia/Lord_Howe",value:"(UTC+10:30) Lord Howe Island"},{key:"Pacific/Bougainville",value:"(UTC+11:00) Bougainville Island"},{key:"Asia/Srednekolymsk",value:"(UTC+11:00) Chokurdakh"},{key:"Asia/Magadan",value:"(UTC+11:00) Magadan"},{key:"Pacific/Norfolk",value:"(UTC+11:00) Norfolk Island"},{key:"Asia/Sakhalin",value:"(UTC+11:00) Sakhalin"},{key:"Pacific/Guadalcanal",value:"(UTC+11:00) Solomon Is., New Caledonia"},{key:"Asia/Kamchatka",value:"(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky"},{key:"Pacific/Auckland",value:"(UTC+12:00) Auckland, Wellington"},{key:"Etc/GMT-12",value:"(UTC+12:00) Coordinated Universal Time+12"},{key:"Pacific/Fiji",value:"(UTC+12:00) Fiji"},{key:"Pacific/Chatham",value:"(UTC+12:45) Chatham Islands"},{key:"Etc/GMT-13",value:"(UTC+13:00) Coordinated Universal Time+13"},{key:"Pacific/Tongatapu",value:"(UTC+13:00) Nuku'alofa"},{key:"Pacific/Apia",value:"(UTC+13:00) Samoa"},{key:"Pacific/Kiritimati",value:"(UTC+14:00) Kiritimati Island"}];const Gs=()=>js.map(({key:e,value:t})=>({timeZone:e,displayName:t}));let L=class extends ke{constructor(){super(...arguments),this.userProfileController=new Vs(this),this.supportedDateFormat={"MM/dd/yyyy":"mm/dd/yyyy (e.g.: 04/24/2023)","dd/MM/yyyy":"dd/mm/yyyy (e.g.: 24/04/2023)","yyyy/MM/dd":"yyyy/mm/dd (e.g.: 2023/04/24)"},this.supportedTimeFormat={"h:mm a":"12-hour clock (e.g. 1:00 PM)","HH:mm":"24-hour clock (e.g. 13:00)"},this.isDialogVisible=!1,this.allowSave=!0,this.isLoading=!1,this.timezones=Gs()}async firstUpdated(){await this.retrieveUserProfile(),this.shouldDisableSaveButton()}async retrieveUserProfile(){this.isLoading=!0,this.userProfile=await this.userProfileController.getUserProfile(),this.isLoading=!1}closeDialog(){this.isDialogVisible=!1,this.dispatchEvent(new CustomEvent("closeEditProfileDialog",{bubbles:!0,composed:!0}))}async saveUserProfileChanges(){var e,t,o,i;const n={profileSettingEditInput:{firstName:(e=q(this.firstName))!==null&&e!==void 0?e:this.firstName.value,lastName:(t=q(this.lastName))!==null&&t!==void 0?t:this.lastName.value,contactPhoneNumber:(o=we(this.phoneNumber))!==null&&o!==void 0?o:this.phoneNumber.value,preferredTimezone:this.preferredTimezone.value,preferredDateFormat:this.preferredDateFormat.value,preferredTimeFormat:this.preferredTimeFormat.value}};((i=this.userProfile)===null||i===void 0?void 0:i.preferredTimezone)!==n.profileSettingEditInput.preferredTimezone&&(n.profileSettingEditInput.timezoneOverridden=!0),this.isLoading=!0,await this.userProfileController.updateUserProfile(n).then(()=>{Xt("Your profile info has been successfully updated",3e3,"center")}),this.saveDateTimeFormatToLocalStorage(n),this.isLoading=!1,this.closeDialog()}validatePhoneInput(e,t){const o=we(e);if(o==="000-000-0000"){e.error=!1,e.errorText="",this.shouldDisableSaveButton();return}if(this.userProfile.contactPhoneNumber=o!=null?o:"",e.required&&!Fe(e,o)){this.allowSave=!1;return}if(!bt(e,t)){this.allowSave=!1;return}e.error=!1,e.errorText="",this.shouldDisableSaveButton()}saveDateTimeFormatToLocalStorage(e){localStorage.setItem("date-format",JSON.stringify({preferredDateFormat:e.profileSettingEditInput.preferredDateFormat,preferredTimeFormat:e.profileSettingEditInput.preferredTimeFormat,preferredTimezone:e.profileSettingEditInput.preferredTimezone})),this.dispatchEvent(new CustomEvent("dateFormatChanged",{bubbles:!0,composed:!0}))}shouldDisableSaveButton(){this.allowSave=!(this.isInvalid()||this.isEmpty())}isInvalid(){return this.firstName.error||this.lastName.error||this.phoneNumber.error}isEmpty(){var e,t,o;return!(!((e=this.userProfile)===null||e===void 0)&&e.firstName)||!(!((t=this.userProfile)===null||t===void 0)&&t.lastName)||!(!((o=this.userProfile)===null||o===void 0)&&o.contactPhoneNumber)}render(){var e,t,o,i,n,a,r,c;return l`<ix-dialog class="dialog z-50 relative" ?open="${this.isDialogVisible}" @close="${()=>this.closeDialog()}"> ${this.isLoading?l`<ix-progress indeterminate slot="content"></ix-progress>`:""} <div class="dlr-text-heading flex p-6" slot="headline"> <span>Edit Profile</span> </div> <form class="dialog-form min-w-0 max-w-full max-[640px]:w-screen px-6 pb-5 pt-[0px]" slot="content" id="edit-profile-id" method="dialog"> <div class="user-profile-name-input-group grid grid-cols-1 sm:grid-cols-2 gap-3"> <div class="user-profile-input"> <ix-textbox required id="first-name" class="textbox" type="text" pattern="${Ne.name}" label="First Name" placeholder="i.e. First Name" value="${(t=(e=this.userProfile)===null||e===void 0?void 0:e.firstName)!==null&&t!==void 0?t:""}" @input="${()=>{var p;this.allowSave=yt(this.firstName,this.firstName.value,"Invalid first name"),this.userProfile.firstName=(p=q(this.firstName))!==null&&p!==void 0?p:"",this.shouldDisableSaveButton()}}"></ix-textbox> </div> <div class="user-profile-input"> <ix-textbox required id="last-name" class="textbox" type="text" pattern="${Ne.name}" label="Last Name" placeholder="i.e. Last Name" value="${(i=(o=this.userProfile)===null||o===void 0?void 0:o.lastName)!==null&&i!==void 0?i:""}" @input="${()=>{var p;this.allowSave=yt(this.lastName,this.lastName.value,"Invalid last name"),this.userProfile.lastName=(p=q(this.lastName))!==null&&p!==void 0?p:"",this.shouldDisableSaveButton()}}"></ix-textbox> </div> </div> <div class="user-profile-input mb-4"> <ix-phone-input required id="phone-number" class="single-row-textbox w-full" label="Phone Number" value="${(a=(n=this.userProfile)===null||n===void 0?void 0:n.contactPhoneNumber)!==null&&a!==void 0?a:""}" @input="${()=>{this.validatePhoneInput(this.phoneNumber,"Invalid phone number")}}"></ix-phone-input> </div> <div class="user-profile-input"> <ix-textbox id="email" class="single-row-textbox" type="email" label="Email Address" readOnly="true" disabled="true" value="${(c=(r=this.userProfile)===null||r===void 0?void 0:r.email)!==null&&c!==void 0?c:""}"></ix-textbox> </div> <div class="user-profile-input"> <ix-select appearance="outlined" id="preferredTimezone" label="Time Zone" menu-positioning="fixed"> ${this.timezones.map(p=>{var m;return l` <ix-select-option value="${p.timeZone}" ?selected="${p.timeZone===((m=this.userProfile)===null||m===void 0?void 0:m.preferredTimezone)}"> <div slot="headline">${p.displayName}</div> </ix-select-option> `})} </ix-select> </div> <div class="user-profile-input"> <ix-select menu-positioning="fixed" appearance="outlined" id="preferredDateFormat" label="Date format"> ${Object.entries(this.supportedDateFormat).map(([p,m])=>{var h;return l` <ix-select-option value="${p}" ?selected="${p===((h=this.userProfile)===null||h===void 0?void 0:h.preferredDateFormat)}"> <div slot="headline">${m}</div> </ix-select-option> `})} </ix-select> </div> <div class="user-profile-input"> <ix-select menu-positioning="fixed" appearance="outlined" id="preferredTimeFormat" label="Time Format"> ${Object.entries(this.supportedTimeFormat).map(([p,m])=>{var h;return l` <ix-select-option value="${p}" ?selected="${p===((h=this.userProfile)===null||h===void 0?void 0:h.preferredTimeFormat)}"> <div slot="headline">${m}</div> </ix-select-option> `})} </ix-select> </div> </form> <div class="dialog-actions p-2" slot="actions"> <ix-button form="edit-profile-id" appearance="text" text="Cancel" @click="${()=>this.closeDialog()}"> Cancel </ix-button> <ix-button id="save-user-button" appearance="text" text="Save Changes" ?disabled="${!this.allowSave||this.isLoading}" @click="${()=>{this.saveUserProfileChanges()}}"> Save Changes </ix-button> </div> </ix-dialog>`}};L.styles=[ti,A],s([d({type:Boolean})],L.prototype,"isDialogVisible",void 0),s([u()],L.prototype,"allowSave",void 0),s([u()],L.prototype,"userProfile",void 0),s([u()],L.prototype,"isLoading",void 0),s([u()],L.prototype,"timezones",void 0),s([N("#first-name")],L.prototype,"firstName",void 0),s([N("#last-name")],L.prototype,"lastName",void 0),s([N("#phone-number")],L.prototype,"phoneNumber",void 0),s([N("#preferredTimezone")],L.prototype,"preferredTimezone",void 0),s([N("#preferredDateFormat")],L.prototype,"preferredDateFormat",void 0),s([N("#preferredTimeFormat")],L.prototype,"preferredTimeFormat",void 0),L=s([b("ui-um-user-profile")],L);class Ks{async getAuthorisation(){const t=await et.getState(),[o,i,n,a]=t;return[o,i,n,a]}}const Js=new Ks;class Zs extends Te{constructor(){super(...arguments),this.expandedNodes=[]}toggleNodeExpanded(t){this.expandedNodes.includes(t)?this.expandedNodes=this.expandedNodes.filter(o=>o!==t):this.expandedNodes.push(t)}async refresh(){this.requestHydration(),this.set(Ts(this.expandedNodes)),this.completeHydration()}}const ii=new Zs({});let O=class extends ke{constructor(){super(),this.errorService=g,this.routes=[],this.baseUrl="",this.isStandalone=!1,this.disableAuthentication=!1,this.compact=localStorage.getItem("compact")==="true",this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1,this.isEditUserProfileDialogOpen=!1,this.handleDrawerEventBinding=this.handleDrawerEvent.bind(this),this.handleCloseEditProfileDialogBinding=this.handleCloseEditProfileDialog.bind(this),this.handleAccountSwitchBinding=this.handleAccountSwitch.bind(this),this.handleEditProfileEventBinding=this.handleEditProfileEvent.bind(this),U.setLoading=!0}connectedCallback(){super.connectedCallback(),window.addEventListener(_.CreateUserClicked,this.handleDrawerEventBinding),document.addEventListener(_.AccountSwitched,this.handleAccountSwitchBinding),window.addEventListener(_.EditProfile,this.handleEditProfileEventBinding)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(_.CreateUserClicked,this.handleDrawerEventBinding),document.removeEventListener(_.AccountSwitched,this.handleAccountSwitchBinding),window.removeEventListener(_.EditProfile,this.handleEditProfileEventBinding),ca(),g.destroyErrorHandler()}async handleAccountSwitch(e){const t=e.detail;U.setAccountNumber(t),await this.fetchData();const o=window.location.href.split("?")[0];window.history.replaceState({},document.title,o)}handleDrawerEvent(){this.toggleDrawer()}async firstUpdated(){await this.configureAuthentication(),await this.fetchData(),this.init(),U.setLoading=!1}updated(e){e.has("routes")&&this.routes.length&&la().setRoutes(this.routes)}async fetchData(){const e=be.getUserDetails(),{email:t}=e;return Js.getAuthorisation().then(o=>{const[i,n,a,r]=o;return U.setMyPermissions(i),M.myPermissions=U.getMyPermissions(),U.setEmail(t),U.setPermissions(n),U.setAccounts(r),me.set(a),ii.refresh(),o})}async configureAuthentication(){this.disableAuthentication||P().UserManagement.UI.DisableUserManagementUIAuth||!this.isStandalone?await this.configureAuthorisation():be.isProcessing()||(be.isLoggedIn()?await this.configureAuthorisation():be.redirectToAuth())}async configureAuthorisation(){const e=be.getUserDetails(),{accountNumber:t}=e;U.setAccountNumber(t)}init(){setTimeout(()=>{this.mainApp&&(ra(this.mainApp,this.baseUrl,vo),$e(window,_.AuthenticationComplete,{accountNumber:U.getAccountNumber()}))})}toggleDrawer(){this.showDraft&&(this.showDraft=!this.showDraft),this.showDrawer=!this.showDrawer}closeDrawer(){this.showDrawer=!1}toggleCompact(){this.compact=!this.compact,localStorage.setItem("compact",`${this.compact}`)}toggleDraft(){this.showDrawer=!this.showDrawer,this.showDraft=!this.showDraft}cancelCreateUser(){this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1}toggleCancelDialog(){this.showCancelDialog=!this.showCancelDialog}renderCreateUser(){return M.hasExternalUserCreate()?l` <create-user-container ?showDrawer="${this.showDrawer}" ?showDraft="${this.showDraft}" ?showCancelDialog="${this.showCancelDialog}" @blur-drawer="${this.toggleCancelDialog}" @toggle-drawer="${this.toggleDrawer}" @toggle-draft="${this.toggleDraft}" @toggle-dialog="${this.toggleCancelDialog}" @close-drawer="${this.closeDrawer}" @cancel-create-user="${this.cancelCreateUser}"></create-user-container> `:x}renderLoading(){return U.getLoading?l` <main> <error-dialog></error-dialog> <ix-progress id="application-loading-bar" aria-label="Application loading bar" indeterminate></ix-progress> </main> `:x}handleEditProfileEvent(){this.isEditUserProfileDialogOpen=!0}handleCloseEditProfileDialog(){this.isEditUserProfileDialogOpen=!1}renderEditProfileForm(){return l` <ui-um-user-profile ?isDialogVisible="${this.isEditUserProfileDialogOpen}" @closeEditProfileDialog="${this.handleCloseEditProfileDialogBinding}"></ui-um-user-profile>`}render(){return l` ${this.renderCreateUser()} <div class="flex flex-col"> <div class="animate-width absolute inset-0 bg-black opacity-50 z-20 ${this.compact?"hidden":"block"} lg:hidden" @click="${this.toggleCompact}" @keypress="${this.toggleCompact}"></div> ${this.isStandalone?l` <nav class="nav-bar wide p-4 m-2 rounded-xl flex items-center relative z-1 md:hidden"> <div class="flex-1"> <ix-icon-button @click="${this.toggleCompact}" icon="menu" class="white-icon"></ix-icon-button> </div> <div class="w-[178px]"> <svg focusable="false" viewBox="0 0 178 27" fill="white" class="w-full"> ${je.digitalRealtyLogoWithText} </svg> </div> <div class="flex-1"></div> </nav> `:x} <div class="w-full h-full flex relative ${this.showDrawer?"drawer-visible":""}"> ${this.isStandalone?l` <div class="${this.compact?"left-[-200px]":"left-0"} min-w-[96px] absolute z-1 md:relative lg:min-w-fit md:left-0 animate-width h-screen"> <navigation-bar @toggle-menu="${this.toggleCompact}" ?compact="${this.compact}" class="h-full p-2 block absolute drop-shadow-lg overflow-auto sm:overflow-visible lg:static lg:p-4"></navigation-bar> </div> `:x} <div class="grow w-full h-full"> <div class="flex flex-col grow h-full ${this.isStandalone?"p-2 lg:p-4":""}"> ${this.isStandalone?l`<app-header @create-user="${this.toggleDrawer}"></app-header>`:x} <main class="h-full">${this.renderLoading()}</main> </div> </div> </div> </div> ${this.renderEditProfileForm()}`}};O.styles=[to,Ee,A],s([d({type:Array})],O.prototype,"routes",void 0),s([d({type:String})],O.prototype,"baseUrl",void 0),s([d({type:Boolean})],O.prototype,"isStandalone",void 0),s([d({type:Boolean,attribute:!0})],O.prototype,"disableAuthentication",void 0),s([d({type:Boolean,attribute:!1})],O.prototype,"compact",void 0),s([u()],O.prototype,"showDrawer",void 0),s([u()],O.prototype,"showDraft",void 0),s([u()],O.prototype,"showCancelDialog",void 0),s([u()],O.prototype,"isEditUserProfileDialogOpen",void 0),s([N("main")],O.prototype,"mainApp",void 0),O=s([b("ui-user-management")],O);export{xa as $,_ as A,Te as B,go as C,P as D,tt as E,Bo as F,Pe as G,Be as H,Dt as I,rt as J,Cs as K,st as L,Ut as M,Le as N,ts as O,zo as P,No as Q,z as R,ti as S,A as T,ot as U,vt as V,ha as W,yt as X,bt as Y,we as Z,pa as _,U as a,Ne as a0,fa as a1,bo as a2,xt as a3,w as a4,To as a5,ce as a6,ne as a7,$t as a8,At as a9,_t as aa,k as ab,Zo as ac,et as ad,Wo as ae,wt as af,Co as ag,ei as ah,da as b,M as c,V as d,eo as e,me as f,Ke as g,ii as h,va as i,Ii as j,q as k,wa as l,ga as m,Je as n,St as o,g as p,at as q,$e as r,Ze as s,Xo as t,Lt as u,zs as v,kt as w,Xt as x,Me as y,Lo as z};
2005
+ `;class nt{}nt.BTN_ADD_ROLE="user-details-tab-roles-btn-add-role",nt.BTN_REMOVE_ROLE="user-details-tab-roles-btn-remove-role";const Rt={RoleSelect:"role-select",OpenRoleMenu:"open-role-menu",RemoveRoleMenu:"open-remove-role-menu"};let X=class extends I{constructor(){super(...arguments),this.disableEscapeKeyBinding=this.disableEscapeKey.bind(this),this.assignedRoles=[],this.activeRoleId="",this.canAddRoles=!1,this.addRolesDisabled=!1,this.canRemoveRoles=!1,this.removeRolesDisabled=!1}connectedCallback(){super.connectedCallback(),this.tabs&&this.tabs.addEventListener("keydown",this.disableEscapeKeyBinding)}disconnectedCallback(){super.disconnectedCallback(),this.tabs&&this.tabs.removeEventListener("keydown",this.disableEscapeKeyBinding)}disableEscapeKey(e){return e.which===27?!1:null}handleRoleClick(e,t){this.dispatchEvent(new CustomEvent(Rt.RoleSelect,{detail:{roleId:t},bubbles:!0,composed:!0})),e.target.scrollIntoView({inline:"center",behavior:"smooth",block:"nearest"})}dispatchOpenRoleMenu(){this.dispatchEvent(new CustomEvent(Rt.OpenRoleMenu,{bubbles:!0,composed:!0}))}dispatchOpenRemoveRoleMeu(){this.dispatchEvent(new CustomEvent(Rt.RemoveRoleMenu,{bubbles:!0,composed:!0}))}setActiveRole(e){this.tabs&&(this.tabs.activeTabIndex=this.assignedRoles.findIndex(t=>t.id===e))}renderAddRoleButton(){return this.canAddRoles?l` <ix-button data-testid="${nt.BTN_ADD_ROLE}" appearance="text" @click="${()=>this.dispatchOpenRoleMenu()}" class="primary" aria-label="Add Role" ?disabled="${this.addRolesDisabled}" has-icon> <md-icon slot="icon">add</md-icon> Add Role </ix-button> `:x}renderRemoveRoleButton(){return this.canRemoveRoles?l` <ix-button data-testid="${nt.BTN_REMOVE_ROLE}" appearance="outlined" .disabled="${this.removeRolesDisabled}" @click="${()=>this.dispatchOpenRemoveRoleMeu()}" class="cancel"> <span>REMOVE ROLE</span> </ix-button> `:x}renderRole(e){return e?l`<ix-primary-tab data-testid="ix-tab-role-${e.id}" @click="${t=>this.handleRoleClick(t,e.id)}" ?activeDisabled="${e.id===this.activeRoleId}"><span id="${`role-tab-${e.id}`}" class="font-bold flex items-center uppercase">${e.name}</span> </ix-primary-tab>`:x}render(){return l` <div class="tab-container"> <div class="flex gap-4 max-w-full overflow-hidden tab-outer-wrapper"> <div class="flex-1 overflow-auto tab-inner-wrapper"> <ix-tabs data-testid="ix-tabs-roles" id="roles-tabs" .scrollButtons="${this.assignedRoles.length>1}" hideScrollBar left-align="true"> ${this.assignedRoles.map(e=>this.renderRole(e))} </ix-tabs> </div> <div class="flex items-center gap-4 shrink-0 tab-inner-wrapper"> ${this.renderAddRoleButton()} ${this.renderRemoveRoleButton()} </div> </div> </div> `}};X.styles=[tt,ot,A,ue,As],s([d({type:Array,attribute:!1})],X.prototype,"assignedRoles",void 0),s([d({type:String,attribute:!1})],X.prototype,"activeRoleId",void 0),s([d({type:Boolean})],X.prototype,"canAddRoles",void 0),s([d({type:Boolean})],X.prototype,"addRolesDisabled",void 0),s([d({type:Boolean})],X.prototype,"canRemoveRoles",void 0),s([d({type:Boolean})],X.prototype,"removeRolesDisabled",void 0),s([N("#roles-tabs")],X.prototype,"tabs",void 0),X=s([b("user-details-tab-roles")],X);const Lo=e=>U.getAccounts().find(t=>t.accountNumber===e),Oo=(e,t)=>{const o=e.filter(i=>i.parentAccountNumber===t);return o.length?o.flatMap(i=>({id:i.accountNumber,name:i.name,displayName:i.displayName,subaccounts:Oo(e,i.accountNumber)})):[]},at=e=>{try{const t=e.map(i=>i.accountNumber),o=e.filter(i=>!t.includes(i.parentAccountNumber||""));if(!o)throw new Error("Failed to get nested account structure");return o.map(i=>({id:i.accountNumber,name:i.name,displayName:i.displayName,subaccounts:Oo(e,i.accountNumber)}))}catch(t){return console.error("Could not get nested account structure",t),[]}},St=()=>U.getAccounts().sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:"base"})),zo=e=>me.get().find(t=>t.id===e)||null,Cs=e=>{const t=[],o=[...new Set(e.map(i=>i.roleId))];for(const i of o){const n=zo(i);n&&t.push(n)}return t},qo=e=>{var t;return{label:(t=e.displayName)!==null&&t!==void 0?t:e.name,id:e.id,children:e.subaccounts.map(o=>qo(o))}},Ho=(e,t)=>{e.children&&e.children.length&&e.children.forEach(i=>Ho(i,t));const o=t.filter(i=>e.id===i.accountNumber).map(i=>({label:i.name,id:i.id,children:void 0}));e.children&&(e.children=o.concat(e.children))},Ts=e=>{const t=[],o=St().filter(r=>M.hasCustomRolesRead(r.accountNumber)||M.hasCustomRolesCreate(r.accountNumber)||M.hasCustomRolesUpdate(r.accountNumber)||M.hasCustomRolesApprove(r.accountNumber)),i=at(o);i.forEach(r=>t.push(qo(r)));const n=me.get().filter(r=>r.roleType===V.Custom);t.forEach(r=>{Ho(r,n),r.expanded=e.includes(r.id)});const a=i.some(r=>!!r.subaccounts.length);return{tree:{label:"root",id:"root",children:t},isEndChild:!a&&o.length<=1}},Ut=(e,t,o=!1)=>{let i=t.filter(n=>n.accountNumber===e||n.roleType===V.Default||n.roleType===V.Internal||n.roleType===V.GlobalAccess);return o||(i=i.filter(n=>n.roleType!==V.Internal&&n.roleType!==V.GlobalAccess)),i};class J{}J.HEADING="add-account-role-dialog-heading",J.ROLE_SELECTOR="add-account-role-dialog-role-selector",J.ROLE_OPTION=e=>`add-account-role-dialog-role-option-${e}`,J.BTN_CANCEL="add-account-role-dialog-cancel-button",J.BTN_ADD="add-account-role-dialog-add-role-button",J.SUCCESS_MESSAGE="add-account-role-dialog-success-message";function Le(e){return P().InternalUserDomainWhitelist.split(",").some(t=>e==null?void 0:e.includes(t))}let j=class extends I{constructor(){super(...arguments),this.roles=[],this.assignedRoles=[],this.isOpen=!1,this.loading=!1,this.roleId="",this.disabled=!0,this.handleEscapeKeyBinding=this.handleEscapeKey.bind(this),this.handleCancelChangesBinding=this.handleCancelChanges.bind(this)}get name(){var e,t;return`${(e=this.contact)===null||e===void 0?void 0:e.firstName} ${(t=this.contact)===null||t===void 0?void 0:t.lastName}`}get addableRoles(){var e,t,o;if(!(!((e=this.account)===null||e===void 0)&&e.accountNumber))return[];const i=Le((t=this.contact)===null||t===void 0?void 0:t.email)&&M.hasAssignInternalRoleCreate((o=this.account)===null||o===void 0?void 0:o.accountNumber);return Ut(this.account.accountNumber,this.roles,i)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleEscapeKeyBinding),this.addEventListener("blur",this.handleCancelChangesBinding)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleEscapeKeyBinding),this.removeEventListener("blur",this.handleCancelChangesBinding)}handleEscapeKey(e){return e.which===27&&(this.isOpen=!1),null}async handleOpenDialog(){this.isOpen=!0;const e=await this.rolesMenu;e==null||e.reset(),this.disabled=!0}async handleConfirmChanges(){this.dispatchEvent(new CustomEvent(_.AddRole,{detail:{roleId:this.roleId}}))}async handleCancelChanges(){this.isOpen=!1}handleRoleSelect(e){e&&(this.disabled=!1)}renderRoleOptions(){return l` ${this.addableRoles.map((e,t)=>l` <ix-select-option class="option" value="${t}" ?disabled="${this.assignedRoles.some(o=>o.id===e.id)}" @click="${()=>{this.roleId=this.addableRoles[t].id}}" data-testid="${J.ROLE_OPTION(e.name)}"> <div slot="headline">${e.name}</div> </ix-select-option>`)} `}renderHeader(){var e;return l` <div id="confirmation-header" slot="headline" style="max-width:560px" data-testid="${J.HEADING}"> <h1 class="dlr-text-heading break-words"> Add Role to ${this.name} for ${(e=this.account)===null||e===void 0?void 0:e.name} </h1> </div>`}renderContent(){return l` <div slot="content" method="dialog"> <form slot="content" style="padding-top:0" id="add-role-to-roles" method="dialog"> <ix-select quick menu-below class="thick" id="roles-menu" menu-positioning="fixed" @input="${e=>this.handleRoleSelect(e.target.value)}" data-testid="${J.ROLE_SELECTOR}"> ${this.renderRoleOptions()} </ix-select> </form> </div>`}renderFooter(){return l` <div class="add-roles-dialog-actions" slot="actions"> <ix-button form="confirm-updates" appearance="text" text="Cancel" ?disabled="${this.loading}" @click="${()=>this.handleCancelChanges()}" data-testid="${J.BTN_CANCEL}"> Cancel </ix-button> <ix-button id="add-account-button" form="confirm-updates" appearance="text" text="Add Role" ?disabled="${this.disabled}" ?submitting="${this.loading}" @click="${this.handleConfirmChanges}" data-testid="${J.BTN_ADD}">Add Role </ix-button> </div> `}render(){return l` <ix-dialog class="z-50 relative" id="add-role-to-account" ?open="${this.isOpen}"> ${this.renderHeader()} ${this.renderContent()} ${this.renderFooter()} </ix-dialog>`}};j.styles=[tt,ot,A],s([d({type:Object})],j.prototype,"contact",void 0),s([d({type:Object})],j.prototype,"account",void 0),s([d({type:Array})],j.prototype,"roles",void 0),s([d({type:Array})],j.prototype,"assignedRoles",void 0),s([d({type:Boolean,reflect:!0})],j.prototype,"isOpen",void 0),s([u()],j.prototype,"loading",void 0),s([u()],j.prototype,"roleId",void 0),s([u()],j.prototype,"disabled",void 0),s([ai("#roles-menu")],j.prototype,"rolesMenu",void 0),j=s([b("add-account-role")],j);const $t=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.cards-container{display:flex;flex-wrap:wrap}.cards-container>:first-child{padding:8px 8px 8px 0}.cards-container>:not(:first-child){padding:8px}.tree-role-locations-count{margin:0;color:rgba(9,34,65,.3);padding-right:20px;text-transform:uppercase;font-weight:700}.tree-role-locations-count-active{margin:0;padding-right:40px;text-transform:uppercase;font-weight:700;font-size:.875rem;font-family:var(--root-secondary-font)}.assign-portal-access-text{font-family:Open Sans;font-weight:400;font-size:12px;line-height:16px;letter-spacing:.4px;color:#092241B2;margin-top:.25rem;margin-bottom:1rem}ix-button{font-family:var(--root-secondary-font)}.remove{color:#db0028}.permissions-content{width:800px}.dismiss-btn{color:#1456e0}@media only screen and (max-width:600px){#next-button{display:inline-block}.next-control{text-align:center}.tree-view-container-footer{padding-bottom:1rem}.permissions-content{width:auto}.cards-container{display:flex;flex-wrap:nowrap;max-width:100%;overflow-x:auto}}@media only screen and (min-width:601px){.permissions-locations{display:flex;justify-content:space-between;align-items:center;width:100%}.controls{display:flex;justify-content:space-between;align-items:center}}@media only screen and (max-width:600px){.cards-container{flex-wrap:unset;overflow-x:auto}.tree-role-locations{margin-top:-3px!important}.tree-role-locations-count,.tree-role-locations-count-active{font-size:.875rem!important}}`,Is={ToggleActiveCard:"toggle-active-card"};let _e=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.isRoles=!1}dispatchToggleActiveCard(e){this.dispatchEvent(new CustomEvent(Is.ToggleActiveCard,{detail:{accountId:e},bubbles:!0,composed:!0}))}renderCards(){return this.dataForAccounts.map(e=>{if(this.isRoles){const o=e.rolesData.filter(i=>i.role.removed===!1).map(i=>i.role.name);return l` <ix-card data-testid="ix-card-${e.accountId}" .itemId="${e.accountId}" .name="${e.accountName}" .names="${o}" .type="${"roles"}" ?isActive="${this.selectedAccountId===e.accountId}" @toggle-card="${i=>{this.dispatchToggleActiveCard(i.detail)}}"></ix-card> `}const t=ne.map(o=>o.text);return l` <ix-card data-testid="ix-card-${e.accountId}" .itemId="${e.accountId}" .name="${e.accountName}" .names="${t}" .type="${"flags"}" .isActive="${this.selectedAccountId===e.accountId}" @toggle-card="${o=>{this.dispatchToggleActiveCard(o.detail)}}"></ix-card> `})}render(){return l`<div class="cards-container">${this.renderCards()}</div> `}};_e.styles=[$t,A,Ee,ue],s([d({type:Array})],_e.prototype,"dataForAccounts",void 0),s([d({type:String})],_e.prototype,"selectedAccountId",void 0),s([d({type:Boolean})],_e.prototype,"isRoles",void 0),_e=s([b("account-tabbing-card")],_e);class st{constructor(){this.updates=[]}get nodeUpdates(){return this.updates}update(t){this.updates=[];let o=[];t&&(o=yi(t));for(const i of o)i.originalCheckedStatus!==i.checked&&this.updates.push(i)}}class Vo{constructor(){this._nodeUpdates=[]}create(t){if(this._nodeUpdates.find(i=>i.key===t))return;const o=new st;this._nodeUpdates.push({key:t,item:o})}update(t,o){const i=this._nodeUpdates.find(n=>n.key===t);i==null||i.item.update(o)}get nodeUpdates(){return this._nodeUpdates}get isDirty(){let t=0;return this._nodeUpdates.forEach(o=>{t+=o.item.nodeUpdates.length}),t>0}get nodeChanges(){const t=[];return this._nodeUpdates.forEach(o=>{o.item.nodeUpdates.length>0&&o.item.nodeUpdates.forEach(i=>{const n=t.find(a=>a.key===o.key);n?n.items.push(i):t.push({key:o.key,items:[i]})})}),t}reset(){this._nodeUpdates=[]}remove(t){this._nodeUpdates=this._nodeUpdates.filter(o=>o.key!==t)}}function Nt(e,t){var o,i;const n=[],a=t.toLowerCase().trim();if(a.length<2||((!((o=e.label)===null||o===void 0)&&o.toLowerCase().includes(a)||!((i=e.secondaryLabel)===null||i===void 0)&&i.toLowerCase().includes(a))&&n.push(e),!e.children))return n;for(const r of e.children){const c=Nt(r,t);n.push(...c)}return n}function jo(e,t,o){if(e==="previous"){const i=o.indexOf(t)-1,n=i<0?o.length-1:i;return o[n]}if(e==="next"){const i=o.indexOf(t)+1,n=i>=o.length?0:i;return o[n]}}function Go(e,t){const o=[];for(const i of t){o.push(i.id),i.selected=!0;let n=He(e,i.id);for(;n!=null&&n.parentId;)n=He(e,n.parentId),n&&(n.expanded=!0)}return o}function Ft(e){e.selected=!1,e.children&&e.children.forEach(t=>{Ft(t)})}class _s{constructor(){this._dataCollection=new Map}capture(t){var o;let i;const n=this._dataCollection.get(t);return n&&(i=xo(n.data),!((o=n.options)===null||o===void 0)&&o.consume&&this._dataCollection.delete(t)),i}emit(t,o){o.options={lock:!1,consume:!0,...o.options},this._store(t,o)}lock(t){const o=this._dataCollection.get(t);o&&(o.options.lock=!0)}remove(t){this._dataCollection.delete(t)}_store(t,o){var i;const n=this._dataCollection.get(t);return n&&!((i=n.options)===null||i===void 0)&&i.lock?!1:(this._dataCollection.set(t,xo(o)),!0)}}const rt=new _s;class ks extends Te{}const Dt=new ks({});let F=class extends I{constructor(){super(...arguments),this.searching=!1,this.disableTree=!1,this.readonly=!1,this.activeRoleId="",this.searchResultCount=0,this.searchResultIndex=0,this.selectedIds=[],this.loadingNodes=!1,this.assignmentUpdateManagers=[],this.searchText="",this.onSearchTextChange=Zt(async e=>{var t;this.searchText=e.detail.searchText;const o=(t=this.assignment)===null||t===void 0?void 0:t.rootNode;Ft(o);const i=Nt(o,this.searchText);i.length&&Ve(o),this.searchResultCount=i.length;const n=Go(o,i);[this.selectedId]=n,this.selectedIds=[...n],this.searchResultIndex=n.indexOf(this.selectedId)+1,this.requestUpdate()},500)}updated(e){super.updated(e),e.has("activeRoleId")&&this.handleNonLocationTrees()}disconnectedCallback(){super.disconnectedCallback(),this.emitUpdates()}emitUpdates(){var e,t;const o=Dt.get(),i=(e=this.assignmentUpdateManagers.find(c=>c.accountId===o.accountNumber))===null||e===void 0?void 0:e.nodeManager,n=i==null?void 0:i.nodeUpdates.flatMap(c=>c.item.nodeUpdates);if(!(o!=null&&o.accountNumber)&&!i)return;const a={data:n||[],options:{consume:!1}},r=`${o.accountNumber}:${(t=this.contact)===null||t===void 0?void 0:t.id}`;rt.emit(r,a)}dispatchCheckToggleEvent(e){this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{updates:structuredClone(e)}}}))}handleNonLocationTrees(){const e=me.get().find(n=>{var a;return n.id===((a=this.assignment)===null||a===void 0?void 0:a.role)});if(!e||!this.assignment)return;if(!e.permissions.every(n=>n.isNonLocation)){this.disableTree=!1;return}const t=this.assignment.rootNode.children[0];t.checked=!0,this.disableTree=!0,fe(t,this.assignment.rootNode);const o=this.getOrCreateNodeManager();if(!o)return;const i=o.nodeUpdates.find(n=>{var a;return n.key===((a=this.assignment)===null||a===void 0?void 0:a.role)});i&&(i.item.update(this.assignment.rootNode),this.dispatchCheckToggleEvent(o.nodeChanges))}onTreeCheckToggle(e){var t;try{const o=this.getOrCreateNodeManager();if(!o)throw new Error("Node manager is missing.");const i=o.nodeUpdates.find(n=>{var a;return n.key===((a=this.assignment)===null||a===void 0?void 0:a.role)});i&&i.item.update(e.detail.message.rootNode),!((t=this.assignment)===null||t===void 0)&&t.rootNode&&(this.assignment.rootNode=structuredClone(e.detail.message.rootNode)),this.dispatchCheckToggleEvent(o.nodeChanges)}catch(o){g.handleError(o,"Failed to toggle tree check.")}}async onTreeExpandToggle(e){var t,o;try{const i=e.detail.message.update,n=e.detail.message.node;if(n.children&&n.children.length)return;if(!this.contact.id||!this.accountNumber)throw new Error("Contact ID or Account Number is missing.");n.loading=!0;const a=await Xa((t=this.assignment)===null||t===void 0?void 0:t.role,this.contact.id,this.accountNumber,n.id,void 0,!0,Le((o=this.contact)===null||o===void 0?void 0:o.email));n.loading=!1,a[0].inventoryItems&&a[0].inventoryItems.length&&(a[0].inventoryItems.forEach(r=>{ce(r,n),n.originalCheckedStatus!==n.checked&&fe(n,n)}),i())}catch(i){g.handleError(i,"Failed to expand tree node.")}}destroyRoleManager(){const e=this.assignmentUpdateManagers.find(t=>t.accountId===this.accountNumber);e&&(e.nodeManager.reset(),this.assignmentUpdateManagers=this.assignmentUpdateManagers.filter(t=>t.accountId!==this.accountNumber))}getOrCreateNodeManager(){var e;let t;try{if(!this.accountNumber)throw new Error("Account number is missing.");t=(e=this.assignmentUpdateManagers.find(o=>o.accountId===this.accountNumber))===null||e===void 0?void 0:e.nodeManager,t||(this.assignmentUpdateManagers.push({accountId:this.accountNumber,nodeManager:new Vo}),t=this.assignmentUpdateManagers.find(o=>o.accountId===this.accountNumber).nodeManager)}catch(o){g.handleError(o,"Failed to get or create node manager.")}return t}disableCheckboxes(){return this.readonly?!0:this.disableTree}onSearchNavigation(e){if(!this.selectedIds.length)return;const t=jo(e.detail.direction,this.selectedId,this.selectedIds);this.selectedId=t!=null?t:this.selectedId,this.searchResultIndex=this.selectedIds.indexOf(this.selectedId)+1,this.requestUpdate()}render(){var e;const t=this.getOrCreateNodeManager();return t&&this.assignment&&t.create(this.assignment.role),l` <div class="flex items-center py-[0.75rem]"> <h1 class="dlr-text-heading">Portal Access</h1> <ix-progress .linear="${!1}" .indeterminate="${!0}" style="visibility:${this.searching?"visible":"hidden"}"></ix-progress> </div> <ix-generic-tree data-testid="location-treeview" .rootNode="${(e=this.assignment)===null||e===void 0?void 0:e.rootNode}" .searchText="${this.searchText}" .selectedId="${this.selectedId}" .showCheckboxes="${!0}" .disableCheckboxes="${this.disableCheckboxes()}" @search-text-change="${this.onSearchTextChange}" @search-navigation="${o=>this.onSearchNavigation(o)}" @check-toggle="${o=>this.onTreeCheckToggle(o)}" @expand-toggle="${o=>this.onTreeExpandToggle(o)}" searchEnabled .searchResultCount="${this.searchResultCount}" .searchResultIndex="${this.searchResultIndex}" searchPlaceholder="Search by Site or Asset Name.."></ix-generic-tree> `}};F.styles=[A,E`:host{--md-circular-progress-size:28px}`],s([d({type:Object,attribute:!1})],F.prototype,"assignment",void 0),s([d({type:Object})],F.prototype,"contact",void 0),s([d({type:String})],F.prototype,"accountNumber",void 0),s([d({type:String})],F.prototype,"selectedId",void 0),s([d({type:Boolean})],F.prototype,"searching",void 0),s([d({type:Boolean})],F.prototype,"disableTree",void 0),s([d({type:Boolean})],F.prototype,"readonly",void 0),s([d({type:String})],F.prototype,"activeRoleId",void 0),s([u()],F.prototype,"searchResultCount",void 0),s([u()],F.prototype,"searchResultIndex",void 0),s([u()],F.prototype,"selectedIds",void 0),s([u()],F.prototype,"loadingNodes",void 0),s([u()],F.prototype,"assignmentUpdateManagers",void 0),s([u()],F.prototype,"searchText",void 0),F=s([b("user-details-assignments")],F);let D=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.permissions=[],this._dataForAccounts=[],this.showPermissionsDialog=!1,this.removeRoleDialogOpen=!1,this._nextButtonEnabled=!1}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._selectedAccountId=this.selectedAccountId,this._selectedRoleId=this.selectedRoleId,this.validateStep(),this.dispatchValidateStepEvent(),this.setInitialRole()}get noOfLocations(){var e;return jt((e=this.selectedRoleData)===null||e===void 0?void 0:e.genericTreeView)}get canAddRolesDisabled(){return this.unAvailableRoles&&this.unAvailableRoles.length<=0}get availableRoles(){const e=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.filter(o=>o.role.removed===!1);return t==null?void 0:t.flatMap(o=>o.role)}get unAvailableRoles(){const e=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.filter(o=>o.role.removed===!0);return t==null?void 0:t.flatMap(o=>o.role)}get roles(){const e=this._dataForAccounts.find(t=>t.accountId===this._selectedAccountId);return e==null?void 0:e.rolesData.flatMap(t=>t.role)}get selectedAccount(){return this._dataForAccounts.find(e=>e.accountId===this._selectedAccountId)}get selectedRole(){return this.selectedAccount.rolesData.find(e=>e.role.id===this._selectedRoleId).role}get selectedRolePermissions(){var e,t;return(t=(e=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId))===null||e===void 0?void 0:e.rolesData.find(o=>o.role.id===this._selectedRoleId))===null||t===void 0?void 0:t.role.permissions}get selectedRoleData(){return this.selectedAccount.rolesData.find(e=>e.role.id===this._selectedRoleId)}toggleActiveCard(e){var t;this._selectedAccountId=e,this._selectedRoleId=(t=this._dataForAccounts.find(o=>o.accountId===e))===null||t===void 0?void 0:t.rolesData[0].role.id,this._dataForAccounts.forEach(o=>{o.accountId!==e?o.active=!1:o.active=!0}),this.roleTabComponent.setActiveRole(this._selectedRoleId),this.setInitialRole(),this.requestUpdate()}setInitialRole(){this.availableRoles&&this.availableRoles.length>0&&(this._selectedRoleId=this.availableRoles[0].id)}dispatchOpenAddAccountRole(){this.addRoleDialog.handleOpenDialog()}dispatchTabControl(e){this._selectedRoleId=this.roles[e].id,this.roleTabComponent.setActiveRole(this._selectedRoleId)}addRole(e){var t;const o=this.selectedAccount.rolesData.findIndex(i=>i.role.id===e);if(this.selectedAccount.rolesData[o].role.permissions.every(i=>i.isNonLocation)){const i=this.selectedAccount.rolesData[o].genericTreeView;if(!(!((t=i==null?void 0:i.children)===null||t===void 0)&&t.length))return;const n=i.children[0];n.checked=!0,fe(n,i),this.selectedAccount.rolesData[o].locations.push(n)}else this.selectedAccount.rolesData[o].locations=[];this.selectedAccount.rolesData[o].role.removed=!1,this.requestUpdate(),this.dispatchTabControl(o),this.addRoleDialog.handleCancelChanges()}dispatchRemoveRoleEvent(){const e=this.roles.findIndex(o=>o.id===this._selectedRoleId);this.roles[e].removed=!0;const t=this.selectedAccount.rolesData.findIndex(o=>o.role.id===this._selectedRoleId);this.selectedAccount.rolesData[t].locations=[],this.selectedAccount.rolesData[t].role.removed=!0,this.selectedAccount.rolesData[t].genericTreeView&&At(this.selectedAccount.rolesData[t].genericTreeView),this.validateStep(),this.setInitialRole(),this.requestUpdate()}renderTree(){const e=this._dataForAccounts.find(n=>n.accountId===this._selectedAccountId),t=e==null?void 0:e.rolesData.find(n=>n.role.id===this._selectedRoleId);if(!t)return x;const o={role:t.role.id,rootNode:t.genericTreeView},i=n=>{this.requestUpdate();const{updates:a}=n.detail.message,r=a.find(c=>c.key===t.role.id);r!=null&&r.items?t.locations=r.items.filter(c=>c.checked):t.locations=[],this.validateStep(),this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()};if(o&&o.rootNode){const n=t==null?void 0:t.role.permissions.every(a=>a.isNonLocation);return l`<user-details-assignments .assignment="${o}" .contact="${this.contact}" .accountNumber="${e==null?void 0:e.accountId}" @check-toggle="${i}" ?disableTree="${n}"></user-details-assignments>`}return x}validateStep(){let e=!0;for(const t of this._dataForAccounts)if(!t.rolesData.filter(o=>o.role.removed===!1).every(o=>o.locations.length)){e=!1;break}this._nextButtonEnabled=e}renderRoles(){var e,t;return l` <user-details-tab-roles id="role-data-element" .assignedRoles="${this.availableRoles}" .activeRoleId="${(e=this._selectedRoleId)!==null&&e!==void 0?e:""}" .canRemoveRoles="${!0}" .removeRolesDisabled="${((t=this.availableRoles)===null||t===void 0?void 0:t.length)<=1}" .canAddRoles="${!0}" .addRolesDisabled="${this.canAddRolesDisabled}" @role-select="${o=>this._selectedRoleId=o.detail.roleId}" @open-role-menu="${()=>this.dispatchOpenAddAccountRole()}" @open-remove-role-menu="${()=>this.removeRoleDialogOpen=!0}"></user-details-tab-roles> `}renderAddAccountRoleConfirmation(){var e;return l`<add-account-role id="add-role-dialog" .contact="${this.contact}" .account="${Lo((e=this.selectedAccount)===null||e===void 0?void 0:e.accountId)||""}" .assignedRoles="${this.availableRoles}" .roles="${this.roles}" @add-role="${t=>this.addRole(t.detail.roleId)}"> </add-account-role>`}renderRemoveRoleConfirmation(){return l`<changes-confirmation id="remove-role-dialog" ?isOpen="${this.removeRoleDialogOpen}" .headerText="${"Are you sure you want to remove this role?"}" .bodyText="${"The user will no longer be able to perform the permissions of this role for this account."}" .confirmationButtonText="${"Remove Role"}" @confirm="${()=>{this.dispatchRemoveRoleEvent(),this.validateStep(),this.removeRoleDialogOpen=!1}}" @cancel="${()=>this.removeRoleDialogOpen=!1}"> </changes-confirmation>`}renderControls(){return l` <div class="controls"> <div class="flex justify-between py-2 items-center permissions-locations"> ${this.renderViewPermissionsButton()} <div class="flex items-center">${this.renderLocationsCount()}</div> </div> <div class="next-control"> <ix-button id="next-button" type="submit" has-icon trailing-icon ?disabled="${!this._nextButtonEnabled}" @click="${()=>{this.dispatchNextStepEvent()}}" data-testid="step-four-next-button"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}renderPermissionsDialog(){var e,t;return l` <ix-dialog ?open="${this.showPermissionsDialog}" @close="${()=>this.showPermissionsDialog=!1}"> <div class="dlr-text-heading" slot="headline">${this.selectedRole.name}</div> <div class="permissions-content" slot="content"> <user-details-permission inPermissionsDialog .permissionData="${(t=_t((e=this.selectedRolePermissions)!==null&&e!==void 0?e:[]))!==null&&t!==void 0?t:[]}"> </user-details-permission> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.togglePermissionsDialog}" slot="secondary"><span class="dismiss-btn">Dismiss</span></ix-button> </div> </ix-dialog> `}togglePermissionsDialog(){this.showPermissionsDialog=!this.showPermissionsDialog}renderViewPermissionsButton(){return l` <div class="tree-view-permissions"> <ix-button class="temp-button view-permissions" appearance="text" @click="${this.togglePermissionsDialog}"> View Permissions </ix-button> </div> `}renderLocationsCount(){const e=`dlr-text-default font-bold uppercase ${this.noOfLocations?"tree-role-locations-count-active":"tree-role-locations-count"}`;return l`<div class="tree-role-locations"> <span class="${e}"> ${this.noOfLocations?l`${this.noOfLocations} locations`:l`Select Locations`} </span> </div>`}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(w.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(w.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchUpdateDFAEvent(){const e=new CustomEvent(w.UpdateDFA,{detail:{dataForAccounts:this._dataForAccounts},bubbles:!0,composed:!0});this.dispatchEvent(e)}renderAccountTabbingCard(){return l` <account-tabbing-card data-testid="step-four-account-cards" isRoles .dataForAccounts="${this._dataForAccounts}" .selectedAccountId="${this._selectedAccountId}" @toggle-active-card="${e=>this.toggleActiveCard(e.detail.accountId)}"> </account-tabbing-card> `}render(){return l` <div class="wizard-step-content overflow-y-auto h-full max-h-screen md:p-1"> ${this.renderAccountTabbingCard()} <div class="tree-view-container-content">${this.renderRoles()}</div> <div class="controls-container">${this.renderControls()}</div> <div class="tree-view-container-footer">${this.renderTree()}</div> </div> ${this.renderAddAccountRoleConfirmation()} ${this.renderRemoveRoleConfirmation()} ${this.renderPermissionsDialog()} `}};D.styles=[$t,A,ue],s([d({type:Array})],D.prototype,"dataForAccounts",void 0),s([d({type:Array})],D.prototype,"permissions",void 0),s([d({type:String})],D.prototype,"selectedAccountId",void 0),s([d({type:String})],D.prototype,"selectedRoleId",void 0),s([d({type:Object})],D.prototype,"contact",void 0),s([u()],D.prototype,"_dataForAccounts",void 0),s([u()],D.prototype,"_selectedAccountId",void 0),s([u()],D.prototype,"_selectedRoleId",void 0),s([u()],D.prototype,"showPermissionsDialog",void 0),s([u()],D.prototype,"removeRoleDialogOpen",void 0),s([u()],D.prototype,"_nextButtonEnabled",void 0),s([N("#add-role-dialog")],D.prototype,"addRoleDialog",void 0),s([N("#role-data-element")],D.prototype,"roleTabComponent",void 0),s([N("user-details-assignments")],D.prototype,"assignmentTreeComponent",void 0),D=s([b("create-user-step-four")],D);const Ko=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}ix-icon-button{--md-sys-color-on-surface-variant:black}`;class se{}se.ACCORDION=e=>`user-flags-accordion-${e}`,se.COMPONENT=e=>`user-flags-${e}`,se.TREE=e=>`user-flags-tree-${e}`,se.ASSIGNMENT_COUNT=e=>`user-flags-assignment-count-${e}`,se.SEARCH_BOX=()=>"search-box";let B=class extends I{constructor(){super(...arguments),this.searchEnabled=!1,this.showCheckboxes=!1,this.disableCheckboxes=!1,this.filledIcons=!1,this.searching=!1,this.searchText="",this.selectedIds=[],this.searchResultCount=0,this.searchResultIndex=0,this.onSearchTextChange=Zt(async e=>{Ft(this.flagTree.rootNode),this.searchText=e.detail.searchText;const t=Nt(this.flagTree.rootNode,e.detail.searchText);t.length&&Ve(this.flagTree.rootNode),this.searchResultCount=t.length;const o=Go(this.flagTree.rootNode,t);[this.selectedId]=o,this.selectedIds=[...o],this.searchResultIndex=o.indexOf(this.selectedId)+1,this.requestUpdate()},500)}onTreeCheckToggle(e){var t;this.flagTree.updateService&&this.flagTree.updateService.update(e.detail.message.rootNode);const o=this.flagUpdateManager.nodeUpdates.find(i=>i.key===this.flagTree.label);o&&o.item.update(e.detail.message.rootNode),this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{...e.detail.message,flagLabel:this.flagTree.label,updates:this.flagUpdateManager.nodeChanges,rootNode:(t=this.flagTree.updateService)===null||t===void 0?void 0:t.nodeUpdates[0]}}})),this.flagTree.rootNode=structuredClone(e.detail.message.rootNode),this.requestUpdate("flagTree")}onSearchNavigation(e){if(!this.selectedIds.length)return;const t=jo(e.detail.direction,this.selectedId,this.selectedIds);this.selectedId=t!=null?t:this.selectedId,this.searchResultIndex=this.selectedIds.indexOf(this.selectedId)+1,this.requestUpdate()}render(){var e;return l` <ix-generic-tree data-testid="${se.TREE(this.flagTree.label)}" ?showCheckboxes="${this.showCheckboxes}" ?filledIcons="${this.filledIcons}" ?disableCheckboxes="${this.disableCheckboxes}" .rootNode="${this.flagTree.rootNode}" .selectedId="${this.selectedId}" .searchText="${this.searchText}" @check-toggle="${t=>this.onTreeCheckToggle(t)}" @search-text-change="${t=>this.onSearchTextChange(t)}" @search-navigation="${t=>this.onSearchNavigation(t)}" ?searchEnabled="${this.searchEnabled&&(((e=this.flagTree.rootNode.children)===null||e===void 0?void 0:e.length)||0)>0}" .searchResultCount="${this.searchResultCount}" .searchResultIndex="${this.searchResultIndex}" searchPlaceholder="Search by Site or Asset Name.."></ix-generic-tree> `}};B.styles=[Ko,A],s([d({type:Object,attribute:!1})],B.prototype,"flagTree",void 0),s([d({type:Boolean})],B.prototype,"searchEnabled",void 0),s([d({type:Boolean})],B.prototype,"showCheckboxes",void 0),s([d({type:Boolean})],B.prototype,"disableCheckboxes",void 0),s([d({type:Boolean})],B.prototype,"filledIcons",void 0),s([d({type:Boolean})],B.prototype,"searching",void 0),s([d({type:String})],B.prototype,"selectedId",void 0),s([d({type:Object})],B.prototype,"flagUpdateManager",void 0),s([u()],B.prototype,"searchText",void 0),s([u()],B.prototype,"selectedIds",void 0),s([u()],B.prototype,"searchResultCount",void 0),s([u()],B.prototype,"searchResultIndex",void 0),B=s([b("user-flag")],B);let G=class extends I{constructor(){super(...arguments),this.searchEnabled=!1,this.showCheckboxes=!1,this.disableCheckboxes=!1,this.filledIcons=!1,this.searching=!1,this.flags=[],this.flagUpdateManager=new Vo,this._defaultUpdates=[]}reset(){this._defaultUpdates=[],this.flagUpdateManager.reset()}onAccordionToggle(e){!e.detail.isOpen||!this.flags.length||(this.flags.forEach(t=>{t.label!==e.detail.accordionId?t.isOpen=!1:t.isOpen=!0}),this.requestUpdate())}connectedCallback(){var e;if(super.connectedCallback(),this._defaultUpdates=[],!this.contact)return;const t=Dt.get();if(!(!((e=this._defaultUpdates)===null||e===void 0)&&e.length)&&t!=null&&t.accountNumber){const o=`${t.accountNumber}:${this.contact.id}`,i=rt.capture(o);i&&rt.lock(o),this._defaultUpdates=i}}disconnectedCallback(){this.reset()}onTreeCheckToggle(e){this.dispatchEvent(new CustomEvent(_.CheckToggle,{detail:{message:{...e.detail.message,flagLabel:e.detail.message.flagLabel,updates:e.detail.message.updates,rootNode:e.detail.message.rootNode}}}))}getUserFlagAssignmentCount(e){var t;const o=(t=e.rootNode.children)===null||t===void 0?void 0:t.at(0);o&&(o.checkedChildrenCount=jt(o),this.renderAssignmentCount(e))}renderAssignmentCount(e){var t;const o=(t=e.rootNode.children)===null||t===void 0?void 0:t.at(0);return o!=null&&o.checkedChildrenCount?l` <span style="color:#53657a;margin-left:8px" data-testid="${se.ASSIGNMENT_COUNT(e.label)}">${o.checkedChildrenCount}</span> `:x}renderUserFlag(e){var t,o;this.flagUpdateManager.create(e.label);const i=this.flagUpdateManager.nodeUpdates.find(n=>n.key===e.label);return!((t=this._defaultUpdates)===null||t===void 0)&&t.length&&!e.defaultsApplied&&(this._defaultUpdates.forEach(n=>{const a=He(e.rootNode,n.id);a&&(a.checked=!0,fe(a,e.rootNode),i==null||i.item.update(e.rootNode))}),e.defaultsApplied=!0),this.getUserFlagAssignmentCount(e),l` <div class="mb-2"> <ix-accordion ?isOpen="${e.isOpen}" .accordionId="${e.label}" @toggle="${this.onAccordionToggle}" data-testid="${se.ACCORDION(e.label)}"> <p slot="title" class="m-0 pl-1"> ${e.label} ${this.renderAssignmentCount(e)} </p> <div style="padding-left:30px"> <div class="flex items-center"> <p class="dlr-text-small"> ${((o=ne.find(n=>n.text===e.label))===null||o===void 0?void 0:o.desc)||""} </p> <ix-progress .linear="${!1}" .indeterminate="${!0}" style="visibility:${this.searching?"visible":"hidden"}"></ix-progress> </div> <user-flag data-testid="${se.COMPONENT(e.label)}" ?showCheckboxes="${this.showCheckboxes}" ?filledIcons="${this.filledIcons}" ?disableCheckboxes="${this.disableCheckboxes}" ?searchEnabled="${this.searchEnabled}" .flagTree="${e}" .flagUpdateManager="${this.flagUpdateManager}" @check-toggle="${n=>this.onTreeCheckToggle(n)}"></user-flag> </div> </ix-accordion> </div> `}render(){return l` ${this.flags.map(e=>this.renderUserFlag(e))}`}};G.styles=[Ko,A],s([d({type:Boolean})],G.prototype,"searchEnabled",void 0),s([d({type:Boolean})],G.prototype,"showCheckboxes",void 0),s([d({type:Boolean})],G.prototype,"disableCheckboxes",void 0),s([d({type:Boolean})],G.prototype,"filledIcons",void 0),s([d({type:Boolean})],G.prototype,"searching",void 0),s([d({type:Array,attribute:!1})],G.prototype,"flags",void 0),s([d({type:Object})],G.prototype,"contact",void 0),s([u()],G.prototype,"flagUpdateManager",void 0),s([u()],G.prototype,"_defaultUpdates",void 0),G=s([b("user-flags")],G);const Jo=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.user-details-header-text{margin-bottom:10px}.user-details-row{display:grid;grid-template-columns:1fr 1fr}.row-label{color:rgba(9,34,65,.7);word-break:break-word;width:192px}.row-value{color:#092241;overflow-wrap:anywhere}.user-details-body{display:flex;gap:10px;flex-direction:column}.arrow-forward-icon{padding-left:6px}.access-summary-header,.user-details-header{display:flex;flex-direction:row;align-items:center;justify-content:space-between}ix-divider{margin-top:30px;margin-bottom:30px}.user-flag-information{margin-left:5px}.user-flag-learn-text{padding-bottom:20px}.user-flag-learn-text-link{color:#1456e0}.user-flag-evacuation{vertical-align:top;line-height:18px}.evacuation-label{padding-left:8px;vertical-align:top}.evacuation-text{text-align:justify;padding-left:5px;padding-top:10px;padding-bottom:30px;color:#092241;margin-right:40px}.flags-description ix-button{margin-top:.5rem;width:112px}ix-button{font-family:var(--root-secondary-font)}@media only screen and (max-width:600px){.flags-description{flex-direction:column-reverse;text-align:center}.flags-description p{text-align:left}.evacuation-text{margin-right:0}.flags-description ix-button{display:block}.subheading-container{flex-direction:column;align-items:start;gap:.75rem}.submit-btn{width:100%}.user-details-row{grid-template-columns:1fr}.step-five-next-container{display:flex;justify-content:center}}ix-phone-number{--ix-phone-number-font-size:16px;--ix-phone-number-text-color:#092241}`;let ee=class extends I{constructor(){super(...arguments),this.dataForAccounts=[],this.evacAssistanceRequired=!1,this._dataForAccounts=[]}get selectedAccount(){return this._dataForAccounts.find(e=>e.accountId===this._selectedAccountId)}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._selectedAccountId=this.selectedAccountId}setSelectedFlag(e){this._selectedFlagId=e}setInitialFlag(){this._selectedFlagId=ne[0].key}toggleActiveCard(e){this._selectedAccountId=e;const t=this._dataForAccounts.find(o=>o.accountId===e);t&&t.genericFlagsData&&(this._selectedFlagId=Ct(t.genericFlagsData[0].label)),this.setSelectedFlag(this._selectedFlagId),this.setInitialFlag(),this.requestUpdate()}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(w.NextStep,{bubbles:!0,composed:!0}))}renderAccountTabbingCard(){return l` <account-tabbing-card data-testid="step-five-account-cards" .dataForAccounts="${this._dataForAccounts}" .selectedAccountId="${this._selectedAccountId}" @toggle-active-card="${e=>this.toggleActiveCard(e.detail.accountId)}"> </account-tabbing-card> `}renderElevatedNextButton(){return l` <div class="flex justify-between flags-description"> <p style="max-width:550px" class="dlr-text-caption evacuation-text"> The locations chosen for this account's Portal access will automatically default selections for the user flags listed below. You have the flexibility to modify these selections by deselecting specific locations and choosing others as needed. </p> <div class="step-five-next-container"> <ix-button type="submit" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" data-testid="step-five-next-button"> <span class="uppercase font-bold tracking-wider">Next</span> <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}renderUserFlags(){var e,t;const o=i=>{var n;const a=(n=structuredClone(i.detail.message.updates))!==null&&n!==void 0?n:[];this.selectedAccount&&a.forEach(r=>{const c=this.selectedAccount.flagData.findIndex(p=>p.key===r.key);c>-1?this.selectedAccount.flagData[c]=structuredClone(r):this.selectedAccount.flagData.push(r)}),this.dispatchEvent(new CustomEvent(w.UpdateFlags,{bubbles:!0}))};return l` <user-flags class="grid grid-cols-1 gap-3" showCheckboxes filledIcons searchEnabled .flags="${(t=(e=this.selectedAccount)===null||e===void 0?void 0:e.genericFlagsData)!==null&&t!==void 0?t:[]}" @check-toggle="${o}" data-testid="step-five-user-flags"></user-flags> `}render(){return l` <div class="wizard-step-content"> ${this.renderAccountTabbingCard()} ${this.renderElevatedNextButton()} ${this.renderUserFlags()} </div> `}};ee.styles=[Jo,A,ue],s([d({type:Object})],ee.prototype,"newContact",void 0),s([d({type:Array})],ee.prototype,"dataForAccounts",void 0),s([d({type:String})],ee.prototype,"selectedAccountId",void 0),s([d({type:Boolean,reflect:!0})],ee.prototype,"evacAssistanceRequired",void 0),s([u()],ee.prototype,"_dataForAccounts",void 0),s([u()],ee.prototype,"_selectedAccountId",void 0),s([u()],ee.prototype,"_selectedFlagId",void 0),ee=s([b("create-user-step-five")],ee);class k{}k.SUCCESS_CREATED="create-user-success",k.SUCCESS_ICON="create-user-success-icon",k.USER_DETAILS="create-user-success-details",k.SUCCESS_MESSAGE="create-user-success-message",k.VIEW_USER="view-user-button",k.BACK_TO_USERS="back-to-users-button",k.S6={DETAILS_HEADER:"s6-details-header",DETAILS_BODY:"s6-details-body",DETAILS_FIRST_NAME:"s6-details-first-name",DETAILS_LAST_NAME:"s6-details-last-name",DETAILS_EMAIL:"s6-details-email",DETAILS_PHONE:"s6-details-phone",PORTAL_TREE:"s6-portal-tree",FLAG_TREE:"s6-flag-tree",TAB_PORTAL:"s6-tab-portal",TAB_FLAGS:"s6-tab-flags"};let Z=class extends I{constructor(){super(...arguments),this.newContact={},this.dataForAccounts=[],this.submitting=!1,this.hideContactDetails=!1,this._readonlyTreeViews=[],this._readonlyUserFlags=[],this._selectedTab="roles-and-portal-access",this._isFirstLoad=!0}connectedCallback(){super.connectedCallback(),this._readonlyTreeViews=this.generateReadOnlyTreeViews(),this._readonlyUserFlags=this.generateReadOnlyUserFlags()}isTabActive(e){return this._isFirstLoad?x:this._selectedTab===e}generateReadOnlyTreeViews(){const e=[];return this.dataForAccounts.forEach(t=>{let o=[];t.rolesData.forEach(i=>{if(!i.role.removed){const n=Gt(i.genericTreeView),a=Kt(structuredClone(n));Jt(a),o.push({role:i.role.name,tree:a})}}),e.push({accountName:t.accountName,roleTrees:o}),o=[]}),e}generateReadOnlyUserFlags(){const e=[];return this.dataForAccounts.forEach(t=>{let o=[];t.genericFlagsData&&(t.genericFlagsData.forEach(i=>{const n=Gt(i.rootNode),a=Kt(structuredClone(n));Jt(a),o.push({label:i.label,rootNode:a,isOpen:!1})}),e.push({accountName:t.accountName,flagTrees:o}),o=[])}),e}renderUserDetails(){return l` <div class="user-details"> <div class="user-details-header" data-testid="${k.S6.DETAILS_HEADER}"> <div class="user-details-header-text">User Details</div> <ix-icon-button class="icon-btn_primary" filledIcon icon="edit" ?disabled="${this.submitting}" @click="${()=>this.dispatchSetStepEvent(1)}"></ix-icon-button> </div> <div class="user-details-body" data-testid="${k.S6.DETAILS_BODY}"> <div class="user-details-row"> <div class="dlr-text-default row-label">First Name</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_FIRST_NAME}"> ${this.newContact.firstName} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Last Name</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_LAST_NAME}"> ${this.newContact.lastName} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Email Address</div> <div class="dlr-text-default row-value" data-testid="${k.S6.DETAILS_EMAIL}"> ${this.newContact.email} </div> </div> <div class="user-details-row"> <div class="dlr-text-default row-label">Phone</div> <ix-phone-number data-testid="${k.S6.DETAILS_PHONE}" .number="${this.newContact.phone}"></ix-phone-number> </div> </div> </div> `}renderTabs(){return l` <ix-tabs> <ix-primary-tab @click="${()=>{this._selectedTab="roles-and-portal-access",this._isFirstLoad=!1}}" ?active="${this.isTabActive("roles-and-portal-access")}" data-testid="${k.S6.TAB_PORTAL}"> <span style="${this._selectedTab==="roles-and-portal-access"?"":"color: #092241; opacity: 60%;"}" class="flex items-center uppercase font-bold tracking-wide"> Roles and Portal Access </span> </ix-primary-tab> <ix-primary-tab @click="${()=>{this._selectedTab="user-flags",this._isFirstLoad=!1}}" ?active="${this.isTabActive("user-flags")}" data-testid="${k.S6.TAB_FLAGS}"> <span style="${this._selectedTab==="user-flags"?"":"color: #092241; opacity: 60%;"}" class="flex items-center uppercase font-bold tracking-wide">User Flags</span></ix-primary-tab> </ix-tabs> `}renderRolesAndPortalAccessSummary(){return this._selectedTab!=="roles-and-portal-access"?x:l` <div class="py-4"> ${this._readonlyTreeViews.map(e=>l` <div> <h4 class="pt-1 pb-3">${e.accountName}</h4> ${e.roleTrees.map(t=>l` <div class="pb-2"> <div class="pb-1">${t.role}</div> <ix-generic-tree filledIcons .rootNode="${t.tree}" data-testid="${k.S6.PORTAL_TREE}"></ix-generic-tree> </div> `)} </div>`)} </div> `}renderUserFlagsSummary(){return this._selectedTab!=="user-flags"?x:l`<div> ${this._readonlyUserFlags.map(e=>l` <div class="py-2"> <h4 class="font-bold pb-2">${e.accountName}</h4> <user-flags filledIcons disableCheckboxes .flags="${e.flagTrees}" data-testid="${k.S6.FLAG_TREE}"></user-flags> </div>`)} </div>`}renderLearnMoreText(){return this._selectedTab==="user-flags"?l` <div style="padding-top:15px"> Learn more about user flags <a class="user-flag-learn-text-link" href="#">here.</a> </div> `:l` <div style="padding-top:15px" class="text-black roles-and-portal-access-text"> Learn more about roles and portal access <a class="user-flag-learn-text-link" href="#">here.</a> </div> `}dispatchSetStepEvent(e){this.dispatchEvent(new CustomEvent(w.SetStep,{detail:{step:e},bubbles:!0,composed:!0}))}render(){return l` <div class="wizard-step-content overflow-y-auto overflow-x-hidden md:p-1"> ${this.hideContactDetails?x:l`${this.renderUserDetails()}<ix-divider></ix-divider>`} ${this.renderTabs()} ${this.renderLearnMoreText()} ${this.renderRolesAndPortalAccessSummary()} ${this.renderUserFlagsSummary()} </div> `}};Z.styles=[Jo,A,ue],s([d({type:Object})],Z.prototype,"newContact",void 0),s([d({type:Array})],Z.prototype,"dataForAccounts",void 0),s([d({type:Boolean})],Z.prototype,"submitting",void 0),s([d({type:Boolean})],Z.prototype,"hideContactDetails",void 0),s([u()],Z.prototype,"_readonlyTreeViews",void 0),s([u()],Z.prototype,"_readonlyUserFlags",void 0),s([u()],Z.prototype,"_selectedTab",void 0),s([u()],Z.prototype,"_isFirstLoad",void 0),Z=s([b("create-user-step-six")],Z);const Es=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.drawer-container{z-index:100;display:flex;flex-direction:row;position:fixed;width:100%;height:100%;top:var(--intraportal-nav-height,0);right:0;background-color:rgba(0,0,0,.5);animation-duration:.25s;animation-name:fadeIn;animation-timing-function:ease-out}.drawer-container-hide{z-index:100;display:flex;flex-direction:row;flex:0 0 auto;position:fixed;width:100vw;height:100vh;top:0;right:0;background-color:rgba(0,0,0,.5);animation-duration:.25s;animation-name:fadeOut;animation-timing-function:ease-out}.drawer-filler{flex:1}aside{padding:32px 40px 40px;border-radius:1rem 0 0 1rem}.drawer-slide-in{width:100vw;max-width:816px;height:calc(100% - var(--intraportal-nav-height,0px));float:right;display:flex;flex-direction:column;background-color:#fff;box-sizing:border-box;animation-duration:.25s;animation-name:slideInFromRight}.drawer-slide-out{width:100vw;max-width:810px;height:100vh;float:right;background-color:#fff;box-sizing:border-box;animation-duration:.25s;animation-name:slideOutToRight}@media screen and (min-width:1024px){.drawer{width:45%}}.drawer-header{display:flex;justify-content:space-between;align-items:center}.drawer-body{flex-grow:1;overflow:hidden}.drawer-header__hide-btn{flex:1}.drawer-header__title{flex:1;text-align:center;flex-grow:1;flex-shrink:0}.drawer-header__close-btn{flex:1}.hide-text{cursor:pointer;user-select:none}.hide-icon{font-weight:700}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{from{opacity:1}to{opacity:0}}@keyframes slideInFromRight{from{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slideOutToRight{from{transform:translateX(0)}to{transform:translateX(100%)}}@media screen and (max-width:600px){aside{border-radius:0;padding:1rem}}`,lt={ToggleDialog:"toggle-dialog",ToggleDraft:"toggle-draft",CloseSuccess:"close-success",BlurDrawer:"blur-drawer"};let de=class extends I{constructor(){super(...arguments),this.isVisible=!1,this.summaryScreen=!1,this.submitting=!1,this.showMinimiseButton=!1}static get styles(){return[Es,A]}dispatchDialogToggleEvent(){this.submitting||this.dispatchEvent(new CustomEvent(lt.ToggleDialog,{composed:!0,bubbles:!0}))}dispatchDraftToggleEvent(){var e,t;(e=this.drawer)===null||e===void 0||e.setAttribute("class","drawer-slide-out"),(t=this.drawerContainer)===null||t===void 0||t.setAttribute("class","drawer-container-hide"),setTimeout(()=>{this.dispatchEvent(new CustomEvent(lt.ToggleDraft,{bubbles:!0,composed:!0}))},250)}dispatchBlurEvent(){this.dispatchEvent(new CustomEvent(lt.BlurDrawer,{bubbles:!0,composed:!0}))}dispatchDrawerCloseEvent(){this.dispatchEvent(new CustomEvent(lt.CloseSuccess,{bubbles:!0,composed:!0}))}render(){const e=this.isVisible?"slide-in":"slide-out";return this.isVisible?(document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",l` <div class="drawer-container" data-testid="ui-um-drawer-container"> <div class="drawer-filler" @click="${this.dispatchBlurEvent}" @keypress="${this.dispatchBlurEvent}"></div> <aside class="drawer-${e}"> <div class="drawer-header"> <div class="drawer-header__hide-btn"> ${!this.summaryScreen&&this.showMinimiseButton?l` <ix-button class="flex w-24" appearance="text" has-icon @click="${this.dispatchDraftToggleEvent}" ?disabled="${this.submitting}" data-testid="hide-drawer-button"> <md-icon class="hide-icon" slot="icon">fullscreen_exit</md-icon> <p class="dlr-text-small hide-text font-bold uppercase">Hide</p> </ix-button> `:x} </div> <div> <slot name="centre-top"></slot> </div> <div class="drawer-header__close-btn"> <div class="float-right"> <ix-icon-button aria-label="Close" icon="close" @click="${this.summaryScreen?this.dispatchDrawerCloseEvent:this.dispatchDialogToggleEvent}" data-testid="close-drawer-icon"></ix-icon-button> </div> </div> </div> <div class="drawer-body"> <slot name="content"></slot> </div> </aside> </div> `):(document.body.style.overflow="auto",document.documentElement.style.overflow="initial",x)}};s([d({type:Boolean})],de.prototype,"isVisible",void 0),s([d({type:Boolean})],de.prototype,"summaryScreen",void 0),s([d({type:Boolean})],de.prototype,"submitting",void 0),s([d({type:Boolean})],de.prototype,"showMinimiseButton",void 0),s([N("aside")],de.prototype,"drawer",void 0),s([N(".drawer-container")],de.prototype,"drawerContainer",void 0),de=s([b("ui-um-drawer")],de);const Rs=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.wizard-body{overflow:hidden;height:100%}.wizard-footer{float:right}.form{height:100%}`,Pt={UpdateForm:"update-form",NextStepWizard:"next-step-wizard",PrevStep:"prev-step-wizard",ButtonToggle:"button-toggle"};let Mt=class extends I{constructor(){super(...arguments),this.updateFormBinding=this.updateForm.bind(this),this.handleSlotChangeBinding=this.handleSlotChange.bind(this),this.wizardForm=new FormData}static get styles(){return[Rs,A]}connectedCallback(){super.connectedCallback(),window.addEventListener(Pt.UpdateForm,this.updateFormBinding)}disconnectedCallback(){var e;super.disconnectedCallback(),window.removeEventListener(Pt.UpdateForm,this.updateFormBinding);const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.removeEventListener("slotchange",this.handleSlotChangeBinding)}firstUpdated(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.addEventListener("slotchange",this.handleSlotChangeBinding)}updateForm(e){e.detail.forEach((t,o)=>this.wizardForm.set(o,t))}handleSlotChange(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.assignedElements().forEach(o=>{o.wizardForm=this.wizardForm})}dispatchButtonToggleEvent(e){this.dispatchEvent(new CustomEvent(Pt.ButtonToggle,{detail:e,bubbles:!0,composed:!0}))}render(){return l` <div class="wizard-body"> <form class="form"> <slot name="wizard-content"></slot> </form> </div> `}};s([d({type:Object})],Mt.prototype,"wizardForm",void 0),Mt=s([b("ui-um-wizard")],Mt);const Ss=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.wizard-step-form{display:flex;flex-direction:column;height:100%}.step{overflow:auto}.wizard-step__btn-group{padding:20px 0;float:right}.input-group{display:flex;flex-direction:row;gap:20px;margin-bottom:20px}.input-group ix-phone-input,.input-group ix-textbox{flex:1}.textfield{width:100%}.subheading-container{display:flex;flex-direction:row;justify-content:space-between;align-items:center;margin-bottom:36px;margin-top:24px}.submit-btn{width:167.44px}.submit-btn-content{display:flex;align-items:center;flex-direction:row;justify-content:space-between}@media screen and (max-width:600px){.input-group{display:block;flex-direction:row;gap:20px;margin-bottom:20px}.input-group ix-phone-input,.input-group ix-textbox{flex:1}}`;let re=class extends I{constructor(){super(...arguments),this.handleSlotChangeBinding=this.handleSlotChange.bind(this),this.stepTitle="",this.stepSubTitle="",this.isRequired=!1,this.isLastStep=!1,this.submitting=!1}static get styles(){return[Ss,Ee,A]}disconnectedCallback(){var e;super.disconnectedCallback();const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.removeEventListener("slotchange",this.handleSlotChangeBinding)}firstUpdated(){var e;const t=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");t&&t.addEventListener("slotchange",this.handleSlotChangeBinding),this.firstFocusableElement.focus()}handleSlotChange(){var e,t;const o=(e=this.shadowRoot)===null||e===void 0?void 0:e.querySelector("slot");for(const i of o.assignedNodes())(t=this.form)===null||t===void 0||t.insertBefore(i,o)}dispatchSubmitEvent(e){e.preventDefault(),this.dispatchEvent(new CustomEvent(w.CreateContact,{bubbles:!0,composed:!0}))}render(){return l` <form class="wizard-step-form" @keydown="${e=>{e.key==="Escape"&&(e.stopPropagation(),e.preventDefault(),this.dispatchEvent(new CustomEvent("close-wizard",{detail:{originElement:this.firstFocusableElement},bubbles:!0,composed:!0})))}}"> <div class="wizard-step-heading pt-6"> <h2 class="dlr-text-page-title" data-testid="dlr-text-page-title" tabindex="-1"> ${this.stepTitle} </h2> <div class="subheading-container"> <h3 class="dlr-text-heading" data-testid="dlr-text-heading">${this.stepSubTitle}</h3> ${this.isRequired?l` <span class="dlr-text-small italic required-field">*denotes required field</span> `:x} ${this.isLastStep?l` <ix-button class="submit-btn" has-icon ?submitting="${this.submitting}" @click="${e=>this.dispatchSubmitEvent(e)}" data-testid="wizard-submit-button"> <div class="submit-btn-content"> Yes, Submit <md-icon class="arrow-forward-icon" slot="icon">arrow_forward</md-icon> </div> </ix-button> `:x} </div> </div> <slot></slot> </form> <div tabindex="-1" @focus="${()=>{this.firstFocusableElement.focus()}}"></div> `}};s([N('[tabindex="-1"]')],re.prototype,"firstFocusableElement",void 0),s([d({type:String})],re.prototype,"stepTitle",void 0),s([d({type:String})],re.prototype,"stepSubTitle",void 0),s([d({type:Boolean})],re.prototype,"isRequired",void 0),s([d({type:Boolean})],re.prototype,"isLastStep",void 0),s([d({type:Boolean})],re.prototype,"submitting",void 0),s([N("form")],re.prototype,"form",void 0),re=s([b("ui-um-wizard-step")],re);const Zo=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}ix-dialog{position:absolute;z-index:101}.create-user-wizard{height:100%;display:flex;flex-direction:column}.dlr-text-small.step-progress{letter-spacing:1.25px}ix-button{font-family:var(--root-secondary-font)}@media only screen and (max-width:600px){.success-actions{flex-direction:column;width:100%}.success-actions ix-button{display:block;width:100%}}`;function Wo(e,t){const o={id:"root",label:"",children:[],customerKnownSpaceName:""},i=new st,n=structuredClone(e.rolesData.filter(m=>m.locations.length>0).filter(m=>!m.role.removed).flatMap(m=>m.locations)),a=t.data;a&&a.length&&ce(a[0],o),n.forEach(m=>{const h=He(o,m.id);h&&(h.checked=!0,fe(h,o),i.update(o))});const r={label:"",isOpen:!1,rootNode:o},c=[],p=ne.map(m=>{const h=structuredClone(r);return h.updateService=new st,h.updateService.updates=structuredClone(i.nodeUpdates),h.label=m.text,c.push({key:m.text,items:[]}),h});e.genericFlagsData=[...p],e.flagData=c}const Us=e=>({id:e.id,name:e.account_name,status:e.status,accountNumber:e.account_number,displayName:e.account_friendly_name,statusUpdateAt:e.updated_at,statusUpdateBy:e.updated_by}),Bt=e=>{var t;const o=[];return(t=e.account_associations)===null||t===void 0||t.forEach(i=>{o.push(Us(i))}),{id:e.id,firstName:e.first_name,lastName:e.last_name,email:e.email,phone:e.phone,evacAssistance:e.evacuation_assistance_required,accounts:o,status:"Active"}},$s=e=>{var t;const o=[];return(t=e.accounts)===null||t===void 0||t.forEach(i=>{o.includes(i.accountNumber)||o.push(i.accountNumber)}),{first_name:e.firstName,last_name:e.lastName,email:e.email,phone:e.phone,account_numbers:o,evacuation_assistance_required:e.evacAssistance}},Ns=e=>({id:e.id,first_name:e.firstName,last_name:e.lastName,email:e.email,phone:e.phone,evacuation_assistance_required:e.evacAssistance}),Fs=e=>({accountNumber:e.accountNumber,includeChildAccounts:!0,page:e.page,size:e.size,firstName:e.firstName,lastName:e.lastName,email:e.email,sort:e.sort,order:e.order}),Ds=e=>{var t,o;const i=[];return(t=e.content)===null||t===void 0||t.forEach(n=>{i.push(Bt(n))}),{contacts:i,recordCount:(o=e.pageable)===null||o===void 0?void 0:o.total_elements}},Ps=e=>({id:e.id}),Ms=e=>({id:e.id,userProfile:Ns(e.contactInput)}),Bs=e=>({userInput:$s(e.contactInput)});class Ls{async update(t){try{const o=Ms(t);return f.UsersApi.updateUser(o)}catch(o){return g.handleError("Failed to update user.")}}async create(t){try{const o=Bs(t),i=await f.UsersApi.createUser(o);return Bt(i)}catch(o){return g.handleError(o,`Failed to create user for ${t.contactInput.email}`),{}}}async search(t){try{const o=Fs(t),i=await f.UsersApi.getUsers(o);return Ds(i)}catch(o){return g.handleError(o,"Failed to get users."),{}}}async get(t){try{const o=Ps(t),i=await f.UsersApi.getUserById(o);return Bt(i)}catch(o){return g.handleError(o,"Failed to get user."),{}}}async getUsersReport(t){try{const o={accountNumber:t.accountNumber,includeChildAccounts:t.includeChildAccounts,firstName:t.firstName,lastName:t.lastName,email:t.email};return await f.UsersApi.getUserReport(o)}catch(o){throw g.handleError(o,"Failed to download users report."),o}}}const Lt=new Ls,Qo=(e,t)=>{var o;const i={expanded:!1,id:e.id,label:(o=e.displayName)!==null&&o!==void 0?o:e.name,parentId:t.id};return e.subaccounts&&(i.children=e.subaccounts.map(n=>Qo(n,i))),i},Os=e=>{const t={expanded:!1,id:"root",label:"",parentId:"",children:[],disabled:!1};return t.children=e.map(o=>Qo(o,t)),t};function Yo(e,t){var o;const i={id:e.id,label:(o=e.displayName)!==null&&o!==void 0?o:e.name,parentId:t.id,expanded:!1,checked:!1,indeterminate:!1,children:[]};return e.subaccounts&&(i.children=e.subaccounts.map(n=>Yo(n,i))),i}function Xo(e){const t={id:"root",parentId:"",label:"",expanded:!1,checked:!1,children:[]};return e.forEach(o=>t.children.push(Yo(o,t))),t}const zs=e=>{const t=at(e);return Os(t)};let T=class extends I{constructor(){super(...arguments),this.showDrawer=!1,this.success=!1,this.submitting=!1,this.newUserId="",this.permissions=[],this.roles=[],this.treeData=[],this.loading=!1,this.selectedAccountId="",this.selectedRoleId="",this.step=1,this.validatingStepOne=!1,this.newContact={firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},this.dataForAccounts=[],this.showManageUserDialog=!1,this.userId="",this.stepTitle="Add New User",this.isNextButtonEnabled=!1,this.canQuickNavigateSteps={1:!1,2:!1,3:!1,4:!1,5:!1},this.maxQuickStep=1}connectedCallback(){super.connectedCallback(),this.setupAccountSelector()}get stepOne(){var e,t;return(t=(e=this.renderRoot.querySelector("#step-1"))===null||e===void 0?void 0:e.shadowRoot)===null||t===void 0?void 0:t.querySelector("create-user-step-one")}setupAccountSelector(){const e=St().filter(t=>M.hasExternalUserCreate(t.accountNumber));this.accounts=at(e),this.accountTree=Xo(this.accounts),this.permissions=U.getPermissions()}resetStep(){this.handleDialogReset("close")}setStep(e){this.step=e,this.canQuickNavigateSteps={1:!0,2:!0,3:!0,4:!0,5:!0}}resetSteps(e){Object.keys(this.canQuickNavigateSteps).forEach(t=>{e.includes(t)||(this.canQuickNavigateSteps={...this.canQuickNavigateSteps,[t]:!1})})}onNextButtonToggle(e){this.isNextButtonEnabled=e.detail,this.step===1?this.canQuickNavigateSteps={...this.canQuickNavigateSteps,1:!1}:this.step===2?this.resetSteps(["1"]):this.step===3?this.resetSteps(["1","2"]):this.step===4?this.resetSteps(["1","2","3"]):this.canQuickNavigateSteps={...this.canQuickNavigateSteps,[this.step]:!1},this.maxQuickStep=this.step}onPrevStep(){this.step!==1&&(this.step===3&&this.collapseAccountTree(),(this.step===5||this.step===6)&&this.collapseLocationTrees(),this.step===6&&(this.isNextButtonEnabled=!0),this.canQuickNavigateSteps[(this.step-1).toString()]=!0,this.maxQuickStep=Math.max(this.maxQuickStep,this.step),this.step-=1)}onQuickNextStep(){this.canQuickNavigateSteps[this.step]&&this.onNextStep()}async onNextStep(){var e;if(this.isNextButtonEnabled){if(this.loading=!0,this.step===1){if(this.collapseAccountTree(),!this.canQuickNavigateSteps[1]){this.validatingStepOne=!0;const t=await this.validateEmail();if(this.validatingStepOne=!1,!t){this.loading=!1;return}}}else if(this.step===2&&!this.canQuickNavigateSteps[2]){if(!this.accountTree)return;const t=((e=this.checkedAccounts)===null||e===void 0?void 0:e.map(a=>a.id))||[],o=await et.getAccountData(t),i=me.get(),n=Le(this.newContact.email)&&M.hasAssignInternalRoleCreate(U.getAccountNumber());this.roles=[],this.treeData=[];for(let a=0;a<t.length;a+=1){const r=Ut(t[a],i,n),c=t[a];this.roles.push({accountId:c,roles:structuredClone(r)}),this.treeData.push({contactId:"",accountNumber:c,roleId:"",data:o[a]})}}else if(this.step===3)this.selectedAccountId=this.dataForAccounts[0].accountId,this.selectedRoleId=this.dataForAccounts[0].rolesData[0].role.id;else if(this.step===4){for(const t of this.dataForAccounts){const o=this.treeData.find(i=>i.accountNumber===t.accountId);o&&Wo(t,o)}this.collapseLocationTrees()}else this.step===5&&this.collapseLocationTrees();this.step!==4&&(this.isNextButtonEnabled=!1),this.step+1===this.maxQuickStep&&(this.canQuickNavigateSteps[this.step]=!1),this.loading=!1,this.step+=1}}collapseAccountTree(){this.accountTree&&(this.accountTree.expanded=!1,this.accountTree.children&&this.accountTree.children.forEach(e=>{e.expanded=!1,e.children&&e.children.forEach(t=>{t.expanded=!1})}))}collapseLocationTrees(){this.dataForAccounts.forEach(e=>{var t;e.rolesData.forEach(o=>{Ve(o.genericTreeView)}),(t=e.genericFlagsData)===null||t===void 0||t.forEach(o=>{Ve(o.rootNode)})})}async validateEmail(){const e=await Lt.search({email:this.newContact.email.split("@")[0]});return e.contacts.find(t=>t.email===this.newContact.email)?(this.userId=e.contacts[0].id,this.toggleManageUserDialog(),!1):!0}handleDialogReset(e){this.step=1,this.newContact={id:"",firstName:"",lastName:"",email:"",phone:"",accounts:[],evacAssistance:!1},this.setupAccountSelector(),this.stepOne&&(this.stepOne.clearTextFields(),this.stepOne.resetErrorStates(),this.stepOne._nextButtonEnabled=!1),this.dataForAccounts=[],this.selectedAccountId="",this.selectedRoleId="",this.canQuickNavigateSteps={1:!1,2:!1,3:!1,4:!1,5:!1},this.maxQuickStep=1,this.isNextButtonEnabled=!1,this.dispatchResetSuccessEvent(),e==="toggle"?this.dispatchToggleDrawerEvent():this.dispatchDrawerCloseEvent()}updateAccounts(e){var t;this.accountTree=e.detail.rootNode,!((t=this.accountTree)===null||t===void 0)&&t.children&&(this.checkedAccounts=wt(this.accountTree.children,Co(this.accounts||[])),this.dataForAccounts=[])}onUpdateContact(e){const t=e.detail.newContact;this.newContact.email!==t.email&&this.newContact.email!==""&&(this.resetSteps(["1"]),this.dataForAccounts=[]),this.newContact=t}renderWizardStep(){switch(this.step){case 1:return l` <ui-um-wizard-step id="step-1" slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"User Information"}" data-testid="create-user-step-one"> <create-user-step-one .newContact="${this.newContact}" .validatingForm="${this.validatingStepOne}" @update-contact="${e=>this.onUpdateContact(e)}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-one> </ui-um-wizard-step> `;case 2:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Accounts*"}" data-testid="create-user-step-two"> <create-user-step-two class="flex flex-col overflow-auto grow" .accountTree="${this.accountTree}" @update-accounts="${e=>this.updateAccounts(e)}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-two> </ui-um-wizard-step> `;case 3:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Roles"}" data-testid="create-user-step-three"> <create-user-step-three class="flex flex-col overflow-auto grow" .checkedAccounts="${this.checkedAccounts||[]}" .roles="${this.roles}" .dataForAccounts="${this.dataForAccounts}" .treeData="${this.treeData}" @update-dfa="${e=>{this.dataForAccounts=e.detail.dataForAccounts}}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-three> </ui-um-wizard-step> `;case 4:return l` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Portal Access"}" data-testid="create-user-step-four"> <create-user-step-four class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .selectedRoleId="${this.selectedRoleId}" .permissions="${this.permissions}" .contact="${this.newContact}" @update-dfa="${e=>this.dataForAccounts=e.detail.dataForAccounts}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></create-user-step-four> </ui-um-wizard-step> `;case 5:return l` <ui-um-wizard-step slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"User Flags"}" data-testid="create-user-step-five"> <create-user-step-five class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .evacAssistanceRequired="${this.newContact.evacAssistance}" @evac-assistance-required="${e=>this.newContact.evacAssistance=e.detail}" @update-flags="${()=>this.canQuickNavigateSteps={...this.canQuickNavigateSteps,5:!1}}" @next-step="${this.onNextStep}"> </create-user-step-five> </ui-um-wizard-step> `;case 6:return l` <ui-um-wizard-step isLastStep slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"Are these details correct?"}" ?submitting="${this.submitting}" @create-contact="${this.dispatchCreateNewContactEvent}" data-testid="create-user-step-six"> <create-user-step-six class="step" .dataForAccounts="${this.dataForAccounts}" .newContact="${this.newContact}" ?submitting="${this.submitting}" @set-step="${e=>this.setStep(e.detail.step)}"></create-user-step-six> </ui-um-wizard-step> `}return x}renderProgress(){return l`<ix-progress slot="wizard-content" indeterminate></ix-progress>`}renderSuccessMessage(){return l` <div data-testid="${k.SUCCESS_CREATED}" slot="content" class="flex flex-col justify-between items-center pt-40 h-96"> <ix-icon data-testid="${k.SUCCESS_ICON}" style="color:#4caf50;font-size:75px;font-weight:700">check_circle</ix-icon> <span data-testid="${k.USER_DETAILS}" class="text-2xl font-bold pb-5">${this.newContact.firstName} ${this.newContact.lastName} Created</span> <div data-testid="${k.SUCCESS_MESSAGE}" class="pb-5"> ${this.newContact.firstName} ${this.newContact.lastName} has been successfully created. </div> <div class="flex justify-between w-400 success-actions"> <ix-button data-testid="${k.VIEW_USER}" appearance="outlined" @click="${this.handleViewUserRedirect}" class="p-1"><span class="font-bold text-sm tracking-wider uppercase">View user</span></ix-button> <ix-button data-testid="${k.BACK_TO_USERS}" appearance="filled" class="p-1" @click="${()=>this.handleDialogReset("close")}"><span class="font-bold uppercase text-sm tracking-wider">Back to users</span></ix-button> </div> </div> `}handleViewUserRedirect(){this.handleDialogReset("close"),Je(z.UserManagementDetails,`?id=${this.newUserId}`),this.newUserId=""}renderManageUserDialog(){return l` <ix-dialog ?open="${this.showManageUserDialog}"> <div class="dlr-text-heading" slot="headline"> This user already exists for your Master Account </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.handleManageUserDialogClose}" slot="secondary"> Cancel </ix-button> <ix-button appearance="text" @click="${this.handleManageUserRedirect}" slot="primary"> Manage User </ix-button> </div> </ix-dialog> `}toggleManageUserDialog(){this.showManageUserDialog=!this.showManageUserDialog}handleManageUserDialogClose(){this.toggleManageUserDialog(),this.handleDialogReset("close")}handleManageUserRedirect(){this.toggleManageUserDialog(),this.handleDialogReset("close"),Je(z.UserManagementDetails,`?id=${this.userId}`),this.userId=""}dispatchToggleDrawerEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDrawer,{bubbles:!0,composed:!0}))}dispatchDrawerCloseEvent(){this.dispatchEvent(new CustomEvent(w.CloseDrawer,{bubbles:!0,composed:!0}))}dispatchResetSuccessEvent(){this.dispatchEvent(new CustomEvent(w.ResetSuccess,{bubbles:!0,composed:!0}))}dispatchCreateNewContactEvent(){this.dispatchEvent(new CustomEvent(w.CreateNewContact,{detail:{newContact:this.newContact,dataForAccounts:this.dataForAccounts},bubbles:!0,composed:!0}))}renderDrawerControls(){return l` <div slot="centre-top"> <div class="flex"> ${this.success?x:l` <ix-icon-button class="icon-btn_primary" ?disabled="${this.step===1||this.loading}" @click="${()=>this.onPrevStep()}" icon="chevron_left" data-testid="prev-step-icon"> </ix-icon-button> <span class="dlr-text-small uppercase font-bold pt-[10px] px-2 step-progress" data-testid="step-progress"> ${this.step} of 6 </span> <ix-icon-button style="${this.step===6?"visibility: hidden":""}" class="icon-btn_primary ${this.step===6||!this.isNextButtonEnabled||this.loading?"disabled":""}" ?disabled="${!this.canQuickNavigateSteps[this.step]||this.loading}" @click="${()=>this.onQuickNextStep()}" icon="chevron_right" data-testid="next-step-icon"> </ix-icon-button> `} </div> </div> `}render(){return l` <ui-um-drawer ?isVisible="${this.showDrawer}" ?summaryScreen="${this.success}" ?submitting="${this.submitting}" @close-success="${()=>this.handleDialogReset("close")}" data-testid="ui-um-drawer"> ${this.renderDrawerControls()} ${this.success?this.renderSuccessMessage():l` <ui-um-wizard class="create-user-wizard" slot="content" data-testid="create-user-wizard"> ${this.loading?this.renderProgress():this.renderWizardStep()} </ui-um-wizard> `} </ui-um-drawer> ${this.renderManageUserDialog()} `}};T.styles=[Zo,A,Ee],s([d({type:Boolean})],T.prototype,"showDrawer",void 0),s([d({type:Boolean})],T.prototype,"success",void 0),s([d({type:Boolean})],T.prototype,"submitting",void 0),s([d({type:String})],T.prototype,"newUserId",void 0),s([u()],T.prototype,"accounts",void 0),s([u()],T.prototype,"accountTree",void 0),s([u()],T.prototype,"permissions",void 0),s([u()],T.prototype,"roles",void 0),s([u()],T.prototype,"treeData",void 0),s([u()],T.prototype,"loading",void 0),s([u()],T.prototype,"selectedAccountId",void 0),s([u()],T.prototype,"selectedRoleId",void 0),s([u()],T.prototype,"step",void 0),s([u()],T.prototype,"validatingStepOne",void 0),s([u()],T.prototype,"newContact",void 0),s([u()],T.prototype,"dataForAccounts",void 0),s([u()],T.prototype,"showManageUserDialog",void 0),s([u()],T.prototype,"userId",void 0),s([u()],T.prototype,"stepTitle",void 0),s([u()],T.prototype,"isNextButtonEnabled",void 0),s([u()],T.prototype,"canQuickNavigateSteps",void 0),s([u()],T.prototype,"maxQuickStep",void 0),s([u()],T.prototype,"checkedAccounts",void 0),T=s([b("create-user")],T);const qs=E`.draft-container{display:flex;flex-direction:row;justify-content:space-between;bottom:24px;position:fixed;right:24px;z-index:1200;gap:8px;background-color:#fff;border-radius:16px;box-shadow:rgba(0,0,0,.12) 0 12px 20px -12px,#e1e4e8 0 0 0 1px inset;align-items:center;padding:16px 24px;width:250px}`;let Oe=class extends I{constructor(){super(...arguments),this.header="",this.subText="",this.isVisible=!1}static get styles(){return[qs]}dispatchDraftToggleEvent(){this.dispatchEvent(new CustomEvent(_.ToggleDraft,{bubbles:!0,composed:!0}))}dispatchDialogToggleEvent(){this.dispatchEvent(new CustomEvent(_.ToggleDialog,{composed:!0}))}render(){return this.isVisible?(document.body.style.overflow="hidden",l` <div class="draft-container"> <div class="draft-text"> <p class="dlr-text-caption text-on-surface-variant">${this.header}</p> <p class="dlr-text-small font-bold">${this.subText}</p> </div> <div class="draft-buttons"> <ix-icon-button filledIcon @click="${this.dispatchDialogToggleEvent}"> <ix-icon filled slot="default" style="color:red">delete</ix-icon> </ix-icon-button> <ix-icon-button appearance="filled" @click="${this.dispatchDraftToggleEvent}"> <ix-icon slot="default">fullscreen</ix-icon> </ix-icon-button> </div> </div> `):(document.body.style.overflow="auto",x)}};s([d({type:String})],Oe.prototype,"header",void 0),s([d({type:String})],Oe.prototype,"subText",void 0),s([d({type:Boolean})],Oe.prototype,"isVisible",void 0),Oe=s([b("ix-draft")],Oe);const ei=E`ix-dialog .dialog-content{max-width:560px}`;let te=class extends ke{constructor(){super(...arguments),this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1,this.success=!1,this.newUserId="",this.submittingNewUser=!1,this.cancellingCreateUser=!1}static get styles(){return[ei,ue,A]}async createNewContact(e){this.submittingNewUser=!0;const t=e.detail.newContact,o=e.detail.dataForAccounts;o.forEach(({accountId:i})=>{t.accounts.some(({accountNumber:n})=>n===i)||t.accounts.push({accountNumber:i})});try{this.newUserId=await this.createContact(t);const i=[this.createRoleAssignments(o,t.email),this.createUserFlags(o)];(await Promise.allSettled(i)).forEach(n=>{if(n.status==="rejected")throw new Error(n.reason)}),this.dispatchTableRefreshEvent(),this.success=!0}catch(i){this.success=!1}finally{this.submittingNewUser=!1}}async createContact(e){const t=await Lt.create({contactInput:e});if(!(t!=null&&t.id))throw new Error("Failed to create the new user.");return t.id}async createRoleAssignments(e,t){const o=[],i=Le(t);if(e.forEach(({rolesData:n})=>{n.filter(a=>a.role.removed===!1).forEach(a=>{a.locations.forEach(r=>{o.push({roleId:a.role.id,location:r.customerKnownSpaceName,accountNumber:a.accountId,contactId:this.newUserId,isInternal:i})})})}),o.length&&!(await Me.create({roleAssignmentInput:o})).length)throw new Error("Failed to assign role(s) to the new user.")}async createUserFlags(e){var t;const o=[];for(const i of e)i.flagData&&((t=i.genericFlagsData)===null||t===void 0||t.forEach(n=>{n.updateService&&n.updateService.updates.forEach(a=>{const r={accountNumber:i.accountId,contactId:this.newUserId,userFlagType:Ct(n.label),location:a.customerKnownSpaceName||""};o.push(r)})}));if(o.length&&!(await Be.create({userFlagAssignmentInput:o})).length)throw new Error("We could not assign the selected flags to the new user.")}dispatchDraftToggleEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDraft,{composed:!0})),this.dispatchDrawerToggleEvent()}dispatchDrawerToggleEvent(){this.dispatchEvent(new CustomEvent(w.ToggleDrawer,{composed:!0}))}dispatchTableRefreshEvent(){document.dispatchEvent(new CustomEvent(_.RefreshTable,{composed:!0}))}toggleDialog(){this.dispatchEvent(new CustomEvent(w.ToggleDialog,{composed:!0,bubbles:!0}))}toggleSuccess(){this.success=!this.success}resetSuccess(){this.success=!1}cancelCreateUser(){this.cancellingCreateUser=!0,setTimeout(()=>{var e;(e=this.createUser)===null||e===void 0||e.resetStep(),this.dispatchEvent(new CustomEvent(w.CancelCreateUser,{composed:!0})),this.cancellingCreateUser=!1},50)}renderCancelDialog(){return l` <ix-dialog ?open="${this.showCancelDialog}" @cancel="${this.toggleDialog}" data-testid="dialog-cancel-add-user"> <div class="dlr-text-heading md:w-[560px]" slot="headline"> Are you sure you want to cancel? </div> <div class="dialog-content" slot="content"> <p>All the details provided will be lost.</p> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" ?disabled="${this.cancellingCreateUser}" @click="${this.toggleDialog}" slot="secondary" data-testid="dismiss-close-create-user-button"> Dismiss </ix-button> <ix-button appearance="text" ?submitting="${this.cancellingCreateUser}" @click="${this.cancelCreateUser}" slot="primary" data-testid="cancel-create-user-button"> Cancel adding user </ix-button> </div> </ix-dialog> `}render(){return l` <create-user .newUserId="${this.newUserId}" ?showDrawer="${this.showDrawer}" ?submitting="${this.submittingNewUser}" ?success="${this.success}" @toggle-drawer="${this.dispatchDrawerToggleEvent}" @create-new-contact="${e=>this.createNewContact(e)}" @toggle-success="${this.toggleSuccess}" @reset-success="${this.resetSuccess}" data-testid="um-create-user"></create-user> <ix-draft header="Draft" subText="Add New User" ?isVisible="${this.showDraft}" @toggle-dialog="${this.toggleDialog}"></ix-draft> ${this.renderCancelDialog()} `}};s([d({type:Boolean})],te.prototype,"showDrawer",void 0),s([d({type:Boolean})],te.prototype,"showDraft",void 0),s([d({type:Boolean})],te.prototype,"showCancelDialog",void 0),s([u()],te.prototype,"success",void 0),s([u()],te.prototype,"newUserId",void 0),s([u()],te.prototype,"submittingNewUser",void 0),s([u()],te.prototype,"cancellingCreateUser",void 0),s([N("create-user")],te.prototype,"createUser",void 0),te=s([b("create-user-container")],te);const ti=E`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.user-details-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem}.edit-icon{font-size:22px;align-items:center;padding-right:1px}.email,.first-name,.last-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#edit-profile-id{display:flex;flex-direction:column}.single-row-textbox{width:100%}#edit-profile-id>*{margin:5px 0}ix-textbox,md-textfield{--md-outlined-text-field-width:100%;--md-outlined-text-field-focus-width:100%;width:inherit}.user-profile-name-input-group{display:flex;justify-content:space-between;gap:10px}.user-profile-input{padding-bottom:10px;width:100%}ix-phone-number{--ix-phone-number-font-size:16px;--ix-phone-number-text-color:#092241}`;class Hs{async getUserProfile(){try{return await f.UserProfileSettingsApi.getUserSettings()}catch(t){g.handleError(t,"Failed to get user profile.");return}}async updateUserProfile(t){try{return await f.UserProfileSettingsApi.userProfilePatch(t)}catch(o){g.handleError(o,"Failed to update user profile.");return}}}const oi=new Hs;class Vs{constructor(t){(this._host=t).addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}getUserProfile(){return oi.getUserProfile()}updateUserProfile(t){return oi.updateUserProfile(t)}}var js=[{key:"Etc/GMT+12",value:"(UTC-12:00) International Date Line West"},{key:"Etc/GMT+11",value:"(UTC-11:00) Coordinated Universal Time-11"},{key:"America/Adak",value:"(UTC-10:00) Aleutian Islands"},{key:"Pacific/Honolulu",value:"(UTC-10:00) Hawaii"},{key:"Pacific/Marquesas",value:"(UTC-09:30) Marquesas Islands"},{key:"America/Anchorage",value:"(UTC-09:00) Alaska"},{key:"Etc/GMT+9",value:"(UTC-09:00) Coordinated Universal Time-09"},{key:"America/Tijuana",value:"(UTC-08:00) Baja California"},{key:"Etc/GMT+8",value:"(UTC-08:00) Coordinated Universal Time-08"},{key:"America/Los_Angeles",value:"(UTC-08:00) Pacific Time (US, Canada)"},{key:"America/Phoenix",value:"(UTC-07:00) Arizona"},{key:"America/Chihuahua",value:"(UTC-07:00) Chihuahua, La Paz, Mazatlan"},{key:"America/Denver",value:"(UTC-07:00) Mountain Time (US, Canada)"},{key:"America/Whitehorse",value:"(UTC-07:00) Yukon"},{key:"America/Guatemala",value:"(UTC-06:00) Central America"},{key:"America/Chicago",value:"(UTC-06:00) Central Time (US, Canada)"},{key:"Pacific/Easter",value:"(UTC-06:00) Easter Island"},{key:"America/Mexico_City",value:"(UTC-06:00) Guadalajara, Mexico City, Monterrey"},{key:"America/Regina",value:"(UTC-06:00) Saskatchewan"},{key:"America/Bogota",value:"(UTC-05:00) Bogota, Lima, Quito, Rio Branco"},{key:"America/Cancun",value:"(UTC-05:00) Chetumal"},{key:"America/New_York",value:"(UTC-05:00) Eastern Time (US, Canada)"},{key:"America/Port-au-Prince",value:"(UTC-05:00) Haiti"},{key:"America/Havana",value:"(UTC-05:00) Havana"},{key:"America/Indiana/Indianapolis",value:"(UTC-05:00) Indiana (East)"},{key:"America/Grand_Turk",value:"(UTC-05:00) Turks and Caicos"},{key:"America/Asuncion",value:"(UTC-04:00) Asuncion"},{key:"America/Halifax",value:"(UTC-04:00) Atlantic Time (Canada)"},{key:"America/Caracas",value:"(UTC-04:00) Caracas"},{key:"America/Cuiaba",value:"(UTC-04:00) Cuiaba"},{key:"America/La_Paz",value:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan"},{key:"America/Santiago",value:"(UTC-04:00) Santiago"},{key:"America/St_Johns",value:"(UTC-03:30) Newfoundland"},{key:"America/Araguaina",value:"(UTC-03:00) Araguaina"},{key:"America/Sao_Paulo",value:"(UTC-03:00) Brasilia"},{key:"America/Cayenne",value:"(UTC-03:00) Cayenne, Fortaleza"},{key:"America/Argentina/Buenos_Aires",value:"(UTC-03:00) City of Buenos Aires"},{key:"America/Nuuk",value:"(UTC-03:00) Greenland"},{key:"America/Montevideo",value:"(UTC-03:00) Montevideo"},{key:"America/Punta_Arenas",value:"(UTC-03:00) Punta Arenas"},{key:"America/Miquelon",value:"(UTC-03:00) Saint Pierre and Miquelon"},{key:"America/Bahia",value:"(UTC-03:00) Salvador"},{key:"Etc/GMT+2",value:"(UTC-02:00) Coordinated Universal Time-02"},{key:"Atlantic/Azores",value:"(UTC-01:00) Azores"},{key:"Atlantic/Cape_Verde",value:"(UTC-01:00) Cabo Verde Is."},{key:"Etc/UTC",value:"(UTC) Coordinated Universal Time"},{key:"Europe/London",value:"(UTC+00:00) Dublin, Edinburgh, Lisbon, London"},{key:"Atlantic/Reykjavik",value:"(UTC+00:00) Monrovia, Reykjavik"},{key:"Africa/Sao_Tome",value:"(UTC+00:00) Sao Tome"},{key:"Africa/Casablanca",value:"(UTC+01:00) Casablanca"},{key:"Europe/Berlin",value:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"},{key:"Europe/Budapest",value:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague"},{key:"Europe/Paris",value:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris"},{key:"Europe/Warsaw",value:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb"},{key:"Africa/Lagos",value:"(UTC+01:00) West Central Africa"},{key:"Asia/Amman",value:"(UTC+02:00) Amman"},{key:"Europe/Bucharest",value:"(UTC+02:00) Athens, Bucharest"},{key:"Asia/Beirut",value:"(UTC+02:00) Beirut"},{key:"Africa/Cairo",value:"(UTC+02:00) Cairo"},{key:"Europe/Chisinau",value:"(UTC+02:00) Chisinau"},{key:"Asia/Damascus",value:"(UTC+02:00) Damascus"},{key:"Asia/Hebron",value:"(UTC+02:00) Gaza, Hebron"},{key:"Africa/Johannesburg",value:"(UTC+02:00) Harare, Pretoria"},{key:"Europe/Kiev",value:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius"},{key:"Asia/Jerusalem",value:"(UTC+02:00) Jerusalem"},{key:"Africa/Juba",value:"(UTC+02:00) Juba"},{key:"Europe/Kaliningrad",value:"(UTC+02:00) Kaliningrad"},{key:"Africa/Khartoum",value:"(UTC+02:00) Khartoum"},{key:"Africa/Tripoli",value:"(UTC+02:00) Tripoli"},{key:"Africa/Windhoek",value:"(UTC+02:00) Windhoek"},{key:"Asia/Baghdad",value:"(UTC+03:00) Baghdad"},{key:"Europe/Istanbul",value:"(UTC+03:00) Istanbul"},{key:"Asia/Riyadh",value:"(UTC+03:00) Kuwait, Riyadh"},{key:"Europe/Minsk",value:"(UTC+03:00) Minsk"},{key:"Europe/Moscow",value:"(UTC+03:00) Moscow, St. Petersburg"},{key:"Africa/Nairobi",value:"(UTC+03:00) Nairobi"},{key:"Europe/Volgograd",value:"(UTC+04:00) Volgograd"},{key:"Asia/Tehran",value:"(UTC+03:30) Tehran"},{key:"Asia/Dubai",value:"(UTC+04:00) Abu Dhabi, Muscat"},{key:"Europe/Astrakhan",value:"(UTC+04:00) Astrakhan, Ulyanovsk"},{key:"Asia/Baku",value:"(UTC+04:00) Baku"},{key:"Europe/Samara",value:"(UTC+04:00) Izhevsk, Samara"},{key:"Indian/Mauritius",value:"(UTC+04:00) Port Louis"},{key:"Europe/Saratov",value:"(UTC+04:00) Saratov"},{key:"Asia/Tbilisi",value:"(UTC+04:00) Tbilisi"},{key:"Asia/Yerevan",value:"(UTC+04:00) Yerevan"},{key:"Asia/Kabul",value:"(UTC+04:30) Kabul"},{key:"Asia/Tashkent",value:"(UTC+05:00) Ashgabat, Tashkent"},{key:"Asia/Yekaterinburg",value:"(UTC+05:00) Ekaterinburg"},{key:"Asia/Karachi",value:"(UTC+05:00) Islamabad, Karachi"},{key:"Asia/Qyzylorda",value:"(UTC+05:00) Qyzylorda"},{key:"Asia/Kolkata",value:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi"},{key:"Asia/Colombo",value:"(UTC+05:30) Sri Jayawardenepura"},{key:"Asia/Kathmandu",value:"(UTC+05:45) Kathmandu"},{key:"Asia/Almaty",value:"(UTC+06:00) Astana"},{key:"Asia/Dhaka",value:"(UTC+06:00) Dhaka"},{key:"Asia/Omsk",value:"(UTC+06:00) Omsk"},{key:"Asia/Yangon",value:"(UTC+06:30) Yangon (Rangoon)"},{key:"Asia/Bangkok",value:"(UTC+07:00) Bangkok, Hanoi, Jakarta"},{key:"Asia/Barnaul",value:"(UTC+07:00) Barnaul, Gorno-Altaysk"},{key:"Asia/Hovd",value:"(UTC+07:00) Hovd"},{key:"Asia/Krasnoyarsk",value:"(UTC+07:00) Krasnoyarsk"},{key:"Asia/Novosibirsk",value:"(UTC+07:00) Novosibirsk"},{key:"Asia/Tomsk",value:"(UTC+07:00) Tomsk"},{key:"Asia/Shanghai",value:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi"},{key:"Asia/Irkutsk",value:"(UTC+08:00) Irkutsk"},{key:"Asia/Singapore",value:"(UTC+08:00) Kuala Lumpur, Singapore"},{key:"Australia/Perth",value:"(UTC+08:00) Perth"},{key:"Asia/Taipei",value:"(UTC+08:00) Taipei"},{key:"Asia/Ulaanbaatar",value:"(UTC+08:00) Ulaanbaatar"},{key:"Australia/Eucla",value:"(UTC+08:45) Eucla"},{key:"Asia/Chita",value:"(UTC+09:00) Chita"},{key:"Asia/Tokyo",value:"(UTC+09:00) Osaka, Sapporo, Tokyo"},{key:"Asia/Pyongyang",value:"(UTC+09:00) Pyongyang"},{key:"Asia/Seoul",value:"(UTC+09:00) Seoul"},{key:"Asia/Yakutsk",value:"(UTC+09:00) Yakutsk"},{key:"Australia/Adelaide",value:"(UTC+09:30) Adelaide"},{key:"Australia/Darwin",value:"(UTC+09:30) Darwin"},{key:"Australia/Brisbane",value:"(UTC+10:00) Brisbane"},{key:"Australia/Sydney",value:"(UTC+10:00) Canberra, Melbourne, Sydney"},{key:"Pacific/Port_Moresby",value:"(UTC+10:00) Guam, Port Moresby"},{key:"Australia/Hobart",value:"(UTC+10:00) Hobart"},{key:"Asia/Vladivostok",value:"(UTC+10:00) Vladivostok"},{key:"Australia/Lord_Howe",value:"(UTC+10:30) Lord Howe Island"},{key:"Pacific/Bougainville",value:"(UTC+11:00) Bougainville Island"},{key:"Asia/Srednekolymsk",value:"(UTC+11:00) Chokurdakh"},{key:"Asia/Magadan",value:"(UTC+11:00) Magadan"},{key:"Pacific/Norfolk",value:"(UTC+11:00) Norfolk Island"},{key:"Asia/Sakhalin",value:"(UTC+11:00) Sakhalin"},{key:"Pacific/Guadalcanal",value:"(UTC+11:00) Solomon Is., New Caledonia"},{key:"Asia/Kamchatka",value:"(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky"},{key:"Pacific/Auckland",value:"(UTC+12:00) Auckland, Wellington"},{key:"Etc/GMT-12",value:"(UTC+12:00) Coordinated Universal Time+12"},{key:"Pacific/Fiji",value:"(UTC+12:00) Fiji"},{key:"Pacific/Chatham",value:"(UTC+12:45) Chatham Islands"},{key:"Etc/GMT-13",value:"(UTC+13:00) Coordinated Universal Time+13"},{key:"Pacific/Tongatapu",value:"(UTC+13:00) Nuku'alofa"},{key:"Pacific/Apia",value:"(UTC+13:00) Samoa"},{key:"Pacific/Kiritimati",value:"(UTC+14:00) Kiritimati Island"}];const Gs=()=>js.map(({key:e,value:t})=>({timeZone:e,displayName:t}));let L=class extends ke{constructor(){super(...arguments),this.userProfileController=new Vs(this),this.supportedDateFormat={"MM/dd/yyyy":"mm/dd/yyyy (e.g.: 04/24/2023)","dd/MM/yyyy":"dd/mm/yyyy (e.g.: 24/04/2023)","yyyy/MM/dd":"yyyy/mm/dd (e.g.: 2023/04/24)"},this.supportedTimeFormat={"h:mm a":"12-hour clock (e.g. 1:00 PM)","HH:mm":"24-hour clock (e.g. 13:00)"},this.isDialogVisible=!1,this.allowSave=!0,this.isLoading=!1,this.timezones=Gs()}async firstUpdated(){await this.retrieveUserProfile(),this.shouldDisableSaveButton()}async retrieveUserProfile(){this.isLoading=!0,this.userProfile=await this.userProfileController.getUserProfile(),this.isLoading=!1}closeDialog(){this.isDialogVisible=!1,this.dispatchEvent(new CustomEvent("closeEditProfileDialog",{bubbles:!0,composed:!0}))}async saveUserProfileChanges(){var e,t,o,i;const n={profileSettingEditInput:{firstName:(e=q(this.firstName))!==null&&e!==void 0?e:this.firstName.value,lastName:(t=q(this.lastName))!==null&&t!==void 0?t:this.lastName.value,contactPhoneNumber:(o=we(this.phoneNumber))!==null&&o!==void 0?o:this.phoneNumber.value,preferredTimezone:this.preferredTimezone.value,preferredDateFormat:this.preferredDateFormat.value,preferredTimeFormat:this.preferredTimeFormat.value}};((i=this.userProfile)===null||i===void 0?void 0:i.preferredTimezone)!==n.profileSettingEditInput.preferredTimezone&&(n.profileSettingEditInput.timezoneOverridden=!0),this.isLoading=!0,await this.userProfileController.updateUserProfile(n).then(()=>{Xt("Your profile info has been successfully updated",3e3,"center")}),this.saveDateTimeFormatToLocalStorage(n),this.isLoading=!1,this.closeDialog()}validatePhoneInput(e,t){const o=we(e);if(o==="000-000-0000"){e.error=!1,e.errorText="",this.shouldDisableSaveButton();return}if(this.userProfile.contactPhoneNumber=o!=null?o:"",e.required&&!Fe(e,o)){this.allowSave=!1;return}if(!bt(e,t)){this.allowSave=!1;return}e.error=!1,e.errorText="",this.shouldDisableSaveButton()}saveDateTimeFormatToLocalStorage(e){localStorage.setItem("date-format",JSON.stringify({preferredDateFormat:e.profileSettingEditInput.preferredDateFormat,preferredTimeFormat:e.profileSettingEditInput.preferredTimeFormat,preferredTimezone:e.profileSettingEditInput.preferredTimezone})),this.dispatchEvent(new CustomEvent("dateFormatChanged",{bubbles:!0,composed:!0}))}shouldDisableSaveButton(){this.allowSave=!(this.isInvalid()||this.isEmpty())}isInvalid(){return this.firstName.error||this.lastName.error||this.phoneNumber.error}isEmpty(){var e,t,o;return!(!((e=this.userProfile)===null||e===void 0)&&e.firstName)||!(!((t=this.userProfile)===null||t===void 0)&&t.lastName)||!(!((o=this.userProfile)===null||o===void 0)&&o.contactPhoneNumber)}render(){var e,t,o,i,n,a,r,c;return l`<ix-dialog class="dialog z-50 relative" ?open="${this.isDialogVisible}" @close="${()=>this.closeDialog()}"> ${this.isLoading?l`<ix-progress indeterminate slot="content"></ix-progress>`:""} <div class="dlr-text-heading flex p-6" slot="headline"> <span>Edit Profile</span> </div> <form class="dialog-form min-w-0 max-w-full max-[640px]:w-screen px-6 pb-5 pt-[0px]" slot="content" id="edit-profile-id" method="dialog"> <div class="user-profile-name-input-group grid grid-cols-1 sm:grid-cols-2 gap-3"> <div class="user-profile-input"> <ix-textbox required id="first-name" class="textbox" type="text" pattern="${Ne.name}" label="First Name" placeholder="i.e. First Name" value="${(t=(e=this.userProfile)===null||e===void 0?void 0:e.firstName)!==null&&t!==void 0?t:""}" @input="${()=>{var p;this.allowSave=yt(this.firstName,this.firstName.value,"Invalid first name"),this.userProfile.firstName=(p=q(this.firstName))!==null&&p!==void 0?p:"",this.shouldDisableSaveButton()}}"></ix-textbox> </div> <div class="user-profile-input"> <ix-textbox required id="last-name" class="textbox" type="text" pattern="${Ne.name}" label="Last Name" placeholder="i.e. Last Name" value="${(i=(o=this.userProfile)===null||o===void 0?void 0:o.lastName)!==null&&i!==void 0?i:""}" @input="${()=>{var p;this.allowSave=yt(this.lastName,this.lastName.value,"Invalid last name"),this.userProfile.lastName=(p=q(this.lastName))!==null&&p!==void 0?p:"",this.shouldDisableSaveButton()}}"></ix-textbox> </div> </div> <div class="user-profile-input mb-4"> <ix-phone-input required id="phone-number" class="single-row-textbox w-full" label="Phone Number" value="${(a=(n=this.userProfile)===null||n===void 0?void 0:n.contactPhoneNumber)!==null&&a!==void 0?a:""}" @input="${()=>{this.validatePhoneInput(this.phoneNumber,"Invalid phone number")}}"></ix-phone-input> </div> <div class="user-profile-input"> <ix-textbox id="email" class="single-row-textbox" type="email" label="Email Address" readOnly="true" disabled="true" value="${(c=(r=this.userProfile)===null||r===void 0?void 0:r.email)!==null&&c!==void 0?c:""}"></ix-textbox> </div> <div class="user-profile-input"> <ix-select appearance="outlined" id="preferredTimezone" label="Time Zone" menu-positioning="fixed"> ${this.timezones.map(p=>{var m;return l` <ix-select-option value="${p.timeZone}" ?selected="${p.timeZone===((m=this.userProfile)===null||m===void 0?void 0:m.preferredTimezone)}"> <div slot="headline">${p.displayName}</div> </ix-select-option> `})} </ix-select> </div> <div class="user-profile-input"> <ix-select menu-positioning="fixed" appearance="outlined" id="preferredDateFormat" label="Date format"> ${Object.entries(this.supportedDateFormat).map(([p,m])=>{var h;return l` <ix-select-option value="${p}" ?selected="${p===((h=this.userProfile)===null||h===void 0?void 0:h.preferredDateFormat)}"> <div slot="headline">${m}</div> </ix-select-option> `})} </ix-select> </div> <div class="user-profile-input"> <ix-select menu-positioning="fixed" appearance="outlined" id="preferredTimeFormat" label="Time Format"> ${Object.entries(this.supportedTimeFormat).map(([p,m])=>{var h;return l` <ix-select-option value="${p}" ?selected="${p===((h=this.userProfile)===null||h===void 0?void 0:h.preferredTimeFormat)}"> <div slot="headline">${m}</div> </ix-select-option> `})} </ix-select> </div> </form> <div class="dialog-actions p-2" slot="actions"> <ix-button form="edit-profile-id" appearance="text" text="Cancel" @click="${()=>this.closeDialog()}"> Cancel </ix-button> <ix-button id="save-user-button" appearance="text" text="Save Changes" ?disabled="${!this.allowSave||this.isLoading}" @click="${()=>{this.saveUserProfileChanges()}}"> Save Changes </ix-button> </div> </ix-dialog>`}};L.styles=[ti,A],s([d({type:Boolean})],L.prototype,"isDialogVisible",void 0),s([u()],L.prototype,"allowSave",void 0),s([u()],L.prototype,"userProfile",void 0),s([u()],L.prototype,"isLoading",void 0),s([u()],L.prototype,"timezones",void 0),s([N("#first-name")],L.prototype,"firstName",void 0),s([N("#last-name")],L.prototype,"lastName",void 0),s([N("#phone-number")],L.prototype,"phoneNumber",void 0),s([N("#preferredTimezone")],L.prototype,"preferredTimezone",void 0),s([N("#preferredDateFormat")],L.prototype,"preferredDateFormat",void 0),s([N("#preferredTimeFormat")],L.prototype,"preferredTimeFormat",void 0),L=s([b("ui-um-user-profile")],L);class Ks{async getAuthorisation(){const t=await et.getState(),[o,i,n,a]=t;return[o,i,n,a]}}const Js=new Ks;class Zs extends Te{constructor(){super(...arguments),this.expandedNodes=[]}toggleNodeExpanded(t){this.expandedNodes.includes(t)?this.expandedNodes=this.expandedNodes.filter(o=>o!==t):this.expandedNodes.push(t)}async refresh(){this.requestHydration(),this.set(Ts(this.expandedNodes)),this.completeHydration()}}const ii=new Zs({});let O=class extends ke{constructor(){super(),this.errorService=g,this.routes=[],this.baseUrl="",this.isStandalone=!1,this.disableAuthentication=!1,this.compact=localStorage.getItem("compact")==="true",this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1,this.isEditUserProfileDialogOpen=!1,this.handleDrawerEventBinding=this.handleDrawerEvent.bind(this),this.handleCloseEditProfileDialogBinding=this.handleCloseEditProfileDialog.bind(this),this.handleAccountSwitchBinding=this.handleAccountSwitch.bind(this),this.handleEditProfileEventBinding=this.handleEditProfileEvent.bind(this),U.setLoading=!0}connectedCallback(){super.connectedCallback(),window.addEventListener(_.CreateUserClicked,this.handleDrawerEventBinding),document.addEventListener(_.AccountSwitched,this.handleAccountSwitchBinding),window.addEventListener(_.EditProfile,this.handleEditProfileEventBinding)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(_.CreateUserClicked,this.handleDrawerEventBinding),document.removeEventListener(_.AccountSwitched,this.handleAccountSwitchBinding),window.removeEventListener(_.EditProfile,this.handleEditProfileEventBinding),ca(),g.destroyErrorHandler()}async handleAccountSwitch(e){const t=e.detail;U.setAccountNumber(t),await this.fetchData();const o=window.location.href.split("?")[0];window.history.replaceState({},document.title,o)}handleDrawerEvent(){this.toggleDrawer()}async firstUpdated(){await this.configureAuthentication(),await this.fetchData(),this.init(),U.setLoading=!1}updated(e){e.has("routes")&&this.routes.length&&la().setRoutes(this.routes)}async fetchData(){const e=be.getUserDetails(),{email:t}=e;return Js.getAuthorisation().then(o=>{const[i,n,a,r]=o;return U.setMyPermissions(i),M.myPermissions=U.getMyPermissions(),U.setEmail(t),U.setPermissions(n),U.setAccounts(r),me.set(a),ii.refresh(),o})}async configureAuthentication(){this.disableAuthentication||P().UserManagement.UI.DisableUserManagementUIAuth||!this.isStandalone?await this.configureAuthorisation():be.isProcessing()||(be.isLoggedIn()?await this.configureAuthorisation():be.redirectToAuth())}async configureAuthorisation(){const e=be.getUserDetails(),{accountNumber:t}=e;U.setAccountNumber(t)}init(){setTimeout(()=>{this.mainApp&&(ra(this.mainApp,this.baseUrl,vo),$e(window,_.AuthenticationComplete,{accountNumber:U.getAccountNumber()}))})}toggleDrawer(){this.showDraft&&(this.showDraft=!this.showDraft),this.showDrawer=!this.showDrawer}closeDrawer(){this.showDrawer=!1}toggleCompact(){this.compact=!this.compact,localStorage.setItem("compact",`${this.compact}`)}toggleDraft(){this.showDrawer=!this.showDrawer,this.showDraft=!this.showDraft}cancelCreateUser(){this.showDrawer=!1,this.showDraft=!1,this.showCancelDialog=!1}toggleCancelDialog(){this.showCancelDialog=!this.showCancelDialog}renderCreateUser(){return M.hasExternalUserCreate()?l` <create-user-container ?showDrawer="${this.showDrawer}" ?showDraft="${this.showDraft}" ?showCancelDialog="${this.showCancelDialog}" @blur-drawer="${this.toggleCancelDialog}" @toggle-drawer="${this.toggleDrawer}" @toggle-draft="${this.toggleDraft}" @toggle-dialog="${this.toggleCancelDialog}" @close-drawer="${this.closeDrawer}" @cancel-create-user="${this.cancelCreateUser}"></create-user-container> `:x}renderLoading(){return U.getLoading?l` <main> <error-dialog></error-dialog> <ix-progress id="application-loading-bar" aria-label="Application loading bar" indeterminate></ix-progress> </main> `:x}handleEditProfileEvent(){this.isEditUserProfileDialogOpen=!0}handleCloseEditProfileDialog(){this.isEditUserProfileDialogOpen=!1}renderEditProfileForm(){return l` <ui-um-user-profile ?isDialogVisible="${this.isEditUserProfileDialogOpen}" @closeEditProfileDialog="${this.handleCloseEditProfileDialogBinding}"></ui-um-user-profile>`}render(){return l` ${this.renderCreateUser()} <div class="flex flex-col"> <div class="animate-width absolute inset-0 bg-black opacity-50 z-20 ${this.compact?"hidden":"block"} lg:hidden" @click="${this.toggleCompact}" @keypress="${this.toggleCompact}"></div> ${this.isStandalone?l` <nav class="nav-bar wide p-4 m-2 rounded-xl flex items-center relative z-1 md:hidden"> <div class="flex-1"> <ix-icon-button @click="${this.toggleCompact}" icon="menu" class="white-icon"></ix-icon-button> </div> <div class="w-[178px]"> <svg focusable="false" viewBox="0 0 178 27" fill="white" class="w-full"> ${je.digitalRealtyLogoWithText} </svg> </div> <div class="flex-1"></div> </nav> `:x} <div class="w-full h-full flex relative ${this.showDrawer?"drawer-visible":""}"> ${this.isStandalone?l` <div class="${this.compact?"left-[-200px]":"left-0"} min-w-[96px] absolute z-1 md:relative lg:min-w-fit md:left-0 animate-width h-screen"> <navigation-bar @toggle-menu="${this.toggleCompact}" ?compact="${this.compact}" class="h-full p-2 block absolute drop-shadow-lg overflow-auto sm:overflow-visible lg:static lg:p-4"></navigation-bar> </div> `:x} <div class="grow w-full h-full"> <div class="flex flex-col grow h-full ${this.isStandalone?"p-2 lg:p-4":""}"> ${this.isStandalone?l`<app-header @create-user="${this.toggleDrawer}"></app-header>`:x} <main class="h-full">${this.renderLoading()}</main> </div> </div> </div> </div> ${this.renderEditProfileForm()}`}};O.styles=[to,Ee,A],s([d({type:Array})],O.prototype,"routes",void 0),s([d({type:String})],O.prototype,"baseUrl",void 0),s([d({type:Boolean})],O.prototype,"isStandalone",void 0),s([d({type:Boolean,attribute:!0})],O.prototype,"disableAuthentication",void 0),s([d({type:Boolean,attribute:!1})],O.prototype,"compact",void 0),s([u()],O.prototype,"showDrawer",void 0),s([u()],O.prototype,"showDraft",void 0),s([u()],O.prototype,"showCancelDialog",void 0),s([u()],O.prototype,"isEditUserProfileDialogOpen",void 0),s([N("main")],O.prototype,"mainApp",void 0),O=s([b("ui-user-management")],O);export{xa as $,_ as A,Te as B,go as C,P as D,tt as E,Bo as F,Pe as G,Be as H,Dt as I,rt as J,Cs as K,st as L,Ut as M,Le as N,ts as O,zo as P,No as Q,z as R,ti as S,A as T,ot as U,vt as V,ha as W,yt as X,bt as Y,we as Z,pa as _,U as a,Ne as a0,fa as a1,bo as a2,xt as a3,w as a4,To as a5,ce as a6,ne as a7,$t as a8,At as a9,_t as aa,k as ab,Zo as ac,et as ad,Wo as ae,wt as af,Co as ag,ei as ah,da as b,M as c,V as d,eo as e,me as f,Ke as g,ii as h,va as i,Ii as j,q as k,wa as l,ga as m,Je as n,St as o,g as p,at as q,$e as r,Ze as s,Xo as t,Lt as u,zs as v,kt as w,Xt as x,Me as y,Lo as z};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent ui-user-management following open-wc recommendations",
4
4
  "license": "UNLICENSED",
5
5
  "author": "ui-user-management",
6
- "version": "12.0.5",
6
+ "version": "12.0.6",
7
7
  "type": "module",
8
8
  "exports": {
9
9
  "./ui-user-management.js": "./dist/ui-user-management.js",