text: lhcAppControllers.controller("TrItemCtrl",["$scope","$http","$location","$rootScope","$log",function(e,n,a,t,s){this.languages=[],this.dialects=[];var i=this;this.move=function(e,n){index=i.languages.indexOf(e),newIndex=index+n,newIndex>-1&&newIndex<i.languages.length&&(removedElement=i.languages.splice(index,1)[0],i.languages.splice(newIndex,0,removedElement))},this.addLanguage=function(){i.languages.push({message:"",languages:[]}),setTimeout((function(){$("#tritems-tabs a:first").tab("show")}),250)},this.toggleSelection=function(e,n){var a=e.languages.indexOf(n);a>-1?e.languages.splice(a,1):e.languages.push(n)},this.deleteLanguage=function(e){i.languages.splice(i.languages.indexOf(e),1),$("#tritems-tabs a:first").tab("show")},this.moveLeftField=function(e){i.move(e,-1)},this.moveRightField=function(e){i.move(e,1)},this.getLanguagesChecked=function(e){var n=[];return e.languages.forEach((function(e){2==e.length&&n.push(e)})),n.length>0?n.join(", "):e.languages.join(", ")},this.isSelectedDialect=function(e,n){void 0===e.dialect&&(e.dialect=[]);var a=!0;n.items.forEach((function(n){(-1===e.languages.indexOf(n.lang_code)||""!=n.short_code&&-1===e.languages.indexOf(n.short_code))&&(a=!1)})),e.dialect[n.lang.id]=a},this.changeSelection=function(e,n){!1===e.dialect[n.lang.id]?n.items.forEach((function(n){""!=n.short_code&&-1===e.languages.indexOf(n.short_code)&&e.languages.push(n.short_code),-1===e.languages.indexOf(n.lang_code)&&e.languages.push(n.lang_code)})):n.items.forEach((function(n){var a=null;""!=n.short_code&&(a=e.languages.indexOf(n.short_code))>-1&&e.languages.splice(a,1),(a=e.languages.indexOf(n.lang_code))>-1&&e.languages.splice(a,1)}))}}]);