"),o.after(u),a=null,o.on("click",function(r){return r.preventDefault(),n=!n,a=e().target(u).start(),n?t.$broadcast("backlog:unload-closed-sprints"):t.$broadcast("backlog:load-closed-sprints")}),i.$on("$destroy",function(){return o.off()}),i.$on("closed-sprints:reloaded",function(t){return function(t,e){var n,i;return a.finish(),n=e.length>0?"BACKLOG.SPRINTS.ACTION_HIDE_CLOSED_SPRINTS":"BACKLOG.SPRINTS.ACTION_SHOW_CLOSED_SPRINTS",i=r.instant(n),o.find(".text").text(i)}}(this))},{link:i}},n.directive("tgBacklogToggleClosedSprintsVisualization",["$rootScope","$tgLoading","$translate",r])}.call(this),function(){var t,e,r,n,i,o,s,a,u;s=this.taiga,n=this.taiga.mixOf,u=this.taiga.toggleText,o=this.taiga.scopeDefer,e=this.taiga.bindOnce,r=this.taiga.groupBy,a=this.taiga.timeout,i=angular.module("taigaTaskboard"),t=function(t){var e,r;return r=function(e,r){var n,i,o,s;return s=e.width(),e.height(240),i=_.map(r,function(t){return moment(t.day)}),n=[],n.unshift({data:_.zip(i,_.map(r,function(t){return t.optimal_points})),lines:{fillColor:"rgba(120,120,120,0.2)"}}),n.unshift({data:_.zip(i,_.map(r,function(t){return t.open_points})),lines:{fillColor:"rgba(102,153,51,0.3)"}}),o={grid:{borderWidth:{top:0,right:1,left:0,bottom:0},borderColor:"#ccc",hoverable:!0},xaxis:{tickSize:[1,"day"],min:i[0],max:_.last(i),mode:"time",daysNames:i,axisLabel:t.instant("TASKBOARD.CHARTS.XAXIS_LABEL"),axisLabelUseCanvas:!0,axisLabelFontSizePixels:12,axisLabelFontFamily:"Verdana, Arial, Helvetica, Tahoma, sans-serif",axisLabelPadding:5},yaxis:{min:0,axisLabel:t.instant("TASKBOARD.CHARTS.YAXIS_LABEL"),axisLabelUseCanvas:!0,axisLabelFontSizePixels:12,axisLabelFontFamily:"Verdana, Arial, Helvetica, Tahoma, sans-serif",axisLabelPadding:5},series:{shadowSize:0,lines:{show:!0,fill:!0},points:{show:!0,fill:!0,radius:4,lineWidth:2}},colors:["rgba(102,153,51,1)","rgba(120,120,120,0.2)"],tooltip:!0,tooltipOpts:{content:function(e,r,n,i){var o,s;return o=moment(r).format(t.instant("TASKBOARD.CHARTS.DATE")),s=Math.round(n),1===i.seriesIndex?t.instant("TASKBOARD.CHARTS.OPTIMAL",{formattedDate:o,roundedValue:s}):t.instant("TASKBOARD.CHARTS.REAL",{formattedDate:o,roundedValue:s})}}},e.empty(),e.plot(n,o).data("plot")},e=function(t,e,n){var i;return i=angular.element(e),t.$on("resize",function(){return t.stats?r(i,t.stats.days):void 0}),t.$on("taskboard:graph:toggle-visibility",function(){return e.parent().toggleClass("open"),a(100,function(){return t.stats?r(i,t.stats.days):void 0})}),t.$watch("stats",function(e){return null!=t.stats?r(i,t.stats.days):void 0}),t.$on("$destroy",function(){return e.off()})},{link:e}},i.directive("tgSprintGraph",["$translate",t])}.call(this),function(){var t,e,r,n,i,o;o=this.taiga,r=this.taiga.bindOnce,n=this.taiga.debounce,e=function(t,e,r,i,o,s,a,u,c){var l;return l=function(e,r,l){var p,d,f,h,m,g,v;return e.isNew=!0,p=Immutable.List(),d=Immutable.List(),m=function(){return p=Immutable.List(),d=Immutable.List()},e.addAttachment=function(t){return p=p.push(t)},e.deleteAttachment=function(t){return d=d.push(t)},f=function(t){var r;return r=_.map(p.toJS(),function(r){return c.upload(r.file,t.id,e.task.project,"task")}),u.all(r)},h=function(t){var e;return e=_.map(d.toJS(),function(t){return c["delete"]("task",t.id)}),u.all(e)},e.$on("taskform:new",function(t,n,i){var o,u;return e.task={project:e.projectId,milestone:n,user_story:i,is_archived:!1,status:e.project.default_task_status,assigned_to:null,tags:[]},e.isNew=!0,e.attachments=Immutable.List(),m(),o=a.instant("COMMON.CREATE"),r.find(".button-green").html(o),u=a.instant("LIGHTBOX.CREATE_EDIT_TASK.TITLE"),r.find(".title").html(u+" "),r.find(".tag-input").val(""),s.open(r)}),e.$on("taskform:edit",function(t,n,i){var o,u;return e.task=n,e.isNew=!1,e.attachments=Immutable.fromJS(i),m(),u=a.instant("COMMON.SAVE"),o=a.instant("LIGHTBOX.CREATE_EDIT_TASK.ACTION_EDIT"),r.find(".button-green").html(u),r.find(".title").html(o+" "),r.find(".tag-input").val(""),s.open(r)}),v=r.find(".submit-button"),g=n(2e3,function(n){return function(n){var a,u,c,l;return n.preventDefault(),c=r.find("form").checksley(),c.validate()?(e.isNew?(l=t.create("tasks",e.task),a="taskform:new:success"):(l=t.save(e.task),a="taskform:edit:success"),l.then(function(t){return f(t),h(t),t}),u=o().target(v).start(),l.then(function(t){return u.finish(),s.close(r),i.$broadcast(a,t)})):void 0}}(this)),r.on("submit","form",g),e.$on("$destroy",function(){return r.off()})},{link:l}},t=function(t,e,r,i,o){var s;return s=function(t,s,a){var u,c;return t.form={data:"",usId:null},u=n(2e3,function(n){return function(n){var a,u,l,p,d,f,h;return n.preventDefault(),l=s.find("form").checksley(),l.validate()?(a=i().target(c).start(),u=t.form.data,p=t.projectId,f=t.form.sprintId,h=t.form.usId,d=e.tasks.bulkCreate(p,f,h,u),d.then(function(t){return a.finish(),r.$broadcast("taskform:bulk:success",t),o.close(s)}),d.then(null,function(){return a.finish(),console.log("FAIL")})):void 0}}(this)),t.$on("taskform:bulk",function(e,r,n){return o.open(s),t.form={data:"",sprintId:r,usId:n}}),c=s.find(".submit-button"),s.on("submit","form",u),t.$on("$destroy",function(){return s.off()})},{link:s}},i=angular.module("taigaTaskboard"),i.directive("tgLbCreateEditTask",["$tgRepo","$tgModel","$tgResources","$rootScope","$tgLoading","lightboxService","$translate","$q","tgAttachmentsService",e]),i.directive("tgLbCreateBulkTasks",["$tgRepo","$tgResources","$rootScope","$tgLoading","lightboxService",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,d,f,h=function(t,e){function r(){this.constructor=t}for(var n in e)m.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},m={}.hasOwnProperty;p=this.taiga,f=this.taiga.toggleText,u=this.taiga.mixOf,a=this.taiga.groupBy,s=this.taiga.bindOnce,l=this.taiga.scopeDefer,d=this.taiga.timeout,o=this.taiga.bindMethods,c=angular.module("taigaTaskboard"),t=function(t){function e(t,e,r,n,i,s,a,u,c,l,p,d,f){var h;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=s,this.q=a,this.appMetaService=u,this.location=c,this.navUrls=l,this.events=p,this.analytics=d,this.translate=f,o(this),this.scope.sectionName=this.translate.instant("TASKBOARD.SECTION_NAME"),this.initializeEventHandlers(),h=this.loadInitialData(),h.then(function(t){return function(){return t._setMeta()}}(this)),h.then(null,this.onInitialDataError.bind(this))}return h(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","tgAppMetaService","$tgLocation","$tgNavUrls","$tgEvents","$tgAnalytics","$translate"],e.prototype._setMeta=function(){var t,e,r;return e=this.translate.instant("BACKLOG.SPRINTS.DATE"),r=this.translate.instant("TASKBOARD.PAGE_TITLE",{projectName:this.scope.project.name,sprintName:this.scope.sprint.name}),t=this.translate.instant("TASKBOARD.PAGE_DESCRIPTION",{projectName:this.scope.project.name,sprintName:this.scope.sprint.name,startDate:moment(this.scope.sprint.estimated_start).format(e),endDate:moment(this.scope.sprint.estimated_finish).format(e),completedPercentage:this.scope.stats.completedPercentage||"0",completedPoints:this.scope.stats.completedPointsSum||"--",totalPoints:this.scope.stats.totalPointsSum||"--",
-openTasks:this.scope.stats.openTasks||"--",totalTasks:this.scope.stats.total_tasks||"--"}),this.appMetaService.setAll(r,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("taskform:bulk:success",function(t){return function(){return t.loadTaskboard(),t.analytics.trackEvent("task","create","bulk create task on taskboard",1)}}(this)),this.scope.$on("taskform:new:success",function(t){return function(){return t.loadTaskboard(),t.analytics.trackEvent("task","create","create task on taskboard",1)}}(this)),this.scope.$on("taskform:edit:success",function(t){return function(){return t.loadTaskboard()}}(this)),this.scope.$on("taskboard:task:move",this.taskMove),this.scope.$on("assigned-to:added",function(t){return function(e,r,n){var i;return n.assigned_to=r,i=t.repo.save(n),i.then(null,function(){return console.log("FAIL")})}}(this))},e.prototype.initializeSubscription=function(){var t,e;return t="changes.project."+this.scope.projectId+".tasks",this.events.subscribe(this.scope,t,function(t){return function(e){return t.loadTaskboard()}}(this)),e="changes.project."+this.scope.projectId+".userstories",this.events.subscribe(this.scope,e,function(t){return function(e){return t.refreshTagsColors(),t.loadSprintStats(),t.loadSprint()}}(this))},e.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(t){return function(e){return e.is_backlog_activated||t.location.path(t.navUrls.resolve("permission-denied")),t.scope.project=e,t.scope.pointsList=_.sortBy(e.points,"order"),t.scope.pointsById=a(e.points,function(t){return t.id}),t.scope.roleById=a(e.roles,function(t){return t.id}),t.scope.taskStatusList=_.sortBy(e.task_statuses,"order"),t.scope.usStatusList=_.sortBy(e.us_statuses,"order"),t.scope.usStatusById=a(e.us_statuses,function(t){return t.id}),t.scope.$emit("project:loaded",e),t.fillUsersAndRoles(e.members,e.roles),e}}(this))},e.prototype.loadSprintStats=function(){return this.rs.sprints.stats(this.scope.projectId,this.scope.sprintId).then(function(t){return function(e){var r,n,i,o;return o=_.reduce(_.values(e.total_points),function(t,e){return t+e},0),r=_.reduce(_.values(e.completed_points),function(t,e){return t+e},0),n=o-r,i=e.total_tasks-e.completed_tasks,t.scope.stats=e,t.scope.stats.totalPointsSum=o,t.scope.stats.completedPointsSum=r,t.scope.stats.remainingPointsSum=n,t.scope.stats.remainingTasks=i,e.totalPointsSum?t.scope.stats.completedPercentage=Math.round(100*e.completedPointsSum/e.totalPointsSum):t.scope.stats.completedPercentage=0,t.scope.stats.openTasks=e.total_tasks-e.completed_tasks,e}}(this))},e.prototype.refreshTagsColors=function(){return this.rs.projects.tagsColors(this.scope.projectId).then(function(t){return function(e){return t.scope.project.tags_colors=e}}(this))},e.prototype.loadSprint=function(){return this.rs.sprints.get(this.scope.projectId,this.scope.sprintId).then(function(t){return function(e){return t.scope.sprint=e,t.scope.userstories=_.sortBy(e.user_stories,"sprint_order"),e}}(this))},e.prototype.loadTasks=function(){return this.rs.tasks.list(this.scope.projectId,this.scope.sprintId).then(function(t){return function(e){var r,n,i,o,s,a,u,c,l,p,d,f,h;for(t.scope.tasks=_.sortBy(e,"taskboard_order"),t.scope.usTasks={},u=_.union(t.scope.userstories,[{id:null}]),r=0,o=u.length;o>r;r++)for(f=u[r],t.scope.usTasks[f.id]={},c=t.scope.taskStatusList,n=0,s=c.length;s>n;n++)p=c[n],t.scope.usTasks[f.id][p.id]=[];for(l=t.scope.tasks,i=0,a=l.length;a>i;i++)d=l[i],null!=t.scope.usTasks[d.user_story]&&null!=t.scope.usTasks[d.user_story][d.status]&&t.scope.usTasks[d.user_story][d.status].push(d);return 0===e.length&&(h=t.scope.userstories.length>0?t.scope.userstories[0].id:null,t.scope.usTasks[h][t.scope.taskStatusList[0].id].push({isPlaceholder:!0})),e}}(this))},e.prototype.loadTaskboard=function(){return this.q.all([this.refreshTagsColors(),this.loadSprintStats(),this.loadSprint().then(function(t){return function(){return t.loadTasks()}}(this))])},e.prototype.loadInitialData=function(){var t,e;return t={pslug:this.params.pslug,sslug:this.params.sslug},e=this.repo.resolve(t).then(function(t){return function(e){return t.scope.projectId=e.project,t.scope.sprintId=e.milestone,t.initializeSubscription(),e}}(this)),e.then(function(t){return function(){return t.loadProject()}}(this)).then(function(t){return function(){return t.loadTaskboard()}}(this))},e.prototype.refreshTasksOrder=function(t){var e,r;return r=this.resortTasks(t),e=this.prepareBulkUpdateData(r),this.rs.tasks.bulkUpdateTaskTaskboardOrder(this.scope.project.id,e)},e.prototype.resortTasks=function(t){var e,r,n,i,o;for(i=[],r=e=0,o=t.length;o>e;r=++e)n=t[r],n.taskboard_order=r,n.isModified()&&i.push(n);return i},e.prototype.prepareBulkUpdateData=function(t){return _.map(t,function(t){return{task_id:t.id,order:t.taskboard_order}})},e.prototype.taskMove=function(t,e,r,n,i){var o,s,a;return s=this.scope.usTasks[e.user_story][e.status].indexOf(e),this.scope.usTasks[e.user_story][e.status].splice(s,1),a=this.scope.usTasks[r][n],a.splice(i,0,e),e.user_story=r,e.status=n,e.taskboard_order=i,o=this.repo.save(e),this.rootscope.$broadcast("sprint:task:moved",e),o.then(function(t){return function(){return t.refreshTasksOrder(a),t.loadSprintStats()}}(this)),o.then(null,function(t){return function(){return console.log("FAIL TASK SAVE")}}(this))},e.prototype.addNewTask=function(t,e){switch(t){case"standard":return this.rootscope.$broadcast("taskform:new",this.scope.sprintId,null!=e?e.id:void 0);case"bulk":return this.rootscope.$broadcast("taskform:bulk",this.scope.sprintId,null!=e?e.id:void 0)}},e.prototype.editTaskAssignedTo=function(t){return this.rootscope.$broadcast("assigned-to:add",t)},e}(u(p.Controller,p.PageMixin)),c.controller("TaskboardController",t),e=function(t){var e;return e=function(e,r,n){var i,o;return i=r.controller(),r.on("click",".toggle-analytics-visibility",function(e){var r;return e.preventDefault(),r=angular.element(e.currentTarget),r.toggleClass("active"),t.$broadcast("taskboard:graph:toggle-visibility")}),o=r.find(".taskboard-table-body"),o.on("scroll",function(t){var e,n;return n=angular.element(t.currentTarget),e=r.find(".taskboard-table-header .taskboard-table-inner"),e.css("left",-1*n.scrollLeft())}),e.$on("$destroy",function(){return r.off()})},{link:e}},c.directive("tgTaskboard",["$rootScope",e]),n=function(t,e,r,n){var i;return i=function(i,o,s,a){return i.$watch("task",function(t){return t.is_blocked&&!o.hasClass("blocked")?o.addClass("blocked"):!t.is_blocked&&o.hasClass("blocked")?o.removeClass("blocked"):void 0}),o.find(".edit-task").on("click",function(s){return o.find(".edit-task").hasClass("noclick")?void 0:i.$apply(function(){var o,a,u;return a=$(s.target),o=e().target(a).timeout(200).start(),u=i.task,r.tasks.getByRef(u.project,u.ref).then(function(e){return function(e){return n.attachments.list("task",e.id,e.project).then(function(r){return t.$broadcast("taskform:edit",e,r.toJS()),o.finish()})}}(this))})})},{link:i}},c.directive("tgTaskboardTask",["$rootScope","$tgLoading","$tgResources","tgResources",n]),r=function(t){var e,r,n;return e=40,n=300,r=function(r,i,o){var a,u,c,l,p;return r.$on("sprint:task:moved",function(t){return function(){return c()}}(this)),s(r,"usTasks",function(e){return r.statusesFolded=t.tasks.getStatusColumnModes(r.project.id),r.usFolded=t.tasks.getUsRowModes(r.project.id,r.sprintId),c()}),r.foldStatus=function(e){return r.statusesFolded[e.id]=!r.statusesFolded[e.id],t.tasks.storeStatusColumnModes(r.projectId,r.statusesFolded),c()},r.foldUs=function(e){return e?r.usFolded[e.id]=!r.usFolded[e.id]:r.usFolded[null]=!r.usFolded[null],t.tasks.storeUsRowModes(r.projectId,r.sprintId,r.usFolded),c()},a=function(t){return function(t,n){var i,o,s;return i=r.usTasks[t][n].length,r.statusesFolded[n]?(i&&r.usFolded[t]?(o=Math.round(Math.sqrt(i)),s=e*o):s=e,s):0}}(this),p=function(t){return function(t,e){var r;return r=i.find(".squish-status-"+t),e?r.css("max-width",e):r.css("max-width",n)}}(this),l=function(t){return function(){var t,e,r;return t=[],e=i.find(".task-colum-name"),t=_.map(e,function(t){return $(t).outerWidth(!0)}),r=_.reduce(t,function(t,e){return t+e}),i.find(".taskboard-table-inner").css("width",r)}}(this),u=function(t){return function(t){var e;return e=a(null,t),_.forEach(r.userstories,function(r){var n;return n=a(r.id,t),n>e?e=n:void 0}),p(t,e)}}(this),c=function(t){return function(){_.forEach(r.taskStatusList,function(t){return u(t.id)}),l()}}(this)},{link:r}},c.directive("tgTaskboardSquishColumn",["$tgResources",r]),i=function(t,e){var r,n;return r=!1,n=function(t,n,i){var o;return o=n.parent().find("a.task-assigned"),o.addClass("not-clickable"),t.$watch("task.assigned_to",function(n){var i;return i=t.usersById[n],void 0===i?_.assign(t,{name:e.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED"),imgurl:"/"+window._version+"/images/unnamed.png",clickable:r}):_.assign(t,{name:i.full_name_display,imgurl:i.photo,clickable:r}),o.text(t.name)}),s(t,"project",function(e){return e.my_permissions.indexOf("modify_task")>-1?(r=!0,n.find(".avatar-assigned-to").on("click",function(e){return function(e){var r;if(!n.find("a").hasClass("noclick"))return r=n.controller(),r.editTaskAssignedTo(t.task)}}(this)),o.removeClass("not-clickable"),o.on("click",function(e){var r;if(!n.find("a").hasClass("noclick"))return r=n.controller(),r.editTaskAssignedTo(t.task)})):void 0})},{link:n,templateUrl:"taskboard/taskboard-user.html",scope:{usersById:"=users",project:"=",task:"="}}},c.directive("tgTaskboardUserAvatar",["$log","$translate",i])}.call(this),function(){var t,e,r,n,i,o,s,a;s=this.taiga,n=this.taiga.mixOf,a=this.taiga.toggleText,o=this.taiga.scopeDefer,e=this.taiga.bindOnce,r=this.taiga.groupBy,i=angular.module("taigaBacklog"),t=function(t,r,n){var i;return i=function(t,r,i){return e(t,"tasks",function(e){var i,o,s,a,u,c,l,p;if(t.project.my_permissions.indexOf("modify_us")>-1)return c=null,u=null,a=null,p=r,o=function(t){return t.scope().$destroy(),t.off(),t.remove()},i=_.map(r.find(".task-column"),function(t){return t}),s=dragula(i,{copySortSource:!1,copy:!1,mirrorContainer:r[0],moves:function(t){return $(t).hasClass("taskboard-task")}}),s.on("drag",function(t){return c=$(t).parent().scope()}),s.on("dragend",function(e){var r,i,s,l,p,d,f;return f=$(e).parent(),a=$(e),i=a.scope().task,r=a.index(),u=f.scope(),d=c.us?c.us.id:null,p=c.st.id,l=u.us?u.us.id:null,s=u.st.id,(s!==p||l!==d)&&o(a),t.$apply(function(){return n.$broadcast("taskboard:task:move",i,l,s,r)})}),l=autoScroll(i,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&s.dragging}}),t.$on("$destroy",function(){return r.off(),s.destroy()})})},{link:i}},i.directive("tgTaskboardSortable",["$tgRepo","$tgResources","$rootScope",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,d,f,h,m,g,v,y,b=function(t,e){function r(){this.constructor=t}for(var n in e)S.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},S={}.hasOwnProperty;m=this.taiga,d=this.taiga.mixOf,v=this.taiga.toggleText,h=this.taiga.scopeDefer,c=this.taiga.bindOnce,p=this.taiga.groupBy,g=this.taiga.timeout,u=this.taiga.bindMethods,f=angular.module("taigaKanban"),l="maximized",y=["maximized","minimized"],r=function(t){function e(t,e,r,n,i,o,s,a,c,l,p,d,f){var h;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=a,this.appMetaService=c,this.navUrls=l,this.events=p,this.analytics=d,this.translate=f,u(this),this.scope.sectionName=this.translate.instant("KANBAN.SECTION_NAME"),this.scope.statusViewModes={},this.initializeEventHandlers(),h=this.loadInitialData(),h.then(function(t){return function(){var e,r;return r=t.translate.instant("KANBAN.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.translate.instant("KANBAN.PAGE_DESCRIPTION",{projectName:t.scope.project.name,projectDescription:t.scope.project.description}),t.appMetaService.setAll(r,e)}}(this)),h.then(null,this.onInitialDataError.bind(this))}return b(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","tgAppMetaService","$tgNavUrls","$tgEvents","$tgAnalytics","$translate"],e.prototype.initializeEventHandlers=function(){return this.scope.$on("usform:new:success",function(t){return function(){return t.loadUserstories(),t.refreshTagsColors(),t.analytics.trackEvent("userstory","create","create userstory on kanban",1)}}(this)),this.scope.$on("usform:bulk:success",function(t){return function(){return t.loadUserstories(),t.analytics.trackEvent("userstory","create","bulk create userstory on kanban",1)}}(this)),this.scope.$on("usform:edit:success",function(t){return function(){return t.loadUserstories(),t.refreshTagsColors()}}(this)),this.scope.$on("assigned-to:added",this.onAssignedToChanged),this.scope.$on("kanban:us:move",this.moveUs),this.scope.$on("kanban:show-userstories-for-status",this.loadUserStoriesForStatus),this.scope.$on("kanban:hide-userstories-for-status",this.hideUserStoriesForStatus)},e.prototype.addNewUs=function(t,e){switch(t){case"standard":return this.rootscope.$broadcast("usform:new",this.scope.projectId,e,this.scope.usStatusList);case"bulk":return this.rootscope.$broadcast("usform:bulk",this.scope.projectId,e)}},e.prototype.changeUsAssignedTo=function(t){return this.rootscope.$broadcast("assigned-to:add",t)},e.prototype.onAssignedToChanged=function(t,e,r){var n;return r.assigned_to=e,n=this.repo.save(r),n.then(null,function(){return console.log("FAIL")})},e.prototype.refreshTagsColors=function(){return this.rs.projects.tagsColors(this.scope.projectId).then(function(t){return function(e){return t.scope.project.tags_colors=e}}(this))},e.prototype.loadUserstories=function(){var t,e;return t={status__is_archived:!1},e=this.rs.userstories.listAll(this.scope.projectId,t).then(function(t){return function(e){var r,n,i,o,s,a,u,c,l,p,d,f,m;for(t.scope.userstories=e,f=_.groupBy(e,"status"),m=[],u=t.scope.usStatusList,r=0,o=u.length;o>r;r++){if(p=u[r],null==f[p.id]&&(f[p.id]=[]),null!=t.scope.usByStatus)for(c=t.scope.usByStatus[p.id],n=0,s=c.length;s>n;n++)d=c[n],d.status!==p.id&&m.push(d);if(p.is_archived&&null!=t.scope.usByStatus&&0!==t.scope.usByStatus[p.id].length)for(l=t.scope.usByStatus[p.id].concat(m),i=0,a=l.length;a>i;i++)d=l[i],d.status===p.id&&f[p.id].push(d);f[p.id]=_.sortBy(f[p.id],"kanban_order")}return 0===e.length&&(p=t.scope.usStatusList[0],f[p.id].push({isPlaceholder:!0})),t.scope.usByStatus=f,h(t.scope,function(){return t.scope.$broadcast("userstories:loaded",e)}),e}}(this)),e.then(function(t){return function(){return t.scope.$broadcast("redraw:wip")}}(this)),e},e.prototype.loadUserStoriesForStatus=function(t,e){var r;return r={status:e},this.rs.userstories.listAll(this.scope.projectId,r).then(function(t){return function(r){return t.scope.usByStatus[e]=_.sortBy(r,"kanban_order"),t.scope.$broadcast("kanban:shown-userstories-for-status",e,r),r}}(this))},e.prototype.hideUserStoriesForStatus=function(t,e){return this.scope.usByStatus[e]=[],this.scope.$broadcast("kanban:hidden-userstories-for-status",e)},e.prototype.loadKanban=function(){return this.q.all([this.refreshTagsColors(),this.loadUserstories()])},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.is_kanban_activated||t.location.path(t.navUrls.resolve("permission-denied")),t.scope.projectId=e.id,t.scope.project=e,t.scope.projectId=e.id,t.scope.points=_.sortBy(e.points,"order"),t.scope.pointsById=p(e.points,function(t){return t.id}),t.scope.usStatusById=p(e.us_statuses,function(t){return t.id}),t.scope.usStatusList=_.sortBy(e.us_statuses,"order"),t.generateStatusViewModes(),t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.initializeSubscription=function(){var t;return t="changes.project."+this.scope.projectId+".userstories",this.events.subscribe(this.scope,t,function(t){return function(e){return t.loadUserstories()}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.initializeSubscription(),t.loadKanban()}}(this))},e.prototype.generateStatusViewModes=function(){var t,e,r,n,i,o;for(o=this.rs.kanban.getStatusViewModes(this.scope.projectId),this.scope.statusViewModes={},n=this.scope.usStatusList,t=0,e=n.length;e>t;t++)i=n[t],r=o[i.id]||l,this.scope.statusViewModes[i.id]=r;return this.storeStatusViewModes()},e.prototype.storeStatusViewModes=function(){return this.rs.kanban.storeStatusViewModes(this.scope.projectId,this.scope.statusViewModes)},e.prototype.updateStatusViewMode=function(t,e){return this.scope.statusViewModes[t]=e,this.storeStatusViewModes()},e.prototype.isMaximized=function(t){var e;return e=this.scope.statusViewModes[t]||l,"maximized"===e},e.prototype.isMinimized=function(t){var e;return e=this.scope.statusViewModes[t]||l,"minimized"===e},e.prototype.prepareBulkUpdateData=function(t,e){return null==e&&(e="kanban_order"),_.map(t,function(t){return{us_id:t.id,order:t[e]}})},e.prototype.resortUserStories=function(t){var e,r,n,i,o;for(i=[],r=e=0,o=t.length;o>e;r=++e)n=t[r],n.kanban_order=r,n.isModified()&&i.push(n);return i},e.prototype.moveUs=function(t,e,r,n,i){var o,s,a;return r!==n?(a=this.scope.usByStatus[r].indexOf(e),this.scope.usByStatus[r].splice(a,1),this.scope.usByStatus[n].splice(i,0,e),e.status=n):(a=this.scope.usByStatus[n].indexOf(e),this.scope.usByStatus[n].splice(a,1),this.scope.usByStatus[n].splice(i,0,e)),o=this.resortUserStories(this.scope.usByStatus[n]),this.scope.usByStatus[n]=_.sortBy(this.scope.usByStatus[n],"kanban_order"),s=this.repo.save(e),s=s.then(function(t){return function(){var r;return o=_.reject(o,{id:e.id}),r=t.prepareBulkUpdateData(o),t.rs.userstories.bulkUpdateKanbanOrder(e.project,r).then(function(){return o})}}(this))},e}(d(m.Controller,m.PageMixin,m.FiltersMixin)),f.controller("KanbanController",r),n=function(t,e){var r;return r=function(t,e,r){var n;return n=e.find(".kanban-table-body"),n.on("scroll",function(t){var r,n;return n=angular.element(t.currentTarget),r=e.find(".kanban-table-header .kanban-table-inner"),r.css("left",-1*n.scrollLeft())}),t.$on("$destroy",function(){return e.off()})},{link:r}},f.directive("tgKanban",["$tgRepo","$rootScope",n]),t=function(t,e){var r,n,i;return i=e.instant("KANBAN.ACTION_SHOW_ARCHIVED"),r=e.instant("KANBAN.ACTION_HIDE_ARCHIVED"),n=function(e,n,o){var s,a;return a=e.$eval(o.tgKanbanArchivedStatusHeader),s=!0,e["class"]="icon-watch",e.title=i,n.on("click",function(n){return s=!s,e.$apply(function(){return s?(e["class"]="icon-watch",e.title=i,t.$broadcast("kanban:hide-userstories-for-status",a.id)):(e["class"]="icon-unwatch",e.title=r,t.$broadcast("kanban:show-userstories-for-status",a.id))})}),e.$on("$destroy",function(){return n.off()})},{link:n}},f.directive("tgKanbanArchivedStatusHeader",["$rootScope","$translate",t]),e=function(t){var e,r;return r=[],e=function(e,n,i){var o,s,a;return o=t.instant("KANBAN.HIDDEN_USER_STORIES"),s=e.$eval(i.tgKanbanArchivedStatusIntro),n.text(o),a=function(){return r.length>0?n.text(""):n.text(o)},e.$on("kanban:us:move",function(t,e,n,i,o){var u;return s.id===i?s.id===n?(u=r.indexOf(e),r.splice(u,1),r.splice(o,0,e)):(e.isArchived=!0,r.splice(o,0,e)):s.id===n&&(e.isArchived=!1,u=r.indexOf(e),r.splice(u,1)),a()}),e.$on("kanban:shown-userstories-for-status",function(t,e,n){return e===s.id?(r=_.filter(n,function(t){return t.status===s.id}),a()):void 0}),e.$on("kanban:hidden-userstories-for-status",function(t,e){return e===s.id?(r=[],a()):void 0}),e.$on("$destroy",function(){return n.off()})},{link:e}},f.directive("tgKanbanArchivedStatusIntro",["$translate",e]),s=function(t,e,r,n){var i;return i=function(i,o,s,a){return i.$watch("us",function(t){return t.is_blocked&&!o.hasClass("blocked")?o.addClass("blocked"):!t.is_blocked&&o.hasClass("blocked")?o.removeClass("blocked"):void 0}),o.on("click",".edit-us",function(i){var s,u,c;if(!o.find(".icon-edit").hasClass("noclick"))return u=$(i.target),s=e().target(u).timeout(200).removeClasses("icon-edit").start(),c=a.$modelValue,r.userstories.getByRef(c.project,c.ref).then(function(e){return function(e){return n.attachments.list("us",c.id,c.project).then(function(r){return t.$broadcast("usform:edit",e,r.toJS()),s.finish()})}}(this))}),i.getTemplateUrl=function(){return i.us.isPlaceholder?"common/components/kanban-placeholder.html":"kanban/kanban-task.html"},i.$on("$destroy",function(){return o.off()})},{template:'
',link:i,require:"ngModel"}},f.directive("tgKanbanUserstory",["$rootScope","$tgLoading","$tgResources","tgResources",s]),i=function(t){var e;return e=function(e,r,n){var i;return e.$on("project:loaded",function(r,n){return e.folds=t.kanban.getStatusColumnModes(n.id),i()}),e.foldStatus=function(r){e.folds[r.id]=!e.folds[r.id],t.kanban.storeStatusColumnModes(e.projectId,e.folds),i()},i=function(){var t,n;return t=_.map(e.usStatusList,function(t){return e.folds[t.id]?40:310}),n=_.reduce(t,function(t,e){return t+e}),r.find(".kanban-table-inner").css("width",n)}},{link:e}},f.directive("tgKanbanSquishColumn",["$tgResources",i]),a=function(){var t;return t=function(t,e,r){var n,i;return i=t.$eval(r.tgKanbanWipLimit),n=function(t){return function(){return e.find(".kanban-wip-limit").remove(),g(200,function(){var t;return t=e.find(".kanban-task")[i.wip_limit],t?angular.element(t).before("
"):void 0})}}(this),i&&!i.is_archived&&(t.$on("redraw:wip",n),t.$on("kanban:us:move",n),t.$on("usform:new:success",n),t.$on("usform:bulk:success",n)),t.$on("$destroy",function(){return e.off()})},{link:t}},f.directive("tgKanbanWipLimit",a),o=function(t,e,r){var n,i,o;return o=_.template('
\n class="not-clickable"<% } %>>\n
\n \n'),n=!1,i=function(i,s,a,u){var l,p,d;return p=s.parent().find("a.task-assigned"),p.addClass("not-clickable"),a.tgKanbanUserAvatar?(d=i.$watch(a.tgKanbanUserAvatar,function(e){var r;return null==i.usersById?(t.error("KanbanUserDirective requires userById set in scope."),d()):(r=i.usersById[e],l(r))}),l=function(t){var a,u;return a=void 0===t?{name:r.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED"),imgurl:"/"+window._version+"/images/unnamed.png",clickable:n}:{name:t.full_name_display,imgurl:t.photo,clickable:n},u=e(o(a))(i),s.html(u),p.text(a.name)},c(i,"project",function(t){return t.my_permissions.indexOf("modify_us")>-1?(n=!0,s.on("click",function(t){return function(t){var e,r;if(!s.find("a").hasClass("noclick"))return r=u.$modelValue,e=s.controller(),e.changeUsAssignedTo(r)}}(this)),p.removeClass("not-clickable"),p.on("click",function(t){var e,r;if(!s.find("a").hasClass("noclick"))return r=u.$modelValue,e=s.controller(),e.changeUsAssignedTo(r)})):void 0}),i.$on("$destroy",function(){return s.off()})):t.error("KanbanUserDirective: no attr is defined")},{link:i,require:"ngModel"}},f.directive("tgKanbanUserAvatar",["$log","$compile","$translate",o])}.call(this),function(){var t,e,r,n,i,o,s,a,u;s=this.taiga,n=this.taiga.mixOf,u=this.taiga.toggleText,o=this.taiga.scopeDefer,e=this.taiga.bindOnce,r=this.taiga.groupBy,a=this.taiga.timeout,i=angular.module("taigaKanban"),t=function(t,r,n){var i;return i=function(t,r,i){return e(t,"project",function(e){var i,o,s,a,u,c,l,p;if(e.my_permissions.indexOf("modify_us")>-1)return c=null,u=null,a=null,p=r,o=function(t){return t.scope().$destroy(),t.off(),t.remove()},i=_.map(r.find(".task-column"),function(t){return t}),s=dragula(i,{copySortSource:!1,copy:!1,mirrorContainer:p[0],moves:function(t){return $(t).hasClass("kanban-task")}}),s.on("drag",function(t){return c=$(t).parent().scope()}),s.on("dragend",function(e){var r,i,s,l,p;return p=$(e).parent(),a=$(e),i=a.scope().us,r=a.index(),u=p.scope(),s=u.s.id,l=c.s.id,s!==l&&o(a),t.$apply(function(){return n.$broadcast("kanban:us:move",i,i.status,s,r)})}),l=autoScroll(i,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&s.dragging}}),t.$on("$destroy",function(){return r.off(),s.destroy()})})},{link:i}},i.directive("tgKanbanSortable",["$tgRepo","$tgResources","$rootScope",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,d,f,h,m=function(t,e){function r(){this.constructor=t}for(var n in e)g.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},g={}.hasOwnProperty;f=this.taiga,p=this.taiga.mixOf,h=this.taiga.toString,l=this.taiga.joinStr,c=this.taiga.groupBy,u=this.taiga.bindOnce,a=this.taiga.bindMethods,d=angular.module("taigaIssues"),t=function(t){function e(t,e,r,n,i,o,s,u,c,l,p,d,f,h){var m;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=u,this.log=c,this.appMetaService=l,this.analytics=p,this.navUrls=d,this.translate=f,this.modelTransform=h,a(this),this.scope.issueRef=this.params.issueref,this.scope.sectionName=this.translate.instant("ISSUES.SECTION_NAME"),this.initializeEventHandlers(),m=this.loadInitialData(),m.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),m.then(null,this.onInitialDataError.bind(this))}return m(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgAnalytics","$tgNavUrls","$translate","$tgQueueModelTransformation"],e.prototype._setMeta=function(){var t,e,r,n,i,o;return o=this.translate.instant("ISSUE.PAGE_TITLE",{issueRef:"#"+this.scope.issue.ref,issueSubject:this.scope.issue.subject,projectName:this.scope.project.name}),t=this.translate.instant("ISSUE.PAGE_DESCRIPTION",{issueStatus:(null!=(e=this.scope.statusById[this.scope.issue.status])?e.name:void 0)||"--",issueType:(null!=(r=this.scope.typeById[this.scope.issue.type])?r.name:void 0)||"--",issueSeverity:(null!=(n=this.scope.severityById[this.scope.issue.severity])?n.name:void 0)||"--",issuePriority:(null!=(i=this.scope.priorityById[this.scope.issue.priority])?i.name:void 0)||"--",issueDescription:angular.element(this.scope.issue.description_html||"").text()}),this.appMetaService.setAll(o,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on issue",1)}}(this)),this.scope.$on("promote-issue-to-us:success",function(t){return function(){return t.analytics.trackEvent("issue","promoteToUserstory","promote issue to userstory",1),t.rootscope.$broadcast("object:updated"),t.loadIssue()}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadIssue()}}(this)),this.scope.$on("custom-attributes-values:edit",function(t){return function(){return t.rootscope.$broadcast("object:updated")}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;return t={project:this.scope.project.slug},this.scope.project.is_issues_activated?this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-issues",t):this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",t)},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.statusList=e.issue_statuses,t.scope.statusById=c(e.issue_statuses,function(t){return t.id}),t.scope.typeById=c(e.issue_types,function(t){return t.id}),t.scope.typeList=_.sortBy(e.issue_types,"order"),t.scope.severityList=e.severities,t.scope.severityById=c(e.severities,function(t){return t.id}),t.scope.priorityList=e.priorities,t.scope.priorityById=c(e.priorities,function(t){return t.id}),e}}(this))},e.prototype.loadIssue=function(){return this.rs.issues.getByRef(this.scope.projectId,this.params.issueref).then(function(t){return function(e){var r,n,i;return t.scope.issue=e,t.scope.issueId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"issue"),null!=(null!=(n=t.scope.issue.neighbors.previous)?n.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.issue.neighbors.previous.ref},t.scope.previousUrl=t.navUrls.resolve("project-issues-detail",r)),null!=(null!=(i=t.scope.issue.neighbors.next)?i.ref:void 0)?(r={project:t.scope.project.slug,ref:t.scope.issue.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-issues-detail",r)):void 0}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.loadIssue()}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.upvote(this.scope.issueId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.downvote(this.scope.issueId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.watch(this.scope.issueId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.unwatch(this.scope.issueId).then(e,t)},e}(p(f.Controller,f.PageMixin)),d.controller("IssueDetailController",t),i=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:s.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){return null!=t?o(t):void 0}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},d.directive("tgIssueStatusDisplay",["$tgTemplate","$compile",i]),n=function(t,e,r,n,i,o,s){var a,u;return u=o.get("common/components/status-button.html",!0),a=function(e,o,a,c){var l,p,d;return l=function(){return-1!==e.project.my_permissions.indexOf("modify_issue")},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=u({status:n,statuses:e.statusList,editable:l()}),r=s(r)(e),o.html(r)}}(this),d=function(e){var s,a,u,c;return $.fn.popover().closeAll(),s=n().target(o).start(),c=i.save(function(t){return t.status=e,t}),u=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},c.then(u,a)},o.on("click",".js-edit-status",function(t){return t.preventDefault(),t.stopPropagation(),l()?o.find(".pop-status").popover().open():void 0}),o.on("click",".status",function(t){var e;return t.preventDefault(),t.stopPropagation(),l()?(e=angular.element(t.currentTarget),d(e.data("status-id"))):void 0}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.status:void 0},function(){var t;return t=c.$modelValue,t?p(t):void 0}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},d.directive("tgIssueStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",n]),o=function(t,e,r,n,i,o,s){var a,u;return u=o.get("issue/issue-type-button.html",!0),a=function(e,o,a,c){var l,p,d;return l=function(){return-1!==e.project.my_permissions.indexOf("modify_issue")},p=function(t){return function(t){var r,n;return n=e.typeById[t.type],r=u({type:n,typees:e.typeList,editable:l()}),r=s(r)(e),o.html(r)}}(this),d=function(e){var s,a,u,c;return $.fn.popover().closeAll(),s=n().target(o.find(".level-name")).start(),
-c=i.save(function(t){return t.type=e,t}),u=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},c.then(u,a)},o.on("click",".type-data",function(t){return t.preventDefault(),t.stopPropagation(),l()?o.find(".pop-type").popover().open():void 0}),o.on("click",".type",function(t){var e,r;return t.preventDefault(),t.stopPropagation(),l()?(e=angular.element(t.currentTarget),r=e.data("type-id"),d(r)):void 0}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.type:void 0},function(){var t;return t=c.$modelValue,t?p(t):void 0}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},d.directive("tgIssueTypeButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",o]),r=function(t,e,r,n,i,o,s){var a,u;return u=o.get("issue/issue-severity-button.html",!0),a=function(e,o,a,c){var l,p,d;return l=function(){return-1!==e.project.my_permissions.indexOf("modify_issue")},p=function(t){return function(t){var r,n;return n=e.severityById[t.severity],r=u({severity:n,severityes:e.severityList,editable:l()}),r=s(r)(e),o.html(r)}}(this),d=function(e){var s,a,u,c;return $.fn.popover().closeAll(),s=n().target(o.find(".level-name")).start(),c=i.save(function(t){return t.severity=e,t}),u=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},c.then(u,a)},o.on("click",".severity-data",function(t){return t.preventDefault(),t.stopPropagation(),l()?o.find(".pop-severity").popover().open():void 0}),o.on("click",".severity",function(t){var e,r;return t.preventDefault(),t.stopPropagation(),l()?(r=angular.element(t.currentTarget),e=r.data("severity-id"),d(e)):void 0}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.severity:void 0},function(){var t;return t=c.$modelValue,t?p(t):void 0}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},d.directive("tgIssueSeverityButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",r]),e=function(t,e,r,n,i,o,s){var a,u;return u=o.get("issue/issue-priority-button.html",!0),a=function(e,o,a,c){var l,p,d;return l=function(){return-1!==e.project.my_permissions.indexOf("modify_issue")},p=function(t){return function(t){var r,n;return n=e.priorityById[t.priority],r=u({priority:n,priorityes:e.priorityList,editable:l()}),r=s(r)(e),o.html(r)}}(this),d=function(e){var s,a,u,c;return $.fn.popover().closeAll(),s=n().target(o.find(".level-name")).start(),c=i.save(function(t){return t.priority=e,t}),u=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},c.then(u,a)},o.on("click",".priority-data",function(t){return t.preventDefault(),t.stopPropagation(),l()?o.find(".pop-priority").popover().open():void 0}),o.on("click",".priority",function(t){var e,r;return t.preventDefault(),t.stopPropagation(),l()?(r=angular.element(t.currentTarget),e=r.data("priority-id"),d(e)):void 0}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.priority:void 0},function(){var t;return t=c.$modelValue,t?p(t):void 0}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},d.directive("tgIssuePriorityButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",e]),s=function(t,e,r,n){var i;return i=function(i,o,s,a){var u;return u=function(n){return function(n,i){var o,s,a;return o={generated_from_issue:n.id,project:n.project,subject:n.subject,description:n.description,tags:n.tags,is_blocked:n.is_blocked,blocked_note:n.blocked_note},a=function(){return i.finish(),r.notify("success"),t.$broadcast("promote-issue-to-us:success")},s=function(){return i.finish(),r.notify("error")},e.create("userstories",o).then(a,s)}}(this),o.on("click","a",function(t){var e,i,o,s;return t.preventDefault(),e=a.$modelValue,s=n.instant("ISSUES.CONFIRM_PROMOTE.TITLE"),i=n.instant("ISSUES.CONFIRM_PROMOTE.MESSAGE"),o=e.subject,r.ask(s,o,i).then(function(t){return function(t){return u(e,t)}}(this))}),i.$on("$destroy",function(){return o.off()})},{restrict:"AE",require:"ngModel",templateUrl:"issue/promote-issue-to-us-button.html",link:i}},d.directive("tgPromoteIssueToUsButton",["$rootScope","$tgRepo","$tgConfirm","$translate",s])}.call(this),function(){var t,e,r,n,i,o;o=this.taiga,r=this.taiga.bindOnce,n=this.taiga.debounce,i=angular.module("taigaIssues"),e=function(t,e,r,i,o,s,a){var u;return u=function(u,c,l){var p,d,f,h,m,g;return f=c.find("form").checksley(),u.issue={},u.attachments=Immutable.List(),u.$on("issueform:new",function(t,e){return f.reset(),h(),c.find(".tag-input").val(""),i.open(c),u.issue={project:e.id,subject:"",status:e.default_issue_status,type:e.default_issue_type,priority:e.default_priority,severity:e.default_severity,tags:[]}}),u.$on("$destroy",function(){return c.off()}),d=function(t){var e;return e=_.map(p.toJS(),function(e){return a.upload(e.file,t.id,u.issue.project,"issue")}),s.all(e)},p=Immutable.List(),h=function(){return p=Immutable.List(),u.attachments=Immutable.List()},u.addAttachment=function(t){return p=p.push(t)},m=n(2e3,function(n){return function(n){var s,a;return n.preventDefault(),f.validate()?(s=o().target(g).start(),a=t.create("issues",u.issue),a.then(function(t){return d(t)}),a.then(function(t){return s.finish(),r.$broadcast("issueform:new:success",t),i.close(c),e.notify("success")}),a.then(null,function(){return s.finish(),e.notify("error")})):void 0}}(this)),g=c.find(".submit-button"),c.on("submit","form",m)},{link:u}},i.directive("tgLbCreateIssue",["$tgRepo","$tgConfirm","$rootScope","lightboxService","$tgLoading","$q","tgAttachmentsService",e]),t=function(t,e,r,i,o,s){var a;return a=function(t,a,u){var c,l,p;return c=null,t.$on("issueform:bulk",function(e,r,n){return c&&c.reset(),s.open(a),t["new"]={projectId:r,bulk:""}}),l=n(2e3,function(n){return function(n){var u,l,d,f;return n.preventDefault(),c=a.find("form").checksley(),c.validate()?(u=o().target(p).start(),l=t["new"].bulk,d=t["new"].projectId,f=e.issues.bulkCreate(d,l),f.then(function(t){return u.finish(),i.$broadcast("issueform:new:success",t),s.close(a),r.notify("success")}),f.then(null,function(){return u.finish(),r.notify("error")})):void 0}}(this)),p=a.find(".submit-button"),a.on("submit","form",l),t.$on("$destroy",function(){return a.off()})},{link:a}},i.directive("tgLbCreateBulkIssues",["$tgRepo","$tgResources","$tgConfirm","$rootScope","$tgLoading","lightboxService",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,d,f,h,m=function(t,e){return function(){return t.apply(e,arguments)}},g=function(t,e){function r(){this.constructor=t}for(var n in e)v.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},v={}.hasOwnProperty;d=this.taiga,c=this.taiga.mixOf,h=this.taiga.trim,f=this.taiga.toString,u=this.taiga.joinStr,a=this.taiga.groupBy,o=this.taiga.bindOnce,s=this.taiga.debounceLeading,p=this.taiga.startswith,l=angular.module("taigaIssues"),r=function(t){function e(t,e,r,n,i,o,s,a,u,c,l,p,d,f){var h,g;return this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.urls=o,this.params=s,this.q=a,this.location=u,this.appMetaService=c,this.navUrls=l,this.events=p,this.analytics=d,this.translate=f,this.loadIssues=m(this.loadIssues,this),this.scope.sectionName="Issues",this.scope.filters={},_.isEmpty(this.location.search())?(h=this.rs.issues.getFilters(this.params.pslug),h.page=1,this.location.search(h),void this.location.replace()):(g=this.loadInitialData(),g.then(function(t){return function(){var e,r;return r=t.translate.instant("ISSUES.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.translate.instant("ISSUES.PAGE_DESCRIPTION",{projectName:t.scope.project.name,projectDescription:t.scope.project.description}),t.appMetaService.setAll(r,e)}}(this)),g.then(null,this.onInitialDataError.bind(this)),void this.scope.$on("issueform:new:success",function(t){return function(){return t.analytics.trackEvent("issue","create","create issue on issues list",1),t.loadIssues()}}(this)))}return g(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$tgUrls","$routeParams","$q","$tgLocation","tgAppMetaService","$tgNavUrls","$tgEvents","$tgAnalytics","$translate"],e.prototype.initializeSubscription=function(){var t;return t="changes.project."+this.scope.projectId+".issues",this.events.subscribe(this.scope,t,function(t){return function(e){return t.loadIssues()}}(this))},e.prototype.storeFilters=function(){return this.rs.issues.storeFilters(this.params.pslug,this.location.search())},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.is_issues_activated||t.location.path(t.navUrls.resolve("permission-denied")),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.issueStatusById=a(e.issue_statuses,function(t){return t.id}),t.scope.issueStatusList=_.sortBy(e.issue_statuses,"order"),t.scope.severityById=a(e.severities,function(t){return t.id}),t.scope.severityList=_.sortBy(e.severities,"order"),t.scope.priorityById=a(e.priorities,function(t){return t.id}),t.scope.priorityList=_.sortBy(e.priorities,"order"),t.scope.issueTypes=_.sortBy(e.issue_types,"order"),t.scope.issueTypeById=a(e.issue_types,function(t){return t.id}),e}}(this))},e.prototype.getUrlFilters=function(){var t;return t=_.pick(this.location.search(),"page","tags","status","types","q","severities","priorities","assignedTo","createdBy","orderBy"),t.page||(t.page=1),t},e.prototype.getUrlFilter=function(t){var e;return e=_.pick(this.location.search(),t),e[t]},e.prototype.loadMyFilters=function(){return this.rs.issues.getMyFilters(this.scope.projectId).then(function(t){return function(t){return _.map(t,function(t,e){return{id:e,name:e,type:"myFilters",selected:!1}})}}(this))},e.prototype.removeNotExistingFiltersFromUrl=function(){var t,e,r,n,i,o;t=this.location.search(),o=this.getUrlFilters();for(r in o)n=o[r],"page"!==r&&"orderBy"!==r&&"q"!==r&&(i="tags"===r?_.map((""+n).split(",")):_.map((""+n).split(","),function(t){return"null"===t?null:parseInt(t)}),e=_.intersection(i,_.map(this.scope.filters[r],"id")),i.length!==e.length&&this.location.search(r,e.join()));return t!==this.location.search()?this.location.replace():void 0},e.prototype.markSelectedFilters=function(t,e){var r,n,i,o,s,a,u,c,l,p,d,f;p={},u=_.omit(e,"page","orderBy");for(s in u)for(f=u[s],null==p[s]&&(p[s]={}),c=(""+f).split(","),n=0,o=c.length;o>n;n++)d=c[n],p[s][d]=!0;r=function(t,e){return null!=p[t]&&p[t][e]?!0:!1},l=[];for(i in t)f=t[i],l.push(function(){var t,e,n;for(n=[],t=0,e=f.length;e>t;t++)a=f[t],n.push(a.selected=r(a.type,a.id)?!0:void 0);return n}());return l},e.prototype.loadFilters=function(){var t,e,r;return r=this.getUrlFilters(),r.q&&(this.scope.filtersQ=r.q),e=this.loadMyFilters().then(function(t){return function(e){return t.scope.filters.myFilters=e,e}}(this)),t={},t.project=this.scope.projectId,t.tags=r.tags,t.status=r.status,t.q=r.q,t.types=r.types,t.severities=r.severities,t.priorities=r.priorities,t.assigned_to=r.assignedTo,t.owner=r.createdBy,e=e.then(function(e){return function(){return e.rs.issues.filtersData(t)}}(this)),e.then(function(t){return function(e){var n,i,o;return o=function(t,e,r){var n,i;return n=_.map(t,function(t){return t.type=e,t.name=t.full_name?t.full_name:r,t}),i=_.remove(n,function(t){return!t.id}),n=_.sortBy(n,function(t){return t.name.toUpperCase()}),i.length>0&&n.unshift(i[0]),n},n=function(t,e,r){return _.map(t,function(t){return t.type=e,t})},i=function(t){return _.map(t,function(t){return t.id=t.name,t.type="tags",t})},t.scope.filters.status=n(e.statuses,"status",t.scope.issueStatusById),t.scope.filters.severities=n(e.severities,"severities",t.scope.severityById),t.scope.filters.priorities=n(e.priorities,"priorities",t.scope.priorityById),t.scope.filters.assignedTo=o(e.assigned_to,"assignedTo","Unassigned"),t.scope.filters.createdBy=o(e.owners,"createdBy","Unknown"),t.scope.filters.types=n(e.types,"types",t.scope.issueTypeById),t.scope.filters.tags=i(e.tags),t.removeNotExistingFiltersFromUrl(),t.markSelectedFilters(t.scope.filters,r),t.rootscope.$broadcast("filters:loaded",t.scope.filters)}}(this))},e.prototype.loadIssuesRequests=0,e.prototype.loadIssues=function(){var t,e,r,n;this.scope.urlFilters=this.getUrlFilters(),this.scope.httpParams={},r=this.scope.urlFilters;for(t in r)n=r[t],"severities"===t?t="severity":"orderBy"===t?t="order_by":"priorities"===t?t="priority":"assignedTo"===t?t="assigned_to":"createdBy"===t?t="owner":"status"===t?t="status":"types"===t&&(t="type"),this.scope.httpParams[t]=n;return e=this.rs.issues.list(this.scope.projectId,this.scope.httpParams),this.loadIssuesRequests+=1,e.index=this.loadIssuesRequests,e.then(function(t){return function(r){return e.index===t.loadIssuesRequests&&(t.scope.issues=r.models,t.scope.page=r.current,t.scope.count=r.count,t.scope.paginatedBy=r.paginatedBy),r}}(this)),e},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.initializeSubscription(),t.loadFilters(),t.loadIssues()}}(this))},e.prototype.saveCurrentFiltersTo=function(t){var e;return e=this.q.defer(),this.rs.issues.getMyFilters(this.scope.projectId).then(function(r){return function(n){return n[t]=r.location.search(),r.rs.issues.storeMyFilters(r.scope.projectId,n).then(function(){return e.resolve()})}}(this)),e.promise},e.prototype.deleteMyFilter=function(t){var e;return e=this.q.defer(),this.rs.issues.getMyFilters(this.scope.projectId).then(function(r){return function(n){return delete n[t],r.rs.issues.storeMyFilters(r.scope.projectId,n).then(function(){return e.resolve()})}}(this)),e.promise},e.prototype.addNewIssue=function(){return this.rootscope.$broadcast("issueform:new",this.scope.project)},e.prototype.addIssuesInBulk=function(){return this.rootscope.$broadcast("issueform:bulk",this.scope.projectId)},e}(c(d.Controller,d.PageMixin,d.FiltersMixin)),l.controller("IssuesController",r),n=function(t,e,r,n){var i,o,s,a;return a=r.get("issue/issue-paginator.html",!0),s=function(t,e,r,i){var o,s,u,c,l,p,d;return s=2,l=4,u=2,c=2,o=e.find(".issues-paginator"),p=function(){var e;return e=t.count/t.paginatedBy,e=parseInt(e,10)
=f)return void o.hide();for(o.show(),m=[],h={},h.pages=m,h.showPrevious=t.page>1,h.showNext=!(t.page===f),e=t.page,i=d=1,g=f;g>=1?g>=d:d>=g;i=g>=1?++d:--d)i===e+s&&f>e+s+c?m.push({classes:"dots",type:"dots"}):i===e-l&&e>u+l?m.push({classes:"dots",type:"dots"}):i>e+s&&f-c>=i||e-l>i&&i>u||(i===e?m.push({classes:"active",num:i,type:"page-active"}):m.push({classes:"page",num:i,type:"page"}));return r=a(h),r=n(r)(t),o.html(r)},t.$watch("issues",function(t){return t?d():void 0}),e.on("click",".issues-paginator a.next",function(e){return e.preventDefault(),t.$apply(function(){return i.selectFilter("page",t.page+1),i.loadIssues()})}),e.on("click",".issues-paginator a.previous",function(e){return e.preventDefault(),t.$apply(function(){return i.selectFilter("page",t.page-1),i.loadIssues()})}),e.on("click",".issues-paginator li.page > a",function(e){var r,n;return e.preventDefault(),n=angular.element(e.currentTarget),r=n.data("pagenum"),t.$apply(function(){return i.selectFilter("page",r),i.loadIssues()})})},o=function(t,e,r,n){var i,o,s;return o=n.getUrlFilter("orderBy")||"created_date",o&&(s=p(o,"-")?"icon-arrow-up":"icon-arrow-bottom",i=e.find(".row.title > div[data-fieldname='"+h(o,"-")+"']"),i.html(i.html()+"")),e.on("click",".row.title > div",function(r){var i,a,u;return u=angular.element(r.currentTarget),o=n.getUrlFilter("orderBy"),a=u.data("fieldname"),i=o===a?"-"+a:a,t.$apply(function(){return n.replaceFilter("orderBy",i),n.storeFilters(),n.loadIssues().then(function(){return e.find(".row.title > div > span.icon").remove(),s=p(i,"-")?"icon-arrow-up":"icon-arrow-bottom",u.html(u.html()+"")})})})},i=function(t,e,r){var n;return n=e.controller(),o(t,e,r,n),s(t,e,r,n),t.$on("$destroy",function(){return e.off()})},{link:i}},l.directive("tgIssues",["$log","$tgLocation","$tgTemplate","$compile",n]),i=function(t,e,r,n,i,o,a,u,c,l){var p,f,h;return f=a.get("issue/issues-filters.html",!0),h=a.get("issue/issues-filters-selected.html",!0),p=function(e,r,a){var p,m,g,v,y,b,$,S,k,j,I,T;return p=r.closest(".wrapper").controller(),S=[],j=function(t,e){return r.find(".filters-cats").hide(),r.find(".filter-list").removeClass("hidden"),r.find(".breadcrumb").removeClass("hidden"),r.find("h2 .subfilter .title").html(t),r.find("h2 .subfilter .title").prop("data-type",e)},k=function(){return r.find(".filters-cats").show(),r.find(".filter-list").addClass("hidden"),r.find(".breadcrumb").addClass("hidden")},g=function(t){var e,r,n,i,o;S=[];for(n in t)for(o=t[n],e=0,r=o.length;r>e;e++)i=o[e],i.selected&&S.push(i);return b(S)},b=function(t){var n;return _.filter(t,function(t){return function(t){return t.color?t.style="border-left: 3px solid "+t.color:void 0}}(this)),n=h({filters:t}),n=c(n)(e),r.find(".filters-applied").html(n),l.isAuthenticated()&&t.length>0?r.find(".save-filters").show():r.find(".save-filters").hide()},y=function(t){var n;return _.filter(t,function(t){return function(t){return t.color?t.style="border-left: 3px solid "+t.color:void 0}}(this)),n=f({filters:t}),n=c(n)(e),r.find(".filter-list").html(n)},m=function(){return r.find(".subfilter .title").prop("data-type")},v=function(){var r;return r=m(),t.all([p.loadIssues(),p.loadFilters()]).then(function(){var t;return t=e.filters[r],y(_.reject(t,"selected"))})},I=function(t,r){var i,o,s,a;return"myFilters"===t?(n.issues.getMyFilters(e.projectId).then(function(t){var n,i;return i=t,n=i[r],n.page=1,p.replaceAllFilters(n),p.storeFilters(),p.loadIssues(),p.markSelectedFilters(e.filters,n),g(e.filters)}),null):(a=e.filters[t],s="tags"===t?d.toString(r):r,o=_.find(a,{id:s}),o.selected=!o.selected,null===r&&(r="null"),o.selected?(S.push(o),p.selectFilter(t,r),p.selectFilter("page",1),p.storeFilters()):(S=_.reject(S,function(t){return t.id===o.id&&t.type===o.type}),p.unselectFilter(t,r),p.selectFilter("page",1),p.storeFilters()),v(),b(S),i=m(),t===i?y(_.reject(a,"selected")):void 0)},e.$on("filters:loaded",function(t,e){return g(e)}),e.$on("filters:issueupdate",function(t,n){var i;return i=f({filters:n.status}),i=c(i)(e),r.find(".filter-list").html(i)}),$=s(100,function(t,e){return void 0!==t&&t!==e?(p.replaceFilter("page",null,!0),0===t.length?(p.replaceFilter("q",null),p.storeFilters()):(p.replaceFilter("q",t),p.storeFilters()),v()):void 0}),T=e.$watch("issues",function(t){return _.isUndefined(t)?void 0:(e.$watch("filtersQ",$),T())}),r.on("click",".filters-cat-single",function(t){var r,n;return t.preventDefault(),n=angular.element(t.currentTarget),r=e.filters[n.data("type")],y(_.reject(r,"selected")),j(n.attr("title"),n.data("type"))}),r.on("click",".back",function(t){return t.preventDefault(),k(r)}),r.on("click",".filters-applied .remove-filter",function(t){var e,r,n;return t.preventDefault(),r=angular.element(t.currentTarget).parent(),e=r.data("id")||null,n=r.data("type"),I(n,e)}),r.on("click",".filter-list .single-filter",function(t){var e,r,n;return t.preventDefault(),r=angular.element(t.currentTarget),r.toggleClass("active"),e=r.data("id")||null,n=r.data("type"),"myFilters"===n&&r.removeClass("active"),I(n,e)}),r.on("click",".filter-list .remove-filter",function(t){var r,n,o,s;return t.preventDefault(),t.stopPropagation(),o=angular.element(t.currentTarget),r=o.parent().data("id"),s=u.instant("ISSUES.FILTERS.CONFIRM_DELETE.TITLE"),n=u.instant("ISSUES.FILTERS.CONFIRM_DELETE.MESSAGE",{customFilterName:r}),i.askOnDelete(s,n).then(function(t){var n;return n=p.deleteMyFilter(r),n.then(function(){return n=p.loadMyFilters(),n.then(function(r){return t.finish(),e.filters.myFilters=r,y(e.filters.myFilters)}),n.then(null,function(){return t.finish()})}),n.then(null,function(){return t.finish(!1),i.notify("error")})})}),r.on("click",".save-filters",function(t){return t.preventDefault(),y(e.filters.myFilters),j("My filters","myFilters"),r.find(".save-filters").hide(),r.find(".my-filter-name").removeClass("hidden"),r.find(".my-filter-name").focus(),e.$apply()}),r.on("keyup",".my-filter-name",function(t){var n,s,a,u;return t.preventDefault(),13===t.keyCode?(u=angular.element(t.currentTarget),s=u.val(),n=o().target(r.find(".new")).start(),a=p.saveCurrentFiltersTo(s),a.then(function(){var t;return t=p.loadMyFilters(),t.then(function(t){var i;return n.finish(),e.filters.myFilters=t,i=r.find("h2 .subfilter .title").prop("data-type"),"myFilters"===i&&y(e.filters.myFilters),r.find(".my-filter-name").addClass("hidden"),r.find(".save-filters").show()}),t.then(null,function(){return n.finish(),i.notify("error","Error loading custom filters")})}),a.then(null,function(){return n.finish(),r.find(".my-filter-name").val(s).focus().select(),i.notify("error","Filter not saved")})):27===t.keyCode?(r.find(".my-filter-name").val(""),r.find(".my-filter-name").addClass("hidden"),r.find(".save-filters").show()):void 0})},{link:p}},l.directive("tgIssuesFilters",["$q","$log","$tgLocation","$tgResources","$tgConfirm","$tgLoading","$tgTemplate","$translate","$compile","$tgAuth",i]),e=function(t,e,r){var n,i,o;return i=e.get("issue/issue-status-inline-edition-selection.html",!0),o=function(t,e,r){var n,i,o;return i=t.find(".issue-status"),n=t.find(".issue-status .issue-status-bind"),o=r[e.status],o?(n.text(o.name),n.prop("title",o.name),i.css("color",o.color)):void 0},n=function(e,n,s){var a,u;return a=n.controller(),u=e.$eval(s.tgIssueStatusInlineEdition),n.on("click",".issue-status",function(t){return t.preventDefault(),t.stopPropagation(),n.find(".pop-status").popover().open()}),n.on("click",".status",function(i){var s,c,l,p,d;for(i.preventDefault(),i.stopPropagation(),d=angular.element(i.currentTarget),p=e.filters.status,c=0,l=p.length;l>c;c++)s=p[c],s.id===u.status&&s.count--;return u.status=d.data("status-id"),n.find(".pop-status").popover().close(),o(n,u,e.issueStatusById),e.$apply(function(){var n,i,o;for(t.save(u).then(function(){return a.loadIssues()}),o=e.filters.status,n=0,i=o.length;i>n;n++)s=o[n],s.id===u.status&&s.count++;return r.$broadcast("filters:issueupdate",e.filters)})}),d.bindOnce(e,"project",function(t){return n.append(i({statuses:t.issue_statuses})),o(n,u,e.issueStatusById),-1===t.my_permissions.indexOf("modify_issue")?(n.unbind("click"),n.find("a").addClass("not-clickable")):void 0}),e.$watch(s.tgIssueStatusInlineEdition,function(t){return function(t){return o(n,t,e.issueStatusById)}}(this)),e.$on("$destroy",function(){return n.off()})},{link:n}},l.directive("tgIssueStatusInlineEdition",["$tgRepo","$tgTemplate","$rootScope",e]),t=function(t,e,r){var n,i;return i=_.template('
\n<%- name %>'),n=function(n,o,s){var a,u,c;return c=function(t){var e,s;return e={name:r.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED"),imgurl:"/"+window._version+"/images/unnamed.png"},s=n.usersById[t.assigned_to],s&&(e.name=s.full_name_display,e.imgurl=s.photo),o.find(".avatar").html(i(e)),o.find(".issue-assignedto").attr("title",e.name)},a=o.controller(),u=n.$eval(s.tgIssueAssignedToInlineEdition),c(u),o.on("click",".issue-assignedto",function(t){return e.$broadcast("assigned-to:add",u)}),d.bindOnce(n,"project",function(t){return-1===t.my_permissions.indexOf("modify_issue")?(o.unbind("click"),o.find("a").addClass("not-clickable")):void 0}),n.$on("assigned-to:added",function(e){return function(e,r,n){return n.id===u.id?(n.assigned_to=r,t.save(n),c(n)):void 0}}(this)),n.$watch(s.tgIssueAssignedToInlineEdition,function(t){return function(t){return c(t)}}(this)),n.$on("$destroy",function(){return o.off()})},{link:n}},l.directive("tgIssueAssignedToInlineEdition",["$tgRepo","$rootScope","$translate",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty;l=this.taiga,u=this.taiga.mixOf,a=this.taiga.groupBy,s=this.taiga.bindOnce,o=this.taiga.bindMethods,c=angular.module("taigaUserStories"),i=function(t){function e(t,e,r,n,i,s,a,u,c,l,p,d,f,h){var m;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=s,this.q=a,this.location=u,this.log=c,this.appMetaService=l,this.navUrls=p,this.analytics=d,this.translate=f,this.modelTransform=h,o(this),this.scope.usRef=this.params.usref,this.scope.sectionName=this.translate.instant("US.SECTION_NAME"),this.initializeEventHandlers(),m=this.loadInitialData(),m.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),m.then(null,this.onInitialDataError.bind(this))}return p(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate","$tgQueueModelTransformation"],e.prototype._setMeta=function(){var t,e,r,n,i,o;return o=this.scope.tasks.length,t=_.filter(this.scope.tasks,function(t){return function(e){return t.scope.taskStatusById[e.status].is_closed}}(this)).length,r=o>0?Math.round(100*t/o):0,i=this.translate.instant("US.PAGE_TITLE",{userStoryRef:"#"+this.scope.us.ref,userStorySubject:this.scope.us.subject,projectName:this.scope.project.name}),e=this.translate.instant("US.PAGE_DESCRIPTION",{userStoryStatus:(null!=(n=this.scope.statusById[this.scope.us.status])?n.name:void 0)||"--",userStoryPoints:this.scope.us.total_points,userStoryDescription:angular.element(this.scope.us.description_html||"").text(),userStoryClosedTasks:t,userStoryTotalTasks:o,userStoryProgressPercentage:r}),this.appMetaService.setAll(i,e)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("related-tasks:update",function(t){return function(){var e;return t.scope.tasks=_.clone(t.scope.tasks,!1),e=_.every(t.scope.tasks,function(t){return t.is_closed}),t.scope.us.is_closed!==e?t.loadUs():void 0}}(this)),this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on userstory",1)}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadUs()}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;return t={project:this.scope.project.slug},this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",t),this.scope.project.is_backlog_activated?this.scope.us.milestone?(t.sprint=this.scope.sprint.slug,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-taskboard",t)):this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-backlog",t):this.scope.project.is_kanban_activated?this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-kanban",t):void 0},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.statusList=e.us_statuses,t.scope.statusById=a(e.us_statuses,function(t){return t.id}),t.scope.taskStatusById=a(e.task_statuses,function(t){return t.id}),t.scope.pointsList=_.sortBy(e.points,"order"),t.scope.pointsById=a(t.scope.pointsList,function(t){return t.id}),e}}(this))},e.prototype.loadUs=function(){var t,e,r,n;return t=_.pick(this.location.search(),"milestone","no-milestone","kanban-status"),r=t.milestone,r&&this.rs.userstories.storeQueryParams(this.scope.projectId,{milestone:r,order_by:"sprint_order"}),n=t["no-milestone"],n&&this.rs.userstories.storeQueryParams(this.scope.projectId,{milestone:"null",order_by:"backlog_order"}),e=t["kanban-status"],e&&this.rs.userstories.storeQueryParams(this.scope.projectId,{status:e,order_by:"kanban_order"}),this.rs.userstories.getByRef(this.scope.projectId,this.params.usref).then(function(t){return function(e){var r,n,i;return t.scope.us=e,t.scope.usId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"us"),null!=(null!=(n=t.scope.us.neighbors.previous)?n.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.us.neighbors.previous.ref},t.scope.previousUrl=t.navUrls.resolve("project-userstories-detail",r)),null!=(null!=(i=t.scope.us.neighbors.next)?i.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.us.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-userstories-detail",r)),e}}(this))},e.prototype.loadSprint=function(){return this.scope.us.milestone?this.rs.sprints.get(this.scope.us.project,this.scope.us.milestone).then(function(t){return function(e){return t.scope.sprint=e,e}}(this)):void 0},e.prototype.loadTasks=function(){return this.rs.tasks.list(this.scope.projectId,null,this.scope.usId).then(function(t){return function(e){return t.scope.tasks=e,e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.loadUs().then(function(){return t.q.all([t.loadSprint(),t.loadTasks()])})}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.upvote(this.scope.usId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.downvote(this.scope.usId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.watch(this.scope.usId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.unwatch(this.scope.usId).then(e,t)},e}(u(l.Controller,l.PageMixin)),c.controller("UserStoryDetailController",i),r=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:i.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){return null!=t?o(t):void 0}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},c.directive("tgUsStatusDisplay",["$tgTemplate","$compile",r]),e=function(t,e,r,n,i,o,s){var a,u;return u=o.get("common/components/status-button.html",!0),a=function(e,o,a,c){var l,p,d;return l=function(){return-1!==e.project.my_permissions.indexOf("modify_us")},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=u({status:n,statuses:e.statusList,editable:l()}),o.html(r),s(o.contents())(e)}}(this),d=function(e){return function(e){var s,a,u,c;return o.find(".pop-status").popover().close(),s=n().target(o.find(".js-edit-status")).start(),c=i.save(function(t){return t.status=e,t}),u=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},c.then(u,a)}}(this),o.on("click",".js-edit-status",function(t){return t.preventDefault(),t.stopPropagation(),l()?o.find(".pop-status").popover().open():void 0}),o.on("click",".status",function(t){var e,r;return t.preventDefault(),t.stopPropagation(),l()?(r=angular.element(t.currentTarget),e=r.data("status-id"),d(e)):void 0}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.status:void 0},function(){
-var t;return t=c.$modelValue,t?p(t):void 0}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},c.directive("tgUsStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",e]),n=function(t,e,r,n,i,o,s){var a,u;return u=o.get("us/us-team-requirement-button.html",!0),a=function(e,o,a,c){var l,p,d;return l=function(){return-1!==e.project.my_permissions.indexOf("modify_us")},p=function(t){var r,n;return r={canEdit:l(),isRequired:t.team_requirement},n=u(r),n=s(n)(e),o.html(n)},d=function(e){var s,a;return s=n().target(o.find("label")).start(),a=i.save(function(t){return t.team_requirement=e,t}),a.then(function(e){return function(){return s.finish(),t.$broadcast("object:updated")}}(this)),a.then(null,function(){return s.finish(),r.notify("error")})},o.on("click",".team-requirement",function(t){var e;if(l())return e=!c.$modelValue.team_requirement,d(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.team_requirement:void 0},function(){var t;return t=c.$modelValue,t?p(t):void 0}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},c.directive("tgUsTeamRequirementButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",n]),t=function(t,e,r,n,i,o,s){var a,u;return u=o.get("us/us-client-requirement-button.html",!0),a=function(e,o,a,c){var l,p,d;return l=function(){return-1!==e.project.my_permissions.indexOf("modify_us")},p=function(t){var r,n;return r={canEdit:l(),isRequired:t.client_requirement},n=s(u(r))(e),o.html(n)},d=function(e){var s,a;return s=n().target(o.find("label")).start(),a=i.save(function(t){return t.client_requirement=e,t}),a.then(function(e){return function(){return s.finish(),t.$broadcast("object:updated")}}(this)),a.then(null,function(){return r.notify("error")})},o.on("click",".client-requirement",function(t){var e;if(l())return e=!c.$modelValue.client_requirement,d(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.client_requirement:void 0},function(){var t;return t=c.$modelValue,t?p(t):void 0}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},c.directive("tgUsClientRequirementButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;u=this.taiga,s=this.taiga.mixOf,o=this.taiga.groupBy,i=this.taiga.bindMethods,a=angular.module("taigaTasks"),t=function(t){function e(t,e,r,n,o,s,a,u,c,l,p,d,f,h){var m;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=o,this.params=s,this.q=a,this.location=u,this.log=c,this.appMetaService=l,this.navUrls=p,this.analytics=d,this.translate=f,this.modelTransform=h,i(this),this.scope.taskRef=this.params.taskref,this.scope.sectionName=this.translate.instant("TASK.SECTION_NAME"),this.initializeEventHandlers(),m=this.loadInitialData(),m.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),m.then(null,this.onInitialDataError.bind(this))}return c(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate","$tgQueueModelTransformation"],e.prototype._setMeta=function(){var t,e,r;return r=this.translate.instant("TASK.PAGE_TITLE",{taskRef:"#"+this.scope.task.ref,taskSubject:this.scope.task.subject,projectName:this.scope.project.name}),t=this.translate.instant("TASK.PAGE_DESCRIPTION",{taskStatus:(null!=(e=this.scope.statusById[this.scope.task.status])?e.name:void 0)||"--",taskDescription:angular.element(this.scope.task.description_html||"").text()}),this.appMetaService.setAll(r,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on task",1)}}(this)),this.scope.$on("custom-attributes-values:edit",function(t){return function(){return t.rootscope.$broadcast("object:updated")}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadTask()}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;if(t={project:this.scope.project.slug},this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",t),this.scope.project.is_backlog_activated){if(this.scope.task.milestone)return t.sprint=this.scope.sprint.slug,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-taskboard",t);if(this.scope.task.us)return t.ref=this.scope.us.ref,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-userstories-detail",t)}else if(this.scope.project.is_kanban_activated&&this.scope.us)return t.ref=this.scope.us.ref,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-userstories-detail",t)},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.statusList=e.task_statuses,t.scope.statusById=o(e.task_statuses,function(t){return t.id}),e}}(this))},e.prototype.loadTask=function(){return this.rs.tasks.getByRef(this.scope.projectId,this.params.taskref).then(function(t){return function(e){var r,n,i;return t.scope.task=e,t.scope.taskId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"task"),null!=(null!=(n=t.scope.task.neighbors.previous)?n.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.task.neighbors.previous.ref},t.scope.previousUrl=t.navUrls.resolve("project-tasks-detail",r)),null!=(null!=(i=t.scope.task.neighbors.next)?i.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.task.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-tasks-detail",r)),e}}(this))},e.prototype.loadSprint=function(){return this.scope.task.milestone?this.rs.sprints.get(this.scope.task.project,this.scope.task.milestone).then(function(t){return function(e){return t.scope.sprint=e,e}}(this)):void 0},e.prototype.loadUserStory=function(){return this.scope.task.user_story?this.rs.userstories.get(this.scope.task.project,this.scope.task.user_story).then(function(t){return function(e){return t.scope.us=e,e}}(this)):void 0},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.loadTask().then(function(){return t.q.all([t.loadSprint(),t.loadUserStory()])})}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.upvote(this.scope.taskId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.downvote(this.scope.taskId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.watch(this.scope.taskId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.unwatch(this.scope.taskId).then(e,t)},e}(s(u.Controller,u.PageMixin)),a.controller("TaskDetailController",t),n=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:s.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){return null!=t?o(t):void 0}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},a.directive("tgTaskStatusDisplay",["$tgTemplate","$compile",n]),r=function(t,e,r,n,i,o,s,a){var u,c;return c=a.get("common/components/status-button.html",!0),u=function(e,s,a,u){var l,p,d;return l=function(){return-1!==e.project.my_permissions.indexOf("modify_task")},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=o(c({status:n,statuses:e.statusList,editable:l()}))(e),s.html(r)}}(this),d=function(e){var o,a,u,c;return o=n().target(s).start(),c=i.save(function(t){return t.status=e,t}),u=function(){return t.$broadcast("object:updated"),o.finish()},a=function(){return r.notify("error"),o.finish()},c.then(u,a)},s.on("click",".js-edit-status",function(t){return t.preventDefault(),t.stopPropagation(),l()?s.find(".pop-status").popover().open():void 0}),s.on("click",".status",function(t){var e;return t.preventDefault(),t.stopPropagation(),l()?(e=angular.element(t.currentTarget),$.fn.popover().closeAll(),d(e.data("status-id"))):void 0}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.status:void 0},function(){var t;return t=u.$modelValue,t?p(t):void 0}),e.$on("$destroy",function(){return s.off()})},{link:u,restrict:"EA",require:"ngModel"}},a.directive("tgTaskStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$compile","$translate","$tgTemplate",r]),e=function(t,e,r,n,i,o,s){var a,u;return u=s.get("issue/iocaine-button.html",!0),a=function(e,s,a,c){var l,p,d;return l=function(){return-1!==e.project.my_permissions.indexOf("modify_task")},p=function(t){var r,n;return l()||t.is_iocaine?(r={isIocaine:t.is_iocaine,isEditable:l()},n=o(u(r))(e),s.html(n)):void s.html("")},d=function(e){var o,a;return o=n().target(s.find("label")).start(),a=i.save(function(t){return t.is_iocaine=e,t}),a.then(function(){return t.$broadcast("object:updated")}),a.then(null,function(){return r.notify("error")}),a["finally"](function(){return o.finish()})},s.on("click",".is-iocaine",function(t){var e;if(l())return e=!c.$modelValue.is_iocaine,d(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.is_iocaine:void 0},function(){var t;return t=c.$modelValue,t?p(t):void 0}),e.$on("$destroy",function(){return s.off()})},{link:a,restrict:"EA",require:"ngModel"}},a.directive("tgTaskIsIocaineButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$compile","$tgTemplate",e])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;c=this.taiga,a=this.taiga.mixOf,u=angular.module("taigaTeam"),e=function(t){function e(t,e,r,n,i,o,s,a,u,c,l,p){var d;this.scope=t,this.rootscope=e,this.repo=r,this.rs=n,this.params=i,this.q=o,this.location=s,this.navUrls=a,this.appMetaService=u,this.auth=c,this.translate=l,this.projectService=p,this.scope.sectionName="TEAM.SECTION_NAME",d=this.loadInitialData(),d.then(function(t){return function(){var e,r;return r=t.translate.instant("TEAM.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.translate.instant("TEAM.PAGE_DESCRIPTION",{projectName:t.scope.project.name,projectDescription:t.scope.project.description}),t.appMetaService.setAll(r,e)}}(this)),d.then(null,this.onInitialDataError.bind(this))}return l(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgResources","$routeParams","$q","$location","$tgNavUrls","tgAppMetaService","$tgAuth","$translate","tgProjectService"],e.prototype.setRole=function(t){return t?this.scope.filtersRole=t:this.scope.filtersRole=null},e.prototype.loadMembers=function(){var t,e,r,n,i;for(i=this.auth.getUser(),this.scope.totals={},n=this.scope.activeUsers,t=0,e=n.length;e>t;t++)r=n[t],this.scope.totals[r.id]=0;return this.scope.currentUser=_.find(this.scope.activeUsers,{id:null!=i?i.id:void 0}),this.scope.memberships=_.reject(this.scope.activeUsers,{id:null!=i?i.id:void 0})},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.issuesEnabled=e.is_issues_activated,t.scope.tasksEnabled=e.is_kanban_activated||e.is_backlog_activated,t.scope.wikiEnabled=e.is_wiki_activated,t.scope.owner=e.owner.id,e}}(this))},e.prototype.loadMemberStats=function(){return this.rs.projects.memberStats(this.scope.projectId).then(function(t){return function(e){var r;return r={},_.forEach(t.scope.totals,function(r,n){var i;return i=_.map(e,function(t,e){return t[n]}),r=_.reduce(i,function(t,e){return t+e}),t.scope.totals[n]=r}),t.scope.stats=t._processStats(e),t.scope.stats.totals=t.scope.totals}}(this))},e.prototype._processStat=function(t){var e,r,n,i,o;r=_.max(_.toArray(t)),n=_.min(_.toArray(t)),i=Object();for(e in t)p.call(t,e)&&(o=t[e],o===n?i[e]=.1:o===r?i[e]=1:i[e]=.5*o/r);return i},e.prototype._processStats=function(t){var e,r;for(e in t)r=t[e],t[e]=this._processStat(r);return t},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){var r;return t.fillUsersAndRoles(e.members,e.roles),t.loadMembers(),r=_.map(t.scope.users,function(t){return t.role}),t.scope.roles=_.filter(t.scope.roles,function(t){return-1!==r.indexOf(t.id)}),t.loadMemberStats()}}(this))},e}(a(c.Controller,c.PageMixin)),u.controller("TeamController",e),r=function(){return{templateUrl:"team/team-filter.html"}},u.directive("tgTeamFilters",[r]),i=function(){return{templateUrl:"team/team-member-stats.html",scope:{stats:"=",userId:"=user",issuesEnabled:"=issuesenabled",tasksEnabled:"=tasksenabled",wikiEnabled:"=wikienabled"}}},u.directive("tgTeamMemberStats",i),n=function(){return{templateUrl:"team/team-member-current-user.html",scope:{project:"=project",currentUser:"=currentuser",stats:"=",issuesEnabled:"=issuesenabled",tasksEnabled:"=tasksenabled",wikiEnabled:"=wikienabled",owner:"=owner"}}},u.directive("tgTeamCurrentUser",n),o=function(){var t;return t="team/team-members.html",{templateUrl:t,scope:{memberships:"=",filtersQ:"=filtersq",filtersRole:"=filtersrole",stats:"=",issuesEnabled:"=issuesenabled",tasksEnabled:"=tasksenabled",wikiEnabled:"=wikienabled",owner:"=owner"}}},u.directive("tgTeamMembers",o),t=function(t,e,r,n,i,o,s,a){var u;return u=function(t,u,c){var l;return l=function(){var s,u;return u=o.instant("TEAM.ACTION_LEAVE_PROJECT"),s=o.instant("TEAM.CONFIRM_LEAVE_PROJECT"),e.ask(u,s).then(function(o){return function(o){var s;return s=n.projects.leave(t.project.id),s.then(function(){return a.loadProjects().then(function(){return o.finish(),e.notify("success"),r.path(i.resolve("home"))})}),s.then(null,function(t){return t.finish(),e.notify("error",t.data._error_message)})}}(this))},t.leave=function(){return t.project.owner.id===t.user.id?s.create("tg-lightbox-leave-project-warning",{"class":"lightbox lightbox-leave-project-warning"},{isCurrentUser:!0,project:t.project}):l()}},{scope:{user:"=",project:"="},templateUrl:"team/leave-project.html",link:u}},u.directive("tgLeaveProject",["$tgRepo","$tgConfirm","$tgLocation","$tgResources","$tgNavUrls","$translate","tgLightboxFactory","tgCurrentUserService",t]),s=function(){return function(t,e,r){return _.filter(t,function(t){return(!r||t.role===r.id)&&(!e||t.full_name.search(new RegExp(e,"i"))>=0)})}},u.filter("membersFilter",s)}.call(this),function(){var t,e,r,n,i,o,s,a,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;u=this.taiga,s=this.taiga.mixOf,o=this.taiga.groupBy,n=this.taiga.bindOnce,i=this.taiga.debounce,a=angular.module("taigaWiki"),e=function(t){function e(t,e,r,n,i,o,s,a,u,c,l,p,d,f,h){var m;this.scope=t,this.rootscope=e,this.repo=r,this.model=n,this.confirm=i,this.rs=o,this.params=s,this.q=a,this.location=u,this.filter=c,this.log=l,this.appMetaService=p,this.navUrls=d,this.analytics=f,this.translate=h,this.scope.projectSlug=this.params.pslug,this.scope.wikiSlug=this.params.slug,this.scope.wikiTitle=this.scope.wikiSlug,this.scope.sectionName="Wiki",this.scope.linksVisible=!1,m=this.loadInitialData(),m.then(function(t){return function(){return t._setMeta()}}(this)),m.then(null,this.onInitialDataError.bind(this))}return c(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$filter","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate"],e.prototype._setMeta=function(){var t,e,r,n,i;return i=this.translate.instant("WIKI.PAGE_TITLE",{wikiPageName:this.scope.wikiTitle,projectName:this.scope.project.name}),t=this.translate.instant("WIKI.PAGE_DESCRIPTION",{wikiPageContent:angular.element((null!=(e=this.scope.wiki)?e.html:void 0)||"").text(),totalEditions:(null!=(r=this.scope.wiki)?r.editions:void 0)||0,lastModifiedDate:moment(null!=(n=this.scope.wiki)?n.modified_date:void 0).format(this.translate.instant("WIKI.DATETIME"))}),this.appMetaService.setAll(i,t)},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.is_wiki_activated||t.location.path(t.navUrls.resolve("permission-denied")),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadWiki=function(){var t;return t=this.rs.wiki.getBySlug(this.scope.projectId,this.params.slug),t.then(function(t){return function(e){return t.scope.wiki=e,t.scope.wikiId=e.id,t.scope.wiki}}(this)),t.then(null,function(t){return function(e){var r;return t.scope.wikiId=null,-1===t.scope.project.my_permissions.indexOf("add_wiki_page")?null:(r={project:t.scope.projectId,slug:t.scope.wikiSlug,content:""},t.scope.wiki=t.model.make_model("wiki",r),t.scope.wiki)}}(this))},e.prototype.loadWikiLinks=function(){return this.rs.wiki.listLinks(this.scope.projectId).then(function(t){return function(e){var r,n,i,o,s;for(t.scope.wikiLinks=e,o=t.scope.wikiLinks,r=0,n=o.length;n>r;r++)i=o[r],i.url=t.navUrls.resolve("project-wiki-page",{project:t.scope.projectSlug,slug:i.href});return s=_.find(e,{href:t.scope.wikiSlug}),null!=s?t.scope.wikiTitle=s.title:void 0}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(e){return t.fillUsersAndRoles(e.members,e.roles),t.q.all([t.loadWikiLinks(),t.loadWiki()]).then(t.checkLinksPerms.bind(t))}}(this))},e.prototype.checkLinksPerms=function(){return-1!==this.scope.project.my_permissions.indexOf("modify_wiki_link")||-1!==this.scope.project.my_permissions.indexOf("view_wiki_links")&&this.scope.wikiLinks.length?this.scope.linksVisible=!0:void 0},e.prototype["delete"]=function(){var t,e;return e=this.translate.instant("WIKI.DELETE_LIGHTBOX_TITLE"),t=this.scope.wikiTitle,this.confirm.askOnDelete(e,t).then(function(t){return function(e){var r,n;return n=function(){var r;return e.finish(),r={project:t.scope.projectSlug},t.location.path(t.navUrls.resolve("project-wiki",r)),t.confirm.notify("success")},r=function(){return e.finish(!1),t.confirm.notify("error")},t.repo.remove(t.scope.wiki).then(n,r)}}(this))},e}(s(u.Controller,u.PageMixin)),a.controller("WikiDetailController",e),r=function(t,e,r,n){var i,o;return o=e.get("wiki/wiki-summary.html",!0),i=function(e,i,s,a){var u;return u=function(s){var a,u,c;return null==e.usersById?t.error("WikiSummaryDirective requires userById set in scope."):c=e.usersById[s.last_modifier],c=void 0===c?{name:"unknown",imgUrl:"/"+window._version+"/images/user-noimage.png"}:{name:c.full_name_display,imgUrl:c.photo},a={totalEditions:s.editions,lastModifiedDate:moment(s.modified_date).format(n.instant("WIKI.DATETIME")),user:c},u=o(a),u=r(u)(e),i.html(u)},e.$watch(s.ngModel,function(t){return t?u(t):void 0}),e.$on("$destroy",function(){return i.off()})},{link:i,restrict:"EA",require:"ngModel"}},a.directive("tgWikiSummary",["$log","$tgTemplate","$compile","$translate",r]),t=function(t,e,r,n,o,s,a,u){var c;return c=function(c,l,p,d){var f,h,m,g,v,_,y;return g=function(){return-1!==c.project.my_permissions.indexOf("modify_wiki_page")},_=function(){return l.find(".edit-wiki-content").show(),l.find(".view-wiki-content").hide(),l.find("textarea").focus()},y=function(){return l.find(".edit-wiki-content").hide(),l.find(".view-wiki-content").show()},h=function(){return l.find(".view-wiki-content .edit").remove(),l.find(".edit-wiki-content").remove()},f=function(){return d.$modelValue.id?(d.$modelValue.revert(),y()):void 0},m=function(){return t.getSelection?t.getSelection().toString():e.selection?e.selection.createRange().text:null},v=a.bindAdd(function(t){var e,i,a,u;return a=function(e){return null==t.id&&s.trackEvent("wikipage","create","create wiki page",1),d.$setViewValue(e.clone()),n.notify("success"),y()},i=function(){return n.notify("error")},e=o().removeClasses("icon-floppy").target(l.find(".icon-floppy")).start(),u=null!=t.id?r.save(t).then(a,i):r.create("wiki",t).then(a,i),u["finally"](function(){return e.finish()})}),l.on("click","a",function(t){var e,r;return r=angular.element(t.currentTarget),e=r.attr("href"),0===e.indexOf("#")?(t.preventDefault(),$("body").scrollTop($(e).offset().top)):void 0}),l.on("mousedown",".view-wiki-content",function(t){var e;e=angular.element(t.target),g()&&2===t.button}),l.on("mouseup",".view-wiki-content",function(t){var e;return e=angular.element(t.target),m()||!g()||e.is("a")||e.is("pre")?void 0:_()}),l.on("click",".save",i(2e3,function(){return v(c.wiki)})),l.on("click",".cancel",function(){return c.$apply(f)}),l.on("keydown","textarea",function(t){return 27===t.keyCode?c.$applyAsync(function(){var t,e;return e=u.instant("COMMON.CONFIRM_CLOSE_EDIT_MODE_TITLE"),t=u.instant("COMMON.CONFIRM_CLOSE_EDIT_MODE_MESSAGE"),n.ask(e,null,t).then(function(t){return f(),t.finish()})}):void 0}),c.$watch(p.ngModel,function(t){return t?g()?(l.addClass("editable"),null==t.id||0===$.trim(t.content).length?_():void 0):h():void 0}),c.$on("$destroy",function(){return l.off()})},{link:c,restrict:"EA",require:"ngModel",templateUrl:"wiki/editable-wiki-content.html"}},a.directive("tgEditableWikiContent",["$window","$document","$tgRepo","$tgConfirm","$tgLoading","$tgAnalytics","$tgQqueue","$translate",t])}.call(this),function(){var t,e,r,n,i,o;o=this.taiga,n=this.taiga.mixOf,r=this.taiga.groupBy,e=this.taiga.bindOnce,i=angular.module("taigaWiki"),t=function(t,r,n,i,o,s,a,u,c){var l,p;return p=a.get("wiki/wiki-nav.html",!0),l=function(n,a,l){var d,f;return d=a.controller(),null==l.ngModel?r.error("WikiNavDirective: no ng-model attr is defined"):(f=function(e){var r,l,h;return r=n.project.my_permissions.indexOf("add_wiki_link")>-1,l=n.project.my_permissions.indexOf("delete_wiki_link")>-1,h=p({wikiLinks:e,projectSlug:n.projectSlug,addWikiLinkPermission:r,deleteWikiLinkPermission:l}),h=u(h)(n),a.off(),a.html(h),a.on("click",".add-button",function(t){return t.preventDefault(),a.find(".new").removeClass("hidden"),a.find(".new input").focus(),a.find(".add-button").hide()}),a.on("click",".js-delete-link",function(e){var r,o,s,a;return e.preventDefault(),e.stopPropagation(),s=angular.element(e.currentTarget),r=s.parents(".wiki-link").data("id"),a=c.instant("WIKI.DELETE_LIGHTBOX_TITLE"),o=n.wikiLinks[r].title,i.askOnDelete(a,o).then(function(e){return function(e){var o;return o=t.remove(n.wikiLinks[r]),o.then(function(){return o=d.loadWikiLinks(),o.then(function(){return e.finish(),f(n.wikiLinks)}),o.then(null,function(){return e.finish()})}),o.then(null,function(){return e.finish(!1),i.notify("error")})}}(this))}),a.on("keyup",".new input",function(e){var r,u,c,l;return e.preventDefault(),13===e.keyCode?(l=angular.element(e.currentTarget),u=l.val(),r=s().target(a.find(".new")).start(),c=t.create("wiki-links",{project:n.projectId,title:u}),c.then(function(){var t;return o.trackEvent("wikilink","create","create wiki link",1),t=d.loadWikiLinks(),t.then(function(){return r.finish(),a.find(".new").addClass("hidden"),a.find(".new input").val(""),a.find(".add-button").show(),f(n.wikiLinks)}),t.then(null,function(){return r.finish(),a.find(".new").addClass("hidden"),a.find(".new input").val(""),a.find(".add-button").show(),i.notify("error","Error loading wiki links")})}),c.then(null,function(t){var e;return r.finish(),a.find(".new input").val(u),a.find(".new input").focus().select(),null!=(null!=t&&null!=(e=t.__all__)?e[0]:void 0)?i.notify("error","The link already exists"):i.notify("error")})):27===e.keyCode?(l=angular.element(e.currentTarget),a.find(".new").addClass("hidden"),a.find(".new input").val(""),a.find(".add-button").show()):void 0})},e(n,l.ngModel,f))},{link:l}},i.directive("tgWikiNav",["$tgRepo","$log","$tgLocation","$tgConfirm","$tgAnalytics","$tgLoading","$tgTemplate","$compile","$translate",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c;c=this.taiga,a=this.taiga.debounce,u=angular.module("taigaKanban"),n=function(){function t(t,e,r,n,i,o){var s;this.scope=t,this.lightboxService=e,this.tgLoader=r,this.confirm=n,this.rs=i,this.rootScope=o,this._defaultMaxInvites=4,this._defaultRole=this.project.roles[0].id,this.form=null,this.submitInvites=!1,this.canAddUsers=!0,this.memberInvites=[],null===this.project.max_memberships?this.membersLimit=this._defaultMaxInvites:(s=Math.max(this.project.max_memberships-this.project.total_memberships,0),this.membersLimit=Math.min(s,this._defaultMaxInvites)),this.addSingleMember()}return t.$inject=["$scope","lightboxService","tgLoader","$tgConfirm","$tgResources","$rootScope"],t.prototype.addSingleMember=function(){return this.memberInvites.push({email:"",role_id:this._defaultRole}),this.memberInvites.length>=this.membersLimit&&(this.canAddUsers=!1),this.showWarningMessage=!this.canAddUsers&&this.project.total_memberships+this.memberInvites.length===this.project.max_memberships},t.prototype.removeSingleMember=function(t){return this.memberInvites.splice(t,1),this.canAddUsers=!0,this.showWarningMessage=1===this.membersLimit},t.prototype.submit=function(){var t;return this.form.initializeFields(),this.form.reset(),this.form.validate()?(this.memberInvites=_.filter(this.memberInvites,function(t){return""!==t.email}),this.submitInvites=!0,t=this.rs.memberships.bulkCreateMemberships(this.project.id,this.memberInvites,this.invitationText),t.then(this._onSuccessInvite.bind(this),this._onErrorInvite.bind(this))):void 0},t.prototype._onSuccessInvite=function(){return this.submitInvites=!1,this.rootScope.$broadcast("membersform:new:success"),this.lightboxService.closeAll(),this.confirm.notify("success")},t.prototype._onErrorInvite=function(t){return this.submitInvites=!1,this.form.setErrors(t.data),t.data._error_message?this.confirm.notify("error",t.data._error_message):void 0},t}(),u.controller("LbAddMembersController",n),i=function(t){var e;return e=function(e,r,n,i){return t.open(r),i.form=r.find("form").checksley()},{scope:{},bindToController:{project:"="},controller:"LbAddMembersController",controllerAs:"vm",templateUrl:"admin/lightbox-add-members.html",link:e}},u.directive("tgLbAddMembers",["lightboxService",i]),o=function(){return{templateUrl:"admin/lightbox-add-members-no-more=memberships-warning-message.html",scope:{project:"="}}},u.directive("tgLightboxAddMembersWarningMessage",[o]),r=function(t,e,r,n){return{link:function(i,o){return t.open(o),i.request=function(){return i.loading=!0,e.projects.transferRequest(i.projectId).then(function(){return i.loading=!1,t.close(o),r.notify("success",n.instant("ADMIN.PROJECT_PROFILE.REQUEST_OWNERSHIP_SUCCESS"))})}},templateUrl:"common/lightbox/lightbox-request-ownership.html"}},u.directive("tgLbRequestOwnership",["lightboxService","tgResources","$tgConfirm","$translate",r]),t=function(){function t(t,e,r,n){this.rs=t,this.lightboxService=e,this.confirm=r,this.translate=n,this.users=[],this.q="",this.commentOpen=!1}return t.prototype.limit=3,t.prototype.normalizeString=function(t){return t=t.replace("Á","A").replace("Ä","A").replace("À","A"),t=t.replace("É","E").replace("Ë","E").replace("È","E"),t=t.replace("Í","I").replace("Ï","I").replace("Ì","I"),t=t.replace("Ó","O").replace("Ö","O").replace("Ò","O"),t=t.replace("Ú","U").replace("Ü","U").replace("Ù","U")},t.prototype.filterUsers=function(t){var e,r;return r=t.full_name_display.toUpperCase(),r=this.normalizeString(r),e=this.q.toUpperCase(),e=this.normalizeString(e),_.includes(r,e)},t.prototype.getUsers=function(){var t;return t=this.users.length||this.q.length?this.users:this.activeUsers,t=t.slice(0,this.limit),t=_.reject(t,{selected:!0}),_.reject(t,{id:this.currentOwnerId})},t.prototype.userSearch=function(){return this.users=this.activeUsers,this.selected=_.find(this.users,{selected:!0}),this.q?this.users=_.filter(this.users,this.filterUsers.bind(this)):void 0},t.prototype.selectUser=function(t){return this.activeUsers=_.map(this.activeUsers,function(t){return t.selected=!1,t}),t.selected=!0,this.userSearch()},t.prototype.submit=function(){return this.loading=!0,this.rs.projects.transferStart(this.projectId,this.selected.id,this.comment).then(function(t){return function(){var e,r;return t.loading=!1,t.lightboxService.closeAll(),r=t.translate.instant("ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_TITLE"),e=t.translate.instant("ADMIN.PROJECT_PROFILE.CHANGE_OWNER_SUCCESS_DESC"),t.confirm.success(r,e,{type:"svg",name:"icon-speak-up"})}}(this))},t}(),t.$inject=["tgResources","lightboxService","$tgConfirm","$translate"],u.controller("ChangeOwnerLightbox",t),e=function(t,e,r,n){var i;return i=function(e,r){return t.open(r)},{scope:!0,controller:"ChangeOwnerLightbox",controllerAs:"vm",bindToController:{currentOwnerId:"=",projectId:"=",activeUsers:"="},templateUrl:"common/lightbox/lightbox-change-owner.html",link:i}},u.directive("tgLbChangeOwner",["lightboxService","lightboxKeyboardNavigationService","$tgTemplate","$compile",e]),s=function(t){var e;return e=function(e,r){return e.close=function(){return t.close(r)},t.open(r)},{templateUrl:"common/lightbox/lightbox-transfer-project-start-success.html",link:e}},u.directive("tgLbTransferProjectStartSuccess",["lightboxService",s])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty;l=this.taiga,u=this.taiga.mixOf,a=this.taiga.bindMethods,c=angular.module("taigaAdmin"),t=function(t){function e(t,e,r,n,i,o,s,u,c,l,p,d,f,h){var m;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=u,this.navUrls=c,this.analytics=l,this.appMetaService=p,this.translate=d,this.auth=f,this.lightboxFactory=h,a(this),this.scope.project={},this.scope.filters={},m=this.loadInitialData(),m.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.MEMBERSHIPS.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),m.then(null,this.onInitialDataError.bind(this)),this.scope.$on("membersform:new:success",function(t){return function(){return t.loadInitialData(),t.analytics.trackEvent("membership","create","create memberships on admin",1)}}(this))}return p(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAnalytics","tgAppMetaService","$translate","$tgAuth","tgLightboxFactory"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.location.path(t.navUrls.resolve("permission-denied")),t.scope.projectId=e.id,t.scope.project=e,t.scope.canAddUsers=null===e.max_memberships||e.max_memberships>e.total_memberships,
-t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadMembers=function(){var t;return t=this.getUrlFilters(),this.rs.memberships.list(this.scope.projectId,t).then(function(t){return function(e){return t.scope.memberships=_.filter(e.models,function(t){return null===t.user||t.is_user_active}),t.scope.page=e.current,t.scope.count=e.count,t.scope.paginatedBy=e.paginatedBy,e}}(this))},e.prototype.loadInitialData=function(){return this.loadProject().then(function(t){return function(){return t.q.all([t.loadMembers(),t.auth.refresh()])}}(this))},e.prototype.getUrlFilters=function(){var t;return t=_.pick(this.location.search(),"page"),t.page||(t.page=1),t},e.prototype.addNewMembers=function(){return this.lightboxFactory.create("tg-lb-add-members",{"class":"lightbox lightbox-add-member",project:"project"},{project:this.scope.project})},e.prototype.showLimitUsersWarningMessage=function(){var t,e,r;return r=this.translate.instant("ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING"),e=this.translate.instant("ADMIN.MEMBERSHIPS.LIMIT_USERS_WARNING_MESSAGE",{members:this.scope.project.max_memberships}),t="/"+window._version+"/svg/icons/team-question.svg",this.confirm.success(r,e,{name:t,type:"img"})},e}(u(l.Controller,l.PageMixin,l.FiltersMixin)),c.controller("MembershipsController",t),e=function(t,e){var r,n,i;return i=t.get("admin/admin-membership-paginator.html",!0),n=function(t,r,n,o){var s,a,u,c,l,p,d;return a=2,l=4,u=2,c=2,s=r.find(".memberships-paginator"),p=function(){var e;return e=t.count/t.paginatedBy,e=parseInt(e,10)=f)return void s.hide();for(m=[],h={},h.pages=m,h.showPrevious=t.page>1,h.showNext=!(t.page===f),r=t.page,o=d=1,g=f;g>=1?g>=d:d>=g;o=g>=1?++d:--d)o===r+a&&f>r+a+c?m.push({classes:"dots",type:"dots"}):o===r-l&&r>u+l?m.push({classes:"dots",type:"dots"}):o>r+a&&f-c>=o||r-l>o&&o>u||(o===r?m.push({classes:"active",num:o,type:"page-active"}):m.push({classes:"page",num:o,type:"page"}));return n=i(h),n=e(n)(t),s.html(n),s.show()},t.$watch("memberships",function(t){return t?d():void 0}),r.on("click",".memberships-paginator a.next",function(e){return e.preventDefault(),t.$apply(function(){return o.selectFilter("page",t.page+1),o.loadMembers()})}),r.on("click",".memberships-paginator a.previous",function(e){return e.preventDefault(),t.$apply(function(){return o.selectFilter("page",t.page-1),o.loadMembers()})}),r.on("click",".memberships-paginator li.page > a",function(e){var r,n;return e.preventDefault(),n=angular.element(e.currentTarget),r=n.data("pagenum"),t.$apply(function(){return o.selectFilter("page",r),o.loadMembers()})})},r=function(t,e,r){var i;return i=e.controller(),n(t,e,r,i),t.$on("$destroy",function(){return e.off()})},{link:r}},c.directive("tgMemberships",["$tgTemplate","$compile",e]),i=function(t,e,r,n){var i,o;return o=e.get("admin/memberships-row-avatar.html",!0),i=function(e,i,s){var a,u,c;return u=r.instant("ADMIN.MEMBERSHIP.STATUS_PENDING"),c=function(t){var r,s;return r={full_name:t.full_name?t.full_name:"",email:t.user_email?t.user_email:t.email,imgurl:t.photo?t.photo:"/"+window._version+"/images/unnamed.png",pending:t.is_user_active?"":u,isOwner:t.is_owner},s=o(r),s=n(s)(e),i.html(s)},null==s.tgMembershipsRowAvatar?t.error("MembershipsRowAvatarDirective: the directive need a member"):(a=e.$eval(s.tgMembershipsRowAvatar),c(a),e.$on("$destroy",function(){return i.off()}))},{link:i}},c.directive("tgMembershipsRowAvatar",["$log","$tgTemplate","$translate","$compile",i]),n=function(t,e,r,n,i){var o,s;return s=n.get("admin/admin-memberships-row-checkbox.html",!0),o=function(n,o,a){var u,c,l;return n.$on("$destroy",function(){return o.off()}),null==a.tgMembershipsRowAdminCheckbox?t.error("MembershipsRowAdminCheckboxDirective: the directive need a member"):(c=n.$eval(a.tgMembershipsRowAdminCheckbox),c.is_owner?void o.find(".js-check").remove():(l=function(t){var e,r;return e={inputId:"is-admin-"+t.id},r=s(e),r=i(r)(n),o.html(r)},o.on("click",":checkbox",function(t){return function(t){var n,i,s;return i=function(){return r.notify("success")},n=function(t){return c.revert(),o.find(":checkbox").prop("checked",c.is_admin),r.notify("error",t.is_admin[0])},s=angular.element(t.currentTarget),c.is_admin=s.prop("checked"),e.save(c).then(i,n)}}(this)),u=l(c),c.is_admin?o.find(":checkbox").prop("checked",!0):void 0))},{link:o}},c.directive("tgMembershipsRowAdminCheckbox",["$log","$tgRepo","$tgConfirm","$tgTemplate","$compile",n]),o=function(t,e,r){var n,i;return i=_.template(''),n=function(n,o,s){var a,u,c,l;return l=function(t){var e,r;return e={roleList:n.project.roles,selectedRole:t.role},r=i(e),o.html(r)},null==s.tgMembershipsRowRoleSelector?t.error("MembershipsRowRoleSelectorDirective: the directive need a member"):(a=o.controller(),c=n.$eval(s.tgMembershipsRowRoleSelector),u=l(c),o.on("change","select",function(t){return function(t){var n,i,o,s;return o=function(){return r.notify("success")},i=function(){return r.notify("error")},s=angular.element(t.currentTarget),n=parseInt(s.val(),10),c.role!==n?(c.role=n,e.save(c).then(o,i)):void 0}}(this)),n.$on("$destroy",function(){return o.off()}))},{link:n}},c.directive("tgMembershipsRowRoleSelector",["$log","$tgRepo","$tgConfirm",o]),r=function(t,e,r,n,i,o,s,a,u){var c,l,p;return c='\n
\n\n \n',p='\n\n\n \n',l=function(l,d,f){var h,m,g,v;return v=function(t){var e;return e=t.user?i(c)(l):i(p)(l),d.html(e)},null==f.tgMembershipsRowActions?t.error("MembershipsRowActionsDirective: the directive need a member"):(h=d.controller(),g=l.$eval(f.tgMembershipsRowActions),v(g),d.on("click",".js-resend",function(t){var e,i;return t.preventDefault(),i=function(){var t;return t=o.instant("ADMIN.MEMBERSHIP.SUCCESS_SEND_INVITATION",{email:l.member.email}),n.notify("success",t)},e=function(){var t;return t=o.instant("ADMIM.MEMBERSHIP.ERROR_SEND_INVITATION"),n.notify("error",t)},r.memberships.resendInvitation(l.member.id).then(i,e)}),m=function(){var t,r,i;return i=o.instant("ADMIN.MEMBERSHIP.DELETE_MEMBER"),t=o.instant("ADMIN.MEMBERSHIP.DEFAULT_DELETE_MESSAGE",{email:g.email}),r=g.user?g.full_name:t,n.askOnDelete(i,r).then(function(t){var i,u;return u=function(e){return function(){var e;return t.finish(),g.user!==l.user.id?(l.page>1&&l.count-1<=l.paginatedBy&&h.selectFilter("page",l.page-1),h.loadInitialData()):s.path(a.resolve("home")),e=o.instant("ADMIN.MEMBERSHIP.SUCCESS_DELETE",{message:r}),n.notify("success",e,null,5e3)}}(this),i=function(e){return function(){var e;return t.finish(!1),e=o.instant("ADMIN.MEMBERSHIP.ERROR_DELETE",{message:r}),n.notify("error",e)}}(this),e.remove(g).then(u,i)})},d.on("click",".delete",function(t){var e;return t.preventDefault(),l.project.owner.id===g.user?(e=l.user.id===g.user,u.create("tg-lightbox-leave-project-warning",{"class":"lightbox lightbox-leave-project-warning"},{isCurrentUser:e,project:l.project})):m()}),l.$on("$destroy",function(){return d.off()}))},{link:l}},c.directive("tgMembershipsRowActions",["$log","$tgRepo","$tgResources","$tgConfirm","$compile","$translate","$tgLocation","$tgNavUrls","tgLightboxFactory",r]),s=function(){return{templateUrl:"admin/no-more-memberships-explanation.html",scope:{project:"="}}},c.directive("tgNoMoreMembershipsExplanation",[s])}.call(this),function(){var t,e;t=function(){var t;return t=function(t,e,r){var n;return n=r.tgAdminNavigation,e.find(".active").removeClass("active"),e.find("#adminmenu-"+n+" a").addClass("active"),t.$on("$destroy",function(){return e.off()})},{link:t}},e=angular.module("taigaAdmin"),e.directive("tgAdminNavigation",t)}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,d,f,h,m,g,v,y,b,$,S,k,j,I,T,E=function(t,e){function r(){this.constructor=t}for(var n in e)C.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},C={}.hasOwnProperty,O=function(t,e){return function(){return t.apply(e,arguments)}};j=this.taiga,S=this.taiga.mixOf,T=this.taiga.trim,I=this.taiga.toString,$=this.taiga.joinStr,b=this.taiga.groupBy,v=this.taiga.bindOnce,y=this.taiga.debounce,k=angular.module("taigaAdmin"),m=function(t){function e(t,e,r,n,i,o,s,a,u,c,l,p,d){var f;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=a,this.navUrls=u,this.appMetaService=c,this.translate=l,this.tgAuth=p,this.currentUserService=d,this.scope.project={},f=this.loadInitialData(),f.then(function(t){return function(){var e,r,n;return r=t.translate.instant(t.scope.sectionName),n=t.translate.instant("ADMIN.PROJECT_PROFILE.PAGE_TITLE",{sectionName:r,projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(n,e),t.fillUsersAndRoles(t.scope.project.members,t.scope.project.roles)}}(this)),f.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:loaded",function(t){return function(){var e,r,n;return r=t.translate.instant(t.scope.sectionName),n=t.translate.instant("ADMIN.PROJECT_PROFILE.PAGE_TITLE",{sectionName:r,projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(n,e)}}(this))}return E(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","$tgAuth","tgCurrentUserService"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.location.path(t.navUrls.resolve("permission-denied")),t.scope.projectId=e.id,t.scope.project=e,t.scope.pointsList=_.sortBy(e.points,"order"),t.scope.usStatusList=_.sortBy(e.us_statuses,"order"),t.scope.taskStatusList=_.sortBy(e.task_statuses,"order"),t.scope.prioritiesList=_.sortBy(e.priorities,"order"),t.scope.severitiesList=_.sortBy(e.severities,"order"),t.scope.issueTypesList=_.sortBy(e.issue_types,"order"),t.scope.issueStatusList=_.sortBy(e.issue_statuses,"order"),t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){return this.q.all([this.loadProject(),this.tgAuth.refresh()])},e.prototype.openDeleteLightbox=function(){return this.rootscope.$broadcast("deletelightbox:new",this.scope.project)},e}(S(j.Controller,j.PageMixin)),k.controller("ProjectProfileController",m),g=function(t,e,r,n,i,o,s){var a;return a=function(a,u,c){var l,p,d,f;return l=u.controller(),p=u.find("form").checksley({onlyOneErrorElement:!0}),d=y(2e3,function(u){return function(u){var c,d;return u.preventDefault(),p.validate()?(c=r().target(f).start(),d=t.save(a.project),d.then(function(){var t;return c.finish(),e.notify("success"),t=n.resolve("project-admin-project-profile-details",{project:a.project.slug}),i.path(t),l.loadInitialData(),o.fetchProject(),s.loadProjects()}),d.then(null,function(t){return c.finish(),p.setErrors(t),t._error_message?e.notify("error",t._error_message):void 0})):void 0}}(this)),f=u.find(".submit-button"),u.on("submit","form",d)},{link:a}},k.directive("tgProjectProfile",["$tgRepo","$tgConfirm","$tgLoading","$tgNavUrls","$tgLocation","tgProjectService","tgCurrentUserService",g]),l=function(t,e,r){var n;return n=function(n,i,o){var s,a,u;return s=i.find("form").checksley({onlyOneErrorElement:!0}),a=y(2e3,function(i){return function(i){var o,a;return i.preventDefault(),s.validate()?(o=r().target(u).start(),a=t.save(n.project),a.then(function(){return o.finish(),e.notify("success")}),a.then(null,function(t){return o.finish(),s.setErrors(t),t._error_message?e.notify("error",t._error_message):void 0})):void 0}}(this)),u=i.find(".submit-button"),i.on("submit","form",a),n.$on("$destroy",function(){return i.off()})},{link:n}},k.directive("tgProjectDefaultValues",["$tgRepo","$tgConfirm","$tgLoading",l]),h=function(t,e,r,n){var i;return i=function(r,i,o){var s;return s=function(o){return function(){var o,s;return o=i.find("form").checksley(),o.initializeFields(),o.reset(),o.validate()?(s=t.save(r.project),s.then(function(){return r.$emit("project:loaded",r.project),e.notify("success"),n.fetchProject()}),s.then(null,function(t){return o.setErrors(t),t._error_message?e.notify("error",t._error_message):void 0})):void 0}}(this),i.on("change",".module-activation.module-direct-active input",function(t){return t.preventDefault(),s()}),i.on("submit","form",function(t){return t.preventDefault(),s()}),i.on("click",".save",function(t){return t.preventDefault(),s()}),i.on("keydown",".videoconference-attributes input",function(t){return 32!==t.which}),r.$watch("project.videoconferences",function(t,e){return null!=t&&null!=e&&t!==e?r.project.videoconferences_extra_data="":void 0}),r.$watch("isVideoconferenceActivated",function(t,e){return t===!1&&(r.project.videoconferences=null,r.project.videoconferences_extra_data="",e===!0)?s():void 0}),r.$watch("project",function(t){return null!=t.videoconferences?r.isVideoconferenceActivated=!0:r.isVideoconferenceActivated=!1})},{link:i}},k.directive("tgProjectModules",["$tgRepo","$tgConfirm","$tgLoading","tgProjectService",h]),p=function(t,e,r,n){var i;return i=function(i,o,s){var a,u,c,l,p,d,f,h,m,g,v,_,b,$,S,k,j,I,T,E,C,O,w,A,P,M;return u=o.find(".admin-project-export-buttons"),I=function(){return u.removeClass("hidden")},l=function(){return u.addClass("hidden")},m=o.find(".admin-project-export-result"),w=function(){return m.removeClass("hidden")},p=function(){return m.addClass("hidden")},P=o.find(".spin"),A=function(){return P.removeClass("hidden")},d=function(){return P.addClass("hidden")},v=o.find(".result-title"),h=n.instant("ADMIN.PROJECT_EXPORT.LOADING_TITLE"),f=n.instant("ADMIN.PROJECT_EXPORT.LOADING_MESSAGE"),c=function(){return v.html(n.instant("ADMIN.PROJECT_EXPORT.DUMP_READY"))},a=function(){return v.html(n.instant("ADMIN.PROJECT_EXPORT.ASYNC_MESSAGE"))},M=function(t){return v.html(n.instant("ADMIN.PROJECT_EXPORT.SYNC_MESSAGE",{url:t}))},S=function(){return v.html(h)},b=function(){return v.html(f)},j=function(){return v.html(c)},g=o.find(".result-message "),$=function(){return g.html(f)},_=function(){return g.html(a)},k=function(t){return g.html(M(t))},O=function(){return A(),S(),$(),l(),w()},E=function(){return d(),b(),_()},C=function(t){return d(),j(),k(t)},T=function(){return d(),p(),I()},o.on("click","a.button-export",y(2e3,function(o){return function(o){var s,a;return o.preventDefault(),a=function(e){var r;return 202===e.status?E():(r=e.data.url,C(r),t.open(r,"_blank"))},s=function(t){var e,i;return T(),e=n.instant("ADMIN.PROJECT_EXPORT.ERROR"),429===t.status?e=n.instant("ADMIN.PROJECT_EXPORT.ERROR_BUSY"):(null!=(i=t.data)?i._error_message:void 0)&&(e=n.instant("ADMIN.PROJECT_EXPORT.ERROR_BUSY",{message:t.data._error_message})),r.notify("error",e)},O(),e.projects["export"](i.projectId).then(a,s)}}(this)))},{link:i}},k.directive("tgProjectExport",["$window","$tgResources","$tgConfirm","$translate",p]),n=function(t){function e(t,e,r,n,i,o){this.scope=t,this.rootscope=e,this.urls=r,this.confirm=n,this.rs=i,this.translate=o,this._generateUuid=O(this._generateUuid,this),this.setCsvUuid=O(this.setCsvUuid,this),this.rootscope.$on("project:loaded",this.setCsvUuid),this.scope.$watch("csvUuid",function(t){return function(e){return e?t.scope.csvUrl=t.urls.resolveAbsolute(t.type+"-csv",e):t.scope.csvUrl=""}}(this))}return E(e,t),e.$inject=["$scope","$rootScope","$tgUrls","$tgConfirm","$tgResources","$translate"],e.prototype.setCsvUuid=function(){return this.scope.csvUuid=this.scope.project[this.type+"_csv_uuid"]},e.prototype._generateUuid=function(t){var e;return null==t&&(t=null),e=this.rs.projects["regenerate_"+this.type+"_csv_uuid"](this.scope.projectId),e.then(function(t){return function(e){var r;return t.scope.csvUuid=null!=(r=e.data)?r.uuid:void 0}}(this)),e.then(null,function(t){return function(){return t.confirm.notify("error")}}(this)),e["finally"](function(){return t?t.finish():void 0}),e},e.prototype.regenerateUuid=function(){var t,e;return this.scope.csvUuid?(e=this.translate.instant("ADMIN.REPORTS.REGENERATE_TITLE"),t=this.translate.instant("ADMIN.REPORTS.REGENERATE_SUBTITLE"),this.confirm.ask(e,t).then(this._generateUuid)):this._generateUuid()},e}(j.Controller),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return E(e,t),e.prototype.type="userstories",e}(n),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return E(e,t),e.prototype.type="tasks",e}(n),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return E(e,t),e.prototype.type="issues",e}(n),k.controller("CsvExporterUserstoriesController",s),k.controller("CsvExporterTasksController",o),k.controller("CsvExporterIssuesController",i),c=function(t){var e;return e=function(t){return t.sectionTitle="ADMIN.CSV.SECTION_TITLE_US"},{controller:"CsvExporterUserstoriesController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:e,scope:!0}},k.directive("tgCsvUs",["$translate",c]),u=function(t){var e;return e=function(t){return t.sectionTitle="ADMIN.CSV.SECTION_TITLE_TASK"},{controller:"CsvExporterTasksController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:e,scope:!0}},k.directive("tgCsvTask",["$translate",u]),a=function(t){var e;return e=function(t){return t.sectionTitle="ADMIN.CSV.SECTION_TITLE_ISSUE"},{controller:"CsvExporterIssuesController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:e,scope:!0}},k.directive("tgCsvIssue",["$translate",a]),d=function(t,e,r,n){var i;return i=function(t,i,o){var s,a,u;return u=function(){return i.find(".size-info").addClass("active")},a=function(r){var o;return o=e.make_model("projects",r.data),t.project=o,i.find(".loading-overlay").removeClass("active"),n.notify("success")},s=function(t){return 413===t.status&&u(),i.find(".loading-overlay").removeClass("active"),n.notify("error",t.data._error_message)},i.on("click",".js-change-logo",function(){return i.find("#logo-field").click()}),i.on("change","#logo-field",function(e){return t.logoAttachment?(i.find(".loading-overlay").addClass("active"),r.projects.changeLogo(t.project.id,t.logoAttachment).then(a,s)):void 0}),i.on("click","a.js-use-default-logo",function(e){return i.find(".loading-overlay").addClass("active"),r.projects.removeLogo(t.project.id).then(a,s)}),t.$on("$destroy",function(){return i.off()})},{link:i}},k.directive("tgProjectLogo",["$tgAuth","$tgModel","$tgResources","$tgConfirm",d]),f=function(t){var e;return e=function(e,r,n){var i,o;return i=t(n.tgProjectLogoModel),o=i.assign,r.bind("change",function(){return e.$apply(function(){return o(e,r[0].files[0])})})},{link:e}},k.directive("tgProjectLogoModel",["$parse",f]),r=function(){return{scope:{project:"="},templateUrl:"admin/admin-project-restrictions.html"}},k.directive("tgAdminProjectRestrictions",[r]),e=function(t){return{link:function(e){return e.requestOwnership=function(){return t.create("tg-lb-request-ownership",{"class":"lightbox lightbox-request-ownership"},{projectId:e.projectId})}},scope:{projectId:"=",owner:"="},templateUrl:"admin/admin-project-request-ownership.html"}},k.directive("tgAdminProjectRequestOwnership",["tgLightboxFactory",e]),t=function(t){return{link:function(e){return e.changeOwner=function(){return t.create("tg-lb-change-owner",{"class":"lightbox lightbox-select-user","project-id":"projectId","active-users":"activeUsers","current-owner-id":"currentOwnerId"},{projectId:e.projectId,activeUsers:e.activeUsers,currentOwnerId:e.owner.id,members:e.members})}},scope:{activeUsers:"=",projectId:"=",owner:"=",members:"="},templateUrl:"admin/admin-project-change-owner.html"}},k.directive("tgAdminProjectChangeOwner",["tgLightboxFactory",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,d,f,h,m,g,v,y,b,S=function(t,e){function r(){this.constructor=t}for(var n in e)k.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},k={}.hasOwnProperty,j=function(t,e){return function(){return t.apply(e,arguments)}};v=this.taiga,m=this.taiga.mixOf,b=this.taiga.trim,y=this.taiga.toString,h=this.taiga.joinStr,f=this.taiga.groupBy,p=this.taiga.bindOnce,d=this.taiga.debounce,g=angular.module("taigaAdmin"),a=function(t){function e(t,e,r,n,i,o,s,a,u,c,l){var p;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=a,this.navUrls=u,this.appMetaService=c,this.translate=l,this.scope.project={},p=this.loadInitialData(),p.then(function(t){return function(){var e,r,n;return r=t.translate.instant(t.scope.sectionName),n=t.translate.instant("ADMIN.PROJECT_VALUES.PAGE_TITLE",{sectionName:r,projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(n,e)}}(this)),p.then(null,this.onInitialDataError.bind(this))}return S(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.location.path(t.navUrls.resolve("permission-denied")),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject()},e}(m(v.Controller,v.PageMixin)),g.controller("ProjectValuesSectionController",a),o=function(t){function e(t,e,r,n,i){this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.moveValue=j(this.moveValue,this),this.loadValues=j(this.loadValues,this),this.scope.$on("admin:project-values:move",this.moveValue),this.rootscope.$on("project:loaded",this.loadValues)}return S(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources"],e.prototype.loadValues=function(){return this.rs[this.scope.resource].listValues(this.scope.projectId,this.scope.type).then(function(t){return function(e){return t.scope.values=e,t.scope.maxValueOrder=_.maxBy(e,"order").order,e}}(this))},e.prototype.moveValue=function(t,e,r){var n,i;return i=this.scope.values,n=i.indexOf(e),i.splice(n,1),i.splice(r,0,e),_.each(i,function(t,e){return t.order=e}),this.repo.saveAll(i)},e}(v.Controller),g.controller("ProjectValuesController",o),s=function(t,e,r,n,i,o,s){var a,u,c;return u=function(t,e,r){var n,i,o,s,a,u;return s=null,o=null,i=null,u=e.find(".sortable"),n=dragula([u[0]],{direction:"vertical",copySortSource:!1,copy:!1,mirrorContainer:u[0],moves:function(t){return $(t).is("div[tg-bind-scope]")}}),n.on("dragend",function(e){var r,n;return i=$(e),n=i.scope().value,r=i.index(),t.$broadcast("admin:project-values:move",n,r)}),a=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&n.dragging}}),t.$on("$destroy",function(){return e.off(),n.destroy()})},c=function(t,n,i){var a,u,c,l,p,f,h,m,g;return a=n.controller(),g=i.type,f=i.objname,l=function(){return t.newValue={name:"",is_closed:!1,is_archived:!1}},p=function(){return t.addNewElementText=o.instant("ADMIN.PROJECT_VALUES_"+f.toUpperCase()+".ACTION_ADD")},l(),p(),s.$on("$translateChangeEnd",function(){return t.$evalAsync(p)}),c=function(t){return function(t){var e;return null==t&&(t=!1),e=n.find(".table-main"),$(document.body).scrollTop(e.offset().top+e.height()),t?n.find(".new-value input:visible").first().focus():void 0}}(this),m=function(t){var r,n,i,o;return n=t.parents("form"),r=n.checksley(),r.validate()?(o=n.scope().value,i=e.save(o),i.then(function(e){return function(){var e;return e=t.parents(".row.table-main"),e.addClass("hidden"),e.siblings(".visualization").removeClass("hidden")}}(this)),i.then(null,function(t){return r.setErrors(t)})):void 0},h=function(r){var n,i,o;return i=r.parents("form"),n=i.checksley(),n.validate()?(t.newValue.project=t.project.id,t.newValue.order=t.maxValueOrder?t.maxValueOrder+1:1,o=e.create(g,t.newValue),o.then(function(e){return function(e){return r.addClass("hidden"),t.values.push(e),t.maxValueOrder=e.order,l()}}(this)),o.then(null,function(t){return n.setErrors(t)})):void 0},u=function(e){var r,n,i;return n=e.parents(".row.table-main"),r=e.parents("form"),i=r.scope().value,t.$apply(function(){return n.addClass("hidden"),i.revert(),n.siblings(".visualization").removeClass("hidden")})},n.on("click",".show-add-new",function(t){return t.preventDefault(),n.find(".new-value").removeClass("hidden"),c(!0)}),n.on("click",".add-new",d(2e3,function(t){var e;return t.preventDefault(),e=n.find(".new-value"),h(e)})),n.on("click",".delete-new",function(t){return t.preventDefault(),n.find(".new-value").addClass("hidden"),l()}),n.on("click",".edit-value",function(t){var e,r,n;return t.preventDefault(),n=angular.element(t.currentTarget),r=n.parents(".row.table-main"),r.addClass("hidden"),e=r.siblings(".edition"),e.removeClass("hidden"),e.find("input:visible").first().focus().select()}),n.on("keyup",".edition input",function(t){var e;return 13===t.keyCode?(e=angular.element(t.currentTarget),m(e)):27===t.keyCode?(e=angular.element(t.currentTarget),u(e)):void 0}),n.on("keyup",".new-value input",function(t){var e;return 13===t.keyCode?(e=n.find(".new-value"),h(e)):27===t.keyCode?(n.find(".new-value").addClass("hidden"),l()):void 0}),n.on("click",".save",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),m(e)}),n.on("click",".cancel",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),u(e)}),n.on("click",".delete-value",function(n){var i,s,u,c,l,p,d;return n.preventDefault(),c=angular.element(n.currentTarget),s=c.parents("form"),d=s.scope().value,i={},_.each(t.values,function(t){return d.id!==t.id?i[t.id]=t.name:void 0}),u=d.name,0===_.keys(i).length?r.error(o.instant("ADMIN.PROJECT_VALUES.ERROR_DELETE_ALL")):(p=o.instant("ADMIN.COMMON.TITLE_ACTION_DELETE_VALUE"),l=o.instant("ADMIN.PROJECT_VALUES.REPLACEMENT"),r.askChoice(p,u,i,l).then(function(t){var n,i;return i=function(){return a.loadValues()["finally"](function(){return t.finish()})},n=function(){return r.notify("error")},e.remove(d,{moveTo:t.selected}).then(i,n)}))})},a=function(t,e,r){return u(t,e,r),c(t,e,r),t.$on("$destroy",function(){return e.off()})},{link:a}},g.directive("tgProjectValues",["$log","$tgRepo","$tgConfirm","$tgLocation","animationFrame","$translate","$rootScope",s]),t=function(){var t;return t=function(t,e,r,n){var i;return i=e.controller(),t.$watch(r.ngModel,function(e){return t.color=e.color}),e.on("click",".current-color",function(t){var r,n;return t.preventDefault(),t.stopPropagation(),n=angular.element(t.currentTarget),e.find(".select-color").hide(),n.siblings(".select-color").show(),r=angular.element("body"),r.on("click",function(t){return function(t){return 0===angular.element(t.target).parent(".select-color").length?(e.find(".select-color").hide(),r.unbind("click")):void 0}}(this))}),e.on("click",".select-color .color",function(r){var i;return r.preventDefault(),i=angular.element(r.currentTarget),t.$apply(function(){return n.$modelValue.color=i.data("color")}),e.find(".select-color").hide()}),e.on("click",".select-color .selected-color",function(r){return r.preventDefault(),t.$apply(function(){return n.$modelValue.color=t.color}),e.find(".select-color").hide()}),t.$on("$destroy",function(){return e.off()})},{link:t,require:"ngModel"}},g.directive("tgColorSelection",t),u="text",r="multiline",e="date",l="url",c=[{key:u,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_TEXT"},{key:r,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_MULTI"},{key:e,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DATE"},{key:l,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL"}],n=function(t){function e(t,e,r,n,i,o,s,a,u,l){this.scope=t,this.rootscope=e,this.repo=r,this.rs=n,this.params=i,this.q=o,this.location=s,this.navUrls=a,this.appMetaService=u,this.translate=l,this.moveCustomAttributes=j(this.moveCustomAttributes,this),this.deleteCustomAttribute=j(this.deleteCustomAttribute,this),this.saveCustomAttribute=j(this.saveCustomAttribute,this),this.createCustomAttribute=j(this.createCustomAttribute,this),this.loadCustomAttributes=j(this.loadCustomAttributes,this),this.scope.TYPE_CHOICES=c,this.scope.project={},this.rootscope.$on("project:loaded",function(t){return function(){var e,r,n;return t.loadCustomAttributes(),r=t.translate.instant(t.scope.sectionName),n=t.translate.instant("ADMIN.CUSTOM_ATTRIBUTES.PAGE_TITLE",{sectionName:r,projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(n,e)}}(this))}return S(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],e.prototype.loadCustomAttributes=function(){return this.rs.customAttributes[this.scope.type].list(this.scope.projectId).then(function(t){return function(e){var r;return t.scope.customAttributes=e,t.scope.maxOrder=null!=(r=_.maxBy(e,"order"))?r.order:void 0,e}}(this))},e.prototype.createCustomAttribute=function(t){return this.repo.create("custom-attributes/"+this.scope.type,t)},e.prototype.saveCustomAttribute=function(t){return this.repo.save(t)},e.prototype.deleteCustomAttribute=function(t){return this.repo.remove(t)},e.prototype.moveCustomAttributes=function(t,e){var r,n;return r=this.scope.customAttributes,n=r.indexOf(t),r.splice(n,1),r.splice(e,0,t),_.each(r,function(t,e){return t.order=e}),this.repo.saveAll(r)},e}(m(v.Controller,v.PageMixin)),g.controller("ProjectCustomAttributesController",n),i=function(t,e,r,n){var i;return i=function(t,r,i){var o,s,a,u,c,l,p,f,h,m,g,v,_,y,b,S,k,j;return o=r.controller(),t.$on("$destroy",function(){return r.off()}),k=r.find(".js-sortable"),l=dragula([k[0]],{direction:"vertical",copySortSource:!1,copy:!1,mirrorContainer:k[0],moves:function(t){return $(t).is("div[tg-bind-scope]")}}),l.on("dragend",function(t){var e,r,n;return r=$(t),e=r.scope().attr,n=r.index(),o.moveCustomAttributes(e,n)}),b=function(){return r.find(".js-new-custom-field").removeClass("hidden"),r.find(".js-new-custom-field input:visible").first().focus()},h=function(){return r.find(".js-new-custom-field").addClass("hidden")},_=function(){return r.find(".js-add-custom-field-button").removeClass("hidden")},p=function(){return r.find(".js-add-custom-field-button").addClass("hidden")},y=function(){return r.find(".js-cancel-new-custom-field-button").removeClass("hidden")},f=function(){return r.find(".js-cancel-new-custom-field-button").addClass("hidden")},g=function(){return t.newAttr={}},u=function(r){var n,i,s,a;return i=r.checksley(),i.validate()?(a=function(t){return function(){return o.loadCustomAttributes(),h(),g(),e.notify("success")}}(this),s=function(t){return function(t){return i.setErrors(t)}}(this),n=t.newAttr,n.project=t.projectId,n.order=t.maxOrder?t.maxOrder+1:1,o.createCustomAttribute(n).then(a,s)):void 0},s=function(){return h(),g()},t.$watch("customAttributes",function(t){return t?0===t.length?(f(),p(),b()):(h(),_(),y()):void 0}),r.on("click",".js-add-custom-field-button",function(t){return t.preventDefault(),b()}),r.on("click",".js-create-custom-field-button",d(2e3,function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),u(e)})),r.on("click",".js-cancel-new-custom-field-button",function(t){return t.preventDefault(),s()}),r.on("keyup",".js-new-custom-field input",function(t){var e,r;return 13===t.keyCode?(r=angular.element(t.currentTarget),e=r.closest("form"),u(e)):27===t.keyCode?s():void 0}),S=function(t){return t.find(".js-view-custom-field").addClass("hidden"),
-t.find(".js-edit-custom-field").removeClass("hidden"),t.find(".js-edit-custom-field input:visible").first().focus().select()},m=function(t){return t.find(".js-edit-custom-field").addClass("hidden"),t.find(".js-view-custom-field").removeClass("hidden")},v=function(e){return t.$apply(function(){return e.scope().attr.revert()})},j=function(t){var r,n,i,s;return n=t.checksley(),n.validate()?(s=function(r){return function(){return o.loadCustomAttributes(),m(t),e.notify("success")}}(this),i=function(t){return function(t){return n.setErrors(t)}}(this),r=t.scope().attr,o.saveCustomAttribute(r).then(s,i)):void 0},a=function(t){return m(t),v(t)},r.on("click",".js-edit-custom-field-button",function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),S(e)}),r.on("click",".js-update-custom-field-button",d(2e3,function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),j(e)})),r.on("click",".js-cancel-edit-custom-field-button",function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),a(e)}),r.on("keyup",".js-edit-custom-field input",function(t){var e,r;return 13===t.keyCode?(r=angular.element(t.currentTarget),e=r.closest("form"),j(e)):27===t.keyCode?(r=angular.element(t.currentTarget),e=r.closest("form"),a(e)):void 0}),c=function(t){var r,i,s,a;return r=t.scope().attr,i=r.name,a=n.instant("COMMON.CUSTOM_ATTRIBUTES.DELETE"),s=n.instant("COMMON.CUSTOM_ATTRIBUTES.CONFIRM_DELETE"),e.ask(a,s,i).then(function(t){var n,s;return s=function(){return o.loadCustomAttributes()["finally"](function(){return t.finish()})},n=function(){return e.notify("error",null,"We have not been able to delete '"+i+"'.")},o.deleteCustomAttribute(r).then(s,n)})},r.on("click",".js-delete-custom-field-button",d(2e3,function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),c(e)}))},{link:i}},g.directive("tgProjectCustomAttributes",["$log","$tgConfirm","animationFrame","$translate",i])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p=function(t,e){return function(){return t.apply(e,arguments)}},d=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty,h=[].indexOf||function(t){for(var e=0,r=this.length;r>e;e++)if(e in this&&this[e]===t)return e;return-1};l=this.taiga,u=this.taiga.mixOf,s=this.taiga.bindOnce,a=this.taiga.debounce,o=this.taiga.bindMethods,c=angular.module("taigaAdmin"),n=function(t){function e(t,e,r,n,i,s,a,u,c,l,d){var f;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=s,this.q=a,this.location=u,this.navUrls=c,this.appMetaService=l,this.translate=d,this._disableComputable=p(this._disableComputable,this),this._enableComputable=p(this._enableComputable,this),o(this),this.scope.sectionName="ADMIN.MENU.PERMISSIONS",this.scope.project={},this.scope.anyComputableRole=!0,f=this.loadInitialData(),f.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.ROLES.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),f.then(null,this.onInitialDataError.bind(this))}return d(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.location.path(t.navUrls.resolve("permission-denied")),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.anyComputableRole=_.some(_.map(e.roles,function(t){return t.computable})),e}}(this))},e.prototype.loadRoles=function(){return this.rs.roles.list(this.scope.projectId).then(function(t){return function(e){var r;return e=e.map(function(t){return t.external_user=!1,t}),r={name:t.translate.instant("ADMIN.ROLES.EXTERNAL_USER"),permissions:t.scope.project.public_permissions,external_user:!0},e.push(r),t.scope.roles=e,t.scope.role=t.scope.roles[0],e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(){return t.loadRoles()}}(this)),t},e.prototype.setRole=function(t){return this.scope.role=t,this.scope.$broadcast("role:changed",this.scope.role)},e.prototype["delete"]=function(){var t,e,r,n,i,o,s,a,u;for(t={},n=this.scope.roles,e=0,r=n.length;r>e;e++)o=n[e],o.id!==this.scope.role.id&&(t[o.id]=o.name);return 0===_.keys(t).length?this.confirm.error(this.translate.instant("ADMIN.ROLES.ERROR_DELETE_ALL")):(a=this.translate.instant("ADMIN.ROLES.TITLE_DELETE_ROLE"),s=this.scope.role.name,i=this.translate.instant("ADMIN.ROLES.REPLACEMENT_ROLE"),u=this.translate.instant("ADMIN.ROLES.WARNING_DELETE_ROLE"),this.confirm.askChoice(a,s,t,i,u).then(function(t){return function(e){var r,n;return n=function(){return t.loadProject(),t.loadRoles()["finally"](function(){return e.finish()})},r=function(){return t.confirm.notify("error")},t.repo.remove(t.scope.role,{moveTo:e.selected}).then(n,r)}}(this)))},e.prototype._enableComputable=function(){var t,e;return e=function(t){return function(){return t.confirm.notify("success"),t.loadProject()}}(this),t=function(t){return function(){return t.confirm.notify("error"),t.scope.role.revert()}}(this),this.repo.save(this.scope.role).then(e,t)},e.prototype._disableComputable=function(){var t,e,r,n;return e=function(t){return function(e){var r,n;return n=function(){return e.finish(),t.confirm.notify("success"),t.loadProject()},r=function(){return e.finish(),t.confirm.notify("error"),t.scope.role.revert()},t.repo.save(t.scope.role).then(n,r)}}(this),t=function(t){return function(e){return t.scope.role.revert()}}(this),n=this.translate.instant("ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_TITLE"),r=this.translate.instant("ADMIN.ROLES.DISABLE_COMPUTABLE_ALERT_SUBTITLE",{roleName:this.scope.role.name}),this.confirm.ask(n,r,"").then(e,t)},e.prototype.toggleComputable=a(2e3,function(){return this.scope.role.computable?this._enableComputable():this._disableComputable()}),e}(u(l.Controller,l.PageMixin,l.FiltersMixin)),c.controller("RolesController",n),t=function(t,e){var r;return r=function(r,n,i){var o,s;return s=function(){return n.find(".total").toggle(),n.find(".edit-role").toggle()},o=function(){var i;return r.role.name=n.find("input").val(),i=t.save(r.role),i.then(function(){return e.notify("success")}),i.then(null,function(t){return e.notify("error")}),s()},n.on("click",".edit-value",function(){return s(),n.find("input").focus(),n.find("input").val(r.role.name)}),n.on("click","a.save",o),n.on("keyup","input",function(t){return 13===t.keyCode?o():27===t.keyCode?s():void 0}),r.$on("role:changed",function(){return n.find(".edit-role").is(":visible")?s():void 0}),r.$on("$destroy",function(){return n.off()})},{link:r}},c.directive("tgEditRole",["$tgRepo","$tgConfirm",t]),i=function(){var t;return t=function(t,e,r){var n;return n=e.controller(),t.$on("$destroy",function(){return e.off()})},{link:t}},c.directive("tgRoles",i),e=function(t,e){var r,n;return r=["view_project","view_milestones","view_us","view_tasks","view_issues"],n=function(n,i,o){var s;return s=i.controller(),n.$on("$destroy",function(){return i.off()}),i.on("click","a.add-button",function(t){return t.preventDefault(),i.find(".new").removeClass("hidden"),i.find(".new").focus(),i.find(".add-button").hide()}),i.on("keyup",".new",function(o){var a,u,c,l;return o.preventDefault(),13===o.keyCode?(l=angular.element(o.currentTarget),a={project:n.projectId,name:l.val(),permissions:r,order:_.maxBy(n.roles,function(t){return t.order}).order+1,computable:!1},i.find(".new").addClass("hidden"),i.find(".new").val(""),c=function(t){var e;return e=n.roles.length-1,n.roles.splice(e,0,t),s.setRole(t),i.find(".add-button").show(),s.loadProject()},u=function(){return e.notify("error")},t.create("roles",a).then(c,u)):27===o.keyCode?(l=angular.element(o.currentTarget),i.find(".new").addClass("hidden"),i.find(".new").val(""),i.find(".add-button").show()):void 0})},{link:n}},c.directive("tgNewRole",["$tgRepo","$tgConfirm",e]),r=function(t,e,r,n){var i,o,a,u;return u=_.template('\n\n
<%- category.activePermissions %>/<%- category.permissions.length %>
\n <% _.each(category.permissions, function(permission) { %>\n
\n <% }) %>\n
\n'),o=_.template('\n
\n
\n
\n
\n <% _.each(category.permissions, function(permission) { %>\n
\n
\n
\n
disabled="disabled" <% } %>\n <% if(permission.active) { %> checked="checked" <% } %>/>\n
\n
\n
\n
\n
\n <% }) %>\n
\n
\n
'),i=_.template(''),a=function(a,c,l){var p,d,f,m,g;return p=c.controller(),d=function(t){var e,r,n,i,o,s,u,c,l;return o=function(e){return _.map(e,function(e){var r;return _.extend({},e,{active:(r=e.key,h.call(t.permissions,r)>=0)})})},r=function(t,e,r){return e.external_user&&!r.is_private&&0===t.key.indexOf("view_")?!1:!0},s=function(e){return _.map(e,function(e){return e.permissions=e.permissions.map(function(e){return e.editable=r(e,t,a.project),e}),_.extend({},e,{activePermissions:_.filter(e.permissions,"active").length})})},e=[],i=[{key:"view_milestones",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.VIEW_SPRINTS"},{key:"add_milestone",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.ADD_SPRINTS"},{key:"modify_milestone",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.MODIFY_SPRINTS"},{key:"delete_milestone",name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.DELETE_SPRINTS"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.SPRINTS.NAME",permissions:o(i)}),c=[{key:"view_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.VIEW_USER_STORIES"},{key:"add_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.ADD_USER_STORIES"},{key:"modify_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.MODIFY_USER_STORIES"},{key:"delete_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.DELETE_USER_STORIES"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.NAME",permissions:o(c)}),u=[{key:"view_tasks",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.VIEW_TASKS"},{key:"add_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.ADD_TASKS"},{key:"modify_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.MODIFY_TASKS"},{key:"delete_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.DELETE_TASKS"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.TASKS.NAME",permissions:o(u)}),n=[{key:"view_issues",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.VIEW_ISSUES"},{key:"add_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.ADD_ISSUES"},{key:"modify_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.MODIFY_ISSUES"},{key:"delete_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.DELETE_ISSUES"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.NAME",permissions:o(n)}),l=[{key:"view_wiki_pages",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.VIEW_WIKI_PAGES"},{key:"add_wiki_page",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.ADD_WIKI_PAGES"},{key:"modify_wiki_page",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.MODIFY_WIKI_PAGES"},{key:"delete_wiki_page",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.DELETE_WIKI_PAGES"},{key:"view_wiki_links",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.VIEW_WIKI_LINKS"},{key:"add_wiki_link",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.ADD_WIKI_LINKS"},{key:"delete_wiki_link",name:"COMMON.PERMISIONS_CATEGORIES.WIKI.DELETE_WIKI_LINKS"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.WIKI.NAME",permissions:o(l)}),s(e)},g=function(t,e){return t.find(".resume").html(n(u({category:e}))(a))},f=function(t,e){var r;return r=o({category:t,index:e}),r=angular.element(r),g(r,t),n(r)(a)},m=function(){var n;return c.off(),n=i(),_.each(d(a.role),function(t,e){return n=angular.element(n).append(f(t,e))}),c.html(n),c.on("click",".resume",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),e.toggleClass("open-drawer"),e.next().toggleClass("open")}),c.on("change",".category-item input",function(n){var i,o,s,u;return i=function(){var t;return t=_.filter(c.find(".category-item input"),function(t){return angular.element(t).is(":checked")}),t=_.sortBy(_.map(t,function(t){var e;return e=angular.element(t).parents(".category-item").data("id")})),t.length&&t.push("view_project"),t},u=angular.element(n.currentTarget),a.role.permissions=i(),s=function(){var e,n;return e=d(a.role),n=u.parents(".category-config").data("id"),g(u.parents(".category-config"),e[n]),t.$broadcast("projects:reload"),r.notify("success"),p.loadProject()},o=function(){return r.notify("error"),u.prop("checked",!u.prop("checked")),a.role.permissions=i()},a.role.external_user?(a.project.public_permissions=a.role.permissions,a.project.anon_permissions=a.role.permissions.filter(function(t){return 0===t.indexOf("view_")}),e.save(a.project).then(s,o)):e.save(a.role).then(s,o)})},a.$on("$destroy",function(){return c.off()}),a.$on("role:changed",function(){return m()}),s(a,l.ngModel,m)},{link:a}},c.directive("tgRolePermissions",["$rootScope","$tgRepo","$tgConfirm","$compile",r])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,d,f,h,m,g,v=function(t,e){function r(){this.constructor=t}for(var n in e)y.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},y={}.hasOwnProperty;m=this.taiga,f=this.taiga.mixOf,p=this.taiga.bindMethods,d=this.taiga.debounce,g=this.taiga.timeout,h=angular.module("taigaAdmin"),l=function(t){function e(t,e,r,n,i,o,s,a){var u;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.location=i,this.navUrls=o,this.appMetaService=s,this.translate=a,p(this),this.scope.sectionName="ADMIN.WEBHOOKS.SECTION_NAME",this.scope.project={},u=this.loadInitialData(),u.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.WEBHOOKS.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),u.then(null,this.onInitialDataError.bind(this)),this.scope.$on("webhooks:reload",this.loadWebhooks)}return v(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],e.prototype.loadWebhooks=function(){return this.rs.webhooks.list(this.scope.projectId).then(function(t){return function(e){return t.scope.webhooks=e}}(this))},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.location.path(t.navUrls.resolve("permission-denied")),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(){return t.loadWebhooks()}}(this)),t},e}(f(m.Controller,m.PageMixin,m.FiltersMixin)),h.controller("WebhooksController",l),c=function(t,e,r,n,i){var o;return o=function(n,o,s){var a,u,c,l,p,f,h,m;return m=n.$eval(s.tgWebhook),f=function(){var e;return e=i.instant("ADMIN.WEBHOOKS.DATE"),t.webhooklogs.list(m.id).then(function(t){return function(t){var r,n,i,o;for(r=0,n=t.length;n>r;r++)i=t[r],i.validStatus=200<=(o=i.status)&&300>o,i.prettySentHeaders=_.map(_.toPairs(i.request_headers),function(t){var e,r;return e=t[0],r=t[1],e+": "+r}).join("\n"),i.prettySentData=JSON.stringify(i.request_data),i.prettyDate=moment(i.created).format(e);return m.logs_counter=t.length,m.logs=t,h()}}(this))},h=function(){var t,e,r,n;return r=o.find(".toggle-history"),t=r.parents(".single-webhook-wrapper").find(".webhooks-history"),t.hasClass("open")?(e=i.instant("ADMIN.WEBHOOKS.ACTION_HIDE_HISTORY"),n=i.instant("ADMIN.WEBHOOKS.ACTION_HIDE_HISTORY_TITLE")):(e=i.instant("ADMIN.WEBHOOKS.ACTION_SHOW_HISTORY"),n=i.instant("ADMIN.WEBHOOKS.ACTION_SHOW_HISTORY_TITLE")),r.text(e),r.prop("title",n)},p=function(){return o.find(".edition-mode").addClass("hidden"),o.find(".visualization-mode").removeClass("hidden")},l=function(){return o.find(".visualization-mode").addClass("hidden"),o.find(".edition-mode").removeClass("hidden")},u=function(){return o.find(".webhooks-history").addClass("open")},a=function(){return p(),n.$apply(function(){return m.revert()})},c=d(2e3,function(t){var n,i;return n=t.parents("form").checksley(),n.validate()?(i=e.save(m),i.then(function(t){return function(){return p()}}(this)),i.then(null,function(t){return r.notify("error"),n.setErrors(t)})):void 0}),o.on("click",".test-webhook",function(){return u(),t.webhooks.test(m.id).then(function(t){return function(){return f()}}(this))}),o.on("click",".edit-webhook",function(){return l()}),o.on("click",".cancel-existing",function(){return a()}),o.on("click",".edit-existing",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),c(e)}),o.on("keyup",".edition-mode input",function(t){var e;return 13===t.keyCode?(e=angular.element(t.currentTarget),c(e)):27===t.keyCode?(e=angular.element(t.currentTarget),a(e)):void 0}),o.on("click",".delete-webhook",function(){var t,o;return o=i.instant("ADMIN.WEBHOOKS.DELETE"),t=i.instant("ADMIN.WEBHOOKS.WEBHOOK_NAME",{name:m.name}),r.askOnDelete(o,t).then(function(t){return function(t){var i,o;return o=function(){return t.finish(),n.$emit("webhooks:reload")},i=function(){return t.finish(!1),r.notify("error")},e.remove(m).then(o,i)}}(this))}),o.on("click",".toggle-history",function(t){var e;return e=angular.element(t.currentTarget),null==m.logs||0===m.logs.length?f().then(function(){return g(0,function(){return o.find(".webhooks-history").toggleClass("open"),h()})}):(o.find(".webhooks-history").toggleClass("open"),n.$apply(function(){return h()}))}),o.on("click",".history-single",function(t){var e;return e=angular.element(t.currentTarget),e.toggleClass("history-single-open"),e.siblings(".history-single-response").toggleClass("open")}),o.on("click",".resend-request",function(e){var r,n;return n=angular.element(e.currentTarget),r=n.data("log"),t.webhooklogs.resend(r).then(function(t){return function(){return f()}}(this))})},{link:o}},h.directive("tgWebhook",["$tgResources","$tgRepo","$tgConfirm","$tgLoading","$translate",c]),s=function(t,e,r,n){var i;return i=function(t,n,i){var o,s,a,u,c;return c=t.$eval(i.tgWebhook),s=n.find(".new-webhook-form"),o=n.find(".add-webhook"),a=function(){return t.newValue={name:"",url:"",key:""}},a(),t.$watch("webhooks",function(t){return null!=t?0===t.length?(s.removeClass("hidden"),o.addClass("hidden"),s.find("input")[0].focus()):(s.addClass("hidden"),o.removeClass("hidden")):void 0}),u=d(2e3,function(){var n,i;return n=s.checksley(),n.validate()?(t.newValue.project=t.project.id,i=e.create("webhooks",t.newValue),i.then(function(e){return function(){return t.$emit("webhooks:reload"),a()}}(this)),i.then(null,function(t){return r.notify("error"),n.setErrors(t)})):void 0}),s.on("click",".add-new",function(t){return t.preventDefault(),u()}),s.on("keyup","input",function(t){return 13===t.keyCode?u():void 0}),s.on("click",".cancel-new",function(e){return t.$apply(function(){return a(),t.webhooks.length>=1?s.addClass("hidden"):void 0})}),o.on("click",function(t){return s.removeClass("hidden"),s.find("input")[0].focus()})},{link:i}},h.directive("tgNewWebhook",["$tgResources","$tgRepo","$tgConfirm","$tgLoading",s]),r=function(t){function e(t,e,r,n,i,o){var s;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,p(this),this.scope.sectionName=this.translate.instant("ADMIN.GITHUB.SECTION_NAME"),this.scope.project={},s=this.loadInitialData(),s.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.GITHUB.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),s.then(null,this.onInitialDataError.bind(this))}return v(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],e.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"github").then(function(t){return function(e){return t.scope.github=e}}(this))},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(){return t.loadModules()}}(this)),t},e}(f(m.Controller,m.PageMixin,m.FiltersMixin)),h.controller("GithubController",r),i=function(t){function e(t,e,r,n,i,o){var s;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,p(this),this.scope.sectionName=this.translate.instant("ADMIN.GITLAB.SECTION_NAME"),this.scope.project={},s=this.loadInitialData(),s.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.GITLAB.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),s.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:modules:reload",function(t){return function(){return t.loadModules()}}(this))}return v(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],e.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"gitlab").then(function(t){return function(e){return t.scope.gitlab=e}}(this))},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(){return t.loadModules()}}(this)),t},e}(f(m.Controller,m.PageMixin,m.FiltersMixin)),h.controller("GitlabController",i),t=function(t){function e(t,e,r,n,i,o){var s;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.appMetaService=i,this.translate=o,p(this),this.scope.sectionName=this.translate.instant("ADMIN.BITBUCKET.SECTION_NAME"),this.scope.project={},s=this.loadInitialData(),s.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.BITBUCKET.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(r,e)}}(this)),s.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:modules:reload",function(t){return function(){return t.loadModules()}}(this))}return v(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],e.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"bitbucket").then(function(t){return function(e){return t.scope.bitbucket=e}}(this))},e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),t.then(function(t){return function(){return t.loadModules()}}(this)),t},e}(f(m.Controller,m.PageMixin,m.FiltersMixin)),h.controller("BitbucketController",t),a=function(){var t;return t=function(t,e,r){return e.on("click",".select-input-content",function(){return e.find("input").select(),e.find(".help-copy").addClass("visible")})},{link:t}},h.directive("tgSelectInputText",a),n=function(t,e,r){var n;return n=function(n,i,o){var s,a,u;return s=i.find("form").checksley({onlyOneErrorElement:!0}),a=d(2e3,function(i){return function(i){var o,a;return i.preventDefault(),s.validate()?(o=r().target(u).start(),a=t.saveAttribute(n.github,"github"),a.then(function(){return o.finish(),e.notify("success")}),a.then(null,function(t){return o.finish(),s.setErrors(t),t._error_message?e.notify("error",t._error_message):void 0})):void 0}}(this)),u=i.find(".submit-button"),i.on("submit","form",a)},{link:n}},h.directive("tgGithubWebhooks",["$tgRepo","$tgConfirm","$tgLoading",n]),o=function(t,e,r){var n;return n=function(n,i,o){var s,a,u;return s=i.find("form").checksley({onlyOneErrorElement:!0}),a=d(2e3,function(i){return function(i){var o,a;return i.preventDefault(),s.validate()?(o=r().target(u).start(),a=t.saveAttribute(n.gitlab,"gitlab"),a.then(function(){return o.finish(),e.notify("success"),n.$emit("project:modules:reload")}),a.then(null,function(t){return o.finish(),s.setErrors(t),t._error_message?e.notify("error",t._error_message):void 0})):void 0}}(this)),u=i.find(".submit-button"),i.on("submit","form",a)},{link:n}},h.directive("tgGitlabWebhooks",["$tgRepo","$tgConfirm","$tgLoading",o]),e=function(t,e,r){var n;return n=function(n,i,o){var s,a,u;return s=i.find("form").checksley({onlyOneErrorElement:!0}),a=d(2e3,function(i){return function(i){var o,a;return i.preventDefault(),s.validate()?(o=r().target(u).start(),a=t.saveAttribute(n.bitbucket,"bitbucket"),a.then(function(){return o.finish(),e.notify("success"),n.$emit("project:modules:reload")}),a.then(null,function(t){return o.finish(),s.setErrors(t),t._error_message?e.notify("error",t._error_message):void 0})):void 0}}(this)),u=i.find(".submit-button"),i.on("submit","form",a)},{link:n}},h.directive("tgBitbucketWebhooks",["$tgRepo","$tgConfirm","$tgLoading",e]),u=function(){var t;return t=function(t,e,r,n){return n.$parsers.push(function(t){return t=$.trim(t),""===t?[]:t.split(",")})},{link:t,restrict:"EA",require:"ngModel"}},h.directive("tgValidOriginIps",u)}.call(this),function(){var t,e;e=angular.module("taigaProject"),t=function(){return{templateUrl:"project/wizard-restrictions.html"}},e.directive("tgCreateProjectRestriction",[t])}.call(this),function(){var t,e,r,n,i,o,s;o=this.taiga,r=this.taiga.bindOnce,s=this.taiga.timeout,n=this.taiga.debounce,i=angular.module("taigaProject"),t=function(t,e,r,n,i,o,s,a,u,c,l,p,d){var f,h;return h=function(i,f,h){var m,g,v,y,b,$,S;return i.data={},i.templates=[],m=null,g=f.find("form").checksley({onlyOneErrorElement:!0}),y=function(e){return c.get("$http").removeAll(),m.finish(),t.$broadcast("projects:reload"),r.notify("success",l.instant("COMMON.SAVE")),n.url(s.get(e)),u.close(f),p.loadProjects()},v=function(t){var e,r,n,i,o,s;for(m.finish(),g.setErrors(t),s=[],i=_.keys(t),o=[],r=0,n=i.length;n>r;r++)e=i[r],o.push(s.push("[name="+e+"]"));return o},$=function(t){return function(t){var r;return t.preventDefault(),g.validate()?(m=a().target(S).start(),r=e.create("projects",i.data),r.then(y,v)):void 0}}(this),b=function(){return i.data={is_private:!1},i.templates.length?i.data.creation_template=_.head(_.filter(i.templates,function(t){return"scrum"===t.slug})).id:o.projects.templates().then(function(t){return function(t){return i.templates=t,i.data.creation_template=_.head(_.filter(i.templates,function(t){return"scrum"===t.slug})).id}}(this)),i.canCreatePrivateProjects=p.canCreatePrivateProjects(),i.canCreatePublicProjects=p.canCreatePublicProjects(),u.open(f)},S=f.find(".submit-button"),f.on("submit","form",$),f.on("click",".close",function(t){return t.preventDefault(),u.close(f)}),i.$on("$destroy",function(){return f.off()}),d.refresh().then(function(){return b()})},f={link:h,templateUrl:"project/wizard-create-project.html",scope:{}}},i.directive("tgLbCreateProject",["$rootScope","$tgRepo","$tgConfirm","$location","$tgNavUrls","$tgResources","$projectUrl","$tgLoading","lightboxService","$cacheFactory","$translate","tgCurrentUserService","$tgAuth",t]),e=function(t,e,r,n,i,o,s,a,u){var c;return c=function(r,c,l){var p,d;return p=null,r.$on("deletelightbox:new",function(t,e){return s.open(c),p=e}),r.$on("$destroy",function(){return c.off()}),d=function(){var r;return a.start(),s.close(c),r=t.remove(p),r.then(function(t){return a.pageLoaded(),e.$broadcast("projects:reload"),n.path(i.resolve("home")),o.notify("success"),u.loadProjects()}),r.then(null,function(){return o.notify("error"),s.close(c)})},c.on("click",".button-red",function(t){return t.preventDefault(),s.close(c)}),c.on("click",".button-green",function(t){return t.preventDefault(),d()})},{link:c}},i.directive("tgLbDeleteProject",["$tgRepo","$rootScope","$tgAuth","$tgLocation","$tgNavUrls","$tgConfirm","lightboxService","tgLoader","tgCurrentUserService",e])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l;c=this.taiga.bindOnce,r=function(){var t;return t=function(t,e,r){return c(t,r.tgBoBind,function(t){return e.text(t)})},{link:t}},i=function(){var t;return t=function(t,e,r){return c(t,r.tgBoHtml,function(t){return e.html(t)})},{link:t}},o=function(){var t;return t=function(t,e,r){return c(t,r.tgBoRef,function(t){return e.html("#"+t+" ")})},{link:t}},s=function(){var t;return t=function(t,e,r){return c(t,r.tgBoSrc,function(t){return e.attr("src",t)})},{link:t}},n=function(){var t;return t=function(t,e,r){return c(t,r.tgBoHref,function(t){return e.attr("href",t)})},{link:t}},e=function(){var t;return t=function(t,e,r){return c(t,r.tgBoAlt,function(t){return e.attr("alt",t)})},{link:t}},a=function(){var t;return t=function(t,e,r){return c(t,r.tgBoTitle,function(t){return e.attr("title",t)})},{link:t}},u=function(){var t;return t=function(t,e,r){return t.$watch(r.tgTitleHtml,function(t){return null!=t?e.attr("title",t):void 0})},{link:t}},t=function(){var t;return t=function(t,e,r){return t.$watch(r.tgBindHtml,function(t){return null!=t?e.html(t):void 0})},{link:t}},l=angular.module("taigaBase"),l.directive("tgBoBind",r),l.directive("tgBoHtml",i),l.directive("tgBoRef",o),l.directive("tgBoSrc",s),l.directive("tgBoHref",n),l.directive("tgBoAlt",e),l.directive("tgBoTitle",a),l.directive("tgBindTitle",u),l.directive("tgBindHtml",t)}.call(this),function(){var t,e;t=function(){function t(){this.config=window.taigaConfig}return t.prototype.get=function(t,e){return null==e&&(e=null),_.has(this.config,t)?this.config[t]:e},t}(),e=angular.module("taigaBase"),e.service("$tgConfig",t)}.call(this),function(){var t,e,r,n=function(t,e){function r(){this.constructor=t}for(var n in e)i.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;r=angular.module("taigaBase"),t=function(t){function e(t,e,r,n,i,o){var s;this.rootScope=t,this.scope=e,this.params=r,this.repo=n,this.rs=i,this.confirm=o,this.scope.currentPlugin=_.head(_.filter(this.rootScope.adminPlugins,{slug:this.params.plugin})),this.scope.projectSlug=this.params.pslug,s=this.loadInitialData(),s.then(null,function(t){return function(){return t.confirm.notify("error")}}(this))}return n(e,t),e.$inject=["$rootScope","$scope","$routeParams","$tgRepo","$tgResources","$tgConfirm"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),t.scope.$broadcast("project:loaded",e),e}}(this))},e.prototype.loadInitialData=function(){return this.loadProject()},e}(taiga.Controller),r.controller("ContribController",t),e=function(t){function e(t,e,r){this.rootScope=t,this.scope=e,this.params=r,this.scope.currentPlugin=_.head(_.filter(this.rootScope.userSettingsPlugins,{
-slug:this.params.plugin}))}return n(e,t),e.$inject=["$rootScope","$scope","$routeParams"],e}(taiga.Controller),r.controller("ContribUserSettingsController",e)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga,t=function(t){function e(t,e){this.storage=t,this.params=e}return r(e,t),e.$inject=["$tgStorage","$routeParams"],e.prototype.generateHash=function(t){return null==t&&(t=[]),t=_.map(t,function(t){return JSON.stringify(t)}),hex_sha1(t.join(":"))},e}(e.Service)}.call(this),function(){var t,e,r,n=function(t,e){function r(){this.constructor=t}for(var n in e)i.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;r=this.taiga,t=function(t){function e(t,r,n,i,o,s){this.http=t,this.q=r,this.storage=n,this.rootScope=i,this.cacheFactory=o,this.translate=s,e.__super__.constructor.call(this),this.cache=this.cacheFactory("httpget")}return n(e,t),e.$inject=["$http","$q","$tgStorage","$rootScope","$cacheFactory","$translate"],e.prototype.headers=function(){var t,e,r;return t={},r=this.storage.get("token"),r&&(t.Authorization="Bearer "+r),e=this.translate.preferredLanguage(),e&&(t["Accept-Language"]=e),t},e.prototype.request=function(t){return t.headers=_.assign({},t.headers||{},this.headers()),this.http(t)},e.prototype.get=function(t,e,r){return r=_.assign({method:"GET",url:t},r),e&&(r.params=e),r.cache=this.cache,this.request(r)["finally"](function(t){return function(e){return t.cache.removeAll()}}(this))},e.prototype.post=function(t,e,r,n){return n=_.assign({method:"POST",url:t},n),e&&(n.data=e),r&&(n.params=r),this.request(n)},e.prototype.put=function(t,e,r,n){return n=_.assign({method:"PUT",url:t},n),e&&(n.data=e),r&&(n.params=r),this.request(n)},e.prototype.patch=function(t,e,r,n){return n=_.assign({method:"PATCH",url:t},n),e&&(n.data=e),r&&(n.params=r),this.request(n)},e.prototype["delete"]=function(t,e,r,n){return n=_.assign({method:"DELETE",url:t},n),e&&(n.data=e),r&&(n.params=r),this.request(n)},e}(r.Service),e=angular.module("taigaBase"),e.service("$tgHttp",t)}.call(this),function(){var t,e;t=function(t,e,r){return t.noreload=function(r){var n,i;return n=e.current,i=r.$on("$locationChangeSuccess",function(){return e.current=n,i()}),t},t.isInCurrentRouteParams=function(e,r){var n;return n=t.search()||{},n[e]===r},t},e=angular.module("taigaBase"),e.factory("$tgLocation",["$location","$route","$rootScope",t])}.call(this),function(){var t,e,r,n,i,o=[].indexOf||function(t){for(var e=0,r=this.length;r>e;e++)if(e in this&&this[e]===t)return e;return-1},s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;t=function(){function t(t,e,r){this._attrs=e,this._name=t,this._dataTypes=r,this.setAttrs(e),this.initialize()}return t.prototype.clone=function(){var e;return e=new t(this._name,this._attrs,this._dataTypes),e._modifiedAttrs=this._modifiedAttrs,e._isModified=this._isModified,e},t.prototype.applyCasts=function(){var t,e,r,n,i;n=this._dataTypes,i=[];for(t in n)r=n[t],e=service.casts[r],e&&i.push(this._attrs[t]=e(this._attrs[t]));return i},t.prototype.getIdAttrName=function(){return"id"},t.prototype.getName=function(){return this._name},t.prototype.getAttrs=function(t){return null==t&&(t=!1),null!=this._attrs.version&&(this._modifiedAttrs.version=this._attrs.version),t?_.extend({},this._modifiedAttrs):_.extend({},this._attrs,this._modifiedAttrs)},t.prototype.setAttrs=function(t){return this._attrs=t,this._modifiedAttrs={},this.applyCasts(),this._isModified=!1},t.prototype.setAttr=function(t,e){return this._modifiedAttrs[t]=e,this._isModified=!0},t.prototype.initialize=function(){var t,e,r;return e=this,t=function(t){return function(){return"string"==typeof t&&"__"===t.substr(0,2)?e[t]:o.call(_.keys(e._modifiedAttrs),t)<0?e._attrs[t]:e._modifiedAttrs[t]}},r=function(t){return function(r){return"string"==typeof t&&"__"===t.substr(0,2)?void(e[t]=r):void(e._attrs[t]!==r?(e._modifiedAttrs[t]=r,e._isModified=!0):delete e._modifiedAttrs[t])}},_.each(this._attrs,function(n,i){var o;return o={get:t(i),set:r(i),enumerable:!0,configurable:!0},Object.defineProperty(e,i,o)})},t.prototype.serialize=function(){var t;return t={data:_.clone(this._attrs),name:this._name},JSON.stringify(t)},t.prototype.isModified=function(){return this._isModified},t.prototype.isAttributeModified=function(t){return null!=this._modifiedAttrs[t]},t.prototype.markSaved=function(){return this._isModified=!1,this._attrs=this.getAttrs(),this._modifiedAttrs={}},t.prototype.revert=function(){return this._modifiedAttrs={},this._isModified=!1},t.desSerialize=function(e){var r,n;return r=JSON.parse(e),n=new t(r.url,r.data)},t}(),i=this.taiga,e=function(t){function e(t,r,n,i){this.q=t,this.urls=r,this.storage=n,this.http=i,e.__super__.constructor.call(this)}return s(e,t),e.$inject=["$q","$tgUrls","$tgStorage","$tgHttp"],e}(i.Service),n=function(e,r,n,i){var o;return o={},o.make_model=function(e,r,n,i){return null==n&&(n=t),null==i&&(i={}),new n(e,r,i)},o.cls=t,o.casts={"int":function(t){return parseInt(t,10)},"float":function(t){return parseFloat(t,10)}},o},r=angular.module("taigaBase"),r.factory("$tgModel",["$q","$http","$tgUrls","$tgStorage",n])}.call(this),function(){var t,e,r,n,i,o,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=this.taiga,o=this.taiga.trim,r=this.taiga.bindOnce,n=angular.module("taigaBase"),e=function(t){function e(){this.urls={}}return s(e,t),e.prototype.update=function(t){return this.urls=_.merge({},this.urls,t||{})},e.prototype.formatUrl=function(t,e){var r;return null==e&&(e={}),r=function(t){return t=o(t,":"),e[t]||"undefined"},t.replace(/(:\w+)/g,r)},e.prototype.resolve=function(t,e){var r;return r=this.urls[t],r?e?this.formatUrl(r,e):r:""},e}(i.Service),n.service("$tgNavUrls",e),t=function(t,e,n,i,s){var a,u,c;return a=function(t,e){var i;return i=n.defer(),r(t,e,function(t){return i.resolve(t)}),i.promise},c=function(t,e){var r,i,s,u,c,l,p,d;if(l=_.map(t.split(":"),o),i=l[0],u=l[1],u)for(p=u.split(/(\w+)=/),p=_.filter(p,function(t){return t.length}),p=_.map(p,function(t){return o(t.replace(/,$/g,""))}),u=[],r=0;rt;t++)s=u[t],r=Object.keys(s)[0],a=s[r],o[r]=e.$eval(a);return[i,o]})},u=function(r,n,o){return n.is("a")&&n.attr("href","#"),n.on("mouseenter",function(a){var u;return u=$(a.currentTarget),u.data("fullUrl")&&o.tgNavGetParams===u.data("params")?void 0:c(o.tgNav,r).then(function(a){var c,l,p,d,f,h,m;return d=a[0],f=a[1],m=e.getUser(),m&&(f.user=m.username),h=t.resolve(d),c=t.formatUrl(h,f),o.tgNavGetParams&&(l=JSON.parse(o.tgNavGetParams),p=$.param(l),c=c+"?"+p,u.data("params",o.tgNavGetParams)),u.data("fullUrl",c),u.is("a")&&u.attr("href",c),n.on("click",function(t){if(!t.metaKey&&!t.ctrlKey&&(t.preventDefault(),u=$(t.currentTarget),!u.hasClass("noclick"))){switch(c=u.data("fullUrl"),t.which){case 1:i.url(c),r.$apply();break;case 2:window.open(c)}return s.closeAll()}})})}),r.$on("$destroy",function(){return n.off()})},{link:u}},n.directive("tgNav",["$tgNavUrls","$tgAuth","$q","$tgLocation","lightboxService",t])}.call(this),function(){var t,e,r,n=function(t,e){function r(){this.constructor=t}for(var n in e)i.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;r=this.taiga,t=function(t){function e(t,r,n,i,o){this.q=t,this.model=r,this.storage=n,this.http=i,this.urls=o,e.__super__.constructor.call(this)}return n(e,t),e.$inject=["$q","$tgModel","$tgStorage","$tgHttp","$tgUrls"],e.prototype.resolveUrlForModel=function(t){var e;return e=t.getIdAttrName(),this.urls.resolve(t.getName())+"/"+t[e]},e.prototype.resolveUrlForAttributeModel=function(t){return this.urls.resolve(t.getName(),t.parent)},e.prototype.create=function(t,e,r,n){var i,o,s;return null==r&&(r={}),null==n&&(n={}),i=this.q.defer(),s=this.urls.resolve(t),o=this.http.post(s,JSON.stringify(e)),o.success(function(e){return function(n,o){return i.resolve(e.model.make_model(t,n,null,r))}}(this)),o.error(function(t){return function(t,e){return i.reject(t)}}(this)),i.promise},e.prototype.remove=function(t,e){var r,n,i;return null==e&&(e={}),r=this.q.defer(),i=this.resolveUrlForModel(t),n=this.http["delete"](i,{},e),n.success(function(e,n){return r.resolve(t)}),n.error(function(e,n){return r.reject(t)}),r.promise},e.prototype.saveAll=function(t,e){var r;return null==e&&(e=!0),r=_.map(t,function(t){return function(e){return t.save(e,!0)}}(this)),this.q.all(r)},e.prototype.save=function(t,e){var r,n,i,o;return null==e&&(e=!0),n=this.q.defer(),!t.isModified()&&e?(n.resolve(t),n.promise):(o=this.resolveUrlForModel(t),r=JSON.stringify(t.getAttrs(e)),i=e?this.http.patch(o,r):this.http.put(o,r),i.success(function(e){return function(e,r){return t._isModified=!1,t._attrs=_.extend(t.getAttrs(),e),t._modifiedAttrs={},t.applyCasts(),n.resolve(t)}}(this)),i.error(function(t,e){return n.reject(t)}),n.promise)},e.prototype.saveAttribute=function(t,e,r){var n,i,o,s;return null==r&&(r=!0),i=this.q.defer(),!t.isModified()&&r?(i.resolve(t),i.promise):(s=this.resolveUrlForAttributeModel(t),n={},n[e]=t.getAttrs(),o=r?this.http.patch(s,n):this.http.put(s,n),o.success(function(e){return function(e,r){return t._isModified=!1,t._attrs=_.extend(t.getAttrs(),e),t._modifiedAttrs={},t.applyCasts(),i.resolve(t)}}(this)),o.error(function(t,e){return i.reject(t)}),i.promise)},e.prototype.refresh=function(t){var e,r,n;return e=this.q.defer(),n=this.resolveUrlForModel(t),r=this.http.get(n),r.success(function(r,n){return t._modifiedAttrs={},t._attrs=r,t._isModified=!1,t.applyCasts(),e.resolve(t)}),r.error(function(t,r){return e.reject(t)}),e.promise},e.prototype.queryMany=function(t,e,r,n){var i,o;return null==r&&(r={}),null==n&&(n=!1),o=this.urls.resolve(t),i={headers:{}},r.enablePagination||(i.headers["x-disable-pagination"]="1"),this.http.get(o,e,i).then(function(e){return function(r){var i;return i=_.map(r.data,function(r){return e.model.make_model(t,r)}),n?[i,r.headers]:i}}(this))},e.prototype.queryOneAttribute=function(t,e,r,n,i){var o,s;return null==i&&(i={}),s=this.urls.resolve(t,e),o={headers:{}},i.enablePagination||(o.headers["x-disable-pagination"]="1"),this.http.get(s,n,o).then(function(n){return function(i){var o;return o=n.model.make_model(t,i.data[r]),o.parent=e,o}}(this))},e.prototype.queryOne=function(t,e,r,n){var i,o;return null==n&&(n={}),o=this.urls.resolve(t),e&&(o=o+"/"+e),i={headers:{}},n.enablePagination||(i.headers["x-disable-pagination"]="1"),this.http.get(o,r,i).then(function(e){return function(r){return e.model.make_model(t,r.data)}}(this))},e.prototype.queryOneRaw=function(t,e,r,n){var i,o;return null==n&&(n={}),o=this.urls.resolve(t),e&&(o=o+"/"+e),i=_.merge({headers:{}},n),n.enablePagination||(i.headers["x-disable-pagination"]="1"),this.http.get(o,r,i).then(function(t){return function(t){return t.data}}(this))},e.prototype.queryPaginated=function(t,e,r){var n,i;return null==r&&(r={}),i=this.urls.resolve(t),n=_.merge({headers:{}},r),this.http.get(i,e,n).then(function(e){return function(r){var n,i;return n=r.headers(),i={},i.models=_.map(r.data,function(r){return e.model.make_model(t,r)}),i.count=parseInt(n["x-pagination-count"],10),i.current=parseInt(n["x-pagination-current"]||1,10),i.paginatedBy=parseInt(n["x-paginated-by"],10),i}}(this))},e.prototype.queryOnePaginatedRaw=function(t,e,r,n){var i,o;return null==n&&(n={}),o=this.urls.resolve(t),e&&(o=o+"/"+e),i=_.merge({headers:{}},n),this.http.get(o,r,i).then(function(t){return function(t){var e,r;return e=t.headers(),r={},r.data=t.data,r.count=parseInt(e["x-pagination-count"],10),r.current=parseInt(e["x-pagination-current"]||1,10),r.paginatedBy=parseInt(e["x-paginated-by"],10),r}}(this))},e.prototype.resolve=function(t){var e,r;return r={},null!=t.pslug&&(r.project=t.pslug),null!=t.usref&&(r.us=t.usref),null!=t.taskref&&(r.task=t.taskref),null!=t.issueref&&(r.issue=t.issueref),null!=t.sslug&&(r.milestone=t.sslug),null!=t.wikipage&&(r.wikipage=t.wikipage),e=!(t.wikipage||t.sslug),this.queryOneRaw("resolver",null,r,{cache:e})},e}(r.Service),e=angular.module("taigaBase"),e.service("$tgRepo",t)}.call(this),function(){var t,e,r,n=function(t,e){function r(){this.constructor=t}for(var n in e)i.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;r=this.taiga,t=function(t){function e(t){e.__super__.constructor.call(this)}return n(e,t),e.$inject=["$rootScope"],e.prototype.get=function(t,e){var r;return r=localStorage.getItem(t),null===r?e||null:JSON.parse(r)},e.prototype.set=function(t,e){return _.isObject(t)?_.each(t,function(t){return function(e,r){return t.set(r,e)}}(this)):localStorage.setItem(t,JSON.stringify(e))},e.prototype.contains=function(t){var e;return e=this.get(t),null!==e},e.prototype.remove=function(t){return localStorage.removeItem(t)},e.prototype.clear=function(){return localStorage.clear()},e}(r.Service),e=angular.module("taigaBase"),e.service("$tgStorage",t)}.call(this),function(){var t,e,r,n,i=function(t,e){function r(){this.constructor=t}for(var n in e)o.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},o={}.hasOwnProperty;e=function(t,e){return e=_.clone(e),t.replace(/%s/g,function(t){return String(e.shift())})},n=this.taiga,t=function(t){function r(t){this.config=t,this.urls={},this.mainUrl=this.config.get("api")}return i(r,t),r.$inject=["$tgConfig"],r.prototype.update=function(t){return this.urls=_.merge(this.urls,t)},r.prototype.resolve=function(){var t,r,n;if(t=_.toArray(arguments),0===t.length)throw Error("wrong arguments to setUrls");return r=t.slice(0,1)[0],n=e(this.urls[r],t.slice(1)),e("%s/%s",[_.trimEnd(this.mainUrl,"/"),_.trimStart(n,"/")])},r.prototype.resolveAbsolute=function(){var t;return t=this.resolve.apply(this,arguments),/^https?:\/\//i.test(t)?t:/^\//.test(t)?window.location.protocol+"//"+window.location.host+t:window.location.protocol+"//"+window.location.host+"/"+t},r}(n.Service),r=angular.module("taigaBase"),r.service("$tgUrls",t)}.call(this),function(){var t,e,r;r=this.taiga,e=function(t){var e,r;return e=function(e,r){return t.queryOne(r,e)},r={userstory:{get:function(t){return e(t,"custom-attributes-values/userstory")}},task:{get:function(t){return e(t,"custom-attributes-values/task")}},issue:{get:function(t){return e(t,"custom-attributes-values/issue")}}},function(t){return t.customAttributesValues=r}},t=angular.module("taigaResources"),t.factory("$tgCustomAttributesValuesResourcesProvider",["$tgRepo",e])}.call(this),function(){var t,e,r,n;n=this.taiga,r=this.taiga.sizeFormat,e=function(t){var e,r;return e=function(e,r){return t.queryMany(r,{project:e})},r={userstory:{list:function(t){return e(t,"custom-attributes/userstory")}},task:{list:function(t){return e(t,"custom-attributes/task")}},issue:{list:function(t){return e(t,"custom-attributes/issue")}}},function(t){return t.customAttributes=r}},t=angular.module("taigaResources"),t.factory("$tgCustomAttributesResourcesProvider",["$tgRepo",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t,e,r){var n;return n={},n.get=function(e,r){return t.queryOneRaw("history/"+e,r)},n.deleteComment=function(t,n,i){var o,s;return s=r.resolve("history/"+t),s=s+"/"+n+"/delete_comment",o={id:i},e.post(s,null,o).then(function(t){return function(t){return t.data}}(this))},n.undeleteComment=function(t,n,i){var o,s;return s=r.resolve("history/"+t),s=s+"/"+n+"/undelete_comment",o={id:i},e.post(s,null,o).then(function(t){return function(t){return t.data}}(this))},function(t){return t.history=n}},t=angular.module("taigaResources"),t.factory("$tgHistoryResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t){var e;return e={},e.get=function(e){return t.queryOne("invitations",e)},function(t){return t.invitations=e}},t=angular.module("taigaResources"),t.factory("$tgInvitationsResourcesProvider",["$tgRepo",e])}.call(this),function(){var t,e,r,n;n=this.taiga,t=n.generateHash,r=function(e,r,n,i,o){var s,a,u,c;return c={},a="issues-queryparams",s="issues-filters",u="issues-my-filters",c.get=function(t,r){var n;return n=c.getQueryParams(t),n.project=t,e.queryOne("issues",r,n)},c.getByRef=function(t,r){var n;return n=c.getQueryParams(t),n.project=t,n.ref=r,e.queryOne("issues","by_ref",n)},c.listInAllProjects=function(t){return e.queryMany("issues",t)},c.list=function(t,r,n){var i;return i={project:t},i=_.extend({},i,r||{}),c.storeQueryParams(t,i),e.queryPaginated("issues",i,n)},c.bulkCreate=function(t,e){var i,o;return o=n.resolve("bulk-create-issues"),i={project_id:t,bulk_issues:e},r.post(o,i)},c.upvote=function(t){var e;return e=n.resolve("issue-upvote",t),r.post(e)},c.downvote=function(t){var e;return e=n.resolve("issue-downvote",t),r.post(e)},c.watch=function(t){var e;return e=n.resolve("issue-watch",t),r.post(e)},c.unwatch=function(t){var e;return e=n.resolve("issue-unwatch",t),r.post(e)},c.stats=function(t){return e.queryOneRaw("projects",t+"/issues_stats")},c.filtersData=function(t){return e.queryOneRaw("issues-filters",null,t)},c.listValues=function(t,r){var n;return n={project:t},c.storeQueryParams(t,n),e.queryMany(r,n)},c.storeQueryParams=function(e,r){var n,o;return o=e+":"+a,n=t([e,o]),i.set(n,r)},c.getQueryParams=function(e){var r,n;return n=e+":"+a,r=t([e,n]),i.get(r)||{}},c.storeFilters=function(e,r){var n,o;return o=e+":"+s,n=t([e,o]),i.set(n,r)},c.getFilters=function(e){var r,n;return n=e+":"+s,r=t([e,n]),i.get(r)||{}},c.storeMyFilters=function(e,i){var s,a,c,l,p;return s=o.defer(),p=n.resolve("user-storage"),c=e+":"+u,a=t([e,c]),_.isEmpty(i)?(l=r["delete"](p+"/"+a,{key:a,value:i}),l.then(function(){return s.resolve()}),l.then(null,function(){return s.reject()})):(l=r.put(p+"/"+a,{key:a,value:i}),l.then(function(t){return s.resolve()}),l.then(null,function(t){var e;return e=r.post(""+p,{key:a,value:i}),e.then(function(){return s.resolve()}),e.then(null,function(){return s.reject()})})),s.promise},c.getMyFilters=function(e){var i,s,a,c,l;return i=o.defer(),l=n.resolve("user-storage"),a=e+":"+u,s=t([e,a]),c=r.get(l+"/"+s),c.then(function(t){return i.resolve(t.data.value)}),c.then(null,function(t){return i.resolve({})}),i.promise},function(t){return t.issues=c}},e=angular.module("taigaResources"),e.factory("$tgIssuesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls","$tgStorage","$q",r])}.call(this),function(){var t,e,r,n;n=this.taiga,t=n.generateHash,r=function(e){var r,n,i;return i={},n="kanban-statusviewmodels",r="kanban-statuscolumnmodels",i.storeStatusViewModes=function(r,i){var o,s;return s=r+":"+n,o=t([r,s]),e.set(o,i)},i.getStatusViewModes=function(r){var i,o;return o=r+":"+n,i=t([r,o]),e.get(i)||{}},i.storeStatusColumnModes=function(n,i){var o,s;return s=n+":"+r,o=t([n,s]),e.set(o,i)},i.getStatusColumnModes=function(n){var i,o;return o=n+":"+r,i=t([n,o]),e.get(i)||{}},function(t){return t.kanban=i}},e=angular.module("taigaResources"),e.factory("$tgKanbanResourcesProvider",["$tgStorage",r])}.call(this),function(){var t,e,r,n;n=this.taiga,r=this.taiga.sizeFormat,e=function(t){var e;return e={list:function(){return t.queryMany("locales")}},function(t){return t.locales=e}},t=angular.module("taigaResources"),t.factory("$tgLocalesResourcesProvider",["$tgRepo",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t,e,r){var n;return n={},n.render=function(t,n){var i,o;return(null==n||""===n)&&(n=" "),i={project_id:t,content:n},o=e.resolve("wiki"),r.post(o+"/render",i).then(function(t){return function(t){return t.data}}(this))},function(t){return t.mdrender=n}},t=angular.module("taigaResources"),t.factory("$tgMdRenderResourcesProvider",["$tgRepo","$tgUrls","$tgHttp",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t,e,r){var n;return n={},n.get=function(e){return t.queryOne("memberships",e)},n.list=function(e,r,n){var i,o;return null==n&&(n=!0),o={project:e},o=_.extend({},o,r||{}),n?t.queryPaginated("memberships",o):t.queryMany("memberships",o,i={enablePagination:n})},n.listByUser=function(e,r){var n;return n={user:e},n=_.extend({},n,r||{}),t.queryPaginated("memberships",n)},n.resendInvitation=function(t){var n;return n=r.resolve("memberships"),e.post(n+"/"+t+"/resend_invitation",{})},n.bulkCreateMemberships=function(t,n,i){var o,s;return s=r.resolve("bulk-create-memberships"),o={project_id:t,bulk_memberships:n,invitation_extra_text:i},e.post(s,o)},function(t){return t.memberships=n}},t=angular.module("taigaResources"),t.factory("$tgMembershipsResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",e])}.call(this),function(){var t,e;e=function(t){var e;return e={},e.list=function(e,r){return t.queryOneAttribute("project-modules",e,r)},function(t){return t.modules=e}},t=angular.module("taigaResources"),t.factory("$tgModulesResourcesProvider",["$tgRepo",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t,e,r){var n;return n={},n.get=function(e){return t.queryOne("notify-policies",e)},n.list=function(e){var r;return r=_.extend({},r,e||{}),t.queryMany("notify-policies",r)},function(t){return t.notifyPolicies=n}},t=angular.module("taigaResources"),t.factory("$tgNotifyPoliciesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",e])}.call(this),function(){var t,e,r,n;n=this.taiga,r=this.taiga.sizeFormat,e=function(t,e,n,i,o,s,a){var u;return u={},u.get=function(t){return e.queryOne("projects",t)},u.getBySlug=function(t){return e.queryOne("projects","by_slug?slug="+t)},u.list=function(){return e.queryMany("projects")},u.listByMember=function(t){var r;return r={member:t,order_by:"memberships__user_order"},e.queryMany("projects",r)},u.templates=function(){return e.queryMany("project-templates")},u.usersList=function(t){var r;return r={project:t},e.queryMany("users",r)},u.rolesList=function(t){var r;return r={project:t},e.queryMany("roles",r)},u.stats=function(t){return e.queryOneRaw("projects",t+"/stats")},u.bulkUpdateOrder=function(t){var e;return e=i.resolve("bulk-update-projects-order"),n.post(e,t)},u.regenerate_userstories_csv_uuid=function(t){var e;return e=i.resolve("projects")+"/"+t+"/regenerate_userstories_csv_uuid",n.post(e)},u.regenerate_issues_csv_uuid=function(t){var e;return e=i.resolve("projects")+"/"+t+"/regenerate_issues_csv_uuid",n.post(e)},u.regenerate_tasks_csv_uuid=function(t){var e;return e=i.resolve("projects")+"/"+t+"/regenerate_tasks_csv_uuid",n.post(e)},u.leave=function(t){var e;return e=i.resolve("projects")+"/"+t+"/leave",n.post(e)},u.memberStats=function(t){return e.queryOneRaw("projects",t+"/member_stats")},u.tagsColors=function(t){return e.queryOne("projects",t+"/tags_colors")},u["export"]=function(t){var e;return e=i.resolve("exporter")+"/"+t,n.get(e)},u["import"]=function(e,n){var u,c,l,p,d,f,h,m,g,v,_;return l=s.defer(),f=t.get("maxUploadFileSize",null),f&&e.size>f?(p=a.instant("PROJECT.IMPORT.ERROR_MAX_SIZE_EXCEEDED",{fileName:e.name,fileSize:r(e.size),maxFileSize:r(f)}),h={status:413,data:{_error_message:p}},l.reject(h),l.promise):(v=function(t){return function(t){var e,i;return i=Math.round(t.loaded/t.total*100),e=a.instant("PROJECT.IMPORT.UPLOAD_IN_PROGRESS_MESSAGE",{uploadedSize:r(t.loaded),totalSize:r(t.total)}),n("in-progress",null,e,i)}}(this),m=function(t){return function(t){return n("done",a.instant("PROJECT.IMPORT.TITLE"),a.instant("PROJECT.IMPORT.DESCRIPTION"))}}(this),g=function(t){return function(t){return n("error")}}(this),u=function(t){return function(t){var e;h={};try{h.data=JSON.parse(t.target.responseText)}catch(r){h.data={}}return h.status=t.target.status,t.target.getResponseHeader("Taiga-Info-Project-Is-Private")&&(h.headers={isPrivate:"True"===t.target.getResponseHeader("Taiga-Info-Project-Is-Private"),memberships:parseInt(t.target.getResponseHeader("Taiga-Info-Project-Memberships"))}),(201===(e=h.status)||202===e)&&l.resolve(h),l.reject(h)}}(this),d=function(t){return function(t){return l.reject("fail")}}(this),c=new FormData,c.append("dump",e),_=new XMLHttpRequest,_.upload.addEventListener("progress",v,!1),_.upload.addEventListener("load",m,!1),_.upload.addEventListener("error",g,!1),_.upload.addEventListener("abort",g,!1),_.addEventListener("load",u,!1),_.addEventListener("error",d,!1),_.open("POST",i.resolve("importer")),_.setRequestHeader("Authorization","Bearer "+o.getToken()),_.setRequestHeader("Accept","application/json"),_.send(c),l.promise)},u.changeLogo=function(e,o){var a,u,c,l,p,d;return c=t.get("maxUploadFileSize",null),c&&o.size>c?(p={status:413,data:{_error_message:"'"+o.name+"' ("+r(o.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+r(c)+")"}},u=s.defer(),u.reject(p),u.promise):(a=new FormData,a.append("logo",o),l={transformRequest:angular.identity,headers:{"Content-Type":void 0}},d=i.resolve("projects")+"/"+e+"/change_logo",n.post(d,a,{},l))},u.removeLogo=function(t){var e;return e=i.resolve("projects")+"/"+t+"/remove_logo",n.post(e)},function(t){return t.projects=u}},t=angular.module("taigaResources"),t.factory("$tgProjectsResourcesProvider",["$tgConfig","$tgRepo","$tgHttp","$tgUrls","$tgAuth","$q","$translate",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t,e,r){var n;return n={},n.get=function(e){return t.queryOne("roles",e)},n.list=function(e){return t.queryMany("roles",{project:e})},function(t){return t.roles=n}},t=angular.module("taigaResources"),t.factory("$tgRolesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t,e,r,n){var i;return i={},i["do"]=function(t,i){var o,s,a,u;return o=n.defer(),u=e.resolve("search"),s={url:u,method:"GET",timeout:o.promise,cancelable:!0,params:{project:t,text:i,get_all:!1}},a=r.request(s).then(function(t){return t.data}),a.abort=function(){return o.resolve()},a["finally"]=function(){return a.abort=angular.noop,o=a=null},a},function(t){return t.search=i}},t=angular.module("taigaResources"),t.factory("$tgSearchResourcesProvider",["$tgRepo","$tgUrls","$tgHttp","$q",e])}.call(this),function(){var t,e,r,n;n=this.taiga,t=n.generateHash,r=function(t,e,r){var n;return n={},n.get=function(r,n){return t.queryOne("milestones",n).then(function(t){var r;return r=t.user_stories,r=_.map(r,function(t){return e.make_model("userstories",t)}),t._attrs.user_stories=r,t})},n.stats=function(e,r){return t.queryOneRaw("milestones",r+"/stats")},n.list=function(r,n){var i;return i={project:r},i=_.extend({},i,n||{}),t.queryMany("milestones",i,{},!0).then(function(t){return function(t){var r,n,i,o,s,a;for(s=t[0],r=t[1],n=0,i=s.length;i>n;n++)o=s[n],a=o.user_stories,a=_.map(a,function(t){return e.make_model("userstories",t)}),o._attrs.user_stories=a;return{milestones:s,closed:parseInt(r("Taiga-Info-Total-Closed-Milestones"),10),open:parseInt(r("Taiga-Info-Total-Opened-Milestones"),10)}}}(this))},function(t){return t.sprints=n}},e=angular.module("taigaResources"),e.factory("$tgSprintsResourcesProvider",["$tgRepo","$tgModel","$tgStorage",r])}.call(this),function(){var t,e,r,n;n=this.taiga,t=n.generateHash,r=function(e,r,n,i){var o,s,a,u;return u={},o="tasks-queryparams",s="tasks-statuscolumnmodels",a="tasks-usrowmodels",u.get=function(t,r){var n;return n=u.getQueryParams(t),n.project=t,e.queryOne("tasks",r,n)},u.getByRef=function(t,r){var n;return n=u.getQueryParams(t),n.project=t,n.ref=r,e.queryOne("tasks","by_ref",n)},u.listInAllProjects=function(t){return e.queryMany("tasks",t)},u.list=function(t,r,n){var i;return null==r&&(r=null),null==n&&(n=null),i={project:t},r&&(i.milestone=r),n&&(i.user_story=n),u.storeQueryParams(t,i),e.queryMany("tasks",i)},u.bulkCreate=function(t,e,i,o){var s,a;return a=n.resolve("bulk-create-tasks"),s={project_id:t,sprint_id:e,us_id:i,bulk_tasks:o},r.post(a,s).then(function(t){return t.data})},u.upvote=function(t){var e;return e=n.resolve("task-upvote",t),r.post(e)},u.downvote=function(t){var e;return e=n.resolve("task-downvote",t),r.post(e)},u.watch=function(t){var e;return e=n.resolve("task-watch",t),r.post(e)},u.unwatch=function(t){var e;return e=n.resolve("task-unwatch",t),r.post(e)},u.bulkUpdateTaskTaskboardOrder=function(t,e){var i,o;return o=n.resolve("bulk-update-task-taskboard-order"),i={project_id:t,bulk_tasks:e},r.post(o,i)},u.listValues=function(t,r){var n;return n={project:t},e.queryMany(r,n)},u.storeQueryParams=function(e,r){var n,s;return s=e+":"+o,n=t([e,s]),i.set(n,r)},u.getQueryParams=function(e){var r,n;return n=e+":"+o,r=t([e,n]),i.get(r)||{}},u.storeStatusColumnModes=function(e,r){var n,o;return o=e+":"+s,n=t([e,o]),i.set(n,r)},u.getStatusColumnModes=function(e){var r,n;return n=e+":"+s,r=t([e,n]),i.get(r)||{}},u.storeUsRowModes=function(e,r,n){var o,s;return s=e+":"+a,o=t([e,r,s]),i.set(o,n)},u.getUsRowModes=function(e,r){var n,o;return o=e+":"+a,n=t([e,r,o]),i.get(n)||{}},function(t){return t.tasks=u}},e=angular.module("taigaResources"),e.factory("$tgTasksResourcesProvider",["$tgRepo","$tgHttp","$tgUrls","$tgStorage",r])}.call(this),function(){var t,e,r,n;n=this.taiga,r=this.taiga.sizeFormat,e=function(t,e,n,i,o){var s;return s={},s.changeAvatar=function(e){var s,a,u,c,l,p;return u=t.get("maxUploadFileSize",null),u&&e.size>u?(l={status:413,data:{_error_message:"'"+e.name+"' ("+r(e.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+r(u)+")"}},a=o.defer(),a.reject(l),a.promise):(s=new FormData,s.append("avatar",e),c={transformRequest:angular.identity,headers:{"Content-Type":void 0}},p=i.resolve("users")+"/change_avatar",n.post(p,s,{},c))},s.removeAvatar=function(){var t;return t=i.resolve("users")+"/remove_avatar",n.post(t)},s.changePassword=function(t,e){var r,o;return o=i.resolve("users")+"/change_password",r={current_password:t,password:e},n.post(o,r)},function(t){return t.userSettings=s}},t=angular.module("taigaResources"),t.factory("$tgUserSettingsResourcesProvider",["$tgConfig","$tgRepo","$tgHttp","$tgUrls","$q",e])}.call(this),function(){var t,e,r,n;n=this.taiga,r=this.taiga.sizeFormat,e=function(t,e){var r;return r={},r.contacts=function(r,n){var i,o;return null==n&&(n={}),o=e.resolve("user-contacts",r),i={headers:{}},n.enablePagination||(i.headers["x-disable-pagination"]="1"),t.get(o,{},i).then(function(t){return t.data})},function(t){return t.users=r}},t=angular.module("taigaResources"),t.factory("$tgUsersResourcesProvider",["$tgHttp","$tgUrls","$q",e])}.call(this),function(){var t,e,r,n;n=this.taiga,t=n.generateHash,r=function(e,r,n,i){var o,s;return s={},o="userstories-queryparams",s.get=function(t,r){var n;return n=s.getQueryParams(t),n.project=t,e.queryOne("userstories",r,n)},s.getByRef=function(t,r){var n;return n=s.getQueryParams(t),n.project=t,n.ref=r,e.queryOne("userstories","by_ref",n)},s.listInAllProjects=function(t){return e.queryMany("userstories",t)},s.filtersData=function(t){return e.queryOneRaw("userstories-filters",null,t)},s.listUnassigned=function(t,r,n){var i;return i={project:t,milestone:"null"},i=_.extend({},i,r||{}),s.storeQueryParams(t,i),e.queryMany("userstories",_.extend(i,{page_size:n}),{enablePagination:!0},!0)},s.listAll=function(t,r){var n;return n={project:t},n=_.extend({},n,r||{}),s.storeQueryParams(t,n),e.queryMany("userstories",n)},s.bulkCreate=function(t,e,i){var o,s;return o={project_id:t,status_id:e,bulk_stories:i},s=n.resolve("bulk-create-us"),r.post(s,o)},s.upvote=function(t){var e;return e=n.resolve("userstory-upvote",t),r.post(e)},s.downvote=function(t){var e;return e=n.resolve("userstory-downvote",t),r.post(e)},s.watch=function(t){var e;return e=n.resolve("userstory-watch",t),
-r.post(e)},s.unwatch=function(t){var e;return e=n.resolve("userstory-unwatch",t),r.post(e)},s.bulkUpdateBacklogOrder=function(t,e){var i,o;return o=n.resolve("bulk-update-us-backlog-order"),i={project_id:t,bulk_stories:e},r.post(o,i)},s.bulkUpdateSprintOrder=function(t,e){var i,o;return o=n.resolve("bulk-update-us-sprint-order"),i={project_id:t,bulk_stories:e},r.post(o,i)},s.bulkUpdateKanbanOrder=function(t,e){var i,o;return o=n.resolve("bulk-update-us-kanban-order"),i={project_id:t,bulk_stories:e},r.post(o,i)},s.listValues=function(t,r){var n;return n={project:t},s.storeQueryParams(t,n),e.queryMany(r,n)},s.storeQueryParams=function(e,r){var n,s;return s=e+":"+o,n=t([e,s]),i.set(n,r)},s.getQueryParams=function(e){var r,n;return n=e+":"+o,r=t([e,n]),i.get(r)||{}},s.storeShowTags=function(e,r){var n;return n=t([e,"showTags"]),i.set(n,r)},s.getShowTags=function(e){var r;return r=t([e,"showTags"]),i.get(r)||null},function(t){return t.userstories=s}},e=angular.module("taigaResources"),e.factory("$tgUserstoriesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls","$tgStorage",r])}.call(this),function(){var t,e;e=function(t,e,r){var n;return n={},n.list=function(e){var r;return r={webhook:e},t.queryMany("webhooklogs",r)},n.resend=function(t){var n;return n=e.resolve("webhooklogs-resend",t),r.post(n)},function(t){return t.webhooklogs=n}},t=angular.module("taigaResources"),t.factory("$tgWebhookLogsResourcesProvider",["$tgRepo","$tgUrls","$tgHttp",e])}.call(this),function(){var t,e;e=function(t,e,r){var n;return n={},n.list=function(e){var r;return r={project:e},t.queryMany("webhooks",r)},n.test=function(t){var n;return n=e.resolve("webhooks-test",t),r.post(n)},function(t){return t.webhooks=n}},t=angular.module("taigaResources"),t.factory("$tgWebhooksResourcesProvider",["$tgRepo","$tgUrls","$tgHttp",e])}.call(this),function(){var t,e,r;r=this.taiga,e=function(t,e,r){var n;return n={},n.get=function(e){return t.queryOne("wiki",e)},n.getBySlug=function(e,r){return t.queryOne("wiki","by_slug?project="+e+"&slug="+r)},n.listLinks=function(e){return t.queryMany("wiki-links",{project:e})},function(t){return t.wiki=n}},t=angular.module("taigaResources"),t.factory("$tgWikiResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",e])}.call(this),function(){var t,e,r,n,i,o,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=this.taiga,n=this.taiga.mixOf,r=this.taiga.debounce,i=angular.module("taigaUserSettings"),t=function(t){function e(t,e,r,n,i,o,s,a,u,c,l){this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=a,this.navUrls=u,this.auth=c,this.translate=l,this.scope.sectionName=this.translate.instant("CHANGE_PASSWORD.SECTION_NAME"),this.scope.user=this.auth.getUser()}return s(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth","$translate"],e}(n(o.Controller,o.PageMixin)),i.controller("UserChangePasswordController",t),e=function(t,e,n,i){var o;return o=function(o,s,a,u){var c,l,p;return c=new checksley.Form(s.find("form")),l=r(2e3,function(r){return function(r){var s,a;return r.preventDefault(),c.validate()?o.newPassword1!==o.newPassword2?void e.notify("error",i.instant("CHANGE_PASSWORD.ERROR_PASSWORD_MATCH")):(s=n().target(p).start(),a=t.userSettings.changePassword(o.currentPassword,o.newPassword1),a.then(function(){return s.finish(),e.notify("success")}),a.then(null,function(t){return s.finish(),e.notify("error",t.data._error_message)})):void 0}}(this)),p=s.find(".submit-button"),s.on("submit","form",l),o.$on("$destroy",function(){return s.off()})},{link:o}},i.directive("tgUserChangePassword",["$tgResources","$tgConfirm","$tgLoading","$translate",e])}.call(this),function(){var t,e,r,n,i;i=this.taiga,e=this.taiga.bindOnce,r=this.taiga.debounce,n=angular.module("taigaUserSettings"),t=function(t,e,n,i,o,s,a){var u;return u=function(e,u,c){var l,p;return e.$on("deletelightbox:new",function(t,e){return s.open(u)}),e.$on("$destroy",function(){return u.off()}),l=function(){var r,c;return r=a().target(p).start(),c=t.remove(e.user),c.then(function(t){return r.finish(),s.close(u),n.logout(),i.path(o.resolve("login"))}),c.then(null,function(){return r.finish(),console.log("FAIL")})},u.on("click",".button-green",function(t){return t.preventDefault(),s.close(u)}),u.on("click",".button-red",r(2e3,function(t){return t.preventDefault(),l()})),p=u.find(".button-red")},{link:u,templateUrl:"user/lightbox/lightbox-delete-account.html"}},n.directive("tgLbDeleteUser",["$tgRepo","$rootScope","$tgAuth","$tgLocation","$tgNavUrls","lightboxService","$tgLoading",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;u=this.taiga,o=this.taiga.mixOf,a=this.taiga.sizeFormat,s=angular.module("taigaUserSettings"),i=this.taiga.debounce,n=function(t){function e(t,e,r,n,i,o,s,u,c,l,p,d){var f,h,m;this.scope=t,this.rootscope=e,this.config=r,this.repo=n,this.confirm=i,this.rs=o,this.params=s,this.q=u,this.location=c,this.navUrls=l,this.auth=p,this.translate=d,this.scope.sectionName="USER_SETTINGS.MENU.SECTION_TITLE",this.scope.project={},this.scope.user=this.auth.getUser(),this.scope.user||(this.location.path(this.navUrls.resolve("permission-denied")),this.location.replace()),this.scope.lang=this.getLan(),this.scope.theme=this.getTheme(),f=this.config.get("maxUploadFileSize",null),f&&(m=this.translate.instant("USER_SETTINGS.AVATAR_MAX_SIZE",{maxFileSize:a(f)}),this.scope.maxFileSizeMsg=m),h=this.loadInitialData(),h.then(null,this.onInitialDataError.bind(this))}return c(e,t),e.$inject=["$scope","$rootScope","$tgConfig","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth","$translate"],e.prototype.loadInitialData=function(){return this.scope.availableThemes=this.config.get("themes",[]),this.rs.locales.list().then(function(t){return function(e){return t.scope.locales=e,e}}(this))},e.prototype.openDeleteLightbox=function(){return this.rootscope.$broadcast("deletelightbox:new",this.scope.user)},e.prototype.getLan=function(){return this.scope.user.lang||this.translate.preferredLanguage()},e.prototype.getTheme=function(){return this.scope.user.theme||this.config.get("defaultTheme")||"taiga"},e}(o(u.Controller,u.PageMixin)),s.controller("UserSettingsController",n),r=function(t,e,r,n){var o;return o=function(o,s,a){var u;return u=i(2e3,function(i){return function(i){var a,u,c,l;return i.preventDefault(),u=s.find("form").checksley(),u.validate()?(a=o.user.isAttributeModified("email"),o.user.lang=o.lang,o.user.theme=o.theme,l=function(r){var i;return e.setUser(r),a?(i=n.instant("USER_PROFILE.CHANGE_EMAIL_SUCCESS"),t.success(i)):t.notify("success")},c=function(e){return u.setErrors(e),t.notify("error",e._error_message)},r.save(o.user).then(l,c)):void 0}}(this)),s.on("submit","form",u),o.$on("$destroy",function(){return s.off()})},{link:o}},s.directive("tgUserProfile",["$tgConfirm","$tgAuth","$tgRepo","$translate",r]),e=function(t,e,r,n){var i;return i=function(i,o,s){var a,u,c;return c=function(){return o.find(".size-info").removeClass("hidden")},u=function(r){var s;return s=e.make_model("users",r.data),t.setUser(s),i.user=s,o.find(".loading-overlay").removeClass("active"),n.notify("success")},a=function(t){return 413===t.status&&c(),o.find(".loading-overlay").removeClass("active"),n.notify("error",t.data._error_message)},o.on("click",".js-change-avatar",function(){return o.find("#avatar-field").click()}),o.on("change","#avatar-field",function(t){return i.avatarAttachment?(o.find(".loading-overlay").addClass("active"),r.userSettings.changeAvatar(i.avatarAttachment).then(u,a)):void 0}),o.on("click","a.js-use-gravatar",function(t){return o.find(".loading-overlay").addClass("active"),r.userSettings.removeAvatar().then(u,a)}),i.$on("$destroy",function(){return o.off()})},{link:i}},s.directive("tgUserAvatar",["$tgAuth","$tgModel","$tgResources","$tgConfirm",e]),t=function(t){var e;return e=function(e,r,n){var i,o;return i=t(n.tgAvatarModel),o=i.assign,r.bind("change",function(){return e.$apply(function(){return o(e,r[0].files[0])})})},{link:e}},s.directive("tgAvatarModel",["$parse",t])}.call(this),function(){var t,e;t=function(){var t;return t=function(t,e,r){var n;return n=r.tgUserSettingsNavigation,e.find(".active").removeClass("active"),e.find("#usersettingsmenu-"+n+" a").addClass("active"),t.$on("$destroy",function(){return e.off()})},{link:t}},e=angular.module("taigaUserSettings"),e.directive("tgUserSettingsNavigation",t)}.call(this),function(){var t,e,r,n,i,o,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=this.taiga,i=this.taiga.mixOf,n=this.taiga.bindOnce,o=angular.module("taigaUserSettings"),t=function(t){function e(t,e,r,n,i,o,s,a,u,c){var l;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=a,this.navUrls=u,this.auth=c,this.scope.sectionName="USER_SETTINGS.NOTIFICATIONS.SECTION_NAME",this.scope.user=this.auth.getUser(),l=this.loadInitialData(),l.then(null,this.onInitialDataError.bind(this))}return a(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth"],e.prototype.loadInitialData=function(){return this.rs.notifyPolicies.list().then(function(t){return function(e){return t.scope.notifyPolicies=e,e}}(this))},e}(i(s.Controller,s.PageMixin)),o.controller("UserNotificationsController",t),e=function(){var t;return t=function(t,e,r){return t.$on("$destroy",function(){return e.off()})},{link:t}},o.directive("tgUserNotifications",e),r=function(t,e,r){var i,o;return o=_.template('<% _.each(notifyPolicies, function (notifyPolicy, index) { %>\n\n
<%- notifyPolicy.project_name %>
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n<% }) %>'),i=function(i,s,a){var u;return u=function(){var n,a;return s.off(),n={notifyPolicies:i.notifyPolicies},a=o(n),s.html(r(a)(i)),s.on("change","input[type=radio]",function(r){var n,o,s,a,u,c;return c=angular.element(r.currentTarget),a=c.parents(".policy-table-row").data("index"),s=i.notifyPolicies[a],u=s.notify_level,s.notify_level=parseInt(c.val(),10),o=function(){return e.notify("success")},n=function(){return e.notify("error"),c.parents(".policy-table-row").find("input[value="+u+"]").prop("checked",!0)},t.save(s).then(o,n)})},i.$on("$destroy",function(){return s.off()}),n(i,a.ngModel,u)},{link:i}},o.directive("tgUserNotificationsList",["$tgRepo","$tgConfirm","$compile",r])}.call(this),function(){angular.module("taigaComponents",[])}.call(this),function(){var t;t=angular.module("taigaDiscover",[])}.call(this),function(){var t;t=angular.module("taigaExternalApps",[])}.call(this),function(){var t;t=angular.module("taigaHome",[])}.call(this),function(){angular.module("taigaNavigationBar",[])}.call(this),function(){var t;t=angular.module("taigaProfile",[])}.call(this),function(){angular.module("taigaProjects",[])}.call(this),function(){angular.module("taigaResources2",[])}.call(this),function(){angular.module("taigaUserTimeline",[])}.call(this),function(){var t;t=function(t,e){var r;return r=function(r,n,i){var o;return o=t(i.tgAttachmentLink)(r),n.on("click",function(t){return taiga.isImage(o.getIn(["file","name"]))?(t.preventDefault(),r.$apply(function(){return e.create("tg-lb-attachment-preview",{"class":"lightbox lightbox-block"},{file:o.get("file")})})):void 0}),r.$on("$destroy",function(){return n.off()})},{link:r}},t.$inject=["$parse","tgLightboxFactory"],angular.module("taigaComponents").directive("tgAttachmentLink",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){},{scope:{},bindToController:{attachment:"=",onDelete:"&",onUpdate:"&",type:"="},controller:"Attachment",controllerAs:"vm",templateUrl:"components/attachment/attachment-gallery.html",link:t}},t.$inject=[],angular.module("taigaComponents").directive("tgAttachmentGallery",t)}.call(this),function(){var t;t=function(){function t(t,e){this.attachmentsService=t,this.translate=e,this.form={},this.form.description=this.attachment.getIn(["file","description"]),this.form.is_deprecated=this.attachment.get(["file","is_deprecated"]),this.title=this.translate.instant("ATTACHMENT.TITLE",{fileName:this.attachment.get("name"),date:moment(this.attachment.get("created_date")).format(this.translate.instant("ATTACHMENT.DATE"))})}return t.$inject=["tgAttachmentsService","$translate"],t.prototype.editMode=function(t){var e;return e=this.attachment.set("editable",t),this.onUpdate({attachment:e})},t.prototype["delete"]=function(){return this.onDelete({attachment:this.attachment})},t.prototype.save=function(){var t;return t=this.attachment.set("loading",!0),this.onUpdate({attachment:t}),t=this.attachment.merge({editable:!1,loading:!1}),t=t.mergeIn(["file"],{description:this.form.description,is_deprecated:!!this.form.is_deprecated}),this.onUpdate({attachment:t})},t}(),angular.module("taigaComponents").controller("Attachment",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){},{scope:{},bindToController:{attachment:"=",onDelete:"&",onUpdate:"&",type:"="},controller:"Attachment",controllerAs:"vm",templateUrl:"components/attachment/attachment.html",link:t}},t.$inject=[],angular.module("taigaComponents").directive("tgAttachment",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){var i;return i=t(n.tgAttachmentsDrop),r.on("dragover",function(t){return t.preventDefault(),!1}),r.on("drop",function(t){var r;return t.stopPropagation(),t.preventDefault(),r=t.dataTransfer||t.originalEvent&&t.originalEvent.dataTransfer,e.$apply(function(){return i(e,{files:r.files})})}),e.$on("$destroy",function(){return r.off()})},{link:e}},t.$inject=["$parse"],angular.module("taigaComponents").directive("tgAttachmentsDrop",t)}.call(this),function(){var t,e;e=this.taiga.sizeFormat,t=function(){function t(t,r,n,i,o,s){this.translate=t,this.confirm=r,this.config=n,this.storage=i,this.attachmentsFullService=o,this.projectService=s,this.mode=this.storage.get("attachment-mode","list"),this.maxFileSize=this.config.get("maxUploadFileSize",null),this.maxFileSize&&(this.maxFileSize=e(this.maxFileSize)),this.maxFileSizeMsg=this.maxFileSize?this.translate.instant("ATTACHMENT.MAX_UPLOAD_SIZE",{maxFileSize:this.maxFileSize}):"",taiga.defineImmutableProperty(this,"attachments",function(t){return function(){return t.attachmentsFullService.attachments}}(this)),taiga.defineImmutableProperty(this,"deprecatedsCount",function(t){return function(){return t.attachmentsFullService.deprecatedsCount}}(this)),taiga.defineImmutableProperty(this,"attachmentsVisible",function(t){return function(){return t.attachmentsFullService.attachmentsVisible}}(this)),taiga.defineImmutableProperty(this,"deprecatedsVisible",function(t){return function(){return t.attachmentsFullService.deprecatedsVisible}}(this))}return t.$inject=["$translate","$tgConfirm","$tgConfig","$tgStorage","tgAttachmentsFullService","tgProjectService"],t.prototype.uploadingAttachments=function(){return this.attachmentsFullService.uploadingAttachments},t.prototype.addAttachment=function(t){var e;return e="list"===this.mode,this.attachmentsFullService.addAttachment(this.projectId,this.objId,this.type,t,e)},t.prototype.setMode=function(t){return this.mode=t,this.storage.set("attachment-mode",t)},t.prototype.toggleDeprecatedsVisible=function(){return this.attachmentsFullService.toggleDeprecatedsVisible()},t.prototype.addAttachments=function(t){return _.forEach(t,function(t){return function(e){return t.addAttachment(e)}}(this))},t.prototype.loadAttachments=function(){return this.attachmentsFullService.loadAttachments(this.type,this.objId,this.projectId)},t.prototype.deleteAttachment=function(t){var e,r;return r=this.translate.instant("ATTACHMENT.TITLE_LIGHTBOX_DELETE_ATTACHMENT"),e=this.translate.instant("ATTACHMENT.MSG_LIGHTBOX_DELETE_ATTACHMENT",{fileName:t.getIn(["file","name"])}),this.confirm.askOnDelete(r,e).then(function(r){return function(n){var i,o;return i=function(){return e=r.translate.instant("ATTACHMENT.ERROR_DELETE_ATTACHMENT",{errorMessage:e}),r.confirm.notify("error",null,e),n.finish(!1)},o=function(){return n.finish()},r.attachmentsFullService.deleteAttachment(t,r.type).then(o,i)}}(this))},t.prototype.reorderAttachment=function(t,e){return this.attachmentsFullService.reorderAttachment(this.type,t,e)},t.prototype.updateAttachment=function(t){return this.attachmentsFullService.updateAttachment(t,this.type)},t.prototype._isEditable=function(){return this.projectService.project?this.projectService.hasPermission(this.editPermission):!1},t.prototype.showAttachments=function(){return this._isEditable()||this.attachmentsFullService.attachments.size},t}(),angular.module("taigaComponents").controller("AttachmentsFull",t)}.call(this),function(){var t,e;e=this.taiga.bindOnce,t=function(){var t;return t=function(t,r,n,i){return e(t,"vm.objId",function(t){return i.loadAttachments()})},{scope:{},bindToController:{type:"@",objId:"=",projectId:"=",editPermission:"@"},controller:"AttachmentsFull",controllerAs:"vm",templateUrl:"components/attachments-full/attachments-full.html",link:t}},t.$inject=[],angular.module("taigaComponents").directive("tgAttachmentsFull",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(t,e){this.attachmentsService=t,this.rootScope=e,this._attachments=Immutable.List(),this._deprecatedsCount=0,this._attachmentsVisible=Immutable.List(),this._deprecatedsVisible=!1,this.uploadingAttachments=[],taiga.defineImmutableProperty(this,"attachments",function(t){return function(){return t._attachments}}(this)),taiga.defineImmutableProperty(this,"deprecatedsCount",function(t){return function(){return t._deprecatedsCount}}(this)),taiga.defineImmutableProperty(this,"attachmentsVisible",function(t){return function(){return t._attachmentsVisible}}(this)),taiga.defineImmutableProperty(this,"deprecatedsVisible",function(t){return function(){return t._deprecatedsVisible}}(this))}return e(r,t),r.$inject=["tgAttachmentsService","$rootScope"],r.prototype.toggleDeprecatedsVisible=function(){return this._deprecatedsVisible=!this._deprecatedsVisible,this.regenerate()},r.prototype.regenerate=function(){return this._deprecatedsCount=this._attachments.count(function(t){return t.getIn(["file","is_deprecated"])}),this._deprecatedsVisible?this._attachmentsVisible=this._attachments:this._attachmentsVisible=this._attachments.filter(function(t){return!t.getIn(["file","is_deprecated"])})},r.prototype.addAttachment=function(t,e,r,n,i){return null==i&&(i=!0),new Promise(function(o){return function(s,a){var u;return o.attachmentsService.validate(n)?(o.uploadingAttachments.push(n),u=o.attachmentsService.upload(n,e,t,r),u.then(function(t){var e;return o.uploadingAttachments=o.uploadingAttachments.filter(function(e){return e.name!==t.get("name")}),e=Immutable.Map(),e=e.merge({file:t,editable:i,loading:!1}),o._attachments=o._attachments.push(e),o.regenerate(),o.rootScope.$broadcast("attachment:create"),s(e)})):a(n)}}(this))},r.prototype.loadAttachments=function(t,e,r){return this.attachmentsService.list(t,e,r).then(function(t){return function(e){return t._attachments=e.map(function(t){var e;return e=Immutable.Map(),e.merge({loading:!1,editable:!1,file:t})}),t.regenerate()}}(this))},r.prototype.deleteAttachment=function(t,e){var r;return r=function(e){return function(){return e._attachments=e._attachments.filter(function(e){return e!==t}),e.regenerate()}}(this),this.attachmentsService["delete"](e,t.getIn(["file","id"])).then(r)},r.prototype.reorderAttachment=function(t,e,r){var n,i,o;return i=this.attachments.findIndex(function(t){return t===e}),i!==r?(n=this.attachments.remove(i),n=n.splice(r,0,e),n=n.map(function(t,e){return t.setIn(["file","order"],e+1)}),o=[],n.forEach(function(e){return function(r){var n;return n={order:r.getIn(["file","order"])},o.push(e.attachmentsService.patch(r.getIn(["file","id"]),t,n))}}(this)),Promise.all(o).then(function(t){return function(){return t._attachments=n,t.regenerate()}}(this))):void 0},r.prototype.updateAttachment=function(t,e){var r,n,i;return r=this._attachments.findIndex(function(e){return e.getIn(["file","id"])===t.getIn(["file","id"])}),n=this._attachments.get(r),i=taiga.patch(n.get("file"),t.get("file")),t.get("loading")?(this._attachments=this._attachments.set(r,t),this.regenerate()):this.attachmentsService.patch(t.getIn(["file","id"]),e,i).then(function(e){return function(){return e._attachments=e._attachments.set(r,t),e.regenerate()}}(this))},r}(taiga.Service),angular.module("taigaComponents").service("tgAttachmentsFullService",t)}.call(this),function(){var t;t=function(){function t(t){this.attachmentsService=t}return t.$inject=["tgAttachmentsService"],t.prototype.addAttachment=function(t){var e;return e=Immutable.fromJS({file:t,name:t.name,size:t.size}),this.attachmentsService.validate(t)&&(this.attachments=this.attachments.push(e),this.onAdd)?this.onAdd({attachment:e}):void 0},t.prototype.addAttachments=function(t){return _.forEach(t,this.addAttachment.bind(this))},t.prototype.deleteAttachment=function(t){return this.attachments=this.attachments.filter(function(e){return e!==t}),this.onDelete?this.onDelete({attachment:t}):void 0},t}(),angular.module("taigaComponents").controller("AttachmentsSimple",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){},{scope:{},bindToController:{attachments:"=",onAdd:"&",onDelete:"&"},controller:"AttachmentsSimple",controllerAs:"vm",templateUrl:"components/attachments-simple/attachments-simple.html",link:t}},t.$inject=[],angular.module("taigaComponents").directive("tgAttachmentsSimple",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){var i,o,s;return i=t(n.tgAttachmentsSortable),o=dragula([r[0]],{copySortSource:!1,copy:!1,mirrorContainer:r[0],moves:function(t){return $(t).is("div[tg-bind-scope]")}}),o.on("dragend",function(t){var r,n;return t=$(t),r=t.scope().attachment,n=t.index(),e.$apply(function(){return i(e,{attachment:r,index:n})})}),s=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&o.dragging}}),e.$on("$destroy",function(){return r.off(),o.destroy()})},{link:e}},t.$inject=["$parse"],angular.module("taigaComponents").directive("tgAttachmentsSortable",t)}.call(this),function(){var t;t=function(t){return{link:function(e,r){return t(function(){return r[0].select()})}}},t.$inject=["$timeout"],angular.module("taigaComponents").directive("tgAutoSelect",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n,i){var o;return o=t(n.tgFileChange),r.on("change",function(t){return e.$apply(function(){return o(e,{files:t.currentTarget.files})})}),e.$on("$destroy",function(){return r.off()})},{require:"ngModel",restrict:"A",link:e}},t.$inject=["$parse"],angular.module("taigaComponents").directive("tgFileChange",t)}.call(this),function(){var t,e;e=this.taiga,t=function(t,e,r,n,i){var o;return o=function(n,o,s,a){var u,c,l;return l=null,c=introJs(),c.oncomplete(function(){return $("html,body").scrollTop(0)}),c.onexit(function(){return e.disableJoyRide()}),u=function(t,e){return e[t.joyride]?(c.setOptions({exitOnEsc:!1,exitOnOverlayClick:!1,showStepNumbers:!1,nextLabel:i.instant("JOYRIDE.NAV.NEXT")+" →",prevLabel:"← "+i.instant("JOYRIDE.NAV.BACK"),skipLabel:i.instant("JOYRIDE.NAV.SKIP"),doneLabel:i.instant("JOYRIDE.NAV.DONE"),disableInteraction:!0}),c.setOption("steps",r.get(t.joyride)),c.start()):void 0},t.$on("$routeChangeSuccess",function(r,n){return n.joyride&&e.isAuthenticated()?(c.oncomplete(function(){return e.disableJoyRide(n.joyride)}),n.loader?l=t.$on("loader:end",function(){return e.loadJoyRideConfig().then(function(t){return u(n,t)}),l()}):e.loadJoyRideConfig().then(function(t){return u(n,t)})):(c.exit(),void(l&&l()))})},{scope:{},link:o}},t.$inject=["$rootScope","tgCurrentUserService","tgJoyRideService","$location","$translate"],angular.module("taigaComponents").directive("tgJoyRide",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(t,e){this.translate=t,this.checkPermissionsService=e}return e(r,t),r.$inject=["$translate","tgCheckPermissionsService"],r.prototype.getConfig=function(){return{dashboard:function(t){return function(){var e;return e=[{element:".project-list > section:not(.ng-hide)",position:"left",joyride:{title:t.translate.instant("JOYRIDE.DASHBOARD.STEP1.TITLE"),text:t.translate.instant("JOYRIDE.DASHBOARD.STEP1.TEXT")}},{element:".working-on-container",position:"right",joyride:{title:t.translate.instant("JOYRIDE.DASHBOARD.STEP2.TITLE"),text:t.translate.instant("JOYRIDE.DASHBOARD.STEP2.TEXT")}},{element:".watching-container",position:"right",joyride:{title:t.translate.instant("JOYRIDE.DASHBOARD.STEP3.TITLE"),text:[t.translate.instant("JOYRIDE.DASHBOARD.STEP3.TEXT1"),t.translate.instant("JOYRIDE.DASHBOARD.STEP3.TEXT2")]}}],$(".project-list .create-project-button").is(":hidden")||e.push({element:".project-list .create-project-button",position:"bottom",joyride:{title:t.translate.instant("JOYRIDE.DASHBOARD.STEP4.TITLE"),text:[t.translate.instant("JOYRIDE.DASHBOARD.STEP4.TEXT1"),t.translate.instant("JOYRIDE.DASHBOARD.STEP4.TEXT2")]}}),e}}(this),backlog:function(t){return function(){var e;return e=[{element:".summary",position:"bottom",joyride:{title:t.translate.instant("JOYRIDE.BACKLOG.STEP1.TITLE"),text:[t.translate.instant("JOYRIDE.BACKLOG.STEP1.TEXT1"),t.translate.instant("JOYRIDE.BACKLOG.STEP1.TEXT2")]}},{element:".backlog-table-empty",position:"bottom",joyride:{title:t.translate.instant("JOYRIDE.BACKLOG.STEP2.TITLE"),text:t.translate.instant("JOYRIDE.BACKLOG.STEP2.TEXT")}},{element:".sprints",position:"left",joyride:{title:t.translate.instant("JOYRIDE.BACKLOG.STEP3.TITLE"),text:t.translate.instant("JOYRIDE.BACKLOG.STEP3.TEXT")}}],t.checkPermissionsService.check("add_us")&&e.push({element:".new-us",position:"rigth",joyride:{title:t.translate.instant("JOYRIDE.BACKLOG.STEP4.TITLE"),text:t.translate.instant("JOYRIDE.BACKLOG.STEP4.TEXT")}}),e}}(this),kanban:function(t){return function(){var e;return e=[{element:".kanban-table-inner",position:"bottom",joyride:{title:t.translate.instant("JOYRIDE.KANBAN.STEP1.TITLE"),text:t.translate.instant("JOYRIDE.KANBAN.STEP1.TEXT")}},{element:".card-placeholder",position:"right",joyride:{title:t.translate.instant("JOYRIDE.KANBAN.STEP2.TITLE"),text:t.translate.instant("JOYRIDE.KANBAN.STEP2.TEXT")}}],t.checkPermissionsService.check("add_us")&&e.push({element:".icon-plus",position:"bottom",joyride:{title:t.translate.instant("JOYRIDE.KANBAN.STEP3.TITLE"),text:[t.translate.instant("JOYRIDE.KANBAN.STEP3.TEXT1"),t.translate.instant("JOYRIDE.KANBAN.STEP3.TEXT2")]}}),e}}(this)}},r.prototype.get=function(t){var e,r;return r=this.getConfig(),e=r[t].call(this),_.map(e,function(t){var e;return e="",t.joyride.title&&(e+=""+t.joyride.title+"
"),_.isArray(t.joyride.text)?_.forEach(t.joyride.text,function(t){return e+=""+t+"
"}):e+=""+t.joyride.text+"
",t.intro=e,t})},r}(taiga.Service),angular.module("taigaComponents").service("tgJoyRideService",t)}.call(this),function(){var t;t=function(t){var e;return e=function(t,e,r){},{restrict:"AE",scope:{},controllerAs:"vm",controller:function(){return this.close=function(){return t.open=!1},Object.defineProperties(this,{open:{get:function(){return t.open}},title:{get:function(){return t.title}},desc:{get:function(){return t.desc}}})},link:e,templateUrl:"components/live-announcement/live-announcement.html"}},t.$inject=["tgLiveAnnouncementService"],angular.module("taigaComponents").directive("tgLiveAnnouncement",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(){this.open=!1,this.title="",this.desc=""}return e(r,t),r.prototype.show=function(t,e){return this.open=!0,this.title=t,this.desc=e},r}(taiga.Service),angular.module("taigaComponents").service("tgLiveAnnouncementService",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){return e.$watch("project",function(e){var n,i;return(e=Immutable.fromJS(e))?(i=e.get("logo_big_url"),i?(r.attr("src",i),r.css("background","")):(n=t.getDefaultProjectLogo(e.get("slug"),e.get("id")),r.attr("src",n.src),r.css("background",n.color))):void 0})},{link:e,scope:{project:"=tgProjectLogoBigSrc"}}},t.$inject=["tgProjectLogoService"],angular.module("taigaComponents").directive("tgProjectLogoBigSrc",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){return e.$watch("project",function(e){var n,i;return(e=Immutable.fromJS(e))?(i=e.get("logo_small_url"),i?(r.attr("src",i),r.css("background","")):(n=t.getDefaultProjectLogo(e.get("slug"),e.get("id")),r.attr("src",n.src),r.css("background",n.color))):void 0})},{link:e,scope:{project:"=tgProjectLogoSmallSrc"}}},t.$inject=["tgProjectLogoService"],angular.module("taigaComponents").directive("tgProjectLogoSmallSrc",t)}.call(this),function(){var t;t=function(){function t(t,e){this.projectService=t,this.lightboxFactory=e,this.project=null,this.menu=Immutable.Map()}return t.$inject=["tgProjectService","tgLightboxFactory"],t.prototype.show=function(){return this.project=this.projectService.project,this.active=this._getActiveSection(),this._setVideoConference(),this._setMenuPermissions()},t.prototype.hide=function(){return this.project=null,this.menu={}},t.prototype.search=function(){return this.lightboxFactory.create("tg-search-box",{"class":"lightbox lightbox-search"})},t.prototype._setVideoConference=function(){var t;return t=this._videoConferenceUrl(),t?this.project=this.project.set("videoconferenceUrl",t):void 0},t.prototype._setMenuPermissions=function(){return this.menu=Immutable.Map({backlog:!1,kanban:!1,issues:!1,wiki:!1}),this.project.get("is_backlog_activated")&&-1!==this.project.get("my_permissions").indexOf("view_us")&&(this.menu=this.menu.set("backlog",!0)),
-this.project.get("is_kanban_activated")&&-1!==this.project.get("my_permissions").indexOf("view_us")&&(this.menu=this.menu.set("kanban",!0)),this.project.get("is_issues_activated")&&-1!==this.project.get("my_permissions").indexOf("view_issues")&&(this.menu=this.menu.set("issues",!0)),this.project.get("is_wiki_activated")&&-1!==this.project.get("my_permissions").indexOf("view_wiki_pages")?this.menu=this.menu.set("wiki",!0):void 0},t.prototype._getActiveSection=function(){var t,e,r,n,i;return n=this.projectService.section,i=this.projectService.sectionsBreadcrumb,t=i.lastIndexOf("backlog"),e=i.lastIndexOf("kanban"),(-1!==t||-1!==e)&&(r=-1===e||t>e?"backlog":"kanban"),"backlog-kanban"===n&&("backlog"===r||"kanban"===r?n=r:this.project.get("is_backlog_activated")&&!this.project.get("is_kanban_activated")?n="backlog":!this.project.get("is_backlog_activated")&&this.project.get("is_kanban_activated")&&(n="kanban")),n},t.prototype._videoConferenceUrl=function(){var t,e;if("appear-in"===this.project.get("videoconferences"))t="https://appear.in/";else if("talky"===this.project.get("videoconferences"))t="https://talky.io/";else{if("jitsi"!==this.project.get("videoconferences"))return"custom"===this.project.get("videoconferences")?this.project.get("videoconferences_extra_data"):"";t="https://meet.jit.si/"}return e=this.project.get("videoconferences_extra_data")?this.project.get("slug")+"-"+taiga.slugify(this.project.get("videoconferences_extra_data")):this.project.get("slug"),"jitsi"===this.project.get("videoconferences")&&(e=e.replace(/-/g,"")),t+e},t}(),angular.module("taigaComponents").controller("ProjectMenu",t)}.call(this),function(){var t,e;e=this.taiga,t=function(t,e){var r;return r=function(e,r,n,i){var o;return o=function(){return t.project?i.show():i.hide()},e.$watch(function(){return t.project},o),e.vm.fixed=!1,$(window).on("scroll",function(){var t;return t=$(window).scrollTop(),t>100&&e.vm.fixed===!1?(e.vm.fixed=!0,e.$digest()):100>t&&e.vm.fixed===!0?(e.vm.fixed=!1,e.$digest()):void 0})},{scope:{},controller:"ProjectMenu",controllerAs:"vm",templateUrl:"components/project-menu/project-menu.html",link:r}},t.$inject=["tgProjectService","tgLightboxFactory"],angular.module("taigaComponents").directive("tgProjectMenu",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n){return e.privacyPolicyUrl=t.get("privacyPolicyUrl"),e.termsOfServiceUrl=t.get("termsOfServiceUrl")},{restrict:"AE",scope:{},link:e,templateUrl:"components/terms-of-service-and-privacy-policy-notice/terms-of-service-and-privacy-policy-notice.html"}},angular.module("taigaComponents").directive("tgTermsOfServiceAndPrivacyPolicyNotice",["$tgConfig",t])}.call(this),function(){var t;t=function(){function t(t){this.currentUserService=t,this.user=this.currentUserService.getUser(),this.isMouseOver=!1,this.loading=!1}return t.$inject=["tgCurrentUserService"],t.prototype.showTextWhenMouseIsOver=function(){return this.isMouseOver=!0},t.prototype.showTextWhenMouseIsLeave=function(){return this.isMouseOver=!1},t.prototype.toggleVote=function(){var t;return this.loading=!0,t=this.item.is_voter?this._downvote():this._upvote(),t["finally"](function(t){return function(){return t.loading=!1}}(this)),t},t.prototype._upvote=function(){return this.onUpvote().then(function(t){return function(){return t.showTextWhenMouseIsLeave()}}(this))},t.prototype._downvote=function(){return this.onDownvote()},t}(),angular.module("taigaComponents").controller("VoteButton",t)}.call(this),function(){var t;t=function(){return{scope:{},controller:"VoteButton",bindToController:{item:"=",onUpvote:"=",onDownvote:"="},controllerAs:"vm",templateUrl:"components/vote-button/vote-button.html"}},angular.module("taigaComponents").directive("tgVoteButton",t)}.call(this),function(){var t;t=function(){function t(t,e){this.currentUserService=t,this.rootScope=e,this.user=this.currentUserService.getUser(),this.isMouseOver=!1,this.loading=!1}return t.$inject=["tgCurrentUserService","$rootScope"],t.prototype.showTextWhenMouseIsOver=function(){return this.isMouseOver=!0},t.prototype.showTextWhenMouseIsLeave=function(){return this.isMouseOver=!1},t.prototype.openWatchers=function(){return this.rootScope.$broadcast("watcher:add",this.item)},t.prototype.getPerms=function(){var t,e;return this.item?(t=this.item._name,e={userstories:"modify_us",issues:"modify_issue",tasks:"modify_task"},e[t]):""},t.prototype.toggleWatch=function(){var t;return this.loading=!0,t=this.item.is_watcher?this._unwatch():this._watch(),t["finally"](function(t){return function(){return t.loading=!1}}(this)),t},t.prototype._watch=function(){return this.onWatch().then(function(t){return function(){return t.showTextWhenMouseIsLeave()}}(this))},t.prototype._unwatch=function(){return this.onUnwatch()},t}(),angular.module("taigaComponents").controller("WatchButton",t)}.call(this),function(){var t;t=function(){return{scope:{},controller:"WatchButton",bindToController:{item:"=",onWatch:"=",onUnwatch:"="},controllerAs:"vm",templateUrl:function(t,e){return"components/watch-button/watch-button-"+e.environment+".html"}}},angular.module("taigaComponents").directive("tgWatchButton",t)}.call(this),function(){var t;t=function(){function t(t){this.translate=t,this.is_open=!1,this.texts={week:this.translate.instant("DISCOVER.FILTERS.WEEK"),month:this.translate.instant("DISCOVER.FILTERS.MONTH"),year:this.translate.instant("DISCOVER.FILTERS.YEAR"),all:this.translate.instant("DISCOVER.FILTERS.ALL_TIME")}}return t.$inject=["$translate"],t.prototype.currentText=function(){return this.texts[this.currentOrderBy]},t.prototype.open=function(){return this.is_open=!0},t.prototype.close=function(){return this.is_open=!1},t.prototype.orderBy=function(t){return this.currentOrderBy=t,this.is_open=!1,this.onChange({orderBy:this.currentOrderBy})},t}(),angular.module("taigaDiscover").controller("DiscoverHomeOrderBy",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r){},{controller:"DiscoverHomeOrderBy",controllerAs:"vm",bindToController:!0,templateUrl:"discover/components/discover-home-order-by/discover-home-order-by.html",scope:{currentOrderBy:"=orderBy",onChange:"&"},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgDiscoverHomeOrderBy",t)}.call(this),function(){var t;t=function(){function t(t){this.discoverProjectsService=t,taiga.defineImmutableProperty(this,"projects",function(t){return function(){return t.discoverProjectsService.projectsCount}}(this)),this.discoverProjectsService.fetchStats()}return t.$inject=["tgDiscoverProjectsService"],t.prototype.selectFilter=function(t){return this.onChange({filter:t,q:this.q})},t.prototype.submitFilter=function(){return this.onChange({filter:this.filter,q:this.q})},t}(),angular.module("taigaDiscover").controller("DiscoverSearchBar",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){},{controller:"DiscoverSearchBar",controllerAs:"vm",templateUrl:"discover/components/discover-search-bar/discover-search-bar.html",bindToController:!0,scope:{q:"=",filter:"=",onChange:"&"},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgDiscoverSearchBar",t)}.call(this),function(){var t;t=function(){function t(){this.like_is_open=0===this.orderBy.indexOf("-total_fans"),this.activity_is_open=0===this.orderBy.indexOf("-total_activity")}return t.$inject=[],t.prototype.openLike=function(){return this.like_is_open=!0,this.activity_is_open=!1,this.setOrderBy("-total_fans_last_week")},t.prototype.openActivity=function(){return this.activity_is_open=!0,this.like_is_open=!1,this.setOrderBy("-total_activity_last_week")},t.prototype.setOrderBy=function(t){return null==t&&(t=""),t||(this.like_is_open=!1,this.activity_is_open=!1),this.onChange({orderBy:t})},t}(),angular.module("taigaDiscover").controller("DiscoverSearchListHeader",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r){},{controller:"DiscoverSearchListHeader",controllerAs:"vm",bindToController:!0,templateUrl:"discover/components/discover-search-list-header/discover-search-list-header.html",scope:{onChange:"&",orderBy:"="},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgDiscoverSearchListHeader",t)}.call(this),function(){var t;t=function(){function t(t){this.discoverProjectsService=t,taiga.defineImmutableProperty(this,"featured",function(t){return function(){return t.discoverProjectsService.featured}}(this)),this.discoverProjectsService.fetchFeatured()}return t.$inject=["tgDiscoverProjectsService"],t}(),angular.module("taigaDiscover").controller("FeaturedProjects",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r){},{controller:"FeaturedProjects",controllerAs:"vm",templateUrl:"discover/components/featured-projects/featured-projects.html",scope:{},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgFeaturedProjects",t)}.call(this),function(){var t;t=function(){return{templateUrl:"discover/components/highlighted/highlighted.html",scope:{loading:"=",highlighted:"=",orderBy:"="}}},t.$inject=[],angular.module("taigaDiscover").directive("tgHighlighted",t)}.call(this),function(){var t;t=function(){function t(t){this.discoverProjectsService=t,taiga.defineImmutableProperty(this,"highlighted",function(t){return function(){return t.discoverProjectsService.mostActive}}(this)),this.currentOrderBy="week",this.order_by=this.getOrderBy()}return t.$inject=["tgDiscoverProjectsService"],t.prototype.fetch=function(){return this.loading=!0,this.order_by=this.getOrderBy(),this.discoverProjectsService.fetchMostActive({order_by:this.order_by}).then(function(t){return function(){return t.loading=!1}}(this))},t.prototype.orderBy=function(t){return this.currentOrderBy=t,this.fetch()},t.prototype.getOrderBy=function(t){return"all"===this.currentOrderBy?"-total_activity":"-total_activity_last_"+this.currentOrderBy},t}(),angular.module("taigaDiscover").controller("MostActive",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){return n.fetch()},{controller:"MostActive",controllerAs:"vm",templateUrl:"discover/components/most-active/most-active.html",scope:{},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgMostActive",t)}.call(this),function(){var t;t=function(){function t(t){this.discoverProjectsService=t,taiga.defineImmutableProperty(this,"highlighted",function(t){return function(){return t.discoverProjectsService.mostLiked}}(this)),this.currentOrderBy="week",this.order_by=this.getOrderBy()}return t.$inject=["tgDiscoverProjectsService"],t.prototype.fetch=function(){return this.loading=!0,this.order_by=this.getOrderBy(),this.discoverProjectsService.fetchMostLiked({order_by:this.order_by}).then(function(t){return function(){return t.loading=!1}}(this))},t.prototype.orderBy=function(t){return this.currentOrderBy=t,this.fetch()},t.prototype.getOrderBy=function(){return"all"===this.currentOrderBy?"-total_fans":"-total_fans_last_"+this.currentOrderBy},t}(),angular.module("taigaDiscover").controller("MostLiked",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){return n.fetch()},{controller:"MostLiked",controllerAs:"vm",templateUrl:"discover/components/most-liked/most-liked.html",scope:{},link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgMostLiked",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n){var i,o;this.location=t,this.navUrls=e,this.appMetaService=r,this.translate=n,o=this.translate.instant("DISCOVER.PAGE_TITLE"),i=this.translate.instant("DISCOVER.PAGE_DESCRIPTION"),this.appMetaService.setAll(o,i)}return t.$inject=["$tgLocation","$tgNavUrls","tgAppMetaService","$translate"],t.prototype.onSubmit=function(t){var e;return e=this.navUrls.resolve("discover-search"),this.location.search("text",t).path(e)},t}(),angular.module("taigaDiscover").controller("DiscoverHome",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n,i){var o,s;this.routeParams=t,this.discoverProjectsService=e,this.route=r,this.appMetaService=n,this.translate=i,this.page=1,taiga.defineImmutableProperty(this,"searchResult",function(t){return function(){return t.discoverProjectsService.searchResult}}(this)),taiga.defineImmutableProperty(this,"nextSearchPage",function(t){return function(){return t.discoverProjectsService.nextSearchPage}}(this)),this.q=this.routeParams.text,this.filter=this.routeParams.filter||"all",this.orderBy=this.routeParams.order_by||"",this.loadingGlobal=!1,this.loadingList=!1,this.loadingPagination=!1,s=this.translate.instant("DISCOVER.SEARCH.PAGE_TITLE"),o=this.translate.instant("DISCOVER.SEARCH.PAGE_DESCRIPTION"),this.appMetaService.setAll(s,o)}return t.$inject=["$routeParams","tgDiscoverProjectsService","$route","tgAppMetaService","$translate"],t.prototype.fetch=function(){return this.page=1,this.discoverProjectsService.resetSearchList(),this.search()},t.prototype.fetchByGlobalSearch=function(){return this.loadingGlobal?void 0:(this.loadingGlobal=!0,this.fetch().then(function(t){return function(){return t.loadingGlobal=!1}}(this)))},t.prototype.fetchByOrderBy=function(){return this.loadingList?void 0:(this.loadingList=!0,this.fetch().then(function(t){return function(){return t.loadingList=!1}}(this)))},t.prototype.showMore=function(){return this.loadingPagination?void 0:(this.loadingPagination=!0,this.page++,this.search().then(function(t){return function(){return t.loadingPagination=!1}}(this)))},t.prototype.search=function(){var t,e;return t=this.getFilter(),e={page:this.page,q:this.q,order_by:this.orderBy},_.assign(e,t),this.discoverProjectsService.fetchSearch(e)},t.prototype.getFilter=function(){return"people"===this.filter?{is_looking_for_people:!0}:"scrum"===this.filter?{is_backlog_activated:!0}:"kanban"===this.filter?{is_kanban_activated:!0}:{}},t.prototype.onChangeFilter=function(t,e){return this.filter=t,this.q=e,this.route.updateParams({filter:this.filter,text:this.q}),this.fetchByGlobalSearch()},t.prototype.onChangeOrder=function(t){return this.orderBy=t,this.route.updateParams({order_by:t}),this.fetchByOrderBy()},t}(),angular.module("taigaDiscover").controller("DiscoverSearch",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){return n.fetch()},{controller:"DiscoverSearch",controllerAs:"vm",link:t}},t.$inject=[],angular.module("taigaDiscover").directive("tgDiscoverSearch",t)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga,t=function(t){function n(t,r){this.rs=t,this.projectsService=r,this._mostLiked=Immutable.List(),this._mostActive=Immutable.List(),this._featured=Immutable.List(),this._searchResult=Immutable.List(),this._projectsCount=0,this.decorate=this.projectsService._decorate.bind(this.projectsService),e.defineImmutableProperty(this,"mostLiked",function(t){return function(){return t._mostLiked}}(this)),e.defineImmutableProperty(this,"mostActive",function(t){return function(){return t._mostActive}}(this)),e.defineImmutableProperty(this,"featured",function(t){return function(){return t._featured}}(this)),e.defineImmutableProperty(this,"searchResult",function(t){return function(){return t._searchResult}}(this)),e.defineImmutableProperty(this,"nextSearchPage",function(t){return function(){return t._nextSearchPage}}(this)),e.defineImmutableProperty(this,"projectsCount",function(t){return function(){return t._projectsCount}}(this))}var i;return r(n,t),n.$inject=["tgResources","tgProjectsService"],i={discover_mode:!0},n.prototype.fetchMostLiked=function(t){var e;return e=_.extend({},i,t),this.rs.projects.getProjects(e,!1).then(function(t){return function(e){var r,n;return r=e.data.slice(0,5),n=Immutable.fromJS(r),n=n.map(t.decorate),t._mostLiked=n}}(this))},n.prototype.fetchMostActive=function(t){var e;return e=_.extend({},i,t),this.rs.projects.getProjects(e,!1).then(function(t){return function(e){var r,n;return r=e.data.slice(0,5),n=Immutable.fromJS(r),n=n.map(t.decorate),t._mostActive=n}}(this))},n.prototype.fetchFeatured=function(){var t;return t=_.extend({},i),t.is_featured=!0,this.rs.projects.getProjects(t,!1).then(function(t){return function(e){var r,n;return r=e.data.slice(0,4),n=Immutable.fromJS(r),n=n.map(t.decorate),t._featured=n}}(this))},n.prototype.resetSearchList=function(){return this._searchResult=Immutable.List()},n.prototype.fetchStats=function(){return this.rs.stats.discover().then(function(t){return function(e){return t._projectsCount=e.getIn(["projects","total"])}}(this))},n.prototype.fetchSearch=function(t){var e;return e=_.extend({},i,t),this.rs.projects.getProjects(e).then(function(t){return function(e){var r;return t._nextSearchPage=!!e.headers("X-Pagination-Next"),r=Immutable.fromJS(e.data),r=r.map(t.decorate),t._searchResult=t._searchResult.concat(r)}}(this))},n}(e.Service),angular.module("taigaDiscover").service("tgDiscoverProjectsService",t)}.call(this),function(){var t,e,r=function(t,e){return function(){return t.apply(e,arguments)}},n=function(t,e){function r(){this.constructor=t}for(var n in e)i.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;e=this.taiga,t=function(t){function i(t,n,i,o,s,a,u,c){var l,p;this.routeParams=t,this.externalAppsService=n,this.window=i,this.currentUserService=o,this.location=s,this.navUrls=a,this.xhrError=u,this.loader=c,this.createApplicationToken=r(this.createApplicationToken,this),this._getApplicationToken=r(this._getApplicationToken,this),this._redirect=r(this._redirect,this),this.loader.start(!1),this._applicationId=this.routeParams.application,this._state=this.routeParams.state,this._getApplicationToken(),this._user=this.currentUserService.getUser(),this._application=null,p=encodeURIComponent(this.location.url()),l=this.navUrls.resolve("login"),this.loginWithAnotherUserUrl=l+"?next="+p,e.defineImmutableProperty(this,"user",function(t){return function(){return t._user}}(this)),e.defineImmutableProperty(this,"application",function(t){return function(){return t._application}}(this))}return n(i,t),i.$inject=["$routeParams","tgExternalAppsService","$window","tgCurrentUserService","$location","$tgNavUrls","tgXhrErrorService","tgLoader"],i.prototype._redirect=function(t){var e;return e=t.get("next_url"),this.window.open(e,"_self")},i.prototype._getApplicationToken=function(){return this.externalAppsService.getApplicationToken(this._applicationId,this._state).then(function(t){return function(e){return t._application=e.get("application"),e.get("auth_code")?t._redirect(e):t.loader.pageLoaded()}}(this))["catch"](function(t){return function(e){return t.loader.pageLoaded(),t.xhrError.response(e)}}(this))},i.prototype.cancel=function(){return this.window.history.back()},i.prototype.createApplicationToken=function(){return this.externalAppsService.authorizeApplicationToken(this._applicationId,this._state).then(function(t){return function(e){return t._redirect(e)}}(this))["catch"](function(t){return function(e){return t.xhrError.response(e)}}(this))},i}(e.Controller),angular.module("taigaExternalApps").controller("ExternalApp",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(t){this.rs=t}return e(r,t),r.$inject=["tgResources"],r.prototype.getApplicationToken=function(t,e){return this.rs.externalapps.getApplicationToken(t,e)},r.prototype.authorizeApplicationToken=function(t,e){return this.rs.externalapps.authorizeApplicationToken(t,e)},r}(taiga.Service),angular.module("taigaExternalApps").service("tgExternalAppsService",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(t){this.lightboxFactory=t}return e(r,t),r.$inject=["tgLightboxFactory"],r.prototype.sendFeedback=function(){return this.lightboxFactory.create("tg-lb-feedback",{"class":"lightbox lightbox-feedback lightbox-generic-form"})},r}(taiga.Service),angular.module("taigaFeedback").service("tgFeedbackService",t)}.call(this),function(){var t;t=function(t,e){var r;return r=function(t,r,n,i){return t.vm={},t.vm.duty=t.duty,t.vm.getDutyType=function(){if(t.vm.duty){if("userstories"===t.vm.duty.get("_name"))return e.instant("COMMON.USER_STORY");if("tasks"===t.vm.duty.get("_name"))return e.instant("COMMON.TASK");if("issues"===t.vm.duty.get("_name"))return e.instant("COMMON.ISSUE")}}},{templateUrl:"home/duties/duty.html",scope:{duty:"=tgDuty"},link:r}},t.$inject=["$tgNavUrls","$translate"],angular.module("taigaHome").directive("tgDuty",t)}.call(this),function(){var t;t=function(){function t(t,e,r){this.currentUserService=t,this.location=e,this.navUrls=r,this.currentUserService.getUser()||this.location.path(this.navUrls.resolve("discover"))}return t.$inject=["tgCurrentUserService","$location","$tgNavUrls"],t}(),angular.module("taigaHome").controller("Home",t)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga.groupBy,t=function(t){function n(t,e,r){this.navurls=t,this.rs=e,this.projectsService=r}return r(n,t),n.$inject=["$tgNavUrls","tgResources","tgProjectsService"],n.prototype._attachProjectInfoToWorkInProgress=function(t,e){var r,n,i,o,s;return r=function(t){return function(r,n){var i,o,s;return o=e.get(String(r.get("project"))),i={project:o.get("slug"),ref:r.get("ref")},s=t.navurls.resolve("project-"+n+"-detail",i),r=r.set("url",s),r=r.set("projectName",o.get("name")),r=r.set("blockedProject",o.get("blocked_code")),r=r.set("_name",n)}}(this),i=function(t,n){return t=t.filter(function(t){return e.get(String(t.get("project")))}),t=t.map(function(t){return r(t,n)})},o=t.get("assignedTo"),o.get("userStories")&&(n=i(o.get("userStories"),"userstories"),o=o.set("userStories",n)),o.get("tasks")&&(n=i(o.get("tasks"),"tasks"),o=o.set("tasks",n)),o.get("issues")&&(n=i(o.get("issues"),"issues"),o=o.set("issues",n)),s=t.get("watching"),s.get("userStories")&&(n=i(s.get("userStories"),"userstories"),s=s.set("userStories",n)),s.get("tasks")&&(n=i(s.get("tasks"),"tasks"),s=s.set("tasks",n)),s.get("issues")&&(n=i(s.get("issues"),"issues"),s=s.set("issues",n)),t=t.set("assignedTo",o),t=t.set("watching",s)},n.prototype.getWorkInProgress=function(t){var r,n,i,o,s,a,u,c,l,p,d,f,h;return u=Immutable.Map(),c=this.projectsService.getProjectsByUserId(t).then(function(t){return u=Immutable.fromJS(e(t.toJS(),function(t){return t.id}))}),i=Immutable.Map(),s={status__is_closed:!1,assigned_to:t},a={is_closed:!1,assigned_to:t},o=this.rs.userstories.listInAllProjects(a).then(function(t){return i=i.set("userStories",t)}),n=this.rs.tasks.listInAllProjects(s).then(function(t){return i=i.set("tasks",t)}),r=this.rs.issues.listInAllProjects(s).then(function(t){return i=i.set("issues",t)}),s={status__is_closed:!1,watchers:t},a={is_closed:!1,watchers:t},l=Immutable.Map(),f=this.rs.userstories.listInAllProjects(a).then(function(t){return l=l.set("userStories",t)}),d=this.rs.tasks.listInAllProjects(s).then(function(t){return l=l.set("tasks",t)}),p=this.rs.issues.listInAllProjects(s).then(function(t){return l=l.set("issues",t)}),h=Immutable.Map(),Promise.all([c,o,n,r,f,d,p]).then(function(t){return function(){return h=h.set("assignedTo",i),h=h.set("watching",l),h=t._attachProjectInfoToWorkInProgress(h,u)}}(this))},n}(taiga.Service),angular.module("taigaHome").service("tgHomeService",t)}.call(this),function(){var t;t=function(t,e){var r,n;return n=function(r,n,i,o){return r.vm={},taiga.defineImmutableProperty(r.vm,"projects",function(){return t.projects.get("recents")}),r.vm.newProject=function(){return e.newProject()}},r={templateUrl:"home/projects/home-project-list.html",scope:{},link:n}},t.$inject=["tgCurrentUserService","tgProjectsService"],angular.module("taigaHome").directive("tgHomeProjectList",t)}.call(this),function(){var t;t=function(){function t(t){this.homeService=t,this.assignedTo=Immutable.Map(),this.watching=Immutable.Map()}return t.$inject=["tgHomeService"],t.prototype._setAssignedTo=function(t){var e,r,n;return n=t.get("assignedTo").get("userStories"),r=t.get("assignedTo").get("tasks"),e=t.get("assignedTo").get("issues"),this.assignedTo=n.concat(r).concat(e),this.assignedTo.size>0?this.assignedTo=this.assignedTo.sortBy(function(t){return t.get("modified_date")}).reverse():void 0},t.prototype._setWatching=function(t){var e,r,n;return n=t.get("watching").get("userStories"),r=t.get("watching").get("tasks"),e=t.get("watching").get("issues"),this.watching=n.concat(r).concat(e),this.watching.size>0?this.watching=this.watching.sortBy(function(t){return t.get("modified_date")}).reverse():void 0},t.prototype.getWorkInProgress=function(t){return this.homeService.getWorkInProgress(t).then(function(t){return function(e){return t._setAssignedTo(e),t._setWatching(e)}}(this))},t}(),angular.module("taigaHome").controller("WorkingOn",t)}.call(this),function(){var t;t=function(t,e){var r;return r=function(t,r,n,i){var o,s;return o=e.getUser(),o?(s=o.get("id"),i.getWorkInProgress(s)):void 0},{controller:"WorkingOn",controllerAs:"vm",templateUrl:"home/working-on/working-on.html",scope:{},link:r}},t.$inject=["tgHomeService","tgCurrentUserService"],angular.module("taigaHome").directive("tgWorkingOn",t)}.call(this),function(){var t;t=function(t,e){var r,n;return n=function(r,n,i,o){return r.vm={},taiga.defineImmutableProperty(r.vm,"projects",function(){return t.projects.get("recents")}),r.vm.newProject=function(){return e.newProject()}},r={templateUrl:"navigation-bar/dropdown-project-list/dropdown-project-list.html",scope:{},link:n}},t.$inject=["tgCurrentUserService","tgProjectsService"],angular.module("taigaNavigationBar").directive("tgDropdownProjectList",t)}.call(this),function(){var t;t=function(t,e,r,n,i,o){var s,a;return a=function(s,a,u,c){return s.vm={},s.vm.isFeedbackEnabled=e.get("feedbackEnabled"),taiga.defineImmutableProperty(s.vm,"user",function(){return t.userData}),s.vm.logout=function(){return t.logout(),r.url(n.resolve("discover")),r.search({})},s.vm.sendFeedback=function(){return i.sendFeedback()},s.vm.userSettingsPlugins=_.filter(o.userSettingsPlugins,{userMenu:!0})},s={templateUrl:"navigation-bar/dropdown-user/dropdown-user.html",scope:{},link:a}},t.$inject=["$tgAuth","$tgConfig","$tgLocation","$tgNavUrls","tgFeedbackService","$rootScope"],angular.module("taigaNavigationBar").directive("tgDropdownUser",t)}.call(this),function(){var t;t=function(t,e,r,n,i){var o,s;return s=function(o,s,a,u){return o.vm={},taiga.defineImmutableProperty(o.vm,"projects",function(){return t.projects.get("recents")}),taiga.defineImmutableProperty(o.vm,"isAuthenticated",function(){return t.isAuthenticated()}),taiga.defineImmutableProperty(o.vm,"isEnabledHeader",function(){return e.isEnabledHeader()}),o.vm.publicRegisterEnabled=i.get("publicRegisterEnabled"),o.vm.login=function(){var t;return t=encodeURIComponent(r.url()),r.url(n.resolve("login")),r.search({next:t})},o.vm.register=function(){var t;return t=encodeURIComponent(r.url()),r.url(n.resolve("register")),r.search({next:t})},o.$on("$routeChangeSuccess",function(){return"/"===r.path()?o.vm.active=!0:o.vm.active=!1})},o={templateUrl:"navigation-bar/navigation-bar.html",scope:{},link:s}},t.$inject=["tgCurrentUserService","tgNavigationBarService","$tgLocation","$tgNavUrls","$tgConfig"],angular.module("taigaNavigationBar").directive("tgNavigationBar",t)}.call(this),function(){var t,e=function(t,e){function n(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;t=function(t){function r(){this.disableHeader()}return e(r,t),r.prototype.enableHeader=function(){return this.enabledHeader=!0},r.prototype.disableHeader=function(){return this.enabledHeader=!1},r.prototype.isEnabledHeader=function(){return this.enabledHeader},r}(taiga.Service),angular.module("taigaNavigationBar").service("tgNavigationBarService",t)}.call(this),function(){var t;t=function(){function t(t){this.userService=t,this.loadStats()}return t.$inject=["tgUserService"],t.prototype.loadStats=function(){return this.userService.getStats(this.user.get("id")).then(function(t){return function(e){return t.stats=e}}(this))},t}(),angular.module("taigaProfile").controller("ProfileBar",t)}.call(this),function(){var t;t=function(){return{templateUrl:"profile/profile-bar/profile-bar.html",controller:"ProfileBar",controllerAs:"vm",scope:{user:"=user",isCurrentUser:"=iscurrentuser"},bindToController:!0}},angular.module("taigaProfile").directive("tgProfileBar",t)}.call(this),function(){var t;t=function(){function t(t,e){this.userService=t,this.currentUserService=e,this.currentUser=this.currentUserService.getUser(),this.isCurrentUser=!1,this.currentUser&&this.currentUser.get("id")===this.user.get("id")&&(this.isCurrentUser=!0)}return t.$inject=["tgUserService","tgCurrentUserService"],t.prototype.loadContacts=function(){return this.userService.getContacts(this.user.get("id")).then(function(t){return function(e){return t.contacts=e}}(this))},t}(),angular.module("taigaProfile").controller("ProfileContacts",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){return n.loadContacts()},{templateUrl:"profile/profile-contacts/profile-contacts.html",scope:{user:"="},controllerAs:"vm",controller:"ProfileContacts",link:t,bindToController:!0}},angular.module("taigaProfile").directive("tgProfileContacts",t)}.call(this),function(){var t;t=function(){var t,e;return t=function(t,e,r,n){return t.vm={item:t.item}},e=function(t,e){return"project"===e.itemType?"profile/profile-favs/items/project.html":"profile/profile-favs/items/ticket.html"},{scope:{item:"=tgFavItem"},link:t,templateUrl:e}},angular.module("taigaProfile").directive("tgFavItem",t)}.call(this),function(){var t,e,r,n,i,o=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=this.taiga.debounceLeading,t=function(){function t(){this._init()}return t.prototype._init=function(){return this.enableFilterByAll=!0,this.enableFilterByProjects=!0,this.enableFilterByUserStories=!0,this.enableFilterByTasks=!0,this.enableFilterByIssues=!0,this.enableFilterByTextQuery=!0,this._resetList(),this.q=null,this.type=null},t.prototype._resetList=function(){return this.items=Immutable.List(),this.scrollDisabled=!1,this._page=1},t.prototype._enableLoadingSpinner=function(){return this.isLoading=!0},t.prototype._disableLoadingSpinner=function(){return this.isLoading=!1},t.prototype._enableScroll=function(){return this.scrollDisabled=!1},t.prototype._disableScroll=function(){return this.scrollDisabled=!0},t.prototype._checkIfHasMorePages=function(t){return t?(this._page+=1,this._enableScroll()):this._disableScroll()},t.prototype._checkIfHasNoResults=function(){return this.hasNoResults=0===this.items.size},t.prototype.loadItems=function(){return this._enableLoadingSpinner(),this._disableScroll(),this._getItems(this.user.get("id"),this._page,this.type,this.q).then(function(t){return function(e){return t.items=t.items.concat(e.get("data")),t._checkIfHasMorePages(e.get("next")),t._checkIfHasNoResults(),t._disableLoadingSpinner(),t.items}}(this))["catch"](function(t){return function(){return t._disableLoadingSpinner(),t.items}}(this))},t.prototype.filterByTextQuery=i(500,function(){return this._resetList(),this.loadItems()}),t.prototype.showAll=function(){return null!==this.type?(this.type=null,this._resetList(),this.loadItems()):void 0},t.prototype.showProjectsOnly=function(){
-return"project"!==this.type?(this.type="project",this._resetList(),this.loadItems()):void 0},t.prototype.showUserStoriesOnly=function(){return"userstory"!==this.type?(this.type="userstory",this._resetList(),this.loadItems()):void 0},t.prototype.showTasksOnly=function(){return"task"!==this.type?(this.type="task",this._resetList(),this.loadItems()):void 0},t.prototype.showIssuesOnly=function(){return"issue"!==this.type?(this.type="issue",this._resetList(),this.loadItems()):void 0},t}(),e=function(t){function e(t){this.userService=t,e.__super__.constructor.call(this),this.enableFilterByAll=!1,this.enableFilterByProjects=!1,this.enableFilterByUserStories=!1,this.enableFilterByTasks=!1,this.enableFilterByIssues=!1,this.enableFilterByTextQuery=!0,this._getItems=this.userService.getLiked}return o(e,t),e.$inject=["tgUserService"],e}(t),angular.module("taigaProfile").controller("ProfileLiked",e),r=function(t){function e(t){this.userService=t,e.__super__.constructor.call(this),this.enableFilterByAll=!0,this.enableFilterByProjects=!1,this.enableFilterByUserStories=!0,this.enableFilterByTasks=!0,this.enableFilterByIssues=!0,this.enableFilterByTextQuery=!0,this._getItems=this.userService.getVoted}return o(e,t),e.$inject=["tgUserService"],e}(t),angular.module("taigaProfile").controller("ProfileVoted",r),n=function(t){function e(t){this.userService=t,e.__super__.constructor.call(this),this._getItems=this.userService.getWatched}return o(e,t),e.$inject=["tgUserService"],e}(t),angular.module("taigaProfile").controller("ProfileWatched",n)}.call(this),function(){var t,e,r,n;n={scope:{},bindToController:{user:"=",type:"@",q:"@",scrollDisabled:"@",isLoading:"@",hasNoResults:"@"},controller:null,controllerAs:"vm",templateUrl:"profile/profile-favs/profile-favs.html"},t=function(){return _.extend({},n,{controller:"ProfileLiked"})},angular.module("taigaProfile").directive("tgProfileLiked",t),e=function(){return _.extend({},n,{controller:"ProfileVoted"})},angular.module("taigaProfile").directive("tgProfileVoted",e),r=function(){return _.extend({},n,{controller:"ProfileWatched"})},angular.module("taigaProfile").directive("tgProfileWatched",r)}.call(this),function(){var t;t=function(){function t(t){var e;this.translate=t,e=Math.floor(Math.random()*this.HINTS.length)+1,this.hint=this.HINTS[e-1],this.hint.linkText=this.hint.linkText||"HINTS.LINK",this.hint.title=this.translate.instant("HINTS.HINT"+e+"_TITLE"),this.hint.text=this.translate.instant("HINTS.HINT"+e+"_TEXT")}return t.prototype.HINTS=[{url:"https://tree.taiga.io/support/admin/import-export-projects/"},{url:"https://tree.taiga.io/support/admin/custom-fields/"},{},{}],t}(),t.$inject=["$translate"],angular.module("taigaProfile").controller("ProfileHints",t)}.call(this),function(){var t;t=function(t){return{scope:{},controller:"ProfileHints",controllerAs:"vm",templateUrl:"profile/profile-hints/profile-hints.html"}},t.$inject=["$translate"],angular.module("taigaProfile").directive("tgProfileHints",t)}.call(this),function(){var t;t=function(){function t(t,e){this.projectsService=t,this.userService=e}return t.$inject=["tgProjectsService","tgUserService"],t.prototype.loadProjects=function(){return this.projectsService.getProjectsByUserId(this.user.get("id")).then(function(t){return function(e){return t.userService.attachUserContactsToProjects(t.user.get("id"),e)}}(this)).then(function(t){return function(e){return t.projects=e}}(this))},t}(),angular.module("taigaProfile").controller("ProfileProjects",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){return n.loadProjects()},{templateUrl:"profile/profile-projects/profile-projects.html",scope:{user:"="},link:t,bindToController:!0,controllerAs:"vm",controller:"ProfileProjects"}},angular.module("taigaProfile").directive("tgProfileProjects",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n,i){return t.tab={},r.$observe("tgProfileTab",function(e){return t.tab.name=e}),r.$observe("tabTitle",function(e){return t.tab.title=e}),t.tab.icon=r.tabIcon,t.tab.active=!!r.tabActive,t.$eval(r.tabDisabled)!==!0?n.addTab(t.tab):void 0},{templateUrl:"profile/profile-tab/profile-tab.html",scope:{},require:"^tgProfileTabs",link:t,transclude:!0}},angular.module("taigaProfile").directive("tgProfileTab",t)}.call(this),function(){var t;t=function(){function t(){this.tabs=[]}return t.prototype.addTab=function(t){return this.tabs.push(t)},t.prototype.toggleTab=function(t){return _.map(this.tabs,function(t){return t.active=!1}),t.active=!0},t}(),angular.module("taigaProfile").controller("ProfileTabs",t)}.call(this),function(){var t;t=function(){return{scope:{},controller:"ProfileTabs",controllerAs:"vm",templateUrl:"profile/profile-tabs/profile-tabs.html",transclude:!0}},angular.module("taigaProfile").directive("tgProfileTabs",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n,i,o){this.appMetaService=t,this.currentUserService=e,this.routeParams=r,this.userService=n,this.xhrError=i,this.translate=o,this.isCurrentUser=!1,this.routeParams.slug?this.userService.getUserByUserName(this.routeParams.slug).then(function(t){return function(e){return e.get("is_active")?(t.user=e,t.isCurrentUser=!1,t._setMeta(t.user),e):t.xhrError.notFound()}}(this))["catch"](function(t){return function(e){return t.xhrError.response(e)}}(this)):(this.user=this.currentUserService.getUser(),this.isCurrentUser=!0,this._setMeta(this.user))}return t.$inject=["tgAppMetaService","tgCurrentUserService","$routeParams","tgUserService","tgXhrErrorService","$translate"],t.prototype._setMeta=function(t){var e,r,n;return e={userFullName:t.get("full_name_display"),userUsername:t.get("username")},n=this.translate.instant("USER.PROFILE.PAGE_TITLE",e),r=t.get("bio"),this.appMetaService.setAll(n,r)},t}(),angular.module("taigaProfile").controller("Profile",t)}.call(this),function(){var t;t=function(){return{templateUrl:"projects/project/blocked-project-explanation.html"}},angular.module("taigaProjects").directive("tgBlockedProjectExplanation",t)}.call(this),function(){var t;t=function(){function t(t,e){this.confirm=t,this.likeButtonService=e,this.isMouseOver=!1,this.loading=!1}return t.$inject=["$tgConfirm","tgLikeProjectButtonService"],t.prototype.showTextWhenMouseIsOver=function(){return this.isMouseOver=!0},t.prototype.showTextWhenMouseIsLeave=function(){return this.isMouseOver=!1},t.prototype.toggleLike=function(){var t;return this.loading=!0,t=this.project.get("is_fan")?this._unlike():this._like(),t["finally"](function(t){return function(){return t.loading=!1}}(this)),t},t.prototype._like=function(){return this.likeButtonService.like(this.project.get("id")).then(function(t){return function(){return t.showTextWhenMouseIsLeave()}}(this))["catch"](function(t){return function(){return t.confirm.notify("error")}}(this))},t.prototype._unlike=function(){return this.likeButtonService.unlike(this.project.get("id"))["catch"](function(t){return function(){return t.confirm.notify("error")}}(this))},t}(),angular.module("taigaProjects").controller("LikeProjectButton",t)}.call(this),function(){var t;t=function(){return{scope:{},controller:"LikeProjectButton",bindToController:{project:"="},controllerAs:"vm",templateUrl:"projects/components/like-project-button/like-project-button.html"}},angular.module("taigaProjects").directive("tgLikeProjectButton",t)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga,t=function(t){function e(t,e,r){this.rs=t,this.currentUserService=e,this.projectService=r}return r(e,t),e.$inject=["tgResources","tgCurrentUserService","tgProjectService"],e.prototype._getProjectIndex=function(t){return this.currentUserService.projects.get("all").findIndex(function(e){return e.get("id")===t})},e.prototype._updateProjects=function(t,e){var r,n;return r=this._getProjectIndex(t),-1!==r?(n=this.currentUserService.projects.get("all").update(r,function(t){var r;return r=t.get("total_fans"),e?r++:r--,t.merge({is_fan:e,total_fans:r})}),this.currentUserService.setProjects(n)):void 0},e.prototype._updateCurrentProject=function(t){var e,r;return r=this.projectService.project.get("total_fans"),t?r++:r--,e=this.projectService.project.merge({is_fan:t,total_fans:r}),this.projectService.setProject(e)},e.prototype.like=function(t){return this.rs.projects.likeProject(t).then(function(e){return function(){return e._updateProjects(t,!0),e._updateCurrentProject(!0)}}(this))},e.prototype.unlike=function(t){return this.rs.projects.unlikeProject(t).then(function(e){return function(){return e._updateProjects(t,!1),e._updateCurrentProject(!1)}}(this))},e}(e.Service),angular.module("taigaProjects").service("tgLikeProjectButtonService",t)}.call(this),function(){var t;t=function(t){var e,r;return r=function(e,r,n,i){var o,s,a;return s=null,o=dragula([r[0]],{copySortSource:!1,copy:!1,mirrorContainer:r[0],moves:function(t){return $(t).hasClass("list-itemtype-project")}}),o.on("dragend",function(r){var n,i,o,a,u,c,l;for(s=$(r),a=s.scope().project,i=s.index(),c=_.map(e.projects.toJS(),function(t){return t.id}),c=_.without(c,a.get("id")),c.splice(i,0,a.get("id")),u=[],i=n=0,o=c.length;o>n;i=++n)l=c[i],u.push({project_id:l,order:i});return t.bulkUpdateProjectsOrder(u)}),a=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&o.dragging}}),e.$on("$destroy",function(){return r.off(),o.destroy()})},e={scope:{projects:"=tgSortProjects"},link:r}},angular.module("taigaProjects").directive("tgSortProjects",["tgCurrentUserService",t])}.call(this),function(){var t;t=function(){function t(t,e){this.confirm=t,this.watchButtonService=e,this.showWatchOptions=!1,this.loading=!1}return t.$inject=["$tgConfirm","tgWatchProjectButtonService"],t.prototype.toggleWatcherOptions=function(){return this.showWatchOptions=!this.showWatchOptions},t.prototype.closeWatcherOptions=function(){return this.showWatchOptions=!1},t.prototype.watch=function(t){return t!==this.project.get("notify_level")?(this.loading=!0,this.closeWatcherOptions(),this.watchButtonService.watch(this.project.get("id"),t)["catch"](function(t){return function(){return t.confirm.notify("error")}}(this))["finally"](function(t){return function(){return t.loading=!1}}(this))):void 0},t.prototype.unwatch=function(){return this.loading=!0,this.closeWatcherOptions(),this.watchButtonService.unwatch(this.project.get("id"))["catch"](function(t){return function(){return t.confirm.notify("error")}}(this))["finally"](function(t){return function(){return t.loading=!1}}(this))},t}(),angular.module("taigaProjects").controller("WatchProjectButton",t)}.call(this),function(){var t;t=function(){return{scope:{},controller:"WatchProjectButton",bindToController:{project:"="},controllerAs:"vm",templateUrl:"projects/components/watch-project-button/watch-project-button.html"}},angular.module("taigaProjects").directive("tgWatchProjectButton",t)}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga,t=function(t){function e(t,e,r){this.rs=t,this.currentUserService=e,this.projectService=r}return r(e,t),e.$inject=["tgResources","tgCurrentUserService","tgProjectService"],e.prototype._getProjectIndex=function(t){return this.currentUserService.projects.get("all").findIndex(function(e){return e.get("id")===t})},e.prototype._updateProjects=function(t,e,r){var n,i;return n=this._getProjectIndex(t),-1!==n?(i=this.currentUserService.projects.get("all").update(n,function(t){return function(n){var i;return i=n.get("total_watchers"),!t.projectService.project.get("is_watcher")&&r?i++:t.projectService.project.get("is_watcher")&&!r&&i--,n.merge({is_watcher:r,total_watchers:i,notify_level:e})}}(this)),this.currentUserService.setProjects(i)):void 0},e.prototype._updateCurrentProject=function(t,e){var r,n;return n=this.projectService.project.get("total_watchers"),!this.projectService.project.get("is_watcher")&&e?n++:this.projectService.project.get("is_watcher")&&!e&&n--,r=this.projectService.project.merge({is_watcher:e,notify_level:t,total_watchers:n}),this.projectService.setProject(r)},e.prototype.watch=function(t,e){return this.rs.projects.watchProject(t,e).then(function(r){return function(){return r._updateProjects(t,e,!0),r._updateCurrentProject(e,!0)}}(this))},e.prototype.unwatch=function(t){return this.rs.projects.unwatchProject(t).then(function(e){return function(){return e._updateProjects(t,null,!1),e._updateCurrentProject(null,!1)}}(this))},e}(e.Service),angular.module("taigaProjects").service("tgWatchProjectButtonService",t)}.call(this),function(){var t;t=function(){function t(t,e){this.currentUserService=t,this.projectsService=e,taiga.defineImmutableProperty(this,"projects",function(t){return function(){return t.currentUserService.projects.get("all")}}(this))}return t.$inject=["tgCurrentUserService","tgProjectsService"],t.prototype.newProject=function(){return this.projectsService.newProject()},t}(),angular.module("taigaProjects").controller("ProjectsListing",t)}.call(this),function(){var t;t=function(){function t(t,e,r,n,i){var o;this.routeParams=t,this.appMetaService=e,this.auth=r,this.translate=n,this.projectService=i,o=this.routeParams.pslug,this.user=this.auth.userData,taiga.defineImmutableProperty(this,"project",function(t){return function(){return t.projectService.project}}(this)),taiga.defineImmutableProperty(this,"members",function(t){return function(){return t.projectService.activeMembers}}(this)),this.appMetaService.setfn(this._setMeta.bind(this))}return t.$inject=["$routeParams","tgAppMetaService","$tgAuth","$translate","tgProjectService"],t.prototype._setMeta=function(t){var e,r;return this.project?(r={},e={projectName:this.project.get("name")},r.title=this.translate.instant("PROJECT.PAGE_TITLE",e),r.description=this.project.get("description"),r):null},t}(),angular.module("taigaProjects").controller("Project",t)}.call(this),function(){var t,e,r,n=function(t,e){function r(){this.constructor=t}for(var n in e)i.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},i={}.hasOwnProperty;r=this.taiga,e=this.taiga.groupBy,t=function(t){function e(t,e,r){this.rs=t,this.projectUrl=e,this.lightboxFactory=r}return n(e,t),e.$inject=["tgResources","$projectUrl","tgLightboxFactory"],e.prototype.getProjectBySlug=function(t){return this.rs.projects.getProjectBySlug(t).then(function(t){return function(e){return t._decorate(e)}}(this))},e.prototype.getProjectStats=function(t){return this.rs.projects.getProjectStats(t)},e.prototype.getProjectsByUserId=function(t,e){return this.rs.projects.getProjectsByUserId(t,e).then(function(t){return function(e){return e.map(t._decorate.bind(t))}}(this))},e.prototype._decorate=function(t){var e,r,n;return n=this.projectUrl.get(t.toJS()),t=t.set("url",n),e=[],t.get("tags")&&(r=t.get("tags").sort(),e=r.map(function(e){var r;return r=t.get("tags_colors").get(e),Immutable.fromJS({name:e,color:r})}),t=t.set("colorized_tags",e)),t},e.prototype.newProject=function(){return this.lightboxFactory.create("tg-lb-create-project",{"class":"wizard-create-project lightbox"})},e.prototype.bulkUpdateProjectsOrder=function(t){return this.rs.projects.bulkUpdateOrder(t)},e.prototype.transferValidateToken=function(t,e){return this.rs.projects.transferValidateToken(t,e)},e.prototype.transferAccept=function(t,e,r){return this.rs.projects.transferAccept(t,e,r)},e.prototype.transferReject=function(t,e,r){return this.rs.projects.transferReject(t,e,r)},e}(r.Service),angular.module("taigaProjects").service("tgProjectsService",t)}.call(this),function(){var t;t=function(){return{templateUrl:"projects/transfer/cant-own-project-explanation.html"}},angular.module("taigaProjects").directive("tgCantOwnProjectExplanation",t)}.call(this),function(){var t,e;e=angular.module("taigaProjects"),t=function(){function t(t,e,r,n,i,o,s,a){this.routeParams=t,this.projectService=e,this.location=r,this.authService=n,this.currentUserService=i,this.navUrls=o,this.translate=s,this.confirmService=a}return t.$inject=["$routeParams","tgProjectsService","$location","$tgAuth","tgCurrentUserService","$tgNavUrls","$translate","$tgConfirm"],t.prototype.initialize=function(){return this.projectId=this.project.get("id"),this.token=this.routeParams.token,this.showAddComment=!1,this._refreshUserData()},t.prototype._validateToken=function(){return this.projectService.transferValidateToken(this.projectId,this.token).then(null,function(t){return function(e,r){return t.location.path(t.navUrls.resolve("not-found"))}}(this))},t.prototype._refreshUserData=function(){return this.authService.refresh().then(function(t){return function(){return t._validateToken(),t._setProjectData(),t._checkOwnerData()}}(this))},t.prototype._setProjectData=function(){return this.canBeOwnedByUser=this.currentUserService.canOwnProject(this.project)},t.prototype._checkOwnerData=function(){var t,e;return t=this.currentUserService.getUser(),this.project.get("is_private")?(this.ownerMessage="ADMIN.PROJECT_TRANSFER.OWNER_MESSAGE.PRIVATE",this.maxProjects=t.get("max_private_projects"),null===this.maxProjects&&(this.maxProjects=this.translate.instant("ADMIN.PROJECT_TRANSFER.UNLIMITED_PROJECTS")),this.currentProjects=t.get("total_private_projects"),e=t.get("max_memberships_private_projects")):(this.ownerMessage="ADMIN.PROJECT_TRANSFER.OWNER_MESSAGE.PUBLIC",this.maxProjects=t.get("max_public_projects"),null===this.maxProjects&&(this.maxProjects=this.translate.instant("ADMIN.PROJECT_TRANSFER.UNLIMITED_PROJECTS")),this.currentProjects=t.get("total_public_projects"),e=t.get("max_memberships_public_projects")),this.validNumberOfMemberships=null===e||this.project.get("total_memberships")<=e},t.prototype.transferAccept=function(t,e){return this.loadingAccept=!0,this.projectService.transferAccept(this.project.get("id"),t,e).then(function(t){return function(){var e;e=t.navUrls.resolve("project-admin-project-profile-details",{project:t.project.get("slug")}),t.loadingAccept=!1,t.location.path(e),t.confirmService.notify("success",t.translate.instant("ADMIN.PROJECT_TRANSFER.ACCEPTED_PROJECT_OWNERNSHIP"),"",5e3)}}(this))},t.prototype.transferReject=function(t,e){return this.loadingReject=!0,this.projectService.transferReject(this.project.get("id"),t,e).then(function(t){return function(){var e;e=t.navUrls.resolve("home",{project:t.project.get("slug")}),t.loadingReject=!1,t.location.path(e),t.confirmService.notify("success",t.translate.instant("ADMIN.PROJECT_TRANSFER.REJECTED_PROJECT_OWNERNSHIP"),"",5e3)}}(this))},t.prototype.addComment=function(){return this.showAddComment=!0},t.prototype.hideComment=function(){return this.showAddComment=!1,this.reason=""},t}(),e.controller("TransferProjectController",t)}.call(this),function(){var t,e;e=angular.module("taigaProjects"),t=function(){var t;return t=function(t,e,r,n){return n.initialize()},{link:t,scope:{},bindToController:{project:"="},templateUrl:"projects/transfer/transfer-project.html",controller:"TransferProjectController",controllerAs:"vm"}},e.directive("tgTransferProject",t)}.call(this),function(){var t,e,r,n;n=this.taiga,r=this.taiga.sizeFormat,t=function(t,e,n,i,o,s){var a;return a={},a.list=function(r,n,i){var o,s,a,u;return u="attachments/"+r,s={object_id:n,project:i},o={headers:{"x-disable-pagination":"1"}},a=t.resolve(u),e.get(a,s,o).then(function(t){return Immutable.fromJS(t.data)})},a["delete"]=function(r,n){var i,o;return o="attachments/"+r,i=t.resolve(o)+("/"+n),e["delete"](i)},a.patch=function(r,n,i){var o,s;return s="attachments/"+r,o=t.resolve(s)+("/"+n),e.patch(o,i)},a.create=function(e,a,u,c){var l,p,d,f,h,m,g,v,_,y,b;return y="attachments/"+e,_=t.resolve(y),p=o.defer(),void 0===c?(p.reject(null),p.promise):(d=n.get("maxUploadFileSize",null),d&&c.size>d?(f={status:413,data:{_error_message:"'"+c.name+"' ("+r(c.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+r(d)+")"}},p.reject(f),p.promise):(v=function(t){return function(t){return i.$apply(function(){return c.status="in-progress",c.size=r(t.total),c.progressMessage="upload "+r(t.loaded)+" of "+r(t.total),c.progressPercent=Math.round(t.loaded/t.total*100)+"%"})}}(this),m=function(t){return function(t){return i.$apply(function(){var e,r,n;c.status="done",n=t.target.status;try{e=JSON.parse(t.target.responseText)}catch(i){e={}}return n>=200&&400>n?(e=Immutable.fromJS(e),p.resolve(e)):(f={status:n,data:{_error_message:null!=(r=l.attached_file)?r[0]:void 0}},p.reject(f))})}}(this),g=function(t){return function(t){return i.$apply(function(){return c.status="error",p.reject("fail")})}}(this),l=new FormData,l.append("project",a),l.append("object_id",u),l.append("attached_file",c),b=new XMLHttpRequest,b.upload.addEventListener("progress",v,!1),b.addEventListener("load",m,!1),b.addEventListener("error",g,!1),h=s.get("token"),b.open("POST",_),b.setRequestHeader("Authorization","Bearer "+h),b.setRequestHeader("Accept","application/json"),b.send(l),p.promise))},function(){return{attachments:a}}},t.$inject=["$tgUrls","$tgHttp","$tgConfig","$rootScope","$q","$tgStorage"],e=angular.module("taigaResources2"),e.factory("tgAttachmentsResource",t)}.call(this),function(){var t,e;t=function(t,e){var r;return r={},r.getApplicationToken=function(r,n){var i;return i=t.resolve("applications"),i=i+"/"+r+"/token?state="+n,e.get(i).then(function(t){return Immutable.fromJS(t.data)})},r.authorizeApplicationToken=function(r,n){var i,o;return o=t.resolve("application-tokens"),o+="/authorize",i={state:n,application:r},e.post(o,i).then(function(t){return Immutable.fromJS(t.data)})},function(){return{externalapps:r}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgExternalAppsResource",t)}.call(this),function(){var t,e;t=function(t,e){var r;return r={},r.listInAllProjects=function(r){var n,i;return i=t.resolve("issues"),n={headers:{"x-disable-pagination":"1"}},e.get(i,r,n).then(function(t){return Immutable.fromJS(t.data)})},function(){return{issues:r}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgIssuesResource",t)}.call(this),function(){var t,e,r;r=function(){},t=function(t,e,r){var n;return n={},n.getProjects=function(r,n){var i,o;return null==r&&(r={}),null==n&&(n=!0),o=t.resolve("projects"),i={},n||(i={headers:{"x-lazy-pagination":!0}}),e.get(o,r,i)},n.getProjectBySlug=function(r){var n;return n=t.resolve("projects"),n=n+"/by_slug?slug="+r,e.get(n).then(function(t){return Immutable.fromJS(t.data)})},n.getProjectsByUserId=function(r,n){var i,o,s;return null==n&&(n=!1),s=t.resolve("projects"),i={},n||(i.headers={"x-disable-pagination":"1"}),o={member:r,order_by:"memberships__user_order"},e.get(s,o,i).then(function(t){return Immutable.fromJS(t.data)})},n.getProjectStats=function(r){var n;return n=t.resolve("projects"),n=n+"/"+r,e.get(n).then(function(t){return Immutable.fromJS(t.data)})},n.bulkUpdateOrder=function(r){var n;return n=t.resolve("bulk-update-projects-order"),e.post(n,r)},n.getTimeline=function(n,i){var o,s;return o={page:i,only_relevant:!0},s=t.resolve("timeline-project"),s=s+"/"+n,e.get(s,o,{headers:{"x-lazy-pagination":!0}}).then(function(t){return t=Immutable.fromJS(t),r(t)})},n.likeProject=function(r){var n;return n=t.resolve("project-like",r),e.post(n)},n.unlikeProject=function(r){var n;return n=t.resolve("project-unlike",r),e.post(n)},n.watchProject=function(r,n){var i,o;return i={notify_level:n},o=t.resolve("project-watch",r),e.post(o,i)},n.unwatchProject=function(r){var n;return n=t.resolve("project-unwatch",r),e.post(n)},n.transferValidateToken=function(r,n){var i,o;return i={token:n},o=t.resolve("project-transfer-validate-token",r),e.post(o,i)},n.transferAccept=function(r,n,i){var o,s;return o={token:n,reason:i},s=t.resolve("project-transfer-accept",r),e.post(s,o)},n.transferReject=function(r,n,i){var o,s;return o={token:n,reason:i},s=t.resolve("project-transfer-reject",r),e.post(s,o)},n.transferRequest=function(r){var n;return n=t.resolve("project-transfer-request",r),e.post(n)},n.transferStart=function(r,n,i){var o,s;return o={user:n,reason:i},s=t.resolve("project-transfer-start",r),e.post(s,o)},function(){return{projects:n}}},t.$inject=["$tgUrls","$tgHttp","tgPaginateResponseService"],e=angular.module("taigaResources2"),e.factory("tgProjectsResources",t)}.call(this),function(){var t,e;e=["tgProjectsResources","tgUserResources","tgUsersResources","tgUserstoriesResource","tgTasksResource","tgIssuesResource","tgExternalAppsResource","tgAttachmentsResource","tgStatsResource"],t=function(t){var r,n,i,o,s,a,u,c,l;for(r=0,i=e.length;i>r;r++)for(c=e[r],u=t.get(c),a=t.invoke(u),s=Object.keys(a),n=0,o=s.length;o>n;n++)l=s[n],this[l]&&console.warm("repeated resource "+l),this[l]=a[l];return this},t.$inject=["$injector"],angular.module("taigaResources2").service("tgResources",t)}.call(this),function(){var t,e;t=function(t,e){var r;return r={},r.discover=function(r,n){var i;return i=t.resolve("stats-discover"),e.get(i).then(function(t){return Immutable.fromJS(t.data)})},function(){return{stats:r}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgStatsResource",t)}.call(this),function(){var t,e;t=function(t,e){var r;return r={},r.listInAllProjects=function(r){var n,i;return i=t.resolve("tasks"),n={headers:{"x-disable-pagination":"1"}},e.get(i,r,n).then(function(t){return Immutable.fromJS(t.data)})},function(){return{tasks:r}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgTasksResource",t)}.call(this),function(){var t,e;t=function(t,e,r){var n;return n={},n.getUserStorage=function(r){var n,i;return i=t.resolve("user-storage"),r&&(i+="/"+r),n={},e.get(i,{}).then(function(t){return t.data.value})},n.setUserStorage=function(r,n){var i,o;return o=t.resolve("user-storage")+"/"+r,i={key:r,value:n},e.put(o,i)},n.createUserStorage=function(r,n){var i,o;return o=t.resolve("user-storage"),i={key:r,value:n},e.post(o,i)},function(){return{user:n}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgUserResources",t)}.call(this),function(){var t,e;t=function(t,e,r){var n;return n={},n.getUserByUsername=function(r){var n,i,o;return o=t.resolve("by_username"),n={headers:{"x-disable-pagination":"1"}},i={username:r},e.get(o,i,n).then(function(t){return Immutable.fromJS(t.data)})},n.getStats=function(r){var n,i;return i=t.resolve("user-stats",r),n={headers:{"x-disable-pagination":"1"}},e.get(i,{},n).then(function(t){return Immutable.fromJS(t.data)})},n.getContacts=function(r){var n,i;return i=t.resolve("user-contacts",r),n={headers:{"x-disable-pagination":"1"}},e.get(i,{},n).then(function(t){return Immutable.fromJS(t.data)})},n.getLiked=function(n,i,o,s){var a,u;return u=t.resolve("user-liked",n),a={},null!=i&&(a.page=i),null!=o&&(a.type=o),null!=s&&(a.q=s),a.only_relevant=!0,e.get(u,a,{headers:{"x-lazy-pagination":!0}}).then(function(t){return t=Immutable.fromJS(t),r(t)})},n.getVoted=function(n,i,o,s){var a,u;return u=t.resolve("user-voted",n),a={},null!=i&&(a.page=i),null!=o&&(a.type=o),null!=s&&(a.q=s),e.get(u,a,{headers:{"x-lazy-pagination":!0}}).then(function(t){return t=Immutable.fromJS(t),r(t)})},n.getWatched=function(n,i,o,s){var a,u;return u=t.resolve("user-watched",n),a={},null!=i&&(a.page=i),null!=o&&(a.type=o),null!=s&&(a.q=s),e.get(u,a,{headers:{"x-lazy-pagination":!0}}).then(function(t){return t=Immutable.fromJS(t),r(t)})},n.getProfileTimeline=function(n,i){var o,s;return o={page:i},s=t.resolve("timeline-profile"),s=s+"/"+n,e.get(s,o,{headers:{"x-lazy-pagination":!0}}).then(function(t){return t=Immutable.fromJS(t),r(t)})},n.getUserTimeline=function(n,i){var o,s;return o={page:i,only_relevant:!0},s=t.resolve("timeline-user"),s=s+"/"+n,e.get(s,o,{headers:{"x-lazy-pagination":!0}}).then(function(t){return t=Immutable.fromJS(t),r(t)})},function(){return{users:n}}},t.$inject=["$tgUrls","$tgHttp","tgPaginateResponseService"],e=angular.module("taigaResources2"),e.factory("tgUsersResources",t)}.call(this),function(){var t,e;t=function(t,e){var r;return r={},r.listInAllProjects=function(r){var n,i;return i=t.resolve("userstories"),n={headers:{"x-disable-pagination":"1"}},e.get(i,r,n).then(function(t){return Immutable.fromJS(t.data)})},function(){return{userstories:r}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgUserstoriesResource",t)}.call(this),function(){var t,e,r;e=this.taiga,r=e.truncate,t=function(){function t(t){this.rootScope=t}return t.$inject=["$rootScope"],t.prototype._set=function(t,e){var r;if(t)return"title"===t?(r=$("head title"),0===r.length&&(r=$(""),$("head").append(r)),r.text(e||"")):0===t.indexOf("og:")?(r=$("head meta[property='"+t+"']"),0===r.length&&(r=$(""),$("head").append(r)),r.attr("content",e||"")):(r=$("head meta[name='"+t+"']"),0===r.length&&(r=$(""),$("head").append(r)),r.attr("content",e||""))},t.prototype.setTitle=function(t){return this._set("title",t)},t.prototype.setDescription=function(t){return this._set("description",r(t,250))},t.prototype.setTwitterMetas=function(t,e){return this._set("twitter:card","summary"),this._set("twitter:site","@taigaio"),this._set("twitter:title",t),this._set("twitter:description",r(e,300)),this._set("twitter:image",window.location.origin+"/"+window._version+"/images/logo-color.png")},t.prototype.setOpenGraphMetas=function(t,e){return this._set("og:type","object"),this._set("og:site_name","Taiga - Love your projects"),this._set("og:title",t),this._set("og:description",r(e,300)),this._set("og:image",window.location.origin+"/"+window._version+"/images/logo-color.png"),this._set("og:url",window.location.href)},t.prototype.setAll=function(t,e){return this.setTitle(t),this.setDescription(e),this.setTwitterMetas(t,e),this.setOpenGraphMetas(t,e)},t.prototype.addMobileViewport=function(){return $("head").append('')},t.prototype.removeMobileViewport=function(){return $('head meta[name="viewport"]').remove()},t.prototype.setfn=function(t){return this.listener&&this._listener(),this._listener=this.rootScope.$watchCollection(t,function(t){return function(e){return e?(t.setAll(e.title,e.description),t._listener()):void 0}}(this))},t}(),angular.module("taigaCommon").service("tgAppMetaService",t)}.call(this),function(){var t,e;e=this.taiga.sizeFormat,t=function(){function t(t,r,n,i){this.confirm=t,this.config=r,this.translate=n,this.rs=i,this.maxFileSize=this.getMaxFileSize(),this.maxFileSize&&(this.maxFileSizeFormated=e(this.maxFileSize))}return t.$inject=["$tgConfirm","$tgConfig","$translate","tgResources"],t.prototype.sizeError=function(t){var r;return r=this.translate.instant("ATTACHMENT.ERROR_MAX_SIZE_EXCEEDED",{fileName:t.name,fileSize:e(t.size),maxFileSize:this.maxFileSizeFormated}),this.confirm.notify("error",r)},t.prototype.validate=function(t){return this.maxFileSize&&t.size>this.maxFileSize?(this.sizeError(t),!1):!0},t.prototype.getMaxFileSize=function(){return this.config.get("maxUploadFileSize",null)},t.prototype.list=function(t,e,r){return this.rs.attachments.list(t,e,r).then(function(t){return function(t){return t.sortBy(function(t){return t.get("order")})}}(this))},t.prototype["delete"]=function(t,e){return this.rs.attachments["delete"](t,e)},t.prototype.saveError=function(t,e){var r;return r="",t&&(r=this.translate.instant("ATTACHMENT.ERROR_UPLOAD_ATTACHMENT",{fileName:t.name,errorMessage:e.data._error_message})),this.confirm.notify("error",r)},t.prototype.upload=function(t,e,r,n){var i;return i=this.rs.attachments.create(n,r,e,t),i.then(null,this.saveError.bind(this,t)),i},t.prototype.patch=function(t,e,r){var n;return n=this.rs.attachments.patch(e,t,r),n.then(null,this.saveError.bind(this,null)),
-n},t}(),angular.module("taigaCommon").service("tgAttachmentsService",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t){this.projectService=t}return t.$inject=["tgProjectService"],t.prototype.check=function(t){return this.projectService.project?-1!==this.projectService.project.get("my_permissions").indexOf(t):!1},t}(),angular.module("taigaCommon").service("tgCheckPermissionsService",t)}.call(this),function(){var t,e,r;r=this.taiga,e=this.taiga.groupBy,t=function(){function t(t,e,n){this.projectsService=t,this.storageService=e,this.rs=n,this._user=null,this._projects=Immutable.Map(),this._projectsById=Immutable.Map(),this._joyride=null,r.defineImmutableProperty(this,"projects",function(t){return function(){return t._projects}}(this)),r.defineImmutableProperty(this,"projectsById",function(t){return function(){return t._projectsById}}(this))}return t.$inject=["tgProjectsService","$tgStorage","tgResources"],t.prototype.isAuthenticated=function(){return null!==this.getUser()?!0:!1},t.prototype.getUser=function(){var t;return this._user||(t=this.storageService.get("userInfo"),t&&(t=Immutable.fromJS(t),this.setUser(t))),this._user},t.prototype.removeUser=function(){return this._user=null,this._projects=Immutable.Map(),this._projectsById=Immutable.Map(),this._joyride=null},t.prototype.setUser=function(t){return this._user=t,this._loadUserInfo()},t.prototype.bulkUpdateProjectsOrder=function(t){return this.projectsService.bulkUpdateProjectsOrder(t).then(function(t){return function(){return t.loadProjects()}}(this))},t.prototype.loadProjects=function(){return this.projectsService.getProjectsByUserId(this._user.get("id")).then(function(t){return function(e){return t.setProjects(e)}}(this))},t.prototype.disableJoyRide=function(t){return t?this._joyride[t]=!1:this._joyride={backlog:!1,kanban:!1,dashboard:!1},this.rs.user.setUserStorage("joyride",this._joyride)},t.prototype.loadJoyRideConfig=function(){return new Promise(function(t){return function(e){return null!==t._joyride?void e(t._joyride):t.rs.user.getUserStorage("joyride").then(function(r){return t._joyride=r,e(t._joyride)})["catch"](function(){return t._joyride={backlog:!0,kanban:!0,dashboard:!0},t.rs.user.createUserStorage("joyride",t._joyride),e(t._joyride)})}}(this))},t.prototype._loadUserInfo=function(){return Promise.all([this.loadProjects()])},t.prototype.setProjects=function(t){return this._projects=this._projects.set("all",t),this._projects=this._projects.set("recents",t.slice(0,10)),this._projectsById=Immutable.fromJS(e(t.toJS(),function(t){return t.id})),this.projects},t.prototype.canCreatePrivateProjects=function(){var t;return t=this.getUser(),null!==t.get("max_private_projects")&&t.get("total_private_projects")>=t.get("max_private_projects")?{valid:!1,reason:"max_private_projects",type:"private_project"}:{valid:!0}},t.prototype.canCreatePublicProjects=function(){var t;return t=this.getUser(),null!==t.get("max_public_projects")&&t.get("total_public_projects")>=t.get("max_public_projects")?{valid:!1,reason:"max_public_projects",type:"public_project"}:{valid:!0}},t.prototype.canOwnProject=function(t){var e,r;if(r=this.getUser(),t.get("is_private")){if(e=this.canCreatePrivateProjects(),!e.valid)return e;if(null!==r.get("max_memberships_private_projects")&&t.get("total_memberships")>r.get("max_memberships_private_projects"))return{valid:!1,reason:"max_members_private_projects",type:"private_project"}}else{if(e=this.canCreatePublicProjects(),!e.valid)return e;if(null!==r.get("max_memberships_public_projects")&&t.get("total_memberships")>r.get("max_memberships_public_projects"))return{valid:!1,reason:"max_members_public_projects",type:"public_project"}}return{valid:!0}},t}(),angular.module("taigaCommon").service("tgCurrentUserService",t)}.call(this),function(){var t;t=function(){function t(t,e){this.rootScope=t,this.compile=e}return t.$inject=["$rootScope","$compile"],t.prototype.create=function(t,e,r){var n,i,o;o=this.rootScope.$new(),o=_.merge(o,r),n=$("