var __awaiter=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},ProfileAgentController=function(){function e(e){this.$representationService=e}return e.$inject=["RepresentationService"],e.prototype.$onInit=function(){this.setCurrentWork(this.fetch())},e.prototype.setCurrentWork=function(e){this.promise=e},e.prototype.isUnconfirmed=function(e){return!e.confirmed},e.prototype.fetch=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,(e=this.$representationService.queryPlayerRerepresentation(this.activeProfile.profile._id)).$promise];case 1:return t.sent(),this.representations=e,this.tree=this.$representationService.createRepresentationTree(this.representations),[2]}}))}))},e}();angular.module("app.profile").component("profileAgent",{templateUrl:"profile/components/agent.html",controller:ProfileAgentController,bindings:{activeProfile:"<",editable:"<",editableForm:"<"}}),angular.module("app.profile").component("profileBasics",{templateUrl:"profile/components/basics.html",bindings:{activeProfile:"<",userProfile:"<",editable:"<",editableForm:"<"}});var ProfileNavigationController=function(){function e(){}return Object.defineProperty(e.prototype,"isStaffProfile",{get:function(){return this.activeProfile&&"staff"===this.activeProfile.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPlayerProfile",{get:function(){return this.activeProfile&&"player"===this.activeProfile.type},enumerable:!1,configurable:!0}),e}();angular.module("app.profile").component("profileNavigation",{templateUrl:"profile/components/navigation.html",controller:ProfileNavigationController,bindings:{activeProfile:"<",editable:"<"}});var ProfilePasswordController=function(){};angular.module("app.profile").component("profilePassword",{templateUrl:"profile/components/password.html",controller:ProfilePasswordController});var MAX_PICTURE_SIZE=5242880,ProfilePhotoController=function(){function e(e,t,r,i){this.$filter=e,this.$api=t,this.$auth="Bearer "+r.getToken(),this.$notifications=i}return e.$inject=["$filter","API_END_POINT","UserService","NotificationCenter"],e.prototype.$onInit=function(){this.flowOptions={target:"".concat(this.$api,"/api/profile/").concat(this.activeProfile.type,"/").concat(this.activeProfile.profile._id,"/picture-upload"),simultaneousUploads:1,allowDuplicateUploads:!0,chunkSize:1048576,headers:{Authorization:this.$auth}}},e.prototype.$onChanges=function(e){e.activeProfile&&!e.activeProfile.isFirstChange()&&(this.flowOptions.target="".concat(this.$api,"/api/profile/").concat(e.activeProfile.currentValue.type,"/").concat(this.activeProfile.currentValue.profile._id,"/picture-upload"))},e.prototype.onUploadSubmit=function(e){var t=this;e.files.forEach((function(r){r.size>MAX_PICTURE_SIZE&&(t.$notifications.show({title:"My Profile",avatar:t.$filter("scImage")(t.activeProfile.profile.imageUrl,t.activeProfile.type),text:"The image is too big."}),e.removeFile(r))})),e.files.length&&(Object.assign(e.opts,this.flowOptions),e.upload())},e.prototype.onFileProgress=function(e){},e.prototype.onFileComplete=function(e,t){Object.assign(this.activeProfile.profile,JSON.parse(t)),this.$notifications.show({title:"My Profile",avatar:this.$filter("scImage")(this.activeProfile.profile.imageUrl,this.activeProfile.type),text:"Picture upload successful!"})},e.prototype.onFileError=function(e,t){this.$notifications.show({title:"My Profile",avatar:this.$filter("scImage")(this.activeProfile.profile.imageUrl,this.activeProfile.type),text:"Unable to upload the picture."})},e}();angular.module("app.profile").component("profilePhoto",{templateUrl:"profile/components/photo.html",controller:ProfilePhotoController,bindings:{activeProfile:"<",editable:"<",editableForm:"<"}});var ProfileController=function(){function e(e,t,r,i){this.$state=e,this.$profileService=t,this.$userService=r,this.$historyService=i}return e.$inject=["$state","ProfileService","UserService","History"],e.prototype.$onInit=function(){var e=this;this.editable=!1,this.availableProfiles=this.$profileService.getAvailableProfiles(),this.userProfile=this.$userService.getUser(),this.availableProfiles.$promise.then((function(t){e.activeProfile=_.chain(t).sortBy((function(t){return e.getProfilePriority(t)})).value()[0]}))},e.prototype.getProfilePriority=function(e){switch(e.type){case"agent":return 1;case"staff":return 2;case"player":return 3;default:return 1/0}},e.prototype.startEditing=function(){this.activeProfileBackup=angular.copy(this.activeProfile),this.userProfileBackup=angular.copy(this.userProfile),this.editable=!0},e.prototype.commitChanges=function(){this.editable=!1,this.activeProfile.$save(),this.userProfile.$save()},e.prototype.rollbackChanges=function(){this.editable=!1,angular.copy(this.activeProfileBackup,this.activeProfile),angular.copy(this.userProfileBackup,this.userProfile)},e.prototype.onActiveProfileChanged=function(){this.$state.go("profile.basic")},Object.defineProperty(e.prototype,"isBasicPageActive",{get:function(){return this.$state.is("profile.basic")},enumerable:!1,configurable:!0}),e.prototype.exit=function(){this.$historyService.goBack()},e}();angular.module("app.profile").component("profile",{templateUrl:"profile/components/profile.html",controller:ProfileController});var __spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};!function(){"use strict";angular.module("app.common").directive("scNationalitiesModelTransformer",(function(){return{restrict:"A",require:"ngModel",priority:1e3,link:function(e,t,r,i){i.$formatters.push((function(e){return __spreadArray([e.country,e.secondaryCountry],e.otherCountries||[],!0).filter((function(e){return!!e}))})),e.$watchCollection((function(){return i.$viewValue}),(function(){i.$modelValue.country=i.$viewValue[0]||void 0,i.$modelValue.secondaryCountry=i.$viewValue[1]||void 0,i.$modelValue.otherCountries=i.$viewValue.slice(2),i.$modelValue.otherCountries.length||(i.$modelValue.otherCountries=void 0)}))}}}))}();var ProfileService=function(){function e(e,t){this.resource=e("".concat(t.getEndpoint(),"/api/profile/:type"),{type:"@type"})}return e.$inject=["$resource","SCConfiguration"],e.prototype.getAvailableProfiles=function(){return this.resource.query()},e}();angular.module("app.profile").service("ProfileService",ProfileService);var EUROPEAN_COUNTRIES=["DEU","AUT","CZE","DNK","FIN","NOR","SWE","ITA","HUN","CHE","EST","ROU"],RepresentationService=function(){function e(e,t,r,i){this.$http=e,this.$translate=r("scTranslate"),this.baseUrl="".concat(i.getEndpoint(),"/api/representation"),this.resource=t("".concat(this.baseUrl,"/:id"),{id:"@_id"},{queryForPlayer:{url:"".concat(this.baseUrl,"/player/:playerId"),isArray:!0,method:"GET"},queryAvailableAgents:{url:"".concat(this.baseUrl,"/search"),isArray:!0,method:"GET"},confirmRepresentations:{url:"".concat(this.baseUrl,"/confirm"),isArray:!0,method:"POST"},applyChangesBulk:{url:"".concat(this.baseUrl,"/apply-changes"),isArray:!0,method:"POST"}})}return e.$inject=["$http","$resource","$filter","SCConfiguration"],e.prototype.queryPlayerRerepresentation=function(e){return this.resource.queryForPlayer({playerId:e})},e.prototype.queryAvailableAgents=function(e){return this.resource.queryAvailableAgents({query:e})},e.prototype.confirmRepresentations=function(e){return this.resource.confirmRepresentations({representationIds:e}).$promise},e.prototype.applyChangesBulk=function(e){return this.resource.applyChangesBulk({changes:e}).$promise},e.prototype.wrap=function(e){return new this.resource(e)},e.prototype.createRepresentationTree=function(e){var t=this,r={representations:[],filter:{},leafs:[{filter:{region:"NORTH_AMERICA"},representations:[],leafs:[]},{filter:{region:"EUROPE"},representations:[],leafs:_.sortBy(EUROPEAN_COUNTRIES,(function(e){return t.$translate("countries.ISO_3.".concat(e))})).map((function(e){return{filter:{region:"EUROPE",country:e},representations:[],leafs:[]}}))},{filter:{region:"RUSSIA"},representations:[],leafs:[]},{filter:{region:"ASIA"},representations:[],leafs:[]}]};return assignRepresentationsToTree(r,e.slice()),assignTreeVisibility(r),r},e}();function assignRepresentationsToTree(e,t){e.leafs.forEach((function(e){assignRepresentationsToTree(e,t)})),e.representations=t.filter((function(t){return _.isMatch(t,e.filter)})),_.remove(t,(function(t){return e.representations.includes(t)}))}function assignTreeVisibility(e){e.leafs.forEach((function(e){assignTreeVisibility(e)})),e.expanded=e.leafs.some((function(e){return e.expanded||e.representations.length>0}))}angular.module("app.profile").service("RepresentationService",RepresentationService),angular.module("app.profile").component("profileAgentDisplay",{templateUrl:"profile/components/agents/agent-display.html",bindings:{representation:"<"}});__awaiter=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};var ProfileAgentSelectorController=function(){function e(e){this.$representationService=e}return e.$inject=["RepresentationService"],e.prototype.search=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){switch(r.label){case 0:return t=[],e?[4,this.$representationService.queryAvailableAgents(e).$promise]:[3,2];case 1:t=r.sent(),r.label=2;case 2:return[2,__spreadArray([this.$representationService.wrap({type:"self-represented"}),this.$representationService.wrap({type:"family-represented"})],t,!0)]}}))}))},e.prototype.remove=function(){this.onDelete({$value:this.value})},e.prototype.select=function(e){this.onSelect({$value:e})},e.prototype.confirm=function(){var e=this;this.promise=this.$representationService.confirmRepresentations([this.value._id]).then((function(){return e.value.confirmed=!0}))},e}();angular.module("app.profile").component("profileAgentSelector",{templateUrl:"profile/components/agents/agent-selector.html",controller:ProfileAgentSelectorController,bindings:{value:"<",onSelect:"&",onDelete:"&"}}),angular.module("app.profile").component("profileRepresentationFilterDisplay",{templateUrl:"profile/components/agents/filter-display.html",bindings:{filter:"<",full:"<"}});__awaiter=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};var ProfileRepresentationTreeController=function(){function e(e){this.$q=e}return e.$inject=["$q"],e.prototype.$onInit=function(){this.isOverriden=this.checkOverridenState(this.root)},e.prototype.add=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){switch(r.label){case 0:return this.isValueInherited(e)?(this.inherit(),[2]):(Object.assign(e,this.root.filter),Object.assign(e,{player:_.pick(this.profile,["_id","firstName","lastName"])}),t=__spreadArray([e.$save()],this.checkNestedInheritance(e),!0),[4,this.broadcastWork(this.$q.all(t))]);case 1:return r.sent(),this.root.representations.push(e),this.onChange(),[2]}}))}))},e.prototype.remove=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.broadcastWork(e.$remove())];case 1:return t.sent(),this.root.representations=this.root.representations.filter((function(t){return t!==e})),this.onChange(),this.inherit(),[2]}}))}))},e.prototype.override=function(){this.inherited=null},e.prototype.inherit=function(){this.parent&&(this.inherited=this.parent.representations)},e.prototype.onNestedTreeRepresentationChanged=function(e){var t=this,r=this.isOverriden,i=this.checkOverridenState(this.root);if(!r&&i){var n=[];this.root.leafs.forEach((function(e){t.checkOverridenState(e)||e.representations.length||(e.representations=angular.copy(t.root.representations.length?t.root.representations:t.inherited)||[],e.representations.forEach((function(t){delete t._id,Object.assign(t,e.filter),n.push(t.$save())})))})),n.push.apply(n,this.root.representations.map((function(e){return e.$remove()}))),this.root.representations=[],this.broadcastWork(this.$q.all(n))}this.isOverriden=i,this.root.expanded=this.root.expanded||i,this.onChange()},e.prototype.onNestedTreeWork=function(e){this.broadcastWork(e)},e.prototype.checkOverridenState=function(e){var t=this;return e.leafs&&e.leafs.length&&e.leafs.some((function(e){return t.checkOverridenState(e)||e.representations.length>0}))},e.prototype.broadcastWork=function(e){return this.onWork({$promise:e}),e},e.prototype.isValueInherited=function(e){return!(this.root.representations.length||!this.parent||1!==this.parent.representations.length||!isRepresentationsEqual(this.parent.representations[0],e))},e.prototype.checkNestedInheritance=function(e){var t=this;return!this.root.representations.length&&this.root.leafs?this.root.leafs.map((function(r){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return 1===r.representations.length&&isRepresentationsEqual(e,r.representations[0])?[4,r.representations[0].$delete()]:[3,2];case 1:t.sent(),r.representations=[],t.label=2;case 2:return[2]}}))}))})):[]},e}();function isRepresentationsEqual(e,t){var r=_.pick(e,["type","agency._id","responsibleAgent._id"]),i=_.pick(t,["type","agency._id","responsibleAgent._id"]);return _.isMatch(r,i)}angular.module("app.profile").component("profileRepresentationTree",{templateUrl:"profile/components/agents/representation-tree.html",controller:ProfileRepresentationTreeController,bindings:{root:"<",parent:"<",inherited:"<",profile:"<",onChange:"&",onWork:"&"}});var ProfileBasicsContactsController=function(){function e(){}return e.prototype.$onInit=function(){this.userProfile.phones||(this.userProfile.phones=[])},e.prototype.addPhone=function(){this.userProfile.phones.push({})},e.prototype.removePhone=function(e){var t=this.userProfile.phones.indexOf(e);this.userProfile.phones.splice(t,1)},e}();angular.module("app.profile").component("profileBasicsContacts",{templateUrl:"profile/components/basics/contacts.html",controller:ProfileBasicsContactsController,bindings:{editable:"<",editableForm:"<",userProfile:"<"}}),angular.module("app.profile").component("profileBasicsGeneral",{templateUrl:"profile/components/basics/general.html",bindings:{editable:"<",activeProfile:"<",hidePictureChanging:"@",hideRoles:"@"}});var ProfileBasicsLanguagesController=function(){function e(e){this.$languageService=e}return e.$inject=["LanguageService"],e.prototype.$onChanges=function(e){e.userProfile&&e.userProfile.currentValue&&_.merge(e.userProfile.currentValue,{languages:[]})},Object.defineProperty(e.prototype,"availableLanguages",{get:function(){return this.$languageService.languages.filter((function(e){return!0}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"availableLevels",{get:function(){return this.$languageService.levels},enumerable:!1,configurable:!0}),e.prototype.addLanguage=function(){this.userProfile.languages.push({})},e.prototype.removeLanguage=function(e){var t=this.userProfile.languages.indexOf(e);this.userProfile.languages.splice(t,1)},e}();angular.module("app.profile").component("profileBasicsLanguages",{templateUrl:"profile/components/basics/languages.html",controller:ProfileBasicsLanguagesController,bindings:{editable:"<",userProfile:"<"}});__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))};var ProfileBasicsPersonalController=function(){function e(e){this.countries=e.fetch(),this.queryCountriesMemoizedWorker=_.memoize(this.queryCountriesWorker.bind(this),(function(e){return e.query+"|"+e.exclude.map((function(e){return e.id})).join(",")}))}return e.$inject=["CountryService"],e.prototype.$onInit=function(){this.currentDate=moment().toDate()},e.prototype.$onChanges=function(e){e.activeProfile&&e.activeProfile.currentValue&&_.merge(e.activeProfile.currentValue.profile,{passports:[]})},e.prototype.queryCountries=function(e,t){var r=this;return this.countries.length?this.queryCountriesMemoizedWorker({query:e,exclude:t}):this.countries.$promise.then((function(){return r.queryCountriesMemoizedWorker({query:e,exclude:t})}))},e.prototype.queryCountriesWorker=function(e){var t=e.query,r=e.exclude;return r=r.map((function(e){return e.id})),t=t.toLocaleLowerCase(),this.countries.filter((function(e){return!r.includes(e.id)&&-1!==e.name.toLocaleLowerCase().indexOf(t)}))},Object.defineProperty(e.prototype,"profileNations",{get:function(){return this.activeProfile?__spreadArray([this.activeProfile.profile.country,this.activeProfile.profile.secondaryCountry],this.activeProfile.profile.otherCountries||[],!0).filter((function(e){return!!e})):null},enumerable:!1,configurable:!0}),e}();angular.module("app.profile").component("profileBasicsPersonal",{templateUrl:"profile/components/basics/personal.html",controller:ProfileBasicsPersonalController,bindings:{editable:"<",activeProfile:"<"}});var ProfileBasicsRolesController=function(){function e(e){this.playerStatisticsCache={},this.$userService=e}return e.$inject=["UserService"],e.prototype.$onInit=function(){var e=this;this.$userService.getAvailableAccounts().then((function(t){e.accounts=t}))},e.prototype.isAccountVisible=function(){var e=this;return function(t){if(!e.activeProfile)return!1;switch(e.activeProfile.type){case"agent":case"staff":return!1===t.isPlayer;case"player":return!0===t.isPlayer;default:return!1}}},e.prototype.getAccountKey=function(e){return"".concat(e.type,"-organization:").concat(e._id)},e.prototype.getPlayerStatistics=function(e){return this.playerStatisticsCache[e._id]=this.playerStatisticsCache[e._id]||this.findPlayerStatistics(e)},e.prototype.findPlayerStatistics=function(e){return _.chain(this.activeProfile.profile.stats).filter((function(t){return t.team._id==e._id})).sortBy("season.startYear").last().value()},e.prototype.transformRoleName=function(e){return e.display},e}();angular.module("app.profile").component("profileBasicsRoles",{templateUrl:"profile/components/basics/roles.html",controller:ProfileBasicsRolesController,bindings:{editable:"<",activeProfile:"<"}});
//# sourceMappingURL=maps/sources.1730197449737.js.map
