1import{r as e}from"./rolldown-runtime-BEU_UCik.js";import{AK as t,BJ as o,BS as s,Bz as l,CJ as i,CT as n,DJ as r,DW as a,Dx as u,FW as p,GS as d,Gw as c,Gx as m,HJ as h,IJ as g,IK as b,IN as y,JC as v,Jv as R,LN as f,LO as w,LW as C,MJ as _,MS as S,Mz as M,OK as T,QJ as k,QS as I,RE as z,RN as P,Rz as F,SJ as W,VK as A,Vz as E,Ww as D,XC as U,Xh as x,YJ as j,Yo as O,Zy as N,_C as L,_H as B,aw as J,cD as G,cn as H,dh as Q,hG as K,hh as Y,iG as q,jJ as V,kz as X,oU as Z,qx as $,rY as ee,sn as te,sy as oe,vC as se,wJ as le,xE as ie,yY as ne,zJ as re,zz as ae}from"./common-DdYwb9D_.js";var ue,pe={description:"_description_1i9dd_1",actions:"_actions_1i9dd_5",role:"_role_1i9dd_14","role-label":"_role-label_1i9dd_21","role-arrow":"_role-arrow_1i9dd_30","role-select":"_role-select_1i9dd_34"},de=new WeakMap,ce=new WeakMap,me=new WeakMap,he=class extends E{constructor(...e){super(...e),ee(this,de,void le(this,"ui")),ee(this,ce,void le(this,"store")),ee(this,me,void le(this,"newRole"))}get availableRoles(){return this.store.peekAll("role").filter(e=>e.id!==this.args.currentRole.id&&e.principalType===this.args.currentRole.principalType)}updateSelectedRole(e){this.newRole=e}};W((ue=he).prototype,"ui",[h]),W(ue.prototype,"store",[h]),W(ue.prototype,"newRole",[_]),i(ue.prototype,"updateSelectedRole",[j]),o(re({id:null,block:'[[[8,[32,0],[[17,1]],[["@title","@close"],[[28,[32,1],["components.people.transfer-users-to-another-permission-set-modal.title"],null],[30,2]]],[["default"],[[[[1,"\\n "],[10,0],[15,0,[32,2,["description"]]],[12],[1,"\\n "],[10,2],[12],[1,[28,[32,1],["components.people.transfer-users-to-another-permission-set-modal.description"],null]],[13],[1,"\\n "],[10,0],[15,0,[32,2,["role"]]],[12],[1,"\\n "],[10,0],[15,0,[32,2,["role-label"]]],[12],[1,"\\n "],[1,[30,3,["name"]]],[1,"\\n "],[13],[1,"\\n "],[10,0],[15,0,[32,2,["role-arrow"]]],[12],[1,"\\n "],[8,[32,3],null,null,null],[1,"\\n "],[13],[1,"\\n "],[10,0],[15,0,[32,2,["role-select"]]],[12],[1,"\\n "],[8,[32,4],null,[["@property","@onChange","@options","@optionLabelPath","@placeholder"],[[30,0,["newRole"]],[30,0,["updateSelectedRole"]],[30,0,["availableRoles"]],"name",[28,[32,1],["components.people.transfer-users-to-another-permission-set-modal.selectPermissionSet"],null]]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[15,0,[32,2,["actions"]]],[12],[1,"\\n "],[8,[32,5],[[4,[32,6],["click",[30,2]],null]],[["@variant","@tone"],["ghost","default"]],[["default"],[[[[1,"\\n "],[1,[28,[32,1],["shared.ui-actions.cancel"],null]],[1,"\\n "]],[]]]]],[1,"\\n\\n "],[8,[32,5],[[4,[32,6],["click",[28,[32,8],[[30,4],[30,3],[30,0,["newRole"]]],null]],null]],[["@variant","@tone","@isDisabled"],["primary","brand",[28,[32,7],[[30,0,["newRole"]]],null]]],[["default"],[[[[1,"\\n "],[1,[28,[32,1],["components.people.transfer-users-to-another-permission-set-modal.transferUsers"],null]],[1,"\\n "]],[]]]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]]]]]],["&attrs","@close","@currentRole","@onSuccess"],[]]',moduleName:"(unknown template module)",scope:()=>({Modal:v,t:l,styles:pe,IconArrowRight:$,FormSelectField:S,Button:M,__keyword__on:g,__keyword__not:p,__keyword__fn:a}),isStrictMode:!0}),ue);var ge,be={container:"_container_2jsp9_1",roleSelector:"_roleSelector_2jsp9_8",tableWrapper:"_tableWrapper_2jsp9_13",table:"_table_2jsp9_13",permissionColumn:"_permissionColumn_2jsp9_43",roleColumn:"_roleColumn_2jsp9_69",roleHeaderText:"_roleHeaderText_2jsp9_75",groupRow:"_groupRow_2jsp9_83",groupCell:"_groupCell_2jsp9_87",groupRoleCell:"_groupRoleCell_2jsp9_102",permissionRow:"_permissionRow_2jsp9_106",permissionCell:"_permissionCell_2jsp9_109",permissionCellContent:"_permissionCellContent_2jsp9_128",permissionCellText:"_permissionCellText_2jsp9_134",valueCell:"_valueCell_2jsp9_141",iconEnabled:"_iconEnabled_2jsp9_147",iconDisabled:"_iconDisabled_2jsp9_148",iconNotApplicable:"_iconNotApplicable_2jsp9_162",emptyState:"_emptyState_2jsp9_172"},ye=new WeakMap,ve=new WeakMap,Re=class extends E{constructor(...e){super(...e),ee(this,ye,void le(this,"app")),ee(this,ve,void le(this,"selectedRoleIds"))}get selectedRoles(){return this.selectedRoleIds.map(e=>this.args.roles.find(t=>
1t.id===e)).filter(e=>!!e)}get roleOptions(){return this.args.roles.map(e=>e.id)}get roleLabels(){return Object.fromEntries(this.args.roles.map(e=>[e.id,e.name]))}get permissionGroups(){const e=new Set(this.selectedRoles.flatMap(e=>e.applicablePermissions.map(e=>e.id)));return[...this.app.permissionGroupConfigs.enabledPermissionGroups].map(t=>({group:t,permissionConfigs:t.enabledGroupPermissionConfigs.filter(t=>e.has(t.id))})).filter(({permissionConfigs:e})=>e.length).sort((e,t)=>e.group.label.localeCompare(t.group.label))}isPermissionApplicable(e,t){return!!this.app.permissionConfigs.isPermissionApplyable(e.baseRoleId,t)}isPermissionEnabled(e,t){return!!e.permissionsWithImplicit[t]}onRolesChange(e){this.selectedRoleIds=e}};W((ge=Re).prototype,"app",[h]),W(ge.prototype,"selectedRoleIds",[_],function(){return[...this.args.roles].sort((e,t)=>e.name.localeCompare(t.name)).slice(0,3).map(e=>e.id)}),i(ge.prototype,"permissionGroups",[V]),i(ge.prototype,"isPermissionApplicable",[j]),i(ge.prototype,"isPermissionEnabled",[j]),i(ge.prototype,"onRolesChange",[j]),o(re({id:null,block:'[[[8,[32,0],null,[["@to"],["#modal-container"]],[["default"],[[[[1,"\\n "],[8,[32,1],null,[["@title","@size","@close","@isRenderedInPlace"],[[28,[32,2],["components.settings.roles.permission-sets-compare-modal.title"],null],"xlarge",[30,1],true]],[["default"],[[[[1,"\\n "],[10,0],[15,0,[32,3,["container"]]],[12],[1,"\\n "],[10,0],[15,0,[32,3,["roleSelector"]]],[12],[1,"\\n "],[8,[32,4],null,[["@label","@isMultiselect","@property","@onChange","@options","@optionLabelMap"],[[28,[32,2],["components.settings.roles.permission-sets-compare-modal.selectRoles"],null],true,[30,0,["selectedRoleIds"]],[30,0,["onRolesChange"]],[30,0,["roleOptions"]],[30,0,["roleLabels"]]]],null],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["selectedRoles","length"]],[[[1," "],[10,0],[15,0,[32,3,["tableWrapper"]]],[12],[1,"\\n "],[10,"table"],[15,0,[32,3,["table"]]],[12],[1,"\\n "],[10,"thead"],[12],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"th"],[14,"scope","col"],[15,0,[32,3,["permissionColumn"]]],[12],[1,"\\n "],[8,[32,5],null,[["@variant","@color"],["body-small-600","neutral-subtle"]],[["default"],[[[[1,"\\n "],[1,[28,[32,2],["components.settings.roles.permission-sets-compare-modal.permission"],null]],[1,"\\n "]],[]]]]],[1,"\\n "],[13],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["selectedRoles"]]],null]],null],null,[[[1," "],[10,"th"],[14,"scope","col"],[15,0,[32,3,["roleColumn"]]],[12],[1,"\\n "],[8,[32,5],[[16,0,[32,3,["roleHeaderText"]]]],[["@variant"],["body-small-600"]],[["default"],[[[[1,"\\n "],[1,[30,2,["name"]]],[1,"\\n "]],[]]]]],[1,"\\n "],[8,[32,6],null,[["@text"],[[30,2,["name"]]]],null],[1,"\\n "],[13],[1,"\\n"]],[2]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"tbody"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["permissionGroups"]]],null]],null],null,[[[1," "],[10,"tr"],[15,0,[32,3,["groupRow"]]],[12],[1,"\\n "],[10,"td"],[15,0,[32,3,["groupCell"]]],[12],[1,"\\n "],[8,[32,5],null,[["@variant","@color"],["body-small-600","neutral-subtle"]],[["default"],[[[[1,"\\n "],[1,[30,3,["group","label"]]],[1,"\\n "]],[]]]]],[1,"\\n "],[13],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["selectedRoles"]]],null]],null],null,[[[1," "],[10,"td"],[15,0,[32,3,["groupRoleCell"]]],[12],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,3,["permissionConfigs"]]],null]],null],null,[[[1," "],[10,"tr"],[15,0,[32,3,["permissionRow"]]],[12],[1,"\\n "],[10,"td"],[15,0,[32,3,["permissionCell"]]],[12],[1,"\\n "],[10,0],[15,0,[32,3,["permissionCellContent"]]],[12],[1,"\\n "],[8,[32,5],[[16,0,[32,3,["permissionCellText"]]]],[["@variant"],["body-default-400"]],[["default"],[[[[1,"\\n "],[1,[30,4,["label"]]],[1,"\\n "]],[]]]]],[1,"\\n"],[41,[30,4,["tooltip"]],[[[1," "],[8,[32,7],null,[["@isLabelClickable"],[false]],[["infoTooltip"],[[[[1,"\\n "],[1,[30,4,["tooltip"]]],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["selectedRoles"]]],null]],null],null,[[[1," "],[10,"td"],[15,0,[32,3,["valueCell"]]],[12],[1,"\\n"],[41,[28,[30,0,["isPermissionApplicable"]],[[30,5],[30,4,["id"]]],null],[[[41,[28,[30,0,["isPermissionEnabled"]],[[30,5],[30,4,["id"]]],null],[[[1," "],[8,[32,8],[[16,0,[32,3,["iconEnabled"]]]],null,null],[1,"\\n"]],[]],[[[1," "],[8,[32,9],[[16,0,[32,3,["iconDisabled"]]]],null,null],[1,"\\n"]],[]]]],[]],[[[1," "],[8,[32,10],[[16,0,[32,3,["iconNotApplicable"]]]],null,null],[1,"\\n "],[8,[32,6],null,[["@text"],[[28,[32,2],["components.settings.roles.permission-sets-compare-modal.notApplicable"],null]]],null],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n"]],[5]],null],[1," "],[13],[1,"\\n"]],[4]],null]],[3]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],[[[1," "],[10,0],[15,0,[32,3,["emptyState"]]],[12],[1,"\\n "],[8,[32,5],null,[["@variant","@color"],["body-default-400","neutral-subtle"]],[["default"],[[[[1,"\\n "],[1,[28,[32,2],["components.settings.roles.permission-sets-compare-modal.noRolesSelected"],null]],[1,"\\n "]],[]]]]],[1,"\\n "],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n "]],[]]]]],[1,"\\n"]],[]]]]]],["@onClose","role","permissionGroup","permConfig","role"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({RenderIn:ie,Modal:v,t:l,styles:be,SelectField:S,Typography:X,TooltipOnParent:n,LabelWithAction:I,IconCheckCircleFill:F,IconXCircle:R,IconFatDot:H}),isStrictMode:!0}),ge);var fe,we=e({default:()=>Te}
1),Ce=new WeakMap,_e=class extends E{constructor(...e){super(...e),ee(this,Ce,void le(this,"media"))}};W((fe=_e).prototype,"media",[h]),o(re({id:null,block:'[[[1,[28,[32,0],[[28,[32,1],["routes.organization.settings.roles.permissionSets"],null]],null]],[1,"\\n\\n"],[41,[30,1,["route","isCompareModalOpen"]],[[[41,[30,0,["media","isTablet"]],[[[1," "],[8,[32,2],null,[["@roles","@onClose"],[[30,1,["viewSetup","allUserPrincipalRoles"]],[30,1,["route","closeCompareModal"]]]],null],[1,"\\n"]],[]],null]],[]],null],[1,"\\n"],[41,[30,1,["route","roleToDelete"]],[[[1," "],[8,[32,3],null,[["@close","@currentRole","@onSuccess"],[[28,[32,4],[[30,1,["route","setDeletePermissionModalRole"]],[27]],null],[30,1,["route","roleToDelete"]],[30,1,["route","transferUsers"]]]],null],[1,"\\n"]],[]],null],[44,[[28,[32,5],null,null]],[[[8,[32,6],[[16,0,[29,[[32,7,["page"]]," ",[32,7,["pageFullWidth"]]]]]],[["@viewSetup"],[[30,1,["viewSetup"]]]],[["default"],[[[[1,"\\n "],[10,0],[15,0,[29,[[32,7,["titleWrapper"]]," items-center"]]],[12],[1,"\\n "],[8,[32,8],[[16,1,[30,2]],[24,0,"py-2.5"]],[["@as","@variant"],["h1","heading-medium-700"]],[["default"],[[[[1,"\\n "],[1,[28,[32,1],["templates.organization.settings.roles.title"],null]],[1,"\\n "]],[]]]]],[1,"\\n\\n "],[10,0],[14,0,"flex gap-1.5"],[12],[1,"\\n "],[8,[32,9],[[16,0,[32,10,["search"]]]],[["@property","@prefixIcon","@placeholder","@autofocus","@isClearButtonEnabled","@onChange"],[[30,1,["viewSetup","roleSearchQuery"]],[32,11],[28,[32,1],["shared.ui-actions.search"],null],[30,0,["media","isDesktop"]],true,[30,1,["viewSetup","setRoleSearchQuery"]]]],null],[1,"\\n\\n"],[41,[30,0,["media","isTablet"]],[[[1," "],[8,[32,12],[[4,[32,14],["click",[30,1,["route","openCompareModal"]]],null]],[["@variant","@tone","@prefixIcon"],["secondary","default",[32,13]]],[["default"],[[[[1,"\\n "],[1,[28,[32,1],["templates.organization.settings.roles.comparePermissionSets"],null]],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,1,["can","app","canManageRoles"]],[[[41,[30,1,["route","subscription","features","customRoles","isAvailable"]],[[[1," "],[8,[32,12],null,[["@variant","@tone","@prefixIcon","@icon","@routeParams"],["primary","brand",[52,[30,0,["media","isTablet"]],[32,15]],[52,[28,[32,16],[[30,0,["media","isTablet"]]],null],[32,15]],[28,[32,17],["organization.settings.roles.new"],null]]],[["default"],[[[[1,"\\n"],[41,[30,0,["media","isTablet"]],[[[1," "],[1,[28,[32,1],["templates.organization.settings.roles.newPermissionSet"],null]],[1,"\\n"]],[]],null],[1," "]],[]]]]],[1,"\\n"]],[]],[[[1," "],[8,[32,12],null,[["@variant","@tone","@prefixIcon","@icon"],["primary","magical",[52,[30,0,["media","isTablet"]],"rocket"],[52,[28,[32,16],[[30,0,["media","isTablet"]]],null],"rocket"]]],[["default"],[[[[1,"\\n"],[41,[30,0,["media","isTablet"]],[[[1," "],[1,[28,[32,1],["templates.organization.settings.roles.newPermissionSet"],null]],[1,"\\n"]],[]],null],[1,"\\n "],[8,[32,18],null,[["@isTriggeredOnClick","@feature"],[true,[30,1,["route","subscription","features","customRoles"]]]],null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]]]],[]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[8,[32,8],[[24,0,"mb-2"]],[["@as","@variant","@color"],["p","body-default-400","neutral-subtle"]],[["default"],[[[[1,"\\n "],[1,[28,[32,1],["templates.organization.settings.roles.permissionsDescription"],null]],[1,"\\n "],[11,"button"],[24,0,"button--link"],[24,4,"button"],[4,[32,14],["click",[28,[32,19],["8517221"],null]],null],[12],[1,"\\n "],[1,[28,[32,1],["shared.ui-actions.learnMore"],null]],[1,"\\n "],[13],[1,"\\n "]],[]]]]],[1,"\\n\\n"],[41,[30,1,["viewSetup","isEmptyState"]],[[[1," "],[8,[32,20],[[24,0,"w-full"]],[["@title","@description","@imagePath"],[[28,[32,1],["templates.organization.settings.roles.noMatchFound"],null],[28,[32,1],["templates.organization.settings.roles.noMatchFoundDescription"],null],[28,[32,21],["/assets/images/zero-states/people.svg"],null]]],null],[1,"\\n"]],[]],[[[1," "],[8,[30,3,["Table"]],[[24,0,"w-full"]],[["@scrollable","@isSimpleTable","@ariaLabelledBy"],[".js-main-content-page-scrollable",true,[30,2]]],null],[1,"\\n"]],[]]]],[3]]]]],[1,"\\n"]],[2]]],[1,"\\n"],[46,[28,[31,3],null,null],null,null,null]],["@controller","titleId","vs"],["if","let","component","-outlet"]]',moduleName:"(unknown template module)",scope:()=>({pageTitle:L,t:l,PermissionSetsCompareModal:Re,TransferUsersToAnotherPermissionSetModal:he,__keyword__fn:a,uniqueId:C,ViewSetup:Y,settingsStyles:O,Typography:X,InputField:U,quickSearchStyles:Q,IconMagnifyingGlass:s,Button:M,IconArrowsLeftRight:u,__keyword__on:g,IconPlus:d,__keyword__not:p,routeParam
1s:m,KacunkoPopover:oe,showIntercomArticle:ae,EmptyState:se,publicAsset:z}),isStrictMode:!0}),fe);var Se,Me,Te=J(_e),ke=e({RolesViewSetup:()=>Pe,default:()=>Oe}),Ie=new WeakMap,ze=new WeakMap,Pe=class extends D{constructor(...e){super(...e),ee(this,Ie,void le(this,"device")),ee(this,ze,void le(this,"roleSearchQuery")),ne(this,"isColumnsEditable",!1),ne(this,"defaultSortBy","name"),ne(this,"itemType","role"),ne(this,"itemTypeColumnId","name"),ne(this,"itemTypeRoute","organization.settings.roles.edit")}get isSortable(){return!0}get isRowsSortable(){return!0}get isClickable(){return!0}get isItemsEditable(){return!1}get defaultColumnIds(){return["name","billing-type","role-type","permissions","active-users-count","inactive-users-count"]}get apiSortBy(){return""}get allUserPrincipalRoles(){var e,t;return(null!==(t=null===(e=this.session.organization)||void 0===e?void 0:e.persistedRoles)&&void 0!==t?t:[]).filter(e=>e.principalType===f.USER)}get items(){return this.roleSearchQuery?this.allUserPrincipalRoles.filter(e=>A(e.name,this.roleSearchQuery)):this.allUserPrincipalRoles}setItems(){}setRoleSearchQuery(e){this.roleSearchQuery=null!=e?e:""}get tableRowOptions(){return this.can.app.canManageRoles?{options:[...this.can.app.canImpersonatePermissionSet?[{icon:N,label:this.intl.t("routes.organization.settings.roles.tryItOut"),click:async e=>{this.device.openWindow(`${location.origin}?previewRoleId=${e.id}`,"_blank")}}]:[],{icon:T,label:this.intl.t("routes.organization.settings.roles.duplicatePermissionSet"),click:async e=>{await this.routing.transitionTo("organization.settings.roles.new",{queryParams:{duplicateId:e.id}})},getDisabledTooltipText:()=>{var e;return(null===(e=this.subscription.features)||void 0===e?void 0:e.customRoles.isAvailable)?this.intl.t("routes.organization.settings.roles.permissionSetCannotBeDuplicated"):this.intl.t("routes.organization.settings.roles.customPermissionSetsAreNotAvailable")},isDisabled:e=>{var t;return e.baseRoleId===r.CONTRACTOR||!(null===(t=this.subscription.features)||void 0===t?void 0:t.customRoles.isAvailable)}},{icon:c,label:this.intl.t("shared.ui-actions.delete"),isImportant:!0,getDisabledTooltipText:e=>{var t;return(null===(t=this.subscription.features)||void 0===t?void 0:t.customRoles.isAvailable)?e.peopleCount>0?this.intl.t("routes.organization.settings.roles.deleteWithAssociatedUsers"):e.editableByUser?this.intl.t("routes.organization.settings.roles.unableToDeleteRole"):this.intl.t("routes.organization.settings.roles.deleteSystemPermissionSet"):this.intl.t("routes.organization.settings.roles.customPermissionSetsAreNotAvailable")},isDisabled:e=>{var t;return!e.editableByUser||!(null===(t=this.subscription.features)||void 0===t?void 0:t.customRoles.isAvailable)},click:async e=>{if(e.peopleCount>0)try{this.route.setDeletePermissionModalRole(e)}catch(t){this.ui.buildFlash().message(this.intl.t("routes.organization.settings.roles.operationCanceledOrFailed")).showError()}else await this.ui.buildModal().title(this.intl.t("routes.organization.settings.roles.deleteConfirmation",{roleName:e.name})).confirm(),await e.destroyRecord(),this.ui.showDeleteSuccessFlash(e.name)}}]}:null}columnsConfig(){return[{id:"name",type:"string",label:this.intl.t("shared.form-fields.name")},{id:"billing-type",type:"enum",enum:{[P.FREE]:this.intl.t("routes.organization.settings.roles.freeSeat"),[P.PAID]:this.intl.t("routes.organization.settings.roles.paidSeat")},enumPaletteMap:{[P.FREE]:"concrete",[P.PAID]:"green"},label:this.intl.t("routes.organization.settings.roles.billing")},{id:"role-type",type:"enum",enum:{[y.CUSTOM]:this.intl.t("routes.organization.settings.roles.custom"),[y.SYSTEM]:this.intl.t("routes.organization.settings.roles.system")},enumPaletteMap:{[y.CUSTOM]:"blue",[y.SYSTEM]:"concrete"},label:this.intl.t("shared.ui-general.type")},{id:"permissions",type:"active-permissions",attr:"role",label:this.intl.t("routes.organization.settings.roles.activePermissions"),sort:!1},{id:"active-users-count",type:"active-users-count",attr:"role",label:this.intl.t("routes.organization.settings.roles.activeUsers"),nonReportItemSortAttr:"activeUsersCount"},{id:"inactive-users-count",type:"inactive-users-count",attr:"role",label:this.intl.t("routes.organization.settings.roles.inactiveUsers"),nonReportItemSortAttr:"inactiveUsersCount"}]}buildFilteredModelsQuery(e){return w.on(this).forUsers().filter(e)}};W((Se=Pe).prototype,"device",[h]),W(Se.prototype,"roleSearchQuery",[_],function(){return""}),i(Se.prototype,"defaultColumnIds",[V]),i(Se.prototype,"setRoleSearchQuery",[j]);var Fe=new WeakMap,We=new WeakMap,Ae=new WeakMap,Ee=new WeakMap,De=new WeakMap,Ue=new WeakMap,xe=new WeakMap,je=new WeakMap,Oe=class extends G{constructor(...e){super(...e),ee(this,Fe,void le(this,"can")),ee(this,We,void le(this,"flags")),ee(this,Ae,void le(this,"ui")),ee(this,Ee,void le(this,"apiAction")),ee(this,De,void le(this,"intl")),ee(this,Ue,void le(this,"subscription")),ee(this,xe,void le(this,"roleToDelete")),ee(this,je,void le(this,"isCompareModalOpen"))}async beforeModel(e){if(await super.beforeModel(e),!this.can.app.canViewRoles)return this.redirectToSettings()}setupController(e,t,o){super.setupController(e,t,o),e.set("viewSetup",new Pe(k(this),{route:this})),e.set("route",this),e.set("can",this.can),e.viewSetup.activate()}resetController(e,t,o){super.resetController(e,t,o),e.viewSetup.deactivate()}openCompareModal(){this.isCompareModalOpen=!0}closeCompareModal(){this.isCompareModalOpen=!1}redirectToSettings(){return this.routing.transitionTo("organization.settings")}setDeletePermissionModalRole(e){this.roleToDelete=e}async transferUsers(e,t){if(await this.apiAction.newAction("role:transferUsersToRole",[e,t]),this.controller.viewSetup.reloadFilteredModels(),this.ui.buildFlash().message(this.intl.t("routes.organization.settings.roles.usersTransferred")).showInfo(),this.setDeletePermissionModalRole(void 0),await this.ui.buildModal().title(this.intl.t("routes.organization.settings.roles.deleteConfirmationWithUsersTransferred",{roleName:e.name})).confirm({returnResult:!0}))try{await e.destroyRecord(),this.ui.showDeleteSuccessFlash(e.name)}catch(o){const e=new q(o);if(e.isServerError)this.ui.showSaveErrorFlash(this.intl.t("routes.organization.settings.roles.somethingWentWrong"));else if(!e.isClientError)throw o}}};W((Me=Oe).prototype,"can",[h]),W(Me.prototype,"flags",[h]),W(Me.prototype,"ui",[h]),W(Me.prototype,"apiAction",[h]),W(Me.prototype,"intl",[h]),W(Me.prototype,"subscription",[h]),W(Me.prototype,"roleToDelete",[_]),W(Me.prototype,"isCompareModalOpen",[_],function(){return!1}),i(Me.prototype,"openCompareModal",[j]),i(Me.prototype,"closeCompareModal",[j]),i(Me.prototype,"redirectToSettings",[j]),i(Me.prototype,"setDeletePermissionModalRole",[j]),i(Me.prototype,"transferUsers",[j]);var Ne,Le=e({default:()=>Be}),Be=J(o(re({id:null,block:'[[[41,[30,1,["customRoleForm"]],[[[1," "],[8,[32,0],null,[["@closeSidebar","@form","@submitForm"],[[30,1,["route","closeModal"]],[30,1,["customRoleForm"]],[30,1,["route","submitCustomRoleForm"]]]],null],[1,"\\n"]],[]],null]],["@controller"],["if"]]',moduleName:"(unknown template module)",scope:()=>({RoleModal:te}),isStrictMode:!0}),t())),Je=e({default:()=>qe}),Ge=new WeakMap,He=new WeakMap,Qe=new WeakMap,Ke=new WeakMap,Ye=new WeakMap,qe=class extends G{constructor(...e){super(...e),ee(this,Ge,void le(this,"can")),ee(this,He,void le(this,"formsHandler")),ee(this,Qe,void le(this,"intl")),ee(this,Ke,void le(this,"subscription")),ee(this,Ye,void le(this,"ui")),ne(this,"controller",void 0)}model(e){return this.store.findRecord("role",e.role_id)}setupController(e,t,o){super.setupController(e,t,o),e.set("route",this),e.set("customRoleForm",this.formsHandler.createForm(x,[t]))}resetController(e,t,o){var s;super.resetController(e,t,o),null===(s=e.customRoleForm)||void 0===s||s.destroy(),e.set("customRoleForm",null)}async submitCustomRoleForm(){try{var e;await(null===(e=this.controller.customRoleForm)||void 0===e?void 0:e.save())}catch(l){var t,o,s;if(new q(l).adapterErrorCode===K.CUSTOM_ROLE_STILL_IN_USE)return void this.ui.buildModal().title(this.intl.t("services.ui.conflict409Title")).html(this.intl.t("routes.organization.settings.roles.customRoleStillInUse",{isNotOwner:this.session.currentPerson!==(null===(t=this.session.organization)||void 0===t?void 0:t.owner),canUpdatePermissions:null===(o=this.session.currentPerson)||void 0===o?void 0:o.ability.canUpdatePermissions,ownerName:null===(s=this.session.organization)||void 0===s||null===(s=s.owner)||void 0===s?void 0:s.name})).alert();throw l}}redirectToRoles(){return this.routing.transitionTo("organization.settings.roles")}};W((Ne=qe).prototype,"can",[h]),W(Ne.prototype,"formsHandler",[h]),W(Ne.prototype,"intl",[h]),W(Ne.prototype,"subscription",[h]),W(Ne.prototype,"ui",[h]),i(Ne.prototype,"submitCustomRoleForm",[j]);var Ve,Xe=e({default:()=>Ze}
1),Ze=J(o(re({id:null,block:'[[[41,[30,1,["customRoleForm"]],[[[1," "],[8,[32,0],null,[["@closeSidebar","@form","@submitForm","@isTryoutDisabled"],[[30,1,["route","closeModal"]],[30,1,["customRoleForm"]],[30,1,["route","submitCustomRoleForm"]],true]],null],[1,"\\n"]],[]],null]],["@controller"],["if"]]',moduleName:"(unknown template module)",scope:()=>({RoleModal:te}),isStrictMode:!0}),t())),$e=e({default:()=>lt}),et=new WeakMap,tt=new WeakMap,ot=new WeakMap,st=new WeakMap,lt=class extends G{constructor(...e){super(...e),ee(this,et,void le(this,"app")),ee(this,tt,void le(this,"formsHandler")),ee(this,ot,void le(this,"subscription")),ee(this,st,void le(this,"intl")),ne(this,"isModalRoute",!0),ne(this,"controller",void 0),ne(this,"queryParams",{duplicateId:{}})}async beforeModel(e){var t;if(await super.beforeModel(e),!(null===(t=this.subscription.features)||void 0===t?void 0:t.customRoles.isAvailable))return this.redirectToRoles()}model(e){const t=this.store.createRecord("role",{permissions:{},editableByUser:!0,userTypeId:Z.TIME_TRACKER,principalType:f.USER});if(e.duplicateId){const t=this.store.peekRecord("role",e.duplicateId);if(t)return this.duplicateRole(t)}return t}setupController(e,t,o){super.setupController(e,t,o),e.set("route",this),e.set("customRoleForm",this.formsHandler.createForm(x,[t]))}resetController(e,t,o){var s;super.resetController(e,t,o),null===(s=e.customRoleForm)||void 0===s||s.destroy(),e.set("customRoleForm",null),t&&e.set("duplicateId",null)}async submitCustomRoleForm(){this.controller.customRoleForm&&(await this.formsHandler.submitForm(this.controller.customRoleForm),this.closeModal())}duplicateRole(e){const t=e.baseRoleId?B[e.baseRoleId]:r.ZERO_ROLE,o=b(e.normalizedPermissions);return t!==e.baseRoleId&&this.app.permissionConfigs.permissions.forEach(s=>{s.defaults.includes(e.baseRoleId)&&!s.defaults.includes(t)&&void 0===o[s.id]&&(o[s.id]=!0)}),this.store.createRecord("role",{name:this.intl.t("routes.organization.settings.roles.new.roleCopy",{roleName:e.name}),baseRoleId:t,permissions:o,description:e.description,editableByUser:!0,userTypeId:e.userTypeId,principalType:e.principalType})}redirectToRoles(){return this.routing.transitionTo("organization.settings.roles")}};W((Ve=lt).prototype,"app",[h]),W(Ve.prototype,"formsHandler",[h]),W(Ve.prototype,"subscription",[h]),W(Ve.prototype,"intl",[h]),i(Ve.prototype,"submitCustomRoleForm",[j]);var it={};it["productive/templates/organization/settings/roles"]=we,it["productive/routes/organization/settings/roles"]=ke,it["productive/templates/organization/settings/roles/edit"]=Le,it["productive/routes/organization/settings/roles/edit"]=Je,it["productive/templates/organization/settings/roles/new"]=Xe,it["productive/routes/organization/settings/roles/new"]=$e;export{it as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.