text: /*! rcm-switch-user 2019-10-22 */
  
  "undefined"!=typeof rcm&&rcm.addAngularModule("rcmSwitchUser"),angular.module("rcmSwitchUser",["RcmLoading","RcmJsLib","rcmApiLib"]);var RcmSwitchUserConfig=function(){var self=this;self.config={},self.defaults={showSwitchToUserNameField:!0,switchToUserName:"",switchToUserNameButtonLabel:"Switch to User",switchBackButtonLabel:"End Impersonation",switchUserInfoContentPrefix:"Impersonating:",switchToUserNamePlaceholder:"Username"},self.get=function(key){return self.config[key]?self.config[key]:self.defaults[key]?self.defaults[key]:null}};angular.module("rcmSwitchUser").service("rcmSwitchUserConfig",function(){return new RcmSwitchUserConfig}),angular.module("rcmSwitchUser").directive("rcmSwitchUserSwitchToUser",["$sce","$window",function($sce,$window){function link($scope,element,attrs){}return{link:link,scope:{propLoading:"=loading",propIsSu:"=isSu",propImpersonatedUser:"=impersonatedUser",propSwitchBackMethod:"=switchBackMethod",propShowSwitchToUserNameField:"=showSwitchToUserNameField",propSwitchToUserName:"=switchToUserName",propSwitchToUserNamePlaceholder:"=switchToUserNamePlaceholder",propSwitchToUserNameButtonLabel:"=switchToUserNameButtonLabel",propSwitchBackButtonLabel:"=switchBackButtonLabel",propSuUserPassword:"=suUserPassword",propSwitchUserInfoContentPrefix:"=switchUserInfoContentPrefix",propMessage:"=message",propOnSwitchTo:"=onSwitchTo",propOnSwitchBack:"=onSwitchBack"},template:'<style type="text/css">    .switch-user.default label,    .switch-user.default p {        margin: 5px 0px 5px 0px;    }</style><div class="switch-user default container-fluid" ng-hide="propLoading">    <div class="row form-inline">        <div class="col-md-12" ng-show="propMessage">            <div class="alert alert-warning" role="alert">                {{propMessage.value}}            </div>        </div>        <div class="col-md-3" ng-show="propIsSu">            <label class="switch-user-info-content">                {{propSwitchUserInfoContentPrefix}} {{propImpersonatedUser.id}} {{propImpersonatedUser.username}}            </label>        </div>        <div class="col-md-4" ng-show="propShowSwitchToUserNameField">            <form ng-submit="propOnSwitchTo()">                <input class="form-control input-sm switchToUserName"                       placeholder="{{propSwitchToUserNamePlaceholder}}"                       ng-model="propSwitchToUserName"                       type="text"/>                <button class="btn btn-default btn-sm"                        type="submit">{{propSwitchToUserNameButtonLabel}}                </button>            </form>        </div>        <div class="col-md-4" ng-show="propIsSu">            <form ng-submit="propOnSwitchBack()">                <input class="form-control input-sm suUserPassword"                       placeholder="password"                       ng-model="propSuUserPassword"                       ng-show="propSwitchBackMethod == \'auth\'"                       type="password"/>                <button class="btn btn-primary btn-sm"                        type="submit">{{propSwitchBackButtonLabel}}                </button>            </form>        </div>    </div></div>'}}]),angular.module("rcmSwitchUser").directive("rcmSwitchUserSwitchToUserSimple",["$sce","$window",function($sce,$window){function link($scope,element,attrs){$scope.showImpersonatorDetails=!1,$scope.toggleImpersonatorDetails=function(){$scope.showImpersonatorDetails=!$scope.showImpersonatorDetails}}return{link:link,scope:{propLoading:"=loading",propIsSu:"=isSu",propImpersonatedUser:"=impersonatedUser",propSwitchBackMethod:"=switchBackMethod",propShowSwitchToUserNameField:"=showSwitchToUserNameField",propSwitchToUserName:"=switchToUserName",propSwitchToUserNamePlaceholder:"=switchToUserNamePlaceholder",propSwitchToUserNameButtonLabel:"=switchToUserNameButtonLabel",propSwitchBackButtonLabel:"=switchBackButtonLabel",propSuUserPassword:"=suUserPassword",propSwitchUserInfoContentPrefix:"=switchUserInfoContentPrefix",propMessage:"=message",propOnSwitchTo:"=onSwitchTo",propOnSwitchBack:"=onSwitchBack"},template:'<style type="text/css">    /* show full borders */    .switch-user.simple .input-group-btn button {        margin-right: 1px;    }</style><div class="switch-user simple">    <div class="row" ng-show="propMessage">        <div class="col-sm-12">            <div class="alert alert-warning" role="alert">                {{propMessage.value}}            </div>        </div>    </div>    <div class="row">        <div class="col-sm-12">            <form ng-submit="propOnSwitchTo()">                <div class="input-group input-group-sm">                    <input class="form-control switchToUserName"                           placeholder="{{propSwitchToUserNamePlaceholder}}"                           ng-model="propSwitchToUserName"                           type="text"                    >                    <span class="input-group-btn">                        <button class="btn btn-primary"                                type="submit">                            {{propSwitchToUserNameButtonLabel}}                        </button>                        <button class="btn btn-warning"                                ng-click="propOnSwitchBack()"                                ng-if="propSwitchBackMethod != \'auth\' && propIsSu"                                type="button">                            {{propSwitchBackButtonLabel}}                        </button>                        <button class="btn btn-default"                                ng-click="toggleImpersonatorDetails()"                                ng-if="propSwitchBackMethod != \'auth\' && propIsSu"                                type="button">                            <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>                        </button>                    </span>                </div>            </form>            <form ng-show="propSwitchBackMethod == \'auth\' && propIsSu"                  ng-submit="propOnSwitchBack()">                <div class="input-group  input-group-sm">                    <input class="form-control suUserPassword"                           placeholder="password"                           ng-model="propSuUserPassword"                           type="password"                    >                    <span class="input-group-btn">                        <button class="btn btn-warning"                                type="submit">                            {{propSwitchBackButtonLabel}}                        </button>                        <button class="btn btn-default"                                ng-click="showImpersonatorDetails = !showImpersonatorDetails"                                type="button">                            <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>                        </button>                    </span>                </div>            </form>            <rcm-switch-user-tooltip                    content="propSwitchUserInfoContentPrefix + \' \' + propImpersonatedUser.id + \' \' + propImpersonatedUser.username"                    show="showImpersonatorDetails && propIsSu"            >                tooltip            </rcm-switch-user-tooltip>        </div>    </div></div>'}}]),angular.module("rcmSwitchUser").directive("rcmSwitchUserSwitchToUserHorizontal",["$sce","$window",function($sce,$window){function link($scope,element,attrs){}return{link:link,scope:{propLoading:"=loading",propIsSu:"=isSu",propImpersonatedUser:"=impersonatedUser",propSwitchBackMethod:"=switchBackMethod",propShowSwitchToUserNameField:"=showSwitchToUserNameField",propSwitchToUserName:"=switchToUserName",propSwitchToUserNamePlaceholder:"=switchToUserNamePlaceholder",propSwitchToUserNameButtonLabel:"=switchToUserNameButtonLabel",propSwitchBackButtonLabel:"=switchBackButtonLabel",propSuUserPassword:"=suUserPassword",propSwitchUserInfoContentPrefix:"=switchUserInfoContentPrefix",propMessage:"=message",propOnSwitchTo:"=onSwitchTo",propOnSwitchBack:"=onSwitchBack"},template:'<style type="text/css">    .switch-user.horizontal {        min-height: 20px;    }    .switch-user.horizontal label {        margin: .3em;    }    /* show full borders */    .switch-user.horizontal .input-group-btn button {        margin-right: 1px;    }</style><div class="switch-user horizontal">    <div class="row" ng-show="propMessage">        <div class="col-sm-12">            <div class="alert alert-warning" role="alert">                {{propMessage.value}}            </div>        </div>    </div>    <div class="row">        <div class="col-sm-4" ng-show="propIsSu">            <label>                <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>                <span class="switch-user-info-content">{{propSwitchUserInfoContentPrefix}} {{propImpersonatedUser.id}} {{propImpersonatedUser.username}}</span>            </label>        </div>        <div ng-class="{\'col-sm-4\': propSwitchBackMethod == \'auth\', \'col-sm-4 col-md-offset-4\': propSwitchBackMethod != \'auth\'}">            <form ng-submit="propOnSwitchTo()">                <div class="input-group input-group-sm">                    <input class="form-control switchToUserName"                           placeholder="{{propSwitchToUserNamePlaceholder}}"                           ng-model="propSwitchToUserName"                           type="text"                    >                    <span class="input-group-btn">                        <button class="btn btn-primary"                                type="submit">                            {{propSwitchToUserNameButtonLabel}}                        </button>                        <button class="btn btn-warning"                                ng-click="propOnSwitchBack()"                                ng-show="propSwitchBackMethod != \'auth\' && propIsSu"                                type="button">                            {{propSwitchBackButtonLabel}}                        </button>                    </span>                </div>            </form>        </div>        <div class="col-sm-4" ng-show="propSwitchBackMethod == \'auth\' && propIsSu">            <form ng-submit="propOnSwitchBack()">                <div class="input-group input-group-sm">                    <input class="form-control suUserPassword"                           placeholder="password"                           ng-model="propSuUserPassword"                           type="password"                    >                    <span class="input-group-btn">                        <button class="btn btn-warning"                                ng-show="propIsSu"                                type="submit">                            {{propSwitchBackButtonLabel}}                        </button>                    </span>                </div>            </form>        </div>    </div></div>'}}]);var RcmSwitchUserService=function(rcmLoading,rcmApiLibService,rcmEventManager){function getSuMayBeActive(){var mayBeActive=!1;return"undefined"!=typeof sessionStorage&&sessionStorage.rcmSwitchUser_suMayBeActive&&(mayBeActive=JSON.parse(sessionStorage.rcmSwitchUser_suMayBeActive)),mayBeActive}function setSuMayBeActive(data){"undefined"!=typeof sessionStorage&&(sessionStorage.rcmSwitchUser_suMayBeActive=JSON.stringify(data))}var self=this;self.config={suMessage:"User is currently impersonating."},self.suData={isSu:!1,impersonatedUser:null,switchBackMethod:"auth"};var apiPaths={switchUser:"/api/rpc/switch-user",switchUserBack:"/api/rpc/switch-user-back"},changeSu=function(data){return data?void(self.suData=data):void(self.suData={isSu:!1,impersonatedUser:null,switchBackMethod:self.suData.switchBackMethod})},buildValidData=function(data){return data||(data={isSu:!1,impersonatedUser:null,switchBackMethod:self.suData.switchBackMethod}),data},onSuChange=function(data){data=buildValidData(data),changeSu(data),rcmEventManager.trigger("rcmSwitchUserService.suChange",data)};self.getSu=function(onSuccess,onError){rcmApiLibService.get({url:apiPaths.switchUser,loading:function(loading){var loadingInt=Number(!loading);rcmLoading.setLoading("rcmSwitchUserService.loading",loadingInt)},success:function(response){onSuChange(response.data),onSuccess(response)},error:function(response){onSuChange(response.data),onError(response)}})},self.switchUser=function(switchToUsername,onSuccess,onError){setSuMayBeActive(!0);var data={switchToUsername:switchToUsername};rcmApiLibService.post({url:apiPaths.switchUser,data:data,loading:function(loading){var loadingInt=Number(!loading);rcmLoading.setLoading("rcmSwitchUserService.loading",loadingInt)},success:function(response,status){onSuChange(response.data),onSuccess(response,status)},error:function(response,status){onSuChange(response.data),onError(response,status)}})},self.switchUserBack=function(noLongerUsedVariableOnlyExistsForBCSupport,onSuccess,onError){rcmApiLibService.post({url:apiPaths.switchUserBack,data:{},loading:function(loading){var loadingInt=Number(!loading);rcmLoading.setLoading("rcmSwitchUserService.loading",loadingInt)},success:function(response,status){onSuChange(),onSuccess(response,status)},error:function(response,status){onSuChange(),onError(response,status)}})};var init=function(){getSuMayBeActive()&&self.getSu(function(){},function(){})};init()};angular.module("rcmSwitchUser").service("rcmSwitchUserService",["rcmLoading","rcmApiLibService","rcmEventManager",function(rcmLoading,rcmApiLibService,rcmEventManager){return new RcmSwitchUserService(rcmLoading,rcmApiLibService,rcmEventManager)}]);var RcmSwitchUserAdminService=function($sce,rcmSwitchUserService,rcmEventManager,rcmApiLibMessageService,$window,rcmLoading){var self=this;self.link=function($scope){$scope.loading=!1,$scope.isSu=!1,$scope.impersonatedUser=null,$scope.switchBackMethod="auth",$scope.suUserPassword=null,$scope.message=null;var setLoading=function(isLoading){$scope.loading=isLoading;var loadingInt=Number(!isLoading);rcmLoading.setLoading("rcmSwitchUserAdmin.loading",loadingInt)},apiInit=function(){setLoading(!0),$scope.message=null},handleMessages=function(messages){$scope.message=null,rcmApiLibMessageService.getPrimaryMessage(messages,function(message){message&&($scope.message=message)})},onSwitchToSuccess=function(response){$window.location.reload()},onSwitchToError=function(response){handleMessages(response.messages),setLoading(!1)},onSwitchBackAndToSuccess=function(response){$scope.suUserPassword=null,switchTo()},onSwitchBackSuccess=function(response){$scope.suUserPassword=null,$window.location.reload()},onSwitchBackError=function(response){$scope.suUserPassword=null,handleMessages(response.messages),setLoading(!1)},switchTo=function(){apiInit(),rcmSwitchUserService.switchUser($scope.propSwitchToUserName,onSwitchToSuccess,onSwitchToError)};$scope.switchTo=function(){return $scope.isSu?(apiInit(),void rcmSwitchUserService.switchUserBack(null,onSwitchBackAndToSuccess,onSwitchBackError)):void switchTo()},$scope.switchBack=function(){apiInit(),rcmSwitchUserService.switchUserBack(null,onSwitchBackSuccess,onSwitchBackError)},rcmEventManager.on("rcmSwitchUserService.suChange",function(data){$scope.isSu=data.isSu,$scope.impersonatedUser=data.impersonatedUser,$scope.switchBackMethod=data.switchBackMethod})},self.scope={propShowSwitchToUserNameField:"=showSwitchToUserNameField",propSwitchToUserName:"=switchToUserName",propSwitchToUserNamePlaceholder:"=switchToUserNamePlaceholder",propSwitchToUserNameButtonLabel:"=switchToUserNameButtonLabel",propSwitchBackButtonLabel:"=switchBackButtonLabel",propSwitchUserInfoContentPrefix:"=switchUserInfoContentPrefix"}};angular.module("rcmSwitchUser").service("rcmSwitchUserAdminService",["$sce","rcmSwitchUserService","rcmEventManager","rcmApiLibMessageService","$window","rcmLoading",function($sce,rcmSwitchUserService,rcmEventManager,rcmApiLibMessageService,$window,rcmLoading){return new RcmSwitchUserAdminService($sce,rcmSwitchUserService,rcmEventManager,rcmApiLibMessageService,$window,rcmLoading)}]);var RcmSwitchUserMessageInject=function($compile,JSON,rcmSwitchUserConfig){var self=this;self.getDefault=function(value,defaultKey,fallback){return"undefined"==typeof value&&(value=rcmSwitchUserConfig.defaults[defaultKey]),"undefined"==typeof value&&(value=fallback),value},self.injectHeader=function(showSwitchToUserNameField,switchToUserName,switchToUserNamePlaceholder,switchToUserNameButtonLabel,switchBackButtonLabel,switchUserInfoContentPrefix){showSwitchToUserNameField=self.getDefault(showSwitchToUserNameField,"showSwitchToUserNameField",!0),switchToUserName=self.getDefault(switchToUserName,"switchToUserName",""),switchToUserNamePlaceholder=self.getDefault(switchToUserNamePlaceholder,"switchToUserNamePlaceholder","Username"),switchToUserNameButtonLabel=self.getDefault(switchToUserNameButtonLabel,"switchToUserNameButtonLabel","Switch to User"),switchBackButtonLabel=self.getDefault(switchBackButtonLabel,"switchBackButtonLabel","Switch Back"),switchUserInfoContentPrefix=self.getDefault(switchUserInfoContentPrefix,"switchUserInfoContentPrefix","Impersonating:"),showSwitchToUserNameField=Boolean(showSwitchToUserNameField),showSwitchToUserNameField=JSON.stringify(showSwitchToUserNameField),switchToUserName=String(switchToUserName),switchToUserNamePlaceholder=String(switchToUserNamePlaceholder),switchToUserNameButtonLabel=String(switchToUserNameButtonLabel),switchBackButtonLabel=String(switchBackButtonLabel),switchUserInfoContentPrefix=String(switchUserInfoContentPrefix);var content='<div rcm-switch-user-message show-switch-to-user-name-field="'+showSwitchToUserNameField+'" switch-to-user-name="\''+switchToUserName+"'\" switch-to-user-name-placeholder=\"'"+switchToUserNamePlaceholder+"'\" switch-to-user-name-button-label=\"'"+switchToUserNameButtonLabel+"'\" switch-back-button-label=\"'"+switchBackButtonLabel+"'\" switch-user-info-content-prefix=\"'"+switchUserInfoContentPrefix+'\'""></div>',element=jQuery(content);element.prependTo("body");var contents=element.contents(),aemlement=angular.element(element),scope=aemlement.scope;$compile(contents)(scope)}};angular.module("rcmSwitchUser").service("rcmSwitchUserMessageInject",["$compile","rcmSwitchUserConfig",function($compile,rcmSwitchUserConfig){return new RcmSwitchUserMessageInject($compile,JSON,rcmSwitchUserConfig)}]),angular.module("rcmSwitchUser").run(["rcmSwitchUserMessageInject","rcmSwitchUserConfig",function(rcmSwitchUserMessageInject,rcmSwitchUserConfig){rcmSwitchUserMessageInject.injectHeader(rcmSwitchUserConfig.defaults.showSwitchToUserNameField,rcmSwitchUserConfig.defaults.switchToUserName,rcmSwitchUserConfig.defaults.switchToUserNamePlaceholder,rcmSwitchUserConfig.defaults.switchToUserNameButtonLabel,rcmSwitchUserConfig.defaults.switchBackButtonLabel,rcmSwitchUserConfig.defaults.switchUserInfoContentPrefix)}]),angular.module("rcmSwitchUser").directive("rcmSwitchUserMessage",["$sce","rcmSwitchUserService","rcmEventManager",function($sce,rcmSwitchUserService,rcmEventManager){function link($scope,element,attrs){$scope.loading=!0,$scope.isSu=!1,$scope.impersonatedUser=null,rcmEventManager.on("rcmSwitchUserService.suChange",function(data){$scope.isSu=data.isSu,$scope.impersonatedUser=data.impersonatedUser,$scope.loading=!1})}return{link:link,scope:{propShowSwitchToUserNameField:"=showSwitchToUserNameField",propSwitchToUserName:"=switchToUserName",propSwitchToUserNamePlaceholder:"=switchToUserNamePlaceholder",propSwitchToUserNameButtonLabel:"=switchToUserNameButtonLabel",propSwitchBackButtonLabel:"=switchBackButtonLabel",propSwitchUserInfoContentPrefix:"=switchUserInfoContentPrefix"},template:'<style type="text/css">    .switch-user-message.real {       position: fixed;       z-index: 1001;    }    .switch-user-message.placeholder {       visibility: hidden    }    .switch-user-message .alert {        padding: 3px;    }    .switch-user-message .alert-caution {       background-color: #FFFFAA;       border-color: #FFFF00;       color: #999900;   }</style><div><div class="switch-user-message real" ng-if="isSu"> <div class="alert alert-caution" role="alert">   <div rcm-switch-user-admin-horizontal        show-switch-to-user-name-field="propShowSwitchToUserNameField"       switch-to-user-name="propSwitchToUserName"       switch-to-user-name-placeholder="propSwitchToUserNamePlaceholder"       switch-to-user-name-button-label="propSwitchToUserNameButtonLabel"       switch-back-button-label="propSwitchBackButtonLabel"       switch-user-info-content-prefix="propSwitchUserInfoContentPrefix"  ></div>  </div> </div><div class="switch-user-message placeholder" ng-if="isSu"> <div class="alert alert-caution" role="alert">   <div rcm-switch-user-admin-horizontal        show-switch-to-user-name-field="propShowSwitchToUserNameField"       switch-to-user-name="propSwitchToUserName"       switch-to-user-name-placeholder="propSwitchToUserNamePlaceholder"       switch-to-user-name-button-label="propSwitchToUserNameButtonLabel"       switch-back-button-label="propSwitchBackButtonLabel"       switch-user-info-content-prefix="propSwitchUserInfoContentPrefix"  ></div>  </div> </div></div>'}}]),angular.module("rcmSwitchUser").directive("rcmSwitchUserAdmin",["rcmSwitchUserAdminService",function(rcmSwitchUserAdminService){return{link:rcmSwitchUserAdminService.link,scope:rcmSwitchUserAdminService.scope,template:'<rcm-switch-user-switch-to-user loading="loading" is-su="isSu" impersonated-user="impersonatedUser" switch-back-method="switchBackMethod" show-switch-to-user-name-field="propShowSwitchToUserNameField" switch-to-user-name="propSwitchToUserName" switch-to-user-name-button-label="propSwitchToUserNameButtonLabel" switch-back-button-label="propSwitchBackButtonLabel" su-user-password="suUserPassword" switch-user-info-content-prefix="propSwitchUserInfoContentPrefix" message="message" on-switch-to="switchTo" on-switch-back="switchBack"></rcm-switch-user-switch-to-user>'}}]),angular.module("rcmSwitchUser").directive("rcmSwitchUserAdminSimple",["rcmSwitchUserAdminService",function(rcmSwitchUserAdminService){return{link:rcmSwitchUserAdminService.link,scope:rcmSwitchUserAdminService.scope,template:'<rcm-switch-user-switch-to-user-simple loading="loading" is-su="isSu" impersonated-user="impersonatedUser" switch-back-method="switchBackMethod" show-switch-to-user-name-field="propShowSwitchToUserNameField" switch-to-user-name="propSwitchToUserName" switch-to-user-name-placeholder="propSwitchToUserNamePlaceholder" switch-to-user-name-button-label="propSwitchToUserNameButtonLabel" switch-back-button-label="propSwitchBackButtonLabel" su-user-password="suUserPassword" switch-user-info-content-prefix="propSwitchUserInfoContentPrefix" message="message" on-switch-to="switchTo" on-switch-back="switchBack"></rcm-switch-user-switch-to-user-simple>'}}]),angular.module("rcmSwitchUser").directive("rcmSwitchUserAdminHorizontal",["rcmSwitchUserAdminService",function(rcmSwitchUserAdminService){return{link:rcmSwitchUserAdminService.link,scope:rcmSwitchUserAdminService.scope,template:'<rcm-switch-user-switch-to-user-horizontal loading="loading" is-su="isSu" impersonated-user="impersonatedUser" switch-back-method="switchBackMethod" show-switch-to-user-name-field="propShowSwitchToUserNameField" switch-to-user-name="propSwitchToUserName" switch-to-user-name-placeholder="propSwitchToUserNamePlaceholder" switch-to-user-name-button-label="propSwitchToUserNameButtonLabel" switch-back-button-label="propSwitchBackButtonLabel" su-user-password="suUserPassword" switch-user-info-content-prefix="propSwitchUserInfoContentPrefix" message="message" on-switch-to="switchTo" on-switch-back="switchBack"></rcm-switch-user-switch-to-user-horizontal>'}}]),angular.module("rcmSwitchUser").directive("rcmSwitchUserTooltip",function(){return{scope:{propInfoContent:"=content",propShow:"=show"},template:'<div class="switch-user-tooltip alert alert-info" ng-show="propShow" role="alert">    <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>    <span class="switch-user-info-content">{{propInfoContent}}</span></div>'}});
  //# sourceMappingURL=switch-user.min.js.map