f){n=e.find(".backlog-table-body .us-item-row")[i],s(n);break}l.push(void 0)}return l}},c=function(){return e.find(".doom-line").remove()},s=function(t){var e;return e=r.instant("BACKLOG.DOOMLINE"),$(t).before(n({text:e}))},a=function(){var t;return t=e.find(".backlog-table-body .us-item-row"),_.map(t,function(t){return angular.element(t)})},t.$on("userstories:loaded",u),t.$watch("stats",u)},a=function(e,r,n,i){var o,s,a,u,c,p,f;return s=function(){var t;return t=r.find(".backlog-table-body input:checkbox:checked"),
-_.map(t,function(t){var r;return t=$(t).closest(".tg-scope"),r=t.scope(),r.us.milestone=e.sprints[0].id,r.us})},p=function(n,o){var s,a,u;return u=_(e.userstories),e.userstories=u.without.apply(u,n).value(),s=_.map(n,function(t,e){return t.total_points}),a=_.reduce(s,function(t,e){return t+e}),o.user_stories=_.union(o.user_stories,n),o.total_points+=a,t.saveAll(n).then(function(){return i.loadSprints(),i.loadProjectStats()}),r.find(".move-to-sprint").hide()},u=function(t){return p(t,e.currentSprint)},c=function(t){return p(t,e.sprints[0])},f=!1,a=null,o=function(t){var n,i;return a=t.closest(".us-item-row"),t.closest(".us-item-row").toggleClass("ui-multisortable-multiple"),n=r.find(".move-to-sprint"),i=r.find(".backlog-table-body input:checkbox:checked"),i.length>0&&e.sprints.length>0?n.show():n.hide()},$(window).on("keydown.shift-pressed keyup.shift-pressed",function(t){return f=!!t.shiftKey,!0}),r.on("change",".backlog-table-body input:checkbox",function(t){var e,r,n,i,s;return a&&f&&(r=[],e=$(t.currentTarget).closest(".us-item-row"),n=a.nextAll(),i=a.prevAll(),_.some(n,function(t){return t===e[0]})?r=a.nextUntil(e):_.some(i,function(t){return t===e[0]})&&(r=a.prevUntil(e)),_.map(r,function(t){var e;return e=$(t).find("input:checkbox"),e.prop("checked",!0),o(e)})),s=angular.element(t.currentTarget),s.closest(".us-item-row").toggleClass("is-checked"),o(s)}),r.on("click","#move-to-latest-sprint",function(t){return function(t){var r;return r=s(),e.$apply(_.partial(c,r))}}(this)),r.on("click","#move-to-current-sprint",function(t){return function(t){var r;return r=s(),e.$apply(_.partial(u,r))}}(this)),r.on("click","#show-tags",function(t){return t.preventDefault(),i.toggleShowTags(),l(i)})},l=function(t){var e,n;return e=angular.element("#show-tags"),t.showTags?(e.addClass("active"),n=r.instant("BACKLOG.TAGS.HIDE"),e.text(n)):(e.removeClass("active"),n=r.instant("BACKLOG.TAGS.SHOW"),e.text(n))},u=function(t,e,r){var n;return n=e.find("sidebar.backlog-filter"),n.addClass("active"),r.activeFilters=!0},c=function(t,n,i){var o,s,a,u;return a=n.find("sidebar.backlog-filter"),a.one("transitionend",function(){return g(150,function(){return e.$broadcast("resize"),$(".burndown").css("visibility","visible")})}),u=angular.element("#show-filters-button"),$(".burndown").css("visibility","hidden"),a.toggleClass("active"),u.toggleClass("active"),o=r.instant("BACKLOG.FILTERS.HIDE"),s=r.instant("BACKLOG.FILTERS.SHOW"),m(u,[o,s]),i.toggleActiveFilters()},s=function(t,e,r,n){return t.filtersSearch={},e.on("click","#show-filters-button",function(r){return r.preventDefault(),t.$apply(function(){return c(t,e,n)})})},i=function(t,e,r,n){var i,c;return i=e.controller(),a(t,e,r,i),s(t,e,r,i),o(t,e,r,i),c=i.location.search(),(c.status||c.tags||c.q||c.assigned_to||c.owner)&&u(t,e,i),t.$on("showTags",function(){return l(i)}),t.$on("$destroy",function(){return e.off(),$(window).off(".shift-pressed")})},{link:i}},f.directive("tgBacklog",["$tgRepo","$rootScope","$translate",e]),s=function(t,e,r,n){var i,o;return o=e.get("backlog/us-role-points-popover.html",!0),i=function(e,i,s){return u(e,"project",function(t){var n,s;return s=_.filter(t.roles,"computable"),n=_.size(s),n>1?i.append(r(o({roles:s}))(e)):(i.find(".icon-arrow-down").remove(),i.find(".header-points").addClass("not-clickable"))}),e.$on("uspoints:select",function(t,e,r){return i.find(".popover").popover().close(),i.find(".header-points").html(r+"/Total")}),e.$on("uspoints:clear-selection",function(t,e){var r;return i.find(".popover").popover().close(),r=n.instant("COMMON.FIELDS.POINTS"),i.find(".header-points").text(r)}),i.on("click",function(t){var e;return e=angular.element(t.target),(e.is("span")||e.is("div"))&&t.stopPropagation(),i.find(".popover").popover().open()}),i.on("click",".clear-selection",function(e){return e.preventDefault(),e.stopPropagation(),t.$broadcast("uspoints:clear-selection")}),i.on("click",".role",function(e){var r,n;return e.preventDefault(),e.stopPropagation(),n=angular.element(e.currentTarget),r=n.scope(),t.$broadcast("uspoints:select",n.data("role-id"),n.text())}),e.$on("$destroy",function(){return i.off()})},{link:i}},f.directive("tgUsRolePointsSelector",["$rootScope","$tgTemplate","$compile","$translate",s]),o=function(t,e,r){var n,i;return i=r.get("common/estimation/us-points-roles-popover.html",!0),n=function(e,n,o){var s,a,u,c,l,p,f;return s=n.controller(),f=null,p=null,c=null,u=null,e.$on("uspoints:select",function(t,r,n){var i;return i=e.$eval(o.tgBacklogUsPoints),p=r,u.render()}),e.$on("uspoints:clear-selection",function(t){var r;return r=e.$eval(o.tgBacklogUsPoints),p=null,u.render()}),e.$watch(o.tgBacklogUsPoints,function(i){var o;if(i)return u=t.create(n,i,e.project),o=u.calculateRoles(),0===o.length?(n.find(".icon-arrow-bottom").remove(),n.find("a.us-points").addClass("not-clickable")):1===o.length&&(p=_.keys(i.points)[0]),u.isEditable&&a(),u.onSelectedPointForRole=function(t,e,r){return i.points=r,u.render(),this.save(t,e).then(function(){return s.loadProjectStats()})},u.render=function(){var t,e,n,i,s,a,u,c,l;return l=this.calculateTotalPoints(),null==p||1===o.length?(u=l,c=l):(i=this.us.points[p],s=this.pointsById[i],u=s.name+" / "+l+"",c=s.name+" / "+l),t={totalPoints:l,roles:this.calculateRoles(),editable:this.isEditable,text:u,title:c},n="common/estimation/us-estimation-total.html",a=r.get(n,!0),e=a(t),this.$el.html(e)},u.render()}),l=function(){var t,e;return e=u.calculateRoles(),t=i({roles:e}),n.append(t),n.find(".pop-role").popover().open(function(){return $(this).remove()})},a=function(){return n.on("click","a.us-points",function(t){var r;return t.preventDefault(),t.stopPropagation(),r=e.$eval(o.tgBacklogUsPoints),f=p,null!=p?u.renderPointsSelector(p):l()}),n.on("click",".role",function(t){var r,i,s;return t.preventDefault(),t.stopPropagation(),i=angular.element(t.currentTarget),s=e.$eval(o.tgBacklogUsPoints),f=i.data("role-id"),r=n.find(".pop-role"),r.find("a").removeClass("active"),r.find("a[data-role-id='"+f+"']").addClass("active"),u.renderPointsSelector(f)})},e.$on("$destroy",function(){return n.off()})},{link:n}},f.directive("tgBacklogUsPoints",["$tgEstimationsService","$tgRepo","$tgTemplate",o]),i=function(t){var e,r,n;return e=function(){return $(".js-burndown-graph").removeClass("shown"),$(".js-toggle-burndown-visibility-button").removeClass("active"),$(".js-burndown-graph").removeClass("open")},n=function(t){return $(".js-toggle-burndown-visibility-button").addClass("active"),t?$(".js-burndown-graph").addClass("shown"):$(".js-burndown-graph").addClass("open")},r=function(r,i,o){var s,a,u;return s=!0,a=c(["is-burndown-grpahs-collapsed"]),r.isBurndownGraphCollapsed=t.get(a)||!1,u=function(){return r.isBurndownGraphCollapsed?e(s):n(s),s=!1},r.$watch("showGraphPlaceholder",function(){if(null!=r.showGraphPlaceholder)return r.isBurndownGraphCollapsed=r.isBurndownGraphCollapsed||r.showGraphPlaceholder,u()}),i.on("click",".js-toggle-burndown-visibility-button",function(){return r.isBurndownGraphCollapsed=!r.isBurndownGraphCollapsed,t.set(a,r.isBurndownGraphCollapsed),u()}),r.$on("$destroy",function(){return i.off()})},{link:r}},f.directive("tgToggleBurndownVisibility",["$tgStorage",i]),r=function(t){var e,r;return r=function(e,r){var n,i,o,s,a,u,c,l,p,f,d;return f=e.width(),e.height(f/6),a=function(){l=[];for(var t=0,e=r.milestones.length-1;0<=e?t<=e:t>=e;0<=e?t++:t--)l.push(t);return l}.apply(this),o=[],d=_.map(r.milestones,function(t){return 0}),o.push({data:_.zip(a,d),lines:{fillColor:"rgba(0,0,0,0)"},points:{show:!1}}),u=_.map(r.milestones,function(t){return t.optimal}),o.push({data:_.zip(a,u),lines:{fillColor:"rgba(120,120,120,0.2)"}}),s=_.filter(_.map(r.milestones,function(t){return t.evolution}),function(t){return null!=t}),o.push({data:_.zip(a,s),lines:{fillColor:"rgba(102,153,51,0.3)"}}),n=_.map(r.milestones,function(t){return-t["team-increment"]-t["client-increment"]}),o.push({data:_.zip(a,n),lines:{fillColor:"rgba(255,51,51,0.3)"}}),p=_.map(r.milestones,function(t){return-t["team-increment"]}),o.push({data:_.zip(a,p),lines:{fillColor:"rgba(153,51,51,0.3)"}}),i=["rgba(0,0,0,1)","rgba(120,120,120,0.2)","rgba(102,153,51,1)","rgba(153,51,51,1)","rgba(255,51,51,1)"],c={grid:{borderWidth:{top:0,right:1,left:0,bottom:0},borderColor:"#ccc",hoverable:!0},xaxis:{ticks:r.milestones.length,axisLabel:t.instant("BACKLOG.CHART.XAXIS_LABEL"),axisLabelUseCanvas:!0,axisLabelFontSizePixels:12,axisLabelFontFamily:"Verdana, Arial, Helvetica, Tahoma, sans-serif",axisLabelPadding:5,tickFormatter:function(t,e){return""}},yaxis:{axisLabel:t.instant("BACKLOG.CHART.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:i,tooltip:!0,tooltipOpts:{content:function(e,n,i,o){var s;return 1===o.seriesIndex?(s={sprintName:r.milestones[n].name,value:Math.abs(i)},t.instant("BACKLOG.CHART.OPTIMAL",s)):2===o.seriesIndex?(s={sprintName:r.milestones[n].name,value:Math.abs(i)},t.instant("BACKLOG.CHART.REAL",s)):3===o.seriesIndex?(s={sprintName:r.milestones[n].name,value:Math.abs(i)},t.instant("BACKLOG.CHART.INCREMENT_CLIENT",s)):(s={sprintName:r.milestones[n].name,value:Math.abs(i)},t.instant("BACKLOG.CHART.INCREMENT_TEAM",s))}}},e.empty(),e.plot(o,c).data("plot")},e=function(t,e,n){var i;return i=angular.element(e),t.$watch("stats",function(e){if(null!=t.stats)return r(i,t.stats),t.$on("resize",function(){return r(i,t.stats)})}),t.$on("$destroy",function(){return e.off()})},{link:e}},f.directive("tgBurndownBacklogGraph",["$translate",r]),n=function(t,e){var r,n,i,o;return o=t.get("backlog/progress-bar.html",!0),i=function(t,r,n,i){var s;return s=o({projectPointsPercentaje:n,closedPointsPercentaje:i}),s=e(s)(t),r.html(s)},r=function(t){var e;return e=_.max([0,t]),e=_.min([100,e]),Math.round(e)},n=function(t,e,n){var o;return o=angular.element(e),t.$watch(n.tgBacklogProgressBar,function(n){var o,s,a,u,c;if(null!=n)return c=n.total_points?n.total_points:n.defined_points,a=n.defined_points,o=n.closed_points,a>c?(u=100*c/a,s=100*o/a):(u=100,s=100*o/c),u=r(u-3),s=r(s-3),i(t,e,u,s)}),t.$on("$destroy",function(){return e.off()})},{link:n}},f.directive("tgBacklogProgressBar",["$tgTemplate","$compile",n])}.call(this),function(){var t,e,r,n,i;i=this.taiga,e=this.taiga.bindOnce,n=angular.module("taigaBacklog"),r=function(t){return $(t).scope().$destroy(),$(t).off(),$(t).remove()},t=function(){var t;return t=function(t,n,i){return e(t,"project",function(e){var i,o,s;if(e.my_permissions.indexOf("modify_us")>-1)return o=!1,i=dragula([n[0],$(".js-empty-backlog")[0]],{copySortSource:!1,copy:!1,isContainer:function(t){return t.classList.contains("sprint-table")},moves:function(t){return!!$(t).hasClass("row")}}),i.on("drag",function(t,e){var r,n;return n=$(t).parent(),o=n.hasClass("backlog-table-body"),$(document.body).addClass("drag-active"),r=$(t).find("input[type='checkbox']").is(":checked"),window.dragMultiple.start(t,e)}),i.on("cloned",function(t){return $(t).addClass("backlog-us-mirror")}),i.on("dragend",function(e){var n,i,s,a,u,c,l,p;return u=$(e).parent(),$(".doom-line").remove(),u=$(e).parent(),a=u.hasClass("backlog-table-body")||u.hasClass("js-empty-backlog"),c=o||a?o===a:$(e).scope().sprint.id===u.scope().sprint.id,n=window.dragMultiple.stop(),$(document.body).removeClass("drag-active"),l=null,i=n.length?n[0]:e,a?s=$(i).index(".backlog-table-body .row"):(s=$(i).index(),l=u.scope().sprint.id),c?p=n.length?_.map(n,function(t){return t=$(t).scope().us}):[$(e).scope().us]:(p=n.length?_.map(n,function(t){return t=$(t).scope().us}):[$(e).scope().us],n.length?_.each(n,function(t){return r(t)}):r(e)),t.$emit("sprint:us:move",p,s,l)}),s=autoScroll([window],{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&i.dragging}}),t.$on("$destroy",function(){return n.off(),i.destroy()})})},{link:t}},n.directive("tgBacklogSortable",t)}.call(this),function(){var t,e,r,n,i;i=this.taiga,n=angular.module("taigaBacklog"),t=function(t,e){var r,n,i,o;return i=50,n={duration:500,easing:"linear"},o=function(t){return function(t){var e,r;return r=t.find(".sprint-table"),e=t.find(".compact-sprint"),e.toggleClass("active"),r.toggleClass("open")}}(this),r=function(t,r,i){return t.$watch(i.tgBacklogSprint,function(e){return e=t.$eval(i.tgBacklogSprint),e.closed?r.addClass("sprint-closed"):o(r)}),r.on("click",".sprint-name > .compact-sprint",function(t){return t.preventDefault(),o(r),r.find(".sprint-table").slideToggle(n)}),r.on("click",".edit-sprint",function(r){var n;return r.preventDefault(),n=t.$eval(i.tgBacklogSprint),e.$broadcast("sprintform:edit",n)}),t.$on("$destroy",function(){return r.off()})},{link:r}},n.directive("tgBacklogSprint",["$tgRepo","$rootScope",t]),e=function(t,e,r,n){var i,o;return o=e.get("backlog/sprint-header.html"),i=function(e,i,s,a){var u,c,l,p;return l=n.instant("BACKLOG.SPRINTS.DATE"),u=function(){return e.project.my_permissions.indexOf("modify_milestone")!==-1},c=function(){return e.project.my_permissions.indexOf("view_milestones")!==-1},p=function(n){var s,a,p,f,d,h,g;return h=t.resolve("project-taskboard",{project:e.project.slug,sprint:n.slug}),d=moment(n.estimated_start).format(l),f=moment(n.estimated_finish).format(l),p=d+"-"+f,a={name:n.name,taskboardUrl:h,estimatedDateRange:p,closedPoints:n.closed_points||0,totalPoints:n.total_points||0,isVisible:c(),isEditable:u()},g=e.$new(),_.assign(g,a),s=r(o)(g),i.html(s)},e.$watch("sprint",function(t){return p(t)}),e.$on("$destroy",function(){return i.off()})},{link:i,restrict:"EA"}},n.directive("tgBacklogSprintHeader",["$tgNavUrls","$tgTemplate","$compile","$translate",e]),r=function(t,e,r){var n,i;return n=!0,i=function(i,o,s){var a,u;return u=$(""),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(){if(t.stats)return r(i,t.stats.days)}),t.$on("taskboard:graph:toggle-visibility",function(){return e.parent().toggleClass("open"),a(100,function(){if(t.stats)return r(i,t.stats.days)})}),t.$watch("stats",function(e){if(null!=t.stats)return r(i,t.stats.days)}),t.$on("$destroy",function(){return e.off()})},{link:e}},i.directive("tgSprintGraph",["$translate",t])}.call(this),function(){var t,e,r,n,i,o,s,a=[].indexOf||function(t){for(var e=0,r=this.length;e0}),n=_.map(o.assigned_to,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.full_name||"Unassigned",t}),s=_.map(o.owners,function(t){return t.id=t.id.toString(),t.name=t.full_name,t}),e.selectedFilters=[],t.status&&(a=e.formatSelectedFilters("status",u,t.status),e.selectedFilters=e.selectedFilters.concat(a)),t.tags&&(a=e.formatSelectedFilters("tags",c,t.tags),e.selectedFilters=e.selectedFilters.concat(a)),t.assigned_to&&(a=e.formatSelectedFilters("assigned_to",n,t.assigned_to),e.selectedFilters=e.selectedFilters.concat(a)),t.owner&&(a=e.formatSelectedFilters("owner",s,t.owner),e.selectedFilters=e.selectedFilters.concat(a)),e.filterQ=t.q,e.filters=[{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.STATUS"),dataType:"status",content:u},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"),dataType:"tags",content:c,hideEmpty:!0,totalTaggedElements:l.length},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),dataType:"assigned_to",content:n},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.CREATED_BY"),dataType:"owner",content:s}],e.customFilters=[],_.forOwn(i,function(t,r){return e.customFilters.push({id:r,name:r,filter:t})})}}(this))},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(e,r){return t.refreshTagsColors().then(function(){return t.taskboardTasksService.add(r)}),t.analytics.trackEvent("task","create","bulk create task on taskboard",1)}}(this)),this.scope.$on("taskform:new:success",function(t){return function(e,r){return t.refreshTagsColors().then(function(){return t.taskboardTasksService.add(r)}),t.analytics.trackEvent("task","create","create task on taskboard",1)}}(this)),this.scope.$on("taskform:edit:success",function(t){return function(e,r){return t.refreshTagsColors().then(function(){return t.taskboardTasksService.replaceModel(r)})}}(this)),this.scope.$on("taskboard:task:move",this.taskMove),this.scope.$on("assigned-to:added",this.onAssignedToChanged)},e.prototype.onAssignedToChanged=function(t,e,r){var n;return r.assigned_to=e,this.taskboardTasksService.replaceModel(r),n=this.repo.save(r),n.then(null,function(){return console.log("FAIL")})},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.errorHandlingService.permissionDenied(),t.scope.project=e,t.scope.pointsList=_.sortBy(e.points,"order"),t.scope.pointsById=o(e.points,function(t){return t.id}),t.scope.roleById=o(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=o(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._attrs}}(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"),t.taskboardTasksService.setUserstories(t.scope.userstories),e}}(this))},e.prototype.loadTasks=function(){var t;return t={include_attachments:!0},t=_.merge(t,this.location.search()),this.rs.tasks.list(this.scope.projectId,this.scope.sprintId,null,t).then(function(t){return function(e){return t.taskboardTasksService.init(t.scope.project,t.scope.usersById),t.taskboardTasksService.set(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.generateFilters(),t.loadTaskboard().then(function(){return t.setRolePoints()})}}(this))},e.prototype.showPlaceHolder=function(t,e){return!(this.taskboardTasksService.tasksRaw.length||this.scope.taskStatusList[0].id!==t||this.scope.userstories.length&&this.scope.userstories[0].id!==e)},e.prototype.editTask=function(t){var e;return e=this.taskboardTasksService.getTask(t),e=e.set("loading",!0),this.taskboardTasksService.replace(e),this.rs.tasks.getByRef(e.getIn(["model","project"]),e.getIn(["model","ref"])).then(function(t){return function(r){return t.rs2.attachments.list("task",e.get("id"),e.getIn(["model","project"])).then(function(n){return t.rootscope.$broadcast("taskform:edit",r,n.toJS()),e=e.set("loading",!1),t.taskboardTasksService.replace(e)})}}(this))},e.prototype.taskMove=function(t,e,r,n,i,o){var s,a,u,c;return e=this.taskboardTasksService.getTaskModel(e.get("id")),s=this.taskboardTasksService.move(e.id,n,i,o),u={status__is_archived:!1,include_attachments:!0},a={headers:{"set-orders":JSON.stringify(s.set_orders)}},c=this.repo.save(e,!0,u,a,!0).then(function(t){return function(e){var r;return r=e[1],r&&r["taiga-info-order-updated"]&&(o=JSON.parse(r["taiga-info-order-updated"]),t.taskboardTasksService.assignOrders(o)),t.loadSprintStats()}}(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.toggleFold=function(t){return this.taskboardTasksService.toggleFold(t)},e.prototype.changeTaskAssignedTo=function(t){var e;return e=this.taskboardTasksService.getTaskModel(t),this.rootscope.$broadcast("assigned-to:add",e)},e.prototype.setRolePoints=function(){var t,e,r,n;return t=_.filter(this.scope.project.roles,"computable"),
-r=function(e){return function(e){return e=parseInt(e,10),_.find(t,function(t){return t.id===e})}}(this),e=function(t){return function(e){var r;return r=parseInt(e,10),_.find(t.scope.project.points,function(t){return t.id===e})}}(this),n=_.reduce(this.scope.userstories,function(t){return function(t,n,i){return _.forOwn(n.points,function(n,i){var o,s;return s=r(i),o=e(n),t[s.id]||(t[s.id]=s,t[s.id].points=0),t[s.id].points+=o.value}),t}}(this),{}),this.scope.pointsByRole=Object.keys(n).map(function(t){return n[t]})},e}(s(c.Controller,c.PageMixin,c.FiltersMixin)),a.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}},a.directive("tgTaskboard",["$rootScope",e]),r=function(t){var e,r,n;return e=40,n=300,r=function(r,i,o){var s,a,u,c,l;return r.$on("sprint:zoom0",function(t){return function(){return u()}}(this)),r.$on("sprint:task:moved",function(t){return function(){return u()}}(this)),r.$watch("usTasks",function(){if(r.project)return r.statusesFolded=t.tasks.getStatusColumnModes(r.project.id),r.usFolded=t.tasks.getUsRowModes(r.project.id,r.sprintId),u()}),r.foldStatus=function(e){return r.statusesFolded[e.id]=!r.statusesFolded[e.id],t.tasks.storeStatusColumnModes(r.projectId,r.statusesFolded),u()},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),u()},s=function(t){return function(t,n){var i,o,s;return i=t?r.usTasks.getIn([t.toString(),n.toString()]).size:r.usTasks.getIn(["null",n.toString()]).size,r.statusesFolded[n]?(i&&r.usFolded[t]?(o=Math.round(Math.sqrt(i)),s=e*o):s=e,s):0}}(this),l=function(t){return function(t,e){var o;return o=i.find(".squish-status-"+t),e?o.css("max-width",e):"0"===r.ctrl.zoomLevel?o.css("max-width",148):o.css("max-width",n)}}(this),c=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),a=function(t){return function(t){var e;return e=s(null,t),_.forEach(r.userstories,function(r){var n;if(n=s(r.id,t),n>e)return e=n}),l(t,e)}}(this),u=function(t){return function(){_.forEach(r.taskStatusList,function(t){return a(t.id)}),c()}}(this)},{link:r}},a.directive("tgTaskboardSquishColumn",["$tgResources",r])}.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,e,r,n){var i;return i=function(t,e,i){var o;return o=t.$watch("usTasks",function(i){var s,a,u,c,l,p,f,d,h;if(i&&i.size&&(o(),t.project.my_permissions.indexOf("modify_task")>-1))return f=null,p=null,l=null,h=e,c=function(){var t;return t=n.instant("BACKLOG.SORTABLE_FILTER_ERROR"),$tgConfirm.notify("error",t)},a=function(t){return t.scope().$destroy(),t.off(),t.remove()},s=_.map(e.find(".task-column"),function(t){return t}),u=dragula(s,{copySortSource:!1,copy:!1,mirrorContainer:e[0],accepts:function(t,e){return!$(e).hasClass("taskboard-userstory-box")},moves:function(t){return $(t).is("tg-card")}}),u.on("drag",function(t){if(f=$(t).parent().scope(),e.hasClass("active-filters"))return c(),setTimeout(function(){return u.cancel(!0)},0),!1}),u.on("dragend",function(e){var n,i,o,s,u,c,d;return d=$(e).parent(),l=$(e),i=l.scope().task,n=l.index(),p=d.scope(),c=f.us?f.us.id:null,u=f.st.id,s=p.us?p.us.id:null,o=p.st.id,o===u&&s===c||a(l),t.$apply(function(){return r.$broadcast("taskboard:task:move",i,i.getIn(["model","status"]),s,o,n)})}),d=autoScroll([$(".taskboard-table-body")[0]],{margin:100,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&u.dragging}}),t.$on("$destroy",function(){return e.off(),u.destroy()})})},{link:i}},i.directive("tgTaskboardSortable",["$tgRepo","$tgResources","$rootScope","$translate",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 e(){this.reset()}return r(e,t),e.$inject=[],e.prototype.reset=function(){return this.tasksRaw=[],this.foldStatusChanged={},this.usTasks=Immutable.Map()},e.prototype.init=function(t,e){return this.project=t,this.usersById=e},e.prototype.resetFolds=function(){return this.foldStatusChanged={},this.refresh()},e.prototype.toggleFold=function(t){return this.foldStatusChanged[t]=!this.foldStatusChanged[t],this.refresh()},e.prototype.add=function(t){return this.tasksRaw=this.tasksRaw.concat(t),this.refresh()},e.prototype.set=function(t){return this.tasksRaw=t,this.refreshRawOrder(),this.refresh()},e.prototype.setUserstories=function(t){return this.userstories=t},e.prototype.refreshRawOrder=function(){var t,e,r,n,i;for(this.order={},r=this.tasksRaw,n=[],t=0,e=r.length;t1)for(s=0,l=d.length;s1)for(o=0,c=f.length;o
")})}}(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}},l.directive("tgKanbanWipLimit",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,e,r){var n;return n=function(t,e,n){var i;return i=t.$watch("usByStatus",function(n){var o,s,a,u,c,l,p,f;if(n&&n.size&&(i(),t.project.my_permissions.indexOf("modify_us")>-1))return l=null,c=null,u=null,f=e,s=function(t){return t.scope().$destroy(),t.off(),t.remove()},o=_.map(e.find(".task-column"),function(t){return t}),a=dragula(o,{copySortSource:!1,copy:!1,mirrorContainer:f[0],moves:function(t){return $(t).is("tg-card")}}),a.on("drag",function(t){return l=$(t).parent().scope()}),a.on("dragend",function(e){var n,i,o,a,p;return p=$(e).parent(),u=$(e),i=u.scope().us,n=u.index(),c=p.scope(),o=c.s.id,a=l.s.id,o!==a&&s(u),t.$apply(function(){return r.$broadcast("kanban:us:move",i,i.getIn(["model","status"]),o,n)})}),p=autoScroll(o,{margin:100,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&a.dragging}}),t.$on("$destroy",function(){return e.off(),a.destroy()})})},{link:n}},i.directive("tgKanbanSortable",["$tgRepo","$tgResources","$rootScope",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)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty;c=this.taiga,a=this.taiga.mixOf,l=this.taiga.toString,s=this.taiga.joinStr,o=this.taiga.groupBy,i=this.taiga.bindOnce,n=this.taiga.bindMethods,u=angular.module("taigaEpics"),t=function(t){function e(t,e,r,i,o,s,a,u,c,l,p,f,d,h,g,m){var v;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=i,this.rs=o,this.rs2=s,this.params=a,this.q=u,this.location=c,this.log=l,this.appMetaService=p,this.analytics=f,this.navUrls=d,this.translate=h,this.modelTransform=g,this.errorHandlingService=m,n(this),this.scope.epicRef=this.params.epicref,this.scope.sectionName=this.translate.instant("EPIC.SECTION_NAME"),this.initializeEventHandlers(),v=this.loadInitialData(),v.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),v.then(null,this.onInitialDataError.bind(this))}return p(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgAnalytics","$tgNavUrls","$translate","$tgQueueModelTransformation","tgErrorHandlingService"],e.prototype._setMeta=function(){var t,e,r;return r=this.translate.instant("EPIC.PAGE_TITLE",{epicRef:"#"+this.scope.epic.ref,epicSubject:this.scope.epic.subject,projectName:this.scope.project.name}),t=this.translate.instant("EPIC.PAGE_DESCRIPTION",{epicStatus:(null!=(e=this.scope.statusById[this.scope.epic.status])?e.name:void 0)||"--",epicDescription:angular.element(this.scope.epic.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 epic",1)}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadEpic()}}(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.onDeleteGoToUrl=this.navUrls.resolve("project-epics",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.immutableProject=Immutable.fromJS(e._attrs),t.scope.$emit("project:loaded",e),t.scope.statusList=e.epic_statuses,t.scope.statusById=o(e.epic_statuses,function(t){return t.id}),e}}(this))},e.prototype.loadEpic=function(){return this.rs.epics.getByRef(this.scope.projectId,this.params.epicref).then(function(t){return function(e){var r,n,i;if(t.scope.epic=e,t.scope.immutableEpic=Immutable.fromJS(e._attrs),t.scope.epicId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"epic"),null!=(null!=(n=t.scope.epic.neighbors.previous)?n.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.epic.neighbors.previous.ref},t.scope.previousUrl=t.navUrls.resolve("project-epics-detail",r)),null!=(null!=(i=t.scope.epic.neighbors.next)?i.ref:void 0))return r={project:t.scope.project.slug,ref:t.scope.epic.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-epics-detail",r)}}(this))},e.prototype.loadUserstories=function(){return this.rs2.userstories.listInEpic(this.scope.epicId).then(function(t){return function(e){return t.scope.userstories=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.loadEpic().then(function(){return t.loadUserstories()})}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.upvote(this.scope.epicId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.downvote(this.scope.epicId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.watch(this.scope.epicId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.unwatch(this.scope.epicId).then(e,t)},e.prototype.onSelectColor=function(t){var e,r,n;return r=function(t){return function(){return t.rootscope.$broadcast("object:updated"),t.confirm.notify("success")}}(this),e=function(t){return function(){return t.confirm.notify("error")}}(this),n=this.modelTransform.save(function(e){return e.color=t,e}),n.then(r,e)},e}(a(c.Controller,c.PageMixin)),u.controller("EpicDetailController",t),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:s.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){if(null!=t)return o(t)}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},u.directive("tgEpicStatusDisplay",["$tgTemplate","$compile",r]),e=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,f;return l=function(){return e.project.my_permissions.indexOf("modify_epic")!==-1},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),f=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){if(t.preventDefault(),t.stopPropagation(),l())return s.find(".pop-status").popover().open()}),s.on("click",".status",function(t){var e;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),$.fn.popover().closeAll(),f(e.data("status-id"))}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.status:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return s.off()})},{link:u,restrict:"EA",require:"ngModel"}},u.directive("tgEpicStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$compile","$translate","$tgTemplate",e])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,f,d,h,g=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;d=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,f=angular.module("taigaIssues"),t=function(t){function e(t,e,r,n,i,o,s,u,c,l,p,f,d,h,g){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=f,this.translate=d,this.modelTransform=h,this.errorHandlingService=g,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 g(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgAnalytics","$tgNavUrls","$translate","$tgQueueModelTransformation","tgErrorHandlingService"],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;if(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))return r={project:t.scope.project.slug,ref:t.scope.issue.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-issues-detail",r)}}(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(d.Controller,d.PageMixin)),f.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){if(null!=t)return o(t)}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},f.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,f;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},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),f=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){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-status").popover().open()}),o.on("click",".status",function(t){var e;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),f(e.data("status-id"))}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.status:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},f.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,f;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},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),f=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){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-type").popover().open()}),o.on("click",".type",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),r=e.data("type-id"),f(r)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.type:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},f.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,f;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},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),f=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){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-severity").popover().open()}),o.on("click",".severity",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return r=angular.element(t.currentTarget),e=r.data("severity-id"),f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.severity:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},f.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,f;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},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),f=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){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-priority").popover().open()}),o.on("click",".priority",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return r=angular.element(t.currentTarget),e=r.data("priority-id"),f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.priority:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},f.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}},f.directive("tgPromoteIssueToUsButton",["$rootScope","$tgRepo","$tgConfirm","$translate",s])}.call(this),function(){var t,e,r,n,i,o,s,a=[].indexOf||function(t){for(var e=0,r=this.length;e0}),n=_.map(o.assigned_to,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.full_name||"Unassigned",t}),s=_.map(o.owners,function(t){return t.id=t.id.toString(),t.name=t.full_name,t}),e.selectedFilters=[],t.status&&(u=e.formatSelectedFilters("status",l,t.status),e.selectedFilters=e.selectedFilters.concat(u)),t.tags&&(u=e.formatSelectedFilters("tags",p,t.tags),e.selectedFilters=e.selectedFilters.concat(u)),t.assigned_to&&(u=e.formatSelectedFilters("assigned_to",n,t.assigned_to),e.selectedFilters=e.selectedFilters.concat(u)),t.owner&&(u=e.formatSelectedFilters("owner",s,t.owner),e.selectedFilters=e.selectedFilters.concat(u)),t.type&&(u=e.formatSelectedFilters("type",d,t.type),e.selectedFilters=e.selectedFilters.concat(u)),t.severity&&(u=e.formatSelectedFilters("severity",c,t.severity),e.selectedFilters=e.selectedFilters.concat(u)),t.priority&&(u=e.formatSelectedFilters("priority",a,t.priority),e.selectedFilters=e.selectedFilters.concat(u)),e.filterQ=t.q,e.filters=[{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.TYPE"),dataType:"type",content:d},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.SEVERITY"),dataType:"severity",content:c},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.PRIORITIES"),dataType:"priority",content:a},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.STATUS"),dataType:"status",content:l},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"),dataType:"tags",content:p,hideEmpty:!0,totalTaggedElements:f.length},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),dataType:"assigned_to",content:n},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.CREATED_BY"),dataType:"owner",content:s}],e.customFilters=[],_.forOwn(i,function(t,r){return e.customFilters.push({id:r,name:r,filter:t})})}}(this))},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.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.is_issues_activated||t.errorHandlingService.permissionDenied(),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.loadIssuesRequests=0,e.prototype.loadIssues=function(){var t,e;return t=this.location.search(),e=this.rs.issues.list(this.scope.projectId,t),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.generateFilters(),t.loadIssues()}}(this))},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.prototype.upVoteIssue=function(t){var e,r;return this.voting=t,r=function(t){return function(){return t.loadIssues(),t.voting=null}}(this),e=function(t){return function(){return t.confirm.notify("error"),t.voting=null}}(this),this.rs.issues.upvote(t).then(r,e)},e.prototype.downVoteIssue=function(t){var e,r;return this.voting=t,r=function(t){return function(){return t.loadIssues(),t.voting=null}}(this),e=function(t){return function(){return t.confirm.notify("error"),t.voting=null}}(this),this.rs.issues.downvote(t).then(r,e)},e.prototype.getOrderBy=function(){return _.isString(this.location.search().order_by)?this.location.search().order_by:"created_date"},e}(c(f.Controller,f.PageMixin,f.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,f;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)1,h.showNext=!(t.page===d),e=t.page,i=f=1,m=d;1<=m?f<=m:f>=m;i=1<=m?++f:--f)i===e+s&&d>e+s+c?g.push({classes:"dots",type:"dots"}):i===e-l&&e>u+l?g.push({classes:"dots",type:"dots"}):i>e+s&&i<=d-c||iu||(i===e?g.push({classes:"active",num:i,type:"page-active"}):g.push({classes:"page",num:i,type:"page"}));return r=a(h),r=n(r)(t),o.html(r)},t.$watch("issues",function(t){if(t)return f()}),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,r,i,o){var s,a,u,c;return a=o.getOrderBy(),a&&(u=p(a,"-")?"icon-arrow-up":"icon-arrow-down",s=r.find(".row.title > div[data-fieldname='"+h(a,"-")+"']"),c=$("").attr("svg-icon",u),s.append(c),n(s.contents())(t)),r.on("click",".row.title > div",function(i){var s,l,f;return f=angular.element(i.currentTarget),a=o.getOrderBy(),l=f.data("fieldname"),s=a===l?"-"+l:l,t.$apply(function(){return o.replaceFilter("order_by",s),o.storeFilters(o.params.pslug,e.search(),o.filtersHashSuffix),o.loadIssues().then(function(){return r.find(".row.title > div > tg-svg").remove(),u=p(s,"-")?"icon-arrow-up":"icon-arrow-down",c=$("").attr("svg-icon",u),f.append(c),n(f.contents())(t)})})})},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]),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;if(i=t.find(".issue-status"),n=t.find(".issue-status .issue-status-bind"),o=r[e.status])return n.text(o.name),n.prop("title",o.name),i.css("color",o.color)},n=function(e,r,n){var s,a;return s=r.controller(),a=e.$eval(n.tgIssueStatusInlineEdition),r.on("click",".issue-status",function(t){return t.preventDefault(),t.stopPropagation(),r.find(".pop-status").popover().open()}),r.on("click",".status",function(n){var i;return n.preventDefault(),n.stopPropagation(),i=angular.element(n.currentTarget),a.status=i.data("status-id"),r.find(".pop-status").popover().close(),o(r,a,e.issueStatusById),e.$apply(function(){return t.save(a).then(function(){return s.loadIssues(),s.generateFilters()})})}),f.bindOnce(e,"project",function(t){if(r.append(i({statuses:t.issue_statuses})),o(r,a,e.issueStatusById),t.my_permissions.indexOf("modify_issue")===-1)return r.unbind("click"),r.find("a").addClass("not-clickable")}),e.$watch(n.tgIssueStatusInlineEdition,function(t){return function(t){return o(r,t,e.issueStatusById)}}(this)),e.$on("$destroy",function(){return r.off()})},{link:n}},l.directive("tgIssueStatusInlineEdition",["$tgRepo","$tgTemplate","$rootScope",e]),t=function(t,e,r,n){var i,o;return o=_.template('
\n<%- name %>'),i=function(i,s,a){var u,c,l;return l=function(t){var e,a,u;return a={name:r.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED"),imgurl:"/"+window._version+"/images/unnamed.png"},u=i.usersById[t.assigned_to],e=n.getAvatar(u),a.imgurl=e.url,a.bg=null,u&&(a.name=u.full_name_display,a.bg=e.bg),s.find(".avatar").html(o(a)),s.find(".issue-assignedto").attr("title",a.name)},u=s.controller(),c=i.$eval(a.tgIssueAssignedToInlineEdition),l(c),s.on("click",".issue-assignedto",function(t){return e.$broadcast("assigned-to:add",c)}),f.bindOnce(i,"project",function(t){if(t.my_permissions.indexOf("modify_issue")===-1)return s.unbind("click"),s.find("a").addClass("not-clickable")}),i.$on("assigned-to:added",function(e){return function(e,r,n){if(n.id===c.id)return n.assigned_to=r,t.save(n),l(n)}}(this)),i.$watch(a.tgIssueAssignedToInlineEdition,function(t){return function(t){return l(t)}}(this)),i.$on("$destroy",function(){return s.off()})},{link:i}},l.directive("tgIssueAssignedToInlineEdition",["$tgRepo","$rootScope","$translate","tgAvatarService",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)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.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,f,d,h,g,m){var v;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=f,this.translate=d,this.modelTransform=h,this.errorHandlingService=g,this.configService=m,o(this),this.scope.usRef=this.params.usref,this.scope.sectionName=this.translate.instant("US.SECTION_NAME"),this.scope.tribeEnabled=this.configService.config.tribeHost,this.initializeEventHandlers(),v=this.loadInitialData(),v.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),v.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","tgErrorHandlingService","$tgConfig"],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;if(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)return t.loadUs()}}(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){return t.scope.us=e,t.scope.usId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"us"),e}}(this))},e.prototype.loadSprint=function(){if(this.scope.us.milestone)return 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))},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.prototype.onTribeInfo=function(){var t,e,r,n;return r=this.translate.instant("US.TRIBE.PUBLISH_MORE_INFO_TITLE"),t=$("
").attr({src:"/"+window._version+"/images/monster-fight.png",alt:this.translate.instant("US.TRIBE.PUBLISH_MORE_INFO_TITLE")}),n=this.translate.instant("US.TRIBE.PUBLISH_MORE_INFO_TEXT"),e=$("").append(t).append(n),this.confirm.success(r,e)},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){if(null!=t)return o(t)}),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,f;return l=function(){return e.project.my_permissions.indexOf("modify_us")!==-1},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),f=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){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-status").popover().open()}),o.on("click",".status",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return r=angular.element(t.currentTarget),e=r.data("status-id"),f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.status:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),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,f;return l=function(){return e.project.my_permissions.indexOf("modify_us")!==-1},p=function(t){var r,n;return r={canEdit:l(),isRequired:t.team_requirement},n=u(r),n=s(n)(e),o.html(n)},f=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,f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.team_requirement:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),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,f;return l=function(){return e.project.my_permissions.indexOf("modify_us")!==-1},p=function(t){var r,n;return r={canEdit:l(),isRequired:t.client_requirement},n=s(u(r))(e),o.html(n)},f=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,f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.client_requirement:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),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,f,d,h,g){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=f,this.translate=d,this.modelTransform=h,this.errorHandlingService=g,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","tgErrorHandlingService"],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(){if(this.scope.task.milestone)return 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))},e.prototype.loadUserStory=function(){if(this.scope.task.user_story)return 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))},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){if(null!=t)return o(t)}),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,f;return l=function(){return e.project.my_permissions.indexOf("modify_task")!==-1},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),f=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){if(t.preventDefault(),t.stopPropagation(),l())return s.find(".pop-status").popover().open()}),s.on("click",".status",function(t){var e;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),$.fn.popover().closeAll(),f(e.data("status-id"))}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.status:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),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,f;return l=function(){return e.project.my_permissions.indexOf("modify_task")!==-1},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("")},f=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,f(e)}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.is_iocaine:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),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,f){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.errorHandlingService=f,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","tgErrorHandlingService"],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;t=0)})}},u.filter("membersFilter",s)}.call(this),function(){var t,e,r,n,i,o,s,a,u,c=function(t,e){return function(){return t.apply(e,arguments)}},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;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,l,p,f,d,h,g,m){var v;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=l,this.log=p,this.appMetaService=f,this.navUrls=d,this.analytics=h,this.translate=g,this.errorHandlingService=m,this.moveLink=c(this.moveLink,this),this.scope.$on("wiki:links:move",this.moveLink),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,v=this.loadInitialData(),v.then(function(t){return function(){return t._setMeta()}}(this)),v.then(null,this.onInitialDataError.bind(this))}return l(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$filter","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate","tgErrorHandlingService"],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.errorHandlingService.permissionDenied(),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,t.scope.project.my_permissions.indexOf("add_wiki_page")===-1?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;r-1,h=null,g=function(e){var r,l,m,v,y;return d=n.project.my_permissions.indexOf("add_wiki_link")>-1,r=n.project.my_permissions.indexOf("delete_wiki_link")>-1,l=f({wikiLinks:e,projectSlug:n.projectSlug,addWikiLinkPermission:d,deleteWikiLinkPermission:r}),l=u(l)(n),a.off(),d&&h&&h.destroy(),a.html(l),d&&(m=null,y=a.find(".sortable"),h=dragula([y[0]],{direction:"vertical",copySortSource:!1,copy:!1,mirrorContainer:y[0],moves:function(t){return $(t).is("li")}}),h.on("dragend",function(t){var e;return m=$(t),t=m.scope().link,e=m.index(),n.$emit("wiki:links:move",t,e)}),v=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&h.dragging}})),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=p.loadWikiLinks(),o.then(function(){return e.finish(),g(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=p.loadWikiLinks(),t.then(function(){return r.finish(),a.find(".new").addClass("hidden"),a.find(".new input").val(""),a.find(".add-button").show(),g(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,g))},l=function(t,e,r){return p(t,e,r),t.$on("$destroy",function(){return e.off()})},{link:l}},i.directive("tgWikiNav",["$tgRepo","$log","$tgLocation","$tgConfirm","$tgAnalytics","$tgLoading","$tgTemplate","$compile","$translate",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;n=this.taiga,e=this.taiga.mixOf,r=angular.module("taigaWiki"),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.model=n,this.confirm=i,this.rs=o,this.params=s,this.q=a,this.navUrls=u,this.errorHandlingService=c,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,l=this.loadInitialData(),l.then(null,this.onInitialDataError.bind(this))}return i(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgNavUrls","tgErrorHandlingService"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.is_wiki_activated||t.errorHandlingService.permissionDenied(),t.scope.projectId=e.id,t.scope.project=e,t.scope.$emit("project:loaded",e),e}}(this))},e.prototype.loadWikiPages=function(){var t;return t=this.rs.wiki.list(this.scope.projectId).then(function(t){return function(e){return t.scope.wikipages=e}}(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;r=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;if(this.form.initializeFields(),this.form.reset(),this.form.validate())return 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))},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){var e;if(this.submitInvites=!1,e={},_.each(t.data.bulk_memberships,function(t){return function(t,r){if(t.email&&(e["email-"+r]=t.email[0]),t.role)return e["role-"+r]=t.role[0]}}(this)),this.form.setErrors(e),t.data._error_message)return this.confirm.notify("error",t.data._error_message)},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/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(){if(this.users=this.activeUsers,this.selected=_.find(this.users,{selected:!0}),this.q)return this.users=_.filter(this.users,this.filterUsers.bind(this))},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)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.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,f,d,h,g){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=f,this.auth=d,this.lightboxFactory=h,this.errorHandlingService=g,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","tgErrorHandlingService"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.errorHandlingService.permissionDenied(),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,f;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)1,h.showNext=!(t.page===d),r=t.page,o=f=1,m=d;1<=m?f<=m:f>=m;o=1<=m?++f:--f)o===r+a&&d>r+a+c?g.push({classes:"dots",type:"dots"}):o===r-l&&r>u+l?g.push({classes:"dots",type:"dots"}):o>r+a&&o<=d-c||ou||(o===r?g.push({classes:"active",num:o,type:"page-active"}):g.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){if(t)return f()}),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,i){var o,s;return s=e.get("admin/memberships-row-avatar.html",!0),o=function(e,o,a){var u,c,l;return c=r.instant("ADMIN.MEMBERSHIP.STATUS_PENDING"),l=function(t){var r,a,u;return r=i.getAvatar(t),a={full_name:t.full_name?t.full_name:"",email:t.user_email?t.user_email:t.email,imgurl:r.url,bg:r.bg,pending:t.is_user_active?"":c,isOwner:t.is_owner},u=s(a),u=n(u)(e),o.html(u)},null==a.tgMembershipsRowAvatar?t.error("MembershipsRowAvatarDirective: the directive need a member"):(u=e.$eval(a.tgMembershipsRowAvatar),l(u),e.$on("$destroy",function(){return o.off()}))},{link:o}},c.directive("tgMembershipsRowAvatar",["$log","$tgTemplate","$translate","$compile","tgAvatarService",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;if(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)return c.role=n,e.save(c).then(o,i)}}(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,f,d){var h,g,m,v;return v=function(t){var e;return e=t.user?i(c)(l):i(p)(l),f.html(e)},null==d.tgMembershipsRowActions?t.error("MembershipsRowActionsDirective: the directive need a member"):(h=f.controller(),m=l.$eval(d.tgMembershipsRowActions),v(m),f.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)}),g=function(){var t,r,i;return i=o.instant("ADMIN.MEMBERSHIP.DELETE_MEMBER"),t=o.instant("ADMIN.MEMBERSHIP.DEFAULT_DELETE_MESSAGE",{email:m.email}),r=m.user?m.full_name:t,n.askOnDelete(i,r).then(function(t){var i,u;return u=function(e){return function(){var e;return t.finish(),m.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(m).then(u,i)})},f.on("click",".delete",function(t){var e;return t.preventDefault(),l.project.owner.id===m.user?(e=l.user.id===m.user,u.create("tg-lightbox-leave-project-warning",{"class":"lightbox lightbox-leave-project-warning"},{isCurrentUser:e,project:l.project})):g()}),l.$on("$destroy",function(){return f.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,f,d,h,g,m,v,y,b,S,k,$,j,I,E,T,C,w=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,A=function(t,e){return function(){return t.apply(e,arguments)}};E=this.taiga,j=this.taiga.mixOf,C=this.taiga.trim,T=this.taiga.toString,$=this.taiga.joinStr,k=this.taiga.groupBy,b=this.taiga.bindOnce,S=this.taiga.debounce,I=angular.module("taigaAdmin"),v=function(t){function e(t,e,r,n,i,o,s,a,u,c,l,p,f,d){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.navUrls=u,this.appMetaService=c,this.translate=l,this.tgAuth=p,this.currentUserService=f,this.errorHandlingService=d,this.scope.project={},h=this.loadInitialData(),this.scope.projectTags=[],h.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)),h.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 w(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","$tgAuth","tgCurrentUserService","tgErrorHandlingService"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.errorHandlingService.permissionDenied(),t.scope.projectId=e.id,t.scope.project=e,t.scope.epicStatusList=_.sortBy(e.epic_statuses,"order"),t.scope.usStatusList=_.sortBy(e.us_statuses,"order"),t.scope.pointsList=_.sortBy(e.points,"order"),t.scope.taskStatusList=_.sortBy(e.task_statuses,"order"),t.scope.issueTypesList=_.sortBy(e.issue_types,"order"),t.scope.issueStatusList=_.sortBy(e.issue_statuses,"order"),t.scope.prioritiesList=_.sortBy(e.priorities,"order"),t.scope.severitiesList=_.sortBy(e.severities,"order"),t.scope.$emit("project:loaded",e),t.scope.projectTags=_.map(t.scope.project.tags,function(e){return[e,t.scope.project.tags_colors[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.prototype.addTag=function(t,e){var r;return r=_.clone(this.scope.project.tags),r.push(t),this.scope.projectTags.push([t,null]),this.scope.project.tags=r},e.prototype.deleteTag=function(t){var e;return e=_.clone(this.scope.project.tags),_.pull(e,t[0]),_.remove(this.scope.projectTags,function(e){return function(e){return e[0]===t[0]}}(this)),this.scope.project.tags=e},e}(j(E.Controller,E.PageMixin)),I.controller("ProjectProfileController",v),y=function(t,e,r,n,i,o,s){var a;return a=function(a,u,c){var l,p,f,d;return l=u.controller(),p=u.find("form").checksley({onlyOneErrorElement:!0}),f=S(2e3,function(u){return function(u){var c,f;if(u.preventDefault(),p.validate())return c=r().target(d).start(),f=t.save(a.project),f.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()}),f.then(null,function(t){if(c.finish(),p.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),d=u.find(".submit-button"),u.on("submit","form",f)},{link:a}},I.directive("tgProjectProfile",["$tgRepo","$tgConfirm","$tgLoading","$tgNavUrls","$tgLocation","tgProjectService","tgCurrentUserService",y]),f=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=S(2e3,function(i){return function(i){var o,a;if(i.preventDefault(),s.validate())return o=r().target(u).start(),a=t.save(n.project),a.then(function(){return o.finish(),e.notify("success")}),a.then(null,function(t){if(o.finish(),s.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=i.find(".submit-button"),i.on("submit","form",a),n.$on("$destroy",function(){return i.off()})},{link:n}},I.directive("tgProjectDefaultValues",["$tgRepo","$tgConfirm","$tgLoading",f]),m=function(t,e,r,n){var i;return i=function(r,i,o){var s;return s=function(o){return function(){var o,s;if(o=i.find("form").checksley(),o.initializeFields(),o.reset(),o.validate())return 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){if(o.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this),i.on("change",".module-activation.module-direct-active input",function(t){return t.preventDefault(),r.$applyAsync(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){if(null!=t&&null!=e&&t!==e)return r.project.videoconferences_extra_data=""}),r.$watch("isVideoconferenceActivated",function(t,e){if(t===!1&&(r.project.videoconferences=null,r.project.videoconferences_extra_data="",e===!0))return s()}),r.$watch("project",function(t){return null!=t.videoconferences?r.isVideoconferenceActivated=!0:r.isVideoconferenceActivated=!1})},{link:i}},I.directive("tgProjectModules",["$tgRepo","$tgConfirm","$tgLoading","tgProjectService",m]),d=function(t,e,r,n){var i;return i=function(i,o,s){var a,u,c,l,p,f,d,h,g,m,v,y,_,b,k,$,j,I,E,T,C,w,O,A,R,P;return u=o.find(".admin-project-export-buttons"),I=function(){return u.removeClass("hidden")},l=function(){return u.addClass("hidden")},g=o.find(".admin-project-export-result"),O=function(){return g.removeClass("hidden")},p=function(){return g.addClass("hidden")},R=o.find(".spin"),A=function(){return R.removeClass("hidden")},f=function(){return R.addClass("hidden")},v=o.find(".result-title"),h=n.instant("ADMIN.PROJECT_EXPORT.LOADING_TITLE"),d=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"))},P=function(t){return v.html(n.instant("ADMIN.PROJECT_EXPORT.SYNC_MESSAGE",{url:t}))},k=function(){return v.html(h)},_=function(){return v.html(d)},j=function(){return v.html(c)},m=o.find(".result-message "),b=function(){return m.html(d)},y=function(){return m.html(a)},$=function(t){return m.html(P(t))},w=function(){return A(),k(),b(),l(),O()},T=function(){return f(),_(),y()},C=function(t){return f(),j(),$(t)},E=function(){return f(),p(),I()},o.on("click","a.button-export",S(2e3,function(o){return function(o){var s,a;return o.preventDefault(),a=function(e){var r;return 202===e.status?T():(r=e.data.url,C(r),t.open(r,"_blank"))},s=function(t){var e,i;return E(),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)},w(),e.projects["export"](i.projectId).then(a,s)}}(this)))},{link:i}},I.directive("tgProjectExport",["$window","$tgResources","$tgConfirm","$translate",d]),i=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=A(this._generateUuid,this),this.setCsvUuid=A(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 w(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(){if(t)return t.finish()}),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}(E.Controller),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return w(e,t),e.prototype.type="epics",e}(i),u=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return w(e,t),e.prototype.type="userstories",e}(i),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return w(e,t),e.prototype.type="tasks",e}(i),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return w(e,t),e.prototype.type="issues",e}(i),I.controller("CsvExporterEpicsController",o),I.controller("CsvExporterUserstoriesController",u),I.controller("CsvExporterTasksController",a),I.controller("CsvExporterIssuesController",s),n=function(t){var e;return e=function(t){return t.sectionTitle="ADMIN.CSV.SECTION_TITLE_EPIC"},{controller:"CsvExporterEpicsController",controllerAs:"ctrl",templateUrl:"admin/project-csv.html",link:e,scope:!0}},I.directive("tgCsvEpic",["$translate",n]),p=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}},I.directive("tgCsvUs",["$translate",p]),l=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}},I.directive("tgCsvTask",["$translate",l]),c=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}},I.directive("tgCsvIssue",["$translate",c]),h=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){if(t.logoAttachment)return i.find(".loading-overlay").addClass("active"),r.projects.changeLogo(t.project.id,t.logoAttachment).then(a,s)}),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}},I.directive("tgProjectLogo",["$tgAuth","$tgModel","$tgResources","$tgConfirm",h]),g=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}},I.directive("tgProjectLogoModel",["$parse",g]),r=function(){return{scope:{project:"="},templateUrl:"admin/admin-project-restrictions.html"}},I.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"}},I.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"}},I.directive("tgAdminProjectChangeOwner",["tgLightboxFactory",t])}.call(this),function(){var t,e,r,n,i,o,s,a,u,c,l,p,f,d,h,g,m,v,y,b,S,k,j,I=function(t,e){function r(){this.constructor=t}for(var n in e)E.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},E={}.hasOwnProperty,T=function(t,e){return function(){return t.apply(e,arguments)}};S=this.taiga,y=this.taiga.mixOf,j=this.taiga.trim,k=this.taiga.toString,v=this.taiga.joinStr,m=this.taiga.groupBy,d=this.taiga.bindOnce,h=this.taiga.debounce,g=this.taiga.getDefaulColorList,b=angular.module("taigaAdmin"),c=function(t){function e(t,e,r,n,i,o,s,a,u,c,l,p){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.errorHandlingService=p,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_VALUES.PAGE_TITLE",{sectionName:r,projectName:t.scope.project.name}),e=t.scope.project.description,t.appMetaService.setAll(n,e)}}(this)),f.then(null,this.onInitialDataError.bind(this))}return I(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","tgErrorHandlingService"],e.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(t){return function(e){return e.i_am_admin||t.errorHandlingService.permissionDenied(),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}(y(S.Controller,S.PageMixin)),b.controller("ProjectValuesSectionController",c),a=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=T(this.moveValue,this),this.loadValues=T(this.loadValues,this),this.scope.$on("admin:project-values:move",this.moveValue),this.rootscope.$on("project:loaded",this.loadValues)}return I(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}(S.Controller),b.controller("ProjectValuesController",a),u=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,d,g,m;return a=n.controller(),m=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;if(null==t&&(t=!1),e=n.find(".table-main"),$(document.body).scrollTop(e.offset().top+e.height()),t)return n.find(".new-value input:visible").first().focus()}}(this),g=function(t){var r,n,i,o;if(n=t.parents("form"),r=n.checksley(),r.validate())return 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)})},d=function(r){var n,i,o;if(i=r.parents("form"),n=i.checksley(),n.validate())return t.newValue.project=t.project.id,t.newValue.order=t.maxValueOrder?t.maxValueOrder+1:1,o=e.create(m,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)})},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",h(2e3,function(t){var e;return t.preventDefault(),e=n.find(".new-value"),d(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",".new-value input",function(t){var e;return 13===t.keyCode?(e=n.find(".new-value"),d(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),g(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,f;return n.preventDefault(),c=angular.element(n.currentTarget),s=c.parents("form"),f=s.scope().value,i={},_.each(t.values,function(t){if(f.id!==t.id)return i[t.id]=t.name}),u=f.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(f,{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}},b.directive("tgProjectValues",["$log","$tgRepo","$tgConfirm","$tgLocation","animationFrame","$translate","$rootScope",u]),t=function(){var t;return t=function(t,e,r,n){var i;return t.colorList=g(),t.allowEmpty=!1,r.tgAllowEmpty&&(t.allowEmpty=!0),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),$(".select-color").hide(),n.siblings(".select-color").show(),r=angular.element("body"),r.on("click",function(t){return function(t){if(0===angular.element(t.target).parent(".select-color").length)return e.find(".select-color").hide(),r.unbind("click")}}(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()}),e.on("keyup","input",function(r){return r.stopPropagation(),13===r.keyCode?(t.$apply(function(){return n.$modelValue.color=t.color}),e.find(".select-color").hide()):27===r.keyCode?e.find(".select-color").hide():void 0}),t.$on("$destroy",function(){return e.off()})},{link:t,require:"ngModel"}},b.directive("tgColorSelection",t),l="text",r="multiline",e="date",f="url",p=[{key:l,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:f,name:"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL"}],n=function(t){function e(t,e,r,n,i,o,s,a,u,c){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=c,this.moveCustomAttributes=T(this.moveCustomAttributes,this),this.deleteCustomAttribute=T(this.deleteCustomAttribute,this),this.saveCustomAttribute=T(this.saveCustomAttribute,this),this.createCustomAttribute=T(this.createCustomAttribute,this),this.loadCustomAttributes=T(this.loadCustomAttributes,this),this.scope.TYPE_CHOICES=p,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 I(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}(y(S.Controller,S.PageMixin)),b.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,d,g,m,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()},d=function(){return r.find(".js-new-custom-field").addClass("hidden")},y=function(){return r.find(".js-add-custom-field-button").removeClass("hidden")},p=function(){return r.find(".js-add-custom-field-button").addClass("hidden")},_=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")},m=function(){return t.newAttr={}},u=function(r){var n,i,s,a;if(i=r.checksley(),i.validate())return a=function(t){return function(){return o.loadCustomAttributes(),d(),m(),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)},s=function(){return d(),m()},t.$watch("customAttributes",function(t){if(t)return 0===t.length?(f(),p(),b()):(d(),y(),_())}),r.on("click",".js-add-custom-field-button",function(t){return t.preventDefault(),b()}),r.on("click",".js-create-custom-field-button",h(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()},g=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;if(n=t.checksley(),n.validate())return s=function(r){return function(){return o.loadCustomAttributes(),g(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)},a=function(t){return g(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",h(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",h(2e3,function(t){var e,r;return t.preventDefault(),r=angular.element(t.currentTarget),e=r.closest("form"),c(e)}))},{link:i}},b.directive("tgProjectCustomAttributes",["$log","$tgConfirm","animationFrame","$translate",i]),o=function(t){function e(t,e,r,n,i,o){this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.model=o,this.mixingClass=T(this.mixingClass,this),this.cancelMixingTags=T(this.cancelMixingTags,this),this.confirmMixingTags=T(this.confirmMixingTags,this),this.toggleMixingFromTags=T(this.toggleMixingFromTags,this),this.startMixingTags=T(this.startMixingTags,this),this.deleteTag=T(this.deleteTag,this),this.editTag=T(this.editTag,this),this.createTag=T(this.createTag,this),this.filterAndSortTags=T(this.filterAndSortTags,this),this.loadTags=T(this.loadTags,this),this.loading=!0,this.rootscope.$on("project:loaded",this.loadTags)}return I(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$tgModel"],e.prototype.loadTags=function(){return this.rs.projects.tagsColors(this.scope.projectId).then(function(t){return function(e){return t.scope.projectTagsAll=_.map(e.getAttrs(),function(e,r){return t.model.make_model("tag",{name:r,color:e})}),t.filterAndSortTags(),t.loading=!1}}(this))},e.prototype.filterAndSortTags=function(){return this.scope.projectTags=_.filter(_.sortBy(this.scope.projectTagsAll,"name"),function(t){return function(e){return e.name.indexOf(t.scope.tagsFilter.name)!==-1}}(this))},e.prototype.createTag=function(t,e){return this.rs.projects.createTag(this.scope.projectId,t,e)},e.prototype.editTag=function(t,e,r){return t===e&&(e=null),this.rs.projects.editTag(this.scope.projectId,t,e,r)},e.prototype.deleteTag=function(t){return this.scope.loadingDelete=!0,this.rs.projects.deleteTag(this.scope.projectId,t)["finally"](function(t){return function(){return t.scope.loadingDelete=!1}}(this))},e.prototype.startMixingTags=function(t){return this.scope.mixingTags.toTag=t.name},e.prototype.toggleMixingFromTags=function(t){var e;if(t.name!==this.scope.mixingTags.toTag)return e=this.scope.mixingTags.fromTags.indexOf(t.name),e===-1?this.scope.mixingTags.fromTags.push(t.name):this.scope.mixingTags.fromTags.splice(e,1)},e.prototype.confirmMixingTags=function(){var t,e;return e=this.scope.mixingTags.toTag,t=this.scope.mixingTags.fromTags,this.scope.loadingMixing=!0,this.rs.projects.mixTags(this.scope.projectId,e,t).then(function(t){return function(){return t.cancelMixingTags(),t.loadTags()}}(this))["finally"](function(t){return function(){return t.scope.loadingMixing=!1}}(this))},e.prototype.cancelMixingTags=function(){return this.scope.mixingTags.toTag=null,this.scope.mixingTags.fromTags=[]},e.prototype.mixingClass=function(t){if(null!==this.scope.mixingTags.toTag){if(t.name===this.scope.mixingTags.toTag)return"mixing-tags-to";if(this.scope.mixingTags.fromTags.indexOf(t.name)!==-1)return"mixing-tags-from"}},e}(S.Controller),b.controller("ProjectTagsController",o),s=function(t,e,r,n,i,o,s){var a;return a=function(t,e,n){var i,a,u,c,l,p,f,d,g,m,v,y;return a=$(window),i=e.controller(),y=n.type,g=n.objname,p=function(){return t.newValue={tag:"",color:""}},f=function(){return t.tagsFilter={name:""}},l=function(){return t.mixingTags={toTag:null,fromTags:[]}},d=function(){return t.addNewElementText=o.instant("ADMIN.PROJECT_VALUES_TAGS.ACTION_ADD")},p(),f(),l(),d(),s.$on("$translateChangeEnd",function(){return t.$evalAsync(d)}),c=function(t){return function(t){var r;if(null==t&&(t=!1),r=e.find(".table-main"),$(document.body).scrollTop(r.offset().top+r.height()),t)return e.find(".new-value input:visible").first().focus()}}(this),v=function(e){return function(e){var r,n,o,s,a;if(n=e.parents("form"),r=n.checksley(),r.validate())return a=n.scope().tag,o=a.clone(),o.revert(),t.loadingEdit=!0,s=i.editTag(o.name,a.name,a.color),s.then(function(){return i.loadTags().then(function(){var r;return r=e.parents(".row.table-main"),r.addClass("hidden"),t.loadingEdit=!1,r.siblings(".visualization").removeClass("hidden")})}),s.then(null,function(e){return t.loadingEdit=!1,r.setErrors(e.data)})}}(this),m=function(e){return function(e){var r,n,o;if(n=e.parents("form"),n=e,r=n.checksley(),r.validate())return t.loadingCreate=!0,o=i.createTag(t.newValue.tag,t.newValue.color),o.then(function(r){return i.loadTags().then(function(){return t.loadingCreate=!1,e.addClass("hidden"),p()})}),o.then(null,function(e){return t.loadingCreate=!1,r.setErrors(e.data)})}}(this),u=function(e){var r,n,i;return n=e.parents(".row.table-main"),r=e.parents("form"),i=r.scope().tag,t.$apply(function(){return n.addClass("hidden"),i.revert(),n.siblings(".visualization").removeClass("hidden")})},t.$watch("tagsFilter.name",function(t){return i.filterAndSortTags()}),a.on("keyup",function(e){if(27===e.keyCode)return t.$apply(function(){return l()})}),e.on("click",".show-add-new",function(t){return t.preventDefault(),e.find(".new-value").removeClass("hidden")}),e.on("click",".add-new",h(2e3,function(t){var r;return t.preventDefault(),r=e.find(".new-value"),m(r)})),e.on("click",".delete-new",function(t){return t.preventDefault(),e.find(".new-value").addClass("hidden"),p()}),e.on("click",".mix-tags",function(e){var r;return e.preventDefault(),r=angular.element(e.currentTarget),t.$apply(function(){return i.startMixingTags(r.parents("form").scope().tag)})}),e.on("click",".mixing-row",function(e){var r;return e.preventDefault(),r=angular.element(e.currentTarget),t.$apply(function(){return i.toggleMixingFromTags(r.parents("form").scope().tag)})}),e.on("click",".mixing-confirm",function(e){return e.preventDefault(),e.stopPropagation(),t.$apply(function(){return i.confirmMixingTags()})}),e.on("click",".mixing-cancel",function(e){return e.preventDefault(),e.stopPropagation(),t.$apply(function(){return i.cancelMixingTags()})}),e.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()}),e.on("keyup",".new-value input",function(t){var r;return 13===t.keyCode?(r=e.find(".new-value"),m(r)):27===t.keyCode?(e.find(".new-value").addClass("hidden"),p()):void 0}),e.on("keyup",".status-name input",function(t){var e;return e=angular.element(t.currentTarget),13===t.keyCode?v(e):27===t.keyCode?u(e):void 0}),e.on("click",".save",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),v(e)}),e.on("click",".cancel",function(t){var e;return t.preventDefault(),e=angular.element(t.currentTarget),u(e)}),e.on("click",".delete-tag",function(t){var e,n,s,a;return t.preventDefault(),s=angular.element(t.currentTarget),e=s.parents("form"),n=e.scope().tag,a=o.instant("ADMIN.COMMON.TITLE_ACTION_DELETE_TAG"),r.askOnDelete(a,n.name).then(function(t){var e,o;return o=function(){return i.loadTags()["finally"](function(){return t.finish()})},e=function(){return r.notify("error")},i.deleteTag(n.name).then(o,e)})}),t.$on("$destroy",function(){return e.off(),a.off()})},{link:a}},b.directive("tgProjectTags",["$log","$tgRepo","$tgConfirm","$tgLocation","animationFrame","$translate","$rootScope",s])}.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)}},f=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,h=[].indexOf||function(t){for(var e=0,r=this.length;e\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,f,d,g,m;return p=c.controller(),f=function(t){var e,r,n,i,o,s,u,c,l,p;return s=function(e){return _.map(e,function(e){var r;return _.extend({},e,{active:(r=e.key,h.call(t.permissions,r)>=0)})})},n=function(t,e,r){return!(e.external_user&&!r.is_private&&0===t.key.indexOf("view_"))},u=function(e){return _.map(e,function(e){return e.permissions=e.permissions.map(function(e){return e.editable=n(e,t,a.project),e}),_.extend({},e,{activePermissions:_.filter(e.permissions,"active").length})})},e=[],r=[{key:"view_epics",name:"COMMON.PERMISIONS_CATEGORIES.EPICS.VIEW_EPICS"},{key:"add_epic",name:"COMMON.PERMISIONS_CATEGORIES.EPICS.ADD_EPICS"},{key:"modify_epic",name:"COMMON.PERMISIONS_CATEGORIES.EPICS.MODIFY_EPICS"},{key:"comment_epic",name:"COMMON.PERMISIONS_CATEGORIES.EPICS.COMMENT_EPICS"},{key:"delete_epic",name:"COMMON.PERMISIONS_CATEGORIES.EPICS.DELETE_EPICS"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.EPICS.NAME",permissions:s(r)}),o=[{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:s(o)}),l=[{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:"comment_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.COMMENT_USER_STORIES"},{key:"delete_us",name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.DELETE_USER_STORIES"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.USER_STORIES.NAME",permissions:s(l)}),c=[{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:"comment_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.COMMENT_TASKS"},{key:"delete_task",name:"COMMON.PERMISIONS_CATEGORIES.TASKS.DELETE_TASKS"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.TASKS.NAME",permissions:s(c)}),i=[{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:"comment_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.COMMENT_ISSUES"},{key:"delete_issue",name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.DELETE_ISSUES"}],e.push({name:"COMMON.PERMISIONS_CATEGORIES.ISSUES.NAME",permissions:s(i)}),p=[{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:s(p)}),u(e)},m=function(t,e){return t.find(".resume").html(n(u({category:e}))(a))},d=function(t,e){var r;return r=o({category:t,index:e}),r=angular.element(r),m(r,t),n(r)(a)},g=function(){var n;return c.off(),n=i(),_.each(f(a.role),function(t,e){return n=angular.element(n).append(d(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=f(a.role),n=u.parents(".category-config").data("id"),m(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 g()}),s(a,l.ngModel,g)},{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,f,d,h,g,m,v,y=function(t,e){function r(){this.constructor=t}for(var n in e)b.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},b={}.hasOwnProperty;m=this.taiga,h=this.taiga.mixOf,f=this.taiga.bindMethods,d=this.taiga.debounce,v=this.taiga.timeout,g=angular.module("taigaAdmin"),p=function(t){function e(t,e,r,n,i,o,s,a,u){var c;this.scope=t,this.repo=e,this.rs=r,this.params=n,this.location=i,this.navUrls=o,this.appMetaService=s,this.translate=a,this.errorHandlingService=u,f(this),this.scope.sectionName="ADMIN.WEBHOOKS.SECTION_NAME",this.scope.project={},c=this.loadInitialData(),c.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)),c.then(null,this.onInitialDataError.bind(this)),this.scope.$on("webhooks:reload",this.loadWebhooks)}return y(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","$tgLocation","$tgNavUrls","tgAppMetaService","$translate","tgErrorHandlingService"],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.errorHandlingService.permissionDenied(),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}(h(m.Controller,m.PageMixin,m.FiltersMixin)),g.controller("WebhooksController",p),l=function(t,e,r,n,i){var o;return o=function(n,o,s){var a,u,c,l,p,f,h,g;return g=n.$eval(s.tgWebhook),f=function(){var e;return e=i.instant("ADMIN.WEBHOOKS.DATE"),t.webhooklogs.list(g.id).then(function(t){return function(t){var r,n,i,o;for(r=0,n=t.length;r=1)return s.addClass("hidden")})}),o.on("click",function(t){return s.removeClass("hidden"),s.find("input")[0].focus()})},{link:i}},g.directive("tgNewWebhook",["$tgResources","$tgRepo","$tgConfirm","$tgLoading",a]),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,f(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 y(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}(h(m.Controller,m.PageMixin,m.FiltersMixin)),g.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,f(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 y(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}(h(m.Controller,m.PageMixin,m.FiltersMixin)),g.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,f(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 y(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}(h(m.Controller,m.PageMixin,m.FiltersMixin)),g.controller("BitbucketController",t),u=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}},g.directive("tgSelectInputText",u),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;if(i.preventDefault(),s.validate())return 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){if(o.finish(),s.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=i.find(".submit-button"),i.on("submit","form",a)},{link:n}},g.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;if(i.preventDefault(),s.validate())return 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){if(o.finish(),s.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=i.find(".submit-button"),i.on("submit","form",a)},{link:n}},g.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;if(i.preventDefault(),s.validate())return 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){if(o.finish(),s.setErrors(t),t._error_message)return e.notify("error",t._error_message)})}}(this)),u=i.find(".submit-button"),i.on("submit","form",a)},{link:n}},g.directive("tgBitbucketWebhooks",["$tgRepo","$tgConfirm","$tgLoading",e]),c=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"}},g.directive("tgValidOriginIps",c),s=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,f(this),this.scope.sectionName=this.translate.instant("ADMIN.GOGS.SECTION_NAME"),this.scope.project={},s=this.loadInitialData(),s.then(function(t){return function(){var e,r;return r=t.translate.instant("ADMIN.GOGS.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 y(e,t),e.$inject=["$scope","$tgRepo","$tgResources","$routeParams","tgAppMetaService","$translate"],e.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"gogs").then(function(t){return function(e){return t.scope.gogs=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}(h(m.Controller,m.PageMixin,m.FiltersMixin)),g.controller("GogsController",s)}.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,f){var d,h;return h=function(i,d,h){var g,m,v,y,b,S,k;return i.data={},i.templates=[],g=null,m=d.find("form").checksley({onlyOneErrorElement:!0}),y=function(e){return c.get("$http").removeAll(),g.finish(),t.$broadcast("projects:reload"),r.notify("success",l.instant("COMMON.SAVE")),n.url(s.get(e)),u.close(d),p.loadProjects()},v=function(t){var e,r,n,i,o,s;for(g.finish(),m.setErrors(t),s=[],i=_.keys(t),o=[],r=0,n=i.length;rd?(p=a.instant("PROJECT.IMPORT.ERROR_MAX_SIZE_EXCEEDED",{fileName:e.name,fileSize:r(e.size),maxFileSize:r(d)}),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),g=function(t){return function(t){return n("done",a.instant("PROJECT.IMPORT.TITLE"),a.instant("PROJECT.IMPORT.DESCRIPTION"))}}(this),m=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),f=function(t){return function(t){return l.reject("fail")}}(this),c=new FormData,c.append("dump",e),y=new XMLHttpRequest,y.upload.addEventListener("progress",v,!1),y.upload.addEventListener("load",g,!1),y.upload.addEventListener("error",m,!1),y.upload.addEventListener("abort",m,!1),y.addEventListener("load",u,!1),y.addEventListener("error",f,!1),y.open("POST",i.resolve("importer")),y.setRequestHeader("Authorization","Bearer "+o.getToken()),y.setRequestHeader("Accept","application/json"),y.send(c),l.promise)},u.changeLogo=function(e,o){var a,u,c,l,p,f;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}},f=i.resolve("projects")+"/"+e+"/change_logo",n.post(f,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;nu?(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,o){var s,a;return a={},s="userstories-queryparams",a.get=function(t,r){var n;return n=a.getQueryParams(t),n.project=t,e.queryOne("userstories",r,n)},a.getByRef=function(t,r,n){var i;return null==n&&(n={}),i=a.getQueryParams(t),i.project=t,i.ref=r,i=_.extend({},i,n),e.queryOne("userstories","by_ref",i)},a.listInAllProjects=function(t){return e.queryMany("userstories",t)},a.filtersData=function(t){return e.queryOneRaw("userstories-filters",null,t)},a.listUnassigned=function(t,r,n){var i;return i={project:t,milestone:"null"},i=_.extend({},i,r||{}),a.storeQueryParams(t,i),e.queryMany("userstories",_.extend(i,{page_size:n}),{enablePagination:!0},!0)},a.listAll=function(t,r){var n;return n={project:t},n=_.extend({},n,r||{}),a.storeQueryParams(t,n),e.queryMany("userstories",n)},a.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)},a.upvote=function(t){var e;return e=n.resolve("userstory-upvote",t),r.post(e)},a.downvote=function(t){var e;return e=n.resolve("userstory-downvote",t),r.post(e)},a.watch=function(t){var e;return e=n.resolve("userstory-watch",t),r.post(e)},a.unwatch=function(t){var e;return e=n.resolve("userstory-unwatch",t),r.post(e)},a.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)},a.bulkUpdateMilestone=function(t,e,i){var o,s;return s=n.resolve("bulk-update-us-milestone"),o={project_id:t,milestone_id:e,bulk_stories:i},r.post(s,o)},a.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)},a.listValues=function(t,r){var n;return n={project:t},a.storeQueryParams(t,n),e.queryMany(r,n)},a.storeQueryParams=function(e,r){var n,o;return o=e+":"+s,n=t([e,o]),i.set(n,r)},a.getQueryParams=function(e){var r,n;return n=e+":"+s,r=t([e,n]),i.get(r)||{}},a.storeShowTags=function(e,r){var n;return n=t([e,"showTags"]),i.set(n,r)},a.getShowTags=function(e){var r;return r=t([e,"showTags"]),i.get(r)||null},function(t){return t.userstories=a}},e=angular.module("taigaResources"),e.factory("$tgUserstoriesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls","$tgStorage","$q",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.list=function(e){return t.queryMany("wiki",{project:e})},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;if(r.preventDefault(),c.validate())return 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)}))}}(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,f,d){var h,g,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=f,this.errorHandlingService=d,this.scope.sectionName="USER_SETTINGS.MENU.SECTION_TITLE",this.scope.project={},this.scope.user=this.auth.getUser(),this.scope.user||this.errorHandlingService.permissionDenied(),this.scope.lang=this.getLan(),this.scope.theme=this.getTheme(),h=this.config.get("maxUploadFileSize",null),h&&(m=this.translate.instant("USER_SETTINGS.AVATAR_MAX_SIZE",{maxFileSize:a(h)}),this.scope.maxFileSizeMsg=m),g=this.loadInitialData(),g.then(null,this.onInitialDataError.bind(this))}return c(e,t),e.$inject=["$scope","$rootScope","$tgConfig","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth","$translate","tgErrorHandlingService"],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;if(i.preventDefault(),u=s.find("form").checksley(),u.validate())return 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)}}(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){if(i.avatarAttachment)return o.find(".loading-overlay").addClass("active"),r.userSettings.changeAvatar(i.avatarAttachment).then(u,a)}),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,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.auth=c,this.errorHandlingService=l,this.scope.sectionName="USER_SETTINGS.NOTIFICATIONS.SECTION_NAME",this.scope.user=this.auth.getUser(),p=this.loadInitialData(),p.then(null,this.onInitialDataError.bind(this))}return a(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth","tgErrorHandlingService"],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(){angular.module("taigaHistory",[])}.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=angular.module("taigaUtils",[])}.call(this),function(){angular.module("taigaWikiHistory",[])}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r){},{templateUrl:"components/assigned-to/assigned-item/assigned-item.html",scope:{member:"="},link:t}},t.$inject=[],angular.module("taigaComponents").directive("tgAssignedItem",t)}.call(this),function(){var t;t=function(){function t(){this.assigned&&this._getAssignedMember(),this._filterAssignedMember()}return t.$inject=[],t.prototype._getAssignedMember=function(){return this.assignedMember=_.filter(this.project.members,function(t){return function(e){return e.id===t.assigned.get("id")}}(this))},t.prototype._filterAssignedMember=function(){return this.assigned?this.nonAssignedMembers=_.filter(this.project.members,function(t){
-return function(e){return e.id!==t.assigned.get("id")}}(this)):this.nonAssignedMembers=this.project.members},t}(),angular.module("taigaComponents").controller("AssignedToSelectorCtrl",t)}.call(this),function(){var t;t=function(){return{controller:"AssignedToSelectorCtrl",controllerAs:"vm",bindToController:!0,templateUrl:"components/assigned-to/assigned-to-selector/assigned-to-selector.html",scope:{assigned:"=",project:"=",onRemoveAssigned:"&",onAssignTo:"&"}}},t.$inject=[],angular.module("taigaComponents").directive("tgAssignedToSelector",t)}.call(this),function(){var t;t=function(){function t(t,e){this.lightboxFactory=t,this.lightboxService=e,this.has_permissions=_.includes(this.project.my_permissions,"modify_epic")}return t.$inject=["tgLightboxFactory","lightboxService"],t.prototype._closeAndRemoveAssigned=function(){return this.lightboxService.closeAll(),this.onRemoveAssigned()},t.prototype._closeAndAssign=function(t){return this.lightboxService.closeAll(),this.onAssignTo({member:t})},t.prototype.onSelectAssignedTo=function(t,e){return this.lightboxFactory.create("tg-assigned-to-selector",{"class":"lightbox lightbox-assigned-to-selector open",assigned:"assigned",project:"project","on-remove-assigned":"onRemoveAssigned()","on-assign-to":"assignTo(member)"},{assigned:this.assignedTo,project:this.project,onRemoveAssigned:this._closeAndRemoveAssigned.bind(this),assignTo:this._closeAndAssign.bind(this)})},t}(),angular.module("taigaComponents").controller("AssignedToCtrl",t)}.call(this),function(){var t;t=function(){return{controller:"AssignedToCtrl",controllerAs:"vm",bindToController:!0,templateUrl:"components/assigned-to/assigned-to.html",scope:{assignedTo:"=",project:"=",onRemoveAssigned:"&",onAssignTo:"&"}}},t.$inject=[],angular.module("taigaComponents").directive("tgAssignedToComponent",t)}.call(this),function(){var t;t=function(t,e,r){var n;return n=function(n,i,o){var s;return s=t(o.tgAttachmentLink)(n),i.on("click",function(t){return taiga.isImage(s.getIn(["file","name"]))?(t.preventDefault(),n.$apply(function(){return r.open($("tg-attachments-preview")),e.fileId=s.getIn(["file","id"])})):taiga.isPdf(s.getIn(["file","name"]))?(t.preventDefault(),window.open(s.getIn(["file","url"]))):void 0}),n.$on("$destroy",function(){return i.off()})},{link:n}},t.$inject=["$parse","tgAttachmentsPreviewService","lightboxService"],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,a){this.translate=t,this.confirm=r,this.config=n,this.storage=i,this.attachmentsFullService=o,this.projectService=s,this.attachmentsPreviewService=a,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","tgAttachmentsPreviewService"],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 this.attachmentsPreviewService.fileId=null,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)},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(new Error(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;if(i=this.attachments.findIndex(function(t){return t===e}),i!==r)return 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))},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.attachmentsPreviewService=t,taiga.defineImmutableProperty(this,"current",function(t){return function(){return t.attachmentsPreviewService.fileId?t.getCurrent():null}}(this))}return t.$inject=["tgAttachmentsPreviewService"],t.prototype.hasPagination=function(){var t;return t=this.attachments.filter(function(t){return function(t){return taiga.isImage(t.getIn(["file","name"]))}}(this)),t.size>1},t.prototype.getCurrent=function(){var t,e;return t=this.attachments.find(function(t){return function(e){return t.attachmentsPreviewService.fileId===e.getIn(["file","id"])}}(this)),e=t.get("file")},t.prototype.getIndex=function(){return this.attachments.findIndex(function(t){return function(e){return t.attachmentsPreviewService.fileId===e.getIn(["file","id"])}}(this))},t.prototype.next=function(){var t,e;return t=this.getIndex(),e=this.attachments.slice(t+1).find(function(t){return taiga.isImage(t.getIn(["file","name"]))}),e||(e=this.attachments.find(function(t){return taiga.isImage(t.getIn(["file","name"]))})),this.attachmentsPreviewService.fileId=e.getIn(["file","id"])},t.prototype.previous=function(){var t,e;return t=this.getIndex(),e=this.attachments.slice(0,t).findLast(function(t){return taiga.isImage(t.getIn(["file","name"]))}),e||(e=this.attachments.findLast(function(t){return taiga.isImage(t.getIn(["file","name"]))})),this.attachmentsPreviewService.fileId=e.getIn(["file","id"])},t}(),angular.module("taigaComponents").controller("AttachmentsPreview",t)}.call(this),function(){var t;t=function(t,e){var r;return r=function(t,r,n,i){return $(document.body).on("keydown.image-preview",function(r){return e.fileId&&(39===r.keyCode?i.next():37===r.keyCode&&i.previous()),t.$digest()}),t.$on("$destroy",function(){return $(document.body).off(".image-preview")})},{scope:{},controller:"AttachmentsPreview",templateUrl:"components/attachments-preview/attachments-preview.html",link:r,controllerAs:"vm",bindToController:{attachments:"="}}},angular.module("taigaComponents").directive("tgAttachmentsPreview",["lightboxService","tgAttachmentsPreviewService",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(){}return e(r,t),r.$inject=[],r}(taiga.Service),angular.module("taigaComponents").service("tgAttachmentsPreviewService",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;if(e=Immutable.fromJS({file:t,name:t.name,size:t.size}),this.attachmentsService.validate(t)&&(this.attachments=this.attachments.push(e),this.onAdd))return this.onAdd({attachment:e})},t.prototype.addAttachments=function(t){return _.forEach(t,this.addAttachment.bind(this))},t.prototype.deleteAttachment=function(t){if(this.attachments=this.attachments.filter(function(e){return e!==t}),this.onDelete)return this.onDelete({attachment:t})},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){var i;return i=n.tgAvatarBig?"avatarBig":"avatar",e.$watch(i,function(e){var n;if(n=t.getAvatar(e,i),r.attr("src",n.url),n.bg)return r.css("background",n.bg)})},{link:e,scope:{avatar:"=tgAvatar",avatarBig:"=tgAvatarBig"}}},t.$inject=["tgAvatarService"],angular.module("taigaComponents").directive("tgAvatar",t),angular.module("taigaComponents").directive("tgAvatarBig",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){var t,e;return t=function(t,e,r){return t.$watch("epics",function(e){if(e&&!e.isIterable)return t.epics=Immutable.fromJS(e)})},e=function(t,e){return e.format?"components/belong-to-epics/belong-to-epics-"+e.format+".html":"components/belong-to-epics/belong-to-epics-pill.html"},{link:t,scope:{epics:"="},templateUrl:e}},e.directive("tgBelongToEpics",t)}.call(this),function(){var t;t=function(){return{scope:{levels:"=",value:"="},templateUrl:"components/board-zoom/board-zoom.html"}},angular.module("taigaComponents").directive("tgBoardZoom",[t])}.call(this),function(){var t;t=function(){function t(){this.index=0}return t.$inject=[],t.prototype.next=function(){if(this.index++,this.index>=this.images.size)return this.index=0},t.prototype.previous=function(){if(this.index--,this.index<0)return this.index=this.images.size-1},t}(),angular.module("taigaComponents").controller("CardSlideshow",t)}.call(this),function(){var t,e;e=angular.module("taigaComponents"),t=function(){return{controller:"CardSlideshow",templateUrl:"components/card-slideshow/card-slideshow.html",bindToController:!0,controllerAs:"vm",scope:{images:"="}}},e.directive("tgCardSlideshow",t)}.call(this),function(){var t;t=function(){function t(){}return t.$inject=[],t.prototype.visible=function(t){return this.zoom.indexOf(t)!==-1},t.prototype.toggleFold=function(){return this.onToggleFold({id:this.item.get("id")})},t.prototype.getClosedTasks=function(){return this.item.getIn(["model","tasks"]).filter(function(t){return t.get("is_closed")})},t.prototype.closedTasksPercent=function(){return 100*this.getClosedTasks().size/this.item.getIn(["model","tasks"]).size},t.prototype.getPermissionsKey=function(){return"task"===this.type?"modify_task":"modify_us"},t.prototype._setVisibility=function(){var t;return t={related:this.visible("related_tasks"),slides:this.visible("attachments")},_.isUndefined(this.item.get("foldStatusChanged"))||(this.visible("related_tasks")&&this.visible("attachments")?(t.related=!this.item.get("foldStatusChanged"),t.slides=!this.item.get("foldStatusChanged")):this.visible("attachments")?(t.related=this.item.get("foldStatusChanged"),t.slides=this.item.get("foldStatusChanged")):this.visible("related_tasks")||this.visible("attachments")||(t.related=this.item.get("foldStatusChanged"),t.slides=this.item.get("foldStatusChanged"))),this.item.getIn(["model","tasks"])&&this.item.getIn(["model","tasks"]).size||(t.related=!1),this.item.get("images")&&this.item.get("images").size||(t.slides=!1),t},t.prototype.isRelatedTasksVisible=function(){var t;return t=this._setVisibility(),t.related},t.prototype.isSlideshowVisible=function(){var t;return t=this._setVisibility(),t.slides},t.prototype.getNavKey=function(){return"task"===this.type?"project-tasks-detail":"project-userstories-detail"},t}(),angular.module("taigaComponents").controller("Card",t)}.call(this),function(){var t,e;e=angular.module("taigaComponents"),t=function(){return{link:function(t){},controller:"Card",controllerAs:"vm",bindToController:!0,templateUrl:"components/card/card.html",scope:{onToggleFold:"&",onClickAssignedTo:"&",onClickEdit:"&",project:"=",item:"=",zoom:"=",zoomLevel:"=",archived:"=",type:"@"}}},e.directive("tgCard",t)}.call(this),function(){var t,e,r;r=this.taiga,e=r.getDefaulColorList,t=function(){function t(t){this.projectService=t,this.colorList=e(),this.checkIsColorRequired(),this.displayColorList=!1}return t.$inject=["tgProjectService"],t.prototype.userCanChangeColor=function(){return!this.requiredPerm||this.projectService.hasPermission(this.requiredPerm)},t.prototype.checkIsColorRequired=function(){if(!this.isColorRequired)return this.colorList=_.dropRight(this.colorList)},t.prototype.setColor=function(t){return this.color=this.initColor},t.prototype.resetColor=function(){if(this.isColorRequired&&!this.color)return this.color=this.initColor},t.prototype.toggleColorList=function(){return this.displayColorList=!this.displayColorList,this.resetColor()},t.prototype.onSelectDropdownColor=function(t){return this.color=t,this.onSelectColor({color:t}),this.toggleColorList()},t.prototype.onKeyDown=function(t){if(13===t.which)return!this.color&&this.isColorRequired||this.onSelectDropdownColor(this.color),t.preventDefault()},t}(),angular.module("taigaComponents").controller("ColorSelectorCtrl",t)}.call(this),function(){var t,e;e=this.taiga.bindOnce,t=function(t){var e;return e=function(e,r,n,i){var o,s,a;return o=null,s=function(){return t.cancel(o),o=null},a=function(){if(!o)return o=t(function(){return i.displayColorList=!1,i.resetColor()},400)},r.find(".color-selector").mouseenter(s).mouseleave(a),r.find(".color-selector-dropdown").mouseenter(s).mouseleave(a),e.$watch("vm.initColor",function(t){return i.setColor(t)})},{link:e,templateUrl:"components/color-selector/color-selector.html",controller:"ColorSelectorCtrl",controllerAs:"vm",bindToController:{isColorRequired:"=",onSelectColor:"&",initColor:"=",requiredPerm:"@"},scope:{}}},t.$inject=["$timeout"],angular.module("taigaComponents").directive("tgColorSelector",t)}.call(this),function(){var t,e;e=angular.module("taigaUserStories"),t=function(){function t(t,e,r,n,i){this.rootScope=t,this.confirm=e,this.modelTransform=r,this.navUrls=n,this.window=i,this.editMode=!1,this.loadingSubject=!1,this.originalSubject=this.item.subject}return t.$inject=["$rootScope","$tgConfirm","$tgQueueModelTransformation","$tgNavUrls","$window"],t.prototype._checkNav=function(){var t,e,r;if(null!=(null!=(e=this.item.neighbors.previous)?e.ref:void 0)&&(t={project:this.project.slug,ref:this.item.neighbors.previous.ref},this.previousUrl=this.navUrls.resolve("project-"+this.item._name+"-detail",t)),null!=(null!=(r=this.item.neighbors.next)?r.ref:void 0))return t={project:this.project.slug,ref:this.item.neighbors.next.ref},this.nextUrl=this.navUrls.resolve("project-"+this.item._name+"-detail",t)},t.prototype._checkPermissions=function(){return this.permissions={canEdit:_.includes(this.project.my_permissions,this.requiredPerm)}},t.prototype.editSubject=function(t){var e;if(e=this.window.getSelection(),"Range"!==e.type&&(t&&(this.editMode=!0),!t))return this.editMode=!1},t.prototype.onKeyDown=function(t){if(13===t.which&&this.saveSubject(),27===t.which)return this.item.subject=this.originalSubject,this.editSubject(!1)},t.prototype.saveSubject=function(){var t,e,r,n;return r=function(t){return function(){return t.loadingSubject=!1,t.rootScope.$broadcast("object:updated"),t.confirm.notify("success"),t.originalSubject=t.item.subject}}(this),e=function(t){return function(){return t.loadingSubject=!1,t.confirm.notify("error")}}(this),this.editMode=!1,this.loadingSubject=!0,t=this.item,n=this.modelTransform.save(function(t){return t}),n.then(r,e)},t}(),e.controller("StoryHeaderCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaUserStories"),t=function(){var t;return this.$inject=[],t=function(t,e,r,n){return n._checkPermissions(),n._checkNav()},{link:t,controller:"StoryHeaderCtrl",bindToController:!0,scope:{item:"=",project:"=",requiredPerm:"@"},controllerAs:"vm",templateUrl:"components/detail/header/detail-header.html"}},e.directive("tgDetailHeader",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,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=taiga.generateHash,t=function(t){function n(t,e,r){this.q=t,this.urls=e,this.http=r}return r(n,t),n.$inject=["$q","$tgUrls","$tgHttp"],n.prototype.storeFilters=function(t,r,n){var i,o,s,a,u;return i=this.q.defer(),u=this.urls.resolve("user-storage"),s=t+":"+n,o=e([t,s]),_.isEmpty(r)?(a=this.http["delete"](u+"/"+o,{key:o,value:r}),a.then(function(){return i.resolve()}),a.then(null,function(){return i.reject()})):(a=this.http.put(u+"/"+o,{key:o,value:r}),a.then(function(t){return i.resolve()}),a.then(null,function(t){return function(e){var n;return n=t.http.post(""+u,{key:o,value:r}),n.then(function(){return i.resolve()}),n.then(null,function(){return i.reject()})}}(this))),i.promise},n.prototype.getFilters=function(t,r){var n,i,o,s,a;return n=this.q.defer(),a=this.urls.resolve("user-storage"),o=t+":"+r,i=e([t,o]),s=this.http.get(a+"/"+i),s.then(function(t){return n.resolve(t.data.value)}),s.then(null,function(t){return n.resolve({})}),n.promise},n}(taiga.Service),angular.module("taigaComponents").service("tgFilterRemoteStorageService",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){var i;return i=$("tg-filter"),t.$watch(r.ngIf,function(t){var r,n;if(t)return i.find(".filter-list").hide(),n=i.height(),r=0,i.children().each(function(){return r+=$(this).outerHeight(!0)}),$(e.context.nextSibling).css({"max-height":n-r,display:"block"})})},{priority:900,link:t}},angular.module("taigaComponents").directive("tgFilterSlideDown",[t])}.call(this),function(){var t;t=function(){function t(){this.opened=null,this.customFilterForm=!1,this.customFilterName=""}return t.$inject=[],t.prototype.toggleFilterCategory=function(t){return this.opened===t?this.opened=null:this.opened=t},t.prototype.isOpen=function(t){return this.opened===t},t.prototype.saveCustomFilter=function(){return this.onSaveCustomFilter({name:this.customFilterName}),this.customFilterForm=!1,this.opened="custom-filter",this.customFilterName=""},t.prototype.changeQ=function(){return this.onChangeQ({q:this.q})},t.prototype.unselectFilter=function(t){return this.onRemoveFilter({filter:t})},t.prototype.unselectFilter=function(t){return this.onRemoveFilter({filter:t})},t.prototype.selectFilter=function(t,e){return e={category:t,filter:e},this.onAddFilter({filter:e})},t.prototype.removeCustomFilter=function(t){return this.onRemoveCustomFilter({filter:t})},t.prototype.selectCustomFilter=function(t){return this.onSelectCustomFilter({filter:t})},t.prototype.isFilterSelected=function(t,e){return!!_.find(this.selectedFilters,function(r){return e.id===r.id&&t.dataType===r.dataType})},t}(),angular.module("taigaComponents").controller("Filter",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){var i;return i=t.$watch("vm.defaultQ",function(e){return e&&!t.vm.filtersForm.$dirty?(t.vm.q=e,i()):t.vm.filtersForm.$dirty?i():void 0})},{scope:{onChangeQ:"&",onAddFilter:"&",onSelectCustomFilter:"&",onRemoveFilter:"&",onRemoveCustomFilter:"&",onSaveCustomFilter:"&",customFilters:"<",defaultQ:"=q",filters:"<",customFilters:"<",selectedFilters:"<"},bindToController:!0,controller:"Filter",controllerAs:"vm",templateUrl:"components/filter/filter.html",link:t}},angular.module("taigaComponents").directive("tgFilter",[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){if(e[t.joyride])return 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()},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:".add-action",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,e){var r;return r=function(r,n,i,o){var s,a,u;return r.zoomIndex=t.get("kanban_zoom")||2,r.levels=5,u=[["ref"],["subject"],["owner","tags","extra_info","unfold"],["attachments"],["related_tasks"]],s=function(e){return null==e&&(e=0),t.get("kanban_zoom")!==e&&t.set("kanban_zoom",e),_.reduce(u,function(t,r,n){return n<=e&&(t=t.concat(r)),t})},r.$watch("zoomIndex",function(t){var e;return e=s(t),r.onZoomChange({zoomLevel:t,zoom:e})}),a=r.$watch(function(){return e.project},function(t){if(t)return t.get("my_permissions").indexOf("view_tasks")===-1&&(r.levels=4),a()})},{scope:{onZoomChange:"&"},template:'',link:r}},angular.module("taigaComponents").directive("tgKanbanBoardZoom",["$tgStorage","tgProjectService",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;if(e=Immutable.fromJS(e))return 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))})},{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;if(e=Immutable.fromJS(e))return 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))})},{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;if(t=this._videoConferenceUrl())return this.project=this.project.set("videoconferenceUrl",t)},t.prototype._setMenuPermissions=function(){if(this.menu=Immutable.Map({epics:!1,backlog:!1,kanban:!1,issues:!1,wiki:!1}),this.project.get("is_epics_activated")&&this.project.get("my_permissions").indexOf("view_epics")!==-1&&(this.menu=this.menu.set("epics",!0)),this.project.get("is_backlog_activated")&&this.project.get("my_permissions").indexOf("view_us")!==-1&&(this.menu=this.menu.set("backlog",!0)),this.project.get("is_kanban_activated")&&this.project.get("my_permissions").indexOf("view_us")!==-1&&(this.menu=this.menu.set("kanban",!0)),this.project.get("is_issues_activated")&&this.project.get("my_permissions").indexOf("view_issues")!==-1&&(this.menu=this.menu.set("issues",!0)),this.project.get("is_wiki_activated")&&this.project.get("my_permissions").indexOf("view_wiki_pages")!==-1)return this.menu=this.menu.set("wiki",!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"),t===-1&&e===-1||(r=e===-1||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()):t<100&&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,e;e=angular.module("taigaCommon"),t=function(){var t,e,r,n;return r=function(t){var e,r,n;return t.addClass("selected"),n=t.position().top+t.outerHeight(),e=t.parent().outerHeight(),n>e?(r=n-e,t.parent().scrollTop(t.parent().scrollTop()+r)):t.position().top<0?t.parent().scrollTop(t.parent().scrollTop()+t.position().top):void 0},t=function(t,e,n){var i,o,s;if(i=t.find(".selected"),40===e){if(!i.length)return r(t.find("li:first"));if(o=i.next("li"),o.length)return i.removeClass("selected"),r(o)}else if(38===e){if(!i.length)return r(t.find("li:last"));if(s=i.prev("li"),s.length)return i.removeClass("selected"),r(s)}},n=function(){return $(document).off(".tags-keyboard-navigation")},e=function(e,r){return n(),$(document).on("keydown.tags-keyboard-navigation",function(n){return function(n){var i;if(i=n.keyCode?n.keyCode:n.which,40===i||38===i)return n.preventDefault(),t(r,i,e)}}(this)),e.$on("$destroy",n)},{link:e,templateUrl:"components/tags/tag-dropdown/tag-dropdown.html",scope:{onSelectTag:"&",colorArray:"=",tag:"="}}},e.directive("tgTagsDropdown",t)}.call(this),function(){var t,e,r;r=this.taiga.trim,e=angular.module("taigaCommon"),t=function(){function t(t){this.tagLineService=t,this.disableColorSelection=!1,this.newTag={name:"",color:null},this.colorArray=[],this.addTag=!1}return t.$inject=["tgTagLineService"],t.prototype.checkPermissions=function(){return this.tagLineService.checkPermissions(this.project.my_permissions,this.permissions)},t.prototype._createColorsArray=function(t){return this.colorArray=this.tagLineService.createColorsArray(t)},t.prototype.displayTagInput=function(){return this.addTag=!0},t.prototype.addNewTag=function(t,e){if(this.newTag.name="",this.newTag.color=null,t.length)return this.disableColorSelection?t.length?this.onAddTag({name:t,color:e}):void 0:(this.project.tags_colors[t]&&(e=this.project.tags_colors[t]),this.onAddTag({name:t,color:e}))},t.prototype.selectColor=function(t){return this.newTag.color=t},t}(),e.controller("TagLineCommonCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaCommon"),t=function(){var t;return t=function(t,e,r,n){var i;return _.isUndefined(r.disableColorSelection)||(n.disableColorSelection=!0),i=t.$watch("vm.project",function(t){if(t&&Object.keys(t).length)return i(),n.disableColorSelection?void 0:n.colorArray=n._createColorsArray(n.project.tags_colors)}),e.on("keydown",".tag-input",function(r){var i;return 27===r.keyCode?(n.addTag=!1,n.newTag.name="",n.newTag.color="",r.stopPropagation()):13===r.keyCode&&(r.preventDefault(),e.find(".tags-dropdown .selected").length?(i=$(".tags-dropdown .selected .tags-dropdown-name").text(),n.addNewTag(i,null)):n.addNewTag(n.newTag.name,n.newTag.color)),t.$apply()})},{link:t,scope:{permissions:"@",loadingAddTag:"=",loadingRemoveTag:"=",tags:"=",project:"=",onAddTag:"&",onDeleteTag:"&"},templateUrl:"components/tags/tag-line-common/tag-line-common.html",controller:"TagLineCommonCtrl",controllerAs:"vm",bindToController:!0}},e.directive("tgTagLineCommon",t)}.call(this),function(){var t,e,r;r=this.taiga.trim,e=angular.module("taigaCommon"),t=function(){function t(t,e,r){this.rootScope=t,this.confirm=e,this.modelTransform=r,this.loadingAddTag=!1}return t.$inject=["$rootScope","$tgConfirm","$tgQueueModelTransformation"],t.prototype.onDeleteTag=function(t){var e,n,i,o;return this.loadingRemoveTag=t[0],n=function(t){return function(e){return t.rootScope.$broadcast("object:updated"),t.loadingRemoveTag=!1,e}}(this),e=function(t){return function(){return t.confirm.notify("error"),t.loadingRemoveTag=!1}}(this),i=r(t[0].toLowerCase()),o=this.modelTransform.save(function(t){var e;return e=_.clone(t.tags),_.remove(e,function(t){return t[0]===i}),t.tags=e,t}),o.then(n,e)},t.prototype.onAddTag=function(t,e){var n,i,o;return this.loadingAddTag=!0,i=function(t){return function(e){return t.rootScope.$broadcast("object:updated"),t.addTag=!1,t.loadingAddTag=!1,e}}(this),n=function(t){return function(){return t.loadingAddTag=!1,t.confirm.notify("error")}}(this),o=this.modelTransform.save(function(n){return function(n){var i,o;return o=r(t.toLowerCase()),i=_.clone(n.tags),i.push([t,e]),n.tags=i,n}}(this)),o.then(i,n)},t}(),e.controller("TagLineCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaCommon"),t=function(){return{scope:{item:"=",permissions:"@",project:"="},templateUrl:"components/tags/tag-line-detail/tag-line-detail.html",controller:"TagLineCtrl",controllerAs:"vm",bindToController:!0}},e.directive("tgTagLine",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=angular.module("taigaCommon"),t=function(t){function e(){}return r(e,t),e.$inject=[],e.prototype.checkPermissions=function(t,e){return _.includes(t,e)},e.prototype.createColorsArray=function(t){return _.map(t,function(t,e){return[e,t]})},e}(taiga.Service),e.service("tgTagLineService",t)}.call(this),function(){var t,e;e=angular.module("taigaCommon"),t=function(){return{templateUrl:"components/tags/tag/tag.html",scope:{tag:"<",loadingRemoveTag:"<",onDeleteTag:"&",hasPermissions:"@"}}},e.directive("tgTag",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n,i){var o,s;return e.zoomIndex=t.get("taskboard_zoom")||2,e.levels=4,s=[["ref"],["subject"],["owner","tags","extra_info","unfold"],["attachments"],["related_tasks"]],o=function(e){return null==e&&(e=0),t.get("taskboard_zoom")!==e&&t.set("taskboard_zoom",e),_.reduce(s,function(t,r,n){return n<=e&&(t=t.concat(r)),t})},e.$watch("zoomIndex",function(t){var r;return r=o(t),e.onZoomChange({zoomLevel:t,zoom:r})})},{scope:{onZoomChange:"&"},template:'',link:e}},angular.module("taigaComponents").directive("tgTaskboardZoom",["$tgStorage",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(t,e){var r;return r=function(r,n,i){return r.vm={},r.vm.tribeHost=t.config.tribeHost,r.vm.url=e.protocol()+"://"+e.host(),"http"===e.protocol()&&80!==e.port()?r.vm.url=r.vm.url+":"+e.port():"https"===e.protocol()&&443!==e.port()?r.vm.url=r.vm.url+":"+e.port():void 0},{scope:{usId:"=",projectSlug:"="},controllerAs:"vm",templateUrl:"components/tribe-button/tribe-button.html",link:r}},t.$inject=["$tgConfig","$tgLocation"],angular.module("taigaComponents").directive("tgTribeButton",t)}.call(this),function(){var t;t=function(t){var e,r;return r=function(e,r,n){return e.vm={},e.vm.tribeHost=t.config.tribeHost,e.vm.show=function(){return e.vm.open=!0},e.vm.hide=function(t){return e.vm.open=!1}},e={templateUrl:"components/tribe-button/tribe-linked.html",scope:{gigTitle:"=",gigId:"="},link:r}},t.$inject=["$tgConfig"],angular.module("taigaComponents").directive("tgTribeLinked",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",epics:"modify_epic"},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:"&"},compile:function(t,e){if(!e.q)return e.q=""},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(){if(!this.loadingGlobal)return this.loadingGlobal=!0,this.fetch().then(function(t){return function(){return t.loadingGlobal=!1}}(this))},t.prototype.fetchByOrderBy=function(){if(!this.loadingList)return this.loadingList=!0,this.fetch().then(function(t){return function(){return t.loadingList=!1}}(this))},t.prototype.showMore=function(){if(!this.loadingPagination)return 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,n;r=this.taiga,n=r.trim,e=r.getRandomDefaultColor,t=function(){function t(t,r,n){this.confirm=t,this.projectService=r,this.epicsService=n,this.project=this.projectService.project.toJS(),this.newEpic={color:e(),status:this.project.default_epic_status,tags:[]},this.attachments=Immutable.List(),this.loading=!1}return t.$inject=["$tgConfirm","tgProjectService","tgEpicsService"],t.prototype.createEpic=function(){if(this.validateForm())return this.loading=!0,this.epicsService.createEpic(this.newEpic,this.attachments).then(function(t){return function(e){return t.onCreateEpic(),t.loading=!1}}(this))["catch"](function(t){return function(e){if(t.loading=!1,t.setFormErrors(e.data),e.data._error_message)return t.confirm.notify("error",e.data._error_message)}}(this))},t.prototype.selectColor=function(t){return this.newEpic.color=t},t.prototype.addTag=function(t,e){if(t=n(t.toLowerCase()),!_.find(this.newEpic.tags,function(e){return e[0]===t}))return this.newEpic.tags.push([t,e])},t.prototype.deleteTag=function(t){return _.remove(this.newEpic.tags,function(e){return e[0]===t[0]})},t.prototype.addAttachment=function(t){return this.attachments.push(t)},t}(),angular.module("taigaEpics").controller("CreateEpicCtrl",t)}.call(this),function(){var t;t=function(){var t;return t=function(t,e,r,n){var i;return i=e.find("form").checksley(),n.validateForm=function(t){return function(){return i.validate()}}(this),n.setFormErrors=function(t){return function(t){return i.setErrors(t)}}(this)},{link:t,templateUrl:"epics/create-epic/create-epic.html",controller:"CreateEpicCtrl",controllerAs:"vm",bindToController:{onCreateEpic:"&"},scope:{}}},angular.module("taigaEpics").directive("tgCreateEpic",t)}.call(this),function(){var t;t=function(){function t(t,e,r){this.confirm=t,this.projectService=e,this.epicsService=r,this.displayUserStories=!1,this.displayAssignedTo=!1,this.displayStatusList=!1,this.loadingStatus=!1,this.project=this.projectService.project.toJS(),this._calculateProgressBar()}return t.$inject=["$tgConfirm","tgProjectService","tgEpicsService"],t.prototype._calculateProgressBar=function(){var t,e,r;return this.epic.getIn(["status_extra_info","is_closed"])===!0?this.percentage="100%":(e=this.epic.getIn(["user_stories_counts","opened"]),t=this.epic.getIn(["user_stories_counts","closed"]),r=e+t,0===r?this.percentage="0%":this.percentage=100*t/r+"%")},t.prototype.canEditEpics=function(){return this.projectService.hasPermission("modify_epic")},t.prototype.toggleUserStoryList=function(){return this.displayUserStories?this.displayUserStories=!1:this.epicsService.listRelatedUserStories(this.epic).then(function(t){return function(e){return t.epicStories=e,t.displayUserStories=!0}}(this))["catch"](function(t){return function(){return t.confirm.notify("error")}}(this))},t.prototype.updateStatus=function(t){return this.displayStatusList=!1,this.loadingStatus=!0,this.epicsService.updateEpicStatus(this.epic,t)["catch"](function(t){return function(){return t.confirm.notify("error")}}(this))["finally"](function(t){return function(){return t.loadingStatus=!1}}(this))},t.prototype.updateAssignedTo=function(t){return this.assignLoader=!0,this.epicsService.updateEpicAssignedTo(this.epic,(null!=t?t.id:void 0)||null)["catch"](function(t){return function(){return t.confirm.notify("error")}}(this)).then(function(t){return function(){return t.assignLoader=!1}}(this))},t}(),angular.module("taigaEpics").controller("EpicRowCtrl",t)}.call(this),function(){var t;t=function(){return{templateUrl:"epics/dashboard/epic-row/epic-row.html",controller:"EpicRowCtrl",controllerAs:"vm",bindToController:!0,scope:{epic:"=",column:"="}}},angular.module("taigaEpics").directive("tgEpicRow",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t,r,n,i,o,s,a,u,c){this.params=t,this.errorHandlingService=r,this.lightboxFactory=n,this.lightboxService=i,this.confirm=o,this.projectService=s,this.epicsService=a,this.appMetaService=u,this.translate=c,this.sectionName="EPICS.SECTION_NAME",e.defineImmutableProperty(this,"project",function(t){return function(){return t.projectService.project}}(this)),e.defineImmutableProperty(this,"epics",function(t){
-return function(){return t.epicsService.epics}}(this)),this.appMetaService.setfn(this._setMeta.bind(this))}return t.$inject=["$routeParams","tgErrorHandlingService","tgLightboxFactory","lightboxService","$tgConfirm","tgProjectService","tgEpicsService","tgAppMetaService","$translate"],t.prototype._setMeta=function(){var t;return this.project?(t={projectName:this.project.get("name"),projectDescription:this.project.get("description")},{title:this.translate.instant("EPICS.PAGE_TITLE",t),description:this.translate.instant("EPICS.PAGE_DESCRIPTION",t)}):null},t.prototype.loadInitialData=function(){return this.epicsService.clear(),this.projectService.setProjectBySlug(this.params.pslug).then(function(t){return function(){return t.projectService.isEpicsDashboardEnabled()?t.projectService.hasPermission("view_epics")?t.epicsService.fetchEpics():t.errorHandlingService.permissionDenied():t.errorHandlingService.notFound()}}(this))},t.prototype.canCreateEpics=function(){return this.projectService.hasPermission("add_epic")},t.prototype.onCreateEpic=function(){var t;return t=function(t){return function(){t.lightboxService.closeAll(),t.confirm.notify("success")}}(this),this.lightboxFactory.create("tg-create-epic",{"class":"lightbox lightbox-create-epic open","on-create-epic":"onCreateEpic()"},{onCreateEpic:t.bind(this)})},t}(),angular.module("taigaEpics").controller("EpicsDashboardCtrl",t)}.call(this),function(){var t;t=function(t,e){var r;return r=function(r,n,i){var o,s,a;if(e.hasPermission("modify_epic"))return o=t(i.tgEpicsSortable),s=dragula([n[0]],{copySortSource:!1,copy:!1,mirrorContainer:n[0],moves:function(t){return $(t).is("div.epics-table-body-row")}}),s.on("dragend",function(t){var e,n,i;return n=$(t),e=n.scope().epic,i=n.index(),r.$apply(function(){return o(r,{epic:e,newIndex:i})})}),a=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&s.dragging}}),r.$on("$destroy",function(){return n.off(),s.destroy()})},{link:r}},t.$inject=["$parse","tgProjectService"],angular.module("taigaComponents").directive("tgEpicsSortable",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t,r,n){this.confirm=t,this.epicsService=r,this.timeout=n,this.displayOptions=!1,this.displayVotes=!0,this.column={votes:!0,name:!0,project:!0,sprint:!0,assigned:!0,status:!0,progress:!0},e.defineImmutableProperty(this,"epics",function(t){return function(){return t.epicsService.epics}}(this)),e.defineImmutableProperty(this,"disabledEpicsPagination",function(t){return function(){return t.epicsService._disablePagination}}(this)),e.defineImmutableProperty(this,"loadingEpics",function(t){return function(){return t.epicsService._loadingEpics}}(this))}return t.$inject=["$tgConfirm","tgEpicsService","$timeout"],t.prototype.toggleEpicTableOptions=function(){return this.displayOptions=!this.displayOptions},t.prototype.reorderEpic=function(t,e){return this.epicsService.reorderEpic(t,e).then(null,function(t){return function(){return t.confirm.notify("error")}}(this))},t.prototype.nextPage=function(){return this.epicsService.nextPage()},t.prototype.hoverEpicTableOption=function(){if(this.timer)return this.timeout.cancel(this.timer)},t.prototype.hideEpicTableOption=function(){return this.timer=this.timeout(function(t){return function(){return t.displayOptions=!1}}(this),400)},t}(),angular.module("taigaEpics").controller("EpicsTableCtrl",t)}.call(this),function(){var t;t=function(){return{templateUrl:"epics/dashboard/epics-table/epics-table.html",controller:"EpicsTableCtrl",controllerAs:"vm",scope:{}}},angular.module("taigaEpics").directive("tgEpicsTable",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){function t(){this._calculateProgressBar()}return t.$inject=[],t.prototype._calculateProgressBar=function(){var t,e;return this.story.get("is_closed")===!0?this.percentage="100%":(t=this.story.get("tasks").size,e=this.story.get("tasks").filter(function(t){return t.get("is_closed")}).size,0===t?this.percentage="0%":this.percentage=100*e/t+"%")},t}(),e.controller("StoryRowCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){return{templateUrl:"epics/dashboard/story-row/story-row.html",controller:"StoryRowCtrl",controllerAs:"vm",bindToController:!0,scope:{story:"=",column:"="}}},e.directive("tgStoryRow",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t,r,n,i){this.projectService=t,this.attachmentsService=r,this.resources=n,this.xhrError=i,this.clear(),e.defineImmutableProperty(this,"epics",function(t){return function(){return t._epics}}(this))}return t.$inject=["tgProjectService","tgAttachmentsService","tgResources","tgXhrErrorService"],t.prototype.clear=function(){return this._loadingEpics=!1,this._disablePagination=!1,this._page=1,this._epics=Immutable.List()},t.prototype.fetchEpics=function(t){return null==t&&(t=!1),this._loadingEpics=!0,this._disablePagination=!0,this.resources.epics.list(this.projectService.project.get("id"),this._page).then(function(e){return function(r){return t?(e.clear(),e._epics=r.list):e._epics=e._epics.concat(r.list),e._loadingEpics=!1,e._disablePagination=!r.headers("x-pagination-next")}}(this))["catch"](function(t){return function(e){return t.xhrError.response(e)}}(this))},t.prototype.nextPage=function(){return this._page++,this.fetchEpics()},t.prototype.listRelatedUserStories=function(t){return this.resources.userstories.listInEpic(t.get("id"))},t.prototype.createEpic=function(t,e){return t.project=this.projectService.project.get("id"),this.resources.epics.post(t).then(function(t){return function(r){var n;return n=_.map(e.toJS(),function(e){return t.attachmentsService.upload(e.file,r.get("id"),r.get("project"),"epic")}),Promise.all(n).then(t.fetchEpics.bind(t,!0))}}(this))},t.prototype.reorderEpic=function(t,e){var r,n,i,o,s,a,u;return u=this.epics.filter(function(e){return function(e){return e.get("id")!==t.get("id")}}(this)),r=u.slice(0,e),o=r.last(),i=o?o.get("epics_order")+1:0,s=r.filter(function(t){return function(t){return t.get("epics_order")===o.get("epics_order")}}(this)),a=_.fromPairs(s.map(function(t){return function(t){return[t.get("id"),t.get("epics_order")]}}(this)).toJS()),n={epics_order:i,version:t.get("version")},this.resources.epics.reorder(t.get("id"),n,a)},t.prototype.reorderRelatedUserstory=function(t,e,r,n){var i,o,s,a,u,c,l,p,f;return f=e.filter(function(t){return function(t){return t.get("id")!==r.get("id")}}(this)),i=f.slice(0,n),u=i.last(),a=u?u.get("epic_order")+1:0,c=i.filter(function(t){return function(t){return t.get("epic_order")===u.get("epic_order")}}(this)),l=_.fromPairs(c.map(function(t){return function(t){return[t.get("id"),t.get("epic_order")]}}(this)).toJS()),o={order:a},s=t.get("id"),p=r.get("id"),this.resources.epics.reorderRelatedUserstory(s,p,o,l).then(function(e){return function(){return e.listRelatedUserStories(t)}}(this))},t.prototype.replaceEpic=function(t){return this._epics=this._epics.map(function(e){return e.get("id")===t.get("id")?t:e})},t.prototype.updateEpicStatus=function(t,e){var r;return r={status:e,version:t.get("version")},this.resources.epics.patch(t.get("id"),r).then(this.replaceEpic.bind(this))},t.prototype.updateEpicAssignedTo=function(t,e){var r;return r={assigned_to:e,version:t.get("version")},this.resources.epics.patch(t.get("id"),r).then(this.replaceEpic.bind(this))},t}(),angular.module("taigaEpics").service("tgEpicsService",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){function t(t,e){this.projectService=t,this.epicsService=e,this.sectionName="Epics",this.showCreateRelatedUserstoriesLightbox=!1}return t.$inject=["tgProjectService","tgEpicsService"],t.prototype.showRelatedUserStoriesSection=function(){var t;return this.projectService.hasPermission("modify_epic")||(null!=(t=this.userstories)?t.legth:void 0)>0},t.prototype.userCanSort=function(){return this.projectService.hasPermission("modify_epic")},t.prototype.loadRelatedUserstories=function(){return this.epicsService.listRelatedUserStories(this.epic).then(function(t){return function(e){return t.userstories=e}}(this))},t.prototype.reorderRelatedUserstory=function(t,e){return this.epicsService.reorderRelatedUserstory(this.epic,this.userstories,t,e).then(function(t){return function(e){return t.userstories=e}}(this))},t}(),e.controller("RelatedUserStoriesCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){function t(t,e,r,n){this.currentUserService=t,this.rs=e,this.confirm=r,this.analytics=n,this.projects=this.currentUserService.projects.get("all"),this.projectUserstories=Immutable.List(),this.loading=!1}return t.$inject=["tgCurrentUserService","tgResources","$tgConfirm","$tgAnalytics"],t.prototype.selectProject=function(t,e){return this.rs.userstories.listAllInProject(t).then(function(t){return function(r){var n,i;if(n=t.epicUserstories.map(function(t){return t.get("id")}),i=r.filter(function(t){return n.indexOf(t.get("id"))===-1}),t.projectUserstories=i,e)return e()}}(this))},t.prototype.saveRelatedUserStory=function(t,e){var r,n,i;if(this.validateExistingUserstoryForm())return this.loading=!0,n=function(t){return function(e){return t.loading=!1,t.confirm.notify("error"),t.setExistingUserstoryFormErrors(e)}}(this),i=function(t){return function(){return t.analytics.trackEvent("epic related user story","create","create related user story on epic",1),t.loading=!1,e&&e(),t.loadRelatedUserstories()}}(this),r=this.epic.get("id"),this.rs.epics.addRelatedUserstory(r,t).then(i,n)},t.prototype.bulkCreateRelatedUserStories=function(t,e,r){var n,i,o;if(this.validateNewUserstoryForm())return this.loading=!0,i=function(t){return function(e){return t.loading=!1,t.confirm.notify("error"),t.setNewUserstoryFormErrors(e)}}(this),o=function(t){return function(){return t.analytics.trackEvent("epic related user story","create","create related user story on epic",1),t.loading=!1,r&&r(),t.loadRelatedUserstories()}}(this),n=this.epic.get("id"),this.rs.epics.bulkCreateRelatedUserStories(n,t,e).then(o,i)},t}(),e.controller("RelatedUserstoriesCreateCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(t){var e;return this.lightboxService=t,e=function(t,e,r,n){var i,o;return o=e.find(".new-user-story-form").checksley(),i=e.find(".existing-user-story-form").checksley(),n.validateNewUserstoryForm=function(t){return function(){return o.validate()}}(this),n.setNewUserstoryFormErrors=function(t){return function(t){return o.setErrors(t)}}(this),n.validateExistingUserstoryForm=function(t){return function(){return i.validate()}}(this),n.setExistingUserstoryFormErrors=function(t){return function(t){return i.setErrors(t)}}(this),t.showLightbox=function(r){return t.selectProject(r).then(function(t){return function(){return lightboxService.open(e.find(".lightbox-create-related-user-stories"))}}(this))},t.closeLightbox=function(){return t.selectedUserstory=null,t.searchUserstory="",t.relatedUserstoriesText="",lightboxService.close(e.find(".lightbox-create-related-user-stories"))},t.$watch("vm.project",function(e){if(null!=e)return t.selectedProject=e.get("id")}),t.selectProject=function(e){return t.selectedUserstory=null,t.searchUserstory="",n.selectProject(e)},t.onUpdateSearchUserstory=function(){return t.selectedUserstory=null}},{link:e,templateUrl:"epics/related-userstories/related-userstories-create/related-userstories-create.html",controller:"RelatedUserstoriesCreateCtrl",controllerAs:"vm",bindToController:!0,scope:{showCreateRelatedUserstoriesLightbox:"=",project:"=",epic:"=",epicUserstories:"=",loadRelatedUserstories:"&"}}},t.$inject=["lightboxService"],e.directive("tgRelatedUserstoriesCreate",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(t,e){var r;return r=function(r,n,i){var o,s,a;if(e.hasPermission("modify_epic"))return o=t(i.tgRelatedUserstoriesSortable),s=dragula([n[0]],{copySortSource:!1,copy:!1,mirrorContainer:n[0],moves:function(t){return $(t).is("tg-related-userstory-row")}}),s.on("dragend",function(t){var e,n,i;return e=$(t),i=e.scope().us,n=e.index(),r.$apply(function(){return o(r,{us:i,newIndex:n})})}),a=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&s.dragging}}),r.$on("$destroy",function(){return n.off(),s.destroy()})},{link:r}},t.$inject=["$parse","tgProjectService"],e.directive("tgRelatedUserstoriesSortable",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){return{templateUrl:"epics/related-userstories/related-userstories.html",controller:"RelatedUserStoriesCtrl",controllerAs:"vm",bindToController:!0,scope:{userstories:"=",project:"=",epic:"="}}},t.$inject=[],e.directive("tgRelatedUserstories",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){function t(t,e,r,n){this.avatarService=t,this.translate=e,this.confirm=r,this.rs=n}return t.$inject=["tgAvatarService","$translate","$tgConfirm","tgResources"],t.prototype.setAvatarData=function(){var t;return t=this.userstory.get("assigned_to_extra_info"),this.avatar=this.avatarService.getAvatar(t)},t.prototype.getAssignedToFullNameDisplay=function(){return this.userstory.get("assigned_to")?this.userstory.getIn(["assigned_to_extra_info","full_name_display"]):this.translate.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED")},t.prototype.onDeleteRelatedUserstory=function(){var t,e;return e=this.translate.instant("EPIC.TITLE_LIGHTBOX_UNLINK_RELATED_USERSTORY"),t=this.translate.instant("EPIC.MSG_LIGHTBOX_UNLINK_RELATED_USERSTORY",{subject:this.userstory.get("subject")}),this.confirm.askOnDelete(e,t).then(function(e){return function(r){var n,i,o,s;return i=function(){return t=e.translate.instant("EPIC.ERROR_UNLINK_RELATED_USERSTORY",{errorMessage:t}),e.confirm.notify("error",null,t),r.finish(!1)},o=function(){return e.loadRelatedUserstories(),r.finish()},n=e.epic.get("id"),s=e.userstory.get("id"),e.rs.epics.deleteRelatedUserstory(n,s).then(o,i)}}(this))},t}(),e.controller("RelatedUserstoryRowCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaEpics"),t=function(){var t;return t=function(t,e,r,n){return n.setAvatarData()},{link:t,templateUrl:"epics/related-userstories/related-userstory-row/related-userstory-row.html",controller:"RelatedUserstoryRowCtrl",controllerAs:"vm",bindToController:!0,scope:{userstory:"=",epic:"=",project:"=",loadRelatedUserstories:"&"}}},t.$inject=[],e.directive("tgRelatedUserstoryRow",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,e;e=angular.module("taigaHistory"),t=function(){function t(t,e,r){this.currentUserService=t,this.permissionService=e,this.lightboxFactory=r,this.hiddenDeletedComment=!0,this.commentContent=angular.copy(this.comment)}return t.$inject=["tgCurrentUserService","tgCheckPermissionsService","tgLightboxFactory"],t.prototype.showDeletedComment=function(){return this.hiddenDeletedComment=!1},t.prototype.hideDeletedComment=function(){return this.hiddenDeletedComment=!0},t.prototype.checkCancelComment=function(t){if(27===t.keyCode)return this.onEditMode({commentId:this.comment.id})},t.prototype.canEditDeleteComment=function(){if(this.currentUserService.getUser())return this.user=this.currentUserService.getUser(),this.user.get("id")===this.comment.user.pk||this.permissionService.check("modify_project")},t.prototype.displayCommentHistory=function(){return this.lightboxFactory.create("tg-lb-display-historic",{"class":"lightbox lightbox-display-historic",comment:"comment",name:"name",object:"object"},{comment:this.comment,name:this.name,object:this.object})},t}(),e.controller("CommentCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){return{scope:{name:"@",object:"@",comment:"<",type:"<",loading:"<",editing:"<",deleting:"<",objectId:"<",editMode:"<",onEditMode:"&",onDeleteComment:"&",onRestoreDeletedComment:"&",onEditComment:"&"},templateUrl:"history/comments/comment.html",bindToController:!0,controller:"CommentCtrl",controllerAs:"vm"}},e.directive("tgComment",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){function t(){}return t.$inject=[],t.prototype.initializePermissions=function(){return this.canAddCommentPermission="comment_"+this.name},t}(),e.controller("CommentsCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){var t;return t=function(t,e,r,n){return n.initializePermissions()},{scope:{type:"<",name:"@",object:"@",comments:"<",onEditMode:"&",onDeleteComment:"&",onRestoreDeletedComment:"&",onAddComment:"&",onEditComment:"&",editMode:"<",loading:"<",deleting:"<",editing:"<",projectId:"="},templateUrl:"history/comments/comments.html",bindToController:!0,controller:"CommentsCtrl",controllerAs:"vm",link:t}},e.directive("tgComments",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){function t(t){this.rs=t}return t.$inject=["$tgResources"],t.prototype._loadHistoric=function(){var t,e,r;return r=this.name,e=this.object,t=this.comment.id,this.rs.history.getCommentHistory(r,e,t).then(function(t){return function(e){return t.commentHistoryEntries=e}}(this))},t}(),e.controller("LightboxDisplayHistoricCtrl",t)}.call(this),function(){var t;t=function(t){var e;return e=function(e,r,n,i){return i._loadHistoric(),t.open(r)},{scope:{},bindToController:{name:"=",object:"=",comment:"="},templateUrl:"history/history-lightbox/comment-history-lightbox.html",controller:"LightboxDisplayHistoricCtrl",controllerAs:"vm",link:e}},t.$inject=["lightboxService"],angular.module("taigaHistory").directive("tgLbDisplayHistoric",t)}.call(this),function(){var t;t=function(){return{scope:{entry:"<"},templateUrl:"history/history-lightbox/history-entry.html"}},angular.module("taigaHistory").directive("tgHistoryEntry",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){return{templateUrl:"history/history-tabs/history-tabs.html",scope:{showCommentTab:"&",showActivityTab:"&",onActiveComments:"&",onActiveActivities:"&",onOrderComments:"&",activeTab:"<",commentsNum:"<",activitiesNum:"<",onReverse:"<"}}},e.directive("tgHistoryTabs",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){function t(t,e,r,n){this.rs=t,this.repo=e,this.storage=r,this.projectService=n,this.editing=null,this.deleting=null,this.editMode={},this.viewComments=!0,this._loadHistory(),this.reverse=this.storage.get("orderComments")}return t.$inject=["$tgResources","$tgRepo","$tgStorage","tgProjectService"],t.prototype._loadHistory=function(){return this.rs.history.get(this.name,this.id).then(function(t){return function(e){return t._getComments(e),t._getActivities(e)}}(this))},t.prototype._getComments=function(t){return this.comments=_.filter(t,function(t){return""!==t.comment}),this.reverse&&this.comments-_.reverse(this.comments),this.commentsNum=this.comments.length},t.prototype._getActivities=function(t){return this.activities=_.filter(t,function(t){return Object.keys(t.values_diff).length>0}),this.activitiesNum=this.activities.length},t.prototype.showHistorySection=function(){return this.showCommentTab()||this.showActivityTab()},t.prototype.showCommentTab=function(){return this.commentsNum>0||this.projectService.hasPermission("comment_"+this.name)},t.prototype.showActivityTab=function(){return this.activitiesNum>0},t.prototype.toggleEditMode=function(t){return this.editMode[t]=!this.editMode[t]},t.prototype.onActiveHistoryTab=function(t){return this.viewComments=t},t.prototype.deleteComment=function(t){var e,r,n;return n=this.name,r=this.id,e=t,this.deleting=t,this.rs.history.deleteComment(n,r,e).then(function(e){return function(){return e._loadHistory(),e.deleting=t}}(this))},t.prototype.editComment=function(t,e){var r,n,i;return i=this.name,n=this.id,r=t,this.editing=t,this.rs.history.editComment(i,n,r,e).then(function(e){return function(){return e._loadHistory(),e.toggleEditMode(t),e.editing=null}}(this))},t.prototype.restoreDeletedComment=function(t){var e,r,n;return n=this.name,r=this.id,e=t,this.editing=t,this.rs.history.undeleteComment(n,r,e).then(function(t){return function(){return t._loadHistory(),t.editing=null}}(this))},t.prototype.addComment=function(){var t;return t=this.type,this.loading=!0,this.repo.save(this.type).then(function(t){return function(){return t._loadHistory(),t.loading=!1}}(this))},t.prototype.onOrderComments=function(){return this.reverse=!this.reverse,this.storage.set("orderComments",this.reverse),this._loadHistory()},t}(),e.controller("HistorySection",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){var t;return t=function(t,e,r,n){return t.$on("object:updated",function(){return n._loadHistory(t.type,t.id)})},{link:t,templateUrl:"history/history.html",controller:"HistorySection",controllerAs:"vm",bindToController:!0,scope:{type:"=",name:"@",id:"=",projectId:"="}}},t.$inject=[],e.directive("tgHistorySection",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){function t(){}return t.$inject=[],t.prototype.diffTags=function(){if("tags"===this.type)return this.diffRemoveTags=_.difference(this.diff[0],this.diff[1]).toString(),this.diffAddTags=_.difference(this.diff[1],this.diff[0]).toString()},t}(),e.controller("ActivitiesDiffCtrl",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){var t;return t=function(t,e,r,n){return n.diffTags()},{scope:{type:"<",diff:"<"},templateUrl:"history/history/history-diff.html",controller:"ActivitiesDiffCtrl",controllerAs:"vm",bindToController:!0,link:t}},e.directive("tgHistoryDiff",t)}.call(this),function(){var t,e;e=angular.module("taigaHistory"),t=function(){var t;return t=function(t,e,r){},{scope:{activities:"<"},templateUrl:"history/history/history.html",link:t}},e.directive("tgHistory",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.type=t.type,t.vm.getDutyType=function(){if(t.vm.duty){if("epics"===t.vm.duty.get("_name"))return e.instant("COMMON.EPIC");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",type:"@"},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("project",o),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("epics")&&(n=i(o.get("epics"),"epics"),o=o.set("epics",n)),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("epics")&&(n=i(s.get("epics"),"epics"),s=s.set("epics",n)),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,f,d,h,g,m,v;return l=Immutable.Map(),p=this.projectsService.getProjectsByUserId(t).then(function(t){return l=Immutable.fromJS(e(t.toJS(),function(t){return t.id}))}),o=Immutable.Map(),a={status__is_closed:!1,assigned_to:t},c={is_closed:!1,assigned_to:t},u={is_closed:!1,assigned_to:t},r=this.rs.epics.listInAllProjects(u).then(function(t){return o=o.set("epics",t)}),s=this.rs.userstories.listInAllProjects(c).then(function(t){return o=o.set("userStories",t)}),i=this.rs.tasks.listInAllProjects(a).then(function(t){return o=o.set("tasks",t)}),n=this.rs.issues.listInAllProjects(a).then(function(t){return o=o.set("issues",t)}),a={status__is_closed:!1,watchers:t},c={is_closed:!1,watchers:t},u={is_closed:!1,watchers:t},f=Immutable.Map(),d=this.rs.epics.listInAllProjects(u).then(function(t){return f=f.set("epics",t)}),m=this.rs.userstories.listInAllProjects(c).then(function(t){return f=f.set("userStories",t)}),g=this.rs.tasks.listInAllProjects(a).then(function(t){return f=f.set("tasks",t)}),h=this.rs.issues.listInAllProjects(a).then(function(t){return f=f.set("issues",t)}),v=Immutable.Map(),Promise.all([p,r,d,s,m,i,g,n,h]).then(function(t){return function(){return v=v.set("assignedTo",o),v=v.set("watching",f),v=t._attachProjectInfoToWorkInProgress(v,l)}}(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,i;if(e=t.get("assignedTo").get("epics"),i=t.get("assignedTo").get("userStories"),n=t.get("assignedTo").get("tasks"),r=t.get("assignedTo").get("issues"),this.assignedTo=i.concat(n).concat(r).concat(e),this.assignedTo.size>0)return this.assignedTo=this.assignedTo.sortBy(function(t){return t.get("modified_date")}).reverse()},t.prototype._setWatching=function(t){var e,r,n,i;if(e=t.get("watching").get("epics"),i=t.get("watching").get("userStories"),n=t.get("watching").get("tasks"),r=t.get("watching").get("issues"),this.watching=i.concat(n).concat(r).concat(e),this.watching.size>0)return this.watching=this.watching.sortBy(function(t){return t.get("modified_date")}).reverse()},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;if(o=e.getUser())return s=o.get("id"),i.getWorkInProgress(s)},{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.enableFilterByEpics=!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(){if(null!==this.type)return this.type=null,this._resetList(),this.loadItems()},t.prototype.showProjectsOnly=function(){if("project"!==this.type)return this.type="project",this._resetList(),this.loadItems()},t.prototype.showEpicsOnly=function(){if("epic"!==this.type)return this.type="epic",this._resetList(),this.loadItems()},t.prototype.showUserStoriesOnly=function(){if("userstory"!==this.type)return this.type="userstory",this._resetList(),this.loadItems()},t.prototype.showTasksOnly=function(){if("task"!==this.type)return this.type="task",this._resetList(),this.loadItems()},t.prototype.showIssuesOnly=function(){if("issue"!==this.type)return this.type="issue",this._resetList(),this.loadItems()},t}(),e=function(t){function e(t){this.userService=t,e.__super__.constructor.call(this),this.tabName="likes",this.enableFilterByAll=!1,this.enableFilterByProjects=!1,this.enableFilterByEpics=!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.tabName="upvotes",this.enableFilterByAll=!0,this.enableFilterByProjects=!1,this.enableFilterByEpics=!0,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.tabName="watchers",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){if(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)return n.addTab(t.tab)},{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;if(r=this._getProjectIndex(t),r!==-1)return 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)},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;nf?(d={status:413,data:{_error_message:"'"+c.name+"' ("+r(c.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+r(f)+")"}},p.reject(d),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),g=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&&n<400?(e=Immutable.fromJS(e),p.resolve(e)):(d={status:n,data:{_error_message:null!=(r=l.attached_file)?r[0]:void 0}},p.reject(d))})}}(this),m=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",g,!1),b.addEventListener("error",m,!1),h=s.get("token"),b.open("POST",y),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.listInAllProjects=function(r){var n,i;return i=t.resolve("epics"),n={headers:{"x-disable-pagination":"1"}},e.get(i,r,n).then(function(t){return Immutable.fromJS(t.data)})},r.list=function(r,n){var i,o;return null==n&&(n=0),o=t.resolve("epics"),i={project:r,page:n},e.get(o,i).then(function(t){return{list:Immutable.fromJS(t.data),headers:t.headers}})},r.patch=function(r,n){var i;return i=t.resolve("epics")+("/"+r),e.patch(i,n).then(function(t){return Immutable.fromJS(t.data)})},r.post=function(r){var n;return n=t.resolve("epics"),e.post(n,r).then(function(t){return Immutable.fromJS(t.data)})},r.reorder=function(r,n,i){var o,s;return s=t.resolve("epics")+("/"+r),o={headers:{"set-orders":JSON.stringify(i)}},e.patch(s,n,null,o).then(function(t){return Immutable.fromJS(t.data)})},r.addRelatedUserstory=function(r,n){var i,o;return o=t.resolve("epic-related-userstories",r),i={user_story:n,epic:r},e.post(o,i)},r.reorderRelatedUserstory=function(r,n,i,o){var s,a;return a=t.resolve("epic-related-userstories",r)+("/"+n),s={headers:{"set-orders":JSON.stringify(o)}},e.patch(a,i,null,s)},r.bulkCreateRelatedUserStories=function(r,n,i){var o,s;return s=t.resolve("epic-related-userstories-bulk-create",r),o={bulk_userstories:i,project_id:n},e.post(s,o)},r.deleteRelatedUserstory=function(r,n){var i;return i=t.resolve("epic-related-userstories",r)+("/"+n),e["delete"](i)},function(){return{epics:r}}},t.$inject=["$tgUrls","$tgHttp"],e=angular.module("taigaResources2"),e.factory("tgEpicsResource",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:"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","tgWikiHistory","tgEpicsResource"],t=function(t){var r,n,i,o,s,a,u,c,l;for(r=0,i=e.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){if(e)return t.setAll(e.title,e.description),t._listener()}}(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)},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=function(t,e){return(+t%(e=+e)+e)%e};t=function(){function t(t){var e,r;this.config=t,r=["/"+window._version+"/images/user-avatars/user-avatar-01.png","/"+window._version+"/images/user-avatars/user-avatar-02.png","/"+window._version+"/images/user-avatars/user-avatar-03.png","/"+window._version+"/images/user-avatars/user-avatar-04.png","/"+window._version+"/images/user-avatars/user-avatar-05.png"],e=["rgba( 178, 176, 204, 1 )","rgba( 183, 203, 131, 1 )","rgba( 210, 198, 139, 1 )","rgba( 214, 161, 212, 1 )","rgba( 247, 154, 154, 1 )"],this.logos=_.cartesianProduct(r,e)}return t.prototype.getDefault=function(t){var r,n;return r=e(murmurhash3_32_gc(t,42),this.logos.length),n=this.logos[r],{src:n[0],color:n[1]}},t.prototype.getUnnamed=function(){return{url:"/"+window._version+"/images/unnamed.png"}},t.prototype.getAvatar=function(t,e){var r,n,i,o,s,a;return t?(r="photo","avatarBig"===e&&(r="big_photo"),s=null,t instanceof Immutable.Map?(n=t.get("gravatar_id"),s=t.get(r)):(n=t.gravatar_id,s=t[r]),n?s?{url:s}:location.host.indexOf("localhost")===-1&&this.config.get("gravatar",!0)?(a=location.protocol+"//"+location.host,i=this.getDefault(n),o=encodeURIComponent(a+i.src),{url:"https://www.gravatar.com/avatar/"+n+"?d="+o,bg:i.color}):(a=location.protocol+"//"+location.host,i=this.getDefault(n),{url:a+i.src,bg:i.color}):this.getUnnamed()):this.getUnnamed()},t}(),angular.module("taigaCommon").service("tgAvatarService",["$tgConfig",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&&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()},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,e;e=this.taiga,t=function(){function t(t){this.rootScope=t}return t.$inject=["$rootScope"],t.prototype.init=function(){return this.rootScope.errorHandling={}},t.prototype.notfound=function(){return this.rootScope.errorHandling.showingError=!0,this.rootScope.errorHandling.notfound=!0},t.prototype.error=function(){return this.rootScope.errorHandling.showingError=!0,this.rootScope.errorHandling.error=!0},t.prototype.permissionDenied=function(){return this.rootScope.errorHandling.showingError=!0,this.rootScope.errorHandling.permissionDenied=!0},t.prototype.block=function(){return this.rootScope.errorHandling.showingError=!0,this.rootScope.errorHandling.blocked=!0},t}(),angular.module("taigaCommon").service("tgErrorHandlingService",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=$("").attr(t,!0).attr("tg-bind-scope",!0),e&&n.attr(e),n.addClass("remove-on-close"),i=this.compile(n)(o),$(document.body).append(i)},t}(),angular.module("taigaCommon").service("tgLightboxFactory",t)}.call(this),function(){var t;t=function(){return function(t){var e;return e=Immutable.Map({data:t.get("data"),next:!!t.get("headers")("x-pagination-next"),prev:!!t.get("headers")("x-pagination-prev"),current:t.get("headers")("x-pagination-current"),count:t.get("headers")("x-pagination-count")})}},angular.module("taigaCommon").factory("tgPaginateResponseService",t)}.call(this),function(){var t,e=function(t,e){return(+t%(e=+e)+e)%e};t=function(){function t(){var t,e;e=["/"+window._version+"/images/project-logos/project-logo-01.png","/"+window._version+"/images/project-logos/project-logo-02.png","/"+window._version+"/images/project-logos/project-logo-03.png","/"+window._version+"/images/project-logos/project-logo-04.png","/"+window._version+"/images/project-logos/project-logo-05.png"],t=["rgba( 153, 214, 220, 1 )","rgba( 213, 156, 156, 1 )","rgba( 214, 161, 212, 1 )","rgba( 164, 162, 219, 1 )","rgba( 152, 224, 168, 1 )"],this.logos=_.cartesianProduct(e,t)}return t.prototype.getDefaultProjectLogo=function(t,r){var n,i,o;return i=t+"-"+r,n=e(murmurhash3_32_gc(i,42),this.logos.length),o=this.logos[n],{src:o[0],color:o[1]}},t}(),angular.module("taigaCommon").service("tgProjectLogoService",t)}.call(this),function(){var t,e;e=this.taiga,t=function(){function t(t,r){this.projectsService=t,this.xhrError=r,this._project=null,this._section=null,this._sectionsBreadcrumb=Immutable.List(),this._activeMembers=Immutable.List(),e.defineImmutableProperty(this,"project",function(t){return function(){return t._project}}(this)),e.defineImmutableProperty(this,"section",function(t){return function(){return t._section}}(this)),e.defineImmutableProperty(this,"sectionsBreadcrumb",function(t){return function(){return t._sectionsBreadcrumb}}(this)),e.defineImmutableProperty(this,"activeMembers",function(t){return function(){return t._activeMembers}}(this))}return t.$inject=["tgProjectsService","tgXhrErrorService"],t.prototype.cleanProject=function(){return this._project=null,this._activeMembers=Immutable.List(),this._section=null,this._sectionsBreadcrumb=Immutable.List()},t.prototype.setSection=function(t){return this._section=t,t?this._sectionsBreadcrumb=this._sectionsBreadcrumb.push(this._section):this._sectionsBreadcrumb=Immutable.List()},t.prototype.setProject=function(t){return this._project=t,this._activeMembers=this._project.get("members").filter(function(t){return t.get("is_active")})},t.prototype.setProjectBySlug=function(t){return new Promise(function(e){return function(r,n){return e.project&&e.project.get("slug")===t?r():e.projectsService.getProjectBySlug(t).then(function(t){return e.setProject(t),r()})["catch"](function(t){return e.xhrError.response(t)})}}(this))},t.prototype.fetchProject=function(){var t;return t=this.project.get("slug"),this.projectsService.getProjectBySlug(t).then(function(t){return function(e){return t.setProject(e)}}(this))},t.prototype.hasPermission=function(t){return this._project.get("my_permissions").indexOf(t)!==-1},t.prototype.isEpicsDashboardEnabled=function(){return this._project.get("is_epics_activated")},t}(),angular.module("taigaCommon").service("tgProjectService",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(){return e.__super__.constructor.apply(this,arguments)}return r(e,t),e}(e.Service=function(){return{use:function(t){var e;return e=$("link[rel='stylesheet']:first"),0===e.length&&(e=$("
"),$("head").append(e)),e.attr("href","/"+window._version+"/styles/theme-"+t+".css")}}}),angular.module("taigaCommon").service("tgThemeService",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=r.bindMethods,t=function(t){function r(t){this.rs=t,e(this)}return n(r,t),r.$inject=["tgResources"],r.prototype.getUserByUserName=function(t){return this.rs.users.getUserByUsername(t)},r.prototype.getContacts=function(t){return this.rs.users.getContacts(t)},r.prototype.getLiked=function(t,e,r,n){return this.rs.users.getLiked(t,e,r,n)},r.prototype.getVoted=function(t,e,r,n){return this.rs.users.getVoted(t,e,r,n)},r.prototype.getWatched=function(t,e,r,n){return this.rs.users.getWatched(t,e,r,n)},r.prototype.getStats=function(t){return this.rs.users.getStats(t)},r.prototype.attachUserContactsToProjects=function(t,e){return this.getContacts(t).then(function(t){return e=e.map(function(e){var r;return r=t.filter(function(t){var r;return r=t.get("id"),e.get("members").indexOf(r)!==-1}),e=e.set("contacts",r)})})},r}(r.Service),angular.module("taigaCommon").service("tgUserService",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.q=t,this.errorHandlingService=e}return e(r,t),r.$inject=["$q","tgErrorHandlingService"],r.prototype.notFound=function(){return this.errorHandlingService.notfound()},r.prototype.permissionDenied=function(){return this.errorHandlingService.permissionDenied()},r.prototype.response=function(t){return t&&(404===t.status?this.notFound():403===t.status&&this.permissionDenied()),this.q.reject(t)},r}(taiga.Service),angular.module("taigaCommon").service("tgXhrErrorService",t)}.call(this),function(){var t;t=function(t,e){var r,n,i;return i=[".jpg",".jpeg",".bmp",".gif",".png"],r=function(t){return t=t.toLowerCase(),_.some(i,function(e){return t.indexOf(e,t-e.length)!==-1})},n=function(n,i){var o,s;return o=r(n.attachment.get("url")),s=o?t.get("user-timeline/user-timeline-attachment/user-timeline-attachment-image.html"):t.get("user-timeline/user-timeline-attachment/user-timeline-attachment.html"),i.html(s),e(i.contents())(n),i.find("img").error(function(){return this.remove()})},{link:n,scope:{attachment:"=tgUserTimelineAttachment"}}},t.$inject=["$tgTemplate","$compile"],angular.module("taigaUserTimeline").directive("tgUserTimelineAttachment",t)}.call(this),function(){var t,e;e=this.taiga.unslugify,t=function(){function t(t,e){this.translate=t,this.sce=e}return t.$inject=["$translate","$sce"],t.prototype._fieldTranslationKey={status:"COMMON.FIELDS.STATUS",subject:"COMMON.FIELDS.SUBJECT",description_diff:"COMMON.FIELDS.DESCRIPTION",points:"COMMON.FIELDS.POINTS",assigned_to:"COMMON.FIELDS.ASSIGNED_TO",severity:"ISSUES.FIELDS.SEVERITY",priority:"ISSUES.FIELDS.PRIORITY",type:"ISSUES.FIELDS.TYPE",is_iocaine:"TASK.FIELDS.IS_IOCAINE",is_blocked:"COMMON.FIELDS.IS_BLOCKED",color:"COMMON.FIELDS.COLOR"},t.prototype._params={username:function(t,e){var r,n,i;return i=t.getIn(["data","user"]),i.get("is_profile_visible")?(r=this.translate.instant("COMMON.SEE_USER_PROFILE",{username:i.get("username")}),n="user-profile:username=timeline.getIn(['data', 'user', 'username'])",this._getLink(n,i.get("name"),r)):this._getUsernameSpan(i.get("name"))},field_name:function(t,e){var r;return r=t.getIn(["data","value_diff","key"]),this.translate.instant(this._fieldTranslationKey[r])},project_name:function(t,e){var r;return r="project:project=timeline.getIn(['data', 'project', 'slug'])",this._getLink(r,t.getIn(["data","project","name"]))},new_value:function(t,e){var r,n;return _.isArray(t.getIn(["data","value_diff","value"]).toJS())?(n=t.getIn(["data","value_diff","value"]).get(1),null===n&&"assigned_to"===t.getIn(["data","value_diff","key"])&&(n=this.translate.instant("ACTIVITY.VALUES.UNASSIGNED")),r=n):r=t.getIn(["data","value_diff","value"]).first().get(1),_.escape(r)},sprint_name:function(t,e){var r;return r="project-taskboard:project=timeline.getIn(['data', 'project', 'slug']),sprint=timeline.getIn(['data', 'milestone', 'slug'])",this._getLink(r,t.getIn(["data","milestone","name"]))},us_name:function(t,e){var r,n,i,o;return n=this._getTimelineObj(t,e).get("userstory"),r={obj:"parent_userstory"},o=this._getDetailObjUrl(r),i="#"+n.get("ref")+" "+n.get("subject"),this._getLink(o,i)},related_us_name:function(t,e){var r,n,i;return r=t.getIn(["data","userstory"]),i="project-userstories-detail:project=timeline.getIn(['data', 'userstory', 'project', 'slug']),ref=timeline.getIn(['data', 'userstory', 'ref'])",n="#"+r.get("ref")+" "+r.get("subject"),this._getLink(i,n)},epic_name:function(t,e){var r,n,i;return r=t.getIn(["data","epic"]),i="project-epics-detail:project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['data', 'epic', 'ref'])",n="#"+r.get("ref")+" "+r.get("subject"),this._getLink(i,n)},obj_name:function(t,r){var n,i,o;return n=this._getTimelineObj(t,r),o=this._getDetailObjUrl(r),i="wikipage"===r.obj?e(n.get("slug")):"milestone"===r.obj?n.get("name"):"#"+n.get("ref")+" "+n.get("subject"),this._getLink(o,i)},role_name:function(t,e){return _.escape(t.getIn(["data","value_diff","value"]).keySeq().first())}},t.prototype._translateTitleParams=function(t,e,r){return this._params[t].call(this,e,r)},t.prototype._getTimelineObj=function(t,e){return t.getIn(["data",e.obj])},t.prototype._getDetailObjUrl=function(t){var e;return e={issue:["project-issues-detail",":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])"],wikipage:["project-wiki-page",":project=timeline.getIn(['data', 'project', 'slug']),slug=timeline.getIn(['obj', 'slug'])"],task:["project-tasks-detail",":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])"],userstory:["project-userstories-detail",":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])"],parent_userstory:["project-userstories-detail",":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'userstory', 'ref'])"],milestone:["project-taskboard",":project=timeline.getIn(['data', 'project', 'slug']),sprint=timeline.getIn(['obj', 'slug'])"],epic:["project-epics-detail",":project=timeline.getIn(['data', 'project', 'slug']),ref=timeline.getIn(['obj', 'ref'])"]},e[t.obj][0]+e[t.obj][1]},t.prototype._getLink=function(t,e,r){var n;return r=r||e,n=$("
").attr("ng-non-bindable",!0).text(e),$("").attr("tg-nav",t).attr("title",r).append(n).prop("outerHTML")},t.prototype._getUsernameSpan=function(t){var e;return e=e||t,$("").addClass("username").text(t).prop("outerHTML")},t.prototype._getParams=function(t,e,r){var n;return n={},r.translate_params.forEach(function(r){return function(i){return n[i]=r._translateTitleParams(i,t,e)}}(this)),n},t.prototype.getTitle=function(t,e,r){var n,i,o;return n=this._getParams(t,e,r),i={},Object.keys(n).forEach(function(t){return i[t]="{{"+t+"}}"}),o=this.translate.instant(r.key,i),Object.keys(n).forEach(function(t){var e;return e="{{"+t+"}}",o=o.replace(new RegExp(e,"g"),n[t])}),o},t}(),angular.module("taigaUserTimeline").service("tgUserTimelineItemTitle",t)}.call(this),function(){var t,e;e=function(t,e){var r;return r=[{check:function(t,e){return"membership"===e.obj},key:"TIMELINE.NEW_MEMBER",translate_params:["project_name"],member:function(t){return Immutable.Map({user:t.getIn(["data","user"]),role:t.getIn(["data","role"])})}},{check:function(t,e){return"project"===e.obj&&"create"===e.type},key:"TIMELINE.NEW_PROJECT",translate_params:["username","project_name"],description:function(t){return t.getIn(["data","project","description"])}},{check:function(t,e){return"change"===e.type&&t.hasIn(["data","value_diff"])&&"attachments"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.UPLOAD_ATTACHMENT",translate_params:["username","obj_name"]},{check:function(t,e){return"userstory"===e.obj&&"create"===e.type},key:"TIMELINE.US_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"issue"===e.obj&&"create"===e.type},key:"TIMELINE.ISSUE_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"wikipage"===e.obj&&"create"===e.type},key:"TIMELINE.WIKI_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"task"===e.obj&&"create"===e.type&&!t.getIn(["data","task","userstory"])},key:"TIMELINE.TASK_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"task"===e.obj&&"create"===e.type&&t.getIn(["data","task","userstory"])},key:"TIMELINE.TASK_CREATED_WITH_US",translate_params:["username","project_name","obj_name","us_name"]},{check:function(t,e){return"milestone"===e.obj&&"create"===e.type},key:"TIMELINE.MILESTONE_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"epic"===e.obj&&"create"===e.type},key:"TIMELINE.EPIC_CREATED",translate_params:["username","project_name","obj_name"]},{check:function(t,e){return"relateduserstory"===e.obj&&"create"===e.type},key:"TIMELINE.EPIC_RELATED_USERSTORY_CREATED",translate_params:["username","project_name","related_us_name","epic_name"]},{check:function(t,e){return t.getIn(["data","comment"])&&"userstory"===e.obj},key:"TIMELINE.NEW_COMMENT_US",translate_params:["username","obj_name"],description:function(t){var e;return e=t.getIn(["data","comment_html"]),$($.parseHTML(e)).text()}},{check:function(t,e){return t.getIn(["data","comment"])&&"issue"===e.obj},key:"TIMELINE.NEW_COMMENT_ISSUE",translate_params:["username","obj_name"],description:function(t){var e;return e=t.getIn(["data","comment_html"]),$($.parseHTML(e)).text()}},{check:function(t,e){return t.getIn(["data","comment"])&&"task"===e.obj},key:"TIMELINE.NEW_COMMENT_TASK",translate_params:["username","obj_name"],description:function(t){var e;return e=t.getIn(["data","comment_html"]),$($.parseHTML(e)).text()}},{check:function(t,e){return t.getIn(["data","comment"])&&"epic"===e.obj},key:"TIMELINE.NEW_COMMENT_EPIC",translate_params:["username","obj_name"],description:function(t){var e;return e=t.getIn(["data","comment_html"]),$($.parseHTML(e)).text()}},{check:function(t,e){return t.hasIn(["data","value_diff"])&&"moveInBacklog"===t.getIn(["data","value_diff","key"])&&t.hasIn(["data","value_diff","value","backlog_order"])&&"change"===e.type},key:"TIMELINE.US_MOVED",translate_params:["username","obj_name"]},{check:function(t,e){return!(!t.hasIn(["data","value_diff"])||"moveInBacklog"!==t.getIn(["data","value_diff","key"])||"change"!==e.type||"userstory"!==e.obj)&&null===t.getIn(["data","value_diff","value","milestone"]).get(1)},key:"TIMELINE.US_REMOVED_FROM_MILESTONE",translate_params:["username","obj_name"]},{check:function(t,e){return t.hasIn(["data","value_diff"])&&"moveInBacklog"===t.getIn(["data","value_diff","key"])&&"change"===e.type&&"userstory"===e.obj},key:"TIMELINE.US_ADDED_MILESTONE",translate_params:["username","obj_name","sprint_name"]},{check:function(t,e){return!(!t.hasIn(["data","value_diff"])||"blocked"!==t.getIn(["data","value_diff","key"])||"change"!==e.type)&&t.getIn(["data","value_diff","value","is_blocked"]).get(1)===!0},key:"TIMELINE.BLOCKED",translate_params:["username","obj_name"],description:function(t){var e;return!!t.hasIn(["data","value_diff","value","blocked_note_html"])&&(e=t.getIn(["data","value_diff","value","blocked_note_html"]).get(1),$($.parseHTML(e)).text())}},{check:function(t,e){return!(!t.hasIn(["data","value_diff"])||"blocked"!==t.getIn(["data","value_diff","key"])||"change"!==e.type)&&t.getIn(["data","value_diff","value","is_blocked"]).get(1)===!1},key:"TIMELINE.UNBLOCKED",translate_params:["username","obj_name"]},{check:function(t,e){return"milestone"===e.obj&&"change"===e.type},key:"TIMELINE.MILESTONE_UPDATED",translate_params:["username","obj_name"]},{check:function(t,e){return"wikipage"===e.obj&&"change"===e.type},key:"TIMELINE.WIKI_UPDATED",translate_params:["username","obj_name"]},{check:function(t,e){return"userstory"===e.obj&&"change"===e.type&&t.hasIn(["data","value_diff"])&&"points"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.US_UPDATED_POINTS",translate_params:["username","field_name","obj_name","new_value","role_name"]},{check:function(t,e){return"userstory"===e.obj&&"change"===e.type&&t.hasIn(["data","value_diff"])&&"description_diff"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.US_UPDATED",translate_params:["username","field_name","obj_name"]},{check:function(t,e){return"userstory"===e.obj&&"change"===e.type},key:"TIMELINE.US_UPDATED_WITH_NEW_VALUE",translate_params:["username","field_name","obj_name","new_value"]},{check:function(t,e){return"issue"===e.obj&&"change"===e.type&&t.hasIn(["data","value_diff"])&&"description_diff"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.ISSUE_UPDATED",translate_params:["username","field_name","obj_name"]},{check:function(t,e){return"issue"===e.obj&&"change"===e.type},key:"TIMELINE.ISSUE_UPDATED_WITH_NEW_VALUE",translate_params:["username","field_name","obj_name","new_value"]},{check:function(t,e){return"task"===e.obj&&"change"===e.type&&!t.getIn(["data","task","userstory"])&&t.hasIn(["data","value_diff"])&&"description_diff"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.TASK_UPDATED",translate_params:["username","field_name","obj_name"]},{check:function(t,e){return"task"===e.obj&&"change"===e.type&&t.getIn(["data","task","userstory"])&&t.hasIn(["data","value_diff"])&&"description_diff"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.TASK_UPDATED_WITH_US",translate_params:["username","field_name","obj_name","us_name"]},{check:function(t,e){return"task"===e.obj&&"change"===e.type&&!t.getIn(["data","task","userstory"])},key:"TIMELINE.TASK_UPDATED_WITH_NEW_VALUE",translate_params:["username","field_name","obj_name","new_value"]},{check:function(t,e){return"task"===e.obj&&"change"===e.type&&t.getIn(["data","task","userstory"])},key:"TIMELINE.TASK_UPDATED_WITH_US_NEW_VALUE",
-translate_params:["username","field_name","obj_name","us_name","new_value"]},{check:function(t,e){return"epic"===e.obj&&"change"===e.type&&t.hasIn(["data","value_diff"])&&"description_diff"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.EPIC_UPDATED",translate_params:["username","field_name","obj_name"]},{check:function(t,e){return"epic"===e.obj&&"change"===e.type&&t.hasIn(["data","value_diff"])&&"color"===t.getIn(["data","value_diff","key"])},key:"TIMELINE.EPIC_UPDATED_WITH_NEW_COLOR",translate_params:["username","field_name","obj_name","new_value"]},{check:function(t,e){return"epic"===e.obj&&"change"===e.type},key:"TIMELINE.EPIC_UPDATED_WITH_NEW_VALUE",translate_params:["username","field_name","obj_name","new_value"]},{check:function(t,e){return"user"===e.obj&&"create"===e.type},key:"TIMELINE.NEW_USER",translate_params:["username"]}],_.find(r,function(r){return r.check(t,e)})},t=function(){function t(){}return t.prototype.getType=function(t,r){return e(t,r)},t}(),angular.module("taigaUserTimeline").service("tgUserTimelineItemType",t)}.call(this),function(){var t;t=function(){return{templateUrl:"user-timeline/user-timeline-item/user-timeline-item.html",scope:{timeline:"=tgUserTimelineItem"}}},angular.module("taigaUserTimeline").directive("tgUserTimelineItem",t)}.call(this),function(){var t;t=function(){var t;return t={},t.generate=function(t){var e,r,n,i;return i=1,r=Immutable.List(),t.minItems=t.minItems||20,n=function(){return r=Immutable.List(),e()},e=function(){return t.fetch(i).then(function(n){var o;return i++,o=n.get("data"),t.filter&&(o=t.filter(o)),t.map&&(o=o.map(t.map)),r=r.concat(o),r.size\n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: app.coffee\n */\n\n(function() {\n var configure, i18nInit, init, module, modules, pluginsModules, pluginsWithModule, taiga;\n\n this.taiga = taiga = {};\n\n this.taigaContribPlugins = this.taigaContribPlugins || window.taigaContribPlugins || [];\n\n taiga.generateHash = function(components) {\n if (components == null) {\n components = [];\n }\n components = _.map(components, function(x) {\n return JSON.stringify(x);\n });\n return hex_sha1(components.join(\":\"));\n };\n\n taiga.generateUniqueSessionIdentifier = function() {\n var date, randomNumber;\n date = (new Date()).getTime();\n randomNumber = Math.floor(Math.random() * 0x9000000);\n return taiga.generateHash([date, randomNumber]);\n };\n\n taiga.sessionId = taiga.generateUniqueSessionIdentifier();\n\n configure = function($routeProvider, $locationProvider, $httpProvider, $provide, $tgEventsProvider, $compileProvider, $translateProvider, $translatePartialLoaderProvider, $animateProvider) {\n var authHttpIntercept, blockingIntercept, decorators, defaultHeaders, loaderIntercept, originalWhen, preferedLangCode, userInfo, versionCheckHttpIntercept;\n $animateProvider.classNameFilter(/^(?:(?!ng-animate-disabled).)*$/);\n originalWhen = $routeProvider.when;\n $routeProvider.when = function(path, route) {\n route.resolve || (route.resolve = {});\n angular.extend(route.resolve, {\n languageLoad: [\n \"$q\", \"$translate\", function($q, $translate) {\n var deferred;\n deferred = $q.defer();\n $translate().then(function() {\n return deferred.resolve();\n });\n return deferred.promise;\n }\n ],\n projectLoaded: [\n \"$q\", \"tgProjectService\", \"$route\", function($q, projectService, $route) {\n var deferred, ref;\n deferred = $q.defer();\n projectService.setSection((ref = $route.current.$$route) != null ? ref.section : void 0);\n if ($route.current.params.pslug) {\n projectService.setProjectBySlug($route.current.params.pslug).then(deferred.resolve);\n } else {\n projectService.cleanProject();\n deferred.resolve();\n }\n return deferred.promise;\n }\n ]\n });\n return originalWhen.call($routeProvider, path, route);\n };\n $routeProvider.when(\"/\", {\n templateUrl: \"home/home.html\",\n controller: \"Home\",\n controllerAs: \"vm\",\n loader: true,\n title: \"HOME.PAGE_TITLE\",\n loader: true,\n description: \"HOME.PAGE_DESCRIPTION\",\n joyride: \"dashboard\"\n });\n $routeProvider.when(\"/discover\", {\n templateUrl: \"discover/discover-home/discover-home.html\",\n controller: \"DiscoverHome\",\n controllerAs: \"vm\",\n title: \"PROJECT.NAVIGATION.DISCOVER\",\n loader: true\n });\n $routeProvider.when(\"/discover/search\", {\n templateUrl: \"discover/discover-search/discover-search.html\",\n title: \"PROJECT.NAVIGATION.DISCOVER\",\n loader: true,\n controller: \"DiscoverSearch\",\n controllerAs: \"vm\",\n reloadOnSearch: false\n });\n $routeProvider.when(\"/projects/\", {\n templateUrl: \"projects/listing/projects-listing.html\",\n access: {\n requiresLogin: true\n },\n title: \"PROJECTS.PAGE_TITLE\",\n description: \"PROJECTS.PAGE_DESCRIPTION\",\n loader: true,\n controller: \"ProjectsListing\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/project/:pslug/\", {\n templateUrl: \"projects/project/project.html\",\n loader: true,\n controller: \"Project\",\n controllerAs: \"vm\",\n section: \"project-timeline\"\n });\n $routeProvider.when(\"/project/:pslug/search\", {\n templateUrl: \"search/search.html\",\n reloadOnSearch: false,\n section: \"search\",\n loader: true\n });\n $routeProvider.when(\"/project/:pslug/epics\", {\n section: \"epics\",\n templateUrl: \"epics/dashboard/epics-dashboard.html\",\n loader: true,\n controller: \"EpicsDashboardCtrl\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/project/:pslug/epic/:epicref\", {\n templateUrl: \"epic/epic-detail.html\",\n loader: true,\n section: \"epics\"\n });\n $routeProvider.when(\"/project/:pslug/backlog\", {\n templateUrl: \"backlog/backlog.html\",\n loader: true,\n section: \"backlog\",\n joyride: \"backlog\"\n });\n $routeProvider.when(\"/project/:pslug/kanban\", {\n templateUrl: \"kanban/kanban.html\",\n loader: true,\n section: \"kanban\",\n joyride: \"kanban\"\n });\n $routeProvider.when(\"/project/:pslug/taskboard/:sslug\", {\n templateUrl: \"taskboard/taskboard.html\",\n loader: true,\n section: \"backlog\"\n });\n $routeProvider.when(\"/project/:pslug/us/:usref\", {\n templateUrl: \"us/us-detail.html\",\n loader: true,\n section: \"backlog-kanban\"\n });\n $routeProvider.when(\"/project/:pslug/task/:taskref\", {\n templateUrl: \"task/task-detail.html\",\n loader: true,\n section: \"backlog-kanban\"\n });\n $routeProvider.when(\"/project/:pslug/wiki\", {\n redirectTo: function(params) {\n return \"/project/\" + params.pslug + \"/wiki/home\";\n }\n });\n $routeProvider.when(\"/project/:pslug/wiki-list\", {\n templateUrl: \"wiki/wiki-list.html\",\n loader: true,\n section: \"wiki\"\n });\n $routeProvider.when(\"/project/:pslug/wiki/:slug\", {\n templateUrl: \"wiki/wiki.html\",\n loader: true,\n section: \"wiki\"\n });\n $routeProvider.when(\"/project/:pslug/team\", {\n templateUrl: \"team/team.html\",\n loader: true,\n section: \"team\"\n });\n $routeProvider.when(\"/project/:pslug/issues\", {\n templateUrl: \"issue/issues.html\",\n loader: true,\n section: \"issues\"\n });\n $routeProvider.when(\"/project/:pslug/issue/:issueref\", {\n templateUrl: \"issue/issues-detail.html\",\n loader: true,\n section: \"issues\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/details\", {\n templateUrl: \"admin/admin-project-profile.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/default-values\", {\n templateUrl: \"admin/admin-project-default-values.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/modules\", {\n templateUrl: \"admin/admin-project-modules.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/export\", {\n templateUrl: \"admin/admin-project-export.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/reports\", {\n templateUrl: \"admin/admin-project-reports.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/status\", {\n templateUrl: \"admin/admin-project-values-status.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/points\", {\n templateUrl: \"admin/admin-project-values-points.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/priorities\", {\n templateUrl: \"admin/admin-project-values-priorities.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/severities\", {\n templateUrl: \"admin/admin-project-values-severities.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/types\", {\n templateUrl: \"admin/admin-project-values-types.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/custom-fields\", {\n templateUrl: \"admin/admin-project-values-custom-fields.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/tags\", {\n templateUrl: \"admin/admin-project-values-tags.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/memberships\", {\n templateUrl: \"admin/admin-memberships.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/roles\", {\n templateUrl: \"admin/admin-roles.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/webhooks\", {\n templateUrl: \"admin/admin-third-parties-webhooks.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/github\", {\n templateUrl: \"admin/admin-third-parties-github.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/gitlab\", {\n templateUrl: \"admin/admin-third-parties-gitlab.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/bitbucket\", {\n templateUrl: \"admin/admin-third-parties-bitbucket.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/gogs\", {\n templateUrl: \"admin/admin-third-parties-gogs.html\",\n section: \"admin\"\n });\n $routeProvider.when(\"/project/:pslug/admin/contrib/:plugin\", {\n templateUrl: \"contrib/main.html\"\n });\n $routeProvider.when(\"/project/:pslug/transfer/:token\", {\n templateUrl: \"projects/transfer/transfer-page.html\",\n loader: true,\n controller: \"Project\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/user-settings/user-profile\", {\n templateUrl: \"user/user-profile.html\"\n });\n $routeProvider.when(\"/user-settings/user-change-password\", {\n templateUrl: \"user/user-change-password.html\"\n });\n $routeProvider.when(\"/user-settings/mail-notifications\", {\n templateUrl: \"user/mail-notifications.html\"\n });\n $routeProvider.when(\"/change-email/:email_token\", {\n templateUrl: \"user/change-email.html\"\n });\n $routeProvider.when(\"/cancel-account/:cancel_token\", {\n templateUrl: \"user/cancel-account.html\"\n });\n $routeProvider.when(\"/user-settings/contrib/:plugin\", {\n templateUrl: \"contrib/user-settings.html\"\n });\n $routeProvider.when(\"/profile\", {\n templateUrl: \"profile/profile.html\",\n loader: true,\n access: {\n requiresLogin: true\n },\n controller: \"Profile\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/profile/:slug\", {\n templateUrl: \"profile/profile.html\",\n loader: true,\n controller: \"Profile\",\n controllerAs: \"vm\"\n });\n $routeProvider.when(\"/login\", {\n templateUrl: \"auth/login.html\",\n title: \"LOGIN.PAGE_TITLE\",\n description: \"LOGIN.PAGE_DESCRIPTION\",\n disableHeader: true,\n controller: \"LoginPage\"\n });\n $routeProvider.when(\"/register\", {\n templateUrl: \"auth/register.html\",\n title: \"REGISTER.PAGE_TITLE\",\n description: \"REGISTER.PAGE_DESCRIPTION\",\n disableHeader: true\n });\n $routeProvider.when(\"/forgot-password\", {\n templateUrl: \"auth/forgot-password.html\",\n title: \"FORGOT_PASSWORD.PAGE_TITLE\",\n description: \"FORGOT_PASSWORD.PAGE_DESCRIPTION\",\n disableHeader: true\n });\n $routeProvider.when(\"/change-password/:token\", {\n templateUrl: \"auth/change-password-from-recovery.html\",\n title: \"CHANGE_PASSWORD.PAGE_TITLE\",\n description: \"CHANGE_PASSWORD.PAGE_TITLE\",\n disableHeader: true\n });\n $routeProvider.when(\"/invitation/:token\", {\n templateUrl: \"auth/invitation.html\",\n title: \"INVITATION.PAGE_TITLE\",\n description: \"INVITATION.PAGE_DESCRIPTION\",\n disableHeader: true\n });\n $routeProvider.when(\"/external-apps\", {\n templateUrl: \"external-apps/external-app.html\",\n title: \"EXTERNAL_APP.PAGE_TITLE\",\n description: \"EXTERNAL_APP.PAGE_DESCRIPTION\",\n controller: \"ExternalApp\",\n controllerAs: \"vm\",\n disableHeader: true,\n mobileViewport: true\n });\n $routeProvider.when(\"/blocked-project/:pslug/\", {\n templateUrl: \"projects/project/blocked-project.html\",\n loader: true\n });\n $routeProvider.when(\"/error\", {\n templateUrl: \"error/error.html\"\n });\n $routeProvider.when(\"/not-found\", {\n templateUrl: \"error/not-found.html\"\n });\n $routeProvider.when(\"/permission-denied\", {\n templateUrl: \"error/permission-denied.html\"\n });\n $routeProvider.otherwise({\n templateUrl: \"error/not-found.html\"\n });\n $locationProvider.html5Mode({\n enabled: true,\n requireBase: false\n });\n defaultHeaders = {\n \"Content-Type\": \"application/json\",\n \"Accept-Language\": window.taigaConfig.defaultLanguage || \"en\",\n \"X-Session-Id\": taiga.sessionId\n };\n $httpProvider.defaults.headers[\"delete\"] = defaultHeaders;\n $httpProvider.defaults.headers.patch = defaultHeaders;\n $httpProvider.defaults.headers.post = defaultHeaders;\n $httpProvider.defaults.headers.put = defaultHeaders;\n $httpProvider.defaults.headers.get = {\n \"X-Session-Id\": taiga.sessionId\n };\n $httpProvider.useApplyAsync(true);\n $tgEventsProvider.setSessionId(taiga.sessionId);\n authHttpIntercept = function($q, $location, $navUrls, $lightboxService, errorHandlingService) {\n var httpResponseError;\n httpResponseError = function(response) {\n var nextUrl, search;\n if (response.status === 0 || (response.status === -1 && !response.config.cancelable)) {\n $lightboxService.closeAll();\n errorHandlingService.error();\n } else if (response.status === 401 && $location.url().indexOf('/login') === -1) {\n nextUrl = $location.url();\n search = $location.search();\n if (search.force_next) {\n $location.url($navUrls.resolve(\"login\")).search(\"force_next\", search.force_next);\n } else {\n $location.url($navUrls.resolve(\"login\")).search(\"next\", nextUrl);\n }\n }\n return $q.reject(response);\n };\n return {\n responseError: httpResponseError\n };\n };\n $provide.factory(\"authHttpIntercept\", [\"$q\", \"$location\", \"$tgNavUrls\", \"lightboxService\", \"tgErrorHandlingService\", authHttpIntercept]);\n $httpProvider.interceptors.push(\"authHttpIntercept\");\n loaderIntercept = function($q, loaderService) {\n return {\n request: function(config) {\n loaderService.logRequest();\n return config;\n },\n requestError: function(rejection) {\n loaderService.logResponse();\n return $q.reject(rejection);\n },\n responseError: function(rejection) {\n loaderService.logResponse();\n return $q.reject(rejection);\n },\n response: function(response) {\n loaderService.logResponse();\n return response;\n }\n };\n };\n $provide.factory(\"loaderIntercept\", [\"$q\", \"tgLoader\", loaderIntercept]);\n $httpProvider.interceptors.push(\"loaderIntercept\");\n versionCheckHttpIntercept = function($q) {\n var httpResponseError;\n httpResponseError = function(response) {\n var $injector;\n if (response.status === 400 && response.data.version) {\n $injector = angular.element(\"body\").injector();\n $injector.invoke([\n \"$tgConfirm\", \"$translate\", (function(_this) {\n return function($confirm, $translate) {\n var versionErrorMsg;\n versionErrorMsg = $translate.instant(\"ERROR.VERSION_ERROR\");\n return $confirm.notify(\"error\", versionErrorMsg, null, 10000);\n };\n })(this)\n ]);\n }\n return $q.reject(response);\n };\n return {\n responseError: httpResponseError\n };\n };\n $provide.factory(\"versionCheckHttpIntercept\", [\"$q\", versionCheckHttpIntercept]);\n $httpProvider.interceptors.push(\"versionCheckHttpIntercept\");\n blockingIntercept = function($q, errorHandlingService) {\n var redirectToBlockedPage, responseError, responseOk;\n redirectToBlockedPage = function() {\n return errorHandlingService.block();\n };\n responseOk = function(response) {\n if (response.data.blocked_code) {\n redirectToBlockedPage();\n }\n return response;\n };\n responseError = function(response) {\n if (response.status === 451) {\n redirectToBlockedPage();\n }\n return $q.reject(response);\n };\n return {\n response: responseOk,\n responseError: responseError\n };\n };\n $provide.factory(\"blockingIntercept\", [\"$q\", \"tgErrorHandlingService\", blockingIntercept]);\n $httpProvider.interceptors.push(\"blockingIntercept\");\n $compileProvider.debugInfoEnabled(window.taigaConfig.debugInfo || false);\n if (localStorage.userInfo) {\n userInfo = JSON.parse(localStorage.userInfo);\n }\n preferedLangCode = (userInfo != null ? userInfo.lang : void 0) || window.taigaConfig.defaultLanguage || \"en\";\n $translatePartialLoaderProvider.addPart('taiga');\n $translateProvider.useLoader('$translatePartialLoader', {\n urlTemplate: '/' + window._version + '/locales/{part}/locale-{lang}.json'\n }).useSanitizeValueStrategy('escapeParameters').addInterpolation('$translateMessageFormatInterpolation').preferredLanguage(preferedLangCode);\n $translateProvider.fallbackLanguage(preferedLangCode);\n decorators = window.getDecorators();\n return _.each(decorators, function(decorator) {\n return $provide.decorator(decorator.provider, decorator.decorator);\n });\n };\n\n i18nInit = function(lang, $translate) {\n var messages;\n moment.locale(lang);\n if (lang !== 'en') {\n ljs.load((\"/\" + window._version + \"/locales/moment-locales/\") + lang + \".js\");\n }\n messages = {\n defaultMessage: $translate.instant(\"COMMON.FORM_ERRORS.DEFAULT_MESSAGE\"),\n type: {\n email: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_EMAIL\"),\n url: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_URL\"),\n urlstrict: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_URLSTRICT\"),\n number: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_NUMBER\"),\n digits: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_DIGITS\"),\n dateIso: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_DATEISO\"),\n alphanum: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_ALPHANUM\"),\n phone: $translate.instant(\"COMMON.FORM_ERRORS.TYPE_PHONE\")\n },\n notnull: $translate.instant(\"COMMON.FORM_ERRORS.NOTNULL\"),\n notblank: $translate.instant(\"COMMON.FORM_ERRORS.NOT_BLANK\"),\n required: $translate.instant(\"COMMON.FORM_ERRORS.REQUIRED\"),\n regexp: $translate.instant(\"COMMON.FORM_ERRORS.REGEXP\"),\n min: $translate.instant(\"COMMON.FORM_ERRORS.MIN\"),\n max: $translate.instant(\"COMMON.FORM_ERRORS.MAX\"),\n range: $translate.instant(\"COMMON.FORM_ERRORS.RANGE\"),\n minlength: $translate.instant(\"COMMON.FORM_ERRORS.MIN_LENGTH\"),\n maxlength: $translate.instant(\"COMMON.FORM_ERRORS.MAX_LENGTH\"),\n rangelength: $translate.instant(\"COMMON.FORM_ERRORS.RANGE_LENGTH\"),\n mincheck: $translate.instant(\"COMMON.FORM_ERRORS.MIN_CHECK\"),\n maxcheck: $translate.instant(\"COMMON.FORM_ERRORS.MAX_CHECK\"),\n rangecheck: $translate.instant(\"COMMON.FORM_ERRORS.RANGE_CHECK\"),\n equalto: $translate.instant(\"COMMON.FORM_ERRORS.EQUAL_TO\"),\n linewidth: $translate.instant(\"COMMON.FORM_ERRORS.LINEWIDTH\"),\n pikaday: $translate.instant(\"COMMON.FORM_ERRORS.PIKADAY\")\n };\n return checksley.updateMessages('default', messages);\n };\n\n init = function($log, $rootscope, $auth, $events, $analytics, $translate, $location, $navUrls, appMetaService, loaderService, navigationBarService, errorHandlingService, lightboxService) {\n var un, user, validators;\n $log.debug(\"Initialize application\");\n $rootscope.$on('$translatePartialLoaderStructureChanged', function() {\n return $translate.refresh();\n });\n validators = {\n linewidth: function(val, width) {\n var lines, valid;\n lines = taiga.nl2br(val).split(\"
\");\n valid = _.every(lines, function(line) {\n return line.length < width;\n });\n return valid;\n },\n pikaday: function(val) {\n var prettyDate;\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n return moment(val, prettyDate).isValid();\n }\n };\n checksley.updateValidators(validators);\n $rootscope.contribPlugins = this.taigaContribPlugins;\n $rootscope.adminPlugins = _.filter(this.taigaContribPlugins, {\n \"type\": \"admin\"\n });\n $rootscope.userSettingsPlugins = _.filter(this.taigaContribPlugins, {\n \"type\": \"userSettings\"\n });\n $rootscope.$on(\"$translateChangeEnd\", function(e, ctx) {\n var lang;\n lang = ctx.language;\n return i18nInit(lang, $translate);\n });\n Promise.setScheduler(function(cb) {\n return $rootscope.$evalAsync(cb);\n });\n $events.setupConnection();\n if ($auth.isAuthenticated()) {\n user = $auth.getUser();\n }\n $analytics.initialize();\n $rootscope.$on('$locationChangeStart', function(event) {\n errorHandlingService.init();\n if (lightboxService.getLightboxOpen().length) {\n event.preventDefault();\n return lightboxService.closeAll();\n }\n });\n un = $rootscope.$on('$routeChangeStart', function(event, next) {\n if (next.loader) {\n loaderService.start(true);\n }\n return un();\n });\n return $rootscope.$on('$routeChangeSuccess', function(event, next) {\n var description, title;\n if (next.loader) {\n loaderService.start(true);\n }\n if (next.access && next.access.requiresLogin) {\n if (!$auth.isAuthenticated()) {\n $location.path($navUrls.resolve(\"login\"));\n }\n }\n if (next.title || next.description) {\n title = $translate.instant(next.title || \"\");\n description = $translate.instant(next.description || \"\");\n appMetaService.setAll(title, description);\n }\n if (next.mobileViewport) {\n appMetaService.addMobileViewport();\n } else {\n appMetaService.removeMobileViewport();\n }\n if (next.disableHeader) {\n return navigationBarService.disableHeader();\n } else {\n return navigationBarService.enableHeader();\n }\n });\n };\n\n angular.module('infinite-scroll').value('THROTTLE_MILLISECONDS', 500);\n\n pluginsWithModule = _.filter(this.taigaContribPlugins, function(plugin) {\n return plugin.module;\n });\n\n pluginsModules = _.map(pluginsWithModule, function(plugin) {\n return plugin.module;\n });\n\n modules = [\"taigaBase\", \"taigaCommon\", \"taigaResources\", \"taigaResources2\", \"taigaAuth\", \"taigaEvents\", \"taigaHome\", \"taigaNavigationBar\", \"taigaProjects\", \"taigaRelatedTasks\", \"taigaBacklog\", \"taigaTaskboard\", \"taigaKanban\", \"taigaIssues\", \"taigaUserStories\", \"taigaTasks\", \"taigaTeam\", \"taigaWiki\", \"taigaSearch\", \"taigaAdmin\", \"taigaProject\", \"taigaUserSettings\", \"taigaFeedback\", \"taigaPlugins\", \"taigaIntegrations\", \"taigaComponents\", \"taigaProfile\", \"taigaHome\", \"taigaUserTimeline\", \"taigaExternalApps\", \"taigaDiscover\", \"taigaHistory\", \"taigaWikiHistory\", \"taigaEpics\", \"taigaUtils\", \"templates\", \"ngSanitize\", \"ngRoute\", \"ngAnimate\", \"ngAria\", \"pascalprecht.translate\", \"infinite-scroll\", \"tgRepeat\"].concat(pluginsModules);\n\n module = angular.module(\"taiga\", modules);\n\n module.config([\"$routeProvider\", \"$locationProvider\", \"$httpProvider\", \"$provide\", \"$tgEventsProvider\", \"$compileProvider\", \"$translateProvider\", \"$translatePartialLoaderProvider\", \"$animateProvider\", configure]);\n\n module.run([\"$log\", \"$rootScope\", \"$tgAuth\", \"$tgEvents\", \"$tgAnalytics\", \"$translate\", \"$tgLocation\", \"$tgNavUrls\", \"tgAppMetaService\", \"tgLoader\", \"tgNavigationBarService\", \"tgErrorHandlingService\", \"lightboxService\", init]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: classes.coffee\n */\n\n(function() {\n var TaigaBase, TaigaController, TaigaService,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n TaigaBase = (function() {\n function TaigaBase() {}\n\n return TaigaBase;\n\n })();\n\n TaigaService = (function(superClass) {\n extend(TaigaService, superClass);\n\n function TaigaService() {\n return TaigaService.__super__.constructor.apply(this, arguments);\n }\n\n return TaigaService;\n\n })(TaigaBase);\n\n TaigaController = (function(superClass) {\n extend(TaigaController, superClass);\n\n function TaigaController() {\n this.onInitialDataError = bind(this.onInitialDataError, this);\n return TaigaController.__super__.constructor.apply(this, arguments);\n }\n\n TaigaController.prototype.onInitialDataError = function(xhr) {\n if (xhr) {\n if (xhr.status === 404) {\n this.errorHandlingService.notfound();\n } else if (xhr.status === 403) {\n this.errorHandlingService.permissionDenied();\n }\n }\n return this.q.reject(xhr);\n };\n\n return TaigaController;\n\n })(TaigaBase);\n\n this.taiga.Base = TaigaBase;\n\n this.taiga.Service = TaigaService;\n\n this.taiga.Controller = TaigaController;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: utils.coffee\n */\n\n(function() {\n var DEFAULT_COLOR_LIST, addClass, bindMethods, bindOnce, cancelTimeout, debounce, debounceLeading, defineImmutableProperty, getDefaulColorList, getRandomDefaultColor, groupBy, isImage, isPdf, joinStr, mixOf, nl2br, patch, replaceTags, scopeDefer, sizeFormat, slugify, startswith, stripTags, taiga, timeout, toString, toggleText, trim, truncate, unslugify,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },\n slice = [].slice,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n addClass = function(el, className) {\n if (el.classList) {\n return el.classList.add(className);\n } else {\n return el.className += ' ' + className;\n }\n };\n\n nl2br = (function(_this) {\n return function(str) {\n var breakTag;\n breakTag = '
';\n return (str + '').replace(/([^>\\r\\n]?)(\\r\\n|\\n\\r|\\r|\\n)/g, '$1' + breakTag + '$2');\n };\n })(this);\n\n bindMethods = (function(_this) {\n return function(object) {\n var dependencies, methods;\n dependencies = _.keys(object);\n methods = [];\n _.forIn(object, function(value, key) {\n if (indexOf.call(dependencies, key) < 0 && _.isFunction(value)) {\n return methods.push(key);\n }\n });\n return _.bindAll(object, methods);\n };\n })(this);\n\n bindOnce = (function(_this) {\n return function(scope, attr, continuation) {\n var delBind, val;\n val = scope.$eval(attr);\n if (val !== void 0) {\n return continuation(val);\n }\n delBind = null;\n return delBind = scope.$watch(attr, function(val) {\n if (val === void 0) {\n return;\n }\n continuation(val);\n if (delBind) {\n return delBind();\n }\n });\n };\n })(this);\n\n mixOf = function() {\n var Mixed, base, i, method, mixin, mixins, name, ref;\n base = arguments[0], mixins = 2 <= arguments.length ? slice.call(arguments, 1) : [];\n Mixed = (function(superClass) {\n extend(Mixed, superClass);\n\n function Mixed() {\n return Mixed.__super__.constructor.apply(this, arguments);\n }\n\n return Mixed;\n\n })(base);\n for (i = mixins.length - 1; i >= 0; i += -1) {\n mixin = mixins[i];\n ref = mixin.prototype;\n for (name in ref) {\n method = ref[name];\n Mixed.prototype[name] = method;\n }\n }\n return Mixed;\n };\n\n trim = function(data, char) {\n return _.trim(data, char);\n };\n\n slugify = function(data) {\n return data.toString().toLowerCase().trim().replace(/\\s+/g, '-').replace(/&/g, '-and-').replace(/[^\\w\\-]+/g, '').replace(/\\-\\-+/g, '-');\n };\n\n unslugify = function(data) {\n if (data) {\n return _.capitalize(data.replace(/-/g, ' '));\n }\n return data;\n };\n\n toggleText = function(element, texts) {\n var nextTextPosition, text;\n nextTextPosition = element.data('nextTextPosition');\n if ((nextTextPosition == null) || nextTextPosition >= texts.length) {\n nextTextPosition = 0;\n }\n text = texts[nextTextPosition];\n element.data('nextTextPosition', nextTextPosition + 1);\n return element.text(text);\n };\n\n groupBy = function(coll, pred) {\n var i, item, len, result;\n result = {};\n for (i = 0, len = coll.length; i < len; i++) {\n item = coll[i];\n result[pred(item)] = item;\n }\n return result;\n };\n\n timeout = function(wait, continuation) {\n return window.setTimeout(continuation, wait);\n };\n\n cancelTimeout = function(timeoutVar) {\n return window.clearTimeout(timeoutVar);\n };\n\n scopeDefer = function(scope, func) {\n return _.defer((function(_this) {\n return function() {\n return scope.$apply(func);\n };\n })(this));\n };\n\n toString = function(value) {\n if (_.isNumber(value)) {\n return value + \"\";\n } else if (_.isString(value)) {\n return value;\n } else if (_.isPlainObject(value)) {\n return JSON.stringify(value);\n } else if (_.isUndefined(value)) {\n return \"\";\n }\n return value.toString();\n };\n\n joinStr = function(str, coll) {\n return coll.join(str);\n };\n\n debounce = function(wait, func) {\n return _.debounce(func, wait, {\n leading: true,\n trailing: false\n });\n };\n\n debounceLeading = function(wait, func) {\n return _.debounce(func, wait, {\n leading: false,\n trailing: true\n });\n };\n\n startswith = function(str1, str2) {\n return _.startsWith(str1, str2);\n };\n\n truncate = function(str, maxLength, suffix) {\n var out;\n if (suffix == null) {\n suffix = \"...\";\n }\n if ((typeof str !== \"string\") && !(str instanceof String)) {\n return str;\n }\n out = str.slice(0);\n if (out.length > maxLength) {\n out = out.substring(0, maxLength + 1);\n out = out.substring(0, Math.min(out.length, out.lastIndexOf(\" \")));\n out = out + suffix;\n }\n return out;\n };\n\n sizeFormat = function(input, precision) {\n var number, size, units;\n if (precision == null) {\n precision = 1;\n }\n if (isNaN(parseFloat(input)) || !isFinite(input)) {\n return \"-\";\n }\n if (input === 0) {\n return \"0 bytes\";\n }\n units = [\"bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"];\n number = Math.floor(Math.log(input) / Math.log(1024));\n if (number > 5) {\n number = 5;\n }\n size = (input / Math.pow(1024, number)).toFixed(precision);\n return size + \" \" + units[number];\n };\n\n stripTags = function(str, exception) {\n var pattern;\n if (exception) {\n pattern = new RegExp('<(?!' + exception + '\\s*\\/?)[^>]+>', 'gi');\n return String(str).replace(pattern, '');\n } else {\n return String(str).replace(/<\\/?[^>]+>/g, '');\n }\n };\n\n replaceTags = function(str, tags, replace) {\n var pattern;\n pattern = new RegExp('<(' + tags + ')>', 'gi');\n str = str.replace(pattern, '<' + replace + '>');\n pattern = new RegExp('<\\/(' + tags + ')>', 'gi');\n str = str.replace(pattern, '' + replace + '>');\n return str;\n };\n\n defineImmutableProperty = (function(_this) {\n return function(obj, name, fn) {\n return Object.defineProperty(obj, name, {\n get: function() {\n var fn_result;\n if (!_.isFunction(fn)) {\n throw \"defineImmutableProperty third param must be a function\";\n }\n fn_result = fn();\n if (fn_result && _.isObject(fn_result)) {\n if (fn_result.size === void 0) {\n throw \"defineImmutableProperty must return immutable data\";\n }\n }\n return fn_result;\n }\n });\n };\n })(this);\n\n _.mixin({\n removeKeys: function(obj, keys) {\n return _.chain([keys]).flatten().reduce(function(obj, key) {\n delete obj[key];\n return obj;\n }, obj).value();\n },\n cartesianProduct: function() {\n return _.reduceRight(arguments, function(a, b) {\n return _.flatten(_.map(a, function(x) {\n return _.map(b, function(y) {\n return [y].concat(x);\n });\n }), true);\n }, [[]]);\n }\n });\n\n isImage = function(name) {\n return name.match(/\\.(jpe?g|png|gif|gifv|webm)/i) !== null;\n };\n\n isPdf = function(name) {\n return name.match(/\\.(pdf)/i) !== null;\n };\n\n patch = function(oldImmutable, newImmutable) {\n var pathObj;\n pathObj = {};\n newImmutable.forEach(function(newValue, key) {\n if (newValue !== oldImmutable.get(key)) {\n if (newValue.toJS) {\n return pathObj[key] = newValue.toJS();\n } else {\n return pathObj[key] = newValue;\n }\n }\n });\n return pathObj;\n };\n\n DEFAULT_COLOR_LIST = ['#fce94f', '#edd400', '#c4a000', '#8ae234', '#73d216', '#4e9a06', '#d3d7cf', '#fcaf3e', '#f57900', '#ce5c00', '#729fcf', '#3465a4', '#204a87', '#888a85', '#ad7fa8', '#75507b', '#5c3566', '#ef2929', '#cc0000', '#a40000', '#222222'];\n\n getRandomDefaultColor = function() {\n return _.sample(DEFAULT_COLOR_LIST);\n };\n\n getDefaulColorList = function() {\n return _.clone(DEFAULT_COLOR_LIST);\n };\n\n taiga = this.taiga;\n\n taiga.addClass = addClass;\n\n taiga.nl2br = nl2br;\n\n taiga.bindMethods = bindMethods;\n\n taiga.bindOnce = bindOnce;\n\n taiga.mixOf = mixOf;\n\n taiga.trim = trim;\n\n taiga.slugify = slugify;\n\n taiga.unslugify = unslugify;\n\n taiga.toggleText = toggleText;\n\n taiga.groupBy = groupBy;\n\n taiga.timeout = timeout;\n\n taiga.cancelTimeout = cancelTimeout;\n\n taiga.scopeDefer = scopeDefer;\n\n taiga.toString = toString;\n\n taiga.joinStr = joinStr;\n\n taiga.truncate = truncate;\n\n taiga.debounce = debounce;\n\n taiga.debounceLeading = debounceLeading;\n\n taiga.startswith = startswith;\n\n taiga.sizeFormat = sizeFormat;\n\n taiga.stripTags = stripTags;\n\n taiga.replaceTags = replaceTags;\n\n taiga.defineImmutableProperty = defineImmutableProperty;\n\n taiga.isImage = isImage;\n\n taiga.isPdf = isPdf;\n\n taiga.patch = patch;\n\n taiga.getRandomDefaultColor = getRandomDefaultColor;\n\n taiga.getDefaulColorList = getDefaulColorList;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/controllerMixins.coffee\n */\n\n(function() {\n var FiltersMixin, PageMixin, UsFiltersMixin, groupBy, joinStr, taiga, toString, trim;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n joinStr = this.taiga.joinStr;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n PageMixin = (function() {\n function PageMixin() {}\n\n PageMixin.prototype.fillUsersAndRoles = function(users, roles) {\n var activeUsers, computableRoles;\n activeUsers = _.filter(users, (function(_this) {\n return function(user) {\n return user.is_active;\n };\n })(this));\n this.scope.activeUsers = _.sortBy(activeUsers, \"full_name_display\");\n this.scope.activeUsersById = groupBy(this.scope.activeUsers, function(e) {\n return e.id;\n });\n this.scope.users = _.sortBy(users, \"full_name_display\");\n this.scope.usersById = groupBy(this.scope.users, function(e) {\n return e.id;\n });\n this.scope.roles = _.sortBy(roles, \"order\");\n computableRoles = _(this.scope.project.members).map(\"role\").uniq().value();\n return this.scope.computableRoles = _(roles).filter(\"computable\").filter(function(x) {\n return _.includes(computableRoles, x.id);\n }).value();\n };\n\n PageMixin.prototype.loadUsersAndRoles = function() {\n var promise;\n promise = this.q.all([this.rs.projects.usersList(this.scope.projectId), this.rs.projects.rolesList(this.scope.projectId)]);\n return promise.then((function(_this) {\n return function(results) {\n var roles, users;\n users = results[0], roles = results[1];\n _this.fillUsersAndRoles(users, roles);\n return results;\n };\n })(this));\n };\n\n return PageMixin;\n\n })();\n\n taiga.PageMixin = PageMixin;\n\n FiltersMixin = (function() {\n function FiltersMixin() {}\n\n FiltersMixin.prototype.selectFilter = function(name, value, load) {\n var existing, location, params;\n if (load == null) {\n load = false;\n }\n params = this.location.search();\n if (params[name] !== void 0 && name !== \"page\") {\n existing = _.map(taiga.toString(params[name]).split(\",\"), function(x) {\n return trim(x);\n });\n existing.push(taiga.toString(value));\n existing = _.compact(existing);\n value = joinStr(\",\", _.uniq(existing));\n }\n if (!this.location.isInCurrentRouteParams(name, value)) {\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n }\n };\n\n FiltersMixin.prototype.replaceFilter = function(name, value, load) {\n var location;\n if (load == null) {\n load = false;\n }\n if (!this.location.isInCurrentRouteParams(name, value)) {\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n }\n };\n\n FiltersMixin.prototype.replaceAllFilters = function(filters, load) {\n var location;\n if (load == null) {\n load = false;\n }\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(filters);\n };\n\n FiltersMixin.prototype.unselectFilter = function(name, value, load) {\n var location, newValues, params, parsedValues;\n if (load == null) {\n load = false;\n }\n params = this.location.search();\n if (params[name] === void 0) {\n return;\n }\n if (value === void 0 || value === null) {\n delete params[name];\n }\n parsedValues = _.map(taiga.toString(params[name]).split(\",\"), function(x) {\n return trim(x);\n });\n newValues = _.reject(parsedValues, function(x) {\n return x === taiga.toString(value);\n });\n newValues = _.compact(newValues);\n if (_.isEmpty(newValues)) {\n value = null;\n } else {\n value = joinStr(\",\", _.uniq(newValues));\n }\n location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n };\n\n FiltersMixin.prototype.applyStoredFilters = function(projectSlug, key) {\n var filters;\n if (_.isEmpty(this.location.search())) {\n filters = this.getFilters(projectSlug, key);\n if (Object.keys(filters).length) {\n this.location.search(filters);\n this.location.replace();\n return true;\n }\n }\n return false;\n };\n\n FiltersMixin.prototype.storeFilters = function(projectSlug, params, filtersHashSuffix) {\n var hash, ns;\n ns = projectSlug + \":\" + filtersHashSuffix;\n hash = taiga.generateHash([projectSlug, ns]);\n return this.storage.set(hash, params);\n };\n\n FiltersMixin.prototype.getFilters = function(projectSlug, filtersHashSuffix) {\n var hash, ns;\n ns = projectSlug + \":\" + filtersHashSuffix;\n hash = taiga.generateHash([projectSlug, ns]);\n return this.storage.get(hash) || {};\n };\n\n FiltersMixin.prototype.formatSelectedFilters = function(type, list, urlIds) {\n var invalidAppliedTags, invalidTags, selectedFilters, selectedIds, validAppliedTags;\n selectedIds = urlIds.split(',');\n selectedFilters = _.filter(list, function(it) {\n return selectedIds.indexOf(_.toString(it.id)) !== -1;\n });\n invalidTags = _.filter(selectedIds, function(it) {\n return !_.find(selectedFilters, function(sit) {\n return _.toString(sit.id) === it;\n });\n });\n invalidAppliedTags = _.map(invalidTags, function(it) {\n return {\n id: it,\n key: type + \":\" + it,\n dataType: type,\n name: it\n };\n });\n validAppliedTags = _.map(selectedFilters, function(it) {\n return {\n id: it.id,\n key: type + \":\" + it.id,\n dataType: type,\n name: it.name,\n color: it.color\n };\n });\n return invalidAppliedTags.concat(validAppliedTags);\n };\n\n return FiltersMixin;\n\n })();\n\n taiga.FiltersMixin = FiltersMixin;\n\n UsFiltersMixin = (function() {\n function UsFiltersMixin() {}\n\n UsFiltersMixin.prototype.changeQ = function(q) {\n this.replaceFilter(\"q\", q);\n this.filtersReloadContent();\n return this.generateFilters();\n };\n\n UsFiltersMixin.prototype.removeFilter = function(filter) {\n this.unselectFilter(filter.dataType, filter.id);\n this.filtersReloadContent();\n return this.generateFilters();\n };\n\n UsFiltersMixin.prototype.addFilter = function(newFilter) {\n this.selectFilter(newFilter.category.dataType, newFilter.filter.id);\n this.filtersReloadContent();\n return this.generateFilters();\n };\n\n UsFiltersMixin.prototype.selectCustomFilter = function(customFilter) {\n this.replaceAllFilters(customFilter.filter);\n this.filtersReloadContent();\n return this.generateFilters();\n };\n\n UsFiltersMixin.prototype.saveCustomFilter = function(name) {\n var filters, urlfilters;\n filters = {};\n urlfilters = this.location.search();\n filters.tags = urlfilters.tags;\n filters.status = urlfilters.status;\n filters.assigned_to = urlfilters.assigned_to;\n filters.owner = urlfilters.owner;\n return this.filterRemoteStorageService.getFilters(this.scope.projectId, this.storeCustomFiltersName).then((function(_this) {\n return function(userFilters) {\n userFilters[name] = filters;\n return _this.filterRemoteStorageService.storeFilters(_this.scope.projectId, userFilters, _this.storeCustomFiltersName).then(_this.generateFilters);\n };\n })(this));\n };\n\n UsFiltersMixin.prototype.removeCustomFilter = function(customFilter) {\n return this.filterRemoteStorageService.getFilters(this.scope.projectId, this.storeCustomFiltersName).then((function(_this) {\n return function(userFilters) {\n delete userFilters[customFilter.id];\n _this.filterRemoteStorageService.storeFilters(_this.scope.projectId, userFilters, _this.storeCustomFiltersName).then(_this.generateFilters);\n return _this.generateFilters();\n };\n })(this));\n };\n\n UsFiltersMixin.prototype.generateFilters = function() {\n var loadFilters, urlfilters;\n this.storeFilters(this.params.pslug, this.location.search(), this.storeFiltersName);\n urlfilters = this.location.search();\n loadFilters = {};\n loadFilters.project = this.scope.projectId;\n loadFilters.tags = urlfilters.tags;\n loadFilters.status = urlfilters.status;\n loadFilters.assigned_to = urlfilters.assigned_to;\n loadFilters.owner = urlfilters.owner;\n loadFilters.epic = urlfilters.epic;\n loadFilters.q = urlfilters.q;\n return this.q.all([this.rs.userstories.filtersData(loadFilters), this.filterRemoteStorageService.getFilters(this.scope.projectId, this.storeCustomFiltersName)]).then((function(_this) {\n return function(result) {\n var assignedTo, customFiltersRaw, data, epic, owner, selected, statuses, tags, tagsWithAtLeastOneElement;\n data = result[0];\n customFiltersRaw = result[1];\n statuses = _.map(data.statuses, function(it) {\n it.id = it.id.toString();\n return it;\n });\n tags = _.map(data.tags, function(it) {\n it.id = it.name;\n return it;\n });\n tagsWithAtLeastOneElement = _.filter(tags, function(tag) {\n return tag.count > 0;\n });\n assignedTo = _.map(data.assigned_to, function(it) {\n if (it.id) {\n it.id = it.id.toString();\n } else {\n it.id = \"null\";\n }\n it.name = it.full_name || \"Unassigned\";\n return it;\n });\n owner = _.map(data.owners, function(it) {\n it.id = it.id.toString();\n it.name = it.full_name;\n return it;\n });\n epic = _.map(data.epics, function(it) {\n if (it.id) {\n it.id = it.id.toString();\n it.name = \"#\" + it.ref + \" \" + it.subject;\n } else {\n it.id = \"null\";\n it.name = \"Not in an epic\";\n }\n return it;\n });\n _this.selectedFilters = [];\n if (loadFilters.status) {\n selected = _this.formatSelectedFilters(\"status\", statuses, loadFilters.status);\n _this.selectedFilters = _this.selectedFilters.concat(selected);\n }\n if (loadFilters.tags) {\n selected = _this.formatSelectedFilters(\"tags\", tags, loadFilters.tags);\n _this.selectedFilters = _this.selectedFilters.concat(selected);\n }\n if (loadFilters.assigned_to) {\n selected = _this.formatSelectedFilters(\"assigned_to\", assignedTo, loadFilters.assigned_to);\n _this.selectedFilters = _this.selectedFilters.concat(selected);\n }\n if (loadFilters.owner) {\n selected = _this.formatSelectedFilters(\"owner\", owner, loadFilters.owner);\n _this.selectedFilters = _this.selectedFilters.concat(selected);\n }\n if (loadFilters.epic) {\n selected = _this.formatSelectedFilters(\"epic\", epic, loadFilters.epic);\n _this.selectedFilters = _this.selectedFilters.concat(selected);\n }\n _this.filterQ = loadFilters.q;\n _this.filters = [\n {\n title: _this.translate.instant(\"COMMON.FILTERS.CATEGORIES.STATUS\"),\n dataType: \"status\",\n content: statuses\n }, {\n title: _this.translate.instant(\"COMMON.FILTERS.CATEGORIES.TAGS\"),\n dataType: \"tags\",\n content: tags,\n hideEmpty: true,\n totalTaggedElements: tagsWithAtLeastOneElement.length\n }, {\n title: _this.translate.instant(\"COMMON.FILTERS.CATEGORIES.ASSIGNED_TO\"),\n dataType: \"assigned_to\",\n content: assignedTo\n }, {\n title: _this.translate.instant(\"COMMON.FILTERS.CATEGORIES.CREATED_BY\"),\n dataType: \"owner\",\n content: owner\n }, {\n title: _this.translate.instant(\"COMMON.FILTERS.CATEGORIES.EPIC\"),\n dataType: \"epic\",\n content: epic\n }\n ];\n _this.customFilters = [];\n return _.forOwn(customFiltersRaw, function(value, key) {\n return _this.customFilters.push({\n id: key,\n name: key,\n filter: value\n });\n });\n };\n })(this));\n };\n\n return UsFiltersMixin;\n\n })();\n\n taiga.UsFiltersMixin = UsFiltersMixin;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/admin.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaAdmin\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/auth.coffee\n */\n\n(function() {\n var AuthService, CancelAccountDirective, ChangeEmailDirective, ChangePasswordFromRecoveryDirective, ForgotPasswordDirective, InvitationDirective, LoginDirective, LoginPage, PublicRegisterMessageDirective, RegisterDirective, debounce, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAuth\", [\"taigaResources\"]);\n\n LoginPage = (function() {\n LoginPage.$inject = ['tgCurrentUserService', '$location', '$tgNavUrls', '$routeParams'];\n\n function LoginPage(currentUserService, $location, $navUrls, $routeParams) {\n var url;\n if (currentUserService.isAuthenticated()) {\n if (!$routeParams['force_login']) {\n url = $navUrls.resolve(\"home\");\n if ($routeParams['next']) {\n url = decodeURIComponent($routeParams['next']);\n $location.search('next', null);\n }\n $location.url(url);\n }\n }\n }\n\n return LoginPage;\n\n })();\n\n module.controller('LoginPage', LoginPage);\n\n AuthService = (function(superClass) {\n extend(AuthService, superClass);\n\n AuthService.$inject = [\"$rootScope\", \"$tgStorage\", \"$tgModel\", \"$tgResources\", \"$tgHttp\", \"$tgUrls\", \"$tgConfig\", \"$translate\", \"tgCurrentUserService\", \"tgThemeService\"];\n\n function AuthService(rootscope, storage, model, rs, http, urls, config1, translate, currentUserService1, themeService) {\n var userModel;\n this.rootscope = rootscope;\n this.storage = storage;\n this.model = model;\n this.rs = rs;\n this.http = http;\n this.urls = urls;\n this.config = config1;\n this.translate = translate;\n this.currentUserService = currentUserService1;\n this.themeService = themeService;\n AuthService.__super__.constructor.call(this);\n userModel = this.getUser();\n this._currentTheme = this._getUserTheme();\n this.setUserdata(userModel);\n }\n\n AuthService.prototype.setUserdata = function(userModel) {\n if (userModel) {\n this.userData = Immutable.fromJS(userModel.getAttrs());\n return this.currentUserService.setUser(this.userData);\n } else {\n return this.userData = null;\n }\n };\n\n AuthService.prototype._getUserTheme = function() {\n var ref;\n return ((ref = this.rootscope.user) != null ? ref.theme : void 0) || this.config.get(\"defaultTheme\") || \"taiga\";\n };\n\n AuthService.prototype._setTheme = function() {\n var newTheme;\n newTheme = this._getUserTheme();\n if (this._currentTheme !== newTheme) {\n this._currentTheme = newTheme;\n return this.themeService.use(this._currentTheme);\n }\n };\n\n AuthService.prototype._setLocales = function() {\n var lang, ref;\n lang = ((ref = this.rootscope.user) != null ? ref.lang : void 0) || this.config.get(\"defaultLanguage\") || \"en\";\n this.translate.preferredLanguage(lang);\n return this.translate.use(lang);\n };\n\n AuthService.prototype.getUser = function() {\n var user, userData;\n if (this.rootscope.user) {\n return this.rootscope.user;\n }\n userData = this.storage.get(\"userInfo\");\n if (userData) {\n user = this.model.make_model(\"users\", userData);\n this.rootscope.user = user;\n this._setLocales();\n this._setTheme();\n return user;\n } else {\n this._setTheme();\n }\n return null;\n };\n\n AuthService.prototype.setUser = function(user) {\n this.rootscope.auth = user;\n this.storage.set(\"userInfo\", user.getAttrs());\n this.rootscope.user = user;\n this.setUserdata(user);\n this._setLocales();\n return this._setTheme();\n };\n\n AuthService.prototype.clear = function() {\n this.rootscope.auth = null;\n this.rootscope.user = null;\n return this.storage.remove(\"userInfo\");\n };\n\n AuthService.prototype.setToken = function(token) {\n return this.storage.set(\"token\", token);\n };\n\n AuthService.prototype.getToken = function() {\n return this.storage.get(\"token\");\n };\n\n AuthService.prototype.removeToken = function() {\n return this.storage.remove(\"token\");\n };\n\n AuthService.prototype.isAuthenticated = function() {\n if (this.getUser() !== null) {\n return true;\n }\n return false;\n };\n\n AuthService.prototype.refresh = function() {\n var url;\n url = this.urls.resolve(\"user-me\");\n return this.http.get(url).then((function(_this) {\n return function(data, status) {\n var user;\n user = data.data;\n user.token = _this.getUser().auth_token;\n user = _this.model.make_model(\"users\", user);\n _this.setUser(user);\n return user;\n };\n })(this));\n };\n\n AuthService.prototype.login = function(data, type) {\n var url;\n url = this.urls.resolve(\"auth\");\n data = _.clone(data, false);\n data.type = type ? type : \"normal\";\n this.removeToken();\n return this.http.post(url, data).then((function(_this) {\n return function(data, status) {\n var user;\n user = _this.model.make_model(\"users\", data.data);\n _this.setToken(user.auth_token);\n _this.setUser(user);\n return user;\n };\n })(this));\n };\n\n AuthService.prototype.logout = function() {\n this.removeToken();\n this.clear();\n this.currentUserService.removeUser();\n this._setTheme();\n return this._setLocales();\n };\n\n AuthService.prototype.register = function(data, type, existing) {\n var url;\n url = this.urls.resolve(\"auth-register\");\n data = _.clone(data, false);\n data.type = type ? type : \"public\";\n if (type === \"private\") {\n data.existing = existing ? existing : false;\n }\n this.removeToken();\n return this.http.post(url, data).then((function(_this) {\n return function(response) {\n var user;\n user = _this.model.make_model(\"users\", response.data);\n _this.setToken(user.auth_token);\n _this.setUser(user);\n return user;\n };\n })(this));\n };\n\n AuthService.prototype.getInvitation = function(token) {\n return this.rs.invitations.get(token);\n };\n\n AuthService.prototype.acceptInvitiationWithNewUser = function(data) {\n return this.register(data, \"private\", false);\n };\n\n AuthService.prototype.acceptInvitiationWithExistingUser = function(data) {\n return this.register(data, \"private\", true);\n };\n\n AuthService.prototype.forgotPassword = function(data) {\n var url;\n url = this.urls.resolve(\"users-password-recovery\");\n data = _.clone(data, false);\n this.removeToken();\n return this.http.post(url, data);\n };\n\n AuthService.prototype.changePasswordFromRecovery = function(data) {\n var url;\n url = this.urls.resolve(\"users-change-password-from-recovery\");\n data = _.clone(data, false);\n this.removeToken();\n return this.http.post(url, data);\n };\n\n AuthService.prototype.changeEmail = function(data) {\n var url;\n url = this.urls.resolve(\"users-change-email\");\n data = _.clone(data, false);\n return this.http.post(url, data);\n };\n\n AuthService.prototype.cancelAccount = function(data) {\n var url;\n url = this.urls.resolve(\"users-cancel-account\");\n data = _.clone(data, false);\n return this.http.post(url, data);\n };\n\n return AuthService;\n\n })(taiga.Service);\n\n module.service(\"$tgAuth\", AuthService);\n\n PublicRegisterMessageDirective = function($config, $navUrls, $routeParams, templates) {\n var template, templateFn;\n template = templates.get(\"auth/login-text.html\", true);\n templateFn = function() {\n var nextUrl, publicRegisterEnabled, url;\n publicRegisterEnabled = $config.get(\"publicRegisterEnabled\");\n if (!publicRegisterEnabled) {\n return \"\";\n }\n url = $navUrls.resolve(\"register\");\n if ($routeParams['force_next']) {\n nextUrl = encodeURIComponent($routeParams['force_next']);\n url += \"?next=\" + nextUrl;\n }\n return template({\n url: url\n });\n };\n return {\n restrict: \"AE\",\n scope: {},\n template: templateFn\n };\n };\n\n module.directive(\"tgPublicRegisterMessage\", [\"$tgConfig\", \"$tgNavUrls\", \"$routeParams\", \"$tgTemplate\", PublicRegisterMessageDirective]);\n\n LoginDirective = function($auth, $confirm, $location, $config, $routeParams, $navUrls, $events, $translate, $window) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onError, onSuccess, submit;\n form = new checksley.Form($el.find(\"form.login-form\"));\n if ($routeParams['next'] && $routeParams['next'] !== $navUrls.resolve(\"login\")) {\n $scope.nextUrl = decodeURIComponent($routeParams['next']);\n } else {\n $scope.nextUrl = $navUrls.resolve(\"home\");\n }\n if ($routeParams['force_next']) {\n $scope.nextUrl = decodeURIComponent($routeParams['force_next']);\n }\n onSuccess = function(response) {\n $events.setupConnection();\n if ($scope.nextUrl.indexOf('http') === 0) {\n return $window.location.href = $scope.nextUrl;\n } else {\n return $location.url($scope.nextUrl);\n }\n };\n onError = function(response) {\n return $confirm.notify(\"light-error\", $translate.instant(\"LOGIN_FORM.ERROR_AUTH_INCORRECT\"));\n };\n $scope.onKeyUp = function(event) {\n var target, value;\n target = angular.element(event.currentTarget);\n value = target.val();\n $scope.iscapsLockActivated = false;\n if (value !== value.toLowerCase()) {\n return $scope.iscapsLockActivated = true;\n }\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var data, loginFormType, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n data = {\n \"username\": $el.find(\"form.login-form input[name=username]\").val(),\n \"password\": $el.find(\"form.login-form input[name=password]\").val()\n };\n loginFormType = $config.get(\"loginFormType\", \"normal\");\n promise = $auth.login(data, loginFormType);\n return promise.then(onSuccess, onError);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n window.prerenderReady = true;\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLogin\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgConfig\", \"$routeParams\", \"$tgNavUrls\", \"$tgEvents\", \"$translate\", \"$window\", LoginDirective]);\n\n RegisterDirective = function($auth, $confirm, $location, $navUrls, $config, $routeParams, $analytics, $translate, $window) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n if (!$config.get(\"publicRegisterEnabled\")) {\n $location.path($navUrls.resolve(\"not-found\"));\n $location.replace();\n }\n $scope.data = {};\n form = $el.find(\"form\").checksley({\n onlyOneErrorElement: true\n });\n if ($routeParams['next'] && $routeParams['next'] !== $navUrls.resolve(\"login\")) {\n $scope.nextUrl = decodeURIComponent($routeParams['next']);\n } else {\n $scope.nextUrl = $navUrls.resolve(\"home\");\n }\n onSuccessSubmit = function(response) {\n $analytics.trackEvent(\"auth\", \"register\", \"user registration\", 1);\n if ($scope.nextUrl.indexOf('http') === 0) {\n return $window.location.href = $scope.nextUrl;\n } else {\n return $location.url($scope.nextUrl);\n }\n };\n onErrorSubmit = function(response) {\n var text;\n if (response.data._error_message) {\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n $confirm.notify(\"light-error\", text);\n }\n return form.setErrors(response.data);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.register($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return window.prerenderReady = true;\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRegister\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfig\", \"$routeParams\", \"$tgAnalytics\", \"$translate\", \"$window\", RegisterDirective]);\n\n ForgotPasswordDirective = function($auth, $confirm, $location, $navUrls, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n var message, title;\n $location.path($navUrls.resolve(\"login\"));\n title = $translate.instant(\"FORGOT_PASSWORD_FORM.SUCCESS_TITLE\");\n message = $translate.instant(\"FORGOT_PASSWORD_FORM.SUCCESS_TEXT\");\n return $confirm.success(title, message);\n };\n onErrorSubmit = function(response) {\n var text;\n text = $translate.instant(\"FORGOT_PASSWORD_FORM.ERROR\");\n return $confirm.notify(\"light-error\", text);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.forgotPassword($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return window.prerenderReady = true;\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgForgotPassword\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgNavUrls\", \"$translate\", ForgotPasswordDirective]);\n\n ChangePasswordFromRecoveryDirective = function($auth, $confirm, $location, $params, $navUrls, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit, text;\n $scope.data = {};\n if ($params.token != null) {\n $scope.tokenInParams = true;\n $scope.data.token = $params.token;\n } else {\n $location.path($navUrls.resolve(\"login\"));\n text = $translate.instant(\"CHANGE_PASSWORD_RECOVERY_FORM.ERROR\");\n $confirm.notify(\"light-error\", text);\n }\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n $location.path($navUrls.resolve(\"login\"));\n text = $translate.instant(\"CHANGE_PASSWORD_RECOVERY_FORM.SUCCESS\");\n return $confirm.success(text);\n };\n onErrorSubmit = function(response) {\n text = $translate.instant(\"CHANGE_PASSWORD_RECOVERY_FORM.ERROR\");\n return $confirm.notify(\"light-error\", text);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.changePasswordFromRecovery($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgChangePasswordFromRecovery\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$translate\", ChangePasswordFromRecoveryDirective]);\n\n InvitationDirective = function($auth, $confirm, $location, $params, $navUrls, $analytics, $translate, config) {\n var link;\n link = function($scope, $el, $attrs) {\n var loginForm, onErrorSubmitLogin, onErrorSubmitRegister, onSuccessSubmitLogin, onSuccessSubmitRegister, promise, registerForm, submitLogin, submitRegister, token;\n token = $params.token;\n promise = $auth.getInvitation(token);\n promise.then(function(invitation) {\n $scope.invitation = invitation;\n return $scope.publicRegisterEnabled = config.get(\"publicRegisterEnabled\");\n });\n promise.then(null, function(response) {\n var text;\n $location.path($navUrls.resolve(\"login\"));\n text = $translate.instant(\"INVITATION_LOGIN_FORM.NOT_FOUND\");\n return $confirm.notify(\"light-error\", text);\n });\n $scope.dataLogin = {\n token: token\n };\n loginForm = $el.find(\"form.login-form\").checksley({\n onlyOneErrorElement: true\n });\n onSuccessSubmitLogin = function(response) {\n var text;\n $analytics.trackEvent(\"auth\", \"invitationAccept\", \"invitation accept with existing user\", 1);\n $location.path($navUrls.resolve(\"project\", {\n project: $scope.invitation.project_slug\n }));\n text = $translate.instant(\"INVITATION_LOGIN_FORM.SUCCESS\", {\n \"project_name\": $scope.invitation.project_name\n });\n return $confirm.notify(\"success\", text);\n };\n onErrorSubmitLogin = function(response) {\n return $confirm.notify(\"light-error\", response.data._error_message);\n };\n submitLogin = debounce(2000, (function(_this) {\n return function(event) {\n event.preventDefault();\n if (!loginForm.validate()) {\n return;\n }\n promise = $auth.acceptInvitiationWithExistingUser($scope.dataLogin);\n return promise.then(onSuccessSubmitLogin, onErrorSubmitLogin);\n };\n })(this));\n $el.on(\"submit\", \"form.login-form\", submitLogin);\n $el.on(\"click\", \".button-login\", submitLogin);\n $scope.dataRegister = {\n token: token\n };\n registerForm = $el.find(\"form.register-form\").checksley({\n onlyOneErrorElement: true\n });\n onSuccessSubmitRegister = function(response) {\n $analytics.trackEvent(\"auth\", \"invitationAccept\", \"invitation accept with new user\", 1);\n $location.path($navUrls.resolve(\"project\", {\n project: $scope.invitation.project_slug\n }));\n return $confirm.notify(\"success\", \"You've successfully joined this project\", \"Welcome to \" + (_.escape($scope.invitation.project_name)));\n };\n onErrorSubmitRegister = function(response) {\n var text;\n if (response.data._error_message) {\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n $confirm.notify(\"light-error\", text);\n }\n return registerForm.setErrors(response.data);\n };\n submitRegister = debounce(2000, (function(_this) {\n return function(event) {\n event.preventDefault();\n if (!registerForm.validate()) {\n return;\n }\n promise = $auth.acceptInvitiationWithNewUser($scope.dataRegister);\n return promise.then(onSuccessSubmitRegister, onErrorSubmitRegister);\n };\n })(this));\n $el.on(\"submit\", \"form.register-form\", submitRegister);\n $el.on(\"click\", \".button-register\", submitRegister);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgInvitation\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$tgAnalytics\", \"$translate\", \"$tgConfig\", InvitationDirective]);\n\n ChangeEmailDirective = function($repo, $model, $auth, $confirm, $location, $params, $navUrls, $translate) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n $scope.data.email_token = $params.email_token;\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n var text;\n if ($auth.isAuthenticated()) {\n $repo.queryOne(\"users\", $auth.getUser().id).then((function(_this) {\n return function(data) {\n $auth.setUser(data);\n return $location.path($navUrls.resolve(\"home\"));\n };\n })(this));\n } else {\n $location.path($navUrls.resolve(\"login\"));\n }\n text = $translate.instant(\"CHANGE_EMAIL_FORM.SUCCESS\");\n return $confirm.success(text);\n };\n onErrorSubmit = function(response) {\n var text;\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n return $confirm.notify(\"light-error\", text);\n };\n submit = function() {\n var promise;\n if (!form.validate()) {\n return;\n }\n promise = $auth.changeEmail($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n $el.on(\"submit\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \"a.button-change-email\", function(event) {\n event.preventDefault();\n return submit();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgChangeEmail\", [\"$tgRepo\", \"$tgModel\", \"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$translate\", ChangeEmailDirective]);\n\n CancelAccountDirective = function($repo, $model, $auth, $confirm, $location, $params, $navUrls) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n $scope.data.cancel_token = $params.cancel_token;\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n var text;\n $auth.logout();\n $location.path($navUrls.resolve(\"home\"));\n text = $translate.instant(\"CANCEL_ACCOUNT.SUCCESS\");\n return $confirm.success(text);\n };\n onErrorSubmit = function(response) {\n var text;\n text = $translate.instant(\"COMMON.GENERIC_ERROR\", {\n error: response.data._error_message\n });\n return $confirm.notify(\"error\", text);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n promise = $auth.cancelAccount($scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgCancelAccount\", [\"$tgRepo\", \"$tgModel\", \"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", CancelAccountDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaBacklog\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base.coffee\n */\n\n(function() {\n var TaigaMainDirective, bindOnce, groupBy, init, module, taiga, urls;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaBase\", []);\n\n TaigaMainDirective = function($rootscope, $window) {\n var link;\n link = function($scope, $el, $attrs) {\n return $window.onresize = function() {\n return $rootscope.$broadcast(\"resize\");\n };\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMain\", [\"$rootScope\", \"$window\", TaigaMainDirective]);\n\n urls = {\n \"home\": \"/\",\n \"projects\": \"/projects\",\n \"error\": \"/error\",\n \"not-found\": \"/not-found\",\n \"permission-denied\": \"/permission-denied\",\n \"discover\": \"/discover\",\n \"discover-search\": \"/discover/search\",\n \"login\": \"/login\",\n \"forgot-password\": \"/forgot-password\",\n \"change-password\": \"/change-password/:token\",\n \"change-email\": \"/change-email/:token\",\n \"cancel-account\": \"/cancel-account/:token\",\n \"register\": \"/register\",\n \"invitation\": \"/invitation/:token\",\n \"create-project\": \"/create-project\",\n \"profile\": \"/profile\",\n \"user-profile\": \"/profile/:username\",\n \"blocked-project\": \"/blocked-project/:project\",\n \"project\": \"/project/:project\",\n \"project-backlog\": \"/project/:project/backlog\",\n \"project-taskboard\": \"/project/:project/taskboard/:sprint\",\n \"project-kanban\": \"/project/:project/kanban\",\n \"project-issues\": \"/project/:project/issues\",\n \"project-epics\": \"/project/:project/epics\",\n \"project-search\": \"/project/:project/search\",\n \"project-epics-detail\": \"/project/:project/epic/:ref\",\n \"project-userstories-detail\": \"/project/:project/us/:ref\",\n \"project-tasks-detail\": \"/project/:project/task/:ref\",\n \"project-issues-detail\": \"/project/:project/issue/:ref\",\n \"project-wiki\": \"/project/:project/wiki\",\n \"project-wiki-list\": \"/project/:project/wiki-list\",\n \"project-wiki-page\": \"/project/:project/wiki/:slug\",\n \"project-team\": \"/project/:project/team\",\n \"project-admin-home\": \"/project/:project/admin/project-profile/details\",\n \"project-admin-project-profile-details\": \"/project/:project/admin/project-profile/details\",\n \"project-admin-project-profile-default-values\": \"/project/:project/admin/project-profile/default-values\",\n \"project-admin-project-profile-modules\": \"/project/:project/admin/project-profile/modules\",\n \"project-admin-project-profile-export\": \"/project/:project/admin/project-profile/export\",\n \"project-admin-project-profile-reports\": \"/project/:project/admin/project-profile/reports\",\n \"project-admin-project-values-status\": \"/project/:project/admin/project-values/status\",\n \"project-admin-project-values-points\": \"/project/:project/admin/project-values/points\",\n \"project-admin-project-values-priorities\": \"/project/:project/admin/project-values/priorities\",\n \"project-admin-project-values-severities\": \"/project/:project/admin/project-values/severities\",\n \"project-admin-project-values-types\": \"/project/:project/admin/project-values/types\",\n \"project-admin-project-values-custom-fields\": \"/project/:project/admin/project-values/custom-fields\",\n \"project-admin-project-values-tags\": \"/project/:project/admin/project-values/tags\",\n \"project-admin-memberships\": \"/project/:project/admin/memberships\",\n \"project-admin-roles\": \"/project/:project/admin/roles\",\n \"project-admin-third-parties-webhooks\": \"/project/:project/admin/third-parties/webhooks\",\n \"project-admin-third-parties-github\": \"/project/:project/admin/third-parties/github\",\n \"project-admin-third-parties-gitlab\": \"/project/:project/admin/third-parties/gitlab\",\n \"project-admin-third-parties-bitbucket\": \"/project/:project/admin/third-parties/bitbucket\",\n \"project-admin-third-parties-gogs\": \"/project/:project/admin/third-parties/gogs\",\n \"project-admin-contrib\": \"/project/:project/admin/contrib/:plugin\",\n \"user-settings-user-profile\": \"/user-settings/user-profile\",\n \"user-settings-user-change-password\": \"/user-settings/user-change-password\",\n \"user-settings-user-avatar\": \"/user-settings/user-avatar\",\n \"user-settings-mail-notifications\": \"/user-settings/mail-notifications\",\n \"user-settings-contrib\": \"/user-settings/contrib/:plugin\"\n };\n\n init = function($log, $navurls) {\n $log.debug(\"Initialize navigation urls\");\n return $navurls.update(urls);\n };\n\n module.run([\"$log\", \"$tgNavUrls\", init]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common.coffee\n */\n\n(function() {\n var AnimationFrame, Autofocus, Capslock, CheckPermissionDirective, ClassPermissionDirective, DataPickerConfig, LightboxClose, ProjectUrl, Qqueue, QueueModelTransformation, SelectedText, Svg, Template, ToggleCommentDirective, module, taiga,\n slice = [].slice,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\", []);\n\n DataPickerConfig = function($translate) {\n return {\n get: function() {\n return {\n i18n: {\n previousMonth: $translate.instant(\"COMMON.PICKERDATE.PREV_MONTH\"),\n nextMonth: $translate.instant(\"COMMON.PICKERDATE.NEXT_MONTH\"),\n months: [$translate.instant(\"COMMON.PICKERDATE.MONTHS.JAN\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.FEB\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.MAR\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.APR\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.MAY\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.JUN\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.JUL\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.AUG\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.SEP\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.OCT\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.NOV\"), $translate.instant(\"COMMON.PICKERDATE.MONTHS.DEC\")],\n weekdays: [$translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.SUN\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.MON\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.TUE\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.WED\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.THU\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.FRI\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS.SAT\")],\n weekdaysShort: [$translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.SUN\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.MON\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.TUE\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.WED\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.THU\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.FRI\"), $translate.instant(\"COMMON.PICKERDATE.WEEK_DAYS_SHORT.SAT\")]\n },\n isRTL: $translate.instant(\"COMMON.PICKERDATE.IS_RTL\") === \"true\",\n firstDay: parseInt($translate.instant(\"COMMON.PICKERDATE.FIRST_DAY_OF_WEEK\"), 10),\n format: $translate.instant(\"COMMON.PICKERDATE.FORMAT\")\n };\n }\n };\n };\n\n module.factory(\"tgDatePickerConfigService\", [\"$translate\", DataPickerConfig]);\n\n SelectedText = function($window, $document) {\n var get;\n get = function() {\n if ($window.getSelection) {\n return $window.getSelection().toString();\n } else if ($document.selection) {\n return $document.selection.createRange().text;\n }\n return \"\";\n };\n return {\n get: get\n };\n };\n\n module.factory(\"$selectedText\", [\"$window\", \"$document\", SelectedText]);\n\n CheckPermissionDirective = function(projectService) {\n var link, render;\n render = function($el, project, permission) {\n if (project && permission) {\n if (project.get('my_permissions').indexOf(permission) > -1) {\n return $el.removeClass('hidden');\n }\n }\n };\n link = function($scope, $el, $attrs) {\n var permission, unObserve, unwatch;\n $el.addClass('hidden');\n permission = $attrs.tgCheckPermission;\n unwatch = $scope.$watch(function() {\n return projectService.project;\n }, function() {\n if (!projectService.project) {\n return;\n }\n render($el, projectService.project, permission);\n return unwatch();\n });\n unObserve = $attrs.$observe(\"tgCheckPermission\", function(permission) {\n if (!permission) {\n return;\n }\n render($el, projectService.project, permission);\n return unObserve();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n CheckPermissionDirective.$inject = [\"tgProjectService\"];\n\n module.directive(\"tgCheckPermission\", CheckPermissionDirective);\n\n ClassPermissionDirective = function() {\n var link, name;\n name = \"tgClassPermission\";\n link = function($scope, $el, $attrs) {\n var checkPermissions, tgClassPermissionWatchAction, unbindWatcher;\n checkPermissions = function(project, className, permission) {\n var negation;\n negation = permission[0] === \"!\";\n if (negation) {\n permission = permission.slice(1);\n }\n if (negation && project.my_permissions.indexOf(permission) === -1) {\n return $el.addClass(className);\n } else if (!negation && project.my_permissions.indexOf(permission) !== -1) {\n return $el.addClass(className);\n } else {\n return $el.removeClass(className);\n }\n };\n tgClassPermissionWatchAction = function(project) {\n var className, classes, permission, results;\n if (project) {\n unbindWatcher();\n classes = $scope.$eval($attrs[name]);\n results = [];\n for (className in classes) {\n permission = classes[className];\n results.push(checkPermissions(project, className, permission));\n }\n return results;\n }\n };\n return unbindWatcher = $scope.$watch(\"project\", tgClassPermissionWatchAction);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgClassPermission\", ClassPermissionDirective);\n\n AnimationFrame = function() {\n var add, animationFrame, performAnimation, tail;\n animationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;\n performAnimation = (function(_this) {\n return function(time) {\n var fn;\n fn = tail.shift();\n fn();\n if (tail.length) {\n return animationFrame(performAnimation);\n }\n };\n })(this);\n tail = [];\n add = function() {\n var fn, i, len, results;\n results = [];\n for (i = 0, len = arguments.length; i < len; i++) {\n fn = arguments[i];\n tail.push(fn);\n if (tail.length === 1) {\n results.push(animationFrame(performAnimation));\n } else {\n results.push(void 0);\n }\n }\n return results;\n };\n return {\n add: add\n };\n };\n\n module.factory(\"animationFrame\", AnimationFrame);\n\n ToggleCommentDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $el.find(\"textarea\").on(\"focus\", function() {\n return $el.addClass(\"active\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgToggleComment\", ToggleCommentDirective);\n\n ProjectUrl = function($navurls) {\n var get;\n get = function(project) {\n var ctx;\n ctx = {\n project: project.slug\n };\n if (project.is_backlog_activated && project.my_permissions.indexOf(\"view_us\") > -1) {\n return $navurls.resolve(\"project-backlog\", ctx);\n }\n if (project.is_kanban_activated && project.my_permissions.indexOf(\"view_us\") > -1) {\n return $navurls.resolve(\"project-kanban\", ctx);\n }\n if (project.is_wiki_activated && project.my_permissions.indexOf(\"view_wiki_pages\") > -1) {\n return $navurls.resolve(\"project-wiki\", ctx);\n }\n if (project.is_issues_activated && project.my_permissions.indexOf(\"view_issues\") > -1) {\n return $navurls.resolve(\"project-issues\", ctx);\n }\n return $navurls.resolve(\"project\", ctx);\n };\n return {\n get: get\n };\n };\n\n module.factory(\"$projectUrl\", [\"$tgNavUrls\", ProjectUrl]);\n\n Qqueue = function($q) {\n var deferred, lastPromise, qqueue;\n deferred = $q.defer();\n deferred.resolve();\n lastPromise = deferred.promise;\n qqueue = {\n bindAdd: (function(_this) {\n return function(fn) {\n return function() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return lastPromise = lastPromise.then(function() {\n return fn.apply(_this, args);\n });\n };\n return qqueue;\n };\n })(this),\n add: (function(_this) {\n return function(fn) {\n if (!lastPromise) {\n lastPromise = fn();\n } else {\n lastPromise = lastPromise.then(fn);\n }\n return qqueue;\n };\n })(this)\n };\n return qqueue;\n };\n\n module.factory(\"$tgQqueue\", [\"$q\", Qqueue]);\n\n QueueModelTransformation = (function(superClass) {\n extend(QueueModelTransformation, superClass);\n\n QueueModelTransformation.$inject = [\"$tgQqueue\", \"$tgRepo\", \"$q\", \"$tgModel\"];\n\n function QueueModelTransformation(qqueue1, repo, q, model1) {\n this.qqueue = qqueue1;\n this.repo = repo;\n this.q = q;\n this.model = model1;\n }\n\n QueueModelTransformation.prototype.setObject = function(scope1, prop) {\n this.scope = scope1;\n this.prop = prop;\n };\n\n QueueModelTransformation.prototype.clone = function() {\n var attrs, model;\n attrs = _.cloneDeep(this.scope[this.prop]._attrs);\n model = this.model.make_model(this.scope[this.prop]._name, attrs);\n return model;\n };\n\n QueueModelTransformation.prototype.getObj = function() {\n return this.scope[this.prop];\n };\n\n QueueModelTransformation.prototype.save = function(transformation) {\n var defered;\n defered = this.q.defer();\n this.qqueue.add((function(_this) {\n return function() {\n var clone, comment, modified, obj, success;\n obj = _this.getObj();\n comment = obj.comment;\n obj.comment = '';\n clone = _this.clone();\n modified = _.omit(obj._modifiedAttrs, ['version']);\n clone = _.assign(clone, modified);\n transformation(clone);\n if (comment.length) {\n clone.comment = comment;\n }\n success = function() {\n _this.scope[_this.prop] = clone;\n return defered.resolve.apply(null, arguments);\n };\n return _this.repo.save(clone).then(success, defered.reject);\n };\n })(this));\n return defered.promise;\n };\n\n return QueueModelTransformation;\n\n })(taiga.Service);\n\n module.service(\"$tgQueueModelTransformation\", QueueModelTransformation);\n\n Template = function($templateCache) {\n return {\n get: (function(_this) {\n return function(name, lodash) {\n var tmp;\n if (lodash == null) {\n lodash = false;\n }\n tmp = $templateCache.get(name);\n if (lodash) {\n tmp = _.template(tmp);\n }\n return tmp;\n };\n })(this)\n };\n };\n\n module.factory(\"$tgTemplate\", [\"$templateCache\", Template]);\n\n Capslock = function() {\n var template;\n template = \"\";\n return {\n template: template\n };\n };\n\n module.directive(\"tgCapslock\", [Capslock]);\n\n LightboxClose = function() {\n var template;\n template = \"\\n \\n\";\n return {\n template: template\n };\n };\n\n module.directive(\"tgLightboxClose\", [LightboxClose]);\n\n Svg = function() {\n var template;\n template = \"\";\n return {\n scope: {\n svgIcon: \"@\",\n svgTitle: \"@\",\n svgTitleTranslate: \"@\",\n svgTitleTranslateValues: \"=\"\n },\n template: template\n };\n };\n\n module.directive(\"tgSvg\", [Svg]);\n\n Autofocus = function($timeout) {\n return {\n restrict: 'A',\n link: function($scope, $element) {\n return $timeout(function() {\n return $element[0].focus();\n });\n }\n };\n };\n\n module.directive('tgAutofocus', ['$timeout', Autofocus]);\n\n module.directive('tgPreloadImage', function() {\n var preload, spinner, template;\n spinner = \"
\";\n template = \"\\n \\n
\";\n preload = function(src, onLoad) {\n var image;\n image = new Image();\n image.onload = onLoad;\n image.src = src;\n return image;\n };\n return {\n template: template,\n transclude: true,\n replace: true,\n link: function(scope, el, attrs) {\n var image, onLoad, timeout;\n image = el.find('img:last');\n timeout = null;\n onLoad = function() {\n el.find('.loading-spinner').remove();\n image.show();\n if (timeout) {\n clearTimeout(timeout);\n return timeout = null;\n }\n };\n return attrs.$observe('preloadSrc', function(src) {\n if (timeout) {\n clearTimeout(timeout);\n }\n el.find('.loading-spinner').remove();\n timeout = setTimeout(function() {\n return el.prepend(spinner);\n }, 200);\n image.hide();\n return preload(src, onLoad);\n });\n }\n };\n });\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/epics.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaEpics\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/events.coffee\n */\n\n(function() {\n var EventsProvider, EventsService, bindMethods, module, startswith, taiga,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n taiga = this.taiga;\n\n startswith = this.taiga.startswith;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaEvents\", []);\n\n EventsService = (function() {\n function EventsService(win, log, config, auth, liveAnnouncementService1, rootScope) {\n this.win = win;\n this.log = log;\n this.config = config;\n this.auth = auth;\n this.liveAnnouncementService = liveAnnouncementService1;\n this.rootScope = rootScope;\n this.processMessage = bind(this.processMessage, this);\n bindMethods(this);\n }\n\n EventsService.prototype.initialize = function(sessionId) {\n this.sessionId = sessionId;\n this.subscriptions = {};\n this.connected = false;\n this.error = false;\n this.pendingMessages = [];\n this.missedHeartbeats = 0;\n this.heartbeatInterval = null;\n if (this.win.WebSocket === void 0) {\n return this.log.info(\"WebSockets not supported on your browser\");\n }\n };\n\n EventsService.prototype.setupConnection = function() {\n var loc, path, scheme, url;\n this.stopExistingConnection();\n url = this.config.get(\"eventsUrl\");\n if (!url) {\n return;\n }\n if (!startswith(url, \"ws:\") && !startswith(url, \"wss:\")) {\n loc = this.win.location;\n scheme = loc.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n path = _.trimStart(url, \"/\");\n url = scheme + \"//\" + loc.host + \"/\" + path;\n }\n this.ws = new this.win.WebSocket(url);\n this.ws.addEventListener(\"open\", this.onOpen);\n this.ws.addEventListener(\"message\", this.onMessage);\n this.ws.addEventListener(\"error\", this.onError);\n return this.ws.addEventListener(\"close\", this.onClose);\n };\n\n EventsService.prototype.stopExistingConnection = function() {\n if (this.ws === void 0) {\n return;\n }\n this.ws.removeEventListener(\"open\", this.onOpen);\n this.ws.removeEventListener(\"close\", this.onClose);\n this.ws.removeEventListener(\"error\", this.onError);\n this.ws.removeEventListener(\"message\", this.onMessage);\n this.stopHeartBeatMessages();\n this.ws.close();\n return delete this.ws;\n };\n\n EventsService.prototype.notifications = function() {\n return this.subscribe(null, 'notifications', (function(_this) {\n return function(data) {\n _this.liveAnnouncementService.show(data.title, data.desc);\n return _this.rootScope.$digest();\n };\n })(this));\n };\n\n EventsService.prototype.startHeartBeatMessages = function() {\n var heartbeatIntervalTime, maxMissedHeartbeats, reconnectTryInterval;\n if (this.heartbeatInterval) {\n return;\n }\n maxMissedHeartbeats = this.config.get(\"eventsMaxMissedHeartbeats\", 5);\n heartbeatIntervalTime = this.config.get(\"eventsHeartbeatIntervalTime\", 60000);\n reconnectTryInterval = this.config.get(\"eventsReconnectTryInterval\", 10000);\n this.missedHeartbeats = 0;\n this.heartbeatInterval = setInterval((function(_this) {\n return function() {\n var e, error1;\n try {\n if (_this.missedHeartbeats >= maxMissedHeartbeats) {\n throw new Error(\"Too many missed heartbeats PINGs.\");\n }\n _this.missedHeartbeats++;\n _this.sendMessage({\n cmd: \"ping\"\n });\n return _this.log.debug(\"HeartBeat send PING\");\n } catch (error1) {\n e = error1;\n _this.log.error(\"HeartBeat error: \" + e.message);\n return _this.setupConnection();\n }\n };\n })(this), heartbeatIntervalTime);\n return this.log.debug(\"HeartBeat enabled\");\n };\n\n EventsService.prototype.stopHeartBeatMessages = function() {\n if (!this.heartbeatInterval) {\n return;\n }\n clearInterval(this.heartbeatInterval);\n this.heartbeatInterval = null;\n return this.log.debug(\"HeartBeat disabled\");\n };\n\n EventsService.prototype.processHeartBeatPongMessage = function(data) {\n this.missedHeartbeats = 0;\n return this.log.debug(\"HeartBeat recived PONG\");\n };\n\n EventsService.prototype.serialize = function(message) {\n if (_.isObject(message)) {\n return JSON.stringify(message);\n }\n return message;\n };\n\n EventsService.prototype.sendMessage = function(message) {\n var i, len, messages, msg, results;\n this.pendingMessages.push(message);\n if (!this.connected) {\n return;\n }\n messages = _.map(this.pendingMessages, this.serialize);\n this.pendingMessages = [];\n results = [];\n for (i = 0, len = messages.length; i < len; i++) {\n msg = messages[i];\n results.push(this.ws.send(msg));\n }\n return results;\n };\n\n EventsService.prototype.processMessage = function(data) {\n var routingKey, subscription;\n routingKey = data.routing_key;\n if (this.subscriptions[routingKey] == null) {\n return;\n }\n subscription = this.subscriptions[routingKey];\n if (subscription.scope) {\n return subscription.scope.$apply(function() {\n return subscription.callback(data.data);\n });\n } else {\n return subscription.callback(data.data);\n }\n };\n\n EventsService.prototype.subscribe = function(scope, routingKey, callback) {\n var message, subscription;\n if (this.error) {\n return;\n }\n this.log.debug(\"Subscribe to: \" + routingKey);\n subscription = {\n scope: scope,\n routingKey: routingKey,\n callback: _.debounce(callback, 500, {\n \"leading\": true,\n \"trailing\": false\n })\n };\n message = {\n \"cmd\": \"subscribe\",\n \"routing_key\": routingKey\n };\n this.subscriptions[routingKey] = subscription;\n this.sendMessage(message);\n if (scope) {\n return scope.$on(\"$destroy\", (function(_this) {\n return function() {\n return _this.unsubscribe(routingKey);\n };\n })(this));\n }\n };\n\n EventsService.prototype.unsubscribe = function(routingKey) {\n var message;\n if (this.error) {\n return;\n }\n this.log.debug(\"Unsubscribe from: \" + routingKey);\n message = {\n \"cmd\": \"unsubscribe\",\n \"routing_key\": routingKey\n };\n return this.sendMessage(message);\n };\n\n EventsService.prototype.onOpen = function() {\n var message, token;\n this.connected = true;\n this.startHeartBeatMessages();\n this.log.debug(\"WebSocket connection opened\");\n token = this.auth.getToken();\n message = {\n cmd: \"auth\",\n data: {\n token: token,\n sessionId: this.sessionId\n }\n };\n this.sendMessage(message);\n return this.notifications();\n };\n\n EventsService.prototype.onMessage = function(event) {\n var data;\n this.log.debug(\"WebSocket message received: \" + event.data);\n data = JSON.parse(event.data);\n if (data.cmd === \"pong\") {\n return this.processHeartBeatPongMessage(data);\n } else {\n return this.processMessage(data);\n }\n };\n\n EventsService.prototype.onError = function(error) {\n this.log.error(\"WebSocket error: \" + error);\n this.error = true;\n return setTimeout(this.setupConnection, this.reconnectTryInterval);\n };\n\n EventsService.prototype.onClose = function() {\n this.log.debug(\"WebSocket closed.\");\n this.connected = false;\n this.stopHeartBeatMessages();\n return setTimeout(this.setupConnection, this.reconnectTryInterval);\n };\n\n return EventsService;\n\n })();\n\n EventsProvider = (function() {\n function EventsProvider() {}\n\n EventsProvider.prototype.setSessionId = function(sessionId) {\n return this.sessionId = sessionId;\n };\n\n EventsProvider.prototype.$get = function($win, $log, $conf, $auth, liveAnnouncementService, $rootScope) {\n var service;\n service = new EventsService($win, $log, $conf, $auth, liveAnnouncementService, $rootScope);\n service.initialize(this.sessionId);\n return service;\n };\n\n EventsProvider.prototype.$get.$inject = [\"$window\", \"$log\", \"$tgConfig\", \"$tgAuth\", \"tgLiveAnnouncementService\", \"$rootScope\"];\n\n return EventsProvider;\n\n })();\n\n module.provider(\"$tgEvents\", EventsProvider);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/feedback.coffee\n */\n\n(function() {\n var FeedbackDirective, bindOnce, debounce, groupBy, mixOf, module, taiga, trim;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n mixOf = this.taiga.mixOf;\n\n debounce = this.taiga.debounce;\n\n trim = this.taiga.trim;\n\n module = angular.module(\"taigaFeedback\", []);\n\n FeedbackDirective = function($lightboxService, $repo, $confirm, $loading, feedbackService) {\n var directive, link;\n link = function($scope, $el, $attrs) {\n var form, openLightbox, submit, submitButton;\n form = $el.find(\"form\").checksley();\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $repo.create(\"feedback\", $scope.feedback);\n promise.then(function(data) {\n currentLoading.finish();\n $lightboxService.close($el);\n return $confirm.notify(\"success\", \"\\\\o/ we'll be happy to read your\");\n });\n return promise.then(null, function() {\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n openLightbox = function() {\n $scope.feedback = {};\n $lightboxService.open($el);\n return $el.find(\"textarea\").focus();\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return openLightbox();\n };\n directive = {\n link: link,\n templateUrl: \"common/lightbox-feedback.html\",\n scope: {}\n };\n return directive;\n };\n\n module.directive(\"tgLbFeedback\", [\"lightboxService\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"tgFeedbackService\", FeedbackDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/integrations.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaIntegrations\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/issues.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaIssues\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/kanban.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaKanban\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/backlog.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaPlugins\", [\"ngRoute\"]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/projects.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaProject\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/related-tasks.coffee\n */\n\n(function() {\n var RelatedTaskAssignedToInlineEditionDirective, RelatedTaskCreateButtonDirective, RelatedTaskCreateFormDirective, RelatedTaskRowDirective, RelatedTasksDirective, debounce, module, taiga, trim;\n\n taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaRelatedTasks\", []);\n\n RelatedTaskRowDirective = function($repo, $compile, $confirm, $rootscope, $loading, $template, $translate) {\n var link, templateEdit, templateView;\n templateView = $template.get(\"task/related-task-row.html\", true);\n templateEdit = $template.get(\"task/related-task-row-edit.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var renderEdit, renderView, saveTask;\n saveTask = debounce(2000, function(task) {\n var currentLoading, promise;\n task.subject = $el.find('input').val();\n currentLoading = $loading().target($el.find('.task-name')).start();\n promise = $repo.save(task);\n promise.then((function(_this) {\n return function() {\n currentLoading.finish();\n return $rootscope.$broadcast(\"related-tasks:update\");\n };\n })(this));\n promise.then(null, (function(_this) {\n return function() {\n currentLoading.finish();\n $el.find('input').val(task.subject);\n return $confirm.notify(\"error\");\n };\n })(this));\n return promise;\n });\n renderEdit = function(task) {\n $el.html($compile(templateEdit({\n task: task\n }))($scope));\n $el.find(\".task-name input\").val(task.subject);\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return saveTask($model.$modelValue).then(function() {\n return renderView($model.$modelValue);\n });\n } else if (event.keyCode === 27) {\n return renderView($model.$modelValue);\n }\n });\n $el.on(\"click\", \".save-task\", function(event) {\n return saveTask($model.$modelValue).then(function() {\n return renderView($model.$modelValue);\n });\n });\n return $el.on(\"click\", \".cancel-edit\", function(event) {\n return renderView($model.$modelValue);\n });\n };\n renderView = function(task) {\n var perms;\n $el.off();\n perms = {\n modify_task: $scope.project.my_permissions.indexOf(\"modify_task\") !== -1,\n delete_task: $scope.project.my_permissions.indexOf(\"delete_task\") !== -1\n };\n $el.html($compile(templateView({\n task: task,\n perms: perms\n }))($scope));\n $el.on(\"click\", \".edit-task\", function() {\n renderEdit($model.$modelValue);\n return $el.find('input').focus().select();\n });\n return $el.on(\"click\", \".delete-task\", function(event) {\n var message, title;\n title = $translate.instant(\"TASK.TITLE_DELETE_ACTION\");\n task = $model.$modelValue;\n message = task.subject;\n return $confirm.askOnDelete(title, message).then(function(askResponse) {\n var promise;\n promise = $repo.remove(task);\n promise.then(function() {\n askResponse.finish();\n return $scope.$emit(\"related-tasks:delete\");\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n });\n });\n });\n };\n $scope.$watch($attrs.ngModel, function(val) {\n if (!val) {\n return;\n }\n return renderView(val);\n });\n $scope.$on(\"related-tasks:assigned-to-changed\", function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n $scope.$on(\"related-tasks:status-changed\", function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgRelatedTaskRow\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$rootScope\", \"$tgLoading\", \"$tgTemplate\", \"$translate\", RelatedTaskRowDirective]);\n\n RelatedTaskCreateFormDirective = function($repo, $compile, $confirm, $tgmodel, $loading, $analytics) {\n var link, newTask;\n newTask = {\n subject: \"\",\n assigned_to: null\n };\n link = function($scope, $el, $attrs) {\n var close, createTask, render, reset;\n createTask = function(task) {\n var currentLoading, promise;\n task.subject = $el.find('input').val();\n task.assigned_to = $scope.newTask.assigned_to;\n task.status = $scope.newTask.status;\n $scope.newTask.status = $scope.project.default_task_status;\n $scope.newTask.assigned_to = null;\n currentLoading = $loading().target($el.find('.task-name')).start();\n promise = $repo.create(\"tasks\", task);\n promise.then(function() {\n $analytics.trackEvent(\"task\", \"create\", \"create task on userstory\", 1);\n currentLoading.finish();\n return $scope.$emit(\"related-tasks:add\");\n });\n promise.then(null, function() {\n $el.find('input').val(task.subject);\n currentLoading.finish();\n return $confirm.notify(\"error\");\n });\n return promise;\n };\n close = function() {\n $el.off();\n return $scope.openNewRelatedTask = false;\n };\n reset = function() {\n newTask = {\n subject: \"\",\n assigned_to: null\n };\n newTask[\"status\"] = $scope.project.default_task_status;\n newTask[\"project\"] = $scope.project.id;\n newTask[\"user_story\"] = $scope.us.id;\n return $scope.newTask = $tgmodel.make_model(\"tasks\", newTask);\n };\n render = function() {\n if ($scope.openNewRelatedTask) {\n return;\n }\n $scope.openNewRelatedTask = true;\n return $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return createTask(newTask).then(function() {\n reset();\n return $el.find('input').focus();\n });\n } else if (event.keyCode === 27) {\n return $scope.$apply(function() {\n return close();\n });\n }\n });\n };\n $scope.save = function() {\n return createTask(newTask).then(function() {\n return close();\n });\n };\n taiga.bindOnce($scope, \"us\", reset);\n $scope.$on(\"related-tasks:show-form\", function() {\n return $scope.$apply(render);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n scope: true,\n link: link,\n templateUrl: 'task/related-task-create-form.html'\n };\n };\n\n module.directive(\"tgRelatedTaskCreateForm\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$tgModel\", \"$tgLoading\", \"$tgAnalytics\", RelatedTaskCreateFormDirective]);\n\n RelatedTaskCreateButtonDirective = function($repo, $compile, $confirm, $tgmodel, $template) {\n var link, template;\n template = $template.get(\"common/components/add-button.html\", true);\n link = function($scope, $el, $attrs) {\n $scope.$watch(\"project\", function(val) {\n if (!val) {\n return;\n }\n $el.off();\n if ($scope.project.my_permissions.indexOf(\"add_task\") !== -1) {\n $el.html($compile(template())($scope));\n } else {\n $el.html(\"\");\n }\n return $el.on(\"click\", \".add-button\", function(event) {\n return $scope.$emit(\"related-tasks:add-new-clicked\");\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskCreateButton\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$tgModel\", \"$tgTemplate\", RelatedTaskCreateButtonDirective]);\n\n RelatedTasksDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var _isEditable, _isVisible, loadTasks;\n loadTasks = function() {\n return $rs.tasks.list($scope.projectId, null, $scope.usId).then((function(_this) {\n return function(tasks) {\n $scope.tasks = _.sortBy(tasks, function(x) {\n return [x.us_order, x.ref];\n });\n return tasks;\n };\n })(this));\n };\n _isVisible = function() {\n if ($scope.project) {\n return $scope.project.my_permissions.indexOf(\"view_tasks\") !== -1;\n }\n return false;\n };\n _isEditable = function() {\n if ($scope.project) {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n }\n return false;\n };\n $scope.showRelatedTasks = function() {\n var ref;\n return _isVisible() && (_isEditable() || ((ref = $scope.tasks) != null ? ref.length : void 0));\n };\n $scope.$on(\"related-tasks:add\", function() {\n return loadTasks().then(function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n });\n $scope.$on(\"related-tasks:delete\", function() {\n return loadTasks().then(function() {\n return $rootscope.$broadcast(\"related-tasks:update\");\n });\n });\n $scope.$on(\"related-tasks:add-new-clicked\", function() {\n return $scope.$broadcast(\"related-tasks:show-form\");\n });\n taiga.bindOnce($scope, \"us\", function(val) {\n return loadTasks();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTasks\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", RelatedTasksDirective]);\n\n RelatedTaskAssignedToInlineEditionDirective = function($repo, $rootscope, $translate, avatarService) {\n var link, template;\n template = _.template(\"
\\\" src=\\\"<%- imgurl %>\\\" alt=\\\"<%- name %>\\\"/>\\n<%- name %>\");\n link = function($scope, $el, $attrs) {\n var $ctrl, autoSave, notAutoSave, task, updateRelatedTask;\n updateRelatedTask = function(task) {\n var avatar, ctx, member;\n ctx = {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\")\n };\n member = $scope.usersById[task.assigned_to];\n avatar = avatarService.getAvatar(member);\n ctx.imgurl = avatar.url;\n ctx.bg = avatar.bg;\n if (member) {\n ctx.name = member.full_name_display;\n }\n $el.find(\".avatar\").html(template(ctx));\n return $el.find(\".task-assignedto\").attr('title', ctx.name);\n };\n $ctrl = $el.controller();\n task = $scope.$eval($attrs.tgRelatedTaskAssignedToInlineEdition);\n notAutoSave = $scope.$eval($attrs.notAutoSave);\n autoSave = !notAutoSave;\n $scope.$watch($attrs.tgRelatedTaskAssignedToInlineEdition, function() {\n task = $scope.$eval($attrs.tgRelatedTaskAssignedToInlineEdition);\n return updateRelatedTask(task);\n });\n updateRelatedTask(task);\n $el.on(\"click\", \".task-assignedto\", function(event) {\n return $rootscope.$broadcast(\"assigned-to:add\", task);\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_task\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"assigned-to:added\", debounce(2000, (function(_this) {\n return function(ctx, userId, updatedRelatedTask) {\n if (updatedRelatedTask.id === task.id) {\n updatedRelatedTask.assigned_to = userId;\n if (autoSave) {\n $repo.save(updatedRelatedTask).then(function() {\n return $scope.$emit(\"related-tasks:assigned-to-changed\");\n });\n }\n return updateRelatedTask(updatedRelatedTask);\n }\n };\n })(this)));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskAssignedToInlineEdition\", [\"$tgRepo\", \"$rootScope\", \"$translate\", \"tgAvatarService\", RelatedTaskAssignedToInlineEditionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/resources.coffee\n */\n\n(function() {\n var ResourcesService, initResources, initUrls, module, taiga, urls,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n ResourcesService = (function(superClass) {\n extend(ResourcesService, superClass);\n\n function ResourcesService() {\n return ResourcesService.__super__.constructor.apply(this, arguments);\n }\n\n return ResourcesService;\n\n })(taiga.Service);\n\n urls = {\n \"auth\": \"/auth\",\n \"auth-register\": \"/auth/register\",\n \"invitations\": \"/invitations\",\n \"users\": \"/users\",\n \"by_username\": \"/users/by_username\",\n \"users-password-recovery\": \"/users/password_recovery\",\n \"users-change-password-from-recovery\": \"/users/change_password_from_recovery\",\n \"users-change-password\": \"/users/change_password\",\n \"users-change-email\": \"/users/change_email\",\n \"users-cancel-account\": \"/users/cancel\",\n \"user-stats\": \"/users/%s/stats\",\n \"user-liked\": \"/users/%s/liked\",\n \"user-voted\": \"/users/%s/voted\",\n \"user-watched\": \"/users/%s/watched\",\n \"user-contacts\": \"/users/%s/contacts\",\n \"user-me\": \"/users/me\",\n \"permissions\": \"/permissions\",\n \"notify-policies\": \"/notify-policies\",\n \"user-storage\": \"/user-storage\",\n \"memberships\": \"/memberships\",\n \"bulk-create-memberships\": \"/memberships/bulk_create\",\n \"roles\": \"/roles\",\n \"permissions\": \"/permissions\",\n \"resolver\": \"/resolver\",\n \"projects\": \"/projects\",\n \"project-templates\": \"/project-templates\",\n \"project-modules\": \"/projects/%s/modules\",\n \"bulk-update-projects-order\": \"/projects/bulk_update_order\",\n \"project-like\": \"/projects/%s/like\",\n \"project-unlike\": \"/projects/%s/unlike\",\n \"project-watch\": \"/projects/%s/watch\",\n \"project-unwatch\": \"/projects/%s/unwatch\",\n \"project-transfer-validate-token\": \"/projects/%s/transfer_validate_token\",\n \"project-transfer-accept\": \"/projects/%s/transfer_accept\",\n \"project-transfer-reject\": \"/projects/%s/transfer_reject\",\n \"project-transfer-request\": \"/projects/%s/transfer_request\",\n \"project-transfer-start\": \"/projects/%s/transfer_start\",\n \"epic-statuses\": \"/epic-statuses\",\n \"userstory-statuses\": \"/userstory-statuses\",\n \"points\": \"/points\",\n \"task-statuses\": \"/task-statuses\",\n \"issue-statuses\": \"/issue-statuses\",\n \"issue-types\": \"/issue-types\",\n \"priorities\": \"/priorities\",\n \"severities\": \"/severities\",\n \"milestones\": \"/milestones\",\n \"epics\": \"/epics\",\n \"epic-upvote\": \"/epics/%s/upvote\",\n \"epic-downvote\": \"/epics/%s/downvote\",\n \"epic-watch\": \"/epics/%s/watch\",\n \"epic-unwatch\": \"/epics/%s/unwatch\",\n \"epic-related-userstories\": \"/epics/%s/related_userstories\",\n \"epic-related-userstories-bulk-create\": \"/epics/%s/related_userstories/bulk_create\",\n \"userstories\": \"/userstories\",\n \"bulk-create-us\": \"/userstories/bulk_create\",\n \"bulk-update-us-backlog-order\": \"/userstories/bulk_update_backlog_order\",\n \"bulk-update-us-milestone\": \"/userstories/bulk_update_milestone\",\n \"bulk-update-us-miles-order\": \"/userstories/bulk_update_sprint_order\",\n \"bulk-update-us-kanban-order\": \"/userstories/bulk_update_kanban_order\",\n \"userstories-filters\": \"/userstories/filters_data\",\n \"userstory-upvote\": \"/userstories/%s/upvote\",\n \"userstory-downvote\": \"/userstories/%s/downvote\",\n \"userstory-watch\": \"/userstories/%s/watch\",\n \"userstory-unwatch\": \"/userstories/%s/unwatch\",\n \"tasks\": \"/tasks\",\n \"bulk-create-tasks\": \"/tasks/bulk_create\",\n \"bulk-update-task-taskboard-order\": \"/tasks/bulk_update_taskboard_order\",\n \"task-upvote\": \"/tasks/%s/upvote\",\n \"task-downvote\": \"/tasks/%s/downvote\",\n \"task-watch\": \"/tasks/%s/watch\",\n \"task-unwatch\": \"/tasks/%s/unwatch\",\n \"task-filters\": \"/tasks/filters_data\",\n \"issues\": \"/issues\",\n \"bulk-create-issues\": \"/issues/bulk_create\",\n \"issues-filters\": \"/issues/filters_data\",\n \"issue-upvote\": \"/issues/%s/upvote\",\n \"issue-downvote\": \"/issues/%s/downvote\",\n \"issue-watch\": \"/issues/%s/watch\",\n \"issue-unwatch\": \"/issues/%s/unwatch\",\n \"wiki\": \"/wiki\",\n \"wiki-restore\": \"/wiki/%s/restore\",\n \"wiki-links\": \"/wiki-links\",\n \"history/epic\": \"/history/epic\",\n \"history/us\": \"/history/userstory\",\n \"history/issue\": \"/history/issue\",\n \"history/task\": \"/history/task\",\n \"history/wiki\": \"/history/wiki/%s\",\n \"attachments/epic\": \"/epics/attachments\",\n \"attachments/us\": \"/userstories/attachments\",\n \"attachments/issue\": \"/issues/attachments\",\n \"attachments/task\": \"/tasks/attachments\",\n \"attachments/wiki_page\": \"/wiki/attachments\",\n \"custom-attributes/epic\": \"/epic-custom-attributes\",\n \"custom-attributes/userstory\": \"/userstory-custom-attributes\",\n \"custom-attributes/task\": \"/task-custom-attributes\",\n \"custom-attributes/issue\": \"/issue-custom-attributes\",\n \"custom-attributes-values/epic\": \"/epics/custom-attributes-values\",\n \"custom-attributes-values/userstory\": \"/userstories/custom-attributes-values\",\n \"custom-attributes-values/task\": \"/tasks/custom-attributes-values\",\n \"custom-attributes-values/issue\": \"/issues/custom-attributes-values\",\n \"webhooks\": \"/webhooks\",\n \"webhooks-test\": \"/webhooks/%s/test\",\n \"webhooklogs\": \"/webhooklogs\",\n \"webhooklogs-resend\": \"/webhooklogs/%s/resend\",\n \"epics-csv\": \"/epics/csv?uuid=%s\",\n \"userstories-csv\": \"/userstories/csv?uuid=%s\",\n \"tasks-csv\": \"/tasks/csv?uuid=%s\",\n \"issues-csv\": \"/issues/csv?uuid=%s\",\n \"timeline-profile\": \"/timeline/profile\",\n \"timeline-user\": \"/timeline/user\",\n \"timeline-project\": \"/timeline/project\",\n \"search\": \"/search\",\n \"exporter\": \"/exporter\",\n \"importer\": \"/importer/load_dump\",\n \"feedback\": \"/feedback\",\n \"locales\": \"/locales\",\n \"applications\": \"/applications\",\n \"application-tokens\": \"/application-tokens\",\n \"stats-discover\": \"/stats/discover\"\n };\n\n initUrls = function($log, $urls) {\n $log.debug(\"Initialize api urls\");\n return $urls.update(urls);\n };\n\n initResources = function($log, $rs) {\n var i, len, provider, providers, results;\n $log.debug(\"Initialize resources\");\n providers = _.toArray(arguments).slice(2);\n results = [];\n for (i = 0, len = providers.length; i < len; i++) {\n provider = providers[i];\n results.push(provider($rs));\n }\n return results;\n };\n\n module = angular.module(\"taigaResources\", [\"taigaBase\"]);\n\n module.service(\"$tgResources\", ResourcesService);\n\n module.run([\"$log\", \"$tgUrls\", initUrls]);\n\n module.run([\"$log\", \"$tgResources\", \"$tgProjectsResourcesProvider\", \"$tgCustomAttributesResourcesProvider\", \"$tgCustomAttributesValuesResourcesProvider\", \"$tgMembershipsResourcesProvider\", \"$tgNotifyPoliciesResourcesProvider\", \"$tgInvitationsResourcesProvider\", \"$tgRolesResourcesProvider\", \"$tgUserSettingsResourcesProvider\", \"$tgSprintsResourcesProvider\", \"$tgEpicsResourcesProvider\", \"$tgUserstoriesResourcesProvider\", \"$tgTasksResourcesProvider\", \"$tgIssuesResourcesProvider\", \"$tgWikiResourcesProvider\", \"$tgSearchResourcesProvider\", \"$tgMdRenderResourcesProvider\", \"$tgHistoryResourcesProvider\", \"$tgKanbanResourcesProvider\", \"$tgModulesResourcesProvider\", \"$tgWebhooksResourcesProvider\", \"$tgWebhookLogsResourcesProvider\", \"$tgLocalesResourcesProvider\", \"$tgUsersResourcesProvider\", initResources]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/search.coffee\n */\n\n(function() {\n var SearchBoxDirective, SearchController, SearchDirective, bindOnce, debounce, debounceLeading, groupBy, mixOf, module, taiga, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n mixOf = this.taiga.mixOf;\n\n debounceLeading = this.taiga.debounceLeading;\n\n trim = this.taiga.trim;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaSearch\", []);\n\n SearchController = (function(superClass) {\n extend(SearchController, superClass);\n\n SearchController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"tgAppMetaService\", \"$tgNavUrls\", \"$translate\", \"tgErrorHandlingService\"];\n\n function SearchController(scope1, repo, rs, params, q, location, appMetaService, navUrls, translate, errorHandlingService) {\n var loadSearchData, promise;\n this.scope = scope1;\n this.repo = repo;\n this.rs = rs;\n this.params = params;\n this.q = q;\n this.location = location;\n this.appMetaService = appMetaService;\n this.navUrls = navUrls;\n this.translate = translate;\n this.errorHandlingService = errorHandlingService;\n this.scope.sectionName = \"Search\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n var description, title;\n title = _this.translate.instant(\"SEARCH.PAGE_TITLE\", {\n projectName: _this.scope.project.name\n });\n description = _this.translate.instant(\"SEARCH.PAGE_DESCRIPTION\", {\n projectName: _this.scope.project.name,\n projectDescription: _this.scope.project.description\n });\n return _this.appMetaService.setAll(title, description);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.searchTerm = null;\n loadSearchData = debounceLeading(100, (function(_this) {\n return function(t) {\n return _this.loadSearchData(t);\n };\n })(this));\n bindOnce(this.scope, \"projectId\", (function(_this) {\n return function(projectId) {\n if (!_this.scope.searchResults && _this.scope.searchTerm) {\n return _this.loadSearchData();\n }\n };\n })(this));\n this.scope.$watch(\"searchTerm\", (function(_this) {\n return function(term) {\n if (term !== void 0 && _this.scope.projectId) {\n return _this.loadSearchData(term);\n }\n };\n })(this));\n }\n\n SearchController.prototype.loadFilters = function() {\n var defered;\n defered = this.q.defer();\n defered.resolve();\n return defered.promise;\n };\n\n SearchController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.epicStatusById = groupBy(project.epic_statuses, function(x) {\n return x.id;\n });\n _this.scope.issueStatusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.taskStatusById = groupBy(project.task_statuses, function(x) {\n return x.id;\n });\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n return project;\n };\n })(this));\n };\n\n SearchController.prototype.loadSearchData = function(term) {\n if (term == null) {\n term = \"\";\n }\n this.scope.loading = true;\n return this._loadSearchData(term).then((function(_this) {\n return function(data) {\n _this.scope.searchResults = data;\n return _this.scope.loading = false;\n };\n })(this));\n };\n\n SearchController.prototype._loadSearchData = function(term) {\n if (term == null) {\n term = \"\";\n }\n if (this._promise) {\n this._promise.abort();\n }\n this._promise = this.rs.search[\"do\"](this.scope.projectId, term);\n return this._promise;\n };\n\n SearchController.prototype.loadInitialData = function() {\n return this.loadProject().then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n return _this.fillUsersAndRoles(project.members, project.roles);\n };\n })(this));\n };\n\n return SearchController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"SearchController\", SearchController);\n\n SearchBoxDirective = function(projectService, $lightboxService, $navurls, $location, $route) {\n var link;\n link = function($scope, $el, $attrs) {\n var openLightbox, project, submit;\n project = null;\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var form, text, url;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n text = $el.find(\"#search-text\").val();\n url = $navurls.resolve(\"project-search\", {\n project: project.get(\"slug\")\n });\n return $scope.$apply(function() {\n $lightboxService.close($el);\n $location.path(url);\n $location.search(\"text\", text).path(url);\n return $route.reload();\n });\n };\n })(this));\n openLightbox = function() {\n project = projectService.project;\n return $lightboxService.open($el).then(function() {\n return $el.find(\"#search-text\").focus();\n });\n };\n $el.on(\"submit\", \"form\", submit);\n return openLightbox();\n };\n return {\n templateUrl: \"search/lightbox-search.html\",\n link: link\n };\n };\n\n SearchBoxDirective.$inject = [\"tgProjectService\", \"lightboxService\", \"$tgNavUrls\", \"$tgLocation\", \"$route\"];\n\n module.directive(\"tgSearchBox\", SearchBoxDirective);\n\n SearchDirective = function($log, $compile, $templatecache, $routeparams, $location) {\n var link, linkTable;\n linkTable = function($scope, $el, $attrs, $ctrl) {\n var activeSectionName, applyAutoTab, getActiveSection, lastSearchResults, markSectionTabActive, renderFilterTabs, renderTableContent, tabsDom, templates;\n applyAutoTab = true;\n activeSectionName = \"userstories\";\n tabsDom = $el.find(\".search-filter\");\n lastSearchResults = null;\n getActiveSection = function(data) {\n var i, len, maxVal, name, ref, selectedSection, value;\n maxVal = 0;\n selectedSection = {};\n selectedSection.name = \"userstories\";\n selectedSection.value = [];\n if (!applyAutoTab) {\n selectedSection.name = activeSectionName;\n selectedSection.value = data[activeSectionName];\n return selectedSection;\n }\n if (data) {\n ref = [\"userstories\", \"epics\", \"issues\", \"tasks\", \"wikipages\"];\n for (i = 0, len = ref.length; i < len; i++) {\n name = ref[i];\n value = data[name];\n if (value.length > maxVal) {\n maxVal = value.length;\n selectedSection.name = name;\n selectedSection.value = value;\n break;\n }\n }\n }\n if (maxVal === 0) {\n return selectedSection;\n }\n return selectedSection;\n };\n renderFilterTabs = function(data) {\n var name, results, value;\n results = [];\n for (name in data) {\n value = data[name];\n tabsDom.find(\"li.\" + name).show();\n results.push(tabsDom.find(\"li.\" + name + \" .num\").html(value.length));\n }\n return results;\n };\n markSectionTabActive = function(section) {\n tabsDom.find(\"a.active\").removeClass(\"active\");\n tabsDom.find(\"li.\" + section.name + \" a\").addClass(\"active\");\n applyAutoTab = false;\n return activeSectionName = section.name;\n };\n templates = {\n epics: $templatecache.get(\"search-epics\"),\n issues: $templatecache.get(\"search-issues\"),\n tasks: $templatecache.get(\"search-tasks\"),\n userstories: $templatecache.get(\"search-userstories\"),\n wikipages: $templatecache.get(\"search-wikipages\")\n };\n renderTableContent = function(section) {\n var element, oldElements, oldScope, scope, template;\n oldElements = $el.find(\".search-result-table\").children();\n oldScope = oldElements.scope();\n if (oldScope) {\n oldScope.$destroy();\n oldElements.remove();\n }\n scope = $scope.$new();\n scope[section.name] = section.value;\n template = angular.element.parseHTML(trim(templates[section.name]));\n element = $compile(template)(scope);\n return $el.find(\".search-result-table\").html(element);\n };\n $scope.$watch(\"searchResults\", function(data) {\n var activeSection;\n lastSearchResults = data;\n if (!lastSearchResults) {\n return;\n }\n activeSection = getActiveSection(data);\n renderFilterTabs(data);\n renderTableContent(activeSection);\n return markSectionTabActive(activeSection);\n });\n $scope.$watch(\"searchTerm\", function(searchTerm) {\n if (searchTerm !== void 0) {\n return $location.search(\"text\", searchTerm);\n }\n });\n return $el.on(\"click\", \".search-filter li > a\", function(event) {\n var section, sectionData, sectionName, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n sectionName = target.parent().data(\"name\");\n sectionData = !lastSearchResults ? [] : lastSearchResults[sectionName];\n section = {\n name: sectionName,\n value: sectionData\n };\n return $scope.$apply(function() {\n renderTableContent(section);\n return markSectionTabActive(section);\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, searchText;\n $ctrl = $el.controller();\n linkTable($scope, $el, $attrs, $ctrl);\n searchText = $routeparams.text;\n return $scope.$watch(\"projectId\", function(projectId) {\n if (projectId != null) {\n return $scope.searchTerm = searchText;\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSearch\", [\"$log\", \"$compile\", \"$templateCache\", \"$routeParams\", \"$tgLocation\", SearchDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/taskboard.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaTaskboard\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/tasks.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaTasks\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/team.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaTeam\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/user-settings.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaUserSettings\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/userstories.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaUserStories\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/wiki.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaWiki\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/analytics.coffee\n */\n\n(function() {\n var AnalyticsService, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n AnalyticsService = (function(superClass) {\n extend(AnalyticsService, superClass);\n\n AnalyticsService.$inject = [\"$rootScope\", \"$log\", \"$tgConfig\", \"$window\", \"$document\", \"$location\"];\n\n function AnalyticsService(rootscope, log, config, win, doc, location) {\n var conf;\n this.rootscope = rootscope;\n this.log = log;\n this.config = config;\n this.win = win;\n this.doc = doc;\n this.location = location;\n this.initialized = false;\n conf = this.config.get(\"analytics\", {});\n this.accountId = conf.accountId;\n this.pageEvent = conf.pageEvent || \"$routeChangeSuccess\";\n this.trackRoutes = conf.trackRoutes || true;\n this.ignoreFirstPageLoad = conf.ignoreFirstPageLoad || false;\n }\n\n AnalyticsService.prototype.initialize = function() {\n if (!this.accountId) {\n this.log.debug(\"Analytics: no acount id provided. Disabling.\");\n return;\n }\n this.injectAnalytics();\n this.win.ga(\"create\", this.accountId, \"auto\");\n this.win.ga(\"require\", \"displayfeatures\");\n if (this.trackRoutes && (!this.ignoreFirstPageLoad)) {\n this.win.ga(\"send\", \"pageview\", this.getUrl());\n }\n if (this.trackRoutes) {\n this.rootscope.$on(this.pageEvent, (function(_this) {\n return function() {\n return _this.trackPage(_this.getUrl(), \"Taiga\");\n };\n })(this));\n }\n return this.initialized = true;\n };\n\n AnalyticsService.prototype.getUrl = function() {\n return this.location.path();\n };\n\n AnalyticsService.prototype.injectAnalytics = function() {\n var fn;\n fn = (function(i,s,o,g,r,a,m){i[\"GoogleAnalyticsObject\"]=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments);},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m);});\n return fn(window, document, \"script\", \"//www.google-analytics.com/analytics.js\", \"ga\");\n };\n\n AnalyticsService.prototype.trackPage = function(url, title) {\n if (!this.initialized) {\n return;\n }\n if (!this.win.ga) {\n return;\n }\n title = title || this.doc[0].title;\n return this.win.ga(\"send\", \"pageview\", {\n \"page\": url,\n \"title\": title\n });\n };\n\n AnalyticsService.prototype.trackEvent = function(category, action, label, value) {\n if (!this.initialized) {\n return;\n }\n if (!this.win.ga) {\n return;\n }\n return this.win.ga(\"send\", \"event\", category, action, label, value);\n };\n\n return AnalyticsService;\n\n })(taiga.Service);\n\n module.service(\"$tgAnalytics\", AnalyticsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: bind-scope.coffee\n */\n\n(function() {\n var BindScope, module;\n\n module = angular.module(\"taigaCommon\");\n\n BindScope = function(config) {\n var link;\n if (!config.debugInfo) {\n jQuery.fn.scope = function() {\n return this.data('scope');\n };\n }\n link = function($scope, $el) {\n if (!config.debugInfo) {\n return $el.data('scope', $scope).addClass('tg-scope');\n }\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBindScope\", [\"$tgConfig\", BindScope]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Taiga Agile LLC \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: compile-html.directive.coffee\n */\n\n(function() {\n var CompileHtmlDirective;\n\n CompileHtmlDirective = function($compile) {\n var link;\n link = function(scope, element, attrs) {\n return scope.$watch(attrs.tgCompileHtml, function(newValue, oldValue) {\n element.html(newValue);\n return $compile(element.contents())(scope);\n });\n };\n return {\n link: link\n };\n };\n\n CompileHtmlDirective.$inject = [\"$compile\"];\n\n angular.module(\"taigaCommon\").directive(\"tgCompileHtml\", CompileHtmlDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/components.coffee\n */\n\n(function() {\n var AssignedToDirective, BlockButtonDirective, CreatedByDisplayDirective, DateRangeDirective, DateSelectorDirective, DeleteButtonDirective, EditableDescriptionDirective, EditableWysiwyg, ListItemAssignedtoDirective, ListItemEpicStatusDirective, ListItemIssueStatusDirective, ListItemPriorityDirective, ListItemSeverityDirective, ListItemTaskStatusDirective, ListItemTypeDirective, ListItemUsStatusDirective, SprintProgressBarDirective, TgMainTitleDirective, TgProgressBarDirective, UserDisplayDirective, WatchersDirective, bindOnce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n DateRangeDirective = function($translate) {\n var link, renderRange;\n renderRange = function($el, first, second) {\n var endDate, initDate, prettyDate;\n prettyDate = $translate.instant(\"BACKLOG.SPRINTS.DATE\");\n initDate = moment(first).format(prettyDate);\n endDate = moment(second).format(prettyDate);\n return $el.html(initDate + \"-\" + endDate);\n };\n link = function($scope, $el, $attrs) {\n var first, ref, second;\n ref = $attrs.tgDateRange.split(\",\"), first = ref[0], second = ref[1];\n return bindOnce($scope, first, function(valFirst) {\n return bindOnce($scope, second, function(valSecond) {\n return renderRange($el, valFirst, valSecond);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgDateRange\", [\"$translate\", DateRangeDirective]);\n\n DateSelectorDirective = function($rootscope, datePickerConfigService) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var initialize, selectedDate, unbind;\n selectedDate = null;\n initialize = function() {\n var datePickerConfig;\n datePickerConfig = datePickerConfigService.get();\n _.merge(datePickerConfig, {\n field: $el[0]\n });\n return $el.picker = new Pikaday(datePickerConfig);\n };\n unbind = $rootscope.$on(\"$translateChangeEnd\", (function(_this) {\n return function(ctx) {\n if ($el.picker) {\n $el.picker.destroy();\n }\n return initialize();\n };\n })(this));\n $attrs.$observe(\"pickerValue\", function(val) {\n $el.val(val);\n if (val != null) {\n if ($el.picker) {\n $el.picker.destroy();\n }\n initialize();\n }\n return $el.picker.setDate(val);\n });\n return $scope.$on(\"$destroy\", function() {\n $el.off();\n unbind();\n return $el.picker.destroy();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgDateSelector\", [\"$rootScope\", \"tgDatePickerConfigService\", DateSelectorDirective]);\n\n SprintProgressBarDirective = function() {\n var link, renderProgress;\n renderProgress = function($el, percentage, visual_percentage) {\n if ($el.hasClass(\".current-progress\")) {\n return $el.css(\"width\", percentage + \"%\");\n } else {\n $el.find(\".current-progress\").css(\"width\", visual_percentage + \"%\");\n return $el.find(\".number\").html(percentage + \" %\");\n }\n };\n link = function($scope, $el, $attrs) {\n bindOnce($scope, $attrs.tgSprintProgressbar, function(sprint) {\n var closedPoints, percentage, totalPoints, visual_percentage;\n closedPoints = sprint.closed_points;\n totalPoints = sprint.total_points;\n percentage = 0;\n if (totalPoints !== 0) {\n percentage = Math.round(100 * (closedPoints / totalPoints));\n }\n visual_percentage = 0;\n if (totalPoints !== 0) {\n visual_percentage = Math.round(98 * (closedPoints / totalPoints));\n }\n return renderProgress($el, percentage, visual_percentage);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSprintProgressbar\", SprintProgressBarDirective);\n\n CreatedByDisplayDirective = function($template, $compile, $translate, $navUrls, avatarService) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, $attrs.ngModel, function(model) {\n var avatar, ref;\n if (model != null) {\n avatar = avatarService.getAvatar(model.owner_extra_info);\n $scope.owner = model.owner_extra_info || {\n full_name_display: $translate.instant(\"COMMON.EXTERNAL_USER\")\n };\n $scope.owner.avatar = avatar.url;\n $scope.owner.bg = avatar.bg;\n $scope.url = ((ref = $scope.owner) != null ? ref.is_active : void 0) ? $navUrls.resolve(\"user-profile\", {\n username: $scope.owner.username\n }) : \"\";\n return $scope.date = moment(model.created_date).format($translate.instant(\"COMMON.DATETIME\"));\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n scope: true,\n templateUrl: \"common/components/created-by.html\"\n };\n };\n\n module.directive(\"tgCreatedByDisplay\", [\"$tgTemplate\", \"$compile\", \"$translate\", \"$tgNavUrls\", \"tgAvatarService\", CreatedByDisplayDirective]);\n\n UserDisplayDirective = function($template, $compile, $translate, $navUrls, avatarService) {\n var link;\n link = function($scope, $el, $attrs) {\n var avatar, id;\n id = $attrs.tgUserId;\n $scope.user = $scope.usersById[id] || {\n full_name_display: $translate.instant(\"COMMON.EXTERNAL_USER\")\n };\n avatar = avatarService.getAvatar($scope.usersById[id] || null);\n $scope.user.avatar = avatar.url;\n $scope.user.bg = avatar.bg;\n $scope.url = $scope.user.is_active ? $navUrls.resolve(\"user-profile\", {\n username: $scope.user.username\n }) : \"\";\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n scope: true,\n templateUrl: \"common/components/user-display.html\"\n };\n };\n\n module.directive(\"tgUserDisplay\", [\"$tgTemplate\", \"$compile\", \"$translate\", \"$tgNavUrls\", \"tgAvatarService\", UserDisplayDirective]);\n\n WatchersDirective = function($rootscope, $confirm, $repo, $modelTransform, $template, $compile, $translate) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var deleteWatcher, isEditable, renderWatchers, save;\n isEditable = function() {\n var ref, ref1;\n return ((ref = $scope.project) != null ? (ref1 = ref.my_permissions) != null ? ref1.indexOf($attrs.requiredPerm) : void 0 : void 0) !== -1;\n };\n save = function(watchers) {\n var transform;\n transform = $modelTransform.save(function(item) {\n item.watchers = watchers;\n return item;\n });\n transform.then(function() {\n watchers = _.map(watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n renderWatchers(watchers);\n return $rootscope.$broadcast(\"object:updated\");\n });\n return transform.then(null, function() {\n return $confirm.notify(\"error\");\n });\n };\n deleteWatcher = function(watcherIds) {\n var transform;\n transform = $modelTransform.save(function(item) {\n item.watchers = watcherIds;\n return item;\n });\n transform.then(function() {\n var item, watchers;\n item = $modelTransform.getObj();\n watchers = _.map(item.watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n renderWatchers(watchers);\n return $rootscope.$broadcast(\"object:updated\");\n });\n return transform.then(null, function() {\n item.revert();\n return $confirm.notify(\"error\");\n });\n };\n renderWatchers = function(watchers) {\n $scope.watchers = watchers;\n return $scope.isEditable = isEditable();\n };\n $el.on(\"click\", \".js-delete-watcher\", function(event) {\n var message, target, title, watcherId;\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n watcherId = target.data(\"watcher-id\");\n title = $translate.instant(\"COMMON.WATCHERS.TITLE_LIGHTBOX_DELETE_WARTCHER\");\n message = $scope.usersById[watcherId].full_name_display;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(askResponse) {\n var watcherIds;\n askResponse.finish();\n watcherIds = _.clone($model.$modelValue.watchers, false);\n watcherIds = _.pull(watcherIds, watcherId);\n return deleteWatcher(watcherIds);\n };\n })(this));\n });\n $scope.$on(\"watcher:added\", function(ctx, watcherId) {\n var watchers;\n watchers = _.clone($model.$modelValue.watchers, false);\n watchers.push(watcherId);\n watchers = _.uniq(watchers);\n return save(watchers);\n });\n $scope.$watch($attrs.ngModel, function(item) {\n var watchers;\n if (item == null) {\n return;\n }\n watchers = _.map(item.watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n watchers = _.filter(watchers, function(it) {\n return !!it;\n });\n return renderWatchers(watchers);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n scope: true,\n templateUrl: \"common/components/watchers.html\",\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgWatchers\", [\"$rootScope\", \"$tgConfirm\", \"$tgRepo\", \"$tgQueueModelTransformation\", \"$tgTemplate\", \"$compile\", \"$translate\", WatchersDirective]);\n\n AssignedToDirective = function($rootscope, $confirm, $repo, $loading, $modelTransform, $template, $translate, $compile, $currentUserService, avatarService) {\n var link, template;\n template = $template.get(\"common/components/assigned-to.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, renderAssignedTo, save;\n isEditable = function() {\n var ref, ref1;\n return ((ref = $scope.project) != null ? (ref1 = ref.my_permissions) != null ? ref1.indexOf($attrs.requiredPerm) : void 0 : void 0) !== -1;\n };\n save = function(userId) {\n var currentLoading, item, transform;\n item = $model.$modelValue.clone();\n item.assigned_to = userId;\n currentLoading = $loading().target($el).start();\n transform = $modelTransform.save(function(item) {\n item.assigned_to = userId;\n return item;\n });\n transform.then(function() {\n currentLoading.finish();\n renderAssignedTo($modelTransform.getObj());\n return $rootscope.$broadcast(\"object:updated\");\n });\n transform.then(null, function() {\n $confirm.notify(\"error\");\n return currentLoading.finish();\n });\n return transform;\n };\n renderAssignedTo = function(assignedObject) {\n var avatar, bg, ctx, fullName, html, isIocaine, isUnassigned;\n avatar = avatarService.getAvatar(assignedObject != null ? assignedObject.assigned_to_extra_info : void 0);\n bg = null;\n if ((assignedObject != null ? assignedObject.assigned_to : void 0) != null) {\n fullName = assignedObject.assigned_to_extra_info.full_name_display;\n isUnassigned = false;\n bg = avatar.bg;\n } else {\n fullName = $translate.instant(\"COMMON.ASSIGNED_TO.ASSIGN\");\n isUnassigned = true;\n }\n isIocaine = assignedObject != null ? assignedObject.is_iocaine : void 0;\n ctx = {\n fullName: fullName,\n avatar: avatar.url,\n bg: bg,\n isUnassigned: isUnassigned,\n isEditable: isEditable(),\n isIocaine: isIocaine,\n fullNameVisible: !(isUnassigned && !$currentUserService.isAuthenticated())\n };\n html = $compile(template(ctx))($scope);\n return $el.html(html);\n };\n $el.on(\"click\", \".user-assigned\", function(event) {\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n return $scope.$apply(function() {\n return $rootscope.$broadcast(\"assigned-to:add\", $model.$modelValue);\n });\n });\n $el.on(\"click\", \".assign-to-me\", function(event) {\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n $model.$modelValue.assigned_to = $currentUserService.getUser().get('id');\n return save($currentUserService.getUser().get('id'));\n });\n $el.on(\"click\", \".remove-user\", function(event) {\n var title;\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n title = $translate.instant(\"COMMON.ASSIGNED_TO.CONFIRM_UNASSIGNED\");\n return $confirm.ask(title).then((function(_this) {\n return function(response) {\n response.finish();\n $model.$modelValue.assigned_to = null;\n return save(null);\n };\n })(this));\n });\n $scope.$on(\"assigned-to:added\", function(ctx, userId, item) {\n if (item.id !== $model.$modelValue.id) {\n return;\n }\n return save(userId);\n });\n $scope.$watch($attrs.ngModel, function(instance) {\n return renderAssignedTo(instance);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgAssignedTo\", [\"$rootScope\", \"$tgConfirm\", \"$tgRepo\", \"$tgLoading\", \"$tgQueueModelTransformation\", \"$tgTemplate\", \"$translate\", \"$compile\", \"tgCurrentUserService\", \"tgAvatarService\", AssignedToDirective]);\n\n BlockButtonDirective = function($rootscope, $loading, $template) {\n var link, template;\n template = $template.get(\"common/components/block-button.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n $scope.$watch($attrs.ngModel, function(item) {\n if (!item) {\n return;\n }\n if (isEditable()) {\n $el.find('.item-block').addClass('editable');\n }\n if (item.is_blocked) {\n $el.find('.item-block').removeClass('is-active');\n return $el.find('.item-unblock').addClass('is-active');\n } else {\n $el.find('.item-block').addClass('is-active');\n return $el.find('.item-unblock').removeClass('is-active');\n }\n });\n $el.on(\"click\", \".item-block\", function(event) {\n event.preventDefault();\n return $rootscope.$broadcast(\"block\", $model.$modelValue);\n });\n $el.on(\"click\", \".item-unblock\", function(event) {\n var currentLoading, finish;\n event.preventDefault();\n currentLoading = $loading().target($el.find(\".item-unblock\")).start();\n finish = function() {\n return currentLoading.finish();\n };\n return $rootscope.$broadcast(\"unblock\", $model.$modelValue, finish);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgBlockButton\", [\"$rootScope\", \"$tgLoading\", \"$tgTemplate\", BlockButtonDirective]);\n\n DeleteButtonDirective = function($log, $repo, $confirm, $location, $template) {\n var link, template;\n template = $template.get(\"common/components/delete-button.html\");\n link = function($scope, $el, $attrs, $model) {\n if (!$attrs.onDeleteGoToUrl) {\n return $log.error(\"DeleteButtonDirective requires on-delete-go-to-url set in scope.\");\n }\n if (!$attrs.onDeleteTitle) {\n return $log.error(\"DeleteButtonDirective requires on-delete-title set in scope.\");\n }\n $el.on(\"click\", \".button-delete\", function(event) {\n var subtitle, title;\n title = $attrs.onDeleteTitle;\n subtitle = $model.$modelValue.subject;\n return $confirm.askOnDelete(title, subtitle).then((function(_this) {\n return function(askResponse) {\n var promise;\n promise = $repo.remove($model.$modelValue);\n promise.then(function() {\n var url;\n askResponse.finish();\n url = $scope.$eval($attrs.onDeleteGoToUrl);\n return $location.path(url);\n });\n return promise.then(null, function() {\n askResponse.finish(false);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgDeleteButton\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"$tgTemplate\", DeleteButtonDirective]);\n\n EditableDescriptionDirective = function($rootscope, $repo, $confirm, $compile, $loading, $selectedText, $modelTransform, $template, $translate) {\n var link, noDescriptionMegEditMode, noDescriptionMegReadMode, template;\n template = $template.get(\"common/components/editable-description.html\");\n noDescriptionMegEditMode = $template.get(\"common/components/editable-description-msg-edit-mode.html\");\n noDescriptionMegReadMode = $template.get(\"common/components/editable-description-msg-read-mode.html\");\n link = function($scope, $el, $attrs, $model) {\n var cancelEdition, isEditable, save;\n $el.find('.edit-description').hide();\n $el.find('.view-description .edit').hide();\n $scope.$on(\"object:updated\", function() {\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n });\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n save = function(description) {\n var currentLoading, transform;\n currentLoading = $loading().target($el.find('.save-container')).start();\n transform = $modelTransform.save(function(item) {\n item.description = description;\n return item;\n });\n transform.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"object:updated\");\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n });\n transform.then(null, function() {\n return $confirm.notify(\"error\");\n });\n return transform[\"finally\"](function() {\n return currentLoading.finish();\n });\n };\n cancelEdition = function() {\n $scope.item.revert();\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n };\n $el.on(\"mouseup\", \".view-description\", function(event) {\n var target;\n target = angular.element(event.target);\n if (!isEditable()) {\n return;\n }\n if (target.is('a')) {\n return;\n }\n if ($selectedText.get().length) {\n return;\n }\n $el.find('.edit-description').show();\n $el.find('.view-description').hide();\n return $el.find('textarea').focus();\n });\n $el.on(\"click\", \"a\", function(event) {\n var href, target;\n target = angular.element(event.target);\n href = target.attr('href');\n if (href.indexOf(\"#\") === 0) {\n event.preventDefault();\n return $('body').scrollTop($(href).offset().top);\n }\n });\n $el.on(\"click\", \".save\", function(e) {\n var description;\n e.preventDefault();\n description = $scope.item.description;\n return save(description);\n });\n $el.on(\"keydown\", \"textarea\", function(event) {\n if (event.keyCode !== 27) {\n return;\n }\n return $scope.$applyAsync(function() {\n var message, title;\n title = $translate.instant(\"COMMON.CONFIRM_CLOSE_EDIT_MODE_TITLE\");\n message = $translate.instant(\"COMMON.CONFIRM_CLOSE_EDIT_MODE_MESSAGE\");\n return $confirm.ask(title, null, message).then(function(askResponse) {\n cancelEdition();\n return askResponse.finish();\n });\n });\n });\n $scope.$watch($attrs.ngModel, function(value) {\n if (!value) {\n return;\n }\n $scope.item = value;\n if (isEditable()) {\n $el.find('.view-description .edit').show();\n $el.find('.view-description .us-content').addClass('editable');\n return $scope.noDescriptionMsg = $compile(noDescriptionMegEditMode)($scope);\n } else {\n return $scope.noDescriptionMsg = $compile(noDescriptionMegReadMode)($scope);\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\",\n template: template\n };\n };\n\n module.directive(\"tgEditableDescription\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$compile\", \"$tgLoading\", \"$selectedText\", \"$tgQueueModelTransformation\", \"$tgTemplate\", \"$translate\", EditableDescriptionDirective]);\n\n EditableWysiwyg = function(attachmentsService, attachmentsFullService) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var isInEditMode, uploadFile;\n isInEditMode = function() {\n return $el.find('textarea').is(':visible') && $model.$modelValue.id;\n };\n uploadFile = function(file, type) {\n if (!attachmentsService.validate(file)) {\n return;\n }\n return attachmentsFullService.addAttachment($model.$modelValue.project, $model.$modelValue.id, type, file).then(function(result) {\n if (taiga.isImage(result.getIn(['file', 'name']))) {\n return '![' + result.getIn(['file', 'name']) + '](' + result.getIn(['file', 'url']) + ')';\n } else {\n return '[' + result.getIn(['file', 'name']) + '](' + result.getIn(['file', 'url']) + ')';\n }\n });\n };\n $el.on('dragover', function(e) {\n var textarea;\n textarea = $el.find('textarea').focus();\n return false;\n });\n return $el.on('drop', function(e) {\n var dataTransfer, promises, textarea, type;\n e.stopPropagation();\n e.preventDefault();\n if (isInEditMode()) {\n dataTransfer = e.dataTransfer || (e.originalEvent && e.originalEvent.dataTransfer);\n textarea = $el.find('textarea');\n textarea.addClass('in-progress');\n type = $model.$modelValue['_name'];\n if (type === \"userstories\") {\n type = \"us\";\n } else if (type === \"tasks\") {\n type = \"task\";\n } else if (type === \"issues\") {\n type = \"issue\";\n } else if (type === \"wiki\") {\n type = \"wiki_page\";\n }\n promises = _.map(dataTransfer.files, function(file) {\n return uploadFile(file, type);\n });\n return Promise.all(promises).then(function(result) {\n textarea = $el.find('textarea');\n $.markItUp({\n replaceWith: result.join(' ')\n });\n return textarea.removeClass('in-progress');\n });\n }\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgEditableWysiwyg\", [\"tgAttachmentsService\", \"tgAttachmentsFullService\", EditableWysiwyg]);\n\n ListItemEpicStatusDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var epic;\n epic = $scope.$eval($attrs.tgListitemEpicStatus);\n return bindOnce($scope, \"epicStatusById\", function(epicStatusById) {\n return $el.html(epicStatusById[epic.status].name);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemEpicStatus\", ListItemEpicStatusDirective);\n\n ListItemUsStatusDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var us;\n us = $scope.$eval($attrs.tgListitemUsStatus);\n return bindOnce($scope, \"usStatusById\", function(usStatusById) {\n return $el.html(usStatusById[us.status].name);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemUsStatus\", ListItemUsStatusDirective);\n\n ListItemTaskStatusDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var task;\n task = $scope.$eval($attrs.tgListitemTaskStatus);\n return bindOnce($scope, \"taskStatusById\", function(taskStatusById) {\n return $el.html(taskStatusById[task.status].name);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemTaskStatus\", ListItemTaskStatusDirective);\n\n ListItemAssignedtoDirective = function($template, $translate, avatarService) {\n var link, template;\n template = $template.get(\"common/components/list-item-assigned-to-avatar.html\", true);\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, \"usersById\", function(usersById) {\n var avatar, ctx, item, member;\n item = $scope.$eval($attrs.tgListitemAssignedto);\n ctx = {\n name: $translate.instant(\"COMMON.ASSIGNED_TO.NOT_ASSIGNED\")\n };\n member = usersById[item.assigned_to];\n avatar = avatarService.getAvatar(member);\n ctx.imgurl = avatar.url;\n ctx.bg = avatar.bg;\n if (member) {\n ctx.name = member.full_name_display;\n }\n return $el.html(template(ctx));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemAssignedto\", [\"$tgTemplate\", \"$translate\", \"tgAvatarService\", ListItemAssignedtoDirective]);\n\n ListItemIssueStatusDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemIssueStatus);\n return bindOnce($scope, \"issueStatusById\", function(issueStatusById) {\n return $el.html(issueStatusById[issue.status].name);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemIssueStatus\", ListItemIssueStatusDirective);\n\n ListItemTypeDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var render;\n render = function(issueTypeById, issue) {\n var domNode, type;\n type = issueTypeById[issue.type];\n domNode = $el.find(\".level\");\n domNode.css(\"background-color\", type.color);\n return domNode.attr(\"title\", type.name);\n };\n bindOnce($scope, \"issueTypeById\", function(issueTypeById) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemType);\n return render(issueTypeById, issue);\n });\n return $scope.$watch($attrs.tgListitemType, function(issue) {\n return render($scope.issueTypeById, issue);\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/level.html\"\n };\n };\n\n module.directive(\"tgListitemType\", ListItemTypeDirective);\n\n ListItemPriorityDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var render;\n render = function(priorityById, issue) {\n var domNode, priority;\n priority = priorityById[issue.priority];\n domNode = $el.find(\".level\");\n domNode.css(\"background-color\", priority.color);\n return domNode.attr(\"title\", priority.name);\n };\n bindOnce($scope, \"priorityById\", function(priorityById) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemPriority);\n return render(priorityById, issue);\n });\n return $scope.$watch($attrs.tgListitemPriority, function(issue) {\n return render($scope.priorityById, issue);\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/level.html\"\n };\n };\n\n module.directive(\"tgListitemPriority\", ListItemPriorityDirective);\n\n ListItemSeverityDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var render;\n render = function(severityById, issue) {\n var domNode, severity;\n severity = severityById[issue.severity];\n domNode = $el.find(\".level\");\n domNode.css(\"background-color\", severity.color);\n return domNode.attr(\"title\", severity.name);\n };\n bindOnce($scope, \"severityById\", function(severityById) {\n var issue;\n issue = $scope.$eval($attrs.tgListitemSeverity);\n return render(severityById, issue);\n });\n return $scope.$watch($attrs.tgListitemSeverity, function(issue) {\n return render($scope.severityById, issue);\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/level.html\"\n };\n };\n\n module.directive(\"tgListitemSeverity\", ListItemSeverityDirective);\n\n TgProgressBarDirective = function($template) {\n var link, render, template;\n template = $template.get(\"common/components/progress-bar.html\", true);\n render = function(el, percentage) {\n return el.html(template({\n percentage: percentage\n }));\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch($attrs.tgProgressBar, function(percentage) {\n percentage = _.max([0, percentage]);\n percentage = _.min([100, percentage]);\n return render($el, percentage);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProgressBar\", [\"$tgTemplate\", TgProgressBarDirective]);\n\n TgMainTitleDirective = function($translate) {\n var link;\n link = function($scope, $el, $attrs) {\n $attrs.$observe(\"i18nSectionName\", function(i18nSectionName) {\n return $scope.sectionName = i18nSectionName;\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n templateUrl: \"common/components/main-title.html\",\n scope: {\n projectName: \"=projectName\"\n }\n };\n };\n\n module.directive(\"tgMainTitle\", [\"$translate\", TgMainTitleDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/base/confirm.coffee\n */\n\n(function() {\n var ConfirmService, NOTIFICATION_MSG, bindMethods, cancelTimeout, debounce, module, taiga, timeout,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n timeout = this.taiga.timeout;\n\n cancelTimeout = this.taiga.cancelTimeout;\n\n debounce = this.taiga.debounce;\n\n bindMethods = this.taiga.bindMethods;\n\n NOTIFICATION_MSG = {\n \"success\": {\n title: \"NOTIFICATION.OK\",\n message: \"NOTIFICATION.SAVED\"\n },\n \"error\": {\n title: \"NOTIFICATION.WARNING\",\n message: \"NOTIFICATION.WARNING_TEXT\"\n },\n \"light-error\": {\n title: \"NOTIFICATION.WARNING\",\n message: \"NOTIFICATION.WARNING_TEXT\"\n }\n };\n\n ConfirmService = (function(superClass) {\n extend(ConfirmService, superClass);\n\n ConfirmService.$inject = [\"$q\", \"lightboxService\", \"$tgLoading\", \"$translate\"];\n\n function ConfirmService(q, lightboxService, loading, translate) {\n this.q = q;\n this.lightboxService = lightboxService;\n this.loading = loading;\n this.translate = translate;\n bindMethods(this);\n }\n\n ConfirmService.prototype.hide = function(el) {\n if (el) {\n this.lightboxService.close(el);\n return el.off(\".confirm-dialog\");\n }\n };\n\n ConfirmService.prototype.ask = function(title, subtitle, message, lightboxSelector) {\n var defered, el;\n if (lightboxSelector == null) {\n lightboxSelector = \".lightbox-generic-ask\";\n }\n defered = this.q.defer();\n el = angular.element(lightboxSelector);\n if (title) {\n el.find(\".title\").text(title);\n }\n if (subtitle) {\n el.find(\".subtitle\").text(subtitle);\n }\n if (message) {\n el.find(\".message\").text(message);\n }\n el.on(\"click.confirm-dialog\", \".button-green\", debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n currentLoading = _this.loading().target(target).start();\n return defered.resolve({\n finish: function(ok) {\n if (ok == null) {\n ok = true;\n }\n currentLoading.finish();\n if (ok) {\n return _this.hide(el);\n }\n }\n });\n };\n })(this)));\n el.on(\"click.confirm-dialog\", \".button-red\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.reject();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.askOnDelete = function(title, message) {\n return this.ask(title, this.translate.instant(\"NOTIFICATION.ASK_DELETE\"), message);\n };\n\n ConfirmService.prototype.askChoice = function(title, subtitle, choices, replacement, warning, lightboxSelector) {\n var choicesField, defered, el;\n if (lightboxSelector == null) {\n lightboxSelector = \".lightbox-ask-choice\";\n }\n defered = this.q.defer();\n el = angular.element(lightboxSelector);\n el.find(\".title\").text(title);\n el.find(\".subtitle\").text(subtitle);\n if (replacement) {\n el.find(\".replacement\").text(replacement);\n } else {\n el.find(\".replacement\").remove();\n }\n if (warning) {\n el.find(\".warning\").text(warning);\n } else {\n el.find(\".warning\").remove();\n }\n choicesField = el.find(\".choices\");\n choicesField.html('');\n _.each(choices, function(value, key) {\n value = _.escape(value);\n return choicesField.append(angular.element(\"\"));\n });\n el.on(\"click.confirm-dialog\", \"a.button-green\", debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n currentLoading = _this.loading().target(target).start();\n return defered.resolve({\n selected: choicesField.val(),\n finish: function(ok) {\n if (ok == null) {\n ok = true;\n }\n currentLoading.finish();\n if (ok) {\n return _this.hide(el);\n }\n }\n });\n };\n })(this)));\n el.on(\"click.confirm-dialog\", \".button-red\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.reject();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.error = function(message) {\n var defered, el;\n defered = this.q.defer();\n el = angular.element(\".lightbox-generic-error\");\n el.find(\".title\").html(message);\n el.on(\"click.confirm-dialog\", \".button-green\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n el.on(\"click.confirm-dialog\", \".close\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.success = function(title, message, icon) {\n var defered, detailImage, el, svgContainer, useSVG;\n defered = this.q.defer();\n el = angular.element(\".lightbox-generic-success\");\n el.find(\"img\").remove();\n el.find(\"svg\").remove();\n if (icon) {\n if (icon.type === \"img\") {\n detailImage = $('
').addClass('lb-icon').attr('src', icon.name);\n } else if (icon.type === \"svg\") {\n detailImage = document.createElement(\"div\");\n taiga.addClass(detailImage, \"icon\");\n taiga.addClass(detailImage, icon.name);\n taiga.addClass(detailImage, \"lb-icon\");\n svgContainer = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n useSVG = document.createElementNS('http://www.w3.org/2000/svg', 'use');\n useSVG.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + icon.name);\n detailImage.appendChild(svgContainer).appendChild(useSVG);\n }\n if (detailImage) {\n el.find('section').prepend(detailImage);\n }\n }\n if (title) {\n el.find(\".title\").html(title);\n }\n if (message) {\n el.find(\".message\").html(message);\n }\n el.on(\"click.confirm-dialog\", \".button-green\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n el.on(\"click.confirm-dialog\", \".close\", (function(_this) {\n return function(event) {\n event.preventDefault();\n defered.resolve();\n return _this.hide(el);\n };\n })(this));\n this.lightboxService.open(el);\n return defered.promise;\n };\n\n ConfirmService.prototype.loader = function(title, message) {\n var el;\n el = angular.element(\".lightbox-generic-loading\");\n if (title) {\n el.find(\".title\").html(title);\n }\n if (message) {\n el.find(\".message\").html(message);\n }\n return {\n start: (function(_this) {\n return function() {\n return _this.lightboxService.open(el);\n };\n })(this),\n stop: (function(_this) {\n return function() {\n return _this.lightboxService.close(el);\n };\n })(this),\n update: (function(_this) {\n return function(status, title, message, percent) {\n if (title) {\n el.find(\".title\").html(title);\n }\n if (message) {\n el.find(\".message\").html(message);\n }\n if (percent) {\n el.find(\".spin\").addClass(\"hidden\");\n el.find(\".progress-bar-wrapper\").removeClass(\"hidden\");\n el.find(\".progress-bar-wrapper > .bar\").width(percent + '%');\n return el.find(\".progress-bar-wrapper > span\").html(percent + '%').css('left', (percent - 9) + '%');\n } else {\n el.find(\".spin\").removeClass(\"hidden\");\n return el.find(\".progress-bar-wrapper\").addClass(\"hidden\");\n }\n };\n })(this)\n };\n };\n\n ConfirmService.prototype.notify = function(type, message, title, time) {\n var body, el, selector;\n selector = \".notification-message-\" + type;\n el = angular.element(selector);\n if (el.hasClass(\"active\")) {\n return;\n }\n if (title) {\n el.find(\"h4\").html(title);\n } else {\n el.find(\"h4\").html(this.translate.instant(NOTIFICATION_MSG[type].title));\n }\n if (message) {\n el.find(\"p\").html(message);\n } else {\n el.find(\"p\").html(this.translate.instant(NOTIFICATION_MSG[type].message));\n }\n body = angular.element(\"body\");\n body.find(\".notification-message .notification-light\").removeClass('active').addClass('inactive');\n body.find(selector).removeClass('inactive').addClass('active');\n if (this.tsem) {\n cancelTimeout(this.tsem);\n }\n if (!time) {\n time = type === 'error' || type === 'light-error' ? 3500 : 1500;\n }\n this.tsem = timeout(time, (function(_this) {\n return function() {\n body.find(selector).removeClass('active').addClass('inactive').one('animationend', function() {\n return $(this).removeClass('inactive');\n });\n return delete _this.tsem;\n };\n })(this));\n return el.on(\"click\", \".icon-close, .close\", (function(_this) {\n return function(event) {\n return body.find(selector).removeClass('active').addClass('inactive');\n };\n })(this));\n };\n\n return ConfirmService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaCommon\");\n\n module.service(\"$tgConfirm\", ConfirmService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/custom-field-values.coffee\n */\n\n(function() {\n var CustomAttributeValueDirective, CustomAttributesValuesController, CustomAttributesValuesDirective, DATE_TYPE, MULTILINE_TYPE, TEXT_TYPE, TYPE_CHOICES, URL_TYPE, bindMethods, bindOnce, debounce, generateHash, module, taiga,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n taiga = this.taiga;\n\n bindMethods = this.taiga.bindMethods;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n generateHash = taiga.generateHash;\n\n module = angular.module(\"taigaCommon\");\n\n TEXT_TYPE = \"text\";\n\n MULTILINE_TYPE = \"multiline\";\n\n DATE_TYPE = \"date\";\n\n URL_TYPE = \"url\";\n\n TYPE_CHOICES = [\n {\n key: TEXT_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_TEXT\"\n }, {\n key: MULTILINE_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_MULTI\"\n }, {\n key: DATE_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_DATE\"\n }, {\n key: URL_TYPE,\n name: \"ADMIN.CUSTOM_FIELDS.FIELD_TYPE_URL\"\n }\n ];\n\n CustomAttributesValuesController = (function(superClass) {\n extend(CustomAttributesValuesController, superClass);\n\n CustomAttributesValuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$q\"];\n\n function CustomAttributesValuesController(scope, rootscope, repo, rs, confirm, q) {\n this.scope = scope;\n this.rootscope = rootscope;\n this.repo = repo;\n this.rs = rs;\n this.confirm = confirm;\n this.q = q;\n bindMethods(this);\n this.type = null;\n this.objectId = null;\n this.projectId = null;\n this.customAttributes = [];\n this.customAttributesValues = null;\n }\n\n CustomAttributesValuesController.prototype.initialize = function(type, objectId) {\n this.project = this.scope.project;\n this.type = type;\n this.objectId = objectId;\n return this.projectId = this.scope.projectId;\n };\n\n CustomAttributesValuesController.prototype.loadCustomAttributesValues = function() {\n if (!this.objectId) {\n return this.customAttributesValues;\n }\n return this.rs.customAttributesValues[this.type].get(this.objectId).then((function(_this) {\n return function(customAttributesValues) {\n _this.customAttributes = _this.project[_this.type + \"_custom_attributes\"];\n _this.customAttributesValues = customAttributesValues;\n return customAttributesValues;\n };\n })(this));\n };\n\n CustomAttributesValuesController.prototype.getAttributeValue = function(attribute) {\n var attributeValue;\n attributeValue = _.clone(attribute, false);\n attributeValue.value = this.customAttributesValues.attributes_values[attribute.id];\n return attributeValue;\n };\n\n CustomAttributesValuesController.prototype.updateAttributeValue = function(attributeValue) {\n var attributesValues, onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"custom-attributes-values:edit\");\n };\n })(this);\n onError = (function(_this) {\n return function(response) {\n _this.confirm.notify(\"error\");\n return _this.q.reject();\n };\n })(this);\n attributesValues = _.clone(this.customAttributesValues.attributes_values, true);\n attributesValues[attributeValue.id] = attributeValue.value;\n this.customAttributesValues.attributes_values = attributesValues;\n this.customAttributesValues.id = this.objectId;\n return this.repo.save(this.customAttributesValues).then(onSuccess, onError);\n };\n\n return CustomAttributesValuesController;\n\n })(taiga.Controller);\n\n CustomAttributesValuesDirective = function($templates, $storage) {\n var collapsedHash, link, template, templateFn;\n template = $templates.get(\"custom-attributes/custom-attributes-values.html\", true);\n collapsedHash = function(type) {\n return generateHash([\"custom-attributes-collapsed\", type]);\n };\n link = function($scope, $el, $attrs, $ctrls) {\n var $ctrl, $model, hash;\n $ctrl = $ctrls[0];\n $model = $ctrls[1];\n hash = collapsedHash($attrs.type);\n $scope.collapsed = $storage.get(hash) || false;\n bindOnce($scope, $attrs.ngModel, function(value) {\n $ctrl.initialize($attrs.type, value.id);\n return $ctrl.loadCustomAttributesValues();\n });\n $scope.toggleCollapse = function() {\n $scope.collapsed = !$scope.collapsed;\n return $storage.set(hash, $scope.collapsed);\n };\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n templateFn = function($el, $attrs) {\n return template({\n requiredEditionPerm: $attrs.requiredEditionPerm\n });\n };\n return {\n require: [\"tgCustomAttributesValues\", \"ngModel\"],\n controller: CustomAttributesValuesController,\n controllerAs: \"ctrl\",\n restrict: \"AE\",\n scope: true,\n link: link,\n template: templateFn\n };\n };\n\n module.directive(\"tgCustomAttributesValues\", [\"$tgTemplate\", \"$tgStorage\", \"$translate\", CustomAttributesValuesDirective]);\n\n CustomAttributeValueDirective = function($template, $selectedText, $compile, $translate, datePickerConfigService) {\n var link, template, templateEdit;\n template = $template.get(\"custom-attributes/custom-attribute-value.html\", true);\n templateEdit = $template.get(\"custom-attributes/custom-attribute-value-edit.html\", true);\n link = function($scope, $el, $attrs, $ctrl) {\n var attributeValue, isEditable, prettyDate, render, setFocusAndSelectOnInputField, submit;\n prettyDate = $translate.instant(\"COMMON.PICKERDATE.FORMAT\");\n render = function(attributeValue, edit) {\n var ctx, datePickerConfig, editable, html, value;\n if (edit == null) {\n edit = false;\n }\n if (attributeValue.type === DATE_TYPE && attributeValue.value) {\n value = moment(attributeValue.value, \"YYYY-MM-DD\").format(prettyDate);\n } else {\n value = attributeValue.value;\n }\n editable = isEditable();\n ctx = {\n id: attributeValue.id,\n name: attributeValue.name,\n description: attributeValue.description,\n value: value,\n isEditable: editable,\n type: attributeValue.type\n };\n if (editable && (edit || !value)) {\n html = templateEdit(ctx);\n html = $compile(html)($scope);\n $el.html(html);\n if (attributeValue.type === DATE_TYPE) {\n datePickerConfig = datePickerConfigService.get();\n _.merge(datePickerConfig, {\n field: $el.find(\"input[name=value]\")[0],\n onSelect: (function(_this) {\n return function(date) {\n var selectedDate;\n return selectedDate = date;\n };\n })(this),\n onOpen: (function(_this) {\n return function() {\n if (typeof selectedDate !== \"undefined\" && selectedDate !== null) {\n return $el.picker.setDate(selectedDate);\n }\n };\n })(this)\n });\n return $el.picker = new Pikaday(datePickerConfig);\n }\n } else {\n html = template(ctx);\n html = $compile(html)($scope);\n return $el.html(html);\n }\n };\n isEditable = function() {\n var permissions, requiredEditionPerm;\n permissions = $scope.project.my_permissions;\n requiredEditionPerm = $attrs.requiredEditionPerm;\n return permissions.indexOf(requiredEditionPerm) > -1;\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var form, input;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n input = $el.find(\"input[name=value], textarea[name='value']\");\n attributeValue.value = input.val();\n if (attributeValue.type === DATE_TYPE) {\n if (moment(attributeValue.value, prettyDate).isValid()) {\n attributeValue.value = moment(attributeValue.value, prettyDate).format(\"YYYY-MM-DD\");\n }\n }\n return $scope.$apply(function() {\n return $ctrl.updateAttributeValue(attributeValue).then(function() {\n return render(attributeValue, false);\n });\n });\n };\n })(this));\n setFocusAndSelectOnInputField = function() {\n return $el.find(\"input[name='value'], textarea[name='value']\").focus().select();\n };\n attributeValue = $scope.$eval($attrs.tgCustomAttributeValue);\n render(attributeValue);\n $el.on(\"click\", \".js-value-view-mode span a\", function(event) {\n return event.stopPropagation();\n });\n $el.on(\"click\", \".js-value-view-mode\", function() {\n if (!isEditable()) {\n return;\n }\n if ($selectedText.get().length) {\n return;\n }\n render(attributeValue, true);\n return setFocusAndSelectOnInputField();\n });\n $el.on(\"click\", \".js-edit-description\", function(event) {\n event.preventDefault();\n render(attributeValue, true);\n return setFocusAndSelectOnInputField();\n });\n $el.on(\"keyup\", \"input[name=value], textarea[name='value']\", function(event) {\n if (event.keyCode === 13 && event.currentTarget.type !== \"textarea\") {\n return submit(event);\n } else if (event.keyCode === 27) {\n return render(attributeValue, false);\n }\n });\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".js-save-description\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"^tgCustomAttributesValues\",\n restrict: \"AE\"\n };\n };\n\n module.directive(\"tgCustomAttributeValue\", [\"$tgTemplate\", \"$selectedText\", \"$compile\", \"$translate\", \"tgDatePickerConfigService\", CustomAttributeValueDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/estimation.coffee\n */\n\n(function() {\n var EstimationsService, LbUsEstimationDirective, UsEstimationDirective, groupBy, module, taiga,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n taiga = this.taiga;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaCommon\");\n\n LbUsEstimationDirective = function($tgEstimationsService, $rootScope, $repo, $template, $compile) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $scope.$watch($attrs.ngModel, function(us) {\n var estimationProcess;\n if (us) {\n estimationProcess = $tgEstimationsService.create($el, us, $scope.project);\n estimationProcess.onSelectedPointForRole = function(roleId, pointId, points) {\n us.points = points;\n estimationProcess.render();\n return $scope.$apply(function() {\n return $model.$setViewValue(us);\n });\n };\n estimationProcess.render = function() {\n var ctx, html, mainTemplate, template;\n ctx = {\n totalPoints: this.calculateTotalPoints(),\n roles: this.calculateRoles(),\n editable: this.isEditable,\n loading: false\n };\n mainTemplate = \"common/estimation/us-estimation-points-per-role.html\";\n template = $template.get(mainTemplate, true);\n html = template(ctx);\n html = $compile(html)($scope);\n return this.$el.html(html);\n };\n return estimationProcess.render();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgLbUsEstimation\", [\"$tgEstimationsService\", \"$rootScope\", \"$tgRepo\", \"$tgTemplate\", \"$compile\", LbUsEstimationDirective]);\n\n UsEstimationDirective = function($tgEstimationsService, $rootScope, $repo, $template, $compile, $modelTransform, $confirm) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var save;\n save = function(points) {\n var onError, transform;\n transform = $modelTransform.save((function(_this) {\n return function(us) {\n us.points = points;\n return us;\n };\n })(this));\n onError = (function(_this) {\n return function() {\n return $confirm.notify(\"error\");\n };\n })(this);\n return transform.then(null, onError);\n };\n $scope.$watchCollection(function() {\n return $model.$modelValue && $model.$modelValue.points;\n }, function() {\n var estimationProcess, us;\n us = $model.$modelValue;\n if (us) {\n estimationProcess = $tgEstimationsService.create($el, us, $scope.project);\n estimationProcess.onSelectedPointForRole = function(roleId, pointId, points) {\n estimationProcess.loading = roleId;\n estimationProcess.render();\n return save(points).then(function() {\n estimationProcess.loading = false;\n $rootScope.$broadcast(\"object:updated\");\n return estimationProcess.render();\n });\n };\n estimationProcess.render = function() {\n var ctx, html, mainTemplate, template;\n ctx = {\n totalPoints: this.calculateTotalPoints(),\n roles: this.calculateRoles(),\n editable: this.isEditable,\n loading: estimationProcess.loading\n };\n mainTemplate = \"common/estimation/us-estimation-points-per-role.html\";\n template = $template.get(mainTemplate, true);\n html = template(ctx);\n html = $compile(html)($scope);\n return this.$el.html(html);\n };\n return estimationProcess.render();\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgUsEstimation\", [\"$tgEstimationsService\", \"$rootScope\", \"$tgRepo\", \"$tgTemplate\", \"$compile\", \"$tgQueueModelTransformation\", \"$tgConfirm\", UsEstimationDirective]);\n\n EstimationsService = function($template, $repo, $confirm, $q, $qqueue) {\n var EstimationProcess, create, pointsTemplate;\n pointsTemplate = $template.get(\"common/estimation/us-estimation-points.html\", true);\n EstimationProcess = (function() {\n function EstimationProcess($el1, us1, project1) {\n this.$el = $el1;\n this.us = us1;\n this.project = project1;\n this.bindClickEvents = bind(this.bindClickEvents, this);\n this.isEditable = this.project.my_permissions.indexOf(\"modify_us\") !== -1;\n this.roles = this.project.roles;\n this.points = this.project.points;\n this.loading = false;\n this.pointsById = groupBy(this.points, function(x) {\n return x.id;\n });\n this.onSelectedPointForRole = function(roleId, pointId) {};\n this.render = function() {};\n }\n\n EstimationProcess.prototype.save = function(roleId, pointId) {\n var deferred;\n deferred = $q.defer();\n $qqueue.add((function(_this) {\n return function() {\n var onError, onSuccess;\n onSuccess = function() {\n deferred.resolve();\n return _this.render();\n };\n onError = function() {\n $confirm.notify(\"error\");\n _this.us.revert();\n _this.render();\n return deferred.reject();\n };\n return $repo.save(_this.us).then(onSuccess, onError);\n };\n })(this));\n return deferred.promise;\n };\n\n EstimationProcess.prototype.calculateTotalPoints = function() {\n var notNullValues, values;\n values = _.map(this.us.points, (function(_this) {\n return function(v, k) {\n var ref;\n return (ref = _this.pointsById[v]) != null ? ref.value : void 0;\n };\n })(this));\n if (values.length === 0) {\n return \"?\";\n }\n notNullValues = _.filter(values, function(v) {\n return v != null;\n });\n if (notNullValues.length === 0) {\n return \"?\";\n }\n return _.reduce(notNullValues, function(acc, num) {\n return acc + num;\n });\n };\n\n EstimationProcess.prototype.calculateRoles = function() {\n var computableRoles, roles;\n computableRoles = _.filter(this.project.roles, \"computable\");\n roles = _.map(computableRoles, (function(_this) {\n return function(role) {\n var pointId, pointObj;\n pointId = _this.us.points[role.id];\n pointObj = _this.pointsById[pointId];\n role = _.clone(role, true);\n role.points = (pointObj != null) && (pointObj.name != null) ? pointObj.name : \"?\";\n return role;\n };\n })(this));\n return roles;\n };\n\n EstimationProcess.prototype.bindClickEvents = function() {\n this.$el.on(\"click\", \".total.clickable\", (function(_this) {\n return function(event) {\n var roleId, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n _this.renderPointsSelector(roleId, target);\n target.siblings().removeClass('active');\n return target.addClass('active');\n };\n })(this));\n return this.$el.on(\"click\", \".point\", (function(_this) {\n return function(event) {\n var pointId, points, roleId, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n pointId = target.data(\"point-id\");\n _this.$el.find(\".popover\").popover().close();\n points = _.clone(_this.us.points, true);\n points[roleId] = pointId;\n return _this.onSelectedPointForRole(roleId, pointId, points);\n };\n })(this));\n };\n\n EstimationProcess.prototype.renderPointsSelector = function(roleId, target) {\n var horizontalList, html, maxPointLength, points, pop;\n points = _.map(this.points, (function(_this) {\n return function(point) {\n point = _.clone(point, true);\n point.selected = _this.us.points[roleId] === point.id ? false : true;\n return point;\n };\n })(this));\n maxPointLength = 5;\n horizontalList = _.some(points, (function(_this) {\n return function(point) {\n return point.name.length > maxPointLength;\n };\n })(this));\n html = pointsTemplate({\n \"points\": points,\n roleId: roleId,\n horizontal: horizontalList\n });\n this.$el.find(\".popover\").popover().close();\n this.$el.find(\".pop-points-open\").remove();\n if (target != null) {\n this.$el.find(target).append(html);\n } else {\n this.$el.append(html);\n }\n this.$el.find(\".pop-points-open\").popover().open(function() {\n return $(this).removeClass(\"active\").closest(\"li\").removeClass(\"active\");\n });\n this.$el.find(\".pop-points-open\").show();\n pop = this.$el.find(\".pop-points-open\");\n if (pop.offset().top + pop.height() > document.body.clientHeight) {\n return pop.addClass('pop-bottom');\n }\n };\n\n return EstimationProcess;\n\n })();\n create = function($el, us, project) {\n var estimationProcess;\n $el.unbind(\"click\");\n estimationProcess = new EstimationProcess($el, us, project);\n if (estimationProcess.isEditable) {\n estimationProcess.bindClickEvents();\n }\n return estimationProcess;\n };\n return {\n create: create\n };\n };\n\n module.factory(\"$tgEstimationsService\", [\"$tgTemplate\", \"$tgRepo\", \"$tgConfirm\", \"$q\", \"$tgQqueue\", EstimationsService]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/filters.coffee\n */\n\n(function() {\n var byRefFilter, darkerFilter, defaultFilter, module, momentFormat, momentFromNow, sizeFormat, taiga, toMutableFilter, unslugify, yesNoFilter;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n defaultFilter = function() {\n return function(value, defaultValue) {\n if (value === [null, void 0]) {\n return defaultValue;\n }\n return value;\n };\n };\n\n module.filter(\"default\", defaultFilter);\n\n yesNoFilter = function($translate) {\n return function(value) {\n if (value) {\n return $translate.instant(\"COMMON.YES\");\n }\n return $translate.instant(\"COMMON.NO\");\n };\n };\n\n module.filter(\"yesNo\", [\"$translate\", yesNoFilter]);\n\n unslugify = function() {\n return taiga.unslugify;\n };\n\n module.filter(\"unslugify\", unslugify);\n\n momentFormat = function() {\n return function(input, format) {\n if (input) {\n return moment(input).format(format);\n }\n return \"\";\n };\n };\n\n module.filter(\"momentFormat\", momentFormat);\n\n momentFromNow = function() {\n return function(input, without_suffix) {\n if (input) {\n return moment(input).fromNow(without_suffix || false);\n }\n return \"\";\n };\n };\n\n module.filter(\"momentFromNow\", momentFromNow);\n\n sizeFormat = (function(_this) {\n return function() {\n return _this.taiga.sizeFormat;\n };\n })(this);\n\n module.filter(\"sizeFormat\", sizeFormat);\n\n toMutableFilter = function() {\n var memoizedMutable, toMutable;\n toMutable = function(js) {\n return js.toJS();\n };\n memoizedMutable = _.memoize(toMutable);\n return function(input) {\n if (input instanceof Immutable.List) {\n return memoizedMutable(input);\n }\n return input;\n };\n };\n\n module.filter(\"toMutable\", toMutableFilter);\n\n byRefFilter = function($filterFilter) {\n return function(userstories, filter) {\n var cleanRef;\n if (filter != null ? filter.startsWith(\"#\") : void 0) {\n cleanRef = filter.substr(1);\n return _.filter(userstories, (function(_this) {\n return function(us) {\n return String(us.ref).startsWith(cleanRef);\n };\n })(this));\n }\n return $filterFilter(userstories, filter);\n };\n };\n\n module.filter(\"byRef\", [\"filterFilter\", byRefFilter]);\n\n darkerFilter = function() {\n return function(color, luminosity) {\n var black, c, i, j, len, newColor, ref, white;\n color = new String(color).replace(/[^0-9a-f]/gi, '');\n if (color.length < 6) {\n color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];\n }\n luminosity = luminosity || 0;\n newColor = \"#\";\n c = 0;\n i = 0;\n black = 0;\n white = 255;\n ref = [0, 1, 2];\n for (j = 0, len = ref.length; j < len; j++) {\n i = ref[j];\n c = parseInt(color.substr(i * 2, 2), 16);\n c = Math.round(Math.min(Math.max(black, c + (luminosity * white)), white)).toString(16);\n newColor += (\"00\" + c).substr(c.length);\n }\n return newColor;\n };\n };\n\n module.filter(\"darker\", darkerFilter);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/importer.coffee\n */\n\n(function() {\n var ImportProjectButtonDirective, LbImportErrorDirective, module;\n\n module = angular.module(\"taigaCommon\");\n\n ImportProjectButtonDirective = function($rs, $confirm, $location, $navUrls, $translate, $lightboxFactory, currentUserService, $tgAuth) {\n var link;\n link = function($scope, $el, $attrs) {\n var getRestrictionError;\n getRestrictionError = function(result) {\n var errorKey, maxMemberships, membersError, privateError, publicError, user;\n if (result.headers) {\n errorKey = '';\n user = currentUserService.getUser();\n maxMemberships = 0;\n if (result.headers.isPrivate) {\n privateError = !currentUserService.canCreatePrivateProjects().valid;\n maxMemberships = null;\n if (user.get('max_memberships_private_projects') !== null && result.headers.memberships >= user.get('max_memberships_private_projects')) {\n membersError = true;\n } else {\n membersError = false;\n }\n if (privateError && membersError) {\n errorKey = 'private-space-members';\n maxMemberships = user.get('max_memberships_private_projects');\n } else if (privateError) {\n errorKey = 'private-space';\n } else if (membersError) {\n errorKey = 'private-members';\n maxMemberships = user.get('max_memberships_private_projects');\n }\n } else {\n publicError = !currentUserService.canCreatePublicProjects().valid;\n if (user.get('max_memberships_public_projects') !== null && result.headers.memberships >= user.get('max_memberships_public_projects')) {\n membersError = true;\n } else {\n membersError = false;\n }\n if (publicError && membersError) {\n errorKey = 'public-space-members';\n maxMemberships = user.get('max_memberships_public_projects');\n } else if (publicError) {\n errorKey = 'public-space';\n } else if (membersError) {\n errorKey = 'public-members';\n maxMemberships = user.get('max_memberships_public_projects');\n }\n }\n return {\n key: errorKey,\n values: {\n max_memberships: maxMemberships,\n members: result.headers.memberships\n }\n };\n } else {\n return false;\n }\n };\n $el.on(\"click\", \".import-project-button\", function(event) {\n event.preventDefault();\n $el.find(\"input.import-file\").val(\"\");\n return $el.find(\"input.import-file\").trigger(\"click\");\n });\n return $el.on(\"change\", \"input.import-file\", function(event) {\n var file, loader, onError, onSuccess;\n event.preventDefault();\n file = event.target.files[0];\n if (!file) {\n return;\n }\n loader = $confirm.loader($translate.instant(\"PROJECT.IMPORT.UPLOADING_FILE\"));\n onSuccess = function(result) {\n return currentUserService.loadProjects().then(function() {\n var ctx, message, msg, title;\n loader.stop();\n if (result.status === 202) {\n title = $translate.instant(\"PROJECT.IMPORT.ASYNC_IN_PROGRESS_TITLE\");\n message = $translate.instant(\"PROJECT.IMPORT.ASYNC_IN_PROGRESS_MESSAGE\");\n return $confirm.success(title, message);\n } else {\n ctx = {\n project: result.data.slug\n };\n $location.path($navUrls.resolve(\"project-admin-project-profile-details\", ctx));\n msg = $translate.instant(\"PROJECT.IMPORT.SYNC_SUCCESS\");\n return $confirm.notify(\"success\", msg);\n }\n });\n };\n onError = function(result) {\n return $tgAuth.refresh().then(function() {\n var errorMsg, ref, restrictionError;\n restrictionError = getRestrictionError(result);\n loader.stop();\n if (restrictionError) {\n return $lightboxFactory.create('tg-lb-import-error', {\n \"class\": 'lightbox lightbox-import-error'\n }, restrictionError);\n } else {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR\");\n if (result.status === 429) {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR_TOO_MANY_REQUEST\");\n } else if ((ref = result.data) != null ? ref._error_message : void 0) {\n errorMsg = $translate.instant(\"PROJECT.IMPORT.ERROR_MESSAGE\", {\n error_message: result.data._error_message\n });\n }\n return $confirm.notify(\"error\", errorMsg);\n }\n });\n };\n loader.start();\n return $rs.projects[\"import\"](file, loader.update).then(onSuccess, onError);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgImportProjectButton\", [\"$tgResources\", \"$tgConfirm\", \"$location\", \"$tgNavUrls\", \"$translate\", \"tgLightboxFactory\", \"tgCurrentUserService\", \"$tgAuth\", ImportProjectButtonDirective]);\n\n LbImportErrorDirective = function(lightboxService) {\n var link;\n link = function(scope, el, attrs) {\n lightboxService.open(el);\n return scope.close = function() {\n lightboxService.close(el);\n };\n };\n return {\n templateUrl: \"common/lightbox/lightbox-import-error.html\",\n link: link\n };\n };\n\n LbImportErrorDirective.$inject = [\"lightboxService\"];\n\n module.directive(\"tgLbImportError\", LbImportErrorDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/lightboxes.coffee\n */\n\n(function() {\n var AssignedToLightboxDirective, BlockLightboxDirective, BlockingMessageInputDirective, CreateBulkUserstoriesDirective, CreateEditUserstoryDirective, LightboxDirective, LightboxKeyboardNavigationService, LightboxLeaveProjectWarningDirective, LightboxService, WatchersLightboxDirective, bindOnce, debounce, module, sizeFormat, timeout, trim,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty,\n indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\n module = angular.module(\"taigaCommon\");\n\n bindOnce = this.taiga.bindOnce;\n\n timeout = this.taiga.timeout;\n\n debounce = this.taiga.debounce;\n\n sizeFormat = this.taiga.sizeFormat;\n\n trim = this.taiga.trim;\n\n LightboxService = (function(superClass) {\n extend(LightboxService, superClass);\n\n function LightboxService(animationFrame, q, rootScope) {\n this.animationFrame = animationFrame;\n this.q = q;\n this.rootScope = rootScope;\n }\n\n LightboxService.prototype.open = function($el, onClose) {\n var defered, docEl, lightboxContent;\n this.onClose = onClose;\n if (_.isString($el)) {\n $el = $($el);\n }\n defered = this.q.defer();\n lightboxContent = $el.children().not(\".close\");\n lightboxContent.hide();\n this.animationFrame.add(function() {\n return $el.css('display', 'flex');\n });\n this.animationFrame.add(function() {\n $el.addClass(\"open\");\n return $el.one(\"transitionend\", (function(_this) {\n return function() {\n var firstField;\n firstField = $el.find('input,textarea').first();\n if (firstField.length) {\n return $el.find('input,textarea').first().focus();\n } else if (document.activeElement) {\n return $(document.activeElement).blur();\n }\n };\n })(this));\n });\n this.animationFrame.add((function(_this) {\n return function() {\n lightboxContent.show();\n return defered.resolve();\n };\n })(this));\n docEl = angular.element(document);\n docEl.on(\"keydown.lightbox\", (function(_this) {\n return function(e) {\n var code;\n code = e.keyCode ? e.keyCode : e.which;\n if (code === 27) {\n return _this.close($el);\n }\n };\n })(this));\n return defered.promise;\n };\n\n LightboxService.prototype.close = function($el) {\n return new Promise((function(_this) {\n return function(resolve) {\n var docEl, scope;\n if (_.isString($el)) {\n $el = $($el);\n }\n docEl = angular.element(document);\n docEl.off(\".lightbox\");\n docEl.off(\".keyboard-navigation\");\n _this.animationFrame.add(function() {\n $el.addClass('close');\n return $el.one(\"transitionend\", function() {\n $el.removeAttr('style');\n $el.removeClass(\"open\").removeClass('close');\n if (_this.onClose) {\n _this.rootScope.$apply(_this.onClose);\n }\n return resolve();\n });\n });\n if ($el.hasClass(\"remove-on-close\")) {\n scope = $el.data(\"scope\");\n if (scope) {\n scope.$destroy();\n }\n return $el.remove();\n }\n };\n })(this));\n };\n\n LightboxService.prototype.getLightboxOpen = function() {\n return $(\".lightbox.open\");\n };\n\n LightboxService.prototype.closeAll = function() {\n var docEl, i, len, lightboxEl, ref, results;\n docEl = angular.element(document);\n ref = docEl.find(\".lightbox.open\");\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n lightboxEl = ref[i];\n results.push(this.close($(lightboxEl)));\n }\n return results;\n };\n\n return LightboxService;\n\n })(taiga.Service);\n\n module.service(\"lightboxService\", [\"animationFrame\", \"$q\", \"$rootScope\", LightboxService]);\n\n LightboxKeyboardNavigationService = (function(superClass) {\n extend(LightboxKeyboardNavigationService, superClass);\n\n function LightboxKeyboardNavigationService() {\n return LightboxKeyboardNavigationService.__super__.constructor.apply(this, arguments);\n }\n\n LightboxKeyboardNavigationService.prototype.stop = function() {\n var docEl;\n docEl = angular.element(document);\n return docEl.off(\".keyboard-navigation\");\n };\n\n LightboxKeyboardNavigationService.prototype.dispatch = function($el, code) {\n var activeElement, next, prev;\n activeElement = $el.find(\".selected\");\n if (code === 13) {\n if ($el.find(\".user-list-single\").length === 1) {\n return $el.find('.user-list-single:first').trigger(\"click\");\n } else {\n return activeElement.trigger(\"click\");\n }\n } else if (code === 40) {\n if (!activeElement.length) {\n return $el.find('.user-list-single:not(\".is-active\"):first').addClass('selected');\n } else {\n next = activeElement.next('.user-list-single');\n if (next.length) {\n activeElement.removeClass('selected');\n return next.addClass('selected');\n }\n }\n } else if (code === 38) {\n if (!activeElement.length) {\n return $el.find('.user-list-single:last').addClass('selected');\n } else {\n prev = activeElement.prev('.user-list-single:not(\".is-active\")');\n if (prev.length) {\n activeElement.removeClass('selected');\n return prev.addClass('selected');\n }\n }\n }\n };\n\n LightboxKeyboardNavigationService.prototype.init = function($el) {\n var docEl;\n this.stop();\n docEl = angular.element(document);\n return docEl.on(\"keydown.keyboard-navigation\", (function(_this) {\n return function(event) {\n var code;\n code = event.keyCode ? event.keyCode : event.which;\n if (code === 40 || code === 38 || code === 13) {\n event.preventDefault();\n return _this.dispatch($el, code);\n }\n };\n })(this));\n };\n\n return LightboxKeyboardNavigationService;\n\n })(taiga.Service);\n\n module.service(\"lightboxKeyboardNavigationService\", LightboxKeyboardNavigationService);\n\n LightboxDirective = function(lightboxService) {\n var link;\n link = function($scope, $el, $attrs) {\n return $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n };\n return {\n restrict: \"C\",\n link: link\n };\n };\n\n module.directive(\"lightbox\", [\"lightboxService\", LightboxDirective]);\n\n BlockLightboxDirective = function($rootscope, $tgrepo, $confirm, lightboxService, $loading, $modelTransform, $translate) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var block, title, unblock;\n title = $translate.instant($attrs.title);\n $el.find(\"h2.title\").text(title);\n unblock = (function(_this) {\n return function(finishCallback) {\n var transform;\n transform = $modelTransform.save(function(item) {\n item.is_blocked = false;\n item.blocked_note = \"\";\n return item;\n });\n transform.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"object:updated\");\n return finishCallback();\n });\n transform.then(null, function() {\n $confirm.notify(\"error\");\n return item.revert();\n });\n transform[\"finally\"](function() {\n return finishCallback();\n });\n return transform;\n };\n })(this);\n block = function() {\n var currentLoading, transform;\n currentLoading = $loading().target($el.find(\".button-green\")).start();\n transform = $modelTransform.save(function(item) {\n item.is_blocked = true;\n item.blocked_note = $el.find(\".reason\").val();\n return item;\n });\n transform.then(function() {\n $confirm.notify(\"success\");\n return $rootscope.$broadcast(\"object:updated\");\n });\n transform.then(null, function() {\n return $confirm.notify(\"error\");\n });\n return transform[\"finally\"](function() {\n currentLoading.finish();\n return lightboxService.close($el);\n });\n };\n $scope.$on(\"block\", function() {\n $el.find(\".reason\").val($model.$modelValue.blocked_note);\n return lightboxService.open($el);\n });\n $scope.$on(\"unblock\", (function(_this) {\n return function(event, model, finishCallback) {\n return unblock(finishCallback);\n };\n })(this));\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return $el.on(\"click\", \".button-green\", function(event) {\n event.preventDefault();\n return block();\n });\n };\n return {\n templateUrl: \"common/lightbox/lightbox-block.html\",\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgLbBlock\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"lightboxService\", \"$tgLoading\", \"$tgQueueModelTransformation\", \"$translate\", BlockLightboxDirective]);\n\n BlockingMessageInputDirective = function($log, $template, $compile) {\n var link, template, templateFn;\n template = $template.get(\"common/lightbox/lightbox-blocking-message-input.html\", true);\n link = function($scope, $el, $attrs, $model) {\n if (!$attrs.watch) {\n return $log.error(\"No watch attribute on tg-blocking-message-input directive\");\n }\n return $scope.$watch($attrs.watch, function(value) {\n if (value === !void 0 && value === true) {\n return $el.find(\".blocked-note\").removeClass(\"hidden\");\n } else {\n return $el.find(\".blocked-note\").addClass(\"hidden\");\n }\n });\n };\n templateFn = function($el, $attrs) {\n return template({\n ngmodel: $attrs.ngModel\n });\n };\n return {\n template: templateFn,\n link: link,\n require: \"ngModel\",\n restrict: \"EA\"\n };\n };\n\n module.directive(\"tgBlockingMessageInput\", [\"$log\", \"$tgTemplate\", \"$compile\", BlockingMessageInputDirective]);\n\n CreateEditUserstoryDirective = function($repo, $model, $rs, $rootScope, lightboxService, $loading, $translate, $confirm, $q, attachmentsService) {\n var link;\n link = function($scope, $el, attrs) {\n var attachmentsToAdd, attachmentsToDelete, createAttachments, deleteAttachments, form, resetAttachments, submit, submitButton;\n form = null;\n $scope.createEditUs = {};\n $scope.isNew = true;\n attachmentsToAdd = Immutable.List();\n attachmentsToDelete = Immutable.List();\n resetAttachments = function() {\n attachmentsToAdd = Immutable.List();\n return attachmentsToDelete = Immutable.List();\n };\n $scope.addAttachment = function(attachment) {\n return attachmentsToAdd = attachmentsToAdd.push(attachment);\n };\n $scope.deleteAttachment = function(attachment) {\n if (attachment.get(\"id\")) {\n return attachmentsToDelete = attachmentsToDelete.push(attachment);\n }\n };\n $scope.addTag = function(tag, color) {\n var inserted, itemtags, projectTags, tags, value;\n value = trim(tag.toLowerCase());\n tags = $scope.project.tags;\n projectTags = $scope.project.tags_colors;\n if (tags == null) {\n tags = [];\n }\n if (projectTags == null) {\n projectTags = {};\n }\n if (indexOf.call(tags, value) < 0) {\n tags.push(value);\n }\n projectTags[tag] = color || null;\n $scope.project.tags = tags;\n itemtags = _.clone($scope.us.tags);\n inserted = _.find(itemtags, function(it) {\n return it[0] === value;\n });\n if (!inserted) {\n itemtags.push([tag, color]);\n return $scope.us.tags = itemtags;\n }\n };\n $scope.deleteTag = function(tag) {\n var itemtags, tags, value;\n value = trim(tag[0].toLowerCase());\n tags = $scope.project.tags;\n itemtags = _.clone($scope.us.tags);\n _.remove(itemtags, function(tag) {\n return tag[0] === value;\n });\n $scope.us.tags = itemtags;\n return _.pull($scope.us.tags, value);\n };\n $scope.$on(\"usform:new\", function(ctx, projectId, status, statusList) {\n if (form) {\n form.reset();\n }\n $scope.isNew = true;\n $scope.usStatusList = statusList;\n $scope.attachments = Immutable.List();\n resetAttachments();\n $scope.us = $model.make_model(\"userstories\", {\n project: projectId,\n points: {},\n status: status,\n is_archived: false,\n tags: []\n });\n $el.find(\".button-green\").html($translate.instant(\"COMMON.CREATE\"));\n $el.find(\".title\").html($translate.instant(\"LIGHTBOX.CREATE_EDIT_US.NEW_US\"));\n $el.find(\".tag-input\").val(\"\");\n $el.find(\".blocked-note\").addClass(\"hidden\");\n $el.find(\"label.blocked\").removeClass(\"selected\");\n $el.find(\"label.team-requirement\").removeClass(\"selected\");\n $el.find(\"label.client-requirement\").removeClass(\"selected\");\n $scope.createEditUsOpen = true;\n return lightboxService.open($el, function() {\n return $scope.createEditUsOpen = false;\n });\n });\n $scope.$on(\"usform:edit\", function(ctx, us, attachments) {\n if (form) {\n form.reset();\n }\n $scope.us = us;\n $scope.attachments = Immutable.fromJS(attachments);\n $scope.isNew = false;\n resetAttachments();\n $el.find(\".button-green\").html($translate.instant(\"COMMON.SAVE\"));\n $el.find(\".title\").html($translate.instant(\"LIGHTBOX.CREATE_EDIT_US.EDIT_US\"));\n $el.find(\".tag-input\").val(\"\");\n if (us.is_blocked) {\n $el.find(\".blocked-note\").removeClass(\"hidden\");\n $el.find(\"label.blocked\").addClass(\"selected\");\n } else {\n $el.find(\".blocked-note\").addClass(\"hidden\");\n $el.find(\"label.blocked\").removeClass(\"selected\");\n }\n if (us.team_requirement) {\n $el.find(\"label.team-requirement\").addClass(\"selected\");\n } else {\n $el.find(\"label.team-requirement\").removeClass(\"selected\");\n }\n if (us.client_requirement) {\n $el.find(\"label.client-requirement\").addClass(\"selected\");\n } else {\n $el.find(\"label.client-requirement\").removeClass(\"selected\");\n }\n $scope.createEditUsOpen = true;\n return lightboxService.open($el, function() {\n return $scope.createEditUsOpen = false;\n });\n });\n createAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToAdd.toJS(), function(attachment) {\n return attachmentsService.upload(attachment.file, obj.id, $scope.us.project, 'us');\n });\n return $q.all(promises);\n };\n deleteAttachments = function(obj) {\n var promises;\n promises = _.map(attachmentsToDelete.toJS(), function(attachment) {\n return attachmentsService[\"delete\"](\"us\", attachment.id);\n });\n return $q.all(promises);\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, currentLoading, params, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n params = {\n include_attachments: true,\n include_tasks: true\n };\n if ($scope.isNew) {\n promise = $repo.create(\"userstories\", $scope.us);\n broadcastEvent = \"usform:new:success\";\n } else {\n promise = $repo.save($scope.us, true);\n broadcastEvent = \"usform:edit:success\";\n }\n promise.then(function(data) {\n return deleteAttachments(data).then((function(_this) {\n return function() {\n return createAttachments(data);\n };\n })(this)).then((function(_this) {\n return function() {\n currentLoading.finish();\n lightboxService.close($el);\n return $rs.userstories.getByRef(data.project, data.ref, params).then(function(us) {\n return $rootScope.$broadcast(broadcastEvent, us);\n });\n };\n })(this));\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n $scope.$apply(function() {\n return $scope.us.revert();\n });\n return lightboxService.close($el);\n });\n $el.keydown(function(event) {\n var code;\n code = event.keyCode ? event.keyCode : event.which;\n if (code === 27) {\n lightboxService.close($el);\n return $scope.$apply(function() {\n return $scope.us.revert();\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateEditUserstory\", [\"$tgRepo\", \"$tgModel\", \"$tgResources\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", \"$translate\", \"$tgConfirm\", \"$q\", \"tgAttachmentsService\", CreateEditUserstoryDirective]);\n\n CreateBulkUserstoriesDirective = function($repo, $rs, $rootscope, lightboxService, $loading, $model) {\n var link;\n link = function($scope, $el, attrs) {\n var form, submit, submitButton;\n form = null;\n $scope.$on(\"usform:bulk\", function(ctx, projectId, status) {\n if (form) {\n form.reset();\n }\n $scope[\"new\"] = {\n projectId: projectId,\n statusId: status,\n bulk: \"\"\n };\n return lightboxService.open($el);\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var currentLoading, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley({\n onlyOneErrorElement: true\n });\n if (!form.validate()) {\n return;\n }\n currentLoading = $loading().target(submitButton).start();\n promise = $rs.userstories.bulkCreate($scope[\"new\"].projectId, $scope[\"new\"].statusId, $scope[\"new\"].bulk);\n promise.then(function(result) {\n result = _.map(result.data, (function(_this) {\n return function(x) {\n return $model.make_model('userstories', x);\n };\n })(this));\n currentLoading.finish();\n $rootscope.$broadcast(\"usform:bulk:success\", result);\n return lightboxService.close($el);\n });\n return promise.then(null, function(data) {\n currentLoading.finish();\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"error\", data._error_message);\n }\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateBulkUserstories\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", \"$tgModel\", CreateBulkUserstoriesDirective]);\n\n AssignedToLightboxDirective = function(lightboxService, lightboxKeyboardNavigationService, $template, $compile, avatarService) {\n var link;\n link = function($scope, $el, $attrs) {\n var closeLightbox, filterUsers, normalizeString, render, selectedItem, selectedUser, usersTemplate;\n selectedUser = null;\n selectedItem = null;\n usersTemplate = $template.get(\"common/lightbox/lightbox-assigned-to-users.html\", true);\n normalizeString = function(string) {\n var normalizedString;\n normalizedString = string;\n normalizedString = normalizedString.replace(\"Á\", \"A\").replace(\"Ä\", \"A\").replace(\"À\", \"A\");\n normalizedString = normalizedString.replace(\"É\", \"E\").replace(\"Ë\", \"E\").replace(\"È\", \"E\");\n normalizedString = normalizedString.replace(\"Í\", \"I\").replace(\"Ï\", \"I\").replace(\"Ì\", \"I\");\n normalizedString = normalizedString.replace(\"Ó\", \"O\").replace(\"Ö\", \"O\").replace(\"Ò\", \"O\");\n normalizedString = normalizedString.replace(\"Ú\", \"U\").replace(\"Ü\", \"U\").replace(\"Ù\", \"U\");\n return normalizedString;\n };\n filterUsers = function(text, user) {\n var username;\n username = user.full_name_display.toUpperCase();\n username = normalizeString(username);\n text = text.toUpperCase();\n text = normalizeString(text);\n return _.includes(username, text);\n };\n render = function(selected, text) {\n var ctx, html, users, visibleUsers;\n users = _.clone($scope.activeUsers, true);\n if (selected != null) {\n users = _.reject(users, {\n \"id\": selected.id\n });\n }\n users = _.sortBy(users, function(o) {\n if (o.id === $scope.user.id) {\n return 0;\n } else {\n return o.id;\n }\n });\n if (text != null) {\n users = _.filter(users, _.partial(filterUsers, text));\n }\n visibleUsers = _.slice(users, 0, 5);\n visibleUsers = _.map(visibleUsers, function(user) {\n return user.avatar = avatarService.getAvatar(user);\n });\n if (selected) {\n if (selected) {\n selected.avatar = avatarService.getAvatar(selected);\n }\n }\n ctx = {\n selected: selected,\n users: _.slice(users, 0, 5),\n showMore: visibleUsers\n };\n html = usersTemplate(ctx);\n html = $compile(html)($scope);\n return $el.find(\".assigned-to-list\").html(html);\n };\n closeLightbox = function() {\n lightboxKeyboardNavigationService.stop();\n return lightboxService.close($el);\n };\n $scope.$on(\"assigned-to:add\", function(ctx, item) {\n var assignedToId;\n selectedItem = item;\n assignedToId = item.assigned_to;\n selectedUser = $scope.usersById[assignedToId];\n render(selectedUser);\n return lightboxService.open($el).then(function() {\n $el.find('input').focus();\n return lightboxKeyboardNavigationService.init($el);\n });\n });\n $scope.$watch(\"usersSearch\", function(searchingText) {\n if (searchingText != null) {\n render(selectedUser, searchingText);\n return $el.find('input').focus();\n }\n });\n $el.on(\"click\", \".user-list-single\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n closeLightbox();\n return $scope.$apply(function() {\n $scope.$broadcast(\"assigned-to:added\", target.data(\"user-id\"), selectedItem);\n return $scope.usersSearch = null;\n });\n });\n $el.on(\"click\", \".remove-assigned-to\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n closeLightbox();\n return $scope.$apply(function() {\n $scope.usersSearch = null;\n return $scope.$broadcast(\"assigned-to:added\", null, selectedItem);\n });\n });\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n closeLightbox();\n return $scope.$apply(function() {\n return $scope.usersSearch = null;\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n templateUrl: \"common/lightbox/lightbox-assigned-to.html\",\n link: link\n };\n };\n\n module.directive(\"tgLbAssignedto\", [\"lightboxService\", \"lightboxKeyboardNavigationService\", \"$tgTemplate\", \"$compile\", \"tgAvatarService\", AssignedToLightboxDirective]);\n\n WatchersLightboxDirective = function($repo, lightboxService, lightboxKeyboardNavigationService, $template, $compile, avatarService) {\n var link;\n link = function($scope, $el, $attrs) {\n var closeLightbox, getFilteredUsers, render, selectedItem, usersTemplate;\n selectedItem = null;\n usersTemplate = $template.get(\"common/lightbox/lightbox-assigned-to-users.html\", true);\n getFilteredUsers = function(text) {\n var _filterUsers, users;\n if (text == null) {\n text = \"\";\n }\n _filterUsers = function(text, user) {\n var username;\n if (selectedItem && _.find(selectedItem.watchers, function(x) {\n return x === user.id;\n })) {\n return false;\n }\n username = user.full_name_display.toUpperCase();\n text = text.toUpperCase();\n return _.includes(username, text);\n };\n users = _.clone($scope.activeUsers, true);\n users = _.filter(users, _.partial(_filterUsers, text));\n return users;\n };\n render = function(users) {\n var ctx, html, visibleUsers;\n visibleUsers = _.slice(users, 0, 5);\n visibleUsers = _.map(visibleUsers, function(user) {\n user.avatar = avatarService.getAvatar(user);\n return user;\n });\n ctx = {\n selected: false,\n users: visibleUsers,\n showMore: users.length > 5\n };\n html = usersTemplate(ctx);\n html = $compile(html)($scope);\n return $el.find(\".ticket-watchers\").html(html);\n };\n closeLightbox = function() {\n lightboxKeyboardNavigationService.stop();\n return lightboxService.close($el);\n };\n $scope.$on(\"watcher:add\", function(ctx, item) {\n var users;\n selectedItem = item;\n users = getFilteredUsers();\n render(users);\n return lightboxService.open($el).then(function() {\n $el.find(\"input\").focus();\n return lightboxKeyboardNavigationService.init($el);\n });\n });\n $scope.$watch(\"usersSearch\", function(searchingText) {\n var users;\n if (searchingText == null) {\n return;\n }\n users = getFilteredUsers(searchingText);\n render(users);\n return $el.find(\"input\").focus();\n });\n $el.on(\"click\", \".user-list-single\", debounce(200, function(event) {\n var target;\n closeLightbox();\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return $scope.$apply(function() {\n $scope.usersSearch = null;\n return $scope.$broadcast(\"watcher:added\", target.data(\"user-id\"));\n });\n }));\n $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n closeLightbox();\n return $scope.$apply(function() {\n return $scope.usersSearch = null;\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n templateUrl: \"common/lightbox/lightbox-users.html\",\n link: link\n };\n };\n\n module.directive(\"tgLbWatchers\", [\"$tgRepo\", \"lightboxService\", \"lightboxKeyboardNavigationService\", \"$tgTemplate\", \"$compile\", \"tgAvatarService\", WatchersLightboxDirective]);\n\n LightboxLeaveProjectWarningDirective = function(lightboxService, $template, $compile) {\n var link;\n link = function($scope, $el, attrs) {\n return lightboxService.open($el);\n };\n return {\n templateUrl: 'common/lightbox/lightbox-leave-project-warning.html',\n link: link,\n scope: true\n };\n };\n\n module.directive(\"tgLightboxLeaveProjectWarning\", [\"lightboxService\", LightboxLeaveProjectWarningDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Juan Francisco Alcántara \n * Copyright (C) 2014-2016 Alejandro Alonso \n * Copyright (C) 2014-2016 Xavi Julian \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n * File: modules/common/loader.coffee\n */\n\n(function() {\n var Loader, LoaderDirective, module, sizeFormat, taiga, timeout;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaCommon\");\n\n LoaderDirective = function(tgLoader, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n tgLoader.onStart(function() {\n $(document.body).addClass(\"loader-active\");\n return $el.addClass(\"active\");\n });\n return tgLoader.onEnd(function() {\n $(document.body).removeClass(\"loader-active\");\n return $el.removeClass(\"active\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLoader\", [\"tgLoader\", \"$rootScope\", LoaderDirective]);\n\n Loader = function($rootscope) {\n var autoClose, config, lastResponseDate, open, pageLoaded, requestCount, start, startLoadTime;\n config = {\n minTime: 300\n };\n open = false;\n startLoadTime = 0;\n requestCount = 0;\n lastResponseDate = 0;\n pageLoaded = function(force) {\n var diff, endTime, timeoutValue;\n if (force == null) {\n force = false;\n }\n if (startLoadTime) {\n timeoutValue = 0;\n if (!force) {\n endTime = new Date().getTime();\n diff = endTime - startLoadTime;\n if (diff < config.minTime) {\n timeoutValue = config.minTime - diff;\n }\n }\n timeout(timeoutValue, function() {\n $rootscope.$broadcast(\"loader:end\");\n open = false;\n return window.prerenderReady = true;\n });\n }\n startLoadTime = 0;\n requestCount = 0;\n return lastResponseDate = 0;\n };\n autoClose = function() {\n var intervalAuto;\n return intervalAuto = setInterval((function() {\n if (lastResponseDate && requestCount === 0) {\n pageLoaded();\n return clearInterval(intervalAuto);\n }\n }), 50);\n };\n start = function() {\n startLoadTime = new Date().getTime();\n $rootscope.$broadcast(\"loader:start\");\n return open = true;\n };\n return {\n pageLoaded: pageLoaded,\n start: function(auto) {\n if (auto == null) {\n auto = false;\n }\n if (!open) {\n start();\n if (auto) {\n return autoClose();\n }\n }\n },\n onStart: function(fn) {\n return $rootscope.$on(\"loader:start\", fn);\n },\n onEnd: function(fn) {\n return $rootscope.$on(\"loader:end\", fn);\n },\n logRequest: function() {\n return requestCount++;\n },\n logResponse: function() {\n requestCount--;\n return lastResponseDate = new Date().getTime();\n }\n };\n };\n\n Loader.$inject = [\"$rootScope\"];\n\n module.factory(\"tgLoader\", Loader);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014-2016 Andrey Antukh \n * Copyright (C) 2014-2016 Jesús Espino Garcia \n * Copyright (C) 2014-2016 David Barragán Merino \n * Copyright (C) 2014-2016 Alejandro Alonso