diff --git a/dist/index.html b/dist/index.html index 75b06cf..01a90d8 100644 --- a/dist/index.html +++ b/dist/index.html @@ -157,8 +157,8 @@

Loading...

- - - + + + \ No newline at end of file diff --git a/dist/js/app-loader.js b/dist/js/app-loader.js index 8fb91c0..f59682f 100644 --- a/dist/js/app-loader.js +++ b/dist/js/app-loader.js @@ -1,7 +1,7 @@ (function() { var promise, version; - version = 1422614193905; + version = 1422619415904; window.taigaConfig = { "api": "http://localhost:8000/api/v1/", diff --git a/dist/js/app.js b/dist/js/app.js index 00a7133..2071c68 100644 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -11,7 +11,7 @@ return template=_.template('
\n _i;_i++)membership=_ref[_i],null==membership.photo&&(membership.photo="/images/unnamed.png");return data}}(this))},TeamController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return _this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.issuesEnabled=project.is_issues_activated,_this.scope.tasksEnabled=project.is_kanban_activated||project.is_backlog_activated,_this.scope.wikiEnabled=project.is_wiki_activated,project}}(this))},TeamController.prototype.loadMemberStats=function(){return this.rs.projects.memberStats(this.scope.projectId).then(function(_this){return function(stats){var totals;return totals={},_.forEach(_this.scope.totals,function(total,userId){var vals;return vals=_.map(stats,function(memberStats){return memberStats[userId]}),total=_.reduce(vals,function(sum,el){return sum+el}),_this.scope.totals[userId]=total}),_this.scope.stats=_this.processStats(stats),_this.scope.stats.totals=_this.scope.totals}}(this))},TeamController.prototype.processStat=function(stat){var max,min,singleStat;return max=_.max(stat),min=_.min(stat),singleStat=_.map(stat,function(value,key){return value===min?[key,.1]:value===max?[key,1]:[key,.5*value/max]}),singleStat=_.object(singleStat)},TeamController.prototype.processStats=function(stats){var key,value;for(key in stats)value=stats[key],stats[key]=this.processStat(value);return stats},TeamController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(project){return _this.fillUsersAndRoles(project.users,project.roles),_this.loadMembers().then(function(){return _this.loadMemberStats()})}}(this))},TeamController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("TeamController",TeamController),TeamFiltersDirective=function(){return{templateUrl:"team/team-filter.html"}},module.directive("tgTeamFilters",[TeamFiltersDirective]),TeamMemberStatsDirective=function(){return{templateUrl:"team/team-member-stats.html",scope:{stats:"=",userId:"=user",issuesEnabled:"=issuesenabled",tasksEnabled:"=tasksenabled",wikiEnabled:"=wikienabled"}}},module.directive("tgTeamMemberStats",TeamMemberStatsDirective),TeamMemberCurrentUserDirective=function(){return{templateUrl:"team/team-member-current-user.html",scope:{projectId:"=projectid",currentUser:"=currentuser",stats:"=",issuesEnabled:"=issuesenabled",tasksEnabled:"=tasksenabled",wikiEnabled:"=wikienabled"}}},module.directive("tgTeamCurrentUser",TeamMemberCurrentUserDirective),TeamMembersDirective=function(){var template;return template="team/team-members.html",{templateUrl:template,scope:{memberships:"=",filtersQ:"=filtersq",filtersRole:"=filtersrole",stats:"=",issuesEnabled:"=issuesenabled",tasksEnabled:"=tasksenabled",wikiEnabled:"=wikienabled"}}},module.directive("tgTeamMembers",TeamMembersDirective),LeaveProjectDirective=function($repo,$confirm,$location,$rs,$navurls){var link;return link=function($scope,$el,$attrs){return $scope.leave=function(){return $confirm.ask("Leave this project","Are you sure you want to leave the project?").then(function(){return function(finish){var promise;return promise=$rs.projects.leave($attrs.projectid),promise.then(function(){return finish(),$confirm.notify("success"),$location.path($navurls.resolve("home"))}),promise.then(null,function(response){return finish(),$confirm.notify("error",response.data._error_message)})}}(this))}},{scope:{},templateUrl:"team/leave-project.html",link:link}},module.directive("tgLeaveProject",["$tgRepo","$tgConfirm","$tgLocation","$tgResources","$tgNavUrls",LeaveProjectDirective]),module.filter("membersRoleFilter",function(){return function(input,filtersRole){return null!=filtersRole?_.filter(input,{role:filtersRole.id}):input}})}.call(this),function(){var EditableWikiContentDirective,WikiDetailController,WikiSummaryDirective,bindOnce,debounce,groupBy,mixOf,module,taiga,unslugify,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,unslugify=this.taiga.unslugify,debounce=this.taiga.debounce,module=angular.module("taigaWiki"),WikiDetailController=function(_super){function WikiDetailController(_at_scope,_at_rootscope,_at_repo,_at_model,_at_confirm,_at_rs,_at_params,_at_q,_at_location,_at_filter,_at_log,_at_appTitle,_at_navUrls,_at_analytics,tgLoader){var promise;this.scope=_at_scope,this.rootscope=_at_rootscope,this.repo=_at_repo,this.model=_at_model,this.confirm=_at_confirm,this.rs=_at_rs,this.params=_at_params,this.q=_at_q,this.location=_at_location,this.filter=_at_filter,this.log=_at_log,this.appTitle=_at_appTitle,this.navUrls=_at_navUrls,this.analytics=_at_analytics,this.scope.projectSlug=this.params.pslug,this.scope.wikiSlug=this.params.slug,this.scope.sectionName="Wiki",promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set("Wiki - "+_this.scope.project.name)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),promise["finally"](tgLoader.pageLoaded)}return __extends(WikiDetailController,_super),WikiDetailController.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$filter","$log","$appTitle","$tgNavUrls","$tgAnalytics","tgLoader"],WikiDetailController.prototype.loadProject=function(){return this.rs.projects.getBySlug(this.params.pslug).then(function(_this){return function(project){return _this.scope.projectId=project.id,_this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.membersById=groupBy(project.memberships,function(x){return x.user}),project}}(this))},WikiDetailController.prototype.loadWiki=function(){var promise;return promise=this.rs.wiki.getBySlug(this.scope.projectId,this.params.slug),promise.then(function(_this){return function(wiki){return _this.scope.wiki=wiki,_this.scope.wikiId=wiki.id,_this.scope.wiki}}(this)),promise.then(null,function(_this){return function(){var data;return _this.scope.wikiId=null,-1===_this.scope.project.my_permissions.indexOf("add_wiki_page")?null:(data={project:_this.scope.projectId,slug:_this.scope.wikiSlug,content:""},_this.scope.wiki=_this.model.make_model("wiki",data),_this.scope.wiki)}}(this))},WikiDetailController.prototype.loadWikiLinks=function(){return this.rs.wiki.listLinks(this.scope.projectId).then(function(_this){return function(wikiLinks){return _this.scope.wikiLinks=wikiLinks}}(this))},WikiDetailController.prototype.loadInitialData=function(){var promise;return promise=this.loadProject(),promise.then(function(_this){return function(project){return _this.fillUsersAndRoles(project.users,project.roles),_this.q.all([_this.loadWikiLinks(),_this.loadWiki()])}}(this))},WikiDetailController.prototype["delete"]=function(){var message,title;return title="Delete Wiki Page",message=unslugify(this.scope.wiki.slug),this.confirm.askOnDelete(title,message).then(function(_this){return function(finish){var onError,onSuccess;return onSuccess=function(){var ctx;return finish(),ctx={project:_this.scope.projectSlug},_this.location.path(_this.navUrls.resolve("project-wiki",ctx)),_this.confirm.notify("success")},onError=function(){return finish(!1),_this.confirm.notify("error")},_this.repo.remove(_this.scope.wiki).then(onSuccess,onError)}}(this))},WikiDetailController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("WikiDetailController",WikiDetailController),WikiSummaryDirective=function($log,$template){var link,template;return template=$template.get("wiki/wiki-summary.html",!0),link=function($scope,$el,$attrs){var render;return render=function(wiki){var ctx,html,user;return null==$scope.usersById?$log.error("WikiSummaryDirective requires userById set in scope."):user=$scope.usersById[wiki.last_modifier],user=void 0===user?{name:"unknown",imgUrl:"/images/unnamed.png"}:{name:user.full_name_display,imgUrl:user.photo},ctx={totalEditions:wiki.editions,lastModifiedDate:moment(wiki.modified_date).format("DD MMM YYYY HH:mm"),user:user},html=template(ctx),$el.html(html)},$scope.$watch($attrs.ngModel,function(wikiPage){return wikiPage?render(wikiPage):void 0}),$scope.$on("wiki:edit",function(event,wikiPage){return render(wikiPage)}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgWikiSummary",["$log","$tgTemplate",WikiSummaryDirective]),EditableWikiContentDirective=function($window,$document,$repo,$confirm,$loading,$analytics,$qqueue){var link;return link=function($scope,$el,$attrs,$model){var cancelEdition,disableEdition,getSelectedText,isEditable,save,switchToEditMode,switchToReadMode;return isEditable=function(){return-1!==$scope.project.my_permissions.indexOf("modify_wiki_page")},switchToEditMode=function(){return $el.find(".edit-wiki-content").show(),$el.find(".view-wiki-content").hide(),$el.find("textarea").focus()},switchToReadMode=function(){return $el.find(".edit-wiki-content").hide(),$el.find(".view-wiki-content").show()},disableEdition=function(){return $el.find(".view-wiki-content .edit").remove(),$el.find(".edit-wiki-content").remove()},cancelEdition=function(){return $model.$modelValue.id?($scope.$apply(function(){return function(){return $model.$modelValue.revert()}}(this)),switchToReadMode()):void 0},getSelectedText=function(){return $window.getSelection?$window.getSelection().toString():$document.selection?$document.selection.createRange().text:null},save=$qqueue.bindAdd(function(wiki){var onError,onSuccess,promise;return onSuccess=function(wikiPage){return null==wiki.id&&$analytics.trackEvent("wikipage","create","create wiki page",1),$model.$modelValue=wikiPage,$scope.$broadcast("wiki:edit",wikiPage),$confirm.notify("success"),switchToReadMode()},onError=function(){return $confirm.notify("error")},$loading.start($el.find(".save-container")),promise=null!=wiki.id?$repo.save(wiki).then(onSuccess,onError):$repo.create("wiki",wiki).then(onSuccess,onError),promise["finally"](function(){return $loading.finish($el.find(".save-container"))})}),$el.on("mousedown",".view-wiki-content",function(event){var target;return target=angular.element(event.target),target.is("pre")?target.data("scroll-pos",target[0].scrollLeft):void 0}),$el.on("mouseup",".view-wiki-content",function(event){var prevPos,target;return target=angular.element(event.target),!isEditable()||target.is("a")||getSelectedText()||target.is("pre")&&(prevPos=target.data("scroll-pos"),target.data("scroll-pos",null),prevPos!==target[0].scrollLeft)?void 0:switchToEditMode()}),$el.on("click",".save",debounce(2e3,function(){return save($scope.wiki)})),$el.on("click",".cancel",function(){return cancelEdition()}),$el.on("keydown","textarea",function(event){return 27===event.keyCode?cancelEdition():void 0}),$scope.$watch($attrs.ngModel,function(wikiPage){return wikiPage?isEditable()?($el.addClass("editable"),null==wikiPage.id?switchToEditMode():void 0):disableEdition():void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,restrict:"EA",require:"ngModel",templateUrl:"wiki/editable-wiki-content.html"}},module.directive("tgEditableWikiContent",["$window","$document","$tgRepo","$tgConfirm","$tgLoading","$tgAnalytics","$tgQqueue",EditableWikiContentDirective])}.call(this),function(){var WikiNavDirective,bindOnce,groupBy,mixOf,module,slugify,taiga,unslugify;taiga=this.taiga,mixOf=this.taiga.mixOf,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,slugify=this.taiga.slugify,unslugify=this.taiga.slugify,module=angular.module("taigaWiki"),WikiNavDirective=function($tgrepo,$log,$location,$confirm,$navUrls,$analytics,$loading,$template){var link,template;return template=$template.get("wiki/wiki-nav.html",!0),link=function($scope,$el,$attrs){var $ctrl,render;return $ctrl=$el.controller(),null==$attrs.ngModel?$log.error("WikiNavDirective: no ng-model attr is defined"):(render=function(wikiLinks){var addWikiLinkPermission,deleteWikiLinkPermission,html;return addWikiLinkPermission=$scope.project.my_permissions.indexOf("add_wiki_link")>-1,deleteWikiLinkPermission=$scope.project.my_permissions.indexOf("delete_wiki_link")>-1,html=template({wikiLinks:wikiLinks,projectSlug:$scope.projectSlug,addWikiLinkPermission:addWikiLinkPermission,deleteWikiLinkPermission:deleteWikiLinkPermission}),$el.off(),$el.html(html),$el.on("click",".wiki-link .link-title",function(event){var linkId,linkSlug,target;return event.preventDefault(),target=angular.element(event.currentTarget),linkId=target.parents(".wiki-link").data("id"),linkSlug=$scope.wikiLinks[linkId].href,$scope.$apply(function(){var ctx;return ctx={project:$scope.projectSlug,slug:linkSlug},$location.path($navUrls.resolve("project-wiki-page",ctx))})}),$el.on("click",".add-button",function(event){return event.preventDefault(),$el.find(".new").removeClass("hidden"),$el.find(".new input").focus(),$el.find(".add-button").hide()}),$el.on("click",".wiki-link .icon-delete",function(event){var linkId,message,target,title;return event.preventDefault(),event.stopPropagation(),target=angular.element(event.currentTarget),linkId=target.parents(".wiki-link").data("id"),title="Delete Wiki Link",message=$scope.wikiLinks[linkId].title,$confirm.askOnDelete(title,message).then(function(){return function(finish){var promise;return promise=$tgrepo.remove($scope.wikiLinks[linkId]),promise.then(function(){return promise=$ctrl.loadWikiLinks(),promise.then(function(){return finish(),render($scope.wikiLinks)}),promise.then(null,function(){return finish()})}),promise.then(null,function(){return finish(!1),$confirm.notify("error")})}}(this))}),$el.on("keyup",".new input",function(event){var newLink,promise,target;return event.preventDefault(),13===event.keyCode?(target=angular.element(event.currentTarget),newLink=target.val(),$loading.start($el.find(".new")),promise=$tgrepo.create("wiki-links",{project:$scope.projectId,title:newLink,href:slugify(newLink)}),promise.then(function(){var loadPromise;return $analytics.trackEvent("wikilink","create","create wiki link",1),loadPromise=$ctrl.loadWikiLinks(),loadPromise.then(function(){return $loading.finish($el.find(".new")),$el.find(".new").addClass("hidden"),$el.find(".new input").val(""),$el.find(".add-button").show(),render($scope.wikiLinks)}),loadPromise.then(null,function(){return $loading.finish($el.find(".new")),$el.find(".new").addClass("hidden"),$el.find(".new input").val(""),$el.find(".add-button").show(),$confirm.notify("error","Error loading wiki links")})}),promise.then(null,function(error){var _ref;return $loading.finish($el.find(".new")),$el.find(".new input").val(newLink),$el.find(".new input").focus().select(),null!=(null!=error&&null!=(_ref=error.__all__)?_ref[0]:void 0)?$confirm.notify("error","The link already exists"):$confirm.notify("error")})):27===event.keyCode?(target=angular.element(event.currentTarget),$el.find(".new").addClass("hidden"),$el.find(".new input").val(""),$el.find(".add-button").show()):void 0})},bindOnce($scope,$attrs.ngModel,render))},{link:link}},module.directive("tgWikiNav",["$tgRepo","$log","$tgLocation","$tgConfirm","$tgNavUrls","$tgAnalytics","$tgLoading","$tgTemplate",WikiNavDirective])}.call(this),function(){var CreateMembersDirective,MAX_MEMBERSHIP_FIELDSETS,debounce,module,taiga;taiga=this.taiga,debounce=this.taiga.debounce,module=angular.module("taigaKanban"),MAX_MEMBERSHIP_FIELDSETS=4,CreateMembersDirective=function($rs,$rootScope,$confirm,$loading,lightboxService){var extraTextTemplate,link,template;return extraTextTemplate='
\n \n
',template=_.template('
\n
\n data-required="true" <% } %> data-type="email" />\n
\n
\n \n \n
\n
'),link=function($scope,$el){var createFieldSet,resetForm,submit,submitButton;return createFieldSet=function(required){var ctx;return null==required&&(required=!0),ctx={roleList:$scope.roles,required:required},template(ctx)},resetForm=function(){var fieldSet,invitations;return $el.find("form textarea").remove(""),$el.find("form .add-member-wrapper").remove(),invitations=$el.find(".add-member-forms"),invitations.html(extraTextTemplate),fieldSet=createFieldSet(),invitations.prepend(fieldSet)},$scope.$on("membersform:new",function(){return resetForm(),lightboxService.open($el)}),$scope.$on("$destroy",function(){return $el.off()}),$el.on("click",".delete-fieldset",function(event){var fieldSet,lastActionButton,target;return event.preventDefault(),target=angular.element(event.currentTarget),fieldSet=target.closest(".add-member-wrapper"),fieldSet.remove(),lastActionButton=$el.find("fieldset:last > a"),lastActionButton.hasClass("icon-delete delete-fieldset")?lastActionButton.removeClass("icon-delete delete-fieldset").addClass("icon-plus add-fieldset"):void 0}),$el.on("click",".add-fieldset",function(event){var fieldSet,newFieldSet,target;return event.preventDefault(),target=angular.element(event.currentTarget),fieldSet=target.closest(".add-member-wrapper"),target.removeClass("icon-plus add-fieldset").addClass("icon-delete delete-fieldset"),newFieldSet=createFieldSet(!1),fieldSet.after(newFieldSet),$el.find(".add-member-wrapper").length===MAX_MEMBERSHIP_FIELDSETS?$el.find(".add-member-wrapper fieldset:last > a").removeClass("icon-plus add-fieldset").addClass("icon-delete delete-fieldset"):void 0}),submit=debounce(2e3,function(){return function(event){var form,invitation_extra_text,invitations,memberWrappers,onError,onSuccess;return event.preventDefault(),$loading.start(submitButton),onSuccess=function(){return $loading.finish(submitButton),lightboxService.close($el),$confirm.notify("success"),$rootScope.$broadcast("membersform:new:success")},onError=function(){return $loading.finish(submitButton),lightboxService.close($el),$confirm.notify("error"),$rootScope.$broadcast("membersform:new:error")},form=$el.find("form").checksley(),form.destroy(),form.initialize(),form.validate()?(memberWrappers=$el.find("form .add-member-wrapper"),memberWrappers=_.filter(memberWrappers,function(mw){return angular.element(mw).find("input").hasClass("checksley-ok")}),invitations=_.map(memberWrappers,function(mw){var email,memberWrapper,role;return memberWrapper=angular.element(mw),email=memberWrapper.find("input"),role=memberWrapper.find("select"),{email:email.val(),role_id:role.val()}}),invitations.length?(invitation_extra_text=$el.find("form textarea").val(),$rs.memberships.bulkCreateMemberships($scope.project.id,invitations,invitation_extra_text).then(onSuccess,onError)):void 0):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$el.on("click",".submit-button",submit)},{link:link}},module.directive("tgLbCreateMembers",["$tgResources","$rootScope","$tgConfirm","$tgLoading","lightboxService",CreateMembersDirective])}.call(this),function(){var MembershipsController,MembershipsDirective,MembershipsRowActionsDirective,MembershipsRowAdminCheckboxDirective,MembershipsRowAvatarDirective,MembershipsRowRoleSelectorDirective,bindMethods,mixOf,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,bindMethods=this.taiga.bindMethods,module=angular.module("taigaAdmin"),MembershipsController=function(_super){function MembershipsController(_at_scope,_at_rootscope,_at_repo,_at_confirm,_at_rs,_at_params,_at_q,_at_location,_at_navUrls,_at_analytics,_at_appTitle){var promise;this.scope=_at_scope,this.rootscope=_at_rootscope,this.repo=_at_repo,this.confirm=_at_confirm,this.rs=_at_rs,this.params=_at_params,this.q=_at_q,this.location=_at_location,this.navUrls=_at_navUrls,this.analytics=_at_analytics,this.appTitle=_at_appTitle,bindMethods(this),this.scope.sectionName="Manage Members",this.scope.project={},this.scope.filters={},promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set("Membership - "+_this.scope.project.name)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("membersform:new:success",function(_this){return function(){return _this.loadMembers(),_this.analytics.trackEvent("membership","create","create memberships on admin",1)}}(this))}return __extends(MembershipsController,_super),MembershipsController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAnalytics","$appTitle"],MembershipsController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},MembershipsController.prototype.loadMembers=function(){var httpFilters;return httpFilters=this.getUrlFilters(),this.rs.memberships.list(this.scope.projectId,httpFilters).then(function(_this){return function(data){return _this.scope.memberships=_.filter(data.models,function(membership){return null===membership.user||membership.is_user_active}),_this.scope.page=data.current,_this.scope.count=data.count,_this.scope.paginatedBy=data.paginatedBy,data}}(this))},MembershipsController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this)).then(function(_this){return function(){return _this.loadUsersAndRoles()}}(this)).then(function(_this){return function(){return _this.loadMembers()}}(this))},MembershipsController.prototype.getUrlFilters=function(){var filters;return filters=_.pick(this.location.search(),"page"),filters.page||(filters.page=1),filters},MembershipsController.prototype.addNewMembers=function(){return this.rootscope.$broadcast("membersform:new")},MembershipsController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("MembershipsController",MembershipsController),MembershipsDirective=function($template){var link,linkPagination,template;return template=$template.get("admin/admin-membership-paginator.html",!0),linkPagination=function($scope,$el,$attrs,$ctrl){var $pagEl,afterCurrent,atBegin,atEnd,beforeCurrent,getNumPages,renderPagination;return afterCurrent=2,beforeCurrent=4,atBegin=2,atEnd=2,$pagEl=$el.find(".memberships-paginator"),getNumPages=function(){var numPages;return numPages=$scope.count/$scope.paginatedBy,numPages=parseInt(numPages,10)=numPages)return void $pagEl.hide();for(pages=[],options={},options.pages=pages,options.showPrevious=$scope.page>1,options.showNext=!($scope.page===numPages),cpage=$scope.page,i=_i=1;numPages>=1?numPages>=_i:_i>=numPages;i=numPages>=1?++_i:--_i)i===cpage+afterCurrent&&numPages>cpage+afterCurrent+atEnd?pages.push({classes:"dots",type:"dots"}):i===cpage-beforeCurrent&&cpage>atBegin+beforeCurrent?pages.push({classes:"dots",type:"dots"}):i>cpage+afterCurrent&&numPages-atEnd>=i||cpage-beforeCurrent>i&&i>atBegin||pages.push(i===cpage?{classes:"active",num:i,type:"page-active"}:{classes:"page",num:i,type:"page"});return $pagEl.html(template(options))},$scope.$watch("memberships",function(value){return value?renderPagination():void 0}),$el.on("click",".memberships-paginator a.next",function(event){return event.preventDefault(),$scope.$apply(function(){return $ctrl.selectFilter("page",$scope.page+1),$ctrl.loadMembers()})}),$el.on("click",".memberships-paginator a.previous",function(event){return event.preventDefault(),$scope.$apply(function(){return $ctrl.selectFilter("page",$scope.page-1),$ctrl.loadMembers()})}),$el.on("click",".memberships-paginator li.page > a",function(event){var pagenum,target;return event.preventDefault(),target=angular.element(event.currentTarget),pagenum=target.data("pagenum"),$scope.$apply(function(){return $ctrl.selectFilter("page",pagenum),$ctrl.loadMembers()})})},link=function($scope,$el,$attrs){var $ctrl;return $ctrl=$el.controller(),linkPagination($scope,$el,$attrs,$ctrl),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgMemberships",["$tgTemplate",MembershipsDirective]),MembershipsRowAvatarDirective=function($log,$template){var link,template;return template=$template.get("admin/memberships-row-avatar.html",!0),link=function($scope,$el,$attrs){var member,render;return render=function(member){var ctx,html;return ctx={full_name:member.full_name?member.full_name:"",email:member.user_email?member.user_email:member.email,imgurl:member.photo?member.photo:"/images/unnamed.png"},html=template(ctx),$el.html(html)},null==$attrs.tgMembershipsRowAvatar?$log.error("MembershipsRowAvatarDirective: the directive need a member"):(member=$scope.$eval($attrs.tgMembershipsRowAvatar),render(member),$scope.$on("$destroy",function(){return $el.off()}))},{link:link}},module.directive("tgMembershipsRowAvatar",["$log","$tgTemplate",MembershipsRowAvatarDirective]),MembershipsRowAdminCheckboxDirective=function($log,$repo,$confirm,$template){var link,template;return template=$template.get("admin/admin-memberships-row-checkbox.html",!0),link=function($scope,$el,$attrs){var html,member,render;return render=function(member){var ctx,html;return ctx={inputId:"is-admin-"+member.id},html=template(ctx),$el.html(html)},null==$attrs.tgMembershipsRowAdminCheckbox?$log.error("MembershipsRowAdminCheckboxDirective: the directive need a member"):(member=$scope.$eval($attrs.tgMembershipsRowAdminCheckbox),html=render(member),member.is_owner&&$el.find(":checkbox").prop("checked",!0),$el.on("click",":checkbox",function(){return function(event){var onError,onSuccess,target;return onSuccess=function(){return $confirm.notify("success")},onError=function(data){return member.revert(),$el.find(":checkbox").prop("checked",member.is_owner),$confirm.notify("error",data.is_owner[0])},target=angular.element(event.currentTarget),member.is_owner=target.prop("checked"),$repo.save(member).then(onSuccess,onError)}}(this)),$scope.$on("$destroy",function(){return $el.off()}))},{link:link}},module.directive("tgMembershipsRowAdminCheckbox",["$log","$tgRepo","$tgConfirm","$tgTemplate",MembershipsRowAdminCheckboxDirective]),MembershipsRowRoleSelectorDirective=function($log,$repo,$confirm){var link,template;return template=_.template(''),link=function($scope,$el,$attrs){var $ctrl,html,member,render;return render=function(member){var ctx,html;return ctx={roleList:$scope.roles,selectedRole:member.role},html=template(ctx),$el.html(html)},null==$attrs.tgMembershipsRowRoleSelector?$log.error("MembershipsRowRoleSelectorDirective: the directive need a member"):($ctrl=$el.controller(),member=$scope.$eval($attrs.tgMembershipsRowRoleSelector),html=render(member),$el.on("click","select",function(){return function(event){var newRole,onError,onSuccess,target;return onSuccess=function(){return $confirm.notify("success")},onError=function(){return $confirm.notify("error")},target=angular.element(event.currentTarget),newRole=parseInt(target.val(),10),member.role!==newRole?(member.role=newRole,$repo.save(member).then(onSuccess,onError)):void 0}}(this)),$scope.$on("$destroy",function(){return $el.off()}))},{link:link}},module.directive("tgMembershipsRowRoleSelector",["$log","$tgRepo","$tgConfirm",MembershipsRowRoleSelectorDirective]),MembershipsRowActionsDirective=function($log,$repo,$rs,$confirm){var activedTemplate,link,pendingTemplate; return activedTemplate=_.template('
\n Active\n
\n\n \n'),pendingTemplate=_.template('\n Pending\n \n\n\n \n'),link=function($scope,$el,$attrs){var $ctrl,member,render;return render=function(member){var html;return html=member.user?activedTemplate():pendingTemplate(),$el.html(html)},null==$attrs.tgMembershipsRowActions?$log.error("MembershipsRowActionsDirective: the directive need a member"):($ctrl=$el.controller(),member=$scope.$eval($attrs.tgMembershipsRowActions),render(member),$el.on("click",".pending",function(event){var onError,onSuccess;return event.preventDefault(),onSuccess=function(){return $confirm.notify("success","We've sent the invitationi again to '"+$scope.member.email+"'.")},onError=function(){return $confirm.notify("error","We haven't sent the invitation.")},$rs.memberships.resendInvitation($scope.member.id).then(onSuccess,onError)}),$el.on("click",".delete",function(event){var message,title;return event.preventDefault(),title="Delete member",message=member.user?member.full_name:"the invitation to "+member.email,$confirm.askOnDelete(title,message).then(function(finish){var onError,onSuccess;return onSuccess=function(){return finish(),$ctrl.loadMembers(),$confirm.notify("success",null,"We've deleted "+message+".")},onError=function(){return finish(!1),$confirm.notify("error",null,"We have not been able to delete "+message+".")},$repo.remove(member).then(onSuccess,onError)})}),$scope.$on("$destroy",function(){return $el.off()}))},{link:link}},module.directive("tgMembershipsRowActions",["$log","$tgRepo","$tgResources","$tgConfirm",MembershipsRowActionsDirective])}.call(this),function(){var AdminNavigationDirective,module;AdminNavigationDirective=function(){var link;return link=function($scope,$el,$attrs){var section;return section=$attrs.tgAdminNavigation,$el.find(".active").removeClass("active"),$el.find("#adminmenu-"+section+" a").addClass("active"),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module=angular.module("taigaAdmin"),module.directive("tgAdminNavigation",AdminNavigationDirective)}.call(this),function(){var ProjectDefaultValuesDirective,ProjectExportDirective,ProjectModulesDirective,ProjectProfileController,ProjectProfileDirective,bindOnce,debounce,groupBy,joinStr,mixOf,module,taiga,toString,trim,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,trim=this.taiga.trim,toString=this.taiga.toString,joinStr=this.taiga.joinStr,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,debounce=this.taiga.debounce,module=angular.module("taigaAdmin"),ProjectProfileController=function(_super){function ProjectProfileController(_at_scope,_at_rootscope,_at_repo,_at_confirm,_at_rs,_at_params,_at_q,_at_location,_at_navUrls,_at_appTitle){var promise;this.scope=_at_scope,this.rootscope=_at_rootscope,this.repo=_at_repo,this.confirm=_at_confirm,this.rs=_at_rs,this.params=_at_params,this.q=_at_q,this.location=_at_location,this.navUrls=_at_navUrls,this.appTitle=_at_appTitle,this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set("Project profile - "+_this.scope.sectionName+" - "+_this.scope.project.name)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:loaded",function(_this){return function(){return _this.appTitle.set("Project profile - "+_this.scope.sectionName+" - "+_this.scope.project.name)}}(this))}return __extends(ProjectProfileController,_super),ProjectProfileController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$appTitle"],ProjectProfileController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.pointsList=_.sortBy(project.points,"order"),_this.scope.usStatusList=_.sortBy(project.us_statuses,"order"),_this.scope.taskStatusList=_.sortBy(project.task_statuses,"order"),_this.scope.prioritiesList=_.sortBy(project.priorities,"order"),_this.scope.severitiesList=_.sortBy(project.severities,"order"),_this.scope.issueTypesList=_.sortBy(project.issue_types,"order"),_this.scope.issueStatusList=_.sortBy(project.issue_statuses,"order"),_this.scope.$emit("project:loaded",project),project}}(this))},ProjectProfileController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this))},ProjectProfileController.prototype.openDeleteLightbox=function(){return this.rootscope.$broadcast("deletelightbox:new",this.scope.project)},ProjectProfileController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("ProjectProfileController",ProjectProfileController),ProjectProfileDirective=function($repo,$confirm,$loading,$navurls,$location){var link;return link=function($scope,$el){var form,submit,submitButton;return form=$el.find("form").checksley({onlyOneErrorElement:!0}),submit=debounce(2e3,function(){return function(event){var promise;return event.preventDefault(),form.validate()?($loading.start(submitButton),promise=$repo.save($scope.project),promise.then(function(){var newUrl;return $loading.finish(submitButton),$confirm.notify("success"),newUrl=$navurls.resolve("project-admin-project-profile-details",{project:$scope.project.slug}),$location.path(newUrl),$scope.$emit("project:loaded",$scope.project)}),promise.then(null,function(data){return $loading.finish(target),form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$el.on("click",".submit-button",submit)},{link:link}},module.directive("tgProjectProfile",["$tgRepo","$tgConfirm","$tgLoading","$tgNavUrls","$tgLocation",ProjectProfileDirective]),ProjectDefaultValuesDirective=function($repo,$confirm,$loading){var link;return link=function($scope,$el){var form,submit,submitButton;return form=$el.find("form").checksley({onlyOneErrorElement:!0}),submit=debounce(2e3,function(){return function(event){var promise;return event.preventDefault(),form.validate()?($loading.start(submitButton),promise=$repo.save($scope.project),promise.then(function(){return $loading.finish(submitButton),$confirm.notify("success")}),promise.then(null,function(data){return $loading.finish(target),form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$el.on("click",".submit-button",submit),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgProjectDefaultValues",["$tgRepo","$tgConfirm","$tgLoading",ProjectDefaultValuesDirective]),ProjectModulesDirective=function($repo,$confirm,$loading){var link;return link=function($scope,$el){var form,submit;return form=$el.find("form").checksley(),submit=function(){return function(){var promise,target;if(form.validate())return target=angular.element(".admin-functionalities a.button-green"),$loading.start(target),promise=$repo.save($scope.project),promise.then(function(){return $loading.finish(target),$confirm.notify("success"),$scope.$emit("project:loaded",$scope.project)}),promise.then(null,function(data){return $loading.finish(target),$confirm.notify("error",data._error_message)})}}(this),$el.on("submit","form",function(event){return event.preventDefault(),submit()}),$el.on("click",".admin-functionalities a.button-green",function(event){return event.preventDefault(),submit()}),$scope.$watch("isVideoconferenceActivated",function(isVideoconferenceActivated){return isVideoconferenceActivated?$el.find(".videoconference-attributes").removeClass("hidden"):($el.find(".videoconference-attributes").addClass("hidden"),$scope.project.videoconferences=null,$scope.project.videoconferences_salt="")}),$scope.$watch("project",function(project){return $scope.isVideoconferenceActivated=null!=project.videoconferences?!0:!1})},{link:link}},module.directive("tgProjectModules",["$tgRepo","$tgConfirm","$tgLoading",ProjectModulesDirective]),ProjectExportDirective=function($window,$rs,$confirm){var link;return link=function($scope,$el){var buttonsEl,hideButtons,hideResult,hideSpinner,resultEl,resultMessageEl,resultTitleEl,setAsyncMessage,setAsyncTitle,setLoadingMessage,setLoadingTitle,setSyncMessage,setSyncTitle,showButtons,showErrorMode,showExportResultAsyncMode,showExportResultSyncMode,showLoadingMode,showResult,showSpinner,spinnerEl;return buttonsEl=$el.find(".admin-project-export-buttons"),showButtons=function(){return buttonsEl.removeClass("hidden")},hideButtons=function(){return buttonsEl.addClass("hidden")},resultEl=$el.find(".admin-project-export-result"),showResult=function(){return resultEl.removeClass("hidden")},hideResult=function(){return resultEl.addClass("hidden")},spinnerEl=$el.find(".spin"),showSpinner=function(){return spinnerEl.removeClass("hidden")},hideSpinner=function(){return spinnerEl.addClass("hidden")},resultTitleEl=$el.find(".result-title"),setLoadingTitle=function(){return resultTitleEl.html("We are generating your dump file")},setAsyncTitle=function(){return resultTitleEl.html("We are generating your dump file")},setSyncTitle=function(){return resultTitleEl.html("Your dump file ir ready!")},resultMessageEl=$el.find(".result-message "),setLoadingMessage=function(){return resultMessageEl.html("Please don't close this page.")},setAsyncMessage=function(){return resultMessageEl.html("We will send you an email when ready.")},setSyncMessage=function(url){return resultMessageEl.html("If the download doesn't start automatically click here.")},showLoadingMode=function(){return showSpinner(),setLoadingTitle(),setLoadingMessage(),hideButtons(),showResult()},showExportResultAsyncMode=function(){return hideSpinner(),setAsyncTitle(),setAsyncMessage()},showExportResultSyncMode=function(url){return hideSpinner(),setSyncTitle(),setSyncMessage(url)},showErrorMode=function(){return hideSpinner(),hideResult(),showButtons()},$el.on("click","a.button-export",debounce(2e3,function(){return function(event){var onError,onSuccess;return event.preventDefault(),onSuccess=function(result){var dumpUrl;return 202===result.status?showExportResultAsyncMode():(dumpUrl=result.data.url,showExportResultSyncMode(dumpUrl),$window.open(dumpUrl,"_blank"))},onError=function(result){var errorMsg,_ref;return showErrorMode(),errorMsg="Our oompa loompas have some problems generasting your dump. Please try again. ",429===result.status?errorMsg="Sorry, our oompa loompas are very busy right now. Please try again in a few minutes. ":(null!=(_ref=result.data)?_ref._error_message:void 0)&&(errorMsg="Our oompa loompas have some problems generasting your dump: "+result.data._error_message),$confirm.notify("error",errorMsg)},showLoadingMode(),$rs.projects["export"]($scope.projectId).then(onSuccess,onError)}}(this)))},{link:link}},module.directive("tgProjectExport",["$window","$tgResources","$tgConfirm",ProjectExportDirective])}.call(this),function(){var ColorSelectionDirective,ProjectValuesController,ProjectValuesDirective,bindOnce,debounce,groupBy,joinStr,mixOf,module,taiga,toString,trim,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,trim=this.taiga.trim,toString=this.taiga.toString,joinStr=this.taiga.joinStr,groupBy=this.taiga.groupBy,bindOnce=this.taiga.bindOnce,debounce=this.taiga.debounce,module=angular.module("taigaAdmin"),ProjectValuesController=function(_super){function ProjectValuesController(_at_scope,_at_rootscope,_at_repo,_at_confirm,_at_rs,_at_params,_at_q,_at_location,_at_navUrls,_at_appTitle){var promise;this.scope=_at_scope,this.rootscope=_at_rootscope,this.repo=_at_repo,this.confirm=_at_confirm,this.rs=_at_rs,this.params=_at_params,this.q=_at_q,this.location=_at_location,this.navUrls=_at_navUrls,this.appTitle=_at_appTitle,this.moveValue=__bind(this.moveValue,this),this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set("Project values - "+_this.scope.sectionName+" - "+_this.scope.project.name)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("admin:project-values:move",this.moveValue)}return __extends(ProjectValuesController,_super),ProjectValuesController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$appTitle"],ProjectValuesController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},ProjectValuesController.prototype.loadValues=function(){return this.rs[this.scope.resource].listValues(this.scope.projectId,this.scope.type).then(function(_this){return function(values){return _this.scope.values=values,_this.scope.maxValueOrder=_.max(values,"order").order,values}}(this))},ProjectValuesController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.q.all([_this.loadProject(),_this.loadValues()])}}(this))},ProjectValuesController.prototype.moveValue=function(ctx,itemValue,itemIndex){var r,values;return values=this.scope.values,r=values.indexOf(itemValue),values.splice(r,1),values.splice(itemIndex,0,itemValue),_.each(values,function(value,index){return value.order=index}),this.repo.saveAll(values)},ProjectValuesController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("ProjectValuesController",ProjectValuesController),ProjectValuesDirective=function($log,$repo,$confirm,$location,animationFrame){var link,linkDragAndDrop,linkValue;return linkDragAndDrop=function($scope,$el){var itemEl,newParentScope,oldParentScope,tdom;return oldParentScope=null,newParentScope=null,itemEl=null,tdom=$el.find(".sortable"),tdom.sortable({handle:".row.table-main.visualization",dropOnEmpty:!0,connectWith:".project-values-body",revert:400,axis:"y"}),tdom.on("sortstop",function(event,ui){var itemIndex,itemValue;return itemEl=ui.item,itemValue=itemEl.scope().value,itemIndex=itemEl.index(),$scope.$broadcast("admin:project-values:move",itemValue,itemIndex)}),$scope.$on("$destroy",function(){return $el.off()})},linkValue=function($scope,$el,$attrs){var $ctrl,cancel,goToBottomList,initializeNewValue,saveValue,submit,valueType;return $ctrl=$el.controller(),valueType=$attrs.type,initializeNewValue=function(){return $scope.newValue={name:"",is_closed:!1,is_archived:!1}},initializeNewValue(),goToBottomList=function(){return function(focus){var table;return null==focus&&(focus=!1),table=$el.find(".table-main"),$(document.body).scrollTop(table.offset().top+table.height()),focus?$(".new-value input").focus():void 0}}(this),submit=debounce(2e3,function(){return function(){var promise;return promise=$repo.save($scope.project),promise.then(function(){return $confirm.notify("success")}),promise.then(null,function(data){return $confirm.notify("error",data._error_message)})}}(this)),saveValue=debounce(2e3,function(target){var form,promise,value;return form=target.parents("form").checksley(),form.validate()?(value=target.scope().value,promise=$repo.save(value),promise.then(function(){return function(){var row;return row=target.parents(".row.table-main"),row.addClass("hidden"),row.siblings(".visualization").removeClass("hidden")}}(this)),promise.then(null,function(data){return $confirm.notify("error"),form.setErrors(data)})):void 0}),cancel=function(target){var row,value;return row=target.parents(".row.table-main"),value=target.scope().value,$scope.$apply(function(){return row.addClass("hidden"),value.revert(),row.siblings(".visualization").removeClass("hidden")})},$el.on("submit","form",function(event){return event.preventDefault(),submit()}),$el.on("click","form a.button-green",function(event){return event.preventDefault(),submit()}),$el.on("click",".show-add-new",function(event){return event.preventDefault(),$el.find(".new-value").removeClass("hidden"),goToBottomList(!0)}),$el.on("click",".add-new",debounce(2e3,function(event){var form,promise;return event.preventDefault(),form=$el.find(".new-value").parents("form").checksley(),form.validate()?($scope.newValue.project=$scope.project.id,$scope.newValue.order=$scope.maxValueOrder?$scope.maxValueOrder+1:1,promise=$repo.create(valueType,$scope.newValue),promise.then(function(){return function(){return $ctrl.loadValues().then(function(){return animationFrame.add(function(){return goToBottomList()})}),$el.find(".new-value").addClass("hidden"),initializeNewValue()}}(this)),promise.then(null,function(data){return $confirm.notify("error"),form.setErrors(data)})):void 0})),$el.on("click",".delete-new",function(event){return event.preventDefault(),$el.find(".new-value").hide(),initializeNewValue()}),$el.on("click",".edit-value",function(event){var editionRow,row,target;return event.preventDefault(),target=angular.element(event.currentTarget),row=target.parents(".row.table-main"),row.addClass("hidden"),editionRow=row.siblings(".edition"),editionRow.removeClass("hidden"),editionRow.find("input:visible").first().focus().select()}),$el.on("keyup",".edition input",function(event){var target;return 13===event.keyCode?(target=angular.element(event.currentTarget),saveValue(target)):27===event.keyCode?(target=angular.element(event.currentTarget),cancel(target)):void 0}),$el.on("click",".save",function(event){var target;return event.preventDefault(),target=angular.element(event.currentTarget),saveValue(target)}),$el.on("click",".cancel",function(event){var target;return event.preventDefault(),target=angular.element(event.currentTarget),cancel(target)}),$el.on("click",".delete-value",function(event){var choices,replacement,subtitle,target,title,value;return event.preventDefault(),target=angular.element(event.currentTarget),value=target.scope().value,choices={},_.each($scope.values,function(option){return value.id!==option.id?choices[option.id]=option.name:void 0}),title="Delete value",subtitle=value.name,replacement="All items with this value will be changed to",0===_.keys(choices).length?$confirm.error("You can't delete all values."):$confirm.askChoice(title,subtitle,choices,replacement).then(function(response){var onError,onSucces;return onSucces=function(){return $ctrl.loadValues()["finally"](function(){return response.finish()})},onError=function(){return $confirm.notify("error")},$repo.remove(value,{moveTo:response.selected}).then(onSucces,onError)})})},link=function($scope,$el,$attrs){return linkDragAndDrop($scope,$el,$attrs),linkValue($scope,$el,$attrs),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgProjectValues",["$log","$tgRepo","$tgConfirm","$tgLocation","animationFrame",ProjectValuesDirective]),ColorSelectionDirective=function(){var link;return link=function($scope,$el,$attrs,$model){var $ctrl;return $ctrl=$el.controller(),$scope.$watch($attrs.ngModel,function(element){return $scope.color=element.color}),$el.on("click",".current-color",function(event){var body,target;return event.preventDefault(),event.stopPropagation(),target=angular.element(event.currentTarget),$el.find(".select-color").hide(),target.siblings(".select-color").show(),body=angular.element("body"),body.on("click",function(){return function(event){return 0===angular.element(event.target).parent(".select-color").length?($el.find(".select-color").hide(),body.unbind("click")):void 0}}(this))}),$el.on("click",".select-color .color",function(event){var target;return event.preventDefault(),target=angular.element(event.currentTarget),$scope.$apply(function(){return $model.$modelValue.color=target.data("color")}),$el.find(".select-color").hide()}),$el.on("click",".select-color .selected-color",function(event){return event.preventDefault(),$scope.$apply(function(){return $model.$modelValue.color=$scope.color}),$el.find(".select-color").hide()}),$scope.$on("$destroy",function(){return $el.off()})},{link:link,require:"ngModel"}},module.directive("tgColorSelection",ColorSelectionDirective)}.call(this),function(){var EditRoleDirective,NewRoleDirective,RolePermissionsDirective,RolesController,RolesDirective,bindMethods,bindOnce,debounce,mixOf,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty,__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;l>i;i++)if(i in this&&this[i]===item)return i;return-1};taiga=this.taiga,mixOf=this.taiga.mixOf,bindOnce=this.taiga.bindOnce,debounce=this.taiga.debounce,bindMethods=this.taiga.bindMethods,module=angular.module("taigaAdmin"),RolesController=function(_super){function RolesController(_at_scope,_at_rootscope,_at_repo,_at_confirm,_at_rs,_at_params,_at_q,_at_location,_at_navUrls,_at_appTitle){var promise;this.scope=_at_scope,this.rootscope=_at_rootscope,this.repo=_at_repo,this.confirm=_at_confirm,this.rs=_at_rs,this.params=_at_params,this.q=_at_q,this.location=_at_location,this.navUrls=_at_navUrls,this.appTitle=_at_appTitle,bindMethods(this),this.scope.sectionName="Permissions",this.scope.project={},this.scope.anyComputableRole=!0,promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set("Roles - "+_this.scope.project.name)}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return __extends(RolesController,_super),RolesController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$appTitle"],RolesController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.anyComputableRole=_.some(_.map(project.roles,function(point){return point.computable})),project}}(this))},RolesController.prototype.loadRoles=function(){return this.rs.roles.list(this.scope.projectId).then(function(_this){return function(data){return _this.scope.roles=data,_this.scope.role=_this.scope.roles[0],data}}(this))},RolesController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this)).then(function(_this){return function(){return _this.loadUsersAndRoles()}}(this)).then(function(_this){return function(){return _this.loadRoles()}}(this))},RolesController.prototype.setRole=function(role){return this.scope.role=role,this.scope.$broadcast("role:changed",this.scope.role)},RolesController.prototype["delete"]=function(){var choices,replacement,role,subtitle,title,warning,_i,_len,_ref;for(title="Delete Role",subtitle=this.scope.role.name,replacement="All the users with this role will be moved to",warning="Be careful, all role estimations will be removed",choices={},_ref=this.scope.roles,_i=0,_len=_ref.length;_len>_i;_i++)role=_ref[_i],role.id!==this.scope.role.id&&(choices[role.id]=role.name);return 0===_.keys(choices).length?this.confirm.error("You can't delete all values."):this.confirm.askChoice(title,subtitle,choices,replacement,warning).then(function(_this){return function(response){var promise;return promise=_this.repo.remove(_this.scope.role,{moveTo:response.selected}),promise.then(function(){return _this.loadProject(),_this.loadRoles()["finally"](function(){return response.finish()})}),promise.then(null,function(){return _this.confirm.notify("error")})}}(this))},RolesController.prototype.setComputable=debounce(2e3,function(){var onError,onSuccess;return onSuccess=function(_this){return function(){return _this.confirm.notify("success"),_this.loadProject()}}(this),onError=function(_this){return function(){return _this.confirm.notify("error"),_this.scope.role.revert()}}(this),this.repo.save(this.scope.role).then(onSuccess,onError)}),RolesController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("RolesController",RolesController),EditRoleDirective=function($repo,$confirm){var link;return link=function($scope,$el){var submit,toggleView;return toggleView=function(){return $el.find(".total").toggle(),$el.find(".edit-role").toggle()},submit=function(){var promise;return $scope.role.name=$el.find("input").val(),promise=$repo.save($scope.role),promise.then(function(){return $confirm.notify("success")}),promise.then(null,function(){return $confirm.notify("error")}),toggleView()},$el.on("click","a.icon-edit",function(){return toggleView(),$el.find("input").focus(),$el.find("input").val($scope.role.name)}),$el.on("click","a.save",submit),$el.on("keyup","input",function(event){return 13===event.keyCode?submit():27===event.keyCode?toggleView():void 0}),$scope.$on("role:changed",function(){return $el.find(".edit-role").is(":visible")?toggleView():void 0}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgEditRole",["$tgRepo","$tgConfirm",EditRoleDirective]),RolesDirective=function(){var link;return link=function($scope,$el){var $ctrl;return $ctrl=$el.controller(),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgRoles",RolesDirective),NewRoleDirective=function($tgrepo,$confirm){var DEFAULT_PERMISSIONS,link;return DEFAULT_PERMISSIONS=["view_project","view_milestones","view_us","view_tasks","view_issues"],link=function($scope,$el){var $ctrl;return $ctrl=$el.controller(),$scope.$on("$destroy",function(){return $el.off()}),$el.on("click","a.add-button",function(event){return event.preventDefault(),$el.find(".new").removeClass("hidden"),$el.find(".new").focus(),$el.find(".add-button").hide()}),$el.on("keyup",".new",function(event){var newRole,onError,onSuccess,target;return event.preventDefault(),13===event.keyCode?(target=angular.element(event.currentTarget),newRole={project:$scope.projectId,name:target.val(),permissions:DEFAULT_PERMISSIONS,order:_.max($scope.roles,function(r){return r.order}).order+1,computable:!1},$el.find(".new").addClass("hidden"),$el.find(".new").val(""),onSuccess=function(role){return $scope.roles.push(role),$ctrl.setRole(role),$el.find(".add-button").show(),$ctrl.loadProject()},onError=function(){return $confirm.notify("error")},$tgrepo.create("roles",newRole).then(onSuccess,onError)):27===event.keyCode?(target=angular.element(event.currentTarget),$el.find(".new").addClass("hidden"),$el.find(".new").val(""),$el.find(".add-button").show()):void 0})},{link:link}},module.directive("tgNewRole",["$tgRepo","$tgConfirm",NewRoleDirective]),RolePermissionsDirective=function($rootscope,$repo,$confirm){var baseTemplate,categoryTemplate,link,resumeTemplate;return resumeTemplate=_.template('
<%- category.name %>
\n
\n
<%- category.activePermissions %>/<%- category.permissions.length %>
\n <% _.each(category.permissions, function(permission) { %>\n
\n <% }) %>\n
\n
'),categoryTemplate=_.template('
\n
\n
\n
\n
\n <% _.each(category.permissions, function(permission) { %>\n
\n <%- permission.description %>\n
\n checked="checked"<% } %>/>\n
\n Yes\n No\n
\n
\n <% }) %>\n
\n
\n
'),baseTemplate=_.template('
'),link=function($scope,$el,$attrs){var $ctrl,generateCategoriesFromRole,renderCategory,renderPermissions,renderResume;return $ctrl=$el.controller(),generateCategoriesFromRole=function(role){var categories,issuePermissions,milestonePermissions,setActivePermissions,setActivePermissionsPerCategory,taskPermissions,userStoryPermissions,wikiPermissions;return setActivePermissions=function(permissions){return _.map(permissions,function(x){var _ref;return _.extend({},x,{active:(_ref=x.key,__indexOf.call(role.permissions,_ref)>=0)})})},setActivePermissionsPerCategory=function(category){return _.map(category,function(x){return _.extend({},x,{activePermissions:_.filter(x.permissions,"active").length})})},categories=[],milestonePermissions=[{key:"view_milestones",description:"View sprints"},{key:"add_milestone",description:"Add sprint"},{key:"modify_milestone",description:"Modify sprint"},{key:"delete_milestone",description:"Delete sprint"}],categories.push({name:"Sprints",permissions:setActivePermissions(milestonePermissions)}),userStoryPermissions=[{key:"view_us",description:"View user story"},{key:"add_us",description:"Add user story"},{key:"modify_us",description:"Modify user story"},{key:"delete_us",description:"Delete user story"}],categories.push({name:"User Stories",permissions:setActivePermissions(userStoryPermissions)}),taskPermissions=[{key:"view_tasks",description:"View tasks"},{key:"add_task",description:"Add task"},{key:"modify_task",description:"Modify task"},{key:"delete_task",description:"Delete task"}],categories.push({name:"Tasks",permissions:setActivePermissions(taskPermissions)}),issuePermissions=[{key:"view_issues",description:"View issues"},{key:"add_issue",description:"Add issue"},{key:"modify_issue",description:"Modify issue"},{key:"delete_issue",description:"Delete issue"}],categories.push({name:"Issues",permissions:setActivePermissions(issuePermissions)}),wikiPermissions=[{key:"view_wiki_pages",description:"View wiki pages"},{key:"add_wiki_page",description:"Add wiki page"},{key:"modify_wiki_page",description:"Modify wiki page"},{key:"delete_wiki_page",description:"Delete wiki page"},{key:"view_wiki_links",description:"View wiki links"},{key:"add_wiki_link",description:"Add wiki link"},{key:"delete_wiki_link",description:"Delete wiki link"}],categories.push({name:"Wiki",permissions:setActivePermissions(wikiPermissions)}),setActivePermissionsPerCategory(categories)},renderResume=function(element,category){return element.find(".resume").html(resumeTemplate({category:category})) },renderCategory=function(category,index){var html;return html=categoryTemplate({category:category,index:index}),html=angular.element(html),renderResume(html,category),html},renderPermissions=function(){var html;return $el.off(),html=baseTemplate(),_.each(generateCategoriesFromRole($scope.role),function(category,index){return html=angular.element(html).append(renderCategory(category,index))}),$el.html(html),$el.on("click",".resume",function(event){var target;return event.preventDefault(),target=angular.element(event.currentTarget),target.next().toggleClass("open")}),$el.on("change",".category-item input",function(event){var getActivePermissions,onError,onSuccess,target;return getActivePermissions=function(){var activePermissions;return activePermissions=_.filter($el.find(".category-item input"),function(t){return angular.element(t).is(":checked")}),activePermissions=_.sortBy(_.map(activePermissions,function(t){var permission;return permission=angular.element(t).parents(".category-item").data("id")})),activePermissions.push("view_project"),activePermissions},target=angular.element(event.currentTarget),$scope.role.permissions=getActivePermissions(),onSuccess=function(role){var categories,categoryId;return categories=generateCategoriesFromRole(role),categoryId=target.parents(".category-config").data("id"),renderResume(target.parents(".category-config"),categories[categoryId]),$rootscope.$broadcast("projects:reload"),$confirm.notify("success"),$ctrl.loadProject()},onError=function(){return $confirm.notify("error"),target.prop("checked",!target.prop("checked")),$scope.role.permissions=getActivePermissions()},$repo.save($scope.role).then(onSuccess,onError)})},$scope.$on("$destroy",function(){return $el.off()}),$scope.$on("role:changed",function(){return renderPermissions()}),bindOnce($scope,$attrs.ngModel,renderPermissions)},{link:link}},module.directive("tgRolePermissions",["$rootScope","$tgRepo","$tgConfirm",RolePermissionsDirective])}.call(this),function(){var BitbucketController,BitbucketWebhooksDirective,GithubController,GithubWebhooksDirective,GitlabController,GitlabWebhooksDirective,NewWebhookDirective,SelectInputText,ValidOriginIpsDirective,WebhookDirective,WebhooksController,bindMethods,debounce,mixOf,module,taiga,timeout,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,bindMethods=this.taiga.bindMethods,debounce=this.taiga.debounce,timeout=this.taiga.timeout,module=angular.module("taigaAdmin"),WebhooksController=function(_super){function WebhooksController(_at_scope,_at_repo,_at_rs,_at_params,_at_appTitle){var promise;this.scope=_at_scope,this.repo=_at_repo,this.rs=_at_rs,this.params=_at_params,this.appTitle=_at_appTitle,bindMethods(this),this.scope.sectionName="Webhooks",this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set("Webhooks - "+_this.scope.project.name)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("webhooks:reload",this.loadWebhooks)}return __extends(WebhooksController,_super),WebhooksController.$inject=["$scope","$tgRepo","$tgResources","$routeParams","$appTitle"],WebhooksController.prototype.loadWebhooks=function(){return this.rs.webhooks.list(this.scope.projectId).then(function(_this){return function(webhooks){return _this.scope.webhooks=webhooks}}(this))},WebhooksController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},WebhooksController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this)).then(function(_this){return function(){return _this.loadWebhooks()}}(this))},WebhooksController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("WebhooksController",WebhooksController),WebhookDirective=function($rs,$repo,$confirm){var link;return link=function($scope,$el,$attrs){var cancel,openHistory,save,showEditMode,showVisualizationMode,updateLogs,updateShowHideHistoryText,webhook;return webhook=$scope.$eval($attrs.tgWebhook),updateLogs=function(){return $rs.webhooklogs.list(webhook.id).then(function(){return function(webhooklogs){var log,_i,_len,_ref;for(_i=0,_len=webhooklogs.length;_len>_i;_i++)log=webhooklogs[_i],log.validStatus=200<=(_ref=log.status)&&300>_ref,log.prettySentHeaders=_.map(_.pairs(log.request_headers),function(_arg){var header,value;return header=_arg[0],value=_arg[1],header+": "+value}).join("\n"),log.prettySentData=JSON.stringify(log.request_data.data,void 0,2),log.prettyDate=moment(log.created).format("DD MMM YYYY [at] hh:mm:ss");return webhook.logs_counter=webhooklogs.length,webhook.logs=webhooklogs,updateShowHideHistoryText()}}(this))},updateShowHideHistoryText=function(){var historyElement,textElement;return textElement=$el.find(".toggle-history"),historyElement=textElement.parents(".single-webhook-wrapper").find(".webhooks-history"),textElement.text(historyElement.hasClass("open")?"(Hide history)":"(Show history)")},showVisualizationMode=function(){return $el.find(".edition-mode").addClass("hidden"),$el.find(".visualization-mode").removeClass("hidden")},showEditMode=function(){return $el.find(".visualization-mode").addClass("hidden"),$el.find(".edition-mode").removeClass("hidden")},openHistory=function(){return $el.find(".webhooks-history").addClass("open")},cancel=function(){return showVisualizationMode(),$scope.$apply(function(){return webhook.revert()})},save=debounce(2e3,function(target){var form,promise,value;return form=target.parents("form").checksley(),form.validate()?(value=target.scope().value,promise=$repo.save(webhook),promise.then(function(){return function(){return showVisualizationMode()}}(this)),promise.then(null,function(data){return $confirm.notify("error"),form.setErrors(data)})):void 0}),$el.on("click",".test-webhook",function(){return openHistory(),$rs.webhooks.test(webhook.id).then(function(){return function(){return updateLogs()}}(this))}),$el.on("click",".edit-webhook",function(){return showEditMode()}),$el.on("click",".cancel-existing",function(){return cancel()}),$el.on("click",".edit-existing",function(event){var target;return event.preventDefault(),target=angular.element(event.currentTarget),save(target)}),$el.on("keyup",".edition-mode input",function(event){var target;return 13===event.keyCode?(target=angular.element(event.currentTarget),saveWebhook(target)):27===event.keyCode?(target=angular.element(event.currentTarget),cancel(target)):void 0}),$el.on("click",".delete-webhook",function(){var message,title;return title="Delete webhook",message="Webhook '"+webhook.name+"'",$confirm.askOnDelete(title,message).then(function(){return function(finish){var onError,onSucces;return onSucces=function(){return finish(),$scope.$emit("webhooks:reload")},onError=function(){return finish(!1),$confirm.notify("error")},$repo.remove(webhook).then(onSucces,onError)}}(this))}),$el.on("click",".toggle-history",function(event){var target;return target=angular.element(event.currentTarget),null==webhook.logs||0===webhook.logs.length?updateLogs().then(function(){return timeout(0,function(){return $el.find(".webhooks-history").toggleClass("open"),updateShowHideHistoryText()})}):($el.find(".webhooks-history").toggleClass("open"),$scope.$apply(function(){return updateShowHideHistoryText()}))}),$el.on("click",".history-single",function(event){var target;return target=angular.element(event.currentTarget),target.toggleClass("history-single-open"),target.siblings(".history-single-response").toggleClass("open")}),$el.on("click",".resend-request",function(event){var log,target;return target=angular.element(event.currentTarget),log=target.data("log"),$rs.webhooklogs.resend(log).then(function(){return function(){return updateLogs()}}(this))})},{link:link}},module.directive("tgWebhook",["$tgResources","$tgRepo","$tgConfirm","$tgLoading",WebhookDirective]),NewWebhookDirective=function($rs,$repo,$confirm){var link;return link=function($scope,$el,$attrs){var addWebhookDOMNode,formDOMNode,initializeNewValue,webhook;return webhook=$scope.$eval($attrs.tgWebhook),formDOMNode=$el.find(".new-webhook-form"),addWebhookDOMNode=$el.find(".add-webhook"),initializeNewValue=function(){return $scope.newValue={name:"",url:"",key:""}},initializeNewValue(),$scope.$watch("webhooks",function(webhooks){return null!=webhooks?0===webhooks.length?(formDOMNode.removeClass("hidden"),addWebhookDOMNode.addClass("hidden"),formDOMNode.find("input")[0].focus()):(formDOMNode.addClass("hidden"),addWebhookDOMNode.removeClass("hidden")):void 0}),formDOMNode.on("click",".add-new",debounce(2e3,function(event){var form,promise;return event.preventDefault(),form=formDOMNode.checksley(),form.validate()?($scope.newValue.project=$scope.project.id,promise=$repo.create("webhooks",$scope.newValue),promise.then(function(){return function(){return $scope.$emit("webhooks:reload"),initializeNewValue()}}(this)),promise.then(null,function(data){return $confirm.notify("error"),form.setErrors(data)})):void 0})),formDOMNode.on("click",".cancel-new",function(){return $scope.$apply(function(){return initializeNewValue()})}),addWebhookDOMNode.on("click",function(){return formDOMNode.removeClass("hidden"),formDOMNode.find("input")[0].focus()})},{link:link}},module.directive("tgNewWebhook",["$tgResources","$tgRepo","$tgConfirm","$tgLoading",NewWebhookDirective]),GithubController=function(_super){function GithubController(_at_scope,_at_repo,_at_rs,_at_params,_at_appTitle){var promise;this.scope=_at_scope,this.repo=_at_repo,this.rs=_at_rs,this.params=_at_params,this.appTitle=_at_appTitle,bindMethods(this),this.scope.sectionName="Github",this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set("Github - "+_this.scope.project.name)}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return __extends(GithubController,_super),GithubController.$inject=["$scope","$tgRepo","$tgResources","$routeParams","$appTitle"],GithubController.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"github").then(function(_this){return function(github){return _this.scope.github=github}}(this))},GithubController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},GithubController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this)).then(function(_this){return function(){return _this.loadModules()}}(this))},GithubController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("GithubController",GithubController),GitlabController=function(_super){function GitlabController(_at_scope,_at_repo,_at_rs,_at_params,_at_appTitle){var promise;this.scope=_at_scope,this.repo=_at_repo,this.rs=_at_rs,this.params=_at_params,this.appTitle=_at_appTitle,bindMethods(this),this.scope.sectionName="Gitlab",this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set("Gitlab - "+_this.scope.project.name)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:modules:reload",function(_this){return function(){return _this.loadModules()}}(this))}return __extends(GitlabController,_super),GitlabController.$inject=["$scope","$tgRepo","$tgResources","$routeParams","$appTitle"],GitlabController.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"gitlab").then(function(_this){return function(gitlab){return _this.scope.gitlab=gitlab}}(this))},GitlabController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},GitlabController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this)).then(function(_this){return function(){return _this.loadModules()}}(this))},GitlabController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("GitlabController",GitlabController),BitbucketController=function(_super){function BitbucketController(_at_scope,_at_repo,_at_rs,_at_params,_at_appTitle){var promise;this.scope=_at_scope,this.repo=_at_repo,this.rs=_at_rs,this.params=_at_params,this.appTitle=_at_appTitle,bindMethods(this),this.scope.sectionName="Bitbucket",this.scope.project={},promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set("Bitbucket - "+_this.scope.project.name)}}(this)),promise.then(null,this.onInitialDataError.bind(this)),this.scope.$on("project:modules:reload",function(_this){return function(){return _this.loadModules()}}(this))}return __extends(BitbucketController,_super),BitbucketController.$inject=["$scope","$tgRepo","$tgResources","$routeParams","$appTitle"],BitbucketController.prototype.loadModules=function(){return this.rs.modules.list(this.scope.projectId,"bitbucket").then(function(_this){return function(bitbucket){return _this.scope.bitbucket=bitbucket}}(this))},BitbucketController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},BitbucketController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this)).then(function(_this){return function(){return _this.loadModules()}}(this))},BitbucketController}(mixOf(taiga.Controller,taiga.PageMixin,taiga.FiltersMixin)),module.controller("BitbucketController",BitbucketController),SelectInputText=function(){var link;return link=function($scope,$el){return $el.on("click",".select-input-content",function(){return $el.find("input").select(),$el.find(".help-copy").addClass("visible")})},{link:link}},module.directive("tgSelectInputText",SelectInputText),GithubWebhooksDirective=function($repo,$confirm,$loading){var link;return link=function($scope,$el){var form,submit,submitButton;return form=$el.find("form").checksley({onlyOneErrorElement:!0}),submit=debounce(2e3,function(){return function(event){var promise;return event.preventDefault(),form.validate()?($loading.start(submitButton),promise=$repo.saveAttribute($scope.github,"github"),promise.then(function(){return $loading.finish(submitButton),$confirm.notify("success")}),promise.then(null,function(data){return $loading.finish(submitButton),form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$el.on("click",".submit-button",submit)},{link:link}},module.directive("tgGithubWebhooks",["$tgRepo","$tgConfirm","$tgLoading",GithubWebhooksDirective]),GitlabWebhooksDirective=function($repo,$confirm,$loading){var link;return link=function($scope,$el){var form,submit,submitButton;return form=$el.find("form").checksley({onlyOneErrorElement:!0}),submit=debounce(2e3,function(){return function(event){var promise;return event.preventDefault(),form.validate()?($loading.start(submitButton),promise=$repo.saveAttribute($scope.gitlab,"gitlab"),promise.then(function(){return $loading.finish(submitButton),$confirm.notify("success"),$scope.$emit("project:modules:reload")}),promise.then(null,function(data){return $loading.finish(submitButton),form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$el.on("click",".submit-button",submit)},{link:link}},module.directive("tgGitlabWebhooks",["$tgRepo","$tgConfirm","$tgLoading",GitlabWebhooksDirective]),BitbucketWebhooksDirective=function($repo,$confirm,$loading){var link;return link=function($scope,$el){var form,submit,submitButton;return form=$el.find("form").checksley({onlyOneErrorElement:!0}),submit=debounce(2e3,function(){return function(event){var promise;return event.preventDefault(),form.validate()?($loading.start(submitButton),promise=$repo.saveAttribute($scope.bitbucket,"bitbucket"),promise.then(function(){return $loading.finish(submitButton),$confirm.notify("success"),$scope.$emit("project:modules:reload")}),promise.then(null,function(data){return $loading.finish(submitButton),form.setErrors(data),data._error_message?$confirm.notify("error",data._error_message):void 0})):void 0}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$el.on("click",".submit-button",submit)},{link:link}},module.directive("tgBitbucketWebhooks",["$tgRepo","$tgConfirm","$tgLoading",BitbucketWebhooksDirective]),ValidOriginIpsDirective=function(){var link;return link=function($scope,$el,$attrs,$ngModel){return $ngModel.$parsers.push(function(value){return value=$.trim(value),""===value?[]:value.split(",")})},{link:link,restrict:"EA",require:"ngModel"}},module.directive("tgValidOriginIps",ValidOriginIpsDirective)}.call(this),function(){var CreateProject,DeleteProjectDirective,bindOnce,debounce,module,taiga,timeout;taiga=this.taiga,bindOnce=this.taiga.bindOnce,timeout=this.taiga.timeout,debounce=this.taiga.debounce,module=angular.module("taigaProject"),CreateProject=function($rootscope,$repo,$confirm,$location,$navurls,$rs,$projectUrl,$loading,lightboxService,$cacheFactory){var link;return link=function($scope,$el){var form,onErrorSubmit,onSuccessSubmit,submit,submitButton;return $scope.data={},$scope.templates=[],form=$el.find("form").checksley({onlyOneErrorElement:!0}),onSuccessSubmit=function(response){return $cacheFactory.get("$http").removeAll(),$loading.finish(submitButton),$rootscope.$broadcast("projects:reload"),$confirm.notify("success","Success"),$location.url($projectUrl.get(response)),lightboxService.close($el)},onErrorSubmit=function(response){var error_field,error_step,selectors,_i,_len,_ref;for($loading.finish(submitButton),form.setErrors(response),selectors=[],_ref=_.keys(response),_i=0,_len=_ref.length;_len>_i;_i++)error_field=_ref[_i],selectors.push("[name="+error_field+"]");return $el.find(".active").removeClass("active"),error_step=$el.find(selectors.join(",")).first().parents(".wizard-step"),error_step.addClass("active"),$el.find(".progress-bar").removeClass().addClass("progress-bar").addClass(error_step.data("step"))},submit=function(){return function(event){var promise;return event.preventDefault(),form.validate()?($loading.start(submitButton),promise=$repo.create("projects",$scope.data),promise.then(onSuccessSubmit,onErrorSubmit)):void 0}}(this),$scope.$on("projects:create",function(){return $scope.data={total_story_points:100,total_milestones:5},$scope.templates.length?$scope.data.creation_template=_.head(_.filter($scope.templates,function(x){return"scrum"===x.slug})).id:$rs.projects.templates().then(function(){return function(result){return $scope.templates=result,$scope.data.creation_template=_.head(_.filter($scope.templates,function(x){return"scrum"===x.slug})).id}}(this)),$el.find(".active").removeClass("active"),$el.find(".create-step1").addClass("active"),lightboxService.open($el),timeout(600,function(){return $el.find(".progress-bar").addClass("step1")})}),$el.on("click",".button-next",function(event){var current,field,next,step,valid,_i,_len,_ref;for(event.preventDefault(),current=$el.find(".active"),valid=!0,_ref=form.fields,_i=0,_len=_ref.length;_len>_i;_i++)field=_ref[_i],current.find("[name="+field.element.attr("name")+"]").length&&(valid=field.validate()!==!1&&valid);return valid?(next=current.next(),current.toggleClass("active"),next.toggleClass("active"),step=next.data("step"),$el.find(".progress-bar").removeClass().addClass("progress-bar").addClass(step)):void 0}),$el.on("click",".button-prev",function(event){var current,prev,step;return event.preventDefault(),current=$el.find(".active"),prev=current.prev(),current.toggleClass("active"),prev.toggleClass("active"),step=prev.data("step"),$el.find(".progress-bar").removeClass().addClass("progress-bar").addClass(step)}),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$el.on("click",".submit-button",submit),$el.on("click",".close",function(event){return event.preventDefault(),lightboxService.close($el)})},{link:link}},module.directive("tgLbCreateProject",["$rootScope","$tgRepo","$tgConfirm","$location","$tgNavUrls","$tgResources","$projectUrl","$tgLoading","lightboxService","$cacheFactory",CreateProject]),DeleteProjectDirective=function($repo,$rootscope,$auth,$location,$navUrls,$confirm,lightboxService,tgLoader){var link;return link=function($scope,$el){var projectToDelete,submit;return projectToDelete=null,$scope.$on("deletelightbox:new",function(ctx,project){return lightboxService.open($el),projectToDelete=project}),$scope.$on("$destroy",function(){return $el.off()}),submit=function(){var promise;return tgLoader.start(),lightboxService.close($el),promise=$repo.remove(projectToDelete),promise.then(function(){return tgLoader.pageLoaded(),$rootscope.$broadcast("projects:reload"),$location.path($navUrls.resolve("home")),$confirm.notify("success")}),promise.then(null,function(){return $confirm.notify("error"),lightboxService.close($el)})},$el.on("click",".button-red",function(event){return event.preventDefault(),lightboxService.close($el)}),$el.on("click",".button-green",function(event){return event.preventDefault(),submit()})},{link:link}},module.directive("tgLbDeleteProject",["$tgRepo","$rootScope","$tgAuth","$tgLocation","$tgNavUrls","$tgConfirm","lightboxService","tgLoader",DeleteProjectDirective])}.call(this),function(){var ProjectController,ProjectsController,ProjectsListDirective,ProjectsPaginationDirective,bindOnce,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,module=angular.module("taigaProject"),bindOnce=this.taiga.bindOnce,ProjectsController=function(_super){function ProjectsController(_at_scope,_at_q,_at_rs,_at_rootscope,_at_navUrls,_at_auth,_at_location,_at_appTitle,_at_projectUrl,tgLoader){var promise;this.scope=_at_scope,this.q=_at_q,this.rs=_at_rs,this.rootscope=_at_rootscope,this.navUrls=_at_navUrls,this.auth=_at_auth,this.location=_at_location,this.appTitle=_at_appTitle,this.projectUrl=_at_projectUrl,this.appTitle.set("Projects"),this.auth.isAuthenticated()||this.location.path(this.navUrls.resolve("login")),this.user=this.auth.getUser(),this.projects=[],promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.scope.$emit("projects:loaded")}}(this)),promise.then(null,this.onInitialDataError.bind(this)),promise["finally"](tgLoader.pageLoaded)}return __extends(ProjectsController,_super),ProjectsController.$inject=["$scope","$q","$tgResources","$rootScope","$tgNavUrls","$tgAuth","$tgLocation","$appTitle","$projectUrl","tgLoader"],ProjectsController.prototype.loadInitialData=function(){return this.rs.projects.list().then(function(_this){return function(projects){var project,_i,_len;for(_this.projects={recents:projects.slice(0,8),all:projects},_i=0,_len=projects.length;_len>_i;_i++)project=projects[_i],project.url=_this.projectUrl.get(project);return projects}}(this))},ProjectsController.prototype.newProject=function(){return this.rootscope.$broadcast("projects:create")},ProjectsController.prototype.logout=function(){return this.auth.logout(),this.location.path(this.navUrls.resolve("login"))},ProjectsController}(taiga.Controller),module.controller("ProjectsController",ProjectsController),ProjectController=function(_super){function ProjectController(_at_scope,_at_rs,_at_repo,_at_params,_at_q,_at_rootscope,_at_appTitle,_at_location,_at_navUrls){var promise;this.scope=_at_scope,this.rs=_at_rs,this.repo=_at_repo,this.params=_at_params,this.q=_at_q,this.rootscope=_at_rootscope,this.appTitle=_at_appTitle,this.location=_at_location,this.navUrls=_at_navUrls,promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set(_this.scope.project.name),_this.scope.$emit("regenerate:project-pagination")}}(this)),promise.then(null,this.onInitialDataError.bind(this))}return __extends(ProjectController,_super),ProjectController.$inject=["$scope","$tgResources","$tgRepo","$routeParams","$q","$rootScope","$appTitle","$tgLocation","$tgNavUrls"],ProjectController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadPageData()}}(this)).then(function(_this){return function(){return _this.scope.$emit("project:loaded",_this.scope.project)}}(this))},ProjectController.prototype.loadPageData=function(){return this.q.all([this.loadProjectStats(),this.loadProject()])},ProjectController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,project}}(this))},ProjectController.prototype.loadProjectStats=function(){return this.rs.projects.stats(this.scope.projectId).then(function(_this){return function(stats){return _this.scope.stats=stats,stats}}(this))},ProjectController}(taiga.Controller),module.controller("ProjectController",ProjectController),ProjectsPaginationDirective=function(){var link;return link=function($scope,$el){var checkButtonVisibility,container,containerSize,hasNextPage,hasPagination,hasPrevPage,hide,nextBtn,nextPage,pageSize,prevBtn,prevPage,remove,render,visible;return prevBtn=$el.find(".v-pagination-previous"),nextBtn=$el.find(".v-pagination-next"),container=$el.find("ul"),pageSize=0,containerSize=0,render=function(){return pageSize=$el.find(".v-pagination-list").height(),container.find("li").length&&hasPagination()?(hasNextPage()?visible(nextBtn):hide(nextBtn),hasPrevPage()?visible(prevBtn):hide(prevBtn)):remove()},hasPagination=function(){return containerSize=container.height(),containerSize>pageSize},hasPrevPage=function(top){return null==top&&(top=-parseInt(container.css("top"),10)||0),0!==top},hasNextPage=function(top){return containerSize=container.height(),top||(top=-parseInt(container.css("top"),10)||0),containerSize>pageSize&&containerSize>top+pageSize},nextPage=function(callback){var lastLi,maxTop,newTop,top;return top=parseInt(container.css("top"),10),newTop=top-pageSize,lastLi=$el.find(".v-pagination-list li:last-child"),maxTop=-(lastLi.position().top+lastLi.outerHeight()-pageSize),maxTop>newTop&&(newTop=maxTop),container.animate({top:newTop},callback),newTop},prevPage=function(callback){var newTop,top;return top=parseInt(container.css("top"),10),newTop=top+pageSize,newTop>0&&(newTop=0),container.animate({top:newTop},callback),newTop},visible=function(element){return element.css("visibility","visible")},hide=function(element){return element.css("visibility","hidden")},checkButtonVisibility=function(){},remove=function(){return container.css("top",0),hide(prevBtn),hide(nextBtn)},$el.on("click",".v-pagination-previous",function(event){var newTop;return event.preventDefault(),container.is(":animated")?void 0:(visible(nextBtn),newTop=prevPage(),hasPrevPage(newTop)?void 0:hide(prevBtn))}),$el.on("click",".v-pagination-next",function(event){var newTop;return event.preventDefault(),container.is(":animated")?void 0:(visible(prevBtn),newTop=-nextPage(),hasNextPage(newTop)?void 0:hide(nextBtn))}),$scope.$on("regenerate:project-pagination",function(){return remove(),render()}),$(window).on("resize.projects-pagination",render),$scope.$on("$destroy",function(){return $(window).off("resize.projects-pagination")})},{link:link}},module.directive("tgProjectsPagination",["$timeout",ProjectsPaginationDirective]),ProjectsListDirective=function($compile,$template){var link,template;return template=$template.get("project/project-list.html",!0),link=function($scope,$el){var render;return render=function(projects){return $el.html($compile(template({projects:projects}))($scope)),$scope.$emit("regenerate:project-pagination")},$scope.$watch("projects",function(projects){return null!=projects?render(projects):void 0})},{link:link}},module.directive("tgProjectsList",["$compile","$tgTemplate",ProjectsListDirective])}.call(this),function(){var BindHtmlDirective,BindOnceAltDirective,BindOnceBindDirective,BindOnceHrefDirective,BindOnceHtmlDirective,BindOnceRefDirective,BindOnceSrcDirective,BindOnceTitleDirective,BindTitleDirective,bindOnce,module;bindOnce=this.taiga.bindOnce,BindOnceBindDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoBind,function(val){return $el.text(val)})},{link:link}},BindOnceHtmlDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoHtml,function(val){return $el.html(val)})},{link:link}},BindOnceRefDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoRef,function(val){return $el.html("#"+val+" ")})},{link:link}},BindOnceSrcDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoSrc,function(val){return $el.attr("src",val)})},{link:link}},BindOnceHrefDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoHref,function(val){return $el.attr("href",val)})},{link:link}},BindOnceAltDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoAlt,function(val){return $el.attr("alt",val)})},{link:link}},BindOnceTitleDirective=function(){var link;return link=function($scope,$el,$attrs){return bindOnce($scope,$attrs.tgBoTitle,function(val){return $el.attr("title",val)})},{link:link}},BindTitleDirective=function(){var link;return link=function($scope,$el,$attrs){return $scope.$watch($attrs.tgTitleHtml,function(val){return null!=val?$el.attr("title",val):void 0})},{link:link}},BindHtmlDirective=function(){var link;return link=function($scope,$el,$attrs){return $scope.$watch($attrs.tgBindHtml,function(val){return null!=val?$el.html(val):void 0})},{link:link}},module=angular.module("taigaBase"),module.directive("tgBoBind",BindOnceBindDirective),module.directive("tgBoHtml",BindOnceHtmlDirective),module.directive("tgBoRef",BindOnceRefDirective),module.directive("tgBoSrc",BindOnceSrcDirective),module.directive("tgBoHref",BindOnceHrefDirective),module.directive("tgBoAlt",BindOnceAltDirective),module.directive("tgBoTitle",BindOnceTitleDirective),module.directive("tgBindTitle",BindTitleDirective),module.directive("tgBindHtml",BindHtmlDirective) -}.call(this),function(){var ConfigurationService,module;ConfigurationService=function(){function ConfigurationService(){this.config=window.taigaConfig}return ConfigurationService.prototype.get=function(key,defaultValue){return null==defaultValue&&(defaultValue=null),_.has(this.config,key)?this.config[key]:defaultValue},ConfigurationService}(),module=angular.module("taigaBase"),module.service("$tgConfig",ConfigurationService)}.call(this),function(){var ContribController,module,taigaContribPlugins,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taigaContribPlugins=this.taigaContribPlugins=this.taigaContribPlugins||[],ContribController=function(_super){function ContribController(_at_rootScope,_at_scope,_at_params,_at_repo,_at_rs,_at_confirm,_at_appTitle){var promise;this.rootScope=_at_rootScope,this.scope=_at_scope,this.params=_at_params,this.repo=_at_repo,this.rs=_at_rs,this.confirm=_at_confirm,this.appTitle=_at_appTitle,this.scope.currentPlugin=_.first(_.where(taigaContribPlugins,{slug:this.params.plugin})),this.scope.pluginTemplate="contrib/"+this.scope.currentPlugin.slug,this.scope.projectSlug=this.params.pslug,this.scope.adminPlugins=_.where(this.rootScope.contribPlugins,{type:"admin"}),promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set(_this.scope.project.name)}}(this)),promise.then(null,function(_this){return function(){return _this.confirm.notify("error")}}(this))}return __extends(ContribController,_super),ContribController.$inject=["$rootScope","$scope","$routeParams","$tgRepo","$tgResources","$tgConfirm","$appTitle"],ContribController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.$broadcast("project:loaded",project),project}}(this))},ContribController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this))},ContribController}(taiga.Controller),module=angular.module("taigaBase"),module.controller("ContribController",ContribController)}.call(this),function(){var FiltersStorageService,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,FiltersStorageService=function(_super){function FiltersStorageService(_at_storage,_at_params){this.storage=_at_storage,this.params=_at_params}return __extends(FiltersStorageService,_super),FiltersStorageService.$inject=["$tgStorage","$routeParams"],FiltersStorageService.prototype.generateHash=function(components){return null==components&&(components=[]),components=_.map(components,function(x){return JSON.stringify(x)}),hex_sha1(components.join(":"))},FiltersStorageService}(taiga.Service)}.call(this),function(){var HttpService,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,HttpService=function(_super){function HttpService(_at_http,_at_q,_at_storage){this.http=_at_http,this.q=_at_q,this.storage=_at_storage,HttpService.__super__.constructor.call(this)}return __extends(HttpService,_super),HttpService.$inject=["$http","$q","$tgStorage"],HttpService.prototype.headers=function(){var token;return token=this.storage.get("token"),token?{Authorization:"Bearer "+token}:{}},HttpService.prototype.request=function(options){return options.headers=_.merge({},options.headers||{},this.headers()),_.isPlainObject(options.data)&&(options.data=JSON.stringify(options.data)),this.http(options)},HttpService.prototype.get=function(url,params,options){return options=_.merge({method:"GET",url:url},options),params&&(options.params=params),this.request(options)},HttpService.prototype.post=function(url,data,params,options){return options=_.merge({method:"POST",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService.prototype.put=function(url,data,params,options){return options=_.merge({method:"PUT",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService.prototype.patch=function(url,data,params,options){return options=_.merge({method:"PATCH",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService.prototype["delete"]=function(url,data,params,options){return options=_.merge({method:"DELETE",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService}(taiga.Service),module=angular.module("taigaBase"),module.service("$tgHttp",HttpService)}.call(this),function(){var I18nDirective,I18nService,bindOnce,defaults,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,bindOnce=this.taiga.bindOnce,defaults={ns:"app",fallbackLng:"en",async:!1,lng:"en"},I18nService=function(_super){function I18nService(_at_rootscope,localesEn){this.rootscope=_at_rootscope,this.options=_.clone(defaults,!0),this.options.resStore={en:{app:localesEn}}}return __extends(I18nService,_super),I18nService.prototype.setLanguage=function(language){return i18n.setLng(language),this.rootscope.currentLang=language,this.rootscope.$broadcast("i18n:changeLang",language)},I18nService.prototype.initialize=function(){return i18n.init(this.options),this.rootscope.t=i18n.t},I18nService.prototype.t=function(path,opts){return i18n.t(path,opts)},I18nService}(taiga.Service),I18nDirective=function($rootscope,$i18n){var link;return link=function($scope,$el,$attrs){var ns,options,opts,v,values,_i,_len,_ref,_results;for(values=$attrs.tr.split(","),options=$attrs.trOpts||"{}",opts=$scope.$eval(options),_results=[],_i=0,_len=values.length;_len>_i;_i++)v=values[_i],-1===v.indexOf(":")?_results.push($el.html(_.escape($i18n.t(v,opts)))):(_ref=v.split(":"),ns=_ref[0],v=_ref[1],_results.push($el.attr(ns,_.escape($i18n.t(v,opts)))));return _results},{link:link,restrict:"A",scope:!1}},module=angular.module("taigaBase"),module.service("$tgI18n",["$rootScope","localesEn",I18nService]),module.directive("tr",["$rootScope","$tgI18n",I18nDirective])}.call(this),function(){var locationFactory,module;locationFactory=function($location,$route){return $location.noreload=function(scope){var lastRoute,un;return lastRoute=$route.current,un=scope.$on("$locationChangeSuccess",function(){return $route.current=lastRoute,un()}),$location},$location},module=angular.module("taigaBase"),module.factory("$tgLocation",["$location","$route","$rootScope",locationFactory])}.call(this),function(){var Model,ModelService,module,provider,taiga,__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;l>i;i++)if(i in this&&this[i]===item)return i;return-1},__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;Model=function(){function Model(name,data,dataTypes){this._attrs=data,this._name=name,this._dataTypes=dataTypes,this.setAttrs(data),this.initialize()}return Model.prototype.clone=function(){var instance;return instance=new Model(this._name,this._attrs,this._dataTypes),instance._modifiedAttrs=this._modifiedAttrs,instance._isModified=this._isModified,instance},Model.prototype.applyCasts=function(){var attrName,castMethod,castName,_ref,_results;_ref=this._dataTypes,_results=[];for(attrName in _ref)castName=_ref[attrName],castMethod=service.casts[castName],castMethod&&_results.push(this._attrs[attrName]=castMethod(this._attrs[attrName]));return _results},Model.prototype.getIdAttrName=function(){return"id"},Model.prototype.getName=function(){return this._name},Model.prototype.getAttrs=function(patch){return null==patch&&(patch=!1),null!=this._attrs.version&&(this._modifiedAttrs.version=this._attrs.version),patch?_.extend({},this._modifiedAttrs):_.extend({},this._attrs,this._modifiedAttrs)},Model.prototype.setAttrs=function(attrs){return this._attrs=attrs,this._modifiedAttrs={},this.applyCasts(),this._isModified=!1},Model.prototype.setAttr=function(name,value){return this._modifiedAttrs[name]=value,this._isModified=!0},Model.prototype.initialize=function(){var getter,self,setter;return self=this,getter=function(name){return function(){return"string"==typeof name&&"__"===name.substr(0,2)?self[name]:__indexOf.call(_.keys(self._modifiedAttrs),name)<0?self._attrs[name]:self._modifiedAttrs[name]}},setter=function(name){return function(value){return"string"==typeof name&&"__"===name.substr(0,2)?void(self[name]=value):void(self._attrs[name]!==value?(self._modifiedAttrs[name]=value,self._isModified=!0):delete self._modifiedAttrs[name])}},_.each(this._attrs,function(value,name){var options;return options={get:getter(name),set:setter(name),enumerable:!0,configurable:!0},Object.defineProperty(self,name,options)})},Model.prototype.serialize=function(){var data;return data={data:_.clone(this._attrs),name:this._name},JSON.stringify(data)},Model.prototype.isModified=function(){return this._isModified},Model.prototype.isAttributeModified=function(attribute){return null!=this._modifiedAttrs[attribute]},Model.prototype.markSaved=function(){return this._isModified=!1,this._attrs=this.getAttrs(),this._modifiedAttrs={}},Model.prototype.revert=function(){return this._modifiedAttrs={},this._isModified=!1},Model.desSerialize=function(sdata){var ddata,model;return ddata=JSON.parse(sdata),model=new Model(ddata.url,ddata.data)},Model}(),taiga=this.taiga,ModelService=function(_super){function ModelService(_at_q,_at_urls,_at_storage,_at_http){this.q=_at_q,this.urls=_at_urls,this.storage=_at_storage,this.http=_at_http,ModelService.__super__.constructor.call(this)}return __extends(ModelService,_super),ModelService.$inject=["$q","$tgUrls","$tgStorage","$tgHttp"],ModelService}(taiga.Service),provider=function(){var service;return service={},service.make_model=function(name,data,cls,dataTypes){return null==cls&&(cls=Model),null==dataTypes&&(dataTypes={}),new cls(name,data,dataTypes)},service.cls=Model,service.casts={"int":function(value){return parseInt(value,10)},"float":function(value){return parseFloat(value,10)}},service},module=angular.module("taigaBase"),module.factory("$tgModel",["$q","$http","$tgUrls","$tgStorage",provider])}.call(this),function(){var NavigationUrlsDirective,NavigationUrlsService,bindOnce,module,taiga,trim,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,trim=this.taiga.trim,bindOnce=this.taiga.bindOnce,module=angular.module("taigaBase"),NavigationUrlsService=function(_super){function NavigationUrlsService(){this.urls={}}return __extends(NavigationUrlsService,_super),NavigationUrlsService.prototype.update=function(urls){return this.urls=_.merge({},this.urls,urls||{})},NavigationUrlsService.prototype.formatUrl=function(url,ctx){var replacer;return null==ctx&&(ctx={}),replacer=function(match){return match=trim(match,":"),ctx[match]||"undefined"},url.replace(/(:\w+)/g,replacer)},NavigationUrlsService.prototype.resolve=function(name,ctx){var url;return url=this.urls[name],url?ctx?this.formatUrl(url,ctx):url:""},NavigationUrlsService}(taiga.Service),module.service("$tgNavUrls",NavigationUrlsService),NavigationUrlsDirective=function($navurls,$auth,$q,$location){var bindOnceP,link,parseNav;return bindOnceP=function($scope,attr){var defered;return defered=$q.defer(),bindOnce($scope,attr,function(v){return defered.resolve(v)}),defered.promise},parseNav=function(data,$scope){var name,params,promises,values,_ref;return _ref=_.map(data.split(":"),trim),name=_ref[0],params=_ref[1],params=params?_.map(params.split(","),trim):[],values=_.map(params,function(x){return trim(x.split("=")[1])}),promises=_.map(values,function(x){return bindOnceP($scope,x)}),$q.all(promises).then(function(){var item,key,options,value,_i,_len,_ref1;for(options={},_i=0,_len=params.length;_len>_i;_i++)item=params[_i],_ref1=_.map(item.split("="),trim),key=_ref1[0],value=_ref1[1],options[key]=$scope.$eval(value);return[name,options]})},link=function($scope,$el,$attrs){return $el.is("a")&&$el.attr("href","#"),$el.on("mouseenter",function(event){var target;return target=$(event.currentTarget),target.data("fullUrl")?void 0:parseNav($attrs.tgNav,$scope).then(function(result){var fullUrl,name,options,url,user;return name=result[0],options=result[1],user=$auth.getUser(),user&&(options.user=user.username),url=$navurls.resolve(name),fullUrl=$navurls.formatUrl(url,options),target.data("fullUrl",fullUrl),target.is("a")&&target.attr("href",fullUrl),$el.on("click",function(event){if(event.preventDefault(),target=$(event.currentTarget),!target.hasClass("noclick"))switch(fullUrl=target.data("fullUrl"),event.which){case 1:return $location.url(fullUrl),$scope.$apply();case 2:return window.open(fullUrl)}})})}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgNav",["$tgNavUrls","$tgAuth","$q","$tgLocation",NavigationUrlsDirective])}.call(this),function(){var RepositoryService,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,RepositoryService=function(_super){function RepositoryService(_at_q,_at_model,_at_storage,_at_http,_at_urls){this.q=_at_q,this.model=_at_model,this.storage=_at_storage,this.http=_at_http,this.urls=_at_urls,RepositoryService.__super__.constructor.call(this)}return __extends(RepositoryService,_super),RepositoryService.$inject=["$q","$tgModel","$tgStorage","$tgHttp","$tgUrls"],RepositoryService.prototype.resolveUrlForModel=function(model){var idAttrName;return idAttrName=model.getIdAttrName(),this.urls.resolve(model.getName())+"/"+model[idAttrName]},RepositoryService.prototype.resolveUrlForAttributeModel=function(model){return this.urls.resolve(model.getName(),model.parent)},RepositoryService.prototype.create=function(name,data,dataTypes,extraParams){var defered,promise,url;return null==dataTypes&&(dataTypes={}),null==extraParams&&(extraParams={}),defered=this.q.defer(),url=this.urls.resolve(name),promise=this.http.post(url,JSON.stringify(data)),promise.success(function(_this){return function(_data){return defered.resolve(_this.model.make_model(name,_data,null,dataTypes))}}(this)),promise.error(function(){return function(data){return defered.reject(data)}}(this)),defered.promise},RepositoryService.prototype.remove=function(model,params){var defered,promise,url;return null==params&&(params={}),defered=this.q.defer(),url=this.resolveUrlForModel(model),promise=this.http["delete"](url,{},params),promise.success(function(){return defered.resolve(model)}),promise.error(function(){return defered.reject(model)}),defered.promise},RepositoryService.prototype.saveAll=function(models,patch){var promises;return null==patch&&(patch=!0),promises=_.map(models,function(_this){return function(x){return _this.save(x,!0)}}(this)),this.q.all(promises)},RepositoryService.prototype.save=function(model,patch){var data,defered,promise,url;return null==patch&&(patch=!0),defered=this.q.defer(),!model.isModified()&&patch?(defered.resolve(model),defered.promise):(url=this.resolveUrlForModel(model),data=JSON.stringify(model.getAttrs(patch)),promise=patch?this.http.patch(url,data):this.http.put(url,data),promise.success(function(){return function(data){return model._isModified=!1,model._attrs=_.extend(model.getAttrs(),data),model._modifiedAttrs={},model.applyCasts(),defered.resolve(model)}}(this)),promise.error(function(data){return defered.reject(data)}),defered.promise)},RepositoryService.prototype.saveAttribute=function(model,attribute,patch){var data,defered,promise,url;return null==patch&&(patch=!0),defered=this.q.defer(),!model.isModified()&&patch?(defered.resolve(model),defered.promise):(url=this.resolveUrlForAttributeModel(model),data={},data[attribute]=model.getAttrs(),promise=patch?this.http.patch(url,data):this.http.put(url,data),promise.success(function(){return function(data){return model._isModified=!1,model._attrs=_.extend(model.getAttrs(),data),model._modifiedAttrs={},model.applyCasts(),defered.resolve(model)}}(this)),promise.error(function(data){return defered.reject(data)}),defered.promise)},RepositoryService.prototype.refresh=function(model){var defered,promise,url;return defered=this.q.defer(),url=this.resolveUrlForModel(model),promise=this.http.get(url),promise.success(function(data){return model._modifiedAttrs={},model._attrs=data,model._isModified=!1,model.applyCasts(),defered.resolve(model)}),promise.error(function(data){return defered.reject(data)}),defered.promise},RepositoryService.prototype.queryMany=function(name,params,options){var httpOptions,url;return null==options&&(options={}),url=this.urls.resolve(name),httpOptions={headers:{}},options.enablePagination||(httpOptions.headers["x-disable-pagination"]="1"),this.http.get(url,params,httpOptions).then(function(_this){return function(data){return _.map(data.data,function(x){return _this.model.make_model(name,x)})}}(this))},RepositoryService.prototype.queryOneAttribute=function(name,id,attribute,params,options){var httpOptions,url;return null==options&&(options={}),url=this.urls.resolve(name,id),httpOptions={headers:{}},options.enablePagination||(httpOptions.headers["x-disable-pagination"]="1"),this.http.get(url,params,httpOptions).then(function(_this){return function(data){var model;return model=_this.model.make_model(name,data.data[attribute]),model.parent=id,model}}(this))},RepositoryService.prototype.queryOne=function(name,id,params,options){var httpOptions,url;return null==options&&(options={}),url=this.urls.resolve(name),id&&(url=url+"/"+id),httpOptions={headers:{}},options.enablePagination||(httpOptions.headers["x-disable-pagination"]="1"),this.http.get(url,params,httpOptions).then(function(_this){return function(data){return _this.model.make_model(name,data.data)}}(this))},RepositoryService.prototype.queryOneRaw=function(name,id,params,options){var httpOptions,url;return null==options&&(options={}),url=this.urls.resolve(name),id&&(url=url+"/"+id),httpOptions=_.merge({headers:{}},options),options.enablePagination||(httpOptions.headers["x-disable-pagination"]="1"),this.http.get(url,params,httpOptions).then(function(){return function(data){return data.data}}(this))},RepositoryService.prototype.queryPaginated=function(name,params,options){var httpOptions,url;return null==options&&(options={}),url=this.urls.resolve(name),httpOptions=_.merge({headers:{}},options),this.http.get(url,params,httpOptions).then(function(_this){return function(data){var headers,result;return headers=data.headers(),result={},result.models=_.map(data.data,function(x){return _this.model.make_model(name,x)}),result.count=parseInt(headers["x-pagination-count"],10),result.current=parseInt(headers["x-pagination-current"]||1,10),result.paginatedBy=parseInt(headers["x-paginated-by"],10),result}}(this))},RepositoryService.prototype.resolve=function(options){var cache,params;return params={},null!=options.pslug&&(params.project=options.pslug),null!=options.usref&&(params.us=options.usref),null!=options.taskref&&(params.task=options.taskref),null!=options.issueref&&(params.issue=options.issueref),null!=options.sslug&&(params.milestone=options.sslug),null!=options.wikipage&&(params.wikipage=options.wikipage),cache=!(options.wikipage||options.sslug),this.queryOneRaw("resolver",null,params,{cache:cache})},RepositoryService}(taiga.Service),module=angular.module("taigaBase"),module.service("$tgRepo",RepositoryService)}.call(this),function(){var StorageService,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,StorageService=function(_super){function StorageService(){StorageService.__super__.constructor.call(this)}return __extends(StorageService,_super),StorageService.$inject=["$rootScope"],StorageService.prototype.get=function(key,_default){var serializedValue;return serializedValue=localStorage.getItem(key),null===serializedValue?_default||null:JSON.parse(serializedValue)},StorageService.prototype.set=function(key,val){return _.isObject(key)?_.each(key,function(_this){return function(val,key){return _this.set(key,val)}}(this)):localStorage.setItem(key,JSON.stringify(val))},StorageService.prototype.contains=function(key){var value;return value=this.get(key),null!==value},StorageService.prototype.remove=function(key){return localStorage.removeItem(key)},StorageService.prototype.clear=function(){return localStorage.clear()},StorageService}(taiga.Service),module=angular.module("taigaBase"),module.service("$tgStorage",StorageService)}.call(this),function(){var UrlsService,format,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;format=function(fmt,obj){return obj=_.clone(obj),fmt.replace(/%s/g,function(){return String(obj.shift())})},taiga=this.taiga,UrlsService=function(_super){function UrlsService(_at_config){this.config=_at_config,this.urls={},this.mainUrl=config.get("api")}return __extends(UrlsService,_super),UrlsService.$inject=["$tgConfig"],UrlsService.prototype.update=function(urls){return this.urls=_.merge(this.urls,urls)},UrlsService.prototype.resolve=function(){var args,name,url;if(args=_.toArray(arguments),0===args.length)throw Error("wrong arguments to setUrls");return name=args.slice(0,1)[0],url=format(this.urls[name],args.slice(1)),format("%s/%s",[_.str.rtrim(this.mainUrl,"/"),_.str.ltrim(url,"/")])},UrlsService}(taiga.Service),module=angular.module("taigaBase"),module.service("$tgUrls",UrlsService)}.call(this),function(){var module,resourceProvider,sizeFormat,taiga;taiga=this.taiga,sizeFormat=this.taiga.sizeFormat,resourceProvider=function($rootScope,$config,$urls,$model,$repo,$auth,$q){var service;return service={},service.list=function(urlName,objectId,projectId){var params;return params={object_id:objectId,project:projectId},$repo.queryMany(urlName,params)},service.create=function(urlName,projectId,objectId,file){var data,defered,maxFileSize,response,uploadComplete,uploadFailed,uploadProgress,xhr;return defered=$q.defer(),void 0===file?(defered.reject(null),defered.promise):(maxFileSize=$config.get("maxUploadFileSize",null),maxFileSize&&file.size>maxFileSize?(response={status:413,data:{_error_message:"'"+file.name+"' ("+sizeFormat(file.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+sizeFormat(maxFileSize)+")"}},defered.reject(response),defered.promise):(uploadProgress=function(){return function(evt){return $rootScope.$apply(function(){return file.status="in-progress",file.size=sizeFormat(evt.total),file.progressMessage="upload "+sizeFormat(evt.loaded)+" of "+sizeFormat(evt.total),file.progressPercent=Math.round(evt.loaded/evt.total*100)+"%"})}}(this),uploadComplete=function(){return function(evt){return $rootScope.$apply(function(){var data,model;file.status="done";try{data=JSON.parse(evt.target.responseText)}catch(_error){data={}}return model=$model.make_model(urlName,data),defered.resolve(model)})}}(this),uploadFailed=function(){return function(){return $rootScope.$apply(function(){return file.status="error",defered.reject("fail")})}}(this),data=new FormData,data.append("project",projectId),data.append("object_id",objectId),data.append("attached_file",file),xhr=new XMLHttpRequest,xhr.upload.addEventListener("progress",uploadProgress,!1),xhr.addEventListener("load",uploadComplete,!1),xhr.addEventListener("error",uploadFailed,!1),xhr.open("POST",$urls.resolve(urlName)),xhr.setRequestHeader("Authorization","Bearer "+$auth.getToken()),xhr.setRequestHeader("Accept","application/json"),xhr.send(data),defered.promise))},function(instance){return instance.attachments=service}},module=angular.module("taigaResources"),module.factory("$tgAttachmentsResourcesProvider",["$rootScope","$tgConfig","$tgUrls","$tgModel","$tgRepo","$tgAuth","$q",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo,$http,$urls){var service;return service={},service.get=function(type,objectId){return $repo.queryOneRaw("history/"+type,objectId)},service.deleteComment=function(type,objectId,activityId){var params,url;return url=$urls.resolve("history/"+type),url=url+"/"+objectId+"/delete_comment",params={id:activityId},$http.post(url,null,params).then(function(){return function(data){return data.data}}(this))},service.undeleteComment=function(type,objectId,activityId){var params,url;return url=$urls.resolve("history/"+type),url=url+"/"+objectId+"/undelete_comment",params={id:activityId},$http.post(url,null,params).then(function(){return function(data){return data.data}}(this))},function(instance){return instance.history=service}},module=angular.module("taigaResources"),module.factory("$tgHistoryResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo){var service;return service={},service.get=function(token){return $repo.queryOne("invitations",token)},function(instance){return instance.invitations=service}},module=angular.module("taigaResources"),module.factory("$tgInvitationsResourcesProvider",["$tgRepo",resourceProvider])}.call(this),function(){var generateHash,module,resourceProvider,taiga;taiga=this.taiga,generateHash=taiga.generateHash,resourceProvider=function($repo,$http,$urls,$storage,$q){var filtersHashSuffix,hashSuffix,myFiltersHashSuffix,service;return service={},hashSuffix="issues-queryparams",filtersHashSuffix="issues-filters",myFiltersHashSuffix="issues-my-filters",service.get=function(projectId,issueId){var params;return params=service.getQueryParams(projectId),params.project=projectId,$repo.queryOne("issues",issueId,params)},service.getByRef=function(projectId,ref){var params;return params=service.getQueryParams(projectId),params.project=projectId,params.ref=ref,$repo.queryOne("issues","by_ref",params)},service.list=function(projectId,filters,options){var params;return params={project:projectId},params=_.extend({},params,filters||{}),service.storeQueryParams(projectId,params),$repo.queryPaginated("issues",params,options)},service.bulkCreate=function(projectId,data){var params,url;return url=$urls.resolve("bulk-create-issues"),params={project_id:projectId,bulk_issues:data},$http.post(url,params)},service.stats=function(projectId){return $repo.queryOneRaw("projects",projectId+"/issues_stats")},service.filtersData=function(projectId){return $repo.queryOneRaw("projects",projectId+"/issue_filters_data")},service.listValues=function(projectId,type){var params;return params={project:projectId},service.storeQueryParams(projectId,params),$repo.queryMany(type,params)},service.storeQueryParams=function(projectId,params){var hash,ns;return ns=projectId+":"+hashSuffix,hash=generateHash([projectId,ns]),$storage.set(hash,params)},service.getQueryParams=function(projectId){var hash,ns;return ns=projectId+":"+hashSuffix,hash=generateHash([projectId,ns]),$storage.get(hash)||{}},service.storeFilters=function(projectSlug,params){var hash,ns;return ns=projectSlug+":"+filtersHashSuffix,hash=generateHash([projectSlug,ns]),$storage.set(hash,params)},service.getFilters=function(projectSlug){var hash,ns;return ns=projectSlug+":"+filtersHashSuffix,hash=generateHash([projectSlug,ns]),$storage.get(hash)||{}},service.storeMyFilters=function(projectId,myFilters){var deferred,hash,ns,promise,url;return deferred=$q.defer(),url=$urls.resolve("user-storage"),ns=projectId+":"+myFiltersHashSuffix,hash=generateHash([projectId,ns]),_.isEmpty(myFilters)?(promise=$http["delete"](url+"/"+hash,{key:hash,value:myFilters}),promise.then(function(){return deferred.resolve()}),promise.then(null,function(){return deferred.reject()})):(promise=$http.put(url+"/"+hash,{key:hash,value:myFilters}),promise.then(function(){return deferred.resolve()}),promise.then(null,function(){var innerPromise;return innerPromise=$http.post(""+url,{key:hash,value:myFilters}),innerPromise.then(function(){return deferred.resolve()}),innerPromise.then(null,function(){return deferred.reject()})})),deferred.promise},service.getMyFilters=function(projectId){var deferred,hash,ns,promise,url;return deferred=$q.defer(),url=$urls.resolve("user-storage"),ns=projectId+":"+myFiltersHashSuffix,hash=generateHash([projectId,ns]),promise=$http.get(url+"/"+hash),promise.then(function(data){return deferred.resolve(data.data.value)}),promise.then(null,function(){return deferred.resolve({})}),deferred.promise},function(instance){return instance.issues=service}},module=angular.module("taigaResources"),module.factory("$tgIssuesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls","$tgStorage","$q",resourceProvider])}.call(this),function(){var generateHash,module,resourceProvider,taiga;taiga=this.taiga,generateHash=taiga.generateHash,resourceProvider=function($storage){var hashSuffixStatusColumnModes,hashSuffixStatusViewModes,service;return service={},hashSuffixStatusViewModes="kanban-statusviewmodels",hashSuffixStatusColumnModes="kanban-statuscolumnmodels",service.storeStatusViewModes=function(projectId,params){var hash,ns;return ns=projectId+":"+hashSuffixStatusViewModes,hash=generateHash([projectId,ns]),$storage.set(hash,params)},service.getStatusViewModes=function(projectId){var hash,ns;return ns=projectId+":"+hashSuffixStatusViewModes,hash=generateHash([projectId,ns]),$storage.get(hash)||{}},service.storeStatusColumnModes=function(projectId,params){var hash,ns;return ns=projectId+":"+hashSuffixStatusColumnModes,hash=generateHash([projectId,ns]),$storage.set(hash,params)},service.getStatusColumnModes=function(projectId){var hash,ns;return ns=projectId+":"+hashSuffixStatusColumnModes,hash=generateHash([projectId,ns]),$storage.get(hash)||{}},function(instance){return instance.kanban=service}},module=angular.module("taigaResources"),module.factory("$tgKanbanResourcesProvider",["$tgStorage",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo,$urls,$http){var service;return service={},service.render=function(projectId,content){var params,url;return(null==content||""===content)&&(content=" "),params={project_id:projectId,content:content},url=$urls.resolve("wiki"),$http.post(url+"/render",params).then(function(){return function(data){return data.data +}.call(this),function(){var ConfigurationService,module;ConfigurationService=function(){function ConfigurationService(){this.config=window.taigaConfig}return ConfigurationService.prototype.get=function(key,defaultValue){return null==defaultValue&&(defaultValue=null),_.has(this.config,key)?this.config[key]:defaultValue},ConfigurationService}(),module=angular.module("taigaBase"),module.service("$tgConfig",ConfigurationService)}.call(this),function(){var ContribController,module,taigaContribPlugins,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taigaContribPlugins=this.taigaContribPlugins=this.taigaContribPlugins||[],ContribController=function(_super){function ContribController(_at_rootScope,_at_scope,_at_params,_at_repo,_at_rs,_at_confirm,_at_appTitle){var promise;this.rootScope=_at_rootScope,this.scope=_at_scope,this.params=_at_params,this.repo=_at_repo,this.rs=_at_rs,this.confirm=_at_confirm,this.appTitle=_at_appTitle,this.scope.currentPlugin=_.first(_.where(taigaContribPlugins,{slug:this.params.plugin})),this.scope.pluginTemplate="contrib/"+this.scope.currentPlugin.slug,this.scope.projectSlug=this.params.pslug,this.scope.adminPlugins=_.where(this.rootScope.contribPlugins,{type:"admin"}),promise=this.loadInitialData(),promise.then(function(_this){return function(){return _this.appTitle.set(_this.scope.project.name)}}(this)),promise.then(null,function(_this){return function(){return _this.confirm.notify("error")}}(this))}return __extends(ContribController,_super),ContribController.$inject=["$rootScope","$scope","$routeParams","$tgRepo","$tgResources","$tgConfirm","$appTitle"],ContribController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),_this.scope.$broadcast("project:loaded",project),project}}(this))},ContribController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this))},ContribController}(taiga.Controller),module=angular.module("taigaBase"),module.controller("ContribController",ContribController)}.call(this),function(){var FiltersStorageService,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,FiltersStorageService=function(_super){function FiltersStorageService(_at_storage,_at_params){this.storage=_at_storage,this.params=_at_params}return __extends(FiltersStorageService,_super),FiltersStorageService.$inject=["$tgStorage","$routeParams"],FiltersStorageService.prototype.generateHash=function(components){return null==components&&(components=[]),components=_.map(components,function(x){return JSON.stringify(x)}),hex_sha1(components.join(":"))},FiltersStorageService}(taiga.Service)}.call(this),function(){var HttpService,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,HttpService=function(_super){function HttpService(_at_http,_at_q,_at_storage){this.http=_at_http,this.q=_at_q,this.storage=_at_storage,HttpService.__super__.constructor.call(this)}return __extends(HttpService,_super),HttpService.$inject=["$http","$q","$tgStorage"],HttpService.prototype.headers=function(){var token;return token=this.storage.get("token"),token?{Authorization:"Bearer "+token}:{}},HttpService.prototype.request=function(options){return options.headers=_.merge({},options.headers||{},this.headers()),_.isPlainObject(options.data)&&(options.data=JSON.stringify(options.data)),this.http(options)},HttpService.prototype.get=function(url,params,options){return options=_.merge({method:"GET",url:url},options),params&&(options.params=params),this.request(options)},HttpService.prototype.post=function(url,data,params,options){return options=_.merge({method:"POST",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService.prototype.put=function(url,data,params,options){return options=_.merge({method:"PUT",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService.prototype.patch=function(url,data,params,options){return options=_.merge({method:"PATCH",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService.prototype["delete"]=function(url,data,params,options){return options=_.merge({method:"DELETE",url:url},options),data&&(options.data=data),params&&(options.params=params),this.request(options)},HttpService}(taiga.Service),module=angular.module("taigaBase"),module.service("$tgHttp",HttpService)}.call(this),function(){var I18nDirective,I18nService,bindOnce,defaults,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,bindOnce=this.taiga.bindOnce,defaults={ns:"app",fallbackLng:"en",async:!1,lng:"en"},I18nService=function(_super){function I18nService(_at_rootscope,localesEn){this.rootscope=_at_rootscope,this.options=_.clone(defaults,!0),this.options.resStore={en:{app:localesEn}}}return __extends(I18nService,_super),I18nService.prototype.setLanguage=function(language){return i18n.setLng(language),this.rootscope.currentLang=language,this.rootscope.$broadcast("i18n:changeLang",language)},I18nService.prototype.initialize=function(){return i18n.init(this.options),this.rootscope.t=i18n.t},I18nService.prototype.t=function(path,opts){return i18n.t(path,opts)},I18nService}(taiga.Service),I18nDirective=function($rootscope,$i18n){var link;return link=function($scope,$el,$attrs){var ns,options,opts,v,values,_i,_len,_ref,_results;for(values=$attrs.tr.split(","),options=$attrs.trOpts||"{}",opts=$scope.$eval(options),_results=[],_i=0,_len=values.length;_len>_i;_i++)v=values[_i],-1===v.indexOf(":")?_results.push($el.html(_.escape($i18n.t(v,opts)))):(_ref=v.split(":"),ns=_ref[0],v=_ref[1],_results.push($el.attr(ns,_.escape($i18n.t(v,opts)))));return _results},{link:link,restrict:"A",scope:!1}},module=angular.module("taigaBase"),module.service("$tgI18n",["$rootScope","localesEn",I18nService]),module.directive("tr",["$rootScope","$tgI18n",I18nDirective])}.call(this),function(){var locationFactory,module;locationFactory=function($location,$route){return $location.noreload=function(scope){var lastRoute,un;return lastRoute=$route.current,un=scope.$on("$locationChangeSuccess",function(){return $route.current=lastRoute,un()}),$location},$location},module=angular.module("taigaBase"),module.factory("$tgLocation",["$location","$route","$rootScope",locationFactory])}.call(this),function(){var Model,ModelService,module,provider,taiga,__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;l>i;i++)if(i in this&&this[i]===item)return i;return-1},__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;Model=function(){function Model(name,data,dataTypes){this._attrs=data,this._name=name,this._dataTypes=dataTypes,this.setAttrs(data),this.initialize()}return Model.prototype.clone=function(){var instance;return instance=new Model(this._name,this._attrs,this._dataTypes),instance._modifiedAttrs=this._modifiedAttrs,instance._isModified=this._isModified,instance},Model.prototype.applyCasts=function(){var attrName,castMethod,castName,_ref,_results;_ref=this._dataTypes,_results=[];for(attrName in _ref)castName=_ref[attrName],castMethod=service.casts[castName],castMethod&&_results.push(this._attrs[attrName]=castMethod(this._attrs[attrName]));return _results},Model.prototype.getIdAttrName=function(){return"id"},Model.prototype.getName=function(){return this._name},Model.prototype.getAttrs=function(patch){return null==patch&&(patch=!1),null!=this._attrs.version&&(this._modifiedAttrs.version=this._attrs.version),patch?_.extend({},this._modifiedAttrs):_.extend({},this._attrs,this._modifiedAttrs)},Model.prototype.setAttrs=function(attrs){return this._attrs=attrs,this._modifiedAttrs={},this.applyCasts(),this._isModified=!1},Model.prototype.setAttr=function(name,value){return this._modifiedAttrs[name]=value,this._isModified=!0},Model.prototype.initialize=function(){var getter,self,setter;return self=this,getter=function(name){return function(){return"string"==typeof name&&"__"===name.substr(0,2)?self[name]:__indexOf.call(_.keys(self._modifiedAttrs),name)<0?self._attrs[name]:self._modifiedAttrs[name]}},setter=function(name){return function(value){return"string"==typeof name&&"__"===name.substr(0,2)?void(self[name]=value):void(self._attrs[name]!==value?(self._modifiedAttrs[name]=value,self._isModified=!0):delete self._modifiedAttrs[name])}},_.each(this._attrs,function(value,name){var options;return options={get:getter(name),set:setter(name),enumerable:!0,configurable:!0},Object.defineProperty(self,name,options)})},Model.prototype.serialize=function(){var data;return data={data:_.clone(this._attrs),name:this._name},JSON.stringify(data)},Model.prototype.isModified=function(){return this._isModified},Model.prototype.isAttributeModified=function(attribute){return null!=this._modifiedAttrs[attribute]},Model.prototype.markSaved=function(){return this._isModified=!1,this._attrs=this.getAttrs(),this._modifiedAttrs={}},Model.prototype.revert=function(){return this._modifiedAttrs={},this._isModified=!1},Model.desSerialize=function(sdata){var ddata,model;return ddata=JSON.parse(sdata),model=new Model(ddata.url,ddata.data)},Model}(),taiga=this.taiga,ModelService=function(_super){function ModelService(_at_q,_at_urls,_at_storage,_at_http){this.q=_at_q,this.urls=_at_urls,this.storage=_at_storage,this.http=_at_http,ModelService.__super__.constructor.call(this)}return __extends(ModelService,_super),ModelService.$inject=["$q","$tgUrls","$tgStorage","$tgHttp"],ModelService}(taiga.Service),provider=function(){var service;return service={},service.make_model=function(name,data,cls,dataTypes){return null==cls&&(cls=Model),null==dataTypes&&(dataTypes={}),new cls(name,data,dataTypes)},service.cls=Model,service.casts={"int":function(value){return parseInt(value,10)},"float":function(value){return parseFloat(value,10)}},service},module=angular.module("taigaBase"),module.factory("$tgModel",["$q","$http","$tgUrls","$tgStorage",provider])}.call(this),function(){var NavigationUrlsDirective,NavigationUrlsService,bindOnce,module,taiga,trim,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,trim=this.taiga.trim,bindOnce=this.taiga.bindOnce,module=angular.module("taigaBase"),NavigationUrlsService=function(_super){function NavigationUrlsService(){this.urls={}}return __extends(NavigationUrlsService,_super),NavigationUrlsService.prototype.update=function(urls){return this.urls=_.merge({},this.urls,urls||{})},NavigationUrlsService.prototype.formatUrl=function(url,ctx){var replacer;return null==ctx&&(ctx={}),replacer=function(match){return match=trim(match,":"),ctx[match]||"undefined"},url.replace(/(:\w+)/g,replacer)},NavigationUrlsService.prototype.resolve=function(name,ctx){var url;return url=this.urls[name],url?ctx?this.formatUrl(url,ctx):url:""},NavigationUrlsService}(taiga.Service),module.service("$tgNavUrls",NavigationUrlsService),NavigationUrlsDirective=function($navurls,$auth,$q,$location){var bindOnceP,link,parseNav;return bindOnceP=function($scope,attr){var defered;return defered=$q.defer(),bindOnce($scope,attr,function(v){return defered.resolve(v)}),defered.promise},parseNav=function(data,$scope){var name,params,promises,values,_ref;return _ref=_.map(data.split(":"),trim),name=_ref[0],params=_ref[1],params=params?_.map(params.split(","),trim):[],values=_.map(params,function(x){return trim(x.split("=")[1])}),promises=_.map(values,function(x){return bindOnceP($scope,x)}),$q.all(promises).then(function(){var item,key,options,value,_i,_len,_ref1;for(options={},_i=0,_len=params.length;_len>_i;_i++)item=params[_i],_ref1=_.map(item.split("="),trim),key=_ref1[0],value=_ref1[1],options[key]=$scope.$eval(value);return[name,options]})},link=function($scope,$el,$attrs){return $el.is("a")&&$el.attr("href","#"),$el.on("mouseenter",function(event){var target;return target=$(event.currentTarget),target.data("fullUrl")?void 0:parseNav($attrs.tgNav,$scope).then(function(result){var fullUrl,name,options,url,user;return name=result[0],options=result[1],user=$auth.getUser(),user&&(options.user=user.username),url=$navurls.resolve(name),fullUrl=$navurls.formatUrl(url,options),target.data("fullUrl",fullUrl),target.is("a")&&target.attr("href",fullUrl),$el.on("click",function(event){if(event.preventDefault(),target=$(event.currentTarget),!target.hasClass("noclick"))switch(fullUrl=target.data("fullUrl"),event.which){case 1:return $location.url(fullUrl),$scope.$apply();case 2:return window.open(fullUrl)}})})}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgNav",["$tgNavUrls","$tgAuth","$q","$tgLocation",NavigationUrlsDirective])}.call(this),function(){var RepositoryService,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,RepositoryService=function(_super){function RepositoryService(_at_q,_at_model,_at_storage,_at_http,_at_urls){this.q=_at_q,this.model=_at_model,this.storage=_at_storage,this.http=_at_http,this.urls=_at_urls,RepositoryService.__super__.constructor.call(this)}return __extends(RepositoryService,_super),RepositoryService.$inject=["$q","$tgModel","$tgStorage","$tgHttp","$tgUrls"],RepositoryService.prototype.resolveUrlForModel=function(model){var idAttrName;return idAttrName=model.getIdAttrName(),this.urls.resolve(model.getName())+"/"+model[idAttrName]},RepositoryService.prototype.resolveUrlForAttributeModel=function(model){return this.urls.resolve(model.getName(),model.parent)},RepositoryService.prototype.create=function(name,data,dataTypes,extraParams){var defered,promise,url;return null==dataTypes&&(dataTypes={}),null==extraParams&&(extraParams={}),defered=this.q.defer(),url=this.urls.resolve(name),promise=this.http.post(url,JSON.stringify(data)),promise.success(function(_this){return function(_data){return defered.resolve(_this.model.make_model(name,_data,null,dataTypes))}}(this)),promise.error(function(){return function(data){return defered.reject(data)}}(this)),defered.promise},RepositoryService.prototype.remove=function(model,params){var defered,promise,url;return null==params&&(params={}),defered=this.q.defer(),url=this.resolveUrlForModel(model),promise=this.http["delete"](url,{},params),promise.success(function(){return defered.resolve(model)}),promise.error(function(){return defered.reject(model)}),defered.promise},RepositoryService.prototype.saveAll=function(models,patch){var promises;return null==patch&&(patch=!0),promises=_.map(models,function(_this){return function(x){return _this.save(x,!0)}}(this)),this.q.all(promises)},RepositoryService.prototype.save=function(model,patch){var data,defered,promise,url;return null==patch&&(patch=!0),defered=this.q.defer(),!model.isModified()&&patch?(defered.resolve(model),defered.promise):(url=this.resolveUrlForModel(model),data=JSON.stringify(model.getAttrs(patch)),promise=patch?this.http.patch(url,data):this.http.put(url,data),promise.success(function(){return function(data){return model._isModified=!1,model._attrs=_.extend(model.getAttrs(),data),model._modifiedAttrs={},model.applyCasts(),defered.resolve(model)}}(this)),promise.error(function(data){return defered.reject(data)}),defered.promise)},RepositoryService.prototype.saveAttribute=function(model,attribute,patch){var data,defered,promise,url;return null==patch&&(patch=!0),defered=this.q.defer(),!model.isModified()&&patch?(defered.resolve(model),defered.promise):(url=this.resolveUrlForAttributeModel(model),data={},data[attribute]=model.getAttrs(),promise=patch?this.http.patch(url,data):this.http.put(url,data),promise.success(function(){return function(data){return model._isModified=!1,model._attrs=_.extend(model.getAttrs(),data),model._modifiedAttrs={},model.applyCasts(),defered.resolve(model)}}(this)),promise.error(function(data){return defered.reject(data)}),defered.promise)},RepositoryService.prototype.refresh=function(model){var defered,promise,url;return defered=this.q.defer(),url=this.resolveUrlForModel(model),promise=this.http.get(url),promise.success(function(data){return model._modifiedAttrs={},model._attrs=data,model._isModified=!1,model.applyCasts(),defered.resolve(model)}),promise.error(function(data){return defered.reject(data)}),defered.promise},RepositoryService.prototype.queryMany=function(name,params,options){var httpOptions,url;return null==options&&(options={}),url=this.urls.resolve(name),httpOptions={headers:{}},options.enablePagination||(httpOptions.headers["x-disable-pagination"]="1"),this.http.get(url,params,httpOptions).then(function(_this){return function(data){return _.map(data.data,function(x){return _this.model.make_model(name,x)})}}(this))},RepositoryService.prototype.queryOneAttribute=function(name,id,attribute,params,options){var httpOptions,url;return null==options&&(options={}),url=this.urls.resolve(name,id),httpOptions={headers:{}},options.enablePagination||(httpOptions.headers["x-disable-pagination"]="1"),this.http.get(url,params,httpOptions).then(function(_this){return function(data){var model;return model=_this.model.make_model(name,data.data[attribute]),model.parent=id,model}}(this))},RepositoryService.prototype.queryOne=function(name,id,params,options){var httpOptions,url;return null==options&&(options={}),url=this.urls.resolve(name),id&&(url=url+"/"+id),httpOptions={headers:{}},options.enablePagination||(httpOptions.headers["x-disable-pagination"]="1"),this.http.get(url,params,httpOptions).then(function(_this){return function(data){return _this.model.make_model(name,data.data)}}(this))},RepositoryService.prototype.queryOneRaw=function(name,id,params,options){var httpOptions,url;return null==options&&(options={}),url=this.urls.resolve(name),id&&(url=url+"/"+id),httpOptions=_.merge({headers:{}},options),options.enablePagination||(httpOptions.headers["x-disable-pagination"]="1"),this.http.get(url,params,httpOptions).then(function(){return function(data){return data.data}}(this))},RepositoryService.prototype.queryPaginated=function(name,params,options){var httpOptions,url;return null==options&&(options={}),url=this.urls.resolve(name),httpOptions=_.merge({headers:{}},options),this.http.get(url,params,httpOptions).then(function(_this){return function(data){var headers,result;return headers=data.headers(),result={},result.models=_.map(data.data,function(x){return _this.model.make_model(name,x)}),result.count=parseInt(headers["x-pagination-count"],10),result.current=parseInt(headers["x-pagination-current"]||1,10),result.paginatedBy=parseInt(headers["x-paginated-by"],10),result}}(this))},RepositoryService.prototype.resolve=function(options){var cache,params;return params={},null!=options.pslug&&(params.project=options.pslug),null!=options.usref&&(params.us=options.usref),null!=options.taskref&&(params.task=options.taskref),null!=options.issueref&&(params.issue=options.issueref),null!=options.sslug&&(params.milestone=options.sslug),null!=options.wikipage&&(params.wikipage=options.wikipage),cache=!(options.wikipage||options.sslug),this.queryOneRaw("resolver",null,params,{cache:cache})},RepositoryService}(taiga.Service),module=angular.module("taigaBase"),module.service("$tgRepo",RepositoryService)}.call(this),function(){var StorageService,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,StorageService=function(_super){function StorageService(){StorageService.__super__.constructor.call(this)}return __extends(StorageService,_super),StorageService.$inject=["$rootScope"],StorageService.prototype.get=function(key,_default){var serializedValue;return serializedValue=localStorage.getItem(key),null===serializedValue?_default||null:JSON.parse(serializedValue)},StorageService.prototype.set=function(key,val){return _.isObject(key)?_.each(key,function(_this){return function(val,key){return _this.set(key,val)}}(this)):localStorage.setItem(key,JSON.stringify(val))},StorageService.prototype.contains=function(key){var value;return value=this.get(key),null!==value},StorageService.prototype.remove=function(key){return localStorage.removeItem(key)},StorageService.prototype.clear=function(){return localStorage.clear()},StorageService}(taiga.Service),module=angular.module("taigaBase"),module.service("$tgStorage",StorageService)}.call(this),function(){var UrlsService,format,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;format=function(fmt,obj){return obj=_.clone(obj),fmt.replace(/%s/g,function(){return String(obj.shift())})},taiga=this.taiga,UrlsService=function(_super){function UrlsService(_at_config){this.config=_at_config,this.urls={},this.mainUrl=this.config.get("api")}return __extends(UrlsService,_super),UrlsService.$inject=["$tgConfig"],UrlsService.prototype.update=function(urls){return this.urls=_.merge(this.urls,urls)},UrlsService.prototype.resolve=function(){var args,name,url;if(args=_.toArray(arguments),0===args.length)throw Error("wrong arguments to setUrls");return name=args.slice(0,1)[0],url=format(this.urls[name],args.slice(1)),format("%s/%s",[_.str.rtrim(this.mainUrl,"/"),_.str.ltrim(url,"/")])},UrlsService}(taiga.Service),module=angular.module("taigaBase"),module.service("$tgUrls",UrlsService)}.call(this),function(){var module,resourceProvider,sizeFormat,taiga;taiga=this.taiga,sizeFormat=this.taiga.sizeFormat,resourceProvider=function($rootScope,$config,$urls,$model,$repo,$auth,$q){var service;return service={},service.list=function(urlName,objectId,projectId){var params;return params={object_id:objectId,project:projectId},$repo.queryMany(urlName,params)},service.create=function(urlName,projectId,objectId,file){var data,defered,maxFileSize,response,uploadComplete,uploadFailed,uploadProgress,xhr;return defered=$q.defer(),void 0===file?(defered.reject(null),defered.promise):(maxFileSize=$config.get("maxUploadFileSize",null),maxFileSize&&file.size>maxFileSize?(response={status:413,data:{_error_message:"'"+file.name+"' ("+sizeFormat(file.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+sizeFormat(maxFileSize)+")"}},defered.reject(response),defered.promise):(uploadProgress=function(){return function(evt){return $rootScope.$apply(function(){return file.status="in-progress",file.size=sizeFormat(evt.total),file.progressMessage="upload "+sizeFormat(evt.loaded)+" of "+sizeFormat(evt.total),file.progressPercent=Math.round(evt.loaded/evt.total*100)+"%"})}}(this),uploadComplete=function(){return function(evt){return $rootScope.$apply(function(){var data,model;file.status="done";try{data=JSON.parse(evt.target.responseText)}catch(_error){data={}}return model=$model.make_model(urlName,data),defered.resolve(model)})}}(this),uploadFailed=function(){return function(){return $rootScope.$apply(function(){return file.status="error",defered.reject("fail")})}}(this),data=new FormData,data.append("project",projectId),data.append("object_id",objectId),data.append("attached_file",file),xhr=new XMLHttpRequest,xhr.upload.addEventListener("progress",uploadProgress,!1),xhr.addEventListener("load",uploadComplete,!1),xhr.addEventListener("error",uploadFailed,!1),xhr.open("POST",$urls.resolve(urlName)),xhr.setRequestHeader("Authorization","Bearer "+$auth.getToken()),xhr.setRequestHeader("Accept","application/json"),xhr.send(data),defered.promise))},function(instance){return instance.attachments=service}},module=angular.module("taigaResources"),module.factory("$tgAttachmentsResourcesProvider",["$rootScope","$tgConfig","$tgUrls","$tgModel","$tgRepo","$tgAuth","$q",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo,$http,$urls){var service;return service={},service.get=function(type,objectId){return $repo.queryOneRaw("history/"+type,objectId)},service.deleteComment=function(type,objectId,activityId){var params,url;return url=$urls.resolve("history/"+type),url=url+"/"+objectId+"/delete_comment",params={id:activityId},$http.post(url,null,params).then(function(){return function(data){return data.data}}(this))},service.undeleteComment=function(type,objectId,activityId){var params,url;return url=$urls.resolve("history/"+type),url=url+"/"+objectId+"/undelete_comment",params={id:activityId},$http.post(url,null,params).then(function(){return function(data){return data.data}}(this))},function(instance){return instance.history=service}},module=angular.module("taigaResources"),module.factory("$tgHistoryResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo){var service;return service={},service.get=function(token){return $repo.queryOne("invitations",token)},function(instance){return instance.invitations=service}},module=angular.module("taigaResources"),module.factory("$tgInvitationsResourcesProvider",["$tgRepo",resourceProvider])}.call(this),function(){var generateHash,module,resourceProvider,taiga;taiga=this.taiga,generateHash=taiga.generateHash,resourceProvider=function($repo,$http,$urls,$storage,$q){var filtersHashSuffix,hashSuffix,myFiltersHashSuffix,service;return service={},hashSuffix="issues-queryparams",filtersHashSuffix="issues-filters",myFiltersHashSuffix="issues-my-filters",service.get=function(projectId,issueId){var params;return params=service.getQueryParams(projectId),params.project=projectId,$repo.queryOne("issues",issueId,params)},service.getByRef=function(projectId,ref){var params;return params=service.getQueryParams(projectId),params.project=projectId,params.ref=ref,$repo.queryOne("issues","by_ref",params)},service.list=function(projectId,filters,options){var params;return params={project:projectId},params=_.extend({},params,filters||{}),service.storeQueryParams(projectId,params),$repo.queryPaginated("issues",params,options)},service.bulkCreate=function(projectId,data){var params,url;return url=$urls.resolve("bulk-create-issues"),params={project_id:projectId,bulk_issues:data},$http.post(url,params)},service.stats=function(projectId){return $repo.queryOneRaw("projects",projectId+"/issues_stats")},service.filtersData=function(projectId){return $repo.queryOneRaw("projects",projectId+"/issue_filters_data")},service.listValues=function(projectId,type){var params;return params={project:projectId},service.storeQueryParams(projectId,params),$repo.queryMany(type,params)},service.storeQueryParams=function(projectId,params){var hash,ns;return ns=projectId+":"+hashSuffix,hash=generateHash([projectId,ns]),$storage.set(hash,params)},service.getQueryParams=function(projectId){var hash,ns;return ns=projectId+":"+hashSuffix,hash=generateHash([projectId,ns]),$storage.get(hash)||{}},service.storeFilters=function(projectSlug,params){var hash,ns;return ns=projectSlug+":"+filtersHashSuffix,hash=generateHash([projectSlug,ns]),$storage.set(hash,params)},service.getFilters=function(projectSlug){var hash,ns;return ns=projectSlug+":"+filtersHashSuffix,hash=generateHash([projectSlug,ns]),$storage.get(hash)||{}},service.storeMyFilters=function(projectId,myFilters){var deferred,hash,ns,promise,url;return deferred=$q.defer(),url=$urls.resolve("user-storage"),ns=projectId+":"+myFiltersHashSuffix,hash=generateHash([projectId,ns]),_.isEmpty(myFilters)?(promise=$http["delete"](url+"/"+hash,{key:hash,value:myFilters}),promise.then(function(){return deferred.resolve()}),promise.then(null,function(){return deferred.reject()})):(promise=$http.put(url+"/"+hash,{key:hash,value:myFilters}),promise.then(function(){return deferred.resolve()}),promise.then(null,function(){var innerPromise;return innerPromise=$http.post(""+url,{key:hash,value:myFilters}),innerPromise.then(function(){return deferred.resolve()}),innerPromise.then(null,function(){return deferred.reject()})})),deferred.promise},service.getMyFilters=function(projectId){var deferred,hash,ns,promise,url;return deferred=$q.defer(),url=$urls.resolve("user-storage"),ns=projectId+":"+myFiltersHashSuffix,hash=generateHash([projectId,ns]),promise=$http.get(url+"/"+hash),promise.then(function(data){return deferred.resolve(data.data.value)}),promise.then(null,function(){return deferred.resolve({})}),deferred.promise},function(instance){return instance.issues=service}},module=angular.module("taigaResources"),module.factory("$tgIssuesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls","$tgStorage","$q",resourceProvider])}.call(this),function(){var generateHash,module,resourceProvider,taiga;taiga=this.taiga,generateHash=taiga.generateHash,resourceProvider=function($storage){var hashSuffixStatusColumnModes,hashSuffixStatusViewModes,service;return service={},hashSuffixStatusViewModes="kanban-statusviewmodels",hashSuffixStatusColumnModes="kanban-statuscolumnmodels",service.storeStatusViewModes=function(projectId,params){var hash,ns;return ns=projectId+":"+hashSuffixStatusViewModes,hash=generateHash([projectId,ns]),$storage.set(hash,params)},service.getStatusViewModes=function(projectId){var hash,ns;return ns=projectId+":"+hashSuffixStatusViewModes,hash=generateHash([projectId,ns]),$storage.get(hash)||{}},service.storeStatusColumnModes=function(projectId,params){var hash,ns;return ns=projectId+":"+hashSuffixStatusColumnModes,hash=generateHash([projectId,ns]),$storage.set(hash,params)},service.getStatusColumnModes=function(projectId){var hash,ns;return ns=projectId+":"+hashSuffixStatusColumnModes,hash=generateHash([projectId,ns]),$storage.get(hash)||{}},function(instance){return instance.kanban=service}},module=angular.module("taigaResources"),module.factory("$tgKanbanResourcesProvider",["$tgStorage",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo,$urls,$http){var service;return service={},service.render=function(projectId,content){var params,url;return(null==content||""===content)&&(content=" "),params={project_id:projectId,content:content},url=$urls.resolve("wiki"),$http.post(url+"/render",params).then(function(){return function(data){return data.data }}(this))},function(instance){return instance.mdrender=service}},module=angular.module("taigaResources"),module.factory("$tgMdRenderResourcesProvider",["$tgRepo","$tgUrls","$tgHttp",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo,$http,$urls){var service;return service={},service.get=function(id){return $repo.queryOne("memberships",id)},service.list=function(projectId,filters,enablePagination){var options,params;return null==enablePagination&&(enablePagination=!0),params={project:projectId},params=_.extend({},params,filters||{}),enablePagination?$repo.queryPaginated("memberships",params):$repo.queryMany("memberships",params,options={enablePagination:enablePagination})},service.listByUser=function(userId,filters){var params;return params={user:userId},params=_.extend({},params,filters||{}),$repo.queryPaginated("memberships",params)},service.resendInvitation=function(id){var url;return url=$urls.resolve("memberships"),$http.post(url+"/"+id+"/resend_invitation",{})},service.bulkCreateMemberships=function(projectId,data,invitation_extra_text){var params,url;return url=$urls.resolve("bulk-create-memberships"),params={project_id:projectId,bulk_memberships:data,invitation_extra_text:invitation_extra_text},$http.post(url,params)},function(instance){return instance.memberships=service}},module=angular.module("taigaResources"),module.factory("$tgMembershipsResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",resourceProvider])}.call(this),function(){var module,resourceProvider;resourceProvider=function($repo){var service;return service={},service.list=function(projectId,module){return $repo.queryOneAttribute("project-modules",projectId,module)},function(instance){return instance.modules=service}},module=angular.module("taigaResources"),module.factory("$tgModulesResourcesProvider",["$tgRepo",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo){var service;return service={},service.get=function(id){return $repo.queryOne("notify-policies",id)},service.list=function(filters){var params;return params=_.extend({},params,filters||{}),$repo.queryMany("notify-policies",params)},function(instance){return instance.notifyPolicies=service}},module=angular.module("taigaResources"),module.factory("$tgNotifyPoliciesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",resourceProvider])}.call(this),function(){var module,resourceProvider,sizeFormat,taiga;taiga=this.taiga,sizeFormat=this.taiga.sizeFormat,resourceProvider=function($config,$repo,$http,$urls,$auth,$q){var service;return service={},service.get=function(projectId){return $repo.queryOne("projects",projectId)},service.getBySlug=function(projectSlug){return $repo.queryOne("projects","by_slug?slug="+projectSlug)},service.list=function(){return $repo.queryMany("projects")},service.templates=function(){return $repo.queryMany("project-templates")},service.usersList=function(projectId){var params;return params={project:projectId},$repo.queryMany("users",params)},service.rolesList=function(projectId){var params;return params={project:projectId},$repo.queryMany("roles",params)},service.stats=function(projectId){return $repo.queryOneRaw("projects",projectId+"/stats")},service.leave=function(projectId){var url;return url=$urls.resolve("projects")+"/"+projectId+"/leave",$http.post(url)},service.memberStats=function(projectId){return $repo.queryOneRaw("projects",projectId+"/member_stats")},service.tagsColors=function(projectId){return $repo.queryOne("projects",projectId+"/tags_colors")},service["export"]=function(projectId){var url;return url=$urls.resolve("exporter")+"/"+projectId,$http.get(url)},service["import"]=function(file,statusUpdater){var complete,data,defered,failed,maxFileSize,response,uploadComplete,uploadFailed,uploadProgress,xhr;return defered=$q.defer(),maxFileSize=$config.get("maxUploadFileSize",null),maxFileSize&&file.size>maxFileSize?(response={status:413,data:{_error_message:"'"+file.name+"' ("+sizeFormat(file.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+sizeFormat(maxFileSize)+")"}},defered.reject(response),defered.promise):(uploadProgress=function(){return function(evt){var message,percent;return percent=Math.round(evt.loaded/evt.total*100),message="Uloaded "+sizeFormat(evt.loaded)+" of "+sizeFormat(evt.total),statusUpdater("in-progress",null,message,percent)}}(this),uploadComplete=function(){return function(){return statusUpdater("done","Importing Project","This process can take a while, please keep the window open.")}}(this),uploadFailed=function(){return function(){return statusUpdater("error")}}(this),complete=function(){return function(evt){var _ref;response={};try{response.data=JSON.parse(evt.target.responseText)}catch(_error){response.data={}}return response.status=evt.target.status,(201===(_ref=response.status)||202===_ref)&&defered.resolve(response),defered.reject(response)}}(this),failed=function(){return function(){return defered.reject("fail")}}(this),data=new FormData,data.append("dump",file),xhr=new XMLHttpRequest,xhr.upload.addEventListener("progress",uploadProgress,!1),xhr.upload.addEventListener("load",uploadComplete,!1),xhr.upload.addEventListener("error",uploadFailed,!1),xhr.upload.addEventListener("abort",uploadFailed,!1),xhr.addEventListener("load",complete,!1),xhr.addEventListener("error",failed,!1),xhr.open("POST",$urls.resolve("importer")),xhr.setRequestHeader("Authorization","Bearer "+$auth.getToken()),xhr.setRequestHeader("Accept","application/json"),xhr.send(data),defered.promise)},function(instance){return instance.projects=service}},module=angular.module("taigaResources"),module.factory("$tgProjectsResourcesProvider",["$tgConfig","$tgRepo","$tgHttp","$tgUrls","$tgAuth","$q",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo){var service;return service={},service.get=function(id){return $repo.queryOne("roles",id)},service.list=function(projectId){return $repo.queryMany("roles",{project:projectId})},function(instance){return instance.roles=service}},module=angular.module("taigaResources"),module.factory("$tgRolesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo,$urls,$http){var service;return service={},service["do"]=function(projectId,term){var params,url;return url=$urls.resolve("search"),params={project:projectId,text:term,get_all:!1},$http.get(url,params).then(function(data){return data.data})},function(instance){return instance.search=service}},module=angular.module("taigaResources"),module.factory("$tgSearchResourcesProvider",["$tgRepo","$tgUrls","$tgHttp",resourceProvider])}.call(this),function(){var generateHash,module,resourceProvider,taiga;taiga=this.taiga,generateHash=taiga.generateHash,resourceProvider=function($repo,$model,$storage){var hashSuffixUserstories,service;return service={},hashSuffixUserstories="userstories-queryparams",service.get=function(projectId,sprintId){return $repo.queryOne("milestones",sprintId).then(function(sprint){var uses;return service.storeUserstoriesQueryParams(projectId,{milestone:sprintId}),uses=sprint.user_stories,uses=_.map(uses,function(u){return $model.make_model("userstories",u)}),sprint._attrs.user_stories=uses,sprint})},service.stats=function(projectId,sprintId){return $repo.queryOneRaw("milestones",sprintId+"/stats")},service.list=function(projectId,filters){var params;return params={project:projectId},params=_.extend({},params,filters||{}),$repo.queryMany("milestones",params).then(function(){return function(milestones){var m,uses,_i,_len;for(_i=0,_len=milestones.length;_len>_i;_i++)m=milestones[_i],uses=m.user_stories,uses=_.map(uses,function(u){return $model.make_model("userstories",u)}),m._attrs.user_stories=uses;return milestones}}(this))},service.storeUserstoriesQueryParams=function(projectId,params){var hash,ns;return ns=projectId+":"+hashSuffixUserstories,hash=generateHash([projectId,ns]),$storage.set(hash,params)},function(instance){return instance.sprints=service}},module=angular.module("taigaResources"),module.factory("$tgSprintsResourcesProvider",["$tgRepo","$tgModel","$tgStorage",resourceProvider])}.call(this),function(){var generateHash,module,resourceProvider,taiga;taiga=this.taiga,generateHash=taiga.generateHash,resourceProvider=function($repo,$http,$urls,$storage){var hashSuffix,hashSuffixStatusColumnModes,hashSuffixUsRowModes,service;return service={},hashSuffix="tasks-queryparams",hashSuffixStatusColumnModes="tasks-statuscolumnmodels",hashSuffixUsRowModes="tasks-usrowmodels",service.get=function(projectId,taskId){var params;return params=service.getQueryParams(projectId),params.project=projectId,$repo.queryOne("tasks",taskId,params)},service.getByRef=function(projectId,ref){var params;return params=service.getQueryParams(projectId),params.project=projectId,params.ref=ref,$repo.queryOne("tasks","by_ref",params)},service.list=function(projectId,sprintId,userStoryId){var params;return null==sprintId&&(sprintId=null),null==userStoryId&&(userStoryId=null),params={project:projectId},sprintId&&(params.milestone=sprintId),userStoryId&&(params.user_story=userStoryId),service.storeQueryParams(projectId,params),$repo.queryMany("tasks",params)},service.bulkCreate=function(projectId,sprintId,usId,data){var params,url;return url=$urls.resolve("bulk-create-tasks"),params={project_id:projectId,sprint_id:sprintId,us_id:usId,bulk_tasks:data},$http.post(url,params).then(function(result){return result.data})},service.bulkUpdateTaskTaskboardOrder=function(projectId,data){var params,url;return url=$urls.resolve("bulk-update-task-taskboard-order"),params={project_id:projectId,bulk_tasks:data},$http.post(url,params)},service.listValues=function(projectId,type){var params;return params={project:projectId},$repo.queryMany(type,params)},service.storeQueryParams=function(projectId,params){var hash,ns;return ns=projectId+":"+hashSuffix,hash=generateHash([projectId,ns]),$storage.set(hash,params)},service.getQueryParams=function(projectId){var hash,ns;return ns=projectId+":"+hashSuffix,hash=generateHash([projectId,ns]),$storage.get(hash)||{}},service.storeStatusColumnModes=function(projectId,params){var hash,ns;return ns=projectId+":"+hashSuffixStatusColumnModes,hash=generateHash([projectId,ns]),$storage.set(hash,params)},service.getStatusColumnModes=function(projectId){var hash,ns;return ns=projectId+":"+hashSuffixStatusColumnModes,hash=generateHash([projectId,ns]),$storage.get(hash)||{}},service.storeUsRowModes=function(projectId,sprintId,params){var hash,ns;return ns=projectId+":"+hashSuffixUsRowModes,hash=generateHash([projectId,sprintId,ns]),$storage.set(hash,params)},service.getUsRowModes=function(projectId,sprintId){var hash,ns;return ns=projectId+":"+hashSuffixUsRowModes,hash=generateHash([projectId,sprintId,ns]),$storage.get(hash)||{}},function(instance){return instance.tasks=service}},module=angular.module("taigaResources"),module.factory("$tgTasksResourcesProvider",["$tgRepo","$tgHttp","$tgUrls","$tgStorage",resourceProvider])}.call(this),function(){var module,resourceProvider,sizeFormat,taiga;taiga=this.taiga,sizeFormat=this.taiga.sizeFormat,resourceProvider=function($config,$repo,$http,$urls,$q){var service;return service={},service.changeAvatar=function(file){var data,defered,maxFileSize,options,response,url;return maxFileSize=$config.get("maxUploadFileSize",null),maxFileSize&&file.size>maxFileSize?(response={status:413,data:{_error_message:"'"+file.name+"' ("+sizeFormat(file.size)+") is too heavy for our oompa loompas, try it with a smaller than ("+sizeFormat(maxFileSize)+")"}},defered=$q.defer(),defered.reject(response),defered.promise):(data=new FormData,data.append("avatar",file),options={transformRequest:angular.identity,headers:{"Content-Type":void 0}},url=$urls.resolve("users")+"/change_avatar",$http.post(url,data,{},options))},service.removeAvatar=function(){var url;return url=$urls.resolve("users")+"/remove_avatar",$http.post(url)},service.changePassword=function(currentPassword,newPassword){var data,url;return url=$urls.resolve("users")+"/change_password",data={current_password:currentPassword,password:newPassword},$http.post(url,data)},function(instance){return instance.userSettings=service}},module=angular.module("taigaResources"),module.factory("$tgUserSettingsResourcesProvider",["$tgConfig","$tgRepo","$tgHttp","$tgUrls","$q",resourceProvider])}.call(this),function(){var generateHash,module,resourceProvider,taiga;taiga=this.taiga,generateHash=taiga.generateHash,resourceProvider=function($repo,$http,$urls,$storage){var hashSuffix,service;return service={},hashSuffix="userstories-queryparams",service.get=function(projectId,usId){var params;return params=service.getQueryParams(projectId),params.project=projectId,$repo.queryOne("userstories",usId,params)},service.getByRef=function(projectId,ref){var params;return params=service.getQueryParams(projectId),params.project=projectId,params.ref=ref,$repo.queryOne("userstories","by_ref",params)},service.listUnassigned=function(projectId,filters){var params;return params={project:projectId,milestone:"null"},params=_.extend({},params,filters||{}),service.storeQueryParams(projectId,params),$repo.queryMany("userstories",params)},service.listAll=function(projectId,filters){var params;return params={project:projectId},params=_.extend({},params,filters||{}),service.storeQueryParams(projectId,params),$repo.queryMany("userstories",params)},service.bulkCreate=function(projectId,status,bulk){var data,url;return data={project_id:projectId,status_id:status,bulk_stories:bulk},url=$urls.resolve("bulk-create-us"),$http.post(url,data)},service.bulkUpdateBacklogOrder=function(projectId,data){var params,url;return url=$urls.resolve("bulk-update-us-backlog-order"),params={project_id:projectId,bulk_stories:data},$http.post(url,params)},service.bulkUpdateSprintOrder=function(projectId,data){var params,url;return url=$urls.resolve("bulk-update-us-sprint-order"),params={project_id:projectId,bulk_stories:data},$http.post(url,params)},service.bulkUpdateKanbanOrder=function(projectId,data){var params,url;return url=$urls.resolve("bulk-update-us-kanban-order"),params={project_id:projectId,bulk_stories:data},$http.post(url,params)},service.listValues=function(projectId,type){var params;return params={project:projectId},service.storeQueryParams(projectId,params),$repo.queryMany(type,params)},service.storeQueryParams=function(projectId,params){var hash,ns;return ns=projectId+":"+hashSuffix,hash=generateHash([projectId,ns]),$storage.set(hash,params)},service.getQueryParams=function(projectId){var hash,ns;return ns=projectId+":"+hashSuffix,hash=generateHash([projectId,ns]),$storage.get(hash)||{}},service.storeShowTags=function(projectId,showTags){var hash;return hash=generateHash([projectId,"showTags"]),$storage.set(hash,showTags)},service.getShowTags=function(projectId){var hash;return hash=generateHash([projectId,"showTags"]),$storage.get(hash)||null},function(instance){return instance.userstories=service}},module=angular.module("taigaResources"),module.factory("$tgUserstoriesResourcesProvider",["$tgRepo","$tgHttp","$tgUrls","$tgStorage",resourceProvider])}.call(this),function(){var module,resourceProvider;resourceProvider=function($repo,$urls,$http){var service;return service={},service.list=function(webhookId){var params;return params={webhook:webhookId},$repo.queryMany("webhooklogs",params)},service.resend=function(webhooklogId){var url;return url=$urls.resolve("webhooklogs-resend",webhooklogId),$http.post(url)},function(instance){return instance.webhooklogs=service}},module=angular.module("taigaResources"),module.factory("$tgWebhookLogsResourcesProvider",["$tgRepo","$tgUrls","$tgHttp",resourceProvider])}.call(this),function(){var module,resourceProvider;resourceProvider=function($repo,$urls,$http){var service;return service={},service.list=function(projectId){var params;return params={project:projectId},$repo.queryMany("webhooks",params)},service.test=function(webhookId){var url;return url=$urls.resolve("webhooks-test",webhookId),$http.post(url)},function(instance){return instance.webhooks=service}},module=angular.module("taigaResources"),module.factory("$tgWebhooksResourcesProvider",["$tgRepo","$tgUrls","$tgHttp",resourceProvider])}.call(this),function(){var module,resourceProvider,taiga;taiga=this.taiga,resourceProvider=function($repo){var service;return service={},service.get=function(wikiId){return $repo.queryOne("wiki",wikiId)},service.getBySlug=function(projectId,slug){return $repo.queryOne("wiki","by_slug?project="+projectId+"&slug="+slug)},service.listLinks=function(projectId){return $repo.queryMany("wiki-links",{project:projectId})},function(instance){return instance.wiki=service}},module=angular.module("taigaResources"),module.factory("$tgWikiResourcesProvider",["$tgRepo","$tgHttp","$tgUrls",resourceProvider])}.call(this),function(){var UserChangePasswordController,UserChangePasswordDirective,debounce,mixOf,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,debounce=this.taiga.debounce,module=angular.module("taigaUserSettings"),UserChangePasswordController=function(_super){function UserChangePasswordController(_at_scope,_at_rootscope,_at_repo,_at_confirm,_at_rs,_at_params,_at_q,_at_location,_at_navUrls,_at_auth){var promise;this.scope=_at_scope,this.rootscope=_at_rootscope,this.repo=_at_repo,this.confirm=_at_confirm,this.rs=_at_rs,this.params=_at_params,this.q=_at_q,this.location=_at_location,this.navUrls=_at_navUrls,this.auth=_at_auth,this.scope.sectionName="Change Password",this.scope.project={},this.scope.user=this.auth.getUser(),promise=this.loadInitialData(),promise.then(null,this.onInitialDataError.bind(this))}return __extends(UserChangePasswordController,_super),UserChangePasswordController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth"],UserChangePasswordController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},UserChangePasswordController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this))},UserChangePasswordController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("UserChangePasswordController",UserChangePasswordController),UserChangePasswordDirective=function($rs,$confirm,$loading){var link;return link=function($scope,$el){var submit,submitButton;return submit=debounce(2e3,function(){return function(event){var promise;return event.preventDefault(),$scope.newPassword1!==$scope.newPassword2?void $confirm.notify("error","The passwords dosn't match"):($loading.start(submitButton),promise=$rs.userSettings.changePassword($scope.currentPassword,$scope.newPassword1),promise.then(function(){return $loading.finish(submitButton),$confirm.notify("success")}),promise.then(null,function(response){return $loading.finish(submitButton),$confirm.notify("error",response.data._error_message)}))}}(this)),submitButton=$el.find(".submit-button"),$el.on("submit","form",submit),$el.on("click",".submit-button",submit),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgUserChangePassword",["$tgResources","$tgConfirm","$tgLoading",UserChangePasswordDirective])}.call(this),function(){var DeleteUserDirective,bindOnce,debounce,module,taiga;taiga=this.taiga,bindOnce=this.taiga.bindOnce,debounce=this.taiga.debounce,module=angular.module("taigaUserSettings"),DeleteUserDirective=function($repo,$rootscope,$auth,$location,$navUrls,lightboxService){var link;return link=function($scope,$el){var submit;return $scope.$on("deletelightbox:new",function(){return lightboxService.open($el)}),$scope.$on("$destroy",function(){return $el.off()}),submit=function(){var promise;return promise=$repo.remove($scope.user),promise.then(function(){return lightboxService.close($el),$auth.logout(),$location.path($navUrls.resolve("login"))}),promise.then(null,function(){return console.log("FAIL")})},$el.on("click",".button-red",function(event){return event.preventDefault(),lightboxService.close($el)}),$el.on("click",".button-green",debounce(2e3,function(event){return event.preventDefault(),submit()}))},{link:link,templateUrl:"user/lightbox/lightbox-delete-account.html"}},module.directive("tgLbDeleteUser",["$tgRepo","$rootScope","$tgAuth","$tgLocation","$tgNavUrls","lightboxService",DeleteUserDirective])}.call(this),function(){var TaigaAvatarModelDirective,UserAvatarDirective,UserProfileDirective,UserSettingsController,debounce,mixOf,module,sizeFormat,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,sizeFormat=this.taiga.sizeFormat,module=angular.module("taigaUserSettings"),debounce=this.taiga.debounce,UserSettingsController=function(_super){function UserSettingsController(_at_scope,_at_rootscope,_at_config,_at_repo,_at_confirm,_at_rs,_at_params,_at_q,_at_location,_at_navUrls,_at_auth){var maxFileSize,promise;this.scope=_at_scope,this.rootscope=_at_rootscope,this.config=_at_config,this.repo=_at_repo,this.confirm=_at_confirm,this.rs=_at_rs,this.params=_at_params,this.q=_at_q,this.location=_at_location,this.navUrls=_at_navUrls,this.auth=_at_auth,this.scope.sectionName="User Profile",this.scope.project={},this.scope.user=this.auth.getUser(),maxFileSize=this.config.get("maxUploadFileSize",null),maxFileSize&&(this.scope.maxFileSizeMsg="[Max, size: "+sizeFormat(maxFileSize)),promise=this.loadInitialData(),promise.then(null,this.onInitialDataError.bind(this))}return __extends(UserSettingsController,_super),UserSettingsController.$inject=["$scope","$rootScope","$tgConfig","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth"],UserSettingsController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},UserSettingsController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this))},UserSettingsController.prototype.openDeleteLightbox=function(){return this.rootscope.$broadcast("deletelightbox:new",this.scope.user)},UserSettingsController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("UserSettingsController",UserSettingsController),UserProfileDirective=function($confirm,$auth,$repo){var link;return link=function($scope,$el){var submit;return submit=debounce(2e3,function(){return function(event){var changeEmail,form,onError,onSuccess;return event.preventDefault(),form=$el.find("form").checksley(),form.validate()?(changeEmail=$scope.user.isAttributeModified("email"),onSuccess=function(){return $auth.setUser($scope.user),changeEmail?$confirm.success("Check your inbox!
We have sent a mail to your account
with the instructions to set your new address"):$confirm.notify("success")},onError=function(data){return form.setErrors(data),$confirm.notify("error",data._error_message)},$repo.save($scope.user).then(onSuccess,onError)):void 0}}(this)),$el.on("submit","form",submit),$el.on("click",".submit-button",submit),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgUserProfile",["$tgConfirm","$tgAuth","$tgRepo",UserProfileDirective]),UserAvatarDirective=function($auth,$model,$rs,$confirm){var link;return link=function($scope,$el){var onError,onSuccess,showSizeInfo;return showSizeInfo=function(){return $el.find(".size-info").removeClass("hidden")},onSuccess=function(response){var user;return user=$model.make_model("users",response.data),$auth.setUser(user),$scope.user=user,$el.find(".overlay").hide(),$confirm.notify("success")},onError=function(response){return 413===response.status&&showSizeInfo(),$el.find(".overlay").hide(),$confirm.notify("error",response.data._error_message)},$el.on("click",".button.change",function(){return $el.find("#avatar-field").click()}),$el.on("change","#avatar-field",function(){return $scope.avatarAttachment?($el.find(".overlay").css("display","flex"),$rs.userSettings.changeAvatar($scope.avatarAttachment).then(onSuccess,onError)):void 0}),$el.on("click","a.use-gravatar",function(){return $el.find(".overlay").show(),$rs.userSettings.removeAvatar().then(onSuccess,onError)}),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgUserAvatar",["$tgAuth","$tgModel","$tgResources","$tgConfirm",UserAvatarDirective]),TaigaAvatarModelDirective=function($parse){var link;return link=function($scope,$el,$attrs){var model,modelSetter;return model=$parse($attrs.tgAvatarModel),modelSetter=model.assign,$el.bind("change",function(){return $scope.$apply(function(){return modelSetter($scope,$el[0].files[0])})})},{link:link}},module.directive("tgAvatarModel",["$parse",TaigaAvatarModelDirective])}.call(this),function(){var UserSettingsNavigationDirective,module;UserSettingsNavigationDirective=function(){var link;return link=function($scope,$el,$attrs){var section;return section=$attrs.tgUserSettingsNavigation,$el.find(".active").removeClass("active"),$el.find("#usersettingsmenu-"+section+" a").addClass("active"),$scope.$on("$destroy",function(){return $el.off()})},{link:link}},module=angular.module("taigaUserSettings"),module.directive("tgUserSettingsNavigation",UserSettingsNavigationDirective)}.call(this),function(){var UserNotificationsController,UserNotificationsDirective,UserNotificationsListDirective,bindOnce,mixOf,module,taiga,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},__hasProp={}.hasOwnProperty;taiga=this.taiga,mixOf=this.taiga.mixOf,bindOnce=this.taiga.bindOnce,module=angular.module("taigaUserSettings"),UserNotificationsController=function(_super){function UserNotificationsController(_at_scope,_at_rootscope,_at_repo,_at_confirm,_at_rs,_at_params,_at_q,_at_location,_at_navUrls,_at_auth){var promise;this.scope=_at_scope,this.rootscope=_at_rootscope,this.repo=_at_repo,this.confirm=_at_confirm,this.rs=_at_rs,this.params=_at_params,this.q=_at_q,this.location=_at_location,this.navUrls=_at_navUrls,this.auth=_at_auth,this.scope.sectionName="Email Notifications",this.scope.project={},this.scope.user=this.auth.getUser(),promise=this.loadInitialData(),promise.then(null,this.onInitialDataError.bind(this))}return __extends(UserNotificationsController,_super),UserNotificationsController.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$tgNavUrls","$tgAuth"],UserNotificationsController.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(_this){return function(project){return _this.scope.project=project,_this.scope.$emit("project:loaded",project),project}}(this))},UserNotificationsController.prototype.loadNotifyPolicies=function(){return this.rs.notifyPolicies.list().then(function(_this){return function(notifyPolicies){return _this.scope.notifyPolicies=notifyPolicies,notifyPolicies}}(this))},UserNotificationsController.prototype.loadInitialData=function(){var promise;return promise=this.repo.resolve({pslug:this.params.pslug}).then(function(_this){return function(data){return _this.scope.projectId=data.project,data}}(this)),promise.then(function(_this){return function(){return _this.loadProject()}}(this)).then(function(_this){return function(){return _this.loadNotifyPolicies()}}(this))},UserNotificationsController}(mixOf(taiga.Controller,taiga.PageMixin)),module.controller("UserNotificationsController",UserNotificationsController),UserNotificationsDirective=function(){var link;return link=function($scope,$el){return $scope.$on("$destroy",function(){return $el.off()})},{link:link}},module.directive("tgUserNotifications",UserNotificationsDirective),UserNotificationsListDirective=function($repo,$confirm){var link,template;return template=_.template('<% _.each(notifyPolicies, function (notifyPolicy, index) { %>\n
\n
<%- notifyPolicy.project_name %>
\n
\n
\n checked="checked"<% } %>/>\n \n
\n
\n
\n
\n checked="checked"<% } %> />\n \n
\n
\n
\n
\n checked="checked"<% } %> />\n \n
\n
\n
\n<% }) %>'),link=function($scope,$el,$attrs){var render;return render=function(){return $el.off(),$el.html(template({notifyPolicies:$scope.notifyPolicies})),$el.on("change","input[type=radio]",function(event){var onError,onSuccess,policy,policyIndex,prev_level,target;return target=angular.element(event.currentTarget),policyIndex=target.parents(".policy-table-row").data("index"),policy=$scope.notifyPolicies[policyIndex],prev_level=policy.notify_level,policy.notify_level=parseInt(target.val(),10),onSuccess=function(){return $confirm.notify("success")},onError=function(){return $confirm.notify("error"),target.parents(".policy-table-row").find("input[value="+prev_level+"]").prop("checked",!0)},$repo.save(policy).then(onSuccess,onError)})},$scope.$on("$destroy",function(){return $el.off()}),bindOnce($scope,$attrs.ngModel,render)},{link:link}},module.directive("tgUserNotificationsList",["$tgRepo","$tgConfirm",UserNotificationsListDirective])}.call(this),function(){var AUTH_URL,GithubLoginButtonDirective,module,taiga;taiga=this.taiga,module=angular.module("taigaIntegrations"),AUTH_URL="https://github.com/login/oauth/authorize",GithubLoginButtonDirective=function($window,$params,$location,$config,$events,$confirm,$auth,$navUrls,$loader){var link,template;return template='
\n \n Login with Github\n',link=function($scope,$el){var clientId,loginOnError,loginOnSuccess,loginWithGitHubAccount,renderGitHubButton; return(clientId=$config.get("gitHubClientId",null))?(renderGitHubButton=function(){return clientId?$el.html(template):void 0},loginOnSuccess=function(){var nextUrl;return nextUrl=$params.next&&$params.next!==$navUrls.resolve("login")?$params.next:$navUrls.resolve("home"),$events.setupConnection(),$location.search("next",null),$location.search("token",null),$location.search("state",null),$location.search("code",null),$location.path(nextUrl)},loginOnError=function(response){return $location.search("state",null),$location.search("code",null),$loader.pageLoaded(),response.data.error_message?$confirm.notify("light-error",response.data.error_message):$confirm.notify("light-error","Our Oompa Loompas have not been able to get you credentials from GitHub.")},loginWithGitHubAccount=function(){var code,data,token,type;return type=$params.state,code=$params.code,token=$params.token,"github"===type&&code?($loader.start(),data={code:code,token:token},$auth.login(data,type).then(loginOnSuccess,loginOnError)):void 0},renderGitHubButton(),loginWithGitHubAccount(),$el.on("click",".button-github",function(){var redirectToUri,url;return redirectToUri=$location.absUrl(),url=AUTH_URL+"?client_id="+clientId+"&redirect_uri="+redirectToUri+"&state=github&scope=user:email",$window.location.href=url}),$scope.$on("$destroy",function(){return $el.off()})):void 0},{link:link,restrict:"EA",template:""}},module.directive("tgGithubLoginButton",["$window","$routeParams","$tgLocation","$tgConfig","$tgEvents","$tgConfirm","$tgAuth","$tgNavUrls","tgLoader",GithubLoginButtonDirective])}.call(this),function(){var configure,module,taiga;taiga=this.taiga,module=angular.module("taigaPlugins",["ngRoute"]),configure=function($routeProvider){return $routeProvider.when("/humans.html",{templateUrl:"/plugins/humanshtml/templates/humans.html"})},module.config(["$routeProvider",configure])}.call(this),function(){var TermsNoticeDirective,module,taiga,template;taiga=this.taiga,module=angular.module("taigaPlugins",["ngRoute"]),template=_.template('

\n By clicking "Sign up", you agree to our
\n terms of service\n and\n privacy policy.\n

'),TermsNoticeDirective=function($config){var privacyPolicyUrl,templateFn,termsOfServiceUrl;return privacyPolicyUrl=$config.get("privacyPolicyUrl"),termsOfServiceUrl=$config.get("termsOfServiceUrl"),templateFn=function(){var ctx;return privacyPolicyUrl&&termsOfServiceUrl?(ctx={termsUrl:termsOfServiceUrl,privacyUrl:privacyPolicyUrl},template(ctx)):""},{scope:{},restrict:"AE",template:templateFn}},module.directive("tgTermsNotice",["$tgConfig",TermsNoticeDirective])}.call(this),function(){var module;module=angular.module("taigaPlugins",["ngRoute"])}.call(this),angular.module("taigaBase").value("localesEn",{checksley:{defaultMessage:"This value seems to be invalid.","type-email":"This value should be a valid email.","type-url":"This value should be a valid url.","type-urlstrict":"This value should be a valid url.","type-number":"This value should be a valid number.","type-digits":"This value should be digits.","type-dateIso":"This value should be a valid date (YYYY-MM-DD).","type-alphanum":"This value should be alphanumeric.","type-phone":"This value should be a valid phone number.",notnull:"This value should not be null.",notblank:"This value should not be blank.",required:"This value is required.",regexp:"This value seems to be invalid.",min:"This value should be greater than or equal to %s.",max:"This value should be lower than or equal to %s.",range:"This value should be between %s and %s.",minlength:"This value is too short. It should have %s characters or more.",maxlength:"This value is too long. It should have %s characters or less.",rangelength:"This value length is invalid. It should be between %s and %s characters long.",mincheck:"You must select at least %s choices.",maxcheck:"You must select %s choices or less.",rangecheck:"You must select between %s and %s choices.",equalto:"This value should be the same."},common:{subject:"Subject",save:"Save",blocked:"Blocked",cancel:"Cancel",status:"Status","new-bulk":"New bulk insert","one-item-line":"One item per line..."},pagination:{next:"Next",prev:"Previous"},"markdown-editor":{"heading-1":"First Level Heading","heading-2":"Second Level Heading","heading-3":"Third Level Heading",bold:"Bold",italic:"Italic",strike:"Strike","bulleted-list":"Bulleted List","numeric-list":"Numeric List",picture:"Picture",link:"Link",quotes:"Quotes","code-block":"Code Block / Code",preview:"Preview",help:"Help",placeholder:"Your title here...","link-placeholder":"Your text to link here..."},us:{"title-new":"New User Story","team-requirement":"Team Requirement","client-requirement":"Client Requirement"}}); //# sourceMappingURL=app.js.map \ No newline at end of file diff --git a/dist/js/app.js.map b/dist/js/app.js.map index db0888c..22f942d 100644 --- a/dist/js/app.js.map +++ b/dist/js/app.js.map @@ -1 +1 @@ -{"version":3,"sources":["app.js","locales.en.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpgrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"app.js","sourcesContent":["\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, init, module, modules, taiga;\n\n this.taiga = taiga = {};\n\n this.taigaContribPlugins = this.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, tgLoaderProvider) {\n var authHttpIntercept, defaultHeaders, versionCheckHttpIntercept;\n $routeProvider.when(\"/\", {\n templateUrl: \"project/projects.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/\", {\n templateUrl: \"project/project.html\"\n });\n $routeProvider.when(\"/project/:pslug/backlog\", {\n templateUrl: \"backlog/backlog.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/taskboard/:sslug\", {\n templateUrl: \"taskboard/taskboard.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/search\", {\n templateUrl: \"search/search.html\",\n reloadOnSearch: false\n });\n $routeProvider.when(\"/project/:pslug/kanban\", {\n templateUrl: \"kanban/kanban.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/us/:usref\", {\n templateUrl: \"us/us-detail.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/task/:taskref\", {\n templateUrl: \"task/task-detail.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\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/:slug\", {\n templateUrl: \"wiki/wiki.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/team\", {\n templateUrl: \"team/team.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/issues\", {\n templateUrl: \"issue/issues.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/issue/:issueref\", {\n templateUrl: \"issue/issues-detail.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/details\", {\n templateUrl: \"admin/admin-project-profile.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/default-values\", {\n templateUrl: \"admin/admin-project-default-values.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/modules\", {\n templateUrl: \"admin/admin-project-modules.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/export\", {\n templateUrl: \"admin/admin-project-export.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/us-status\", {\n templateUrl: \"admin/admin-project-values-us-status.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/us-points\", {\n templateUrl: \"admin/admin-project-values-us-points.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/task-status\", {\n templateUrl: \"admin/admin-project-values-task-status.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/issue-status\", {\n templateUrl: \"admin/admin-project-values-issue-status.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/issue-types\", {\n templateUrl: \"admin/admin-project-values-issue-types.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/issue-priorities\", {\n templateUrl: \"admin/admin-project-values-issue-priorities.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/issue-severities\", {\n templateUrl: \"admin/admin-project-values-issue-severities.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/memberships\", {\n templateUrl: \"admin/admin-memberships.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/roles\", {\n templateUrl: \"admin/admin-roles.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/webhooks\", {\n templateUrl: \"admin/admin-third-parties-webhooks.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/github\", {\n templateUrl: \"admin/admin-third-parties-github.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/gitlab\", {\n templateUrl: \"admin/admin-third-parties-gitlab.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/bitbucket\", {\n templateUrl: \"admin/admin-third-parties-bitbucket.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/contrib/:plugin\", {\n templateUrl: \"contrib/main.html\"\n });\n $routeProvider.when(\"/project/:pslug/user-settings/user-profile\", {\n templateUrl: \"user/user-profile.html\"\n });\n $routeProvider.when(\"/project/:pslug/user-settings/user-change-password\", {\n templateUrl: \"user/user-change-password.html\"\n });\n $routeProvider.when(\"/project/:pslug/user-settings/user-avatar\", {\n templateUrl: \"user/user-avatar.html\"\n });\n $routeProvider.when(\"/project/:pslug/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(\"/login\", {\n templateUrl: \"auth/login.html\"\n });\n $routeProvider.when(\"/register\", {\n templateUrl: \"auth/register.html\"\n });\n $routeProvider.when(\"/forgot-password\", {\n templateUrl: \"auth/forgot-password.html\"\n });\n $routeProvider.when(\"/change-password\", {\n templateUrl: \"auth/change-password-from-recovery.html\"\n });\n $routeProvider.when(\"/change-password/:token\", {\n templateUrl: \"auth/change-password-from-recovery.html\"\n });\n $routeProvider.when(\"/invitation/:token\", {\n templateUrl: \"auth/invitation.html\"\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 redirectTo: '/not-found'\n });\n $locationProvider.html5Mode({\n enabled: true,\n requireBase: false\n });\n defaultHeaders = {\n \"Content-Type\": \"application/json\",\n \"Accept-Language\": \"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 $tgEventsProvider.setSessionId(taiga.sessionId);\n authHttpIntercept = function($q, $location, $navUrls, $lightboxService) {\n var httpResponseError;\n httpResponseError = function(response) {\n var nextPath;\n if (response.status === 0) {\n $lightboxService.closeAll();\n $location.path($navUrls.resolve(\"error\"));\n $location.replace();\n } else if (response.status === 401) {\n nextPath = $location.path();\n $location.url($navUrls.resolve(\"login\")).search(\"next=\" + nextPath);\n }\n return $q.reject(response);\n };\n return {\n responseError: httpResponseError\n };\n };\n $provide.factory(\"authHttpIntercept\", [\"$q\", \"$location\", \"$tgNavUrls\", \"lightboxService\", authHttpIntercept]);\n $httpProvider.interceptors.push('authHttpIntercept');\n versionCheckHttpIntercept = function($q, $confirm) {\n var httpResponseError, versionErrorMsg;\n versionErrorMsg = \"Someone inside Taiga has changed this before and our Oompa Loompas cannot apply your changes. Please reload and apply your changes again (they will be lost).\";\n httpResponseError = function(response) {\n if (response.status === 400 && response.data.version) {\n $confirm.notify(\"error\", versionErrorMsg, null, 10000);\n return $q.reject(response);\n }\n return $q.reject(response);\n };\n return {\n responseError: httpResponseError\n };\n };\n $provide.factory(\"versionCheckHttpIntercept\", [\"$q\", \"$tgConfirm\", versionCheckHttpIntercept]);\n $httpProvider.interceptors.push('versionCheckHttpIntercept');\n window.checksley.updateValidators({\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 });\n return window.checksley.updateMessages(\"default\", {\n linewidth: \"The subject must have a maximum size of %s\"\n });\n };\n\n init = function($log, $i18n, $config, $rootscope, $auth, $events, $analytics) {\n $i18n.initialize($config.get(\"defaultLanguage\"));\n $log.debug(\"Initialize application\");\n $rootscope.contribPlugins = this.taigaContribPlugins;\n if ($auth.isAuthenticated()) {\n $events.setupConnection();\n }\n return $analytics.initialize();\n };\n\n modules = [\"taigaBase\", \"taigaCommon\", \"taigaResources\", \"taigaLocales\", \"taigaAuth\", \"taigaEvents\", \"taigaRelatedTasks\", \"taigaBacklog\", \"taigaTaskboard\", \"taigaKanban\", \"taigaIssues\", \"taigaUserStories\", \"taigaTasks\", \"taigaTeam\", \"taigaWiki\", \"taigaSearch\", \"taigaAdmin\", \"taigaNavMenu\", \"taigaProject\", \"taigaUserSettings\", \"taigaFeedback\", \"taigaPlugins\", \"taigaIntegrations\", \"templates\", \"ngRoute\", \"ngAnimate\"].concat(_.map(this.taigaContribPlugins, function(plugin) {\n return plugin.module;\n }));\n\n module = angular.module(\"taiga\", modules);\n\n module.config([\"$routeProvider\", \"$locationProvider\", \"$httpProvider\", \"$provide\", \"$tgEventsProvider\", \"tgLoaderProvider\", configure]);\n\n module.run([\"$log\", \"$tgI18n\", \"$tgConfig\", \"$rootScope\", \"$tgAuth\", \"$tgEvents\", \"$tgAnalytics\", init]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 __extends = 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(_super) {\n __extends(TaigaService, _super);\n\n function TaigaService() {\n return TaigaService.__super__.constructor.apply(this, arguments);\n }\n\n return TaigaService;\n\n })(TaigaBase);\n\n TaigaController = (function(_super) {\n __extends(TaigaController, _super);\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.location.path(this.navUrls.resolve(\"not-found\"));\n this.location.replace();\n } else if (xhr.status === 403) {\n this.location.path(this.navUrls.resolve(\"permission-denied\"));\n this.location.replace();\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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 bindMethods, bindOnce, cancelTimeout, debounce, debounceLeading, groupBy, joinStr, mixOf, nl2br, scopeDefer, sizeFormat, slugify, startswith, taiga, timeout, toString, toggleText, trim, 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 __extends = 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 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) {\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, method, mixin, mixins, name, _i, _ref;\n base = arguments[0], mixins = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n Mixed = (function(_super) {\n __extends(Mixed, _super);\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 _.str.trim(data, char);\n };\n\n slugify = function(data) {\n return _.str.slugify(data);\n };\n\n unslugify = function(data) {\n if (data) {\n return _.str.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 item, result, _i, _len;\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 _.str.join(str, coll);\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 _.str.startsWith(str1, str2);\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 taiga = this.taiga;\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.debounce = debounce;\n\n taiga.debounceLeading = debounceLeading;\n\n taiga.startswith = startswith;\n\n taiga.sizeFormat = sizeFormat;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, 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, availableRoles;\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 availableRoles = _(this.scope.project.memberships).map(\"role\").uniq().value();\n return this.scope.computableRoles = _(roles).filter(\"computable\").filter(function(x) {\n return _.contains(availableRoles, 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 location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n };\n\n FiltersMixin.prototype.replaceFilter = function(name, value, 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(name, value);\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 return FiltersMixin;\n\n })();\n\n taiga.FiltersMixin = FiltersMixin;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, PublicRegisterMessageDirective, RegisterDirective, debounce, module, taiga,\n __extends = 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 AuthService = (function(_super) {\n __extends(AuthService, _super);\n\n AuthService.$inject = [\"$rootScope\", \"$tgStorage\", \"$tgModel\", \"$tgResources\", \"$tgHttp\", \"$tgUrls\"];\n\n function AuthService(_at_rootscope, _at_storage, _at_model, _at_rs, _at_http, _at_urls) {\n this.rootscope = _at_rootscope;\n this.storage = _at_storage;\n this.model = _at_model;\n this.rs = _at_rs;\n this.http = _at_http;\n this.urls = _at_urls;\n AuthService.__super__.constructor.call(this);\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 return user;\n }\n return null;\n };\n\n AuthService.prototype.setUser = function(user) {\n this.rootscope.auth = user;\n this.rootscope.$broadcast(\"i18n:change\", user.default_language);\n this.storage.set(\"userInfo\", user.getAttrs());\n return this.rootscope.user = user;\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.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 return this.clear();\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, templates) {\n var template, templateFn;\n template = templates.get(\"auth/login-text.html\", true);\n templateFn = function() {\n var publicRegisterEnabled;\n publicRegisterEnabled = $config.get(\"publicRegisterEnabled\");\n if (!publicRegisterEnabled) {\n return \"\";\n }\n return template({\n url: $navUrls.resolve(\"register\")\n });\n };\n return {\n restrict: \"AE\",\n scope: {},\n template: templateFn\n };\n };\n\n module.directive(\"tgPublicRegisterMessage\", [\"$tgConfig\", \"$tgNavUrls\", \"$tgTemplate\", PublicRegisterMessageDirective]);\n\n LoginDirective = function($auth, $confirm, $location, $config, $routeParams, $navUrls, $events) {\n var link;\n link = function($scope, $el, $attrs) {\n var onError, onSuccess, submit;\n onSuccess = function(response) {\n var nextUrl;\n if ($routeParams['next'] && $routeParams['next'] !== $navUrls.resolve(\"login\")) {\n nextUrl = $routeParams['next'];\n } else {\n nextUrl = $navUrls.resolve(\"home\");\n }\n $events.setupConnection();\n return $location.path(nextUrl);\n };\n onError = function(response) {\n return $confirm.notify(\"light-error\", \"According to our Oompa Loompas, your username/email or password are incorrect.\");\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var data, form, promise;\n event.preventDefault();\n form = new checksley.Form($el.find(\"form.login-form\"));\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 promise = $auth.login(data);\n return promise.then(onSuccess, onError);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLogin\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgConfig\", \"$routeParams\", \"$tgNavUrls\", \"$tgEvents\", LoginDirective]);\n\n RegisterDirective = function($auth, $confirm, $location, $navUrls, $config, $analytics) {\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 onSuccessSubmit = function(response) {\n $analytics.trackEvent(\"auth\", \"register\", \"user registration\", 1);\n $confirm.notify(\"success\", \"Our Oompa Loompas are happy, welcome to Taiga.\");\n return $location.path($navUrls.resolve(\"home\"));\n };\n onErrorSubmit = function(response) {\n if (response.data._error_message != null) {\n $confirm.notify(\"light-error\", \"According to our Oompa Loompas there was an error. \" + response.data._error_message);\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 return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRegister\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfig\", \"$tgAnalytics\", RegisterDirective]);\n\n ForgotPasswordDirective = function($auth, $confirm, $location, $navUrls) {\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 $location.path($navUrls.resolve(\"login\"));\n return $confirm.success(\"Check your inbox!
We have sent a mail to
\" + response.data.email + \"
with the instructions to set a new password\");\n };\n onErrorSubmit = function(response) {\n return $confirm.notify(\"light-error\", \"According to our Oompa Loompas, your are not registered yet.\");\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 return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgForgotPassword\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgNavUrls\", ForgotPasswordDirective]);\n\n ChangePasswordFromRecoveryDirective = function($auth, $confirm, $location, $params, $navUrls) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n if ($params.token != null) {\n $scope.tokenInParams = true;\n $scope.data.token = $params.token;\n } else {\n $scope.tokenInParams = false;\n }\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n $location.path($navUrls.resolve(\"login\"));\n return $confirm.success(\"Our Oompa Loompas saved your new password.
Try to sign in with it.\");\n };\n onErrorSubmit = function(response) {\n return $confirm.notify(\"light-error\", \"One of our Oompa Loompas say '\" + response.data._error_message + \"'.\");\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 $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgChangePasswordFromRecovery\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", ChangePasswordFromRecoveryDirective]);\n\n InvitationDirective = function($auth, $confirm, $location, $params, $navUrls, $analytics) {\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 return $scope.invitation = invitation;\n });\n promise.then(null, function(response) {\n $location.path($navUrls.resolve(\"login\"));\n return $confirm.success(\"Ooops, we have a problem
Our Oompa Loompas can't find your invitation.\");\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 $analytics.trackEvent(\"auth\", \"invitationAccept\", \"invitation accept with existing 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 onErrorSubmitLogin = function(response) {\n return $confirm.notify(\"light-error\", \"According to our Oompa Loompas, your are not registered yet or typed an invalid password.\");\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 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 return $confirm.notify(\"light-error\", \"According to our Oompa Loompas, that username or email is already in use.\");\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 return $el.on(\"click\", \".button-register\", submitRegister);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgInvitation\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$tgAnalytics\", InvitationDirective]);\n\n ChangeEmailDirective = 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.email_token = $params.email_token;\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n return $repo.queryOne(\"users\", $auth.getUser().id).then((function(_this) {\n return function(data) {\n $auth.setUser(data);\n $location.path($navUrls.resolve(\"home\"));\n return $confirm.success(\"Our Oompa Loompas updated your email\");\n };\n })(this));\n };\n onErrorSubmit = function(response) {\n return $confirm.notify(\"error\", \"One of our Oompa Loompas says '\" + response.data._error_message + \"'.\");\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 return $el.on(\"click\", \"a.button-change-email\", function(event) {\n event.preventDefault();\n return submit();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgChangeEmail\", [\"$tgRepo\", \"$tgModel\", \"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", 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 $auth.logout();\n $location.path($navUrls.resolve(\"home\"));\n return $confirm.success(\"Our Oompa Loompas removed your account\");\n };\n onErrorSubmit = function(response) {\n return $confirm.notify(\"error\", \"One of our Oompa Loompas says '\" + response.data._error_message + \"'.\");\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 $el.on(\"click\", \".submit-button\", submit);\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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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\", [\"taigaLocales\"]);\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 \"error\": \"/error\",\n \"not-found\": \"/not-found\",\n \"permission-denied\": \"/permission-denied\",\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\": \"/:user\",\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-search\": \"/project/:project/search\",\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-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-values-us-status\": \"/project/:project/admin/project-values/us-status\",\n \"project-admin-project-values-us-points\": \"/project/:project/admin/project-values/us-points\",\n \"project-admin-project-values-task-status\": \"/project/:project/admin/project-values/task-status\",\n \"project-admin-project-values-issue-status\": \"/project/:project/admin/project-values/issue-status\",\n \"project-admin-project-values-issue-types\": \"/project/:project/admin/project-values/issue-types\",\n \"project-admin-project-values-issue-priorities\": \"/project/:project/admin/project-values/issue-priorities\",\n \"project-admin-project-values-issue-severities\": \"/project/:project/admin/project-values/issue-severities\",\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-contrib\": \"/project/:project/admin/contrib/:plugin\",\n \"user-settings-user-profile\": \"/project/:project/user-settings/user-profile\",\n \"user-settings-user-change-password\": \"/project/:project/user-settings/user-change-password\",\n \"user-settings-user-avatar\": \"/project/:project/user-settings/user-avatar\",\n \"user-settings-mail-notifications\": \"/project/:project/user-settings/mail-notifications\"\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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, AppTitle, CheckPermissionDirective, LimitLineLengthDirective, ProjectUrl, Qqueue, SelectedText, Template, ToggleCommentDirective, module, taiga,\n __slice = [].slice;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\", []);\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() {\n var link, render;\n render = function($el, project, permission) {\n if (project.my_permissions.indexOf(permission) > -1) {\n return $el.removeClass('hidden');\n }\n };\n link = function($scope, $el, $attrs) {\n var permission;\n $el.addClass('hidden');\n permission = $attrs.tgCheckPermission;\n $scope.$watch(\"project\", function(project) {\n if (project != null) {\n return render($el, project, permission);\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(\"tgCheckPermission\", CheckPermissionDirective);\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 AppTitle = function() {\n var set;\n set = function(text) {\n return $(\"title\").text(text);\n };\n return {\n set: set\n };\n };\n\n module.factory(\"$appTitle\", AppTitle);\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 LimitLineLengthDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var maxColsPerLine;\n maxColsPerLine = parseInt($el.attr(\"cols\"));\n return $el.on(\"keyup\", function(event) {\n var code, lines;\n code = event.keyCode;\n lines = $el.val().split(\"\\n\");\n _.each(lines, function(line, index) {\n return lines[index] = line.substring(0, maxColsPerLine - 2);\n });\n return $el.val(lines.join(\"\\n\"));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLimitLineLength\", LimitLineLengthDirective);\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 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}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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\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(_at_win, _at_log, _at_config, _at_auth) {\n this.win = _at_win;\n this.log = _at_log;\n this.config = _at_config;\n this.auth = _at_auth;\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 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 = _.str.ltrim(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.ws.close();\n return delete this.ws;\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 messages, msg, _i, _len, _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.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 return scope.$on(\"$destroy\", (function(_this) {\n return function() {\n return _this.unsubscribe(routingKey);\n };\n })(this));\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.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 return this.sendMessage(message);\n };\n\n EventsService.prototype.onMessage = function(event) {\n var data, routingKey, subscription;\n this.log.debug(\"WebSocket message received: \" + event.data);\n data = JSON.parse(event.data);\n routingKey = data.routing_key;\n if (this.subscriptions[routingKey] == null) {\n return;\n }\n subscription = this.subscriptions[routingKey];\n return subscription.scope.$apply(function() {\n return subscription.callback(data.data);\n });\n };\n\n EventsService.prototype.onError = function(error) {\n this.log.error(\"WebSocket error: \" + error);\n return this.error = true;\n };\n\n EventsService.prototype.onClose = function() {\n this.log.debug(\"WebSocket closed.\");\n return this.connected = false;\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) {\n var service;\n service = new EventsService($win, $log, $conf, $auth);\n service.initialize(this.sessionId);\n return service;\n };\n\n EventsProvider.prototype.$get.$inject = [\"$window\", \"$log\", \"$tgConfig\", \"$tgAuth\"];\n\n return EventsProvider;\n\n })();\n\n module.provider(\"$tgEvents\", EventsProvider);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley();\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n promise = $repo.create(\"feedback\", $scope.feedback);\n promise.then(function(data) {\n $loading.finish(submitButton);\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 $loading.finish(submitButton);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n $scope.$on(\"feedback:show\", function() {\n $scope.$apply(function() {\n return $scope.feedback = {};\n });\n $lightboxService.open($el);\n return $el.find(\"textarea\").focus();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbFeedback\", [\"lightboxService\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", FeedbackDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/locales.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaLocales\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/nav.coffee\n */\n\n(function() {\n var ProjectMenuDirective, ProjectsNavigationController, ProjectsNavigationDirective, bindOnce, groupBy, module, taiga, timeout,\n __extends = 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 timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaNavMenu\", []);\n\n ProjectsNavigationController = (function(_super) {\n __extends(ProjectsNavigationController, _super);\n\n ProjectsNavigationController.$inject = [\"$scope\", \"$rootScope\", \"$tgResources\", \"$tgNavUrls\", \"$projectUrl\"];\n\n function ProjectsNavigationController(_at_scope, _at_rootscope, _at_rs, _at_navurls, _at_projectUrl) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.rs = _at_rs;\n this.navurls = _at_navurls;\n this.projectUrl = _at_projectUrl;\n promise = this.loadInitialData();\n promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n this.scope.$on(\"projects:reload\", (function(_this) {\n return function() {\n return _this.loadInitialData();\n };\n })(this));\n this.scope.$on(\"project:loaded\", (function(_this) {\n return function(ctx, project) {\n return _this.loadInitialData();\n };\n })(this));\n }\n\n ProjectsNavigationController.prototype.loadInitialData = function() {\n return this.rs.projects.list().then((function(_this) {\n return function(projects) {\n var project, _i, _len;\n for (_i = 0, _len = projects.length; _i < _len; _i++) {\n project = projects[_i];\n project.url = _this.projectUrl.get(project);\n }\n _this.scope.projects = projects;\n _this.scope.filteredProjects = projects;\n _this.scope.filterText = \"\";\n return projects;\n };\n })(this));\n };\n\n ProjectsNavigationController.prototype.newProject = function() {\n return this.scope.$apply((function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"projects:create\");\n };\n })(this));\n };\n\n ProjectsNavigationController.prototype.filterProjects = function(text) {\n this.scope.filteredProjects = _.filter(this.scope.projects, function(project) {\n return project.name.toLowerCase().indexOf(text) > -1;\n });\n this.scope.filterText = text;\n return this.rootscope.$broadcast(\"projects:filtered\");\n };\n\n return ProjectsNavigationController;\n\n })(taiga.Controller);\n\n module.controller(\"ProjectsNavigationController\", ProjectsNavigationController);\n\n ProjectsNavigationDirective = function($rootscope, animationFrame, $timeout, tgLoader, $location, $compile, $template) {\n var baseTemplate, hideMenu, link, loadingStart, overlay, projectsTemplate;\n baseTemplate = $template.get(\"project/project-navigation-base.html\", true);\n projectsTemplate = $template.get(\"project/project-navigation-list.html\", true);\n overlay = $(\".projects-nav-overlay\");\n loadingStart = 0;\n hideMenu = function() {\n var difftime, timeoutValue;\n if (overlay.is(':visible')) {\n difftime = new Date().getTime() - loadingStart;\n timeoutValue = 0;\n if (difftime < 1000) {\n timeoutValue = 1000 - timeoutValue;\n }\n return timeout(timeoutValue, function() {\n overlay.one('transitionend', function() {\n $(document.body).removeClass(\"loading-project open-projects-nav closed-projects-nav\").css(\"overflow-x\", \"visible\");\n return overlay.hide();\n });\n $(document.body).addClass(\"closed-projects-nav\");\n return tgLoader.disablePreventLoading();\n });\n }\n };\n link = function($scope, $el, $attrs, $ctrls) {\n var $ctrl, render, renderProjects;\n $ctrl = $ctrls[0];\n $rootscope.$on(\"project:loaded\", hideMenu);\n renderProjects = function(projects) {\n var html;\n html = projectsTemplate({\n projects: projects\n });\n $el.find(\".projects-list\").html(html);\n return $scope.$emit(\"regenerate:project-pagination\");\n };\n render = function(projects) {\n $el.html($compile(baseTemplate())($scope));\n return renderProjects(projects);\n };\n overlay.on('click', function() {\n return hideMenu();\n });\n $(document).on('keydown', (function(_this) {\n return function(e) {\n var code;\n code = e.keyCode ? e.keyCode : e.which;\n if (code === 27) {\n return hideMenu();\n }\n };\n })(this));\n $scope.$on(\"nav:projects-list:open\", function() {\n if (!$(document.body).hasClass(\"open-projects-nav\")) {\n animationFrame.add((function(_this) {\n return function() {\n return overlay.show();\n };\n })(this));\n }\n return animationFrame.add((function(_this) {\n return function() {\n return $(document.body).css(\"overflow-x\", \"hidden\");\n };\n })(this), (function(_this) {\n return function() {\n return $(document.body).toggleClass(\"open-projects-nav\");\n };\n })(this));\n });\n $el.on(\"click\", \".projects-list > li > a\", function(event) {\n var currentUrl, nextUrl, target;\n target = angular.element(event.currentTarget);\n nextUrl = target.prop(\"href\");\n currentUrl = $location.absUrl();\n if (nextUrl === currentUrl) {\n hideMenu();\n return;\n }\n $(document.body).addClass('loading-project');\n tgLoader.preventLoading();\n return loadingStart = new Date().getTime();\n });\n $el.on(\"click\", \".create-project-button\", function(event) {\n event.preventDefault();\n return $ctrl.newProject();\n });\n $el.on(\"keyup\", \".search-project\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n return $ctrl.filterProjects(target.val());\n });\n $scope.$on(\"projects:filtered\", function() {\n return renderProjects($scope.filteredProjects);\n });\n return $scope.$watch(\"projects\", function(projects) {\n if (projects != null) {\n return render(projects);\n }\n });\n };\n return {\n require: [\"tgProjectsNav\"],\n controller: ProjectsNavigationController,\n link: link\n };\n };\n\n module.directive(\"tgProjectsNav\", [\"$rootScope\", \"animationFrame\", \"$timeout\", \"tgLoader\", \"$tgLocation\", \"$compile\", \"$tgTemplate\", ProjectsNavigationDirective]);\n\n ProjectMenuDirective = function($log, $compile, $auth, $rootscope, $tgAuth, $location, $navUrls, $config, $template) {\n var getSectionName, link, mainTemplate, menuEntriesTemplate, renderMainMenu, renderMenuEntries, videoConferenceUrl;\n menuEntriesTemplate = $template.get(\"project/project-menu.html\", true);\n mainTemplate = _.template(\"
\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n taiga[beta]\\n
\\n
\");\n getSectionName = function($el, sectionName, project) {\n var oldSectionName, _ref;\n oldSectionName = (_ref = $el.find(\"a.active\").parent().attr(\"id\")) != null ? _ref.replace(\"nav-\", \"\") : void 0;\n if (sectionName === \"backlog-kanban\") {\n if (oldSectionName === \"backlog\" || oldSectionName === \"kanban\") {\n sectionName = oldSectionName;\n } else if (project.is_backlog_activated && !project.is_kanban_activated) {\n sectionName = \"backlog\";\n } else if (!project.is_backlog_activated && project.is_kanban_activated) {\n sectionName = \"kanban\";\n }\n }\n return sectionName;\n };\n renderMainMenu = function($el) {\n var html;\n html = mainTemplate({});\n return $el.html(html);\n };\n renderMenuEntries = function($el, targetScope, project) {\n var container, ctx, dom, sectionName;\n if (project == null) {\n project = {};\n }\n container = $el.find(\".menu-container\");\n sectionName = getSectionName($el, targetScope.section, project);\n ctx = {\n user: $auth.getUser(),\n project: project,\n feedbackEnabled: $config.get(\"feedbackEnabled\")\n };\n dom = $compile(menuEntriesTemplate(ctx))(targetScope);\n dom.find(\"a.active\").removeClass(\"active\");\n dom.find(\"#nav-\" + sectionName + \" > a\").addClass(\"active\");\n return container.replaceWith(dom);\n };\n videoConferenceUrl = function(project) {\n var baseUrl, url;\n if (project.videoconferences === \"appear-in\") {\n baseUrl = \"https://appear.in/\";\n } else if (project.videoconferences === \"talky\") {\n baseUrl = \"https://talky.io/\";\n } else {\n return \"\";\n }\n if (project.videoconferences_salt) {\n url = project.slug + \"-\" + project.videoconferences_salt;\n } else {\n url = \"\" + project.slug;\n }\n return baseUrl + url;\n };\n link = function($scope, $el, $attrs, $ctrl) {\n var project;\n renderMainMenu($el);\n project = null;\n $el.on(\"click\", \".logo\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return $rootscope.$broadcast(\"nav:projects-list:open\");\n });\n $el.on(\"click\", \".user-settings .avatar\", function(event) {\n event.preventDefault();\n return $el.find(\".user-settings .popover\").popover().open();\n });\n $el.on(\"click\", \".logout\", function(event) {\n event.preventDefault();\n $auth.logout();\n return $scope.$apply(function() {\n return $location.path($navUrls.resolve(\"login\"));\n });\n });\n $el.on(\"click\", \"#nav-search > a\", function(event) {\n event.preventDefault();\n return $rootscope.$broadcast(\"search-box:show\", project);\n });\n $el.on(\"click\", \".feedback\", function(event) {\n event.preventDefault();\n return $rootscope.$broadcast(\"feedback:show\");\n });\n $scope.$on(\"projects:loaded\", function(listener) {\n $el.addClass(\"hidden\");\n return listener.stopPropagation();\n });\n return $scope.$on(\"project:loaded\", function(ctx, newProject) {\n project = newProject;\n if ($el.hasClass(\"hidden\")) {\n $el.removeClass(\"hidden\");\n }\n project.videoconferenceUrl = videoConferenceUrl(project);\n return renderMenuEntries($el, ctx.targetScope, project);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectMenu\", [\"$log\", \"$compile\", \"$tgAuth\", \"$rootScope\", \"$tgAuth\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfig\", \"$tgTemplate\", ProjectMenuDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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) {\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 promise;\n task.subject = $el.find('input').val();\n $loading.start($el.find('.task-name'));\n promise = $repo.save(task);\n promise.then((function(_this) {\n return function() {\n $loading.finish($el.find('.task-name'));\n $confirm.notify(\"success\");\n return $rootscope.$broadcast(\"related-tasks:update\");\n };\n })(this));\n promise.then(null, (function(_this) {\n return function() {\n $loading.finish($el.find('.task-name'));\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.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\", \".icon-floppy\", 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\", \".icon-edit\", 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 task = $model.$modelValue;\n title = \"Delete Task\";\n message = task.subject;\n return $confirm.askOnDelete(title, message).then(function(finish) {\n var promise;\n promise = $repo.remove(task);\n promise.then(function() {\n finish();\n $confirm.notify(\"success\");\n return $scope.$emit(\"related-tasks:delete\");\n });\n return promise.then(null, function() {\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\", RelatedTaskRowDirective]);\n\n RelatedTaskCreateFormDirective = function($repo, $compile, $confirm, $tgmodel, $loading, $analytics, $template) {\n var link, newTask, template;\n template = $template.get(\"task/related-task-create-form.html\", true);\n newTask = {\n subject: \"\",\n assigned_to: null\n };\n link = function($scope, $el, $attrs) {\n var createTask, render;\n createTask = debounce(2000, function(task) {\n var 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 $loading.start($el.find('.task-name'));\n promise = $repo.create(\"tasks\", task);\n promise.then(function() {\n $analytics.trackEvent(\"task\", \"create\", \"create task on userstory\", 1);\n $loading.finish($el.find('.task-name'));\n $scope.$emit(\"related-tasks:add\");\n return $confirm.notify(\"success\");\n });\n promise.then(null, function() {\n $el.find('input').val(task.subject);\n $loading.finish($el.find('.task-name'));\n return $confirm.notify(\"error\");\n });\n return promise;\n });\n render = function() {\n $el.off();\n $el.html($compile(template())($scope));\n $el.find('input').focus().select();\n $el.addClass('active');\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return createTask(newTask).then(function() {\n return render();\n });\n } else if (event.keyCode === 27) {\n return $el.html(\"\");\n }\n });\n $el.on(\"click\", \".icon-delete\", function(event) {\n return $el.html(\"\");\n });\n return $el.on(\"click\", \".icon-floppy\", function(event) {\n return createTask(newTask).then(function() {\n return $el.html(\"\");\n });\n });\n };\n taiga.bindOnce($scope, \"us\", function(val) {\n newTask[\"status\"] = $scope.project.default_task_status;\n newTask[\"project\"] = $scope.project.id;\n newTask[\"user_story\"] = $scope.us.id;\n $scope.newTask = $tgmodel.make_model(\"tasks\", newTask);\n return $el.html(\"\");\n });\n $scope.$on(\"related-tasks:show-form\", function() {\n return render();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskCreateForm\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$tgModel\", \"$tgLoading\", \"$tgAnalytics\", \"$tgTemplate\", RelatedTaskCreateFormDirective]);\n\n RelatedTaskCreateButtonDirective = function($repo, $compile, $confirm, $tgmodel) {\n var link, template;\n template = _.template(\"\");\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(template());\n } else {\n $el.html(\"\");\n }\n return $el.on(\"click\", \".icon\", 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\", RelatedTaskCreateButtonDirective]);\n\n RelatedTasksDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var loadTasks;\n loadTasks = function() {\n return $rs.tasks.list($scope.projectId, null, $scope.usId).then((function(_this) {\n return function(tasks) {\n $scope.tasks = tasks;\n return tasks;\n };\n })(this));\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, popoverService) {\n var link, template;\n template = _.template(\"\\\" alt=\\\"<%- name %>\\\"/>\\n
<%- name %>
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, autoSave, notAutoSave, task, updateRelatedTask;\n updateRelatedTask = function(task) {\n var ctx, member;\n ctx = {\n name: \"Unassigned\",\n imgurl: \"/images/unnamed.png\"\n };\n member = $scope.usersById[task.assigned_to];\n if (member) {\n ctx.imgurl = member.photo;\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 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\", RelatedTaskAssignedToInlineEditionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 __extends = 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(_super) {\n __extends(ResourcesService, _super);\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 \"permissions\": \"/permissions\",\n \"roles\": \"/roles\",\n \"projects\": \"/projects\",\n \"memberships\": \"/memberships\",\n \"notify-policies\": \"/notify-policies\",\n \"bulk-create-memberships\": \"/memberships/bulk_create\",\n \"milestones\": \"/milestones\",\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-sprint-order\": \"/userstories/bulk_update_sprint_order\",\n \"bulk-update-us-kanban-order\": \"/userstories/bulk_update_kanban_order\",\n \"userstories-restore\": \"/userstories/%s/restore\",\n \"tasks\": \"/tasks\",\n \"bulk-create-tasks\": \"/tasks/bulk_create\",\n \"bulk-update-task-taskboard-order\": \"/tasks/bulk_update_taskboard_order\",\n \"tasks-restore\": \"/tasks/%s/restore\",\n \"issues\": \"/issues\",\n \"bulk-create-issues\": \"/issues/bulk_create\",\n \"issues-restore\": \"/issues/%s/restore\",\n \"wiki\": \"/wiki\",\n \"wiki-restore\": \"/wiki/%s/restore\",\n \"wiki-links\": \"/wiki-links\",\n \"choices/userstory-statuses\": \"/userstory-statuses\",\n \"choices/userstory-statuses/bulk-update-order\": \"/userstory-statuses/bulk_update_order\",\n \"choices/points\": \"/points\",\n \"choices/points/bulk-update-order\": \"/points/bulk_update_order\",\n \"choices/task-statuses\": \"/task-statuses\",\n \"choices/task-statuses/bulk-update-order\": \"/task-statuses/bulk_update_order\",\n \"choices/issue-statuses\": \"/issue-statuses\",\n \"choices/issue-statuses/bulk-update-order\": \"/issue-statuses/bulk_update_order\",\n \"choices/issue-types\": \"/issue-types\",\n \"choices/issue-types/bulk-update-order\": \"/issue-types/bulk_update_order\",\n \"choices/priorities\": \"/priorities\",\n \"choices/priorities/bulk-update-order\": \"/priorities/bulk_update_order\",\n \"choices/severities\": \"/severities\",\n \"choices/severities/bulk-update-order\": \"/severities/bulk_update_order\",\n \"search\": \"/search\",\n \"sites\": \"/sites\",\n \"project-templates\": \"/project-templates\",\n \"site-members\": \"/site-members\",\n \"site-projects\": \"/site-projects\",\n \"users\": \"/users\",\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-storage\": \"/user-storage\",\n \"resolver\": \"/resolver\",\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 \"project-modules\": \"/projects/%s/modules\",\n \"webhooks\": \"/webhooks\",\n \"webhooks-test\": \"/webhooks/%s/test\",\n \"webhooklogs\": \"/webhooklogs\",\n \"webhooklogs-resend\": \"/webhooklogs/%s/resend\",\n \"history/us\": \"/history/userstory\",\n \"history/issue\": \"/history/issue\",\n \"history/task\": \"/history/task\",\n \"history/wiki\": \"/history/wiki\",\n \"attachments/us\": \"/userstories/attachments\",\n \"attachments/issue\": \"/issues/attachments\",\n \"attachments/task\": \"/tasks/attachments\",\n \"attachments/wiki_page\": \"/wiki/attachments\",\n \"feedback\": \"/feedback\",\n \"exporter\": \"/exporter\",\n \"importer\": \"/importer/load_dump\"\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 provider, providers, _i, _len, _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\", \"$tgMembershipsResourcesProvider\", \"$tgNotifyPoliciesResourcesProvider\", \"$tgInvitationsResourcesProvider\", \"$tgRolesResourcesProvider\", \"$tgUserSettingsResourcesProvider\", \"$tgSprintsResourcesProvider\", \"$tgUserstoriesResourcesProvider\", \"$tgTasksResourcesProvider\", \"$tgIssuesResourcesProvider\", \"$tgWikiResourcesProvider\", \"$tgSearchResourcesProvider\", \"$tgAttachmentsResourcesProvider\", \"$tgMdRenderResourcesProvider\", \"$tgHistoryResourcesProvider\", \"$tgKanbanResourcesProvider\", \"$tgModulesResourcesProvider\", \"$tgWebhooksResourcesProvider\", \"$tgWebhookLogsResourcesProvider\", initResources]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 __extends = 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(_super) {\n __extends(SearchController, _super);\n\n SearchController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$appTitle\", \"$tgNavUrls\", \"tgLoader\"];\n\n function SearchController(_at_scope, _at_repo, _at_rs, _at_params, _at_q, _at_location, _at_appTitle, _at_navUrls, _at_tgLoader) {\n var loadSearchData, promise;\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.tgLoader = _at_tgLoader;\n this.scope.sectionName = \"Search\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Search\");\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.searchTerm = \"\";\n loadSearchData = debounceLeading(100, (function(_this) {\n return function(t) {\n return _this.loadSearchData(t);\n };\n })(this));\n this.scope.$watch(\"searchTerm\", (function(_this) {\n return function(term) {\n if (!term) {\n return _this.tgLoader.pageLoaded();\n } else {\n return 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.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.membersById = groupBy(project.memberships, function(x) {\n return x.user;\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 var promise;\n promise = this.rs.search[\"do\"](this.scope.projectId, term).then((function(_this) {\n return function(data) {\n _this.scope.searchResults = data;\n return data;\n };\n })(this));\n promise[\"finally\"]((function(_this) {\n return function() {\n return _this.tgLoader.pageLoaded();\n };\n })(this));\n return 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.users, 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($lightboxService, $navurls, $location, $route) {\n var link;\n link = function($scope, $el, $attrs) {\n var 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.slug\n });\n $lightboxService.close($el);\n return $scope.$apply(function() {\n $location.path(url);\n $location.search(\"text\", text).path(url);\n return $route.reload();\n });\n };\n })(this));\n $scope.$on(\"search-box:show\", function(ctx, newProject) {\n project = newProject;\n $lightboxService.open($el);\n return $el.find(\"#search-text\").val(\"\");\n });\n $el.on(\"submit\", \"form\", submit);\n return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSearchBox\", [\"lightboxService\", \"$tgNavUrls\", \"$tgLocation\", \"$route\", SearchBoxDirective]);\n\n SearchDirective = function($log, $compile, $templatecache, $routeparams, $location) {\n var link, linkTable;\n linkTable = function($scope, $el, $attrs, $ctrl) {\n var getActiveSection, lastSeatchResults, markSectionTabActive, renderFilterTabs, renderTableContent, tabsDom, templates;\n tabsDom = $el.find(\"section.search-filter\");\n lastSeatchResults = null;\n getActiveSection = function(data) {\n var maxVal, name, selectedSectionData, selectedSectionName, value;\n maxVal = 0;\n selectedSectionName = null;\n selectedSectionData = null;\n for (name in data) {\n value = data[name];\n if (name === \"count\") {\n continue;\n }\n if (value.length > maxVal) {\n maxVal = value.length;\n selectedSectionName = name;\n selectedSectionData = value;\n }\n }\n if (maxVal === 0) {\n return {\n name: \"userstories\",\n value: []\n };\n }\n return {\n name: selectedSectionName,\n value: selectedSectionData\n };\n };\n renderFilterTabs = function(data) {\n var name, value, _results;\n _results = [];\n for (name in data) {\n value = data[name];\n if (name === \"count\") {\n continue;\n }\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 return tabsDom.find(\"li.\" + section.name + \" a\").addClass(\"active\");\n };\n templates = {\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 lastSeatchResults = data;\n activeSection = getActiveSection(data);\n renderFilterTabs(data);\n renderTableContent(activeSection);\n return markSectionTabActive(activeSection);\n });\n $scope.$watch(\"searchTerm\", function(searchTerm) {\n if (searchTerm) {\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 = lastSeatchResults[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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 __extends = 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(_super) {\n __extends(AnalyticsService, _super);\n\n AnalyticsService.$inject = [\"$rootScope\", \"$log\", \"$tgConfig\", \"$window\", \"$document\", \"$location\"];\n\n function AnalyticsService(_at_rootscope, _at_log, _at_config, _at_win, _at_doc, _at_location) {\n var conf;\n this.rootscope = _at_rootscope;\n this.log = _at_log;\n this.config = _at_config;\n this.win = _at_win;\n this.doc = _at_doc;\n this.location = _at_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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/attachments.coffee\n */\n\n(function() {\n var AttachmentDirective, AttachmentsController, AttachmentsDirective, bindMethods, bindOnce, module, sizeFormat, taiga,\n __extends = 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 sizeFormat = this.taiga.sizeFormat;\n\n bindOnce = this.taiga.bindOnce;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaCommon\");\n\n AttachmentsController = (function(_super) {\n __extends(AttachmentsController, _super);\n\n AttachmentsController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$q\"];\n\n function AttachmentsController(_at_scope, _at_rootscope, _at_repo, _at_rs, _at_confirm, _at_q) {\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.confirm = _at_confirm;\n this.q = _at_q;\n bindMethods(this);\n this.type = null;\n this.objectId = null;\n this.projectId = null;\n this.uploadingAttachments = [];\n this.attachments = [];\n this.attachmentsCount = 0;\n this.deprecatedAttachmentsCount = 0;\n this.showDeprecated = false;\n }\n\n AttachmentsController.prototype.initialize = function(type, objectId) {\n this.type = type;\n this.objectId = objectId;\n return this.projectId = this.scope.projectId;\n };\n\n AttachmentsController.prototype.loadAttachments = function() {\n var urlname;\n if (!this.objectId) {\n return this.attachments;\n }\n urlname = \"attachments/\" + this.type;\n return this.rs.attachments.list(urlname, this.objectId, this.projectId).then((function(_this) {\n return function(attachments) {\n _this.attachments = _.sortBy(attachments, \"order\");\n _this.updateCounters();\n return attachments;\n };\n })(this));\n };\n\n AttachmentsController.prototype.updateCounters = function() {\n this.attachmentsCount = this.attachments.length;\n return this.deprecatedAttachmentsCount = _.filter(this.attachments, {\n is_deprecated: true\n }).length;\n };\n\n AttachmentsController.prototype._createAttachment = function(attachment) {\n var promise, urlName;\n urlName = \"attachments/\" + this.type;\n promise = this.rs.attachments.create(urlName, this.projectId, this.objectId, attachment);\n promise = promise.then((function(_this) {\n return function(data) {\n var index;\n data.isCreatedRightNow = true;\n index = _this.uploadingAttachments.indexOf(attachment);\n _this.uploadingAttachments.splice(index, 1);\n _this.attachments.push(data);\n return _this.rootscope.$broadcast(\"attachment:create\");\n };\n })(this));\n promise = promise.then(null, (function(_this) {\n return function(data) {\n var index;\n if (data.status === 413) {\n _this.scope.$emit(\"attachments:size-error\");\n }\n index = _this.uploadingAttachments.indexOf(attachment);\n _this.uploadingAttachments.splice(index, 1);\n _this.confirm.notify(\"error\", \"We have not been able to upload '\" + attachment.name + \"'. \" + data.data._error_message);\n return _this.q.reject(data);\n };\n })(this));\n return promise;\n };\n\n AttachmentsController.prototype.createAttachments = function(attachments) {\n var promises;\n promises = _.map(attachments, (function(_this) {\n return function(x) {\n return _this._createAttachment(x);\n };\n })(this));\n return this.q.all(promises).then((function(_this) {\n return function() {\n return _this.updateCounters();\n };\n })(this));\n };\n\n AttachmentsController.prototype.addUploadingAttachments = function(attachments) {\n return this.uploadingAttachments = _.union(this.uploadingAttachments, attachments);\n };\n\n AttachmentsController.prototype.reorderAttachment = function(attachment, newIndex) {\n var oldIndex;\n oldIndex = this.attachments.indexOf(attachment);\n if (oldIndex === newIndex) {\n return;\n }\n this.attachments.splice(oldIndex, 1);\n this.attachments.splice(newIndex, 0, attachment);\n return _.each(this.attachments, function(x, i) {\n return x.order = i + 1;\n });\n };\n\n AttachmentsController.prototype.updateAttachment = function(attachment) {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.updateCounters();\n return _this.rootscope.$broadcast(\"attachment:edit\");\n };\n })(this);\n onError = (function(_this) {\n return function(response) {\n if (response.status === 413) {\n $scope.$emit(\"attachments:size-error\");\n }\n _this.confirm.notify(\"error\");\n return _this.q.reject();\n };\n })(this);\n return this.repo.save(attachment).then(onSuccess, onError);\n };\n\n AttachmentsController.prototype.saveAttachments = function() {\n return this.repo.saveAll(this.attachments).then(null, (function(_this) {\n return function() {\n var item, _i, _len, _ref;\n _ref = _this.attachments;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n item = _ref[_i];\n item.revert();\n }\n return _this.attachments = _.sortBy(_this.attachments, \"order\");\n };\n })(this));\n };\n\n AttachmentsController.prototype.removeAttachment = function(attachment) {\n var message, title;\n title = \"Delete attachment\";\n message = \"the attachment '\" + attachment.name + \"'\";\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var onError, onSuccess;\n onSuccess = function() {\n var index;\n finish();\n index = _this.attachments.indexOf(attachment);\n _this.attachments.splice(index, 1);\n _this.updateCounters();\n return _this.rootscope.$broadcast(\"attachment:delete\");\n };\n onError = function() {\n finish(false);\n _this.confirm.notify(\"error\", null, \"We have not been able to delete \" + message + \".\");\n return _this.q.reject();\n };\n return _this.repo.remove(attachment).then(onSuccess, onError);\n };\n })(this));\n };\n\n AttachmentsController.prototype.filterAttachments = function(item) {\n if (this.showDeprecated) {\n return true;\n }\n return !item.is_deprecated;\n };\n\n return AttachmentsController;\n\n })(taiga.Controller);\n\n AttachmentsDirective = function($config, $confirm, $templates) {\n var link, template, templateFn;\n template = $templates.get(\"attachment/attachments.html\", true);\n link = function($scope, $el, $attrs, $ctrls) {\n var $ctrl, $model, showSizeInfo, tdom;\n $ctrl = $ctrls[0];\n $model = $ctrls[1];\n bindOnce($scope, $attrs.ngModel, function(value) {\n $ctrl.initialize($attrs.type, value.id);\n return $ctrl.loadAttachments();\n });\n tdom = $el.find(\"div.attachment-body.sortable\");\n tdom.sortable({\n items: \"div.single-attachment\",\n handle: \"a.settings.icon.icon-drag-v\",\n containment: \".attachments\",\n dropOnEmpty: true,\n scroll: false,\n tolerance: \"pointer\",\n placeholder: \"sortable-placeholder single-attachment\"\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var attachment, newIndex;\n attachment = ui.item.scope().attach;\n newIndex = ui.item.index();\n $ctrl.reorderAttachment(attachment, newIndex);\n return $ctrl.saveAttachments().then(function() {\n return $scope.$emit(\"attachment:edit\");\n });\n });\n showSizeInfo = function() {\n return $el.find(\".size-info\").removeClass(\"hidden\");\n };\n $scope.$on(\"attachments:size-error\", function() {\n return showSizeInfo();\n });\n $el.on(\"change\", \".attachments-header input\", function(event) {\n var files;\n files = _.toArray(event.target.files);\n if (files.length < 1) {\n return;\n }\n return $scope.$apply(function() {\n $ctrl.addUploadingAttachments(files);\n return $ctrl.createAttachments(files);\n });\n });\n $el.on(\"click\", \".more-attachments\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n $scope.$apply(function() {\n return $ctrl.showDeprecated = !$ctrl.showDeprecated;\n });\n target.find(\"span.text\").addClass(\"hidden\");\n if ($ctrl.showDeprecated) {\n target.find(\"span[data-type=hide]\").removeClass(\"hidden\");\n return target.find(\"more-attachments-num\").addClass(\"hidden\");\n } else {\n target.find(\"span[data-type=show]\").removeClass(\"hidden\");\n return target.find(\"more-attachments-num\").removeClass(\"hidden\");\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n templateFn = function($el, $attrs) {\n var ctx, maxFileSize, maxFileSizeMsg;\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize) {\n maxFileSize = sizeFormat(maxFileSize);\n }\n maxFileSizeMsg = maxFileSize ? \"Maximum upload size is \" + maxFileSize : \"\";\n ctx = {\n type: $attrs.type,\n maxFileSize: maxFileSize,\n maxFileSizeMsg: maxFileSizeMsg\n };\n return template(ctx);\n };\n return {\n require: [\"tgAttachments\", \"ngModel\"],\n controller: AttachmentsController,\n controllerAs: \"ctrl\",\n restrict: \"AE\",\n scope: true,\n link: link,\n template: templateFn\n };\n };\n\n module.directive(\"tgAttachments\", [\"$tgConfig\", \"$tgConfirm\", \"$tgTemplate\", AttachmentsDirective]);\n\n AttachmentDirective = function($template) {\n var link, template, templateEdit;\n template = $template.get(\"attachment/attachment.html\", true);\n templateEdit = $template.get(\"attachment/attachment-edit.html\", true);\n link = function($scope, $el, $attrs, $ctrl) {\n var attachment, render, saveAttachment;\n render = function(attachment, edit) {\n var ctx, html, modifyPermission, permissions;\n if (edit == null) {\n edit = false;\n }\n permissions = $scope.project.my_permissions;\n modifyPermission = permissions.indexOf(\"modify_\" + $ctrl.type) > -1;\n ctx = {\n id: attachment.id,\n name: attachment.name,\n created_date: moment(attachment.created_date).format(\"DD MMM YYYY [at] hh:mm\"),\n url: attachment.url,\n size: sizeFormat(attachment.size),\n description: attachment.description,\n isDeprecated: attachment.is_deprecated,\n modifyPermission: modifyPermission\n };\n if (edit) {\n html = templateEdit(ctx);\n } else {\n html = template(ctx);\n }\n $el.html(html);\n if (attachment.is_deprecated) {\n $el.addClass(\"deprecated\");\n return $el.find(\"input:checkbox\").prop('checked', true);\n }\n };\n saveAttachment = function() {\n attachment.description = $el.find(\"input[name='description']\").val();\n attachment.is_deprecated = $el.find(\"input[name='is-deprecated']\").prop(\"checked\");\n return $scope.$apply(function() {\n return $ctrl.updateAttachment(attachment).then(function() {\n return render(attachment, false);\n });\n });\n };\n $el.on(\"click\", \"a.editable-settings.icon-floppy\", function(event) {\n event.preventDefault();\n return saveAttachment();\n });\n $el.on(\"keyup\", \"input[name=description]\", function(event) {\n if (event.keyCode === 13) {\n return saveAttachment();\n } else if (event.keyCode === 27) {\n return render(attachment, false);\n }\n });\n $el.on(\"click\", \"a.editable-settings.icon-delete\", function(event) {\n event.preventDefault();\n return render(attachment, false);\n });\n $el.on(\"click\", \"a.settings.icon-edit\", function(event) {\n event.preventDefault();\n render(attachment, true);\n return $el.find(\"input[name='description']\").focus().select();\n });\n $el.on(\"click\", \"a.settings.icon-delete\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n return $ctrl.removeAttachment(attachment);\n });\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n attachment = $scope.$eval($attrs.tgAttachment);\n render(attachment, attachment.isCreatedRightNow);\n if (attachment.isCreatedRightNow) {\n return $el.find(\"input[name='description']\").focus().select();\n }\n };\n return {\n link: link,\n require: \"^tgAttachments\",\n restrict: \"AE\"\n };\n };\n\n module.directive(\"tgAttachment\", [\"$tgTemplate\", AttachmentDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, EditableSubjectDirective, ListItemAssignedtoDirective, ListItemIssueStatusDirective, ListItemPriorityDirective, ListItemSeverityDirective, ListItemTaskStatusDirective, ListItemTypeDirective, ListItemUsStatusDirective, SprintProgressBarDirective, TgMainTitleDirective, TgProgressBarDirective, 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() {\n var link, renderRange;\n renderRange = function($el, first, second) {\n var endDate, initDate;\n initDate = moment(first).format(\"DD MMM YYYY\");\n endDate = moment(second).format(\"DD MMM YYYY\");\n return $el.html(initDate + \"-\" + endDate);\n };\n link = function($scope, $el, $attrs) {\n var first, second, _ref;\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\", DateRangeDirective);\n\n DateSelectorDirective = function() {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var selectedDate;\n selectedDate = null;\n $el.picker = new Pikaday({\n field: $el[0],\n format: \"DD MMM YYYY\",\n onSelect: (function(_this) {\n return function(date) {\n return selectedDate = date;\n };\n })(this),\n onOpen: (function(_this) {\n return function() {\n if (selectedDate != null) {\n return $el.picker.setDate(selectedDate);\n }\n };\n })(this)\n });\n return $scope.$watch($attrs.ngModel, function(val) {\n if (val != null) {\n return $el.picker.setDate(val);\n }\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgDateSelector\", 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 return 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 };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSprintProgressbar\", SprintProgressBarDirective);\n\n CreatedByDisplayDirective = function($template) {\n var link, template;\n template = $template.get(\"common/components/created-by.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(model) {\n var html, owner, _ref;\n owner = ((_ref = $scope.usersById) != null ? _ref[model.owner] : void 0) || {\n full_name_display: \"external user\",\n photo: \"/images/unnamed.png\"\n };\n html = template({\n owner: owner,\n date: moment(model.created_date).format(\"DD MMM YYYY HH:mm\")\n });\n return $el.html(html);\n };\n bindOnce($scope, $attrs.ngModel, function(model) {\n if (model != null) {\n return render(model);\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(\"tgCreatedByDisplay\", [\"$tgTemplate\", CreatedByDisplayDirective]);\n\n WatchersDirective = function($rootscope, $confirm, $repo, $qqueue, $template) {\n var link, template;\n template = $template.get(\"common/components/watchers.html\", true);\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 = $qqueue.bindAdd((function(_this) {\n return function(watchers) {\n var item, promise;\n item = $model.$modelValue.clone();\n item.watchers = watchers;\n $model.$setViewValue(item);\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n watchers = _.map(watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n renderWatchers(watchers);\n return $rootscope.$broadcast(\"history:reload\");\n });\n return promise.then(null, function() {\n return $model.$modelValue.revert();\n });\n };\n })(this));\n deleteWatcher = $qqueue.bindAdd((function(_this) {\n return function(watcherIds) {\n var item, promise;\n item = $model.$modelValue.clone();\n item.watchers = watcherIds;\n $model.$setViewValue(item);\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n var watchers;\n $confirm.notify(\"success\");\n watchers = _.map(item.watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n renderWatchers(watchers);\n return $rootscope.$broadcast(\"history:reload\");\n });\n return promise.then(null, function() {\n item.revert();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n renderWatchers = function(watchers) {\n var ctx, html;\n ctx = {\n watchers: watchers,\n isEditable: isEditable()\n };\n html = template(ctx);\n $el.html(html);\n if (isEditable() && watchers.length === 0) {\n $el.find(\".title\").text(\"Add watchers\");\n return $el.find(\".watchers-header\").addClass(\"no-watchers\");\n }\n };\n $el.on(\"click\", \".icon-delete\", 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 = \"Delete watcher\";\n message = $scope.usersById[watcherId].full_name_display;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var watcherIds;\n finish();\n watcherIds = _.clone($model.$modelValue.watchers, false);\n watcherIds = _.pull(watcherIds, watcherId);\n return deleteWatcher(watcherIds);\n };\n })(this));\n });\n $el.on(\"click\", \".add-watcher\", function(event) {\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n return $scope.$apply(function() {\n return $rootscope.$broadcast(\"watcher:add\", $model.$modelValue);\n });\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 return renderWatchers(watchers);\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(\"tgWatchers\", [\"$rootScope\", \"$tgConfirm\", \"$tgRepo\", \"$tgQqueue\", \"$tgTemplate\", WatchersDirective]);\n\n AssignedToDirective = function($rootscope, $confirm, $repo, $loading, $qqueue, $template) {\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 = $qqueue.bindAdd((function(_this) {\n return function(userId) {\n var promise;\n $model.$modelValue.assigned_to = userId;\n $loading.start($el);\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $loading.finish($el);\n $confirm.notify(\"success\");\n renderAssignedTo($model.$modelValue);\n return $rootscope.$broadcast(\"history:reload\");\n });\n promise.then(null, function() {\n $model.$modelValue.revert();\n $confirm.notify(\"error\");\n return $loading.finish($el);\n });\n return promise;\n };\n })(this));\n renderAssignedTo = function(issue) {\n var assignedTo, assignedToId, ctx, html;\n assignedToId = issue != null ? issue.assigned_to : void 0;\n assignedTo = assignedToId != null ? $scope.usersById[assignedToId] : null;\n ctx = {\n assignedTo: assignedTo,\n isEditable: isEditable()\n };\n html = template(ctx);\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\", \".icon-delete\", function(event) {\n var title;\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n title = \"Are you sure you want to leave it unassigned?\";\n return $confirm.ask(title).then((function(_this) {\n return function(finish) {\n 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\", \"$tgQqueue\", \"$tgTemplate\", 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').hide();\n return $el.find('.item-unblock').show();\n } else {\n $el.find('.item-block').show();\n return $el.find('.item-unblock').hide();\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 finish;\n event.preventDefault();\n $loading.start($el.find(\".item-unblock\"));\n finish = function() {\n return $loading.finish($el.find(\".item-unblock\"));\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\", function(event) {\n var subtitle, title;\n title = $scope.$eval($attrs.onDeleteTitle);\n subtitle = $model.$modelValue.subject;\n return $confirm.askOnDelete(title, subtitle).then((function(_this) {\n return function(finish) {\n var promise;\n promise = $repo.remove($model.$modelValue);\n promise.then(function() {\n var url;\n finish();\n url = $scope.$eval($attrs.onDeleteGoToUrl);\n return $location.path(url);\n });\n return promise.then(null, function() {\n 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 EditableSubjectDirective = function($rootscope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"common/components/editable-subject.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(subject) {\n var promise;\n $model.$modelValue.subject = subject;\n $loading.start($el.find('.save-container'));\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"history:reload\");\n $el.find('.edit-subject').hide();\n return $el.find('.view-subject').show();\n });\n promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n promise[\"finally\"](function() {\n return $loading.finish($el.find('.save-container'));\n });\n return promise;\n };\n })(this));\n $el.click(function() {\n if (!isEditable()) {\n return;\n }\n $el.find('.edit-subject').show();\n $el.find('.view-subject').hide();\n return $el.find('input').focus();\n });\n $el.on(\"click\", \".save\", function() {\n var subject;\n subject = $scope.item.subject;\n return save(subject);\n });\n $el.on(\"keyup\", \"input\", function(event) {\n var subject;\n if (event.keyCode === 13) {\n subject = $scope.item.subject;\n return save(subject);\n } else if (event.keyCode === 27) {\n $scope.$apply((function(_this) {\n return function() {\n return $model.$modelValue.revert();\n };\n })(this));\n $el.find('div.edit-subject').hide();\n return $el.find('div.view-subject').show();\n }\n });\n $el.find('div.edit-subject').hide();\n $el.find('div.view-subject span.edit').hide();\n $scope.$watch($attrs.ngModel, function(value) {\n if (!value) {\n return;\n }\n $scope.item = value;\n if (!isEditable()) {\n return $el.find('.view-subject .edit').remove();\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(\"tgEditableSubject\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", EditableSubjectDirective]);\n\n EditableDescriptionDirective = function($rootscope, $repo, $confirm, $compile, $loading, $selectedText, $qqueue, $template) {\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 isEditable, save;\n $el.find('.edit-description').hide();\n $el.find('.view-description .edit').hide();\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(description) {\n var promise;\n $model.$modelValue.description = description;\n $loading.start($el.find('.save-container'));\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"history:reload\");\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n });\n promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n return promise[\"finally\"](function() {\n return $loading.finish($el.find('.save-container'));\n });\n };\n })(this));\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\", \".save\", function() {\n var description;\n description = $scope.item.description;\n return save(description);\n });\n $el.on(\"keydown\", \"textarea\", function(event) {\n if (event.keyCode === 27) {\n $scope.$apply((function(_this) {\n return function() {\n return $scope.item.revert();\n };\n })(this));\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\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 = noDescriptionMegEditMode;\n } else {\n return $scope.noDescriptionMsg = noDescriptionMegReadMode;\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\", \"$tgQqueue\", \"$tgTemplate\", EditableDescriptionDirective]);\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 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 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 ListItemAssignedtoDirective = function($template) {\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, \"membersById\", function(membersById) {\n var ctx, item, member;\n item = $scope.$eval($attrs.tgListitemAssignedto);\n ctx = {\n name: \"Unassigned\",\n imgurl: \"/images/unnamed.png\"\n };\n member = membersById[item.assigned_to];\n if (member) {\n ctx.imgurl = member.photo;\n ctx.name = member.full_name;\n }\n return $el.html(template(ctx));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemAssignedto\", [\"$tgTemplate\", ListItemAssignedtoDirective]);\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 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 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($template) {\n var link, render, template;\n template = $template.get(\"common/components/main-title.html\", true);\n render = function(el, projectName, sectionName) {\n return el.html(template({\n projectName: projectName,\n sectionName: sectionName\n }));\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch(\"project\", function(project) {\n if (project) {\n return render($el, project.name, $scope.sectionName);\n }\n });\n $scope.$on(\"project:loaded\", (function(_this) {\n return function(ctx, project) {\n return render($el, project.name, $scope.sectionName);\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(\"tgMainTitle\", [\"$tgTemplate\", TgMainTitleDirective]);\n\n module.directive(\"tgListitemType\", ListItemTypeDirective);\n\n module.directive(\"tgListitemIssueStatus\", ListItemIssueStatusDirective);\n\n module.directive(\"tgListitemSeverity\", ListItemSeverityDirective);\n\n module.directive(\"tgListitemTaskStatus\", ListItemTaskStatusDirective);\n\n module.directive(\"tgListitemUsStatus\", ListItemUsStatusDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 __extends = 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: \"Everything is ok\",\n message: \"Our Oompa Loompas saved all your changes!\"\n },\n \"error\": {\n title: \"Oops, something happened...\",\n message: \"Our Oompa Loompas are sad, your changes were not saved!\"\n },\n \"light-error\": {\n title: \"Oops, something happened...\",\n message: \"Our Oompa Loompas are sad, your changes were not saved!\"\n }\n };\n\n ConfirmService = (function(_super) {\n __extends(ConfirmService, _super);\n\n ConfirmService.$inject = [\"$q\", \"lightboxService\", \"$tgLoading\"];\n\n function ConfirmService(_at_q, _at_lightboxService, _at_loading) {\n this.q = _at_q;\n this.lightboxService = _at_lightboxService;\n this.loading = _at_loading;\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 el = angular.element(lightboxSelector);\n el.find(\"h2.title\").html(title);\n el.find(\"span.subtitle\").html(subtitle);\n el.find(\"span.message\").html(message);\n defered = this.q.defer();\n el.on(\"click.confirm-dialog\", \"a.button-green\", debounce(2000, (function(_this) {\n return function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n _this.loading.start(target);\n return defered.resolve(function(ok) {\n if (ok == null) {\n ok = true;\n }\n _this.loading.finish(target);\n if (ok) {\n return _this.hide(el);\n }\n });\n };\n })(this)));\n el.on(\"click.confirm-dialog\", \"a.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, \"Are you sure you want to 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 el = angular.element(lightboxSelector);\n el.find(\".title\").html(title);\n el.find(\".subtitle\").html(subtitle);\n if (replacement) {\n el.find(\".replacement\").html(replacement);\n } else {\n el.find(\".replacement\").remove();\n }\n if (warning) {\n el.find(\".warning\").html(warning);\n } else {\n el.find(\".warning\").remove();\n }\n choicesField = el.find(\".choices\");\n choicesField.html('');\n _.each(choices, function(value, key) {\n return choicesField.append(angular.element(\"\"));\n });\n defered = this.q.defer();\n el.on(\"click.confirm-dialog\", \"a.button-green\", debounce(2000, (function(_this) {\n return function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n _this.loading.start(target);\n return defered.resolve({\n selected: choicesField.val(),\n finish: function() {\n _this.loading.finish(target);\n return _this.hide(el);\n }\n });\n };\n })(this)));\n el.on(\"click.confirm-dialog\", \"a.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 el = angular.element(\".lightbox-generic-error\");\n el.find(\"h2.title\").html(message);\n defered = this.q.defer();\n el.on(\"click.confirm-dialog\", \"a.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\", \"a.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) {\n var defered, el;\n el = angular.element(\".lightbox-generic-success\");\n if (title) {\n el.find(\"h2.title\").html(title);\n }\n if (message) {\n el.find(\"p.message\").html(message);\n }\n defered = this.q.defer();\n el.on(\"click.confirm-dialog\", \"a.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\", \"a.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(\"h2.title\").html(title);\n }\n if (message) {\n el.find(\"p.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(\"h2.title\").html(title);\n }\n if (message) {\n el.find(\"p.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(NOTIFICATION_MSG[type].title);\n }\n if (message) {\n el.find(\"p\").html(message);\n } else {\n el.find(\"p\").html(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');\n return delete _this.tsem;\n };\n })(this));\n return el.on(\"click\", \".icon-delete\", (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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 LbUsEstimationDirective, UsEstimationDirective, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n LbUsEstimationDirective = function($rootScope, $repo, $confirm, $template) {\n var link, mainTemplate, pointsTemplate;\n mainTemplate = $template.get(\"common/estimation/lb-us-estimation-points-per-role.html\", true);\n pointsTemplate = $template.get(\"common/estimation/lb-us-estimation-points.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var calculateTotalPoints, render, renderPoints;\n render = function(points) {\n var computableRoles, ctx, html, roles, totalPoints;\n totalPoints = calculateTotalPoints(points) || 0;\n computableRoles = _.filter($scope.project.roles, \"computable\");\n roles = _.map(computableRoles, function(role) {\n var pointId, pointObj;\n pointId = points[role.id];\n pointObj = $scope.pointsById[pointId];\n role = _.clone(role, true);\n role.points = (pointObj != null) && (pointObj.name != null) ? pointObj.name : \"?\";\n return role;\n });\n ctx = {\n totalPoints: totalPoints,\n roles: roles\n };\n html = mainTemplate(ctx);\n return $el.html(html);\n };\n renderPoints = function(target, usPoints, roleId) {\n var html, points;\n points = _.map($scope.project.points, function(point) {\n point = _.clone(point, true);\n point.selected = usPoints[roleId] === point.id ? false : true;\n return point;\n });\n html = pointsTemplate({\n \"points\": points,\n roleId: roleId\n });\n $el.find(\".popover\").popover().close();\n $el.find(\".pop-points-open\").remove();\n if ($el.find(\".pop-role:visible\").css(\"left\") == null) {\n $el.find(\".pop-points-open\").css(\"left\", \"110px\");\n }\n $el.find(\".pop-points-open\").remove();\n $el.find(target).append(html);\n $el.find(\".pop-points-open\").popover().open(function() {\n return $(this).removeClass(\"active\");\n });\n return $el.find(\".pop-points-open\").show();\n };\n calculateTotalPoints = function(points) {\n var values;\n values = _.map(points, function(v, k) {\n var _ref;\n return ((_ref = $scope.pointsById[v]) != null ? _ref.value : void 0) || 0;\n });\n if (values.length === 0) {\n return \"0\";\n }\n return _.reduce(values, function(acc, num) {\n return acc + num;\n });\n };\n $el.on(\"click\", \".total.clickable\", function(event) {\n var points, roleId, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n points = $model.$modelValue;\n renderPoints(target, points, roleId);\n target.siblings().removeClass('active');\n return target.addClass('active');\n });\n $el.on(\"click\", \".point\", 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 $el.find(\".popover\").popover().close();\n points = _.clone($model.$modelValue, true);\n points[roleId] = pointId;\n return $scope.$apply(function() {\n return $model.$setViewValue(points);\n });\n });\n $scope.$watch($attrs.ngModel, function(points) {\n if (points) {\n return render(points);\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\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgTemplate\", LbUsEstimationDirective]);\n\n UsEstimationDirective = function($rootScope, $repo, $confirm, $qqueue, $template) {\n var link, mainTemplate, pointsTemplate;\n mainTemplate = $template.get(\"common/estimation/us-estimation-points-per-role.html\", true);\n pointsTemplate = $template.get(\"common/estimation/us-estimation-points.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var calculateTotalPoints, isEditable, render, renderPoints, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = function(us) {\n var computableRoles, ctx, html, roles, totalPoints;\n totalPoints = us.total_points != null ? us.total_points : \"?\";\n computableRoles = _.filter($scope.project.roles, \"computable\");\n roles = _.map(computableRoles, function(role) {\n var pointId, pointObj;\n pointId = us.points[role.id];\n pointObj = $scope.pointsById[pointId];\n role = _.clone(role, true);\n role.points = (pointObj != null) && (pointObj.name != null) ? pointObj.name : \"?\";\n return role;\n });\n ctx = {\n totalPoints: totalPoints,\n roles: roles,\n editable: isEditable()\n };\n html = mainTemplate(ctx);\n return $el.html(html);\n };\n renderPoints = function(target, us, roleId) {\n var html, points;\n points = _.map($scope.project.points, function(point) {\n point = _.clone(point, true);\n point.selected = us.points[roleId] === point.id ? false : true;\n return point;\n });\n html = pointsTemplate({\n \"points\": points,\n roleId: roleId\n });\n $el.find(\".popover\").popover().close();\n $el.find(\".pop-points-open\").remove();\n if ($el.find(\".pop-role:visible\").css(\"left\") == null) {\n $el.find(\".pop-points-open\").css(\"left\", \"110px\");\n }\n $el.find(\".pop-points-open\").remove();\n $el.find(target).append(html);\n $el.find(\".pop-points-open\").popover().open(function() {\n return $(this).removeClass(\"active\").closest(\"li\").removeClass(\"active\");\n });\n return $el.find(\".pop-points-open\").show();\n };\n calculateTotalPoints = function(us) {\n var notNullValues, values;\n values = _.map(us.points, function(v, k) {\n var _ref;\n return (_ref = $scope.pointsById[v]) != null ? _ref.value : void 0;\n });\n if (values.length === 0) {\n return \"0\";\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 save = $qqueue.bindAdd((function(_this) {\n return function(roleId, pointId) {\n var onError, onSuccess, points, us;\n $el.find(\".popover\").popover().close();\n us = angular.copy($model.$modelValue);\n points = _.clone($model.$modelValue.points, true);\n points[roleId] = pointId;\n us.setAttr('points', points);\n us.points = points;\n us.total_points = calculateTotalPoints(us);\n $model.$setViewValue(us);\n onSuccess = function() {\n $confirm.notify(\"success\");\n return $rootScope.$broadcast(\"history:reload\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n us.revert();\n return $model.$setViewValue(us);\n };\n return $repo.save($model.$modelValue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".total.clickable\", function(event) {\n var roleId, target, us;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n us = $model.$modelValue;\n renderPoints(target, us, roleId);\n target.siblings().removeClass('active');\n return target.addClass('active');\n });\n $el.on(\"click\", \".point\", function(event) {\n var pointId, roleId, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n pointId = target.data(\"point-id\");\n return save(roleId, pointId);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\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\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgQqueue\", \"$tgTemplate\", UsEstimationDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 defaultFilter, module, momentFormat, momentFromNow, taiga, 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() {\n return function(value) {\n if (value) {\n return \"Yes\";\n }\n return \"No\";\n };\n };\n\n module.filter(\"yesNo\", 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}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/history.coffee\n */\n\n(function() {\n var HistoryController, HistoryDirective, bindOnce, debounce, module, taiga, trim,\n __extends = 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 trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaCommon\");\n\n HistoryController = (function(_super) {\n __extends(HistoryController, _super);\n\n HistoryController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\"];\n\n function HistoryController(_at_scope, _at_repo, _at_rs) {\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n }\n\n HistoryController.prototype.initialize = function(type, objectId) {\n this.type = type;\n return this.objectId = objectId;\n };\n\n HistoryController.prototype.loadHistory = function(type, objectId) {\n return this.rs.history.get(type, objectId).then((function(_this) {\n return function(history) {\n var historyResult, _i, _len;\n for (_i = 0, _len = history.length; _i < _len; _i++) {\n historyResult = history[_i];\n if (historyResult.values_diff.description_diff != null) {\n historyResult.values_diff.description = historyResult.values_diff.description_diff;\n }\n delete historyResult.values_diff.description_html;\n delete historyResult.values_diff.description_diff;\n }\n _this.scope.history = history;\n return _this.scope.comments = _.filter(history, function(item) {\n return item.comment !== \"\";\n });\n };\n })(this));\n };\n\n HistoryController.prototype.deleteComment = function(type, objectId, activityId) {\n return this.rs.history.deleteComment(type, objectId, activityId).then((function(_this) {\n return function() {\n return _this.loadHistory(type, objectId);\n };\n })(this));\n };\n\n HistoryController.prototype.undeleteComment = function(type, objectId, activityId) {\n return this.rs.history.undeleteComment(type, objectId, activityId).then((function(_this) {\n return function() {\n return _this.loadHistory(type, objectId);\n };\n })(this));\n };\n\n return HistoryController;\n\n })(taiga.Controller);\n\n HistoryDirective = function($log, $loading, $qqueue, $template, $confirm) {\n var link, templateActivity, templateBase, templateBaseEntries, templateChangeAttachment, templateChangeDiff, templateChangeGeneric, templateChangePoints, templateDeletedComment, templateFn;\n templateChangeDiff = $template.get(\"common/history/history-change-diff.html\", true);\n templateChangePoints = $template.get(\"common/history/history-change-points.html\", true);\n templateChangeGeneric = $template.get(\"common/history/history-change-generic.html\", true);\n templateChangeAttachment = $template.get(\"common/history/history-change-attachment.html\", true);\n templateDeletedComment = $template.get(\"common/history/history-deleted-comment.html\", true);\n templateActivity = $template.get(\"common/history/history-activity.html\", true);\n templateBaseEntries = $template.get(\"common/history/history-base-entries.html\", true);\n templateBase = $template.get(\"common/history/history-base.html\", true);\n link = function($scope, $el, $attrs, $ctrl) {\n var countChanges, formatChange, getHumanizedFieldName, getUserAvatar, getUserFullName, objectId, renderActivity, renderAttachmentEntry, renderChange, renderChangeEntries, renderChangeEntry, renderChangesHelperText, renderComment, renderComments, renderHistory, save, showAllActivity, showAllComments, type;\n type = $attrs.type;\n objectId = null;\n showAllComments = false;\n showAllActivity = false;\n bindOnce($scope, $attrs.ngModel, function(model) {\n type = $attrs.type;\n objectId = model.id;\n $ctrl.initialize(type, objectId);\n return $ctrl.loadHistory(type, objectId);\n });\n getHumanizedFieldName = function(field) {\n var humanizedFieldNames;\n humanizedFieldNames = {\n assigned_to: \"assigned to\",\n is_closed: \"is closed\",\n finish_date: \"finish date\",\n client_requirement: \"client requirement\",\n team_requirement: \"team requirement\",\n milestone: \"sprint\",\n user_story: \"user story\",\n is_iocaine: \"is iocaine\",\n is_deprecated: \"is deprecated\"\n };\n return humanizedFieldNames[field] || field;\n };\n getUserFullName = function(userId) {\n var _ref;\n return (_ref = $scope.usersById[userId]) != null ? _ref.full_name_display : void 0;\n };\n getUserAvatar = function(userId) {\n if ($scope.usersById[userId] != null) {\n return $scope.usersById[userId].photo;\n } else {\n return \"/images/unnamed.png\";\n }\n };\n countChanges = function(comment) {\n return _.keys(comment.values_diff).length;\n };\n formatChange = function(change) {\n if (_.isArray(change)) {\n if (change.length === 0) {\n return \"nil\";\n }\n return change.join(\", \");\n }\n if (change === \"\") {\n return \"nil\";\n }\n if (change === true) {\n return \"yes\";\n }\n if (change === false) {\n return \"no\";\n }\n return change;\n };\n renderAttachmentEntry = function(value) {\n var attachments;\n attachments = _.map(value, function(changes, type) {\n if (type === \"new\") {\n return _.map(changes, function(change) {\n return templateChangeDiff({\n name: \"new attachment\",\n diff: change.filename\n });\n });\n } else if (type === \"deleted\") {\n return _.map(changes, function(change) {\n return templateChangeDiff({\n name: \"deleted attachment\",\n diff: change.filename\n });\n });\n } else {\n return _.map(changes, function(change) {\n var diff, name;\n name = \"updated attachment \" + change.filename;\n diff = _.map(change.changes, function(values, name) {\n return {\n name: getHumanizedFieldName(name),\n from: formatChange(values[0]),\n to: formatChange(values[1])\n };\n });\n return templateChangeAttachment({\n name: name,\n diff: diff\n });\n });\n }\n });\n return _.flatten(attachments).join(\"\\n\");\n };\n renderChangeEntry = function(field, value) {\n var from, name, to;\n if (field === \"description\") {\n return templateChangeDiff({\n name: \"description\",\n diff: value[1]\n });\n } else if (field === \"points\") {\n return templateChangePoints({\n points: value\n });\n } else if (field === \"attachments\") {\n return renderAttachmentEntry(value);\n } else if (field === \"assigned_to\") {\n name = getHumanizedFieldName(field);\n from = formatChange(value[0] || \"Unassigned\");\n to = formatChange(value[1] || \"Unassigned\");\n return templateChangeGeneric({\n name: name,\n from: from,\n to: to\n });\n } else {\n name = getHumanizedFieldName(field);\n from = formatChange(value[0]);\n to = formatChange(value[1]);\n return templateChangeGeneric({\n name: name,\n from: from,\n to: to\n });\n }\n };\n renderChangeEntries = function(change) {\n return _.map(change.values_diff, function(value, field) {\n return renderChangeEntry(field, value);\n });\n };\n renderChangesHelperText = function(change) {\n var size;\n size = countChanges(change);\n if (size === 1) {\n return \"Made \" + size + \" change\";\n }\n return \"Made \" + size + \" changes\";\n };\n renderComment = function(comment) {\n var _ref, _ref1;\n if (comment.delete_comment_date || ((_ref = comment.delete_comment_user) != null ? _ref.name : void 0)) {\n return templateDeletedComment({\n deleteCommentDate: comment.delete_comment_date ? moment(comment.delete_comment_date).format(\"DD MMM YYYY HH:mm\") : void 0,\n deleteCommentUser: comment.delete_comment_user.name,\n deleteComment: comment.comment_html,\n activityId: comment.id,\n canRestoreComment: comment.delete_comment_user.pk === $scope.user.id || $scope.project.my_permissions.indexOf(\"modify_project\") > -1\n });\n }\n return templateActivity({\n avatar: getUserAvatar(comment.user.pk),\n userFullName: comment.user.name,\n creationDate: moment(comment.created_at).format(\"DD MMM YYYY HH:mm\"),\n comment: comment.comment_html,\n changesText: renderChangesHelperText(comment),\n changes: renderChangeEntries(comment),\n mode: \"comment\",\n deleteCommentDate: comment.delete_comment_date ? moment(comment.delete_comment_date).format(\"DD MMM YYYY HH:mm\") : void 0,\n deleteCommentUser: ((_ref1 = comment.delete_comment_user) != null ? _ref1.name : void 0) ? comment.delete_comment_user.name : void 0,\n activityId: comment.id,\n canDeleteComment: comment.user.pk === $scope.user.id || $scope.project.my_permissions.indexOf(\"modify_project\") > -1\n });\n };\n renderChange = function(change) {\n var _ref;\n return templateActivity({\n avatar: getUserAvatar(change.user.pk),\n userFullName: change.user.name,\n creationDate: moment(change.created_at).format(\"DD MMM YYYY HH:mm\"),\n comment: change.comment_html,\n changes: renderChangeEntries(change),\n changesText: \"\",\n mode: \"activity\",\n deleteCommentDate: change.delete_comment_date ? moment(change.delete_comment_date).format(\"DD MMM YYYY HH:mm\") : void 0,\n deleteCommentUser: ((_ref = change.delete_comment_user) != null ? _ref.name : void 0) ? change.delete_comment_user.name : void 0,\n activityId: change.id\n });\n };\n renderHistory = function(entries, totalEntries) {\n var showMore;\n if (entries.length === totalEntries) {\n showMore = 0;\n } else {\n showMore = totalEntries - entries.length;\n }\n return templateBaseEntries({\n entries: entries,\n showMore: showMore\n });\n };\n renderComments = function() {\n var comments, html, totalComments;\n comments = $scope.comments || [];\n totalComments = comments.length;\n if (!showAllComments) {\n comments = _.last(comments, 4);\n }\n comments = _.map(comments, function(x) {\n return renderComment(x);\n });\n html = renderHistory(comments, totalComments);\n return $el.find(\".comments-list\").html(html);\n };\n renderActivity = function() {\n var changes, html, totalChanges;\n changes = $scope.history || [];\n totalChanges = changes.length;\n if (!showAllActivity) {\n changes = _.last(changes, 4);\n }\n changes = _.map(changes, function(x) {\n return renderChange(x);\n });\n html = renderHistory(changes, totalChanges);\n return $el.find(\".changes-list\").html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(target) {\n var model, onError, onSuccess;\n $scope.$broadcast(\"markdown-editor:submit\");\n $el.find(\".comment-list\").addClass(\"activeanimation\");\n onSuccess = function() {\n return $ctrl.loadHistory(type, objectId)[\"finally\"](function() {\n return $loading.finish(target);\n });\n };\n onError = function() {\n $loading.finish(target);\n return $confirm.notify(\"error\");\n };\n model = $scope.$eval($attrs.ngModel);\n $loading.start(target);\n return $ctrl.repo.save(model).then(onSuccess, onError);\n };\n })(this));\n $scope.$watch(\"comments\", renderComments);\n $scope.$watch(\"history\", renderActivity);\n $scope.$on(\"history:reload\", function() {\n return $ctrl.loadHistory(type, objectId);\n });\n $el.on(\"click\", \".add-comment a.button-green\", debounce(2000, function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return save(target);\n }));\n $el.on(\"click\", \".show-more\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n if (target.parent().is(\".changes-list\")) {\n showAllActivity = !showAllActivity;\n return renderActivity();\n } else {\n showAllComments = !showAllComments;\n return renderComments();\n }\n });\n $el.on(\"click\", \".show-deleted-comment\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.parents('.activity-single').find('.hide-deleted-comment').show();\n target.parents('.activity-single').find('.show-deleted-comment').hide();\n return target.parents('.activity-single').find('.comment-body').show();\n });\n $el.on(\"click\", \".hide-deleted-comment\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.parents('.activity-single').find('.hide-deleted-comment').hide();\n target.parents('.activity-single').find('.show-deleted-comment').show();\n return target.parents('.activity-single').find('.comment-body').hide();\n });\n $el.on(\"click\", \".changes-title\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return target.parent().find(\".change-entry\").toggleClass(\"active\");\n });\n $el.on(\"focus\", \".add-comment textarea\", function(event) {\n return $(this).addClass('active');\n });\n $el.on(\"click\", \".history-tabs li a\", function(event) {\n $el.find(\".history-tabs li a\").toggleClass(\"active\");\n return $el.find(\".history section\").toggleClass(\"hidden\");\n });\n $el.on(\"click\", \".comment-delete\", debounce(2000, function(event) {\n var activityId, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n activityId = target.data('activity-id');\n return $ctrl.deleteComment(type, objectId, activityId);\n }));\n $el.on(\"click\", \".comment-restore\", debounce(2000, function(event) {\n var activityId, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n activityId = target.data('activity-id');\n return $ctrl.undeleteComment(type, objectId, activityId);\n }));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n templateFn = function($el, $attrs) {\n return templateBase({\n ngmodel: $attrs.ngModel,\n type: $attrs.type,\n mode: $attrs.mode\n });\n };\n return {\n controller: HistoryController,\n template: templateFn,\n restrict: \"AE\",\n link: link\n };\n };\n\n module.directive(\"tgHistory\", [\"$log\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$tgConfirm\", HistoryDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, module;\n\n module = angular.module(\"taigaCommon\");\n\n ImportProjectButtonDirective = function($rs, $confirm, $location, $navUrls) {\n var link;\n link = function($scope, $el, $attrs) {\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(\"Uploading dump file\");\n onSuccess = function(result) {\n var ctx, message, title;\n loader.stop();\n if (result.status === 202) {\n title = \"Our Oompa Loompas are importing your project\";\n message = \"This process could take a few minutes
We will send you an email when ready\";\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 return $confirm.notify(\"success\", \"Your project has been imported successfuly.\");\n }\n };\n onError = function(result) {\n var errorMsg, _ref;\n loader.stop();\n console.log(\"Error\", result);\n errorMsg = \"Our oompa loompas have some problems importing your dump data. Please try again. \";\n if (result.status === 429) {\n errorMsg = \"Sorry, our oompa loompas are very busy right now. Please try again in a few minutes. \";\n } else if ((_ref = result.data) != null ? _ref._error_message : void 0) {\n errorMsg = \"Our oompa loompas have some problems importing your dump data: \" + result.data._error_message;\n }\n return $confirm.notify(\"error\", errorMsg);\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\", ImportProjectButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, LightboxService, NotionButtonDirective, NotionLightboxDirective, WatchersLightboxDirective, bindOnce, debounce, module, timeout,\n __extends = 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 module = angular.module(\"taigaCommon\");\n\n bindOnce = this.taiga.bindOnce;\n\n timeout = this.taiga.timeout;\n\n debounce = this.taiga.debounce;\n\n LightboxService = (function(_super) {\n __extends(LightboxService, _super);\n\n function LightboxService(_at_animationFrame) {\n this.animationFrame = _at_animationFrame;\n }\n\n LightboxService.prototype.open = function($el) {\n var docEl, lightboxContent;\n lightboxContent = $el.children().not(\".close\");\n lightboxContent.hide();\n $el.css('display', 'flex');\n $el.find('input,textarea').first().focus();\n this.animationFrame.add((function(_this) {\n return function() {\n $el.addClass(\"open\");\n return lightboxContent.show();\n };\n })(this));\n docEl = angular.element(document);\n return 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 };\n\n LightboxService.prototype.close = function($el) {\n var docEl;\n docEl = angular.element(document);\n docEl.off(\".lightbox\");\n docEl.off(\".keyboard-navigation\");\n $el.one(\"transitionend\", (function(_this) {\n return function() {\n $el.removeAttr('style');\n return $el.removeClass(\"open\").removeClass('close');\n };\n })(this));\n return $el.addClass('close');\n };\n\n LightboxService.prototype.closeAll = function() {\n var docEl, lightboxEl, _i, _len, _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\", LightboxService]);\n\n LightboxKeyboardNavigationService = (function(_super) {\n __extends(LightboxKeyboardNavigationService, _super);\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(\".active\");\n if (code === 13) {\n return activeElement.trigger(\"click\");\n } else if (code === 40) {\n if (!activeElement.length) {\n return $el.find('.watcher-single:first').addClass('active');\n } else {\n next = activeElement.next('.watcher-single');\n if (next.length) {\n activeElement.removeClass('active');\n return next.addClass('active');\n }\n }\n } else if (code === 38) {\n if (!activeElement.length) {\n return $el.find('.watcher-single:last').addClass('active');\n } else {\n prev = activeElement.prev('.watcher-single');\n if (prev.length) {\n activeElement.removeClass('active');\n return prev.addClass('active');\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, $qqueue) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var block, unblock;\n $el.find(\"h2.title\").text($attrs.title);\n unblock = $qqueue.bindAdd((function(_this) {\n return function(item, finishCallback) {\n var promise;\n promise = $tgrepo.save(item);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"history:reload\");\n $model.$setViewValue(item);\n return finishCallback();\n });\n promise.then(null, function() {\n $confirm.notify(\"error\");\n item.revert();\n return $model.$setViewValue(item);\n });\n promise[\"finally\"](function() {\n return finishCallback();\n });\n return promise;\n };\n })(this));\n block = $qqueue.bindAdd((function(_this) {\n return function(item) {\n var promise;\n $model.$setViewValue(item);\n $loading.start($el.find(\".button-green\"));\n promise = $tgrepo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n return $rootscope.$broadcast(\"history:reload\");\n });\n promise.then(null, function() {\n $confirm.notify(\"error\");\n item.revert();\n return $model.$setViewValue(item);\n });\n return promise[\"finally\"](function() {\n $loading.finish($el.find(\".button-green\"));\n return lightboxService.close($el);\n });\n };\n })(this));\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 var item;\n item = $model.$modelValue.clone();\n item.is_blocked = false;\n item.blocked_note = \"\";\n return unblock(item, finishCallback);\n };\n })(this));\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return $el.on(\"click\", \".button-green\", function(event) {\n var item;\n event.preventDefault();\n item = $model.$modelValue.clone();\n item.is_blocked = true;\n item.blocked_note = $el.find(\".reason\").val();\n return block(item);\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\", \"$tgQqueue\", BlockLightboxDirective]);\n\n BlockingMessageInputDirective = function($log, $template) {\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\", BlockingMessageInputDirective]);\n\n CreateEditUserstoryDirective = function($repo, $model, $rs, $rootScope, lightboxService, $loading) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.isNew = true;\n $scope.$on(\"usform:new\", function(ctx, projectId, status, statusList) {\n $scope.isNew = true;\n $scope.usStatusList = statusList;\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(\"Create\");\n $el.find(\".title\").html(\"New user story \");\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 return lightboxService.open($el);\n });\n $scope.$on(\"usform:edit\", function(ctx, us) {\n $scope.us = us;\n $scope.isNew = false;\n $el.find(\".button-green\").html(\"Save\");\n $el.find(\".title\").html(\"Edit user story \");\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 return lightboxService.open($el);\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, form, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n if ($scope.isNew) {\n promise = $repo.create(\"userstories\", $scope.us);\n broadcastEvent = \"usform:new:success\";\n } else {\n promise = $repo.save($scope.us);\n broadcastEvent = \"usform:edit:success\";\n }\n promise.then(function(data) {\n $loading.finish(submitButton);\n lightboxService.close($el);\n return $rootScope.$broadcast(broadcastEvent, data);\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\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\", \".submit-button\", 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\", CreateEditUserstoryDirective]);\n\n CreateBulkUserstoriesDirective = function($repo, $rs, $rootscope, lightboxService, $loading) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.$on(\"usform:bulk\", function(ctx, projectId, status) {\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 form, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley({\n onlyOneErrorElement: true\n });\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n promise = $rs.userstories.bulkCreate($scope[\"new\"].projectId, $scope[\"new\"].statusId, $scope[\"new\"].bulk);\n promise.then(function(result) {\n $loading.finish(submitButton);\n $rootscope.$broadcast(\"usform:bulk:success\", result);\n return lightboxService.close($el);\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\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\", \".submit-button\", 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\", CreateBulkUserstoriesDirective]);\n\n AssignedToLightboxDirective = function(lightboxService, lightboxKeyboardNavigationService, $template) {\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 _.contains(username, text);\n };\n render = function(selected, text) {\n var ctx, html, users;\n $el.find(\"input\").focus();\n users = _.clone($scope.activeUsers, true);\n if (selected != null) {\n users = _.reject(users, {\n \"id\": selected.id\n });\n }\n if (text != null) {\n users = _.filter(users, _.partial(filterUsers, text));\n }\n ctx = {\n selected: selected,\n users: _.first(users, 5),\n showMore: users.length > 5\n };\n html = usersTemplate(ctx);\n $el.find(\"div.watchers\").html(html);\n return lightboxKeyboardNavigationService.init($el);\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 lightboxService.open($el);\n return $el.find('input').focus();\n });\n $scope.$watch(\"usersSearch\", function(searchingText) {\n if (searchingText != null) {\n return render(selectedUser, searchingText);\n }\n });\n $el.on(\"click\", \".watcher-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\", AssignedToLightboxDirective]);\n\n WatchersLightboxDirective = function($repo, lightboxService, lightboxKeyboardNavigationService, $template) {\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 users, _filterUsers;\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 _.contains(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;\n $el.find(\"input\").focus();\n ctx = {\n selected: false,\n users: _.first(users, 5),\n showMore: users.length > 5\n };\n html = usersTemplate(ctx);\n return $el.find(\"div.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 lightboxService.open($el);\n return lightboxKeyboardNavigationService.init($el);\n });\n $scope.$watch(\"usersSearch\", function(searchingText) {\n var users;\n if (searchingText == null) {\n return;\n }\n users = getFilteredUsers(searchingText);\n return render(users);\n });\n $el.on(\"click\", \".watcher-single\", debounce(2000, 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\", WatchersLightboxDirective]);\n\n NotionLightboxDirective = function(lightboxService) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $scope.$on(\"notion:open\", function(event, lightboxId) {\n if ($el.attr(\"id\") === lightboxId) {\n return lightboxService.open($el);\n }\n });\n $el.on(\"click\", \".button-green\", function(event) {\n return lightboxService.close($el);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbNotion\", [\"lightboxService\", NotionLightboxDirective]);\n\n NotionButtonDirective = function($log, $rootScope) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n if ($attrs.tgLbNotionButton == null) {\n return $log.error(\"NotionButtonDirective: the directive need the id of the notion lightbox\");\n }\n $el.on(\"click\", function() {\n return $rootScope.$broadcast(\"notion:open\", $attrs.tgLbNotionButton);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbNotionButton\", [\"$log\", \"$rootScope\", NotionButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \n * Copyright (C) 2014 Juan Francisco Alcántara \n * Copyright (C) 2014 Alejandro Alonso \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 tgLoader.onEnd(function() {\n $(document.body).removeClass(\"loader-active\");\n return $el.removeClass(\"active\");\n });\n $rootscope.$on(\"$routeChangeSuccess\", function(e) {\n return tgLoader.startCurrentPageLoader();\n });\n return $rootscope.$on(\"$locationChangeSuccess\", function(e) {\n return tgLoader.reset();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLoader\", [\"tgLoader\", \"$rootScope\", LoaderDirective]);\n\n Loader = function() {\n var config, defaultConfig, forceDisabled;\n forceDisabled = false;\n defaultConfig = {\n enabled: false,\n minTime: 300\n };\n config = _.merge({}, defaultConfig);\n this.add = function() {\n return function() {\n if (!forceDisabled) {\n return config.enabled = true;\n }\n };\n };\n this.$get = [\n \"$rootScope\", function($rootscope) {\n var pageLoaded, reset, start, startLoadTime;\n startLoadTime = 0;\n reset = function() {\n return config = _.merge({}, defaultConfig);\n };\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 return timeout(timeoutValue, function() {\n return $rootscope.$broadcast(\"loader:end\");\n });\n }\n };\n start = function() {\n startLoadTime = new Date().getTime();\n return $rootscope.$broadcast(\"loader:start\");\n };\n return {\n reset: reset,\n pageLoaded: pageLoaded,\n start: start,\n startCurrentPageLoader: function() {\n if (config.enabled) {\n return start();\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 preventLoading: function() {\n return forceDisabled = true;\n },\n disablePreventLoading: function() {\n return forceDisabled = false;\n }\n };\n }\n ];\n };\n\n module.provider(\"tgLoader\", [Loader]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var TgLoadingService, module,\n __extends = 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 module = angular.module(\"taigaCommon\");\n\n TgLoadingService = (function(_super) {\n __extends(TgLoadingService, _super);\n\n function TgLoadingService() {\n return TgLoadingService.__super__.constructor.apply(this, arguments);\n }\n\n TgLoadingService.prototype.start = function(target) {\n if (!target.hasClass('loading')) {\n target.data('loading-old-content', target.html());\n target.addClass('loading');\n return target.html(\"loading...\");\n }\n };\n\n TgLoadingService.prototype.finish = function(target) {\n var oldContent;\n if (target.hasClass('loading')) {\n oldContent = target.data('loading-old-content');\n target.data('loading-old-content', null);\n target.html(oldContent);\n return target.removeClass('loading');\n }\n };\n\n return TgLoadingService;\n\n })(taiga.Service);\n\n module.service(\"$tgLoading\", TgLoadingService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/popovers.coffee\n */\n\n(function() {\n var RelatedTaskStatusDirective, UsStatusDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaCommon\");\n\n UsStatusDirective = function($repo, $template) {\n\n /*\n Print the status of a US and a popover to change it.\n - tg-us-status: The user story\n - on-update: Method call after US is updated\n \n Example:\n \n div.status(tg-us-status=\"us\" on-update=\"ctrl.loadSprintState()\")\n a.us-status(href=\"\", title=\"Status Name\")\n \n NOTE: This directive need 'usStatusById' and 'project'.\n */\n var link, template;\n template = $template.get(\"common/popover/popover-us-status.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, render, us;\n $ctrl = $el.controller();\n render = function(us) {\n var usStatusById, usStatusDom, usStatusDomParent;\n usStatusDomParent = $el.find(\".us-status\");\n usStatusDom = $el.find(\".us-status .us-status-bind\");\n usStatusById = $scope.usStatusById;\n if (usStatusById[us.status]) {\n usStatusDom.text(usStatusById[us.status].name);\n return usStatusDomParent.css(\"color\", usStatusById[us.status].color);\n }\n };\n $el.on(\"click\", \".us-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", debounce(2000, function(event) {\n var target, us;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n us = $scope.$eval($attrs.tgUsStatus);\n us.status = target.data(\"status-id\");\n render(us);\n $el.find(\".pop-status\").popover().close();\n return $scope.$apply(function() {\n return $repo.save(us).then(function() {\n return $scope.$eval($attrs.onUpdate);\n });\n });\n }));\n $scope.$on(\"userstories:loaded\", function() {\n return render($scope.$eval($attrs.tgUsStatus));\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n us = $scope.$eval($attrs.tgUsStatus);\n render(us);\n return bindOnce($scope, \"project\", function(project) {\n var html;\n html = template({\n \"statuses\": project.us_statuses\n });\n $el.append(html);\n if ($scope.project.my_permissions.indexOf(\"modify_us\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUsStatus\", [\"$tgRepo\", \"$tgTemplate\", UsStatusDirective]);\n\n RelatedTaskStatusDirective = function($repo, $template) {\n\n /*\n Print the status of a related task and a popover to change it.\n - tg-related-task-status: The related task\n - on-update: Method call after US is updated\n \n Example:\n \n div.status(tg-related-task-status=\"task\" on-update=\"ctrl.loadSprintState()\")\n a.task-status(href=\"\", title=\"Status Name\")\n \n NOTE: This directive need 'taskStatusById' and 'project'.\n */\n var link, selectionTemplate, updateTaskStatus;\n selectionTemplate = $template.get(\"common/popover/popover-related-task-status.html\", true);\n updateTaskStatus = function($el, task, taskStatusById) {\n var taskStatusDom, taskStatusDomParent;\n taskStatusDomParent = $el.find(\".us-status\");\n taskStatusDom = $el.find(\".task-status .task-status-bind\");\n if (taskStatusById[task.status]) {\n taskStatusDom.text(taskStatusById[task.status].name);\n return taskStatusDomParent.css('color', taskStatusById[task.status].color);\n }\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, autoSave, notAutoSave, task;\n $ctrl = $el.controller();\n task = $scope.$eval($attrs.tgRelatedTaskStatus);\n notAutoSave = $scope.$eval($attrs.notAutoSave);\n autoSave = !notAutoSave;\n $el.on(\"click\", \".task-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", debounce(2000, function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n task.status = target.data(\"status-id\");\n $el.find(\".pop-status\").popover().close();\n updateTaskStatus($el, task, $scope.taskStatusById);\n if (autoSave) {\n return $scope.$apply(function() {\n return $repo.save(task).then(function() {\n $scope.$eval($attrs.onUpdate);\n return $scope.$emit(\"related-tasks:status-changed\");\n });\n });\n }\n }));\n taiga.bindOnce($scope, \"project\", function(project) {\n $el.append(selectionTemplate({\n 'statuses': project.task_statuses\n }));\n updateTaskStatus($el, task, $scope.taskStatusById);\n if (project.my_permissions.indexOf(\"modify_task\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\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(\"tgRelatedTaskStatus\", [\"$tgRepo\", \"$tgTemplate\", RelatedTaskStatusDirective]);\n\n $.fn.popover = function() {\n var $el, close, closeAll, closePopover, isVisible, open;\n $el = this;\n isVisible = (function(_this) {\n return function() {\n var docViewBottom, docViewLeft, docViewRight, docViewTop, docViewWidth, elemBottom, elemLeft, elemRight, elemTop, elemWidth;\n $el.css({\n \"display\": \"block\",\n \"visibility\": \"hidden\"\n });\n docViewTop = $(window).scrollTop();\n docViewBottom = docViewTop + $(window).height();\n docViewWidth = $(window).width();\n docViewRight = docViewWidth;\n docViewLeft = 0;\n elemTop = $el.offset().top;\n elemBottom = elemTop + $el.height();\n elemWidth = $el.width();\n elemLeft = $el.offset().left;\n elemRight = $el.offset().left + elemWidth;\n $el.css({\n \"display\": \"none\",\n \"visibility\": \"visible\"\n });\n return (elemBottom <= docViewBottom) && (elemTop >= docViewTop) && (elemLeft >= docViewLeft) && (elemRight <= docViewRight);\n };\n })(this);\n closePopover = (function(_this) {\n return function(onClose) {\n if (onClose) {\n onClose.call($el);\n }\n $el.fadeOut(function() {\n return $el.removeClass(\"active\").removeClass(\"fix\");\n });\n return $el.off(\"popup:close\");\n };\n })(this);\n closeAll = (function(_this) {\n return function() {\n return $(\".popover.active\").each(function() {\n return $(this).trigger(\"popup:close\");\n });\n };\n })(this);\n open = (function(_this) {\n return function(onClose) {\n if ($el.hasClass(\"active\")) {\n return close();\n } else {\n closeAll();\n if (!isVisible()) {\n $el.addClass(\"fix\");\n }\n $el.fadeIn(function() {\n $el.addClass(\"active\");\n $(document.body).off(\"popover\");\n return $(document.body).one(\"click.popover\", function() {\n return closeAll();\n });\n });\n return $el.on(\"popup:close\", function(e) {\n return closePopover(onClose);\n });\n }\n };\n })(this);\n close = (function(_this) {\n return function() {\n return $el.trigger(\"popup:close\");\n };\n })(this);\n return {\n open: open,\n close: close,\n closeAll: closeAll\n };\n };\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/raven-logger.coffee\n */\n\n(function() {\n var ExceptionHandlerFactory, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n ExceptionHandlerFactory = function($log, _at_config) {\n var ravenConfig;\n this.config = _at_config;\n ravenConfig = this.config.get(\"ravenConfig\", null);\n if (ravenConfig) {\n $log.debug(\"Using the RavenJS exception handler.\");\n Raven.config(ravenConfig).install();\n return function(exception, cause) {\n $log.error.apply($log, arguments);\n return Raven.captureException(exception);\n };\n } else {\n $log.debug(\"Using the default logging exception handler.\");\n return function(exception, cause) {\n return $log.error.apply($log, arguments);\n };\n }\n };\n\n module.factory(\"$exceptionHandler\", [\"$log\", \"$tgConfig\", ExceptionHandlerFactory]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/tags.coffee\n */\n\n(function() {\n var ColorizeTagsDirective, LbTagLineDirective, TagLineDirective, TagsDirective, bindOnce, module, taiga, trim,\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 taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n TagsDirective = function() {\n var formatter, link, parser;\n formatter = function(v) {\n if (_.isArray(v)) {\n return v.join(\", \");\n }\n return \"\";\n };\n parser = function(v) {\n var result;\n if (!v) {\n return [];\n }\n result = _(v.split(\",\")).map(function(x) {\n return _.str.trim(x);\n });\n return result.value();\n };\n link = function($scope, $el, $attrs, $ctrl) {\n $ctrl.$formatters.push(formatter);\n $ctrl.$parsers.push(parser);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n require: \"ngModel\",\n link: link\n };\n };\n\n module.directive(\"tgTags\", TagsDirective);\n\n ColorizeTagsDirective = function() {\n var link, templates;\n templates = {\n backlog: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\"><%- tag.name %>\\n<% }) %>\"),\n kanban: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\" title=\\\"<%- tag.name %>\\\" />\\n<% }) %>\"),\n taskboard: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\" title=\\\"<%- tag.name %>\\\" />\\n<% }) %>\")\n };\n link = function($scope, $el, $attrs, $ctrl) {\n var render;\n render = function(srcTags) {\n var html, tags, template;\n template = templates[$attrs.tgColorizeTagsType];\n srcTags.sort();\n tags = _.map(srcTags, function(tag) {\n var color;\n color = $scope.project.tags_colors[tag];\n return {\n name: tag,\n color: color\n };\n });\n html = template({\n tags: tags\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.tgColorizeTags, function(tags) {\n if (tags != null) {\n return render(tags);\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(\"tgColorizeTags\", ColorizeTagsDirective);\n\n LbTagLineDirective = function($rs, $template) {\n var COMMA_KEY, ENTER_KEY, link, templateTags;\n ENTER_KEY = 13;\n COMMA_KEY = 188;\n templateTags = $template.get(\"common/tag/lb-tag-line-tags.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var addValue, deleteValue, hideSaveButton, removeInputLastCharacter, renderTags, resetInput, saveInputTag, showSaveButton;\n renderTags = function(tags, tagsColors) {\n var ctx, html;\n ctx = {\n tags: _.map(tags, function(t) {\n return {\n name: t,\n color: tagsColors[t]\n };\n })\n };\n _.map(ctx.tags, (function(_this) {\n return function(tag) {\n if (tag.color) {\n return tag.style = \"border-left: 5px solid \" + tag.color;\n }\n };\n })(this));\n html = templateTags(ctx);\n return $el.find(\"div.tags-container\").html(html);\n };\n showSaveButton = function() {\n return $el.find(\".save\").removeClass(\"hidden\");\n };\n hideSaveButton = function() {\n return $el.find(\".save\").addClass(\"hidden\");\n };\n resetInput = function() {\n $el.find(\"input\").val(\"\");\n return $el.find(\"input\").autocomplete(\"close\");\n };\n addValue = function(value) {\n var tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue, false);\n if (tags == null) {\n tags = [];\n }\n if (__indexOf.call(tags, value) < 0) {\n tags.push(value);\n }\n $scope.$apply(function() {\n return $model.$setViewValue(tags);\n });\n return hideSaveButton();\n };\n deleteValue = function(value) {\n var tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue, false);\n tags = _.pull(tags, value);\n return $scope.$apply(function() {\n return $model.$setViewValue(tags);\n });\n };\n saveInputTag = function() {\n var value;\n value = $el.find(\"input\").val();\n addValue(value);\n return resetInput();\n };\n removeInputLastCharacter = (function(_this) {\n return function(input) {\n var inputValue;\n inputValue = input.val();\n return input.val(inputValue.substring(0, inputValue.length - 1));\n };\n })(this);\n $el.on(\"keypress\", \"input\", function(event) {\n if (event.keyCode !== ENTER_KEY) {\n return;\n }\n return event.preventDefault();\n });\n $el.on(\"keyup\", \"input\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if (event.keyCode === ENTER_KEY) {\n return saveInputTag();\n } else if (event.keyCode === COMMA_KEY) {\n removeInputLastCharacter(target);\n return saveInputTag();\n } else {\n if (target.val().length) {\n return showSaveButton();\n } else {\n return hideSaveButton();\n }\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n event.preventDefault();\n return saveInputTag();\n });\n $el.on(\"click\", \".icon-delete\", function(event) {\n var target, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n value = target.siblings(\".tag-name\").text();\n return deleteValue(value);\n });\n bindOnce($scope, \"project\", function(project) {\n var positioningFunction;\n positioningFunction = function(position, elements) {\n var menu;\n menu = elements.element.element;\n menu.css(\"width\", elements.target.width);\n menu.css(\"top\", position.top);\n return menu.css(\"left\", position.left);\n };\n return $el.find(\"input\").autocomplete({\n source: _.keys(project.tags_colors),\n position: {\n my: \"left top\",\n using: positioningFunction\n },\n select: function(event, ui) {\n addValue(ui.item.value);\n return ui.item.value = \"\";\n }\n });\n });\n $scope.$watch($attrs.ngModel, function(tags) {\n var tagsColors, _ref;\n tagsColors = ((_ref = $scope.project) != null ? _ref.tags_colors : void 0) || [];\n return renderTags(tags, tagsColors);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\",\n templateUrl: \"common/tag/lb-tag-line.html\"\n };\n };\n\n module.directive(\"tgLbTagLine\", [\"$tgResources\", \"$tgTemplate\", LbTagLineDirective]);\n\n TagLineDirective = function($rootScope, $repo, $rs, $confirm, $qqueue, $template) {\n var COMMA_KEY, ENTER_KEY, ESC_KEY, link, templateTags;\n ENTER_KEY = 13;\n ESC_KEY = 27;\n COMMA_KEY = 188;\n templateTags = $template.get(\"common/tag/tags-line-tags.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var addValue, deleteValue, hideAddTagButton, hideAddTagButtonText, hideInput, hideSaveButton, isEditable, removeInputLastCharacter, renderInReadModeOnly, renderTags, resetInput, saveInputTag, showAddTagButton, showAddTagButtonText, showInput, showSaveButton;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n renderTags = function(tags, tagsColors) {\n var ctx, html;\n ctx = {\n tags: _.map(tags, function(t) {\n return {\n name: t,\n color: tagsColors[t]\n };\n }),\n isEditable: isEditable()\n };\n html = templateTags(ctx);\n return $el.find(\"div.tags-container\").html(html);\n };\n renderInReadModeOnly = function() {\n $el.find(\".add-tag\").remove();\n $el.find(\"input\").remove();\n return $el.find(\".save\").remove();\n };\n showAddTagButton = function() {\n return $el.find(\".add-tag\").removeClass(\"hidden\");\n };\n hideAddTagButton = function() {\n return $el.find(\".add-tag\").addClass(\"hidden\");\n };\n showAddTagButtonText = function() {\n return $el.find(\".add-tag-text\").removeClass(\"hidden\");\n };\n hideAddTagButtonText = function() {\n return $el.find(\".add-tag-text\").addClass(\"hidden\");\n };\n showSaveButton = function() {\n return $el.find(\".save\").removeClass(\"hidden\");\n };\n hideSaveButton = function() {\n return $el.find(\".save\").addClass(\"hidden\");\n };\n showInput = function() {\n return $el.find(\"input\").removeClass(\"hidden\").focus();\n };\n hideInput = function() {\n return $el.find(\"input\").addClass(\"hidden\").blur();\n };\n resetInput = function() {\n $el.find(\"input\").val(\"\");\n return $el.find(\"input\").autocomplete(\"close\");\n };\n addValue = $qqueue.bindAdd(function(value) {\n var model, onError, onSuccess, tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue.tags, false);\n if (tags == null) {\n tags = [];\n }\n if (__indexOf.call(tags, value) < 0) {\n tags.push(value);\n }\n model = $model.$modelValue.clone();\n model.tags = tags;\n $model.$setViewValue(model);\n onSuccess = function() {\n return $rootScope.$broadcast(\"history:reload\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n model.revert();\n return $model.$setViewValue(model);\n };\n $repo.save(model).then(onSuccess, onError);\n return hideSaveButton();\n });\n deleteValue = $qqueue.bindAdd(function(value) {\n var model, onError, onSuccess, tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue.tags, false);\n tags = _.pull(tags, value);\n model = $model.$modelValue.clone();\n model.tags = tags;\n $model.$setViewValue(model);\n onSuccess = function() {\n return $rootScope.$broadcast(\"history:reload\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n model.revert();\n return $model.$setViewValue(model);\n };\n return $repo.save(model).then(onSuccess, onError);\n });\n saveInputTag = function() {\n var value;\n value = $el.find(\"input\").val();\n addValue(value);\n return resetInput();\n };\n removeInputLastCharacter = (function(_this) {\n return function(input) {\n var inputValue;\n inputValue = input.val();\n return input.val(inputValue.substring(0, inputValue.length - 1));\n };\n })(this);\n $el.on(\"keypress\", \"input\", function(event) {\n var _ref;\n if ((_ref = event.keyCode) !== ENTER_KEY && _ref !== ESC_KEY) {\n return;\n }\n return event.preventDefault();\n });\n $el.on(\"keyup\", \"input\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if (event.keyCode === ENTER_KEY) {\n return saveInputTag();\n } else if (event.keyCode === COMMA_KEY) {\n removeInputLastCharacter(target);\n return saveInputTag();\n } else if (event.keyCode === ESC_KEY) {\n resetInput();\n hideInput();\n hideSaveButton();\n return showAddTagButton();\n } else {\n if (target.val().length) {\n return showSaveButton();\n } else {\n return hideSaveButton();\n }\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n event.preventDefault();\n return saveInputTag();\n });\n $el.on(\"click\", \".add-tag\", function(event) {\n event.preventDefault();\n hideAddTagButton();\n return showInput();\n });\n $el.on(\"click\", \".icon-delete\", function(event) {\n var target, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n value = target.siblings(\".tag-name\").text();\n return deleteValue(value);\n });\n bindOnce($scope, \"project\", function(project) {\n var positioningFunction;\n if (!isEditable()) {\n renderInReadModeOnly();\n return;\n }\n showAddTagButton();\n positioningFunction = function(position, elements) {\n var menu;\n menu = elements.element.element;\n menu.css(\"width\", elements.target.width);\n menu.css(\"top\", position.top);\n return menu.css(\"left\", position.left);\n };\n return $el.find(\"input\").autocomplete({\n source: _.keys(project.tags_colors),\n position: {\n my: \"left top\",\n using: positioningFunction\n },\n select: function(event, ui) {\n addValue(ui.item.value);\n return ui.item.value = \"\";\n }\n });\n });\n $scope.$watch($attrs.ngModel, function(model) {\n var tagsColors, _ref, _ref1;\n if (!model) {\n return;\n }\n if ((_ref = model.tags) != null ? _ref.length : void 0) {\n hideAddTagButtonText();\n } else {\n showAddTagButtonText();\n }\n tagsColors = ((_ref1 = $scope.project) != null ? _ref1.tags_colors : void 0) || [];\n return renderTags(model.tags, tagsColors);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\",\n templateUrl: \"common/tag/tag-line.html\"\n };\n };\n\n module.directive(\"tgTagLine\", [\"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$tgQqueue\", \"$tgTemplate\", TagLineDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/wisiwyg.coffee\n */\n\n(function() {\n var bindOnce, module, taiga, tgMarkitupDirective;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n tgMarkitupDirective = function($rootscope, $rs, $tr, $selectedText, $template) {\n var link, previewTemplate;\n previewTemplate = $template.get(\"common/wysiwyg/wysiwyg-markitup-preview.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var closePreviewMode, element, markdownCaretPositon, markdownSettings, markdownTitle, preview, previewDomNode, removeEmptyLine, setCaretPosition;\n element = angular.element($el);\n previewDomNode = $(\"
\", {\n \"class\": \"preview\"\n });\n closePreviewMode = function() {\n element.parents(\".markdown\").find(\".preview\").remove();\n return element.parents(\".markItUp\").show();\n };\n $scope.$on(\"markdown-editor:submit\", function() {\n return closePreviewMode();\n });\n preview = function() {\n var markItUpDomNode, markdownDomNode;\n markdownDomNode = element.parents(\".markdown\");\n markItUpDomNode = element.parents(\".markItUp\");\n return $rs.mdrender.render($scope.projectId, $model.$modelValue).then(function(data) {\n var markdown;\n markdownDomNode.append(previewTemplate({\n data: data.data\n }));\n markItUpDomNode.hide();\n markdown = element.closest(\".markdown\");\n return markdown.on(\"mouseup.preview\", \".preview\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.target);\n if (!target.is('a') && $selectedText.get().length) {\n return;\n }\n markdown.off(\".preview\");\n return closePreviewMode();\n });\n });\n };\n markdownCaretPositon = false;\n setCaretPosition = function(elm, caretPos) {\n var range;\n if (elm.createTextRange) {\n range = elm.createTextRange();\n range.move(\"character\", caretPos);\n return range.select();\n } else if (elm.selectionStart) {\n elm.focus();\n return elm.setSelectionRange(caretPos, caretPos);\n }\n };\n removeEmptyLine = function(textarea, line, currentCaretPosition) {\n var lines, removedLineLength;\n lines = textarea.value.split(\"\\n\");\n removedLineLength = lines[line].length;\n lines[line] = \"\";\n textarea.value = lines.join(\"\\n\");\n return currentCaretPosition - removedLineLength + 1;\n };\n markdownSettings = {\n nameSpace: \"markdown\",\n onShiftEnter: {\n keepDefault: false,\n openWith: \"\\n\\n\"\n },\n onEnter: {\n keepDefault: false,\n replaceWith: (function(_this) {\n return function(data) {\n var breakLineAtBeginning, cursorLine, emptyListItem, lastLine, lines, match, newLineContent;\n lines = data.textarea.value.split(\"\\n\");\n cursorLine = data.textarea.value.slice(0, +(data.caretPosition - 1) + 1 || 9e9).split(\"\\n\").length;\n newLineContent = data.textarea.value.slice(data.caretPosition).split(\"\\n\")[0];\n lastLine = lines[cursorLine - 1];\n match = lastLine.match(/^(\\s*- ).*/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*)\\-\\s$/);\n if (emptyListItem) {\n markdownCaretPositon = removeEmptyLine(data.textarea, lines.length - 1, data.caretPosition);\n } else {\n breakLineAtBeginning = newLineContent.match(/^(\\s*)\\-\\s/);\n if (!breakLineAtBeginning) {\n if (match) {\n return \"\\n\" + match[1];\n }\n }\n }\n }\n match = lastLine.match(/^(\\s*\\* ).*/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*\\* )$/);\n if (emptyListItem) {\n markdownCaretPositon = removeEmptyLine(data.textarea, lines.length - 1, data.caretPosition);\n } else {\n breakLineAtBeginning = newLineContent.match(/^(\\s*)\\*\\s/);\n if (!breakLineAtBeginning) {\n if (match) {\n return \"\\n\" + match[1];\n }\n }\n }\n }\n match = lastLine.match(/^(\\s*)(\\d+)\\.\\s/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*)(\\d+)\\.\\s$/);\n if (emptyListItem) {\n markdownCaretPositon = removeEmptyLine(data.textarea, lines.length - 1, data.caretPosition);\n } else {\n breakLineAtBeginning = newLineContent.match(/^(\\s*)(\\d+)\\.\\s/);\n if (!breakLineAtBeginning) {\n return \"\\n\" + (match[1] + (parseInt(match[2], 10) + 1)) + \". \";\n }\n }\n }\n return \"\\n\";\n };\n })(this),\n afterInsert: function(data) {\n var caretPosition, line, scrollRelation, totalLines;\n if (markdownCaretPositon) {\n setCaretPosition(data.textarea, markdownCaretPositon);\n caretPosition = markdownCaretPositon;\n markdownCaretPositon = false;\n } else {\n caretPosition = data.caretPosition;\n }\n totalLines = data.textarea.value.split(\"\\n\").length;\n line = data.textarea.value.slice(0, +(caretPosition - 1) + 1 || 9e9).split(\"\\n\").length;\n scrollRelation = line / totalLines;\n return $el.scrollTop((scrollRelation * $el[0].scrollHeight) - ($el.height() / 2));\n }\n },\n markupSet: [\n {\n name: $tr.t(\"markdown-editor.heading-1\"),\n key: \"1\",\n placeHolder: $tr.t(\"markdown-editor.placeholder\"),\n closeWith: function(markItUp) {\n return markdownTitle(markItUp, \"=\");\n }\n }, {\n name: $tr.t(\"markdown-editor.heading-2\"),\n key: \"2\",\n placeHolder: $tr.t(\"markdown-editor.placeholder\"),\n closeWith: function(markItUp) {\n return markdownTitle(markItUp, \"-\");\n }\n }, {\n name: $tr.t(\"markdown-editor.heading-3\"),\n key: \"3\",\n openWith: \"### \",\n placeHolder: $tr.t(\"markdown-editor.placeholder\")\n }, {\n separator: \"---------------\"\n }, {\n name: $tr.t(\"markdown-editor.bold\"),\n key: \"B\",\n openWith: \"**\",\n closeWith: \"**\"\n }, {\n name: $tr.t(\"markdown-editor.italic\"),\n key: \"I\",\n openWith: \"_\",\n closeWith: \"_\"\n }, {\n name: $tr.t(\"markdown-editor.strike\"),\n key: \"S\",\n openWith: \"~~\",\n closeWith: \"~~\"\n }, {\n separator: \"---------------\"\n }, {\n name: $tr.t(\"markdown-editor.bulleted-list\"),\n openWith: \"- \"\n }, {\n name: $tr.t(\"markdown-editor.numeric-list\"),\n openWith: function(markItUp) {\n return markItUp.line + \". \";\n }\n }, {\n separator: \"---------------\"\n }, {\n name: $tr.t(\"markdown-editor.picture\"),\n key: \"P\",\n replaceWith: '![[![Alternative text]!]]([![Url:!:http://]!] \"[![Title]!]\")'\n }, {\n name: $tr.t(\"markdown-editor.link\"),\n key: \"L\",\n openWith: \"[\",\n closeWith: ']([![Url:!:http://]!] \"[![Title]!]\")',\n placeHolder: $tr.t(\"markdown-editor.link-placeholder\")\n }, {\n separator: \"---------------\"\n }, {\n name: $tr.t(\"markdown-editor.quotes\"),\n openWith: \"> \"\n }, {\n name: $tr.t(\"markdown-editor.code-block\"),\n openWith: \"```\\n\",\n closeWith: \"\\n```\"\n }, {\n separator: \"---------------\"\n }, {\n name: $tr.t(\"markdown-editor.preview\"),\n call: preview,\n className: \"preview-icon\"\n }\n ],\n afterInsert: function(event) {\n var target;\n target = angular.element(event.textarea);\n return $model.$setViewValue(target.val());\n }\n };\n markdownTitle = function(markItUp, char) {\n var heading, i, n, _i, _ref;\n heading = \"\";\n n = $.trim(markItUp.selection || markItUp.placeHolder).length;\n for (i = _i = 0, _ref = n - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {\n heading += char;\n }\n return \"\\n\" + heading + \"\\n\";\n };\n element.markItUp(markdownSettings);\n element.on(\"keypress\", function(event) {\n return $scope.$apply();\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(\"tgMarkitup\", [\"$rootScope\", \"$tgResources\", \"$tgI18n\", \"$selectedText\", \"$tgTemplate\", tgMarkitupDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var BacklogFiltersDirective, bindOnce, debounceLeading, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n debounceLeading = this.taiga.debounceLeading;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogFiltersDirective = function($log, $location, $templates) {\n var link, template, templateSelected;\n template = $templates.get(\"backlog/filters.html\", true);\n templateSelected = $templates.get(\"backlog/filter-selected.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, initializeSelectedFilters, renderFilters, renderSelectedFilters, selectQFilter, selectedFilters, showCategories, showFilters, toggleFilterSelection;\n $ctrl = $el.closest(\".wrapper\").controller();\n selectedFilters = [];\n showFilters = function(title, type) {\n $el.find(\".filters-cats\").hide();\n $el.find(\".filter-list\").removeClass(\"hidden\");\n $el.find(\"h2.breadcrumb\").removeClass(\"hidden\");\n $el.find(\"h2 a.subfilter span.title\").html(title);\n return $el.find(\"h2 a.subfilter span.title\").prop(\"data-type\", type);\n };\n showCategories = function() {\n $el.find(\".filters-cats\").show();\n $el.find(\".filter-list\").addClass(\"hidden\");\n return $el.find(\"h2.breadcrumb\").addClass(\"hidden\");\n };\n initializeSelectedFilters = function(filters) {\n var name, val, values, _i, _len;\n showCategories();\n selectedFilters = [];\n for (name in filters) {\n values = filters[name];\n for (_i = 0, _len = values.length; _i < _len; _i++) {\n val = values[_i];\n if (val.selected) {\n selectedFilters.push(val);\n }\n }\n }\n return renderSelectedFilters();\n };\n renderSelectedFilters = function() {\n var html;\n _.map(selectedFilters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = templateSelected({\n filters: selectedFilters\n });\n return $el.find(\".filters-applied\").html(html);\n };\n renderFilters = function(filters) {\n var html;\n _.map(filters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = template({\n filters: filters\n });\n return $el.find(\".filter-list\").html(html);\n };\n toggleFilterSelection = function(type, id) {\n var currentFiltersType, filter, filters;\n filters = $scope.filters[type];\n filter = _.find(filters, {\n id: taiga.toString(id)\n });\n filter.selected = !filter.selected;\n if (filter.selected) {\n selectedFilters.push(filter);\n $scope.$apply(function() {\n $ctrl.selectFilter(type, id);\n return $ctrl.filterVisibleUserstories();\n });\n } else {\n selectedFilters = _.reject(selectedFilters, filter);\n $scope.$apply(function() {\n $ctrl.unselectFilter(type, id);\n return $ctrl.filterVisibleUserstories();\n });\n }\n renderSelectedFilters(selectedFilters);\n currentFiltersType = $el.find(\"h2 a.subfilter span.title\").prop('data-type');\n if (type === currentFiltersType) {\n renderFilters(_.reject(filters, \"selected\"));\n }\n return $ctrl.loadUserstories();\n };\n selectQFilter = debounceLeading(100, function(value) {\n if (value === void 0) {\n return;\n }\n if (value.length === 0) {\n $ctrl.replaceFilter(\"q\", null);\n } else {\n $ctrl.replaceFilter(\"q\", value);\n }\n return $ctrl.loadUserstories();\n });\n $scope.$watch(\"filtersQ\", selectQFilter);\n $scope.$on(\"filters:loaded\", function(ctx, filters) {\n return initializeSelectedFilters(filters);\n });\n $el.on(\"click\", \".filters-cats > ul > li > a\", function(event) {\n var tags, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n tags = $scope.filters[target.data(\"type\")];\n renderFilters(_.reject(tags, \"selected\"));\n return showFilters(target.attr(\"title\"), target.data(\"type\"));\n });\n $el.on(\"click\", \".filters-inner > .filters-step-cat > .breadcrumb > .back\", function(event) {\n event.preventDefault();\n return showCategories();\n });\n $el.on(\"click\", \".filters-applied a\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n id = target.data(\"id\");\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n return $el.on(\"click\", \".filter-list .single-filter\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n if (target.hasClass(\"active\")) {\n target.removeClass(\"active\");\n } else {\n target.addClass(\"active\");\n }\n id = target.data(\"id\");\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogFilters\", [\"$log\", \"$tgLocation\", \"$tgTemplate\", BacklogFiltersDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var CreateEditSprint, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaBacklog\");\n\n CreateEditSprint = function($repo, $confirm, $rs, $rootscope, lightboxService, $loading) {\n var link;\n link = function($scope, $el, attrs) {\n var createSprint, hasErrors, remove, submit, submitButton;\n hasErrors = false;\n createSprint = true;\n $scope.sprint = {\n project: null,\n name: null,\n estimated_start: null,\n estimated_finish: null\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, form, newSprint, promise, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n hasErrors = true;\n $el.find(\".last-sprint-name\").addClass(\"disappear\");\n return;\n }\n hasErrors = false;\n newSprint = angular.copy($scope.sprint);\n broadcastEvent = null;\n if (createSprint) {\n newSprint.estimated_start = moment(newSprint.estimated_start).format(\"YYYY-MM-DD\");\n newSprint.estimated_finish = moment(newSprint.estimated_finish).format(\"YYYY-MM-DD\");\n promise = $repo.create(\"milestones\", newSprint);\n broadcastEvent = \"sprintform:create:success\";\n } else {\n newSprint.setAttr(\"estimated_start\", moment(newSprint.estimated_start).format(\"YYYY-MM-DD\"));\n newSprint.setAttr(\"estimated_finish\", moment(newSprint.estimated_finish).format(\"YYYY-MM-DD\"));\n promise = $repo.save(newSprint);\n broadcastEvent = \"sprintform:edit:success\";\n }\n $loading.start(submitButton);\n promise.then(function(data) {\n $loading.finish(submitButton);\n if (createSprint) {\n $scope.sprintsCounter += 1;\n }\n $rootscope.$broadcast(broadcastEvent, data);\n return lightboxService.close($el);\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"light-error\", data._error_message);\n } else if (data.__all__) {\n return $confirm.notify(\"light-error\", data.__all__[0]);\n }\n });\n };\n })(this));\n remove = function() {\n var message, title;\n title = \"Delete sprint\";\n message = $scope.sprint.name;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var onError, onSuccess;\n onSuccess = function() {\n finish();\n $scope.milestonesCounter -= 1;\n lightboxService.close($el);\n return $rootscope.$broadcast(\"sprintform:remove:success\");\n };\n onError = function() {\n finish(false);\n return $confirm.notify(\"error\");\n };\n return $repo.remove($scope.sprint).then(onSuccess, onError);\n };\n })(this));\n };\n $scope.$on(\"sprintform:create\", function(event, projectId) {\n var estimatedFinish, estimatedStart, lastSprint, lastSprintNameDom;\n createSprint = true;\n $scope.sprint.project = projectId;\n $scope.sprint.name = null;\n $scope.sprint.slug = null;\n lastSprint = $scope.sprints[0];\n estimatedStart = moment();\n if ($scope.sprint.estimated_start) {\n estimatedStart = moment($scope.sprint.estimated_start);\n } else if (lastSprint != null) {\n estimatedStart = moment(lastSprint.estimated_finish);\n }\n $scope.sprint.estimated_start = estimatedStart.format(\"DD MMM YYYY\");\n estimatedFinish = moment().add(2, \"weeks\");\n if ($scope.sprint.estimated_finish) {\n estimatedFinish = moment($scope.sprint.estimated_finish);\n } else if (lastSprint != null) {\n estimatedFinish = moment(lastSprint.estimated_finish).add(2, \"weeks\");\n }\n $scope.sprint.estimated_finish = estimatedFinish.format(\"DD MMM YYYY\");\n lastSprintNameDom = $el.find(\".last-sprint-name\");\n if ((lastSprint != null ? lastSprint.name : void 0) != null) {\n lastSprintNameDom.html(\" last sprint is \" + lastSprint.name + \" ;-) \");\n }\n $el.find(\".delete-sprint\").addClass(\"hidden\");\n $el.find(\".title\").text(\"New sprint\");\n $el.find(\".button-green\").text(\"Create\");\n lightboxService.open($el);\n $el.find(\".sprint-name\").focus();\n return $el.find(\".last-sprint-name\").removeClass(\"disappear\");\n });\n $scope.$on(\"sprintform:edit\", function(ctx, sprint) {\n createSprint = false;\n $scope.$apply(function() {\n $scope.sprint = sprint;\n $scope.sprint.estimated_start = moment($scope.sprint.estimated_start).format(\"DD MMM YYYY\");\n return $scope.sprint.estimated_finish = moment($scope.sprint.estimated_finish).format(\"DD MMM YYYY\");\n });\n $el.find(\".delete-sprint\").removeClass(\"hidden\");\n $el.find(\".title\").text(\"Edit sprint\");\n $el.find(\".button-green\").text(\"Save\");\n lightboxService.open($el);\n $el.find(\".sprint-name\").focus().select();\n return $el.find(\".last-sprint-name\").addClass(\"disappear\");\n });\n $el.on(\"keyup\", \".sprint-name\", function(event) {\n if ($el.find(\".sprint-name\").val().length > 0 || hasErrors) {\n return $el.find(\".last-sprint-name\").addClass(\"disappear\");\n } else {\n return $el.find(\".last-sprint-name\").removeClass(\"disappear\");\n }\n });\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n $el.on(\"click\", \".delete-sprint .icon-delete\", function(event) {\n event.preventDefault();\n return remove();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateEditSprint\", [\"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", CreateEditSprint]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var BacklogController, BacklogDirective, TgBacklogProgressBarDirective, UsPointsDirective, UsRolePointsSelectorDirective, bindMethods, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, tgBacklogGraphDirective, timeout, toggleText,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogController = (function(_super) {\n __extends(BacklogController, _super);\n\n BacklogController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$appTitle\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"tgLoader\"];\n\n function BacklogController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_appTitle, _at_navUrls, _at_events, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.events = _at_events;\n this.analytics = _at_analytics;\n bindMethods(this);\n this.scope.sectionName = \"Backlog\";\n this.showTags = false;\n this.activeFilters = false;\n this.excludeClosedSprints = true;\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this.appTitle.set(\"Backlog - \" + _this.scope.project.name);\n if (_this.rs.userstories.getShowTags(_this.scope.projectId)) {\n _this.showTags = true;\n return _this.scope.$broadcast(\"showTags\", _this.showTags);\n }\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n BacklogController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"usform:bulk:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.loadProjectStats();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"bulk create userstory on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"sprintform:create:success\", (function(_this) {\n return function() {\n _this.loadSprints();\n _this.loadProjectStats();\n return _this.analytics.trackEvent(\"sprint\", \"create\", \"create sprint on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"usform:new:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.loadProjectStats();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"create userstory on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"sprintform:edit:success\", (function(_this) {\n return function() {\n return _this.loadProjectStats();\n };\n })(this));\n this.scope.$on(\"sprintform:remove:success\", (function(_this) {\n return function() {\n _this.loadSprints();\n _this.loadProjectStats();\n return _this.loadUserstories();\n };\n })(this));\n this.scope.$on(\"usform:edit:success\", (function(_this) {\n return function() {\n return _this.loadUserstories();\n };\n })(this));\n this.scope.$on(\"sprint:us:move\", this.moveUs);\n this.scope.$on(\"sprint:us:moved\", this.loadSprints);\n this.scope.$on(\"sprint:us:moved\", this.loadProjectStats);\n return this.scope.$on(\"backlog:toggle-closed-sprints-visualization\", this.toggleClosedSprintsVisualization);\n };\n\n BacklogController.prototype.initializeSubscription = function() {\n var routingKey1, routingKey2;\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n _this.loadUserstories();\n return _this.loadSprints();\n };\n })(this));\n routingKey2 = \"changes.project.\" + this.scope.projectId + \".milestones\";\n return this.events.subscribe(this.scope, routingKey2, (function(_this) {\n return function(message) {\n return _this.loadSprints();\n };\n })(this));\n };\n\n BacklogController.prototype.toggleShowTags = function() {\n return this.scope.$apply((function(_this) {\n return function() {\n _this.showTags = !_this.showTags;\n return _this.rs.userstories.storeShowTags(_this.scope.projectId, _this.showTags);\n };\n })(this));\n };\n\n BacklogController.prototype.toggleActiveFilters = function() {\n return this.activeFilters = !this.activeFilters;\n };\n\n BacklogController.prototype.loadProjectStats = function() {\n return this.rs.projects.stats(this.scope.projectId).then((function(_this) {\n return function(stats) {\n _this.scope.stats = stats;\n if (stats.total_points) {\n _this.scope.stats.completedPercentage = Math.round(100 * stats.closed_points / stats.total_points);\n } else {\n _this.scope.stats.completedPercentage = 0;\n }\n return stats;\n };\n })(this));\n };\n\n BacklogController.prototype.refreshTagsColors = function() {\n return this.rs.projects.tagsColors(this.scope.projectId).then((function(_this) {\n return function(tags_colors) {\n return _this.scope.project.tags_colors = tags_colors;\n };\n })(this));\n };\n\n BacklogController.prototype.loadSprints = function() {\n var params;\n params = {};\n if (this.excludeClosedSprints) {\n params[\"closed\"] = false;\n }\n return this.rs.sprints.list(this.scope.projectId, params).then((function(_this) {\n return function(sprints) {\n var sprint, _i, _len;\n for (_i = 0, _len = sprints.length; _i < _len; _i++) {\n sprint = sprints[_i];\n sprint.user_stories = _.sortBy(sprint.user_stories, \"sprint_order\");\n }\n _this.scope.sprints = sprints;\n _this.scope.openSprints = _.filter(sprints, function(sprint) {\n return !sprint.closed;\n }).reverse();\n _this.scope.closedSprints = _.filter(sprints, function(sprint) {\n return sprint.closed;\n });\n if (!_this.excludeClosedSprints) {\n _this.scope.totalClosedMilestones = _this.scope.closedSprints.length;\n }\n _this.scope.sprintsCounter = sprints.length;\n _this.scope.sprintsById = groupBy(sprints, function(x) {\n return x.id;\n });\n _this.rootscope.$broadcast(\"sprints:loaded\", sprints);\n return sprints;\n };\n })(this));\n };\n\n BacklogController.prototype.resetFilters = function() {\n var selectedStatuses, selectedTags;\n selectedTags = _.filter(this.scope.filters.tags, \"selected\");\n selectedStatuses = _.filter(this.scope.filters.statuses, \"selected\");\n this.scope.filtersQ = \"\";\n _.each([selectedTags, selectedStatuses], (function(_this) {\n return function(filterGrp) {\n return _.each(filterGrp, function(item) {\n var filter, filters;\n filters = _this.scope.filters[item.type];\n filter = _.find(filters, {\n id: taiga.toString(item.id)\n });\n filter.selected = false;\n return _this.unselectFilter(item.type, item.id);\n });\n };\n })(this));\n return this.loadUserstories();\n };\n\n BacklogController.prototype.loadUserstories = function() {\n var promise;\n this.scope.httpParams = this.getUrlFilters();\n this.rs.userstories.storeQueryParams(this.scope.projectId, this.scope.httpParams);\n promise = this.q.all([this.refreshTagsColors(), this.rs.userstories.listUnassigned(this.scope.projectId, this.scope.httpParams)]);\n return promise.then((function(_this) {\n return function(data) {\n var userstories;\n userstories = data[1];\n _this.scope.userstories = _.sortBy(userstories, \"backlog_order\");\n _this.generateFilters();\n _this.filterVisibleUserstories();\n _this.rootscope.$broadcast(\"filters:loaded\", _this.scope.filters);\n scopeDefer(_this.scope, function() {\n return _this.scope.$broadcast(\"userstories:loaded\");\n });\n return userstories;\n };\n })(this));\n };\n\n BacklogController.prototype.loadBacklog = function() {\n return this.q.all([this.loadProjectStats(), this.loadSprints(), this.loadUserstories()]);\n };\n\n BacklogController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.totalClosedMilestones = project.total_closed_milestones;\n _this.scope.$emit('project:loaded', project);\n _this.scope.points = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"id\");\n return project;\n };\n })(this));\n };\n\n BacklogController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.initializeSubscription();\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadBacklog();\n };\n })(this));\n };\n\n BacklogController.prototype.toggleClosedSprintsVisualization = function() {\n this.excludeClosedSprints = !this.excludeClosedSprints;\n return this.loadSprints();\n };\n\n BacklogController.prototype.filterVisibleUserstories = function() {\n var selectedStatuses, selectedTags;\n this.scope.visibleUserstories = [];\n selectedTags = _.filter(this.scope.filters.tags, \"selected\");\n selectedTags = _.map(selectedTags, \"name\");\n if (selectedTags.length === 0) {\n this.scope.visibleUserstories = _.clone(this.scope.userstories, false);\n } else {\n this.scope.visibleUserstories = _.reject(this.scope.userstories, (function(_this) {\n return function(us) {\n if (_.intersection(selectedTags, us.tags).length === 0) {\n return true;\n }\n return false;\n };\n })(this));\n }\n selectedStatuses = _.filter(this.scope.filters.statuses, \"selected\");\n selectedStatuses = _.map(selectedStatuses, \"id\");\n if (selectedStatuses.length > 0) {\n this.scope.visibleUserstories = _.reject(this.scope.visibleUserstories, (function(_this) {\n return function(us) {\n var res;\n res = _.find(selectedStatuses, function(x) {\n return x === taiga.toString(us.status);\n });\n return !res;\n };\n })(this));\n }\n return this.rs.userstories.storeQueryParams(this.scope.projectId, {\n \"status\": selectedStatuses,\n \"tags\": selectedTags,\n \"project\": this.scope.projectId,\n \"milestone\": null\n });\n };\n\n BacklogController.prototype.prepareBulkUpdateData = function(uses, field) {\n if (field == null) {\n field = \"backlog_order\";\n }\n return _.map(uses, function(x) {\n return {\n \"us_id\": x.id,\n \"order\": x[field]\n };\n });\n };\n\n BacklogController.prototype.resortUserStories = function(uses, field) {\n var index, item, items, _i, _len;\n if (field == null) {\n field = \"backlog_order\";\n }\n items = [];\n for (index = _i = 0, _len = uses.length; _i < _len; index = ++_i) {\n item = uses[index];\n item[field] = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n BacklogController.prototype.moveUs = function(ctx, usList, newUsIndex, newSprintId) {\n var data, items, newSprint, oldSprintId, project, promise, promises, us, userstories, _i, _j, _k, _len, _len1, _len2;\n oldSprintId = usList[0].milestone;\n project = usList[0].project;\n if (newSprintId === oldSprintId) {\n items = null;\n userstories = null;\n if (newSprintId === null) {\n userstories = this.scope.userstories;\n } else {\n userstories = this.scope.sprintsById[newSprintId].user_stories;\n }\n this.scope.$apply(function() {\n var args, key, r, us, _i, _len;\n for (key = _i = 0, _len = usList.length; _i < _len; key = ++_i) {\n us = usList[key];\n r = userstories.indexOf(us);\n userstories.splice(r, 1);\n }\n args = [newUsIndex, 0].concat(usList);\n return Array.prototype.splice.apply(userstories, args);\n });\n if (newSprintId === null) {\n items = this.resortUserStories(userstories, \"backlog_order\");\n data = this.prepareBulkUpdateData(items, \"backlog_order\");\n this.rs.userstories.bulkUpdateBacklogOrder(project, data).then((function(_this) {\n return function() {\n var us, _i, _len, _results;\n _results = [];\n for (_i = 0, _len = usList.length; _i < _len; _i++) {\n us = usList[_i];\n _results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return _results;\n };\n })(this));\n } else {\n items = this.resortUserStories(userstories, \"sprint_order\");\n data = this.prepareBulkUpdateData(items, \"sprint_order\");\n this.rs.userstories.bulkUpdateSprintOrder(project, data).then((function(_this) {\n return function() {\n var us, _i, _len, _results;\n _results = [];\n for (_i = 0, _len = usList.length; _i < _len; _i++) {\n us = usList[_i];\n _results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return _results;\n };\n })(this));\n }\n return promise;\n }\n if (newSprintId === null) {\n for (_i = 0, _len = usList.length; _i < _len; _i++) {\n us = usList[_i];\n us.milestone = null;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, key, r, sprint, _j, _len1, _results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(_this.scope.userstories, args);\n Array.prototype.splice.apply(_this.scope.visibleUserstories, args);\n _this.filterVisibleUserstories();\n sprint = _this.scope.sprintsById[oldSprintId];\n _results = [];\n for (key = _j = 0, _len1 = usList.length; _j < _len1; key = ++_j) {\n us = usList[key];\n r = sprint.user_stories.indexOf(us);\n _results.push(sprint.user_stories.splice(r, 1));\n }\n return _results;\n };\n })(this));\n promise = this.repo.save(us);\n promise = promise.then((function(_this) {\n return function() {\n items = _this.resortUserStories(_this.scope.userstories, \"backlog_order\");\n data = _this.prepareBulkUpdateData(items, \"backlog_order\");\n return _this.rs.userstories.bulkUpdateBacklogOrder(us.project, data).then(function() {\n return _this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId);\n });\n };\n })(this));\n promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n return promise;\n }\n newSprint = this.scope.sprintsById[newSprintId];\n if (oldSprintId === null) {\n for (_j = 0, _len1 = usList.length; _j < _len1; _j++) {\n us = usList[_j];\n us.milestone = newSprintId;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, key, r, _k, _len2, _results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(newSprint.user_stories, args);\n _results = [];\n for (key = _k = 0, _len2 = usList.length; _k < _len2; key = ++_k) {\n us = usList[key];\n r = _this.scope.visibleUserstories.indexOf(us);\n _this.scope.visibleUserstories.splice(r, 1);\n r = _this.scope.userstories.indexOf(us);\n _results.push(_this.scope.userstories.splice(r, 1));\n }\n return _results;\n };\n })(this));\n } else {\n for (_k = 0, _len2 = usList.length; _k < _len2; _k++) {\n us = usList[_k];\n us.milestone = newSprintId;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, oldSprint, r, _l, _len3, _results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(newSprint.user_stories, args);\n _results = [];\n for (_l = 0, _len3 = usList.length; _l < _len3; _l++) {\n us = usList[_l];\n oldSprint = _this.scope.sprintsById[oldSprintId];\n r = oldSprint.user_stories.indexOf(us);\n _results.push(oldSprint.user_stories.splice(r, 1));\n }\n return _results;\n };\n })(this));\n }\n promises = _.map(usList, (function(_this) {\n return function(us) {\n return _this.repo.save(us);\n };\n })(this));\n promise = this.q.all(promises).then((function(_this) {\n return function() {\n items = _this.resortUserStories(newSprint.user_stories, \"sprint_order\");\n data = _this.prepareBulkUpdateData(items, \"sprint_order\");\n _this.rs.userstories.bulkUpdateSprintOrder(project, data).then(function() {\n return _this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId);\n });\n return _this.rs.userstories.bulkUpdateBacklogOrder(project, data).then(function() {\n var _l, _len3, _results;\n _results = [];\n for (_l = 0, _len3 = usList.length; _l < _len3; _l++) {\n us = usList[_l];\n _results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return _results;\n });\n };\n })(this));\n promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n return promise;\n };\n\n BacklogController.prototype.getUrlFilters = function() {\n return _.pick(this.location.search(), \"statuses\", \"tags\", \"q\");\n };\n\n BacklogController.prototype.generateFilters = function() {\n var isSelected, name, plainStatuses, plainTags, searchdata, urlfilters, val, value, _i, _len, _ref;\n urlfilters = this.getUrlFilters();\n if (urlfilters.q) {\n this.scope.filtersQ = this.scope.filtersQ || urlfilters.q;\n }\n searchdata = {};\n for (name in urlfilters) {\n value = urlfilters[name];\n if (searchdata[name] == null) {\n searchdata[name] = {};\n }\n _ref = taiga.toString(value).split(\",\");\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n val = _ref[_i];\n searchdata[name][val] = true;\n }\n }\n isSelected = function(type, id) {\n if ((searchdata[type] != null) && searchdata[type][id]) {\n return true;\n }\n return false;\n };\n this.scope.filters = {};\n plainTags = _.flatten(_.filter(_.map(this.scope.userstories, \"tags\")));\n plainTags.sort();\n this.scope.filters.tags = _.map(_.countBy(plainTags), (function(_this) {\n return function(v, k) {\n var obj;\n obj = {\n id: k,\n type: \"tags\",\n name: k,\n color: _this.scope.project.tags_colors[k],\n count: v\n };\n if (isSelected(\"tags\", obj.id)) {\n obj.selected = true;\n }\n return obj;\n };\n })(this));\n plainStatuses = _.map(this.scope.userstories, \"status\");\n plainStatuses = _.filter(plainStatuses, (function(_this) {\n return function(status) {\n if (status) {\n return status;\n }\n };\n })(this));\n this.scope.filters.statuses = _.map(_.countBy(plainStatuses), (function(_this) {\n return function(v, k) {\n var obj;\n obj = {\n id: k,\n type: \"statuses\",\n name: _this.scope.usStatusById[k].name,\n color: _this.scope.usStatusById[k].color,\n count: v\n };\n if (isSelected(\"statuses\", obj.id)) {\n obj.selected = true;\n }\n return obj;\n };\n })(this));\n return this.scope.filters;\n };\n\n BacklogController.prototype.editUserStory = function(us) {\n return this.rootscope.$broadcast(\"usform:edit\", us);\n };\n\n BacklogController.prototype.deleteUserStory = function(us) {\n var message, title;\n title = \"Delete User Story\";\n message = us.subject;\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var promise;\n _this.scope.userstories = _.without(_this.scope.userstories, us);\n _this.filterVisibleUserstories();\n promise = _this.repo.remove(us);\n promise.then(function() {\n finish();\n return _this.loadBacklog();\n });\n return promise.then(null, function() {\n finish(false);\n return _this.confirm.notify(\"error\");\n });\n };\n })(this));\n };\n\n BacklogController.prototype.addNewUs = function(type) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"usform:new\", this.scope.projectId, this.scope.project.default_us_status, this.scope.usStatusList);\n case \"bulk\":\n return this.rootscope.$broadcast(\"usform:bulk\", this.scope.projectId, this.scope.project.default_us_status);\n }\n };\n\n BacklogController.prototype.addNewSprint = function() {\n return this.rootscope.$broadcast(\"sprintform:create\", this.scope.projectId);\n };\n\n return BacklogController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"BacklogController\", BacklogController);\n\n BacklogDirective = function($repo, $rootscope) {\n var doomLineTemplate, link, linkDoomLine, linkFilters, linkToolbar, showHideFilter, showHideTags;\n doomLineTemplate = _.template(\"
Project Scope [Doomline]
\");\n linkDoomLine = function($scope, $el, $attrs, $ctrl) {\n var addDoomLineDom, getUsItems, reloadDoomLine, removeDoomlineDom;\n reloadDoomLine = function() {\n var current_sum, element, elements, scope, stats, total_points, _i, _len, _results;\n if ($scope.stats != null) {\n removeDoomlineDom();\n elements = getUsItems();\n stats = $scope.stats;\n total_points = stats.total_points;\n current_sum = stats.assigned_points;\n _results = [];\n for (_i = 0, _len = elements.length; _i < _len; _i++) {\n element = elements[_i];\n scope = element.scope();\n if (scope.us == null) {\n continue;\n }\n current_sum += scope.us.total_points;\n if (current_sum > total_points) {\n addDoomLineDom(element);\n break;\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n }\n };\n removeDoomlineDom = function() {\n return $el.find(\".doom-line\").remove();\n };\n addDoomLineDom = function(element) {\n return element != null ? element.before(doomLineTemplate({})) : void 0;\n };\n getUsItems = function() {\n var rowElements;\n rowElements = $el.find('.backlog-table-body .us-item-row');\n return _.map(rowElements, function(x) {\n return angular.element(x);\n });\n };\n $scope.$on(\"userstories:loaded\", reloadDoomLine);\n return $scope.$watch(\"stats\", reloadDoomLine);\n };\n linkToolbar = function($scope, $el, $attrs, $ctrl) {\n var moveToCurrentSprint;\n moveToCurrentSprint = function(selectedUss) {\n var extraPoints, totalExtraPoints, ussCurrent;\n ussCurrent = _($scope.userstories);\n $scope.userstories = ussCurrent.without.apply(ussCurrent, selectedUss).value();\n extraPoints = _.map(selectedUss, function(v, k) {\n return v.total_points;\n });\n totalExtraPoints = _.reduce(extraPoints, function(acc, num) {\n return acc + num;\n });\n $scope.sprints[0].user_stories = _.union($scope.sprints[0].user_stories, selectedUss);\n $scope.sprints[0].total_points += totalExtraPoints;\n $ctrl.filterVisibleUserstories();\n return $repo.saveAll(selectedUss).then(function() {\n $ctrl.loadSprints();\n return $ctrl.loadProjectStats();\n });\n };\n $el.on(\"change\", \".backlog-table-body .user-stories input:checkbox\", function(event) {\n var moveToCurrentSprintDom, selectedUsDom, target;\n target = angular.element(event.currentTarget);\n moveToCurrentSprintDom = $el.find(\"#move-to-current-sprint\");\n selectedUsDom = $el.find(\".backlog-table-body .user-stories input:checkbox:checked\");\n if (selectedUsDom.length > 0 && $scope.sprints.length > 0) {\n moveToCurrentSprintDom.show();\n } else {\n moveToCurrentSprintDom.hide();\n }\n return target.closest('.us-item-row').toggleClass('ui-multisortable-multiple');\n });\n $el.on(\"click\", \"#move-to-current-sprint\", (function(_this) {\n return function(event) {\n var ussDom, ussToMove;\n ussDom = $el.find(\".backlog-table-body .user-stories input:checkbox:checked\");\n ussToMove = _.map(ussDom, function(item) {\n var itemScope;\n itemScope = angular.element(item).scope();\n itemScope.us.milestone = $scope.sprints[0].id;\n return itemScope.us;\n });\n return $scope.$apply(_.partial(moveToCurrentSprint, ussToMove));\n };\n })(this));\n return $el.on(\"click\", \"#show-tags\", function(event) {\n event.preventDefault();\n $ctrl.toggleShowTags();\n return showHideTags($ctrl);\n });\n };\n showHideTags = function($ctrl) {\n var elm;\n elm = angular.element(\"#show-tags\");\n if ($ctrl.showTags) {\n elm.addClass(\"active\");\n return elm.find(\".text\").text(\"Hide Tags\");\n } else {\n elm.removeClass(\"active\");\n return elm.find(\".text\").text(\"Show Tags\");\n }\n };\n showHideFilter = function($scope, $el, $ctrl) {\n var sidebar, target;\n sidebar = $el.find(\"sidebar.filters-bar\");\n sidebar.one(\"transitionend\", function() {\n return timeout(150, function() {\n $rootscope.$broadcast(\"resize\");\n return $('.burndown').css(\"visibility\", \"visible\");\n });\n });\n target = angular.element(\"#show-filters-button\");\n $('.burndown').css(\"visibility\", \"hidden\");\n sidebar.toggleClass(\"active\");\n target.toggleClass(\"active\");\n toggleText(target.find(\".text\"), [\"Remove Filters\", \"Show Filters\"]);\n if (!sidebar.hasClass(\"active\")) {\n $ctrl.resetFilters();\n }\n return $ctrl.toggleActiveFilters();\n };\n linkFilters = function($scope, $el, $attrs, $ctrl) {\n $scope.filtersSearch = {};\n return $el.on(\"click\", \"#show-filters-button\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n return showHideFilter($scope, $el, $ctrl);\n });\n });\n };\n link = function($scope, $el, $attrs, $rootscope) {\n var $ctrl, filters;\n $ctrl = $el.controller();\n linkToolbar($scope, $el, $attrs, $ctrl);\n linkFilters($scope, $el, $attrs, $ctrl);\n linkDoomLine($scope, $el, $attrs, $ctrl);\n $el.find(\".backlog-table-body\").disableSelection();\n filters = $ctrl.getUrlFilters();\n if (filters.statuses || filters.tags || filters.q) {\n showHideFilter($scope, $el, $ctrl);\n }\n $scope.$on(\"showTags\", function() {\n return showHideTags($ctrl);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklog\", [\"$tgRepo\", \"$rootScope\", BacklogDirective]);\n\n UsRolePointsSelectorDirective = function($rootscope, $template) {\n var link, selectionTemplate;\n selectionTemplate = $template.get(\"backlog/us-role-points-popover.html\", true);\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var numberOfRoles, roles;\n roles = _.filter(project.roles, \"computable\");\n numberOfRoles = _.size(roles);\n if (numberOfRoles > 1) {\n return $el.append(selectionTemplate({\n \"roles\": roles\n }));\n } else {\n $el.find(\".icon-arrow-bottom\").remove();\n return $el.find(\".header-points\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"uspoints:select\", function(ctx, roleId, roleName) {\n $el.find(\".popover\").popover().close();\n return $el.find(\".header-points\").html(roleName + \"/Total\");\n });\n $scope.$on(\"uspoints:clear-selection\", function(ctx, roleId) {\n $el.find(\".popover\").popover().close();\n return $el.find(\".header-points\").text(\"Points\");\n });\n $el.on(\"click\", function(event) {\n var target;\n target = angular.element(event.target);\n if (target.is(\"span\") || target.is(\"div\")) {\n event.stopPropagation();\n }\n return $el.find(\".popover\").popover().open();\n });\n $el.on(\"click\", \".clear-selection\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $rootscope.$broadcast(\"uspoints:clear-selection\");\n });\n $el.on(\"click\", \".role\", function(event) {\n var rolScope, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n rolScope = target.scope();\n return $rootscope.$broadcast(\"uspoints:select\", target.data(\"role-id\"), target.text());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUsRolePointsSelector\", [\"$rootScope\", \"$tgTemplate\", UsRolePointsSelectorDirective]);\n\n UsPointsDirective = function($repo, $tgTemplate) {\n var link, pointsTemplate, rolesTemplate;\n rolesTemplate = $tgTemplate.get(\"backlog/us-points-roles-popover.html\", true);\n pointsTemplate = $tgTemplate.get(\"backlog/us-points-popover.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, calculateTotalPoints, computableRoles, numberOfRoles, renderPoints, renderPointsSelector, renderRolesSelector, roles, selectedRoleId, updatePointsRoles, updatingSelectedRoleId, us;\n $ctrl = $el.controller();\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n updatingSelectedRoleId = null;\n selectedRoleId = null;\n numberOfRoles = _.size(us.points);\n if (numberOfRoles === 1) {\n selectedRoleId = _.keys(us.points)[0];\n }\n roles = [];\n updatePointsRoles = function() {\n return roles = _.map(computableRoles, function(role) {\n var pointId, pointObj;\n pointId = us.points[role.id];\n pointObj = $scope.pointsById[pointId];\n role = _.clone(role, true);\n role.points = pointObj.value != null ? pointObj.value : \"?\";\n return role;\n });\n };\n computableRoles = _.filter($scope.project.roles, \"computable\");\n updatePointsRoles();\n if (roles.length === 0) {\n $el.find(\".icon-arrow-bottom\").remove();\n $el.find(\"a.us-points\").addClass(\"not-clickable\");\n }\n renderPointsSelector = function(us, roleId) {\n var html, points;\n points = _.map($scope.project.points, function(point) {\n point = _.clone(point, true);\n point.selected = us.points[roleId] === point.id ? false : true;\n return point;\n });\n html = pointsTemplate({\n \"points\": points\n });\n $el.find(\".popover\").popover().close();\n $el.find(\".pop-points-open\").remove();\n $el.append(html);\n if ($el.find(\".pop-role:visible\").css(\"left\") == null) {\n $el.find(\".pop-points-open\").css(\"left\", \"110px\");\n }\n return $el.find(\".pop-points-open\").popover().open();\n };\n renderRolesSelector = function(us) {\n var html;\n updatePointsRoles();\n html = rolesTemplate({\n \"roles\": roles\n });\n $el.append(html);\n return $el.find(\".pop-role\").popover().open(function() {\n return $(this).remove();\n });\n };\n renderPoints = function(us, roleId) {\n var dom, pointId, pointObj, totalPoints;\n dom = $el.find(\"a > span.points-value\");\n if (roleId === null || numberOfRoles === 1) {\n totalPoints = us.total_points != null ? us.total_points : \"?\";\n dom.text(totalPoints);\n return dom.parent().prop(\"title\", totalPoints);\n } else {\n pointId = us.points[roleId];\n pointObj = $scope.pointsById[pointId];\n dom.html(pointObj.name + \" / \" + us.total_points + \"\");\n return dom.parent().prop(\"title\", pointObj.name + \" / \" + us.total_points);\n }\n };\n calculateTotalPoints = function() {\n var values;\n values = _.map(us.points, function(v, k) {\n return $scope.pointsById[v].value;\n });\n values = _.filter(values, function(num) {\n return num != null;\n });\n if (values.length === 0) {\n return \"?\";\n }\n return _.reduce(values, function(acc, num) {\n return acc + num;\n });\n };\n $scope.$watch($attrs.tgBacklogUsPoints, function(us) {\n if (us) {\n return renderPoints(us, selectedRoleId);\n }\n });\n $scope.$on(\"uspoints:select\", function(ctx, roleId, roleName) {\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n renderPoints(us, roleId);\n return selectedRoleId = roleId;\n });\n $scope.$on(\"uspoints:clear-selection\", function(ctx) {\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n renderPoints(us, null);\n return selectedRoleId = null;\n });\n if (roles.length > 0) {\n $el.on(\"click\", \"a.us-points span\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n updatingSelectedRoleId = selectedRoleId;\n if (selectedRoleId != null) {\n return renderPointsSelector(us, selectedRoleId);\n } else {\n return renderRolesSelector(us);\n }\n });\n $el.on(\"click\", \".role\", function(event) {\n var popRolesDom, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n updatingSelectedRoleId = target.data(\"role-id\");\n popRolesDom = $el.find(\".pop-role\");\n popRolesDom.find(\"a\").removeClass(\"active\");\n popRolesDom.find(\"a[data-role-id='\" + updatingSelectedRoleId + \"']\").addClass(\"active\");\n return renderPointsSelector(us, updatingSelectedRoleId);\n });\n $el.on(\"click\", \".point\", function(event) {\n var points, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n $el.find(\".pop-points-open\").hide();\n $el.find(\".pop-role\").hide();\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n points = _.clone(us.points, true);\n points[updatingSelectedRoleId] = target.data(\"point-id\");\n return $scope.$apply(function() {\n us.points = points;\n us.total_points = calculateTotalPoints(us);\n renderPoints(us, selectedRoleId);\n return $repo.save(us).then(function() {\n return $repo.refresh(us).then(function() {\n return $ctrl.loadProjectStats();\n });\n });\n });\n });\n }\n bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\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(\"tgBacklogUsPoints\", [\"$tgRepo\", \"$tgTemplate\", UsPointsDirective]);\n\n tgBacklogGraphDirective = function() {\n var link, redrawChart;\n redrawChart = function(element, dataToDraw) {\n var client_increment_line, colors, data, evolution_line, milestonesRange, optimal_line, options, team_increment_line, width, zero_line, _i, _ref, _results;\n width = element.width();\n element.height(width / 6);\n milestonesRange = (function() {\n _results = [];\n for (var _i = 0, _ref = dataToDraw.milestones.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; 0 <= _ref ? _i++ : _i--){ _results.push(_i); }\n return _results;\n }).apply(this);\n data = [];\n zero_line = _.map(dataToDraw.milestones, function(ml) {\n return 0;\n });\n data.push({\n data: _.zip(milestonesRange, zero_line),\n lines: {\n fillColor: \"rgba(0,0,0,0)\"\n },\n points: {\n show: false\n }\n });\n optimal_line = _.map(dataToDraw.milestones, function(ml) {\n return ml.optimal;\n });\n data.push({\n data: _.zip(milestonesRange, optimal_line),\n lines: {\n fillColor: \"rgba(120,120,120,0.2)\"\n }\n });\n evolution_line = _.filter(_.map(dataToDraw.milestones, function(ml) {\n return ml.evolution;\n }), function(evolution) {\n return evolution != null;\n });\n data.push({\n data: _.zip(milestonesRange, evolution_line),\n lines: {\n fillColor: \"rgba(102,153,51,0.3)\"\n }\n });\n team_increment_line = _.map(dataToDraw.milestones, function(ml) {\n return -ml[\"team-increment\"];\n });\n data.push({\n data: _.zip(milestonesRange, team_increment_line),\n lines: {\n fillColor: \"rgba(153,51,51,0.3)\"\n }\n });\n client_increment_line = _.map(dataToDraw.milestones, function(ml) {\n return -ml[\"team-increment\"] - ml[\"client-increment\"];\n });\n data.push({\n data: _.zip(milestonesRange, client_increment_line),\n lines: {\n fillColor: \"rgba(255,51,51,0.3)\"\n }\n });\n colors = [\"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)\"];\n options = {\n grid: {\n borderWidth: {\n top: 0,\n right: 1,\n left: 0,\n bottom: 0\n },\n borderColor: \"#ccc\",\n hoverable: true\n },\n xaxis: {\n ticks: dataToDraw.milestones.length,\n axisLabel: \"Sprints\",\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 14,\n axisLabelFontFamily: \"Verdana, Arial, Helvetica, Tahoma, sans-serif\",\n axisLabelPadding: 15,\n tickFormatter: function(val, axis) {\n return \"\";\n }\n },\n series: {\n shadowSize: 0,\n lines: {\n show: true,\n fill: true\n },\n points: {\n show: true,\n fill: true,\n radius: 4,\n lineWidth: 2\n }\n },\n colors: colors,\n tooltip: true,\n tooltipOpts: {\n content: function(label, xval, yval, flotItem) {\n if (flotItem.seriesIndex === 1) {\n return \"Optimal pending points for sprint \" + xval + \" should be \" + yval;\n } else if (flotItem.seriesIndex === 2) {\n return \"Real pending points for sprint \" + xval + \" is \" + yval;\n } else if (flotItem.seriesIndex === 3) {\n return \"Incremented points by team requirements for sprint \" + xval + \" is \" + (Math.abs(yval));\n } else {\n return \"Incremented points by client requirements for sprint \" + xval + \" is \" + (Math.abs(yval));\n }\n }\n }\n };\n element.empty();\n return element.plot(data, options).data(\"plot\");\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch(\"stats\", function(value) {\n if ($scope.stats != null) {\n redrawChart(element, $scope.stats);\n return $scope.$on(\"resize\", function() {\n return redrawChart(element, $scope.stats);\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(\"tgGmBacklogGraph\", tgBacklogGraphDirective);\n\n TgBacklogProgressBarDirective = function($template) {\n var adjustPercentaje, link, render, template;\n template = $template.get(\"backlog/progress-bar.html\", true);\n render = function(el, projectPointsPercentaje, closedPointsPercentaje) {\n return el.html(template({\n projectPointsPercentaje: projectPointsPercentaje,\n closedPointsPercentaje: closedPointsPercentaje\n }));\n };\n adjustPercentaje = function(percentage) {\n var adjusted;\n adjusted = _.max([0, percentage]);\n adjusted = _.min([100, adjusted]);\n return Math.round(adjusted);\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch($attrs.tgBacklogProgressBar, function(stats) {\n var closedPoints, closedPointsPercentaje, definedPoints, projectPointsPercentaje, totalPoints;\n if (stats != null) {\n totalPoints = stats.total_points;\n definedPoints = stats.defined_points;\n closedPoints = stats.closed_points;\n if (definedPoints > totalPoints) {\n projectPointsPercentaje = totalPoints * 100 / definedPoints;\n closedPointsPercentaje = closedPoints * 100 / definedPoints;\n } else {\n projectPointsPercentaje = 100;\n closedPointsPercentaje = closedPoints * 100 / totalPoints;\n }\n projectPointsPercentaje = adjustPercentaje(projectPointsPercentaje - 3);\n closedPointsPercentaje = adjustPercentaje(closedPointsPercentaje - 3);\n return render($el, projectPointsPercentaje, closedPointsPercentaje);\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(\"tgBacklogProgressBar\", [\"$tgTemplate\", TgBacklogProgressBarDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/sortable.coffee\n */\n\n(function() {\n var BacklogEmptySortableDirective, BacklogSortableDirective, SprintSortableDirective, bindOnce, deleteElement, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaBacklog\");\n\n deleteElement = function(el) {\n el.scope().$destroy();\n el.off();\n return el.remove();\n };\n\n BacklogSortableDirective = function($repo, $rs, $rootscope, $tgConfirm) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var filterError;\n if (!(project.my_permissions.indexOf(\"modify_us\") > -1)) {\n return;\n }\n filterError = function() {\n return $tgConfirm.notify(\"error\", \"You can't drop on backlog when filters are open\");\n };\n $el.sortable({\n items: \".us-item-row\",\n connectWith: \".sprint\",\n containment: \".wrapper\",\n dropOnEmpty: true,\n placeholder: \"row us-item-row us-item-drag sortable-placeholder\",\n scroll: true,\n tolerance: \"pointer\",\n revert: false,\n cursorAt: {\n right: 15\n },\n stop: function() {\n if ($el.hasClass(\"active-filters\")) {\n $el.sortable(\"cancel\");\n return filterError();\n }\n }\n });\n $el.on(\"multiplesortreceive\", function(event, ui) {\n var itemIndex, itemUs;\n if ($el.hasClass(\"active-filters\")) {\n ui.source.sortable(\"cancel\");\n filterError();\n return;\n }\n itemUs = ui.item.scope().us;\n itemIndex = ui.item.index();\n deleteElement(ui.item);\n $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, null);\n return ui.item.find('a').removeClass('noclick');\n });\n $el.on(\"multiplesortstop\", function(event, ui) {\n var index, items, us;\n if ($(ui.items[0]).parent().length === 0) {\n return;\n }\n items = _.sortBy(ui.items, function(item) {\n return $(item).index();\n });\n index = _.min(_.map(items, function(item) {\n return $(item).index();\n }));\n us = _.map(items, function(item) {\n var itemUs;\n item = $(item);\n itemUs = item.scope().us;\n setTimeout(((function(_this) {\n return function() {\n return item.find('a').removeClass('noclick');\n };\n })(this)), 300);\n return itemUs;\n });\n return $scope.$emit(\"sprint:us:move\", us, index, null);\n });\n return $el.on(\"sortstart\", function(event, ui) {\n return ui.item.find('a').addClass('noclick');\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n BacklogEmptySortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n $el.sortable({\n dropOnEmpty: true\n });\n return $el.on(\"sortreceive\", function(event, ui) {\n var itemIndex, itemUs;\n itemUs = ui.item.scope().us;\n itemIndex = ui.item.index();\n deleteElement(ui.item);\n $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, null);\n return ui.item.find('a').removeClass('noclick');\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n SprintSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n $el.sortable({\n scroll: true,\n dropOnEmpty: true,\n items: \".sprint-table .milestone-us-item-row\",\n connectWith: \".sprint,.backlog-table-body,.empty-backlog\"\n });\n $el.on(\"multiplesortreceive\", function(event, ui) {\n var index, items, us;\n items = _.sortBy(ui.items, function(item) {\n return $(item).index();\n });\n index = _.min(_.map(items, function(item) {\n return $(item).index();\n }));\n us = _.map(items, function(item) {\n var itemUs;\n item = $(item);\n itemUs = item.scope().us;\n deleteElement(item);\n return itemUs;\n });\n return $scope.$emit(\"sprint:us:move\", us, index, $scope.sprint.id);\n });\n $el.on(\"multiplesortstop\", function(event, ui) {\n var itemIndex, itemUs;\n if (ui.item.parent().length === 0) {\n return;\n }\n itemUs = ui.item.scope().us;\n itemIndex = ui.item.index();\n setTimeout(((function(_this) {\n return function() {\n return ui.item.find('a').removeClass('noclick');\n };\n })(this)), 300);\n return $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, $scope.sprint.id);\n });\n return $el.on(\"sortstart\", function(event, ui) {\n return ui.item.find('a').addClass('noclick');\n });\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"$tgConfirm\", BacklogSortableDirective]);\n\n module.directive(\"tgBacklogEmptySortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", BacklogEmptySortableDirective]);\n\n module.directive(\"tgSprintSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", SprintSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/sprints.coffee\n */\n\n(function() {\n var BacklogSprintDirective, BacklogSprintHeaderDirective, ToggleExcludeClosedSprintsVisualization, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogSprintDirective = function($repo, $rootscope) {\n var link, refreshSprintTableHeight, slideOptions, sprintTableMinHeight, toggleSprint;\n sprintTableMinHeight = 50;\n slideOptions = {\n duration: 500,\n easing: 'linear'\n };\n refreshSprintTableHeight = (function(_this) {\n return function(sprintTable) {\n if (!sprintTable.find(\".row\").length) {\n return sprintTable.css(\"height\", sprintTableMinHeight);\n } else {\n return sprintTable.css(\"height\", \"auto\");\n }\n };\n })(this);\n toggleSprint = (function(_this) {\n return function($el) {\n var sprintArrow, sprintTable;\n sprintTable = $el.find(\".sprint-table\");\n sprintArrow = $el.find(\".icon-arrow-up\");\n sprintArrow.toggleClass('active');\n sprintTable.toggleClass('open');\n return refreshSprintTableHeight(sprintTable);\n };\n })(this);\n link = function($scope, $el, $attrs) {\n $scope.$watch($attrs.tgBacklogSprint, function(sprint) {\n sprint = $scope.$eval($attrs.tgBacklogSprint);\n if (sprint.closed) {\n return $el.addClass(\"sprint-closed\");\n } else {\n return toggleSprint($el);\n }\n });\n $el.on(\"click\", \".sprint-name > .icon-arrow-up\", function(event) {\n toggleSprint($el);\n return $el.find(\".sprint-table\").slideToggle(slideOptions);\n });\n $el.on(\"click\", \".sprint-name > .icon-edit\", function(event) {\n var sprint;\n event.preventDefault();\n sprint = $scope.$eval($attrs.tgBacklogSprint);\n return $rootscope.$broadcast(\"sprintform:edit\", sprint);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogSprint\", [\"$tgRepo\", \"$rootScope\", BacklogSprintDirective]);\n\n BacklogSprintHeaderDirective = function($navUrls, $template) {\n var link, template;\n template = $template.get(\"backlog/sprint-header.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, isVisible, render;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_milestone\") !== -1;\n };\n isVisible = function() {\n return $scope.project.my_permissions.indexOf(\"view_milestones\") !== -1;\n };\n render = function(sprint) {\n var ctx, estimatedDateRange, finish, start, taskboardUrl;\n taskboardUrl = $navUrls.resolve(\"project-taskboard\", {\n project: $scope.project.slug,\n sprint: sprint.slug\n });\n start = moment(sprint.estimated_start).format(\"DD MMM YYYY\");\n finish = moment(sprint.estimated_finish).format(\"DD MMM YYYY\");\n estimatedDateRange = start + \"-\" + finish;\n ctx = {\n name: sprint.name,\n taskboardUrl: taskboardUrl,\n estimatedDateRange: estimatedDateRange,\n closedPoints: sprint.closed_points || 0,\n totalPoints: sprint.total_points || 0,\n isVisible: isVisible(),\n isEditable: isEditable()\n };\n return $el.html(template(ctx));\n };\n $scope.$watch($attrs.ngModel, function(sprint) {\n return render(sprint);\n });\n $scope.$on(\"sprintform:edit:success\", function() {\n return render($model.$modelValue);\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(\"tgBacklogSprintHeader\", [\"$tgNavUrls\", \"$tgTemplate\", BacklogSprintHeaderDirective]);\n\n ToggleExcludeClosedSprintsVisualization = function($rootscope, $loading) {\n var excludeClosedSprints, link;\n excludeClosedSprints = false;\n link = function($scope, $el, $attrs) {\n $el.on(\"click\", \"\", function(event) {\n $loading.start($el.parent().siblings('.loading-spinner'));\n return $rootscope.$broadcast(\"backlog:toggle-closed-sprints-visualization\");\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return $scope.$on(\"sprints:loaded\", (function(_this) {\n return function(ctx, sprints) {\n var closedSprints;\n closedSprints = _.filter(sprints, function(sprint) {\n return sprint.closed;\n });\n $loading.finish($el.parent().siblings('.loading-spinner'));\n if (closedSprints.length > 0) {\n return $el.text(\"Hide closed sprints\");\n } else {\n return $el.text(\"Show closed sprints\");\n }\n };\n })(this));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogToggleClosedSprintsVisualization\", [\"$rootScope\", \"$tgLoading\", ToggleExcludeClosedSprintsVisualization]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/charts.coffee\n */\n\n(function() {\n var SprintGraphDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaTaskboard\");\n\n SprintGraphDirective = function() {\n var link, redrawChart;\n redrawChart = function(element, dataToDraw) {\n var data, days, options, width;\n width = element.width();\n element.height(240);\n days = _.map(dataToDraw, function(x) {\n return moment(x.day);\n });\n data = [];\n data.unshift({\n data: _.zip(days, _.map(dataToDraw, function(d) {\n return d.optimal_points;\n })),\n lines: {\n fillColor: \"rgba(120,120,120,0.2)\"\n }\n });\n data.unshift({\n data: _.zip(days, _.map(dataToDraw, function(d) {\n return d.open_points;\n })),\n lines: {\n fillColor: \"rgba(102,153,51,0.3)\"\n }\n });\n options = {\n grid: {\n borderWidth: {\n top: 0,\n right: 1,\n left: 0,\n bottom: 0\n },\n borderColor: '#ccc',\n hoverable: true\n },\n xaxis: {\n tickSize: [1, \"day\"],\n min: days[0],\n max: _.last(days),\n mode: \"time\",\n daysNames: days,\n axisLabel: 'Day',\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',\n axisLabelPadding: 5\n },\n yaxis: {\n min: 0\n },\n series: {\n shadowSize: 0,\n lines: {\n show: true,\n fill: true\n },\n points: {\n show: true,\n fill: true,\n radius: 4,\n lineWidth: 2\n }\n },\n colors: [\"rgba(102,153,51,1)\", \"rgba(120,120,120,0.2)\"],\n tooltip: true,\n tooltipOpts: {\n content: function(label, xval, yval, flotItem) {\n var formattedDate, roundedValue;\n formattedDate = moment(xval).format(\"DD MMM\");\n roundedValue = Math.round(yval);\n if (flotItem.seriesIndex === 1) {\n return \"Optimal pending points for day \" + formattedDate + \" should be \" + roundedValue;\n } else {\n return \"Real pending points for day \" + formattedDate + \" is \" + roundedValue;\n }\n }\n }\n };\n element.empty();\n return element.plot(data, options).data(\"plot\");\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$on(\"resize\", function() {\n if ($scope.stats) {\n return redrawChart(element, $scope.stats.days);\n }\n });\n $scope.$on(\"taskboard:graph:toggle-visibility\", function() {\n $el.parent().toggleClass('open');\n return timeout(100, function() {\n if ($scope.stats) {\n return redrawChart(element, $scope.stats.days);\n }\n });\n });\n $scope.$watch('stats', function(value) {\n if ($scope.stats == null) {\n return;\n }\n return redrawChart(element, $scope.stats.days);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSprintGraph\", SprintGraphDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var CreateBulkTasksDirective, CreateEditTaskDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n CreateEditTaskDirective = function($repo, $model, $rs, $rootscope, $loading, lightboxService) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.isNew = true;\n $scope.$on(\"taskform:new\", function(ctx, sprintId, usId) {\n $scope.task = {\n project: $scope.projectId,\n milestone: sprintId,\n user_story: usId,\n is_archived: false,\n status: $scope.project.default_task_status,\n assigned_to: null,\n tags: []\n };\n $scope.isNew = true;\n $el.find(\".button-green span\").html(\"Create\");\n $el.find(\".title\").html(\"New task \");\n $el.find(\".tag-input\").val(\"\");\n return lightboxService.open($el);\n });\n $scope.$on(\"taskform:edit\", function(ctx, task) {\n $scope.task = task;\n $scope.isNew = false;\n $el.find(\".button-green span\").html(\"Save\");\n $el.find(\".title\").html(\"Edit task \");\n $el.find(\".tag-input\").val(\"\");\n return lightboxService.open($el);\n });\n submitButton = $el.find(\".submit-button\");\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, form, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n if ($scope.isNew) {\n promise = $repo.create(\"tasks\", $scope.task);\n broadcastEvent = \"taskform:new:success\";\n } else {\n promise = $repo.save($scope.task);\n broadcastEvent = \"taskform:edit:success\";\n }\n $loading.start(submitButton);\n return promise.then(function(data) {\n $loading.finish(submitButton);\n lightboxService.close($el);\n return $rootscope.$broadcast(broadcastEvent, data);\n });\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n CreateBulkTasksDirective = function($repo, $rs, $rootscope, $loading, lightboxService) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.form = {\n data: \"\",\n usId: null\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var data, form, projectId, promise, sprintId, usId;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n data = $scope.form.data;\n projectId = $scope.projectId;\n sprintId = $scope.form.sprintId;\n usId = $scope.form.usId;\n promise = $rs.tasks.bulkCreate(projectId, sprintId, usId, data);\n promise.then(function(result) {\n $loading.finish(submitButton);\n $rootscope.$broadcast(\"taskform:bulk:success\", result);\n return lightboxService.close($el);\n });\n return promise.then(null, function() {\n $loading.finish(submitButton);\n return console.log(\"FAIL\");\n });\n };\n })(this));\n $scope.$on(\"taskform:bulk\", function(ctx, sprintId, usId) {\n lightboxService.open($el);\n return $scope.form = {\n data: \"\",\n sprintId: sprintId,\n usId: usId\n };\n });\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaTaskboard\");\n\n module.directive(\"tgLbCreateEditTask\", [\"$tgRepo\", \"$tgModel\", \"$tgResources\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", CreateEditTaskDirective]);\n\n module.directive(\"tgLbCreateBulkTasks\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", CreateBulkTasksDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 TaskboardController, TaskboardDirective, TaskboardSquishColumnDirective, TaskboardTableHeightFixerDirective, TaskboardTaskDirective, TaskboardUserDirective, bindMethods, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText,\n __extends = 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 toggleText = this.taiga.toggleText;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n scopeDefer = this.taiga.scopeDefer;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaTaskboard\");\n\n TaskboardController = (function(_super) {\n __extends(TaskboardController, _super);\n\n TaskboardController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$appTitle\", \"$tgLocation\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"tgLoader\"];\n\n function TaskboardController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_appTitle, _at_location, _at_navUrls, _at_events, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.appTitle = _at_appTitle;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.events = _at_events;\n this.analytics = _at_analytics;\n bindMethods(this);\n this.scope.sectionName = \"Taskboard\";\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Taskboard - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n TaskboardController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"taskform:bulk:success\", (function(_this) {\n return function() {\n _this.loadTaskboard();\n return _this.analytics.trackEvent(\"task\", \"create\", \"bulk create task on taskboard\", 1);\n };\n })(this));\n this.scope.$on(\"taskform:new:success\", (function(_this) {\n return function() {\n _this.loadTaskboard();\n return _this.analytics.trackEvent(\"task\", \"create\", \"create task on taskboard\", 1);\n };\n })(this));\n this.scope.$on(\"taskform:edit:success\", (function(_this) {\n return function() {\n return _this.loadTaskboard();\n };\n })(this));\n this.scope.$on(\"taskboard:task:move\", this.taskMove);\n return this.scope.$on(\"assigned-to:added\", (function(_this) {\n return function(ctx, userId, task) {\n var promise;\n task.assigned_to = userId;\n promise = _this.repo.save(task);\n return promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n };\n })(this));\n };\n\n TaskboardController.prototype.initializeSubscription = function() {\n var routingKey, routingKey1;\n routingKey = \"changes.project.\" + this.scope.projectId + \".tasks\";\n this.events.subscribe(this.scope, routingKey, (function(_this) {\n return function(message) {\n return _this.loadTaskboard();\n };\n })(this));\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n return this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n _this.refreshTagsColors();\n _this.loadSprintStats();\n return _this.loadSprint();\n };\n })(this));\n };\n\n TaskboardController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(e) {\n return e.id;\n });\n _this.scope.roleById = groupBy(project.roles, function(e) {\n return e.id;\n });\n _this.scope.taskStatusList = _.sortBy(project.task_statuses, \"order\");\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.scope.usStatusById = groupBy(project.us_statuses, function(e) {\n return e.id;\n });\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadSprintStats = function() {\n return this.rs.sprints.stats(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(stats) {\n var completedPointsSum, remainingPointsSum, remainingTasks, totalPointsSum;\n totalPointsSum = _.reduce(_.values(stats.total_points), (function(res, n) {\n return res + n;\n }), 0);\n completedPointsSum = _.reduce(_.values(stats.completed_points), (function(res, n) {\n return res + n;\n }), 0);\n remainingPointsSum = totalPointsSum - completedPointsSum;\n remainingTasks = stats.total_tasks - stats.completed_tasks;\n _this.scope.stats = stats;\n _this.scope.stats.totalPointsSum = totalPointsSum;\n _this.scope.stats.completedPointsSum = completedPointsSum;\n _this.scope.stats.remainingPointsSum = remainingPointsSum;\n _this.scope.stats.remainingTasks = remainingTasks;\n if (stats.totalPointsSum) {\n _this.scope.stats.completedPercentage = Math.round(100 * stats.completedPointsSum / stats.totalPointsSum);\n } else {\n _this.scope.stats.completedPercentage = 0;\n }\n _this.scope.stats.openTasks = stats.total_tasks - stats.completed_tasks;\n return stats;\n };\n })(this));\n };\n\n TaskboardController.prototype.refreshTagsColors = function() {\n return this.rs.projects.tagsColors(this.scope.projectId).then((function(_this) {\n return function(tags_colors) {\n return _this.scope.project.tags_colors = tags_colors;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadSprint = function() {\n return this.rs.sprints.get(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n _this.scope.userstories = _.sortBy(sprint.user_stories, \"sprint_order\");\n return sprint;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadTasks = function() {\n return this.rs.tasks.list(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(tasks) {\n var status, task, us, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;\n _this.scope.tasks = _.sortBy(tasks, 'taskboard_order');\n _this.scope.usTasks = {};\n _ref = _.union(_this.scope.userstories, [\n {\n id: null\n }\n ]);\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n us = _ref[_i];\n _this.scope.usTasks[us.id] = {};\n _ref1 = _this.scope.taskStatusList;\n for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n status = _ref1[_j];\n _this.scope.usTasks[us.id][status.id] = [];\n }\n }\n _ref2 = _this.scope.tasks;\n for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {\n task = _ref2[_k];\n if ((_this.scope.usTasks[task.user_story] != null) && (_this.scope.usTasks[task.user_story][task.status] != null)) {\n _this.scope.usTasks[task.user_story][task.status].push(task);\n }\n }\n return tasks;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadTaskboard = function() {\n return this.q.all([\n this.refreshTagsColors(), this.loadSprintStats(), this.loadSprint().then((function(_this) {\n return function() {\n return _this.loadTasks();\n };\n })(this))\n ]);\n };\n\n TaskboardController.prototype.loadInitialData = function() {\n var params, promise;\n params = {\n pslug: this.params.pslug,\n sslug: this.params.sslug\n };\n promise = this.repo.resolve(params).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n _this.scope.sprintId = data.milestone;\n _this.initializeSubscription();\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadUsersAndRoles();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadTaskboard();\n };\n })(this));\n };\n\n TaskboardController.prototype.refreshTasksOrder = function(tasks) {\n var data, items;\n items = this.resortTasks(tasks);\n data = this.prepareBulkUpdateData(items);\n return this.rs.tasks.bulkUpdateTaskTaskboardOrder(this.scope.project.id, data);\n };\n\n TaskboardController.prototype.resortTasks = function(tasks) {\n var index, item, items, _i, _len;\n items = [];\n for (index = _i = 0, _len = tasks.length; _i < _len; index = ++_i) {\n item = tasks[index];\n item[\"taskboard_order\"] = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n TaskboardController.prototype.prepareBulkUpdateData = function(uses) {\n return _.map(uses, function(x) {\n return {\n \"task_id\": x.id,\n \"order\": x[\"taskboard_order\"]\n };\n });\n };\n\n TaskboardController.prototype.taskMove = function(ctx, task, usId, statusId, order) {\n var promise, r, tasks;\n r = this.scope.usTasks[task.user_story][task.status].indexOf(task);\n this.scope.usTasks[task.user_story][task.status].splice(r, 1);\n tasks = this.scope.usTasks[usId][statusId];\n tasks.splice(order, 0, task);\n task.user_story = usId;\n task.status = statusId;\n task.taskboard_order = order;\n promise = this.repo.save(task);\n this.rootscope.$broadcast(\"sprint:task:moved\", task);\n promise.then((function(_this) {\n return function() {\n _this.refreshTasksOrder(tasks);\n return _this.loadSprintStats();\n };\n })(this));\n return promise.then(null, (function(_this) {\n return function() {\n return console.log(\"FAIL TASK SAVE\");\n };\n })(this));\n };\n\n TaskboardController.prototype.addNewTask = function(type, us) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"taskform:new\", this.scope.sprintId, us != null ? us.id : void 0);\n case \"bulk\":\n return this.rootscope.$broadcast(\"taskform:bulk\", this.scope.sprintId, us != null ? us.id : void 0);\n }\n };\n\n TaskboardController.prototype.editTaskAssignedTo = function(task) {\n return this.rootscope.$broadcast(\"assigned-to:add\", task);\n };\n\n return TaskboardController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TaskboardController\", TaskboardController);\n\n TaskboardDirective = function($rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl, tableBodyDom;\n $ctrl = $el.controller();\n $el.on(\"click\", \".toggle-analytics-visibility\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.toggleClass('active');\n return $rootscope.$broadcast(\"taskboard:graph:toggle-visibility\");\n });\n tableBodyDom = $el.find(\".taskboard-table-body\");\n tableBodyDom.on(\"scroll\", function(event) {\n var tableHeaderDom, target;\n target = angular.element(event.currentTarget);\n tableHeaderDom = $el.find(\".taskboard-table-header .taskboard-table-inner\");\n return tableHeaderDom.css(\"left\", -1 * target.scrollLeft());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboard\", [\"$rootScope\", TaskboardDirective]);\n\n TaskboardTaskDirective = function($rootscope) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $el.disableSelection();\n $scope.$watch(\"task\", function(task) {\n if (task.is_blocked && !$el.hasClass(\"blocked\")) {\n return $el.addClass(\"blocked\");\n } else if (!task.is_blocked && $el.hasClass(\"blocked\")) {\n return $el.removeClass(\"blocked\");\n }\n });\n return $el.find(\".icon-edit\").on(\"click\", function(event) {\n if ($el.find('.icon-edit').hasClass('noclick')) {\n return;\n }\n return $scope.$apply(function() {\n return $rootscope.$broadcast(\"taskform:edit\", $scope.task);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardTask\", [\"$rootScope\", TaskboardTaskDirective]);\n\n TaskboardTableHeightFixerDirective = function() {\n var link, mainPadding, renderSize;\n mainPadding = 32;\n renderSize = function($el) {\n var columnHeight, elementOffset, windowHeight;\n elementOffset = $el.offset().top;\n windowHeight = angular.element(window).height();\n columnHeight = windowHeight - elementOffset - mainPadding;\n return $el.css(\"height\", columnHeight + \"px\");\n };\n link = function($scope, $el, $attrs) {\n timeout(500, function() {\n return renderSize($el);\n });\n return $scope.$on(\"resize\", function() {\n return renderSize($el);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardTableHeightFixer\", TaskboardTableHeightFixerDirective);\n\n TaskboardSquishColumnDirective = function(rs) {\n var avatarWidth, link, maxColumnWidth;\n avatarWidth = 40;\n maxColumnWidth = 300;\n link = function($scope, $el, $attrs) {\n var getCeilWidth, recalculateStatusColumnWidth, recalculateTaskboardWidth, refreshTaskboardTableWidth, setStatusColumnWidth;\n $scope.$on(\"sprint:task:moved\", (function(_this) {\n return function() {\n return recalculateTaskboardWidth();\n };\n })(this));\n bindOnce($scope, \"usTasks\", function(project) {\n $scope.statusesFolded = rs.tasks.getStatusColumnModes($scope.project.id);\n $scope.usFolded = rs.tasks.getUsRowModes($scope.project.id, $scope.sprintId);\n return recalculateTaskboardWidth();\n });\n $scope.foldStatus = function(status) {\n $scope.statusesFolded[status.id] = !!!$scope.statusesFolded[status.id];\n rs.tasks.storeStatusColumnModes($scope.projectId, $scope.statusesFolded);\n return recalculateTaskboardWidth();\n };\n $scope.foldUs = function(us) {\n if (!us) {\n $scope.usFolded[null] = !!!$scope.usFolded[null];\n } else {\n $scope.usFolded[us.id] = !!!$scope.usFolded[us.id];\n }\n rs.tasks.storeUsRowModes($scope.projectId, $scope.sprintId, $scope.usFolded);\n return recalculateTaskboardWidth();\n };\n getCeilWidth = (function(_this) {\n return function(usId, statusId) {\n var tasks, tasksMatrixSize, width;\n tasks = $scope.usTasks[usId][statusId].length;\n if ($scope.statusesFolded[statusId]) {\n if (tasks && $scope.usFolded[usId]) {\n tasksMatrixSize = Math.round(Math.sqrt(tasks));\n width = avatarWidth * tasksMatrixSize;\n } else {\n width = avatarWidth;\n }\n return width;\n }\n return 0;\n };\n })(this);\n setStatusColumnWidth = (function(_this) {\n return function(statusId, width) {\n var column;\n column = $el.find(\".squish-status-\" + statusId);\n if (width) {\n return column.css('max-width', width);\n } else {\n return column.css(\"max-width\", maxColumnWidth);\n }\n };\n })(this);\n refreshTaskboardTableWidth = (function(_this) {\n return function() {\n var columnWidths, columns, totalWidth;\n columnWidths = [];\n columns = $el.find(\".task-colum-name\");\n columnWidths = _.map(columns, function(column) {\n return $(column).outerWidth(true);\n });\n totalWidth = _.reduce(columnWidths, function(total, width) {\n return total + width;\n });\n return $el.find('.taskboard-table-inner').css(\"width\", totalWidth);\n };\n })(this);\n recalculateStatusColumnWidth = (function(_this) {\n return function(statusId) {\n var statusFoldedWidth;\n statusFoldedWidth = getCeilWidth(null, statusId);\n _.forEach($scope.userstories, function(us) {\n var width;\n width = getCeilWidth(us.id, statusId);\n if (width > statusFoldedWidth) {\n return statusFoldedWidth = width;\n }\n });\n return setStatusColumnWidth(statusId, statusFoldedWidth);\n };\n })(this);\n return recalculateTaskboardWidth = (function(_this) {\n return function() {\n _.forEach($scope.taskStatusList, function(status) {\n return recalculateStatusColumnWidth(status.id);\n });\n refreshTaskboardTableWidth();\n };\n })(this);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardSquishColumn\", [\"$tgResources\", TaskboardSquishColumnDirective]);\n\n TaskboardUserDirective = function($log) {\n var clickable, link;\n clickable = false;\n link = function($scope, $el, $attrs) {\n var username_label;\n username_label = $el.parent().find(\"a.task-assigned\");\n username_label.on(\"click\", function(event) {\n var $ctrl;\n if ($el.find('a').hasClass('noclick')) {\n return;\n }\n $ctrl = $el.controller();\n return $ctrl.editTaskAssignedTo($scope.task);\n });\n $scope.$watch('task.assigned_to', function(assigned_to) {\n var user;\n user = $scope.usersById[assigned_to];\n if (user === void 0) {\n _.assign($scope, {\n name: \"Unassigned\",\n imgurl: \"/images/unnamed.png\",\n clickable: clickable\n });\n } else {\n _.assign($scope, {\n name: user.full_name_display,\n imgurl: user.photo,\n clickable: clickable\n });\n }\n return username_label.text($scope.name);\n });\n return bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_task\") > -1) {\n clickable = true;\n return $el.find(\".avatar-assigned-to\").on(\"click\", (function(_this) {\n return function(event) {\n var $ctrl;\n if ($el.find('a').hasClass('noclick')) {\n return;\n }\n $ctrl = $el.controller();\n return $ctrl.editTaskAssignedTo($scope.task);\n };\n })(this));\n }\n });\n };\n return {\n link: link,\n templateUrl: \"taskboard/taskboard-user.html\",\n scope: {\n \"usersById\": \"=users\",\n \"project\": \"=\",\n \"task\": \"=\"\n }\n };\n };\n\n module.directive(\"tgTaskboardUserAvatar\", [\"$log\", TaskboardUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/sortable.coffee\n */\n\n(function() {\n var TaskboardSortableDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaBacklog\");\n\n TaskboardSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var deleteElement, itemEl, newParentScope, oldParentScope, tdom;\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el;\n deleteElement = function(itemEl) {\n itemEl.scope().$destroy();\n itemEl.off();\n return itemEl.remove();\n };\n tdom.sortable({\n handle: \".taskboard-task-inner\",\n dropOnEmpty: true,\n connectWith: \".taskboard-tasks-box\",\n revert: 400\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemTask, newStatusId, newUsId, oldStatusId, oldUsId, parentEl;\n parentEl = ui.item.parent();\n itemEl = ui.item;\n itemTask = itemEl.scope().task;\n itemIndex = itemEl.index();\n newParentScope = parentEl.scope();\n oldUsId = oldParentScope.us ? oldParentScope.us.id : null;\n oldStatusId = oldParentScope.st.id;\n newUsId = newParentScope.us ? newParentScope.us.id : null;\n newStatusId = newParentScope.st.id;\n if (newStatusId !== oldStatusId || newUsId !== oldUsId) {\n deleteElement(itemEl);\n }\n $scope.$apply(function() {\n return $rootscope.$broadcast(\"taskboard:task:move\", itemTask, newUsId, newStatusId, itemIndex);\n });\n return ui.item.find('a').removeClass('noclick');\n });\n tdom.on(\"sortstart\", function(event, ui) {\n oldParentScope = ui.item.parent().scope();\n return ui.item.find('a').addClass('noclick');\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", TaskboardSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var KanbanArchivedStatusHeaderDirective, KanbanArchivedStatusIntroDirective, KanbanColumnHeightFixerDirective, KanbanController, KanbanDirective, KanbanSquishColumnDirective, KanbanUserDirective, KanbanUserstoryDirective, KanbanWipLimitDirective, bindMethods, bindOnce, defaultViewMode, defaultViewModes, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaKanban\");\n\n defaultViewMode = \"maximized\";\n\n defaultViewModes = {\n maximized: {\n cardClass: \"kanban-task-maximized\"\n },\n minimized: {\n cardClass: \"kanban-task-minimized\"\n }\n };\n\n KanbanController = (function(_super) {\n __extends(KanbanController, _super);\n\n KanbanController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$appTitle\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"tgLoader\"];\n\n function KanbanController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_appTitle, _at_navUrls, _at_events, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.events = _at_events;\n this.analytics = _at_analytics;\n bindMethods(this);\n this.scope.sectionName = \"Kanban\";\n this.scope.statusViewModes = {};\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Kanban - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n KanbanController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"usform:new:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.refreshTagsColors();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"create userstory on kanban\", 1);\n };\n })(this));\n this.scope.$on(\"usform:bulk:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"bulk create userstory on kanban\", 1);\n };\n })(this));\n this.scope.$on(\"usform:edit:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n return _this.refreshTagsColors();\n };\n })(this));\n this.scope.$on(\"assigned-to:added\", this.onAssignedToChanged);\n this.scope.$on(\"kanban:us:move\", this.moveUs);\n this.scope.$on(\"kanban:show-userstories-for-status\", this.loadUserStoriesForStatus);\n return this.scope.$on(\"kanban:hide-userstories-for-status\", this.hideUserStoriesForStatus);\n };\n\n KanbanController.prototype.addNewUs = function(type, statusId) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"usform:new\", this.scope.projectId, statusId, this.scope.usStatusList);\n case \"bulk\":\n return this.rootscope.$broadcast(\"usform:bulk\", this.scope.projectId, statusId);\n }\n };\n\n KanbanController.prototype.changeUsAssignedTo = function(us) {\n return this.rootscope.$broadcast(\"assigned-to:add\", us);\n };\n\n KanbanController.prototype.onAssignedToChanged = function(ctx, userid, us) {\n var promise;\n us.assigned_to = userid;\n promise = this.repo.save(us);\n return promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n };\n\n KanbanController.prototype.refreshTagsColors = function() {\n return this.rs.projects.tagsColors(this.scope.projectId).then((function(_this) {\n return function(tags_colors) {\n return _this.scope.project.tags_colors = tags_colors;\n };\n })(this));\n };\n\n KanbanController.prototype.loadUserstories = function() {\n var params;\n params = {\n status__is_archived: false\n };\n return this.rs.userstories.listAll(this.scope.projectId, params).then((function(_this) {\n return function(userstories) {\n var status, usByStatus, _i, _len, _ref;\n _this.scope.userstories = userstories;\n usByStatus = _.groupBy(userstories, \"status\");\n _ref = _this.scope.usStatusList;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n status = _ref[_i];\n if (usByStatus[status.id] == null) {\n usByStatus[status.id] = [];\n }\n if (status.is_archived && (_this.scope.usByStatus != null)) {\n usByStatus[status.id] = _this.scope.usByStatus[status.id];\n }\n usByStatus[status.id] = _.sortBy(usByStatus[status.id], \"kanban_order\");\n }\n _this.scope.usByStatus = usByStatus;\n scopeDefer(_this.scope, function() {\n return _this.scope.$broadcast(\"userstories:loaded\", userstories);\n });\n return userstories;\n };\n })(this));\n };\n\n KanbanController.prototype.loadUserStoriesForStatus = function(ctx, statusId) {\n var params;\n params = {\n status: statusId\n };\n return this.rs.userstories.listAll(this.scope.projectId, params).then((function(_this) {\n return function(userstories) {\n _this.scope.usByStatus[statusId] = _.sortBy(userstories, \"kanban_order\");\n _this.scope.$broadcast(\"kanban:shown-userstories-for-status\", statusId, userstories);\n return userstories;\n };\n })(this));\n };\n\n KanbanController.prototype.hideUserStoriesForStatus = function(ctx, statusId) {\n this.scope.usByStatus[statusId] = [];\n return this.scope.$broadcast(\"kanban:hidden-userstories-for-status\", statusId);\n };\n\n KanbanController.prototype.loadKanban = function() {\n return this.q.all([this.refreshTagsColors(), this.loadUserstories()]);\n };\n\n KanbanController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.projectId = project.id;\n _this.scope.points = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.generateStatusViewModes();\n _this.scope.$emit(\"project:loaded\", project);\n return project;\n };\n })(this));\n };\n\n KanbanController.prototype.initializeSubscription = function() {\n var routingKey1;\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n return this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n return _this.loadUserstories();\n };\n })(this));\n };\n\n KanbanController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n _this.initializeSubscription();\n return _this.loadKanban().then(function() {\n return _this.scope.$broadcast(\"redraw:wip\");\n });\n };\n })(this));\n };\n\n KanbanController.prototype.generateStatusViewModes = function() {\n var mode, status, storedStatusViewModes, _i, _len, _ref;\n storedStatusViewModes = this.rs.kanban.getStatusViewModes(this.scope.projectId);\n this.scope.statusViewModes = {};\n _ref = this.scope.usStatusList;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n status = _ref[_i];\n mode = storedStatusViewModes[status.id];\n this.scope.statusViewModes[status.id] = _.has(defaultViewModes, mode) ? mode : defaultViewMode;\n }\n return this.storeStatusViewModes();\n };\n\n KanbanController.prototype.storeStatusViewModes = function() {\n return this.rs.kanban.storeStatusViewModes(this.scope.projectId, this.scope.statusViewModes);\n };\n\n KanbanController.prototype.updateStatusViewMode = function(statusId, newViewMode) {\n this.scope.statusViewModes[statusId] = newViewMode;\n return this.storeStatusViewModes();\n };\n\n KanbanController.prototype.getCardClass = function(statusId) {\n var mode;\n mode = this.scope.statusViewModes[statusId] || defaultViewMode;\n return defaultViewModes[mode].cardClass || defaultViewModes[defaultViewMode].cardClass;\n };\n\n KanbanController.prototype.prepareBulkUpdateData = function(uses, field) {\n if (field == null) {\n field = \"kanban_order\";\n }\n return _.map(uses, function(x) {\n return {\n \"us_id\": x.id,\n \"order\": x[field]\n };\n });\n };\n\n KanbanController.prototype.resortUserStories = function(uses) {\n var index, item, items, _i, _len;\n items = [];\n for (index = _i = 0, _len = uses.length; _i < _len; index = ++_i) {\n item = uses[index];\n item.kanban_order = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n KanbanController.prototype.moveUs = function(ctx, us, oldStatusId, newStatusId, index) {\n var itemsToSave, promise, r;\n if (oldStatusId !== newStatusId) {\n r = this.scope.usByStatus[oldStatusId].indexOf(us);\n this.scope.usByStatus[oldStatusId].splice(r, 1);\n this.scope.usByStatus[newStatusId].splice(index, 0, us);\n us.status = newStatusId;\n } else {\n r = this.scope.usByStatus[newStatusId].indexOf(us);\n this.scope.usByStatus[newStatusId].splice(r, 1);\n this.scope.usByStatus[newStatusId].splice(index, 0, us);\n }\n itemsToSave = this.resortUserStories(this.scope.usByStatus[newStatusId]);\n this.scope.usByStatus[newStatusId] = _.sortBy(this.scope.usByStatus[newStatusId], \"kanban_order\");\n promise = this.repo.save(us);\n promise = promise.then((function(_this) {\n return function() {\n var data;\n itemsToSave = _.reject(itemsToSave, {\n \"id\": us.id\n });\n data = _this.prepareBulkUpdateData(itemsToSave);\n return _this.rs.userstories.bulkUpdateKanbanOrder(us.project, data).then(function() {\n return itemsToSave;\n });\n };\n })(this));\n return promise;\n };\n\n return KanbanController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"KanbanController\", KanbanController);\n\n KanbanDirective = function($repo, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var tableBodyDom;\n tableBodyDom = $el.find(\".kanban-table-body\");\n tableBodyDom.on(\"scroll\", function(event) {\n var tableHeaderDom, target;\n target = angular.element(event.currentTarget);\n tableHeaderDom = $el.find(\".kanban-table-header .kanban-table-inner\");\n return tableHeaderDom.css(\"left\", -1 * target.scrollLeft());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanban\", [\"$tgRepo\", \"$rootScope\", KanbanDirective]);\n\n KanbanColumnHeightFixerDirective = function() {\n var link, mainPadding, renderSize, scrollPadding;\n mainPadding = 32;\n scrollPadding = 0;\n renderSize = function($el) {\n var columnHeight, elementOffset, windowHeight;\n elementOffset = $el.parent().parent().offset().top;\n windowHeight = angular.element(window).height();\n columnHeight = windowHeight - elementOffset - mainPadding - scrollPadding;\n return $el.css(\"height\", columnHeight + \"px\");\n };\n link = function($scope, $el, $attrs) {\n timeout(500, function() {\n return renderSize($el);\n });\n $scope.$on(\"resize\", function() {\n return renderSize($el);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanColumnHeightFixer\", KanbanColumnHeightFixerDirective);\n\n KanbanArchivedStatusHeaderDirective = function($rootscope) {\n var hideArchivedText, link, showArchivedText;\n showArchivedText = \"Show archived\";\n hideArchivedText = \"Hide archived\";\n link = function($scope, $el, $attrs) {\n var hidden, status;\n status = $scope.$eval($attrs.tgKanbanArchivedStatusHeader);\n hidden = true;\n $scope[\"class\"] = \"icon icon-open-eye\";\n $scope.title = showArchivedText;\n $el.on(\"click\", function(event) {\n hidden = !hidden;\n return $scope.$apply(function() {\n if (hidden) {\n $scope[\"class\"] = \"icon icon-open-eye\";\n $scope.title = showArchivedText;\n return $rootscope.$broadcast(\"kanban:hide-userstories-for-status\", status.id);\n } else {\n $scope[\"class\"] = \"icon icon-closed-eye\";\n $scope.title = hideArchivedText;\n return $rootscope.$broadcast(\"kanban:show-userstories-for-status\", status.id);\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(\"tgKanbanArchivedStatusHeader\", [\"$rootScope\", KanbanArchivedStatusHeaderDirective]);\n\n KanbanArchivedStatusIntroDirective = function() {\n var hiddenUserStoriexText, link, userStories;\n hiddenUserStoriexText = \"The user stories in this status are hidden by default\";\n userStories = [];\n link = function($scope, $el, $attrs) {\n var status, updateIntroText;\n status = $scope.$eval($attrs.tgKanbanArchivedStatusIntro);\n $el.text(hiddenUserStoriexText);\n updateIntroText = function() {\n if (userStories.length > 0) {\n return $el.text(\"\");\n } else {\n return $el.text(hiddenUserStoriexText);\n }\n };\n $scope.$on(\"kanban:us:move\", function(ctx, itemUs, oldStatusId, newStatusId, itemIndex) {\n var r;\n if (status.id === newStatusId) {\n if (status.id === oldStatusId) {\n r = userStories.indexOf(itemUs);\n userStories.splice(r, 1);\n userStories.splice(itemIndex, 0, itemUs);\n } else {\n itemUs.isArchived = true;\n userStories.splice(itemIndex, 0, itemUs);\n }\n } else if (status.id === oldStatusId) {\n itemUs.isArchived = false;\n r = userStories.indexOf(itemUs);\n userStories.splice(r, 1);\n }\n return updateIntroText();\n });\n $scope.$on(\"kanban:shown-userstories-for-status\", function(ctx, statusId, userStoriesLoaded) {\n if (statusId === status.id) {\n userStories = _.filter(userStoriesLoaded, function(us) {\n return us.status === status.id;\n });\n return updateIntroText();\n }\n });\n $scope.$on(\"kanban:hidden-userstories-for-status\", function(ctx, statusId) {\n if (statusId === status.id) {\n userStories = [];\n return updateIntroText();\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(\"tgKanbanArchivedStatusIntro\", KanbanArchivedStatusIntroDirective);\n\n KanbanUserstoryDirective = function($rootscope) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $el.disableSelection();\n $scope.$watch(\"us\", function(us) {\n if (us.is_blocked && !$el.hasClass(\"blocked\")) {\n return $el.addClass(\"blocked\");\n } else if (!us.is_blocked && $el.hasClass(\"blocked\")) {\n return $el.removeClass(\"blocked\");\n }\n });\n $el.find(\".icon-edit\").on(\"click\", function(event) {\n if ($el.find(\".icon-edit\").hasClass(\"noclick\")) {\n return;\n }\n return $scope.$apply(function() {\n return $rootscope.$broadcast(\"usform:edit\", $model.$modelValue);\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n templateUrl: \"kanban/kanban-task.html\",\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgKanbanUserstory\", [\"$rootScope\", KanbanUserstoryDirective]);\n\n KanbanSquishColumnDirective = function(rs) {\n var link;\n link = function($scope, $el, $attrs) {\n var updateTableWidth;\n $scope.$on(\"project:loaded\", function(event, project) {\n $scope.folds = rs.kanban.getStatusColumnModes(project.id);\n return updateTableWidth();\n });\n $scope.foldStatus = function(status) {\n $scope.folds[status.id] = !!!$scope.folds[status.id];\n rs.kanban.storeStatusColumnModes($scope.projectId, $scope.folds);\n updateTableWidth();\n };\n return updateTableWidth = function() {\n var columnWidths, totalWidth;\n columnWidths = _.map($scope.usStatusList, function(status) {\n if ($scope.folds[status.id]) {\n return 40;\n } else {\n return 310;\n }\n });\n totalWidth = _.reduce(columnWidths, function(total, width) {\n return total + width;\n });\n return $el.find('.kanban-table-inner').css(\"width\", totalWidth);\n };\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanSquishColumn\", [\"$tgResources\", KanbanSquishColumnDirective]);\n\n KanbanWipLimitDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var redrawWipLimit;\n $el.disableSelection();\n redrawWipLimit = function() {\n $el.find(\".kanban-wip-limit\").remove();\n return timeout(200, function() {\n var element;\n element = $el.find(\".kanban-task\")[$scope.$eval($attrs.tgKanbanWipLimit)];\n if (element) {\n return angular.element(element).before(\"
\");\n }\n });\n };\n $scope.$on(\"redraw:wip\", redrawWipLimit);\n $scope.$on(\"kanban:us:move\", redrawWipLimit);\n $scope.$on(\"usform:new:success\", redrawWipLimit);\n $scope.$on(\"usform:bulk:success\", redrawWipLimit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanWipLimit\", KanbanWipLimitDirective);\n\n KanbanUserDirective = function($log) {\n var clickable, link, template;\n template = _.template(\"
\\n class=\\\"not-clickable\\\"<% } %>>\\n \\\" alt=\\\"<%- name %>\\\" class=\\\"avatar\\\">\\n \\n
\");\n clickable = false;\n link = function($scope, $el, $attrs, $model) {\n var render, wtid;\n if (!$attrs.tgKanbanUserAvatar) {\n return $log.error(\"KanbanUserDirective: no attr is defined\");\n }\n wtid = $scope.$watch($attrs.tgKanbanUserAvatar, function(v) {\n var user;\n if ($scope.usersById == null) {\n $log.error(\"KanbanUserDirective requires userById set in scope.\");\n return wtid();\n } else {\n user = $scope.usersById[v];\n return render(user);\n }\n });\n render = function(user) {\n var ctx, html, username_label;\n if (user === void 0) {\n ctx = {\n name: \"Unassigned\",\n imgurl: \"/images/unnamed.png\",\n clickable: clickable\n };\n } else {\n ctx = {\n name: user.full_name_display,\n imgurl: user.photo,\n clickable: clickable\n };\n }\n html = template(ctx);\n $el.html(html);\n username_label = $el.parent().find(\"a.task-assigned\");\n username_label.html(ctx.name);\n return username_label.on(\"click\", function(event) {\n var $ctrl, us;\n if ($el.find(\"a\").hasClass(\"noclick\")) {\n return;\n }\n us = $model.$modelValue;\n $ctrl = $el.controller();\n return $ctrl.changeUsAssignedTo(us);\n });\n };\n bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n clickable = true;\n return $el.on(\"click\", (function(_this) {\n return function(event) {\n var $ctrl, us;\n if ($el.find(\"a\").hasClass(\"noclick\")) {\n return;\n }\n us = $model.$modelValue;\n $ctrl = $el.controller();\n return $ctrl.changeUsAssignedTo(us);\n };\n })(this));\n }\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(\"tgKanbanUserAvatar\", [\"$log\", KanbanUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/sortable.coffee\n */\n\n(function() {\n var KanbanSortableDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaKanban\");\n\n KanbanSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var deleteElement, itemEl, newParentScope, oldParentScope, tdom;\n if (!(project.my_permissions.indexOf(\"modify_us\") > -1)) {\n return;\n }\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el;\n deleteElement = function(itemEl) {\n itemEl.scope().$destroy();\n itemEl.off();\n return itemEl.remove();\n };\n tdom.sortable({\n handle: \".kanban-task-inner\",\n dropOnEmpty: true,\n connectWith: \".kanban-uses-box\",\n revert: 400\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemUs, newStatusId, oldStatusId, parentEl;\n parentEl = ui.item.parent();\n itemEl = ui.item;\n itemUs = itemEl.scope().us;\n itemIndex = itemEl.index();\n newParentScope = parentEl.scope();\n newStatusId = newParentScope.s.id;\n oldStatusId = oldParentScope.s.id;\n if (newStatusId !== oldStatusId) {\n deleteElement(itemEl);\n }\n $scope.$apply(function() {\n return $rootscope.$broadcast(\"kanban:us:move\", itemUs, itemUs.status, newStatusId, itemIndex);\n });\n return ui.item.find('a').removeClass('noclick');\n });\n return tdom.on(\"sortstart\", function(event, ui) {\n oldParentScope = ui.item.parent().scope();\n return ui.item.find('a').addClass('noclick');\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(\"tgKanbanSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", KanbanSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/detail.coffee\n */\n\n(function() {\n var IssueDetailController, IssuePriorityButtonDirective, IssueSeverityButtonDirective, IssueStatusButtonDirective, IssueStatusDisplayDirective, IssueTypeButtonDirective, PromoteIssueToUsButtonDirective, bindOnce, groupBy, joinStr, mixOf, module, taiga, toString,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaIssues\");\n\n IssueDetailController = (function(_super) {\n __extends(IssueDetailController, _super);\n\n IssueDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"$appTitle\", \"$tgAnalytics\", \"$tgNavUrls\", \"tgLoader\"];\n\n function IssueDetailController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_log, _at_appTitle, _at_analytics, _at_navUrls, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.log = _at_log;\n this.appTitle = _at_appTitle;\n this.analytics = _at_analytics;\n this.navUrls = _at_navUrls;\n this.scope.issueRef = this.params.issueref;\n this.scope.sectionName = \"Issue Details\";\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this.appTitle.set(_this.scope.issue.subject + \" - \" + _this.scope.project.name);\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n IssueDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n _this.rootscope.$broadcast(\"history:reload\");\n return _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on issue\", 1);\n };\n })(this));\n this.scope.$on(\"attachment:edit\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n this.scope.$on(\"attachment:delete\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n return this.scope.$on(\"promote-issue-to-us:success\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"issue\", \"promoteToUserstory\", \"promote issue to userstory\", 1);\n _this.rootscope.$broadcast(\"history:reload\");\n return _this.loadIssue();\n };\n })(this));\n };\n\n IssueDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n if (this.scope.project.is_issues_activated) {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-issues\", ctx);\n } else {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n }\n };\n\n IssueDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.issue_statuses;\n _this.scope.statusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.typeById = groupBy(project.issue_types, function(x) {\n return x.id;\n });\n _this.scope.typeList = _.sortBy(project.issue_types, \"order\");\n _this.scope.severityList = project.severities;\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.priorityList = project.priorities;\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n _this.scope.membersById = groupBy(project.memberships, function(x) {\n return x.user;\n });\n return project;\n };\n })(this));\n };\n\n IssueDetailController.prototype.loadIssue = function() {\n return this.rs.issues.getByRef(this.scope.projectId, this.params.issueref).then((function(_this) {\n return function(issue) {\n var ctx;\n _this.scope.issue = issue;\n _this.scope.issueId = issue.id;\n _this.scope.commentModel = issue;\n if (_this.scope.issue.neighbors.previous.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.issue.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-issues-detail\", ctx);\n }\n if (_this.scope.issue.neighbors.next.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.issue.neighbors.next.ref\n };\n return _this.scope.nextUrl = _this.navUrls.resolve(\"project-issues-detail\", ctx);\n }\n };\n })(this));\n };\n\n IssueDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.loadIssue();\n };\n })(this));\n };\n\n return IssueDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"IssueDetailController\", IssueDetailController);\n\n IssueStatusDisplayDirective = function($template) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(issue) {\n var html;\n html = template({\n status: $scope.statusById[issue.status]\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue != null) {\n return render(issue);\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(\"tgIssueStatusDisplay\", [\"$tgTemplate\", IssueStatusDisplayDirective]);\n\n IssueStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"issue/issues-status-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, status;\n status = $scope.statusById[issue.status];\n html = template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(statusId) {\n var issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.status = statusId;\n onSuccess = function() {\n $confirm.notify(\"success\");\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".status-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n return save(target.data(\"status-id\"));\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\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(\"tgIssueStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", IssueStatusButtonDirective]);\n\n IssueTypeButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"issue/issue-type-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, type;\n type = $scope.typeById[issue.type];\n html = template({\n type: type,\n typees: $scope.typeList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(type) {\n var issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.type = type;\n onSuccess = function() {\n $confirm.notify(\"success\");\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".type-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-type\").popover().open();\n });\n $el.on(\"click\", \".type\", function(event) {\n var target, type;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n type = target.data(\"type-id\");\n return save(type);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\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(\"tgIssueTypeButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", IssueTypeButtonDirective]);\n\n IssueSeverityButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"issue/issue-severity-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, severity;\n severity = $scope.severityById[issue.severity];\n html = template({\n severity: severity,\n severityes: $scope.severityList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(severity) {\n var issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.severity = severity;\n onSuccess = function() {\n $confirm.notify(\"success\");\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".severity-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-severity\").popover().open();\n });\n $el.on(\"click\", \".severity\", function(event) {\n var severity, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n severity = target.data(\"severity-id\");\n return save(severity);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\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(\"tgIssueSeverityButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", IssueSeverityButtonDirective]);\n\n IssuePriorityButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"issue/issue-priority-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, priority;\n priority = $scope.priorityById[issue.priority];\n html = template({\n priority: priority,\n priorityes: $scope.priorityList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(priority) {\n var issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.priority = priority;\n onSuccess = function() {\n $confirm.notify(\"success\");\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".priority-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-priority\").popover().open();\n });\n $el.on(\"click\", \".priority\", function(event) {\n var priority, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n priority = target.data(\"priority-id\");\n return save(priority);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\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(\"tgIssuePriorityButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", IssuePriorityButtonDirective]);\n\n PromoteIssueToUsButtonDirective = function($rootScope, $repo, $confirm, $qqueue) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var save;\n save = $qqueue.bindAdd((function(_this) {\n return function(issue, finish) {\n var data, onError, onSuccess;\n data = {\n generated_from_issue: issue.id,\n project: issue.project,\n subject: issue.subject,\n description: issue.description,\n tags: issue.tags,\n is_blocked: issue.is_blocked,\n blocked_note: issue.blocked_note\n };\n onSuccess = function() {\n finish();\n $confirm.notify(\"success\");\n return $rootScope.$broadcast(\"promote-issue-to-us:success\");\n };\n onError = function() {\n finish(false);\n return $confirm.notify(\"error\");\n };\n return $repo.create(\"userstories\", data).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \"a\", function(event) {\n var issue, message, subtitle, title;\n event.preventDefault();\n issue = $model.$modelValue;\n title = \"Promote this issue to a new user story\";\n message = \"Are you sure you want to create a new US from this Issue?\";\n subtitle = issue.subject;\n return $confirm.ask(title, subtitle, message).then((function(_this) {\n return function(finish) {\n return save(issue, finish);\n };\n })(this));\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n restrict: \"AE\",\n require: \"ngModel\",\n templateUrl: \"issue/promote-issue-to-us-button.html\",\n link: link\n };\n };\n\n module.directive(\"tgPromoteIssueToUsButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgQqueue\", PromoteIssueToUsButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var CreateBulkIssuesDirective, CreateIssueDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaIssues\");\n\n CreateIssueDirective = function($repo, $confirm, $rootscope, lightboxService, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley();\n $scope.issue = {};\n $scope.$on(\"issueform:new\", function(ctx, project) {\n $el.find(\".tag-input\").val(\"\");\n lightboxService.open($el);\n return $scope.issue = {\n project: project.id,\n subject: \"\",\n status: project.default_issue_status,\n type: project.default_issue_type,\n priority: project.default_priority,\n severity: project.default_severity,\n tags: []\n };\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\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 $loading.start(submitButton);\n promise = $repo.create(\"issues\", $scope.issue);\n promise.then(function(data) {\n $loading.finish(submitButton);\n $rootscope.$broadcast(\"issueform:new:success\", data);\n lightboxService.close($el);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function() {\n $loading.finish(submitButton);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateIssue\", [\"$tgRepo\", \"$tgConfirm\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", CreateIssueDirective]);\n\n CreateBulkIssuesDirective = function($repo, $rs, $confirm, $rootscope, $loading, lightboxService) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.$on(\"issueform:bulk\", function(ctx, projectId, status) {\n lightboxService.open($el);\n return $scope[\"new\"] = {\n projectId: projectId,\n bulk: \"\"\n };\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var data, form, projectId, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n data = $scope[\"new\"].bulk;\n projectId = $scope[\"new\"].projectId;\n promise = $rs.issues.bulkCreate(projectId, data);\n promise.then(function(result) {\n $loading.finish(submitButton);\n $rootscope.$broadcast(\"issueform:new:success\", result);\n lightboxService.close($el);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function() {\n $loading.finish(submitButton);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateBulkIssues\", [\"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", CreateBulkIssuesDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/list.coffee\n */\n\n(function() {\n var IssueAssignedToInlineEditionDirective, IssueStatusInlineEditionDirective, IssuesController, IssuesDirective, IssuesFiltersDirective, bindOnce, debounceLeading, groupBy, joinStr, mixOf, module, startswith, taiga, toString, trim,\n __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n __extends = 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 mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounceLeading = this.taiga.debounceLeading;\n\n startswith = this.taiga.startswith;\n\n module = angular.module(\"taigaIssues\");\n\n IssuesController = (function(_super) {\n __extends(IssuesController, _super);\n\n IssuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$tgUrls\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$appTitle\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"tgLoader\"];\n\n function IssuesController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_urls, _at_params, _at_q, _at_location, _at_appTitle, _at_navUrls, _at_events, _at_analytics, tgLoader) {\n var filters, promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.urls = _at_urls;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.events = _at_events;\n this.analytics = _at_analytics;\n this.loadIssues = __bind(this.loadIssues, this);\n this.scope.sectionName = \"Issues\";\n this.scope.filters = {};\n if (_.isEmpty(this.location.search())) {\n filters = this.rs.issues.getFilters(this.params.pslug);\n filters.page = 1;\n this.location.search(filters);\n this.location.replace();\n return;\n }\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Issues - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n this.scope.$on(\"issueform:new:success\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"issue\", \"create\", \"create issue on issues list\", 1);\n _this.loadIssues();\n return _this.loadFilters();\n };\n })(this));\n }\n\n IssuesController.prototype.initializeSubscription = function() {\n var routingKey;\n routingKey = \"changes.project.\" + this.scope.projectId + \".issues\";\n return this.events.subscribe(this.scope, routingKey, (function(_this) {\n return function(message) {\n return _this.loadIssues();\n };\n })(this));\n };\n\n IssuesController.prototype.storeFilters = function() {\n return this.rs.issues.storeFilters(this.params.pslug, this.location.search());\n };\n\n IssuesController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.issueStatusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.issueStatusList = _.sortBy(project.issue_statuses, \"order\");\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.severityList = _.sortBy(project.severities, \"order\");\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n _this.scope.priorityList = _.sortBy(project.priorities, \"order\");\n _this.scope.issueTypes = _.sortBy(project.issue_types, \"order\");\n _this.scope.issueTypeById = groupBy(project.issue_types, function(x) {\n return x.id;\n });\n _this.scope.membersById = groupBy(project.memberships, function(x) {\n return x.user;\n });\n return project;\n };\n })(this));\n };\n\n IssuesController.prototype.getUrlFilters = function() {\n var filters;\n filters = _.pick(this.location.search(), \"page\", \"tags\", \"statuses\", \"types\", \"q\", \"severities\", \"priorities\", \"assignedTo\", \"createdBy\", \"orderBy\");\n if (!filters.page) {\n filters.page = 1;\n }\n return filters;\n };\n\n IssuesController.prototype.getUrlFilter = function(name) {\n var filters;\n filters = _.pick(this.location.search(), name);\n return filters[name];\n };\n\n IssuesController.prototype.loadMyFilters = function() {\n return this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n return _.map(filters, function(value, key) {\n return {\n id: key,\n name: key,\n type: \"myFilters\",\n selected: false\n };\n });\n };\n })(this));\n };\n\n IssuesController.prototype.removeNotExistingFiltersFromUrl = function() {\n var currentSearch, existingValues, filterName, filterValue, splittedValues, urlfilters;\n currentSearch = this.location.search();\n urlfilters = this.getUrlFilters();\n for (filterName in urlfilters) {\n filterValue = urlfilters[filterName];\n if (filterName === \"page\" || filterName === \"orderBy\" || filterName === \"q\") {\n continue;\n }\n if (filterName === \"tags\") {\n splittedValues = _.map((\"\" + filterValue).split(\",\"));\n } else {\n splittedValues = _.map((\"\" + filterValue).split(\",\"), function(x) {\n if (x === \"null\") {\n return null;\n } else {\n return parseInt(x);\n }\n });\n }\n existingValues = _.intersection(splittedValues, _.map(this.scope.filters[filterName], \"id\"));\n if (splittedValues.length !== existingValues.length) {\n this.location.search(filterName, existingValues.join());\n }\n }\n if (currentSearch !== this.location.search()) {\n return this.location.replace();\n }\n };\n\n IssuesController.prototype.markSelectedFilters = function(filters, urlfilters) {\n var isSelected, key, name, obj, searchdata, val, value, _i, _len, _ref, _ref1, _results;\n searchdata = {};\n _ref = _.omit(urlfilters, \"page\", \"orderBy\");\n for (name in _ref) {\n value = _ref[name];\n if (searchdata[name] == null) {\n searchdata[name] = {};\n }\n _ref1 = (\"\" + value).split(\",\");\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n val = _ref1[_i];\n searchdata[name][val] = true;\n }\n }\n isSelected = function(type, id) {\n if ((searchdata[type] != null) && searchdata[type][id]) {\n return true;\n }\n return false;\n };\n _results = [];\n for (key in filters) {\n value = filters[key];\n _results.push((function() {\n var _j, _len1, _results1;\n _results1 = [];\n for (_j = 0, _len1 = value.length; _j < _len1; _j++) {\n obj = value[_j];\n _results1.push(obj.selected = isSelected(obj.type, obj.id) ? true : void 0);\n }\n return _results1;\n })());\n }\n return _results;\n };\n\n IssuesController.prototype.loadFilters = function() {\n var promise, urlfilters;\n urlfilters = this.getUrlFilters();\n if (urlfilters.q) {\n this.scope.filtersQ = urlfilters.q;\n }\n promise = this.loadMyFilters().then((function(_this) {\n return function(myFilters) {\n _this.scope.filters.myFilters = myFilters;\n return myFilters;\n };\n })(this));\n promise = promise.then((function(_this) {\n return function() {\n return _this.rs.issues.filtersData(_this.scope.projectId);\n };\n })(this));\n return promise.then((function(_this) {\n return function(data) {\n var choicesFiltersFormat, tagsFilterFormat, usersFiltersFormat;\n usersFiltersFormat = function(users, type, unknownOption) {\n var reformatedUsers, unknownItem;\n reformatedUsers = _.map(users, function(t) {\n return {\n id: t[0],\n count: t[1],\n type: type,\n name: t[0] ? _this.scope.usersById[t[0]].full_name_display : unknownOption\n };\n });\n unknownItem = _.remove(reformatedUsers, function(u) {\n return !u.id;\n });\n reformatedUsers = _.sortBy(reformatedUsers, function(u) {\n return u.name.toUpperCase();\n });\n if (unknownItem.length > 0) {\n reformatedUsers.unshift(unknownItem[0]);\n }\n return reformatedUsers;\n };\n choicesFiltersFormat = function(choices, type, byIdObject) {\n return _.map(choices, function(t) {\n return {\n id: t[0],\n name: byIdObject[t[0]].name,\n color: byIdObject[t[0]].color,\n count: t[1],\n type: type\n };\n });\n };\n tagsFilterFormat = function(tags) {\n return _.map(tags, function(t) {\n return {\n id: t[0],\n name: t[0],\n color: _this.scope.project.tags_colors[t[0]],\n count: t[1],\n type: \"tags\"\n };\n });\n };\n _this.scope.filters.statuses = choicesFiltersFormat(data.statuses, \"statuses\", _this.scope.issueStatusById);\n _this.scope.filters.severities = choicesFiltersFormat(data.severities, \"severities\", _this.scope.severityById);\n _this.scope.filters.priorities = choicesFiltersFormat(data.priorities, \"priorities\", _this.scope.priorityById);\n _this.scope.filters.assignedTo = usersFiltersFormat(data.assigned_to, \"assignedTo\", \"Unassigned\");\n _this.scope.filters.createdBy = usersFiltersFormat(data.created_by, \"createdBy\", \"Unknown\");\n _this.scope.filters.types = choicesFiltersFormat(data.types, \"types\", _this.scope.issueTypeById);\n _this.scope.filters.tags = tagsFilterFormat(data.tags);\n _this.removeNotExistingFiltersFromUrl();\n _this.markSelectedFilters(_this.scope.filters, urlfilters);\n return _this.rootscope.$broadcast(\"filters:loaded\", _this.scope.filters);\n };\n })(this));\n };\n\n IssuesController.prototype.loadIssuesRequests = 0;\n\n IssuesController.prototype.loadIssues = function() {\n var name, promise, values, _ref;\n this.scope.urlFilters = this.getUrlFilters();\n this.scope.httpParams = {};\n _ref = this.scope.urlFilters;\n for (name in _ref) {\n values = _ref[name];\n if (name === \"severities\") {\n name = \"severity\";\n } else if (name === \"orderBy\") {\n name = \"order_by\";\n } else if (name === \"priorities\") {\n name = \"priority\";\n } else if (name === \"assignedTo\") {\n name = \"assigned_to\";\n } else if (name === \"createdBy\") {\n name = \"owner\";\n } else if (name === \"statuses\") {\n name = \"status\";\n } else if (name === \"types\") {\n name = \"type\";\n }\n this.scope.httpParams[name] = values;\n }\n promise = this.rs.issues.list(this.scope.projectId, this.scope.httpParams);\n this.loadIssuesRequests += 1;\n promise.index = this.loadIssuesRequests;\n return promise.then((function(_this) {\n return function(data) {\n if (promise.index === _this.loadIssuesRequests) {\n _this.scope.issues = data.models;\n _this.scope.page = data.current;\n _this.scope.count = data.count;\n _this.scope.paginatedBy = data.paginatedBy;\n }\n return data;\n };\n })(this));\n };\n\n IssuesController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n _this.initializeSubscription();\n return _this.q.all([_this.loadFilters(), _this.loadIssues()]);\n };\n })(this));\n };\n\n IssuesController.prototype.saveCurrentFiltersTo = function(newFilter) {\n var deferred;\n deferred = this.q.defer();\n this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n filters[newFilter] = _this.location.search();\n return _this.rs.issues.storeMyFilters(_this.scope.projectId, filters).then(function() {\n return deferred.resolve();\n });\n };\n })(this));\n return deferred.promise;\n };\n\n IssuesController.prototype.deleteMyFilter = function(filter) {\n var deferred;\n deferred = this.q.defer();\n this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n delete filters[filter];\n return _this.rs.issues.storeMyFilters(_this.scope.projectId, filters).then(function() {\n return deferred.resolve();\n });\n };\n })(this));\n return deferred.promise;\n };\n\n IssuesController.prototype.addNewIssue = function() {\n return this.rootscope.$broadcast(\"issueform:new\", this.scope.project);\n };\n\n IssuesController.prototype.addIssuesInBulk = function() {\n return this.rootscope.$broadcast(\"issueform:bulk\", this.scope.projectId);\n };\n\n return IssuesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"IssuesController\", IssuesController);\n\n IssuesDirective = function($log, $location, $template) {\n var link, linkOrdering, linkPagination, template;\n template = $template.get(\"issue/issue-paginator.html\", true);\n linkPagination = function($scope, $el, $attrs, $ctrl) {\n var $pagEl, afterCurrent, atBegin, atEnd, beforeCurrent, getNumPages, renderPagination;\n afterCurrent = 2;\n beforeCurrent = 4;\n atBegin = 2;\n atEnd = 2;\n $pagEl = $el.find(\".issues-paginator\");\n getNumPages = function() {\n var numPages;\n numPages = $scope.count / $scope.paginatedBy;\n if (parseInt(numPages, 10) < numPages) {\n numPages = parseInt(numPages, 10) + 1;\n } else {\n numPages = parseInt(numPages, 10);\n }\n return numPages;\n };\n renderPagination = function() {\n var cpage, i, numPages, options, pages, _i;\n numPages = getNumPages();\n if (numPages <= 1) {\n $pagEl.hide();\n return;\n }\n $pagEl.show();\n pages = [];\n options = {};\n options.pages = pages;\n options.showPrevious = $scope.page > 1;\n options.showNext = !($scope.page === numPages);\n cpage = $scope.page;\n for (i = _i = 1; 1 <= numPages ? _i <= numPages : _i >= numPages; i = 1 <= numPages ? ++_i : --_i) {\n if (i === (cpage + afterCurrent) && numPages > (cpage + afterCurrent + atEnd)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i === (cpage - beforeCurrent) && cpage > (atBegin + beforeCurrent)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i > (cpage + afterCurrent) && i <= (numPages - atEnd)) {\n\n } else if (i < (cpage - beforeCurrent) && i > atBegin) {\n\n } else if (i === cpage) {\n pages.push({\n classes: \"active\",\n num: i,\n type: \"page-active\"\n });\n } else {\n pages.push({\n classes: \"page\",\n num: i,\n type: \"page\"\n });\n }\n }\n return $pagEl.html(template(options));\n };\n $scope.$watch(\"issues\", function(value) {\n if (!value) {\n return;\n }\n return renderPagination();\n });\n $el.on(\"click\", \".issues-paginator a.next\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page + 1);\n return $ctrl.loadIssues();\n });\n });\n $el.on(\"click\", \".issues-paginator a.previous\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page - 1);\n return $ctrl.loadIssues();\n });\n });\n return $el.on(\"click\", \".issues-paginator li.page > a\", function(event) {\n var pagenum, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n pagenum = target.data(\"pagenum\");\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", pagenum);\n return $ctrl.loadIssues();\n });\n });\n };\n linkOrdering = function($scope, $el, $attrs, $ctrl) {\n var colHeadElement, currentOrder, icon;\n currentOrder = $ctrl.getUrlFilter(\"orderBy\") || \"created_date\";\n if (currentOrder) {\n icon = startswith(currentOrder, \"-\") ? \"icon-caret-up\" : \"icon-caret-down\";\n colHeadElement = $el.find(\".row.title > div[data-fieldname='\" + (trim(currentOrder, \"-\")) + \"']\");\n colHeadElement.html((colHeadElement.html()) + \"\");\n }\n return $el.on(\"click\", \".row.title > div\", function(event) {\n var finalOrder, newOrder, target;\n target = angular.element(event.currentTarget);\n currentOrder = $ctrl.getUrlFilter(\"orderBy\");\n newOrder = target.data(\"fieldname\");\n finalOrder = currentOrder === newOrder ? \"-\" + newOrder : newOrder;\n return $scope.$apply(function() {\n $ctrl.replaceFilter(\"orderBy\", finalOrder);\n $ctrl.storeFilters();\n return $ctrl.loadIssues().then(function() {\n $el.find(\".row.title > div > span.icon\").remove();\n icon = startswith(finalOrder, \"-\") ? \"icon-caret-up\" : \"icon-caret-down\";\n return target.html((target.html()) + \"\");\n });\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n linkOrdering($scope, $el, $attrs, $ctrl);\n linkPagination($scope, $el, $attrs, $ctrl);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssues\", [\"$log\", \"$tgLocation\", \"$tgTemplate\", IssuesDirective]);\n\n IssuesFiltersDirective = function($log, $location, $rs, $confirm, $loading, $template) {\n var link, template, templateSelected;\n template = $template.get(\"issue/issues-filters.html\", true);\n templateSelected = $template.get(\"issue/issues-filters-selected.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, initializeSelectedFilters, renderFilters, renderSelectedFilters, selectQFilter, selectedFilters, showCategories, showFilters, toggleFilterSelection;\n $ctrl = $el.closest(\".wrapper\").controller();\n selectedFilters = [];\n showFilters = function(title, type) {\n $el.find(\".filters-cats\").hide();\n $el.find(\".filter-list\").removeClass(\"hidden\");\n $el.find(\"h2.breadcrumb\").removeClass(\"hidden\");\n $el.find(\"h2 a.subfilter span.title\").html(title);\n return $el.find(\"h2 a.subfilter span.title\").prop(\"data-type\", type);\n };\n showCategories = function() {\n $el.find(\".filters-cats\").show();\n $el.find(\".filter-list\").addClass(\"hidden\");\n return $el.find(\"h2.breadcrumb\").addClass(\"hidden\");\n };\n initializeSelectedFilters = function(filters) {\n var name, val, values, _i, _len;\n selectedFilters = [];\n for (name in filters) {\n values = filters[name];\n for (_i = 0, _len = values.length; _i < _len; _i++) {\n val = values[_i];\n if (val.selected) {\n selectedFilters.push(val);\n }\n }\n }\n return renderSelectedFilters(selectedFilters);\n };\n renderSelectedFilters = function(selectedFilters) {\n var html;\n _.filter(selectedFilters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = templateSelected({\n filters: selectedFilters\n });\n $el.find(\".filters-applied\").html(html);\n if (selectedFilters.length > 0) {\n return $el.find(\".save-filters\").show();\n } else {\n return $el.find(\".save-filters\").hide();\n }\n };\n renderFilters = function(filters) {\n var html;\n _.filter(filters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = template({\n filters: filters\n });\n return $el.find(\".filter-list\").html(html);\n };\n toggleFilterSelection = function(type, id) {\n var currentFiltersType, filter, filterId, filters;\n if (type === \"myFilters\") {\n $rs.issues.getMyFilters($scope.projectId).then(function(data) {\n var filters, myFilters;\n myFilters = data;\n filters = myFilters[id];\n filters.page = 1;\n $ctrl.replaceAllFilters(filters);\n $ctrl.storeFilters();\n $ctrl.loadIssues();\n $ctrl.markSelectedFilters($scope.filters, filters);\n return initializeSelectedFilters($scope.filters);\n });\n return null;\n }\n filters = $scope.filters[type];\n filterId = type === 'tags' ? taiga.toString(id) : id;\n filter = _.find(filters, {\n id: filterId\n });\n filter.selected = !filter.selected;\n if (id === null) {\n id = \"null\";\n }\n if (filter.selected) {\n selectedFilters.push(filter);\n $scope.$apply(function() {\n $ctrl.selectFilter(type, id);\n $ctrl.selectFilter(\"page\", 1);\n $ctrl.storeFilters();\n return $ctrl.loadIssues();\n });\n } else {\n selectedFilters = _.reject(selectedFilters, filter);\n $scope.$apply(function() {\n $ctrl.unselectFilter(type, id);\n $ctrl.selectFilter(\"page\", 1);\n $ctrl.storeFilters();\n return $ctrl.loadIssues();\n });\n }\n renderSelectedFilters(selectedFilters);\n currentFiltersType = $el.find(\"h2 a.subfilter span.title\").prop('data-type');\n if (type === currentFiltersType) {\n return renderFilters(_.reject(filters, \"selected\"));\n }\n };\n $scope.$on(\"filters:loaded\", function(ctx, filters) {\n return initializeSelectedFilters(filters);\n });\n selectQFilter = debounceLeading(100, function(value) {\n if (value === void 0) {\n return;\n }\n if (value.length === 0) {\n $ctrl.replaceFilter(\"q\", null);\n $ctrl.storeFilters();\n } else {\n $ctrl.replaceFilter(\"q\", value);\n $ctrl.storeFilters();\n }\n return $ctrl.loadIssues();\n });\n $scope.$watch(\"filtersQ\", selectQFilter);\n $el.on(\"click\", \".filters-cats > ul > li > a\", function(event) {\n var tags, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n tags = $scope.filters[target.data(\"type\")];\n renderFilters(_.reject(tags, \"selected\"));\n return showFilters(target.attr(\"title\"), target.data(\"type\"));\n });\n $el.on(\"click\", \".filters-inner > .filters-step-cat > .breadcrumb > .back\", function(event) {\n event.preventDefault();\n return showCategories($el);\n });\n $el.on(\"click\", \".filters-applied a\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n id = target.data(\"id\") || null;\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n $el.on(\"click\", \".filter-list .single-filter\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.toggleClass(\"active\");\n id = target.data(\"id\") || null;\n type = target.data(\"type\");\n if (type === \"myFilters\") {\n target.removeClass(\"active\");\n }\n return toggleFilterSelection(type, id);\n });\n $el.on(\"click\", \".filter-list .single-filter .icon-delete\", function(event) {\n var customFilterName, message, target, title;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n customFilterName = target.parent().data('id');\n title = \"Delete custom filter\";\n message = \"the custom filter '\" + customFilterName + \"'\";\n return $confirm.askOnDelete(title, message).then(function(finish) {\n var promise;\n promise = $ctrl.deleteMyFilter(customFilterName);\n promise.then(function() {\n promise = $ctrl.loadMyFilters();\n promise.then(function(filters) {\n finish();\n $scope.filters.myFilters = filters;\n return renderFilters($scope.filters.myFilters);\n });\n return promise.then(null, function() {\n return finish();\n });\n });\n return promise.then(null, function() {\n finish(false);\n return $confirm.notify(\"error\");\n });\n });\n });\n $el.on(\"click\", \".save-filters\", function(event) {\n event.preventDefault();\n renderFilters($scope.filters[\"myFilters\"]);\n showFilters(\"My filters\", \"myFilters\");\n $el.find('.save-filters').hide();\n $el.find('.my-filter-name').removeClass(\"hidden\");\n return $el.find('.my-filter-name').focus();\n });\n return $el.on(\"keyup\", \".my-filter-name\", function(event) {\n var newFilter, promise, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newFilter = target.val();\n $loading.start($el.find(\".new\"));\n promise = $ctrl.saveCurrentFiltersTo(newFilter);\n promise.then(function() {\n var loadPromise;\n loadPromise = $ctrl.loadMyFilters();\n loadPromise.then(function(filters) {\n var currentfilterstype;\n $loading.finish($el.find(\".new\"));\n $scope.filters.myFilters = filters;\n currentfilterstype = $el.find(\"h2 a.subfilter span.title\").prop('data-type');\n if (currentfilterstype === \"myFilters\") {\n renderFilters($scope.filters.myFilters);\n }\n $el.find('.my-filter-name').addClass(\"hidden\");\n return $el.find('.save-filters').show();\n });\n return loadPromise.then(null, function() {\n $loading.finish($el.find(\".new\"));\n return $confirm.notify(\"error\", \"Error loading custom filters\");\n });\n });\n return promise.then(null, function() {\n $loading.finish($el.find(\".new\"));\n $el.find(\".my-filter-name\").val(newFilter).focus().select();\n return $confirm.notify(\"error\", \"Filter not saved\");\n });\n } else if (event.keyCode === 27) {\n $el.find('.my-filter-name').val('');\n $el.find('.my-filter-name').addClass(\"hidden\");\n return $el.find('.save-filters').show();\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssuesFilters\", [\"$log\", \"$tgLocation\", \"$tgResources\", \"$tgConfirm\", \"$tgLoading\", \"$tgTemplate\", IssuesFiltersDirective]);\n\n IssueStatusInlineEditionDirective = function($repo, $template) {\n\n /*\n Print the status of an Issue and a popover to change it.\n - tg-issue-status-inline-edition: The issue\n \n Example:\n \n div.status(tg-issue-status-inline-edition=\"issue\")\n a.issue-status(href=\"\")\n \n NOTE: This directive need 'issueStatusById' and 'project'.\n */\n var link, selectionTemplate, updateIssueStatus;\n selectionTemplate = $template.get(\"issue/issue-status-inline-edition-selection.html\", true);\n updateIssueStatus = function($el, issue, issueStatusById) {\n var issueStatusDom, issueStatusDomParent, status;\n issueStatusDomParent = $el.find(\".issue-status\");\n issueStatusDom = $el.find(\".issue-status .issue-status-bind\");\n status = issueStatusById[issue.status];\n if (status) {\n issueStatusDom.text(status.name);\n issueStatusDom.prop(\"title\", status.name);\n return issueStatusDomParent.css('color', status.color);\n }\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, issue;\n $ctrl = $el.controller();\n issue = $scope.$eval($attrs.tgIssueStatusInlineEdition);\n $el.on(\"click\", \".issue-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n issue.status = target.data(\"status-id\");\n $el.find(\".pop-status\").popover().close();\n updateIssueStatus($el, issue, $scope.issueStatusById);\n return $scope.$apply(function() {\n return $repo.save(issue).then;\n });\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n $el.append(selectionTemplate({\n 'statuses': project.issue_statuses\n }));\n updateIssueStatus($el, issue, $scope.issueStatusById);\n if (project.my_permissions.indexOf(\"modify_issue\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$watch($attrs.tgIssueStatusInlineEdition, (function(_this) {\n return function(val) {\n return updateIssueStatus($el, val, $scope.issueStatusById);\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(\"tgIssueStatusInlineEdition\", [\"$tgRepo\", \"$tgTemplate\", IssueStatusInlineEditionDirective]);\n\n IssueAssignedToInlineEditionDirective = function($repo, $rootscope, popoverService) {\n var link, template;\n template = _.template(\"\\\" alt=\\\"<%- name %>\\\"/>\\n
<%- name %>
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, issue, updateIssue;\n updateIssue = function(issue) {\n var ctx, member;\n ctx = {\n name: \"Unassigned\",\n imgurl: \"/images/unnamed.png\"\n };\n member = $scope.usersById[issue.assigned_to];\n if (member) {\n ctx.imgurl = member.photo;\n ctx.name = member.full_name_display;\n }\n $el.find(\".avatar\").html(template(ctx));\n return $el.find(\".issue-assignedto\").attr('title', ctx.name);\n };\n $ctrl = $el.controller();\n issue = $scope.$eval($attrs.tgIssueAssignedToInlineEdition);\n updateIssue(issue);\n $el.on(\"click\", \".issue-assignedto\", function(event) {\n return $rootscope.$broadcast(\"assigned-to:add\", issue);\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_issue\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"assigned-to:added\", (function(_this) {\n return function(ctx, userId, updatedIssue) {\n if (updatedIssue.id === issue.id) {\n updatedIssue.assigned_to = userId;\n $repo.save(updatedIssue);\n return updateIssue(updatedIssue);\n }\n };\n })(this));\n $scope.$watch($attrs.tgIssueAssignedToInlineEdition, (function(_this) {\n return function(val) {\n return updateIssue(val);\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(\"tgIssueAssignedToInlineEdition\", [\"$tgRepo\", \"$rootScope\", IssueAssignedToInlineEditionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/detail.coffee\n */\n\n(function() {\n var UsClientRequirementButtonDirective, UsStatusButtonDirective, UsStatusDisplayDirective, UsTasksProgressDisplayDirective, UsTeamRequirementButtonDirective, UserStoryDetailController, bindOnce, groupBy, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaUserStories\");\n\n UserStoryDetailController = (function(_super) {\n __extends(UserStoryDetailController, _super);\n\n UserStoryDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"$appTitle\", \"$tgNavUrls\", \"$tgAnalytics\", \"tgLoader\"];\n\n function UserStoryDetailController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_log, _at_appTitle, _at_navUrls, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.log = _at_log;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.analytics = _at_analytics;\n this.scope.usRef = this.params.usref;\n this.scope.sectionName = \"User Story Details\";\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this.appTitle.set(_this.scope.us.subject + \" - \" + _this.scope.project.name);\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n UserStoryDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"related-tasks:update\", (function(_this) {\n return function() {\n _this.loadUs();\n return _this.scope.tasks = _.clone(_this.scope.tasks, false);\n };\n })(this));\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on userstory\", 1);\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n this.scope.$on(\"attachment:edit\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n return this.scope.$on(\"attachment:delete\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n if (this.scope.project.is_backlog_activated) {\n if (this.scope.us.milestone) {\n ctx.sprint = this.scope.sprint.slug;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-taskboard\", ctx);\n } else {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-backlog\", ctx);\n }\n } else if (this.scope.project.is_kanban_activated) {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-kanban\", ctx);\n }\n };\n\n UserStoryDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.us_statuses;\n _this.scope.statusById = groupBy(project.us_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.membersById = groupBy(project.memberships, function(x) {\n return x.user;\n });\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(_this.scope.pointsList, function(e) {\n return e.id;\n });\n return project;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadUs = function() {\n return this.rs.userstories.getByRef(this.scope.projectId, this.params.usref).then((function(_this) {\n return function(us) {\n var ctx;\n _this.scope.us = us;\n _this.scope.usId = us.id;\n _this.scope.commentModel = us;\n if (_this.scope.us.neighbors.previous.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.us.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n if (_this.scope.us.neighbors.next.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.us.neighbors.next.ref\n };\n _this.scope.nextUrl = _this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n return us;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadSprint = function() {\n if (this.scope.us.milestone) {\n return this.rs.sprints.get(this.scope.us.project, this.scope.us.milestone).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n return sprint;\n };\n })(this));\n }\n };\n\n UserStoryDetailController.prototype.loadTasks = function() {\n return this.rs.tasks.list(this.scope.projectId, null, this.scope.usId).then((function(_this) {\n return function(tasks) {\n _this.scope.tasks = tasks;\n return tasks;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.loadUs().then(function() {\n return _this.q.all([_this.loadSprint(), _this.loadTasks()]);\n });\n };\n })(this));\n };\n\n return UserStoryDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserStoryDetailController\", UserStoryDetailController);\n\n UsStatusDisplayDirective = function($template) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(us) {\n var html;\n html = template({\n is_closed: us.is_closed,\n status: $scope.statusById[us.status]\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(us) {\n if (us != null) {\n return render(us);\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(\"tgUsStatusDisplay\", [\"$tgTemplate\", UsStatusDisplayDirective]);\n\n UsTasksProgressDisplayDirective = function($template) {\n var link, template;\n template = $template.get(\"us/us-task-progress.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(tasks) {\n var html, progress, totalClosedTasks, totalTasks;\n totalTasks = tasks.length;\n totalClosedTasks = _.filter(tasks, (function(_this) {\n return function(task) {\n return $scope.taskStatusById[task.status].is_closed;\n };\n })(this)).length;\n progress = totalTasks > 0 ? 100 * totalClosedTasks / totalTasks : 0;\n html = template({\n totalTasks: totalTasks,\n totalClosedTasks: totalClosedTasks,\n progress: progress\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(tasks) {\n if (tasks != null) {\n return render(tasks);\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(\"tgUsTasksProgressDisplay\", [\"$tgTemplate\", UsTasksProgressDisplayDirective]);\n\n UsStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"us/us-status-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = (function(_this) {\n return function(us) {\n var html, status;\n status = $scope.statusById[us.status];\n html = template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(status) {\n var onError, onSuccess, us;\n us = $model.$modelValue.clone();\n us.status = status;\n $.fn.popover().closeAll();\n $model.$setViewValue(us);\n onSuccess = function() {\n $confirm.notify(\"success\");\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n us.revert();\n $model.$setViewValue(us);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save($model.$modelValue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".status-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var status, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n status = target.data(\"status-id\");\n return save(status);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\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(\"tgUsStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", UsStatusButtonDirective]);\n\n UsTeamRequirementButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"us/us-team-requirement-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var canEdit, render, save;\n canEdit = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = function(us) {\n var ctx, html;\n if (!canEdit() && !us.team_requirement) {\n $el.html(\"\");\n return;\n }\n ctx = {\n canEdit: canEdit(),\n isRequired: us.team_requirement\n };\n html = template(ctx);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(team_requirement) {\n var promise, us;\n us = $model.$modelValue.clone();\n us.team_requirement = team_requirement;\n $model.$setViewValue(us);\n $loading.start($el.find(\"label\"));\n promise = $tgrepo.save($model.$modelValue);\n promise.then(function() {\n $loading.finish($el.find(\"label\"));\n return $rootscope.$broadcast(\"history:reload\");\n });\n return promise.then(null, function() {\n $loading.finish($el.find(\"label\"));\n $confirm.notify(\"error\");\n us.revert();\n return $model.$setViewValue(us);\n });\n };\n })(this));\n $el.on(\"click\", \".team-requirement\", function(event) {\n var team_requirement;\n if (!canEdit()) {\n return;\n }\n team_requirement = !$model.$modelValue.team_requirement;\n return save(team_requirement);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\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(\"tgUsTeamRequirementButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", UsTeamRequirementButtonDirective]);\n\n UsClientRequirementButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"us/us-client-requirement-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var canEdit, render, save;\n canEdit = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = function(us) {\n var ctx, html;\n if (!canEdit() && !us.client_requirement) {\n $el.html(\"\");\n return;\n }\n ctx = {\n canEdit: canEdit(),\n isRequired: us.client_requirement\n };\n html = template(ctx);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(client_requirement) {\n var promise, us;\n us = $model.$modelValue.clone();\n us.client_requirement = client_requirement;\n $model.$setViewValue(us);\n $loading.start($el.find(\"label\"));\n promise = $tgrepo.save($model.$modelValue);\n promise.then(function() {\n $loading.finish($el.find(\"label\"));\n return $rootscope.$broadcast(\"history:reload\");\n });\n return promise.then(null, function() {\n $loading.finish($el.find(\"label\"));\n $confirm.notify(\"error\");\n us.revert();\n return $model.$setViewValue(us);\n });\n };\n })(this));\n $el.on(\"click\", \".client-requirement\", function(event) {\n var client_requirement;\n if (!canEdit()) {\n return;\n }\n client_requirement = !$model.$modelValue.client_requirement;\n return save(client_requirement);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\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(\"tgUsClientRequirementButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", UsClientRequirementButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/detail.coffee\n */\n\n(function() {\n var TaskDetailController, TaskIsIocaineButtonDirective, TaskStatusButtonDirective, TaskStatusDisplayDirective, groupBy, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaTasks\");\n\n TaskDetailController = (function(_super) {\n __extends(TaskDetailController, _super);\n\n TaskDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"$appTitle\", \"$tgNavUrls\", \"$tgAnalytics\", \"tgLoader\"];\n\n function TaskDetailController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_log, _at_appTitle, _at_navUrls, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.log = _at_log;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.analytics = _at_analytics;\n this.scope.taskRef = this.params.taskref;\n this.scope.sectionName = \"Task Details\";\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this.appTitle.set(_this.scope.task.subject + \" - \" + _this.scope.project.name);\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n TaskDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on task\", 1);\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n this.scope.$on(\"attachment:edit\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n return this.scope.$on(\"attachment:delete\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n };\n\n TaskDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n if (this.scope.project.is_backlog_activated) {\n if (this.scope.task.milestone) {\n ctx.sprint = this.scope.sprint.slug;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-taskboard\", ctx);\n } else if (this.scope.task.us) {\n ctx.ref = this.scope.us.ref;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n } else if (this.scope.project.is_kanban_activated) {\n if (this.scope.us) {\n ctx.ref = this.scope.us.ref;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n }\n };\n\n TaskDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.task_statuses;\n _this.scope.statusById = groupBy(project.task_statuses, function(x) {\n return x.id;\n });\n _this.scope.membersById = groupBy(project.memberships, function(x) {\n return x.user;\n });\n return project;\n };\n })(this));\n };\n\n TaskDetailController.prototype.loadTask = function() {\n return this.rs.tasks.getByRef(this.scope.projectId, this.params.taskref).then((function(_this) {\n return function(task) {\n var ctx;\n _this.scope.task = task;\n _this.scope.taskId = task.id;\n _this.scope.commentModel = task;\n if (_this.scope.task.neighbors.previous.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.task.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-tasks-detail\", ctx);\n }\n if (_this.scope.task.neighbors.next.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.task.neighbors.next.ref\n };\n _this.scope.nextUrl = _this.navUrls.resolve(\"project-tasks-detail\", ctx);\n }\n return task;\n };\n })(this));\n };\n\n TaskDetailController.prototype.loadSprint = function() {\n if (this.scope.task.milestone) {\n return this.rs.sprints.get(this.scope.task.project, this.scope.task.milestone).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n return sprint;\n };\n })(this));\n }\n };\n\n TaskDetailController.prototype.loadUserStory = function() {\n if (this.scope.task.user_story) {\n return this.rs.userstories.get(this.scope.task.project, this.scope.task.user_story).then((function(_this) {\n return function(us) {\n _this.scope.us = us;\n return us;\n };\n })(this));\n }\n };\n\n TaskDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.loadTask().then(function() {\n return _this.q.all([_this.loadSprint(), _this.loadUserStory()]);\n });\n };\n })(this));\n };\n\n return TaskDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TaskDetailController\", TaskDetailController);\n\n TaskStatusDisplayDirective = function($template) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(task) {\n var html;\n html = template({\n status: $scope.statusById[task.status]\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(task) {\n if (task != null) {\n return render(task);\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(\"tgTaskStatusDisplay\", [\"$tgTemplate\", TaskStatusDisplayDirective]);\n\n TaskStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue) {\n var link, template;\n template = _.template(\"
clickable<% }%>\\\">\\n \\\">\\n <%- status.name %>\\n <% if(editable){ %><% }%>\\n status\\n\\n \\n
\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n };\n render = (function(_this) {\n return function(task) {\n var html, status;\n status = $scope.statusById[task.status];\n html = template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(status) {\n var onError, onSuccess, task;\n task = $model.$modelValue.clone();\n task.status = status;\n $model.$setViewValue(task);\n onSuccess = function() {\n $confirm.notify(\"success\");\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n task.revert();\n $model.$setViewValue(task);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save($model.$modelValue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".status-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n $.fn.popover().closeAll();\n return save(target.data(\"status-id\"));\n });\n $scope.$watch($attrs.ngModel, function(task) {\n if (task) {\n return render(task);\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(\"tgTaskStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", TaskStatusButtonDirective]);\n\n TaskIsIocaineButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue) {\n var link, template;\n template = _.template(\"
\\n \\n \\n
\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n };\n render = function(task) {\n var ctx, html;\n if (!isEditable() && !task.is_iocaine) {\n $el.html(\"\");\n return;\n }\n ctx = {\n isIocaine: task.is_iocaine,\n isEditable: isEditable()\n };\n html = template(ctx);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(is_iocaine) {\n var promise, task;\n task = $model.$modelValue.clone();\n task.is_iocaine = is_iocaine;\n $model.$setViewValue(task);\n $loading.start($el.find('label'));\n promise = $tgrepo.save(task);\n promise.then(function() {\n $confirm.notify(\"success\");\n return $rootscope.$broadcast(\"history:reload\");\n });\n promise.then(null, function() {\n task.revert();\n $model.$setViewValue(task);\n return $confirm.notify(\"error\");\n });\n return promise[\"finally\"](function() {\n return $loading.finish($el.find('label'));\n });\n };\n })(this));\n $el.on(\"click\", \".is-iocaine\", function(event) {\n var is_iocaine;\n if (!isEditable()) {\n return;\n }\n is_iocaine = !$model.$modelValue.is_iocaine;\n return save(is_iocaine);\n });\n $scope.$watch($attrs.ngModel, function(task) {\n if (task) {\n return render(task);\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(\"tgTaskIsIocaineButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", TaskIsIocaineButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var LeaveProjectDirective, TeamController, TeamFiltersDirective, TeamMemberCurrentUserDirective, TeamMemberStatsDirective, TeamMembersDirective, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n module = angular.module(\"taigaTeam\");\n\n TeamController = (function(_super) {\n __extends(TeamController, _super);\n\n TeamController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$location\", \"$tgNavUrls\", \"$appTitle\", \"$tgAuth\", \"tgLoader\"];\n\n function TeamController(_at_scope, _at_rootscope, _at_repo, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_appTitle, _at_auth, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.appTitle = _at_appTitle;\n this.auth = _at_auth;\n this.scope.sectionName = \"Team\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Team - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n TeamController.prototype.setRole = function(role) {\n if (role) {\n return this.scope.filtersRole = role;\n } else {\n return this.scope.filtersRole = null;\n }\n };\n\n TeamController.prototype.loadMembers = function() {\n return this.rs.memberships.list(this.scope.projectId, {}, false).then((function(_this) {\n return function(data) {\n var currentUser, membership, _i, _len, _ref;\n currentUser = _this.auth.getUser();\n if (currentUser.photo == null) {\n currentUser.photo = \"/images/unnamed.png\";\n }\n _this.scope.currentUser = _.find(data, function(membership) {\n return membership.user === currentUser.id;\n });\n _this.scope.totals = {};\n _.forEach(data, function(membership) {\n return _this.scope.totals[membership.user] = 0;\n });\n _this.scope.memberships = _.filter(data, function(membership) {\n if (membership.user && membership.user !== currentUser.id && membership.is_user_active) {\n return membership;\n }\n });\n _ref = _this.scope.memberships;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n membership = _ref[_i];\n if (membership.photo == null) {\n membership.photo = \"/images/unnamed.png\";\n }\n }\n return data;\n };\n })(this));\n };\n\n TeamController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.issuesEnabled = project.is_issues_activated;\n _this.scope.tasksEnabled = project.is_kanban_activated || project.is_backlog_activated;\n _this.scope.wikiEnabled = project.is_wiki_activated;\n return project;\n };\n })(this));\n };\n\n TeamController.prototype.loadMemberStats = function() {\n return this.rs.projects.memberStats(this.scope.projectId).then((function(_this) {\n return function(stats) {\n var totals;\n totals = {};\n _.forEach(_this.scope.totals, function(total, userId) {\n var vals;\n vals = _.map(stats, function(memberStats, statsKey) {\n return memberStats[userId];\n });\n total = _.reduce(vals, function(sum, el) {\n return sum + el;\n });\n return _this.scope.totals[userId] = total;\n });\n _this.scope.stats = _this.processStats(stats);\n return _this.scope.stats.totals = _this.scope.totals;\n };\n })(this));\n };\n\n TeamController.prototype.processStat = function(stat) {\n var max, min, singleStat;\n max = _.max(stat);\n min = _.min(stat);\n singleStat = _.map(stat, function(value, key) {\n if (value === min) {\n return [key, 0.1];\n }\n if (value === max) {\n return [key, 1];\n }\n return [key, (value * 0.5) / max];\n });\n singleStat = _.object(singleStat);\n return singleStat;\n };\n\n TeamController.prototype.processStats = function(stats) {\n var key, value;\n for (key in stats) {\n value = stats[key];\n stats[key] = this.processStat(value);\n }\n return stats;\n };\n\n TeamController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.loadMembers().then(function() {\n return _this.loadMemberStats();\n });\n };\n })(this));\n };\n\n return TeamController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TeamController\", TeamController);\n\n TeamFiltersDirective = function() {\n return {\n templateUrl: \"team/team-filter.html\"\n };\n };\n\n module.directive(\"tgTeamFilters\", [TeamFiltersDirective]);\n\n TeamMemberStatsDirective = function() {\n return {\n templateUrl: \"team/team-member-stats.html\",\n scope: {\n stats: \"=\",\n userId: \"=user\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\"\n }\n };\n };\n\n module.directive(\"tgTeamMemberStats\", TeamMemberStatsDirective);\n\n TeamMemberCurrentUserDirective = function() {\n return {\n templateUrl: \"team/team-member-current-user.html\",\n scope: {\n projectId: \"=projectid\",\n currentUser: \"=currentuser\",\n stats: \"=\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\"\n }\n };\n };\n\n module.directive(\"tgTeamCurrentUser\", TeamMemberCurrentUserDirective);\n\n TeamMembersDirective = function() {\n var template;\n template = \"team/team-members.html\";\n return {\n templateUrl: template,\n scope: {\n memberships: \"=\",\n filtersQ: \"=filtersq\",\n filtersRole: \"=filtersrole\",\n stats: \"=\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\"\n }\n };\n };\n\n module.directive(\"tgTeamMembers\", TeamMembersDirective);\n\n LeaveProjectDirective = function($repo, $confirm, $location, $rs, $navurls) {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.leave = function() {\n return $confirm.ask(\"Leave this project\", \"Are you sure you want to leave the project?\").then((function(_this) {\n return function(finish) {\n var promise;\n promise = $rs.projects.leave($attrs.projectid);\n promise.then(function() {\n finish();\n $confirm.notify(\"success\");\n return $location.path($navurls.resolve(\"home\"));\n });\n return promise.then(null, function(response) {\n finish();\n return $confirm.notify('error', response.data._error_message);\n });\n };\n })(this));\n };\n };\n return {\n scope: {},\n templateUrl: \"team/leave-project.html\",\n link: link\n };\n };\n\n module.directive(\"tgLeaveProject\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"$tgResources\", \"$tgNavUrls\", LeaveProjectDirective]);\n\n module.filter('membersRoleFilter', function() {\n return function(input, filtersRole) {\n if (filtersRole != null) {\n return _.filter(input, {\n role: filtersRole.id\n });\n }\n return input;\n };\n });\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/detail.coffee\n */\n\n(function() {\n var EditableWikiContentDirective, WikiDetailController, WikiSummaryDirective, bindOnce, debounce, groupBy, mixOf, module, taiga, unslugify,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n unslugify = this.taiga.unslugify;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaWiki\");\n\n WikiDetailController = (function(_super) {\n __extends(WikiDetailController, _super);\n\n WikiDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgModel\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$filter\", \"$log\", \"$appTitle\", \"$tgNavUrls\", \"$tgAnalytics\", \"tgLoader\"];\n\n function WikiDetailController(_at_scope, _at_rootscope, _at_repo, _at_model, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_filter, _at_log, _at_appTitle, _at_navUrls, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.model = _at_model;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.filter = _at_filter;\n this.log = _at_log;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.analytics = _at_analytics;\n this.scope.projectSlug = this.params.pslug;\n this.scope.wikiSlug = this.params.slug;\n this.scope.sectionName = \"Wiki\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Wiki - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n WikiDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.membersById = groupBy(project.memberships, function(x) {\n return x.user;\n });\n return project;\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadWiki = function() {\n var promise;\n promise = this.rs.wiki.getBySlug(this.scope.projectId, this.params.slug);\n promise.then((function(_this) {\n return function(wiki) {\n _this.scope.wiki = wiki;\n _this.scope.wikiId = wiki.id;\n return _this.scope.wiki;\n };\n })(this));\n return promise.then(null, (function(_this) {\n return function(xhr) {\n var data;\n _this.scope.wikiId = null;\n if (_this.scope.project.my_permissions.indexOf(\"add_wiki_page\") === -1) {\n return null;\n }\n data = {\n project: _this.scope.projectId,\n slug: _this.scope.wikiSlug,\n content: \"\"\n };\n _this.scope.wiki = _this.model.make_model(\"wiki\", data);\n return _this.scope.wiki;\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadWikiLinks = function() {\n return this.rs.wiki.listLinks(this.scope.projectId).then((function(_this) {\n return function(wikiLinks) {\n return _this.scope.wikiLinks = wikiLinks;\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.q.all([_this.loadWikiLinks(), _this.loadWiki()]);\n };\n })(this));\n };\n\n WikiDetailController.prototype[\"delete\"] = function() {\n var message, title;\n title = \"Delete Wiki Page\";\n message = unslugify(this.scope.wiki.slug);\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var onError, onSuccess;\n onSuccess = function() {\n var ctx;\n finish();\n ctx = {\n project: _this.scope.projectSlug\n };\n _this.location.path(_this.navUrls.resolve(\"project-wiki\", ctx));\n return _this.confirm.notify(\"success\");\n };\n onError = function() {\n finish(false);\n return _this.confirm.notify(\"error\");\n };\n return _this.repo.remove(_this.scope.wiki).then(onSuccess, onError);\n };\n })(this));\n };\n\n return WikiDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"WikiDetailController\", WikiDetailController);\n\n WikiSummaryDirective = function($log, $template) {\n var link, template;\n template = $template.get(\"wiki/wiki-summary.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var render;\n render = function(wiki) {\n var ctx, html, user;\n if ($scope.usersById == null) {\n $log.error(\"WikiSummaryDirective requires userById set in scope.\");\n } else {\n user = $scope.usersById[wiki.last_modifier];\n }\n if (user === void 0) {\n user = {\n name: \"unknown\",\n imgUrl: \"/images/unnamed.png\"\n };\n } else {\n user = {\n name: user.full_name_display,\n imgUrl: user.photo\n };\n }\n ctx = {\n totalEditions: wiki.editions,\n lastModifiedDate: moment(wiki.modified_date).format(\"DD MMM YYYY HH:mm\"),\n user: user\n };\n html = template(ctx);\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(wikiPage) {\n if (!wikiPage) {\n return;\n }\n return render(wikiPage);\n });\n $scope.$on(\"wiki:edit\", function(event, wikiPage) {\n return render(wikiPage);\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(\"tgWikiSummary\", [\"$log\", \"$tgTemplate\", WikiSummaryDirective]);\n\n EditableWikiContentDirective = function($window, $document, $repo, $confirm, $loading, $analytics, $qqueue) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var cancelEdition, disableEdition, getSelectedText, isEditable, save, switchToEditMode, switchToReadMode;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_wiki_page\") !== -1;\n };\n switchToEditMode = function() {\n $el.find('.edit-wiki-content').show();\n $el.find('.view-wiki-content').hide();\n return $el.find('textarea').focus();\n };\n switchToReadMode = function() {\n $el.find('.edit-wiki-content').hide();\n return $el.find('.view-wiki-content').show();\n };\n disableEdition = function() {\n $el.find(\".view-wiki-content .edit\").remove();\n return $el.find(\".edit-wiki-content\").remove();\n };\n cancelEdition = function() {\n if (!$model.$modelValue.id) {\n return;\n }\n $scope.$apply((function(_this) {\n return function() {\n return $model.$modelValue.revert();\n };\n })(this));\n return switchToReadMode();\n };\n getSelectedText = function() {\n if ($window.getSelection) {\n return $window.getSelection().toString();\n } else if ($document.selection) {\n return $document.selection.createRange().text;\n }\n return null;\n };\n save = $qqueue.bindAdd(function(wiki) {\n var onError, onSuccess, promise;\n onSuccess = function(wikiPage) {\n if (wiki.id == null) {\n $analytics.trackEvent(\"wikipage\", \"create\", \"create wiki page\", 1);\n }\n $model.$modelValue = wikiPage;\n $scope.$broadcast(\"wiki:edit\", wikiPage);\n $confirm.notify(\"success\");\n return switchToReadMode();\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n $loading.start($el.find('.save-container'));\n if (wiki.id != null) {\n promise = $repo.save(wiki).then(onSuccess, onError);\n } else {\n promise = $repo.create(\"wiki\", wiki).then(onSuccess, onError);\n }\n return promise[\"finally\"](function() {\n return $loading.finish($el.find('.save-container'));\n });\n });\n $el.on(\"mousedown\", \".view-wiki-content\", function(event) {\n var target;\n target = angular.element(event.target);\n if (target.is('pre')) {\n return target.data(\"scroll-pos\", target[0].scrollLeft);\n }\n });\n $el.on(\"mouseup\", \".view-wiki-content\", function(event) {\n var prevPos, target;\n target = angular.element(event.target);\n if (!isEditable()) {\n return;\n }\n if (target.is('a')) {\n return;\n }\n if (getSelectedText()) {\n return;\n }\n if (target.is('pre')) {\n prevPos = target.data(\"scroll-pos\");\n target.data(\"scroll-pos\", null);\n if (prevPos !== target[0].scrollLeft) {\n return;\n }\n }\n return switchToEditMode();\n });\n $el.on(\"click\", \".save\", debounce(2000, function() {\n return save($scope.wiki);\n }));\n $el.on(\"click\", \".cancel\", function() {\n return cancelEdition();\n });\n $el.on(\"keydown\", \"textarea\", function(event) {\n if (event.keyCode === 27) {\n return cancelEdition();\n }\n });\n $scope.$watch($attrs.ngModel, function(wikiPage) {\n if (!wikiPage) {\n return;\n }\n if (isEditable()) {\n $el.addClass('editable');\n if (wikiPage.id == null) {\n return switchToEditMode();\n }\n } else {\n return disableEdition();\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 templateUrl: \"wiki/editable-wiki-content.html\"\n };\n };\n\n module.directive(\"tgEditableWikiContent\", [\"$window\", \"$document\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgAnalytics\", \"$tgQqueue\", EditableWikiContentDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/detail.coffee\n */\n\n(function() {\n var WikiNavDirective, bindOnce, groupBy, mixOf, module, slugify, taiga, unslugify;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n slugify = this.taiga.slugify;\n\n unslugify = this.taiga.slugify;\n\n module = angular.module(\"taigaWiki\");\n\n WikiNavDirective = function($tgrepo, $log, $location, $confirm, $navUrls, $analytics, $loading, $template) {\n var link, template;\n template = $template.get(\"wiki/wiki-nav.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, render;\n $ctrl = $el.controller();\n if ($attrs.ngModel == null) {\n return $log.error(\"WikiNavDirective: no ng-model attr is defined\");\n }\n render = function(wikiLinks) {\n var addWikiLinkPermission, deleteWikiLinkPermission, html;\n addWikiLinkPermission = $scope.project.my_permissions.indexOf(\"add_wiki_link\") > -1;\n deleteWikiLinkPermission = $scope.project.my_permissions.indexOf(\"delete_wiki_link\") > -1;\n html = template({\n wikiLinks: wikiLinks,\n projectSlug: $scope.projectSlug,\n addWikiLinkPermission: addWikiLinkPermission,\n deleteWikiLinkPermission: deleteWikiLinkPermission\n });\n $el.off();\n $el.html(html);\n $el.on(\"click\", \".wiki-link .link-title\", function(event) {\n var linkId, linkSlug, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n linkId = target.parents('.wiki-link').data('id');\n linkSlug = $scope.wikiLinks[linkId].href;\n return $scope.$apply(function() {\n var ctx;\n ctx = {\n project: $scope.projectSlug,\n slug: linkSlug\n };\n return $location.path($navUrls.resolve(\"project-wiki-page\", ctx));\n });\n });\n $el.on(\"click\", \".add-button\", function(event) {\n event.preventDefault();\n $el.find(\".new\").removeClass(\"hidden\");\n $el.find(\".new input\").focus();\n return $el.find(\".add-button\").hide();\n });\n $el.on(\"click\", \".wiki-link .icon-delete\", function(event) {\n var linkId, message, target, title;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n linkId = target.parents('.wiki-link').data('id');\n title = \"Delete Wiki Link\";\n message = $scope.wikiLinks[linkId].title;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var promise;\n promise = $tgrepo.remove($scope.wikiLinks[linkId]);\n promise.then(function() {\n promise = $ctrl.loadWikiLinks();\n promise.then(function() {\n finish();\n return render($scope.wikiLinks);\n });\n return promise.then(null, function() {\n return finish();\n });\n });\n return promise.then(null, function() {\n finish(false);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n });\n return $el.on(\"keyup\", \".new input\", function(event) {\n var newLink, promise, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newLink = target.val();\n $loading.start($el.find(\".new\"));\n promise = $tgrepo.create(\"wiki-links\", {\n project: $scope.projectId,\n title: newLink,\n href: slugify(newLink)\n });\n promise.then(function() {\n var loadPromise;\n $analytics.trackEvent(\"wikilink\", \"create\", \"create wiki link\", 1);\n loadPromise = $ctrl.loadWikiLinks();\n loadPromise.then(function() {\n $loading.finish($el.find(\".new\"));\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n $el.find(\".add-button\").show();\n return render($scope.wikiLinks);\n });\n return loadPromise.then(null, function() {\n $loading.finish($el.find(\".new\"));\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n $el.find(\".add-button\").show();\n return $confirm.notify(\"error\", \"Error loading wiki links\");\n });\n });\n return promise.then(null, function(error) {\n var _ref;\n $loading.finish($el.find(\".new\"));\n $el.find(\".new input\").val(newLink);\n $el.find(\".new input\").focus().select();\n if ((error != null ? (_ref = error.__all__) != null ? _ref[0] : void 0 : void 0) != null) {\n return $confirm.notify(\"error\", \"The link already exists\");\n } else {\n return $confirm.notify(\"error\");\n }\n });\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n return $el.find(\".add-button\").show();\n }\n });\n };\n return bindOnce($scope, $attrs.ngModel, render);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgWikiNav\", [\"$tgRepo\", \"$log\", \"$tgLocation\", \"$tgConfirm\", \"$tgNavUrls\", \"$tgAnalytics\", \"$tgLoading\", \"$tgTemplate\", WikiNavDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var CreateMembersDirective, MAX_MEMBERSHIP_FIELDSETS, debounce, module, taiga;\n\n taiga = this.taiga;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaKanban\");\n\n MAX_MEMBERSHIP_FIELDSETS = 4;\n\n CreateMembersDirective = function($rs, $rootScope, $confirm, $loading, lightboxService) {\n var extraTextTemplate, link, template;\n extraTextTemplate = \"
\\n \\n
\";\n template = _.template(\"
\\n
\\n data-required=\\\"true\\\" <% } %> data-type=\\\"email\\\" />\\n
\\n
\\n \\n \\n
\\n
\");\n link = function($scope, $el, $attrs) {\n var createFieldSet, resetForm, submit, submitButton;\n createFieldSet = function(required) {\n var ctx;\n if (required == null) {\n required = true;\n }\n ctx = {\n roleList: $scope.roles,\n required: required\n };\n return template(ctx);\n };\n resetForm = function() {\n var fieldSet, invitations;\n $el.find(\"form textarea\").remove(\"\");\n $el.find(\"form .add-member-wrapper\").remove();\n invitations = $el.find(\".add-member-forms\");\n invitations.html(extraTextTemplate);\n fieldSet = createFieldSet();\n return invitations.prepend(fieldSet);\n };\n $scope.$on(\"membersform:new\", function() {\n resetForm();\n return lightboxService.open($el);\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n $el.on(\"click\", \".delete-fieldset\", function(event) {\n var fieldSet, lastActionButton, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n fieldSet = target.closest('.add-member-wrapper');\n fieldSet.remove();\n lastActionButton = $el.find(\"fieldset:last > a\");\n if (lastActionButton.hasClass(\"icon-delete delete-fieldset\")) {\n return lastActionButton.removeClass(\"icon-delete delete-fieldset\").addClass(\"icon-plus add-fieldset\");\n }\n });\n $el.on(\"click\", \".add-fieldset\", function(event) {\n var fieldSet, newFieldSet, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n fieldSet = target.closest('.add-member-wrapper');\n target.removeClass(\"icon-plus add-fieldset\").addClass(\"icon-delete delete-fieldset\");\n newFieldSet = createFieldSet(false);\n fieldSet.after(newFieldSet);\n if ($el.find(\".add-member-wrapper\").length === MAX_MEMBERSHIP_FIELDSETS) {\n return $el.find(\".add-member-wrapper fieldset:last > a\").removeClass(\"icon-plus add-fieldset\").addClass(\"icon-delete delete-fieldset\");\n }\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var form, invitation_extra_text, invitations, memberWrappers, onError, onSuccess;\n event.preventDefault();\n $loading.start(submitButton);\n onSuccess = function(data) {\n $loading.finish(submitButton);\n lightboxService.close($el);\n $confirm.notify(\"success\");\n return $rootScope.$broadcast(\"membersform:new:success\");\n };\n onError = function(data) {\n $loading.finish(submitButton);\n lightboxService.close($el);\n $confirm.notify(\"error\");\n return $rootScope.$broadcast(\"membersform:new:error\");\n };\n form = $el.find(\"form\").checksley();\n form.destroy();\n form.initialize();\n if (!form.validate()) {\n return;\n }\n memberWrappers = $el.find(\"form .add-member-wrapper\");\n memberWrappers = _.filter(memberWrappers, function(mw) {\n return angular.element(mw).find(\"input\").hasClass('checksley-ok');\n });\n invitations = _.map(memberWrappers, function(mw) {\n var email, memberWrapper, role;\n memberWrapper = angular.element(mw);\n email = memberWrapper.find(\"input\");\n role = memberWrapper.find(\"select\");\n return {\n email: email.val(),\n role_id: role.val()\n };\n });\n if (invitations.length) {\n invitation_extra_text = $el.find(\"form textarea\").val();\n return $rs.memberships.bulkCreateMemberships($scope.project.id, invitations, invitation_extra_text).then(onSuccess, onError);\n }\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateMembers\", [\"$tgResources\", \"$rootScope\", \"$tgConfirm\", \"$tgLoading\", \"lightboxService\", CreateMembersDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var MembershipsController, MembershipsDirective, MembershipsRowActionsDirective, MembershipsRowAdminCheckboxDirective, MembershipsRowAvatarDirective, MembershipsRowRoleSelectorDirective, bindMethods, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaAdmin\");\n\n MembershipsController = (function(_super) {\n __extends(MembershipsController, _super);\n\n MembershipsController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAnalytics\", \"$appTitle\"];\n\n function MembershipsController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_analytics, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.analytics = _at_analytics;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Manage Members\";\n this.scope.project = {};\n this.scope.filters = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Membership - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"membersform:new:success\", (function(_this) {\n return function() {\n _this.loadMembers();\n return _this.analytics.trackEvent(\"membership\", \"create\", \"create memberships on admin\", 1);\n };\n })(this));\n }\n\n MembershipsController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n MembershipsController.prototype.loadMembers = function() {\n var httpFilters;\n httpFilters = this.getUrlFilters();\n return this.rs.memberships.list(this.scope.projectId, httpFilters).then((function(_this) {\n return function(data) {\n _this.scope.memberships = _.filter(data.models, function(membership) {\n return membership.user === null || membership.is_user_active;\n });\n _this.scope.page = data.current;\n _this.scope.count = data.count;\n _this.scope.paginatedBy = data.paginatedBy;\n return data;\n };\n })(this));\n };\n\n MembershipsController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadUsersAndRoles();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadMembers();\n };\n })(this));\n };\n\n MembershipsController.prototype.getUrlFilters = function() {\n var filters;\n filters = _.pick(this.location.search(), \"page\");\n if (!filters.page) {\n filters.page = 1;\n }\n return filters;\n };\n\n MembershipsController.prototype.addNewMembers = function() {\n return this.rootscope.$broadcast(\"membersform:new\");\n };\n\n return MembershipsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"MembershipsController\", MembershipsController);\n\n MembershipsDirective = function($template) {\n var link, linkPagination, template;\n template = $template.get(\"admin/admin-membership-paginator.html\", true);\n linkPagination = function($scope, $el, $attrs, $ctrl) {\n var $pagEl, afterCurrent, atBegin, atEnd, beforeCurrent, getNumPages, renderPagination;\n afterCurrent = 2;\n beforeCurrent = 4;\n atBegin = 2;\n atEnd = 2;\n $pagEl = $el.find(\".memberships-paginator\");\n getNumPages = function() {\n var numPages;\n numPages = $scope.count / $scope.paginatedBy;\n if (parseInt(numPages, 10) < numPages) {\n numPages = parseInt(numPages, 10) + 1;\n } else {\n numPages = parseInt(numPages, 10);\n }\n return numPages;\n };\n renderPagination = function() {\n var cpage, i, numPages, options, pages, _i;\n numPages = getNumPages();\n if (numPages <= 1) {\n $pagEl.hide();\n return;\n }\n pages = [];\n options = {};\n options.pages = pages;\n options.showPrevious = $scope.page > 1;\n options.showNext = !($scope.page === numPages);\n cpage = $scope.page;\n for (i = _i = 1; 1 <= numPages ? _i <= numPages : _i >= numPages; i = 1 <= numPages ? ++_i : --_i) {\n if (i === (cpage + afterCurrent) && numPages > (cpage + afterCurrent + atEnd)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i === (cpage - beforeCurrent) && cpage > (atBegin + beforeCurrent)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i > (cpage + afterCurrent) && i <= (numPages - atEnd)) {\n\n } else if (i < (cpage - beforeCurrent) && i > atBegin) {\n\n } else if (i === cpage) {\n pages.push({\n classes: \"active\",\n num: i,\n type: \"page-active\"\n });\n } else {\n pages.push({\n classes: \"page\",\n num: i,\n type: \"page\"\n });\n }\n }\n return $pagEl.html(template(options));\n };\n $scope.$watch(\"memberships\", function(value) {\n if (!value) {\n return;\n }\n return renderPagination();\n });\n $el.on(\"click\", \".memberships-paginator a.next\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page + 1);\n return $ctrl.loadMembers();\n });\n });\n $el.on(\"click\", \".memberships-paginator a.previous\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page - 1);\n return $ctrl.loadMembers();\n });\n });\n return $el.on(\"click\", \".memberships-paginator li.page > a\", function(event) {\n var pagenum, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n pagenum = target.data(\"pagenum\");\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", pagenum);\n return $ctrl.loadMembers();\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n linkPagination($scope, $el, $attrs, $ctrl);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMemberships\", [\"$tgTemplate\", MembershipsDirective]);\n\n MembershipsRowAvatarDirective = function($log, $template) {\n var link, template;\n template = $template.get(\"admin/memberships-row-avatar.html\", true);\n link = function($scope, $el, $attrs) {\n var member, render;\n render = function(member) {\n var ctx, html;\n ctx = {\n full_name: member.full_name ? member.full_name : \"\",\n email: member.user_email ? member.user_email : member.email,\n imgurl: member.photo ? member.photo : \"/images/unnamed.png\"\n };\n html = template(ctx);\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowAvatar == null) {\n return $log.error(\"MembershipsRowAvatarDirective: the directive need a member\");\n }\n member = $scope.$eval($attrs.tgMembershipsRowAvatar);\n render(member);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMembershipsRowAvatar\", [\"$log\", \"$tgTemplate\", MembershipsRowAvatarDirective]);\n\n MembershipsRowAdminCheckboxDirective = function($log, $repo, $confirm, $template) {\n var link, template;\n template = $template.get(\"admin/admin-memberships-row-checkbox.html\", true);\n link = function($scope, $el, $attrs) {\n var html, member, render;\n render = function(member) {\n var ctx, html;\n ctx = {\n inputId: \"is-admin-\" + member.id\n };\n html = template(ctx);\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowAdminCheckbox == null) {\n return $log.error(\"MembershipsRowAdminCheckboxDirective: the directive need a member\");\n }\n member = $scope.$eval($attrs.tgMembershipsRowAdminCheckbox);\n html = render(member);\n if (member.is_owner) {\n $el.find(\":checkbox\").prop(\"checked\", true);\n }\n $el.on(\"click\", \":checkbox\", (function(_this) {\n return function(event) {\n var onError, onSuccess, target;\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function(data) {\n member.revert();\n $el.find(\":checkbox\").prop(\"checked\", member.is_owner);\n return $confirm.notify(\"error\", data.is_owner[0]);\n };\n target = angular.element(event.currentTarget);\n member.is_owner = target.prop(\"checked\");\n return $repo.save(member).then(onSuccess, onError);\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(\"tgMembershipsRowAdminCheckbox\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgTemplate\", MembershipsRowAdminCheckboxDirective]);\n\n MembershipsRowRoleSelectorDirective = function($log, $repo, $confirm) {\n var link, template;\n template = _.template(\"\");\n link = function($scope, $el, $attrs) {\n var $ctrl, html, member, render;\n render = function(member) {\n var ctx, html;\n ctx = {\n roleList: $scope.roles,\n selectedRole: member.role\n };\n html = template(ctx);\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowRoleSelector == null) {\n return $log.error(\"MembershipsRowRoleSelectorDirective: the directive need a member\");\n }\n $ctrl = $el.controller();\n member = $scope.$eval($attrs.tgMembershipsRowRoleSelector);\n html = render(member);\n $el.on(\"click\", \"select\", (function(_this) {\n return function(event) {\n var newRole, onError, onSuccess, target;\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n target = angular.element(event.currentTarget);\n newRole = parseInt(target.val(), 10);\n if (member.role !== newRole) {\n member.role = newRole;\n return $repo.save(member).then(onSuccess, onError);\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(\"tgMembershipsRowRoleSelector\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", MembershipsRowRoleSelectorDirective]);\n\n MembershipsRowActionsDirective = function($log, $repo, $rs, $confirm) {\n var activedTemplate, link, pendingTemplate;\n activedTemplate = _.template(\"
\\n Active\\n
\\n\\n \\n\");\n pendingTemplate = _.template(\"\\n Pending\\n \\n\\n\\n \\n\");\n link = function($scope, $el, $attrs) {\n var $ctrl, member, render;\n render = function(member) {\n var html;\n if (member.user) {\n html = activedTemplate();\n } else {\n html = pendingTemplate();\n }\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowActions == null) {\n return $log.error(\"MembershipsRowActionsDirective: the directive need a member\");\n }\n $ctrl = $el.controller();\n member = $scope.$eval($attrs.tgMembershipsRowActions);\n render(member);\n $el.on(\"click\", \".pending\", function(event) {\n var onError, onSuccess;\n event.preventDefault();\n onSuccess = function() {\n return $confirm.notify(\"success\", \"We've sent the invitationi again to '\" + $scope.member.email + \"'.\");\n };\n onError = function() {\n return $confirm.notify(\"error\", \"We haven't sent the invitation.\");\n };\n return $rs.memberships.resendInvitation($scope.member.id).then(onSuccess, onError);\n });\n $el.on(\"click\", \".delete\", function(event) {\n var message, title;\n event.preventDefault();\n title = \"Delete member\";\n message = member.user ? member.full_name : \"the invitation to \" + member.email;\n return $confirm.askOnDelete(title, message).then(function(finish) {\n var onError, onSuccess;\n onSuccess = function() {\n finish();\n $ctrl.loadMembers();\n return $confirm.notify(\"success\", null, \"We've deleted \" + message + \".\");\n };\n onError = function() {\n finish(false);\n return $confirm.notify(\"error\", null, \"We have not been able to delete \" + message + \".\");\n };\n return $repo.remove(member).then(onSuccess, onError);\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(\"tgMembershipsRowActions\", [\"$log\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", MembershipsRowActionsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/nav.coffee\n */\n\n(function() {\n var AdminNavigationDirective, module;\n\n AdminNavigationDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var section;\n section = $attrs.tgAdminNavigation;\n $el.find(\".active\").removeClass(\"active\");\n $el.find(\"#adminmenu-\" + section + \" a\").addClass(\"active\");\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaAdmin\");\n\n module.directive(\"tgAdminNavigation\", AdminNavigationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/project-profile.coffee\n */\n\n(function() {\n var ProjectDefaultValuesDirective, ProjectExportDirective, ProjectModulesDirective, ProjectProfileController, ProjectProfileDirective, bindOnce, debounce, groupBy, joinStr, mixOf, module, taiga, toString, trim,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAdmin\");\n\n ProjectProfileController = (function(_super) {\n __extends(ProjectProfileController, _super);\n\n ProjectProfileController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$appTitle\"];\n\n function ProjectProfileController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.appTitle = _at_appTitle;\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Project profile - \" + _this.scope.sectionName + \" - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:loaded\", (function(_this) {\n return function() {\n return _this.appTitle.set(\"Project profile - \" + _this.scope.sectionName + \" - \" + _this.scope.project.name);\n };\n })(this));\n }\n\n ProjectProfileController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.scope.taskStatusList = _.sortBy(project.task_statuses, \"order\");\n _this.scope.prioritiesList = _.sortBy(project.priorities, \"order\");\n _this.scope.severitiesList = _.sortBy(project.severities, \"order\");\n _this.scope.issueTypesList = _.sortBy(project.issue_types, \"order\");\n _this.scope.issueStatusList = _.sortBy(project.issue_statuses, \"order\");\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ProjectProfileController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this));\n };\n\n ProjectProfileController.prototype.openDeleteLightbox = function() {\n return this.rootscope.$broadcast(\"deletelightbox:new\", this.scope.project);\n };\n\n return ProjectProfileController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"ProjectProfileController\", ProjectProfileController);\n\n ProjectProfileDirective = function($repo, $confirm, $loading, $navurls, $location) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\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 $loading.start(submitButton);\n promise = $repo.save($scope.project);\n promise.then(function() {\n var newUrl;\n $loading.finish(submitButton);\n $confirm.notify(\"success\");\n newUrl = $navurls.resolve(\"project-admin-project-profile-details\", {\n project: $scope.project.slug\n });\n $location.path(newUrl);\n return $scope.$emit(\"project:loaded\", $scope.project);\n });\n return promise.then(null, function(data) {\n $loading.finish(target);\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 $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectProfile\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgNavUrls\", \"$tgLocation\", ProjectProfileDirective]);\n\n ProjectDefaultValuesDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\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 $loading.start(submitButton);\n promise = $repo.save($scope.project);\n promise.then(function() {\n $loading.finish(submitButton);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function(data) {\n $loading.finish(target);\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\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectDefaultValues\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", ProjectDefaultValuesDirective]);\n\n ProjectModulesDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit;\n form = $el.find(\"form\").checksley();\n submit = (function(_this) {\n return function() {\n var promise, target;\n if (!form.validate()) {\n return;\n }\n target = angular.element(\".admin-functionalities a.button-green\");\n $loading.start(target);\n promise = $repo.save($scope.project);\n promise.then(function() {\n $loading.finish(target);\n $confirm.notify(\"success\");\n return $scope.$emit(\"project:loaded\", $scope.project);\n });\n return promise.then(null, function(data) {\n $loading.finish(target);\n return $confirm.notify(\"error\", data._error_message);\n });\n };\n })(this);\n $el.on(\"submit\", \"form\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \".admin-functionalities a.button-green\", function(event) {\n event.preventDefault();\n return submit();\n });\n $scope.$watch(\"isVideoconferenceActivated\", function(isVideoconferenceActivated) {\n if (isVideoconferenceActivated) {\n return $el.find(\".videoconference-attributes\").removeClass(\"hidden\");\n } else {\n $el.find(\".videoconference-attributes\").addClass(\"hidden\");\n $scope.project.videoconferences = null;\n return $scope.project.videoconferences_salt = \"\";\n }\n });\n return $scope.$watch(\"project\", function(project) {\n if (project.videoconferences != null) {\n return $scope.isVideoconferenceActivated = true;\n } else {\n return $scope.isVideoconferenceActivated = false;\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectModules\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", ProjectModulesDirective]);\n\n ProjectExportDirective = function($window, $rs, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var buttonsEl, hideButtons, hideResult, hideSpinner, resultEl, resultMessageEl, resultTitleEl, setAsyncMessage, setAsyncTitle, setLoadingMessage, setLoadingTitle, setSyncMessage, setSyncTitle, showButtons, showErrorMode, showExportResultAsyncMode, showExportResultSyncMode, showLoadingMode, showResult, showSpinner, spinnerEl;\n buttonsEl = $el.find(\".admin-project-export-buttons\");\n showButtons = function() {\n return buttonsEl.removeClass(\"hidden\");\n };\n hideButtons = function() {\n return buttonsEl.addClass(\"hidden\");\n };\n resultEl = $el.find(\".admin-project-export-result\");\n showResult = function() {\n return resultEl.removeClass(\"hidden\");\n };\n hideResult = function() {\n return resultEl.addClass(\"hidden\");\n };\n spinnerEl = $el.find(\".spin\");\n showSpinner = function() {\n return spinnerEl.removeClass(\"hidden\");\n };\n hideSpinner = function() {\n return spinnerEl.addClass(\"hidden\");\n };\n resultTitleEl = $el.find(\".result-title\");\n setLoadingTitle = function() {\n return resultTitleEl.html(\"We are generating your dump file\");\n };\n setAsyncTitle = function() {\n return resultTitleEl.html(\"We are generating your dump file\");\n };\n setSyncTitle = function() {\n return resultTitleEl.html(\"Your dump file ir ready!\");\n };\n resultMessageEl = $el.find(\".result-message \");\n setLoadingMessage = function() {\n return resultMessageEl.html(\"Please don't close this page.\");\n };\n setAsyncMessage = function() {\n return resultMessageEl.html(\"We will send you an email when ready.\");\n };\n setSyncMessage = function(url) {\n return resultMessageEl.html(\"If the download doesn't start automatically click here.\");\n };\n showLoadingMode = function() {\n showSpinner();\n setLoadingTitle();\n setLoadingMessage();\n hideButtons();\n return showResult();\n };\n showExportResultAsyncMode = function() {\n hideSpinner();\n setAsyncTitle();\n return setAsyncMessage();\n };\n showExportResultSyncMode = function(url) {\n hideSpinner();\n setSyncTitle();\n return setSyncMessage(url);\n };\n showErrorMode = function() {\n hideSpinner();\n hideResult();\n return showButtons();\n };\n return $el.on(\"click\", \"a.button-export\", debounce(2000, (function(_this) {\n return function(event) {\n var onError, onSuccess;\n event.preventDefault();\n onSuccess = function(result) {\n var dumpUrl;\n if (result.status === 202) {\n return showExportResultAsyncMode();\n } else {\n dumpUrl = result.data.url;\n showExportResultSyncMode(dumpUrl);\n return $window.open(dumpUrl, \"_blank\");\n }\n };\n onError = function(result) {\n var errorMsg, _ref;\n showErrorMode();\n errorMsg = \"Our oompa loompas have some problems generasting your dump. Please try again. \";\n if (result.status === 429) {\n errorMsg = \"Sorry, our oompa loompas are very busy right now. Please try again in a few minutes. \";\n } else if ((_ref = result.data) != null ? _ref._error_message : void 0) {\n errorMsg = \"Our oompa loompas have some problems generasting your dump: \" + result.data._error_message;\n }\n return $confirm.notify(\"error\", errorMsg);\n };\n showLoadingMode();\n return $rs.projects[\"export\"]($scope.projectId).then(onSuccess, onError);\n };\n })(this)));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectExport\", [\"$window\", \"$tgResources\", \"$tgConfirm\", ProjectExportDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/project-profile.coffee\n */\n\n(function() {\n var ColorSelectionDirective, ProjectValuesController, ProjectValuesDirective, bindOnce, debounce, groupBy, joinStr, mixOf, module, taiga, toString, trim,\n __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n __extends = 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 mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAdmin\");\n\n ProjectValuesController = (function(_super) {\n __extends(ProjectValuesController, _super);\n\n ProjectValuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$appTitle\"];\n\n function ProjectValuesController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.appTitle = _at_appTitle;\n this.moveValue = __bind(this.moveValue, this);\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Project values - \" + _this.scope.sectionName + \" - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"admin:project-values:move\", this.moveValue);\n }\n\n ProjectValuesController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ProjectValuesController.prototype.loadValues = function() {\n return this.rs[this.scope.resource].listValues(this.scope.projectId, this.scope.type).then((function(_this) {\n return function(values) {\n _this.scope.values = values;\n _this.scope.maxValueOrder = _.max(values, \"order\").order;\n return values;\n };\n })(this));\n };\n\n ProjectValuesController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.q.all([_this.loadProject(), _this.loadValues()]);\n };\n })(this));\n };\n\n ProjectValuesController.prototype.moveValue = function(ctx, itemValue, itemIndex) {\n var r, values;\n values = this.scope.values;\n r = values.indexOf(itemValue);\n values.splice(r, 1);\n values.splice(itemIndex, 0, itemValue);\n _.each(values, function(value, index) {\n return value.order = index;\n });\n return this.repo.saveAll(values);\n };\n\n return ProjectValuesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"ProjectValuesController\", ProjectValuesController);\n\n ProjectValuesDirective = function($log, $repo, $confirm, $location, animationFrame) {\n var link, linkDragAndDrop, linkValue;\n linkDragAndDrop = function($scope, $el, $attrs) {\n var itemEl, newParentScope, oldParentScope, tdom;\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el.find(\".sortable\");\n tdom.sortable({\n handle: \".row.table-main.visualization\",\n dropOnEmpty: true,\n connectWith: \".project-values-body\",\n revert: 400,\n axis: \"y\"\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemValue;\n itemEl = ui.item;\n itemValue = itemEl.scope().value;\n itemIndex = itemEl.index();\n return $scope.$broadcast(\"admin:project-values:move\", itemValue, itemIndex);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n linkValue = function($scope, $el, $attrs) {\n var $ctrl, cancel, goToBottomList, initializeNewValue, saveValue, submit, valueType;\n $ctrl = $el.controller();\n valueType = $attrs.type;\n initializeNewValue = function() {\n return $scope.newValue = {\n \"name\": \"\",\n \"is_closed\": false,\n \"is_archived\": false\n };\n };\n initializeNewValue();\n goToBottomList = (function(_this) {\n return function(focus) {\n var table;\n if (focus == null) {\n focus = false;\n }\n table = $el.find(\".table-main\");\n $(document.body).scrollTop(table.offset().top + table.height());\n if (focus) {\n return $(\".new-value input\").focus();\n }\n };\n })(this);\n submit = debounce(2000, (function(_this) {\n return function() {\n var promise;\n promise = $repo.save($scope.project);\n promise.then(function() {\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function(data) {\n return $confirm.notify(\"error\", data._error_message);\n });\n };\n })(this));\n saveValue = debounce(2000, function(target) {\n var form, promise, value;\n form = target.parents(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n value = target.scope().value;\n promise = $repo.save(value);\n promise.then((function(_this) {\n return function() {\n var row;\n row = target.parents(\".row.table-main\");\n row.addClass(\"hidden\");\n return row.siblings(\".visualization\").removeClass('hidden');\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n });\n cancel = function(target) {\n var row, value;\n row = target.parents(\".row.table-main\");\n value = target.scope().value;\n return $scope.$apply(function() {\n row.addClass(\"hidden\");\n value.revert();\n return row.siblings(\".visualization\").removeClass('hidden');\n });\n };\n $el.on(\"submit\", \"form\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \"form a.button-green\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \".show-add-new\", function(event) {\n event.preventDefault();\n $el.find(\".new-value\").removeClass('hidden');\n return goToBottomList(true);\n });\n $el.on(\"click\", \".add-new\", debounce(2000, function(event) {\n var form, promise;\n event.preventDefault();\n form = $el.find(\".new-value\").parents(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n $scope.newValue.project = $scope.project.id;\n $scope.newValue.order = $scope.maxValueOrder ? $scope.maxValueOrder + 1 : 1;\n promise = $repo.create(valueType, $scope.newValue);\n promise.then((function(_this) {\n return function() {\n $ctrl.loadValues().then(function() {\n return animationFrame.add(function() {\n return goToBottomList();\n });\n });\n $el.find(\".new-value\").addClass(\"hidden\");\n return initializeNewValue();\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n }));\n $el.on(\"click\", \".delete-new\", function(event) {\n event.preventDefault();\n $el.find(\".new-value\").hide();\n return initializeNewValue();\n });\n $el.on(\"click\", \".edit-value\", function(event) {\n var editionRow, row, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n row = target.parents(\".row.table-main\");\n row.addClass(\"hidden\");\n editionRow = row.siblings(\".edition\");\n editionRow.removeClass('hidden');\n return editionRow.find('input:visible').first().focus().select();\n });\n $el.on(\"keyup\", \".edition input\", function(event) {\n var target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n return saveValue(target);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n return cancel(target);\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return saveValue(target);\n });\n $el.on(\"click\", \".cancel\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return cancel(target);\n });\n return $el.on(\"click\", \".delete-value\", function(event) {\n var choices, replacement, subtitle, target, title, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n value = target.scope().value;\n choices = {};\n _.each($scope.values, function(option) {\n if (value.id !== option.id) {\n return choices[option.id] = option.name;\n }\n });\n title = \"Delete value\";\n subtitle = value.name;\n replacement = \"All items with this value will be changed to\";\n if (_.keys(choices).length === 0) {\n return $confirm.error(\"You can't delete all values.\");\n }\n return $confirm.askChoice(title, subtitle, choices, replacement).then(function(response) {\n var onError, onSucces;\n onSucces = function() {\n return $ctrl.loadValues()[\"finally\"](function() {\n return response.finish();\n });\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n return $repo.remove(value, {\n \"moveTo\": response.selected\n }).then(onSucces, onError);\n });\n });\n };\n link = function($scope, $el, $attrs) {\n linkDragAndDrop($scope, $el, $attrs);\n linkValue($scope, $el, $attrs);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectValues\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"animationFrame\", ProjectValuesDirective]);\n\n ColorSelectionDirective = function() {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var $ctrl;\n $ctrl = $el.controller();\n $scope.$watch($attrs.ngModel, function(element) {\n return $scope.color = element.color;\n });\n $el.on(\"click\", \".current-color\", function(event) {\n var body, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n $el.find(\".select-color\").hide();\n target.siblings(\".select-color\").show();\n body = angular.element(\"body\");\n return body.on(\"click\", (function(_this) {\n return function(event) {\n if (angular.element(event.target).parent(\".select-color\").length === 0) {\n $el.find(\".select-color\").hide();\n return body.unbind(\"click\");\n }\n };\n })(this));\n });\n $el.on(\"click\", \".select-color .color\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n $scope.$apply(function() {\n return $model.$modelValue.color = target.data(\"color\");\n });\n return $el.find(\".select-color\").hide();\n });\n $el.on(\"click\", \".select-color .selected-color\", function(event) {\n event.preventDefault();\n $scope.$apply(function() {\n return $model.$modelValue.color = $scope.color;\n });\n return $el.find(\".select-color\").hide();\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(\"tgColorSelection\", ColorSelectionDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var EditRoleDirective, NewRoleDirective, RolePermissionsDirective, RolesController, RolesDirective, bindMethods, bindOnce, debounce, mixOf, module, taiga,\n __extends = 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 taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaAdmin\");\n\n RolesController = (function(_super) {\n __extends(RolesController, _super);\n\n RolesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$appTitle\"];\n\n function RolesController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Permissions\";\n this.scope.project = {};\n this.scope.anyComputableRole = true;\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Roles - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n RolesController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.anyComputableRole = _.some(_.map(project.roles, function(point) {\n return point.computable;\n }));\n return project;\n };\n })(this));\n };\n\n RolesController.prototype.loadRoles = function() {\n return this.rs.roles.list(this.scope.projectId).then((function(_this) {\n return function(data) {\n _this.scope.roles = data;\n _this.scope.role = _this.scope.roles[0];\n return data;\n };\n })(this));\n };\n\n RolesController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadUsersAndRoles();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadRoles();\n };\n })(this));\n };\n\n RolesController.prototype.setRole = function(role) {\n this.scope.role = role;\n return this.scope.$broadcast(\"role:changed\", this.scope.role);\n };\n\n RolesController.prototype[\"delete\"] = function() {\n var choices, replacement, role, subtitle, title, warning, _i, _len, _ref;\n title = \"Delete Role\";\n subtitle = this.scope.role.name;\n replacement = \"All the users with this role will be moved to\";\n warning = \"Be careful, all role estimations will be removed\";\n choices = {};\n _ref = this.scope.roles;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n role = _ref[_i];\n if (role.id !== this.scope.role.id) {\n choices[role.id] = role.name;\n }\n }\n if (_.keys(choices).length === 0) {\n return this.confirm.error(\"You can't delete all values.\");\n }\n return this.confirm.askChoice(title, subtitle, choices, replacement, warning).then((function(_this) {\n return function(response) {\n var promise;\n promise = _this.repo.remove(_this.scope.role, {\n moveTo: response.selected\n });\n promise.then(function() {\n _this.loadProject();\n return _this.loadRoles()[\"finally\"](function() {\n return response.finish();\n });\n });\n return promise.then(null, function() {\n return _this.confirm.notify('error');\n });\n };\n })(this));\n };\n\n RolesController.prototype.setComputable = debounce(2000, function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.confirm.notify(\"success\");\n return _this.loadProject();\n };\n })(this);\n onError = (function(_this) {\n return function() {\n _this.confirm.notify(\"error\");\n return _this.scope.role.revert();\n };\n })(this);\n return this.repo.save(this.scope.role).then(onSuccess, onError);\n });\n\n return RolesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"RolesController\", RolesController);\n\n EditRoleDirective = function($repo, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit, toggleView;\n toggleView = function() {\n $el.find('.total').toggle();\n return $el.find('.edit-role').toggle();\n };\n submit = function() {\n var promise;\n $scope.role.name = $el.find(\"input\").val();\n promise = $repo.save($scope.role);\n promise.then(function() {\n return $confirm.notify(\"success\");\n });\n promise.then(null, function(data) {\n return $confirm.notify(\"error\");\n });\n return toggleView();\n };\n $el.on(\"click\", \"a.icon-edit\", function() {\n toggleView();\n $el.find(\"input\").focus();\n return $el.find(\"input\").val($scope.role.name);\n });\n $el.on(\"click\", \"a.save\", submit);\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return submit();\n } else if (event.keyCode === 27) {\n return toggleView();\n }\n });\n $scope.$on(\"role:changed\", function() {\n if ($el.find('.edit-role').is(\":visible\")) {\n return toggleView();\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(\"tgEditRole\", [\"$tgRepo\", \"$tgConfirm\", EditRoleDirective]);\n\n RolesDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRoles\", RolesDirective);\n\n NewRoleDirective = function($tgrepo, $confirm) {\n var DEFAULT_PERMISSIONS, link;\n DEFAULT_PERMISSIONS = [\"view_project\", \"view_milestones\", \"view_us\", \"view_tasks\", \"view_issues\"];\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n $el.on(\"click\", \"a.add-button\", function(event) {\n event.preventDefault();\n $el.find(\".new\").removeClass(\"hidden\");\n $el.find(\".new\").focus();\n return $el.find(\".add-button\").hide();\n });\n return $el.on(\"keyup\", \".new\", function(event) {\n var newRole, onError, onSuccess, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newRole = {\n project: $scope.projectId,\n name: target.val(),\n permissions: DEFAULT_PERMISSIONS,\n order: _.max($scope.roles, function(r) {\n return r.order;\n }).order + 1,\n computable: false\n };\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new\").val('');\n onSuccess = function(role) {\n $scope.roles.push(role);\n $ctrl.setRole(role);\n $el.find(\".add-button\").show();\n return $ctrl.loadProject();\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n return $tgrepo.create(\"roles\", newRole).then(onSuccess, onError);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new\").val('');\n return $el.find(\".add-button\").show();\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgNewRole\", [\"$tgRepo\", \"$tgConfirm\", NewRoleDirective]);\n\n RolePermissionsDirective = function($rootscope, $repo, $confirm) {\n var baseTemplate, categoryTemplate, link, resumeTemplate;\n resumeTemplate = _.template(\"
<%- category.name %>
\\n
\\n
<%- category.activePermissions %>/<%- category.permissions.length %>
\\n <% _.each(category.permissions, function(permission) { %>\\n
active<% } %>\\\"\\n title=\\\"<%- permission.description %>\\\">
\\n <% }) %>\\n
\\n
\");\n categoryTemplate = _.template(\"
\\\">\\n
\\n
\\n
\\n
\\n <% _.each(category.permissions, function(permission) { %>\\n
\\\">\\n <%- permission.description %>\\n
\\n checked=\\\"checked\\\"<% } %>/>\\n
\\n Yes\\n No\\n
\\n
\\n <% }) %>\\n
\\n
\\n
\");\n baseTemplate = _.template(\"
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, generateCategoriesFromRole, renderCategory, renderPermissions, renderResume;\n $ctrl = $el.controller();\n generateCategoriesFromRole = function(role) {\n var categories, issuePermissions, milestonePermissions, setActivePermissions, setActivePermissionsPerCategory, taskPermissions, userStoryPermissions, wikiPermissions;\n setActivePermissions = function(permissions) {\n return _.map(permissions, function(x) {\n var _ref;\n return _.extend({}, x, {\n active: (_ref = x[\"key\"], __indexOf.call(role.permissions, _ref) >= 0)\n });\n });\n };\n setActivePermissionsPerCategory = function(category) {\n return _.map(category, function(x) {\n return _.extend({}, x, {\n activePermissions: _.filter(x[\"permissions\"], \"active\").length\n });\n });\n };\n categories = [];\n milestonePermissions = [\n {\n key: \"view_milestones\",\n description: \"View sprints\"\n }, {\n key: \"add_milestone\",\n description: \"Add sprint\"\n }, {\n key: \"modify_milestone\",\n description: \"Modify sprint\"\n }, {\n key: \"delete_milestone\",\n description: \"Delete sprint\"\n }\n ];\n categories.push({\n name: \"Sprints\",\n permissions: setActivePermissions(milestonePermissions)\n });\n userStoryPermissions = [\n {\n key: \"view_us\",\n description: \"View user story\"\n }, {\n key: \"add_us\",\n description: \"Add user story\"\n }, {\n key: \"modify_us\",\n description: \"Modify user story\"\n }, {\n key: \"delete_us\",\n description: \"Delete user story\"\n }\n ];\n categories.push({\n name: \"User Stories\",\n permissions: setActivePermissions(userStoryPermissions)\n });\n taskPermissions = [\n {\n key: \"view_tasks\",\n description: \"View tasks\"\n }, {\n key: \"add_task\",\n description: \"Add task\"\n }, {\n key: \"modify_task\",\n description: \"Modify task\"\n }, {\n key: \"delete_task\",\n description: \"Delete task\"\n }\n ];\n categories.push({\n name: \"Tasks\",\n permissions: setActivePermissions(taskPermissions)\n });\n issuePermissions = [\n {\n key: \"view_issues\",\n description: \"View issues\"\n }, {\n key: \"add_issue\",\n description: \"Add issue\"\n }, {\n key: \"modify_issue\",\n description: \"Modify issue\"\n }, {\n key: \"delete_issue\",\n description: \"Delete issue\"\n }\n ];\n categories.push({\n name: \"Issues\",\n permissions: setActivePermissions(issuePermissions)\n });\n wikiPermissions = [\n {\n key: \"view_wiki_pages\",\n description: \"View wiki pages\"\n }, {\n key: \"add_wiki_page\",\n description: \"Add wiki page\"\n }, {\n key: \"modify_wiki_page\",\n description: \"Modify wiki page\"\n }, {\n key: \"delete_wiki_page\",\n description: \"Delete wiki page\"\n }, {\n key: \"view_wiki_links\",\n description: \"View wiki links\"\n }, {\n key: \"add_wiki_link\",\n description: \"Add wiki link\"\n }, {\n key: \"delete_wiki_link\",\n description: \"Delete wiki link\"\n }\n ];\n categories.push({\n name: \"Wiki\",\n permissions: setActivePermissions(wikiPermissions)\n });\n return setActivePermissionsPerCategory(categories);\n };\n renderResume = function(element, category) {\n return element.find(\".resume\").html(resumeTemplate({\n category: category\n }));\n };\n renderCategory = function(category, index) {\n var html;\n html = categoryTemplate({\n category: category,\n index: index\n });\n html = angular.element(html);\n renderResume(html, category);\n return html;\n };\n renderPermissions = function() {\n var html;\n $el.off();\n html = baseTemplate();\n _.each(generateCategoriesFromRole($scope.role), function(category, index) {\n return html = angular.element(html).append(renderCategory(category, index));\n });\n $el.html(html);\n $el.on(\"click\", \".resume\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return target.next().toggleClass(\"open\");\n });\n return $el.on(\"change\", \".category-item input\", function(event) {\n var getActivePermissions, onError, onSuccess, target;\n getActivePermissions = function() {\n var activePermissions;\n activePermissions = _.filter($el.find(\".category-item input\"), function(t) {\n return angular.element(t).is(\":checked\");\n });\n activePermissions = _.sortBy(_.map(activePermissions, function(t) {\n var permission;\n return permission = angular.element(t).parents(\".category-item\").data(\"id\");\n }));\n activePermissions.push(\"view_project\");\n return activePermissions;\n };\n target = angular.element(event.currentTarget);\n $scope.role.permissions = getActivePermissions();\n onSuccess = function(role) {\n var categories, categoryId;\n categories = generateCategoriesFromRole(role);\n categoryId = target.parents(\".category-config\").data(\"id\");\n renderResume(target.parents(\".category-config\"), categories[categoryId]);\n $rootscope.$broadcast(\"projects:reload\");\n $confirm.notify(\"success\");\n return $ctrl.loadProject();\n };\n onError = function() {\n $confirm.notify(\"error\");\n target.prop(\"checked\", !target.prop(\"checked\"));\n return $scope.role.permissions = getActivePermissions();\n };\n return $repo.save($scope.role).then(onSuccess, onError);\n });\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n $scope.$on(\"role:changed\", function() {\n return renderPermissions();\n });\n return bindOnce($scope, $attrs.ngModel, renderPermissions);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRolePermissions\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", RolePermissionsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/third-parties.coffee\n */\n\n(function() {\n var BitbucketController, BitbucketWebhooksDirective, GithubController, GithubWebhooksDirective, GitlabController, GitlabWebhooksDirective, NewWebhookDirective, SelectInputText, ValidOriginIpsDirective, WebhookDirective, WebhooksController, bindMethods, debounce, mixOf, module, taiga, timeout,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n bindMethods = this.taiga.bindMethods;\n\n debounce = this.taiga.debounce;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaAdmin\");\n\n WebhooksController = (function(_super) {\n __extends(WebhooksController, _super);\n\n WebhooksController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$appTitle\"];\n\n function WebhooksController(_at_scope, _at_repo, _at_rs, _at_params, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Webhooks\";\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Webhooks - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"webhooks:reload\", this.loadWebhooks);\n }\n\n WebhooksController.prototype.loadWebhooks = function() {\n return this.rs.webhooks.list(this.scope.projectId).then((function(_this) {\n return function(webhooks) {\n return _this.scope.webhooks = webhooks;\n };\n })(this));\n };\n\n WebhooksController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n WebhooksController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadWebhooks();\n };\n })(this));\n };\n\n return WebhooksController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"WebhooksController\", WebhooksController);\n\n WebhookDirective = function($rs, $repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var cancel, openHistory, save, showEditMode, showVisualizationMode, updateLogs, updateShowHideHistoryText, webhook;\n webhook = $scope.$eval($attrs.tgWebhook);\n updateLogs = function() {\n return $rs.webhooklogs.list(webhook.id).then((function(_this) {\n return function(webhooklogs) {\n var log, _i, _len, _ref;\n for (_i = 0, _len = webhooklogs.length; _i < _len; _i++) {\n log = webhooklogs[_i];\n log.validStatus = (200 <= (_ref = log.status) && _ref < 300);\n log.prettySentHeaders = _.map(_.pairs(log.request_headers), function(_arg) {\n var header, value;\n header = _arg[0], value = _arg[1];\n return header + \": \" + value;\n }).join(\"\\n\");\n log.prettySentData = JSON.stringify(log.request_data.data, void 0, 2);\n log.prettyDate = moment(log.created).format(\"DD MMM YYYY [at] hh:mm:ss\");\n }\n webhook.logs_counter = webhooklogs.length;\n webhook.logs = webhooklogs;\n return updateShowHideHistoryText();\n };\n })(this));\n };\n updateShowHideHistoryText = function() {\n var historyElement, textElement;\n textElement = $el.find(\".toggle-history\");\n historyElement = textElement.parents(\".single-webhook-wrapper\").find(\".webhooks-history\");\n if (historyElement.hasClass(\"open\")) {\n return textElement.text(\"(Hide history)\");\n } else {\n return textElement.text(\"(Show history)\");\n }\n };\n showVisualizationMode = function() {\n $el.find(\".edition-mode\").addClass(\"hidden\");\n return $el.find(\".visualization-mode\").removeClass(\"hidden\");\n };\n showEditMode = function() {\n $el.find(\".visualization-mode\").addClass(\"hidden\");\n return $el.find(\".edition-mode\").removeClass(\"hidden\");\n };\n openHistory = function() {\n return $el.find(\".webhooks-history\").addClass(\"open\");\n };\n cancel = function() {\n showVisualizationMode();\n return $scope.$apply(function() {\n return webhook.revert();\n });\n };\n save = debounce(2000, function(target) {\n var form, promise, value;\n form = target.parents(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n value = target.scope().value;\n promise = $repo.save(webhook);\n promise.then((function(_this) {\n return function() {\n return showVisualizationMode();\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n });\n $el.on(\"click\", \".test-webhook\", function() {\n openHistory();\n return $rs.webhooks.test(webhook.id).then((function(_this) {\n return function() {\n return updateLogs();\n };\n })(this));\n });\n $el.on(\"click\", \".edit-webhook\", function() {\n return showEditMode();\n });\n $el.on(\"click\", \".cancel-existing\", function() {\n return cancel();\n });\n $el.on(\"click\", \".edit-existing\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return save(target);\n });\n $el.on(\"keyup\", \".edition-mode input\", function(event) {\n var target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n return saveWebhook(target);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n return cancel(target);\n }\n });\n $el.on(\"click\", \".delete-webhook\", function() {\n var message, title;\n title = \"Delete webhook\";\n message = \"Webhook '\" + webhook.name + \"'\";\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var onError, onSucces;\n onSucces = function() {\n finish();\n return $scope.$emit(\"webhooks:reload\");\n };\n onError = function() {\n finish(false);\n return $confirm.notify(\"error\");\n };\n return $repo.remove(webhook).then(onSucces, onError);\n };\n })(this));\n });\n $el.on(\"click\", \".toggle-history\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if ((webhook.logs == null) || webhook.logs.length === 0) {\n return updateLogs().then(function() {\n return timeout(0, function() {\n $el.find(\".webhooks-history\").toggleClass(\"open\");\n return updateShowHideHistoryText();\n });\n });\n } else {\n $el.find(\".webhooks-history\").toggleClass(\"open\");\n return $scope.$apply(function() {\n return updateShowHideHistoryText();\n });\n }\n });\n $el.on(\"click\", \".history-single\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n target.toggleClass(\"history-single-open\");\n return target.siblings(\".history-single-response\").toggleClass(\"open\");\n });\n return $el.on(\"click\", \".resend-request\", function(event) {\n var log, target;\n target = angular.element(event.currentTarget);\n log = target.data(\"log\");\n return $rs.webhooklogs.resend(log).then((function(_this) {\n return function() {\n return updateLogs();\n };\n })(this));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgWebhook\", [\"$tgResources\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", WebhookDirective]);\n\n NewWebhookDirective = function($rs, $repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var addWebhookDOMNode, formDOMNode, initializeNewValue, webhook;\n webhook = $scope.$eval($attrs.tgWebhook);\n formDOMNode = $el.find(\".new-webhook-form\");\n addWebhookDOMNode = $el.find(\".add-webhook\");\n initializeNewValue = function() {\n return $scope.newValue = {\n \"name\": \"\",\n \"url\": \"\",\n \"key\": \"\"\n };\n };\n initializeNewValue();\n $scope.$watch(\"webhooks\", function(webhooks) {\n if (webhooks != null) {\n if (webhooks.length === 0) {\n formDOMNode.removeClass(\"hidden\");\n addWebhookDOMNode.addClass(\"hidden\");\n return formDOMNode.find(\"input\")[0].focus();\n } else {\n formDOMNode.addClass(\"hidden\");\n return addWebhookDOMNode.removeClass(\"hidden\");\n }\n }\n });\n formDOMNode.on(\"click\", \".add-new\", debounce(2000, function(event) {\n var form, promise;\n event.preventDefault();\n form = formDOMNode.checksley();\n if (!form.validate()) {\n return;\n }\n $scope.newValue.project = $scope.project.id;\n promise = $repo.create(\"webhooks\", $scope.newValue);\n promise.then((function(_this) {\n return function() {\n $scope.$emit(\"webhooks:reload\");\n return initializeNewValue();\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n }));\n formDOMNode.on(\"click\", \".cancel-new\", function(event) {\n return $scope.$apply(function() {\n return initializeNewValue();\n });\n });\n return addWebhookDOMNode.on(\"click\", function(event) {\n formDOMNode.removeClass(\"hidden\");\n return formDOMNode.find(\"input\")[0].focus();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgNewWebhook\", [\"$tgResources\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", NewWebhookDirective]);\n\n GithubController = (function(_super) {\n __extends(GithubController, _super);\n\n GithubController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$appTitle\"];\n\n function GithubController(_at_scope, _at_repo, _at_rs, _at_params, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Github\";\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Github - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n GithubController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"github\").then((function(_this) {\n return function(github) {\n return _this.scope.github = github;\n };\n })(this));\n };\n\n GithubController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n GithubController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n };\n\n return GithubController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"GithubController\", GithubController);\n\n GitlabController = (function(_super) {\n __extends(GitlabController, _super);\n\n GitlabController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$appTitle\"];\n\n function GitlabController(_at_scope, _at_repo, _at_rs, _at_params, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Gitlab\";\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Gitlab - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:modules:reload\", (function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n }\n\n GitlabController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"gitlab\").then((function(_this) {\n return function(gitlab) {\n return _this.scope.gitlab = gitlab;\n };\n })(this));\n };\n\n GitlabController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n GitlabController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n };\n\n return GitlabController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"GitlabController\", GitlabController);\n\n BitbucketController = (function(_super) {\n __extends(BitbucketController, _super);\n\n BitbucketController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$appTitle\"];\n\n function BitbucketController(_at_scope, _at_repo, _at_rs, _at_params, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Bitbucket\";\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Bitbucket - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:modules:reload\", (function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n }\n\n BitbucketController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"bitbucket\").then((function(_this) {\n return function(bitbucket) {\n return _this.scope.bitbucket = bitbucket;\n };\n })(this));\n };\n\n BitbucketController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n BitbucketController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n };\n\n return BitbucketController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"BitbucketController\", BitbucketController);\n\n SelectInputText = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $el.on(\"click\", \".select-input-content\", function() {\n $el.find(\"input\").select();\n return $el.find(\".help-copy\").addClass(\"visible\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSelectInputText\", SelectInputText);\n\n GithubWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\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 $loading.start(submitButton);\n promise = $repo.saveAttribute($scope.github, \"github\");\n promise.then(function() {\n $loading.finish(submitButton);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\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 $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgGithubWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", GithubWebhooksDirective]);\n\n GitlabWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\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 $loading.start(submitButton);\n promise = $repo.saveAttribute($scope.gitlab, \"gitlab\");\n promise.then(function() {\n $loading.finish(submitButton);\n $confirm.notify(\"success\");\n return $scope.$emit(\"project:modules:reload\");\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\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 $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgGitlabWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", GitlabWebhooksDirective]);\n\n BitbucketWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\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 $loading.start(submitButton);\n promise = $repo.saveAttribute($scope.bitbucket, \"bitbucket\");\n promise.then(function() {\n $loading.finish(submitButton);\n $confirm.notify(\"success\");\n return $scope.$emit(\"project:modules:reload\");\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\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 $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBitbucketWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", BitbucketWebhooksDirective]);\n\n ValidOriginIpsDirective = function() {\n var link;\n link = function($scope, $el, $attrs, $ngModel) {\n return $ngModel.$parsers.push(function(value) {\n value = $.trim(value);\n if (value === \"\") {\n return [];\n }\n return value.split(\",\");\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgValidOriginIps\", ValidOriginIpsDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/attachments.coffee\n */\n\n(function() {\n var CreateProject, DeleteProjectDirective, bindOnce, debounce, module, taiga, timeout;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n timeout = this.taiga.timeout;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaProject\");\n\n CreateProject = function($rootscope, $repo, $confirm, $location, $navurls, $rs, $projectUrl, $loading, lightboxService, $cacheFactory) {\n var link;\n link = function($scope, $el, attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit, submitButton;\n $scope.data = {};\n $scope.templates = [];\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n onSuccessSubmit = function(response) {\n $cacheFactory.get('$http').removeAll();\n $loading.finish(submitButton);\n $rootscope.$broadcast(\"projects:reload\");\n $confirm.notify(\"success\", \"Success\");\n $location.url($projectUrl.get(response));\n return lightboxService.close($el);\n };\n onErrorSubmit = function(response) {\n var error_field, error_step, selectors, _i, _len, _ref;\n $loading.finish(submitButton);\n form.setErrors(response);\n selectors = [];\n _ref = _.keys(response);\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n error_field = _ref[_i];\n selectors.push(\"[name=\" + error_field + \"]\");\n }\n $el.find(\".active\").removeClass(\"active\");\n error_step = $el.find(selectors.join(\",\")).first().parents(\".wizard-step\");\n error_step.addClass(\"active\");\n return $el.find('.progress-bar').removeClass().addClass('progress-bar').addClass(error_step.data(\"step\"));\n };\n submit = (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n promise = $repo.create(\"projects\", $scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this);\n $scope.$on(\"projects:create\", function() {\n $scope.data = {\n total_story_points: 100,\n total_milestones: 5\n };\n if (!$scope.templates.length) {\n $rs.projects.templates().then((function(_this) {\n return function(result) {\n $scope.templates = result;\n return $scope.data.creation_template = _.head(_.filter($scope.templates, function(x) {\n return x.slug === \"scrum\";\n })).id;\n };\n })(this));\n } else {\n $scope.data.creation_template = _.head(_.filter($scope.templates, function(x) {\n return x.slug === \"scrum\";\n })).id;\n }\n $el.find(\".active\").removeClass(\"active\");\n $el.find(\".create-step1\").addClass(\"active\");\n lightboxService.open($el);\n return timeout(600, function() {\n return $el.find(\".progress-bar\").addClass('step1');\n });\n });\n $el.on(\"click\", \".button-next\", function(event) {\n var current, field, next, step, valid, _i, _len, _ref;\n event.preventDefault();\n current = $el.find(\".active\");\n valid = true;\n _ref = form.fields;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n field = _ref[_i];\n if (current.find(\"[name=\" + (field.element.attr('name')) + \"]\").length) {\n valid = field.validate() !== false && valid;\n }\n }\n if (!valid) {\n return;\n }\n next = current.next();\n current.toggleClass('active');\n next.toggleClass('active');\n step = next.data('step');\n return $el.find('.progress-bar').removeClass().addClass('progress-bar').addClass(step);\n });\n $el.on(\"click\", \".button-prev\", function(event) {\n var current, prev, step;\n event.preventDefault();\n current = $el.find(\".active\");\n prev = current.prev();\n current.toggleClass('active');\n prev.toggleClass('active');\n step = prev.data('step');\n return $el.find('.progress-bar').removeClass().addClass('progress-bar').addClass(step);\n });\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateProject\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$location\", \"$tgNavUrls\", \"$tgResources\", \"$projectUrl\", \"$tgLoading\", \"lightboxService\", \"$cacheFactory\", CreateProject]);\n\n DeleteProjectDirective = function($repo, $rootscope, $auth, $location, $navUrls, $confirm, lightboxService, tgLoader) {\n var link;\n link = function($scope, $el, $attrs) {\n var projectToDelete, submit;\n projectToDelete = null;\n $scope.$on(\"deletelightbox:new\", function(ctx, project) {\n lightboxService.open($el);\n return projectToDelete = project;\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n submit = function() {\n var promise;\n tgLoader.start();\n lightboxService.close($el);\n promise = $repo.remove(projectToDelete);\n promise.then(function(data) {\n tgLoader.pageLoaded();\n $rootscope.$broadcast(\"projects:reload\");\n $location.path($navUrls.resolve(\"home\"));\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function() {\n $confirm.notify(\"error\");\n return lightboxService.close($el);\n });\n };\n $el.on(\"click\", \".button-red\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n return $el.on(\"click\", \".button-green\", function(event) {\n event.preventDefault();\n return submit();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbDeleteProject\", [\"$tgRepo\", \"$rootScope\", \"$tgAuth\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfirm\", \"lightboxService\", \"tgLoader\", DeleteProjectDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/attachments.coffee\n */\n\n(function() {\n var ProjectController, ProjectsController, ProjectsListDirective, ProjectsPaginationDirective, bindOnce, module, taiga,\n __extends = 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(\"taigaProject\");\n\n bindOnce = this.taiga.bindOnce;\n\n ProjectsController = (function(_super) {\n __extends(ProjectsController, _super);\n\n ProjectsController.$inject = [\"$scope\", \"$q\", \"$tgResources\", \"$rootScope\", \"$tgNavUrls\", \"$tgAuth\", \"$tgLocation\", \"$appTitle\", \"$projectUrl\", \"tgLoader\"];\n\n function ProjectsController(_at_scope, _at_q, _at_rs, _at_rootscope, _at_navUrls, _at_auth, _at_location, _at_appTitle, _at_projectUrl, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.q = _at_q;\n this.rs = _at_rs;\n this.rootscope = _at_rootscope;\n this.navUrls = _at_navUrls;\n this.auth = _at_auth;\n this.location = _at_location;\n this.appTitle = _at_appTitle;\n this.projectUrl = _at_projectUrl;\n this.appTitle.set(\"Projects\");\n if (!this.auth.isAuthenticated()) {\n this.location.path(this.navUrls.resolve(\"login\"));\n }\n this.user = this.auth.getUser();\n this.projects = [];\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.scope.$emit(\"projects:loaded\");\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n ProjectsController.prototype.loadInitialData = function() {\n return this.rs.projects.list().then((function(_this) {\n return function(projects) {\n var project, _i, _len;\n _this.projects = {\n 'recents': projects.slice(0, 8),\n 'all': projects\n };\n for (_i = 0, _len = projects.length; _i < _len; _i++) {\n project = projects[_i];\n project.url = _this.projectUrl.get(project);\n }\n return projects;\n };\n })(this));\n };\n\n ProjectsController.prototype.newProject = function() {\n return this.rootscope.$broadcast(\"projects:create\");\n };\n\n ProjectsController.prototype.logout = function() {\n this.auth.logout();\n return this.location.path(this.navUrls.resolve(\"login\"));\n };\n\n return ProjectsController;\n\n })(taiga.Controller);\n\n module.controller(\"ProjectsController\", ProjectsController);\n\n ProjectController = (function(_super) {\n __extends(ProjectController, _super);\n\n ProjectController.$inject = [\"$scope\", \"$tgResources\", \"$tgRepo\", \"$routeParams\", \"$q\", \"$rootScope\", \"$appTitle\", \"$tgLocation\", \"$tgNavUrls\"];\n\n function ProjectController(_at_scope, _at_rs, _at_repo, _at_params, _at_q, _at_rootscope, _at_appTitle, _at_location, _at_navUrls) {\n var promise;\n this.scope = _at_scope;\n this.rs = _at_rs;\n this.repo = _at_repo;\n this.params = _at_params;\n this.q = _at_q;\n this.rootscope = _at_rootscope;\n this.appTitle = _at_appTitle;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this.appTitle.set(_this.scope.project.name);\n return _this.scope.$emit(\"regenerate:project-pagination\");\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n ProjectController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadPageData();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.scope.$emit(\"project:loaded\", _this.scope.project);\n };\n })(this));\n };\n\n ProjectController.prototype.loadPageData = function() {\n return this.q.all([this.loadProjectStats(), this.loadProject()]);\n };\n\n ProjectController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n return project;\n };\n })(this));\n };\n\n ProjectController.prototype.loadProjectStats = function() {\n return this.rs.projects.stats(this.scope.projectId).then((function(_this) {\n return function(stats) {\n _this.scope.stats = stats;\n return stats;\n };\n })(this));\n };\n\n return ProjectController;\n\n })(taiga.Controller);\n\n module.controller(\"ProjectController\", ProjectController);\n\n ProjectsPaginationDirective = function($timeout) {\n var link;\n link = function($scope, $el, $attrs) {\n var checkButtonVisibility, container, containerSize, hasNextPage, hasPagination, hasPrevPage, hide, nextBtn, nextPage, pageSize, prevBtn, prevPage, remove, render, visible;\n prevBtn = $el.find(\".v-pagination-previous\");\n nextBtn = $el.find(\".v-pagination-next\");\n container = $el.find(\"ul\");\n pageSize = 0;\n containerSize = 0;\n render = function() {\n pageSize = $el.find(\".v-pagination-list\").height();\n if (container.find(\"li\").length) {\n if (hasPagination()) {\n if (hasNextPage()) {\n visible(nextBtn);\n } else {\n hide(nextBtn);\n }\n if (hasPrevPage()) {\n return visible(prevBtn);\n } else {\n return hide(prevBtn);\n }\n } else {\n return remove();\n }\n } else {\n return remove();\n }\n };\n hasPagination = function() {\n containerSize = container.height();\n return containerSize > pageSize;\n };\n hasPrevPage = function(top) {\n if (top == null) {\n top = -parseInt(container.css('top'), 10) || 0;\n }\n return top !== 0;\n };\n hasNextPage = function(top) {\n containerSize = container.height();\n if (!top) {\n top = -parseInt(container.css('top'), 10) || 0;\n }\n return containerSize > pageSize && top + pageSize < containerSize;\n };\n nextPage = function(callback) {\n var lastLi, maxTop, newTop, top;\n top = parseInt(container.css('top'), 10);\n newTop = top - pageSize;\n lastLi = $el.find(\".v-pagination-list li:last-child\");\n maxTop = -((lastLi.position().top + lastLi.outerHeight()) - pageSize);\n if (newTop < maxTop) {\n newTop = maxTop;\n }\n container.animate({\n \"top\": newTop\n }, callback);\n return newTop;\n };\n prevPage = function(callback) {\n var newTop, top;\n top = parseInt(container.css('top'), 10);\n newTop = top + pageSize;\n if (newTop > 0) {\n newTop = 0;\n }\n container.animate({\n \"top\": newTop\n }, callback);\n return newTop;\n };\n visible = function(element) {\n return element.css('visibility', 'visible');\n };\n hide = function(element) {\n return element.css('visibility', 'hidden');\n };\n checkButtonVisibility = function() {};\n remove = function() {\n container.css('top', 0);\n hide(prevBtn);\n return hide(nextBtn);\n };\n $el.on(\"click\", \".v-pagination-previous\", function(event) {\n var newTop;\n event.preventDefault();\n if (container.is(':animated')) {\n return;\n }\n visible(nextBtn);\n newTop = prevPage();\n if (!hasPrevPage(newTop)) {\n return hide(prevBtn);\n }\n });\n $el.on(\"click\", \".v-pagination-next\", function(event) {\n var newTop;\n event.preventDefault();\n if (container.is(':animated')) {\n return;\n }\n visible(prevBtn);\n newTop = -nextPage();\n if (!hasNextPage(newTop)) {\n return hide(nextBtn);\n }\n });\n $scope.$on(\"regenerate:project-pagination\", function() {\n remove();\n return render();\n });\n $(window).on(\"resize.projects-pagination\", render);\n return $scope.$on(\"$destroy\", function() {\n return $(window).off(\"resize.projects-pagination\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectsPagination\", ['$timeout', ProjectsPaginationDirective]);\n\n ProjectsListDirective = function($compile, $template) {\n var link, template;\n template = $template.get('project/project-list.html', true);\n link = function($scope, $el, $attrs, $ctrls) {\n var render;\n render = function(projects) {\n $el.html($compile(template({\n projects: projects\n }))($scope));\n return $scope.$emit(\"regenerate:project-pagination\");\n };\n return $scope.$watch(\"projects\", function(projects) {\n if (projects != null) {\n return render(projects);\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectsList\", [\"$compile\", \"$tgTemplate\", ProjectsListDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/bind.coffee\n */\n\n(function() {\n var BindHtmlDirective, BindOnceAltDirective, BindOnceBindDirective, BindOnceHrefDirective, BindOnceHtmlDirective, BindOnceRefDirective, BindOnceSrcDirective, BindOnceTitleDirective, BindTitleDirective, bindOnce, module;\n\n bindOnce = this.taiga.bindOnce;\n\n BindOnceBindDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoBind, function(val) {\n return $el.text(val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceHtmlDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoHtml, function(val) {\n return $el.html(val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceRefDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoRef, function(val) {\n return $el.html(\"#\" + val + \" \");\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceSrcDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoSrc, function(val) {\n return $el.attr(\"src\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceHrefDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoHref, function(val) {\n return $el.attr(\"href\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceAltDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoAlt, function(val) {\n return $el.attr(\"alt\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceTitleDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoTitle, function(val) {\n return $el.attr(\"title\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindTitleDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$watch($attrs.tgTitleHtml, function(val) {\n if (val != null) {\n return $el.attr(\"title\", val);\n }\n });\n };\n return {\n link: link\n };\n };\n\n BindHtmlDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$watch($attrs.tgBindHtml, function(val) {\n if (val != null) {\n return $el.html(val);\n }\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaBase\");\n\n module.directive(\"tgBoBind\", BindOnceBindDirective);\n\n module.directive(\"tgBoHtml\", BindOnceHtmlDirective);\n\n module.directive(\"tgBoRef\", BindOnceRefDirective);\n\n module.directive(\"tgBoSrc\", BindOnceSrcDirective);\n\n module.directive(\"tgBoHref\", BindOnceHrefDirective);\n\n module.directive(\"tgBoAlt\", BindOnceAltDirective);\n\n module.directive(\"tgBoTitle\", BindOnceTitleDirective);\n\n module.directive(\"tgBindTitle\", BindTitleDirective);\n\n module.directive(\"tgBindHtml\", BindHtmlDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/conf.coffee\n */\n\n(function() {\n var ConfigurationService, module;\n\n ConfigurationService = (function() {\n function ConfigurationService() {\n this.config = window.taigaConfig;\n }\n\n ConfigurationService.prototype.get = function(key, defaultValue) {\n if (defaultValue == null) {\n defaultValue = null;\n }\n if (_.has(this.config, key)) {\n return this.config[key];\n }\n return defaultValue;\n };\n\n return ConfigurationService;\n\n })();\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgConfig\", ConfigurationService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/contrib.coffee\n */\n\n(function() {\n var ContribController, module, taigaContribPlugins,\n __extends = 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 taigaContribPlugins = this.taigaContribPlugins = this.taigaContribPlugins || [];\n\n ContribController = (function(_super) {\n __extends(ContribController, _super);\n\n ContribController.$inject = [\"$rootScope\", \"$scope\", \"$routeParams\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$appTitle\"];\n\n function ContribController(_at_rootScope, _at_scope, _at_params, _at_repo, _at_rs, _at_confirm, _at_appTitle) {\n var promise;\n this.rootScope = _at_rootScope;\n this.scope = _at_scope;\n this.params = _at_params;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.confirm = _at_confirm;\n this.appTitle = _at_appTitle;\n this.scope.currentPlugin = _.first(_.where(taigaContribPlugins, {\n \"slug\": this.params.plugin\n }));\n this.scope.pluginTemplate = \"contrib/\" + this.scope.currentPlugin.slug;\n this.scope.projectSlug = this.params.pslug;\n this.scope.adminPlugins = _.where(this.rootScope.contribPlugins, {\n \"type\": \"admin\"\n });\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(_this.scope.project.name);\n };\n })(this));\n promise.then(null, (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this));\n }\n\n ContribController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.$broadcast('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ContribController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this));\n };\n\n return ContribController;\n\n })(taiga.Controller);\n\n module = angular.module(\"taigaBase\");\n\n module.controller(\"ContribController\", ContribController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/filters.coffee\n */\n\n(function() {\n var FiltersStorageService, taiga,\n __extends = 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 FiltersStorageService = (function(_super) {\n __extends(FiltersStorageService, _super);\n\n FiltersStorageService.$inject = [\"$tgStorage\", \"$routeParams\"];\n\n function FiltersStorageService(_at_storage, _at_params) {\n this.storage = _at_storage;\n this.params = _at_params;\n }\n\n FiltersStorageService.prototype.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 return FiltersStorageService;\n\n })(taiga.Service);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/http.coffee\n */\n\n(function() {\n var HttpService, module, taiga,\n __extends = 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 HttpService = (function(_super) {\n __extends(HttpService, _super);\n\n HttpService.$inject = [\"$http\", \"$q\", \"$tgStorage\"];\n\n HttpService.prototype.headers = function() {\n var token;\n token = this.storage.get('token');\n if (token) {\n return {\n \"Authorization\": \"Bearer \" + token\n };\n }\n return {};\n };\n\n function HttpService(_at_http, _at_q, _at_storage) {\n this.http = _at_http;\n this.q = _at_q;\n this.storage = _at_storage;\n HttpService.__super__.constructor.call(this);\n }\n\n HttpService.prototype.request = function(options) {\n options.headers = _.merge({}, options.headers || {}, this.headers());\n if (_.isPlainObject(options.data)) {\n options.data = JSON.stringify(options.data);\n }\n return this.http(options);\n };\n\n HttpService.prototype.get = function(url, params, options) {\n options = _.merge({\n method: \"GET\",\n url: url\n }, options);\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype.post = function(url, data, params, options) {\n options = _.merge({\n method: \"POST\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype.put = function(url, data, params, options) {\n options = _.merge({\n method: \"PUT\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype.patch = function(url, data, params, options) {\n options = _.merge({\n method: \"PATCH\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype[\"delete\"] = function(url, data, params, options) {\n options = _.merge({\n method: \"DELETE\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n return HttpService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgHttp\", HttpService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/i18n.coffee\n */\n\n(function() {\n var I18nDirective, I18nService, bindOnce, defaults, module, taiga,\n __extends = 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 bindOnce = this.taiga.bindOnce;\n\n defaults = {\n ns: \"app\",\n fallbackLng: \"en\",\n async: false,\n lng: \"en\"\n };\n\n I18nService = (function(_super) {\n __extends(I18nService, _super);\n\n function I18nService(_at_rootscope, localesEn) {\n this.rootscope = _at_rootscope;\n this.options = _.clone(defaults, true);\n this.options.resStore = {\n en: {\n app: localesEn\n }\n };\n }\n\n I18nService.prototype.setLanguage = function(language) {\n i18n.setLng(language);\n this.rootscope.currentLang = language;\n return this.rootscope.$broadcast(\"i18n:changeLang\", language);\n };\n\n I18nService.prototype.initialize = function() {\n i18n.init(this.options);\n return this.rootscope.t = i18n.t;\n };\n\n I18nService.prototype.t = function(path, opts) {\n return i18n.t(path, opts);\n };\n\n return I18nService;\n\n })(taiga.Service);\n\n I18nDirective = function($rootscope, $i18n) {\n var link;\n link = function($scope, $el, $attrs) {\n var ns, options, opts, v, values, _i, _len, _ref, _results;\n values = $attrs.tr.split(\",\");\n options = $attrs.trOpts || '{}';\n opts = $scope.$eval(options);\n _results = [];\n for (_i = 0, _len = values.length; _i < _len; _i++) {\n v = values[_i];\n if (v.indexOf(\":\") === -1) {\n _results.push($el.html(_.escape($i18n.t(v, opts))));\n } else {\n _ref = v.split(\":\"), ns = _ref[0], v = _ref[1];\n _results.push($el.attr(ns, _.escape($i18n.t(v, opts))));\n }\n }\n return _results;\n };\n return {\n link: link,\n restrict: \"A\",\n scope: false\n };\n };\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgI18n\", [\"$rootScope\", \"localesEn\", I18nService]);\n\n module.directive(\"tr\", [\"$rootScope\", \"$tgI18n\", I18nDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/location.coffee\n */\n\n(function() {\n var locationFactory, module;\n\n locationFactory = function($location, $route, $rootscope) {\n $location.noreload = function(scope) {\n var lastRoute, un;\n lastRoute = $route.current;\n un = scope.$on(\"$locationChangeSuccess\", function() {\n $route.current = lastRoute;\n return un();\n });\n return $location;\n };\n return $location;\n };\n\n module = angular.module(\"taigaBase\");\n\n module.factory(\"$tgLocation\", [\"$location\", \"$route\", \"$rootScope\", locationFactory]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/model.coffee\n */\n\n(function() {\n var Model, ModelService, module, provider, taiga,\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 __extends = 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 Model = (function() {\n function Model(name, data, dataTypes) {\n this._attrs = data;\n this._name = name;\n this._dataTypes = dataTypes;\n this.setAttrs(data);\n this.initialize();\n }\n\n Model.prototype.clone = function() {\n var instance;\n instance = new Model(this._name, this._attrs, this._dataTypes);\n instance._modifiedAttrs = this._modifiedAttrs;\n instance._isModified = this._isModified;\n return instance;\n };\n\n Model.prototype.applyCasts = function() {\n var attrName, castMethod, castName, _ref, _results;\n _ref = this._dataTypes;\n _results = [];\n for (attrName in _ref) {\n castName = _ref[attrName];\n castMethod = service.casts[castName];\n if (!castMethod) {\n continue;\n }\n _results.push(this._attrs[attrName] = castMethod(this._attrs[attrName]));\n }\n return _results;\n };\n\n Model.prototype.getIdAttrName = function() {\n return \"id\";\n };\n\n Model.prototype.getName = function() {\n return this._name;\n };\n\n Model.prototype.getAttrs = function(patch) {\n if (patch == null) {\n patch = false;\n }\n if (this._attrs.version != null) {\n this._modifiedAttrs.version = this._attrs.version;\n }\n if (patch) {\n return _.extend({}, this._modifiedAttrs);\n }\n return _.extend({}, this._attrs, this._modifiedAttrs);\n };\n\n Model.prototype.setAttrs = function(attrs) {\n this._attrs = attrs;\n this._modifiedAttrs = {};\n this.applyCasts();\n return this._isModified = false;\n };\n\n Model.prototype.setAttr = function(name, value) {\n this._modifiedAttrs[name] = value;\n return this._isModified = true;\n };\n\n Model.prototype.initialize = function() {\n var getter, self, setter;\n self = this;\n getter = function(name) {\n return function() {\n if (typeof name === 'string' && name.substr(0, 2) === \"__\") {\n return self[name];\n }\n if (__indexOf.call(_.keys(self._modifiedAttrs), name) < 0) {\n return self._attrs[name];\n }\n return self._modifiedAttrs[name];\n };\n };\n setter = function(name) {\n return function(value) {\n if (typeof name === 'string' && name.substr(0, 2) === \"__\") {\n self[name] = value;\n return;\n }\n if (self._attrs[name] !== value) {\n self._modifiedAttrs[name] = value;\n self._isModified = true;\n } else {\n delete self._modifiedAttrs[name];\n }\n };\n };\n return _.each(this._attrs, function(value, name) {\n var options;\n options = {\n get: getter(name),\n set: setter(name),\n enumerable: true,\n configurable: true\n };\n return Object.defineProperty(self, name, options);\n });\n };\n\n Model.prototype.serialize = function() {\n var data;\n data = {\n \"data\": _.clone(this._attrs),\n \"name\": this._name\n };\n return JSON.stringify(data);\n };\n\n Model.prototype.isModified = function() {\n return this._isModified;\n };\n\n Model.prototype.isAttributeModified = function(attribute) {\n return this._modifiedAttrs[attribute] != null;\n };\n\n Model.prototype.markSaved = function() {\n this._isModified = false;\n this._attrs = this.getAttrs();\n return this._modifiedAttrs = {};\n };\n\n Model.prototype.revert = function() {\n this._modifiedAttrs = {};\n return this._isModified = false;\n };\n\n Model.desSerialize = function(sdata) {\n var ddata, model;\n ddata = JSON.parse(sdata);\n model = new Model(ddata.url, ddata.data);\n return model;\n };\n\n return Model;\n\n })();\n\n taiga = this.taiga;\n\n ModelService = (function(_super) {\n __extends(ModelService, _super);\n\n ModelService.$inject = [\"$q\", \"$tgUrls\", \"$tgStorage\", \"$tgHttp\"];\n\n function ModelService(_at_q, _at_urls, _at_storage, _at_http) {\n this.q = _at_q;\n this.urls = _at_urls;\n this.storage = _at_storage;\n this.http = _at_http;\n ModelService.__super__.constructor.call(this);\n }\n\n return ModelService;\n\n })(taiga.Service);\n\n provider = function($q, $http, $gmUrls, $gmStorage) {\n var service;\n service = {};\n service.make_model = function(name, data, cls, dataTypes) {\n if (cls == null) {\n cls = Model;\n }\n if (dataTypes == null) {\n dataTypes = {};\n }\n return new cls(name, data, dataTypes);\n };\n service.cls = Model;\n service.casts = {\n int: function(value) {\n return parseInt(value, 10);\n },\n float: function(value) {\n return parseFloat(value, 10);\n }\n };\n return service;\n };\n\n module = angular.module(\"taigaBase\");\n\n module.factory(\"$tgModel\", [\"$q\", \"$http\", \"$tgUrls\", \"$tgStorage\", provider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/navurl.coffee\n */\n\n(function() {\n var NavigationUrlsDirective, NavigationUrlsService, bindOnce, module, taiga, trim,\n __extends = 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 trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaBase\");\n\n NavigationUrlsService = (function(_super) {\n __extends(NavigationUrlsService, _super);\n\n function NavigationUrlsService() {\n this.urls = {};\n }\n\n NavigationUrlsService.prototype.update = function(urls) {\n return this.urls = _.merge({}, this.urls, urls || {});\n };\n\n NavigationUrlsService.prototype.formatUrl = function(url, ctx) {\n var replacer;\n if (ctx == null) {\n ctx = {};\n }\n replacer = function(match) {\n match = trim(match, \":\");\n return ctx[match] || \"undefined\";\n };\n return url.replace(/(:\\w+)/g, replacer);\n };\n\n NavigationUrlsService.prototype.resolve = function(name, ctx) {\n var url;\n url = this.urls[name];\n if (!url) {\n return \"\";\n }\n if (ctx) {\n return this.formatUrl(url, ctx);\n }\n return url;\n };\n\n return NavigationUrlsService;\n\n })(taiga.Service);\n\n module.service(\"$tgNavUrls\", NavigationUrlsService);\n\n NavigationUrlsDirective = function($navurls, $auth, $q, $location) {\n var bindOnceP, link, parseNav;\n bindOnceP = function($scope, attr) {\n var defered;\n defered = $q.defer();\n bindOnce($scope, attr, function(v) {\n return defered.resolve(v);\n });\n return defered.promise;\n };\n parseNav = function(data, $scope) {\n var name, params, promises, values, _ref;\n _ref = _.map(data.split(\":\"), trim), name = _ref[0], params = _ref[1];\n if (params) {\n params = _.map(params.split(\",\"), trim);\n } else {\n params = [];\n }\n values = _.map(params, function(x) {\n return trim(x.split(\"=\")[1]);\n });\n promises = _.map(values, function(x) {\n return bindOnceP($scope, x);\n });\n return $q.all(promises).then(function() {\n var item, key, options, value, _i, _len, _ref1;\n options = {};\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n item = params[_i];\n _ref1 = _.map(item.split(\"=\"), trim), key = _ref1[0], value = _ref1[1];\n options[key] = $scope.$eval(value);\n }\n return [name, options];\n });\n };\n link = function($scope, $el, $attrs) {\n if ($el.is(\"a\")) {\n $el.attr(\"href\", \"#\");\n }\n $el.on(\"mouseenter\", function(event) {\n var target;\n target = $(event.currentTarget);\n if (!target.data(\"fullUrl\")) {\n return parseNav($attrs.tgNav, $scope).then(function(result) {\n var fullUrl, name, options, url, user;\n name = result[0], options = result[1];\n user = $auth.getUser();\n if (user) {\n options.user = user.username;\n }\n url = $navurls.resolve(name);\n fullUrl = $navurls.formatUrl(url, options);\n target.data(\"fullUrl\", fullUrl);\n if (target.is(\"a\")) {\n target.attr(\"href\", fullUrl);\n }\n return $el.on(\"click\", function(event) {\n event.preventDefault();\n target = $(event.currentTarget);\n if (target.hasClass('noclick')) {\n return;\n }\n fullUrl = target.data(\"fullUrl\");\n switch (event.which) {\n case 1:\n $location.url(fullUrl);\n return $scope.$apply();\n case 2:\n return window.open(fullUrl);\n }\n });\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(\"tgNav\", [\"$tgNavUrls\", \"$tgAuth\", \"$q\", \"$tgLocation\", NavigationUrlsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/repository.coffee\n */\n\n(function() {\n var RepositoryService, module, taiga,\n __extends = 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 RepositoryService = (function(_super) {\n __extends(RepositoryService, _super);\n\n RepositoryService.$inject = [\"$q\", \"$tgModel\", \"$tgStorage\", \"$tgHttp\", \"$tgUrls\"];\n\n function RepositoryService(_at_q, _at_model, _at_storage, _at_http, _at_urls) {\n this.q = _at_q;\n this.model = _at_model;\n this.storage = _at_storage;\n this.http = _at_http;\n this.urls = _at_urls;\n RepositoryService.__super__.constructor.call(this);\n }\n\n RepositoryService.prototype.resolveUrlForModel = function(model) {\n var idAttrName;\n idAttrName = model.getIdAttrName();\n return (this.urls.resolve(model.getName())) + \"/\" + model[idAttrName];\n };\n\n RepositoryService.prototype.resolveUrlForAttributeModel = function(model) {\n return this.urls.resolve(model.getName(), model.parent);\n };\n\n RepositoryService.prototype.create = function(name, data, dataTypes, extraParams) {\n var defered, promise, url;\n if (dataTypes == null) {\n dataTypes = {};\n }\n if (extraParams == null) {\n extraParams = {};\n }\n defered = this.q.defer();\n url = this.urls.resolve(name);\n promise = this.http.post(url, JSON.stringify(data));\n promise.success((function(_this) {\n return function(_data, _status) {\n return defered.resolve(_this.model.make_model(name, _data, null, dataTypes));\n };\n })(this));\n promise.error((function(_this) {\n return function(data, status) {\n return defered.reject(data);\n };\n })(this));\n return defered.promise;\n };\n\n RepositoryService.prototype.remove = function(model, params) {\n var defered, promise, url;\n if (params == null) {\n params = {};\n }\n defered = this.q.defer();\n url = this.resolveUrlForModel(model);\n promise = this.http[\"delete\"](url, {}, params);\n promise.success(function(data, status) {\n return defered.resolve(model);\n });\n promise.error(function(data, status) {\n return defered.reject(model);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.saveAll = function(models, patch) {\n var promises;\n if (patch == null) {\n patch = true;\n }\n promises = _.map(models, (function(_this) {\n return function(x) {\n return _this.save(x, true);\n };\n })(this));\n return this.q.all(promises);\n };\n\n RepositoryService.prototype.save = function(model, patch) {\n var data, defered, promise, url;\n if (patch == null) {\n patch = true;\n }\n defered = this.q.defer();\n if (!model.isModified() && patch) {\n defered.resolve(model);\n return defered.promise;\n }\n url = this.resolveUrlForModel(model);\n data = JSON.stringify(model.getAttrs(patch));\n if (patch) {\n promise = this.http.patch(url, data);\n } else {\n promise = this.http.put(url, data);\n }\n promise.success((function(_this) {\n return function(data, status) {\n model._isModified = false;\n model._attrs = _.extend(model.getAttrs(), data);\n model._modifiedAttrs = {};\n model.applyCasts();\n return defered.resolve(model);\n };\n })(this));\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.saveAttribute = function(model, attribute, patch) {\n var data, defered, promise, url;\n if (patch == null) {\n patch = true;\n }\n defered = this.q.defer();\n if (!model.isModified() && patch) {\n defered.resolve(model);\n return defered.promise;\n }\n url = this.resolveUrlForAttributeModel(model);\n data = {};\n data[attribute] = model.getAttrs();\n if (patch) {\n promise = this.http.patch(url, data);\n } else {\n promise = this.http.put(url, data);\n }\n promise.success((function(_this) {\n return function(data, status) {\n model._isModified = false;\n model._attrs = _.extend(model.getAttrs(), data);\n model._modifiedAttrs = {};\n model.applyCasts();\n return defered.resolve(model);\n };\n })(this));\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.refresh = function(model) {\n var defered, promise, url;\n defered = this.q.defer();\n url = this.resolveUrlForModel(model);\n promise = this.http.get(url);\n promise.success(function(data, status) {\n model._modifiedAttrs = {};\n model._attrs = data;\n model._isModified = false;\n model.applyCasts();\n return defered.resolve(model);\n });\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.queryMany = function(name, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n return _.map(data.data, function(x) {\n return _this.model.make_model(name, x);\n });\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOneAttribute = function(name, id, attribute, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name, id);\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var model;\n model = _this.model.make_model(name, data.data[attribute]);\n model.parent = id;\n return model;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOne = function(name, id, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n if (id) {\n url = url + \"/\" + id;\n }\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n return _this.model.make_model(name, data.data);\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOneRaw = function(name, id, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n if (id) {\n url = url + \"/\" + id;\n }\n httpOptions = _.merge({\n headers: {}\n }, options);\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryPaginated = function(name, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n httpOptions = _.merge({\n headers: {}\n }, options);\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var headers, result;\n headers = data.headers();\n result = {};\n result.models = _.map(data.data, function(x) {\n return _this.model.make_model(name, x);\n });\n result.count = parseInt(headers[\"x-pagination-count\"], 10);\n result.current = parseInt(headers[\"x-pagination-current\"] || 1, 10);\n result.paginatedBy = parseInt(headers[\"x-paginated-by\"], 10);\n return result;\n };\n })(this));\n };\n\n RepositoryService.prototype.resolve = function(options) {\n var cache, params;\n params = {};\n if (options.pslug != null) {\n params.project = options.pslug;\n }\n if (options.usref != null) {\n params.us = options.usref;\n }\n if (options.taskref != null) {\n params.task = options.taskref;\n }\n if (options.issueref != null) {\n params.issue = options.issueref;\n }\n if (options.sslug != null) {\n params.milestone = options.sslug;\n }\n if (options.wikipage != null) {\n params.wikipage = options.wikipage;\n }\n cache = !(options.wikipage || options.sslug);\n return this.queryOneRaw(\"resolver\", null, params, {\n cache: cache\n });\n };\n\n return RepositoryService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgRepo\", RepositoryService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/storage.coffee\n */\n\n(function() {\n var StorageService, module, taiga,\n __extends = 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 StorageService = (function(_super) {\n __extends(StorageService, _super);\n\n StorageService.$inject = [\"$rootScope\"];\n\n function StorageService($rootScope) {\n StorageService.__super__.constructor.call(this);\n }\n\n StorageService.prototype.get = function(key, _default) {\n var serializedValue;\n serializedValue = localStorage.getItem(key);\n if (serializedValue === null) {\n return _default || null;\n }\n return JSON.parse(serializedValue);\n };\n\n StorageService.prototype.set = function(key, val) {\n if (_.isObject(key)) {\n return _.each(key, (function(_this) {\n return function(val, key) {\n return _this.set(key, val);\n };\n })(this));\n } else {\n return localStorage.setItem(key, JSON.stringify(val));\n }\n };\n\n StorageService.prototype.contains = function(key) {\n var value;\n value = this.get(key);\n return value !== null;\n };\n\n StorageService.prototype.remove = function(key) {\n return localStorage.removeItem(key);\n };\n\n StorageService.prototype.clear = function() {\n return localStorage.clear();\n };\n\n return StorageService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgStorage\", StorageService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/http.coffee\n */\n\n(function() {\n var UrlsService, format, module, taiga,\n __extends = 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 format = function(fmt, obj) {\n obj = _.clone(obj);\n return fmt.replace(/%s/g, function(match) {\n return String(obj.shift());\n });\n };\n\n taiga = this.taiga;\n\n UrlsService = (function(_super) {\n __extends(UrlsService, _super);\n\n UrlsService.$inject = [\"$tgConfig\"];\n\n function UrlsService(_at_config) {\n this.config = _at_config;\n this.urls = {};\n this.mainUrl = config.get(\"api\");\n }\n\n UrlsService.prototype.update = function(urls) {\n return this.urls = _.merge(this.urls, urls);\n };\n\n UrlsService.prototype.resolve = function() {\n var args, name, url;\n args = _.toArray(arguments);\n if (args.length === 0) {\n throw Error(\"wrong arguments to setUrls\");\n }\n name = args.slice(0, 1)[0];\n url = format(this.urls[name], args.slice(1));\n return format(\"%s/%s\", [_.str.rtrim(this.mainUrl, \"/\"), _.str.ltrim(url, \"/\")]);\n };\n\n return UrlsService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service('$tgUrls', UrlsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/attachments.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($rootScope, $config, $urls, $model, $repo, $auth, $q) {\n var service;\n service = {};\n service.list = function(urlName, objectId, projectId) {\n var params;\n params = {\n object_id: objectId,\n project: projectId\n };\n return $repo.queryMany(urlName, params);\n };\n service.create = function(urlName, projectId, objectId, file) {\n var data, defered, maxFileSize, response, uploadComplete, uploadFailed, uploadProgress, xhr;\n defered = $q.defer();\n if (file === void 0) {\n defered.reject(null);\n return defered.promise;\n }\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered.reject(response);\n return defered.promise;\n }\n uploadProgress = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n file.status = \"in-progress\";\n file.size = sizeFormat(evt.total);\n file.progressMessage = \"upload \" + (sizeFormat(evt.loaded)) + \" of \" + (sizeFormat(evt.total));\n return file.progressPercent = (Math.round((evt.loaded / evt.total) * 100)) + \"%\";\n });\n };\n })(this);\n uploadComplete = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n var data, model;\n file.status = \"done\";\n try {\n data = JSON.parse(evt.target.responseText);\n } catch (_error) {\n data = {};\n }\n model = $model.make_model(urlName, data);\n return defered.resolve(model);\n });\n };\n })(this);\n uploadFailed = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n file.status = \"error\";\n return defered.reject(\"fail\");\n });\n };\n })(this);\n data = new FormData();\n data.append(\"project\", projectId);\n data.append(\"object_id\", objectId);\n data.append(\"attached_file\", file);\n xhr = new XMLHttpRequest();\n xhr.upload.addEventListener(\"progress\", uploadProgress, false);\n xhr.addEventListener(\"load\", uploadComplete, false);\n xhr.addEventListener(\"error\", uploadFailed, false);\n xhr.open(\"POST\", $urls.resolve(urlName));\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + ($auth.getToken()));\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send(data);\n return defered.promise;\n };\n return function(instance) {\n return instance.attachments = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgAttachmentsResourcesProvider\", [\"$rootScope\", \"$tgConfig\", \"$tgUrls\", \"$tgModel\", \"$tgRepo\", \"$tgAuth\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/history.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(type, objectId) {\n return $repo.queryOneRaw(\"history/\" + type, objectId);\n };\n service.deleteComment = function(type, objectId, activityId) {\n var params, url;\n url = $urls.resolve(\"history/\" + type);\n url = url + \"/\" + objectId + \"/delete_comment\";\n params = {\n id: activityId\n };\n return $http.post(url, null, params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n service.undeleteComment = function(type, objectId, activityId) {\n var params, url;\n url = $urls.resolve(\"history/\" + type);\n url = url + \"/\" + objectId + \"/undelete_comment\";\n params = {\n id: activityId\n };\n return $http.post(url, null, params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n return function(instance) {\n return instance.history = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgHistoryResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/projects.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo) {\n var service;\n service = {};\n service.get = function(token) {\n return $repo.queryOne(\"invitations\", token);\n };\n return function(instance) {\n return instance.invitations = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgInvitationsResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/issues.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage, $q) {\n var filtersHashSuffix, hashSuffix, myFiltersHashSuffix, service;\n service = {};\n hashSuffix = \"issues-queryparams\";\n filtersHashSuffix = \"issues-filters\";\n myFiltersHashSuffix = \"issues-my-filters\";\n service.get = function(projectId, issueId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"issues\", issueId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"issues\", \"by_ref\", params);\n };\n service.list = function(projectId, filters, options) {\n var params;\n params = {\n project: projectId\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryPaginated(\"issues\", params, options);\n };\n service.bulkCreate = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-create-issues\");\n params = {\n project_id: projectId,\n bulk_issues: data\n };\n return $http.post(url, params);\n };\n service.stats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/issues_stats\");\n };\n service.filtersData = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/issue_filters_data\");\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeFilters = function(projectSlug, params) {\n var hash, ns;\n ns = projectSlug + \":\" + filtersHashSuffix;\n hash = generateHash([projectSlug, ns]);\n return $storage.set(hash, params);\n };\n service.getFilters = function(projectSlug) {\n var hash, ns;\n ns = projectSlug + \":\" + filtersHashSuffix;\n hash = generateHash([projectSlug, ns]);\n return $storage.get(hash) || {};\n };\n service.storeMyFilters = function(projectId, myFilters) {\n var deferred, hash, ns, promise, url;\n deferred = $q.defer();\n url = $urls.resolve(\"user-storage\");\n ns = projectId + \":\" + myFiltersHashSuffix;\n hash = generateHash([projectId, ns]);\n if (_.isEmpty(myFilters)) {\n promise = $http[\"delete\"](url + \"/\" + hash, {\n key: hash,\n value: myFilters\n });\n promise.then(function() {\n return deferred.resolve();\n });\n promise.then(null, function() {\n return deferred.reject();\n });\n } else {\n promise = $http.put(url + \"/\" + hash, {\n key: hash,\n value: myFilters\n });\n promise.then(function(data) {\n return deferred.resolve();\n });\n promise.then(null, function(data) {\n var innerPromise;\n innerPromise = $http.post(\"\" + url, {\n key: hash,\n value: myFilters\n });\n innerPromise.then(function() {\n return deferred.resolve();\n });\n return innerPromise.then(null, function() {\n return deferred.reject();\n });\n });\n }\n return deferred.promise;\n };\n service.getMyFilters = function(projectId) {\n var deferred, hash, ns, promise, url;\n deferred = $q.defer();\n url = $urls.resolve(\"user-storage\");\n ns = projectId + \":\" + myFiltersHashSuffix;\n hash = generateHash([projectId, ns]);\n promise = $http.get(url + \"/\" + hash);\n promise.then(function(data) {\n return deferred.resolve(data.data.value);\n });\n promise.then(null, function(data) {\n return deferred.resolve({});\n });\n return deferred.promise;\n };\n return function(instance) {\n return instance.issues = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgIssuesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/kanban.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($storage) {\n var hashSuffixStatusColumnModes, hashSuffixStatusViewModes, service;\n service = {};\n hashSuffixStatusViewModes = \"kanban-statusviewmodels\";\n hashSuffixStatusColumnModes = \"kanban-statuscolumnmodels\";\n service.storeStatusViewModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusViewModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusViewModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusViewModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeStatusColumnModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusColumnModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n return function(instance) {\n return instance.kanban = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgKanbanResourcesProvider\", [\"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/mdrender.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.render = function(projectId, content) {\n var params, url;\n if ((content == null) || content === \"\") {\n content = ' ';\n }\n params = {\n project_id: projectId,\n content: content\n };\n url = $urls.resolve(\"wiki\");\n return $http.post(url + \"/render\", params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n return function(instance) {\n return instance.mdrender = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgMdRenderResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"memberships\", id);\n };\n service.list = function(projectId, filters, enablePagination) {\n var options, params;\n if (enablePagination == null) {\n enablePagination = true;\n }\n params = {\n project: projectId\n };\n params = _.extend({}, params, filters || {});\n if (enablePagination) {\n return $repo.queryPaginated(\"memberships\", params);\n }\n return $repo.queryMany(\"memberships\", params, options = {\n enablePagination: enablePagination\n });\n };\n service.listByUser = function(userId, filters) {\n var params;\n params = {\n user: userId\n };\n params = _.extend({}, params, filters || {});\n return $repo.queryPaginated(\"memberships\", params);\n };\n service.resendInvitation = function(id) {\n var url;\n url = $urls.resolve(\"memberships\");\n return $http.post(url + \"/\" + id + \"/resend_invitation\", {});\n };\n service.bulkCreateMemberships = function(projectId, data, invitation_extra_text) {\n var params, url;\n url = $urls.resolve(\"bulk-create-memberships\");\n params = {\n project_id: projectId,\n bulk_memberships: data,\n invitation_extra_text: invitation_extra_text\n };\n return $http.post(url, params);\n };\n return function(instance) {\n return instance.memberships = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgMembershipsResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo) {\n var service;\n service = {};\n service.list = function(projectId, module) {\n return $repo.queryOneAttribute(\"project-modules\", projectId, module);\n };\n return function(instance) {\n return instance.modules = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgModulesResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"notify-policies\", id);\n };\n service.list = function(filters) {\n var params;\n params = _.extend({}, params, filters || {});\n return $repo.queryMany(\"notify-policies\", params);\n };\n return function(instance) {\n return instance.notifyPolicies = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgNotifyPoliciesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/projects.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($config, $repo, $http, $urls, $auth, $q, $rootScope) {\n var service;\n service = {};\n service.get = function(projectId) {\n return $repo.queryOne(\"projects\", projectId);\n };\n service.getBySlug = function(projectSlug) {\n return $repo.queryOne(\"projects\", \"by_slug?slug=\" + projectSlug);\n };\n service.list = function() {\n return $repo.queryMany(\"projects\");\n };\n service.templates = function() {\n return $repo.queryMany(\"project-templates\");\n };\n service.usersList = function(projectId) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(\"users\", params);\n };\n service.rolesList = function(projectId) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(\"roles\", params);\n };\n service.stats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/stats\");\n };\n service.leave = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/leave\";\n return $http.post(url);\n };\n service.memberStats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/member_stats\");\n };\n service.tagsColors = function(projectId) {\n return $repo.queryOne(\"projects\", projectId + \"/tags_colors\");\n };\n service[\"export\"] = function(projectId) {\n var url;\n url = ($urls.resolve(\"exporter\")) + \"/\" + projectId;\n return $http.get(url);\n };\n service[\"import\"] = function(file, statusUpdater) {\n var complete, data, defered, failed, maxFileSize, response, uploadComplete, uploadFailed, uploadProgress, xhr;\n defered = $q.defer();\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered.reject(response);\n return defered.promise;\n }\n uploadProgress = (function(_this) {\n return function(evt) {\n var message, percent;\n percent = Math.round((evt.loaded / evt.total) * 100);\n message = \"Uloaded \" + (sizeFormat(evt.loaded)) + \" of \" + (sizeFormat(evt.total));\n return statusUpdater(\"in-progress\", null, message, percent);\n };\n })(this);\n uploadComplete = (function(_this) {\n return function(evt) {\n return statusUpdater(\"done\", \"Importing Project\", \"This process can take a while, please keep the window open.\");\n };\n })(this);\n uploadFailed = (function(_this) {\n return function(evt) {\n return statusUpdater(\"error\");\n };\n })(this);\n complete = (function(_this) {\n return function(evt) {\n var _ref;\n response = {};\n try {\n response.data = JSON.parse(evt.target.responseText);\n } catch (_error) {\n response.data = {};\n }\n response.status = evt.target.status;\n if ((_ref = response.status) === 201 || _ref === 202) {\n defered.resolve(response);\n }\n return defered.reject(response);\n };\n })(this);\n failed = (function(_this) {\n return function(evt) {\n return defered.reject(\"fail\");\n };\n })(this);\n data = new FormData();\n data.append('dump', file);\n xhr = new XMLHttpRequest();\n xhr.upload.addEventListener(\"progress\", uploadProgress, false);\n xhr.upload.addEventListener(\"load\", uploadComplete, false);\n xhr.upload.addEventListener(\"error\", uploadFailed, false);\n xhr.upload.addEventListener(\"abort\", uploadFailed, false);\n xhr.addEventListener(\"load\", complete, false);\n xhr.addEventListener(\"error\", failed, false);\n xhr.open(\"POST\", $urls.resolve(\"importer\"));\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + ($auth.getToken()));\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send(data);\n return defered.promise;\n };\n return function(instance) {\n return instance.projects = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgProjectsResourcesProvider\", [\"$tgConfig\", \"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgAuth\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"roles\", id);\n };\n service.list = function(projectId) {\n return $repo.queryMany(\"roles\", {\n project: projectId\n });\n };\n return function(instance) {\n return instance.roles = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgRolesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/search.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service[\"do\"] = function(projectId, term) {\n var params, url;\n url = $urls.resolve(\"search\");\n params = {\n project: projectId,\n text: term,\n get_all: false\n };\n return $http.get(url, params).then(function(data) {\n return data.data;\n });\n };\n return function(instance) {\n return instance.search = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgSearchResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/sprints.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $model, $storage) {\n var hashSuffixUserstories, service;\n service = {};\n hashSuffixUserstories = \"userstories-queryparams\";\n service.get = function(projectId, sprintId) {\n return $repo.queryOne(\"milestones\", sprintId).then(function(sprint) {\n var uses;\n service.storeUserstoriesQueryParams(projectId, {\n \"milestone\": sprintId\n });\n uses = sprint.user_stories;\n uses = _.map(uses, function(u) {\n return $model.make_model(\"userstories\", u);\n });\n sprint._attrs.user_stories = uses;\n return sprint;\n });\n };\n service.stats = function(projectId, sprintId) {\n return $repo.queryOneRaw(\"milestones\", sprintId + \"/stats\");\n };\n service.list = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId\n };\n params = _.extend({}, params, filters || {});\n return $repo.queryMany(\"milestones\", params).then((function(_this) {\n return function(milestones) {\n var m, uses, _i, _len;\n for (_i = 0, _len = milestones.length; _i < _len; _i++) {\n m = milestones[_i];\n uses = m.user_stories;\n uses = _.map(uses, function(u) {\n return $model.make_model(\"userstories\", u);\n });\n m._attrs.user_stories = uses;\n }\n return milestones;\n };\n })(this));\n };\n service.storeUserstoriesQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixUserstories;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n return function(instance) {\n return instance.sprints = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgSprintsResourcesProvider\", [\"$tgRepo\", \"$tgModel\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/tasks.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage) {\n var hashSuffix, hashSuffixStatusColumnModes, hashSuffixUsRowModes, service;\n service = {};\n hashSuffix = \"tasks-queryparams\";\n hashSuffixStatusColumnModes = \"tasks-statuscolumnmodels\";\n hashSuffixUsRowModes = \"tasks-usrowmodels\";\n service.get = function(projectId, taskId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"tasks\", taskId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"tasks\", \"by_ref\", params);\n };\n service.list = function(projectId, sprintId, userStoryId) {\n var params;\n if (sprintId == null) {\n sprintId = null;\n }\n if (userStoryId == null) {\n userStoryId = null;\n }\n params = {\n project: projectId\n };\n if (sprintId) {\n params.milestone = sprintId;\n }\n if (userStoryId) {\n params.user_story = userStoryId;\n }\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"tasks\", params);\n };\n service.bulkCreate = function(projectId, sprintId, usId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-create-tasks\");\n params = {\n project_id: projectId,\n sprint_id: sprintId,\n us_id: usId,\n bulk_tasks: data\n };\n return $http.post(url, params).then(function(result) {\n return result.data;\n });\n };\n service.bulkUpdateTaskTaskboardOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-task-taskboard-order\");\n params = {\n project_id: projectId,\n bulk_tasks: data\n };\n return $http.post(url, params);\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeStatusColumnModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusColumnModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeUsRowModes = function(projectId, sprintId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixUsRowModes;\n hash = generateHash([projectId, sprintId, ns]);\n return $storage.set(hash, params);\n };\n service.getUsRowModes = function(projectId, sprintId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixUsRowModes;\n hash = generateHash([projectId, sprintId, ns]);\n return $storage.get(hash) || {};\n };\n return function(instance) {\n return instance.tasks = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgTasksResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($config, $repo, $http, $urls, $q) {\n var service;\n service = {};\n service.changeAvatar = function(file) {\n var data, defered, maxFileSize, options, response, url;\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered = $q.defer();\n defered.reject(response);\n return defered.promise;\n }\n data = new FormData();\n data.append('avatar', file);\n options = {\n transformRequest: angular.identity,\n headers: {\n 'Content-Type': void 0\n }\n };\n url = ($urls.resolve(\"users\")) + \"/change_avatar\";\n return $http.post(url, data, {}, options);\n };\n service.removeAvatar = function() {\n var url;\n url = ($urls.resolve(\"users\")) + \"/remove_avatar\";\n return $http.post(url);\n };\n service.changePassword = function(currentPassword, newPassword) {\n var data, url;\n url = ($urls.resolve(\"users\")) + \"/change_password\";\n data = {\n current_password: currentPassword,\n password: newPassword\n };\n return $http.post(url, data);\n };\n return function(instance) {\n return instance.userSettings = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgUserSettingsResourcesProvider\", [\"$tgConfig\", \"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/userstories.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage) {\n var hashSuffix, service;\n service = {};\n hashSuffix = \"userstories-queryparams\";\n service.get = function(projectId, usId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"userstories\", usId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"userstories\", \"by_ref\", params);\n };\n service.listUnassigned = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId,\n \"milestone\": \"null\"\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"userstories\", params);\n };\n service.listAll = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"userstories\", params);\n };\n service.bulkCreate = function(projectId, status, bulk) {\n var data, url;\n data = {\n project_id: projectId,\n status_id: status,\n bulk_stories: bulk\n };\n url = $urls.resolve(\"bulk-create-us\");\n return $http.post(url, data);\n };\n service.bulkUpdateBacklogOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-backlog-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.bulkUpdateSprintOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-sprint-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.bulkUpdateKanbanOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-kanban-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeShowTags = function(projectId, showTags) {\n var hash;\n hash = generateHash([projectId, 'showTags']);\n return $storage.set(hash, showTags);\n };\n service.getShowTags = function(projectId) {\n var hash;\n hash = generateHash([projectId, 'showTags']);\n return $storage.get(hash) || null;\n };\n return function(instance) {\n return instance.userstories = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgUserstoriesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.list = function(webhookId) {\n var params;\n params = {\n webhook: webhookId\n };\n return $repo.queryMany(\"webhooklogs\", params);\n };\n service.resend = function(webhooklogId) {\n var url;\n url = $urls.resolve(\"webhooklogs-resend\", webhooklogId);\n return $http.post(url);\n };\n return function(instance) {\n return instance.webhooklogs = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWebhookLogsResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.list = function(projectId) {\n var params;\n params = {\n project: projectId\n };\n return $repo.queryMany(\"webhooks\", params);\n };\n service.test = function(webhookId) {\n var url;\n url = $urls.resolve(\"webhooks-test\", webhookId);\n return $http.post(url);\n };\n return function(instance) {\n return instance.webhooks = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWebhooksResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/wikis.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(wikiId) {\n return $repo.queryOne(\"wiki\", wikiId);\n };\n service.getBySlug = function(projectId, slug) {\n return $repo.queryOne(\"wiki\", \"by_slug?project=\" + projectId + \"&slug=\" + slug);\n };\n service.listLinks = function(projectId) {\n return $repo.queryMany(\"wiki-links\", {\n project: projectId\n });\n };\n return function(instance) {\n return instance.wiki = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWikiResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var UserChangePasswordController, UserChangePasswordDirective, debounce, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaUserSettings\");\n\n UserChangePasswordController = (function(_super) {\n __extends(UserChangePasswordController, _super);\n\n UserChangePasswordController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\"];\n\n function UserChangePasswordController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_auth) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.auth = _at_auth;\n this.scope.sectionName = \"Change Password\";\n this.scope.project = {};\n this.scope.user = this.auth.getUser();\n promise = this.loadInitialData();\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserChangePasswordController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n UserChangePasswordController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this));\n };\n\n return UserChangePasswordController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserChangePasswordController\", UserChangePasswordController);\n\n UserChangePasswordDirective = function($rs, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs, ctrl) {\n var submit, submitButton;\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if ($scope.newPassword1 !== $scope.newPassword2) {\n $confirm.notify('error', \"The passwords dosn't match\");\n return;\n }\n $loading.start(submitButton);\n promise = $rs.userSettings.changePassword($scope.currentPassword, $scope.newPassword1);\n promise.then(function() {\n $loading.finish(submitButton);\n return $confirm.notify('success');\n });\n return promise.then(null, function(response) {\n $loading.finish(submitButton);\n return $confirm.notify('error', response.data._error_message);\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserChangePassword\", [\"$tgResources\", \"$tgConfirm\", \"$tgLoading\", UserChangePasswordDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var DeleteUserDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaUserSettings\");\n\n DeleteUserDirective = function($repo, $rootscope, $auth, $location, $navUrls, lightboxService) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit;\n $scope.$on(\"deletelightbox:new\", function(ctx, user) {\n return lightboxService.open($el);\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n submit = function() {\n var promise;\n promise = $repo.remove($scope.user);\n promise.then(function(data) {\n lightboxService.close($el);\n $auth.logout();\n return $location.path($navUrls.resolve(\"login\"));\n });\n return promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n };\n $el.on(\"click\", \".button-red\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n return $el.on(\"click\", \".button-green\", debounce(2000, function(event) {\n event.preventDefault();\n return submit();\n }));\n };\n return {\n link: link,\n templateUrl: \"user/lightbox/lightbox-delete-account.html\"\n };\n };\n\n module.directive(\"tgLbDeleteUser\", [\"$tgRepo\", \"$rootScope\", \"$tgAuth\", \"$tgLocation\", \"$tgNavUrls\", \"lightboxService\", DeleteUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var TaigaAvatarModelDirective, UserAvatarDirective, UserProfileDirective, UserSettingsController, debounce, mixOf, module, sizeFormat, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n sizeFormat = this.taiga.sizeFormat;\n\n module = angular.module(\"taigaUserSettings\");\n\n debounce = this.taiga.debounce;\n\n UserSettingsController = (function(_super) {\n __extends(UserSettingsController, _super);\n\n UserSettingsController.$inject = [\"$scope\", \"$rootScope\", \"$tgConfig\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\"];\n\n function UserSettingsController(_at_scope, _at_rootscope, _at_config, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_auth) {\n var maxFileSize, promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.config = _at_config;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.auth = _at_auth;\n this.scope.sectionName = \"User Profile\";\n this.scope.project = {};\n this.scope.user = this.auth.getUser();\n maxFileSize = this.config.get(\"maxUploadFileSize\", null);\n if (maxFileSize) {\n this.scope.maxFileSizeMsg = \"[Max, size: \" + (sizeFormat(maxFileSize));\n }\n promise = this.loadInitialData();\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserSettingsController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n UserSettingsController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this));\n };\n\n UserSettingsController.prototype.openDeleteLightbox = function() {\n return this.rootscope.$broadcast(\"deletelightbox:new\", this.scope.user);\n };\n\n return UserSettingsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserSettingsController\", UserSettingsController);\n\n UserProfileDirective = function($confirm, $auth, $repo) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit;\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var changeEmail, form, onError, onSuccess;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n changeEmail = $scope.user.isAttributeModified(\"email\");\n onSuccess = function(data) {\n $auth.setUser($scope.user);\n if (changeEmail) {\n return $confirm.success(\"Check your inbox!
We have sent a mail to your account
with the instructions to set your new address\");\n } else {\n return $confirm.notify('success');\n }\n };\n onError = function(data) {\n form.setErrors(data);\n return $confirm.notify('error', data._error_message);\n };\n return $repo.save($scope.user).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserProfile\", [\"$tgConfirm\", \"$tgAuth\", \"$tgRepo\", UserProfileDirective]);\n\n UserAvatarDirective = function($auth, $model, $rs, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var onError, onSuccess, showSizeInfo;\n showSizeInfo = function() {\n return $el.find(\".size-info\").removeClass(\"hidden\");\n };\n onSuccess = function(response) {\n var user;\n user = $model.make_model(\"users\", response.data);\n $auth.setUser(user);\n $scope.user = user;\n $el.find('.overlay').hide();\n return $confirm.notify('success');\n };\n onError = function(response) {\n if (response.status === 413) {\n showSizeInfo();\n }\n $el.find('.overlay').hide();\n return $confirm.notify('error', response.data._error_message);\n };\n $el.on(\"click\", \".button.change\", function() {\n return $el.find(\"#avatar-field\").click();\n });\n $el.on(\"change\", \"#avatar-field\", function(event) {\n if ($scope.avatarAttachment) {\n $el.find('.overlay').css('display', 'flex');\n return $rs.userSettings.changeAvatar($scope.avatarAttachment).then(onSuccess, onError);\n }\n });\n $el.on(\"click\", \"a.use-gravatar\", function(event) {\n $el.find('.overlay').show();\n return $rs.userSettings.removeAvatar().then(onSuccess, onError);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserAvatar\", [\"$tgAuth\", \"$tgModel\", \"$tgResources\", \"$tgConfirm\", UserAvatarDirective]);\n\n TaigaAvatarModelDirective = function($parse) {\n var link;\n link = function($scope, $el, $attrs) {\n var model, modelSetter;\n model = $parse($attrs.tgAvatarModel);\n modelSetter = model.assign;\n return $el.bind('change', function() {\n return $scope.$apply(function() {\n return modelSetter($scope, $el[0].files[0]);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive('tgAvatarModel', ['$parse', TaigaAvatarModelDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/nav.coffee\n */\n\n(function() {\n var UserSettingsNavigationDirective, module;\n\n UserSettingsNavigationDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var section;\n section = $attrs.tgUserSettingsNavigation;\n $el.find(\".active\").removeClass(\"active\");\n $el.find(\"#usersettingsmenu-\" + section + \" a\").addClass(\"active\");\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaUserSettings\");\n\n module.directive(\"tgUserSettingsNavigation\", UserSettingsNavigationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/notifications.coffee\n */\n\n(function() {\n var UserNotificationsController, UserNotificationsDirective, UserNotificationsListDirective, bindOnce, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaUserSettings\");\n\n UserNotificationsController = (function(_super) {\n __extends(UserNotificationsController, _super);\n\n UserNotificationsController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\"];\n\n function UserNotificationsController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_auth) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.auth = _at_auth;\n this.scope.sectionName = \"Email Notifications\";\n this.scope.project = {};\n this.scope.user = this.auth.getUser();\n promise = this.loadInitialData();\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserNotificationsController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n UserNotificationsController.prototype.loadNotifyPolicies = function() {\n return this.rs.notifyPolicies.list().then((function(_this) {\n return function(notifyPolicies) {\n _this.scope.notifyPolicies = notifyPolicies;\n return notifyPolicies;\n };\n })(this));\n };\n\n UserNotificationsController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadNotifyPolicies();\n };\n })(this));\n };\n\n return UserNotificationsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserNotificationsController\", UserNotificationsController);\n\n UserNotificationsDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserNotifications\", UserNotificationsDirective);\n\n UserNotificationsListDirective = function($repo, $confirm) {\n var link, template;\n template = _.template(\"<% _.each(notifyPolicies, function (notifyPolicy, index) { %>\\n
\\\">\\n
<%- notifyPolicy.project_name %>
\\n
\\n
\\n \\\" id=\\\"policy-all-<%- notifyPolicy.id %>\\\"\\n value=\\\"2\\\" <% if (notifyPolicy.notify_level == 2) { %>checked=\\\"checked\\\"<% } %>/>\\n \\n
\\n
\\n
\\n
\\n \\\" id=\\\"policy-involved-<%- notifyPolicy.id %>\\\"\\n value=\\\"1\\\" <% if (notifyPolicy.notify_level == 1) { %>checked=\\\"checked\\\"<% } %> />\\n \\n
\\n
\\n
\\n
\\n \\\" id=\\\"policy-none-<%- notifyPolicy.id %>\\\"\\n value=\\\"3\\\" <% if (notifyPolicy.notify_level == 3) { %>checked=\\\"checked\\\"<% } %> />\\n \\n
\\n
\\n
\\n<% }) %>\");\n link = function($scope, $el, $attrs) {\n var render;\n render = function() {\n $el.off();\n $el.html(template({\n notifyPolicies: $scope.notifyPolicies\n }));\n return $el.on(\"change\", \"input[type=radio]\", function(event) {\n var onError, onSuccess, policy, policyIndex, prev_level, target;\n target = angular.element(event.currentTarget);\n policyIndex = target.parents(\".policy-table-row\").data('index');\n policy = $scope.notifyPolicies[policyIndex];\n prev_level = policy.notify_level;\n policy.notify_level = parseInt(target.val(), 10);\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n return target.parents(\".policy-table-row\").find(\"input[value=\" + prev_level + \"]\").prop(\"checked\", true);\n };\n return $repo.save(policy).then(onSuccess, onError);\n });\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return bindOnce($scope, $attrs.ngModel, render);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserNotificationsList\", [\"$tgRepo\", \"$tgConfirm\", UserNotificationsListDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/github.coffee\n */\n\n(function() {\n var AUTH_URL, GithubLoginButtonDirective, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaIntegrations\");\n\n AUTH_URL = \"https://github.com/login/oauth/authorize\";\n\n GithubLoginButtonDirective = function($window, $params, $location, $config, $events, $confirm, $auth, $navUrls, $loader) {\n var link, template;\n template = \"
\\n \\n Login with Github\\n\";\n link = function($scope, $el, $attrs) {\n var clientId, loginOnError, loginOnSuccess, loginWithGitHubAccount, renderGitHubButton;\n clientId = $config.get(\"gitHubClientId\", null);\n if (!clientId) {\n return;\n }\n renderGitHubButton = function() {\n if (clientId) {\n return $el.html(template);\n }\n };\n loginOnSuccess = function(response) {\n var nextUrl;\n if ($params.next && $params.next !== $navUrls.resolve(\"login\")) {\n nextUrl = $params.next;\n } else {\n nextUrl = $navUrls.resolve(\"home\");\n }\n $events.setupConnection();\n $location.search(\"next\", null);\n $location.search(\"token\", null);\n $location.search(\"state\", null);\n $location.search(\"code\", null);\n return $location.path(nextUrl);\n };\n loginOnError = function(response) {\n $location.search(\"state\", null);\n $location.search(\"code\", null);\n $loader.pageLoaded();\n if (response.data.error_message) {\n return $confirm.notify(\"light-error\", response.data.error_message);\n } else {\n return $confirm.notify(\"light-error\", \"Our Oompa Loompas have not been able to get you credentials from GitHub.\");\n }\n };\n loginWithGitHubAccount = function() {\n var code, data, token, type;\n type = $params.state;\n code = $params.code;\n token = $params.token;\n if (!(type === \"github\" && code)) {\n return;\n }\n $loader.start();\n data = {\n code: code,\n token: token\n };\n return $auth.login(data, type).then(loginOnSuccess, loginOnError);\n };\n renderGitHubButton();\n loginWithGitHubAccount();\n $el.on(\"click\", \".button-github\", function(event) {\n var redirectToUri, url;\n redirectToUri = $location.absUrl();\n url = AUTH_URL + \"?client_id=\" + clientId + \"&redirect_uri=\" + redirectToUri + \"&state=github&scope=user:email\";\n return $window.location.href = url;\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n template: \"\"\n };\n };\n\n module.directive(\"tgGithubLoginButton\", [\"$window\", '$routeParams', \"$tgLocation\", \"$tgConfig\", \"$tgEvents\", \"$tgConfirm\", \"$tgAuth\", \"$tgNavUrls\", \"tgLoader\", GithubLoginButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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: plugins/humanshtml/humanshtml.coffee\n */\n\n(function() {\n var configure, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaPlugins\", [\"ngRoute\"]);\n\n configure = function($routeProvider) {\n return $routeProvider.when(\"/humans.html\", {\n \"templateUrl\": \"/plugins/humanshtml/templates/humans.html\"\n });\n };\n\n module.config([\"$routeProvider\", configure]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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: plugins/terms/terms.coffee\n */\n\n(function() {\n var TermsNoticeDirective, module, taiga, template;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaPlugins\", [\"ngRoute\"]);\n\n template = _.template(\"

\\n By clicking \\\"Sign up\\\", you agree to our
\\n \\\" title=\\\"See terms of service\\\" target=\\\"_blank\\\"> terms of service\\n and\\n \\\" title=\\\"See privacy policy\\\" target=\\\"_blank\\\"> privacy policy.\\n

\");\n\n TermsNoticeDirective = function($config) {\n var privacyPolicyUrl, templateFn, termsOfServiceUrl;\n privacyPolicyUrl = $config.get(\"privacyPolicyUrl\");\n termsOfServiceUrl = $config.get(\"termsOfServiceUrl\");\n templateFn = function() {\n var ctx;\n if (!(privacyPolicyUrl && termsOfServiceUrl)) {\n return \"\";\n }\n ctx = {\n termsUrl: termsOfServiceUrl,\n privacyUrl: privacyPolicyUrl\n };\n return template(ctx);\n };\n return {\n scope: {},\n restrict: \"AE\",\n template: templateFn\n };\n };\n\n module.directive(\"tgTermsNotice\", [\"$tgConfig\", TermsNoticeDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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: pluggins/main.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaPlugins\", [\"ngRoute\"]);\n\n}).call(this);\n","angular.module('taigaBase').value('localesEn', {\n \"checksley\": {\n \"defaultMessage\": \"This value seems to be invalid.\",\n \"type-email\": \"This value should be a valid email.\",\n \"type-url\": \"This value should be a valid url.\",\n \"type-urlstrict\": \"This value should be a valid url.\",\n \"type-number\": \"This value should be a valid number.\",\n \"type-digits\": \"This value should be digits.\",\n \"type-dateIso\": \"This value should be a valid date (YYYY-MM-DD).\",\n \"type-alphanum\": \"This value should be alphanumeric.\",\n \"type-phone\": \"This value should be a valid phone number.\",\n \"notnull\": \"This value should not be null.\",\n \"notblank\": \"This value should not be blank.\",\n \"required\": \"This value is required.\",\n \"regexp\": \"This value seems to be invalid.\",\n \"min\": \"This value should be greater than or equal to %s.\",\n \"max\": \"This value should be lower than or equal to %s.\",\n \"range\": \"This value should be between %s and %s.\",\n \"minlength\": \"This value is too short. It should have %s characters or more.\",\n \"maxlength\": \"This value is too long. It should have %s characters or less.\",\n \"rangelength\": \"This value length is invalid. It should be between %s and %s characters long.\",\n \"mincheck\": \"You must select at least %s choices.\",\n \"maxcheck\": \"You must select %s choices or less.\",\n \"rangecheck\": \"You must select between %s and %s choices.\",\n \"equalto\": \"This value should be the same.\"\n },\n \"common\": {\n \"subject\": \"Subject\",\n \"save\": \"Save\",\n \"blocked\": \"Blocked\",\n \"cancel\": \"Cancel\",\n \"status\": \"Status\",\n \"new-bulk\": \"New bulk insert\",\n \"one-item-line\": \"One item per line...\"\n },\n \"pagination\": {\n \"next\": \"Next\",\n \"prev\": \"Previous\"\n },\n \"markdown-editor\": {\n \"heading-1\": \"First Level Heading\",\n \"heading-2\": \"Second Level Heading\",\n \"heading-3\": \"Third Level Heading\",\n \"bold\": \"Bold\",\n \"italic\": \"Italic\",\n \"strike\": \"Strike\",\n \"bulleted-list\": \"Bulleted List\",\n \"numeric-list\": \"Numeric List\",\n \"picture\": \"Picture\",\n \"link\": \"Link\",\n \"quotes\": \"Quotes\",\n \"code-block\": \"Code Block / Code\",\n \"preview\": \"Preview\",\n \"help\": \"Help\",\n \"placeholder\": \"Your title here...\",\n \"link-placeholder\": \"Your text to link here...\"\n },\n \"us\": {\n \"title-new\": \"New User Story\",\n \"team-requirement\": \"Team Requirement\",\n \"client-requirement\": \"Client Requirement\"\n }\n}\n);"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["app.js","locales.en.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpgrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"app.js","sourcesContent":["\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, init, module, modules, taiga;\n\n this.taiga = taiga = {};\n\n this.taigaContribPlugins = this.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, tgLoaderProvider) {\n var authHttpIntercept, defaultHeaders, versionCheckHttpIntercept;\n $routeProvider.when(\"/\", {\n templateUrl: \"project/projects.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/\", {\n templateUrl: \"project/project.html\"\n });\n $routeProvider.when(\"/project/:pslug/backlog\", {\n templateUrl: \"backlog/backlog.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/taskboard/:sslug\", {\n templateUrl: \"taskboard/taskboard.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/search\", {\n templateUrl: \"search/search.html\",\n reloadOnSearch: false\n });\n $routeProvider.when(\"/project/:pslug/kanban\", {\n templateUrl: \"kanban/kanban.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/us/:usref\", {\n templateUrl: \"us/us-detail.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/task/:taskref\", {\n templateUrl: \"task/task-detail.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\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/:slug\", {\n templateUrl: \"wiki/wiki.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/team\", {\n templateUrl: \"team/team.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/issues\", {\n templateUrl: \"issue/issues.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/issue/:issueref\", {\n templateUrl: \"issue/issues-detail.html\",\n resolve: {\n loader: tgLoaderProvider.add()\n }\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/details\", {\n templateUrl: \"admin/admin-project-profile.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/default-values\", {\n templateUrl: \"admin/admin-project-default-values.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/modules\", {\n templateUrl: \"admin/admin-project-modules.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-profile/export\", {\n templateUrl: \"admin/admin-project-export.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/us-status\", {\n templateUrl: \"admin/admin-project-values-us-status.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/us-points\", {\n templateUrl: \"admin/admin-project-values-us-points.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/task-status\", {\n templateUrl: \"admin/admin-project-values-task-status.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/issue-status\", {\n templateUrl: \"admin/admin-project-values-issue-status.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/issue-types\", {\n templateUrl: \"admin/admin-project-values-issue-types.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/issue-priorities\", {\n templateUrl: \"admin/admin-project-values-issue-priorities.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/project-values/issue-severities\", {\n templateUrl: \"admin/admin-project-values-issue-severities.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/memberships\", {\n templateUrl: \"admin/admin-memberships.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/roles\", {\n templateUrl: \"admin/admin-roles.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/webhooks\", {\n templateUrl: \"admin/admin-third-parties-webhooks.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/github\", {\n templateUrl: \"admin/admin-third-parties-github.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/gitlab\", {\n templateUrl: \"admin/admin-third-parties-gitlab.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/third-parties/bitbucket\", {\n templateUrl: \"admin/admin-third-parties-bitbucket.html\"\n });\n $routeProvider.when(\"/project/:pslug/admin/contrib/:plugin\", {\n templateUrl: \"contrib/main.html\"\n });\n $routeProvider.when(\"/project/:pslug/user-settings/user-profile\", {\n templateUrl: \"user/user-profile.html\"\n });\n $routeProvider.when(\"/project/:pslug/user-settings/user-change-password\", {\n templateUrl: \"user/user-change-password.html\"\n });\n $routeProvider.when(\"/project/:pslug/user-settings/user-avatar\", {\n templateUrl: \"user/user-avatar.html\"\n });\n $routeProvider.when(\"/project/:pslug/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(\"/login\", {\n templateUrl: \"auth/login.html\"\n });\n $routeProvider.when(\"/register\", {\n templateUrl: \"auth/register.html\"\n });\n $routeProvider.when(\"/forgot-password\", {\n templateUrl: \"auth/forgot-password.html\"\n });\n $routeProvider.when(\"/change-password\", {\n templateUrl: \"auth/change-password-from-recovery.html\"\n });\n $routeProvider.when(\"/change-password/:token\", {\n templateUrl: \"auth/change-password-from-recovery.html\"\n });\n $routeProvider.when(\"/invitation/:token\", {\n templateUrl: \"auth/invitation.html\"\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 redirectTo: '/not-found'\n });\n $locationProvider.html5Mode({\n enabled: true,\n requireBase: false\n });\n defaultHeaders = {\n \"Content-Type\": \"application/json\",\n \"Accept-Language\": \"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 $tgEventsProvider.setSessionId(taiga.sessionId);\n authHttpIntercept = function($q, $location, $navUrls, $lightboxService) {\n var httpResponseError;\n httpResponseError = function(response) {\n var nextPath;\n if (response.status === 0) {\n $lightboxService.closeAll();\n $location.path($navUrls.resolve(\"error\"));\n $location.replace();\n } else if (response.status === 401) {\n nextPath = $location.path();\n $location.url($navUrls.resolve(\"login\")).search(\"next=\" + nextPath);\n }\n return $q.reject(response);\n };\n return {\n responseError: httpResponseError\n };\n };\n $provide.factory(\"authHttpIntercept\", [\"$q\", \"$location\", \"$tgNavUrls\", \"lightboxService\", authHttpIntercept]);\n $httpProvider.interceptors.push('authHttpIntercept');\n versionCheckHttpIntercept = function($q, $confirm) {\n var httpResponseError, versionErrorMsg;\n versionErrorMsg = \"Someone inside Taiga has changed this before and our Oompa Loompas cannot apply your changes. Please reload and apply your changes again (they will be lost).\";\n httpResponseError = function(response) {\n if (response.status === 400 && response.data.version) {\n $confirm.notify(\"error\", versionErrorMsg, null, 10000);\n return $q.reject(response);\n }\n return $q.reject(response);\n };\n return {\n responseError: httpResponseError\n };\n };\n $provide.factory(\"versionCheckHttpIntercept\", [\"$q\", \"$tgConfirm\", versionCheckHttpIntercept]);\n $httpProvider.interceptors.push('versionCheckHttpIntercept');\n window.checksley.updateValidators({\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 });\n return window.checksley.updateMessages(\"default\", {\n linewidth: \"The subject must have a maximum size of %s\"\n });\n };\n\n init = function($log, $i18n, $config, $rootscope, $auth, $events, $analytics) {\n $i18n.initialize($config.get(\"defaultLanguage\"));\n $log.debug(\"Initialize application\");\n $rootscope.contribPlugins = this.taigaContribPlugins;\n if ($auth.isAuthenticated()) {\n $events.setupConnection();\n }\n return $analytics.initialize();\n };\n\n modules = [\"taigaBase\", \"taigaCommon\", \"taigaResources\", \"taigaLocales\", \"taigaAuth\", \"taigaEvents\", \"taigaRelatedTasks\", \"taigaBacklog\", \"taigaTaskboard\", \"taigaKanban\", \"taigaIssues\", \"taigaUserStories\", \"taigaTasks\", \"taigaTeam\", \"taigaWiki\", \"taigaSearch\", \"taigaAdmin\", \"taigaNavMenu\", \"taigaProject\", \"taigaUserSettings\", \"taigaFeedback\", \"taigaPlugins\", \"taigaIntegrations\", \"templates\", \"ngRoute\", \"ngAnimate\"].concat(_.map(this.taigaContribPlugins, function(plugin) {\n return plugin.module;\n }));\n\n module = angular.module(\"taiga\", modules);\n\n module.config([\"$routeProvider\", \"$locationProvider\", \"$httpProvider\", \"$provide\", \"$tgEventsProvider\", \"tgLoaderProvider\", configure]);\n\n module.run([\"$log\", \"$tgI18n\", \"$tgConfig\", \"$rootScope\", \"$tgAuth\", \"$tgEvents\", \"$tgAnalytics\", init]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 __extends = 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(_super) {\n __extends(TaigaService, _super);\n\n function TaigaService() {\n return TaigaService.__super__.constructor.apply(this, arguments);\n }\n\n return TaigaService;\n\n })(TaigaBase);\n\n TaigaController = (function(_super) {\n __extends(TaigaController, _super);\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.location.path(this.navUrls.resolve(\"not-found\"));\n this.location.replace();\n } else if (xhr.status === 403) {\n this.location.path(this.navUrls.resolve(\"permission-denied\"));\n this.location.replace();\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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 bindMethods, bindOnce, cancelTimeout, debounce, debounceLeading, groupBy, joinStr, mixOf, nl2br, scopeDefer, sizeFormat, slugify, startswith, taiga, timeout, toString, toggleText, trim, 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 __extends = 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 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) {\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, method, mixin, mixins, name, _i, _ref;\n base = arguments[0], mixins = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\n Mixed = (function(_super) {\n __extends(Mixed, _super);\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 _.str.trim(data, char);\n };\n\n slugify = function(data) {\n return _.str.slugify(data);\n };\n\n unslugify = function(data) {\n if (data) {\n return _.str.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 item, result, _i, _len;\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 _.str.join(str, coll);\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 _.str.startsWith(str1, str2);\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 taiga = this.taiga;\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.debounce = debounce;\n\n taiga.debounceLeading = debounceLeading;\n\n taiga.startswith = startswith;\n\n taiga.sizeFormat = sizeFormat;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, 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, availableRoles;\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 availableRoles = _(this.scope.project.memberships).map(\"role\").uniq().value();\n return this.scope.computableRoles = _(roles).filter(\"computable\").filter(function(x) {\n return _.contains(availableRoles, 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 location = load ? this.location : this.location.noreload(this.scope);\n return location.search(name, value);\n };\n\n FiltersMixin.prototype.replaceFilter = function(name, value, 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(name, value);\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 return FiltersMixin;\n\n })();\n\n taiga.FiltersMixin = FiltersMixin;\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, PublicRegisterMessageDirective, RegisterDirective, debounce, module, taiga,\n __extends = 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 AuthService = (function(_super) {\n __extends(AuthService, _super);\n\n AuthService.$inject = [\"$rootScope\", \"$tgStorage\", \"$tgModel\", \"$tgResources\", \"$tgHttp\", \"$tgUrls\"];\n\n function AuthService(_at_rootscope, _at_storage, _at_model, _at_rs, _at_http, _at_urls) {\n this.rootscope = _at_rootscope;\n this.storage = _at_storage;\n this.model = _at_model;\n this.rs = _at_rs;\n this.http = _at_http;\n this.urls = _at_urls;\n AuthService.__super__.constructor.call(this);\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 return user;\n }\n return null;\n };\n\n AuthService.prototype.setUser = function(user) {\n this.rootscope.auth = user;\n this.rootscope.$broadcast(\"i18n:change\", user.default_language);\n this.storage.set(\"userInfo\", user.getAttrs());\n return this.rootscope.user = user;\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.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 return this.clear();\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, templates) {\n var template, templateFn;\n template = templates.get(\"auth/login-text.html\", true);\n templateFn = function() {\n var publicRegisterEnabled;\n publicRegisterEnabled = $config.get(\"publicRegisterEnabled\");\n if (!publicRegisterEnabled) {\n return \"\";\n }\n return template({\n url: $navUrls.resolve(\"register\")\n });\n };\n return {\n restrict: \"AE\",\n scope: {},\n template: templateFn\n };\n };\n\n module.directive(\"tgPublicRegisterMessage\", [\"$tgConfig\", \"$tgNavUrls\", \"$tgTemplate\", PublicRegisterMessageDirective]);\n\n LoginDirective = function($auth, $confirm, $location, $config, $routeParams, $navUrls, $events) {\n var link;\n link = function($scope, $el, $attrs) {\n var onError, onSuccess, submit;\n onSuccess = function(response) {\n var nextUrl;\n if ($routeParams['next'] && $routeParams['next'] !== $navUrls.resolve(\"login\")) {\n nextUrl = $routeParams['next'];\n } else {\n nextUrl = $navUrls.resolve(\"home\");\n }\n $events.setupConnection();\n return $location.path(nextUrl);\n };\n onError = function(response) {\n return $confirm.notify(\"light-error\", \"According to our Oompa Loompas, your username/email or password are incorrect.\");\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var data, form, promise;\n event.preventDefault();\n form = new checksley.Form($el.find(\"form.login-form\"));\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 promise = $auth.login(data);\n return promise.then(onSuccess, onError);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLogin\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgConfig\", \"$routeParams\", \"$tgNavUrls\", \"$tgEvents\", LoginDirective]);\n\n RegisterDirective = function($auth, $confirm, $location, $navUrls, $config, $analytics) {\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 onSuccessSubmit = function(response) {\n $analytics.trackEvent(\"auth\", \"register\", \"user registration\", 1);\n $confirm.notify(\"success\", \"Our Oompa Loompas are happy, welcome to Taiga.\");\n return $location.path($navUrls.resolve(\"home\"));\n };\n onErrorSubmit = function(response) {\n if (response.data._error_message != null) {\n $confirm.notify(\"light-error\", \"According to our Oompa Loompas there was an error. \" + response.data._error_message);\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 return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRegister\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfig\", \"$tgAnalytics\", RegisterDirective]);\n\n ForgotPasswordDirective = function($auth, $confirm, $location, $navUrls) {\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 $location.path($navUrls.resolve(\"login\"));\n return $confirm.success(\"Check your inbox!
We have sent a mail to
\" + response.data.email + \"
with the instructions to set a new password\");\n };\n onErrorSubmit = function(response) {\n return $confirm.notify(\"light-error\", \"According to our Oompa Loompas, your are not registered yet.\");\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 return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgForgotPassword\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$tgNavUrls\", ForgotPasswordDirective]);\n\n ChangePasswordFromRecoveryDirective = function($auth, $confirm, $location, $params, $navUrls) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit;\n $scope.data = {};\n if ($params.token != null) {\n $scope.tokenInParams = true;\n $scope.data.token = $params.token;\n } else {\n $scope.tokenInParams = false;\n }\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n $location.path($navUrls.resolve(\"login\"));\n return $confirm.success(\"Our Oompa Loompas saved your new password.
Try to sign in with it.\");\n };\n onErrorSubmit = function(response) {\n return $confirm.notify(\"light-error\", \"One of our Oompa Loompas say '\" + response.data._error_message + \"'.\");\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 $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgChangePasswordFromRecovery\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", ChangePasswordFromRecoveryDirective]);\n\n InvitationDirective = function($auth, $confirm, $location, $params, $navUrls, $analytics) {\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 return $scope.invitation = invitation;\n });\n promise.then(null, function(response) {\n $location.path($navUrls.resolve(\"login\"));\n return $confirm.success(\"Ooops, we have a problem
Our Oompa Loompas can't find your invitation.\");\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 $analytics.trackEvent(\"auth\", \"invitationAccept\", \"invitation accept with existing 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 onErrorSubmitLogin = function(response) {\n return $confirm.notify(\"light-error\", \"According to our Oompa Loompas, your are not registered yet or typed an invalid password.\");\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 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 return $confirm.notify(\"light-error\", \"According to our Oompa Loompas, that username or email is already in use.\");\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 return $el.on(\"click\", \".button-register\", submitRegister);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgInvitation\", [\"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", \"$tgAnalytics\", InvitationDirective]);\n\n ChangeEmailDirective = 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.email_token = $params.email_token;\n form = $el.find(\"form\").checksley();\n onSuccessSubmit = function(response) {\n return $repo.queryOne(\"users\", $auth.getUser().id).then((function(_this) {\n return function(data) {\n $auth.setUser(data);\n $location.path($navUrls.resolve(\"home\"));\n return $confirm.success(\"Our Oompa Loompas updated your email\");\n };\n })(this));\n };\n onErrorSubmit = function(response) {\n return $confirm.notify(\"error\", \"One of our Oompa Loompas says '\" + response.data._error_message + \"'.\");\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 return $el.on(\"click\", \"a.button-change-email\", function(event) {\n event.preventDefault();\n return submit();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgChangeEmail\", [\"$tgRepo\", \"$tgModel\", \"$tgAuth\", \"$tgConfirm\", \"$tgLocation\", \"$routeParams\", \"$tgNavUrls\", 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 $auth.logout();\n $location.path($navUrls.resolve(\"home\"));\n return $confirm.success(\"Our Oompa Loompas removed your account\");\n };\n onErrorSubmit = function(response) {\n return $confirm.notify(\"error\", \"One of our Oompa Loompas says '\" + response.data._error_message + \"'.\");\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 $el.on(\"click\", \".submit-button\", submit);\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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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\", [\"taigaLocales\"]);\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 \"error\": \"/error\",\n \"not-found\": \"/not-found\",\n \"permission-denied\": \"/permission-denied\",\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\": \"/:user\",\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-search\": \"/project/:project/search\",\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-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-values-us-status\": \"/project/:project/admin/project-values/us-status\",\n \"project-admin-project-values-us-points\": \"/project/:project/admin/project-values/us-points\",\n \"project-admin-project-values-task-status\": \"/project/:project/admin/project-values/task-status\",\n \"project-admin-project-values-issue-status\": \"/project/:project/admin/project-values/issue-status\",\n \"project-admin-project-values-issue-types\": \"/project/:project/admin/project-values/issue-types\",\n \"project-admin-project-values-issue-priorities\": \"/project/:project/admin/project-values/issue-priorities\",\n \"project-admin-project-values-issue-severities\": \"/project/:project/admin/project-values/issue-severities\",\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-contrib\": \"/project/:project/admin/contrib/:plugin\",\n \"user-settings-user-profile\": \"/project/:project/user-settings/user-profile\",\n \"user-settings-user-change-password\": \"/project/:project/user-settings/user-change-password\",\n \"user-settings-user-avatar\": \"/project/:project/user-settings/user-avatar\",\n \"user-settings-mail-notifications\": \"/project/:project/user-settings/mail-notifications\"\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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, AppTitle, CheckPermissionDirective, LimitLineLengthDirective, ProjectUrl, Qqueue, SelectedText, Template, ToggleCommentDirective, module, taiga,\n __slice = [].slice;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\", []);\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() {\n var link, render;\n render = function($el, project, permission) {\n if (project.my_permissions.indexOf(permission) > -1) {\n return $el.removeClass('hidden');\n }\n };\n link = function($scope, $el, $attrs) {\n var permission;\n $el.addClass('hidden');\n permission = $attrs.tgCheckPermission;\n $scope.$watch(\"project\", function(project) {\n if (project != null) {\n return render($el, project, permission);\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(\"tgCheckPermission\", CheckPermissionDirective);\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 AppTitle = function() {\n var set;\n set = function(text) {\n return $(\"title\").text(text);\n };\n return {\n set: set\n };\n };\n\n module.factory(\"$appTitle\", AppTitle);\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 LimitLineLengthDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var maxColsPerLine;\n maxColsPerLine = parseInt($el.attr(\"cols\"));\n return $el.on(\"keyup\", function(event) {\n var code, lines;\n code = event.keyCode;\n lines = $el.val().split(\"\\n\");\n _.each(lines, function(line, index) {\n return lines[index] = line.substring(0, maxColsPerLine - 2);\n });\n return $el.val(lines.join(\"\\n\"));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLimitLineLength\", LimitLineLengthDirective);\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 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}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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\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(_at_win, _at_log, _at_config, _at_auth) {\n this.win = _at_win;\n this.log = _at_log;\n this.config = _at_config;\n this.auth = _at_auth;\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 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 = _.str.ltrim(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.ws.close();\n return delete this.ws;\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 messages, msg, _i, _len, _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.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 return scope.$on(\"$destroy\", (function(_this) {\n return function() {\n return _this.unsubscribe(routingKey);\n };\n })(this));\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.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 return this.sendMessage(message);\n };\n\n EventsService.prototype.onMessage = function(event) {\n var data, routingKey, subscription;\n this.log.debug(\"WebSocket message received: \" + event.data);\n data = JSON.parse(event.data);\n routingKey = data.routing_key;\n if (this.subscriptions[routingKey] == null) {\n return;\n }\n subscription = this.subscriptions[routingKey];\n return subscription.scope.$apply(function() {\n return subscription.callback(data.data);\n });\n };\n\n EventsService.prototype.onError = function(error) {\n this.log.error(\"WebSocket error: \" + error);\n return this.error = true;\n };\n\n EventsService.prototype.onClose = function() {\n this.log.debug(\"WebSocket closed.\");\n return this.connected = false;\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) {\n var service;\n service = new EventsService($win, $log, $conf, $auth);\n service.initialize(this.sessionId);\n return service;\n };\n\n EventsProvider.prototype.$get.$inject = [\"$window\", \"$log\", \"$tgConfig\", \"$tgAuth\"];\n\n return EventsProvider;\n\n })();\n\n module.provider(\"$tgEvents\", EventsProvider);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley();\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n promise = $repo.create(\"feedback\", $scope.feedback);\n promise.then(function(data) {\n $loading.finish(submitButton);\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 $loading.finish(submitButton);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n $scope.$on(\"feedback:show\", function() {\n $scope.$apply(function() {\n return $scope.feedback = {};\n });\n $lightboxService.open($el);\n return $el.find(\"textarea\").focus();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbFeedback\", [\"lightboxService\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", FeedbackDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/locales.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaLocales\", []);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/nav.coffee\n */\n\n(function() {\n var ProjectMenuDirective, ProjectsNavigationController, ProjectsNavigationDirective, bindOnce, groupBy, module, taiga, timeout,\n __extends = 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 timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaNavMenu\", []);\n\n ProjectsNavigationController = (function(_super) {\n __extends(ProjectsNavigationController, _super);\n\n ProjectsNavigationController.$inject = [\"$scope\", \"$rootScope\", \"$tgResources\", \"$tgNavUrls\", \"$projectUrl\"];\n\n function ProjectsNavigationController(_at_scope, _at_rootscope, _at_rs, _at_navurls, _at_projectUrl) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.rs = _at_rs;\n this.navurls = _at_navurls;\n this.projectUrl = _at_projectUrl;\n promise = this.loadInitialData();\n promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n this.scope.$on(\"projects:reload\", (function(_this) {\n return function() {\n return _this.loadInitialData();\n };\n })(this));\n this.scope.$on(\"project:loaded\", (function(_this) {\n return function(ctx, project) {\n return _this.loadInitialData();\n };\n })(this));\n }\n\n ProjectsNavigationController.prototype.loadInitialData = function() {\n return this.rs.projects.list().then((function(_this) {\n return function(projects) {\n var project, _i, _len;\n for (_i = 0, _len = projects.length; _i < _len; _i++) {\n project = projects[_i];\n project.url = _this.projectUrl.get(project);\n }\n _this.scope.projects = projects;\n _this.scope.filteredProjects = projects;\n _this.scope.filterText = \"\";\n return projects;\n };\n })(this));\n };\n\n ProjectsNavigationController.prototype.newProject = function() {\n return this.scope.$apply((function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"projects:create\");\n };\n })(this));\n };\n\n ProjectsNavigationController.prototype.filterProjects = function(text) {\n this.scope.filteredProjects = _.filter(this.scope.projects, function(project) {\n return project.name.toLowerCase().indexOf(text) > -1;\n });\n this.scope.filterText = text;\n return this.rootscope.$broadcast(\"projects:filtered\");\n };\n\n return ProjectsNavigationController;\n\n })(taiga.Controller);\n\n module.controller(\"ProjectsNavigationController\", ProjectsNavigationController);\n\n ProjectsNavigationDirective = function($rootscope, animationFrame, $timeout, tgLoader, $location, $compile, $template) {\n var baseTemplate, hideMenu, link, loadingStart, overlay, projectsTemplate;\n baseTemplate = $template.get(\"project/project-navigation-base.html\", true);\n projectsTemplate = $template.get(\"project/project-navigation-list.html\", true);\n overlay = $(\".projects-nav-overlay\");\n loadingStart = 0;\n hideMenu = function() {\n var difftime, timeoutValue;\n if (overlay.is(':visible')) {\n difftime = new Date().getTime() - loadingStart;\n timeoutValue = 0;\n if (difftime < 1000) {\n timeoutValue = 1000 - timeoutValue;\n }\n return timeout(timeoutValue, function() {\n overlay.one('transitionend', function() {\n $(document.body).removeClass(\"loading-project open-projects-nav closed-projects-nav\").css(\"overflow-x\", \"visible\");\n return overlay.hide();\n });\n $(document.body).addClass(\"closed-projects-nav\");\n return tgLoader.disablePreventLoading();\n });\n }\n };\n link = function($scope, $el, $attrs, $ctrls) {\n var $ctrl, render, renderProjects;\n $ctrl = $ctrls[0];\n $rootscope.$on(\"project:loaded\", hideMenu);\n renderProjects = function(projects) {\n var html;\n html = projectsTemplate({\n projects: projects\n });\n $el.find(\".projects-list\").html(html);\n return $scope.$emit(\"regenerate:project-pagination\");\n };\n render = function(projects) {\n $el.html($compile(baseTemplate())($scope));\n return renderProjects(projects);\n };\n overlay.on('click', function() {\n return hideMenu();\n });\n $(document).on('keydown', (function(_this) {\n return function(e) {\n var code;\n code = e.keyCode ? e.keyCode : e.which;\n if (code === 27) {\n return hideMenu();\n }\n };\n })(this));\n $scope.$on(\"nav:projects-list:open\", function() {\n if (!$(document.body).hasClass(\"open-projects-nav\")) {\n animationFrame.add((function(_this) {\n return function() {\n return overlay.show();\n };\n })(this));\n }\n return animationFrame.add((function(_this) {\n return function() {\n return $(document.body).css(\"overflow-x\", \"hidden\");\n };\n })(this), (function(_this) {\n return function() {\n return $(document.body).toggleClass(\"open-projects-nav\");\n };\n })(this));\n });\n $el.on(\"click\", \".projects-list > li > a\", function(event) {\n var currentUrl, nextUrl, target;\n target = angular.element(event.currentTarget);\n nextUrl = target.prop(\"href\");\n currentUrl = $location.absUrl();\n if (nextUrl === currentUrl) {\n hideMenu();\n return;\n }\n $(document.body).addClass('loading-project');\n tgLoader.preventLoading();\n return loadingStart = new Date().getTime();\n });\n $el.on(\"click\", \".create-project-button\", function(event) {\n event.preventDefault();\n return $ctrl.newProject();\n });\n $el.on(\"keyup\", \".search-project\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n return $ctrl.filterProjects(target.val());\n });\n $scope.$on(\"projects:filtered\", function() {\n return renderProjects($scope.filteredProjects);\n });\n return $scope.$watch(\"projects\", function(projects) {\n if (projects != null) {\n return render(projects);\n }\n });\n };\n return {\n require: [\"tgProjectsNav\"],\n controller: ProjectsNavigationController,\n link: link\n };\n };\n\n module.directive(\"tgProjectsNav\", [\"$rootScope\", \"animationFrame\", \"$timeout\", \"tgLoader\", \"$tgLocation\", \"$compile\", \"$tgTemplate\", ProjectsNavigationDirective]);\n\n ProjectMenuDirective = function($log, $compile, $auth, $rootscope, $tgAuth, $location, $navUrls, $config, $template) {\n var getSectionName, link, mainTemplate, menuEntriesTemplate, renderMainMenu, renderMenuEntries, videoConferenceUrl;\n menuEntriesTemplate = $template.get(\"project/project-menu.html\", true);\n mainTemplate = _.template(\"
\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n taiga[beta]\\n
\\n
\");\n getSectionName = function($el, sectionName, project) {\n var oldSectionName, _ref;\n oldSectionName = (_ref = $el.find(\"a.active\").parent().attr(\"id\")) != null ? _ref.replace(\"nav-\", \"\") : void 0;\n if (sectionName === \"backlog-kanban\") {\n if (oldSectionName === \"backlog\" || oldSectionName === \"kanban\") {\n sectionName = oldSectionName;\n } else if (project.is_backlog_activated && !project.is_kanban_activated) {\n sectionName = \"backlog\";\n } else if (!project.is_backlog_activated && project.is_kanban_activated) {\n sectionName = \"kanban\";\n }\n }\n return sectionName;\n };\n renderMainMenu = function($el) {\n var html;\n html = mainTemplate({});\n return $el.html(html);\n };\n renderMenuEntries = function($el, targetScope, project) {\n var container, ctx, dom, sectionName;\n if (project == null) {\n project = {};\n }\n container = $el.find(\".menu-container\");\n sectionName = getSectionName($el, targetScope.section, project);\n ctx = {\n user: $auth.getUser(),\n project: project,\n feedbackEnabled: $config.get(\"feedbackEnabled\")\n };\n dom = $compile(menuEntriesTemplate(ctx))(targetScope);\n dom.find(\"a.active\").removeClass(\"active\");\n dom.find(\"#nav-\" + sectionName + \" > a\").addClass(\"active\");\n return container.replaceWith(dom);\n };\n videoConferenceUrl = function(project) {\n var baseUrl, url;\n if (project.videoconferences === \"appear-in\") {\n baseUrl = \"https://appear.in/\";\n } else if (project.videoconferences === \"talky\") {\n baseUrl = \"https://talky.io/\";\n } else {\n return \"\";\n }\n if (project.videoconferences_salt) {\n url = project.slug + \"-\" + project.videoconferences_salt;\n } else {\n url = \"\" + project.slug;\n }\n return baseUrl + url;\n };\n link = function($scope, $el, $attrs, $ctrl) {\n var project;\n renderMainMenu($el);\n project = null;\n $el.on(\"click\", \".logo\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return $rootscope.$broadcast(\"nav:projects-list:open\");\n });\n $el.on(\"click\", \".user-settings .avatar\", function(event) {\n event.preventDefault();\n return $el.find(\".user-settings .popover\").popover().open();\n });\n $el.on(\"click\", \".logout\", function(event) {\n event.preventDefault();\n $auth.logout();\n return $scope.$apply(function() {\n return $location.path($navUrls.resolve(\"login\"));\n });\n });\n $el.on(\"click\", \"#nav-search > a\", function(event) {\n event.preventDefault();\n return $rootscope.$broadcast(\"search-box:show\", project);\n });\n $el.on(\"click\", \".feedback\", function(event) {\n event.preventDefault();\n return $rootscope.$broadcast(\"feedback:show\");\n });\n $scope.$on(\"projects:loaded\", function(listener) {\n $el.addClass(\"hidden\");\n return listener.stopPropagation();\n });\n return $scope.$on(\"project:loaded\", function(ctx, newProject) {\n project = newProject;\n if ($el.hasClass(\"hidden\")) {\n $el.removeClass(\"hidden\");\n }\n project.videoconferenceUrl = videoConferenceUrl(project);\n return renderMenuEntries($el, ctx.targetScope, project);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectMenu\", [\"$log\", \"$compile\", \"$tgAuth\", \"$rootScope\", \"$tgAuth\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfig\", \"$tgTemplate\", ProjectMenuDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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) {\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 promise;\n task.subject = $el.find('input').val();\n $loading.start($el.find('.task-name'));\n promise = $repo.save(task);\n promise.then((function(_this) {\n return function() {\n $loading.finish($el.find('.task-name'));\n $confirm.notify(\"success\");\n return $rootscope.$broadcast(\"related-tasks:update\");\n };\n })(this));\n promise.then(null, (function(_this) {\n return function() {\n $loading.finish($el.find('.task-name'));\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.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\", \".icon-floppy\", 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\", \".icon-edit\", 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 task = $model.$modelValue;\n title = \"Delete Task\";\n message = task.subject;\n return $confirm.askOnDelete(title, message).then(function(finish) {\n var promise;\n promise = $repo.remove(task);\n promise.then(function() {\n finish();\n $confirm.notify(\"success\");\n return $scope.$emit(\"related-tasks:delete\");\n });\n return promise.then(null, function() {\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\", RelatedTaskRowDirective]);\n\n RelatedTaskCreateFormDirective = function($repo, $compile, $confirm, $tgmodel, $loading, $analytics, $template) {\n var link, newTask, template;\n template = $template.get(\"task/related-task-create-form.html\", true);\n newTask = {\n subject: \"\",\n assigned_to: null\n };\n link = function($scope, $el, $attrs) {\n var createTask, render;\n createTask = debounce(2000, function(task) {\n var 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 $loading.start($el.find('.task-name'));\n promise = $repo.create(\"tasks\", task);\n promise.then(function() {\n $analytics.trackEvent(\"task\", \"create\", \"create task on userstory\", 1);\n $loading.finish($el.find('.task-name'));\n $scope.$emit(\"related-tasks:add\");\n return $confirm.notify(\"success\");\n });\n promise.then(null, function() {\n $el.find('input').val(task.subject);\n $loading.finish($el.find('.task-name'));\n return $confirm.notify(\"error\");\n });\n return promise;\n });\n render = function() {\n $el.off();\n $el.html($compile(template())($scope));\n $el.find('input').focus().select();\n $el.addClass('active');\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return createTask(newTask).then(function() {\n return render();\n });\n } else if (event.keyCode === 27) {\n return $el.html(\"\");\n }\n });\n $el.on(\"click\", \".icon-delete\", function(event) {\n return $el.html(\"\");\n });\n return $el.on(\"click\", \".icon-floppy\", function(event) {\n return createTask(newTask).then(function() {\n return $el.html(\"\");\n });\n });\n };\n taiga.bindOnce($scope, \"us\", function(val) {\n newTask[\"status\"] = $scope.project.default_task_status;\n newTask[\"project\"] = $scope.project.id;\n newTask[\"user_story\"] = $scope.us.id;\n $scope.newTask = $tgmodel.make_model(\"tasks\", newTask);\n return $el.html(\"\");\n });\n $scope.$on(\"related-tasks:show-form\", function() {\n return render();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRelatedTaskCreateForm\", [\"$tgRepo\", \"$compile\", \"$tgConfirm\", \"$tgModel\", \"$tgLoading\", \"$tgAnalytics\", \"$tgTemplate\", RelatedTaskCreateFormDirective]);\n\n RelatedTaskCreateButtonDirective = function($repo, $compile, $confirm, $tgmodel) {\n var link, template;\n template = _.template(\"\");\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(template());\n } else {\n $el.html(\"\");\n }\n return $el.on(\"click\", \".icon\", 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\", RelatedTaskCreateButtonDirective]);\n\n RelatedTasksDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var loadTasks;\n loadTasks = function() {\n return $rs.tasks.list($scope.projectId, null, $scope.usId).then((function(_this) {\n return function(tasks) {\n $scope.tasks = tasks;\n return tasks;\n };\n })(this));\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, popoverService) {\n var link, template;\n template = _.template(\"\\\" alt=\\\"<%- name %>\\\"/>\\n
<%- name %>
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, autoSave, notAutoSave, task, updateRelatedTask;\n updateRelatedTask = function(task) {\n var ctx, member;\n ctx = {\n name: \"Unassigned\",\n imgurl: \"/images/unnamed.png\"\n };\n member = $scope.usersById[task.assigned_to];\n if (member) {\n ctx.imgurl = member.photo;\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 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\", RelatedTaskAssignedToInlineEditionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 __extends = 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(_super) {\n __extends(ResourcesService, _super);\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 \"permissions\": \"/permissions\",\n \"roles\": \"/roles\",\n \"projects\": \"/projects\",\n \"memberships\": \"/memberships\",\n \"notify-policies\": \"/notify-policies\",\n \"bulk-create-memberships\": \"/memberships/bulk_create\",\n \"milestones\": \"/milestones\",\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-sprint-order\": \"/userstories/bulk_update_sprint_order\",\n \"bulk-update-us-kanban-order\": \"/userstories/bulk_update_kanban_order\",\n \"userstories-restore\": \"/userstories/%s/restore\",\n \"tasks\": \"/tasks\",\n \"bulk-create-tasks\": \"/tasks/bulk_create\",\n \"bulk-update-task-taskboard-order\": \"/tasks/bulk_update_taskboard_order\",\n \"tasks-restore\": \"/tasks/%s/restore\",\n \"issues\": \"/issues\",\n \"bulk-create-issues\": \"/issues/bulk_create\",\n \"issues-restore\": \"/issues/%s/restore\",\n \"wiki\": \"/wiki\",\n \"wiki-restore\": \"/wiki/%s/restore\",\n \"wiki-links\": \"/wiki-links\",\n \"choices/userstory-statuses\": \"/userstory-statuses\",\n \"choices/userstory-statuses/bulk-update-order\": \"/userstory-statuses/bulk_update_order\",\n \"choices/points\": \"/points\",\n \"choices/points/bulk-update-order\": \"/points/bulk_update_order\",\n \"choices/task-statuses\": \"/task-statuses\",\n \"choices/task-statuses/bulk-update-order\": \"/task-statuses/bulk_update_order\",\n \"choices/issue-statuses\": \"/issue-statuses\",\n \"choices/issue-statuses/bulk-update-order\": \"/issue-statuses/bulk_update_order\",\n \"choices/issue-types\": \"/issue-types\",\n \"choices/issue-types/bulk-update-order\": \"/issue-types/bulk_update_order\",\n \"choices/priorities\": \"/priorities\",\n \"choices/priorities/bulk-update-order\": \"/priorities/bulk_update_order\",\n \"choices/severities\": \"/severities\",\n \"choices/severities/bulk-update-order\": \"/severities/bulk_update_order\",\n \"search\": \"/search\",\n \"sites\": \"/sites\",\n \"project-templates\": \"/project-templates\",\n \"site-members\": \"/site-members\",\n \"site-projects\": \"/site-projects\",\n \"users\": \"/users\",\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-storage\": \"/user-storage\",\n \"resolver\": \"/resolver\",\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 \"project-modules\": \"/projects/%s/modules\",\n \"webhooks\": \"/webhooks\",\n \"webhooks-test\": \"/webhooks/%s/test\",\n \"webhooklogs\": \"/webhooklogs\",\n \"webhooklogs-resend\": \"/webhooklogs/%s/resend\",\n \"history/us\": \"/history/userstory\",\n \"history/issue\": \"/history/issue\",\n \"history/task\": \"/history/task\",\n \"history/wiki\": \"/history/wiki\",\n \"attachments/us\": \"/userstories/attachments\",\n \"attachments/issue\": \"/issues/attachments\",\n \"attachments/task\": \"/tasks/attachments\",\n \"attachments/wiki_page\": \"/wiki/attachments\",\n \"feedback\": \"/feedback\",\n \"exporter\": \"/exporter\",\n \"importer\": \"/importer/load_dump\"\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 provider, providers, _i, _len, _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\", \"$tgMembershipsResourcesProvider\", \"$tgNotifyPoliciesResourcesProvider\", \"$tgInvitationsResourcesProvider\", \"$tgRolesResourcesProvider\", \"$tgUserSettingsResourcesProvider\", \"$tgSprintsResourcesProvider\", \"$tgUserstoriesResourcesProvider\", \"$tgTasksResourcesProvider\", \"$tgIssuesResourcesProvider\", \"$tgWikiResourcesProvider\", \"$tgSearchResourcesProvider\", \"$tgAttachmentsResourcesProvider\", \"$tgMdRenderResourcesProvider\", \"$tgHistoryResourcesProvider\", \"$tgKanbanResourcesProvider\", \"$tgModulesResourcesProvider\", \"$tgWebhooksResourcesProvider\", \"$tgWebhookLogsResourcesProvider\", initResources]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 __extends = 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(_super) {\n __extends(SearchController, _super);\n\n SearchController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$appTitle\", \"$tgNavUrls\", \"tgLoader\"];\n\n function SearchController(_at_scope, _at_repo, _at_rs, _at_params, _at_q, _at_location, _at_appTitle, _at_navUrls, _at_tgLoader) {\n var loadSearchData, promise;\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.tgLoader = _at_tgLoader;\n this.scope.sectionName = \"Search\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Search\");\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.searchTerm = \"\";\n loadSearchData = debounceLeading(100, (function(_this) {\n return function(t) {\n return _this.loadSearchData(t);\n };\n })(this));\n this.scope.$watch(\"searchTerm\", (function(_this) {\n return function(term) {\n if (!term) {\n return _this.tgLoader.pageLoaded();\n } else {\n return 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.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.membersById = groupBy(project.memberships, function(x) {\n return x.user;\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 var promise;\n promise = this.rs.search[\"do\"](this.scope.projectId, term).then((function(_this) {\n return function(data) {\n _this.scope.searchResults = data;\n return data;\n };\n })(this));\n promise[\"finally\"]((function(_this) {\n return function() {\n return _this.tgLoader.pageLoaded();\n };\n })(this));\n return 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.users, 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($lightboxService, $navurls, $location, $route) {\n var link;\n link = function($scope, $el, $attrs) {\n var 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.slug\n });\n $lightboxService.close($el);\n return $scope.$apply(function() {\n $location.path(url);\n $location.search(\"text\", text).path(url);\n return $route.reload();\n });\n };\n })(this));\n $scope.$on(\"search-box:show\", function(ctx, newProject) {\n project = newProject;\n $lightboxService.open($el);\n return $el.find(\"#search-text\").val(\"\");\n });\n $el.on(\"submit\", \"form\", submit);\n return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSearchBox\", [\"lightboxService\", \"$tgNavUrls\", \"$tgLocation\", \"$route\", SearchBoxDirective]);\n\n SearchDirective = function($log, $compile, $templatecache, $routeparams, $location) {\n var link, linkTable;\n linkTable = function($scope, $el, $attrs, $ctrl) {\n var getActiveSection, lastSeatchResults, markSectionTabActive, renderFilterTabs, renderTableContent, tabsDom, templates;\n tabsDom = $el.find(\"section.search-filter\");\n lastSeatchResults = null;\n getActiveSection = function(data) {\n var maxVal, name, selectedSectionData, selectedSectionName, value;\n maxVal = 0;\n selectedSectionName = null;\n selectedSectionData = null;\n for (name in data) {\n value = data[name];\n if (name === \"count\") {\n continue;\n }\n if (value.length > maxVal) {\n maxVal = value.length;\n selectedSectionName = name;\n selectedSectionData = value;\n }\n }\n if (maxVal === 0) {\n return {\n name: \"userstories\",\n value: []\n };\n }\n return {\n name: selectedSectionName,\n value: selectedSectionData\n };\n };\n renderFilterTabs = function(data) {\n var name, value, _results;\n _results = [];\n for (name in data) {\n value = data[name];\n if (name === \"count\") {\n continue;\n }\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 return tabsDom.find(\"li.\" + section.name + \" a\").addClass(\"active\");\n };\n templates = {\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 lastSeatchResults = data;\n activeSection = getActiveSection(data);\n renderFilterTabs(data);\n renderTableContent(activeSection);\n return markSectionTabActive(activeSection);\n });\n $scope.$watch(\"searchTerm\", function(searchTerm) {\n if (searchTerm) {\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 = lastSeatchResults[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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 __extends = 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(_super) {\n __extends(AnalyticsService, _super);\n\n AnalyticsService.$inject = [\"$rootScope\", \"$log\", \"$tgConfig\", \"$window\", \"$document\", \"$location\"];\n\n function AnalyticsService(_at_rootscope, _at_log, _at_config, _at_win, _at_doc, _at_location) {\n var conf;\n this.rootscope = _at_rootscope;\n this.log = _at_log;\n this.config = _at_config;\n this.win = _at_win;\n this.doc = _at_doc;\n this.location = _at_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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/attachments.coffee\n */\n\n(function() {\n var AttachmentDirective, AttachmentsController, AttachmentsDirective, bindMethods, bindOnce, module, sizeFormat, taiga,\n __extends = 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 sizeFormat = this.taiga.sizeFormat;\n\n bindOnce = this.taiga.bindOnce;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaCommon\");\n\n AttachmentsController = (function(_super) {\n __extends(AttachmentsController, _super);\n\n AttachmentsController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$q\"];\n\n function AttachmentsController(_at_scope, _at_rootscope, _at_repo, _at_rs, _at_confirm, _at_q) {\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.confirm = _at_confirm;\n this.q = _at_q;\n bindMethods(this);\n this.type = null;\n this.objectId = null;\n this.projectId = null;\n this.uploadingAttachments = [];\n this.attachments = [];\n this.attachmentsCount = 0;\n this.deprecatedAttachmentsCount = 0;\n this.showDeprecated = false;\n }\n\n AttachmentsController.prototype.initialize = function(type, objectId) {\n this.type = type;\n this.objectId = objectId;\n return this.projectId = this.scope.projectId;\n };\n\n AttachmentsController.prototype.loadAttachments = function() {\n var urlname;\n if (!this.objectId) {\n return this.attachments;\n }\n urlname = \"attachments/\" + this.type;\n return this.rs.attachments.list(urlname, this.objectId, this.projectId).then((function(_this) {\n return function(attachments) {\n _this.attachments = _.sortBy(attachments, \"order\");\n _this.updateCounters();\n return attachments;\n };\n })(this));\n };\n\n AttachmentsController.prototype.updateCounters = function() {\n this.attachmentsCount = this.attachments.length;\n return this.deprecatedAttachmentsCount = _.filter(this.attachments, {\n is_deprecated: true\n }).length;\n };\n\n AttachmentsController.prototype._createAttachment = function(attachment) {\n var promise, urlName;\n urlName = \"attachments/\" + this.type;\n promise = this.rs.attachments.create(urlName, this.projectId, this.objectId, attachment);\n promise = promise.then((function(_this) {\n return function(data) {\n var index;\n data.isCreatedRightNow = true;\n index = _this.uploadingAttachments.indexOf(attachment);\n _this.uploadingAttachments.splice(index, 1);\n _this.attachments.push(data);\n return _this.rootscope.$broadcast(\"attachment:create\");\n };\n })(this));\n promise = promise.then(null, (function(_this) {\n return function(data) {\n var index;\n if (data.status === 413) {\n _this.scope.$emit(\"attachments:size-error\");\n }\n index = _this.uploadingAttachments.indexOf(attachment);\n _this.uploadingAttachments.splice(index, 1);\n _this.confirm.notify(\"error\", \"We have not been able to upload '\" + attachment.name + \"'. \" + data.data._error_message);\n return _this.q.reject(data);\n };\n })(this));\n return promise;\n };\n\n AttachmentsController.prototype.createAttachments = function(attachments) {\n var promises;\n promises = _.map(attachments, (function(_this) {\n return function(x) {\n return _this._createAttachment(x);\n };\n })(this));\n return this.q.all(promises).then((function(_this) {\n return function() {\n return _this.updateCounters();\n };\n })(this));\n };\n\n AttachmentsController.prototype.addUploadingAttachments = function(attachments) {\n return this.uploadingAttachments = _.union(this.uploadingAttachments, attachments);\n };\n\n AttachmentsController.prototype.reorderAttachment = function(attachment, newIndex) {\n var oldIndex;\n oldIndex = this.attachments.indexOf(attachment);\n if (oldIndex === newIndex) {\n return;\n }\n this.attachments.splice(oldIndex, 1);\n this.attachments.splice(newIndex, 0, attachment);\n return _.each(this.attachments, function(x, i) {\n return x.order = i + 1;\n });\n };\n\n AttachmentsController.prototype.updateAttachment = function(attachment) {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.updateCounters();\n return _this.rootscope.$broadcast(\"attachment:edit\");\n };\n })(this);\n onError = (function(_this) {\n return function(response) {\n if (response.status === 413) {\n $scope.$emit(\"attachments:size-error\");\n }\n _this.confirm.notify(\"error\");\n return _this.q.reject();\n };\n })(this);\n return this.repo.save(attachment).then(onSuccess, onError);\n };\n\n AttachmentsController.prototype.saveAttachments = function() {\n return this.repo.saveAll(this.attachments).then(null, (function(_this) {\n return function() {\n var item, _i, _len, _ref;\n _ref = _this.attachments;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n item = _ref[_i];\n item.revert();\n }\n return _this.attachments = _.sortBy(_this.attachments, \"order\");\n };\n })(this));\n };\n\n AttachmentsController.prototype.removeAttachment = function(attachment) {\n var message, title;\n title = \"Delete attachment\";\n message = \"the attachment '\" + attachment.name + \"'\";\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var onError, onSuccess;\n onSuccess = function() {\n var index;\n finish();\n index = _this.attachments.indexOf(attachment);\n _this.attachments.splice(index, 1);\n _this.updateCounters();\n return _this.rootscope.$broadcast(\"attachment:delete\");\n };\n onError = function() {\n finish(false);\n _this.confirm.notify(\"error\", null, \"We have not been able to delete \" + message + \".\");\n return _this.q.reject();\n };\n return _this.repo.remove(attachment).then(onSuccess, onError);\n };\n })(this));\n };\n\n AttachmentsController.prototype.filterAttachments = function(item) {\n if (this.showDeprecated) {\n return true;\n }\n return !item.is_deprecated;\n };\n\n return AttachmentsController;\n\n })(taiga.Controller);\n\n AttachmentsDirective = function($config, $confirm, $templates) {\n var link, template, templateFn;\n template = $templates.get(\"attachment/attachments.html\", true);\n link = function($scope, $el, $attrs, $ctrls) {\n var $ctrl, $model, showSizeInfo, tdom;\n $ctrl = $ctrls[0];\n $model = $ctrls[1];\n bindOnce($scope, $attrs.ngModel, function(value) {\n $ctrl.initialize($attrs.type, value.id);\n return $ctrl.loadAttachments();\n });\n tdom = $el.find(\"div.attachment-body.sortable\");\n tdom.sortable({\n items: \"div.single-attachment\",\n handle: \"a.settings.icon.icon-drag-v\",\n containment: \".attachments\",\n dropOnEmpty: true,\n scroll: false,\n tolerance: \"pointer\",\n placeholder: \"sortable-placeholder single-attachment\"\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var attachment, newIndex;\n attachment = ui.item.scope().attach;\n newIndex = ui.item.index();\n $ctrl.reorderAttachment(attachment, newIndex);\n return $ctrl.saveAttachments().then(function() {\n return $scope.$emit(\"attachment:edit\");\n });\n });\n showSizeInfo = function() {\n return $el.find(\".size-info\").removeClass(\"hidden\");\n };\n $scope.$on(\"attachments:size-error\", function() {\n return showSizeInfo();\n });\n $el.on(\"change\", \".attachments-header input\", function(event) {\n var files;\n files = _.toArray(event.target.files);\n if (files.length < 1) {\n return;\n }\n return $scope.$apply(function() {\n $ctrl.addUploadingAttachments(files);\n return $ctrl.createAttachments(files);\n });\n });\n $el.on(\"click\", \".more-attachments\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n $scope.$apply(function() {\n return $ctrl.showDeprecated = !$ctrl.showDeprecated;\n });\n target.find(\"span.text\").addClass(\"hidden\");\n if ($ctrl.showDeprecated) {\n target.find(\"span[data-type=hide]\").removeClass(\"hidden\");\n return target.find(\"more-attachments-num\").addClass(\"hidden\");\n } else {\n target.find(\"span[data-type=show]\").removeClass(\"hidden\");\n return target.find(\"more-attachments-num\").removeClass(\"hidden\");\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n templateFn = function($el, $attrs) {\n var ctx, maxFileSize, maxFileSizeMsg;\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize) {\n maxFileSize = sizeFormat(maxFileSize);\n }\n maxFileSizeMsg = maxFileSize ? \"Maximum upload size is \" + maxFileSize : \"\";\n ctx = {\n type: $attrs.type,\n maxFileSize: maxFileSize,\n maxFileSizeMsg: maxFileSizeMsg\n };\n return template(ctx);\n };\n return {\n require: [\"tgAttachments\", \"ngModel\"],\n controller: AttachmentsController,\n controllerAs: \"ctrl\",\n restrict: \"AE\",\n scope: true,\n link: link,\n template: templateFn\n };\n };\n\n module.directive(\"tgAttachments\", [\"$tgConfig\", \"$tgConfirm\", \"$tgTemplate\", AttachmentsDirective]);\n\n AttachmentDirective = function($template) {\n var link, template, templateEdit;\n template = $template.get(\"attachment/attachment.html\", true);\n templateEdit = $template.get(\"attachment/attachment-edit.html\", true);\n link = function($scope, $el, $attrs, $ctrl) {\n var attachment, render, saveAttachment;\n render = function(attachment, edit) {\n var ctx, html, modifyPermission, permissions;\n if (edit == null) {\n edit = false;\n }\n permissions = $scope.project.my_permissions;\n modifyPermission = permissions.indexOf(\"modify_\" + $ctrl.type) > -1;\n ctx = {\n id: attachment.id,\n name: attachment.name,\n created_date: moment(attachment.created_date).format(\"DD MMM YYYY [at] hh:mm\"),\n url: attachment.url,\n size: sizeFormat(attachment.size),\n description: attachment.description,\n isDeprecated: attachment.is_deprecated,\n modifyPermission: modifyPermission\n };\n if (edit) {\n html = templateEdit(ctx);\n } else {\n html = template(ctx);\n }\n $el.html(html);\n if (attachment.is_deprecated) {\n $el.addClass(\"deprecated\");\n return $el.find(\"input:checkbox\").prop('checked', true);\n }\n };\n saveAttachment = function() {\n attachment.description = $el.find(\"input[name='description']\").val();\n attachment.is_deprecated = $el.find(\"input[name='is-deprecated']\").prop(\"checked\");\n return $scope.$apply(function() {\n return $ctrl.updateAttachment(attachment).then(function() {\n return render(attachment, false);\n });\n });\n };\n $el.on(\"click\", \"a.editable-settings.icon-floppy\", function(event) {\n event.preventDefault();\n return saveAttachment();\n });\n $el.on(\"keyup\", \"input[name=description]\", function(event) {\n if (event.keyCode === 13) {\n return saveAttachment();\n } else if (event.keyCode === 27) {\n return render(attachment, false);\n }\n });\n $el.on(\"click\", \"a.editable-settings.icon-delete\", function(event) {\n event.preventDefault();\n return render(attachment, false);\n });\n $el.on(\"click\", \"a.settings.icon-edit\", function(event) {\n event.preventDefault();\n render(attachment, true);\n return $el.find(\"input[name='description']\").focus().select();\n });\n $el.on(\"click\", \"a.settings.icon-delete\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n return $ctrl.removeAttachment(attachment);\n });\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n attachment = $scope.$eval($attrs.tgAttachment);\n render(attachment, attachment.isCreatedRightNow);\n if (attachment.isCreatedRightNow) {\n return $el.find(\"input[name='description']\").focus().select();\n }\n };\n return {\n link: link,\n require: \"^tgAttachments\",\n restrict: \"AE\"\n };\n };\n\n module.directive(\"tgAttachment\", [\"$tgTemplate\", AttachmentDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, EditableSubjectDirective, ListItemAssignedtoDirective, ListItemIssueStatusDirective, ListItemPriorityDirective, ListItemSeverityDirective, ListItemTaskStatusDirective, ListItemTypeDirective, ListItemUsStatusDirective, SprintProgressBarDirective, TgMainTitleDirective, TgProgressBarDirective, 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() {\n var link, renderRange;\n renderRange = function($el, first, second) {\n var endDate, initDate;\n initDate = moment(first).format(\"DD MMM YYYY\");\n endDate = moment(second).format(\"DD MMM YYYY\");\n return $el.html(initDate + \"-\" + endDate);\n };\n link = function($scope, $el, $attrs) {\n var first, second, _ref;\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\", DateRangeDirective);\n\n DateSelectorDirective = function() {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var selectedDate;\n selectedDate = null;\n $el.picker = new Pikaday({\n field: $el[0],\n format: \"DD MMM YYYY\",\n onSelect: (function(_this) {\n return function(date) {\n return selectedDate = date;\n };\n })(this),\n onOpen: (function(_this) {\n return function() {\n if (selectedDate != null) {\n return $el.picker.setDate(selectedDate);\n }\n };\n })(this)\n });\n return $scope.$watch($attrs.ngModel, function(val) {\n if (val != null) {\n return $el.picker.setDate(val);\n }\n });\n };\n return {\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgDateSelector\", 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 return 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 };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSprintProgressbar\", SprintProgressBarDirective);\n\n CreatedByDisplayDirective = function($template) {\n var link, template;\n template = $template.get(\"common/components/created-by.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(model) {\n var html, owner, _ref;\n owner = ((_ref = $scope.usersById) != null ? _ref[model.owner] : void 0) || {\n full_name_display: \"external user\",\n photo: \"/images/unnamed.png\"\n };\n html = template({\n owner: owner,\n date: moment(model.created_date).format(\"DD MMM YYYY HH:mm\")\n });\n return $el.html(html);\n };\n bindOnce($scope, $attrs.ngModel, function(model) {\n if (model != null) {\n return render(model);\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(\"tgCreatedByDisplay\", [\"$tgTemplate\", CreatedByDisplayDirective]);\n\n WatchersDirective = function($rootscope, $confirm, $repo, $qqueue, $template) {\n var link, template;\n template = $template.get(\"common/components/watchers.html\", true);\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 = $qqueue.bindAdd((function(_this) {\n return function(watchers) {\n var item, promise;\n item = $model.$modelValue.clone();\n item.watchers = watchers;\n $model.$setViewValue(item);\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n watchers = _.map(watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n renderWatchers(watchers);\n return $rootscope.$broadcast(\"history:reload\");\n });\n return promise.then(null, function() {\n return $model.$modelValue.revert();\n });\n };\n })(this));\n deleteWatcher = $qqueue.bindAdd((function(_this) {\n return function(watcherIds) {\n var item, promise;\n item = $model.$modelValue.clone();\n item.watchers = watcherIds;\n $model.$setViewValue(item);\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n var watchers;\n $confirm.notify(\"success\");\n watchers = _.map(item.watchers, function(watcherId) {\n return $scope.usersById[watcherId];\n });\n renderWatchers(watchers);\n return $rootscope.$broadcast(\"history:reload\");\n });\n return promise.then(null, function() {\n item.revert();\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n renderWatchers = function(watchers) {\n var ctx, html;\n ctx = {\n watchers: watchers,\n isEditable: isEditable()\n };\n html = template(ctx);\n $el.html(html);\n if (isEditable() && watchers.length === 0) {\n $el.find(\".title\").text(\"Add watchers\");\n return $el.find(\".watchers-header\").addClass(\"no-watchers\");\n }\n };\n $el.on(\"click\", \".icon-delete\", 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 = \"Delete watcher\";\n message = $scope.usersById[watcherId].full_name_display;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var watcherIds;\n finish();\n watcherIds = _.clone($model.$modelValue.watchers, false);\n watcherIds = _.pull(watcherIds, watcherId);\n return deleteWatcher(watcherIds);\n };\n })(this));\n });\n $el.on(\"click\", \".add-watcher\", function(event) {\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n return $scope.$apply(function() {\n return $rootscope.$broadcast(\"watcher:add\", $model.$modelValue);\n });\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 return renderWatchers(watchers);\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(\"tgWatchers\", [\"$rootScope\", \"$tgConfirm\", \"$tgRepo\", \"$tgQqueue\", \"$tgTemplate\", WatchersDirective]);\n\n AssignedToDirective = function($rootscope, $confirm, $repo, $loading, $qqueue, $template) {\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 = $qqueue.bindAdd((function(_this) {\n return function(userId) {\n var promise;\n $model.$modelValue.assigned_to = userId;\n $loading.start($el);\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $loading.finish($el);\n $confirm.notify(\"success\");\n renderAssignedTo($model.$modelValue);\n return $rootscope.$broadcast(\"history:reload\");\n });\n promise.then(null, function() {\n $model.$modelValue.revert();\n $confirm.notify(\"error\");\n return $loading.finish($el);\n });\n return promise;\n };\n })(this));\n renderAssignedTo = function(issue) {\n var assignedTo, assignedToId, ctx, html;\n assignedToId = issue != null ? issue.assigned_to : void 0;\n assignedTo = assignedToId != null ? $scope.usersById[assignedToId] : null;\n ctx = {\n assignedTo: assignedTo,\n isEditable: isEditable()\n };\n html = template(ctx);\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\", \".icon-delete\", function(event) {\n var title;\n event.preventDefault();\n if (!isEditable()) {\n return;\n }\n title = \"Are you sure you want to leave it unassigned?\";\n return $confirm.ask(title).then((function(_this) {\n return function(finish) {\n 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\", \"$tgQqueue\", \"$tgTemplate\", 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').hide();\n return $el.find('.item-unblock').show();\n } else {\n $el.find('.item-block').show();\n return $el.find('.item-unblock').hide();\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 finish;\n event.preventDefault();\n $loading.start($el.find(\".item-unblock\"));\n finish = function() {\n return $loading.finish($el.find(\".item-unblock\"));\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\", function(event) {\n var subtitle, title;\n title = $scope.$eval($attrs.onDeleteTitle);\n subtitle = $model.$modelValue.subject;\n return $confirm.askOnDelete(title, subtitle).then((function(_this) {\n return function(finish) {\n var promise;\n promise = $repo.remove($model.$modelValue);\n promise.then(function() {\n var url;\n finish();\n url = $scope.$eval($attrs.onDeleteGoToUrl);\n return $location.path(url);\n });\n return promise.then(null, function() {\n 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 EditableSubjectDirective = function($rootscope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"common/components/editable-subject.html\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(subject) {\n var promise;\n $model.$modelValue.subject = subject;\n $loading.start($el.find('.save-container'));\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"history:reload\");\n $el.find('.edit-subject').hide();\n return $el.find('.view-subject').show();\n });\n promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n promise[\"finally\"](function() {\n return $loading.finish($el.find('.save-container'));\n });\n return promise;\n };\n })(this));\n $el.click(function() {\n if (!isEditable()) {\n return;\n }\n $el.find('.edit-subject').show();\n $el.find('.view-subject').hide();\n return $el.find('input').focus();\n });\n $el.on(\"click\", \".save\", function() {\n var subject;\n subject = $scope.item.subject;\n return save(subject);\n });\n $el.on(\"keyup\", \"input\", function(event) {\n var subject;\n if (event.keyCode === 13) {\n subject = $scope.item.subject;\n return save(subject);\n } else if (event.keyCode === 27) {\n $scope.$apply((function(_this) {\n return function() {\n return $model.$modelValue.revert();\n };\n })(this));\n $el.find('div.edit-subject').hide();\n return $el.find('div.view-subject').show();\n }\n });\n $el.find('div.edit-subject').hide();\n $el.find('div.view-subject span.edit').hide();\n $scope.$watch($attrs.ngModel, function(value) {\n if (!value) {\n return;\n }\n $scope.item = value;\n if (!isEditable()) {\n return $el.find('.view-subject .edit').remove();\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(\"tgEditableSubject\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", EditableSubjectDirective]);\n\n EditableDescriptionDirective = function($rootscope, $repo, $confirm, $compile, $loading, $selectedText, $qqueue, $template) {\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 isEditable, save;\n $el.find('.edit-description').hide();\n $el.find('.view-description .edit').hide();\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(description) {\n var promise;\n $model.$modelValue.description = description;\n $loading.start($el.find('.save-container'));\n promise = $repo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"history:reload\");\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\n });\n promise.then(null, function() {\n return $confirm.notify(\"error\");\n });\n return promise[\"finally\"](function() {\n return $loading.finish($el.find('.save-container'));\n });\n };\n })(this));\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\", \".save\", function() {\n var description;\n description = $scope.item.description;\n return save(description);\n });\n $el.on(\"keydown\", \"textarea\", function(event) {\n if (event.keyCode === 27) {\n $scope.$apply((function(_this) {\n return function() {\n return $scope.item.revert();\n };\n })(this));\n $el.find('.edit-description').hide();\n return $el.find('.view-description').show();\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 = noDescriptionMegEditMode;\n } else {\n return $scope.noDescriptionMsg = noDescriptionMegReadMode;\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\", \"$tgQqueue\", \"$tgTemplate\", EditableDescriptionDirective]);\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 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 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 ListItemAssignedtoDirective = function($template) {\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, \"membersById\", function(membersById) {\n var ctx, item, member;\n item = $scope.$eval($attrs.tgListitemAssignedto);\n ctx = {\n name: \"Unassigned\",\n imgurl: \"/images/unnamed.png\"\n };\n member = membersById[item.assigned_to];\n if (member) {\n ctx.imgurl = member.photo;\n ctx.name = member.full_name;\n }\n return $el.html(template(ctx));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgListitemAssignedto\", [\"$tgTemplate\", ListItemAssignedtoDirective]);\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 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 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($template) {\n var link, render, template;\n template = $template.get(\"common/components/main-title.html\", true);\n render = function(el, projectName, sectionName) {\n return el.html(template({\n projectName: projectName,\n sectionName: sectionName\n }));\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch(\"project\", function(project) {\n if (project) {\n return render($el, project.name, $scope.sectionName);\n }\n });\n $scope.$on(\"project:loaded\", (function(_this) {\n return function(ctx, project) {\n return render($el, project.name, $scope.sectionName);\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(\"tgMainTitle\", [\"$tgTemplate\", TgMainTitleDirective]);\n\n module.directive(\"tgListitemType\", ListItemTypeDirective);\n\n module.directive(\"tgListitemIssueStatus\", ListItemIssueStatusDirective);\n\n module.directive(\"tgListitemSeverity\", ListItemSeverityDirective);\n\n module.directive(\"tgListitemTaskStatus\", ListItemTaskStatusDirective);\n\n module.directive(\"tgListitemUsStatus\", ListItemUsStatusDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 __extends = 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: \"Everything is ok\",\n message: \"Our Oompa Loompas saved all your changes!\"\n },\n \"error\": {\n title: \"Oops, something happened...\",\n message: \"Our Oompa Loompas are sad, your changes were not saved!\"\n },\n \"light-error\": {\n title: \"Oops, something happened...\",\n message: \"Our Oompa Loompas are sad, your changes were not saved!\"\n }\n };\n\n ConfirmService = (function(_super) {\n __extends(ConfirmService, _super);\n\n ConfirmService.$inject = [\"$q\", \"lightboxService\", \"$tgLoading\"];\n\n function ConfirmService(_at_q, _at_lightboxService, _at_loading) {\n this.q = _at_q;\n this.lightboxService = _at_lightboxService;\n this.loading = _at_loading;\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 el = angular.element(lightboxSelector);\n el.find(\"h2.title\").html(title);\n el.find(\"span.subtitle\").html(subtitle);\n el.find(\"span.message\").html(message);\n defered = this.q.defer();\n el.on(\"click.confirm-dialog\", \"a.button-green\", debounce(2000, (function(_this) {\n return function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n _this.loading.start(target);\n return defered.resolve(function(ok) {\n if (ok == null) {\n ok = true;\n }\n _this.loading.finish(target);\n if (ok) {\n return _this.hide(el);\n }\n });\n };\n })(this)));\n el.on(\"click.confirm-dialog\", \"a.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, \"Are you sure you want to 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 el = angular.element(lightboxSelector);\n el.find(\".title\").html(title);\n el.find(\".subtitle\").html(subtitle);\n if (replacement) {\n el.find(\".replacement\").html(replacement);\n } else {\n el.find(\".replacement\").remove();\n }\n if (warning) {\n el.find(\".warning\").html(warning);\n } else {\n el.find(\".warning\").remove();\n }\n choicesField = el.find(\".choices\");\n choicesField.html('');\n _.each(choices, function(value, key) {\n return choicesField.append(angular.element(\"\"));\n });\n defered = this.q.defer();\n el.on(\"click.confirm-dialog\", \"a.button-green\", debounce(2000, (function(_this) {\n return function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n _this.loading.start(target);\n return defered.resolve({\n selected: choicesField.val(),\n finish: function() {\n _this.loading.finish(target);\n return _this.hide(el);\n }\n });\n };\n })(this)));\n el.on(\"click.confirm-dialog\", \"a.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 el = angular.element(\".lightbox-generic-error\");\n el.find(\"h2.title\").html(message);\n defered = this.q.defer();\n el.on(\"click.confirm-dialog\", \"a.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\", \"a.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) {\n var defered, el;\n el = angular.element(\".lightbox-generic-success\");\n if (title) {\n el.find(\"h2.title\").html(title);\n }\n if (message) {\n el.find(\"p.message\").html(message);\n }\n defered = this.q.defer();\n el.on(\"click.confirm-dialog\", \"a.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\", \"a.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(\"h2.title\").html(title);\n }\n if (message) {\n el.find(\"p.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(\"h2.title\").html(title);\n }\n if (message) {\n el.find(\"p.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(NOTIFICATION_MSG[type].title);\n }\n if (message) {\n el.find(\"p\").html(message);\n } else {\n el.find(\"p\").html(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');\n return delete _this.tsem;\n };\n })(this));\n return el.on(\"click\", \".icon-delete\", (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 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 LbUsEstimationDirective, UsEstimationDirective, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n LbUsEstimationDirective = function($rootScope, $repo, $confirm, $template) {\n var link, mainTemplate, pointsTemplate;\n mainTemplate = $template.get(\"common/estimation/lb-us-estimation-points-per-role.html\", true);\n pointsTemplate = $template.get(\"common/estimation/lb-us-estimation-points.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var calculateTotalPoints, render, renderPoints;\n render = function(points) {\n var computableRoles, ctx, html, roles, totalPoints;\n totalPoints = calculateTotalPoints(points) || 0;\n computableRoles = _.filter($scope.project.roles, \"computable\");\n roles = _.map(computableRoles, function(role) {\n var pointId, pointObj;\n pointId = points[role.id];\n pointObj = $scope.pointsById[pointId];\n role = _.clone(role, true);\n role.points = (pointObj != null) && (pointObj.name != null) ? pointObj.name : \"?\";\n return role;\n });\n ctx = {\n totalPoints: totalPoints,\n roles: roles\n };\n html = mainTemplate(ctx);\n return $el.html(html);\n };\n renderPoints = function(target, usPoints, roleId) {\n var html, points;\n points = _.map($scope.project.points, function(point) {\n point = _.clone(point, true);\n point.selected = usPoints[roleId] === point.id ? false : true;\n return point;\n });\n html = pointsTemplate({\n \"points\": points,\n roleId: roleId\n });\n $el.find(\".popover\").popover().close();\n $el.find(\".pop-points-open\").remove();\n if ($el.find(\".pop-role:visible\").css(\"left\") == null) {\n $el.find(\".pop-points-open\").css(\"left\", \"110px\");\n }\n $el.find(\".pop-points-open\").remove();\n $el.find(target).append(html);\n $el.find(\".pop-points-open\").popover().open(function() {\n return $(this).removeClass(\"active\");\n });\n return $el.find(\".pop-points-open\").show();\n };\n calculateTotalPoints = function(points) {\n var values;\n values = _.map(points, function(v, k) {\n var _ref;\n return ((_ref = $scope.pointsById[v]) != null ? _ref.value : void 0) || 0;\n });\n if (values.length === 0) {\n return \"0\";\n }\n return _.reduce(values, function(acc, num) {\n return acc + num;\n });\n };\n $el.on(\"click\", \".total.clickable\", function(event) {\n var points, roleId, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n points = $model.$modelValue;\n renderPoints(target, points, roleId);\n target.siblings().removeClass('active');\n return target.addClass('active');\n });\n $el.on(\"click\", \".point\", 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 $el.find(\".popover\").popover().close();\n points = _.clone($model.$modelValue, true);\n points[roleId] = pointId;\n return $scope.$apply(function() {\n return $model.$setViewValue(points);\n });\n });\n $scope.$watch($attrs.ngModel, function(points) {\n if (points) {\n return render(points);\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\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgTemplate\", LbUsEstimationDirective]);\n\n UsEstimationDirective = function($rootScope, $repo, $confirm, $qqueue, $template) {\n var link, mainTemplate, pointsTemplate;\n mainTemplate = $template.get(\"common/estimation/us-estimation-points-per-role.html\", true);\n pointsTemplate = $template.get(\"common/estimation/us-estimation-points.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var calculateTotalPoints, isEditable, render, renderPoints, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = function(us) {\n var computableRoles, ctx, html, roles, totalPoints;\n totalPoints = us.total_points != null ? us.total_points : \"?\";\n computableRoles = _.filter($scope.project.roles, \"computable\");\n roles = _.map(computableRoles, function(role) {\n var pointId, pointObj;\n pointId = us.points[role.id];\n pointObj = $scope.pointsById[pointId];\n role = _.clone(role, true);\n role.points = (pointObj != null) && (pointObj.name != null) ? pointObj.name : \"?\";\n return role;\n });\n ctx = {\n totalPoints: totalPoints,\n roles: roles,\n editable: isEditable()\n };\n html = mainTemplate(ctx);\n return $el.html(html);\n };\n renderPoints = function(target, us, roleId) {\n var html, points;\n points = _.map($scope.project.points, function(point) {\n point = _.clone(point, true);\n point.selected = us.points[roleId] === point.id ? false : true;\n return point;\n });\n html = pointsTemplate({\n \"points\": points,\n roleId: roleId\n });\n $el.find(\".popover\").popover().close();\n $el.find(\".pop-points-open\").remove();\n if ($el.find(\".pop-role:visible\").css(\"left\") == null) {\n $el.find(\".pop-points-open\").css(\"left\", \"110px\");\n }\n $el.find(\".pop-points-open\").remove();\n $el.find(target).append(html);\n $el.find(\".pop-points-open\").popover().open(function() {\n return $(this).removeClass(\"active\").closest(\"li\").removeClass(\"active\");\n });\n return $el.find(\".pop-points-open\").show();\n };\n calculateTotalPoints = function(us) {\n var notNullValues, values;\n values = _.map(us.points, function(v, k) {\n var _ref;\n return (_ref = $scope.pointsById[v]) != null ? _ref.value : void 0;\n });\n if (values.length === 0) {\n return \"0\";\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 save = $qqueue.bindAdd((function(_this) {\n return function(roleId, pointId) {\n var onError, onSuccess, points, us;\n $el.find(\".popover\").popover().close();\n us = angular.copy($model.$modelValue);\n points = _.clone($model.$modelValue.points, true);\n points[roleId] = pointId;\n us.setAttr('points', points);\n us.points = points;\n us.total_points = calculateTotalPoints(us);\n $model.$setViewValue(us);\n onSuccess = function() {\n $confirm.notify(\"success\");\n return $rootScope.$broadcast(\"history:reload\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n us.revert();\n return $model.$setViewValue(us);\n };\n return $repo.save($model.$modelValue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".total.clickable\", function(event) {\n var roleId, target, us;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n us = $model.$modelValue;\n renderPoints(target, us, roleId);\n target.siblings().removeClass('active');\n return target.addClass('active');\n });\n $el.on(\"click\", \".point\", function(event) {\n var pointId, roleId, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n roleId = target.data(\"role-id\");\n pointId = target.data(\"point-id\");\n return save(roleId, pointId);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\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\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgQqueue\", \"$tgTemplate\", UsEstimationDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 defaultFilter, module, momentFormat, momentFromNow, taiga, 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() {\n return function(value) {\n if (value) {\n return \"Yes\";\n }\n return \"No\";\n };\n };\n\n module.filter(\"yesNo\", 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}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/history.coffee\n */\n\n(function() {\n var HistoryController, HistoryDirective, bindOnce, debounce, module, taiga, trim,\n __extends = 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 trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaCommon\");\n\n HistoryController = (function(_super) {\n __extends(HistoryController, _super);\n\n HistoryController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\"];\n\n function HistoryController(_at_scope, _at_repo, _at_rs) {\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n }\n\n HistoryController.prototype.initialize = function(type, objectId) {\n this.type = type;\n return this.objectId = objectId;\n };\n\n HistoryController.prototype.loadHistory = function(type, objectId) {\n return this.rs.history.get(type, objectId).then((function(_this) {\n return function(history) {\n var historyResult, _i, _len;\n for (_i = 0, _len = history.length; _i < _len; _i++) {\n historyResult = history[_i];\n if (historyResult.values_diff.description_diff != null) {\n historyResult.values_diff.description = historyResult.values_diff.description_diff;\n }\n delete historyResult.values_diff.description_html;\n delete historyResult.values_diff.description_diff;\n }\n _this.scope.history = history;\n return _this.scope.comments = _.filter(history, function(item) {\n return item.comment !== \"\";\n });\n };\n })(this));\n };\n\n HistoryController.prototype.deleteComment = function(type, objectId, activityId) {\n return this.rs.history.deleteComment(type, objectId, activityId).then((function(_this) {\n return function() {\n return _this.loadHistory(type, objectId);\n };\n })(this));\n };\n\n HistoryController.prototype.undeleteComment = function(type, objectId, activityId) {\n return this.rs.history.undeleteComment(type, objectId, activityId).then((function(_this) {\n return function() {\n return _this.loadHistory(type, objectId);\n };\n })(this));\n };\n\n return HistoryController;\n\n })(taiga.Controller);\n\n HistoryDirective = function($log, $loading, $qqueue, $template, $confirm) {\n var link, templateActivity, templateBase, templateBaseEntries, templateChangeAttachment, templateChangeDiff, templateChangeGeneric, templateChangePoints, templateDeletedComment, templateFn;\n templateChangeDiff = $template.get(\"common/history/history-change-diff.html\", true);\n templateChangePoints = $template.get(\"common/history/history-change-points.html\", true);\n templateChangeGeneric = $template.get(\"common/history/history-change-generic.html\", true);\n templateChangeAttachment = $template.get(\"common/history/history-change-attachment.html\", true);\n templateDeletedComment = $template.get(\"common/history/history-deleted-comment.html\", true);\n templateActivity = $template.get(\"common/history/history-activity.html\", true);\n templateBaseEntries = $template.get(\"common/history/history-base-entries.html\", true);\n templateBase = $template.get(\"common/history/history-base.html\", true);\n link = function($scope, $el, $attrs, $ctrl) {\n var countChanges, formatChange, getHumanizedFieldName, getUserAvatar, getUserFullName, objectId, renderActivity, renderAttachmentEntry, renderChange, renderChangeEntries, renderChangeEntry, renderChangesHelperText, renderComment, renderComments, renderHistory, save, showAllActivity, showAllComments, type;\n type = $attrs.type;\n objectId = null;\n showAllComments = false;\n showAllActivity = false;\n bindOnce($scope, $attrs.ngModel, function(model) {\n type = $attrs.type;\n objectId = model.id;\n $ctrl.initialize(type, objectId);\n return $ctrl.loadHistory(type, objectId);\n });\n getHumanizedFieldName = function(field) {\n var humanizedFieldNames;\n humanizedFieldNames = {\n assigned_to: \"assigned to\",\n is_closed: \"is closed\",\n finish_date: \"finish date\",\n client_requirement: \"client requirement\",\n team_requirement: \"team requirement\",\n milestone: \"sprint\",\n user_story: \"user story\",\n is_iocaine: \"is iocaine\",\n is_deprecated: \"is deprecated\"\n };\n return humanizedFieldNames[field] || field;\n };\n getUserFullName = function(userId) {\n var _ref;\n return (_ref = $scope.usersById[userId]) != null ? _ref.full_name_display : void 0;\n };\n getUserAvatar = function(userId) {\n if ($scope.usersById[userId] != null) {\n return $scope.usersById[userId].photo;\n } else {\n return \"/images/unnamed.png\";\n }\n };\n countChanges = function(comment) {\n return _.keys(comment.values_diff).length;\n };\n formatChange = function(change) {\n if (_.isArray(change)) {\n if (change.length === 0) {\n return \"nil\";\n }\n return change.join(\", \");\n }\n if (change === \"\") {\n return \"nil\";\n }\n if (change === true) {\n return \"yes\";\n }\n if (change === false) {\n return \"no\";\n }\n return change;\n };\n renderAttachmentEntry = function(value) {\n var attachments;\n attachments = _.map(value, function(changes, type) {\n if (type === \"new\") {\n return _.map(changes, function(change) {\n return templateChangeDiff({\n name: \"new attachment\",\n diff: change.filename\n });\n });\n } else if (type === \"deleted\") {\n return _.map(changes, function(change) {\n return templateChangeDiff({\n name: \"deleted attachment\",\n diff: change.filename\n });\n });\n } else {\n return _.map(changes, function(change) {\n var diff, name;\n name = \"updated attachment \" + change.filename;\n diff = _.map(change.changes, function(values, name) {\n return {\n name: getHumanizedFieldName(name),\n from: formatChange(values[0]),\n to: formatChange(values[1])\n };\n });\n return templateChangeAttachment({\n name: name,\n diff: diff\n });\n });\n }\n });\n return _.flatten(attachments).join(\"\\n\");\n };\n renderChangeEntry = function(field, value) {\n var from, name, to;\n if (field === \"description\") {\n return templateChangeDiff({\n name: \"description\",\n diff: value[1]\n });\n } else if (field === \"points\") {\n return templateChangePoints({\n points: value\n });\n } else if (field === \"attachments\") {\n return renderAttachmentEntry(value);\n } else if (field === \"assigned_to\") {\n name = getHumanizedFieldName(field);\n from = formatChange(value[0] || \"Unassigned\");\n to = formatChange(value[1] || \"Unassigned\");\n return templateChangeGeneric({\n name: name,\n from: from,\n to: to\n });\n } else {\n name = getHumanizedFieldName(field);\n from = formatChange(value[0]);\n to = formatChange(value[1]);\n return templateChangeGeneric({\n name: name,\n from: from,\n to: to\n });\n }\n };\n renderChangeEntries = function(change) {\n return _.map(change.values_diff, function(value, field) {\n return renderChangeEntry(field, value);\n });\n };\n renderChangesHelperText = function(change) {\n var size;\n size = countChanges(change);\n if (size === 1) {\n return \"Made \" + size + \" change\";\n }\n return \"Made \" + size + \" changes\";\n };\n renderComment = function(comment) {\n var _ref, _ref1;\n if (comment.delete_comment_date || ((_ref = comment.delete_comment_user) != null ? _ref.name : void 0)) {\n return templateDeletedComment({\n deleteCommentDate: comment.delete_comment_date ? moment(comment.delete_comment_date).format(\"DD MMM YYYY HH:mm\") : void 0,\n deleteCommentUser: comment.delete_comment_user.name,\n deleteComment: comment.comment_html,\n activityId: comment.id,\n canRestoreComment: comment.delete_comment_user.pk === $scope.user.id || $scope.project.my_permissions.indexOf(\"modify_project\") > -1\n });\n }\n return templateActivity({\n avatar: getUserAvatar(comment.user.pk),\n userFullName: comment.user.name,\n creationDate: moment(comment.created_at).format(\"DD MMM YYYY HH:mm\"),\n comment: comment.comment_html,\n changesText: renderChangesHelperText(comment),\n changes: renderChangeEntries(comment),\n mode: \"comment\",\n deleteCommentDate: comment.delete_comment_date ? moment(comment.delete_comment_date).format(\"DD MMM YYYY HH:mm\") : void 0,\n deleteCommentUser: ((_ref1 = comment.delete_comment_user) != null ? _ref1.name : void 0) ? comment.delete_comment_user.name : void 0,\n activityId: comment.id,\n canDeleteComment: comment.user.pk === $scope.user.id || $scope.project.my_permissions.indexOf(\"modify_project\") > -1\n });\n };\n renderChange = function(change) {\n var _ref;\n return templateActivity({\n avatar: getUserAvatar(change.user.pk),\n userFullName: change.user.name,\n creationDate: moment(change.created_at).format(\"DD MMM YYYY HH:mm\"),\n comment: change.comment_html,\n changes: renderChangeEntries(change),\n changesText: \"\",\n mode: \"activity\",\n deleteCommentDate: change.delete_comment_date ? moment(change.delete_comment_date).format(\"DD MMM YYYY HH:mm\") : void 0,\n deleteCommentUser: ((_ref = change.delete_comment_user) != null ? _ref.name : void 0) ? change.delete_comment_user.name : void 0,\n activityId: change.id\n });\n };\n renderHistory = function(entries, totalEntries) {\n var showMore;\n if (entries.length === totalEntries) {\n showMore = 0;\n } else {\n showMore = totalEntries - entries.length;\n }\n return templateBaseEntries({\n entries: entries,\n showMore: showMore\n });\n };\n renderComments = function() {\n var comments, html, totalComments;\n comments = $scope.comments || [];\n totalComments = comments.length;\n if (!showAllComments) {\n comments = _.last(comments, 4);\n }\n comments = _.map(comments, function(x) {\n return renderComment(x);\n });\n html = renderHistory(comments, totalComments);\n return $el.find(\".comments-list\").html(html);\n };\n renderActivity = function() {\n var changes, html, totalChanges;\n changes = $scope.history || [];\n totalChanges = changes.length;\n if (!showAllActivity) {\n changes = _.last(changes, 4);\n }\n changes = _.map(changes, function(x) {\n return renderChange(x);\n });\n html = renderHistory(changes, totalChanges);\n return $el.find(\".changes-list\").html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(target) {\n var model, onError, onSuccess;\n $scope.$broadcast(\"markdown-editor:submit\");\n $el.find(\".comment-list\").addClass(\"activeanimation\");\n onSuccess = function() {\n return $ctrl.loadHistory(type, objectId)[\"finally\"](function() {\n return $loading.finish(target);\n });\n };\n onError = function() {\n $loading.finish(target);\n return $confirm.notify(\"error\");\n };\n model = $scope.$eval($attrs.ngModel);\n $loading.start(target);\n return $ctrl.repo.save(model).then(onSuccess, onError);\n };\n })(this));\n $scope.$watch(\"comments\", renderComments);\n $scope.$watch(\"history\", renderActivity);\n $scope.$on(\"history:reload\", function() {\n return $ctrl.loadHistory(type, objectId);\n });\n $el.on(\"click\", \".add-comment a.button-green\", debounce(2000, function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return save(target);\n }));\n $el.on(\"click\", \".show-more\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n if (target.parent().is(\".changes-list\")) {\n showAllActivity = !showAllActivity;\n return renderActivity();\n } else {\n showAllComments = !showAllComments;\n return renderComments();\n }\n });\n $el.on(\"click\", \".show-deleted-comment\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.parents('.activity-single').find('.hide-deleted-comment').show();\n target.parents('.activity-single').find('.show-deleted-comment').hide();\n return target.parents('.activity-single').find('.comment-body').show();\n });\n $el.on(\"click\", \".hide-deleted-comment\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.parents('.activity-single').find('.hide-deleted-comment').hide();\n target.parents('.activity-single').find('.show-deleted-comment').show();\n return target.parents('.activity-single').find('.comment-body').hide();\n });\n $el.on(\"click\", \".changes-title\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return target.parent().find(\".change-entry\").toggleClass(\"active\");\n });\n $el.on(\"focus\", \".add-comment textarea\", function(event) {\n return $(this).addClass('active');\n });\n $el.on(\"click\", \".history-tabs li a\", function(event) {\n $el.find(\".history-tabs li a\").toggleClass(\"active\");\n return $el.find(\".history section\").toggleClass(\"hidden\");\n });\n $el.on(\"click\", \".comment-delete\", debounce(2000, function(event) {\n var activityId, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n activityId = target.data('activity-id');\n return $ctrl.deleteComment(type, objectId, activityId);\n }));\n $el.on(\"click\", \".comment-restore\", debounce(2000, function(event) {\n var activityId, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n activityId = target.data('activity-id');\n return $ctrl.undeleteComment(type, objectId, activityId);\n }));\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n templateFn = function($el, $attrs) {\n return templateBase({\n ngmodel: $attrs.ngModel,\n type: $attrs.type,\n mode: $attrs.mode\n });\n };\n return {\n controller: HistoryController,\n template: templateFn,\n restrict: \"AE\",\n link: link\n };\n };\n\n module.directive(\"tgHistory\", [\"$log\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", \"$tgConfirm\", HistoryDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, module;\n\n module = angular.module(\"taigaCommon\");\n\n ImportProjectButtonDirective = function($rs, $confirm, $location, $navUrls) {\n var link;\n link = function($scope, $el, $attrs) {\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(\"Uploading dump file\");\n onSuccess = function(result) {\n var ctx, message, title;\n loader.stop();\n if (result.status === 202) {\n title = \"Our Oompa Loompas are importing your project\";\n message = \"This process could take a few minutes
We will send you an email when ready\";\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 return $confirm.notify(\"success\", \"Your project has been imported successfuly.\");\n }\n };\n onError = function(result) {\n var errorMsg, _ref;\n loader.stop();\n console.log(\"Error\", result);\n errorMsg = \"Our oompa loompas have some problems importing your dump data. Please try again. \";\n if (result.status === 429) {\n errorMsg = \"Sorry, our oompa loompas are very busy right now. Please try again in a few minutes. \";\n } else if ((_ref = result.data) != null ? _ref._error_message : void 0) {\n errorMsg = \"Our oompa loompas have some problems importing your dump data: \" + result.data._error_message;\n }\n return $confirm.notify(\"error\", errorMsg);\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\", ImportProjectButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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, LightboxService, NotionButtonDirective, NotionLightboxDirective, WatchersLightboxDirective, bindOnce, debounce, module, timeout,\n __extends = 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 module = angular.module(\"taigaCommon\");\n\n bindOnce = this.taiga.bindOnce;\n\n timeout = this.taiga.timeout;\n\n debounce = this.taiga.debounce;\n\n LightboxService = (function(_super) {\n __extends(LightboxService, _super);\n\n function LightboxService(_at_animationFrame) {\n this.animationFrame = _at_animationFrame;\n }\n\n LightboxService.prototype.open = function($el) {\n var docEl, lightboxContent;\n lightboxContent = $el.children().not(\".close\");\n lightboxContent.hide();\n $el.css('display', 'flex');\n $el.find('input,textarea').first().focus();\n this.animationFrame.add((function(_this) {\n return function() {\n $el.addClass(\"open\");\n return lightboxContent.show();\n };\n })(this));\n docEl = angular.element(document);\n return 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 };\n\n LightboxService.prototype.close = function($el) {\n var docEl;\n docEl = angular.element(document);\n docEl.off(\".lightbox\");\n docEl.off(\".keyboard-navigation\");\n $el.one(\"transitionend\", (function(_this) {\n return function() {\n $el.removeAttr('style');\n return $el.removeClass(\"open\").removeClass('close');\n };\n })(this));\n return $el.addClass('close');\n };\n\n LightboxService.prototype.closeAll = function() {\n var docEl, lightboxEl, _i, _len, _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\", LightboxService]);\n\n LightboxKeyboardNavigationService = (function(_super) {\n __extends(LightboxKeyboardNavigationService, _super);\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(\".active\");\n if (code === 13) {\n return activeElement.trigger(\"click\");\n } else if (code === 40) {\n if (!activeElement.length) {\n return $el.find('.watcher-single:first').addClass('active');\n } else {\n next = activeElement.next('.watcher-single');\n if (next.length) {\n activeElement.removeClass('active');\n return next.addClass('active');\n }\n }\n } else if (code === 38) {\n if (!activeElement.length) {\n return $el.find('.watcher-single:last').addClass('active');\n } else {\n prev = activeElement.prev('.watcher-single');\n if (prev.length) {\n activeElement.removeClass('active');\n return prev.addClass('active');\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, $qqueue) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var block, unblock;\n $el.find(\"h2.title\").text($attrs.title);\n unblock = $qqueue.bindAdd((function(_this) {\n return function(item, finishCallback) {\n var promise;\n promise = $tgrepo.save(item);\n promise.then(function() {\n $confirm.notify(\"success\");\n $rootscope.$broadcast(\"history:reload\");\n $model.$setViewValue(item);\n return finishCallback();\n });\n promise.then(null, function() {\n $confirm.notify(\"error\");\n item.revert();\n return $model.$setViewValue(item);\n });\n promise[\"finally\"](function() {\n return finishCallback();\n });\n return promise;\n };\n })(this));\n block = $qqueue.bindAdd((function(_this) {\n return function(item) {\n var promise;\n $model.$setViewValue(item);\n $loading.start($el.find(\".button-green\"));\n promise = $tgrepo.save($model.$modelValue);\n promise.then(function() {\n $confirm.notify(\"success\");\n return $rootscope.$broadcast(\"history:reload\");\n });\n promise.then(null, function() {\n $confirm.notify(\"error\");\n item.revert();\n return $model.$setViewValue(item);\n });\n return promise[\"finally\"](function() {\n $loading.finish($el.find(\".button-green\"));\n return lightboxService.close($el);\n });\n };\n })(this));\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 var item;\n item = $model.$modelValue.clone();\n item.is_blocked = false;\n item.blocked_note = \"\";\n return unblock(item, finishCallback);\n };\n })(this));\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return $el.on(\"click\", \".button-green\", function(event) {\n var item;\n event.preventDefault();\n item = $model.$modelValue.clone();\n item.is_blocked = true;\n item.blocked_note = $el.find(\".reason\").val();\n return block(item);\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\", \"$tgQqueue\", BlockLightboxDirective]);\n\n BlockingMessageInputDirective = function($log, $template) {\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\", BlockingMessageInputDirective]);\n\n CreateEditUserstoryDirective = function($repo, $model, $rs, $rootScope, lightboxService, $loading) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.isNew = true;\n $scope.$on(\"usform:new\", function(ctx, projectId, status, statusList) {\n $scope.isNew = true;\n $scope.usStatusList = statusList;\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(\"Create\");\n $el.find(\".title\").html(\"New user story \");\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 return lightboxService.open($el);\n });\n $scope.$on(\"usform:edit\", function(ctx, us) {\n $scope.us = us;\n $scope.isNew = false;\n $el.find(\".button-green\").html(\"Save\");\n $el.find(\".title\").html(\"Edit user story \");\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 return lightboxService.open($el);\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, form, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n if ($scope.isNew) {\n promise = $repo.create(\"userstories\", $scope.us);\n broadcastEvent = \"usform:new:success\";\n } else {\n promise = $repo.save($scope.us);\n broadcastEvent = \"usform:edit:success\";\n }\n promise.then(function(data) {\n $loading.finish(submitButton);\n lightboxService.close($el);\n return $rootScope.$broadcast(broadcastEvent, data);\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\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\", \".submit-button\", 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\", CreateEditUserstoryDirective]);\n\n CreateBulkUserstoriesDirective = function($repo, $rs, $rootscope, lightboxService, $loading) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.$on(\"usform:bulk\", function(ctx, projectId, status) {\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 form, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley({\n onlyOneErrorElement: true\n });\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n promise = $rs.userstories.bulkCreate($scope[\"new\"].projectId, $scope[\"new\"].statusId, $scope[\"new\"].bulk);\n promise.then(function(result) {\n $loading.finish(submitButton);\n $rootscope.$broadcast(\"usform:bulk:success\", result);\n return lightboxService.close($el);\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\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\", \".submit-button\", 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\", CreateBulkUserstoriesDirective]);\n\n AssignedToLightboxDirective = function(lightboxService, lightboxKeyboardNavigationService, $template) {\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 _.contains(username, text);\n };\n render = function(selected, text) {\n var ctx, html, users;\n $el.find(\"input\").focus();\n users = _.clone($scope.activeUsers, true);\n if (selected != null) {\n users = _.reject(users, {\n \"id\": selected.id\n });\n }\n if (text != null) {\n users = _.filter(users, _.partial(filterUsers, text));\n }\n ctx = {\n selected: selected,\n users: _.first(users, 5),\n showMore: users.length > 5\n };\n html = usersTemplate(ctx);\n $el.find(\"div.watchers\").html(html);\n return lightboxKeyboardNavigationService.init($el);\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 lightboxService.open($el);\n return $el.find('input').focus();\n });\n $scope.$watch(\"usersSearch\", function(searchingText) {\n if (searchingText != null) {\n return render(selectedUser, searchingText);\n }\n });\n $el.on(\"click\", \".watcher-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\", AssignedToLightboxDirective]);\n\n WatchersLightboxDirective = function($repo, lightboxService, lightboxKeyboardNavigationService, $template) {\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 users, _filterUsers;\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 _.contains(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;\n $el.find(\"input\").focus();\n ctx = {\n selected: false,\n users: _.first(users, 5),\n showMore: users.length > 5\n };\n html = usersTemplate(ctx);\n return $el.find(\"div.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 lightboxService.open($el);\n return lightboxKeyboardNavigationService.init($el);\n });\n $scope.$watch(\"usersSearch\", function(searchingText) {\n var users;\n if (searchingText == null) {\n return;\n }\n users = getFilteredUsers(searchingText);\n return render(users);\n });\n $el.on(\"click\", \".watcher-single\", debounce(2000, 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\", WatchersLightboxDirective]);\n\n NotionLightboxDirective = function(lightboxService) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $scope.$on(\"notion:open\", function(event, lightboxId) {\n if ($el.attr(\"id\") === lightboxId) {\n return lightboxService.open($el);\n }\n });\n $el.on(\"click\", \".button-green\", function(event) {\n return lightboxService.close($el);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbNotion\", [\"lightboxService\", NotionLightboxDirective]);\n\n NotionButtonDirective = function($log, $rootScope) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n if ($attrs.tgLbNotionButton == null) {\n return $log.error(\"NotionButtonDirective: the directive need the id of the notion lightbox\");\n }\n $el.on(\"click\", function() {\n return $rootScope.$broadcast(\"notion:open\", $attrs.tgLbNotionButton);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbNotionButton\", [\"$log\", \"$rootScope\", NotionButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \n * Copyright (C) 2014 Juan Francisco Alcántara \n * Copyright (C) 2014 Alejandro Alonso \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 tgLoader.onEnd(function() {\n $(document.body).removeClass(\"loader-active\");\n return $el.removeClass(\"active\");\n });\n $rootscope.$on(\"$routeChangeSuccess\", function(e) {\n return tgLoader.startCurrentPageLoader();\n });\n return $rootscope.$on(\"$locationChangeSuccess\", function(e) {\n return tgLoader.reset();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLoader\", [\"tgLoader\", \"$rootScope\", LoaderDirective]);\n\n Loader = function() {\n var config, defaultConfig, forceDisabled;\n forceDisabled = false;\n defaultConfig = {\n enabled: false,\n minTime: 300\n };\n config = _.merge({}, defaultConfig);\n this.add = function() {\n return function() {\n if (!forceDisabled) {\n return config.enabled = true;\n }\n };\n };\n this.$get = [\n \"$rootScope\", function($rootscope) {\n var pageLoaded, reset, start, startLoadTime;\n startLoadTime = 0;\n reset = function() {\n return config = _.merge({}, defaultConfig);\n };\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 return timeout(timeoutValue, function() {\n return $rootscope.$broadcast(\"loader:end\");\n });\n }\n };\n start = function() {\n startLoadTime = new Date().getTime();\n return $rootscope.$broadcast(\"loader:start\");\n };\n return {\n reset: reset,\n pageLoaded: pageLoaded,\n start: start,\n startCurrentPageLoader: function() {\n if (config.enabled) {\n return start();\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 preventLoading: function() {\n return forceDisabled = true;\n },\n disablePreventLoading: function() {\n return forceDisabled = false;\n }\n };\n }\n ];\n };\n\n module.provider(\"tgLoader\", [Loader]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var TgLoadingService, module,\n __extends = 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 module = angular.module(\"taigaCommon\");\n\n TgLoadingService = (function(_super) {\n __extends(TgLoadingService, _super);\n\n function TgLoadingService() {\n return TgLoadingService.__super__.constructor.apply(this, arguments);\n }\n\n TgLoadingService.prototype.start = function(target) {\n if (!target.hasClass('loading')) {\n target.data('loading-old-content', target.html());\n target.addClass('loading');\n return target.html(\"loading...\");\n }\n };\n\n TgLoadingService.prototype.finish = function(target) {\n var oldContent;\n if (target.hasClass('loading')) {\n oldContent = target.data('loading-old-content');\n target.data('loading-old-content', null);\n target.html(oldContent);\n return target.removeClass('loading');\n }\n };\n\n return TgLoadingService;\n\n })(taiga.Service);\n\n module.service(\"$tgLoading\", TgLoadingService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/popovers.coffee\n */\n\n(function() {\n var RelatedTaskStatusDirective, UsStatusDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaCommon\");\n\n UsStatusDirective = function($repo, $template) {\n\n /*\n Print the status of a US and a popover to change it.\n - tg-us-status: The user story\n - on-update: Method call after US is updated\n \n Example:\n \n div.status(tg-us-status=\"us\" on-update=\"ctrl.loadSprintState()\")\n a.us-status(href=\"\", title=\"Status Name\")\n \n NOTE: This directive need 'usStatusById' and 'project'.\n */\n var link, template;\n template = $template.get(\"common/popover/popover-us-status.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, render, us;\n $ctrl = $el.controller();\n render = function(us) {\n var usStatusById, usStatusDom, usStatusDomParent;\n usStatusDomParent = $el.find(\".us-status\");\n usStatusDom = $el.find(\".us-status .us-status-bind\");\n usStatusById = $scope.usStatusById;\n if (usStatusById[us.status]) {\n usStatusDom.text(usStatusById[us.status].name);\n return usStatusDomParent.css(\"color\", usStatusById[us.status].color);\n }\n };\n $el.on(\"click\", \".us-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", debounce(2000, function(event) {\n var target, us;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n us = $scope.$eval($attrs.tgUsStatus);\n us.status = target.data(\"status-id\");\n render(us);\n $el.find(\".pop-status\").popover().close();\n return $scope.$apply(function() {\n return $repo.save(us).then(function() {\n return $scope.$eval($attrs.onUpdate);\n });\n });\n }));\n $scope.$on(\"userstories:loaded\", function() {\n return render($scope.$eval($attrs.tgUsStatus));\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n us = $scope.$eval($attrs.tgUsStatus);\n render(us);\n return bindOnce($scope, \"project\", function(project) {\n var html;\n html = template({\n \"statuses\": project.us_statuses\n });\n $el.append(html);\n if ($scope.project.my_permissions.indexOf(\"modify_us\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUsStatus\", [\"$tgRepo\", \"$tgTemplate\", UsStatusDirective]);\n\n RelatedTaskStatusDirective = function($repo, $template) {\n\n /*\n Print the status of a related task and a popover to change it.\n - tg-related-task-status: The related task\n - on-update: Method call after US is updated\n \n Example:\n \n div.status(tg-related-task-status=\"task\" on-update=\"ctrl.loadSprintState()\")\n a.task-status(href=\"\", title=\"Status Name\")\n \n NOTE: This directive need 'taskStatusById' and 'project'.\n */\n var link, selectionTemplate, updateTaskStatus;\n selectionTemplate = $template.get(\"common/popover/popover-related-task-status.html\", true);\n updateTaskStatus = function($el, task, taskStatusById) {\n var taskStatusDom, taskStatusDomParent;\n taskStatusDomParent = $el.find(\".us-status\");\n taskStatusDom = $el.find(\".task-status .task-status-bind\");\n if (taskStatusById[task.status]) {\n taskStatusDom.text(taskStatusById[task.status].name);\n return taskStatusDomParent.css('color', taskStatusById[task.status].color);\n }\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, autoSave, notAutoSave, task;\n $ctrl = $el.controller();\n task = $scope.$eval($attrs.tgRelatedTaskStatus);\n notAutoSave = $scope.$eval($attrs.notAutoSave);\n autoSave = !notAutoSave;\n $el.on(\"click\", \".task-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", debounce(2000, function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n task.status = target.data(\"status-id\");\n $el.find(\".pop-status\").popover().close();\n updateTaskStatus($el, task, $scope.taskStatusById);\n if (autoSave) {\n return $scope.$apply(function() {\n return $repo.save(task).then(function() {\n $scope.$eval($attrs.onUpdate);\n return $scope.$emit(\"related-tasks:status-changed\");\n });\n });\n }\n }));\n taiga.bindOnce($scope, \"project\", function(project) {\n $el.append(selectionTemplate({\n 'statuses': project.task_statuses\n }));\n updateTaskStatus($el, task, $scope.taskStatusById);\n if (project.my_permissions.indexOf(\"modify_task\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\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(\"tgRelatedTaskStatus\", [\"$tgRepo\", \"$tgTemplate\", RelatedTaskStatusDirective]);\n\n $.fn.popover = function() {\n var $el, close, closeAll, closePopover, isVisible, open;\n $el = this;\n isVisible = (function(_this) {\n return function() {\n var docViewBottom, docViewLeft, docViewRight, docViewTop, docViewWidth, elemBottom, elemLeft, elemRight, elemTop, elemWidth;\n $el.css({\n \"display\": \"block\",\n \"visibility\": \"hidden\"\n });\n docViewTop = $(window).scrollTop();\n docViewBottom = docViewTop + $(window).height();\n docViewWidth = $(window).width();\n docViewRight = docViewWidth;\n docViewLeft = 0;\n elemTop = $el.offset().top;\n elemBottom = elemTop + $el.height();\n elemWidth = $el.width();\n elemLeft = $el.offset().left;\n elemRight = $el.offset().left + elemWidth;\n $el.css({\n \"display\": \"none\",\n \"visibility\": \"visible\"\n });\n return (elemBottom <= docViewBottom) && (elemTop >= docViewTop) && (elemLeft >= docViewLeft) && (elemRight <= docViewRight);\n };\n })(this);\n closePopover = (function(_this) {\n return function(onClose) {\n if (onClose) {\n onClose.call($el);\n }\n $el.fadeOut(function() {\n return $el.removeClass(\"active\").removeClass(\"fix\");\n });\n return $el.off(\"popup:close\");\n };\n })(this);\n closeAll = (function(_this) {\n return function() {\n return $(\".popover.active\").each(function() {\n return $(this).trigger(\"popup:close\");\n });\n };\n })(this);\n open = (function(_this) {\n return function(onClose) {\n if ($el.hasClass(\"active\")) {\n return close();\n } else {\n closeAll();\n if (!isVisible()) {\n $el.addClass(\"fix\");\n }\n $el.fadeIn(function() {\n $el.addClass(\"active\");\n $(document.body).off(\"popover\");\n return $(document.body).one(\"click.popover\", function() {\n return closeAll();\n });\n });\n return $el.on(\"popup:close\", function(e) {\n return closePopover(onClose);\n });\n }\n };\n })(this);\n close = (function(_this) {\n return function() {\n return $el.trigger(\"popup:close\");\n };\n })(this);\n return {\n open: open,\n close: close,\n closeAll: closeAll\n };\n };\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/raven-logger.coffee\n */\n\n(function() {\n var ExceptionHandlerFactory, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaCommon\");\n\n ExceptionHandlerFactory = function($log, _at_config) {\n var ravenConfig;\n this.config = _at_config;\n ravenConfig = this.config.get(\"ravenConfig\", null);\n if (ravenConfig) {\n $log.debug(\"Using the RavenJS exception handler.\");\n Raven.config(ravenConfig).install();\n return function(exception, cause) {\n $log.error.apply($log, arguments);\n return Raven.captureException(exception);\n };\n } else {\n $log.debug(\"Using the default logging exception handler.\");\n return function(exception, cause) {\n return $log.error.apply($log, arguments);\n };\n }\n };\n\n module.factory(\"$exceptionHandler\", [\"$log\", \"$tgConfig\", ExceptionHandlerFactory]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/tags.coffee\n */\n\n(function() {\n var ColorizeTagsDirective, LbTagLineDirective, TagLineDirective, TagsDirective, bindOnce, module, taiga, trim,\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 taiga = this.taiga;\n\n trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n TagsDirective = function() {\n var formatter, link, parser;\n formatter = function(v) {\n if (_.isArray(v)) {\n return v.join(\", \");\n }\n return \"\";\n };\n parser = function(v) {\n var result;\n if (!v) {\n return [];\n }\n result = _(v.split(\",\")).map(function(x) {\n return _.str.trim(x);\n });\n return result.value();\n };\n link = function($scope, $el, $attrs, $ctrl) {\n $ctrl.$formatters.push(formatter);\n $ctrl.$parsers.push(parser);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n require: \"ngModel\",\n link: link\n };\n };\n\n module.directive(\"tgTags\", TagsDirective);\n\n ColorizeTagsDirective = function() {\n var link, templates;\n templates = {\n backlog: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\"><%- tag.name %>\\n<% }) %>\"),\n kanban: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\" title=\\\"<%- tag.name %>\\\" />\\n<% }) %>\"),\n taskboard: _.template(\"<% _.each(tags, function(tag) { %>\\n \\\" title=\\\"<%- tag.name %>\\\" />\\n<% }) %>\")\n };\n link = function($scope, $el, $attrs, $ctrl) {\n var render;\n render = function(srcTags) {\n var html, tags, template;\n template = templates[$attrs.tgColorizeTagsType];\n srcTags.sort();\n tags = _.map(srcTags, function(tag) {\n var color;\n color = $scope.project.tags_colors[tag];\n return {\n name: tag,\n color: color\n };\n });\n html = template({\n tags: tags\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.tgColorizeTags, function(tags) {\n if (tags != null) {\n return render(tags);\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(\"tgColorizeTags\", ColorizeTagsDirective);\n\n LbTagLineDirective = function($rs, $template) {\n var COMMA_KEY, ENTER_KEY, link, templateTags;\n ENTER_KEY = 13;\n COMMA_KEY = 188;\n templateTags = $template.get(\"common/tag/lb-tag-line-tags.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var addValue, deleteValue, hideSaveButton, removeInputLastCharacter, renderTags, resetInput, saveInputTag, showSaveButton;\n renderTags = function(tags, tagsColors) {\n var ctx, html;\n ctx = {\n tags: _.map(tags, function(t) {\n return {\n name: t,\n color: tagsColors[t]\n };\n })\n };\n _.map(ctx.tags, (function(_this) {\n return function(tag) {\n if (tag.color) {\n return tag.style = \"border-left: 5px solid \" + tag.color;\n }\n };\n })(this));\n html = templateTags(ctx);\n return $el.find(\"div.tags-container\").html(html);\n };\n showSaveButton = function() {\n return $el.find(\".save\").removeClass(\"hidden\");\n };\n hideSaveButton = function() {\n return $el.find(\".save\").addClass(\"hidden\");\n };\n resetInput = function() {\n $el.find(\"input\").val(\"\");\n return $el.find(\"input\").autocomplete(\"close\");\n };\n addValue = function(value) {\n var tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue, false);\n if (tags == null) {\n tags = [];\n }\n if (__indexOf.call(tags, value) < 0) {\n tags.push(value);\n }\n $scope.$apply(function() {\n return $model.$setViewValue(tags);\n });\n return hideSaveButton();\n };\n deleteValue = function(value) {\n var tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue, false);\n tags = _.pull(tags, value);\n return $scope.$apply(function() {\n return $model.$setViewValue(tags);\n });\n };\n saveInputTag = function() {\n var value;\n value = $el.find(\"input\").val();\n addValue(value);\n return resetInput();\n };\n removeInputLastCharacter = (function(_this) {\n return function(input) {\n var inputValue;\n inputValue = input.val();\n return input.val(inputValue.substring(0, inputValue.length - 1));\n };\n })(this);\n $el.on(\"keypress\", \"input\", function(event) {\n if (event.keyCode !== ENTER_KEY) {\n return;\n }\n return event.preventDefault();\n });\n $el.on(\"keyup\", \"input\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if (event.keyCode === ENTER_KEY) {\n return saveInputTag();\n } else if (event.keyCode === COMMA_KEY) {\n removeInputLastCharacter(target);\n return saveInputTag();\n } else {\n if (target.val().length) {\n return showSaveButton();\n } else {\n return hideSaveButton();\n }\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n event.preventDefault();\n return saveInputTag();\n });\n $el.on(\"click\", \".icon-delete\", function(event) {\n var target, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n value = target.siblings(\".tag-name\").text();\n return deleteValue(value);\n });\n bindOnce($scope, \"project\", function(project) {\n var positioningFunction;\n positioningFunction = function(position, elements) {\n var menu;\n menu = elements.element.element;\n menu.css(\"width\", elements.target.width);\n menu.css(\"top\", position.top);\n return menu.css(\"left\", position.left);\n };\n return $el.find(\"input\").autocomplete({\n source: _.keys(project.tags_colors),\n position: {\n my: \"left top\",\n using: positioningFunction\n },\n select: function(event, ui) {\n addValue(ui.item.value);\n return ui.item.value = \"\";\n }\n });\n });\n $scope.$watch($attrs.ngModel, function(tags) {\n var tagsColors, _ref;\n tagsColors = ((_ref = $scope.project) != null ? _ref.tags_colors : void 0) || [];\n return renderTags(tags, tagsColors);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\",\n templateUrl: \"common/tag/lb-tag-line.html\"\n };\n };\n\n module.directive(\"tgLbTagLine\", [\"$tgResources\", \"$tgTemplate\", LbTagLineDirective]);\n\n TagLineDirective = function($rootScope, $repo, $rs, $confirm, $qqueue, $template) {\n var COMMA_KEY, ENTER_KEY, ESC_KEY, link, templateTags;\n ENTER_KEY = 13;\n ESC_KEY = 27;\n COMMA_KEY = 188;\n templateTags = $template.get(\"common/tag/tags-line-tags.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var addValue, deleteValue, hideAddTagButton, hideAddTagButtonText, hideInput, hideSaveButton, isEditable, removeInputLastCharacter, renderInReadModeOnly, renderTags, resetInput, saveInputTag, showAddTagButton, showAddTagButtonText, showInput, showSaveButton;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf($attrs.requiredPerm) !== -1;\n };\n renderTags = function(tags, tagsColors) {\n var ctx, html;\n ctx = {\n tags: _.map(tags, function(t) {\n return {\n name: t,\n color: tagsColors[t]\n };\n }),\n isEditable: isEditable()\n };\n html = templateTags(ctx);\n return $el.find(\"div.tags-container\").html(html);\n };\n renderInReadModeOnly = function() {\n $el.find(\".add-tag\").remove();\n $el.find(\"input\").remove();\n return $el.find(\".save\").remove();\n };\n showAddTagButton = function() {\n return $el.find(\".add-tag\").removeClass(\"hidden\");\n };\n hideAddTagButton = function() {\n return $el.find(\".add-tag\").addClass(\"hidden\");\n };\n showAddTagButtonText = function() {\n return $el.find(\".add-tag-text\").removeClass(\"hidden\");\n };\n hideAddTagButtonText = function() {\n return $el.find(\".add-tag-text\").addClass(\"hidden\");\n };\n showSaveButton = function() {\n return $el.find(\".save\").removeClass(\"hidden\");\n };\n hideSaveButton = function() {\n return $el.find(\".save\").addClass(\"hidden\");\n };\n showInput = function() {\n return $el.find(\"input\").removeClass(\"hidden\").focus();\n };\n hideInput = function() {\n return $el.find(\"input\").addClass(\"hidden\").blur();\n };\n resetInput = function() {\n $el.find(\"input\").val(\"\");\n return $el.find(\"input\").autocomplete(\"close\");\n };\n addValue = $qqueue.bindAdd(function(value) {\n var model, onError, onSuccess, tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue.tags, false);\n if (tags == null) {\n tags = [];\n }\n if (__indexOf.call(tags, value) < 0) {\n tags.push(value);\n }\n model = $model.$modelValue.clone();\n model.tags = tags;\n $model.$setViewValue(model);\n onSuccess = function() {\n return $rootScope.$broadcast(\"history:reload\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n model.revert();\n return $model.$setViewValue(model);\n };\n $repo.save(model).then(onSuccess, onError);\n return hideSaveButton();\n });\n deleteValue = $qqueue.bindAdd(function(value) {\n var model, onError, onSuccess, tags;\n value = trim(value.toLowerCase());\n if (value.length === 0) {\n return;\n }\n tags = _.clone($model.$modelValue.tags, false);\n tags = _.pull(tags, value);\n model = $model.$modelValue.clone();\n model.tags = tags;\n $model.$setViewValue(model);\n onSuccess = function() {\n return $rootScope.$broadcast(\"history:reload\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n model.revert();\n return $model.$setViewValue(model);\n };\n return $repo.save(model).then(onSuccess, onError);\n });\n saveInputTag = function() {\n var value;\n value = $el.find(\"input\").val();\n addValue(value);\n return resetInput();\n };\n removeInputLastCharacter = (function(_this) {\n return function(input) {\n var inputValue;\n inputValue = input.val();\n return input.val(inputValue.substring(0, inputValue.length - 1));\n };\n })(this);\n $el.on(\"keypress\", \"input\", function(event) {\n var _ref;\n if ((_ref = event.keyCode) !== ENTER_KEY && _ref !== ESC_KEY) {\n return;\n }\n return event.preventDefault();\n });\n $el.on(\"keyup\", \"input\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if (event.keyCode === ENTER_KEY) {\n return saveInputTag();\n } else if (event.keyCode === COMMA_KEY) {\n removeInputLastCharacter(target);\n return saveInputTag();\n } else if (event.keyCode === ESC_KEY) {\n resetInput();\n hideInput();\n hideSaveButton();\n return showAddTagButton();\n } else {\n if (target.val().length) {\n return showSaveButton();\n } else {\n return hideSaveButton();\n }\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n event.preventDefault();\n return saveInputTag();\n });\n $el.on(\"click\", \".add-tag\", function(event) {\n event.preventDefault();\n hideAddTagButton();\n return showInput();\n });\n $el.on(\"click\", \".icon-delete\", function(event) {\n var target, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n value = target.siblings(\".tag-name\").text();\n return deleteValue(value);\n });\n bindOnce($scope, \"project\", function(project) {\n var positioningFunction;\n if (!isEditable()) {\n renderInReadModeOnly();\n return;\n }\n showAddTagButton();\n positioningFunction = function(position, elements) {\n var menu;\n menu = elements.element.element;\n menu.css(\"width\", elements.target.width);\n menu.css(\"top\", position.top);\n return menu.css(\"left\", position.left);\n };\n return $el.find(\"input\").autocomplete({\n source: _.keys(project.tags_colors),\n position: {\n my: \"left top\",\n using: positioningFunction\n },\n select: function(event, ui) {\n addValue(ui.item.value);\n return ui.item.value = \"\";\n }\n });\n });\n $scope.$watch($attrs.ngModel, function(model) {\n var tagsColors, _ref, _ref1;\n if (!model) {\n return;\n }\n if ((_ref = model.tags) != null ? _ref.length : void 0) {\n hideAddTagButtonText();\n } else {\n showAddTagButtonText();\n }\n tagsColors = ((_ref1 = $scope.project) != null ? _ref1.tags_colors : void 0) || [];\n return renderTags(model.tags, tagsColors);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n require: \"ngModel\",\n templateUrl: \"common/tag/tag-line.html\"\n };\n };\n\n module.directive(\"tgTagLine\", [\"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$tgQqueue\", \"$tgTemplate\", TagLineDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/wisiwyg.coffee\n */\n\n(function() {\n var bindOnce, module, taiga, tgMarkitupDirective;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaCommon\");\n\n tgMarkitupDirective = function($rootscope, $rs, $tr, $selectedText, $template) {\n var link, previewTemplate;\n previewTemplate = $template.get(\"common/wysiwyg/wysiwyg-markitup-preview.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var closePreviewMode, element, markdownCaretPositon, markdownSettings, markdownTitle, preview, previewDomNode, removeEmptyLine, setCaretPosition;\n element = angular.element($el);\n previewDomNode = $(\"
\", {\n \"class\": \"preview\"\n });\n closePreviewMode = function() {\n element.parents(\".markdown\").find(\".preview\").remove();\n return element.parents(\".markItUp\").show();\n };\n $scope.$on(\"markdown-editor:submit\", function() {\n return closePreviewMode();\n });\n preview = function() {\n var markItUpDomNode, markdownDomNode;\n markdownDomNode = element.parents(\".markdown\");\n markItUpDomNode = element.parents(\".markItUp\");\n return $rs.mdrender.render($scope.projectId, $model.$modelValue).then(function(data) {\n var markdown;\n markdownDomNode.append(previewTemplate({\n data: data.data\n }));\n markItUpDomNode.hide();\n markdown = element.closest(\".markdown\");\n return markdown.on(\"mouseup.preview\", \".preview\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.target);\n if (!target.is('a') && $selectedText.get().length) {\n return;\n }\n markdown.off(\".preview\");\n return closePreviewMode();\n });\n });\n };\n markdownCaretPositon = false;\n setCaretPosition = function(elm, caretPos) {\n var range;\n if (elm.createTextRange) {\n range = elm.createTextRange();\n range.move(\"character\", caretPos);\n return range.select();\n } else if (elm.selectionStart) {\n elm.focus();\n return elm.setSelectionRange(caretPos, caretPos);\n }\n };\n removeEmptyLine = function(textarea, line, currentCaretPosition) {\n var lines, removedLineLength;\n lines = textarea.value.split(\"\\n\");\n removedLineLength = lines[line].length;\n lines[line] = \"\";\n textarea.value = lines.join(\"\\n\");\n return currentCaretPosition - removedLineLength + 1;\n };\n markdownSettings = {\n nameSpace: \"markdown\",\n onShiftEnter: {\n keepDefault: false,\n openWith: \"\\n\\n\"\n },\n onEnter: {\n keepDefault: false,\n replaceWith: (function(_this) {\n return function(data) {\n var breakLineAtBeginning, cursorLine, emptyListItem, lastLine, lines, match, newLineContent;\n lines = data.textarea.value.split(\"\\n\");\n cursorLine = data.textarea.value.slice(0, +(data.caretPosition - 1) + 1 || 9e9).split(\"\\n\").length;\n newLineContent = data.textarea.value.slice(data.caretPosition).split(\"\\n\")[0];\n lastLine = lines[cursorLine - 1];\n match = lastLine.match(/^(\\s*- ).*/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*)\\-\\s$/);\n if (emptyListItem) {\n markdownCaretPositon = removeEmptyLine(data.textarea, lines.length - 1, data.caretPosition);\n } else {\n breakLineAtBeginning = newLineContent.match(/^(\\s*)\\-\\s/);\n if (!breakLineAtBeginning) {\n if (match) {\n return \"\\n\" + match[1];\n }\n }\n }\n }\n match = lastLine.match(/^(\\s*\\* ).*/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*\\* )$/);\n if (emptyListItem) {\n markdownCaretPositon = removeEmptyLine(data.textarea, lines.length - 1, data.caretPosition);\n } else {\n breakLineAtBeginning = newLineContent.match(/^(\\s*)\\*\\s/);\n if (!breakLineAtBeginning) {\n if (match) {\n return \"\\n\" + match[1];\n }\n }\n }\n }\n match = lastLine.match(/^(\\s*)(\\d+)\\.\\s/);\n if (match) {\n emptyListItem = lastLine.match(/^(\\s*)(\\d+)\\.\\s$/);\n if (emptyListItem) {\n markdownCaretPositon = removeEmptyLine(data.textarea, lines.length - 1, data.caretPosition);\n } else {\n breakLineAtBeginning = newLineContent.match(/^(\\s*)(\\d+)\\.\\s/);\n if (!breakLineAtBeginning) {\n return \"\\n\" + (match[1] + (parseInt(match[2], 10) + 1)) + \". \";\n }\n }\n }\n return \"\\n\";\n };\n })(this),\n afterInsert: function(data) {\n var caretPosition, line, scrollRelation, totalLines;\n if (markdownCaretPositon) {\n setCaretPosition(data.textarea, markdownCaretPositon);\n caretPosition = markdownCaretPositon;\n markdownCaretPositon = false;\n } else {\n caretPosition = data.caretPosition;\n }\n totalLines = data.textarea.value.split(\"\\n\").length;\n line = data.textarea.value.slice(0, +(caretPosition - 1) + 1 || 9e9).split(\"\\n\").length;\n scrollRelation = line / totalLines;\n return $el.scrollTop((scrollRelation * $el[0].scrollHeight) - ($el.height() / 2));\n }\n },\n markupSet: [\n {\n name: $tr.t(\"markdown-editor.heading-1\"),\n key: \"1\",\n placeHolder: $tr.t(\"markdown-editor.placeholder\"),\n closeWith: function(markItUp) {\n return markdownTitle(markItUp, \"=\");\n }\n }, {\n name: $tr.t(\"markdown-editor.heading-2\"),\n key: \"2\",\n placeHolder: $tr.t(\"markdown-editor.placeholder\"),\n closeWith: function(markItUp) {\n return markdownTitle(markItUp, \"-\");\n }\n }, {\n name: $tr.t(\"markdown-editor.heading-3\"),\n key: \"3\",\n openWith: \"### \",\n placeHolder: $tr.t(\"markdown-editor.placeholder\")\n }, {\n separator: \"---------------\"\n }, {\n name: $tr.t(\"markdown-editor.bold\"),\n key: \"B\",\n openWith: \"**\",\n closeWith: \"**\"\n }, {\n name: $tr.t(\"markdown-editor.italic\"),\n key: \"I\",\n openWith: \"_\",\n closeWith: \"_\"\n }, {\n name: $tr.t(\"markdown-editor.strike\"),\n key: \"S\",\n openWith: \"~~\",\n closeWith: \"~~\"\n }, {\n separator: \"---------------\"\n }, {\n name: $tr.t(\"markdown-editor.bulleted-list\"),\n openWith: \"- \"\n }, {\n name: $tr.t(\"markdown-editor.numeric-list\"),\n openWith: function(markItUp) {\n return markItUp.line + \". \";\n }\n }, {\n separator: \"---------------\"\n }, {\n name: $tr.t(\"markdown-editor.picture\"),\n key: \"P\",\n replaceWith: '![[![Alternative text]!]]([![Url:!:http://]!] \"[![Title]!]\")'\n }, {\n name: $tr.t(\"markdown-editor.link\"),\n key: \"L\",\n openWith: \"[\",\n closeWith: ']([![Url:!:http://]!] \"[![Title]!]\")',\n placeHolder: $tr.t(\"markdown-editor.link-placeholder\")\n }, {\n separator: \"---------------\"\n }, {\n name: $tr.t(\"markdown-editor.quotes\"),\n openWith: \"> \"\n }, {\n name: $tr.t(\"markdown-editor.code-block\"),\n openWith: \"```\\n\",\n closeWith: \"\\n```\"\n }, {\n separator: \"---------------\"\n }, {\n name: $tr.t(\"markdown-editor.preview\"),\n call: preview,\n className: \"preview-icon\"\n }\n ],\n afterInsert: function(event) {\n var target;\n target = angular.element(event.textarea);\n return $model.$setViewValue(target.val());\n }\n };\n markdownTitle = function(markItUp, char) {\n var heading, i, n, _i, _ref;\n heading = \"\";\n n = $.trim(markItUp.selection || markItUp.placeHolder).length;\n for (i = _i = 0, _ref = n - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {\n heading += char;\n }\n return \"\\n\" + heading + \"\\n\";\n };\n element.markItUp(markdownSettings);\n element.on(\"keypress\", function(event) {\n return $scope.$apply();\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(\"tgMarkitup\", [\"$rootScope\", \"$tgResources\", \"$tgI18n\", \"$selectedText\", \"$tgTemplate\", tgMarkitupDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var BacklogFiltersDirective, bindOnce, debounceLeading, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n debounceLeading = this.taiga.debounceLeading;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogFiltersDirective = function($log, $location, $templates) {\n var link, template, templateSelected;\n template = $templates.get(\"backlog/filters.html\", true);\n templateSelected = $templates.get(\"backlog/filter-selected.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, initializeSelectedFilters, renderFilters, renderSelectedFilters, selectQFilter, selectedFilters, showCategories, showFilters, toggleFilterSelection;\n $ctrl = $el.closest(\".wrapper\").controller();\n selectedFilters = [];\n showFilters = function(title, type) {\n $el.find(\".filters-cats\").hide();\n $el.find(\".filter-list\").removeClass(\"hidden\");\n $el.find(\"h2.breadcrumb\").removeClass(\"hidden\");\n $el.find(\"h2 a.subfilter span.title\").html(title);\n return $el.find(\"h2 a.subfilter span.title\").prop(\"data-type\", type);\n };\n showCategories = function() {\n $el.find(\".filters-cats\").show();\n $el.find(\".filter-list\").addClass(\"hidden\");\n return $el.find(\"h2.breadcrumb\").addClass(\"hidden\");\n };\n initializeSelectedFilters = function(filters) {\n var name, val, values, _i, _len;\n showCategories();\n selectedFilters = [];\n for (name in filters) {\n values = filters[name];\n for (_i = 0, _len = values.length; _i < _len; _i++) {\n val = values[_i];\n if (val.selected) {\n selectedFilters.push(val);\n }\n }\n }\n return renderSelectedFilters();\n };\n renderSelectedFilters = function() {\n var html;\n _.map(selectedFilters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = templateSelected({\n filters: selectedFilters\n });\n return $el.find(\".filters-applied\").html(html);\n };\n renderFilters = function(filters) {\n var html;\n _.map(filters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = template({\n filters: filters\n });\n return $el.find(\".filter-list\").html(html);\n };\n toggleFilterSelection = function(type, id) {\n var currentFiltersType, filter, filters;\n filters = $scope.filters[type];\n filter = _.find(filters, {\n id: taiga.toString(id)\n });\n filter.selected = !filter.selected;\n if (filter.selected) {\n selectedFilters.push(filter);\n $scope.$apply(function() {\n $ctrl.selectFilter(type, id);\n return $ctrl.filterVisibleUserstories();\n });\n } else {\n selectedFilters = _.reject(selectedFilters, filter);\n $scope.$apply(function() {\n $ctrl.unselectFilter(type, id);\n return $ctrl.filterVisibleUserstories();\n });\n }\n renderSelectedFilters(selectedFilters);\n currentFiltersType = $el.find(\"h2 a.subfilter span.title\").prop('data-type');\n if (type === currentFiltersType) {\n renderFilters(_.reject(filters, \"selected\"));\n }\n return $ctrl.loadUserstories();\n };\n selectQFilter = debounceLeading(100, function(value) {\n if (value === void 0) {\n return;\n }\n if (value.length === 0) {\n $ctrl.replaceFilter(\"q\", null);\n } else {\n $ctrl.replaceFilter(\"q\", value);\n }\n return $ctrl.loadUserstories();\n });\n $scope.$watch(\"filtersQ\", selectQFilter);\n $scope.$on(\"filters:loaded\", function(ctx, filters) {\n return initializeSelectedFilters(filters);\n });\n $el.on(\"click\", \".filters-cats > ul > li > a\", function(event) {\n var tags, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n tags = $scope.filters[target.data(\"type\")];\n renderFilters(_.reject(tags, \"selected\"));\n return showFilters(target.attr(\"title\"), target.data(\"type\"));\n });\n $el.on(\"click\", \".filters-inner > .filters-step-cat > .breadcrumb > .back\", function(event) {\n event.preventDefault();\n return showCategories();\n });\n $el.on(\"click\", \".filters-applied a\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n id = target.data(\"id\");\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n return $el.on(\"click\", \".filter-list .single-filter\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n if (target.hasClass(\"active\")) {\n target.removeClass(\"active\");\n } else {\n target.addClass(\"active\");\n }\n id = target.data(\"id\");\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogFilters\", [\"$log\", \"$tgLocation\", \"$tgTemplate\", BacklogFiltersDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var CreateEditSprint, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaBacklog\");\n\n CreateEditSprint = function($repo, $confirm, $rs, $rootscope, lightboxService, $loading) {\n var link;\n link = function($scope, $el, attrs) {\n var createSprint, hasErrors, remove, submit, submitButton;\n hasErrors = false;\n createSprint = true;\n $scope.sprint = {\n project: null,\n name: null,\n estimated_start: null,\n estimated_finish: null\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, form, newSprint, promise, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n hasErrors = true;\n $el.find(\".last-sprint-name\").addClass(\"disappear\");\n return;\n }\n hasErrors = false;\n newSprint = angular.copy($scope.sprint);\n broadcastEvent = null;\n if (createSprint) {\n newSprint.estimated_start = moment(newSprint.estimated_start).format(\"YYYY-MM-DD\");\n newSprint.estimated_finish = moment(newSprint.estimated_finish).format(\"YYYY-MM-DD\");\n promise = $repo.create(\"milestones\", newSprint);\n broadcastEvent = \"sprintform:create:success\";\n } else {\n newSprint.setAttr(\"estimated_start\", moment(newSprint.estimated_start).format(\"YYYY-MM-DD\"));\n newSprint.setAttr(\"estimated_finish\", moment(newSprint.estimated_finish).format(\"YYYY-MM-DD\"));\n promise = $repo.save(newSprint);\n broadcastEvent = \"sprintform:edit:success\";\n }\n $loading.start(submitButton);\n promise.then(function(data) {\n $loading.finish(submitButton);\n if (createSprint) {\n $scope.sprintsCounter += 1;\n }\n $rootscope.$broadcast(broadcastEvent, data);\n return lightboxService.close($el);\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\n form.setErrors(data);\n if (data._error_message) {\n return $confirm.notify(\"light-error\", data._error_message);\n } else if (data.__all__) {\n return $confirm.notify(\"light-error\", data.__all__[0]);\n }\n });\n };\n })(this));\n remove = function() {\n var message, title;\n title = \"Delete sprint\";\n message = $scope.sprint.name;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var onError, onSuccess;\n onSuccess = function() {\n finish();\n $scope.milestonesCounter -= 1;\n lightboxService.close($el);\n return $rootscope.$broadcast(\"sprintform:remove:success\");\n };\n onError = function() {\n finish(false);\n return $confirm.notify(\"error\");\n };\n return $repo.remove($scope.sprint).then(onSuccess, onError);\n };\n })(this));\n };\n $scope.$on(\"sprintform:create\", function(event, projectId) {\n var estimatedFinish, estimatedStart, lastSprint, lastSprintNameDom;\n createSprint = true;\n $scope.sprint.project = projectId;\n $scope.sprint.name = null;\n $scope.sprint.slug = null;\n lastSprint = $scope.sprints[0];\n estimatedStart = moment();\n if ($scope.sprint.estimated_start) {\n estimatedStart = moment($scope.sprint.estimated_start);\n } else if (lastSprint != null) {\n estimatedStart = moment(lastSprint.estimated_finish);\n }\n $scope.sprint.estimated_start = estimatedStart.format(\"DD MMM YYYY\");\n estimatedFinish = moment().add(2, \"weeks\");\n if ($scope.sprint.estimated_finish) {\n estimatedFinish = moment($scope.sprint.estimated_finish);\n } else if (lastSprint != null) {\n estimatedFinish = moment(lastSprint.estimated_finish).add(2, \"weeks\");\n }\n $scope.sprint.estimated_finish = estimatedFinish.format(\"DD MMM YYYY\");\n lastSprintNameDom = $el.find(\".last-sprint-name\");\n if ((lastSprint != null ? lastSprint.name : void 0) != null) {\n lastSprintNameDom.html(\" last sprint is \" + lastSprint.name + \" ;-) \");\n }\n $el.find(\".delete-sprint\").addClass(\"hidden\");\n $el.find(\".title\").text(\"New sprint\");\n $el.find(\".button-green\").text(\"Create\");\n lightboxService.open($el);\n $el.find(\".sprint-name\").focus();\n return $el.find(\".last-sprint-name\").removeClass(\"disappear\");\n });\n $scope.$on(\"sprintform:edit\", function(ctx, sprint) {\n createSprint = false;\n $scope.$apply(function() {\n $scope.sprint = sprint;\n $scope.sprint.estimated_start = moment($scope.sprint.estimated_start).format(\"DD MMM YYYY\");\n return $scope.sprint.estimated_finish = moment($scope.sprint.estimated_finish).format(\"DD MMM YYYY\");\n });\n $el.find(\".delete-sprint\").removeClass(\"hidden\");\n $el.find(\".title\").text(\"Edit sprint\");\n $el.find(\".button-green\").text(\"Save\");\n lightboxService.open($el);\n $el.find(\".sprint-name\").focus().select();\n return $el.find(\".last-sprint-name\").addClass(\"disappear\");\n });\n $el.on(\"keyup\", \".sprint-name\", function(event) {\n if ($el.find(\".sprint-name\").val().length > 0 || hasErrors) {\n return $el.find(\".last-sprint-name\").addClass(\"disappear\");\n } else {\n return $el.find(\".last-sprint-name\").removeClass(\"disappear\");\n }\n });\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n $el.on(\"click\", \".delete-sprint .icon-delete\", function(event) {\n event.preventDefault();\n return remove();\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateEditSprint\", [\"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", CreateEditSprint]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var BacklogController, BacklogDirective, TgBacklogProgressBarDirective, UsPointsDirective, UsRolePointsSelectorDirective, bindMethods, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, tgBacklogGraphDirective, timeout, toggleText,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogController = (function(_super) {\n __extends(BacklogController, _super);\n\n BacklogController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$appTitle\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"tgLoader\"];\n\n function BacklogController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_appTitle, _at_navUrls, _at_events, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.events = _at_events;\n this.analytics = _at_analytics;\n bindMethods(this);\n this.scope.sectionName = \"Backlog\";\n this.showTags = false;\n this.activeFilters = false;\n this.excludeClosedSprints = true;\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this.appTitle.set(\"Backlog - \" + _this.scope.project.name);\n if (_this.rs.userstories.getShowTags(_this.scope.projectId)) {\n _this.showTags = true;\n return _this.scope.$broadcast(\"showTags\", _this.showTags);\n }\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n BacklogController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"usform:bulk:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.loadProjectStats();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"bulk create userstory on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"sprintform:create:success\", (function(_this) {\n return function() {\n _this.loadSprints();\n _this.loadProjectStats();\n return _this.analytics.trackEvent(\"sprint\", \"create\", \"create sprint on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"usform:new:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.loadProjectStats();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"create userstory on backlog\", 1);\n };\n })(this));\n this.scope.$on(\"sprintform:edit:success\", (function(_this) {\n return function() {\n return _this.loadProjectStats();\n };\n })(this));\n this.scope.$on(\"sprintform:remove:success\", (function(_this) {\n return function() {\n _this.loadSprints();\n _this.loadProjectStats();\n return _this.loadUserstories();\n };\n })(this));\n this.scope.$on(\"usform:edit:success\", (function(_this) {\n return function() {\n return _this.loadUserstories();\n };\n })(this));\n this.scope.$on(\"sprint:us:move\", this.moveUs);\n this.scope.$on(\"sprint:us:moved\", this.loadSprints);\n this.scope.$on(\"sprint:us:moved\", this.loadProjectStats);\n return this.scope.$on(\"backlog:toggle-closed-sprints-visualization\", this.toggleClosedSprintsVisualization);\n };\n\n BacklogController.prototype.initializeSubscription = function() {\n var routingKey1, routingKey2;\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n _this.loadUserstories();\n return _this.loadSprints();\n };\n })(this));\n routingKey2 = \"changes.project.\" + this.scope.projectId + \".milestones\";\n return this.events.subscribe(this.scope, routingKey2, (function(_this) {\n return function(message) {\n return _this.loadSprints();\n };\n })(this));\n };\n\n BacklogController.prototype.toggleShowTags = function() {\n return this.scope.$apply((function(_this) {\n return function() {\n _this.showTags = !_this.showTags;\n return _this.rs.userstories.storeShowTags(_this.scope.projectId, _this.showTags);\n };\n })(this));\n };\n\n BacklogController.prototype.toggleActiveFilters = function() {\n return this.activeFilters = !this.activeFilters;\n };\n\n BacklogController.prototype.loadProjectStats = function() {\n return this.rs.projects.stats(this.scope.projectId).then((function(_this) {\n return function(stats) {\n _this.scope.stats = stats;\n if (stats.total_points) {\n _this.scope.stats.completedPercentage = Math.round(100 * stats.closed_points / stats.total_points);\n } else {\n _this.scope.stats.completedPercentage = 0;\n }\n return stats;\n };\n })(this));\n };\n\n BacklogController.prototype.refreshTagsColors = function() {\n return this.rs.projects.tagsColors(this.scope.projectId).then((function(_this) {\n return function(tags_colors) {\n return _this.scope.project.tags_colors = tags_colors;\n };\n })(this));\n };\n\n BacklogController.prototype.loadSprints = function() {\n var params;\n params = {};\n if (this.excludeClosedSprints) {\n params[\"closed\"] = false;\n }\n return this.rs.sprints.list(this.scope.projectId, params).then((function(_this) {\n return function(sprints) {\n var sprint, _i, _len;\n for (_i = 0, _len = sprints.length; _i < _len; _i++) {\n sprint = sprints[_i];\n sprint.user_stories = _.sortBy(sprint.user_stories, \"sprint_order\");\n }\n _this.scope.sprints = sprints;\n _this.scope.openSprints = _.filter(sprints, function(sprint) {\n return !sprint.closed;\n }).reverse();\n _this.scope.closedSprints = _.filter(sprints, function(sprint) {\n return sprint.closed;\n });\n if (!_this.excludeClosedSprints) {\n _this.scope.totalClosedMilestones = _this.scope.closedSprints.length;\n }\n _this.scope.sprintsCounter = sprints.length;\n _this.scope.sprintsById = groupBy(sprints, function(x) {\n return x.id;\n });\n _this.rootscope.$broadcast(\"sprints:loaded\", sprints);\n return sprints;\n };\n })(this));\n };\n\n BacklogController.prototype.resetFilters = function() {\n var selectedStatuses, selectedTags;\n selectedTags = _.filter(this.scope.filters.tags, \"selected\");\n selectedStatuses = _.filter(this.scope.filters.statuses, \"selected\");\n this.scope.filtersQ = \"\";\n _.each([selectedTags, selectedStatuses], (function(_this) {\n return function(filterGrp) {\n return _.each(filterGrp, function(item) {\n var filter, filters;\n filters = _this.scope.filters[item.type];\n filter = _.find(filters, {\n id: taiga.toString(item.id)\n });\n filter.selected = false;\n return _this.unselectFilter(item.type, item.id);\n });\n };\n })(this));\n return this.loadUserstories();\n };\n\n BacklogController.prototype.loadUserstories = function() {\n var promise;\n this.scope.httpParams = this.getUrlFilters();\n this.rs.userstories.storeQueryParams(this.scope.projectId, this.scope.httpParams);\n promise = this.q.all([this.refreshTagsColors(), this.rs.userstories.listUnassigned(this.scope.projectId, this.scope.httpParams)]);\n return promise.then((function(_this) {\n return function(data) {\n var userstories;\n userstories = data[1];\n _this.scope.userstories = _.sortBy(userstories, \"backlog_order\");\n _this.generateFilters();\n _this.filterVisibleUserstories();\n _this.rootscope.$broadcast(\"filters:loaded\", _this.scope.filters);\n scopeDefer(_this.scope, function() {\n return _this.scope.$broadcast(\"userstories:loaded\");\n });\n return userstories;\n };\n })(this));\n };\n\n BacklogController.prototype.loadBacklog = function() {\n return this.q.all([this.loadProjectStats(), this.loadSprints(), this.loadUserstories()]);\n };\n\n BacklogController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.totalClosedMilestones = project.total_closed_milestones;\n _this.scope.$emit('project:loaded', project);\n _this.scope.points = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"id\");\n return project;\n };\n })(this));\n };\n\n BacklogController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.initializeSubscription();\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadBacklog();\n };\n })(this));\n };\n\n BacklogController.prototype.toggleClosedSprintsVisualization = function() {\n this.excludeClosedSprints = !this.excludeClosedSprints;\n return this.loadSprints();\n };\n\n BacklogController.prototype.filterVisibleUserstories = function() {\n var selectedStatuses, selectedTags;\n this.scope.visibleUserstories = [];\n selectedTags = _.filter(this.scope.filters.tags, \"selected\");\n selectedTags = _.map(selectedTags, \"name\");\n if (selectedTags.length === 0) {\n this.scope.visibleUserstories = _.clone(this.scope.userstories, false);\n } else {\n this.scope.visibleUserstories = _.reject(this.scope.userstories, (function(_this) {\n return function(us) {\n if (_.intersection(selectedTags, us.tags).length === 0) {\n return true;\n }\n return false;\n };\n })(this));\n }\n selectedStatuses = _.filter(this.scope.filters.statuses, \"selected\");\n selectedStatuses = _.map(selectedStatuses, \"id\");\n if (selectedStatuses.length > 0) {\n this.scope.visibleUserstories = _.reject(this.scope.visibleUserstories, (function(_this) {\n return function(us) {\n var res;\n res = _.find(selectedStatuses, function(x) {\n return x === taiga.toString(us.status);\n });\n return !res;\n };\n })(this));\n }\n return this.rs.userstories.storeQueryParams(this.scope.projectId, {\n \"status\": selectedStatuses,\n \"tags\": selectedTags,\n \"project\": this.scope.projectId,\n \"milestone\": null\n });\n };\n\n BacklogController.prototype.prepareBulkUpdateData = function(uses, field) {\n if (field == null) {\n field = \"backlog_order\";\n }\n return _.map(uses, function(x) {\n return {\n \"us_id\": x.id,\n \"order\": x[field]\n };\n });\n };\n\n BacklogController.prototype.resortUserStories = function(uses, field) {\n var index, item, items, _i, _len;\n if (field == null) {\n field = \"backlog_order\";\n }\n items = [];\n for (index = _i = 0, _len = uses.length; _i < _len; index = ++_i) {\n item = uses[index];\n item[field] = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n BacklogController.prototype.moveUs = function(ctx, usList, newUsIndex, newSprintId) {\n var data, items, newSprint, oldSprintId, project, promise, promises, us, userstories, _i, _j, _k, _len, _len1, _len2;\n oldSprintId = usList[0].milestone;\n project = usList[0].project;\n if (newSprintId === oldSprintId) {\n items = null;\n userstories = null;\n if (newSprintId === null) {\n userstories = this.scope.userstories;\n } else {\n userstories = this.scope.sprintsById[newSprintId].user_stories;\n }\n this.scope.$apply(function() {\n var args, key, r, us, _i, _len;\n for (key = _i = 0, _len = usList.length; _i < _len; key = ++_i) {\n us = usList[key];\n r = userstories.indexOf(us);\n userstories.splice(r, 1);\n }\n args = [newUsIndex, 0].concat(usList);\n return Array.prototype.splice.apply(userstories, args);\n });\n if (newSprintId === null) {\n items = this.resortUserStories(userstories, \"backlog_order\");\n data = this.prepareBulkUpdateData(items, \"backlog_order\");\n this.rs.userstories.bulkUpdateBacklogOrder(project, data).then((function(_this) {\n return function() {\n var us, _i, _len, _results;\n _results = [];\n for (_i = 0, _len = usList.length; _i < _len; _i++) {\n us = usList[_i];\n _results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return _results;\n };\n })(this));\n } else {\n items = this.resortUserStories(userstories, \"sprint_order\");\n data = this.prepareBulkUpdateData(items, \"sprint_order\");\n this.rs.userstories.bulkUpdateSprintOrder(project, data).then((function(_this) {\n return function() {\n var us, _i, _len, _results;\n _results = [];\n for (_i = 0, _len = usList.length; _i < _len; _i++) {\n us = usList[_i];\n _results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return _results;\n };\n })(this));\n }\n return promise;\n }\n if (newSprintId === null) {\n for (_i = 0, _len = usList.length; _i < _len; _i++) {\n us = usList[_i];\n us.milestone = null;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, key, r, sprint, _j, _len1, _results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(_this.scope.userstories, args);\n Array.prototype.splice.apply(_this.scope.visibleUserstories, args);\n _this.filterVisibleUserstories();\n sprint = _this.scope.sprintsById[oldSprintId];\n _results = [];\n for (key = _j = 0, _len1 = usList.length; _j < _len1; key = ++_j) {\n us = usList[key];\n r = sprint.user_stories.indexOf(us);\n _results.push(sprint.user_stories.splice(r, 1));\n }\n return _results;\n };\n })(this));\n promise = this.repo.save(us);\n promise = promise.then((function(_this) {\n return function() {\n items = _this.resortUserStories(_this.scope.userstories, \"backlog_order\");\n data = _this.prepareBulkUpdateData(items, \"backlog_order\");\n return _this.rs.userstories.bulkUpdateBacklogOrder(us.project, data).then(function() {\n return _this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId);\n });\n };\n })(this));\n promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n return promise;\n }\n newSprint = this.scope.sprintsById[newSprintId];\n if (oldSprintId === null) {\n for (_j = 0, _len1 = usList.length; _j < _len1; _j++) {\n us = usList[_j];\n us.milestone = newSprintId;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, key, r, _k, _len2, _results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(newSprint.user_stories, args);\n _results = [];\n for (key = _k = 0, _len2 = usList.length; _k < _len2; key = ++_k) {\n us = usList[key];\n r = _this.scope.visibleUserstories.indexOf(us);\n _this.scope.visibleUserstories.splice(r, 1);\n r = _this.scope.userstories.indexOf(us);\n _results.push(_this.scope.userstories.splice(r, 1));\n }\n return _results;\n };\n })(this));\n } else {\n for (_k = 0, _len2 = usList.length; _k < _len2; _k++) {\n us = usList[_k];\n us.milestone = newSprintId;\n }\n this.scope.$apply((function(_this) {\n return function() {\n var args, oldSprint, r, _l, _len3, _results;\n args = [newUsIndex, 0].concat(usList);\n Array.prototype.splice.apply(newSprint.user_stories, args);\n _results = [];\n for (_l = 0, _len3 = usList.length; _l < _len3; _l++) {\n us = usList[_l];\n oldSprint = _this.scope.sprintsById[oldSprintId];\n r = oldSprint.user_stories.indexOf(us);\n _results.push(oldSprint.user_stories.splice(r, 1));\n }\n return _results;\n };\n })(this));\n }\n promises = _.map(usList, (function(_this) {\n return function(us) {\n return _this.repo.save(us);\n };\n })(this));\n promise = this.q.all(promises).then((function(_this) {\n return function() {\n items = _this.resortUserStories(newSprint.user_stories, \"sprint_order\");\n data = _this.prepareBulkUpdateData(items, \"sprint_order\");\n _this.rs.userstories.bulkUpdateSprintOrder(project, data).then(function() {\n return _this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId);\n });\n return _this.rs.userstories.bulkUpdateBacklogOrder(project, data).then(function() {\n var _l, _len3, _results;\n _results = [];\n for (_l = 0, _len3 = usList.length; _l < _len3; _l++) {\n us = usList[_l];\n _results.push(_this.rootscope.$broadcast(\"sprint:us:moved\", us, oldSprintId, newSprintId));\n }\n return _results;\n });\n };\n })(this));\n promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n return promise;\n };\n\n BacklogController.prototype.getUrlFilters = function() {\n return _.pick(this.location.search(), \"statuses\", \"tags\", \"q\");\n };\n\n BacklogController.prototype.generateFilters = function() {\n var isSelected, name, plainStatuses, plainTags, searchdata, urlfilters, val, value, _i, _len, _ref;\n urlfilters = this.getUrlFilters();\n if (urlfilters.q) {\n this.scope.filtersQ = this.scope.filtersQ || urlfilters.q;\n }\n searchdata = {};\n for (name in urlfilters) {\n value = urlfilters[name];\n if (searchdata[name] == null) {\n searchdata[name] = {};\n }\n _ref = taiga.toString(value).split(\",\");\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n val = _ref[_i];\n searchdata[name][val] = true;\n }\n }\n isSelected = function(type, id) {\n if ((searchdata[type] != null) && searchdata[type][id]) {\n return true;\n }\n return false;\n };\n this.scope.filters = {};\n plainTags = _.flatten(_.filter(_.map(this.scope.userstories, \"tags\")));\n plainTags.sort();\n this.scope.filters.tags = _.map(_.countBy(plainTags), (function(_this) {\n return function(v, k) {\n var obj;\n obj = {\n id: k,\n type: \"tags\",\n name: k,\n color: _this.scope.project.tags_colors[k],\n count: v\n };\n if (isSelected(\"tags\", obj.id)) {\n obj.selected = true;\n }\n return obj;\n };\n })(this));\n plainStatuses = _.map(this.scope.userstories, \"status\");\n plainStatuses = _.filter(plainStatuses, (function(_this) {\n return function(status) {\n if (status) {\n return status;\n }\n };\n })(this));\n this.scope.filters.statuses = _.map(_.countBy(plainStatuses), (function(_this) {\n return function(v, k) {\n var obj;\n obj = {\n id: k,\n type: \"statuses\",\n name: _this.scope.usStatusById[k].name,\n color: _this.scope.usStatusById[k].color,\n count: v\n };\n if (isSelected(\"statuses\", obj.id)) {\n obj.selected = true;\n }\n return obj;\n };\n })(this));\n return this.scope.filters;\n };\n\n BacklogController.prototype.editUserStory = function(us) {\n return this.rootscope.$broadcast(\"usform:edit\", us);\n };\n\n BacklogController.prototype.deleteUserStory = function(us) {\n var message, title;\n title = \"Delete User Story\";\n message = us.subject;\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var promise;\n _this.scope.userstories = _.without(_this.scope.userstories, us);\n _this.filterVisibleUserstories();\n promise = _this.repo.remove(us);\n promise.then(function() {\n finish();\n return _this.loadBacklog();\n });\n return promise.then(null, function() {\n finish(false);\n return _this.confirm.notify(\"error\");\n });\n };\n })(this));\n };\n\n BacklogController.prototype.addNewUs = function(type) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"usform:new\", this.scope.projectId, this.scope.project.default_us_status, this.scope.usStatusList);\n case \"bulk\":\n return this.rootscope.$broadcast(\"usform:bulk\", this.scope.projectId, this.scope.project.default_us_status);\n }\n };\n\n BacklogController.prototype.addNewSprint = function() {\n return this.rootscope.$broadcast(\"sprintform:create\", this.scope.projectId);\n };\n\n return BacklogController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"BacklogController\", BacklogController);\n\n BacklogDirective = function($repo, $rootscope) {\n var doomLineTemplate, link, linkDoomLine, linkFilters, linkToolbar, showHideFilter, showHideTags;\n doomLineTemplate = _.template(\"
Project Scope [Doomline]
\");\n linkDoomLine = function($scope, $el, $attrs, $ctrl) {\n var addDoomLineDom, getUsItems, reloadDoomLine, removeDoomlineDom;\n reloadDoomLine = function() {\n var current_sum, element, elements, scope, stats, total_points, _i, _len, _results;\n if ($scope.stats != null) {\n removeDoomlineDom();\n elements = getUsItems();\n stats = $scope.stats;\n total_points = stats.total_points;\n current_sum = stats.assigned_points;\n _results = [];\n for (_i = 0, _len = elements.length; _i < _len; _i++) {\n element = elements[_i];\n scope = element.scope();\n if (scope.us == null) {\n continue;\n }\n current_sum += scope.us.total_points;\n if (current_sum > total_points) {\n addDoomLineDom(element);\n break;\n } else {\n _results.push(void 0);\n }\n }\n return _results;\n }\n };\n removeDoomlineDom = function() {\n return $el.find(\".doom-line\").remove();\n };\n addDoomLineDom = function(element) {\n return element != null ? element.before(doomLineTemplate({})) : void 0;\n };\n getUsItems = function() {\n var rowElements;\n rowElements = $el.find('.backlog-table-body .us-item-row');\n return _.map(rowElements, function(x) {\n return angular.element(x);\n });\n };\n $scope.$on(\"userstories:loaded\", reloadDoomLine);\n return $scope.$watch(\"stats\", reloadDoomLine);\n };\n linkToolbar = function($scope, $el, $attrs, $ctrl) {\n var moveToCurrentSprint;\n moveToCurrentSprint = function(selectedUss) {\n var extraPoints, totalExtraPoints, ussCurrent;\n ussCurrent = _($scope.userstories);\n $scope.userstories = ussCurrent.without.apply(ussCurrent, selectedUss).value();\n extraPoints = _.map(selectedUss, function(v, k) {\n return v.total_points;\n });\n totalExtraPoints = _.reduce(extraPoints, function(acc, num) {\n return acc + num;\n });\n $scope.sprints[0].user_stories = _.union($scope.sprints[0].user_stories, selectedUss);\n $scope.sprints[0].total_points += totalExtraPoints;\n $ctrl.filterVisibleUserstories();\n return $repo.saveAll(selectedUss).then(function() {\n $ctrl.loadSprints();\n return $ctrl.loadProjectStats();\n });\n };\n $el.on(\"change\", \".backlog-table-body .user-stories input:checkbox\", function(event) {\n var moveToCurrentSprintDom, selectedUsDom, target;\n target = angular.element(event.currentTarget);\n moveToCurrentSprintDom = $el.find(\"#move-to-current-sprint\");\n selectedUsDom = $el.find(\".backlog-table-body .user-stories input:checkbox:checked\");\n if (selectedUsDom.length > 0 && $scope.sprints.length > 0) {\n moveToCurrentSprintDom.show();\n } else {\n moveToCurrentSprintDom.hide();\n }\n return target.closest('.us-item-row').toggleClass('ui-multisortable-multiple');\n });\n $el.on(\"click\", \"#move-to-current-sprint\", (function(_this) {\n return function(event) {\n var ussDom, ussToMove;\n ussDom = $el.find(\".backlog-table-body .user-stories input:checkbox:checked\");\n ussToMove = _.map(ussDom, function(item) {\n var itemScope;\n itemScope = angular.element(item).scope();\n itemScope.us.milestone = $scope.sprints[0].id;\n return itemScope.us;\n });\n return $scope.$apply(_.partial(moveToCurrentSprint, ussToMove));\n };\n })(this));\n return $el.on(\"click\", \"#show-tags\", function(event) {\n event.preventDefault();\n $ctrl.toggleShowTags();\n return showHideTags($ctrl);\n });\n };\n showHideTags = function($ctrl) {\n var elm;\n elm = angular.element(\"#show-tags\");\n if ($ctrl.showTags) {\n elm.addClass(\"active\");\n return elm.find(\".text\").text(\"Hide Tags\");\n } else {\n elm.removeClass(\"active\");\n return elm.find(\".text\").text(\"Show Tags\");\n }\n };\n showHideFilter = function($scope, $el, $ctrl) {\n var sidebar, target;\n sidebar = $el.find(\"sidebar.filters-bar\");\n sidebar.one(\"transitionend\", function() {\n return timeout(150, function() {\n $rootscope.$broadcast(\"resize\");\n return $('.burndown').css(\"visibility\", \"visible\");\n });\n });\n target = angular.element(\"#show-filters-button\");\n $('.burndown').css(\"visibility\", \"hidden\");\n sidebar.toggleClass(\"active\");\n target.toggleClass(\"active\");\n toggleText(target.find(\".text\"), [\"Remove Filters\", \"Show Filters\"]);\n if (!sidebar.hasClass(\"active\")) {\n $ctrl.resetFilters();\n }\n return $ctrl.toggleActiveFilters();\n };\n linkFilters = function($scope, $el, $attrs, $ctrl) {\n $scope.filtersSearch = {};\n return $el.on(\"click\", \"#show-filters-button\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n return showHideFilter($scope, $el, $ctrl);\n });\n });\n };\n link = function($scope, $el, $attrs, $rootscope) {\n var $ctrl, filters;\n $ctrl = $el.controller();\n linkToolbar($scope, $el, $attrs, $ctrl);\n linkFilters($scope, $el, $attrs, $ctrl);\n linkDoomLine($scope, $el, $attrs, $ctrl);\n $el.find(\".backlog-table-body\").disableSelection();\n filters = $ctrl.getUrlFilters();\n if (filters.statuses || filters.tags || filters.q) {\n showHideFilter($scope, $el, $ctrl);\n }\n $scope.$on(\"showTags\", function() {\n return showHideTags($ctrl);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklog\", [\"$tgRepo\", \"$rootScope\", BacklogDirective]);\n\n UsRolePointsSelectorDirective = function($rootscope, $template) {\n var link, selectionTemplate;\n selectionTemplate = $template.get(\"backlog/us-role-points-popover.html\", true);\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var numberOfRoles, roles;\n roles = _.filter(project.roles, \"computable\");\n numberOfRoles = _.size(roles);\n if (numberOfRoles > 1) {\n return $el.append(selectionTemplate({\n \"roles\": roles\n }));\n } else {\n $el.find(\".icon-arrow-bottom\").remove();\n return $el.find(\".header-points\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"uspoints:select\", function(ctx, roleId, roleName) {\n $el.find(\".popover\").popover().close();\n return $el.find(\".header-points\").html(roleName + \"/Total\");\n });\n $scope.$on(\"uspoints:clear-selection\", function(ctx, roleId) {\n $el.find(\".popover\").popover().close();\n return $el.find(\".header-points\").text(\"Points\");\n });\n $el.on(\"click\", function(event) {\n var target;\n target = angular.element(event.target);\n if (target.is(\"span\") || target.is(\"div\")) {\n event.stopPropagation();\n }\n return $el.find(\".popover\").popover().open();\n });\n $el.on(\"click\", \".clear-selection\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $rootscope.$broadcast(\"uspoints:clear-selection\");\n });\n $el.on(\"click\", \".role\", function(event) {\n var rolScope, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n rolScope = target.scope();\n return $rootscope.$broadcast(\"uspoints:select\", target.data(\"role-id\"), target.text());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUsRolePointsSelector\", [\"$rootScope\", \"$tgTemplate\", UsRolePointsSelectorDirective]);\n\n UsPointsDirective = function($repo, $tgTemplate) {\n var link, pointsTemplate, rolesTemplate;\n rolesTemplate = $tgTemplate.get(\"backlog/us-points-roles-popover.html\", true);\n pointsTemplate = $tgTemplate.get(\"backlog/us-points-popover.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, calculateTotalPoints, computableRoles, numberOfRoles, renderPoints, renderPointsSelector, renderRolesSelector, roles, selectedRoleId, updatePointsRoles, updatingSelectedRoleId, us;\n $ctrl = $el.controller();\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n updatingSelectedRoleId = null;\n selectedRoleId = null;\n numberOfRoles = _.size(us.points);\n if (numberOfRoles === 1) {\n selectedRoleId = _.keys(us.points)[0];\n }\n roles = [];\n updatePointsRoles = function() {\n return roles = _.map(computableRoles, function(role) {\n var pointId, pointObj;\n pointId = us.points[role.id];\n pointObj = $scope.pointsById[pointId];\n role = _.clone(role, true);\n role.points = pointObj.value != null ? pointObj.value : \"?\";\n return role;\n });\n };\n computableRoles = _.filter($scope.project.roles, \"computable\");\n updatePointsRoles();\n if (roles.length === 0) {\n $el.find(\".icon-arrow-bottom\").remove();\n $el.find(\"a.us-points\").addClass(\"not-clickable\");\n }\n renderPointsSelector = function(us, roleId) {\n var html, points;\n points = _.map($scope.project.points, function(point) {\n point = _.clone(point, true);\n point.selected = us.points[roleId] === point.id ? false : true;\n return point;\n });\n html = pointsTemplate({\n \"points\": points\n });\n $el.find(\".popover\").popover().close();\n $el.find(\".pop-points-open\").remove();\n $el.append(html);\n if ($el.find(\".pop-role:visible\").css(\"left\") == null) {\n $el.find(\".pop-points-open\").css(\"left\", \"110px\");\n }\n return $el.find(\".pop-points-open\").popover().open();\n };\n renderRolesSelector = function(us) {\n var html;\n updatePointsRoles();\n html = rolesTemplate({\n \"roles\": roles\n });\n $el.append(html);\n return $el.find(\".pop-role\").popover().open(function() {\n return $(this).remove();\n });\n };\n renderPoints = function(us, roleId) {\n var dom, pointId, pointObj, totalPoints;\n dom = $el.find(\"a > span.points-value\");\n if (roleId === null || numberOfRoles === 1) {\n totalPoints = us.total_points != null ? us.total_points : \"?\";\n dom.text(totalPoints);\n return dom.parent().prop(\"title\", totalPoints);\n } else {\n pointId = us.points[roleId];\n pointObj = $scope.pointsById[pointId];\n dom.html(pointObj.name + \" / \" + us.total_points + \"\");\n return dom.parent().prop(\"title\", pointObj.name + \" / \" + us.total_points);\n }\n };\n calculateTotalPoints = function() {\n var values;\n values = _.map(us.points, function(v, k) {\n return $scope.pointsById[v].value;\n });\n values = _.filter(values, function(num) {\n return num != null;\n });\n if (values.length === 0) {\n return \"?\";\n }\n return _.reduce(values, function(acc, num) {\n return acc + num;\n });\n };\n $scope.$watch($attrs.tgBacklogUsPoints, function(us) {\n if (us) {\n return renderPoints(us, selectedRoleId);\n }\n });\n $scope.$on(\"uspoints:select\", function(ctx, roleId, roleName) {\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n renderPoints(us, roleId);\n return selectedRoleId = roleId;\n });\n $scope.$on(\"uspoints:clear-selection\", function(ctx) {\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n renderPoints(us, null);\n return selectedRoleId = null;\n });\n if (roles.length > 0) {\n $el.on(\"click\", \"a.us-points span\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n updatingSelectedRoleId = selectedRoleId;\n if (selectedRoleId != null) {\n return renderPointsSelector(us, selectedRoleId);\n } else {\n return renderRolesSelector(us);\n }\n });\n $el.on(\"click\", \".role\", function(event) {\n var popRolesDom, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n updatingSelectedRoleId = target.data(\"role-id\");\n popRolesDom = $el.find(\".pop-role\");\n popRolesDom.find(\"a\").removeClass(\"active\");\n popRolesDom.find(\"a[data-role-id='\" + updatingSelectedRoleId + \"']\").addClass(\"active\");\n return renderPointsSelector(us, updatingSelectedRoleId);\n });\n $el.on(\"click\", \".point\", function(event) {\n var points, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n $el.find(\".pop-points-open\").hide();\n $el.find(\".pop-role\").hide();\n us = $scope.$eval($attrs.tgBacklogUsPoints);\n points = _.clone(us.points, true);\n points[updatingSelectedRoleId] = target.data(\"point-id\");\n return $scope.$apply(function() {\n us.points = points;\n us.total_points = calculateTotalPoints(us);\n renderPoints(us, selectedRoleId);\n return $repo.save(us).then(function() {\n return $repo.refresh(us).then(function() {\n return $ctrl.loadProjectStats();\n });\n });\n });\n });\n }\n bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\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(\"tgBacklogUsPoints\", [\"$tgRepo\", \"$tgTemplate\", UsPointsDirective]);\n\n tgBacklogGraphDirective = function() {\n var link, redrawChart;\n redrawChart = function(element, dataToDraw) {\n var client_increment_line, colors, data, evolution_line, milestonesRange, optimal_line, options, team_increment_line, width, zero_line, _i, _ref, _results;\n width = element.width();\n element.height(width / 6);\n milestonesRange = (function() {\n _results = [];\n for (var _i = 0, _ref = dataToDraw.milestones.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; 0 <= _ref ? _i++ : _i--){ _results.push(_i); }\n return _results;\n }).apply(this);\n data = [];\n zero_line = _.map(dataToDraw.milestones, function(ml) {\n return 0;\n });\n data.push({\n data: _.zip(milestonesRange, zero_line),\n lines: {\n fillColor: \"rgba(0,0,0,0)\"\n },\n points: {\n show: false\n }\n });\n optimal_line = _.map(dataToDraw.milestones, function(ml) {\n return ml.optimal;\n });\n data.push({\n data: _.zip(milestonesRange, optimal_line),\n lines: {\n fillColor: \"rgba(120,120,120,0.2)\"\n }\n });\n evolution_line = _.filter(_.map(dataToDraw.milestones, function(ml) {\n return ml.evolution;\n }), function(evolution) {\n return evolution != null;\n });\n data.push({\n data: _.zip(milestonesRange, evolution_line),\n lines: {\n fillColor: \"rgba(102,153,51,0.3)\"\n }\n });\n team_increment_line = _.map(dataToDraw.milestones, function(ml) {\n return -ml[\"team-increment\"];\n });\n data.push({\n data: _.zip(milestonesRange, team_increment_line),\n lines: {\n fillColor: \"rgba(153,51,51,0.3)\"\n }\n });\n client_increment_line = _.map(dataToDraw.milestones, function(ml) {\n return -ml[\"team-increment\"] - ml[\"client-increment\"];\n });\n data.push({\n data: _.zip(milestonesRange, client_increment_line),\n lines: {\n fillColor: \"rgba(255,51,51,0.3)\"\n }\n });\n colors = [\"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)\"];\n options = {\n grid: {\n borderWidth: {\n top: 0,\n right: 1,\n left: 0,\n bottom: 0\n },\n borderColor: \"#ccc\",\n hoverable: true\n },\n xaxis: {\n ticks: dataToDraw.milestones.length,\n axisLabel: \"Sprints\",\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 14,\n axisLabelFontFamily: \"Verdana, Arial, Helvetica, Tahoma, sans-serif\",\n axisLabelPadding: 15,\n tickFormatter: function(val, axis) {\n return \"\";\n }\n },\n series: {\n shadowSize: 0,\n lines: {\n show: true,\n fill: true\n },\n points: {\n show: true,\n fill: true,\n radius: 4,\n lineWidth: 2\n }\n },\n colors: colors,\n tooltip: true,\n tooltipOpts: {\n content: function(label, xval, yval, flotItem) {\n if (flotItem.seriesIndex === 1) {\n return \"Optimal pending points for sprint \" + xval + \" should be \" + yval;\n } else if (flotItem.seriesIndex === 2) {\n return \"Real pending points for sprint \" + xval + \" is \" + yval;\n } else if (flotItem.seriesIndex === 3) {\n return \"Incremented points by team requirements for sprint \" + xval + \" is \" + (Math.abs(yval));\n } else {\n return \"Incremented points by client requirements for sprint \" + xval + \" is \" + (Math.abs(yval));\n }\n }\n }\n };\n element.empty();\n return element.plot(data, options).data(\"plot\");\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch(\"stats\", function(value) {\n if ($scope.stats != null) {\n redrawChart(element, $scope.stats);\n return $scope.$on(\"resize\", function() {\n return redrawChart(element, $scope.stats);\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(\"tgGmBacklogGraph\", tgBacklogGraphDirective);\n\n TgBacklogProgressBarDirective = function($template) {\n var adjustPercentaje, link, render, template;\n template = $template.get(\"backlog/progress-bar.html\", true);\n render = function(el, projectPointsPercentaje, closedPointsPercentaje) {\n return el.html(template({\n projectPointsPercentaje: projectPointsPercentaje,\n closedPointsPercentaje: closedPointsPercentaje\n }));\n };\n adjustPercentaje = function(percentage) {\n var adjusted;\n adjusted = _.max([0, percentage]);\n adjusted = _.min([100, adjusted]);\n return Math.round(adjusted);\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$watch($attrs.tgBacklogProgressBar, function(stats) {\n var closedPoints, closedPointsPercentaje, definedPoints, projectPointsPercentaje, totalPoints;\n if (stats != null) {\n totalPoints = stats.total_points;\n definedPoints = stats.defined_points;\n closedPoints = stats.closed_points;\n if (definedPoints > totalPoints) {\n projectPointsPercentaje = totalPoints * 100 / definedPoints;\n closedPointsPercentaje = closedPoints * 100 / definedPoints;\n } else {\n projectPointsPercentaje = 100;\n closedPointsPercentaje = closedPoints * 100 / totalPoints;\n }\n projectPointsPercentaje = adjustPercentaje(projectPointsPercentaje - 3);\n closedPointsPercentaje = adjustPercentaje(closedPointsPercentaje - 3);\n return render($el, projectPointsPercentaje, closedPointsPercentaje);\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(\"tgBacklogProgressBar\", [\"$tgTemplate\", TgBacklogProgressBarDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/sortable.coffee\n */\n\n(function() {\n var BacklogEmptySortableDirective, BacklogSortableDirective, SprintSortableDirective, bindOnce, deleteElement, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaBacklog\");\n\n deleteElement = function(el) {\n el.scope().$destroy();\n el.off();\n return el.remove();\n };\n\n BacklogSortableDirective = function($repo, $rs, $rootscope, $tgConfirm) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var filterError;\n if (!(project.my_permissions.indexOf(\"modify_us\") > -1)) {\n return;\n }\n filterError = function() {\n return $tgConfirm.notify(\"error\", \"You can't drop on backlog when filters are open\");\n };\n $el.sortable({\n items: \".us-item-row\",\n connectWith: \".sprint\",\n containment: \".wrapper\",\n dropOnEmpty: true,\n placeholder: \"row us-item-row us-item-drag sortable-placeholder\",\n scroll: true,\n tolerance: \"pointer\",\n revert: false,\n cursorAt: {\n right: 15\n },\n stop: function() {\n if ($el.hasClass(\"active-filters\")) {\n $el.sortable(\"cancel\");\n return filterError();\n }\n }\n });\n $el.on(\"multiplesortreceive\", function(event, ui) {\n var itemIndex, itemUs;\n if ($el.hasClass(\"active-filters\")) {\n ui.source.sortable(\"cancel\");\n filterError();\n return;\n }\n itemUs = ui.item.scope().us;\n itemIndex = ui.item.index();\n deleteElement(ui.item);\n $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, null);\n return ui.item.find('a').removeClass('noclick');\n });\n $el.on(\"multiplesortstop\", function(event, ui) {\n var index, items, us;\n if ($(ui.items[0]).parent().length === 0) {\n return;\n }\n items = _.sortBy(ui.items, function(item) {\n return $(item).index();\n });\n index = _.min(_.map(items, function(item) {\n return $(item).index();\n }));\n us = _.map(items, function(item) {\n var itemUs;\n item = $(item);\n itemUs = item.scope().us;\n setTimeout(((function(_this) {\n return function() {\n return item.find('a').removeClass('noclick');\n };\n })(this)), 300);\n return itemUs;\n });\n return $scope.$emit(\"sprint:us:move\", us, index, null);\n });\n return $el.on(\"sortstart\", function(event, ui) {\n return ui.item.find('a').addClass('noclick');\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n BacklogEmptySortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n $el.sortable({\n dropOnEmpty: true\n });\n return $el.on(\"sortreceive\", function(event, ui) {\n var itemIndex, itemUs;\n itemUs = ui.item.scope().us;\n itemIndex = ui.item.index();\n deleteElement(ui.item);\n $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, null);\n return ui.item.find('a').removeClass('noclick');\n });\n }\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n SprintSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n $el.sortable({\n scroll: true,\n dropOnEmpty: true,\n items: \".sprint-table .milestone-us-item-row\",\n connectWith: \".sprint,.backlog-table-body,.empty-backlog\"\n });\n $el.on(\"multiplesortreceive\", function(event, ui) {\n var index, items, us;\n items = _.sortBy(ui.items, function(item) {\n return $(item).index();\n });\n index = _.min(_.map(items, function(item) {\n return $(item).index();\n }));\n us = _.map(items, function(item) {\n var itemUs;\n item = $(item);\n itemUs = item.scope().us;\n deleteElement(item);\n return itemUs;\n });\n return $scope.$emit(\"sprint:us:move\", us, index, $scope.sprint.id);\n });\n $el.on(\"multiplesortstop\", function(event, ui) {\n var itemIndex, itemUs;\n if (ui.item.parent().length === 0) {\n return;\n }\n itemUs = ui.item.scope().us;\n itemIndex = ui.item.index();\n setTimeout(((function(_this) {\n return function() {\n return ui.item.find('a').removeClass('noclick');\n };\n })(this)), 300);\n return $scope.$emit(\"sprint:us:move\", [itemUs], itemIndex, $scope.sprint.id);\n });\n return $el.on(\"sortstart\", function(event, ui) {\n return ui.item.find('a').addClass('noclick');\n });\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"$tgConfirm\", BacklogSortableDirective]);\n\n module.directive(\"tgBacklogEmptySortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", BacklogEmptySortableDirective]);\n\n module.directive(\"tgSprintSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", SprintSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/sprints.coffee\n */\n\n(function() {\n var BacklogSprintDirective, BacklogSprintHeaderDirective, ToggleExcludeClosedSprintsVisualization, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaBacklog\");\n\n BacklogSprintDirective = function($repo, $rootscope) {\n var link, refreshSprintTableHeight, slideOptions, sprintTableMinHeight, toggleSprint;\n sprintTableMinHeight = 50;\n slideOptions = {\n duration: 500,\n easing: 'linear'\n };\n refreshSprintTableHeight = (function(_this) {\n return function(sprintTable) {\n if (!sprintTable.find(\".row\").length) {\n return sprintTable.css(\"height\", sprintTableMinHeight);\n } else {\n return sprintTable.css(\"height\", \"auto\");\n }\n };\n })(this);\n toggleSprint = (function(_this) {\n return function($el) {\n var sprintArrow, sprintTable;\n sprintTable = $el.find(\".sprint-table\");\n sprintArrow = $el.find(\".icon-arrow-up\");\n sprintArrow.toggleClass('active');\n sprintTable.toggleClass('open');\n return refreshSprintTableHeight(sprintTable);\n };\n })(this);\n link = function($scope, $el, $attrs) {\n $scope.$watch($attrs.tgBacklogSprint, function(sprint) {\n sprint = $scope.$eval($attrs.tgBacklogSprint);\n if (sprint.closed) {\n return $el.addClass(\"sprint-closed\");\n } else {\n return toggleSprint($el);\n }\n });\n $el.on(\"click\", \".sprint-name > .icon-arrow-up\", function(event) {\n toggleSprint($el);\n return $el.find(\".sprint-table\").slideToggle(slideOptions);\n });\n $el.on(\"click\", \".sprint-name > .icon-edit\", function(event) {\n var sprint;\n event.preventDefault();\n sprint = $scope.$eval($attrs.tgBacklogSprint);\n return $rootscope.$broadcast(\"sprintform:edit\", sprint);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogSprint\", [\"$tgRepo\", \"$rootScope\", BacklogSprintDirective]);\n\n BacklogSprintHeaderDirective = function($navUrls, $template) {\n var link, template;\n template = $template.get(\"backlog/sprint-header.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, isVisible, render;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_milestone\") !== -1;\n };\n isVisible = function() {\n return $scope.project.my_permissions.indexOf(\"view_milestones\") !== -1;\n };\n render = function(sprint) {\n var ctx, estimatedDateRange, finish, start, taskboardUrl;\n taskboardUrl = $navUrls.resolve(\"project-taskboard\", {\n project: $scope.project.slug,\n sprint: sprint.slug\n });\n start = moment(sprint.estimated_start).format(\"DD MMM YYYY\");\n finish = moment(sprint.estimated_finish).format(\"DD MMM YYYY\");\n estimatedDateRange = start + \"-\" + finish;\n ctx = {\n name: sprint.name,\n taskboardUrl: taskboardUrl,\n estimatedDateRange: estimatedDateRange,\n closedPoints: sprint.closed_points || 0,\n totalPoints: sprint.total_points || 0,\n isVisible: isVisible(),\n isEditable: isEditable()\n };\n return $el.html(template(ctx));\n };\n $scope.$watch($attrs.ngModel, function(sprint) {\n return render(sprint);\n });\n $scope.$on(\"sprintform:edit:success\", function() {\n return render($model.$modelValue);\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(\"tgBacklogSprintHeader\", [\"$tgNavUrls\", \"$tgTemplate\", BacklogSprintHeaderDirective]);\n\n ToggleExcludeClosedSprintsVisualization = function($rootscope, $loading) {\n var excludeClosedSprints, link;\n excludeClosedSprints = false;\n link = function($scope, $el, $attrs) {\n $el.on(\"click\", \"\", function(event) {\n $loading.start($el.parent().siblings('.loading-spinner'));\n return $rootscope.$broadcast(\"backlog:toggle-closed-sprints-visualization\");\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return $scope.$on(\"sprints:loaded\", (function(_this) {\n return function(ctx, sprints) {\n var closedSprints;\n closedSprints = _.filter(sprints, function(sprint) {\n return sprint.closed;\n });\n $loading.finish($el.parent().siblings('.loading-spinner'));\n if (closedSprints.length > 0) {\n return $el.text(\"Hide closed sprints\");\n } else {\n return $el.text(\"Show closed sprints\");\n }\n };\n })(this));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBacklogToggleClosedSprintsVisualization\", [\"$rootScope\", \"$tgLoading\", ToggleExcludeClosedSprintsVisualization]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/charts.coffee\n */\n\n(function() {\n var SprintGraphDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaTaskboard\");\n\n SprintGraphDirective = function() {\n var link, redrawChart;\n redrawChart = function(element, dataToDraw) {\n var data, days, options, width;\n width = element.width();\n element.height(240);\n days = _.map(dataToDraw, function(x) {\n return moment(x.day);\n });\n data = [];\n data.unshift({\n data: _.zip(days, _.map(dataToDraw, function(d) {\n return d.optimal_points;\n })),\n lines: {\n fillColor: \"rgba(120,120,120,0.2)\"\n }\n });\n data.unshift({\n data: _.zip(days, _.map(dataToDraw, function(d) {\n return d.open_points;\n })),\n lines: {\n fillColor: \"rgba(102,153,51,0.3)\"\n }\n });\n options = {\n grid: {\n borderWidth: {\n top: 0,\n right: 1,\n left: 0,\n bottom: 0\n },\n borderColor: '#ccc',\n hoverable: true\n },\n xaxis: {\n tickSize: [1, \"day\"],\n min: days[0],\n max: _.last(days),\n mode: \"time\",\n daysNames: days,\n axisLabel: 'Day',\n axisLabelUseCanvas: true,\n axisLabelFontSizePixels: 12,\n axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',\n axisLabelPadding: 5\n },\n yaxis: {\n min: 0\n },\n series: {\n shadowSize: 0,\n lines: {\n show: true,\n fill: true\n },\n points: {\n show: true,\n fill: true,\n radius: 4,\n lineWidth: 2\n }\n },\n colors: [\"rgba(102,153,51,1)\", \"rgba(120,120,120,0.2)\"],\n tooltip: true,\n tooltipOpts: {\n content: function(label, xval, yval, flotItem) {\n var formattedDate, roundedValue;\n formattedDate = moment(xval).format(\"DD MMM\");\n roundedValue = Math.round(yval);\n if (flotItem.seriesIndex === 1) {\n return \"Optimal pending points for day \" + formattedDate + \" should be \" + roundedValue;\n } else {\n return \"Real pending points for day \" + formattedDate + \" is \" + roundedValue;\n }\n }\n }\n };\n element.empty();\n return element.plot(data, options).data(\"plot\");\n };\n link = function($scope, $el, $attrs) {\n var element;\n element = angular.element($el);\n $scope.$on(\"resize\", function() {\n if ($scope.stats) {\n return redrawChart(element, $scope.stats.days);\n }\n });\n $scope.$on(\"taskboard:graph:toggle-visibility\", function() {\n $el.parent().toggleClass('open');\n return timeout(100, function() {\n if ($scope.stats) {\n return redrawChart(element, $scope.stats.days);\n }\n });\n });\n $scope.$watch('stats', function(value) {\n if ($scope.stats == null) {\n return;\n }\n return redrawChart(element, $scope.stats.days);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSprintGraph\", SprintGraphDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var CreateBulkTasksDirective, CreateEditTaskDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n CreateEditTaskDirective = function($repo, $model, $rs, $rootscope, $loading, lightboxService) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.isNew = true;\n $scope.$on(\"taskform:new\", function(ctx, sprintId, usId) {\n $scope.task = {\n project: $scope.projectId,\n milestone: sprintId,\n user_story: usId,\n is_archived: false,\n status: $scope.project.default_task_status,\n assigned_to: null,\n tags: []\n };\n $scope.isNew = true;\n $el.find(\".button-green span\").html(\"Create\");\n $el.find(\".title\").html(\"New task \");\n $el.find(\".tag-input\").val(\"\");\n return lightboxService.open($el);\n });\n $scope.$on(\"taskform:edit\", function(ctx, task) {\n $scope.task = task;\n $scope.isNew = false;\n $el.find(\".button-green span\").html(\"Save\");\n $el.find(\".title\").html(\"Edit task \");\n $el.find(\".tag-input\").val(\"\");\n return lightboxService.open($el);\n });\n submitButton = $el.find(\".submit-button\");\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var broadcastEvent, form, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n if ($scope.isNew) {\n promise = $repo.create(\"tasks\", $scope.task);\n broadcastEvent = \"taskform:new:success\";\n } else {\n promise = $repo.save($scope.task);\n broadcastEvent = \"taskform:edit:success\";\n }\n $loading.start(submitButton);\n return promise.then(function(data) {\n $loading.finish(submitButton);\n lightboxService.close($el);\n return $rootscope.$broadcast(broadcastEvent, data);\n });\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n CreateBulkTasksDirective = function($repo, $rs, $rootscope, $loading, lightboxService) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.form = {\n data: \"\",\n usId: null\n };\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var data, form, projectId, promise, sprintId, usId;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n data = $scope.form.data;\n projectId = $scope.projectId;\n sprintId = $scope.form.sprintId;\n usId = $scope.form.usId;\n promise = $rs.tasks.bulkCreate(projectId, sprintId, usId, data);\n promise.then(function(result) {\n $loading.finish(submitButton);\n $rootscope.$broadcast(\"taskform:bulk:success\", result);\n return lightboxService.close($el);\n });\n return promise.then(null, function() {\n $loading.finish(submitButton);\n return console.log(\"FAIL\");\n });\n };\n })(this));\n $scope.$on(\"taskform:bulk\", function(ctx, sprintId, usId) {\n lightboxService.open($el);\n return $scope.form = {\n data: \"\",\n sprintId: sprintId,\n usId: usId\n };\n });\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaTaskboard\");\n\n module.directive(\"tgLbCreateEditTask\", [\"$tgRepo\", \"$tgModel\", \"$tgResources\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", CreateEditTaskDirective]);\n\n module.directive(\"tgLbCreateBulkTasks\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", CreateBulkTasksDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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 TaskboardController, TaskboardDirective, TaskboardSquishColumnDirective, TaskboardTableHeightFixerDirective, TaskboardTaskDirective, TaskboardUserDirective, bindMethods, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText,\n __extends = 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 toggleText = this.taiga.toggleText;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n scopeDefer = this.taiga.scopeDefer;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaTaskboard\");\n\n TaskboardController = (function(_super) {\n __extends(TaskboardController, _super);\n\n TaskboardController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$appTitle\", \"$tgLocation\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"tgLoader\"];\n\n function TaskboardController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_appTitle, _at_location, _at_navUrls, _at_events, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.appTitle = _at_appTitle;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.events = _at_events;\n this.analytics = _at_analytics;\n bindMethods(this);\n this.scope.sectionName = \"Taskboard\";\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Taskboard - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n TaskboardController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"taskform:bulk:success\", (function(_this) {\n return function() {\n _this.loadTaskboard();\n return _this.analytics.trackEvent(\"task\", \"create\", \"bulk create task on taskboard\", 1);\n };\n })(this));\n this.scope.$on(\"taskform:new:success\", (function(_this) {\n return function() {\n _this.loadTaskboard();\n return _this.analytics.trackEvent(\"task\", \"create\", \"create task on taskboard\", 1);\n };\n })(this));\n this.scope.$on(\"taskform:edit:success\", (function(_this) {\n return function() {\n return _this.loadTaskboard();\n };\n })(this));\n this.scope.$on(\"taskboard:task:move\", this.taskMove);\n return this.scope.$on(\"assigned-to:added\", (function(_this) {\n return function(ctx, userId, task) {\n var promise;\n task.assigned_to = userId;\n promise = _this.repo.save(task);\n return promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n };\n })(this));\n };\n\n TaskboardController.prototype.initializeSubscription = function() {\n var routingKey, routingKey1;\n routingKey = \"changes.project.\" + this.scope.projectId + \".tasks\";\n this.events.subscribe(this.scope, routingKey, (function(_this) {\n return function(message) {\n return _this.loadTaskboard();\n };\n })(this));\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n return this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n _this.refreshTagsColors();\n _this.loadSprintStats();\n return _this.loadSprint();\n };\n })(this));\n };\n\n TaskboardController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(e) {\n return e.id;\n });\n _this.scope.roleById = groupBy(project.roles, function(e) {\n return e.id;\n });\n _this.scope.taskStatusList = _.sortBy(project.task_statuses, \"order\");\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.scope.usStatusById = groupBy(project.us_statuses, function(e) {\n return e.id;\n });\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadSprintStats = function() {\n return this.rs.sprints.stats(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(stats) {\n var completedPointsSum, remainingPointsSum, remainingTasks, totalPointsSum;\n totalPointsSum = _.reduce(_.values(stats.total_points), (function(res, n) {\n return res + n;\n }), 0);\n completedPointsSum = _.reduce(_.values(stats.completed_points), (function(res, n) {\n return res + n;\n }), 0);\n remainingPointsSum = totalPointsSum - completedPointsSum;\n remainingTasks = stats.total_tasks - stats.completed_tasks;\n _this.scope.stats = stats;\n _this.scope.stats.totalPointsSum = totalPointsSum;\n _this.scope.stats.completedPointsSum = completedPointsSum;\n _this.scope.stats.remainingPointsSum = remainingPointsSum;\n _this.scope.stats.remainingTasks = remainingTasks;\n if (stats.totalPointsSum) {\n _this.scope.stats.completedPercentage = Math.round(100 * stats.completedPointsSum / stats.totalPointsSum);\n } else {\n _this.scope.stats.completedPercentage = 0;\n }\n _this.scope.stats.openTasks = stats.total_tasks - stats.completed_tasks;\n return stats;\n };\n })(this));\n };\n\n TaskboardController.prototype.refreshTagsColors = function() {\n return this.rs.projects.tagsColors(this.scope.projectId).then((function(_this) {\n return function(tags_colors) {\n return _this.scope.project.tags_colors = tags_colors;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadSprint = function() {\n return this.rs.sprints.get(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n _this.scope.userstories = _.sortBy(sprint.user_stories, \"sprint_order\");\n return sprint;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadTasks = function() {\n return this.rs.tasks.list(this.scope.projectId, this.scope.sprintId).then((function(_this) {\n return function(tasks) {\n var status, task, us, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;\n _this.scope.tasks = _.sortBy(tasks, 'taskboard_order');\n _this.scope.usTasks = {};\n _ref = _.union(_this.scope.userstories, [\n {\n id: null\n }\n ]);\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n us = _ref[_i];\n _this.scope.usTasks[us.id] = {};\n _ref1 = _this.scope.taskStatusList;\n for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {\n status = _ref1[_j];\n _this.scope.usTasks[us.id][status.id] = [];\n }\n }\n _ref2 = _this.scope.tasks;\n for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {\n task = _ref2[_k];\n if ((_this.scope.usTasks[task.user_story] != null) && (_this.scope.usTasks[task.user_story][task.status] != null)) {\n _this.scope.usTasks[task.user_story][task.status].push(task);\n }\n }\n return tasks;\n };\n })(this));\n };\n\n TaskboardController.prototype.loadTaskboard = function() {\n return this.q.all([\n this.refreshTagsColors(), this.loadSprintStats(), this.loadSprint().then((function(_this) {\n return function() {\n return _this.loadTasks();\n };\n })(this))\n ]);\n };\n\n TaskboardController.prototype.loadInitialData = function() {\n var params, promise;\n params = {\n pslug: this.params.pslug,\n sslug: this.params.sslug\n };\n promise = this.repo.resolve(params).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n _this.scope.sprintId = data.milestone;\n _this.initializeSubscription();\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadUsersAndRoles();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadTaskboard();\n };\n })(this));\n };\n\n TaskboardController.prototype.refreshTasksOrder = function(tasks) {\n var data, items;\n items = this.resortTasks(tasks);\n data = this.prepareBulkUpdateData(items);\n return this.rs.tasks.bulkUpdateTaskTaskboardOrder(this.scope.project.id, data);\n };\n\n TaskboardController.prototype.resortTasks = function(tasks) {\n var index, item, items, _i, _len;\n items = [];\n for (index = _i = 0, _len = tasks.length; _i < _len; index = ++_i) {\n item = tasks[index];\n item[\"taskboard_order\"] = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n TaskboardController.prototype.prepareBulkUpdateData = function(uses) {\n return _.map(uses, function(x) {\n return {\n \"task_id\": x.id,\n \"order\": x[\"taskboard_order\"]\n };\n });\n };\n\n TaskboardController.prototype.taskMove = function(ctx, task, usId, statusId, order) {\n var promise, r, tasks;\n r = this.scope.usTasks[task.user_story][task.status].indexOf(task);\n this.scope.usTasks[task.user_story][task.status].splice(r, 1);\n tasks = this.scope.usTasks[usId][statusId];\n tasks.splice(order, 0, task);\n task.user_story = usId;\n task.status = statusId;\n task.taskboard_order = order;\n promise = this.repo.save(task);\n this.rootscope.$broadcast(\"sprint:task:moved\", task);\n promise.then((function(_this) {\n return function() {\n _this.refreshTasksOrder(tasks);\n return _this.loadSprintStats();\n };\n })(this));\n return promise.then(null, (function(_this) {\n return function() {\n return console.log(\"FAIL TASK SAVE\");\n };\n })(this));\n };\n\n TaskboardController.prototype.addNewTask = function(type, us) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"taskform:new\", this.scope.sprintId, us != null ? us.id : void 0);\n case \"bulk\":\n return this.rootscope.$broadcast(\"taskform:bulk\", this.scope.sprintId, us != null ? us.id : void 0);\n }\n };\n\n TaskboardController.prototype.editTaskAssignedTo = function(task) {\n return this.rootscope.$broadcast(\"assigned-to:add\", task);\n };\n\n return TaskboardController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TaskboardController\", TaskboardController);\n\n TaskboardDirective = function($rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl, tableBodyDom;\n $ctrl = $el.controller();\n $el.on(\"click\", \".toggle-analytics-visibility\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.toggleClass('active');\n return $rootscope.$broadcast(\"taskboard:graph:toggle-visibility\");\n });\n tableBodyDom = $el.find(\".taskboard-table-body\");\n tableBodyDom.on(\"scroll\", function(event) {\n var tableHeaderDom, target;\n target = angular.element(event.currentTarget);\n tableHeaderDom = $el.find(\".taskboard-table-header .taskboard-table-inner\");\n return tableHeaderDom.css(\"left\", -1 * target.scrollLeft());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboard\", [\"$rootScope\", TaskboardDirective]);\n\n TaskboardTaskDirective = function($rootscope) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $el.disableSelection();\n $scope.$watch(\"task\", function(task) {\n if (task.is_blocked && !$el.hasClass(\"blocked\")) {\n return $el.addClass(\"blocked\");\n } else if (!task.is_blocked && $el.hasClass(\"blocked\")) {\n return $el.removeClass(\"blocked\");\n }\n });\n return $el.find(\".icon-edit\").on(\"click\", function(event) {\n if ($el.find('.icon-edit').hasClass('noclick')) {\n return;\n }\n return $scope.$apply(function() {\n return $rootscope.$broadcast(\"taskform:edit\", $scope.task);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardTask\", [\"$rootScope\", TaskboardTaskDirective]);\n\n TaskboardTableHeightFixerDirective = function() {\n var link, mainPadding, renderSize;\n mainPadding = 32;\n renderSize = function($el) {\n var columnHeight, elementOffset, windowHeight;\n elementOffset = $el.offset().top;\n windowHeight = angular.element(window).height();\n columnHeight = windowHeight - elementOffset - mainPadding;\n return $el.css(\"height\", columnHeight + \"px\");\n };\n link = function($scope, $el, $attrs) {\n timeout(500, function() {\n return renderSize($el);\n });\n return $scope.$on(\"resize\", function() {\n return renderSize($el);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardTableHeightFixer\", TaskboardTableHeightFixerDirective);\n\n TaskboardSquishColumnDirective = function(rs) {\n var avatarWidth, link, maxColumnWidth;\n avatarWidth = 40;\n maxColumnWidth = 300;\n link = function($scope, $el, $attrs) {\n var getCeilWidth, recalculateStatusColumnWidth, recalculateTaskboardWidth, refreshTaskboardTableWidth, setStatusColumnWidth;\n $scope.$on(\"sprint:task:moved\", (function(_this) {\n return function() {\n return recalculateTaskboardWidth();\n };\n })(this));\n bindOnce($scope, \"usTasks\", function(project) {\n $scope.statusesFolded = rs.tasks.getStatusColumnModes($scope.project.id);\n $scope.usFolded = rs.tasks.getUsRowModes($scope.project.id, $scope.sprintId);\n return recalculateTaskboardWidth();\n });\n $scope.foldStatus = function(status) {\n $scope.statusesFolded[status.id] = !!!$scope.statusesFolded[status.id];\n rs.tasks.storeStatusColumnModes($scope.projectId, $scope.statusesFolded);\n return recalculateTaskboardWidth();\n };\n $scope.foldUs = function(us) {\n if (!us) {\n $scope.usFolded[null] = !!!$scope.usFolded[null];\n } else {\n $scope.usFolded[us.id] = !!!$scope.usFolded[us.id];\n }\n rs.tasks.storeUsRowModes($scope.projectId, $scope.sprintId, $scope.usFolded);\n return recalculateTaskboardWidth();\n };\n getCeilWidth = (function(_this) {\n return function(usId, statusId) {\n var tasks, tasksMatrixSize, width;\n tasks = $scope.usTasks[usId][statusId].length;\n if ($scope.statusesFolded[statusId]) {\n if (tasks && $scope.usFolded[usId]) {\n tasksMatrixSize = Math.round(Math.sqrt(tasks));\n width = avatarWidth * tasksMatrixSize;\n } else {\n width = avatarWidth;\n }\n return width;\n }\n return 0;\n };\n })(this);\n setStatusColumnWidth = (function(_this) {\n return function(statusId, width) {\n var column;\n column = $el.find(\".squish-status-\" + statusId);\n if (width) {\n return column.css('max-width', width);\n } else {\n return column.css(\"max-width\", maxColumnWidth);\n }\n };\n })(this);\n refreshTaskboardTableWidth = (function(_this) {\n return function() {\n var columnWidths, columns, totalWidth;\n columnWidths = [];\n columns = $el.find(\".task-colum-name\");\n columnWidths = _.map(columns, function(column) {\n return $(column).outerWidth(true);\n });\n totalWidth = _.reduce(columnWidths, function(total, width) {\n return total + width;\n });\n return $el.find('.taskboard-table-inner').css(\"width\", totalWidth);\n };\n })(this);\n recalculateStatusColumnWidth = (function(_this) {\n return function(statusId) {\n var statusFoldedWidth;\n statusFoldedWidth = getCeilWidth(null, statusId);\n _.forEach($scope.userstories, function(us) {\n var width;\n width = getCeilWidth(us.id, statusId);\n if (width > statusFoldedWidth) {\n return statusFoldedWidth = width;\n }\n });\n return setStatusColumnWidth(statusId, statusFoldedWidth);\n };\n })(this);\n return recalculateTaskboardWidth = (function(_this) {\n return function() {\n _.forEach($scope.taskStatusList, function(status) {\n return recalculateStatusColumnWidth(status.id);\n });\n refreshTaskboardTableWidth();\n };\n })(this);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardSquishColumn\", [\"$tgResources\", TaskboardSquishColumnDirective]);\n\n TaskboardUserDirective = function($log) {\n var clickable, link;\n clickable = false;\n link = function($scope, $el, $attrs) {\n var username_label;\n username_label = $el.parent().find(\"a.task-assigned\");\n username_label.on(\"click\", function(event) {\n var $ctrl;\n if ($el.find('a').hasClass('noclick')) {\n return;\n }\n $ctrl = $el.controller();\n return $ctrl.editTaskAssignedTo($scope.task);\n });\n $scope.$watch('task.assigned_to', function(assigned_to) {\n var user;\n user = $scope.usersById[assigned_to];\n if (user === void 0) {\n _.assign($scope, {\n name: \"Unassigned\",\n imgurl: \"/images/unnamed.png\",\n clickable: clickable\n });\n } else {\n _.assign($scope, {\n name: user.full_name_display,\n imgurl: user.photo,\n clickable: clickable\n });\n }\n return username_label.text($scope.name);\n });\n return bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_task\") > -1) {\n clickable = true;\n return $el.find(\".avatar-assigned-to\").on(\"click\", (function(_this) {\n return function(event) {\n var $ctrl;\n if ($el.find('a').hasClass('noclick')) {\n return;\n }\n $ctrl = $el.controller();\n return $ctrl.editTaskAssignedTo($scope.task);\n };\n })(this));\n }\n });\n };\n return {\n link: link,\n templateUrl: \"taskboard/taskboard-user.html\",\n scope: {\n \"usersById\": \"=users\",\n \"project\": \"=\",\n \"task\": \"=\"\n }\n };\n };\n\n module.directive(\"tgTaskboardUserAvatar\", [\"$log\", TaskboardUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/sortable.coffee\n */\n\n(function() {\n var TaskboardSortableDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaBacklog\");\n\n TaskboardSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var deleteElement, itemEl, newParentScope, oldParentScope, tdom;\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el;\n deleteElement = function(itemEl) {\n itemEl.scope().$destroy();\n itemEl.off();\n return itemEl.remove();\n };\n tdom.sortable({\n handle: \".taskboard-task-inner\",\n dropOnEmpty: true,\n connectWith: \".taskboard-tasks-box\",\n revert: 400\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemTask, newStatusId, newUsId, oldStatusId, oldUsId, parentEl;\n parentEl = ui.item.parent();\n itemEl = ui.item;\n itemTask = itemEl.scope().task;\n itemIndex = itemEl.index();\n newParentScope = parentEl.scope();\n oldUsId = oldParentScope.us ? oldParentScope.us.id : null;\n oldStatusId = oldParentScope.st.id;\n newUsId = newParentScope.us ? newParentScope.us.id : null;\n newStatusId = newParentScope.st.id;\n if (newStatusId !== oldStatusId || newUsId !== oldUsId) {\n deleteElement(itemEl);\n }\n $scope.$apply(function() {\n return $rootscope.$broadcast(\"taskboard:task:move\", itemTask, newUsId, newStatusId, itemIndex);\n });\n return ui.item.find('a').removeClass('noclick');\n });\n tdom.on(\"sortstart\", function(event, ui) {\n oldParentScope = ui.item.parent().scope();\n return ui.item.find('a').addClass('noclick');\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgTaskboardSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", TaskboardSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var KanbanArchivedStatusHeaderDirective, KanbanArchivedStatusIntroDirective, KanbanColumnHeightFixerDirective, KanbanController, KanbanDirective, KanbanSquishColumnDirective, KanbanUserDirective, KanbanUserstoryDirective, KanbanWipLimitDirective, bindMethods, bindOnce, defaultViewMode, defaultViewModes, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaKanban\");\n\n defaultViewMode = \"maximized\";\n\n defaultViewModes = {\n maximized: {\n cardClass: \"kanban-task-maximized\"\n },\n minimized: {\n cardClass: \"kanban-task-minimized\"\n }\n };\n\n KanbanController = (function(_super) {\n __extends(KanbanController, _super);\n\n KanbanController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$appTitle\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"tgLoader\"];\n\n function KanbanController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_appTitle, _at_navUrls, _at_events, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.events = _at_events;\n this.analytics = _at_analytics;\n bindMethods(this);\n this.scope.sectionName = \"Kanban\";\n this.scope.statusViewModes = {};\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Kanban - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n KanbanController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"usform:new:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n _this.refreshTagsColors();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"create userstory on kanban\", 1);\n };\n })(this));\n this.scope.$on(\"usform:bulk:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n return _this.analytics.trackEvent(\"userstory\", \"create\", \"bulk create userstory on kanban\", 1);\n };\n })(this));\n this.scope.$on(\"usform:edit:success\", (function(_this) {\n return function() {\n _this.loadUserstories();\n return _this.refreshTagsColors();\n };\n })(this));\n this.scope.$on(\"assigned-to:added\", this.onAssignedToChanged);\n this.scope.$on(\"kanban:us:move\", this.moveUs);\n this.scope.$on(\"kanban:show-userstories-for-status\", this.loadUserStoriesForStatus);\n return this.scope.$on(\"kanban:hide-userstories-for-status\", this.hideUserStoriesForStatus);\n };\n\n KanbanController.prototype.addNewUs = function(type, statusId) {\n switch (type) {\n case \"standard\":\n return this.rootscope.$broadcast(\"usform:new\", this.scope.projectId, statusId, this.scope.usStatusList);\n case \"bulk\":\n return this.rootscope.$broadcast(\"usform:bulk\", this.scope.projectId, statusId);\n }\n };\n\n KanbanController.prototype.changeUsAssignedTo = function(us) {\n return this.rootscope.$broadcast(\"assigned-to:add\", us);\n };\n\n KanbanController.prototype.onAssignedToChanged = function(ctx, userid, us) {\n var promise;\n us.assigned_to = userid;\n promise = this.repo.save(us);\n return promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n };\n\n KanbanController.prototype.refreshTagsColors = function() {\n return this.rs.projects.tagsColors(this.scope.projectId).then((function(_this) {\n return function(tags_colors) {\n return _this.scope.project.tags_colors = tags_colors;\n };\n })(this));\n };\n\n KanbanController.prototype.loadUserstories = function() {\n var params;\n params = {\n status__is_archived: false\n };\n return this.rs.userstories.listAll(this.scope.projectId, params).then((function(_this) {\n return function(userstories) {\n var status, usByStatus, _i, _len, _ref;\n _this.scope.userstories = userstories;\n usByStatus = _.groupBy(userstories, \"status\");\n _ref = _this.scope.usStatusList;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n status = _ref[_i];\n if (usByStatus[status.id] == null) {\n usByStatus[status.id] = [];\n }\n if (status.is_archived && (_this.scope.usByStatus != null)) {\n usByStatus[status.id] = _this.scope.usByStatus[status.id];\n }\n usByStatus[status.id] = _.sortBy(usByStatus[status.id], \"kanban_order\");\n }\n _this.scope.usByStatus = usByStatus;\n scopeDefer(_this.scope, function() {\n return _this.scope.$broadcast(\"userstories:loaded\", userstories);\n });\n return userstories;\n };\n })(this));\n };\n\n KanbanController.prototype.loadUserStoriesForStatus = function(ctx, statusId) {\n var params;\n params = {\n status: statusId\n };\n return this.rs.userstories.listAll(this.scope.projectId, params).then((function(_this) {\n return function(userstories) {\n _this.scope.usByStatus[statusId] = _.sortBy(userstories, \"kanban_order\");\n _this.scope.$broadcast(\"kanban:shown-userstories-for-status\", statusId, userstories);\n return userstories;\n };\n })(this));\n };\n\n KanbanController.prototype.hideUserStoriesForStatus = function(ctx, statusId) {\n this.scope.usByStatus[statusId] = [];\n return this.scope.$broadcast(\"kanban:hidden-userstories-for-status\", statusId);\n };\n\n KanbanController.prototype.loadKanban = function() {\n return this.q.all([this.refreshTagsColors(), this.loadUserstories()]);\n };\n\n KanbanController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.projectId = project.id;\n _this.scope.points = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(project.points, function(x) {\n return x.id;\n });\n _this.scope.usStatusById = groupBy(project.us_statuses, function(x) {\n return x.id;\n });\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.generateStatusViewModes();\n _this.scope.$emit(\"project:loaded\", project);\n return project;\n };\n })(this));\n };\n\n KanbanController.prototype.initializeSubscription = function() {\n var routingKey1;\n routingKey1 = \"changes.project.\" + this.scope.projectId + \".userstories\";\n return this.events.subscribe(this.scope, routingKey1, (function(_this) {\n return function(message) {\n return _this.loadUserstories();\n };\n })(this));\n };\n\n KanbanController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n _this.initializeSubscription();\n return _this.loadKanban().then(function() {\n return _this.scope.$broadcast(\"redraw:wip\");\n });\n };\n })(this));\n };\n\n KanbanController.prototype.generateStatusViewModes = function() {\n var mode, status, storedStatusViewModes, _i, _len, _ref;\n storedStatusViewModes = this.rs.kanban.getStatusViewModes(this.scope.projectId);\n this.scope.statusViewModes = {};\n _ref = this.scope.usStatusList;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n status = _ref[_i];\n mode = storedStatusViewModes[status.id];\n this.scope.statusViewModes[status.id] = _.has(defaultViewModes, mode) ? mode : defaultViewMode;\n }\n return this.storeStatusViewModes();\n };\n\n KanbanController.prototype.storeStatusViewModes = function() {\n return this.rs.kanban.storeStatusViewModes(this.scope.projectId, this.scope.statusViewModes);\n };\n\n KanbanController.prototype.updateStatusViewMode = function(statusId, newViewMode) {\n this.scope.statusViewModes[statusId] = newViewMode;\n return this.storeStatusViewModes();\n };\n\n KanbanController.prototype.getCardClass = function(statusId) {\n var mode;\n mode = this.scope.statusViewModes[statusId] || defaultViewMode;\n return defaultViewModes[mode].cardClass || defaultViewModes[defaultViewMode].cardClass;\n };\n\n KanbanController.prototype.prepareBulkUpdateData = function(uses, field) {\n if (field == null) {\n field = \"kanban_order\";\n }\n return _.map(uses, function(x) {\n return {\n \"us_id\": x.id,\n \"order\": x[field]\n };\n });\n };\n\n KanbanController.prototype.resortUserStories = function(uses) {\n var index, item, items, _i, _len;\n items = [];\n for (index = _i = 0, _len = uses.length; _i < _len; index = ++_i) {\n item = uses[index];\n item.kanban_order = index;\n if (item.isModified()) {\n items.push(item);\n }\n }\n return items;\n };\n\n KanbanController.prototype.moveUs = function(ctx, us, oldStatusId, newStatusId, index) {\n var itemsToSave, promise, r;\n if (oldStatusId !== newStatusId) {\n r = this.scope.usByStatus[oldStatusId].indexOf(us);\n this.scope.usByStatus[oldStatusId].splice(r, 1);\n this.scope.usByStatus[newStatusId].splice(index, 0, us);\n us.status = newStatusId;\n } else {\n r = this.scope.usByStatus[newStatusId].indexOf(us);\n this.scope.usByStatus[newStatusId].splice(r, 1);\n this.scope.usByStatus[newStatusId].splice(index, 0, us);\n }\n itemsToSave = this.resortUserStories(this.scope.usByStatus[newStatusId]);\n this.scope.usByStatus[newStatusId] = _.sortBy(this.scope.usByStatus[newStatusId], \"kanban_order\");\n promise = this.repo.save(us);\n promise = promise.then((function(_this) {\n return function() {\n var data;\n itemsToSave = _.reject(itemsToSave, {\n \"id\": us.id\n });\n data = _this.prepareBulkUpdateData(itemsToSave);\n return _this.rs.userstories.bulkUpdateKanbanOrder(us.project, data).then(function() {\n return itemsToSave;\n });\n };\n })(this));\n return promise;\n };\n\n return KanbanController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"KanbanController\", KanbanController);\n\n KanbanDirective = function($repo, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n var tableBodyDom;\n tableBodyDom = $el.find(\".kanban-table-body\");\n tableBodyDom.on(\"scroll\", function(event) {\n var tableHeaderDom, target;\n target = angular.element(event.currentTarget);\n tableHeaderDom = $el.find(\".kanban-table-header .kanban-table-inner\");\n return tableHeaderDom.css(\"left\", -1 * target.scrollLeft());\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanban\", [\"$tgRepo\", \"$rootScope\", KanbanDirective]);\n\n KanbanColumnHeightFixerDirective = function() {\n var link, mainPadding, renderSize, scrollPadding;\n mainPadding = 32;\n scrollPadding = 0;\n renderSize = function($el) {\n var columnHeight, elementOffset, windowHeight;\n elementOffset = $el.parent().parent().offset().top;\n windowHeight = angular.element(window).height();\n columnHeight = windowHeight - elementOffset - mainPadding - scrollPadding;\n return $el.css(\"height\", columnHeight + \"px\");\n };\n link = function($scope, $el, $attrs) {\n timeout(500, function() {\n return renderSize($el);\n });\n $scope.$on(\"resize\", function() {\n return renderSize($el);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanColumnHeightFixer\", KanbanColumnHeightFixerDirective);\n\n KanbanArchivedStatusHeaderDirective = function($rootscope) {\n var hideArchivedText, link, showArchivedText;\n showArchivedText = \"Show archived\";\n hideArchivedText = \"Hide archived\";\n link = function($scope, $el, $attrs) {\n var hidden, status;\n status = $scope.$eval($attrs.tgKanbanArchivedStatusHeader);\n hidden = true;\n $scope[\"class\"] = \"icon icon-open-eye\";\n $scope.title = showArchivedText;\n $el.on(\"click\", function(event) {\n hidden = !hidden;\n return $scope.$apply(function() {\n if (hidden) {\n $scope[\"class\"] = \"icon icon-open-eye\";\n $scope.title = showArchivedText;\n return $rootscope.$broadcast(\"kanban:hide-userstories-for-status\", status.id);\n } else {\n $scope[\"class\"] = \"icon icon-closed-eye\";\n $scope.title = hideArchivedText;\n return $rootscope.$broadcast(\"kanban:show-userstories-for-status\", status.id);\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(\"tgKanbanArchivedStatusHeader\", [\"$rootScope\", KanbanArchivedStatusHeaderDirective]);\n\n KanbanArchivedStatusIntroDirective = function() {\n var hiddenUserStoriexText, link, userStories;\n hiddenUserStoriexText = \"The user stories in this status are hidden by default\";\n userStories = [];\n link = function($scope, $el, $attrs) {\n var status, updateIntroText;\n status = $scope.$eval($attrs.tgKanbanArchivedStatusIntro);\n $el.text(hiddenUserStoriexText);\n updateIntroText = function() {\n if (userStories.length > 0) {\n return $el.text(\"\");\n } else {\n return $el.text(hiddenUserStoriexText);\n }\n };\n $scope.$on(\"kanban:us:move\", function(ctx, itemUs, oldStatusId, newStatusId, itemIndex) {\n var r;\n if (status.id === newStatusId) {\n if (status.id === oldStatusId) {\n r = userStories.indexOf(itemUs);\n userStories.splice(r, 1);\n userStories.splice(itemIndex, 0, itemUs);\n } else {\n itemUs.isArchived = true;\n userStories.splice(itemIndex, 0, itemUs);\n }\n } else if (status.id === oldStatusId) {\n itemUs.isArchived = false;\n r = userStories.indexOf(itemUs);\n userStories.splice(r, 1);\n }\n return updateIntroText();\n });\n $scope.$on(\"kanban:shown-userstories-for-status\", function(ctx, statusId, userStoriesLoaded) {\n if (statusId === status.id) {\n userStories = _.filter(userStoriesLoaded, function(us) {\n return us.status === status.id;\n });\n return updateIntroText();\n }\n });\n $scope.$on(\"kanban:hidden-userstories-for-status\", function(ctx, statusId) {\n if (statusId === status.id) {\n userStories = [];\n return updateIntroText();\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(\"tgKanbanArchivedStatusIntro\", KanbanArchivedStatusIntroDirective);\n\n KanbanUserstoryDirective = function($rootscope) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n $el.disableSelection();\n $scope.$watch(\"us\", function(us) {\n if (us.is_blocked && !$el.hasClass(\"blocked\")) {\n return $el.addClass(\"blocked\");\n } else if (!us.is_blocked && $el.hasClass(\"blocked\")) {\n return $el.removeClass(\"blocked\");\n }\n });\n $el.find(\".icon-edit\").on(\"click\", function(event) {\n if ($el.find(\".icon-edit\").hasClass(\"noclick\")) {\n return;\n }\n return $scope.$apply(function() {\n return $rootscope.$broadcast(\"usform:edit\", $model.$modelValue);\n });\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n templateUrl: \"kanban/kanban-task.html\",\n link: link,\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgKanbanUserstory\", [\"$rootScope\", KanbanUserstoryDirective]);\n\n KanbanSquishColumnDirective = function(rs) {\n var link;\n link = function($scope, $el, $attrs) {\n var updateTableWidth;\n $scope.$on(\"project:loaded\", function(event, project) {\n $scope.folds = rs.kanban.getStatusColumnModes(project.id);\n return updateTableWidth();\n });\n $scope.foldStatus = function(status) {\n $scope.folds[status.id] = !!!$scope.folds[status.id];\n rs.kanban.storeStatusColumnModes($scope.projectId, $scope.folds);\n updateTableWidth();\n };\n return updateTableWidth = function() {\n var columnWidths, totalWidth;\n columnWidths = _.map($scope.usStatusList, function(status) {\n if ($scope.folds[status.id]) {\n return 40;\n } else {\n return 310;\n }\n });\n totalWidth = _.reduce(columnWidths, function(total, width) {\n return total + width;\n });\n return $el.find('.kanban-table-inner').css(\"width\", totalWidth);\n };\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanSquishColumn\", [\"$tgResources\", KanbanSquishColumnDirective]);\n\n KanbanWipLimitDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var redrawWipLimit;\n $el.disableSelection();\n redrawWipLimit = function() {\n $el.find(\".kanban-wip-limit\").remove();\n return timeout(200, function() {\n var element;\n element = $el.find(\".kanban-task\")[$scope.$eval($attrs.tgKanbanWipLimit)];\n if (element) {\n return angular.element(element).before(\"
\");\n }\n });\n };\n $scope.$on(\"redraw:wip\", redrawWipLimit);\n $scope.$on(\"kanban:us:move\", redrawWipLimit);\n $scope.$on(\"usform:new:success\", redrawWipLimit);\n $scope.$on(\"usform:bulk:success\", redrawWipLimit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgKanbanWipLimit\", KanbanWipLimitDirective);\n\n KanbanUserDirective = function($log) {\n var clickable, link, template;\n template = _.template(\"
\\n class=\\\"not-clickable\\\"<% } %>>\\n \\\" alt=\\\"<%- name %>\\\" class=\\\"avatar\\\">\\n \\n
\");\n clickable = false;\n link = function($scope, $el, $attrs, $model) {\n var render, wtid;\n if (!$attrs.tgKanbanUserAvatar) {\n return $log.error(\"KanbanUserDirective: no attr is defined\");\n }\n wtid = $scope.$watch($attrs.tgKanbanUserAvatar, function(v) {\n var user;\n if ($scope.usersById == null) {\n $log.error(\"KanbanUserDirective requires userById set in scope.\");\n return wtid();\n } else {\n user = $scope.usersById[v];\n return render(user);\n }\n });\n render = function(user) {\n var ctx, html, username_label;\n if (user === void 0) {\n ctx = {\n name: \"Unassigned\",\n imgurl: \"/images/unnamed.png\",\n clickable: clickable\n };\n } else {\n ctx = {\n name: user.full_name_display,\n imgurl: user.photo,\n clickable: clickable\n };\n }\n html = template(ctx);\n $el.html(html);\n username_label = $el.parent().find(\"a.task-assigned\");\n username_label.html(ctx.name);\n return username_label.on(\"click\", function(event) {\n var $ctrl, us;\n if ($el.find(\"a\").hasClass(\"noclick\")) {\n return;\n }\n us = $model.$modelValue;\n $ctrl = $el.controller();\n return $ctrl.changeUsAssignedTo(us);\n });\n };\n bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_us\") > -1) {\n clickable = true;\n return $el.on(\"click\", (function(_this) {\n return function(event) {\n var $ctrl, us;\n if ($el.find(\"a\").hasClass(\"noclick\")) {\n return;\n }\n us = $model.$modelValue;\n $ctrl = $el.controller();\n return $ctrl.changeUsAssignedTo(us);\n };\n })(this));\n }\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(\"tgKanbanUserAvatar\", [\"$log\", KanbanUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/sortable.coffee\n */\n\n(function() {\n var KanbanSortableDirective, bindOnce, groupBy, mixOf, module, scopeDefer, taiga, timeout, toggleText;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n toggleText = this.taiga.toggleText;\n\n scopeDefer = this.taiga.scopeDefer;\n\n bindOnce = this.taiga.bindOnce;\n\n groupBy = this.taiga.groupBy;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaKanban\");\n\n KanbanSortableDirective = function($repo, $rs, $rootscope) {\n var link;\n link = function($scope, $el, $attrs) {\n bindOnce($scope, \"project\", function(project) {\n var deleteElement, itemEl, newParentScope, oldParentScope, tdom;\n if (!(project.my_permissions.indexOf(\"modify_us\") > -1)) {\n return;\n }\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el;\n deleteElement = function(itemEl) {\n itemEl.scope().$destroy();\n itemEl.off();\n return itemEl.remove();\n };\n tdom.sortable({\n handle: \".kanban-task-inner\",\n dropOnEmpty: true,\n connectWith: \".kanban-uses-box\",\n revert: 400\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemUs, newStatusId, oldStatusId, parentEl;\n parentEl = ui.item.parent();\n itemEl = ui.item;\n itemUs = itemEl.scope().us;\n itemIndex = itemEl.index();\n newParentScope = parentEl.scope();\n newStatusId = newParentScope.s.id;\n oldStatusId = oldParentScope.s.id;\n if (newStatusId !== oldStatusId) {\n deleteElement(itemEl);\n }\n $scope.$apply(function() {\n return $rootscope.$broadcast(\"kanban:us:move\", itemUs, itemUs.status, newStatusId, itemIndex);\n });\n return ui.item.find('a').removeClass('noclick');\n });\n return tdom.on(\"sortstart\", function(event, ui) {\n oldParentScope = ui.item.parent().scope();\n return ui.item.find('a').addClass('noclick');\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(\"tgKanbanSortable\", [\"$tgRepo\", \"$tgResources\", \"$rootScope\", KanbanSortableDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/detail.coffee\n */\n\n(function() {\n var IssueDetailController, IssuePriorityButtonDirective, IssueSeverityButtonDirective, IssueStatusButtonDirective, IssueStatusDisplayDirective, IssueTypeButtonDirective, PromoteIssueToUsButtonDirective, bindOnce, groupBy, joinStr, mixOf, module, taiga, toString,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaIssues\");\n\n IssueDetailController = (function(_super) {\n __extends(IssueDetailController, _super);\n\n IssueDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"$appTitle\", \"$tgAnalytics\", \"$tgNavUrls\", \"tgLoader\"];\n\n function IssueDetailController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_log, _at_appTitle, _at_analytics, _at_navUrls, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.log = _at_log;\n this.appTitle = _at_appTitle;\n this.analytics = _at_analytics;\n this.navUrls = _at_navUrls;\n this.scope.issueRef = this.params.issueref;\n this.scope.sectionName = \"Issue Details\";\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this.appTitle.set(_this.scope.issue.subject + \" - \" + _this.scope.project.name);\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n IssueDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n _this.rootscope.$broadcast(\"history:reload\");\n return _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on issue\", 1);\n };\n })(this));\n this.scope.$on(\"attachment:edit\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n this.scope.$on(\"attachment:delete\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n return this.scope.$on(\"promote-issue-to-us:success\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"issue\", \"promoteToUserstory\", \"promote issue to userstory\", 1);\n _this.rootscope.$broadcast(\"history:reload\");\n return _this.loadIssue();\n };\n })(this));\n };\n\n IssueDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n if (this.scope.project.is_issues_activated) {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-issues\", ctx);\n } else {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n }\n };\n\n IssueDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.issue_statuses;\n _this.scope.statusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.typeById = groupBy(project.issue_types, function(x) {\n return x.id;\n });\n _this.scope.typeList = _.sortBy(project.issue_types, \"order\");\n _this.scope.severityList = project.severities;\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.priorityList = project.priorities;\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n _this.scope.membersById = groupBy(project.memberships, function(x) {\n return x.user;\n });\n return project;\n };\n })(this));\n };\n\n IssueDetailController.prototype.loadIssue = function() {\n return this.rs.issues.getByRef(this.scope.projectId, this.params.issueref).then((function(_this) {\n return function(issue) {\n var ctx;\n _this.scope.issue = issue;\n _this.scope.issueId = issue.id;\n _this.scope.commentModel = issue;\n if (_this.scope.issue.neighbors.previous.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.issue.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-issues-detail\", ctx);\n }\n if (_this.scope.issue.neighbors.next.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.issue.neighbors.next.ref\n };\n return _this.scope.nextUrl = _this.navUrls.resolve(\"project-issues-detail\", ctx);\n }\n };\n })(this));\n };\n\n IssueDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.loadIssue();\n };\n })(this));\n };\n\n return IssueDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"IssueDetailController\", IssueDetailController);\n\n IssueStatusDisplayDirective = function($template) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(issue) {\n var html;\n html = template({\n status: $scope.statusById[issue.status]\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue != null) {\n return render(issue);\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(\"tgIssueStatusDisplay\", [\"$tgTemplate\", IssueStatusDisplayDirective]);\n\n IssueStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"issue/issues-status-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, status;\n status = $scope.statusById[issue.status];\n html = template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(statusId) {\n var issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.status = statusId;\n onSuccess = function() {\n $confirm.notify(\"success\");\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".status-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n return save(target.data(\"status-id\"));\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\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(\"tgIssueStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", IssueStatusButtonDirective]);\n\n IssueTypeButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"issue/issue-type-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, type;\n type = $scope.typeById[issue.type];\n html = template({\n type: type,\n typees: $scope.typeList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(type) {\n var issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.type = type;\n onSuccess = function() {\n $confirm.notify(\"success\");\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".type-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-type\").popover().open();\n });\n $el.on(\"click\", \".type\", function(event) {\n var target, type;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n type = target.data(\"type-id\");\n return save(type);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\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(\"tgIssueTypeButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", IssueTypeButtonDirective]);\n\n IssueSeverityButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"issue/issue-severity-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, severity;\n severity = $scope.severityById[issue.severity];\n html = template({\n severity: severity,\n severityes: $scope.severityList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(severity) {\n var issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.severity = severity;\n onSuccess = function() {\n $confirm.notify(\"success\");\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".severity-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-severity\").popover().open();\n });\n $el.on(\"click\", \".severity\", function(event) {\n var severity, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n severity = target.data(\"severity-id\");\n return save(severity);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\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(\"tgIssueSeverityButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", IssueSeverityButtonDirective]);\n\n IssuePriorityButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"issue/issue-priority-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_issue\") !== -1;\n };\n render = (function(_this) {\n return function(issue) {\n var html, priority;\n priority = $scope.priorityById[issue.priority];\n html = template({\n priority: priority,\n priorityes: $scope.priorityList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(priority) {\n var issue, onError, onSuccess;\n $.fn.popover().closeAll();\n issue = $model.$modelValue.clone();\n issue.priority = priority;\n onSuccess = function() {\n $confirm.notify(\"success\");\n $model.$setViewValue(issue);\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n issue.revert();\n $model.$setViewValue(issue);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save(issue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".priority-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-priority\").popover().open();\n });\n $el.on(\"click\", \".priority\", function(event) {\n var priority, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n priority = target.data(\"priority-id\");\n return save(priority);\n });\n $scope.$watch($attrs.ngModel, function(issue) {\n if (issue) {\n return render(issue);\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(\"tgIssuePriorityButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", IssuePriorityButtonDirective]);\n\n PromoteIssueToUsButtonDirective = function($rootScope, $repo, $confirm, $qqueue) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var save;\n save = $qqueue.bindAdd((function(_this) {\n return function(issue, finish) {\n var data, onError, onSuccess;\n data = {\n generated_from_issue: issue.id,\n project: issue.project,\n subject: issue.subject,\n description: issue.description,\n tags: issue.tags,\n is_blocked: issue.is_blocked,\n blocked_note: issue.blocked_note\n };\n onSuccess = function() {\n finish();\n $confirm.notify(\"success\");\n return $rootScope.$broadcast(\"promote-issue-to-us:success\");\n };\n onError = function() {\n finish(false);\n return $confirm.notify(\"error\");\n };\n return $repo.create(\"userstories\", data).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \"a\", function(event) {\n var issue, message, subtitle, title;\n event.preventDefault();\n issue = $model.$modelValue;\n title = \"Promote this issue to a new user story\";\n message = \"Are you sure you want to create a new US from this Issue?\";\n subtitle = issue.subject;\n return $confirm.ask(title, subtitle, message).then((function(_this) {\n return function(finish) {\n return save(issue, finish);\n };\n })(this));\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n restrict: \"AE\",\n require: \"ngModel\",\n templateUrl: \"issue/promote-issue-to-us-button.html\",\n link: link\n };\n };\n\n module.directive(\"tgPromoteIssueToUsButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgQqueue\", PromoteIssueToUsButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var CreateBulkIssuesDirective, CreateIssueDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaIssues\");\n\n CreateIssueDirective = function($repo, $confirm, $rootscope, lightboxService, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley();\n $scope.issue = {};\n $scope.$on(\"issueform:new\", function(ctx, project) {\n $el.find(\".tag-input\").val(\"\");\n lightboxService.open($el);\n return $scope.issue = {\n project: project.id,\n subject: \"\",\n status: project.default_issue_status,\n type: project.default_issue_type,\n priority: project.default_priority,\n severity: project.default_severity,\n tags: []\n };\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\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 $loading.start(submitButton);\n promise = $repo.create(\"issues\", $scope.issue);\n promise.then(function(data) {\n $loading.finish(submitButton);\n $rootscope.$broadcast(\"issueform:new:success\", data);\n lightboxService.close($el);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function() {\n $loading.finish(submitButton);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateIssue\", [\"$tgRepo\", \"$tgConfirm\", \"$rootScope\", \"lightboxService\", \"$tgLoading\", CreateIssueDirective]);\n\n CreateBulkIssuesDirective = function($repo, $rs, $confirm, $rootscope, $loading, lightboxService) {\n var link;\n link = function($scope, $el, attrs) {\n var submit, submitButton;\n $scope.$on(\"issueform:bulk\", function(ctx, projectId, status) {\n lightboxService.open($el);\n return $scope[\"new\"] = {\n projectId: projectId,\n bulk: \"\"\n };\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var data, form, projectId, promise;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n data = $scope[\"new\"].bulk;\n projectId = $scope[\"new\"].projectId;\n promise = $rs.issues.bulkCreate(projectId, data);\n promise.then(function(result) {\n $loading.finish(submitButton);\n $rootscope.$broadcast(\"issueform:new:success\", result);\n lightboxService.close($el);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function() {\n $loading.finish(submitButton);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateBulkIssues\", [\"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$rootScope\", \"$tgLoading\", \"lightboxService\", CreateBulkIssuesDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/list.coffee\n */\n\n(function() {\n var IssueAssignedToInlineEditionDirective, IssueStatusInlineEditionDirective, IssuesController, IssuesDirective, IssuesFiltersDirective, bindOnce, debounceLeading, groupBy, joinStr, mixOf, module, startswith, taiga, toString, trim,\n __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n __extends = 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 mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounceLeading = this.taiga.debounceLeading;\n\n startswith = this.taiga.startswith;\n\n module = angular.module(\"taigaIssues\");\n\n IssuesController = (function(_super) {\n __extends(IssuesController, _super);\n\n IssuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$tgUrls\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$appTitle\", \"$tgNavUrls\", \"$tgEvents\", \"$tgAnalytics\", \"tgLoader\"];\n\n function IssuesController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_urls, _at_params, _at_q, _at_location, _at_appTitle, _at_navUrls, _at_events, _at_analytics, tgLoader) {\n var filters, promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.urls = _at_urls;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.events = _at_events;\n this.analytics = _at_analytics;\n this.loadIssues = __bind(this.loadIssues, this);\n this.scope.sectionName = \"Issues\";\n this.scope.filters = {};\n if (_.isEmpty(this.location.search())) {\n filters = this.rs.issues.getFilters(this.params.pslug);\n filters.page = 1;\n this.location.search(filters);\n this.location.replace();\n return;\n }\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Issues - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n this.scope.$on(\"issueform:new:success\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"issue\", \"create\", \"create issue on issues list\", 1);\n _this.loadIssues();\n return _this.loadFilters();\n };\n })(this));\n }\n\n IssuesController.prototype.initializeSubscription = function() {\n var routingKey;\n routingKey = \"changes.project.\" + this.scope.projectId + \".issues\";\n return this.events.subscribe(this.scope, routingKey, (function(_this) {\n return function(message) {\n return _this.loadIssues();\n };\n })(this));\n };\n\n IssuesController.prototype.storeFilters = function() {\n return this.rs.issues.storeFilters(this.params.pslug, this.location.search());\n };\n\n IssuesController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.issueStatusById = groupBy(project.issue_statuses, function(x) {\n return x.id;\n });\n _this.scope.issueStatusList = _.sortBy(project.issue_statuses, \"order\");\n _this.scope.severityById = groupBy(project.severities, function(x) {\n return x.id;\n });\n _this.scope.severityList = _.sortBy(project.severities, \"order\");\n _this.scope.priorityById = groupBy(project.priorities, function(x) {\n return x.id;\n });\n _this.scope.priorityList = _.sortBy(project.priorities, \"order\");\n _this.scope.issueTypes = _.sortBy(project.issue_types, \"order\");\n _this.scope.issueTypeById = groupBy(project.issue_types, function(x) {\n return x.id;\n });\n _this.scope.membersById = groupBy(project.memberships, function(x) {\n return x.user;\n });\n return project;\n };\n })(this));\n };\n\n IssuesController.prototype.getUrlFilters = function() {\n var filters;\n filters = _.pick(this.location.search(), \"page\", \"tags\", \"statuses\", \"types\", \"q\", \"severities\", \"priorities\", \"assignedTo\", \"createdBy\", \"orderBy\");\n if (!filters.page) {\n filters.page = 1;\n }\n return filters;\n };\n\n IssuesController.prototype.getUrlFilter = function(name) {\n var filters;\n filters = _.pick(this.location.search(), name);\n return filters[name];\n };\n\n IssuesController.prototype.loadMyFilters = function() {\n return this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n return _.map(filters, function(value, key) {\n return {\n id: key,\n name: key,\n type: \"myFilters\",\n selected: false\n };\n });\n };\n })(this));\n };\n\n IssuesController.prototype.removeNotExistingFiltersFromUrl = function() {\n var currentSearch, existingValues, filterName, filterValue, splittedValues, urlfilters;\n currentSearch = this.location.search();\n urlfilters = this.getUrlFilters();\n for (filterName in urlfilters) {\n filterValue = urlfilters[filterName];\n if (filterName === \"page\" || filterName === \"orderBy\" || filterName === \"q\") {\n continue;\n }\n if (filterName === \"tags\") {\n splittedValues = _.map((\"\" + filterValue).split(\",\"));\n } else {\n splittedValues = _.map((\"\" + filterValue).split(\",\"), function(x) {\n if (x === \"null\") {\n return null;\n } else {\n return parseInt(x);\n }\n });\n }\n existingValues = _.intersection(splittedValues, _.map(this.scope.filters[filterName], \"id\"));\n if (splittedValues.length !== existingValues.length) {\n this.location.search(filterName, existingValues.join());\n }\n }\n if (currentSearch !== this.location.search()) {\n return this.location.replace();\n }\n };\n\n IssuesController.prototype.markSelectedFilters = function(filters, urlfilters) {\n var isSelected, key, name, obj, searchdata, val, value, _i, _len, _ref, _ref1, _results;\n searchdata = {};\n _ref = _.omit(urlfilters, \"page\", \"orderBy\");\n for (name in _ref) {\n value = _ref[name];\n if (searchdata[name] == null) {\n searchdata[name] = {};\n }\n _ref1 = (\"\" + value).split(\",\");\n for (_i = 0, _len = _ref1.length; _i < _len; _i++) {\n val = _ref1[_i];\n searchdata[name][val] = true;\n }\n }\n isSelected = function(type, id) {\n if ((searchdata[type] != null) && searchdata[type][id]) {\n return true;\n }\n return false;\n };\n _results = [];\n for (key in filters) {\n value = filters[key];\n _results.push((function() {\n var _j, _len1, _results1;\n _results1 = [];\n for (_j = 0, _len1 = value.length; _j < _len1; _j++) {\n obj = value[_j];\n _results1.push(obj.selected = isSelected(obj.type, obj.id) ? true : void 0);\n }\n return _results1;\n })());\n }\n return _results;\n };\n\n IssuesController.prototype.loadFilters = function() {\n var promise, urlfilters;\n urlfilters = this.getUrlFilters();\n if (urlfilters.q) {\n this.scope.filtersQ = urlfilters.q;\n }\n promise = this.loadMyFilters().then((function(_this) {\n return function(myFilters) {\n _this.scope.filters.myFilters = myFilters;\n return myFilters;\n };\n })(this));\n promise = promise.then((function(_this) {\n return function() {\n return _this.rs.issues.filtersData(_this.scope.projectId);\n };\n })(this));\n return promise.then((function(_this) {\n return function(data) {\n var choicesFiltersFormat, tagsFilterFormat, usersFiltersFormat;\n usersFiltersFormat = function(users, type, unknownOption) {\n var reformatedUsers, unknownItem;\n reformatedUsers = _.map(users, function(t) {\n return {\n id: t[0],\n count: t[1],\n type: type,\n name: t[0] ? _this.scope.usersById[t[0]].full_name_display : unknownOption\n };\n });\n unknownItem = _.remove(reformatedUsers, function(u) {\n return !u.id;\n });\n reformatedUsers = _.sortBy(reformatedUsers, function(u) {\n return u.name.toUpperCase();\n });\n if (unknownItem.length > 0) {\n reformatedUsers.unshift(unknownItem[0]);\n }\n return reformatedUsers;\n };\n choicesFiltersFormat = function(choices, type, byIdObject) {\n return _.map(choices, function(t) {\n return {\n id: t[0],\n name: byIdObject[t[0]].name,\n color: byIdObject[t[0]].color,\n count: t[1],\n type: type\n };\n });\n };\n tagsFilterFormat = function(tags) {\n return _.map(tags, function(t) {\n return {\n id: t[0],\n name: t[0],\n color: _this.scope.project.tags_colors[t[0]],\n count: t[1],\n type: \"tags\"\n };\n });\n };\n _this.scope.filters.statuses = choicesFiltersFormat(data.statuses, \"statuses\", _this.scope.issueStatusById);\n _this.scope.filters.severities = choicesFiltersFormat(data.severities, \"severities\", _this.scope.severityById);\n _this.scope.filters.priorities = choicesFiltersFormat(data.priorities, \"priorities\", _this.scope.priorityById);\n _this.scope.filters.assignedTo = usersFiltersFormat(data.assigned_to, \"assignedTo\", \"Unassigned\");\n _this.scope.filters.createdBy = usersFiltersFormat(data.created_by, \"createdBy\", \"Unknown\");\n _this.scope.filters.types = choicesFiltersFormat(data.types, \"types\", _this.scope.issueTypeById);\n _this.scope.filters.tags = tagsFilterFormat(data.tags);\n _this.removeNotExistingFiltersFromUrl();\n _this.markSelectedFilters(_this.scope.filters, urlfilters);\n return _this.rootscope.$broadcast(\"filters:loaded\", _this.scope.filters);\n };\n })(this));\n };\n\n IssuesController.prototype.loadIssuesRequests = 0;\n\n IssuesController.prototype.loadIssues = function() {\n var name, promise, values, _ref;\n this.scope.urlFilters = this.getUrlFilters();\n this.scope.httpParams = {};\n _ref = this.scope.urlFilters;\n for (name in _ref) {\n values = _ref[name];\n if (name === \"severities\") {\n name = \"severity\";\n } else if (name === \"orderBy\") {\n name = \"order_by\";\n } else if (name === \"priorities\") {\n name = \"priority\";\n } else if (name === \"assignedTo\") {\n name = \"assigned_to\";\n } else if (name === \"createdBy\") {\n name = \"owner\";\n } else if (name === \"statuses\") {\n name = \"status\";\n } else if (name === \"types\") {\n name = \"type\";\n }\n this.scope.httpParams[name] = values;\n }\n promise = this.rs.issues.list(this.scope.projectId, this.scope.httpParams);\n this.loadIssuesRequests += 1;\n promise.index = this.loadIssuesRequests;\n return promise.then((function(_this) {\n return function(data) {\n if (promise.index === _this.loadIssuesRequests) {\n _this.scope.issues = data.models;\n _this.scope.page = data.current;\n _this.scope.count = data.count;\n _this.scope.paginatedBy = data.paginatedBy;\n }\n return data;\n };\n })(this));\n };\n\n IssuesController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n _this.initializeSubscription();\n return _this.q.all([_this.loadFilters(), _this.loadIssues()]);\n };\n })(this));\n };\n\n IssuesController.prototype.saveCurrentFiltersTo = function(newFilter) {\n var deferred;\n deferred = this.q.defer();\n this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n filters[newFilter] = _this.location.search();\n return _this.rs.issues.storeMyFilters(_this.scope.projectId, filters).then(function() {\n return deferred.resolve();\n });\n };\n })(this));\n return deferred.promise;\n };\n\n IssuesController.prototype.deleteMyFilter = function(filter) {\n var deferred;\n deferred = this.q.defer();\n this.rs.issues.getMyFilters(this.scope.projectId).then((function(_this) {\n return function(filters) {\n delete filters[filter];\n return _this.rs.issues.storeMyFilters(_this.scope.projectId, filters).then(function() {\n return deferred.resolve();\n });\n };\n })(this));\n return deferred.promise;\n };\n\n IssuesController.prototype.addNewIssue = function() {\n return this.rootscope.$broadcast(\"issueform:new\", this.scope.project);\n };\n\n IssuesController.prototype.addIssuesInBulk = function() {\n return this.rootscope.$broadcast(\"issueform:bulk\", this.scope.projectId);\n };\n\n return IssuesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"IssuesController\", IssuesController);\n\n IssuesDirective = function($log, $location, $template) {\n var link, linkOrdering, linkPagination, template;\n template = $template.get(\"issue/issue-paginator.html\", true);\n linkPagination = function($scope, $el, $attrs, $ctrl) {\n var $pagEl, afterCurrent, atBegin, atEnd, beforeCurrent, getNumPages, renderPagination;\n afterCurrent = 2;\n beforeCurrent = 4;\n atBegin = 2;\n atEnd = 2;\n $pagEl = $el.find(\".issues-paginator\");\n getNumPages = function() {\n var numPages;\n numPages = $scope.count / $scope.paginatedBy;\n if (parseInt(numPages, 10) < numPages) {\n numPages = parseInt(numPages, 10) + 1;\n } else {\n numPages = parseInt(numPages, 10);\n }\n return numPages;\n };\n renderPagination = function() {\n var cpage, i, numPages, options, pages, _i;\n numPages = getNumPages();\n if (numPages <= 1) {\n $pagEl.hide();\n return;\n }\n $pagEl.show();\n pages = [];\n options = {};\n options.pages = pages;\n options.showPrevious = $scope.page > 1;\n options.showNext = !($scope.page === numPages);\n cpage = $scope.page;\n for (i = _i = 1; 1 <= numPages ? _i <= numPages : _i >= numPages; i = 1 <= numPages ? ++_i : --_i) {\n if (i === (cpage + afterCurrent) && numPages > (cpage + afterCurrent + atEnd)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i === (cpage - beforeCurrent) && cpage > (atBegin + beforeCurrent)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i > (cpage + afterCurrent) && i <= (numPages - atEnd)) {\n\n } else if (i < (cpage - beforeCurrent) && i > atBegin) {\n\n } else if (i === cpage) {\n pages.push({\n classes: \"active\",\n num: i,\n type: \"page-active\"\n });\n } else {\n pages.push({\n classes: \"page\",\n num: i,\n type: \"page\"\n });\n }\n }\n return $pagEl.html(template(options));\n };\n $scope.$watch(\"issues\", function(value) {\n if (!value) {\n return;\n }\n return renderPagination();\n });\n $el.on(\"click\", \".issues-paginator a.next\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page + 1);\n return $ctrl.loadIssues();\n });\n });\n $el.on(\"click\", \".issues-paginator a.previous\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page - 1);\n return $ctrl.loadIssues();\n });\n });\n return $el.on(\"click\", \".issues-paginator li.page > a\", function(event) {\n var pagenum, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n pagenum = target.data(\"pagenum\");\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", pagenum);\n return $ctrl.loadIssues();\n });\n });\n };\n linkOrdering = function($scope, $el, $attrs, $ctrl) {\n var colHeadElement, currentOrder, icon;\n currentOrder = $ctrl.getUrlFilter(\"orderBy\") || \"created_date\";\n if (currentOrder) {\n icon = startswith(currentOrder, \"-\") ? \"icon-caret-up\" : \"icon-caret-down\";\n colHeadElement = $el.find(\".row.title > div[data-fieldname='\" + (trim(currentOrder, \"-\")) + \"']\");\n colHeadElement.html((colHeadElement.html()) + \"\");\n }\n return $el.on(\"click\", \".row.title > div\", function(event) {\n var finalOrder, newOrder, target;\n target = angular.element(event.currentTarget);\n currentOrder = $ctrl.getUrlFilter(\"orderBy\");\n newOrder = target.data(\"fieldname\");\n finalOrder = currentOrder === newOrder ? \"-\" + newOrder : newOrder;\n return $scope.$apply(function() {\n $ctrl.replaceFilter(\"orderBy\", finalOrder);\n $ctrl.storeFilters();\n return $ctrl.loadIssues().then(function() {\n $el.find(\".row.title > div > span.icon\").remove();\n icon = startswith(finalOrder, \"-\") ? \"icon-caret-up\" : \"icon-caret-down\";\n return target.html((target.html()) + \"\");\n });\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n linkOrdering($scope, $el, $attrs, $ctrl);\n linkPagination($scope, $el, $attrs, $ctrl);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssues\", [\"$log\", \"$tgLocation\", \"$tgTemplate\", IssuesDirective]);\n\n IssuesFiltersDirective = function($log, $location, $rs, $confirm, $loading, $template) {\n var link, template, templateSelected;\n template = $template.get(\"issue/issues-filters.html\", true);\n templateSelected = $template.get(\"issue/issues-filters-selected.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, initializeSelectedFilters, renderFilters, renderSelectedFilters, selectQFilter, selectedFilters, showCategories, showFilters, toggleFilterSelection;\n $ctrl = $el.closest(\".wrapper\").controller();\n selectedFilters = [];\n showFilters = function(title, type) {\n $el.find(\".filters-cats\").hide();\n $el.find(\".filter-list\").removeClass(\"hidden\");\n $el.find(\"h2.breadcrumb\").removeClass(\"hidden\");\n $el.find(\"h2 a.subfilter span.title\").html(title);\n return $el.find(\"h2 a.subfilter span.title\").prop(\"data-type\", type);\n };\n showCategories = function() {\n $el.find(\".filters-cats\").show();\n $el.find(\".filter-list\").addClass(\"hidden\");\n return $el.find(\"h2.breadcrumb\").addClass(\"hidden\");\n };\n initializeSelectedFilters = function(filters) {\n var name, val, values, _i, _len;\n selectedFilters = [];\n for (name in filters) {\n values = filters[name];\n for (_i = 0, _len = values.length; _i < _len; _i++) {\n val = values[_i];\n if (val.selected) {\n selectedFilters.push(val);\n }\n }\n }\n return renderSelectedFilters(selectedFilters);\n };\n renderSelectedFilters = function(selectedFilters) {\n var html;\n _.filter(selectedFilters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = templateSelected({\n filters: selectedFilters\n });\n $el.find(\".filters-applied\").html(html);\n if (selectedFilters.length > 0) {\n return $el.find(\".save-filters\").show();\n } else {\n return $el.find(\".save-filters\").hide();\n }\n };\n renderFilters = function(filters) {\n var html;\n _.filter(filters, (function(_this) {\n return function(f) {\n if (f.color) {\n return f.style = \"border-left: 3px solid \" + f.color;\n }\n };\n })(this));\n html = template({\n filters: filters\n });\n return $el.find(\".filter-list\").html(html);\n };\n toggleFilterSelection = function(type, id) {\n var currentFiltersType, filter, filterId, filters;\n if (type === \"myFilters\") {\n $rs.issues.getMyFilters($scope.projectId).then(function(data) {\n var filters, myFilters;\n myFilters = data;\n filters = myFilters[id];\n filters.page = 1;\n $ctrl.replaceAllFilters(filters);\n $ctrl.storeFilters();\n $ctrl.loadIssues();\n $ctrl.markSelectedFilters($scope.filters, filters);\n return initializeSelectedFilters($scope.filters);\n });\n return null;\n }\n filters = $scope.filters[type];\n filterId = type === 'tags' ? taiga.toString(id) : id;\n filter = _.find(filters, {\n id: filterId\n });\n filter.selected = !filter.selected;\n if (id === null) {\n id = \"null\";\n }\n if (filter.selected) {\n selectedFilters.push(filter);\n $scope.$apply(function() {\n $ctrl.selectFilter(type, id);\n $ctrl.selectFilter(\"page\", 1);\n $ctrl.storeFilters();\n return $ctrl.loadIssues();\n });\n } else {\n selectedFilters = _.reject(selectedFilters, filter);\n $scope.$apply(function() {\n $ctrl.unselectFilter(type, id);\n $ctrl.selectFilter(\"page\", 1);\n $ctrl.storeFilters();\n return $ctrl.loadIssues();\n });\n }\n renderSelectedFilters(selectedFilters);\n currentFiltersType = $el.find(\"h2 a.subfilter span.title\").prop('data-type');\n if (type === currentFiltersType) {\n return renderFilters(_.reject(filters, \"selected\"));\n }\n };\n $scope.$on(\"filters:loaded\", function(ctx, filters) {\n return initializeSelectedFilters(filters);\n });\n selectQFilter = debounceLeading(100, function(value) {\n if (value === void 0) {\n return;\n }\n if (value.length === 0) {\n $ctrl.replaceFilter(\"q\", null);\n $ctrl.storeFilters();\n } else {\n $ctrl.replaceFilter(\"q\", value);\n $ctrl.storeFilters();\n }\n return $ctrl.loadIssues();\n });\n $scope.$watch(\"filtersQ\", selectQFilter);\n $el.on(\"click\", \".filters-cats > ul > li > a\", function(event) {\n var tags, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n tags = $scope.filters[target.data(\"type\")];\n renderFilters(_.reject(tags, \"selected\"));\n return showFilters(target.attr(\"title\"), target.data(\"type\"));\n });\n $el.on(\"click\", \".filters-inner > .filters-step-cat > .breadcrumb > .back\", function(event) {\n event.preventDefault();\n return showCategories($el);\n });\n $el.on(\"click\", \".filters-applied a\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n id = target.data(\"id\") || null;\n type = target.data(\"type\");\n return toggleFilterSelection(type, id);\n });\n $el.on(\"click\", \".filter-list .single-filter\", function(event) {\n var id, target, type;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n target.toggleClass(\"active\");\n id = target.data(\"id\") || null;\n type = target.data(\"type\");\n if (type === \"myFilters\") {\n target.removeClass(\"active\");\n }\n return toggleFilterSelection(type, id);\n });\n $el.on(\"click\", \".filter-list .single-filter .icon-delete\", function(event) {\n var customFilterName, message, target, title;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n customFilterName = target.parent().data('id');\n title = \"Delete custom filter\";\n message = \"the custom filter '\" + customFilterName + \"'\";\n return $confirm.askOnDelete(title, message).then(function(finish) {\n var promise;\n promise = $ctrl.deleteMyFilter(customFilterName);\n promise.then(function() {\n promise = $ctrl.loadMyFilters();\n promise.then(function(filters) {\n finish();\n $scope.filters.myFilters = filters;\n return renderFilters($scope.filters.myFilters);\n });\n return promise.then(null, function() {\n return finish();\n });\n });\n return promise.then(null, function() {\n finish(false);\n return $confirm.notify(\"error\");\n });\n });\n });\n $el.on(\"click\", \".save-filters\", function(event) {\n event.preventDefault();\n renderFilters($scope.filters[\"myFilters\"]);\n showFilters(\"My filters\", \"myFilters\");\n $el.find('.save-filters').hide();\n $el.find('.my-filter-name').removeClass(\"hidden\");\n return $el.find('.my-filter-name').focus();\n });\n return $el.on(\"keyup\", \".my-filter-name\", function(event) {\n var newFilter, promise, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newFilter = target.val();\n $loading.start($el.find(\".new\"));\n promise = $ctrl.saveCurrentFiltersTo(newFilter);\n promise.then(function() {\n var loadPromise;\n loadPromise = $ctrl.loadMyFilters();\n loadPromise.then(function(filters) {\n var currentfilterstype;\n $loading.finish($el.find(\".new\"));\n $scope.filters.myFilters = filters;\n currentfilterstype = $el.find(\"h2 a.subfilter span.title\").prop('data-type');\n if (currentfilterstype === \"myFilters\") {\n renderFilters($scope.filters.myFilters);\n }\n $el.find('.my-filter-name').addClass(\"hidden\");\n return $el.find('.save-filters').show();\n });\n return loadPromise.then(null, function() {\n $loading.finish($el.find(\".new\"));\n return $confirm.notify(\"error\", \"Error loading custom filters\");\n });\n });\n return promise.then(null, function() {\n $loading.finish($el.find(\".new\"));\n $el.find(\".my-filter-name\").val(newFilter).focus().select();\n return $confirm.notify(\"error\", \"Filter not saved\");\n });\n } else if (event.keyCode === 27) {\n $el.find('.my-filter-name').val('');\n $el.find('.my-filter-name').addClass(\"hidden\");\n return $el.find('.save-filters').show();\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgIssuesFilters\", [\"$log\", \"$tgLocation\", \"$tgResources\", \"$tgConfirm\", \"$tgLoading\", \"$tgTemplate\", IssuesFiltersDirective]);\n\n IssueStatusInlineEditionDirective = function($repo, $template) {\n\n /*\n Print the status of an Issue and a popover to change it.\n - tg-issue-status-inline-edition: The issue\n \n Example:\n \n div.status(tg-issue-status-inline-edition=\"issue\")\n a.issue-status(href=\"\")\n \n NOTE: This directive need 'issueStatusById' and 'project'.\n */\n var link, selectionTemplate, updateIssueStatus;\n selectionTemplate = $template.get(\"issue/issue-status-inline-edition-selection.html\", true);\n updateIssueStatus = function($el, issue, issueStatusById) {\n var issueStatusDom, issueStatusDomParent, status;\n issueStatusDomParent = $el.find(\".issue-status\");\n issueStatusDom = $el.find(\".issue-status .issue-status-bind\");\n status = issueStatusById[issue.status];\n if (status) {\n issueStatusDom.text(status.name);\n issueStatusDom.prop(\"title\", status.name);\n return issueStatusDomParent.css('color', status.color);\n }\n };\n link = function($scope, $el, $attrs) {\n var $ctrl, issue;\n $ctrl = $el.controller();\n issue = $scope.$eval($attrs.tgIssueStatusInlineEdition);\n $el.on(\"click\", \".issue-status\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n issue.status = target.data(\"status-id\");\n $el.find(\".pop-status\").popover().close();\n updateIssueStatus($el, issue, $scope.issueStatusById);\n return $scope.$apply(function() {\n return $repo.save(issue).then;\n });\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n $el.append(selectionTemplate({\n 'statuses': project.issue_statuses\n }));\n updateIssueStatus($el, issue, $scope.issueStatusById);\n if (project.my_permissions.indexOf(\"modify_issue\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$watch($attrs.tgIssueStatusInlineEdition, (function(_this) {\n return function(val) {\n return updateIssueStatus($el, val, $scope.issueStatusById);\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(\"tgIssueStatusInlineEdition\", [\"$tgRepo\", \"$tgTemplate\", IssueStatusInlineEditionDirective]);\n\n IssueAssignedToInlineEditionDirective = function($repo, $rootscope, popoverService) {\n var link, template;\n template = _.template(\"\\\" alt=\\\"<%- name %>\\\"/>\\n
<%- name %>
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, issue, updateIssue;\n updateIssue = function(issue) {\n var ctx, member;\n ctx = {\n name: \"Unassigned\",\n imgurl: \"/images/unnamed.png\"\n };\n member = $scope.usersById[issue.assigned_to];\n if (member) {\n ctx.imgurl = member.photo;\n ctx.name = member.full_name_display;\n }\n $el.find(\".avatar\").html(template(ctx));\n return $el.find(\".issue-assignedto\").attr('title', ctx.name);\n };\n $ctrl = $el.controller();\n issue = $scope.$eval($attrs.tgIssueAssignedToInlineEdition);\n updateIssue(issue);\n $el.on(\"click\", \".issue-assignedto\", function(event) {\n return $rootscope.$broadcast(\"assigned-to:add\", issue);\n });\n taiga.bindOnce($scope, \"project\", function(project) {\n if (project.my_permissions.indexOf(\"modify_issue\") === -1) {\n $el.unbind(\"click\");\n return $el.find(\"a\").addClass(\"not-clickable\");\n }\n });\n $scope.$on(\"assigned-to:added\", (function(_this) {\n return function(ctx, userId, updatedIssue) {\n if (updatedIssue.id === issue.id) {\n updatedIssue.assigned_to = userId;\n $repo.save(updatedIssue);\n return updateIssue(updatedIssue);\n }\n };\n })(this));\n $scope.$watch($attrs.tgIssueAssignedToInlineEdition, (function(_this) {\n return function(val) {\n return updateIssue(val);\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(\"tgIssueAssignedToInlineEdition\", [\"$tgRepo\", \"$rootScope\", IssueAssignedToInlineEditionDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/detail.coffee\n */\n\n(function() {\n var UsClientRequirementButtonDirective, UsStatusButtonDirective, UsStatusDisplayDirective, UsTasksProgressDisplayDirective, UsTeamRequirementButtonDirective, UserStoryDetailController, bindOnce, groupBy, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaUserStories\");\n\n UserStoryDetailController = (function(_super) {\n __extends(UserStoryDetailController, _super);\n\n UserStoryDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"$appTitle\", \"$tgNavUrls\", \"$tgAnalytics\", \"tgLoader\"];\n\n function UserStoryDetailController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_log, _at_appTitle, _at_navUrls, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.log = _at_log;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.analytics = _at_analytics;\n this.scope.usRef = this.params.usref;\n this.scope.sectionName = \"User Story Details\";\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this.appTitle.set(_this.scope.us.subject + \" - \" + _this.scope.project.name);\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n UserStoryDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"related-tasks:update\", (function(_this) {\n return function() {\n _this.loadUs();\n return _this.scope.tasks = _.clone(_this.scope.tasks, false);\n };\n })(this));\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on userstory\", 1);\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n this.scope.$on(\"attachment:edit\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n return this.scope.$on(\"attachment:delete\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n if (this.scope.project.is_backlog_activated) {\n if (this.scope.us.milestone) {\n ctx.sprint = this.scope.sprint.slug;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-taskboard\", ctx);\n } else {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-backlog\", ctx);\n }\n } else if (this.scope.project.is_kanban_activated) {\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-kanban\", ctx);\n }\n };\n\n UserStoryDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.us_statuses;\n _this.scope.statusById = groupBy(project.us_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.membersById = groupBy(project.memberships, function(x) {\n return x.user;\n });\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.pointsById = groupBy(_this.scope.pointsList, function(e) {\n return e.id;\n });\n return project;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadUs = function() {\n return this.rs.userstories.getByRef(this.scope.projectId, this.params.usref).then((function(_this) {\n return function(us) {\n var ctx;\n _this.scope.us = us;\n _this.scope.usId = us.id;\n _this.scope.commentModel = us;\n if (_this.scope.us.neighbors.previous.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.us.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n if (_this.scope.us.neighbors.next.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.us.neighbors.next.ref\n };\n _this.scope.nextUrl = _this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n return us;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadSprint = function() {\n if (this.scope.us.milestone) {\n return this.rs.sprints.get(this.scope.us.project, this.scope.us.milestone).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n return sprint;\n };\n })(this));\n }\n };\n\n UserStoryDetailController.prototype.loadTasks = function() {\n return this.rs.tasks.list(this.scope.projectId, null, this.scope.usId).then((function(_this) {\n return function(tasks) {\n _this.scope.tasks = tasks;\n return tasks;\n };\n })(this));\n };\n\n UserStoryDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.loadUs().then(function() {\n return _this.q.all([_this.loadSprint(), _this.loadTasks()]);\n });\n };\n })(this));\n };\n\n return UserStoryDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserStoryDetailController\", UserStoryDetailController);\n\n UsStatusDisplayDirective = function($template) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(us) {\n var html;\n html = template({\n is_closed: us.is_closed,\n status: $scope.statusById[us.status]\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(us) {\n if (us != null) {\n return render(us);\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(\"tgUsStatusDisplay\", [\"$tgTemplate\", UsStatusDisplayDirective]);\n\n UsTasksProgressDisplayDirective = function($template) {\n var link, template;\n template = $template.get(\"us/us-task-progress.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(tasks) {\n var html, progress, totalClosedTasks, totalTasks;\n totalTasks = tasks.length;\n totalClosedTasks = _.filter(tasks, (function(_this) {\n return function(task) {\n return $scope.taskStatusById[task.status].is_closed;\n };\n })(this)).length;\n progress = totalTasks > 0 ? 100 * totalClosedTasks / totalTasks : 0;\n html = template({\n totalTasks: totalTasks,\n totalClosedTasks: totalClosedTasks,\n progress: progress\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(tasks) {\n if (tasks != null) {\n return render(tasks);\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(\"tgUsTasksProgressDisplay\", [\"$tgTemplate\", UsTasksProgressDisplayDirective]);\n\n UsStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"us/us-status-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = (function(_this) {\n return function(us) {\n var html, status;\n status = $scope.statusById[us.status];\n html = template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(status) {\n var onError, onSuccess, us;\n us = $model.$modelValue.clone();\n us.status = status;\n $.fn.popover().closeAll();\n $model.$setViewValue(us);\n onSuccess = function() {\n $confirm.notify(\"success\");\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n us.revert();\n $model.$setViewValue(us);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save($model.$modelValue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".status-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var status, target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n status = target.data(\"status-id\");\n return save(status);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\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(\"tgUsStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", UsStatusButtonDirective]);\n\n UsTeamRequirementButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"us/us-team-requirement-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var canEdit, render, save;\n canEdit = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = function(us) {\n var ctx, html;\n if (!canEdit() && !us.team_requirement) {\n $el.html(\"\");\n return;\n }\n ctx = {\n canEdit: canEdit(),\n isRequired: us.team_requirement\n };\n html = template(ctx);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(team_requirement) {\n var promise, us;\n us = $model.$modelValue.clone();\n us.team_requirement = team_requirement;\n $model.$setViewValue(us);\n $loading.start($el.find(\"label\"));\n promise = $tgrepo.save($model.$modelValue);\n promise.then(function() {\n $loading.finish($el.find(\"label\"));\n return $rootscope.$broadcast(\"history:reload\");\n });\n return promise.then(null, function() {\n $loading.finish($el.find(\"label\"));\n $confirm.notify(\"error\");\n us.revert();\n return $model.$setViewValue(us);\n });\n };\n })(this));\n $el.on(\"click\", \".team-requirement\", function(event) {\n var team_requirement;\n if (!canEdit()) {\n return;\n }\n team_requirement = !$model.$modelValue.team_requirement;\n return save(team_requirement);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\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(\"tgUsTeamRequirementButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", UsTeamRequirementButtonDirective]);\n\n UsClientRequirementButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue, $template) {\n var link, template;\n template = $template.get(\"us/us-client-requirement-button.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var canEdit, render, save;\n canEdit = function() {\n return $scope.project.my_permissions.indexOf(\"modify_us\") !== -1;\n };\n render = function(us) {\n var ctx, html;\n if (!canEdit() && !us.client_requirement) {\n $el.html(\"\");\n return;\n }\n ctx = {\n canEdit: canEdit(),\n isRequired: us.client_requirement\n };\n html = template(ctx);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(client_requirement) {\n var promise, us;\n us = $model.$modelValue.clone();\n us.client_requirement = client_requirement;\n $model.$setViewValue(us);\n $loading.start($el.find(\"label\"));\n promise = $tgrepo.save($model.$modelValue);\n promise.then(function() {\n $loading.finish($el.find(\"label\"));\n return $rootscope.$broadcast(\"history:reload\");\n });\n return promise.then(null, function() {\n $loading.finish($el.find(\"label\"));\n $confirm.notify(\"error\");\n us.revert();\n return $model.$setViewValue(us);\n });\n };\n })(this));\n $el.on(\"click\", \".client-requirement\", function(event) {\n var client_requirement;\n if (!canEdit()) {\n return;\n }\n client_requirement = !$model.$modelValue.client_requirement;\n return save(client_requirement);\n });\n $scope.$watch($attrs.ngModel, function(us) {\n if (us) {\n return render(us);\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(\"tgUsClientRequirementButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", \"$tgTemplate\", UsClientRequirementButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/detail.coffee\n */\n\n(function() {\n var TaskDetailController, TaskIsIocaineButtonDirective, TaskStatusButtonDirective, TaskStatusDisplayDirective, groupBy, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n module = angular.module(\"taigaTasks\");\n\n TaskDetailController = (function(_super) {\n __extends(TaskDetailController, _super);\n\n TaskDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$log\", \"$appTitle\", \"$tgNavUrls\", \"$tgAnalytics\", \"tgLoader\"];\n\n function TaskDetailController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_log, _at_appTitle, _at_navUrls, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.log = _at_log;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.analytics = _at_analytics;\n this.scope.taskRef = this.params.taskref;\n this.scope.sectionName = \"Task Details\";\n this.initializeEventHandlers();\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this.appTitle.set(_this.scope.task.subject + \" - \" + _this.scope.project.name);\n return _this.initializeOnDeleteGoToUrl();\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n TaskDetailController.prototype.initializeEventHandlers = function() {\n this.scope.$on(\"attachment:create\", (function(_this) {\n return function() {\n _this.analytics.trackEvent(\"attachment\", \"create\", \"create attachment on task\", 1);\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n this.scope.$on(\"attachment:edit\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n return this.scope.$on(\"attachment:delete\", (function(_this) {\n return function() {\n return _this.rootscope.$broadcast(\"history:reload\");\n };\n })(this));\n };\n\n TaskDetailController.prototype.initializeOnDeleteGoToUrl = function() {\n var ctx;\n ctx = {\n project: this.scope.project.slug\n };\n this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project\", ctx);\n if (this.scope.project.is_backlog_activated) {\n if (this.scope.task.milestone) {\n ctx.sprint = this.scope.sprint.slug;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-taskboard\", ctx);\n } else if (this.scope.task.us) {\n ctx.ref = this.scope.us.ref;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n } else if (this.scope.project.is_kanban_activated) {\n if (this.scope.us) {\n ctx.ref = this.scope.us.ref;\n return this.scope.onDeleteGoToUrl = this.navUrls.resolve(\"project-userstories-detail\", ctx);\n }\n }\n };\n\n TaskDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.statusList = project.task_statuses;\n _this.scope.statusById = groupBy(project.task_statuses, function(x) {\n return x.id;\n });\n _this.scope.membersById = groupBy(project.memberships, function(x) {\n return x.user;\n });\n return project;\n };\n })(this));\n };\n\n TaskDetailController.prototype.loadTask = function() {\n return this.rs.tasks.getByRef(this.scope.projectId, this.params.taskref).then((function(_this) {\n return function(task) {\n var ctx;\n _this.scope.task = task;\n _this.scope.taskId = task.id;\n _this.scope.commentModel = task;\n if (_this.scope.task.neighbors.previous.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.task.neighbors.previous.ref\n };\n _this.scope.previousUrl = _this.navUrls.resolve(\"project-tasks-detail\", ctx);\n }\n if (_this.scope.task.neighbors.next.ref != null) {\n ctx = {\n project: _this.scope.project.slug,\n ref: _this.scope.task.neighbors.next.ref\n };\n _this.scope.nextUrl = _this.navUrls.resolve(\"project-tasks-detail\", ctx);\n }\n return task;\n };\n })(this));\n };\n\n TaskDetailController.prototype.loadSprint = function() {\n if (this.scope.task.milestone) {\n return this.rs.sprints.get(this.scope.task.project, this.scope.task.milestone).then((function(_this) {\n return function(sprint) {\n _this.scope.sprint = sprint;\n return sprint;\n };\n })(this));\n }\n };\n\n TaskDetailController.prototype.loadUserStory = function() {\n if (this.scope.task.user_story) {\n return this.rs.userstories.get(this.scope.task.project, this.scope.task.user_story).then((function(_this) {\n return function(us) {\n _this.scope.us = us;\n return us;\n };\n })(this));\n }\n };\n\n TaskDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.loadTask().then(function() {\n return _this.q.all([_this.loadSprint(), _this.loadUserStory()]);\n });\n };\n })(this));\n };\n\n return TaskDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TaskDetailController\", TaskDetailController);\n\n TaskStatusDisplayDirective = function($template) {\n var link, template;\n template = $template.get(\"common/components/status-display.html\", true);\n link = function($scope, $el, $attrs) {\n var render;\n render = function(task) {\n var html;\n html = template({\n status: $scope.statusById[task.status]\n });\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(task) {\n if (task != null) {\n return render(task);\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(\"tgTaskStatusDisplay\", [\"$tgTemplate\", TaskStatusDisplayDirective]);\n\n TaskStatusButtonDirective = function($rootScope, $repo, $confirm, $loading, $qqueue) {\n var link, template;\n template = _.template(\"
clickable<% }%>\\\">\\n \\\">\\n <%- status.name %>\\n <% if(editable){ %><% }%>\\n status\\n\\n \\n
\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n };\n render = (function(_this) {\n return function(task) {\n var html, status;\n status = $scope.statusById[task.status];\n html = template({\n status: status,\n statuses: $scope.statusList,\n editable: isEditable()\n });\n return $el.html(html);\n };\n })(this);\n save = $qqueue.bindAdd((function(_this) {\n return function(status) {\n var onError, onSuccess, task;\n task = $model.$modelValue.clone();\n task.status = status;\n $model.$setViewValue(task);\n onSuccess = function() {\n $confirm.notify(\"success\");\n $rootScope.$broadcast(\"history:reload\");\n return $loading.finish($el.find(\".level-name\"));\n };\n onError = function() {\n $confirm.notify(\"error\");\n task.revert();\n $model.$setViewValue(task);\n return $loading.finish($el.find(\".level-name\"));\n };\n $loading.start($el.find(\".level-name\"));\n return $repo.save($model.$modelValue).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"click\", \".status-data\", function(event) {\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n return $el.find(\".pop-status\").popover().open();\n });\n $el.on(\"click\", \".status\", function(event) {\n var target;\n event.preventDefault();\n event.stopPropagation();\n if (!isEditable()) {\n return;\n }\n target = angular.element(event.currentTarget);\n $.fn.popover().closeAll();\n return save(target.data(\"status-id\"));\n });\n $scope.$watch($attrs.ngModel, function(task) {\n if (task) {\n return render(task);\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(\"tgTaskStatusButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", TaskStatusButtonDirective]);\n\n TaskIsIocaineButtonDirective = function($rootscope, $tgrepo, $confirm, $loading, $qqueue) {\n var link, template;\n template = _.template(\"
\\n \\n \\n
\");\n link = function($scope, $el, $attrs, $model) {\n var isEditable, render, save;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_task\") !== -1;\n };\n render = function(task) {\n var ctx, html;\n if (!isEditable() && !task.is_iocaine) {\n $el.html(\"\");\n return;\n }\n ctx = {\n isIocaine: task.is_iocaine,\n isEditable: isEditable()\n };\n html = template(ctx);\n return $el.html(html);\n };\n save = $qqueue.bindAdd((function(_this) {\n return function(is_iocaine) {\n var promise, task;\n task = $model.$modelValue.clone();\n task.is_iocaine = is_iocaine;\n $model.$setViewValue(task);\n $loading.start($el.find('label'));\n promise = $tgrepo.save(task);\n promise.then(function() {\n $confirm.notify(\"success\");\n return $rootscope.$broadcast(\"history:reload\");\n });\n promise.then(null, function() {\n task.revert();\n $model.$setViewValue(task);\n return $confirm.notify(\"error\");\n });\n return promise[\"finally\"](function() {\n return $loading.finish($el.find('label'));\n });\n };\n })(this));\n $el.on(\"click\", \".is-iocaine\", function(event) {\n var is_iocaine;\n if (!isEditable()) {\n return;\n }\n is_iocaine = !$model.$modelValue.is_iocaine;\n return save(is_iocaine);\n });\n $scope.$watch($attrs.ngModel, function(task) {\n if (task) {\n return render(task);\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(\"tgTaskIsIocaineButton\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgQqueue\", TaskIsIocaineButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var LeaveProjectDirective, TeamController, TeamFiltersDirective, TeamMemberCurrentUserDirective, TeamMemberStatsDirective, TeamMembersDirective, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n module = angular.module(\"taigaTeam\");\n\n TeamController = (function(_super) {\n __extends(TeamController, _super);\n\n TeamController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$q\", \"$location\", \"$tgNavUrls\", \"$appTitle\", \"$tgAuth\", \"tgLoader\"];\n\n function TeamController(_at_scope, _at_rootscope, _at_repo, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_appTitle, _at_auth, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.appTitle = _at_appTitle;\n this.auth = _at_auth;\n this.scope.sectionName = \"Team\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Team - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n TeamController.prototype.setRole = function(role) {\n if (role) {\n return this.scope.filtersRole = role;\n } else {\n return this.scope.filtersRole = null;\n }\n };\n\n TeamController.prototype.loadMembers = function() {\n return this.rs.memberships.list(this.scope.projectId, {}, false).then((function(_this) {\n return function(data) {\n var currentUser, membership, _i, _len, _ref;\n currentUser = _this.auth.getUser();\n if (currentUser.photo == null) {\n currentUser.photo = \"/images/unnamed.png\";\n }\n _this.scope.currentUser = _.find(data, function(membership) {\n return membership.user === currentUser.id;\n });\n _this.scope.totals = {};\n _.forEach(data, function(membership) {\n return _this.scope.totals[membership.user] = 0;\n });\n _this.scope.memberships = _.filter(data, function(membership) {\n if (membership.user && membership.user !== currentUser.id && membership.is_user_active) {\n return membership;\n }\n });\n _ref = _this.scope.memberships;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n membership = _ref[_i];\n if (membership.photo == null) {\n membership.photo = \"/images/unnamed.png\";\n }\n }\n return data;\n };\n })(this));\n };\n\n TeamController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.issuesEnabled = project.is_issues_activated;\n _this.scope.tasksEnabled = project.is_kanban_activated || project.is_backlog_activated;\n _this.scope.wikiEnabled = project.is_wiki_activated;\n return project;\n };\n })(this));\n };\n\n TeamController.prototype.loadMemberStats = function() {\n return this.rs.projects.memberStats(this.scope.projectId).then((function(_this) {\n return function(stats) {\n var totals;\n totals = {};\n _.forEach(_this.scope.totals, function(total, userId) {\n var vals;\n vals = _.map(stats, function(memberStats, statsKey) {\n return memberStats[userId];\n });\n total = _.reduce(vals, function(sum, el) {\n return sum + el;\n });\n return _this.scope.totals[userId] = total;\n });\n _this.scope.stats = _this.processStats(stats);\n return _this.scope.stats.totals = _this.scope.totals;\n };\n })(this));\n };\n\n TeamController.prototype.processStat = function(stat) {\n var max, min, singleStat;\n max = _.max(stat);\n min = _.min(stat);\n singleStat = _.map(stat, function(value, key) {\n if (value === min) {\n return [key, 0.1];\n }\n if (value === max) {\n return [key, 1];\n }\n return [key, (value * 0.5) / max];\n });\n singleStat = _.object(singleStat);\n return singleStat;\n };\n\n TeamController.prototype.processStats = function(stats) {\n var key, value;\n for (key in stats) {\n value = stats[key];\n stats[key] = this.processStat(value);\n }\n return stats;\n };\n\n TeamController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.loadMembers().then(function() {\n return _this.loadMemberStats();\n });\n };\n })(this));\n };\n\n return TeamController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"TeamController\", TeamController);\n\n TeamFiltersDirective = function() {\n return {\n templateUrl: \"team/team-filter.html\"\n };\n };\n\n module.directive(\"tgTeamFilters\", [TeamFiltersDirective]);\n\n TeamMemberStatsDirective = function() {\n return {\n templateUrl: \"team/team-member-stats.html\",\n scope: {\n stats: \"=\",\n userId: \"=user\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\"\n }\n };\n };\n\n module.directive(\"tgTeamMemberStats\", TeamMemberStatsDirective);\n\n TeamMemberCurrentUserDirective = function() {\n return {\n templateUrl: \"team/team-member-current-user.html\",\n scope: {\n projectId: \"=projectid\",\n currentUser: \"=currentuser\",\n stats: \"=\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\"\n }\n };\n };\n\n module.directive(\"tgTeamCurrentUser\", TeamMemberCurrentUserDirective);\n\n TeamMembersDirective = function() {\n var template;\n template = \"team/team-members.html\";\n return {\n templateUrl: template,\n scope: {\n memberships: \"=\",\n filtersQ: \"=filtersq\",\n filtersRole: \"=filtersrole\",\n stats: \"=\",\n issuesEnabled: \"=issuesenabled\",\n tasksEnabled: \"=tasksenabled\",\n wikiEnabled: \"=wikienabled\"\n }\n };\n };\n\n module.directive(\"tgTeamMembers\", TeamMembersDirective);\n\n LeaveProjectDirective = function($repo, $confirm, $location, $rs, $navurls) {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.leave = function() {\n return $confirm.ask(\"Leave this project\", \"Are you sure you want to leave the project?\").then((function(_this) {\n return function(finish) {\n var promise;\n promise = $rs.projects.leave($attrs.projectid);\n promise.then(function() {\n finish();\n $confirm.notify(\"success\");\n return $location.path($navurls.resolve(\"home\"));\n });\n return promise.then(null, function(response) {\n finish();\n return $confirm.notify('error', response.data._error_message);\n });\n };\n })(this));\n };\n };\n return {\n scope: {},\n templateUrl: \"team/leave-project.html\",\n link: link\n };\n };\n\n module.directive(\"tgLeaveProject\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"$tgResources\", \"$tgNavUrls\", LeaveProjectDirective]);\n\n module.filter('membersRoleFilter', function() {\n return function(input, filtersRole) {\n if (filtersRole != null) {\n return _.filter(input, {\n role: filtersRole.id\n });\n }\n return input;\n };\n });\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/detail.coffee\n */\n\n(function() {\n var EditableWikiContentDirective, WikiDetailController, WikiSummaryDirective, bindOnce, debounce, groupBy, mixOf, module, taiga, unslugify,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n unslugify = this.taiga.unslugify;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaWiki\");\n\n WikiDetailController = (function(_super) {\n __extends(WikiDetailController, _super);\n\n WikiDetailController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgModel\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$filter\", \"$log\", \"$appTitle\", \"$tgNavUrls\", \"$tgAnalytics\", \"tgLoader\"];\n\n function WikiDetailController(_at_scope, _at_rootscope, _at_repo, _at_model, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_filter, _at_log, _at_appTitle, _at_navUrls, _at_analytics, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.model = _at_model;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.filter = _at_filter;\n this.log = _at_log;\n this.appTitle = _at_appTitle;\n this.navUrls = _at_navUrls;\n this.analytics = _at_analytics;\n this.scope.projectSlug = this.params.pslug;\n this.scope.wikiSlug = this.params.slug;\n this.scope.sectionName = \"Wiki\";\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Wiki - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n WikiDetailController.prototype.loadProject = function() {\n return this.rs.projects.getBySlug(this.params.pslug).then((function(_this) {\n return function(project) {\n _this.scope.projectId = project.id;\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.membersById = groupBy(project.memberships, function(x) {\n return x.user;\n });\n return project;\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadWiki = function() {\n var promise;\n promise = this.rs.wiki.getBySlug(this.scope.projectId, this.params.slug);\n promise.then((function(_this) {\n return function(wiki) {\n _this.scope.wiki = wiki;\n _this.scope.wikiId = wiki.id;\n return _this.scope.wiki;\n };\n })(this));\n return promise.then(null, (function(_this) {\n return function(xhr) {\n var data;\n _this.scope.wikiId = null;\n if (_this.scope.project.my_permissions.indexOf(\"add_wiki_page\") === -1) {\n return null;\n }\n data = {\n project: _this.scope.projectId,\n slug: _this.scope.wikiSlug,\n content: \"\"\n };\n _this.scope.wiki = _this.model.make_model(\"wiki\", data);\n return _this.scope.wiki;\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadWikiLinks = function() {\n return this.rs.wiki.listLinks(this.scope.projectId).then((function(_this) {\n return function(wikiLinks) {\n return _this.scope.wikiLinks = wikiLinks;\n };\n })(this));\n };\n\n WikiDetailController.prototype.loadInitialData = function() {\n var promise;\n promise = this.loadProject();\n return promise.then((function(_this) {\n return function(project) {\n _this.fillUsersAndRoles(project.users, project.roles);\n return _this.q.all([_this.loadWikiLinks(), _this.loadWiki()]);\n };\n })(this));\n };\n\n WikiDetailController.prototype[\"delete\"] = function() {\n var message, title;\n title = \"Delete Wiki Page\";\n message = unslugify(this.scope.wiki.slug);\n return this.confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var onError, onSuccess;\n onSuccess = function() {\n var ctx;\n finish();\n ctx = {\n project: _this.scope.projectSlug\n };\n _this.location.path(_this.navUrls.resolve(\"project-wiki\", ctx));\n return _this.confirm.notify(\"success\");\n };\n onError = function() {\n finish(false);\n return _this.confirm.notify(\"error\");\n };\n return _this.repo.remove(_this.scope.wiki).then(onSuccess, onError);\n };\n })(this));\n };\n\n return WikiDetailController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"WikiDetailController\", WikiDetailController);\n\n WikiSummaryDirective = function($log, $template) {\n var link, template;\n template = $template.get(\"wiki/wiki-summary.html\", true);\n link = function($scope, $el, $attrs, $model) {\n var render;\n render = function(wiki) {\n var ctx, html, user;\n if ($scope.usersById == null) {\n $log.error(\"WikiSummaryDirective requires userById set in scope.\");\n } else {\n user = $scope.usersById[wiki.last_modifier];\n }\n if (user === void 0) {\n user = {\n name: \"unknown\",\n imgUrl: \"/images/unnamed.png\"\n };\n } else {\n user = {\n name: user.full_name_display,\n imgUrl: user.photo\n };\n }\n ctx = {\n totalEditions: wiki.editions,\n lastModifiedDate: moment(wiki.modified_date).format(\"DD MMM YYYY HH:mm\"),\n user: user\n };\n html = template(ctx);\n return $el.html(html);\n };\n $scope.$watch($attrs.ngModel, function(wikiPage) {\n if (!wikiPage) {\n return;\n }\n return render(wikiPage);\n });\n $scope.$on(\"wiki:edit\", function(event, wikiPage) {\n return render(wikiPage);\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(\"tgWikiSummary\", [\"$log\", \"$tgTemplate\", WikiSummaryDirective]);\n\n EditableWikiContentDirective = function($window, $document, $repo, $confirm, $loading, $analytics, $qqueue) {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var cancelEdition, disableEdition, getSelectedText, isEditable, save, switchToEditMode, switchToReadMode;\n isEditable = function() {\n return $scope.project.my_permissions.indexOf(\"modify_wiki_page\") !== -1;\n };\n switchToEditMode = function() {\n $el.find('.edit-wiki-content').show();\n $el.find('.view-wiki-content').hide();\n return $el.find('textarea').focus();\n };\n switchToReadMode = function() {\n $el.find('.edit-wiki-content').hide();\n return $el.find('.view-wiki-content').show();\n };\n disableEdition = function() {\n $el.find(\".view-wiki-content .edit\").remove();\n return $el.find(\".edit-wiki-content\").remove();\n };\n cancelEdition = function() {\n if (!$model.$modelValue.id) {\n return;\n }\n $scope.$apply((function(_this) {\n return function() {\n return $model.$modelValue.revert();\n };\n })(this));\n return switchToReadMode();\n };\n getSelectedText = function() {\n if ($window.getSelection) {\n return $window.getSelection().toString();\n } else if ($document.selection) {\n return $document.selection.createRange().text;\n }\n return null;\n };\n save = $qqueue.bindAdd(function(wiki) {\n var onError, onSuccess, promise;\n onSuccess = function(wikiPage) {\n if (wiki.id == null) {\n $analytics.trackEvent(\"wikipage\", \"create\", \"create wiki page\", 1);\n }\n $model.$modelValue = wikiPage;\n $scope.$broadcast(\"wiki:edit\", wikiPage);\n $confirm.notify(\"success\");\n return switchToReadMode();\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n $loading.start($el.find('.save-container'));\n if (wiki.id != null) {\n promise = $repo.save(wiki).then(onSuccess, onError);\n } else {\n promise = $repo.create(\"wiki\", wiki).then(onSuccess, onError);\n }\n return promise[\"finally\"](function() {\n return $loading.finish($el.find('.save-container'));\n });\n });\n $el.on(\"mousedown\", \".view-wiki-content\", function(event) {\n var target;\n target = angular.element(event.target);\n if (target.is('pre')) {\n return target.data(\"scroll-pos\", target[0].scrollLeft);\n }\n });\n $el.on(\"mouseup\", \".view-wiki-content\", function(event) {\n var prevPos, target;\n target = angular.element(event.target);\n if (!isEditable()) {\n return;\n }\n if (target.is('a')) {\n return;\n }\n if (getSelectedText()) {\n return;\n }\n if (target.is('pre')) {\n prevPos = target.data(\"scroll-pos\");\n target.data(\"scroll-pos\", null);\n if (prevPos !== target[0].scrollLeft) {\n return;\n }\n }\n return switchToEditMode();\n });\n $el.on(\"click\", \".save\", debounce(2000, function() {\n return save($scope.wiki);\n }));\n $el.on(\"click\", \".cancel\", function() {\n return cancelEdition();\n });\n $el.on(\"keydown\", \"textarea\", function(event) {\n if (event.keyCode === 27) {\n return cancelEdition();\n }\n });\n $scope.$watch($attrs.ngModel, function(wikiPage) {\n if (!wikiPage) {\n return;\n }\n if (isEditable()) {\n $el.addClass('editable');\n if (wikiPage.id == null) {\n return switchToEditMode();\n }\n } else {\n return disableEdition();\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 templateUrl: \"wiki/editable-wiki-content.html\"\n };\n };\n\n module.directive(\"tgEditableWikiContent\", [\"$window\", \"$document\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgAnalytics\", \"$tgQqueue\", EditableWikiContentDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/detail.coffee\n */\n\n(function() {\n var WikiNavDirective, bindOnce, groupBy, mixOf, module, slugify, taiga, unslugify;\n\n taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n slugify = this.taiga.slugify;\n\n unslugify = this.taiga.slugify;\n\n module = angular.module(\"taigaWiki\");\n\n WikiNavDirective = function($tgrepo, $log, $location, $confirm, $navUrls, $analytics, $loading, $template) {\n var link, template;\n template = $template.get(\"wiki/wiki-nav.html\", true);\n link = function($scope, $el, $attrs) {\n var $ctrl, render;\n $ctrl = $el.controller();\n if ($attrs.ngModel == null) {\n return $log.error(\"WikiNavDirective: no ng-model attr is defined\");\n }\n render = function(wikiLinks) {\n var addWikiLinkPermission, deleteWikiLinkPermission, html;\n addWikiLinkPermission = $scope.project.my_permissions.indexOf(\"add_wiki_link\") > -1;\n deleteWikiLinkPermission = $scope.project.my_permissions.indexOf(\"delete_wiki_link\") > -1;\n html = template({\n wikiLinks: wikiLinks,\n projectSlug: $scope.projectSlug,\n addWikiLinkPermission: addWikiLinkPermission,\n deleteWikiLinkPermission: deleteWikiLinkPermission\n });\n $el.off();\n $el.html(html);\n $el.on(\"click\", \".wiki-link .link-title\", function(event) {\n var linkId, linkSlug, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n linkId = target.parents('.wiki-link').data('id');\n linkSlug = $scope.wikiLinks[linkId].href;\n return $scope.$apply(function() {\n var ctx;\n ctx = {\n project: $scope.projectSlug,\n slug: linkSlug\n };\n return $location.path($navUrls.resolve(\"project-wiki-page\", ctx));\n });\n });\n $el.on(\"click\", \".add-button\", function(event) {\n event.preventDefault();\n $el.find(\".new\").removeClass(\"hidden\");\n $el.find(\".new input\").focus();\n return $el.find(\".add-button\").hide();\n });\n $el.on(\"click\", \".wiki-link .icon-delete\", function(event) {\n var linkId, message, target, title;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n linkId = target.parents('.wiki-link').data('id');\n title = \"Delete Wiki Link\";\n message = $scope.wikiLinks[linkId].title;\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var promise;\n promise = $tgrepo.remove($scope.wikiLinks[linkId]);\n promise.then(function() {\n promise = $ctrl.loadWikiLinks();\n promise.then(function() {\n finish();\n return render($scope.wikiLinks);\n });\n return promise.then(null, function() {\n return finish();\n });\n });\n return promise.then(null, function() {\n finish(false);\n return $confirm.notify(\"error\");\n });\n };\n })(this));\n });\n return $el.on(\"keyup\", \".new input\", function(event) {\n var newLink, promise, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newLink = target.val();\n $loading.start($el.find(\".new\"));\n promise = $tgrepo.create(\"wiki-links\", {\n project: $scope.projectId,\n title: newLink,\n href: slugify(newLink)\n });\n promise.then(function() {\n var loadPromise;\n $analytics.trackEvent(\"wikilink\", \"create\", \"create wiki link\", 1);\n loadPromise = $ctrl.loadWikiLinks();\n loadPromise.then(function() {\n $loading.finish($el.find(\".new\"));\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n $el.find(\".add-button\").show();\n return render($scope.wikiLinks);\n });\n return loadPromise.then(null, function() {\n $loading.finish($el.find(\".new\"));\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n $el.find(\".add-button\").show();\n return $confirm.notify(\"error\", \"Error loading wiki links\");\n });\n });\n return promise.then(null, function(error) {\n var _ref;\n $loading.finish($el.find(\".new\"));\n $el.find(\".new input\").val(newLink);\n $el.find(\".new input\").focus().select();\n if ((error != null ? (_ref = error.__all__) != null ? _ref[0] : void 0 : void 0) != null) {\n return $confirm.notify(\"error\", \"The link already exists\");\n } else {\n return $confirm.notify(\"error\");\n }\n });\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new input\").val('');\n return $el.find(\".add-button\").show();\n }\n });\n };\n return bindOnce($scope, $attrs.ngModel, render);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgWikiNav\", [\"$tgRepo\", \"$log\", \"$tgLocation\", \"$tgConfirm\", \"$tgNavUrls\", \"$tgAnalytics\", \"$tgLoading\", \"$tgTemplate\", WikiNavDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var CreateMembersDirective, MAX_MEMBERSHIP_FIELDSETS, debounce, module, taiga;\n\n taiga = this.taiga;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaKanban\");\n\n MAX_MEMBERSHIP_FIELDSETS = 4;\n\n CreateMembersDirective = function($rs, $rootScope, $confirm, $loading, lightboxService) {\n var extraTextTemplate, link, template;\n extraTextTemplate = \"
\\n \\n
\";\n template = _.template(\"
\\n
\\n data-required=\\\"true\\\" <% } %> data-type=\\\"email\\\" />\\n
\\n
\\n \\n \\n
\\n
\");\n link = function($scope, $el, $attrs) {\n var createFieldSet, resetForm, submit, submitButton;\n createFieldSet = function(required) {\n var ctx;\n if (required == null) {\n required = true;\n }\n ctx = {\n roleList: $scope.roles,\n required: required\n };\n return template(ctx);\n };\n resetForm = function() {\n var fieldSet, invitations;\n $el.find(\"form textarea\").remove(\"\");\n $el.find(\"form .add-member-wrapper\").remove();\n invitations = $el.find(\".add-member-forms\");\n invitations.html(extraTextTemplate);\n fieldSet = createFieldSet();\n return invitations.prepend(fieldSet);\n };\n $scope.$on(\"membersform:new\", function() {\n resetForm();\n return lightboxService.open($el);\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n $el.on(\"click\", \".delete-fieldset\", function(event) {\n var fieldSet, lastActionButton, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n fieldSet = target.closest('.add-member-wrapper');\n fieldSet.remove();\n lastActionButton = $el.find(\"fieldset:last > a\");\n if (lastActionButton.hasClass(\"icon-delete delete-fieldset\")) {\n return lastActionButton.removeClass(\"icon-delete delete-fieldset\").addClass(\"icon-plus add-fieldset\");\n }\n });\n $el.on(\"click\", \".add-fieldset\", function(event) {\n var fieldSet, newFieldSet, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n fieldSet = target.closest('.add-member-wrapper');\n target.removeClass(\"icon-plus add-fieldset\").addClass(\"icon-delete delete-fieldset\");\n newFieldSet = createFieldSet(false);\n fieldSet.after(newFieldSet);\n if ($el.find(\".add-member-wrapper\").length === MAX_MEMBERSHIP_FIELDSETS) {\n return $el.find(\".add-member-wrapper fieldset:last > a\").removeClass(\"icon-plus add-fieldset\").addClass(\"icon-delete delete-fieldset\");\n }\n });\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var form, invitation_extra_text, invitations, memberWrappers, onError, onSuccess;\n event.preventDefault();\n $loading.start(submitButton);\n onSuccess = function(data) {\n $loading.finish(submitButton);\n lightboxService.close($el);\n $confirm.notify(\"success\");\n return $rootScope.$broadcast(\"membersform:new:success\");\n };\n onError = function(data) {\n $loading.finish(submitButton);\n lightboxService.close($el);\n $confirm.notify(\"error\");\n return $rootScope.$broadcast(\"membersform:new:error\");\n };\n form = $el.find(\"form\").checksley();\n form.destroy();\n form.initialize();\n if (!form.validate()) {\n return;\n }\n memberWrappers = $el.find(\"form .add-member-wrapper\");\n memberWrappers = _.filter(memberWrappers, function(mw) {\n return angular.element(mw).find(\"input\").hasClass('checksley-ok');\n });\n invitations = _.map(memberWrappers, function(mw) {\n var email, memberWrapper, role;\n memberWrapper = angular.element(mw);\n email = memberWrapper.find(\"input\");\n role = memberWrapper.find(\"select\");\n return {\n email: email.val(),\n role_id: role.val()\n };\n });\n if (invitations.length) {\n invitation_extra_text = $el.find(\"form textarea\").val();\n return $rs.memberships.bulkCreateMemberships($scope.project.id, invitations, invitation_extra_text).then(onSuccess, onError);\n }\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n return $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateMembers\", [\"$tgResources\", \"$rootScope\", \"$tgConfirm\", \"$tgLoading\", \"lightboxService\", CreateMembersDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var MembershipsController, MembershipsDirective, MembershipsRowActionsDirective, MembershipsRowAdminCheckboxDirective, MembershipsRowAvatarDirective, MembershipsRowRoleSelectorDirective, bindMethods, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaAdmin\");\n\n MembershipsController = (function(_super) {\n __extends(MembershipsController, _super);\n\n MembershipsController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAnalytics\", \"$appTitle\"];\n\n function MembershipsController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_analytics, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.analytics = _at_analytics;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Manage Members\";\n this.scope.project = {};\n this.scope.filters = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Membership - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"membersform:new:success\", (function(_this) {\n return function() {\n _this.loadMembers();\n return _this.analytics.trackEvent(\"membership\", \"create\", \"create memberships on admin\", 1);\n };\n })(this));\n }\n\n MembershipsController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n MembershipsController.prototype.loadMembers = function() {\n var httpFilters;\n httpFilters = this.getUrlFilters();\n return this.rs.memberships.list(this.scope.projectId, httpFilters).then((function(_this) {\n return function(data) {\n _this.scope.memberships = _.filter(data.models, function(membership) {\n return membership.user === null || membership.is_user_active;\n });\n _this.scope.page = data.current;\n _this.scope.count = data.count;\n _this.scope.paginatedBy = data.paginatedBy;\n return data;\n };\n })(this));\n };\n\n MembershipsController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadUsersAndRoles();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadMembers();\n };\n })(this));\n };\n\n MembershipsController.prototype.getUrlFilters = function() {\n var filters;\n filters = _.pick(this.location.search(), \"page\");\n if (!filters.page) {\n filters.page = 1;\n }\n return filters;\n };\n\n MembershipsController.prototype.addNewMembers = function() {\n return this.rootscope.$broadcast(\"membersform:new\");\n };\n\n return MembershipsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"MembershipsController\", MembershipsController);\n\n MembershipsDirective = function($template) {\n var link, linkPagination, template;\n template = $template.get(\"admin/admin-membership-paginator.html\", true);\n linkPagination = function($scope, $el, $attrs, $ctrl) {\n var $pagEl, afterCurrent, atBegin, atEnd, beforeCurrent, getNumPages, renderPagination;\n afterCurrent = 2;\n beforeCurrent = 4;\n atBegin = 2;\n atEnd = 2;\n $pagEl = $el.find(\".memberships-paginator\");\n getNumPages = function() {\n var numPages;\n numPages = $scope.count / $scope.paginatedBy;\n if (parseInt(numPages, 10) < numPages) {\n numPages = parseInt(numPages, 10) + 1;\n } else {\n numPages = parseInt(numPages, 10);\n }\n return numPages;\n };\n renderPagination = function() {\n var cpage, i, numPages, options, pages, _i;\n numPages = getNumPages();\n if (numPages <= 1) {\n $pagEl.hide();\n return;\n }\n pages = [];\n options = {};\n options.pages = pages;\n options.showPrevious = $scope.page > 1;\n options.showNext = !($scope.page === numPages);\n cpage = $scope.page;\n for (i = _i = 1; 1 <= numPages ? _i <= numPages : _i >= numPages; i = 1 <= numPages ? ++_i : --_i) {\n if (i === (cpage + afterCurrent) && numPages > (cpage + afterCurrent + atEnd)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i === (cpage - beforeCurrent) && cpage > (atBegin + beforeCurrent)) {\n pages.push({\n classes: \"dots\",\n type: \"dots\"\n });\n } else if (i > (cpage + afterCurrent) && i <= (numPages - atEnd)) {\n\n } else if (i < (cpage - beforeCurrent) && i > atBegin) {\n\n } else if (i === cpage) {\n pages.push({\n classes: \"active\",\n num: i,\n type: \"page-active\"\n });\n } else {\n pages.push({\n classes: \"page\",\n num: i,\n type: \"page\"\n });\n }\n }\n return $pagEl.html(template(options));\n };\n $scope.$watch(\"memberships\", function(value) {\n if (!value) {\n return;\n }\n return renderPagination();\n });\n $el.on(\"click\", \".memberships-paginator a.next\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page + 1);\n return $ctrl.loadMembers();\n });\n });\n $el.on(\"click\", \".memberships-paginator a.previous\", function(event) {\n event.preventDefault();\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", $scope.page - 1);\n return $ctrl.loadMembers();\n });\n });\n return $el.on(\"click\", \".memberships-paginator li.page > a\", function(event) {\n var pagenum, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n pagenum = target.data(\"pagenum\");\n return $scope.$apply(function() {\n $ctrl.selectFilter(\"page\", pagenum);\n return $ctrl.loadMembers();\n });\n });\n };\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n linkPagination($scope, $el, $attrs, $ctrl);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMemberships\", [\"$tgTemplate\", MembershipsDirective]);\n\n MembershipsRowAvatarDirective = function($log, $template) {\n var link, template;\n template = $template.get(\"admin/memberships-row-avatar.html\", true);\n link = function($scope, $el, $attrs) {\n var member, render;\n render = function(member) {\n var ctx, html;\n ctx = {\n full_name: member.full_name ? member.full_name : \"\",\n email: member.user_email ? member.user_email : member.email,\n imgurl: member.photo ? member.photo : \"/images/unnamed.png\"\n };\n html = template(ctx);\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowAvatar == null) {\n return $log.error(\"MembershipsRowAvatarDirective: the directive need a member\");\n }\n member = $scope.$eval($attrs.tgMembershipsRowAvatar);\n render(member);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgMembershipsRowAvatar\", [\"$log\", \"$tgTemplate\", MembershipsRowAvatarDirective]);\n\n MembershipsRowAdminCheckboxDirective = function($log, $repo, $confirm, $template) {\n var link, template;\n template = $template.get(\"admin/admin-memberships-row-checkbox.html\", true);\n link = function($scope, $el, $attrs) {\n var html, member, render;\n render = function(member) {\n var ctx, html;\n ctx = {\n inputId: \"is-admin-\" + member.id\n };\n html = template(ctx);\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowAdminCheckbox == null) {\n return $log.error(\"MembershipsRowAdminCheckboxDirective: the directive need a member\");\n }\n member = $scope.$eval($attrs.tgMembershipsRowAdminCheckbox);\n html = render(member);\n if (member.is_owner) {\n $el.find(\":checkbox\").prop(\"checked\", true);\n }\n $el.on(\"click\", \":checkbox\", (function(_this) {\n return function(event) {\n var onError, onSuccess, target;\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function(data) {\n member.revert();\n $el.find(\":checkbox\").prop(\"checked\", member.is_owner);\n return $confirm.notify(\"error\", data.is_owner[0]);\n };\n target = angular.element(event.currentTarget);\n member.is_owner = target.prop(\"checked\");\n return $repo.save(member).then(onSuccess, onError);\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(\"tgMembershipsRowAdminCheckbox\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgTemplate\", MembershipsRowAdminCheckboxDirective]);\n\n MembershipsRowRoleSelectorDirective = function($log, $repo, $confirm) {\n var link, template;\n template = _.template(\"\");\n link = function($scope, $el, $attrs) {\n var $ctrl, html, member, render;\n render = function(member) {\n var ctx, html;\n ctx = {\n roleList: $scope.roles,\n selectedRole: member.role\n };\n html = template(ctx);\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowRoleSelector == null) {\n return $log.error(\"MembershipsRowRoleSelectorDirective: the directive need a member\");\n }\n $ctrl = $el.controller();\n member = $scope.$eval($attrs.tgMembershipsRowRoleSelector);\n html = render(member);\n $el.on(\"click\", \"select\", (function(_this) {\n return function(event) {\n var newRole, onError, onSuccess, target;\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n target = angular.element(event.currentTarget);\n newRole = parseInt(target.val(), 10);\n if (member.role !== newRole) {\n member.role = newRole;\n return $repo.save(member).then(onSuccess, onError);\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(\"tgMembershipsRowRoleSelector\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", MembershipsRowRoleSelectorDirective]);\n\n MembershipsRowActionsDirective = function($log, $repo, $rs, $confirm) {\n var activedTemplate, link, pendingTemplate;\n activedTemplate = _.template(\"
\\n Active\\n
\\n\\n \\n\");\n pendingTemplate = _.template(\"\\n Pending\\n \\n\\n\\n \\n\");\n link = function($scope, $el, $attrs) {\n var $ctrl, member, render;\n render = function(member) {\n var html;\n if (member.user) {\n html = activedTemplate();\n } else {\n html = pendingTemplate();\n }\n return $el.html(html);\n };\n if ($attrs.tgMembershipsRowActions == null) {\n return $log.error(\"MembershipsRowActionsDirective: the directive need a member\");\n }\n $ctrl = $el.controller();\n member = $scope.$eval($attrs.tgMembershipsRowActions);\n render(member);\n $el.on(\"click\", \".pending\", function(event) {\n var onError, onSuccess;\n event.preventDefault();\n onSuccess = function() {\n return $confirm.notify(\"success\", \"We've sent the invitationi again to '\" + $scope.member.email + \"'.\");\n };\n onError = function() {\n return $confirm.notify(\"error\", \"We haven't sent the invitation.\");\n };\n return $rs.memberships.resendInvitation($scope.member.id).then(onSuccess, onError);\n });\n $el.on(\"click\", \".delete\", function(event) {\n var message, title;\n event.preventDefault();\n title = \"Delete member\";\n message = member.user ? member.full_name : \"the invitation to \" + member.email;\n return $confirm.askOnDelete(title, message).then(function(finish) {\n var onError, onSuccess;\n onSuccess = function() {\n finish();\n $ctrl.loadMembers();\n return $confirm.notify(\"success\", null, \"We've deleted \" + message + \".\");\n };\n onError = function() {\n finish(false);\n return $confirm.notify(\"error\", null, \"We have not been able to delete \" + message + \".\");\n };\n return $repo.remove(member).then(onSuccess, onError);\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(\"tgMembershipsRowActions\", [\"$log\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", MembershipsRowActionsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/nav.coffee\n */\n\n(function() {\n var AdminNavigationDirective, module;\n\n AdminNavigationDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var section;\n section = $attrs.tgAdminNavigation;\n $el.find(\".active\").removeClass(\"active\");\n $el.find(\"#adminmenu-\" + section + \" a\").addClass(\"active\");\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaAdmin\");\n\n module.directive(\"tgAdminNavigation\", AdminNavigationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/project-profile.coffee\n */\n\n(function() {\n var ProjectDefaultValuesDirective, ProjectExportDirective, ProjectModulesDirective, ProjectProfileController, ProjectProfileDirective, bindOnce, debounce, groupBy, joinStr, mixOf, module, taiga, toString, trim,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAdmin\");\n\n ProjectProfileController = (function(_super) {\n __extends(ProjectProfileController, _super);\n\n ProjectProfileController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$appTitle\"];\n\n function ProjectProfileController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.appTitle = _at_appTitle;\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Project profile - \" + _this.scope.sectionName + \" - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:loaded\", (function(_this) {\n return function() {\n return _this.appTitle.set(\"Project profile - \" + _this.scope.sectionName + \" - \" + _this.scope.project.name);\n };\n })(this));\n }\n\n ProjectProfileController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.pointsList = _.sortBy(project.points, \"order\");\n _this.scope.usStatusList = _.sortBy(project.us_statuses, \"order\");\n _this.scope.taskStatusList = _.sortBy(project.task_statuses, \"order\");\n _this.scope.prioritiesList = _.sortBy(project.priorities, \"order\");\n _this.scope.severitiesList = _.sortBy(project.severities, \"order\");\n _this.scope.issueTypesList = _.sortBy(project.issue_types, \"order\");\n _this.scope.issueStatusList = _.sortBy(project.issue_statuses, \"order\");\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ProjectProfileController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this));\n };\n\n ProjectProfileController.prototype.openDeleteLightbox = function() {\n return this.rootscope.$broadcast(\"deletelightbox:new\", this.scope.project);\n };\n\n return ProjectProfileController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"ProjectProfileController\", ProjectProfileController);\n\n ProjectProfileDirective = function($repo, $confirm, $loading, $navurls, $location) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\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 $loading.start(submitButton);\n promise = $repo.save($scope.project);\n promise.then(function() {\n var newUrl;\n $loading.finish(submitButton);\n $confirm.notify(\"success\");\n newUrl = $navurls.resolve(\"project-admin-project-profile-details\", {\n project: $scope.project.slug\n });\n $location.path(newUrl);\n return $scope.$emit(\"project:loaded\", $scope.project);\n });\n return promise.then(null, function(data) {\n $loading.finish(target);\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 $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectProfile\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", \"$tgNavUrls\", \"$tgLocation\", ProjectProfileDirective]);\n\n ProjectDefaultValuesDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\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 $loading.start(submitButton);\n promise = $repo.save($scope.project);\n promise.then(function() {\n $loading.finish(submitButton);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function(data) {\n $loading.finish(target);\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\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectDefaultValues\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", ProjectDefaultValuesDirective]);\n\n ProjectModulesDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit;\n form = $el.find(\"form\").checksley();\n submit = (function(_this) {\n return function() {\n var promise, target;\n if (!form.validate()) {\n return;\n }\n target = angular.element(\".admin-functionalities a.button-green\");\n $loading.start(target);\n promise = $repo.save($scope.project);\n promise.then(function() {\n $loading.finish(target);\n $confirm.notify(\"success\");\n return $scope.$emit(\"project:loaded\", $scope.project);\n });\n return promise.then(null, function(data) {\n $loading.finish(target);\n return $confirm.notify(\"error\", data._error_message);\n });\n };\n })(this);\n $el.on(\"submit\", \"form\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \".admin-functionalities a.button-green\", function(event) {\n event.preventDefault();\n return submit();\n });\n $scope.$watch(\"isVideoconferenceActivated\", function(isVideoconferenceActivated) {\n if (isVideoconferenceActivated) {\n return $el.find(\".videoconference-attributes\").removeClass(\"hidden\");\n } else {\n $el.find(\".videoconference-attributes\").addClass(\"hidden\");\n $scope.project.videoconferences = null;\n return $scope.project.videoconferences_salt = \"\";\n }\n });\n return $scope.$watch(\"project\", function(project) {\n if (project.videoconferences != null) {\n return $scope.isVideoconferenceActivated = true;\n } else {\n return $scope.isVideoconferenceActivated = false;\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectModules\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", ProjectModulesDirective]);\n\n ProjectExportDirective = function($window, $rs, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var buttonsEl, hideButtons, hideResult, hideSpinner, resultEl, resultMessageEl, resultTitleEl, setAsyncMessage, setAsyncTitle, setLoadingMessage, setLoadingTitle, setSyncMessage, setSyncTitle, showButtons, showErrorMode, showExportResultAsyncMode, showExportResultSyncMode, showLoadingMode, showResult, showSpinner, spinnerEl;\n buttonsEl = $el.find(\".admin-project-export-buttons\");\n showButtons = function() {\n return buttonsEl.removeClass(\"hidden\");\n };\n hideButtons = function() {\n return buttonsEl.addClass(\"hidden\");\n };\n resultEl = $el.find(\".admin-project-export-result\");\n showResult = function() {\n return resultEl.removeClass(\"hidden\");\n };\n hideResult = function() {\n return resultEl.addClass(\"hidden\");\n };\n spinnerEl = $el.find(\".spin\");\n showSpinner = function() {\n return spinnerEl.removeClass(\"hidden\");\n };\n hideSpinner = function() {\n return spinnerEl.addClass(\"hidden\");\n };\n resultTitleEl = $el.find(\".result-title\");\n setLoadingTitle = function() {\n return resultTitleEl.html(\"We are generating your dump file\");\n };\n setAsyncTitle = function() {\n return resultTitleEl.html(\"We are generating your dump file\");\n };\n setSyncTitle = function() {\n return resultTitleEl.html(\"Your dump file ir ready!\");\n };\n resultMessageEl = $el.find(\".result-message \");\n setLoadingMessage = function() {\n return resultMessageEl.html(\"Please don't close this page.\");\n };\n setAsyncMessage = function() {\n return resultMessageEl.html(\"We will send you an email when ready.\");\n };\n setSyncMessage = function(url) {\n return resultMessageEl.html(\"If the download doesn't start automatically click here.\");\n };\n showLoadingMode = function() {\n showSpinner();\n setLoadingTitle();\n setLoadingMessage();\n hideButtons();\n return showResult();\n };\n showExportResultAsyncMode = function() {\n hideSpinner();\n setAsyncTitle();\n return setAsyncMessage();\n };\n showExportResultSyncMode = function(url) {\n hideSpinner();\n setSyncTitle();\n return setSyncMessage(url);\n };\n showErrorMode = function() {\n hideSpinner();\n hideResult();\n return showButtons();\n };\n return $el.on(\"click\", \"a.button-export\", debounce(2000, (function(_this) {\n return function(event) {\n var onError, onSuccess;\n event.preventDefault();\n onSuccess = function(result) {\n var dumpUrl;\n if (result.status === 202) {\n return showExportResultAsyncMode();\n } else {\n dumpUrl = result.data.url;\n showExportResultSyncMode(dumpUrl);\n return $window.open(dumpUrl, \"_blank\");\n }\n };\n onError = function(result) {\n var errorMsg, _ref;\n showErrorMode();\n errorMsg = \"Our oompa loompas have some problems generasting your dump. Please try again. \";\n if (result.status === 429) {\n errorMsg = \"Sorry, our oompa loompas are very busy right now. Please try again in a few minutes. \";\n } else if ((_ref = result.data) != null ? _ref._error_message : void 0) {\n errorMsg = \"Our oompa loompas have some problems generasting your dump: \" + result.data._error_message;\n }\n return $confirm.notify(\"error\", errorMsg);\n };\n showLoadingMode();\n return $rs.projects[\"export\"]($scope.projectId).then(onSuccess, onError);\n };\n })(this)));\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectExport\", [\"$window\", \"$tgResources\", \"$tgConfirm\", ProjectExportDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/project-profile.coffee\n */\n\n(function() {\n var ColorSelectionDirective, ProjectValuesController, ProjectValuesDirective, bindOnce, debounce, groupBy, joinStr, mixOf, module, taiga, toString, trim,\n __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n __extends = 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 mixOf = this.taiga.mixOf;\n\n trim = this.taiga.trim;\n\n toString = this.taiga.toString;\n\n joinStr = this.taiga.joinStr;\n\n groupBy = this.taiga.groupBy;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaAdmin\");\n\n ProjectValuesController = (function(_super) {\n __extends(ProjectValuesController, _super);\n\n ProjectValuesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$appTitle\"];\n\n function ProjectValuesController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.appTitle = _at_appTitle;\n this.moveValue = __bind(this.moveValue, this);\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Project values - \" + _this.scope.sectionName + \" - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"admin:project-values:move\", this.moveValue);\n }\n\n ProjectValuesController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ProjectValuesController.prototype.loadValues = function() {\n return this.rs[this.scope.resource].listValues(this.scope.projectId, this.scope.type).then((function(_this) {\n return function(values) {\n _this.scope.values = values;\n _this.scope.maxValueOrder = _.max(values, \"order\").order;\n return values;\n };\n })(this));\n };\n\n ProjectValuesController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.q.all([_this.loadProject(), _this.loadValues()]);\n };\n })(this));\n };\n\n ProjectValuesController.prototype.moveValue = function(ctx, itemValue, itemIndex) {\n var r, values;\n values = this.scope.values;\n r = values.indexOf(itemValue);\n values.splice(r, 1);\n values.splice(itemIndex, 0, itemValue);\n _.each(values, function(value, index) {\n return value.order = index;\n });\n return this.repo.saveAll(values);\n };\n\n return ProjectValuesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"ProjectValuesController\", ProjectValuesController);\n\n ProjectValuesDirective = function($log, $repo, $confirm, $location, animationFrame) {\n var link, linkDragAndDrop, linkValue;\n linkDragAndDrop = function($scope, $el, $attrs) {\n var itemEl, newParentScope, oldParentScope, tdom;\n oldParentScope = null;\n newParentScope = null;\n itemEl = null;\n tdom = $el.find(\".sortable\");\n tdom.sortable({\n handle: \".row.table-main.visualization\",\n dropOnEmpty: true,\n connectWith: \".project-values-body\",\n revert: 400,\n axis: \"y\"\n });\n tdom.on(\"sortstop\", function(event, ui) {\n var itemIndex, itemValue;\n itemEl = ui.item;\n itemValue = itemEl.scope().value;\n itemIndex = itemEl.index();\n return $scope.$broadcast(\"admin:project-values:move\", itemValue, itemIndex);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n linkValue = function($scope, $el, $attrs) {\n var $ctrl, cancel, goToBottomList, initializeNewValue, saveValue, submit, valueType;\n $ctrl = $el.controller();\n valueType = $attrs.type;\n initializeNewValue = function() {\n return $scope.newValue = {\n \"name\": \"\",\n \"is_closed\": false,\n \"is_archived\": false\n };\n };\n initializeNewValue();\n goToBottomList = (function(_this) {\n return function(focus) {\n var table;\n if (focus == null) {\n focus = false;\n }\n table = $el.find(\".table-main\");\n $(document.body).scrollTop(table.offset().top + table.height());\n if (focus) {\n return $(\".new-value input\").focus();\n }\n };\n })(this);\n submit = debounce(2000, (function(_this) {\n return function() {\n var promise;\n promise = $repo.save($scope.project);\n promise.then(function() {\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function(data) {\n return $confirm.notify(\"error\", data._error_message);\n });\n };\n })(this));\n saveValue = debounce(2000, function(target) {\n var form, promise, value;\n form = target.parents(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n value = target.scope().value;\n promise = $repo.save(value);\n promise.then((function(_this) {\n return function() {\n var row;\n row = target.parents(\".row.table-main\");\n row.addClass(\"hidden\");\n return row.siblings(\".visualization\").removeClass('hidden');\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n });\n cancel = function(target) {\n var row, value;\n row = target.parents(\".row.table-main\");\n value = target.scope().value;\n return $scope.$apply(function() {\n row.addClass(\"hidden\");\n value.revert();\n return row.siblings(\".visualization\").removeClass('hidden');\n });\n };\n $el.on(\"submit\", \"form\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \"form a.button-green\", function(event) {\n event.preventDefault();\n return submit();\n });\n $el.on(\"click\", \".show-add-new\", function(event) {\n event.preventDefault();\n $el.find(\".new-value\").removeClass('hidden');\n return goToBottomList(true);\n });\n $el.on(\"click\", \".add-new\", debounce(2000, function(event) {\n var form, promise;\n event.preventDefault();\n form = $el.find(\".new-value\").parents(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n $scope.newValue.project = $scope.project.id;\n $scope.newValue.order = $scope.maxValueOrder ? $scope.maxValueOrder + 1 : 1;\n promise = $repo.create(valueType, $scope.newValue);\n promise.then((function(_this) {\n return function() {\n $ctrl.loadValues().then(function() {\n return animationFrame.add(function() {\n return goToBottomList();\n });\n });\n $el.find(\".new-value\").addClass(\"hidden\");\n return initializeNewValue();\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n }));\n $el.on(\"click\", \".delete-new\", function(event) {\n event.preventDefault();\n $el.find(\".new-value\").hide();\n return initializeNewValue();\n });\n $el.on(\"click\", \".edit-value\", function(event) {\n var editionRow, row, target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n row = target.parents(\".row.table-main\");\n row.addClass(\"hidden\");\n editionRow = row.siblings(\".edition\");\n editionRow.removeClass('hidden');\n return editionRow.find('input:visible').first().focus().select();\n });\n $el.on(\"keyup\", \".edition input\", function(event) {\n var target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n return saveValue(target);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n return cancel(target);\n }\n });\n $el.on(\"click\", \".save\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return saveValue(target);\n });\n $el.on(\"click\", \".cancel\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return cancel(target);\n });\n return $el.on(\"click\", \".delete-value\", function(event) {\n var choices, replacement, subtitle, target, title, value;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n value = target.scope().value;\n choices = {};\n _.each($scope.values, function(option) {\n if (value.id !== option.id) {\n return choices[option.id] = option.name;\n }\n });\n title = \"Delete value\";\n subtitle = value.name;\n replacement = \"All items with this value will be changed to\";\n if (_.keys(choices).length === 0) {\n return $confirm.error(\"You can't delete all values.\");\n }\n return $confirm.askChoice(title, subtitle, choices, replacement).then(function(response) {\n var onError, onSucces;\n onSucces = function() {\n return $ctrl.loadValues()[\"finally\"](function() {\n return response.finish();\n });\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n return $repo.remove(value, {\n \"moveTo\": response.selected\n }).then(onSucces, onError);\n });\n });\n };\n link = function($scope, $el, $attrs) {\n linkDragAndDrop($scope, $el, $attrs);\n linkValue($scope, $el, $attrs);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectValues\", [\"$log\", \"$tgRepo\", \"$tgConfirm\", \"$tgLocation\", \"animationFrame\", ProjectValuesDirective]);\n\n ColorSelectionDirective = function() {\n var link;\n link = function($scope, $el, $attrs, $model) {\n var $ctrl;\n $ctrl = $el.controller();\n $scope.$watch($attrs.ngModel, function(element) {\n return $scope.color = element.color;\n });\n $el.on(\"click\", \".current-color\", function(event) {\n var body, target;\n event.preventDefault();\n event.stopPropagation();\n target = angular.element(event.currentTarget);\n $el.find(\".select-color\").hide();\n target.siblings(\".select-color\").show();\n body = angular.element(\"body\");\n return body.on(\"click\", (function(_this) {\n return function(event) {\n if (angular.element(event.target).parent(\".select-color\").length === 0) {\n $el.find(\".select-color\").hide();\n return body.unbind(\"click\");\n }\n };\n })(this));\n });\n $el.on(\"click\", \".select-color .color\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n $scope.$apply(function() {\n return $model.$modelValue.color = target.data(\"color\");\n });\n return $el.find(\".select-color\").hide();\n });\n $el.on(\"click\", \".select-color .selected-color\", function(event) {\n event.preventDefault();\n $scope.$apply(function() {\n return $model.$modelValue.color = $scope.color;\n });\n return $el.find(\".select-color\").hide();\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(\"tgColorSelection\", ColorSelectionDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var EditRoleDirective, NewRoleDirective, RolePermissionsDirective, RolesController, RolesDirective, bindMethods, bindOnce, debounce, mixOf, module, taiga,\n __extends = 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 taiga = this.taiga;\n\n mixOf = this.taiga.mixOf;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n bindMethods = this.taiga.bindMethods;\n\n module = angular.module(\"taigaAdmin\");\n\n RolesController = (function(_super) {\n __extends(RolesController, _super);\n\n RolesController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$appTitle\"];\n\n function RolesController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Permissions\";\n this.scope.project = {};\n this.scope.anyComputableRole = true;\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Roles - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n RolesController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.anyComputableRole = _.some(_.map(project.roles, function(point) {\n return point.computable;\n }));\n return project;\n };\n })(this));\n };\n\n RolesController.prototype.loadRoles = function() {\n return this.rs.roles.list(this.scope.projectId).then((function(_this) {\n return function(data) {\n _this.scope.roles = data;\n _this.scope.role = _this.scope.roles[0];\n return data;\n };\n })(this));\n };\n\n RolesController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadUsersAndRoles();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadRoles();\n };\n })(this));\n };\n\n RolesController.prototype.setRole = function(role) {\n this.scope.role = role;\n return this.scope.$broadcast(\"role:changed\", this.scope.role);\n };\n\n RolesController.prototype[\"delete\"] = function() {\n var choices, replacement, role, subtitle, title, warning, _i, _len, _ref;\n title = \"Delete Role\";\n subtitle = this.scope.role.name;\n replacement = \"All the users with this role will be moved to\";\n warning = \"Be careful, all role estimations will be removed\";\n choices = {};\n _ref = this.scope.roles;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n role = _ref[_i];\n if (role.id !== this.scope.role.id) {\n choices[role.id] = role.name;\n }\n }\n if (_.keys(choices).length === 0) {\n return this.confirm.error(\"You can't delete all values.\");\n }\n return this.confirm.askChoice(title, subtitle, choices, replacement, warning).then((function(_this) {\n return function(response) {\n var promise;\n promise = _this.repo.remove(_this.scope.role, {\n moveTo: response.selected\n });\n promise.then(function() {\n _this.loadProject();\n return _this.loadRoles()[\"finally\"](function() {\n return response.finish();\n });\n });\n return promise.then(null, function() {\n return _this.confirm.notify('error');\n });\n };\n })(this));\n };\n\n RolesController.prototype.setComputable = debounce(2000, function() {\n var onError, onSuccess;\n onSuccess = (function(_this) {\n return function() {\n _this.confirm.notify(\"success\");\n return _this.loadProject();\n };\n })(this);\n onError = (function(_this) {\n return function() {\n _this.confirm.notify(\"error\");\n return _this.scope.role.revert();\n };\n })(this);\n return this.repo.save(this.scope.role).then(onSuccess, onError);\n });\n\n return RolesController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"RolesController\", RolesController);\n\n EditRoleDirective = function($repo, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit, toggleView;\n toggleView = function() {\n $el.find('.total').toggle();\n return $el.find('.edit-role').toggle();\n };\n submit = function() {\n var promise;\n $scope.role.name = $el.find(\"input\").val();\n promise = $repo.save($scope.role);\n promise.then(function() {\n return $confirm.notify(\"success\");\n });\n promise.then(null, function(data) {\n return $confirm.notify(\"error\");\n });\n return toggleView();\n };\n $el.on(\"click\", \"a.icon-edit\", function() {\n toggleView();\n $el.find(\"input\").focus();\n return $el.find(\"input\").val($scope.role.name);\n });\n $el.on(\"click\", \"a.save\", submit);\n $el.on(\"keyup\", \"input\", function(event) {\n if (event.keyCode === 13) {\n return submit();\n } else if (event.keyCode === 27) {\n return toggleView();\n }\n });\n $scope.$on(\"role:changed\", function() {\n if ($el.find('.edit-role').is(\":visible\")) {\n return toggleView();\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(\"tgEditRole\", [\"$tgRepo\", \"$tgConfirm\", EditRoleDirective]);\n\n RolesDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRoles\", RolesDirective);\n\n NewRoleDirective = function($tgrepo, $confirm) {\n var DEFAULT_PERMISSIONS, link;\n DEFAULT_PERMISSIONS = [\"view_project\", \"view_milestones\", \"view_us\", \"view_tasks\", \"view_issues\"];\n link = function($scope, $el, $attrs) {\n var $ctrl;\n $ctrl = $el.controller();\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n $el.on(\"click\", \"a.add-button\", function(event) {\n event.preventDefault();\n $el.find(\".new\").removeClass(\"hidden\");\n $el.find(\".new\").focus();\n return $el.find(\".add-button\").hide();\n });\n return $el.on(\"keyup\", \".new\", function(event) {\n var newRole, onError, onSuccess, target;\n event.preventDefault();\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n newRole = {\n project: $scope.projectId,\n name: target.val(),\n permissions: DEFAULT_PERMISSIONS,\n order: _.max($scope.roles, function(r) {\n return r.order;\n }).order + 1,\n computable: false\n };\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new\").val('');\n onSuccess = function(role) {\n $scope.roles.push(role);\n $ctrl.setRole(role);\n $el.find(\".add-button\").show();\n return $ctrl.loadProject();\n };\n onError = function() {\n return $confirm.notify(\"error\");\n };\n return $tgrepo.create(\"roles\", newRole).then(onSuccess, onError);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n $el.find(\".new\").addClass(\"hidden\");\n $el.find(\".new\").val('');\n return $el.find(\".add-button\").show();\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgNewRole\", [\"$tgRepo\", \"$tgConfirm\", NewRoleDirective]);\n\n RolePermissionsDirective = function($rootscope, $repo, $confirm) {\n var baseTemplate, categoryTemplate, link, resumeTemplate;\n resumeTemplate = _.template(\"
<%- category.name %>
\\n
\\n
<%- category.activePermissions %>/<%- category.permissions.length %>
\\n <% _.each(category.permissions, function(permission) { %>\\n
active<% } %>\\\"\\n title=\\\"<%- permission.description %>\\\">
\\n <% }) %>\\n
\\n
\");\n categoryTemplate = _.template(\"
\\\">\\n
\\n
\\n
\\n
\\n <% _.each(category.permissions, function(permission) { %>\\n
\\\">\\n <%- permission.description %>\\n
\\n checked=\\\"checked\\\"<% } %>/>\\n
\\n Yes\\n No\\n
\\n
\\n <% }) %>\\n
\\n
\\n
\");\n baseTemplate = _.template(\"
\");\n link = function($scope, $el, $attrs) {\n var $ctrl, generateCategoriesFromRole, renderCategory, renderPermissions, renderResume;\n $ctrl = $el.controller();\n generateCategoriesFromRole = function(role) {\n var categories, issuePermissions, milestonePermissions, setActivePermissions, setActivePermissionsPerCategory, taskPermissions, userStoryPermissions, wikiPermissions;\n setActivePermissions = function(permissions) {\n return _.map(permissions, function(x) {\n var _ref;\n return _.extend({}, x, {\n active: (_ref = x[\"key\"], __indexOf.call(role.permissions, _ref) >= 0)\n });\n });\n };\n setActivePermissionsPerCategory = function(category) {\n return _.map(category, function(x) {\n return _.extend({}, x, {\n activePermissions: _.filter(x[\"permissions\"], \"active\").length\n });\n });\n };\n categories = [];\n milestonePermissions = [\n {\n key: \"view_milestones\",\n description: \"View sprints\"\n }, {\n key: \"add_milestone\",\n description: \"Add sprint\"\n }, {\n key: \"modify_milestone\",\n description: \"Modify sprint\"\n }, {\n key: \"delete_milestone\",\n description: \"Delete sprint\"\n }\n ];\n categories.push({\n name: \"Sprints\",\n permissions: setActivePermissions(milestonePermissions)\n });\n userStoryPermissions = [\n {\n key: \"view_us\",\n description: \"View user story\"\n }, {\n key: \"add_us\",\n description: \"Add user story\"\n }, {\n key: \"modify_us\",\n description: \"Modify user story\"\n }, {\n key: \"delete_us\",\n description: \"Delete user story\"\n }\n ];\n categories.push({\n name: \"User Stories\",\n permissions: setActivePermissions(userStoryPermissions)\n });\n taskPermissions = [\n {\n key: \"view_tasks\",\n description: \"View tasks\"\n }, {\n key: \"add_task\",\n description: \"Add task\"\n }, {\n key: \"modify_task\",\n description: \"Modify task\"\n }, {\n key: \"delete_task\",\n description: \"Delete task\"\n }\n ];\n categories.push({\n name: \"Tasks\",\n permissions: setActivePermissions(taskPermissions)\n });\n issuePermissions = [\n {\n key: \"view_issues\",\n description: \"View issues\"\n }, {\n key: \"add_issue\",\n description: \"Add issue\"\n }, {\n key: \"modify_issue\",\n description: \"Modify issue\"\n }, {\n key: \"delete_issue\",\n description: \"Delete issue\"\n }\n ];\n categories.push({\n name: \"Issues\",\n permissions: setActivePermissions(issuePermissions)\n });\n wikiPermissions = [\n {\n key: \"view_wiki_pages\",\n description: \"View wiki pages\"\n }, {\n key: \"add_wiki_page\",\n description: \"Add wiki page\"\n }, {\n key: \"modify_wiki_page\",\n description: \"Modify wiki page\"\n }, {\n key: \"delete_wiki_page\",\n description: \"Delete wiki page\"\n }, {\n key: \"view_wiki_links\",\n description: \"View wiki links\"\n }, {\n key: \"add_wiki_link\",\n description: \"Add wiki link\"\n }, {\n key: \"delete_wiki_link\",\n description: \"Delete wiki link\"\n }\n ];\n categories.push({\n name: \"Wiki\",\n permissions: setActivePermissions(wikiPermissions)\n });\n return setActivePermissionsPerCategory(categories);\n };\n renderResume = function(element, category) {\n return element.find(\".resume\").html(resumeTemplate({\n category: category\n }));\n };\n renderCategory = function(category, index) {\n var html;\n html = categoryTemplate({\n category: category,\n index: index\n });\n html = angular.element(html);\n renderResume(html, category);\n return html;\n };\n renderPermissions = function() {\n var html;\n $el.off();\n html = baseTemplate();\n _.each(generateCategoriesFromRole($scope.role), function(category, index) {\n return html = angular.element(html).append(renderCategory(category, index));\n });\n $el.html(html);\n $el.on(\"click\", \".resume\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return target.next().toggleClass(\"open\");\n });\n return $el.on(\"change\", \".category-item input\", function(event) {\n var getActivePermissions, onError, onSuccess, target;\n getActivePermissions = function() {\n var activePermissions;\n activePermissions = _.filter($el.find(\".category-item input\"), function(t) {\n return angular.element(t).is(\":checked\");\n });\n activePermissions = _.sortBy(_.map(activePermissions, function(t) {\n var permission;\n return permission = angular.element(t).parents(\".category-item\").data(\"id\");\n }));\n activePermissions.push(\"view_project\");\n return activePermissions;\n };\n target = angular.element(event.currentTarget);\n $scope.role.permissions = getActivePermissions();\n onSuccess = function(role) {\n var categories, categoryId;\n categories = generateCategoriesFromRole(role);\n categoryId = target.parents(\".category-config\").data(\"id\");\n renderResume(target.parents(\".category-config\"), categories[categoryId]);\n $rootscope.$broadcast(\"projects:reload\");\n $confirm.notify(\"success\");\n return $ctrl.loadProject();\n };\n onError = function() {\n $confirm.notify(\"error\");\n target.prop(\"checked\", !target.prop(\"checked\"));\n return $scope.role.permissions = getActivePermissions();\n };\n return $repo.save($scope.role).then(onSuccess, onError);\n });\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n $scope.$on(\"role:changed\", function() {\n return renderPermissions();\n });\n return bindOnce($scope, $attrs.ngModel, renderPermissions);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgRolePermissions\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", RolePermissionsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/third-parties.coffee\n */\n\n(function() {\n var BitbucketController, BitbucketWebhooksDirective, GithubController, GithubWebhooksDirective, GitlabController, GitlabWebhooksDirective, NewWebhookDirective, SelectInputText, ValidOriginIpsDirective, WebhookDirective, WebhooksController, bindMethods, debounce, mixOf, module, taiga, timeout,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n bindMethods = this.taiga.bindMethods;\n\n debounce = this.taiga.debounce;\n\n timeout = this.taiga.timeout;\n\n module = angular.module(\"taigaAdmin\");\n\n WebhooksController = (function(_super) {\n __extends(WebhooksController, _super);\n\n WebhooksController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$appTitle\"];\n\n function WebhooksController(_at_scope, _at_repo, _at_rs, _at_params, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Webhooks\";\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Webhooks - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"webhooks:reload\", this.loadWebhooks);\n }\n\n WebhooksController.prototype.loadWebhooks = function() {\n return this.rs.webhooks.list(this.scope.projectId).then((function(_this) {\n return function(webhooks) {\n return _this.scope.webhooks = webhooks;\n };\n })(this));\n };\n\n WebhooksController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n WebhooksController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadWebhooks();\n };\n })(this));\n };\n\n return WebhooksController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"WebhooksController\", WebhooksController);\n\n WebhookDirective = function($rs, $repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var cancel, openHistory, save, showEditMode, showVisualizationMode, updateLogs, updateShowHideHistoryText, webhook;\n webhook = $scope.$eval($attrs.tgWebhook);\n updateLogs = function() {\n return $rs.webhooklogs.list(webhook.id).then((function(_this) {\n return function(webhooklogs) {\n var log, _i, _len, _ref;\n for (_i = 0, _len = webhooklogs.length; _i < _len; _i++) {\n log = webhooklogs[_i];\n log.validStatus = (200 <= (_ref = log.status) && _ref < 300);\n log.prettySentHeaders = _.map(_.pairs(log.request_headers), function(_arg) {\n var header, value;\n header = _arg[0], value = _arg[1];\n return header + \": \" + value;\n }).join(\"\\n\");\n log.prettySentData = JSON.stringify(log.request_data.data, void 0, 2);\n log.prettyDate = moment(log.created).format(\"DD MMM YYYY [at] hh:mm:ss\");\n }\n webhook.logs_counter = webhooklogs.length;\n webhook.logs = webhooklogs;\n return updateShowHideHistoryText();\n };\n })(this));\n };\n updateShowHideHistoryText = function() {\n var historyElement, textElement;\n textElement = $el.find(\".toggle-history\");\n historyElement = textElement.parents(\".single-webhook-wrapper\").find(\".webhooks-history\");\n if (historyElement.hasClass(\"open\")) {\n return textElement.text(\"(Hide history)\");\n } else {\n return textElement.text(\"(Show history)\");\n }\n };\n showVisualizationMode = function() {\n $el.find(\".edition-mode\").addClass(\"hidden\");\n return $el.find(\".visualization-mode\").removeClass(\"hidden\");\n };\n showEditMode = function() {\n $el.find(\".visualization-mode\").addClass(\"hidden\");\n return $el.find(\".edition-mode\").removeClass(\"hidden\");\n };\n openHistory = function() {\n return $el.find(\".webhooks-history\").addClass(\"open\");\n };\n cancel = function() {\n showVisualizationMode();\n return $scope.$apply(function() {\n return webhook.revert();\n });\n };\n save = debounce(2000, function(target) {\n var form, promise, value;\n form = target.parents(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n value = target.scope().value;\n promise = $repo.save(webhook);\n promise.then((function(_this) {\n return function() {\n return showVisualizationMode();\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n });\n $el.on(\"click\", \".test-webhook\", function() {\n openHistory();\n return $rs.webhooks.test(webhook.id).then((function(_this) {\n return function() {\n return updateLogs();\n };\n })(this));\n });\n $el.on(\"click\", \".edit-webhook\", function() {\n return showEditMode();\n });\n $el.on(\"click\", \".cancel-existing\", function() {\n return cancel();\n });\n $el.on(\"click\", \".edit-existing\", function(event) {\n var target;\n event.preventDefault();\n target = angular.element(event.currentTarget);\n return save(target);\n });\n $el.on(\"keyup\", \".edition-mode input\", function(event) {\n var target;\n if (event.keyCode === 13) {\n target = angular.element(event.currentTarget);\n return saveWebhook(target);\n } else if (event.keyCode === 27) {\n target = angular.element(event.currentTarget);\n return cancel(target);\n }\n });\n $el.on(\"click\", \".delete-webhook\", function() {\n var message, title;\n title = \"Delete webhook\";\n message = \"Webhook '\" + webhook.name + \"'\";\n return $confirm.askOnDelete(title, message).then((function(_this) {\n return function(finish) {\n var onError, onSucces;\n onSucces = function() {\n finish();\n return $scope.$emit(\"webhooks:reload\");\n };\n onError = function() {\n finish(false);\n return $confirm.notify(\"error\");\n };\n return $repo.remove(webhook).then(onSucces, onError);\n };\n })(this));\n });\n $el.on(\"click\", \".toggle-history\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n if ((webhook.logs == null) || webhook.logs.length === 0) {\n return updateLogs().then(function() {\n return timeout(0, function() {\n $el.find(\".webhooks-history\").toggleClass(\"open\");\n return updateShowHideHistoryText();\n });\n });\n } else {\n $el.find(\".webhooks-history\").toggleClass(\"open\");\n return $scope.$apply(function() {\n return updateShowHideHistoryText();\n });\n }\n });\n $el.on(\"click\", \".history-single\", function(event) {\n var target;\n target = angular.element(event.currentTarget);\n target.toggleClass(\"history-single-open\");\n return target.siblings(\".history-single-response\").toggleClass(\"open\");\n });\n return $el.on(\"click\", \".resend-request\", function(event) {\n var log, target;\n target = angular.element(event.currentTarget);\n log = target.data(\"log\");\n return $rs.webhooklogs.resend(log).then((function(_this) {\n return function() {\n return updateLogs();\n };\n })(this));\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgWebhook\", [\"$tgResources\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", WebhookDirective]);\n\n NewWebhookDirective = function($rs, $repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var addWebhookDOMNode, formDOMNode, initializeNewValue, webhook;\n webhook = $scope.$eval($attrs.tgWebhook);\n formDOMNode = $el.find(\".new-webhook-form\");\n addWebhookDOMNode = $el.find(\".add-webhook\");\n initializeNewValue = function() {\n return $scope.newValue = {\n \"name\": \"\",\n \"url\": \"\",\n \"key\": \"\"\n };\n };\n initializeNewValue();\n $scope.$watch(\"webhooks\", function(webhooks) {\n if (webhooks != null) {\n if (webhooks.length === 0) {\n formDOMNode.removeClass(\"hidden\");\n addWebhookDOMNode.addClass(\"hidden\");\n return formDOMNode.find(\"input\")[0].focus();\n } else {\n formDOMNode.addClass(\"hidden\");\n return addWebhookDOMNode.removeClass(\"hidden\");\n }\n }\n });\n formDOMNode.on(\"click\", \".add-new\", debounce(2000, function(event) {\n var form, promise;\n event.preventDefault();\n form = formDOMNode.checksley();\n if (!form.validate()) {\n return;\n }\n $scope.newValue.project = $scope.project.id;\n promise = $repo.create(\"webhooks\", $scope.newValue);\n promise.then((function(_this) {\n return function() {\n $scope.$emit(\"webhooks:reload\");\n return initializeNewValue();\n };\n })(this));\n return promise.then(null, function(data) {\n $confirm.notify(\"error\");\n return form.setErrors(data);\n });\n }));\n formDOMNode.on(\"click\", \".cancel-new\", function(event) {\n return $scope.$apply(function() {\n return initializeNewValue();\n });\n });\n return addWebhookDOMNode.on(\"click\", function(event) {\n formDOMNode.removeClass(\"hidden\");\n return formDOMNode.find(\"input\")[0].focus();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgNewWebhook\", [\"$tgResources\", \"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", NewWebhookDirective]);\n\n GithubController = (function(_super) {\n __extends(GithubController, _super);\n\n GithubController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$appTitle\"];\n\n function GithubController(_at_scope, _at_repo, _at_rs, _at_params, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Github\";\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Github - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n GithubController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"github\").then((function(_this) {\n return function(github) {\n return _this.scope.github = github;\n };\n })(this));\n };\n\n GithubController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n GithubController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n };\n\n return GithubController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"GithubController\", GithubController);\n\n GitlabController = (function(_super) {\n __extends(GitlabController, _super);\n\n GitlabController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$appTitle\"];\n\n function GitlabController(_at_scope, _at_repo, _at_rs, _at_params, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Gitlab\";\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Gitlab - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:modules:reload\", (function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n }\n\n GitlabController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"gitlab\").then((function(_this) {\n return function(gitlab) {\n return _this.scope.gitlab = gitlab;\n };\n })(this));\n };\n\n GitlabController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n GitlabController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n };\n\n return GitlabController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"GitlabController\", GitlabController);\n\n BitbucketController = (function(_super) {\n __extends(BitbucketController, _super);\n\n BitbucketController.$inject = [\"$scope\", \"$tgRepo\", \"$tgResources\", \"$routeParams\", \"$appTitle\"];\n\n function BitbucketController(_at_scope, _at_repo, _at_rs, _at_params, _at_appTitle) {\n var promise;\n this.scope = _at_scope;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.params = _at_params;\n this.appTitle = _at_appTitle;\n bindMethods(this);\n this.scope.sectionName = \"Bitbucket\";\n this.scope.project = {};\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(\"Bitbucket - \" + _this.scope.project.name);\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n this.scope.$on(\"project:modules:reload\", (function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n }\n\n BitbucketController.prototype.loadModules = function() {\n return this.rs.modules.list(this.scope.projectId, \"bitbucket\").then((function(_this) {\n return function(bitbucket) {\n return _this.scope.bitbucket = bitbucket;\n };\n })(this));\n };\n\n BitbucketController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n BitbucketController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadModules();\n };\n })(this));\n };\n\n return BitbucketController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin));\n\n module.controller(\"BitbucketController\", BitbucketController);\n\n SelectInputText = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $el.on(\"click\", \".select-input-content\", function() {\n $el.find(\"input\").select();\n return $el.find(\".help-copy\").addClass(\"visible\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgSelectInputText\", SelectInputText);\n\n GithubWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\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 $loading.start(submitButton);\n promise = $repo.saveAttribute($scope.github, \"github\");\n promise.then(function() {\n $loading.finish(submitButton);\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\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 $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgGithubWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", GithubWebhooksDirective]);\n\n GitlabWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\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 $loading.start(submitButton);\n promise = $repo.saveAttribute($scope.gitlab, \"gitlab\");\n promise.then(function() {\n $loading.finish(submitButton);\n $confirm.notify(\"success\");\n return $scope.$emit(\"project:modules:reload\");\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\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 $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgGitlabWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", GitlabWebhooksDirective]);\n\n BitbucketWebhooksDirective = function($repo, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs) {\n var form, submit, submitButton;\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\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 $loading.start(submitButton);\n promise = $repo.saveAttribute($scope.bitbucket, \"bitbucket\");\n promise.then(function() {\n $loading.finish(submitButton);\n $confirm.notify(\"success\");\n return $scope.$emit(\"project:modules:reload\");\n });\n return promise.then(null, function(data) {\n $loading.finish(submitButton);\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 $el.on(\"click\", \".submit-button\", submit);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgBitbucketWebhooks\", [\"$tgRepo\", \"$tgConfirm\", \"$tgLoading\", BitbucketWebhooksDirective]);\n\n ValidOriginIpsDirective = function() {\n var link;\n link = function($scope, $el, $attrs, $ngModel) {\n return $ngModel.$parsers.push(function(value) {\n value = $.trim(value);\n if (value === \"\") {\n return [];\n }\n return value.split(\",\");\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n require: \"ngModel\"\n };\n };\n\n module.directive(\"tgValidOriginIps\", ValidOriginIpsDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/attachments.coffee\n */\n\n(function() {\n var CreateProject, DeleteProjectDirective, bindOnce, debounce, module, taiga, timeout;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n timeout = this.taiga.timeout;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaProject\");\n\n CreateProject = function($rootscope, $repo, $confirm, $location, $navurls, $rs, $projectUrl, $loading, lightboxService, $cacheFactory) {\n var link;\n link = function($scope, $el, attrs) {\n var form, onErrorSubmit, onSuccessSubmit, submit, submitButton;\n $scope.data = {};\n $scope.templates = [];\n form = $el.find(\"form\").checksley({\n \"onlyOneErrorElement\": true\n });\n onSuccessSubmit = function(response) {\n $cacheFactory.get('$http').removeAll();\n $loading.finish(submitButton);\n $rootscope.$broadcast(\"projects:reload\");\n $confirm.notify(\"success\", \"Success\");\n $location.url($projectUrl.get(response));\n return lightboxService.close($el);\n };\n onErrorSubmit = function(response) {\n var error_field, error_step, selectors, _i, _len, _ref;\n $loading.finish(submitButton);\n form.setErrors(response);\n selectors = [];\n _ref = _.keys(response);\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n error_field = _ref[_i];\n selectors.push(\"[name=\" + error_field + \"]\");\n }\n $el.find(\".active\").removeClass(\"active\");\n error_step = $el.find(selectors.join(\",\")).first().parents(\".wizard-step\");\n error_step.addClass(\"active\");\n return $el.find('.progress-bar').removeClass().addClass('progress-bar').addClass(error_step.data(\"step\"));\n };\n submit = (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if (!form.validate()) {\n return;\n }\n $loading.start(submitButton);\n promise = $repo.create(\"projects\", $scope.data);\n return promise.then(onSuccessSubmit, onErrorSubmit);\n };\n })(this);\n $scope.$on(\"projects:create\", function() {\n $scope.data = {\n total_story_points: 100,\n total_milestones: 5\n };\n if (!$scope.templates.length) {\n $rs.projects.templates().then((function(_this) {\n return function(result) {\n $scope.templates = result;\n return $scope.data.creation_template = _.head(_.filter($scope.templates, function(x) {\n return x.slug === \"scrum\";\n })).id;\n };\n })(this));\n } else {\n $scope.data.creation_template = _.head(_.filter($scope.templates, function(x) {\n return x.slug === \"scrum\";\n })).id;\n }\n $el.find(\".active\").removeClass(\"active\");\n $el.find(\".create-step1\").addClass(\"active\");\n lightboxService.open($el);\n return timeout(600, function() {\n return $el.find(\".progress-bar\").addClass('step1');\n });\n });\n $el.on(\"click\", \".button-next\", function(event) {\n var current, field, next, step, valid, _i, _len, _ref;\n event.preventDefault();\n current = $el.find(\".active\");\n valid = true;\n _ref = form.fields;\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\n field = _ref[_i];\n if (current.find(\"[name=\" + (field.element.attr('name')) + \"]\").length) {\n valid = field.validate() !== false && valid;\n }\n }\n if (!valid) {\n return;\n }\n next = current.next();\n current.toggleClass('active');\n next.toggleClass('active');\n step = next.data('step');\n return $el.find('.progress-bar').removeClass().addClass('progress-bar').addClass(step);\n });\n $el.on(\"click\", \".button-prev\", function(event) {\n var current, prev, step;\n event.preventDefault();\n current = $el.find(\".active\");\n prev = current.prev();\n current.toggleClass('active');\n prev.toggleClass('active');\n step = prev.data('step');\n return $el.find('.progress-bar').removeClass().addClass('progress-bar').addClass(step);\n });\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $el.on(\"click\", \".close\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbCreateProject\", [\"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$location\", \"$tgNavUrls\", \"$tgResources\", \"$projectUrl\", \"$tgLoading\", \"lightboxService\", \"$cacheFactory\", CreateProject]);\n\n DeleteProjectDirective = function($repo, $rootscope, $auth, $location, $navUrls, $confirm, lightboxService, tgLoader) {\n var link;\n link = function($scope, $el, $attrs) {\n var projectToDelete, submit;\n projectToDelete = null;\n $scope.$on(\"deletelightbox:new\", function(ctx, project) {\n lightboxService.open($el);\n return projectToDelete = project;\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n submit = function() {\n var promise;\n tgLoader.start();\n lightboxService.close($el);\n promise = $repo.remove(projectToDelete);\n promise.then(function(data) {\n tgLoader.pageLoaded();\n $rootscope.$broadcast(\"projects:reload\");\n $location.path($navUrls.resolve(\"home\"));\n return $confirm.notify(\"success\");\n });\n return promise.then(null, function() {\n $confirm.notify(\"error\");\n return lightboxService.close($el);\n });\n };\n $el.on(\"click\", \".button-red\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n return $el.on(\"click\", \".button-green\", function(event) {\n event.preventDefault();\n return submit();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgLbDeleteProject\", [\"$tgRepo\", \"$rootScope\", \"$tgAuth\", \"$tgLocation\", \"$tgNavUrls\", \"$tgConfirm\", \"lightboxService\", \"tgLoader\", DeleteProjectDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/attachments.coffee\n */\n\n(function() {\n var ProjectController, ProjectsController, ProjectsListDirective, ProjectsPaginationDirective, bindOnce, module, taiga,\n __extends = 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(\"taigaProject\");\n\n bindOnce = this.taiga.bindOnce;\n\n ProjectsController = (function(_super) {\n __extends(ProjectsController, _super);\n\n ProjectsController.$inject = [\"$scope\", \"$q\", \"$tgResources\", \"$rootScope\", \"$tgNavUrls\", \"$tgAuth\", \"$tgLocation\", \"$appTitle\", \"$projectUrl\", \"tgLoader\"];\n\n function ProjectsController(_at_scope, _at_q, _at_rs, _at_rootscope, _at_navUrls, _at_auth, _at_location, _at_appTitle, _at_projectUrl, tgLoader) {\n var promise;\n this.scope = _at_scope;\n this.q = _at_q;\n this.rs = _at_rs;\n this.rootscope = _at_rootscope;\n this.navUrls = _at_navUrls;\n this.auth = _at_auth;\n this.location = _at_location;\n this.appTitle = _at_appTitle;\n this.projectUrl = _at_projectUrl;\n this.appTitle.set(\"Projects\");\n if (!this.auth.isAuthenticated()) {\n this.location.path(this.navUrls.resolve(\"login\"));\n }\n this.user = this.auth.getUser();\n this.projects = [];\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.scope.$emit(\"projects:loaded\");\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n promise[\"finally\"](tgLoader.pageLoaded);\n }\n\n ProjectsController.prototype.loadInitialData = function() {\n return this.rs.projects.list().then((function(_this) {\n return function(projects) {\n var project, _i, _len;\n _this.projects = {\n 'recents': projects.slice(0, 8),\n 'all': projects\n };\n for (_i = 0, _len = projects.length; _i < _len; _i++) {\n project = projects[_i];\n project.url = _this.projectUrl.get(project);\n }\n return projects;\n };\n })(this));\n };\n\n ProjectsController.prototype.newProject = function() {\n return this.rootscope.$broadcast(\"projects:create\");\n };\n\n ProjectsController.prototype.logout = function() {\n this.auth.logout();\n return this.location.path(this.navUrls.resolve(\"login\"));\n };\n\n return ProjectsController;\n\n })(taiga.Controller);\n\n module.controller(\"ProjectsController\", ProjectsController);\n\n ProjectController = (function(_super) {\n __extends(ProjectController, _super);\n\n ProjectController.$inject = [\"$scope\", \"$tgResources\", \"$tgRepo\", \"$routeParams\", \"$q\", \"$rootScope\", \"$appTitle\", \"$tgLocation\", \"$tgNavUrls\"];\n\n function ProjectController(_at_scope, _at_rs, _at_repo, _at_params, _at_q, _at_rootscope, _at_appTitle, _at_location, _at_navUrls) {\n var promise;\n this.scope = _at_scope;\n this.rs = _at_rs;\n this.repo = _at_repo;\n this.params = _at_params;\n this.q = _at_q;\n this.rootscope = _at_rootscope;\n this.appTitle = _at_appTitle;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n _this.appTitle.set(_this.scope.project.name);\n return _this.scope.$emit(\"regenerate:project-pagination\");\n };\n })(this));\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n ProjectController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadPageData();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.scope.$emit(\"project:loaded\", _this.scope.project);\n };\n })(this));\n };\n\n ProjectController.prototype.loadPageData = function() {\n return this.q.all([this.loadProjectStats(), this.loadProject()]);\n };\n\n ProjectController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n return project;\n };\n })(this));\n };\n\n ProjectController.prototype.loadProjectStats = function() {\n return this.rs.projects.stats(this.scope.projectId).then((function(_this) {\n return function(stats) {\n _this.scope.stats = stats;\n return stats;\n };\n })(this));\n };\n\n return ProjectController;\n\n })(taiga.Controller);\n\n module.controller(\"ProjectController\", ProjectController);\n\n ProjectsPaginationDirective = function($timeout) {\n var link;\n link = function($scope, $el, $attrs) {\n var checkButtonVisibility, container, containerSize, hasNextPage, hasPagination, hasPrevPage, hide, nextBtn, nextPage, pageSize, prevBtn, prevPage, remove, render, visible;\n prevBtn = $el.find(\".v-pagination-previous\");\n nextBtn = $el.find(\".v-pagination-next\");\n container = $el.find(\"ul\");\n pageSize = 0;\n containerSize = 0;\n render = function() {\n pageSize = $el.find(\".v-pagination-list\").height();\n if (container.find(\"li\").length) {\n if (hasPagination()) {\n if (hasNextPage()) {\n visible(nextBtn);\n } else {\n hide(nextBtn);\n }\n if (hasPrevPage()) {\n return visible(prevBtn);\n } else {\n return hide(prevBtn);\n }\n } else {\n return remove();\n }\n } else {\n return remove();\n }\n };\n hasPagination = function() {\n containerSize = container.height();\n return containerSize > pageSize;\n };\n hasPrevPage = function(top) {\n if (top == null) {\n top = -parseInt(container.css('top'), 10) || 0;\n }\n return top !== 0;\n };\n hasNextPage = function(top) {\n containerSize = container.height();\n if (!top) {\n top = -parseInt(container.css('top'), 10) || 0;\n }\n return containerSize > pageSize && top + pageSize < containerSize;\n };\n nextPage = function(callback) {\n var lastLi, maxTop, newTop, top;\n top = parseInt(container.css('top'), 10);\n newTop = top - pageSize;\n lastLi = $el.find(\".v-pagination-list li:last-child\");\n maxTop = -((lastLi.position().top + lastLi.outerHeight()) - pageSize);\n if (newTop < maxTop) {\n newTop = maxTop;\n }\n container.animate({\n \"top\": newTop\n }, callback);\n return newTop;\n };\n prevPage = function(callback) {\n var newTop, top;\n top = parseInt(container.css('top'), 10);\n newTop = top + pageSize;\n if (newTop > 0) {\n newTop = 0;\n }\n container.animate({\n \"top\": newTop\n }, callback);\n return newTop;\n };\n visible = function(element) {\n return element.css('visibility', 'visible');\n };\n hide = function(element) {\n return element.css('visibility', 'hidden');\n };\n checkButtonVisibility = function() {};\n remove = function() {\n container.css('top', 0);\n hide(prevBtn);\n return hide(nextBtn);\n };\n $el.on(\"click\", \".v-pagination-previous\", function(event) {\n var newTop;\n event.preventDefault();\n if (container.is(':animated')) {\n return;\n }\n visible(nextBtn);\n newTop = prevPage();\n if (!hasPrevPage(newTop)) {\n return hide(prevBtn);\n }\n });\n $el.on(\"click\", \".v-pagination-next\", function(event) {\n var newTop;\n event.preventDefault();\n if (container.is(':animated')) {\n return;\n }\n visible(prevBtn);\n newTop = -nextPage();\n if (!hasNextPage(newTop)) {\n return hide(nextBtn);\n }\n });\n $scope.$on(\"regenerate:project-pagination\", function() {\n remove();\n return render();\n });\n $(window).on(\"resize.projects-pagination\", render);\n return $scope.$on(\"$destroy\", function() {\n return $(window).off(\"resize.projects-pagination\");\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectsPagination\", ['$timeout', ProjectsPaginationDirective]);\n\n ProjectsListDirective = function($compile, $template) {\n var link, template;\n template = $template.get('project/project-list.html', true);\n link = function($scope, $el, $attrs, $ctrls) {\n var render;\n render = function(projects) {\n $el.html($compile(template({\n projects: projects\n }))($scope));\n return $scope.$emit(\"regenerate:project-pagination\");\n };\n return $scope.$watch(\"projects\", function(projects) {\n if (projects != null) {\n return render(projects);\n }\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgProjectsList\", [\"$compile\", \"$tgTemplate\", ProjectsListDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/bind.coffee\n */\n\n(function() {\n var BindHtmlDirective, BindOnceAltDirective, BindOnceBindDirective, BindOnceHrefDirective, BindOnceHtmlDirective, BindOnceRefDirective, BindOnceSrcDirective, BindOnceTitleDirective, BindTitleDirective, bindOnce, module;\n\n bindOnce = this.taiga.bindOnce;\n\n BindOnceBindDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoBind, function(val) {\n return $el.text(val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceHtmlDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoHtml, function(val) {\n return $el.html(val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceRefDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoRef, function(val) {\n return $el.html(\"#\" + val + \" \");\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceSrcDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoSrc, function(val) {\n return $el.attr(\"src\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceHrefDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoHref, function(val) {\n return $el.attr(\"href\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceAltDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoAlt, function(val) {\n return $el.attr(\"alt\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindOnceTitleDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return bindOnce($scope, $attrs.tgBoTitle, function(val) {\n return $el.attr(\"title\", val);\n });\n };\n return {\n link: link\n };\n };\n\n BindTitleDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$watch($attrs.tgTitleHtml, function(val) {\n if (val != null) {\n return $el.attr(\"title\", val);\n }\n });\n };\n return {\n link: link\n };\n };\n\n BindHtmlDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$watch($attrs.tgBindHtml, function(val) {\n if (val != null) {\n return $el.html(val);\n }\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaBase\");\n\n module.directive(\"tgBoBind\", BindOnceBindDirective);\n\n module.directive(\"tgBoHtml\", BindOnceHtmlDirective);\n\n module.directive(\"tgBoRef\", BindOnceRefDirective);\n\n module.directive(\"tgBoSrc\", BindOnceSrcDirective);\n\n module.directive(\"tgBoHref\", BindOnceHrefDirective);\n\n module.directive(\"tgBoAlt\", BindOnceAltDirective);\n\n module.directive(\"tgBoTitle\", BindOnceTitleDirective);\n\n module.directive(\"tgBindTitle\", BindTitleDirective);\n\n module.directive(\"tgBindHtml\", BindHtmlDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/conf.coffee\n */\n\n(function() {\n var ConfigurationService, module;\n\n ConfigurationService = (function() {\n function ConfigurationService() {\n this.config = window.taigaConfig;\n }\n\n ConfigurationService.prototype.get = function(key, defaultValue) {\n if (defaultValue == null) {\n defaultValue = null;\n }\n if (_.has(this.config, key)) {\n return this.config[key];\n }\n return defaultValue;\n };\n\n return ConfigurationService;\n\n })();\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgConfig\", ConfigurationService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/contrib.coffee\n */\n\n(function() {\n var ContribController, module, taigaContribPlugins,\n __extends = 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 taigaContribPlugins = this.taigaContribPlugins = this.taigaContribPlugins || [];\n\n ContribController = (function(_super) {\n __extends(ContribController, _super);\n\n ContribController.$inject = [\"$rootScope\", \"$scope\", \"$routeParams\", \"$tgRepo\", \"$tgResources\", \"$tgConfirm\", \"$appTitle\"];\n\n function ContribController(_at_rootScope, _at_scope, _at_params, _at_repo, _at_rs, _at_confirm, _at_appTitle) {\n var promise;\n this.rootScope = _at_rootScope;\n this.scope = _at_scope;\n this.params = _at_params;\n this.repo = _at_repo;\n this.rs = _at_rs;\n this.confirm = _at_confirm;\n this.appTitle = _at_appTitle;\n this.scope.currentPlugin = _.first(_.where(taigaContribPlugins, {\n \"slug\": this.params.plugin\n }));\n this.scope.pluginTemplate = \"contrib/\" + this.scope.currentPlugin.slug;\n this.scope.projectSlug = this.params.pslug;\n this.scope.adminPlugins = _.where(this.rootScope.contribPlugins, {\n \"type\": \"admin\"\n });\n promise = this.loadInitialData();\n promise.then((function(_this) {\n return function() {\n return _this.appTitle.set(_this.scope.project.name);\n };\n })(this));\n promise.then(null, (function(_this) {\n return function() {\n return _this.confirm.notify(\"error\");\n };\n })(this));\n }\n\n ContribController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n _this.scope.$broadcast('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n ContribController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this));\n };\n\n return ContribController;\n\n })(taiga.Controller);\n\n module = angular.module(\"taigaBase\");\n\n module.controller(\"ContribController\", ContribController);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/filters.coffee\n */\n\n(function() {\n var FiltersStorageService, taiga,\n __extends = 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 FiltersStorageService = (function(_super) {\n __extends(FiltersStorageService, _super);\n\n FiltersStorageService.$inject = [\"$tgStorage\", \"$routeParams\"];\n\n function FiltersStorageService(_at_storage, _at_params) {\n this.storage = _at_storage;\n this.params = _at_params;\n }\n\n FiltersStorageService.prototype.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 return FiltersStorageService;\n\n })(taiga.Service);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/http.coffee\n */\n\n(function() {\n var HttpService, module, taiga,\n __extends = 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 HttpService = (function(_super) {\n __extends(HttpService, _super);\n\n HttpService.$inject = [\"$http\", \"$q\", \"$tgStorage\"];\n\n HttpService.prototype.headers = function() {\n var token;\n token = this.storage.get('token');\n if (token) {\n return {\n \"Authorization\": \"Bearer \" + token\n };\n }\n return {};\n };\n\n function HttpService(_at_http, _at_q, _at_storage) {\n this.http = _at_http;\n this.q = _at_q;\n this.storage = _at_storage;\n HttpService.__super__.constructor.call(this);\n }\n\n HttpService.prototype.request = function(options) {\n options.headers = _.merge({}, options.headers || {}, this.headers());\n if (_.isPlainObject(options.data)) {\n options.data = JSON.stringify(options.data);\n }\n return this.http(options);\n };\n\n HttpService.prototype.get = function(url, params, options) {\n options = _.merge({\n method: \"GET\",\n url: url\n }, options);\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype.post = function(url, data, params, options) {\n options = _.merge({\n method: \"POST\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype.put = function(url, data, params, options) {\n options = _.merge({\n method: \"PUT\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype.patch = function(url, data, params, options) {\n options = _.merge({\n method: \"PATCH\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n HttpService.prototype[\"delete\"] = function(url, data, params, options) {\n options = _.merge({\n method: \"DELETE\",\n url: url\n }, options);\n if (data) {\n options.data = data;\n }\n if (params) {\n options.params = params;\n }\n return this.request(options);\n };\n\n return HttpService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgHttp\", HttpService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/i18n.coffee\n */\n\n(function() {\n var I18nDirective, I18nService, bindOnce, defaults, module, taiga,\n __extends = 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 bindOnce = this.taiga.bindOnce;\n\n defaults = {\n ns: \"app\",\n fallbackLng: \"en\",\n async: false,\n lng: \"en\"\n };\n\n I18nService = (function(_super) {\n __extends(I18nService, _super);\n\n function I18nService(_at_rootscope, localesEn) {\n this.rootscope = _at_rootscope;\n this.options = _.clone(defaults, true);\n this.options.resStore = {\n en: {\n app: localesEn\n }\n };\n }\n\n I18nService.prototype.setLanguage = function(language) {\n i18n.setLng(language);\n this.rootscope.currentLang = language;\n return this.rootscope.$broadcast(\"i18n:changeLang\", language);\n };\n\n I18nService.prototype.initialize = function() {\n i18n.init(this.options);\n return this.rootscope.t = i18n.t;\n };\n\n I18nService.prototype.t = function(path, opts) {\n return i18n.t(path, opts);\n };\n\n return I18nService;\n\n })(taiga.Service);\n\n I18nDirective = function($rootscope, $i18n) {\n var link;\n link = function($scope, $el, $attrs) {\n var ns, options, opts, v, values, _i, _len, _ref, _results;\n values = $attrs.tr.split(\",\");\n options = $attrs.trOpts || '{}';\n opts = $scope.$eval(options);\n _results = [];\n for (_i = 0, _len = values.length; _i < _len; _i++) {\n v = values[_i];\n if (v.indexOf(\":\") === -1) {\n _results.push($el.html(_.escape($i18n.t(v, opts))));\n } else {\n _ref = v.split(\":\"), ns = _ref[0], v = _ref[1];\n _results.push($el.attr(ns, _.escape($i18n.t(v, opts))));\n }\n }\n return _results;\n };\n return {\n link: link,\n restrict: \"A\",\n scope: false\n };\n };\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgI18n\", [\"$rootScope\", \"localesEn\", I18nService]);\n\n module.directive(\"tr\", [\"$rootScope\", \"$tgI18n\", I18nDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/location.coffee\n */\n\n(function() {\n var locationFactory, module;\n\n locationFactory = function($location, $route, $rootscope) {\n $location.noreload = function(scope) {\n var lastRoute, un;\n lastRoute = $route.current;\n un = scope.$on(\"$locationChangeSuccess\", function() {\n $route.current = lastRoute;\n return un();\n });\n return $location;\n };\n return $location;\n };\n\n module = angular.module(\"taigaBase\");\n\n module.factory(\"$tgLocation\", [\"$location\", \"$route\", \"$rootScope\", locationFactory]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/model.coffee\n */\n\n(function() {\n var Model, ModelService, module, provider, taiga,\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 __extends = 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 Model = (function() {\n function Model(name, data, dataTypes) {\n this._attrs = data;\n this._name = name;\n this._dataTypes = dataTypes;\n this.setAttrs(data);\n this.initialize();\n }\n\n Model.prototype.clone = function() {\n var instance;\n instance = new Model(this._name, this._attrs, this._dataTypes);\n instance._modifiedAttrs = this._modifiedAttrs;\n instance._isModified = this._isModified;\n return instance;\n };\n\n Model.prototype.applyCasts = function() {\n var attrName, castMethod, castName, _ref, _results;\n _ref = this._dataTypes;\n _results = [];\n for (attrName in _ref) {\n castName = _ref[attrName];\n castMethod = service.casts[castName];\n if (!castMethod) {\n continue;\n }\n _results.push(this._attrs[attrName] = castMethod(this._attrs[attrName]));\n }\n return _results;\n };\n\n Model.prototype.getIdAttrName = function() {\n return \"id\";\n };\n\n Model.prototype.getName = function() {\n return this._name;\n };\n\n Model.prototype.getAttrs = function(patch) {\n if (patch == null) {\n patch = false;\n }\n if (this._attrs.version != null) {\n this._modifiedAttrs.version = this._attrs.version;\n }\n if (patch) {\n return _.extend({}, this._modifiedAttrs);\n }\n return _.extend({}, this._attrs, this._modifiedAttrs);\n };\n\n Model.prototype.setAttrs = function(attrs) {\n this._attrs = attrs;\n this._modifiedAttrs = {};\n this.applyCasts();\n return this._isModified = false;\n };\n\n Model.prototype.setAttr = function(name, value) {\n this._modifiedAttrs[name] = value;\n return this._isModified = true;\n };\n\n Model.prototype.initialize = function() {\n var getter, self, setter;\n self = this;\n getter = function(name) {\n return function() {\n if (typeof name === 'string' && name.substr(0, 2) === \"__\") {\n return self[name];\n }\n if (__indexOf.call(_.keys(self._modifiedAttrs), name) < 0) {\n return self._attrs[name];\n }\n return self._modifiedAttrs[name];\n };\n };\n setter = function(name) {\n return function(value) {\n if (typeof name === 'string' && name.substr(0, 2) === \"__\") {\n self[name] = value;\n return;\n }\n if (self._attrs[name] !== value) {\n self._modifiedAttrs[name] = value;\n self._isModified = true;\n } else {\n delete self._modifiedAttrs[name];\n }\n };\n };\n return _.each(this._attrs, function(value, name) {\n var options;\n options = {\n get: getter(name),\n set: setter(name),\n enumerable: true,\n configurable: true\n };\n return Object.defineProperty(self, name, options);\n });\n };\n\n Model.prototype.serialize = function() {\n var data;\n data = {\n \"data\": _.clone(this._attrs),\n \"name\": this._name\n };\n return JSON.stringify(data);\n };\n\n Model.prototype.isModified = function() {\n return this._isModified;\n };\n\n Model.prototype.isAttributeModified = function(attribute) {\n return this._modifiedAttrs[attribute] != null;\n };\n\n Model.prototype.markSaved = function() {\n this._isModified = false;\n this._attrs = this.getAttrs();\n return this._modifiedAttrs = {};\n };\n\n Model.prototype.revert = function() {\n this._modifiedAttrs = {};\n return this._isModified = false;\n };\n\n Model.desSerialize = function(sdata) {\n var ddata, model;\n ddata = JSON.parse(sdata);\n model = new Model(ddata.url, ddata.data);\n return model;\n };\n\n return Model;\n\n })();\n\n taiga = this.taiga;\n\n ModelService = (function(_super) {\n __extends(ModelService, _super);\n\n ModelService.$inject = [\"$q\", \"$tgUrls\", \"$tgStorage\", \"$tgHttp\"];\n\n function ModelService(_at_q, _at_urls, _at_storage, _at_http) {\n this.q = _at_q;\n this.urls = _at_urls;\n this.storage = _at_storage;\n this.http = _at_http;\n ModelService.__super__.constructor.call(this);\n }\n\n return ModelService;\n\n })(taiga.Service);\n\n provider = function($q, $http, $gmUrls, $gmStorage) {\n var service;\n service = {};\n service.make_model = function(name, data, cls, dataTypes) {\n if (cls == null) {\n cls = Model;\n }\n if (dataTypes == null) {\n dataTypes = {};\n }\n return new cls(name, data, dataTypes);\n };\n service.cls = Model;\n service.casts = {\n int: function(value) {\n return parseInt(value, 10);\n },\n float: function(value) {\n return parseFloat(value, 10);\n }\n };\n return service;\n };\n\n module = angular.module(\"taigaBase\");\n\n module.factory(\"$tgModel\", [\"$q\", \"$http\", \"$tgUrls\", \"$tgStorage\", provider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/navurl.coffee\n */\n\n(function() {\n var NavigationUrlsDirective, NavigationUrlsService, bindOnce, module, taiga, trim,\n __extends = 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 trim = this.taiga.trim;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaBase\");\n\n NavigationUrlsService = (function(_super) {\n __extends(NavigationUrlsService, _super);\n\n function NavigationUrlsService() {\n this.urls = {};\n }\n\n NavigationUrlsService.prototype.update = function(urls) {\n return this.urls = _.merge({}, this.urls, urls || {});\n };\n\n NavigationUrlsService.prototype.formatUrl = function(url, ctx) {\n var replacer;\n if (ctx == null) {\n ctx = {};\n }\n replacer = function(match) {\n match = trim(match, \":\");\n return ctx[match] || \"undefined\";\n };\n return url.replace(/(:\\w+)/g, replacer);\n };\n\n NavigationUrlsService.prototype.resolve = function(name, ctx) {\n var url;\n url = this.urls[name];\n if (!url) {\n return \"\";\n }\n if (ctx) {\n return this.formatUrl(url, ctx);\n }\n return url;\n };\n\n return NavigationUrlsService;\n\n })(taiga.Service);\n\n module.service(\"$tgNavUrls\", NavigationUrlsService);\n\n NavigationUrlsDirective = function($navurls, $auth, $q, $location) {\n var bindOnceP, link, parseNav;\n bindOnceP = function($scope, attr) {\n var defered;\n defered = $q.defer();\n bindOnce($scope, attr, function(v) {\n return defered.resolve(v);\n });\n return defered.promise;\n };\n parseNav = function(data, $scope) {\n var name, params, promises, values, _ref;\n _ref = _.map(data.split(\":\"), trim), name = _ref[0], params = _ref[1];\n if (params) {\n params = _.map(params.split(\",\"), trim);\n } else {\n params = [];\n }\n values = _.map(params, function(x) {\n return trim(x.split(\"=\")[1]);\n });\n promises = _.map(values, function(x) {\n return bindOnceP($scope, x);\n });\n return $q.all(promises).then(function() {\n var item, key, options, value, _i, _len, _ref1;\n options = {};\n for (_i = 0, _len = params.length; _i < _len; _i++) {\n item = params[_i];\n _ref1 = _.map(item.split(\"=\"), trim), key = _ref1[0], value = _ref1[1];\n options[key] = $scope.$eval(value);\n }\n return [name, options];\n });\n };\n link = function($scope, $el, $attrs) {\n if ($el.is(\"a\")) {\n $el.attr(\"href\", \"#\");\n }\n $el.on(\"mouseenter\", function(event) {\n var target;\n target = $(event.currentTarget);\n if (!target.data(\"fullUrl\")) {\n return parseNav($attrs.tgNav, $scope).then(function(result) {\n var fullUrl, name, options, url, user;\n name = result[0], options = result[1];\n user = $auth.getUser();\n if (user) {\n options.user = user.username;\n }\n url = $navurls.resolve(name);\n fullUrl = $navurls.formatUrl(url, options);\n target.data(\"fullUrl\", fullUrl);\n if (target.is(\"a\")) {\n target.attr(\"href\", fullUrl);\n }\n return $el.on(\"click\", function(event) {\n event.preventDefault();\n target = $(event.currentTarget);\n if (target.hasClass('noclick')) {\n return;\n }\n fullUrl = target.data(\"fullUrl\");\n switch (event.which) {\n case 1:\n $location.url(fullUrl);\n return $scope.$apply();\n case 2:\n return window.open(fullUrl);\n }\n });\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(\"tgNav\", [\"$tgNavUrls\", \"$tgAuth\", \"$q\", \"$tgLocation\", NavigationUrlsDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/repository.coffee\n */\n\n(function() {\n var RepositoryService, module, taiga,\n __extends = 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 RepositoryService = (function(_super) {\n __extends(RepositoryService, _super);\n\n RepositoryService.$inject = [\"$q\", \"$tgModel\", \"$tgStorage\", \"$tgHttp\", \"$tgUrls\"];\n\n function RepositoryService(_at_q, _at_model, _at_storage, _at_http, _at_urls) {\n this.q = _at_q;\n this.model = _at_model;\n this.storage = _at_storage;\n this.http = _at_http;\n this.urls = _at_urls;\n RepositoryService.__super__.constructor.call(this);\n }\n\n RepositoryService.prototype.resolveUrlForModel = function(model) {\n var idAttrName;\n idAttrName = model.getIdAttrName();\n return (this.urls.resolve(model.getName())) + \"/\" + model[idAttrName];\n };\n\n RepositoryService.prototype.resolveUrlForAttributeModel = function(model) {\n return this.urls.resolve(model.getName(), model.parent);\n };\n\n RepositoryService.prototype.create = function(name, data, dataTypes, extraParams) {\n var defered, promise, url;\n if (dataTypes == null) {\n dataTypes = {};\n }\n if (extraParams == null) {\n extraParams = {};\n }\n defered = this.q.defer();\n url = this.urls.resolve(name);\n promise = this.http.post(url, JSON.stringify(data));\n promise.success((function(_this) {\n return function(_data, _status) {\n return defered.resolve(_this.model.make_model(name, _data, null, dataTypes));\n };\n })(this));\n promise.error((function(_this) {\n return function(data, status) {\n return defered.reject(data);\n };\n })(this));\n return defered.promise;\n };\n\n RepositoryService.prototype.remove = function(model, params) {\n var defered, promise, url;\n if (params == null) {\n params = {};\n }\n defered = this.q.defer();\n url = this.resolveUrlForModel(model);\n promise = this.http[\"delete\"](url, {}, params);\n promise.success(function(data, status) {\n return defered.resolve(model);\n });\n promise.error(function(data, status) {\n return defered.reject(model);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.saveAll = function(models, patch) {\n var promises;\n if (patch == null) {\n patch = true;\n }\n promises = _.map(models, (function(_this) {\n return function(x) {\n return _this.save(x, true);\n };\n })(this));\n return this.q.all(promises);\n };\n\n RepositoryService.prototype.save = function(model, patch) {\n var data, defered, promise, url;\n if (patch == null) {\n patch = true;\n }\n defered = this.q.defer();\n if (!model.isModified() && patch) {\n defered.resolve(model);\n return defered.promise;\n }\n url = this.resolveUrlForModel(model);\n data = JSON.stringify(model.getAttrs(patch));\n if (patch) {\n promise = this.http.patch(url, data);\n } else {\n promise = this.http.put(url, data);\n }\n promise.success((function(_this) {\n return function(data, status) {\n model._isModified = false;\n model._attrs = _.extend(model.getAttrs(), data);\n model._modifiedAttrs = {};\n model.applyCasts();\n return defered.resolve(model);\n };\n })(this));\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.saveAttribute = function(model, attribute, patch) {\n var data, defered, promise, url;\n if (patch == null) {\n patch = true;\n }\n defered = this.q.defer();\n if (!model.isModified() && patch) {\n defered.resolve(model);\n return defered.promise;\n }\n url = this.resolveUrlForAttributeModel(model);\n data = {};\n data[attribute] = model.getAttrs();\n if (patch) {\n promise = this.http.patch(url, data);\n } else {\n promise = this.http.put(url, data);\n }\n promise.success((function(_this) {\n return function(data, status) {\n model._isModified = false;\n model._attrs = _.extend(model.getAttrs(), data);\n model._modifiedAttrs = {};\n model.applyCasts();\n return defered.resolve(model);\n };\n })(this));\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.refresh = function(model) {\n var defered, promise, url;\n defered = this.q.defer();\n url = this.resolveUrlForModel(model);\n promise = this.http.get(url);\n promise.success(function(data, status) {\n model._modifiedAttrs = {};\n model._attrs = data;\n model._isModified = false;\n model.applyCasts();\n return defered.resolve(model);\n });\n promise.error(function(data, status) {\n return defered.reject(data);\n });\n return defered.promise;\n };\n\n RepositoryService.prototype.queryMany = function(name, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n return _.map(data.data, function(x) {\n return _this.model.make_model(name, x);\n });\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOneAttribute = function(name, id, attribute, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name, id);\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var model;\n model = _this.model.make_model(name, data.data[attribute]);\n model.parent = id;\n return model;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOne = function(name, id, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n if (id) {\n url = url + \"/\" + id;\n }\n httpOptions = {\n headers: {}\n };\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n return _this.model.make_model(name, data.data);\n };\n })(this));\n };\n\n RepositoryService.prototype.queryOneRaw = function(name, id, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n if (id) {\n url = url + \"/\" + id;\n }\n httpOptions = _.merge({\n headers: {}\n }, options);\n if (!options.enablePagination) {\n httpOptions.headers[\"x-disable-pagination\"] = \"1\";\n }\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n\n RepositoryService.prototype.queryPaginated = function(name, params, options) {\n var httpOptions, url;\n if (options == null) {\n options = {};\n }\n url = this.urls.resolve(name);\n httpOptions = _.merge({\n headers: {}\n }, options);\n return this.http.get(url, params, httpOptions).then((function(_this) {\n return function(data) {\n var headers, result;\n headers = data.headers();\n result = {};\n result.models = _.map(data.data, function(x) {\n return _this.model.make_model(name, x);\n });\n result.count = parseInt(headers[\"x-pagination-count\"], 10);\n result.current = parseInt(headers[\"x-pagination-current\"] || 1, 10);\n result.paginatedBy = parseInt(headers[\"x-paginated-by\"], 10);\n return result;\n };\n })(this));\n };\n\n RepositoryService.prototype.resolve = function(options) {\n var cache, params;\n params = {};\n if (options.pslug != null) {\n params.project = options.pslug;\n }\n if (options.usref != null) {\n params.us = options.usref;\n }\n if (options.taskref != null) {\n params.task = options.taskref;\n }\n if (options.issueref != null) {\n params.issue = options.issueref;\n }\n if (options.sslug != null) {\n params.milestone = options.sslug;\n }\n if (options.wikipage != null) {\n params.wikipage = options.wikipage;\n }\n cache = !(options.wikipage || options.sslug);\n return this.queryOneRaw(\"resolver\", null, params, {\n cache: cache\n });\n };\n\n return RepositoryService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgRepo\", RepositoryService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/storage.coffee\n */\n\n(function() {\n var StorageService, module, taiga,\n __extends = 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 StorageService = (function(_super) {\n __extends(StorageService, _super);\n\n StorageService.$inject = [\"$rootScope\"];\n\n function StorageService($rootScope) {\n StorageService.__super__.constructor.call(this);\n }\n\n StorageService.prototype.get = function(key, _default) {\n var serializedValue;\n serializedValue = localStorage.getItem(key);\n if (serializedValue === null) {\n return _default || null;\n }\n return JSON.parse(serializedValue);\n };\n\n StorageService.prototype.set = function(key, val) {\n if (_.isObject(key)) {\n return _.each(key, (function(_this) {\n return function(val, key) {\n return _this.set(key, val);\n };\n })(this));\n } else {\n return localStorage.setItem(key, JSON.stringify(val));\n }\n };\n\n StorageService.prototype.contains = function(key) {\n var value;\n value = this.get(key);\n return value !== null;\n };\n\n StorageService.prototype.remove = function(key) {\n return localStorage.removeItem(key);\n };\n\n StorageService.prototype.clear = function() {\n return localStorage.clear();\n };\n\n return StorageService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service(\"$tgStorage\", StorageService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/http.coffee\n */\n\n(function() {\n var UrlsService, format, module, taiga,\n __extends = 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 format = function(fmt, obj) {\n obj = _.clone(obj);\n return fmt.replace(/%s/g, function(match) {\n return String(obj.shift());\n });\n };\n\n taiga = this.taiga;\n\n UrlsService = (function(_super) {\n __extends(UrlsService, _super);\n\n UrlsService.$inject = [\"$tgConfig\"];\n\n function UrlsService(_at_config) {\n this.config = _at_config;\n this.urls = {};\n this.mainUrl = this.config.get(\"api\");\n }\n\n UrlsService.prototype.update = function(urls) {\n return this.urls = _.merge(this.urls, urls);\n };\n\n UrlsService.prototype.resolve = function() {\n var args, name, url;\n args = _.toArray(arguments);\n if (args.length === 0) {\n throw Error(\"wrong arguments to setUrls\");\n }\n name = args.slice(0, 1)[0];\n url = format(this.urls[name], args.slice(1));\n return format(\"%s/%s\", [_.str.rtrim(this.mainUrl, \"/\"), _.str.ltrim(url, \"/\")]);\n };\n\n return UrlsService;\n\n })(taiga.Service);\n\n module = angular.module(\"taigaBase\");\n\n module.service('$tgUrls', UrlsService);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/attachments.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($rootScope, $config, $urls, $model, $repo, $auth, $q) {\n var service;\n service = {};\n service.list = function(urlName, objectId, projectId) {\n var params;\n params = {\n object_id: objectId,\n project: projectId\n };\n return $repo.queryMany(urlName, params);\n };\n service.create = function(urlName, projectId, objectId, file) {\n var data, defered, maxFileSize, response, uploadComplete, uploadFailed, uploadProgress, xhr;\n defered = $q.defer();\n if (file === void 0) {\n defered.reject(null);\n return defered.promise;\n }\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered.reject(response);\n return defered.promise;\n }\n uploadProgress = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n file.status = \"in-progress\";\n file.size = sizeFormat(evt.total);\n file.progressMessage = \"upload \" + (sizeFormat(evt.loaded)) + \" of \" + (sizeFormat(evt.total));\n return file.progressPercent = (Math.round((evt.loaded / evt.total) * 100)) + \"%\";\n });\n };\n })(this);\n uploadComplete = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n var data, model;\n file.status = \"done\";\n try {\n data = JSON.parse(evt.target.responseText);\n } catch (_error) {\n data = {};\n }\n model = $model.make_model(urlName, data);\n return defered.resolve(model);\n });\n };\n })(this);\n uploadFailed = (function(_this) {\n return function(evt) {\n return $rootScope.$apply(function() {\n file.status = \"error\";\n return defered.reject(\"fail\");\n });\n };\n })(this);\n data = new FormData();\n data.append(\"project\", projectId);\n data.append(\"object_id\", objectId);\n data.append(\"attached_file\", file);\n xhr = new XMLHttpRequest();\n xhr.upload.addEventListener(\"progress\", uploadProgress, false);\n xhr.addEventListener(\"load\", uploadComplete, false);\n xhr.addEventListener(\"error\", uploadFailed, false);\n xhr.open(\"POST\", $urls.resolve(urlName));\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + ($auth.getToken()));\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send(data);\n return defered.promise;\n };\n return function(instance) {\n return instance.attachments = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgAttachmentsResourcesProvider\", [\"$rootScope\", \"$tgConfig\", \"$tgUrls\", \"$tgModel\", \"$tgRepo\", \"$tgAuth\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/history.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(type, objectId) {\n return $repo.queryOneRaw(\"history/\" + type, objectId);\n };\n service.deleteComment = function(type, objectId, activityId) {\n var params, url;\n url = $urls.resolve(\"history/\" + type);\n url = url + \"/\" + objectId + \"/delete_comment\";\n params = {\n id: activityId\n };\n return $http.post(url, null, params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n service.undeleteComment = function(type, objectId, activityId) {\n var params, url;\n url = $urls.resolve(\"history/\" + type);\n url = url + \"/\" + objectId + \"/undelete_comment\";\n params = {\n id: activityId\n };\n return $http.post(url, null, params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n return function(instance) {\n return instance.history = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgHistoryResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/projects.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo) {\n var service;\n service = {};\n service.get = function(token) {\n return $repo.queryOne(\"invitations\", token);\n };\n return function(instance) {\n return instance.invitations = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgInvitationsResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/issues.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage, $q) {\n var filtersHashSuffix, hashSuffix, myFiltersHashSuffix, service;\n service = {};\n hashSuffix = \"issues-queryparams\";\n filtersHashSuffix = \"issues-filters\";\n myFiltersHashSuffix = \"issues-my-filters\";\n service.get = function(projectId, issueId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"issues\", issueId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"issues\", \"by_ref\", params);\n };\n service.list = function(projectId, filters, options) {\n var params;\n params = {\n project: projectId\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryPaginated(\"issues\", params, options);\n };\n service.bulkCreate = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-create-issues\");\n params = {\n project_id: projectId,\n bulk_issues: data\n };\n return $http.post(url, params);\n };\n service.stats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/issues_stats\");\n };\n service.filtersData = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/issue_filters_data\");\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeFilters = function(projectSlug, params) {\n var hash, ns;\n ns = projectSlug + \":\" + filtersHashSuffix;\n hash = generateHash([projectSlug, ns]);\n return $storage.set(hash, params);\n };\n service.getFilters = function(projectSlug) {\n var hash, ns;\n ns = projectSlug + \":\" + filtersHashSuffix;\n hash = generateHash([projectSlug, ns]);\n return $storage.get(hash) || {};\n };\n service.storeMyFilters = function(projectId, myFilters) {\n var deferred, hash, ns, promise, url;\n deferred = $q.defer();\n url = $urls.resolve(\"user-storage\");\n ns = projectId + \":\" + myFiltersHashSuffix;\n hash = generateHash([projectId, ns]);\n if (_.isEmpty(myFilters)) {\n promise = $http[\"delete\"](url + \"/\" + hash, {\n key: hash,\n value: myFilters\n });\n promise.then(function() {\n return deferred.resolve();\n });\n promise.then(null, function() {\n return deferred.reject();\n });\n } else {\n promise = $http.put(url + \"/\" + hash, {\n key: hash,\n value: myFilters\n });\n promise.then(function(data) {\n return deferred.resolve();\n });\n promise.then(null, function(data) {\n var innerPromise;\n innerPromise = $http.post(\"\" + url, {\n key: hash,\n value: myFilters\n });\n innerPromise.then(function() {\n return deferred.resolve();\n });\n return innerPromise.then(null, function() {\n return deferred.reject();\n });\n });\n }\n return deferred.promise;\n };\n service.getMyFilters = function(projectId) {\n var deferred, hash, ns, promise, url;\n deferred = $q.defer();\n url = $urls.resolve(\"user-storage\");\n ns = projectId + \":\" + myFiltersHashSuffix;\n hash = generateHash([projectId, ns]);\n promise = $http.get(url + \"/\" + hash);\n promise.then(function(data) {\n return deferred.resolve(data.data.value);\n });\n promise.then(null, function(data) {\n return deferred.resolve({});\n });\n return deferred.promise;\n };\n return function(instance) {\n return instance.issues = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgIssuesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/kanban.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($storage) {\n var hashSuffixStatusColumnModes, hashSuffixStatusViewModes, service;\n service = {};\n hashSuffixStatusViewModes = \"kanban-statusviewmodels\";\n hashSuffixStatusColumnModes = \"kanban-statuscolumnmodels\";\n service.storeStatusViewModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusViewModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusViewModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusViewModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeStatusColumnModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusColumnModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n return function(instance) {\n return instance.kanban = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgKanbanResourcesProvider\", [\"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/mdrender.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.render = function(projectId, content) {\n var params, url;\n if ((content == null) || content === \"\") {\n content = ' ';\n }\n params = {\n project_id: projectId,\n content: content\n };\n url = $urls.resolve(\"wiki\");\n return $http.post(url + \"/render\", params).then((function(_this) {\n return function(data) {\n return data.data;\n };\n })(this));\n };\n return function(instance) {\n return instance.mdrender = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgMdRenderResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"memberships\", id);\n };\n service.list = function(projectId, filters, enablePagination) {\n var options, params;\n if (enablePagination == null) {\n enablePagination = true;\n }\n params = {\n project: projectId\n };\n params = _.extend({}, params, filters || {});\n if (enablePagination) {\n return $repo.queryPaginated(\"memberships\", params);\n }\n return $repo.queryMany(\"memberships\", params, options = {\n enablePagination: enablePagination\n });\n };\n service.listByUser = function(userId, filters) {\n var params;\n params = {\n user: userId\n };\n params = _.extend({}, params, filters || {});\n return $repo.queryPaginated(\"memberships\", params);\n };\n service.resendInvitation = function(id) {\n var url;\n url = $urls.resolve(\"memberships\");\n return $http.post(url + \"/\" + id + \"/resend_invitation\", {});\n };\n service.bulkCreateMemberships = function(projectId, data, invitation_extra_text) {\n var params, url;\n url = $urls.resolve(\"bulk-create-memberships\");\n params = {\n project_id: projectId,\n bulk_memberships: data,\n invitation_extra_text: invitation_extra_text\n };\n return $http.post(url, params);\n };\n return function(instance) {\n return instance.memberships = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgMembershipsResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo) {\n var service;\n service = {};\n service.list = function(projectId, module) {\n return $repo.queryOneAttribute(\"project-modules\", projectId, module);\n };\n return function(instance) {\n return instance.modules = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgModulesResourcesProvider\", [\"$tgRepo\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"notify-policies\", id);\n };\n service.list = function(filters) {\n var params;\n params = _.extend({}, params, filters || {});\n return $repo.queryMany(\"notify-policies\", params);\n };\n return function(instance) {\n return instance.notifyPolicies = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgNotifyPoliciesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/projects.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($config, $repo, $http, $urls, $auth, $q, $rootScope) {\n var service;\n service = {};\n service.get = function(projectId) {\n return $repo.queryOne(\"projects\", projectId);\n };\n service.getBySlug = function(projectSlug) {\n return $repo.queryOne(\"projects\", \"by_slug?slug=\" + projectSlug);\n };\n service.list = function() {\n return $repo.queryMany(\"projects\");\n };\n service.templates = function() {\n return $repo.queryMany(\"project-templates\");\n };\n service.usersList = function(projectId) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(\"users\", params);\n };\n service.rolesList = function(projectId) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(\"roles\", params);\n };\n service.stats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/stats\");\n };\n service.leave = function(projectId) {\n var url;\n url = ($urls.resolve(\"projects\")) + \"/\" + projectId + \"/leave\";\n return $http.post(url);\n };\n service.memberStats = function(projectId) {\n return $repo.queryOneRaw(\"projects\", projectId + \"/member_stats\");\n };\n service.tagsColors = function(projectId) {\n return $repo.queryOne(\"projects\", projectId + \"/tags_colors\");\n };\n service[\"export\"] = function(projectId) {\n var url;\n url = ($urls.resolve(\"exporter\")) + \"/\" + projectId;\n return $http.get(url);\n };\n service[\"import\"] = function(file, statusUpdater) {\n var complete, data, defered, failed, maxFileSize, response, uploadComplete, uploadFailed, uploadProgress, xhr;\n defered = $q.defer();\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered.reject(response);\n return defered.promise;\n }\n uploadProgress = (function(_this) {\n return function(evt) {\n var message, percent;\n percent = Math.round((evt.loaded / evt.total) * 100);\n message = \"Uloaded \" + (sizeFormat(evt.loaded)) + \" of \" + (sizeFormat(evt.total));\n return statusUpdater(\"in-progress\", null, message, percent);\n };\n })(this);\n uploadComplete = (function(_this) {\n return function(evt) {\n return statusUpdater(\"done\", \"Importing Project\", \"This process can take a while, please keep the window open.\");\n };\n })(this);\n uploadFailed = (function(_this) {\n return function(evt) {\n return statusUpdater(\"error\");\n };\n })(this);\n complete = (function(_this) {\n return function(evt) {\n var _ref;\n response = {};\n try {\n response.data = JSON.parse(evt.target.responseText);\n } catch (_error) {\n response.data = {};\n }\n response.status = evt.target.status;\n if ((_ref = response.status) === 201 || _ref === 202) {\n defered.resolve(response);\n }\n return defered.reject(response);\n };\n })(this);\n failed = (function(_this) {\n return function(evt) {\n return defered.reject(\"fail\");\n };\n })(this);\n data = new FormData();\n data.append('dump', file);\n xhr = new XMLHttpRequest();\n xhr.upload.addEventListener(\"progress\", uploadProgress, false);\n xhr.upload.addEventListener(\"load\", uploadComplete, false);\n xhr.upload.addEventListener(\"error\", uploadFailed, false);\n xhr.upload.addEventListener(\"abort\", uploadFailed, false);\n xhr.addEventListener(\"load\", complete, false);\n xhr.addEventListener(\"error\", failed, false);\n xhr.open(\"POST\", $urls.resolve(\"importer\"));\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + ($auth.getToken()));\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send(data);\n return defered.promise;\n };\n return function(instance) {\n return instance.projects = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgProjectsResourcesProvider\", [\"$tgConfig\", \"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgAuth\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(id) {\n return $repo.queryOne(\"roles\", id);\n };\n service.list = function(projectId) {\n return $repo.queryMany(\"roles\", {\n project: projectId\n });\n };\n return function(instance) {\n return instance.roles = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgRolesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/search.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service[\"do\"] = function(projectId, term) {\n var params, url;\n url = $urls.resolve(\"search\");\n params = {\n project: projectId,\n text: term,\n get_all: false\n };\n return $http.get(url, params).then(function(data) {\n return data.data;\n });\n };\n return function(instance) {\n return instance.search = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgSearchResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/sprints.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $model, $storage) {\n var hashSuffixUserstories, service;\n service = {};\n hashSuffixUserstories = \"userstories-queryparams\";\n service.get = function(projectId, sprintId) {\n return $repo.queryOne(\"milestones\", sprintId).then(function(sprint) {\n var uses;\n service.storeUserstoriesQueryParams(projectId, {\n \"milestone\": sprintId\n });\n uses = sprint.user_stories;\n uses = _.map(uses, function(u) {\n return $model.make_model(\"userstories\", u);\n });\n sprint._attrs.user_stories = uses;\n return sprint;\n });\n };\n service.stats = function(projectId, sprintId) {\n return $repo.queryOneRaw(\"milestones\", sprintId + \"/stats\");\n };\n service.list = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId\n };\n params = _.extend({}, params, filters || {});\n return $repo.queryMany(\"milestones\", params).then((function(_this) {\n return function(milestones) {\n var m, uses, _i, _len;\n for (_i = 0, _len = milestones.length; _i < _len; _i++) {\n m = milestones[_i];\n uses = m.user_stories;\n uses = _.map(uses, function(u) {\n return $model.make_model(\"userstories\", u);\n });\n m._attrs.user_stories = uses;\n }\n return milestones;\n };\n })(this));\n };\n service.storeUserstoriesQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixUserstories;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n return function(instance) {\n return instance.sprints = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgSprintsResourcesProvider\", [\"$tgRepo\", \"$tgModel\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/tasks.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage) {\n var hashSuffix, hashSuffixStatusColumnModes, hashSuffixUsRowModes, service;\n service = {};\n hashSuffix = \"tasks-queryparams\";\n hashSuffixStatusColumnModes = \"tasks-statuscolumnmodels\";\n hashSuffixUsRowModes = \"tasks-usrowmodels\";\n service.get = function(projectId, taskId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"tasks\", taskId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"tasks\", \"by_ref\", params);\n };\n service.list = function(projectId, sprintId, userStoryId) {\n var params;\n if (sprintId == null) {\n sprintId = null;\n }\n if (userStoryId == null) {\n userStoryId = null;\n }\n params = {\n project: projectId\n };\n if (sprintId) {\n params.milestone = sprintId;\n }\n if (userStoryId) {\n params.user_story = userStoryId;\n }\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"tasks\", params);\n };\n service.bulkCreate = function(projectId, sprintId, usId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-create-tasks\");\n params = {\n project_id: projectId,\n sprint_id: sprintId,\n us_id: usId,\n bulk_tasks: data\n };\n return $http.post(url, params).then(function(result) {\n return result.data;\n });\n };\n service.bulkUpdateTaskTaskboardOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-task-taskboard-order\");\n params = {\n project_id: projectId,\n bulk_tasks: data\n };\n return $http.post(url, params);\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeStatusColumnModes = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getStatusColumnModes = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixStatusColumnModes;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeUsRowModes = function(projectId, sprintId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixUsRowModes;\n hash = generateHash([projectId, sprintId, ns]);\n return $storage.set(hash, params);\n };\n service.getUsRowModes = function(projectId, sprintId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffixUsRowModes;\n hash = generateHash([projectId, sprintId, ns]);\n return $storage.get(hash) || {};\n };\n return function(instance) {\n return instance.tasks = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgTasksResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/memberships.coffee\n */\n\n(function() {\n var module, resourceProvider, sizeFormat, taiga;\n\n taiga = this.taiga;\n\n sizeFormat = this.taiga.sizeFormat;\n\n resourceProvider = function($config, $repo, $http, $urls, $q) {\n var service;\n service = {};\n service.changeAvatar = function(file) {\n var data, defered, maxFileSize, options, response, url;\n maxFileSize = $config.get(\"maxUploadFileSize\", null);\n if (maxFileSize && file.size > maxFileSize) {\n response = {\n status: 413,\n data: {\n _error_message: \"'\" + file.name + \"' (\" + (sizeFormat(file.size)) + \") is too heavy for our oompa loompas, try it with a smaller than (\" + (sizeFormat(maxFileSize)) + \")\"\n }\n };\n defered = $q.defer();\n defered.reject(response);\n return defered.promise;\n }\n data = new FormData();\n data.append('avatar', file);\n options = {\n transformRequest: angular.identity,\n headers: {\n 'Content-Type': void 0\n }\n };\n url = ($urls.resolve(\"users\")) + \"/change_avatar\";\n return $http.post(url, data, {}, options);\n };\n service.removeAvatar = function() {\n var url;\n url = ($urls.resolve(\"users\")) + \"/remove_avatar\";\n return $http.post(url);\n };\n service.changePassword = function(currentPassword, newPassword) {\n var data, url;\n url = ($urls.resolve(\"users\")) + \"/change_password\";\n data = {\n current_password: currentPassword,\n password: newPassword\n };\n return $http.post(url, data);\n };\n return function(instance) {\n return instance.userSettings = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgUserSettingsResourcesProvider\", [\"$tgConfig\", \"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$q\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/userstories.coffee\n */\n\n(function() {\n var generateHash, module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n generateHash = taiga.generateHash;\n\n resourceProvider = function($repo, $http, $urls, $storage) {\n var hashSuffix, service;\n service = {};\n hashSuffix = \"userstories-queryparams\";\n service.get = function(projectId, usId) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n return $repo.queryOne(\"userstories\", usId, params);\n };\n service.getByRef = function(projectId, ref) {\n var params;\n params = service.getQueryParams(projectId);\n params.project = projectId;\n params.ref = ref;\n return $repo.queryOne(\"userstories\", \"by_ref\", params);\n };\n service.listUnassigned = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId,\n \"milestone\": \"null\"\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"userstories\", params);\n };\n service.listAll = function(projectId, filters) {\n var params;\n params = {\n \"project\": projectId\n };\n params = _.extend({}, params, filters || {});\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(\"userstories\", params);\n };\n service.bulkCreate = function(projectId, status, bulk) {\n var data, url;\n data = {\n project_id: projectId,\n status_id: status,\n bulk_stories: bulk\n };\n url = $urls.resolve(\"bulk-create-us\");\n return $http.post(url, data);\n };\n service.bulkUpdateBacklogOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-backlog-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.bulkUpdateSprintOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-sprint-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.bulkUpdateKanbanOrder = function(projectId, data) {\n var params, url;\n url = $urls.resolve(\"bulk-update-us-kanban-order\");\n params = {\n project_id: projectId,\n bulk_stories: data\n };\n return $http.post(url, params);\n };\n service.listValues = function(projectId, type) {\n var params;\n params = {\n \"project\": projectId\n };\n service.storeQueryParams(projectId, params);\n return $repo.queryMany(type, params);\n };\n service.storeQueryParams = function(projectId, params) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.set(hash, params);\n };\n service.getQueryParams = function(projectId) {\n var hash, ns;\n ns = projectId + \":\" + hashSuffix;\n hash = generateHash([projectId, ns]);\n return $storage.get(hash) || {};\n };\n service.storeShowTags = function(projectId, showTags) {\n var hash;\n hash = generateHash([projectId, 'showTags']);\n return $storage.set(hash, showTags);\n };\n service.getShowTags = function(projectId) {\n var hash;\n hash = generateHash([projectId, 'showTags']);\n return $storage.get(hash) || null;\n };\n return function(instance) {\n return instance.userstories = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgUserstoriesResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", \"$tgStorage\", resourceProvider]);\n\n}).call(this);\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.list = function(webhookId) {\n var params;\n params = {\n webhook: webhookId\n };\n return $repo.queryMany(\"webhooklogs\", params);\n };\n service.resend = function(webhooklogId) {\n var url;\n url = $urls.resolve(\"webhooklogs-resend\", webhooklogId);\n return $http.post(url);\n };\n return function(instance) {\n return instance.webhooklogs = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWebhookLogsResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n(function() {\n var module, resourceProvider;\n\n resourceProvider = function($repo, $urls, $http) {\n var service;\n service = {};\n service.list = function(projectId) {\n var params;\n params = {\n project: projectId\n };\n return $repo.queryMany(\"webhooks\", params);\n };\n service.test = function(webhookId) {\n var url;\n url = $urls.resolve(\"webhooks-test\", webhookId);\n return $http.post(url);\n };\n return function(instance) {\n return instance.webhooks = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWebhooksResourcesProvider\", [\"$tgRepo\", \"$tgUrls\", \"$tgHttp\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/wikis.coffee\n */\n\n(function() {\n var module, resourceProvider, taiga;\n\n taiga = this.taiga;\n\n resourceProvider = function($repo, $http, $urls) {\n var service;\n service = {};\n service.get = function(wikiId) {\n return $repo.queryOne(\"wiki\", wikiId);\n };\n service.getBySlug = function(projectId, slug) {\n return $repo.queryOne(\"wiki\", \"by_slug?project=\" + projectId + \"&slug=\" + slug);\n };\n service.listLinks = function(projectId) {\n return $repo.queryMany(\"wiki-links\", {\n project: projectId\n });\n };\n return function(instance) {\n return instance.wiki = service;\n };\n };\n\n module = angular.module(\"taigaResources\");\n\n module.factory(\"$tgWikiResourcesProvider\", [\"$tgRepo\", \"$tgHttp\", \"$tgUrls\", resourceProvider]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var UserChangePasswordController, UserChangePasswordDirective, debounce, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaUserSettings\");\n\n UserChangePasswordController = (function(_super) {\n __extends(UserChangePasswordController, _super);\n\n UserChangePasswordController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\"];\n\n function UserChangePasswordController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_auth) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.auth = _at_auth;\n this.scope.sectionName = \"Change Password\";\n this.scope.project = {};\n this.scope.user = this.auth.getUser();\n promise = this.loadInitialData();\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserChangePasswordController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n UserChangePasswordController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this));\n };\n\n return UserChangePasswordController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserChangePasswordController\", UserChangePasswordController);\n\n UserChangePasswordDirective = function($rs, $confirm, $loading) {\n var link;\n link = function($scope, $el, $attrs, ctrl) {\n var submit, submitButton;\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var promise;\n event.preventDefault();\n if ($scope.newPassword1 !== $scope.newPassword2) {\n $confirm.notify('error', \"The passwords dosn't match\");\n return;\n }\n $loading.start(submitButton);\n promise = $rs.userSettings.changePassword($scope.currentPassword, $scope.newPassword1);\n promise.then(function() {\n $loading.finish(submitButton);\n return $confirm.notify('success');\n });\n return promise.then(null, function(response) {\n $loading.finish(submitButton);\n return $confirm.notify('error', response.data._error_message);\n });\n };\n })(this));\n submitButton = $el.find(\".submit-button\");\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserChangePassword\", [\"$tgResources\", \"$tgConfirm\", \"$tgLoading\", UserChangePasswordDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/lightboxes.coffee\n */\n\n(function() {\n var DeleteUserDirective, bindOnce, debounce, module, taiga;\n\n taiga = this.taiga;\n\n bindOnce = this.taiga.bindOnce;\n\n debounce = this.taiga.debounce;\n\n module = angular.module(\"taigaUserSettings\");\n\n DeleteUserDirective = function($repo, $rootscope, $auth, $location, $navUrls, lightboxService) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit;\n $scope.$on(\"deletelightbox:new\", function(ctx, user) {\n return lightboxService.open($el);\n });\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n submit = function() {\n var promise;\n promise = $repo.remove($scope.user);\n promise.then(function(data) {\n lightboxService.close($el);\n $auth.logout();\n return $location.path($navUrls.resolve(\"login\"));\n });\n return promise.then(null, function() {\n return console.log(\"FAIL\");\n });\n };\n $el.on(\"click\", \".button-red\", function(event) {\n event.preventDefault();\n return lightboxService.close($el);\n });\n return $el.on(\"click\", \".button-green\", debounce(2000, function(event) {\n event.preventDefault();\n return submit();\n }));\n };\n return {\n link: link,\n templateUrl: \"user/lightbox/lightbox-delete-account.html\"\n };\n };\n\n module.directive(\"tgLbDeleteUser\", [\"$tgRepo\", \"$rootScope\", \"$tgAuth\", \"$tgLocation\", \"$tgNavUrls\", \"lightboxService\", DeleteUserDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/main.coffee\n */\n\n(function() {\n var TaigaAvatarModelDirective, UserAvatarDirective, UserProfileDirective, UserSettingsController, debounce, mixOf, module, sizeFormat, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n sizeFormat = this.taiga.sizeFormat;\n\n module = angular.module(\"taigaUserSettings\");\n\n debounce = this.taiga.debounce;\n\n UserSettingsController = (function(_super) {\n __extends(UserSettingsController, _super);\n\n UserSettingsController.$inject = [\"$scope\", \"$rootScope\", \"$tgConfig\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\"];\n\n function UserSettingsController(_at_scope, _at_rootscope, _at_config, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_auth) {\n var maxFileSize, promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.config = _at_config;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.auth = _at_auth;\n this.scope.sectionName = \"User Profile\";\n this.scope.project = {};\n this.scope.user = this.auth.getUser();\n maxFileSize = this.config.get(\"maxUploadFileSize\", null);\n if (maxFileSize) {\n this.scope.maxFileSizeMsg = \"[Max, size: \" + (sizeFormat(maxFileSize));\n }\n promise = this.loadInitialData();\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserSettingsController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n UserSettingsController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this));\n };\n\n UserSettingsController.prototype.openDeleteLightbox = function() {\n return this.rootscope.$broadcast(\"deletelightbox:new\", this.scope.user);\n };\n\n return UserSettingsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserSettingsController\", UserSettingsController);\n\n UserProfileDirective = function($confirm, $auth, $repo) {\n var link;\n link = function($scope, $el, $attrs) {\n var submit;\n submit = debounce(2000, (function(_this) {\n return function(event) {\n var changeEmail, form, onError, onSuccess;\n event.preventDefault();\n form = $el.find(\"form\").checksley();\n if (!form.validate()) {\n return;\n }\n changeEmail = $scope.user.isAttributeModified(\"email\");\n onSuccess = function(data) {\n $auth.setUser($scope.user);\n if (changeEmail) {\n return $confirm.success(\"Check your inbox!
We have sent a mail to your account
with the instructions to set your new address\");\n } else {\n return $confirm.notify('success');\n }\n };\n onError = function(data) {\n form.setErrors(data);\n return $confirm.notify('error', data._error_message);\n };\n return $repo.save($scope.user).then(onSuccess, onError);\n };\n })(this));\n $el.on(\"submit\", \"form\", submit);\n $el.on(\"click\", \".submit-button\", submit);\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserProfile\", [\"$tgConfirm\", \"$tgAuth\", \"$tgRepo\", UserProfileDirective]);\n\n UserAvatarDirective = function($auth, $model, $rs, $confirm) {\n var link;\n link = function($scope, $el, $attrs) {\n var onError, onSuccess, showSizeInfo;\n showSizeInfo = function() {\n return $el.find(\".size-info\").removeClass(\"hidden\");\n };\n onSuccess = function(response) {\n var user;\n user = $model.make_model(\"users\", response.data);\n $auth.setUser(user);\n $scope.user = user;\n $el.find('.overlay').hide();\n return $confirm.notify('success');\n };\n onError = function(response) {\n if (response.status === 413) {\n showSizeInfo();\n }\n $el.find('.overlay').hide();\n return $confirm.notify('error', response.data._error_message);\n };\n $el.on(\"click\", \".button.change\", function() {\n return $el.find(\"#avatar-field\").click();\n });\n $el.on(\"change\", \"#avatar-field\", function(event) {\n if ($scope.avatarAttachment) {\n $el.find('.overlay').css('display', 'flex');\n return $rs.userSettings.changeAvatar($scope.avatarAttachment).then(onSuccess, onError);\n }\n });\n $el.on(\"click\", \"a.use-gravatar\", function(event) {\n $el.find('.overlay').show();\n return $rs.userSettings.removeAvatar().then(onSuccess, onError);\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserAvatar\", [\"$tgAuth\", \"$tgModel\", \"$tgResources\", \"$tgConfirm\", UserAvatarDirective]);\n\n TaigaAvatarModelDirective = function($parse) {\n var link;\n link = function($scope, $el, $attrs) {\n var model, modelSetter;\n model = $parse($attrs.tgAvatarModel);\n modelSetter = model.assign;\n return $el.bind('change', function() {\n return $scope.$apply(function() {\n return modelSetter($scope, $el[0].files[0]);\n });\n });\n };\n return {\n link: link\n };\n };\n\n module.directive('tgAvatarModel', ['$parse', TaigaAvatarModelDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/nav.coffee\n */\n\n(function() {\n var UserSettingsNavigationDirective, module;\n\n UserSettingsNavigationDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n var section;\n section = $attrs.tgUserSettingsNavigation;\n $el.find(\".active\").removeClass(\"active\");\n $el.find(\"#usersettingsmenu-\" + section + \" a\").addClass(\"active\");\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module = angular.module(\"taigaUserSettings\");\n\n module.directive(\"tgUserSettingsNavigation\", UserSettingsNavigationDirective);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/notifications.coffee\n */\n\n(function() {\n var UserNotificationsController, UserNotificationsDirective, UserNotificationsListDirective, bindOnce, mixOf, module, taiga,\n __extends = 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 mixOf = this.taiga.mixOf;\n\n bindOnce = this.taiga.bindOnce;\n\n module = angular.module(\"taigaUserSettings\");\n\n UserNotificationsController = (function(_super) {\n __extends(UserNotificationsController, _super);\n\n UserNotificationsController.$inject = [\"$scope\", \"$rootScope\", \"$tgRepo\", \"$tgConfirm\", \"$tgResources\", \"$routeParams\", \"$q\", \"$tgLocation\", \"$tgNavUrls\", \"$tgAuth\"];\n\n function UserNotificationsController(_at_scope, _at_rootscope, _at_repo, _at_confirm, _at_rs, _at_params, _at_q, _at_location, _at_navUrls, _at_auth) {\n var promise;\n this.scope = _at_scope;\n this.rootscope = _at_rootscope;\n this.repo = _at_repo;\n this.confirm = _at_confirm;\n this.rs = _at_rs;\n this.params = _at_params;\n this.q = _at_q;\n this.location = _at_location;\n this.navUrls = _at_navUrls;\n this.auth = _at_auth;\n this.scope.sectionName = \"Email Notifications\";\n this.scope.project = {};\n this.scope.user = this.auth.getUser();\n promise = this.loadInitialData();\n promise.then(null, this.onInitialDataError.bind(this));\n }\n\n UserNotificationsController.prototype.loadProject = function() {\n return this.rs.projects.get(this.scope.projectId).then((function(_this) {\n return function(project) {\n _this.scope.project = project;\n _this.scope.$emit('project:loaded', project);\n return project;\n };\n })(this));\n };\n\n UserNotificationsController.prototype.loadNotifyPolicies = function() {\n return this.rs.notifyPolicies.list().then((function(_this) {\n return function(notifyPolicies) {\n _this.scope.notifyPolicies = notifyPolicies;\n return notifyPolicies;\n };\n })(this));\n };\n\n UserNotificationsController.prototype.loadInitialData = function() {\n var promise;\n promise = this.repo.resolve({\n pslug: this.params.pslug\n }).then((function(_this) {\n return function(data) {\n _this.scope.projectId = data.project;\n return data;\n };\n })(this));\n return promise.then((function(_this) {\n return function() {\n return _this.loadProject();\n };\n })(this)).then((function(_this) {\n return function() {\n return _this.loadNotifyPolicies();\n };\n })(this));\n };\n\n return UserNotificationsController;\n\n })(mixOf(taiga.Controller, taiga.PageMixin));\n\n module.controller(\"UserNotificationsController\", UserNotificationsController);\n\n UserNotificationsDirective = function() {\n var link;\n link = function($scope, $el, $attrs) {\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserNotifications\", UserNotificationsDirective);\n\n UserNotificationsListDirective = function($repo, $confirm) {\n var link, template;\n template = _.template(\"<% _.each(notifyPolicies, function (notifyPolicy, index) { %>\\n
\\\">\\n
<%- notifyPolicy.project_name %>
\\n
\\n
\\n \\\" id=\\\"policy-all-<%- notifyPolicy.id %>\\\"\\n value=\\\"2\\\" <% if (notifyPolicy.notify_level == 2) { %>checked=\\\"checked\\\"<% } %>/>\\n \\n
\\n
\\n
\\n
\\n \\\" id=\\\"policy-involved-<%- notifyPolicy.id %>\\\"\\n value=\\\"1\\\" <% if (notifyPolicy.notify_level == 1) { %>checked=\\\"checked\\\"<% } %> />\\n \\n
\\n
\\n
\\n
\\n \\\" id=\\\"policy-none-<%- notifyPolicy.id %>\\\"\\n value=\\\"3\\\" <% if (notifyPolicy.notify_level == 3) { %>checked=\\\"checked\\\"<% } %> />\\n \\n
\\n
\\n
\\n<% }) %>\");\n link = function($scope, $el, $attrs) {\n var render;\n render = function() {\n $el.off();\n $el.html(template({\n notifyPolicies: $scope.notifyPolicies\n }));\n return $el.on(\"change\", \"input[type=radio]\", function(event) {\n var onError, onSuccess, policy, policyIndex, prev_level, target;\n target = angular.element(event.currentTarget);\n policyIndex = target.parents(\".policy-table-row\").data('index');\n policy = $scope.notifyPolicies[policyIndex];\n prev_level = policy.notify_level;\n policy.notify_level = parseInt(target.val(), 10);\n onSuccess = function() {\n return $confirm.notify(\"success\");\n };\n onError = function() {\n $confirm.notify(\"error\");\n return target.parents(\".policy-table-row\").find(\"input[value=\" + prev_level + \"]\").prop(\"checked\", true);\n };\n return $repo.save(policy).then(onSuccess, onError);\n });\n };\n $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n return bindOnce($scope, $attrs.ngModel, render);\n };\n return {\n link: link\n };\n };\n\n module.directive(\"tgUserNotificationsList\", [\"$tgRepo\", \"$tgConfirm\", UserNotificationsListDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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/github.coffee\n */\n\n(function() {\n var AUTH_URL, GithubLoginButtonDirective, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaIntegrations\");\n\n AUTH_URL = \"https://github.com/login/oauth/authorize\";\n\n GithubLoginButtonDirective = function($window, $params, $location, $config, $events, $confirm, $auth, $navUrls, $loader) {\n var link, template;\n template = \"
\\n \\n Login with Github\\n\";\n link = function($scope, $el, $attrs) {\n var clientId, loginOnError, loginOnSuccess, loginWithGitHubAccount, renderGitHubButton;\n clientId = $config.get(\"gitHubClientId\", null);\n if (!clientId) {\n return;\n }\n renderGitHubButton = function() {\n if (clientId) {\n return $el.html(template);\n }\n };\n loginOnSuccess = function(response) {\n var nextUrl;\n if ($params.next && $params.next !== $navUrls.resolve(\"login\")) {\n nextUrl = $params.next;\n } else {\n nextUrl = $navUrls.resolve(\"home\");\n }\n $events.setupConnection();\n $location.search(\"next\", null);\n $location.search(\"token\", null);\n $location.search(\"state\", null);\n $location.search(\"code\", null);\n return $location.path(nextUrl);\n };\n loginOnError = function(response) {\n $location.search(\"state\", null);\n $location.search(\"code\", null);\n $loader.pageLoaded();\n if (response.data.error_message) {\n return $confirm.notify(\"light-error\", response.data.error_message);\n } else {\n return $confirm.notify(\"light-error\", \"Our Oompa Loompas have not been able to get you credentials from GitHub.\");\n }\n };\n loginWithGitHubAccount = function() {\n var code, data, token, type;\n type = $params.state;\n code = $params.code;\n token = $params.token;\n if (!(type === \"github\" && code)) {\n return;\n }\n $loader.start();\n data = {\n code: code,\n token: token\n };\n return $auth.login(data, type).then(loginOnSuccess, loginOnError);\n };\n renderGitHubButton();\n loginWithGitHubAccount();\n $el.on(\"click\", \".button-github\", function(event) {\n var redirectToUri, url;\n redirectToUri = $location.absUrl();\n url = AUTH_URL + \"?client_id=\" + clientId + \"&redirect_uri=\" + redirectToUri + \"&state=github&scope=user:email\";\n return $window.location.href = url;\n });\n return $scope.$on(\"$destroy\", function() {\n return $el.off();\n });\n };\n return {\n link: link,\n restrict: \"EA\",\n template: \"\"\n };\n };\n\n module.directive(\"tgGithubLoginButton\", [\"$window\", '$routeParams', \"$tgLocation\", \"$tgConfig\", \"$tgEvents\", \"$tgConfirm\", \"$tgAuth\", \"$tgNavUrls\", \"tgLoader\", GithubLoginButtonDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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: plugins/humanshtml/humanshtml.coffee\n */\n\n(function() {\n var configure, module, taiga;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaPlugins\", [\"ngRoute\"]);\n\n configure = function($routeProvider) {\n return $routeProvider.when(\"/humans.html\", {\n \"templateUrl\": \"/plugins/humanshtml/templates/humans.html\"\n });\n };\n\n module.config([\"$routeProvider\", configure]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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: plugins/terms/terms.coffee\n */\n\n(function() {\n var TermsNoticeDirective, module, taiga, template;\n\n taiga = this.taiga;\n\n module = angular.module(\"taigaPlugins\", [\"ngRoute\"]);\n\n template = _.template(\"

\\n By clicking \\\"Sign up\\\", you agree to our
\\n \\\" title=\\\"See terms of service\\\" target=\\\"_blank\\\"> terms of service\\n and\\n \\\" title=\\\"See privacy policy\\\" target=\\\"_blank\\\"> privacy policy.\\n

\");\n\n TermsNoticeDirective = function($config) {\n var privacyPolicyUrl, templateFn, termsOfServiceUrl;\n privacyPolicyUrl = $config.get(\"privacyPolicyUrl\");\n termsOfServiceUrl = $config.get(\"termsOfServiceUrl\");\n templateFn = function() {\n var ctx;\n if (!(privacyPolicyUrl && termsOfServiceUrl)) {\n return \"\";\n }\n ctx = {\n termsUrl: termsOfServiceUrl,\n privacyUrl: privacyPolicyUrl\n };\n return template(ctx);\n };\n return {\n scope: {},\n restrict: \"AE\",\n template: templateFn\n };\n };\n\n module.directive(\"tgTermsNotice\", [\"$tgConfig\", TermsNoticeDirective]);\n\n}).call(this);\n\n\n/*\n * Copyright (C) 2014 Andrey Antukh \n * Copyright (C) 2014 Jesús Espino Garcia \n * Copyright (C) 2014 David Barragán Merino \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: pluggins/main.coffee\n */\n\n(function() {\n var module;\n\n module = angular.module(\"taigaPlugins\", [\"ngRoute\"]);\n\n}).call(this);\n","angular.module('taigaBase').value('localesEn', {\n \"checksley\": {\n \"defaultMessage\": \"This value seems to be invalid.\",\n \"type-email\": \"This value should be a valid email.\",\n \"type-url\": \"This value should be a valid url.\",\n \"type-urlstrict\": \"This value should be a valid url.\",\n \"type-number\": \"This value should be a valid number.\",\n \"type-digits\": \"This value should be digits.\",\n \"type-dateIso\": \"This value should be a valid date (YYYY-MM-DD).\",\n \"type-alphanum\": \"This value should be alphanumeric.\",\n \"type-phone\": \"This value should be a valid phone number.\",\n \"notnull\": \"This value should not be null.\",\n \"notblank\": \"This value should not be blank.\",\n \"required\": \"This value is required.\",\n \"regexp\": \"This value seems to be invalid.\",\n \"min\": \"This value should be greater than or equal to %s.\",\n \"max\": \"This value should be lower than or equal to %s.\",\n \"range\": \"This value should be between %s and %s.\",\n \"minlength\": \"This value is too short. It should have %s characters or more.\",\n \"maxlength\": \"This value is too long. It should have %s characters or less.\",\n \"rangelength\": \"This value length is invalid. It should be between %s and %s characters long.\",\n \"mincheck\": \"You must select at least %s choices.\",\n \"maxcheck\": \"You must select %s choices or less.\",\n \"rangecheck\": \"You must select between %s and %s choices.\",\n \"equalto\": \"This value should be the same.\"\n },\n \"common\": {\n \"subject\": \"Subject\",\n \"save\": \"Save\",\n \"blocked\": \"Blocked\",\n \"cancel\": \"Cancel\",\n \"status\": \"Status\",\n \"new-bulk\": \"New bulk insert\",\n \"one-item-line\": \"One item per line...\"\n },\n \"pagination\": {\n \"next\": \"Next\",\n \"prev\": \"Previous\"\n },\n \"markdown-editor\": {\n \"heading-1\": \"First Level Heading\",\n \"heading-2\": \"Second Level Heading\",\n \"heading-3\": \"Third Level Heading\",\n \"bold\": \"Bold\",\n \"italic\": \"Italic\",\n \"strike\": \"Strike\",\n \"bulleted-list\": \"Bulleted List\",\n \"numeric-list\": \"Numeric List\",\n \"picture\": \"Picture\",\n \"link\": \"Link\",\n \"quotes\": \"Quotes\",\n \"code-block\": \"Code Block / Code\",\n \"preview\": \"Preview\",\n \"help\": \"Help\",\n \"placeholder\": \"Your title here...\",\n \"link-placeholder\": \"Your text to link here...\"\n },\n \"us\": {\n \"title-new\": \"New User Story\",\n \"team-requirement\": \"Team Requirement\",\n \"client-requirement\": \"Client Requirement\"\n }\n}\n);"],"sourceRoot":"/source/"} \ No newline at end of file