diff --git a/public/main.min.js b/public/main.min.js index 1646ba0..86bf899 100644 --- a/public/main.min.js +++ b/public/main.min.js @@ -5,6 +5,6 @@ links:["Africa/Abidjan|Africa/Bamako","Africa/Abidjan|Africa/Banjul","Africa/Abi ;return void 0===key?this._locale._abbr:(newLocaleData=getLocale(key),null!=newLocaleData&&(this._locale=newLocaleData),this)}function localeData(){return this._locale}function startOf(units){switch(units=normalizeUnits(units)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===units&&this.weekday(0),"isoWeek"===units&&this.isoWeekday(1),"quarter"===units&&this.month(3*Math.floor(this.month()/3)),this}function endOf(units){return void 0===(units=normalizeUnits(units))||"millisecond"===units?this:("date"===units&&(units="day"),this.startOf(units).add(1,"isoWeek"===units?"week":units).subtract(1,"ms"))}function valueOf(){return this._d.valueOf()-6e4*(this._offset||0)}function unix(){return Math.floor(this.valueOf()/1e3)}function toDate(){return new Date(this.valueOf())}function toArray(){var m=this;return[m.year(),m.month(),m.date(),m.hour(),m.minute(),m.second(),m.millisecond()]}function toObject(){var m=this;return{years:m.year(),months:m.month(),date:m.date(),hours:m.hours(),minutes:m.minutes(),seconds:m.seconds(),milliseconds:m.milliseconds()}}function toJSON(){return this.isValid()?this.toISOString():null}function isValid$2(){return isValid(this)}function parsingFlags(){return extend({},getParsingFlags(this))}function invalidAt(){return getParsingFlags(this).overflow}function creationData(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function addWeekYearFormatToken(token,getter){addFormatToken(0,[token,token.length],0,getter)}function getSetWeekYear(input){return getSetWeekYearHelper.call(this,input,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function getSetISOWeekYear(input){return getSetWeekYearHelper.call(this,input,this.isoWeek(),this.isoWeekday(),1,4)}function getISOWeeksInYear(){return weeksInYear(this.year(),1,4)}function getWeeksInYear(){var weekInfo=this.localeData()._week;return weeksInYear(this.year(),weekInfo.dow,weekInfo.doy)}function getSetWeekYearHelper(input,week,weekday,dow,doy){var weeksTarget;return null==input?weekOfYear(this,dow,doy).year:(weeksTarget=weeksInYear(input,dow,doy),week>weeksTarget&&(week=weeksTarget),setWeekAll.call(this,input,week,weekday,dow,doy))}function setWeekAll(weekYear,week,weekday,dow,doy){var dayOfYearData=dayOfYearFromWeeks(weekYear,week,weekday,dow,doy),date=createUTCDate(dayOfYearData.year,0,dayOfYearData.dayOfYear);return this.year(date.getUTCFullYear()),this.month(date.getUTCMonth()),this.date(date.getUTCDate()),this}function getSetQuarter(input){return null==input?Math.ceil((this.month()+1)/3):this.month(3*(input-1)+this.month()%3)}function getSetDayOfYear(input){var dayOfYear=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==input?dayOfYear:this.add(input-dayOfYear,"d")}function parseMs(input,array){array[MILLISECOND]=toInt(1e3*("0."+input))}function getZoneAbbr(){return this._isUTC?"UTC":""}function getZoneName(){return this._isUTC?"Coordinated Universal Time":""}function createUnix(input){return createLocal(1e3*input)}function createInZone(){return createLocal.apply(null,arguments).parseZone()}function preParsePostFormat(string){return string}function get$1(format,index,field,setter){var locale=getLocale(),utc=createUTC().set(setter,index);return locale[field](utc,format)}function listMonthsImpl(format,index,field){if(isNumber(format)&&(index=format,format=void 0),format=format||"",null!=index)return get$1(format,index,field,"month");var i,out=[];for(i=0;i<12;i++)out[i]=get$1(format,i,field,"month");return out}function listWeekdaysImpl(localeSorted,format,index,field){"boolean"==typeof localeSorted?(isNumber(format)&&(index=format,format=void 0),format=format||""):(format=localeSorted,index=format,localeSorted=!1,isNumber(format)&&(index=format,format=void 0),format=format||"");var locale=getLocale(),shift=localeSorted?locale._week.dow:0;if(null!=index)return get$1(format,(index+shift)%7,field,"day");var i,out=[];for(i=0;i<7;i++)out[i]=get$1(format,(i+shift)%7,field,"day");return out}function listMonths(format,index){return listMonthsImpl(format,index,"months")}function listMonthsShort(format,index){return listMonthsImpl(format,index,"monthsShort")}function listWeekdays(localeSorted,format,index){return listWeekdaysImpl(localeSorted,format,index,"weekdays")}function listWeekdaysShort(localeSorted,format,index){return listWeekdaysImpl(localeSorted,format,index,"weekdaysShort")}function listWeekdaysMin(localeSorted,format,index){return listWeekdaysImpl(localeSorted,format,index,"weekdaysMin")}function abs(){var data=this._data;return this._milliseconds=mathAbs(this._milliseconds),this._days=mathAbs(this._days),this._months=mathAbs(this._months),data.milliseconds=mathAbs(data.milliseconds),data.seconds=mathAbs(data.seconds),data.minutes=mathAbs(data.minutes),data.hours=mathAbs(data.hours),data.months=mathAbs(data.months),data.years=mathAbs(data.years),this}function addSubtract$1(duration,input,value,direction){var other=createDuration(input,value);return duration._milliseconds+=direction*other._milliseconds,duration._days+=direction*other._days,duration._months+=direction*other._months,duration._bubble()}function add$1(input,value){return addSubtract$1(this,input,value,1)}function subtract$1(input,value){return addSubtract$1(this,input,value,-1)}function absCeil(number){return number<0?Math.floor(number):Math.ceil(number)}function bubble(){var seconds,minutes,hours,years,monthsFromDays,milliseconds=this._milliseconds,days=this._days,months=this._months,data=this._data;return milliseconds>=0&&days>=0&&months>=0||milliseconds<=0&&days<=0&&months<=0||(milliseconds+=864e5*absCeil(monthsToDays(months)+days),days=0,months=0),data.milliseconds=milliseconds%1e3,seconds=absFloor(milliseconds/1e3),data.seconds=seconds%60,minutes=absFloor(seconds/60),data.minutes=minutes%60,hours=absFloor(minutes/60),data.hours=hours%24,days+=absFloor(hours/24),monthsFromDays=absFloor(daysToMonths(days)),months+=monthsFromDays,days-=absCeil(monthsToDays(monthsFromDays)),years=absFloor(months/12),months%=12,data.days=days,data.months=months,data.years=years,this}function daysToMonths(days){return 4800*days/146097}function monthsToDays(months){return 146097*months/4800}function as(units){if(!this.isValid())return NaN;var days,months,milliseconds=this._milliseconds;if("month"===(units=normalizeUnits(units))||"year"===units)return days=this._days+milliseconds/864e5,months=this._months+daysToMonths(days),"month"===units?months:months/12;switch(days=this._days+Math.round(monthsToDays(this._months)),units){case"week":return days/7+milliseconds/6048e5;case"day":return days+milliseconds/864e5;case"hour":return 24*days+milliseconds/36e5;case"minute":return 1440*days+milliseconds/6e4;case"second":return 86400*days+milliseconds/1e3;case"millisecond":return Math.floor(864e5*days)+milliseconds;default:throw new Error("Unknown unit "+units)}}function valueOf$1(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*toInt(this._months/12):NaN}function makeAs(alias){return function(){return this.as(alias)}}function get$2(units){return units=normalizeUnits(units),this.isValid()?this[units+"s"]():NaN}function makeGetter(name){return function(){return this.isValid()?this._data[name]:NaN}}function weeks(){return absFloor(this.days()/7)}function substituteTimeAgo(string,number,withoutSuffix,isFuture,locale){return locale.relativeTime(number||1,!!withoutSuffix,string,isFuture)}function relativeTime$1(posNegDuration,withoutSuffix,locale){var duration=createDuration(posNegDuration).abs(),seconds=round(duration.as("s")),minutes=round(duration.as("m")),hours=round(duration.as("h")),days=round(duration.as("d")),months=round(duration.as("M")),years=round(duration.as("y")),a=seconds<=thresholds.ss&&["s",seconds]||seconds0,a[4]=locale,substituteTimeAgo.apply(null,a)}function getSetRelativeTimeRounding(roundingFunction){return void 0===roundingFunction?round:"function"==typeof roundingFunction&&(round=roundingFunction,!0)}function getSetRelativeTimeThreshold(threshold,limit){return void 0!==thresholds[threshold]&&(void 0===limit?thresholds[threshold]:(thresholds[threshold]=limit,"s"===threshold&&(thresholds.ss=limit-1),!0))}function humanize(withSuffix){if(!this.isValid())return this.localeData().invalidDate();var locale=this.localeData(),output=relativeTime$1(this,!withSuffix,locale);return withSuffix&&(output=locale.pastFuture(+this,output)),locale.postformat(output)}function toISOString$1(){if(!this.isValid())return this.localeData().invalidDate();var minutes,hours,years,seconds=abs$1(this._milliseconds)/1e3,days=abs$1(this._days),months=abs$1(this._months);minutes=absFloor(seconds/60),hours=absFloor(minutes/60),seconds%=60,minutes%=60,years=absFloor(months/12),months%=12;var Y=years,M=months,D=days,h=hours,m=minutes,s=seconds,total=this.asSeconds();return total?(total<0?"-":"")+"P"+(Y?Y+"Y":"")+(M?M+"M":"")+(D?D+"D":"")+(h||m||s?"T":"")+(h?h+"H":"")+(m?m+"M":"")+(s?s+"S":""):"P0D"}var hookCallback,some;some=Array.prototype.some?Array.prototype.some:function(fun){for(var t=Object(this),len=t.length>>>0,i=0;i68?1900:2e3)};var getSetYear=makeGetSet("FullYear",!0);addFormatToken("w",["ww",2],"wo","week"),addFormatToken("W",["WW",2],"Wo","isoWeek"),addUnitAlias("week","w"),addUnitAlias("isoWeek","W"),addUnitPriority("week",5),addUnitPriority("isoWeek",5),addRegexToken("w",match1to2),addRegexToken("ww",match1to2,match2),addRegexToken("W",match1to2),addRegexToken("WW",match1to2,match2),addWeekParseToken(["w","ww","W","WW"],function(input,week,config,token){week[token.substr(0,1)]=toInt(input)});var defaultLocaleWeek={dow:0,doy:6};addFormatToken("d",0,"do","day"),addFormatToken("dd",0,0,function(format){return this.localeData().weekdaysMin(this,format)}),addFormatToken("ddd",0,0,function(format){return this.localeData().weekdaysShort(this,format)}),addFormatToken("dddd",0,0,function(format){return this.localeData().weekdays(this,format)}),addFormatToken("e",0,0,"weekday"),addFormatToken("E",0,0,"isoWeekday"),addUnitAlias("day","d"),addUnitAlias("weekday","e"),addUnitAlias("isoWeekday","E"),addUnitPriority("day",11),addUnitPriority("weekday",11),addUnitPriority("isoWeekday",11),addRegexToken("d",match1to2),addRegexToken("e",match1to2),addRegexToken("E",match1to2),addRegexToken("dd",function(isStrict,locale){return locale.weekdaysMinRegex(isStrict)}),addRegexToken("ddd",function(isStrict,locale){return locale.weekdaysShortRegex(isStrict)}),addRegexToken("dddd",function(isStrict,locale){return locale.weekdaysRegex(isStrict)}),addWeekParseToken(["dd","ddd","dddd"],function(input,week,config,token){var weekday=config._locale.weekdaysParse(input,token,config._strict);null!=weekday?week.d=weekday:getParsingFlags(config).invalidWeekday=input}),addWeekParseToken(["d","e","E"],function(input,week,config,token){week[token]=toInt(input)});var defaultLocaleWeekdays="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),defaultLocaleWeekdaysShort="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),defaultLocaleWeekdaysMin="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),defaultWeekdaysRegex=matchWord,defaultWeekdaysShortRegex=matchWord,defaultWeekdaysMinRegex=matchWord;addFormatToken("H",["HH",2],0,"hour"),addFormatToken("h",["hh",2],0,hFormat),addFormatToken("k",["kk",2],0,kFormat),addFormatToken("hmm",0,0,function(){return""+hFormat.apply(this)+zeroFill(this.minutes(),2)}),addFormatToken("hmmss",0,0,function(){return""+hFormat.apply(this)+zeroFill(this.minutes(),2)+zeroFill(this.seconds(),2)}),addFormatToken("Hmm",0,0,function(){return""+this.hours()+zeroFill(this.minutes(),2)}),addFormatToken("Hmmss",0,0,function(){return""+this.hours()+zeroFill(this.minutes(),2)+zeroFill(this.seconds(),2)}),meridiem("a",!0),meridiem("A",!1),addUnitAlias("hour","h"),addUnitPriority("hour",13),addRegexToken("a",matchMeridiem),addRegexToken("A",matchMeridiem),addRegexToken("H",match1to2),addRegexToken("h",match1to2),addRegexToken("k",match1to2),addRegexToken("HH",match1to2,match2),addRegexToken("hh",match1to2,match2),addRegexToken("kk",match1to2,match2),addRegexToken("hmm",match3to4),addRegexToken("hmmss",match5to6),addRegexToken("Hmm",match3to4),addRegexToken("Hmmss",match5to6),addParseToken(["H","HH"],HOUR),addParseToken(["k","kk"],function(input,array,config){var kInput=toInt(input);array[HOUR]=24===kInput?0:kInput}),addParseToken(["a","A"],function(input,array,config){config._isPm=config._locale.isPM(input),config._meridiem=input}),addParseToken(["h","hh"],function(input,array,config){array[HOUR]=toInt(input),getParsingFlags(config).bigHour=!0}),addParseToken("hmm",function(input,array,config){var pos=input.length-2;array[HOUR]=toInt(input.substr(0,pos)),array[MINUTE]=toInt(input.substr(pos)),getParsingFlags(config).bigHour=!0}),addParseToken("hmmss",function(input,array,config){var pos1=input.length-4,pos2=input.length-2;array[HOUR]=toInt(input.substr(0,pos1)),array[MINUTE]=toInt(input.substr(pos1,2)),array[SECOND]=toInt(input.substr(pos2)),getParsingFlags(config).bigHour=!0}),addParseToken("Hmm",function(input,array,config){var pos=input.length-2;array[HOUR]=toInt(input.substr(0,pos)),array[MINUTE]=toInt(input.substr(pos))}),addParseToken("Hmmss",function(input,array,config){var pos1=input.length-4,pos2=input.length-2;array[HOUR]=toInt(input.substr(0,pos1)),array[MINUTE]=toInt(input.substr(pos1,2)),array[SECOND]=toInt(input.substr(pos2))});var globalLocale,defaultLocaleMeridiemParse=/[ap]\.?m?\.?/i,getSetHour=makeGetSet("Hours",!0),baseConfig={calendar:defaultCalendar,longDateFormat:defaultLongDateFormat,invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:defaultDayOfMonthOrdinalParse,relativeTime:defaultRelativeTime,months:defaultLocaleMonths,monthsShort:defaultLocaleMonthsShort,week:defaultLocaleWeek,weekdays:defaultLocaleWeekdays,weekdaysMin:defaultLocaleWeekdaysMin,weekdaysShort:defaultLocaleWeekdaysShort,meridiemParse:defaultLocaleMeridiemParse},locales={},localeFamilies={},extendedIsoRegex=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,basicIsoRegex=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,tzRegex=/Z|[+-]\d\d(?::?\d\d)?/,isoDates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],isoTimes=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],aspNetJsonRegex=/^\/?Date\((\-?\d+)/i,basicRfcRegex=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;hooks.createFromInputFallback=deprecate("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(config){config._d=new Date(config._i+(config._useUTC?" UTC":""))}),hooks.ISO_8601=function(){},hooks.RFC_2822=function(){};var prototypeMin=deprecate("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var other=createLocal.apply(null,arguments);return this.isValid()&&other.isValid()?otherthis?this:other:createInvalid()}),now=function(){return Date.now?Date.now():+new Date},ordering=["year","quarter","month","week","day","hour","minute","second","millisecond"];offset("Z",":"),offset("ZZ",""),addRegexToken("Z",matchShortOffset),addRegexToken("ZZ",matchShortOffset),addParseToken(["Z","ZZ"],function(input,array,config){config._useUTC=!0,config._tzm=offsetFromString(matchShortOffset,input)});var chunkOffset=/([\+\-]|\d\d)/gi;hooks.updateOffset=function(){};var aspNetRegex=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,isoRegex=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;createDuration.fn=Duration.prototype,createDuration.invalid=createInvalid$1;var add=createAdder(1,"add"),subtract=createAdder(-1,"subtract");hooks.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",hooks.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var lang=deprecate("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(key){return void 0===key?this.localeData():this.locale(key)});addFormatToken(0,["gg",2],0,function(){return this.weekYear()%100}),addFormatToken(0,["GG",2],0,function(){return this.isoWeekYear()%100}),addWeekYearFormatToken("gggg","weekYear"),addWeekYearFormatToken("ggggg","weekYear"),addWeekYearFormatToken("GGGG","isoWeekYear"),addWeekYearFormatToken("GGGGG","isoWeekYear"),addUnitAlias("weekYear","gg"),addUnitAlias("isoWeekYear","GG"),addUnitPriority("weekYear",1),addUnitPriority("isoWeekYear",1),addRegexToken("G",matchSigned),addRegexToken("g",matchSigned),addRegexToken("GG",match1to2,match2),addRegexToken("gg",match1to2,match2),addRegexToken("GGGG",match1to4,match4),addRegexToken("gggg",match1to4,match4),addRegexToken("GGGGG",match1to6,match6),addRegexToken("ggggg",match1to6,match6),addWeekParseToken(["gggg","ggggg","GGGG","GGGGG"],function(input,week,config,token){week[token.substr(0,2)]=toInt(input)}),addWeekParseToken(["gg","GG"],function(input,week,config,token){week[token]=hooks.parseTwoDigitYear(input)}),addFormatToken("Q",0,"Qo","quarter"),addUnitAlias("quarter","Q"),addUnitPriority("quarter",7),addRegexToken("Q",match1),addParseToken("Q",function(input,array){array[MONTH]=3*(toInt(input)-1)}),addFormatToken("D",["DD",2],"Do","date"),addUnitAlias("date","D"),addUnitPriority("date",9),addRegexToken("D",match1to2),addRegexToken("DD",match1to2,match2),addRegexToken("Do",function(isStrict,locale){return isStrict?locale._dayOfMonthOrdinalParse||locale._ordinalParse:locale._dayOfMonthOrdinalParseLenient}),addParseToken(["D","DD"],DATE),addParseToken("Do",function(input,array){array[DATE]=toInt(input.match(match1to2)[0],10)});var getSetDayOfMonth=makeGetSet("Date",!0);addFormatToken("DDD",["DDDD",3],"DDDo","dayOfYear"),addUnitAlias("dayOfYear","DDD"),addUnitPriority("dayOfYear",4),addRegexToken("DDD",match1to3),addRegexToken("DDDD",match3),addParseToken(["DDD","DDDD"],function(input,array,config){config._dayOfYear=toInt(input)}),addFormatToken("m",["mm",2],0,"minute"),addUnitAlias("minute","m"),addUnitPriority("minute",14),addRegexToken("m",match1to2),addRegexToken("mm",match1to2,match2),addParseToken(["m","mm"],MINUTE);var getSetMinute=makeGetSet("Minutes",!1);addFormatToken("s",["ss",2],0,"second"),addUnitAlias("second","s"),addUnitPriority("second",15),addRegexToken("s",match1to2),addRegexToken("ss",match1to2,match2),addParseToken(["s","ss"],SECOND);var getSetSecond=makeGetSet("Seconds",!1);addFormatToken("S",0,0,function(){return~~(this.millisecond()/100)}),addFormatToken(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),addFormatToken(0,["SSS",3],0,"millisecond"),addFormatToken(0,["SSSS",4],0,function(){return 10*this.millisecond()}),addFormatToken(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),addFormatToken(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),addFormatToken(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),addFormatToken(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),addFormatToken(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),addUnitAlias("millisecond","ms"),addUnitPriority("millisecond",16),addRegexToken("S",match1to3,match1),addRegexToken("SS",match1to3,match2),addRegexToken("SSS",match1to3,match3);var token;for(token="SSSS";token.length<=9;token+="S")addRegexToken(token,matchUnsigned);for(token="S";token.length<=9;token+="S")addParseToken(token,parseMs);var getSetMillisecond=makeGetSet("Milliseconds",!1);addFormatToken("z",0,0,"zoneAbbr"),addFormatToken("zz",0,0,"zoneName");var proto=Moment.prototype;proto.add=add,proto.calendar=calendar$1,proto.clone=clone,proto.diff=diff,proto.endOf=endOf,proto.format=format,proto.from=from,proto.fromNow=fromNow,proto.to=to,proto.toNow=toNow,proto.get=stringGet,proto.invalidAt=invalidAt,proto.isAfter=isAfter,proto.isBefore=isBefore,proto.isBetween=isBetween,proto.isSame=isSame,proto.isSameOrAfter=isSameOrAfter,proto.isSameOrBefore=isSameOrBefore,proto.isValid=isValid$2,proto.lang=lang,proto.locale=locale,proto.localeData=localeData,proto.max=prototypeMax,proto.min=prototypeMin,proto.parsingFlags=parsingFlags,proto.set=stringSet,proto.startOf=startOf,proto.subtract=subtract,proto.toArray=toArray,proto.toObject=toObject,proto.toDate=toDate,proto.toISOString=toISOString,proto.inspect=inspect,proto.toJSON=toJSON,proto.toString=toString,proto.unix=unix,proto.valueOf=valueOf,proto.creationData=creationData,proto.year=getSetYear,proto.isLeapYear=getIsLeapYear,proto.weekYear=getSetWeekYear,proto.isoWeekYear=getSetISOWeekYear,proto.quarter=proto.quarters=getSetQuarter,proto.month=getSetMonth,proto.daysInMonth=getDaysInMonth,proto.week=proto.weeks=getSetWeek,proto.isoWeek=proto.isoWeeks=getSetISOWeek,proto.weeksInYear=getWeeksInYear,proto.isoWeeksInYear=getISOWeeksInYear,proto.date=getSetDayOfMonth,proto.day=proto.days=getSetDayOfWeek,proto.weekday=getSetLocaleDayOfWeek,proto.isoWeekday=getSetISODayOfWeek,proto.dayOfYear=getSetDayOfYear,proto.hour=proto.hours=getSetHour,proto.minute=proto.minutes=getSetMinute,proto.second=proto.seconds=getSetSecond,proto.millisecond=proto.milliseconds=getSetMillisecond,proto.utcOffset=getSetOffset,proto.utc=setOffsetToUTC,proto.local=setOffsetToLocal,proto.parseZone=setOffsetToParsedOffset,proto.hasAlignedHourOffset=hasAlignedHourOffset,proto.isDST=isDaylightSavingTime,proto.isLocal=isLocal,proto.isUtcOffset=isUtcOffset,proto.isUtc=isUtc,proto.isUTC=isUtc,proto.zoneAbbr=getZoneAbbr,proto.zoneName=getZoneName,proto.dates=deprecate("dates accessor is deprecated. Use date instead.",getSetDayOfMonth),proto.months=deprecate("months accessor is deprecated. Use month instead",getSetMonth),proto.years=deprecate("years accessor is deprecated. Use year instead",getSetYear),proto.zone=deprecate("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",getSetZone),proto.isDSTShifted=deprecate("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",isDaylightSavingTimeShifted);var proto$1=Locale.prototype;proto$1.calendar=calendar,proto$1.longDateFormat=longDateFormat,proto$1.invalidDate=invalidDate,proto$1.ordinal=ordinal,proto$1.preparse=preParsePostFormat,proto$1.postformat=preParsePostFormat,proto$1.relativeTime=relativeTime,proto$1.pastFuture=pastFuture,proto$1.set=set,proto$1.months=localeMonths,proto$1.monthsShort=localeMonthsShort,proto$1.monthsParse=localeMonthsParse,proto$1.monthsRegex=monthsRegex,proto$1.monthsShortRegex=monthsShortRegex,proto$1.week=localeWeek,proto$1.firstDayOfYear=localeFirstDayOfYear,proto$1.firstDayOfWeek=localeFirstDayOfWeek,proto$1.weekdays=localeWeekdays,proto$1.weekdaysMin=localeWeekdaysMin,proto$1.weekdaysShort=localeWeekdaysShort,proto$1.weekdaysParse=localeWeekdaysParse,proto$1.weekdaysRegex=weekdaysRegex,proto$1.weekdaysShortRegex=weekdaysShortRegex,proto$1.weekdaysMinRegex=weekdaysMinRegex,proto$1.isPM=localeIsPM,proto$1.meridiem=localeMeridiem,getSetGlobalLocale("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(number){var b=number%10;return number+(1===toInt(number%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th")}}),hooks.lang=deprecate("moment.lang is deprecated. Use moment.locale instead.",getSetGlobalLocale),hooks.langData=deprecate("moment.langData is deprecated. Use moment.localeData instead.",getLocale);var mathAbs=Math.abs,asMilliseconds=makeAs("ms"),asSeconds=makeAs("s"),asMinutes=makeAs("m"),asHours=makeAs("h"),asDays=makeAs("d"),asWeeks=makeAs("w"),asMonths=makeAs("M"),asYears=makeAs("y"),milliseconds=makeGetter("milliseconds"),seconds=makeGetter("seconds"),minutes=makeGetter("minutes"),hours=makeGetter("hours"),days=makeGetter("days"),months=makeGetter("months"),years=makeGetter("years"),round=Math.round,thresholds={ss:44,s:45,m:45,h:22,d:26,M:11},abs$1=Math.abs,proto$2=Duration.prototype;return proto$2.isValid=isValid$1,proto$2.abs=abs,proto$2.add=add$1,proto$2.subtract=subtract$1,proto$2.as=as,proto$2.asMilliseconds=asMilliseconds,proto$2.asSeconds=asSeconds,proto$2.asMinutes=asMinutes,proto$2.asHours=asHours,proto$2.asDays=asDays,proto$2.asWeeks=asWeeks,proto$2.asMonths=asMonths,proto$2.asYears=asYears,proto$2.valueOf=valueOf$1,proto$2._bubble=bubble,proto$2.get=get$2,proto$2.milliseconds=milliseconds,proto$2.seconds=seconds,proto$2.minutes=minutes,proto$2.hours=hours,proto$2.days=days,proto$2.weeks=weeks,proto$2.months=months,proto$2.years=years,proto$2.humanize=humanize,proto$2.toISOString=toISOString$1,proto$2.toString=toISOString$1,proto$2.toJSON=toISOString$1,proto$2.locale=locale,proto$2.localeData=localeData,proto$2.toIsoString=deprecate("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",toISOString$1),proto$2.lang=lang,addFormatToken("X",0,0,"unix"),addFormatToken("x",0,0,"valueOf"),addRegexToken("x",matchSigned),addRegexToken("X",matchTimestamp),addParseToken("X",function(input,array,config){config._d=new Date(1e3*parseFloat(input,10))}),addParseToken("x",function(input,array,config){config._d=new Date(toInt(input))}),hooks.version="2.18.1",function(callback){hookCallback=callback}(createLocal),hooks.fn=proto,hooks.min=min,hooks.max=max,hooks.now=now,hooks.utc=createUTC,hooks.unix=createUnix,hooks.months=listMonths,hooks.isDate=isDate,hooks.locale=getSetGlobalLocale,hooks.invalid=createInvalid,hooks.duration=createDuration,hooks.isMoment=isMoment,hooks.weekdays=listWeekdays,hooks.parseZone=createInZone,hooks.localeData=getLocale,hooks.isDuration=isDuration,hooks.monthsShort=listMonthsShort,hooks.weekdaysMin=listWeekdaysMin,hooks.defineLocale=defineLocale,hooks.updateLocale=updateLocale,hooks.locales=listLocales,hooks.weekdaysShort=listWeekdaysShort,hooks.normalizeUnits=normalizeUnits,hooks.relativeTimeRounding=getSetRelativeTimeRounding,hooks.relativeTimeThreshold=getSetRelativeTimeThreshold,hooks.calendarFormat=getCalendarFormat,hooks.prototype=proto,hooks})},{}],7:[function(require,module,exports){!function(){"use strict";function isNil(value){return angular.isUndefined(value)||null===value}var KEY={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34, HOME:36,END:35,BACKSPACE:8,DELETE:46,COMMAND:91,MAP:{91:"COMMAND",8:"BACKSPACE",9:"TAB",13:"ENTER",16:"SHIFT",17:"CTRL",18:"ALT",19:"PAUSEBREAK",20:"CAPSLOCK",27:"ESC",32:"SPACE",33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT",38:"UP",39:"RIGHT",40:"DOWN",43:"+",44:"PRINTSCREEN",45:"INSERT",46:"DELETE",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NUMLOCK",145:"SCROLLLOCK",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},isControl:function(e){switch(e.which){case KEY.COMMAND:case KEY.SHIFT:case KEY.CTRL:case KEY.ALT:return!0}return!!(e.metaKey||e.ctrlKey||e.altKey)},isFunctionKey:function(k){return(k=k.which?k.which:k)>=112&&k<=123},isVerticalMovement:function(k){return~[KEY.UP,KEY.DOWN].indexOf(k)},isHorizontalMovement:function(k){return~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k)},toSeparator:function(k){var sep={ENTER:"\n",TAB:"\t",SPACE:" "}[k];return sep||(KEY[k]?void 0:k)}};void 0===angular.element.prototype.querySelectorAll&&(angular.element.prototype.querySelectorAll=function(selector){return angular.element(this[0].querySelectorAll(selector))}),void 0===angular.element.prototype.closest&&(angular.element.prototype.closest=function(selector){for(var elem=this[0],matchesSelector=elem.matches||elem.webkitMatchesSelector||elem.mozMatchesSelector||elem.msMatchesSelector;elem;){if(matchesSelector.bind(elem)(selector))return elem;elem=elem.parentElement}return!1});var latestId=0,uis=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:!0,sortable:!1,placeholder:"",refreshDelay:1e3,closeOnSelect:!0,skipFocusser:!1,dropdownPosition:"auto",removeSelected:!0,resetSearchInput:!0,generateId:function(){return latestId++},appendToBody:!1,spinnerEnabled:!1,spinnerClass:"glyphicon glyphicon-refresh ui-select-spin",backspaceReset:!0}).service("uiSelectMinErr",function(){var minErr=angular.$$minErr("ui.select");return function(){var error=minErr.apply(this,arguments),message=error.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(message)}}).directive("uisTranscludeAppend",function(){return{link:function(scope,element,attrs,ctrl,transclude){transclude(scope,function(clone){element.append(clone)})}}}).filter("highlight",function(){function escapeRegexp(queryToEscape){return(""+queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(matchItem,query){return query&&matchItem?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),'$&'):matchItem}}).factory("uisOffset",["$document","$window",function($document,$window){return function(element){var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop("offsetWidth"),height:boundingClientRect.height||element.prop("offsetHeight"),top:boundingClientRect.top+($window.pageYOffset||$document[0].documentElement.scrollTop),left:boundingClientRect.left+($window.pageXOffset||$document[0].documentElement.scrollLeft)}}}]);uis.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(uiSelectConfig,RepeatParser,uiSelectMinErr,$compile,$window){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(tElement){return tElement.addClass("ui-select-choices"),(tElement.parent().attr("theme")||uiSelectConfig.theme)+"/choices.tpl.html"},compile:function(tElement,tAttrs){if(!tAttrs.repeat)throw uiSelectMinErr("repeat","Expected 'repeat' expression.");var groupByExp=tAttrs.groupBy,groupFilterExp=tAttrs.groupFilter;if(groupByExp){var groups=tElement.querySelectorAll(".ui-select-choices-group");if(1!==groups.length)throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-group but got '{0}'.",groups.length);groups.attr("ng-repeat",RepeatParser.getGroupNgRepeatExpression())}var parserResult=RepeatParser.parse(tAttrs.repeat),choices=tElement.querySelectorAll(".ui-select-choices-row");if(1!==choices.length)throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row but got '{0}'.",choices.length);choices.attr("ng-repeat",parserResult.repeatExpression(groupByExp)).attr("ng-if","$select.open");var rowsInner=tElement.querySelectorAll(".ui-select-choices-row-inner");if(1!==rowsInner.length)throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",rowsInner.length);return rowsInner.attr("uis-transclude-append",""),($window.document.addEventListener?choices:rowsInner).attr("ng-click","$select.select("+parserResult.itemName+",$select.skipFocusser,$event)"),function(scope,element,attrs,$select){$select.parseRepeatAttr(attrs.repeat,groupByExp,groupFilterExp),$select.disableChoiceExpression=attrs.uiDisableChoice,$select.onHighlightCallback=attrs.onHighlight,$select.minimumInputLength=parseInt(attrs.minimumInputLength)||0,$select.dropdownPosition=attrs.position?attrs.position.toLowerCase():uiSelectConfig.dropdownPosition,scope.$watch("$select.search",function(newValue){newValue&&!$select.open&&$select.multiple&&$select.activate(!1,!0),$select.activeIndex=$select.tagging.isActivated?-1:0,!attrs.minimumInputLength||$select.search.length>=attrs.minimumInputLength?$select.refresh(attrs.refresh):$select.items=[]}),attrs.$observe("refreshDelay",function(){var refreshDelay=scope.$eval(attrs.refreshDelay);$select.refreshDelay=void 0!==refreshDelay?refreshDelay:uiSelectConfig.refreshDelay}),scope.$watch("$select.open",function(open){open?(tElement.attr("role","listbox"),$select.refresh(attrs.refresh)):element.removeAttr("role")})}}}}]),uis.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function($scope,$element,$timeout,$filter,$$uisDebounce,RepeatParser,uiSelectMinErr,uiSelectConfig,$parse,$injector,$window){function _findIndex(collection,predicate,thisArg){if(collection.findIndex)return collection.findIndex(predicate,thisArg);for(var value,list=Object(collection),length=list.length>>>0,i=0;i-1&&disabledItems.splice(disabledItemIndex,1)}function _isItemDisabled(item){return disabledItems.indexOf(item)>-1}function _initaliseLockedChoices(doInitalise){function _updateItemLocked(item,isLocked){var lockedItemIndex=lockedItems.indexOf(item);isLocked&&-1===lockedItemIndex&&lockedItems.push(item),!isLocked&&lockedItemIndex>-1&&lockedItems.splice(lockedItemIndex,1)}function _isItemlocked(item){return lockedItems.indexOf(item)>-1}if(doInitalise){var lockedItems=[];ctrl.isLocked=function(itemScope,itemIndex){var isLocked=!1,item=ctrl.selected[itemIndex];return item&&(itemScope?(isLocked=!!itemScope.$eval(ctrl.lockChoiceExpression),_updateItemLocked(item,isLocked)):isLocked=_isItemlocked(item)),isLocked}}}function _handleDropDownSelection(key){var processed=!0;switch(key){case KEY.DOWN:if(!ctrl.open&&ctrl.multiple)ctrl.activate(!1,!0);else if(ctrl.activeIndexminActiveIndex)for(var idxmin=--ctrl.activeIndex;_isItemDisabled(ctrl.items[idxmin])&&idxmin>minActiveIndex;)ctrl.activeIndex=--idxmin;break;case KEY.TAB:ctrl.multiple&&!ctrl.open||ctrl.select(ctrl.items[ctrl.activeIndex],!0);break;case KEY.ENTER:ctrl.open&&(ctrl.tagging.isActivated||ctrl.activeIndex>=0)?ctrl.select(ctrl.items[ctrl.activeIndex],ctrl.skipFocusser):ctrl.activate(!1,!0);break;case KEY.ESC:ctrl.close();break;default:processed=!1}return processed}function _ensureHighlightVisible(){var container=$element.querySelectorAll(".ui-select-choices-content"),choices=container.querySelectorAll(".ui-select-choices-row");if(choices.length<1)throw uiSelectMinErr("choices","Expected multiple .ui-select-choices-row but got '{0}'.",choices.length);if(!(ctrl.activeIndex<0)){var highlighted=choices[ctrl.activeIndex],posY=highlighted.offsetTop+highlighted.clientHeight-container[0].scrollTop,height=container[0].offsetHeight;posY>height?container[0].scrollTop+=posY-height:posY=ctrl.items.length?0:ctrl.activeIndex,-1===ctrl.activeIndex&&!1!==ctrl.taggingLabel&&(ctrl.activeIndex=0);var container=$element.querySelectorAll(".ui-select-choices-content"),searchInput=$element.querySelectorAll(".ui-select-search");if(ctrl.$animate&&ctrl.$animate.on&&ctrl.$animate.enabled(container[0])){var animateHandler=function(elem,phase){"start"===phase&&0===ctrl.items.length?(ctrl.$animate.off("removeClass",searchInput[0],animateHandler),$timeout(function(){ctrl.focusSearchInput(initSearchValue)})):"close"===phase&&(ctrl.$animate.off("enter",container[0],animateHandler),$timeout(function(){ctrl.focusSearchInput(initSearchValue)}))};ctrl.items.length>0?ctrl.$animate.on("enter",container[0],animateHandler):ctrl.$animate.on("removeClass",searchInput[0],animateHandler)}else $timeout(function(){ctrl.focusSearchInput(initSearchValue),!ctrl.tagging.isActivated&&ctrl.items.length>1&&_ensureHighlightVisible()})}},ctrl.focusSearchInput=function(initSearchValue){ctrl.search=initSearchValue||ctrl.search,ctrl.searchInput[0].focus()},ctrl.findGroupByName=function(name){return ctrl.groups&&ctrl.groups.filter(function(group){return group.name===name})[0]},ctrl.parseRepeatAttr=function(repeatAttr,groupByExp,groupFilterExp){function updateGroups(items){var groupFn=$scope.$eval(groupByExp);if(ctrl.groups=[],angular.forEach(items,function(item){var groupName=angular.isFunction(groupFn)?groupFn(item):item[groupFn],group=ctrl.findGroupByName(groupName);group?group.items.push(item):ctrl.groups.push({name:groupName,items:[item]})}),groupFilterExp){var groupFilterFn=$scope.$eval(groupFilterExp);angular.isFunction(groupFilterFn)?ctrl.groups=groupFilterFn(ctrl.groups):angular.isArray(groupFilterFn)&&(ctrl.groups=_groupsFilter(ctrl.groups,groupFilterFn))}ctrl.items=[],ctrl.groups.forEach(function(group){ctrl.items=ctrl.items.concat(group.items)})}function setPlainItems(items){ctrl.items=items||[]}ctrl.setItemsFn=groupByExp?updateGroups:setPlainItems,ctrl.parserResult=RepeatParser.parse(repeatAttr),ctrl.isGrouped=!!groupByExp,ctrl.itemProperty=ctrl.parserResult.itemName;var originalSource=ctrl.parserResult.source,createArrayFromObject=function(){var origSrc=originalSource($scope);$scope.$uisSource=Object.keys(origSrc).map(function(v){var result={};return result[ctrl.parserResult.keyName]=v,result.value=origSrc[v],result})};ctrl.parserResult.keyName&&(createArrayFromObject(),ctrl.parserResult.source=$parse("$uisSource"+ctrl.parserResult.filters),$scope.$watch(originalSource,function(newVal,oldVal){newVal!==oldVal&&createArrayFromObject()},!0)),ctrl.refreshItems=function(data){data=data||ctrl.parserResult.source($scope);var selectedItems=ctrl.selected;if(ctrl.isEmpty()||angular.isArray(selectedItems)&&!selectedItems.length||!ctrl.multiple||!ctrl.removeSelected)ctrl.setItemsFn(data);else if(void 0!==data&&null!==data){var filteredItems=data.filter(function(i){return angular.isArray(selectedItems)?selectedItems.every(function(selectedItem){return!angular.equals(i,selectedItem)}):!angular.equals(i,selectedItems)});ctrl.setItemsFn(filteredItems)}"auto"!==ctrl.dropdownPosition&&"up"!==ctrl.dropdownPosition||$scope.calculateDropdownPos(),$scope.$broadcast("uis:refresh")},$scope.$watchCollection(ctrl.parserResult.source,function(items){if(void 0===items||null===items)ctrl.items=[];else{if(!angular.isArray(items))throw uiSelectMinErr("items","Expected an array but got '{0}'.",items);ctrl.refreshItems(items),angular.isDefined(ctrl.ngModel.$modelValue)&&(ctrl.ngModel.$modelValue=null)}})};var _refreshDelayPromise;ctrl.refresh=function(refreshAttr){void 0!==refreshAttr&&(_refreshDelayPromise&&$timeout.cancel(_refreshDelayPromise),_refreshDelayPromise=$timeout(function(){if($scope.$select.search.length>=$scope.$select.minimumInputLength){var refreshPromise=$scope.$eval(refreshAttr);refreshPromise&&angular.isFunction(refreshPromise.then)&&!ctrl.refreshing&&(ctrl.refreshing=!0,refreshPromise.finally(function(){ctrl.refreshing=!1}))}},ctrl.refreshDelay))},ctrl.isActive=function(itemScope){if(!ctrl.open)return!1;var itemIndex=ctrl.items.indexOf(itemScope[ctrl.itemProperty]),isActive=itemIndex==ctrl.activeIndex;return!(!isActive||itemIndex<0)&&(isActive&&!angular.isUndefined(ctrl.onHighlightCallback)&&itemScope.$eval(ctrl.onHighlightCallback),isActive)};var _isItemSelected=function(item){return ctrl.selected&&angular.isArray(ctrl.selected)&&ctrl.selected.filter(function(selection){return angular.equals(selection,item)}).length>0},disabledItems=[];ctrl.isDisabled=function(itemScope){if(ctrl.open){var item=itemScope[ctrl.itemProperty],itemIndex=ctrl.items.indexOf(item),isDisabled=!1;if(itemIndex>=0&&(angular.isDefined(ctrl.disableChoiceExpression)||ctrl.multiple)){if(item.isTag)return!1;ctrl.multiple&&(isDisabled=_isItemSelected(item)),!isDisabled&&angular.isDefined(ctrl.disableChoiceExpression)&&(isDisabled=!!itemScope.$eval(ctrl.disableChoiceExpression)),_updateItemDisabled(item,isDisabled)}return isDisabled}},ctrl.select=function(item,skipFocusser,$event){if(isNil(item)||!_isItemDisabled(item)){if(!ctrl.items&&!ctrl.search&&!ctrl.tagging.isActivated)return;if(!item||!_isItemDisabled(item)){if(ctrl.clickTriggeredSelect=!1,$event&&("click"===$event.type||"touchend"===$event.type)&&item&&(ctrl.clickTriggeredSelect=!0),ctrl.tagging.isActivated&&!1===ctrl.clickTriggeredSelect){if(!1===ctrl.taggingLabel)if(ctrl.activeIndex<0){if(void 0===item&&(item=void 0!==ctrl.tagging.fct?ctrl.tagging.fct(ctrl.search):ctrl.search),!item||angular.equals(ctrl.items[0],item))return}else item=ctrl.items[ctrl.activeIndex];else if(0===ctrl.activeIndex){if(void 0===item)return;if(void 0!==ctrl.tagging.fct&&"string"==typeof item){if(!(item=ctrl.tagging.fct(item)))return}else"string"==typeof item&&(item=item.replace(ctrl.taggingLabel,"").trim())}if(_isItemSelected(item))return void ctrl.close(skipFocusser)}_resetSearchInput(),$scope.$broadcast("uis:select",item),ctrl.closeOnSelect&&ctrl.close(skipFocusser)}}},ctrl.close=function(skipFocusser){ctrl.open&&(ctrl.ngModel&&ctrl.ngModel.$setTouched&&ctrl.ngModel.$setTouched(),ctrl.open=!1,_resetSearchInput(),$scope.$broadcast("uis:close",skipFocusser))},ctrl.setFocus=function(){ctrl.focus||ctrl.focusInput[0].focus()},ctrl.clear=function($event){ctrl.select(null),$event.stopPropagation(),$timeout(function(){ctrl.focusser[0].focus()},0,!1)},ctrl.toggle=function(e){ctrl.open?(ctrl.close(),e.preventDefault(),e.stopPropagation()):ctrl.activate()},ctrl.isLocked=function(){return!1},$scope.$watch(function(){return angular.isDefined(ctrl.lockChoiceExpression)&&""!==ctrl.lockChoiceExpression},_initaliseLockedChoices);var sizeWatch=null,updaterScheduled=!1;ctrl.sizeSearchInput=function(){var input=ctrl.searchInput[0],container=ctrl.$element[0],calculateContainerWidth=function(){return container.clientWidth*!!input.offsetParent},updateIfVisible=function(containerWidth){if(0===containerWidth)return!1;var inputWidth=containerWidth-input.offsetLeft;return inputWidth<50&&(inputWidth=containerWidth),ctrl.searchInput.css("width",inputWidth+"px"),!0};ctrl.searchInput.css("width","10px"),$timeout(function(){null!==sizeWatch||updateIfVisible(calculateContainerWidth())||(sizeWatch=$scope.$watch(function(){updaterScheduled||(updaterScheduled=!0,$scope.$$postDigest(function(){updaterScheduled=!1,updateIfVisible(calculateContainerWidth())&&(sizeWatch(),sizeWatch=null)}))},angular.noop))})},ctrl.searchInput.on("keydown",function(e){var key=e.which;~[KEY.ENTER,KEY.ESC].indexOf(key)&&(e.preventDefault(),e.stopPropagation()),$scope.$apply(function(){var tagged=!1;if((ctrl.items.length>0||ctrl.tagging.isActivated)&&(_handleDropDownSelection(key)||ctrl.searchEnabled||(e.preventDefault(),e.stopPropagation()),ctrl.taggingTokens.isActivated)){for(var i=0;i0&&(tagged=!0);tagged&&$timeout(function(){ctrl.searchInput.triggerHandler("tagged");var newItem=ctrl.search.replace(KEY.MAP[e.keyCode],"").trim();ctrl.tagging.fct&&(newItem=ctrl.tagging.fct(newItem)),newItem&&ctrl.select(newItem,!0)})}}),KEY.isVerticalMovement(key)&&ctrl.items.length>0&&_ensureHighlightVisible(),key!==KEY.ENTER&&key!==KEY.ESC||(e.preventDefault(),e.stopPropagation())}),ctrl.searchInput.on("paste",function(e){var data;if(data=window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):(e.originalEvent||e).clipboardData.getData("text/plain"),(data=ctrl.search+data)&&data.length>0)if(ctrl.taggingTokens.isActivated){for(var items=[],i=0;i-1){items=data.split(separator);break}}0===items.length&&(items=[data]);var oldsearch=ctrl.search;angular.forEach(items,function(item){var newItem=ctrl.tagging.fct?ctrl.tagging.fct(item):item;newItem&&ctrl.select(newItem,!0)}),ctrl.search=oldsearch||EMPTY_SEARCH,e.preventDefault(),e.stopPropagation()}else ctrl.paste&&(ctrl.paste(data),ctrl.search=EMPTY_SEARCH,e.preventDefault(),e.stopPropagation())}),ctrl.searchInput.on("tagged",function(){$timeout(function(){_resetSearchInput()})});var onResize=$$uisDebounce(function(){ctrl.sizeSearchInput()},50);angular.element($window).bind("resize",onResize),$scope.$on("$destroy",function(){ctrl.searchInput.off("keyup keydown tagged blur paste"),angular.element($window).off("resize",onResize)}),$scope.$watch("$select.activeIndex",function(activeIndex){activeIndex&&$element.find("input").attr("aria-activedescendant","ui-select-choices-row-"+ctrl.generatedId+"-"+activeIndex)}),$scope.$watch("$select.open",function(open){open||$element.find("input").removeAttr("aria-activedescendant")})}]),uis.directive("uiSelect",["$document","uiSelectConfig","uiSelectMinErr","uisOffset","$compile","$parse","$timeout",function($document,uiSelectConfig,uiSelectMinErr,uisOffset,$compile,$parse,$timeout){return{restrict:"EA",templateUrl:function(tElement,tAttrs){return(tAttrs.theme||uiSelectConfig.theme)+(angular.isDefined(tAttrs.multiple)?"/select-multiple.tpl.html":"/select.tpl.html")},replace:!0,transclude:!0,require:["uiSelect","^ngModel"],scope:!0,controller:"uiSelectCtrl",controllerAs:"$select",compile:function(tElement,tAttrs){var match=/{(.*)}\s*{(.*)}/.exec(tAttrs.ngClass);if(match){var combined="{"+match[1]+", "+match[2]+"}";tAttrs.ngClass=combined,tElement.attr("ng-class",combined)}return angular.isDefined(tAttrs.multiple)?tElement.append("").removeAttr("multiple"):tElement.append(""),tAttrs.inputId&&(tElement.querySelectorAll("input.ui-select-search")[0].id=tAttrs.inputId),function(scope,element,attrs,ctrls,transcludeFn){function onDocumentClick(e){if($select.open){if(!(window.jQuery?window.jQuery.contains(element[0],e.target):element[0].contains(e.target))&&!$select.clickTriggeredSelect){var skipFocusser;if($select.skipFocusser)skipFocusser=!0;else{var focusableControls=["input","button","textarea","select"],targetController=angular.element(e.target).controller("uiSelect");skipFocusser=targetController&&targetController!==$select,skipFocusser||(skipFocusser=~focusableControls.indexOf(e.target.tagName.toLowerCase()))}$select.close(skipFocusser),scope.$digest()}$select.clickTriggeredSelect=!1}}function positionDropdown(){var offset=uisOffset(element);placeholder=angular.element('
'),placeholder[0].style.width=offset.width+"px",placeholder[0].style.height=offset.height+"px",element.after(placeholder),originalWidth=element[0].style.width,$document.find("body").append(element),element[0].style.position="absolute",element[0].style.left=offset.left+"px",element[0].style.top=offset.top+"px",element[0].style.width=offset.width+"px"}function resetDropdown(){null!==placeholder&&(placeholder.replaceWith(element),placeholder=null,element[0].style.position="",element[0].style.left="",element[0].style.top="",element[0].style.width=originalWidth,$select.setFocus())}var $select=ctrls[0],ngModel=ctrls[1];$select.generatedId=uiSelectConfig.generateId(),$select.baseTitle=attrs.title||"Select box",$select.focusserTitle=$select.baseTitle+" focus",$select.focusserId="focusser-"+$select.generatedId,$select.closeOnSelect=function(){return angular.isDefined(attrs.closeOnSelect)?$parse(attrs.closeOnSelect)():uiSelectConfig.closeOnSelect}(),scope.$watch("skipFocusser",function(){var skipFocusser=scope.$eval(attrs.skipFocusser);$select.skipFocusser=void 0!==skipFocusser?skipFocusser:uiSelectConfig.skipFocusser}),$select.onSelectCallback=$parse(attrs.onSelect),$select.onRemoveCallback=$parse(attrs.onRemove),$select.ngModel=ngModel,$select.choiceGrouped=function(group){return $select.isGrouped&&group&&group.name},attrs.tabindex&&attrs.$observe("tabindex",function(value){$select.focusInput.attr("tabindex",value),element.removeAttr("tabindex")}),scope.$watch(function(){return scope.$eval(attrs.searchEnabled)},function(newVal){$select.searchEnabled=void 0!==newVal?newVal:uiSelectConfig.searchEnabled}),scope.$watch("sortable",function(){var sortable=scope.$eval(attrs.sortable);$select.sortable=void 0!==sortable?sortable:uiSelectConfig.sortable}),attrs.$observe("backspaceReset",function(){var backspaceReset=scope.$eval(attrs.backspaceReset);$select.backspaceReset=void 0===backspaceReset||backspaceReset}),attrs.$observe("limit",function(){$select.limit=angular.isDefined(attrs.limit)?parseInt(attrs.limit,10):void 0}),scope.$watch("removeSelected",function(){var removeSelected=scope.$eval(attrs.removeSelected);$select.removeSelected=void 0!==removeSelected?removeSelected:uiSelectConfig.removeSelected}),attrs.$observe("disabled",function(){$select.disabled=void 0!==attrs.disabled&&attrs.disabled}),attrs.$observe("resetSearchInput",function(){var resetSearchInput=scope.$eval(attrs.resetSearchInput);$select.resetSearchInput=void 0===resetSearchInput||resetSearchInput}),attrs.$observe("paste",function(){$select.paste=scope.$eval(attrs.paste)}),attrs.$observe("tagging",function(){if(void 0!==attrs.tagging){var taggingEval=scope.$eval(attrs.tagging);$select.tagging={isActivated:!0,fct:!0!==taggingEval?taggingEval:void 0}}else $select.tagging={isActivated:!1,fct:void 0}}),attrs.$observe("taggingLabel",function(){void 0!==attrs.tagging&&("false"===attrs.taggingLabel?$select.taggingLabel=!1:$select.taggingLabel=void 0!==attrs.taggingLabel?attrs.taggingLabel:"(new)")}),attrs.$observe("taggingTokens",function(){if(void 0!==attrs.tagging){var tokens=void 0!==attrs.taggingTokens?attrs.taggingTokens.split("|"):[",","ENTER"];$select.taggingTokens={isActivated:!0,tokens:tokens}}}),attrs.$observe("spinnerEnabled",function(){var spinnerEnabled=scope.$eval(attrs.spinnerEnabled);$select.spinnerEnabled=void 0!==spinnerEnabled?spinnerEnabled:uiSelectConfig.spinnerEnabled}),attrs.$observe("spinnerClass",function(){var spinnerClass=attrs.spinnerClass;$select.spinnerClass=void 0!==spinnerClass?attrs.spinnerClass:uiSelectConfig.spinnerClass}),angular.isDefined(attrs.autofocus)&&$timeout(function(){$select.setFocus()}),angular.isDefined(attrs.focusOn)&&scope.$on(attrs.focusOn,function(){$timeout(function(){$select.setFocus()})}),$document.on("click",onDocumentClick),scope.$on("$destroy",function(){$document.off("click",onDocumentClick)}),transcludeFn(scope,function(clone){var transcluded=angular.element("
").append(clone),transcludedMatch=transcluded.querySelectorAll(".ui-select-match");if(transcludedMatch.removeAttr("ui-select-match"),transcludedMatch.removeAttr("data-ui-select-match"),1!==transcludedMatch.length)throw uiSelectMinErr("transcluded","Expected 1 .ui-select-match but got '{0}'.",transcludedMatch.length);element.querySelectorAll(".ui-select-match").replaceWith(transcludedMatch);var transcludedChoices=transcluded.querySelectorAll(".ui-select-choices");if(transcludedChoices.removeAttr("ui-select-choices"),transcludedChoices.removeAttr("data-ui-select-choices"),1!==transcludedChoices.length)throw uiSelectMinErr("transcluded","Expected 1 .ui-select-choices but got '{0}'.",transcludedChoices.length);element.querySelectorAll(".ui-select-choices").replaceWith(transcludedChoices);var transcludedNoChoice=transcluded.querySelectorAll(".ui-select-no-choice");transcludedNoChoice.removeAttr("ui-select-no-choice"),transcludedNoChoice.removeAttr("data-ui-select-no-choice"),1==transcludedNoChoice.length&&element.querySelectorAll(".ui-select-no-choice").replaceWith(transcludedNoChoice)});var appendToBody=scope.$eval(attrs.appendToBody);(void 0!==appendToBody?appendToBody:uiSelectConfig.appendToBody)&&(scope.$watch("$select.open",function(isOpen){isOpen?positionDropdown():resetDropdown()}),scope.$on("$destroy",function(){resetDropdown()}));var placeholder=null,originalWidth="",dropdown=null;scope.$watch("$select.open",function(){"auto"!==$select.dropdownPosition&&"up"!==$select.dropdownPosition||scope.calculateDropdownPos()});var setDropdownPosUp=function(offset,offsetDropdown){offset=offset||uisOffset(element),offsetDropdown=offsetDropdown||uisOffset(dropdown),dropdown[0].style.position="absolute",dropdown[0].style.top=-1*offsetDropdown.height+"px",element.addClass("direction-up")},setDropdownPosDown=function(offset,offsetDropdown){element.removeClass("direction-up"),offset=offset||uisOffset(element),offsetDropdown=offsetDropdown||uisOffset(dropdown),dropdown[0].style.position="",dropdown[0].style.top=""},calculateDropdownPosAfterAnimation=function(){$timeout(function(){if("up"===$select.dropdownPosition)setDropdownPosUp();else{element.removeClass("direction-up");var offset=uisOffset(element),offsetDropdown=uisOffset(dropdown),scrollTop=$document[0].documentElement.scrollTop||$document[0].body.scrollTop;offset.top+offset.height+offsetDropdown.height>scrollTop+$document[0].documentElement.clientHeight?setDropdownPosUp(offset,offsetDropdown):setDropdownPosDown(offset,offsetDropdown)}dropdown[0].style.opacity=1})},opened=!1;scope.calculateDropdownPos=function(){if($select.open){if(dropdown=angular.element(element).querySelectorAll(".ui-select-dropdown"),0===dropdown.length)return;if(""!==$select.search||opened||(dropdown[0].style.opacity=0,opened=!0),!uisOffset(dropdown).height&&$select.$animate&&$select.$animate.on&&$select.$animate.enabled(dropdown)){var needsCalculated=!0;$select.$animate.on("enter",dropdown,function(elem,phase){"close"===phase&&needsCalculated&&(calculateDropdownPosAfterAnimation(),needsCalculated=!1)})}else calculateDropdownPosAfterAnimation()}else{if(null===dropdown||0===dropdown.length)return;dropdown[0].style.opacity=0,dropdown[0].style.position="",dropdown[0].style.top="",element.removeClass("direction-up")}}}}}}]),uis.directive("uiSelectMatch",["uiSelectConfig",function(uiSelectConfig){function getAttribute(elem,attribute){return elem[0].hasAttribute(attribute)?elem.attr(attribute):elem[0].hasAttribute("data-"+attribute)?elem.attr("data-"+attribute):elem[0].hasAttribute("x-"+attribute)?elem.attr("x-"+attribute):void 0}return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(tElement){tElement.addClass("ui-select-match");var parent=tElement.parent();return(getAttribute(parent,"theme")||uiSelectConfig.theme)+(angular.isDefined(getAttribute(parent,"multiple"))?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(scope,element,attrs,$select){function setAllowClear(allow){$select.allowClear=!!angular.isDefined(allow)&&(""===allow||"true"===allow.toLowerCase())}$select.lockChoiceExpression=attrs.uiLockChoice,attrs.$observe("placeholder",function(placeholder){$select.placeholder=void 0!==placeholder?placeholder:uiSelectConfig.placeholder}),attrs.$observe("allowClear",setAllowClear),setAllowClear(attrs.allowClear),$select.multiple&&$select.sizeSearchInput()}}}]),uis.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(uiSelectMinErr,$timeout){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function($scope,$timeout){var ngModel,ctrl=this,$select=$scope.$select;angular.isUndefined($select.selected)&&($select.selected=[]),$scope.$evalAsync(function(){ngModel=$scope.ngModel}),ctrl.activeMatchIndex=-1,ctrl.updateModel=function(){ngModel.$setViewValue(Date.now()),ctrl.refreshComponent()},ctrl.refreshComponent=function(){$select.refreshItems&&$select.refreshItems(),$select.sizeSearchInput&&$select.sizeSearchInput()},ctrl.removeChoice=function(index){if($select.isLocked(null,index))return!1;var removedChoice=$select.selected[index],locals={};return locals[$select.parserResult.itemName]=removedChoice,$select.selected.splice(index,1),ctrl.activeMatchIndex=-1,$select.sizeSearchInput(),$timeout(function(){$select.onRemoveCallback($scope,{$item:removedChoice,$model:$select.parserResult.modelMapper($scope,locals)})}),ctrl.updateModel(),!0},ctrl.getPlaceholder=function(){ if(!$select.selected||!$select.selected.length)return $select.placeholder}}],controllerAs:"$selectMultiple",link:function(scope,element,attrs,ctrls){function _getCaretPosition(el){return angular.isNumber(el.selectionStart)?el.selectionStart:el.value.length}function _handleMatchSelection(key){var caretPosition=_getCaretPosition($select.searchInput[0]),length=$select.selected.length,last=length-1,curr=$selectMultiple.activeMatchIndex,next=$selectMultiple.activeMatchIndex+1,prev=$selectMultiple.activeMatchIndex-1,newIndex=curr;return!(caretPosition>0||$select.search.length&&key==KEY.RIGHT)&&($select.close(),newIndex=function(){switch(key){case KEY.LEFT:return~$selectMultiple.activeMatchIndex?prev:last;case KEY.RIGHT:return~$selectMultiple.activeMatchIndex&&curr!==last?next:($select.activate(),!1);case KEY.BACKSPACE:return~$selectMultiple.activeMatchIndex?$selectMultiple.removeChoice(curr)?prev:curr:last;case KEY.DELETE:return!!~$selectMultiple.activeMatchIndex&&($selectMultiple.removeChoice($selectMultiple.activeMatchIndex),curr)}}(),$select.selected.length&&!1!==newIndex?$selectMultiple.activeMatchIndex=Math.min(last,Math.max(0,newIndex)):$selectMultiple.activeMatchIndex=-1,!0)}function _findCaseInsensitiveDupe(arr){return void 0!==arr&&void 0!==$select.search&&arr.filter(function(origItem){return void 0!==$select.search.toUpperCase()&&void 0!==origItem&&origItem.toUpperCase()===$select.search.toUpperCase()}).length>0}function _findApproxDupe(haystack,needle){var dupeIndex=-1;if(angular.isArray(haystack))for(var tempArr=angular.copy(haystack),i=0;i=0;j--)locals={},locals[$select.parserResult.itemName]=$select.selected[j],result=$select.parserResult.modelMapper(scope,locals),resultMultiple.unshift(result);return resultMultiple}),ngModel.$formatters.unshift(function(inputValue){var result,data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:""}}),locals={};if(!data)return inputValue;var resultMultiple=[],checkFnMultiple=function(list,value){if(list&&list.length){for(var p=list.length-1;p>=0;p--){if(locals[$select.parserResult.itemName]=list[p],result=$select.parserResult.modelMapper(scope,locals),$select.parserResult.trackByExp){var propsItemNameMatches=/(\w*)\./.exec($select.parserResult.trackByExp),matches=/\.([^\s]+)/.exec($select.parserResult.trackByExp);if(propsItemNameMatches&&propsItemNameMatches.length>0&&propsItemNameMatches[1]==$select.parserResult.itemName&&matches&&matches.length>0&&result[matches[1]]==value[matches[1]])return resultMultiple.unshift(list[p]),!0}if(angular.equals(result,value))return resultMultiple.unshift(list[p]),!0}return!1}};if(!inputValue)return resultMultiple;for(var k=inputValue.length-1;k>=0;k--)checkFnMultiple($select.selected,inputValue[k])||checkFnMultiple(data,inputValue[k])||resultMultiple.unshift(inputValue[k]);return resultMultiple}),scope.$watchCollection(function(){return ngModel.$modelValue},function(newValue,oldValue){oldValue!=newValue&&(angular.isDefined(ngModel.$modelValue)&&(ngModel.$modelValue=null),$selectMultiple.refreshComponent())}),ngModel.$render=function(){if(!angular.isArray(ngModel.$viewValue)){if(!isNil(ngModel.$viewValue))throw uiSelectMinErr("multiarr","Expected model value to be array but got '{0}'",ngModel.$viewValue);ngModel.$viewValue=[]}$select.selected=ngModel.$viewValue,$selectMultiple.refreshComponent(),scope.$evalAsync()},scope.$on("uis:select",function(event,item){if(!($select.selected.length>=$select.limit)){$select.selected.push(item);var locals={};locals[$select.parserResult.itemName]=item,$timeout(function(){$select.onSelectCallback(scope,{$item:item,$model:$select.parserResult.modelMapper(scope,locals)})}),$selectMultiple.updateModel()}}),scope.$on("uis:activate",function(){$selectMultiple.activeMatchIndex=-1}),scope.$watch("$select.disabled",function(newValue,oldValue){oldValue&&!newValue&&$select.sizeSearchInput()}),$select.searchInput.on("keydown",function(e){var key=e.which;scope.$apply(function(){var processed=!1;KEY.isHorizontalMovement(key)&&(processed=_handleMatchSelection(key)),processed&&key!=KEY.TAB&&(e.preventDefault(),e.stopPropagation())})}),$select.searchInput.on("keyup",function(e){if(KEY.isVerticalMovement(e.which)||scope.$evalAsync(function(){$select.activeIndex=!1===$select.taggingLabel?-1:0}),$select.tagging.isActivated&&$select.search.length>0){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||KEY.isVerticalMovement(e.which))return;if($select.activeIndex=!1===$select.taggingLabel?-1:0,!1===$select.taggingLabel)return;var newItem,item,tagItems,tagItem,items=angular.copy($select.items),stashArr=angular.copy($select.items),hasTag=!1,dupeIndex=-1;if(void 0!==$select.tagging.fct){if(tagItems=$select.$filter("filter")(items,{isTag:!0}),tagItems.length>0&&(tagItem=tagItems[0]),items.length>0&&tagItem&&(hasTag=!0,items=items.slice(1,items.length),stashArr=stashArr.slice(1,stashArr.length)),newItem=$select.tagging.fct($select.search),stashArr.some(function(origItem){return angular.equals(origItem,newItem)})||$select.selected.some(function(origItem){return angular.equals(origItem,newItem)}))return void scope.$evalAsync(function(){$select.activeIndex=0,$select.items=items});newItem&&(newItem.isTag=!0)}else{if(tagItems=$select.$filter("filter")(items,function(item){return item.match($select.taggingLabel)}),tagItems.length>0&&(tagItem=tagItems[0]),item=items[0],void 0!==item&&items.length>0&&tagItem&&(hasTag=!0,items=items.slice(1,items.length),stashArr=stashArr.slice(1,stashArr.length)),newItem=$select.search+" "+$select.taggingLabel,_findApproxDupe($select.selected,$select.search)>-1)return;if(_findCaseInsensitiveDupe(stashArr.concat($select.selected)))return void(hasTag&&(items=stashArr,scope.$evalAsync(function(){$select.activeIndex=0,$select.items=items})));if(_findCaseInsensitiveDupe(stashArr))return void(hasTag&&($select.items=stashArr.slice(1,stashArr.length)))}hasTag&&(dupeIndex=_findApproxDupe($select.selected,newItem)),dupeIndex>-1?items=items.slice(dupeIndex+1,items.length-1):(items=[],newItem&&items.push(newItem),items=items.concat(stashArr)),scope.$evalAsync(function(){if($select.activeIndex=0,$select.items=items,$select.isGrouped){var itemsWithoutTag=newItem?items.slice(1):items;$select.setItemsFn(itemsWithoutTag),newItem&&($select.items.unshift(newItem),$select.groups.unshift({name:"",items:[newItem],tagging:!0}))}})}}),$select.searchInput.on("blur",function(){$timeout(function(){$selectMultiple.activeMatchIndex=-1})})}}}]),uis.directive("uiSelectNoChoice",["uiSelectConfig",function(uiSelectConfig){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(tElement){return tElement.addClass("ui-select-no-choice"),(tElement.parent().attr("theme")||uiSelectConfig.theme)+"/no-choice.tpl.html"}}}]),uis.directive("uiSelectSingle",["$timeout","$compile",function($timeout,$compile){return{restrict:"EA",require:["^uiSelect","^ngModel"],link:function(scope,element,attrs,ctrls){var $select=ctrls[0],ngModel=ctrls[1];ngModel.$parsers.unshift(function(inputValue){if(isNil(inputValue))return inputValue;var locals={};return locals[$select.parserResult.itemName]=inputValue,$select.parserResult.modelMapper(scope,locals)}),ngModel.$formatters.unshift(function(inputValue){if(isNil(inputValue))return inputValue;var result,data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:""}}),locals={};if(data){var checkFnSingle=function(d){return locals[$select.parserResult.itemName]=d,(result=$select.parserResult.modelMapper(scope,locals))===inputValue};if($select.selected&&checkFnSingle($select.selected))return $select.selected;for(var i=data.length-1;i>=0;i--)if(checkFnSingle(data[i]))return data[i]}return inputValue}),scope.$watch("$select.selected",function(newValue){ngModel.$viewValue!==newValue&&ngModel.$setViewValue(newValue)}),ngModel.$render=function(){$select.selected=ngModel.$viewValue},scope.$on("uis:select",function(event,item){$select.selected=item;var locals={};locals[$select.parserResult.itemName]=item,$timeout(function(){$select.onSelectCallback(scope,{$item:item,$model:isNil(item)?item:$select.parserResult.modelMapper(scope,locals)})})}),scope.$on("uis:close",function(event,skipFocusser){$timeout(function(){$select.focusser.prop("disabled",!1),skipFocusser||$select.focusser[0].focus()},0,!1)}),scope.$on("uis:activate",function(){focusser.prop("disabled",!0)});var focusser=angular.element("");$compile(focusser)(scope),$select.focusser=focusser,$select.focusInput=focusser,element.parent().append(focusser),focusser.bind("focus",function(){scope.$evalAsync(function(){$select.focus=!0})}),focusser.bind("blur",function(){scope.$evalAsync(function(){$select.focus=!1})}),focusser.bind("keydown",function(e){if(e.which===KEY.BACKSPACE&&!1!==$select.backspaceReset)return e.preventDefault(),e.stopPropagation(),$select.select(void 0),void scope.$apply();e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||(e.which!=KEY.DOWN&&e.which!=KEY.UP&&e.which!=KEY.ENTER&&e.which!=KEY.SPACE||(e.preventDefault(),e.stopPropagation(),$select.activate()),scope.$digest())}),focusser.bind("keyup input",function(e){e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||e.which==KEY.ENTER||e.which===KEY.BACKSPACE||($select.activate(focusser.val()),focusser.val(""),scope.$digest())})}}}]),uis.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function($timeout,uiSelectConfig,uiSelectMinErr){return{require:["^^uiSelect","^ngModel"],link:function(scope,element,attrs,ctrls){if(null===scope[attrs.uiSelectSort])throw uiSelectMinErr("sort","Expected a list to sort");var $select=ctrls[0],$ngModel=ctrls[1],options=angular.extend({axis:"horizontal"},scope.$eval(attrs.uiSelectSortOptions)),axis=options.axis;scope.$watch(function(){return $select.sortable},function(newValue){newValue?element.attr("draggable",!0):element.removeAttr("draggable")}),element.on("dragstart",function(event){element.addClass("dragging"),(event.dataTransfer||event.originalEvent.dataTransfer).setData("text",scope.$index.toString())}),element.on("dragend",function(){removeClass("dragging")});var dropTimeout,move=function(from,to){this.splice(to,0,this.splice(from,1)[0])},removeClass=function(className){angular.forEach($select.$element.querySelectorAll("."+className),function(el){angular.element(el).removeClass(className)})},dragOverHandler=function(event){event.preventDefault(),("vertical"===axis?event.offsetY||event.layerY||(event.originalEvent?event.originalEvent.offsetY:0):event.offsetX||event.layerX||(event.originalEvent?event.originalEvent.offsetX:0))
  • '),$templateCache.put("bootstrap/match-multiple.tpl.html",' × '),$templateCache.put("bootstrap/match.tpl.html",'
    {{$select.placeholder}}
    '),$templateCache.put("bootstrap/no-choice.tpl.html",''),$templateCache.put("bootstrap/select-multiple.tpl.html",''),$templateCache.put("bootstrap/select.tpl.html",''),$templateCache.put("select2/choices.tpl.html",'
    '),$templateCache.put("select2/match-multiple.tpl.html",'
  • '),$templateCache.put("select2/match.tpl.html",'{{$select.placeholder}} '),$templateCache.put("select2/no-choice.tpl.html",''),$templateCache.put("select2/select-multiple.tpl.html",'
    '),$templateCache.put("select2/select.tpl.html",'
    '),$templateCache.put("selectize/choices.tpl.html",'
    '),$templateCache.put("selectize/match-multiple.tpl.html",'
    ×
    '),$templateCache.put("selectize/match.tpl.html",'
    {{$select.placeholder}}
    '),$templateCache.put("selectize/no-choice.tpl.html",'
    '),$templateCache.put("selectize/select-multiple.tpl.html",'
    '),$templateCache.put("selectize/select.tpl.html",'
    ')}])},{}],8:[function(require,module,exports){require("./dist/select.js"),module.exports="ui.select"},{"./dist/select.js":7}],9:[function(require,module,exports){angular.module("app.Constant",[]).constant("CONST",{APP_NAME:"Social Health Platform",APP_NAME_SHORT:"SHP",DEFAULT_TIMEZONE:"PST",DEV_MODE:!1,AD_CONFIG:{TENANT_ID:"microsoft.onmicrosoft.com",CLIENT_ID:"482514c8-43d4-4421-a58e-73771b9e9e4c"},MESSAGE_TYPES:{PostsVolumeSpikeDetected:"Posts volume spike detected",UniqueUserSessionsSpikeDetected:"Unique user sessions spike detected",PositiveVolumePostSpikeDetected:"Positive volume post spike detected",NegativeVolumePostSpikeDetected:"Negative volume post spike detected",ServicesMentionedSpikeDetected:"Services mentioned spike detected",InfluenceVolumeSpikeDetected:"Influence volume spike detected",ServiceOutageDetected:"Possible service outage issues",SupportExperienceIssuesDetected:"Support experience issues"},SERVICE_INFO:{ENDPOINT:"https://shpv2-uat.azurewebsites.net/WebServices/SHPDateUnlimitedDataService/",LOCAL_TEST_DATA:"/data/",TWITTER_SERVER_STATUS:"https://shpv2-dataslice.azurewebsites.net/WebServices/S3PDataService/GetJobStatus",OTHERS_SERVER_STATUS:"https://shpv2-rawdata-proccess.azurewebsites.net/WebServices/S3PDataService/GetJobStatus"},ALL_ENABLED_PLARFORMS:{twitter:"Twitter",so:"Stackoverflow",sf:"Serverfault",su:"Superuser",msdn:"MSDN",tn:"TechNet",lithium:"Lithium"},WS_STATUS:{0:"connecting",1:"online",2:"closing",3:"offline"},ERRORS:{1:"No Data Available",2:"Null",3:"N/A"}}),module.exports="app.Constant"},{}],10:[function(require,module,exports){moment=require("moment-timezone"),angular.module("app",[require("ui-select"),require("./controller"),require("./service"),require("./directive"),require("./filter"),require("./app.route.js"),require("./app.constants.js"),"duScroll","smart-table","toastr"]).config(function(toastrConfig){angular.extend(toastrConfig,{autoDismiss:!1,containerId:"toast-container",maxOpened:5,newestOnTop:!0,positionClass:"toast-bottom-right",preventDuplicates:!1,preventOpenDuplicates:!1,target:"body"})}).run(function($rootScope,$window,$state,$stateParams,$injector,adalAuthenticationService,utilitySrv,CONST,Notifications,$http){$rootScope.CONST=CONST,$rootScope.TZ=moment.tz(moment.tz.guess()).format("z"),$rootScope.Notifications=Notifications,$rootScope.service=$injector.get("rawdataSrv"),$rootScope.service.checkAdminAccessRights($rootScope.userInfo.userName).then(function(data){$rootScope.isAdmin=data}),$rootScope.$state=$state,$rootScope.$stateParams=$stateParams,$rootScope.global={topic:""},$rootScope.signOut=function(){adalAuthenticationService.logOut()},$rootScope.signIn=function(){adalAuthenticationService.login()};var timezoneOffset=60*(new Date).getTimezoneOffset()*1e3;$rootScope.timeRange={start:moment.utc().startOf("day").subtract(7,"days").valueOf(),end:moment.utc().startOf("day").subtract(1,"days").valueOf()},$rootScope.dateList=utilitySrv.getTimeRange($rootScope.timeRange.start,$rootScope.timeRange.end),$rootScope.startUTCDateLocalsString=utilitySrv.getDateTimeLocaleStringInMinute($rootScope.timeRange.start+timezoneOffset),$rootScope.endUTCDateLocalsString=utilitySrv.getDateTimeLocaleStringInMinute($rootScope.timeRange.end+timezoneOffset+864e5),$rootScope.startDateLocalsString=utilitySrv.getDateTimeLocaleStringInMinute($rootScope.timeRange.start),$rootScope.endDateLocalsString=utilitySrv.getDateTimeLocaleStringInMinute($rootScope.timeRange.end+864e5),window.history&&history.replaceState&&($rootScope.$on("duScrollspy:becameActive",function($event,$element,$target){var color=$element.find("div").attr("set-color");$($element.find("div")).addClass(color);for(var siblings=$element.parent().siblings(),labels=$(siblings).find("div.ui.label"),i=0;i
    ",controller:function($scope,$state,adalAuthenticationService){$scope.userInfo.isAuthenticated?$state.go("home.dashboard"):adalAuthenticationService.login()}}).state("home",{abstract:!0,url:"/home",template:""}).state("home.about",{url:"/about",templateUrl:"templates/home.html"}).state("home.dashboard",{url:"/dashboard",requireADLogin:!0,templateUrl:"templates/dashboard.html",controller:"homeCtrl"}).state("social",{abstract:!0,url:"/social",template:""}).state("social.platform",{url:"/:platform",requireADLogin:!0,templateUrl:"templates/social.html",controller:"socialCtrl"}).state("thirdParty",{abstract:!0,url:"/thirdParty",template:""}).state("thirdParty.platform",{url:"/:platform",requireADLogin:!0,templateUrl:"templates/social.html",controller:"socialCtrl"}).state("msPlatform",{abstract:!0,url:"/msPlatform",template:""}).state("msPlatform.platform",{url:"/:platform",requireADLogin:!0,templateUrl:"templates/social.html",controller:"socialCtrl"}).state("admin",{url:"/admin",requireADLogin:!0,controller:"adminCtrl",templateUrl:"templates/admin.html"}).state("notification",{url:"/notification",controller:"notificationCtrl",templateUrl:"templates/notification_center.html",requireADLogin:!0}).state("report",{url:"/report",templateUrl:"templates/report.html",requireADLogin:!1}),adalAuthenticationServiceProvider.init({tenant:CONST.AD_CONFIG.TENANT_ID,clientId:CONST.AD_CONFIG.CLIENT_ID,redirectUri:window.location.origin+"/frameRedirect.html",cacheLocation:"localStorage",anonymousEndpoints:["public/","templates/"]},$httpProvider)}).run(function($rootScope,$state,$injector,adalAuthenticationService){}),module.exports="app.Route"},{}],12:[function(require,module,exports){module.exports=function($scope,$rootScope,$window,$location,$state,$timeout,$http,$filter,toastr){function generateNewScopeObj(platform){var newScope={topic:$scope.newTopicName,topicsettings:{topic:$scope.newTopicName}};switch(platform){case"so":case"sf":case"su":case"lithium":case"twitter":newScope.topicsettings.Keywords=[];break;case"msdn":case"tn":newScope.topicsettings.Tags=[]}return newScope}$scope.isAdmin||$state.go("home.dashboard"),$scope.platforms=[],$scope.search={datasource:"all",messagetype:"all",topic:"all"};$(".tabular.menu .item").tab(),$(".vertical.menu .item").tab(),$(".ui.checkbox").checkbox(),$scope.getPlatforms=function(){$timeout(function(){$scope.platforms=["twitter","so","sf","su","msdn","tn"]},500)}(),$scope.getConfigData=function(){$scope.service.getPlatformSyncSetting().then(function(data){$scope.MsdnTopicMapping=data.MsdnTopicMapping,$scope.TopicWithForum=data.TopicWithForum,$scope.originData=angular.copy($scope.TopicWithForum)})},$scope.init=function(){$timeout(function(){},50),$scope.getConfigData()},$scope.renderDimmer=function(){$timeout(function(){$(".hover.dimmer").dimmer({on:"hover"})},0)},$scope.selectPlatform=function(index){$scope.selectedPlatformIndex=index;var p=$scope.TopicWithForum[index];$scope.selectedPlatform=p.platform_Name,$scope.selectTopic("")},$scope.isSelectedPlatform=function(platform){return $scope.selectedPlatform===platform},$scope.selectTopic=function(index){if($scope.filterTags="",$scope.selectedTopicIndex=index,Number.isInteger(index)){var t=$scope.TopicWithForum[$scope.selectedPlatformIndex].topics[index];$scope.selectedTopic=t.topic}else $scope.selectedTopic=void 0},$scope.isSelectedTopic=function(t){return $scope.selectedTopic===t},$scope.autoScale=function(e){console.log(e)},$scope.addKwd=function(event){console.log(event),event.stopPropagation();var currentTopic=$scope.TopicWithForum[$scope.selectedPlatformIndex].topics[$scope.selectedTopicIndex],array=currentTopic.topicsettings.Keywords,string=(event.target.value||event.target.previousElementSibling.value).trim();""!==string&&-1===array.indexOf(string)&&array.push(string),event.target.value=""},$scope.cancelUpdate=function(){var src=angular.copy($scope.originData),dist=$scope.TopicWithForum;Number.isInteger($scope.selectedTopicIndex)?angular.extend(dist[$scope.selectedPlatformIndex].topics[$scope.selectedTopicIndex],src[$scope.selectedPlatformIndex].topics[$scope.selectedTopicIndex]):angular.extend(dist[$scope.selectedPlatformIndex],src[$scope.selectedPlatformIndex])},$scope.approveUpdate=function(){$scope.originData=angular.copy($scope.TopicWithForum),$scope.service.saveForumServiceSetting({MsdnTopicMapping:$scope.MsdnTopicMapping,TopicWithForum:$scope.originData}).then(function(data){1==data?toastr.success("Success","Operation Success!"):toastr.error("Error","Operation Failed!")})},$scope.forumSelectChanged=function(index){if(null===index)$scope.TopicWithForum[$scope.selectedPlatformIndex].topics[$scope.selectedTopicIndex].topicsettings={};else{console.log(index);var tagCfg=$filter("findObjectInArray")(angular.copy($scope.MsdnTopicMapping),"topic",index);console.log(angular.copy(tagCfg)),$scope.TopicWithForum[$scope.selectedPlatformIndex].topics[$scope.selectedTopicIndex].topicsettings=angular.copy(tagCfg)}},$scope.isDirty=function(){return!angular.equals(angular.copy($scope.originData),angular.copy($scope.TopicWithForum))},$scope.removeTopic=function(index){$("#removeConfirmModal").modal({onDeny:function(){},onApprove:function(){$scope.TopicWithForum[$scope.selectedPlatformIndex].topics.splice(index,1),$scope.selectedTopic=void 0,$scope.$digest()}}).modal("show")},$scope.newScope=function(){var newScope={};$("#newServiceModal").modal({onDeny:function(){$scope.newTopicName=""},onApprove:function(){""===$scope.newTopicName.trim()||(newScope=generateNewScopeObj($scope.selectedPlatform),$scope.TopicWithForum[$scope.selectedPlatformIndex].topics.push(newScope),$scope.newTopicName="",$scope.$digest())}}).modal("show")},$scope.init(),$scope.getTopics=function(){$scope.service.getCate().then(function(data){$scope.enabledTopics=data;var multipleSelectedTopics=[];$.each(data,function(i,topic){!0===topic.isGA&&multipleSelectedTopics.push(topic.TechCategoryName)}),$scope.multipleSelectedTopics=multipleSelectedTopics})}(),$scope.listSubscriptions=function(platform,topic,msgtype,servicename){platform=platform||$scope.search.datasource,topic=topic||$scope.search.topic,msgtype=msgtype||$scope.search.messagetype,$scope.service.getSubscribeSettings(platform,topic,msgtype,servicename).then(function(data){var swap=data.reduce(function(array,item){var platform=item.Platform.trim(),topic=item.Topic.trim(),msgtype=item.MsgType.trim();if(array[item.GroupId]){var e=array[item.GroupId];e.Platforms.indexOf(platform)<0&&(e.Platforms.push(platform),e.PlatformsText.push($rootScope.CONST.ALL_ENABLED_PLARFORMS[platform]||platform)),e.Topics.indexOf(topic)<0&&(e.Topics.push(topic),e.TopicsText.push(topic)),e.MsgTypes.indexOf(msgtype)<0&&(e.MsgTypes.push(msgtype),e.MsgTypesText.push($rootScope.CONST.MESSAGE_TYPES[msgtype]||msgtype))}else array[item.GroupId]={GroupId:item.GroupId,EMail:item.EMail,Platforms:[platform],PlatformsText:[$rootScope.CONST.ALL_ENABLED_PLARFORMS[platform]||platform],Topics:[topic],TopicsText:[topic],MsgTypes:[msgtype],MsgTypesText:[$rootScope.CONST.MESSAGE_TYPES[msgtype]||msgtype],ServiceName:item.ServiceName,IsEnabled:item.IsEnabled};return array},{});$scope.subscriptions=Object.keys(swap).map(function(groupId){var e=swap[groupId];return{GroupId:e.GroupId,EMail:e.EMail,Platform:e.PlatformsText.join(", "),Topic:e.TopicsText.join(", "),MsgType:e.MsgTypesText.join(", "),PlatformArrayJson:JSON.stringify(e.Platforms),TopicArrayJson:JSON.stringify(e.Topics),MsgTypeArrayJson:JSON.stringify(e.MsgTypes),ServiceName:e.ServiceName,IsEnabled:e.IsEnabled}})})},$scope.listSubscriptions(),$scope.$watch("selectedPlatform",function(nv,ov){switch($scope.selectedPlatform){case"sf":case"su":case"so":$scope.tagsCfg="stackExchange";break;case"twitter":$scope.tagsCfg="twitter";break;case"msdn":case"tn":$scope.tagsCfg="msdn"}})}},{}],13:[function(require,module,exports){module.exports=function($scope,$rootScope,$window,$timeout,$http,$q,$sce,$compile,$document,$websocket,CONST,utilitySrv){function datetimeChanged(){var dtStart=dtpStart.value(),dtEnd=dtpEnd.value();dtStart&&dtpEnd.min(new Date(dtStart)),dtEnd&&dtpStart.max(new Date(dtEnd)),$scope.startGetData($rootScope.global.topic)}function listenServiceStatus(){try{$http.get(CONST.SERVICE_INFO.TWITTER_SERVER_STATUS).then(function(data){$scope.twitter_status=data.data})}catch(err){console.log("connection Error",err)}try{$http.get(CONST.SERVICE_INFO.OTHERS_SERVER_STATUS).then(function(data){$scope.others_status=data.data})}catch(err){console.log("connection Error",err)}}var today=24*parseInt((new Date).valueOf()/36e5/24)*36e5+6e4*(new Date).getTimezoneOffset(),start=new Date(today-6048e5),end=new Date(today-864e5),outset=new Date(today-2592e6),dtpStart=$("#DateTimePickerStart").kendoDatePicker({value:outset,format:localeDateFormatString,change:datetimeChanged,min:new Date(2017,0,1),max:end}).data("kendoDatePicker"),dtpEnd=$("#DateTimePickerEnd").kendoDatePicker({value:end,format:localeDateFormatString,change:datetimeChanged,min:start,max:end}).data("kendoDatePicker");$scope.query={granularity:3};$scope.flags={m:!1,g:!1,r:!1},$(".popup").popup(),$("#scrollspy .list .item .label").popup(),$(".ui.accordion").accordion({exclusive:!1,animateChildren:!1,selector:{trigger:".segment .title",content:".segment .content"},onOpen:function(){console.log($(this).find(".ui.segment.visible")),$(this).find(".ui.segment").removeClass("visible"),$(this).find("div.echart").map(function(index,currentObj,array){echarts.getInstanceByDom(currentObj).resize()})}}),$scope.isSelected=function(section){return $scope.selected===section},$scope.getTopics=function(){$scope.service.getCate().then(function(data){$scope.topics=data,$rootScope.global.topic&&$scope.startGetData($rootScope.global.topic)})}(),$scope.$on("data-got",function(event,arg){$scope.flags.m=!0,$(".tabular.menu .item").tab({onVisible:function(tab){console.log(tab);var chartDom=$('.ui.tab[data-tab="'+tab+'"]').find("div.echart").get(0);chartDom&&echarts.getInstanceByDom(chartDom).resize()}}),$("#progress").progress("increment"),$("#progress").progress("get value")===$scope.totalrequests&&$timeout(function(){$("#progress").hide()},1e3)}),$scope.startGetData=function(topic){$rootScope.global.topic=topic,$scope.flags.m=!1,$("div.echart").map(function(){echarts.getInstanceByDom(this).clear()}),$("#progress").progress("reset"),$("#progress").show();var dtStart=dtpStart.value(),dtEnd=dtpEnd.value();dtStart=dtStart.valueOf()-6e4*dtStart.getTimezoneOffset(),dtEnd=dtEnd.valueOf()-6e4*dtEnd.getTimezoneOffset(),$scope.query.start=dtStart,$scope.query.end=dtEnd;var offsetDays=(dtEnd-dtStart)/3600/24/1e3;$("#volumes > div.content > div:nth-child(2)").attr("class","ui "+(offsetDays<=30?"three":offsetDays<=60?"two":"one")+" column grid"),$scope.query.topic!==topic?($scope.enabledPlatforms=[],$scope.query.topic=topic,$timeout(function(){$scope.topics.forEach(function(item){item.TechCategoryName.toLowerCase()===topic.toLowerCase()&&item.Platforms.forEach(function(p){p.isEnabled&&$scope.enabledPlatforms.push(p.PlatformName)})}),$scope.totalrequests=8*$scope.enabledPlatforms.length+0,$("#progress").progress({total:$scope.totalrequests}),$scope.selected=$scope.enabledPlatforms[0],$scope.listNotification(5)},50)):($scope.$broadcast("start-get-data","home"),$scope.selected=$scope.enabledPlatforms[0])},$scope.listNotification=function(top){var date=Math.floor(moment.utc().add(-1,"days").startOf("day")/1e3);$scope.service.getSysDetections(void 0,void 0,$rootScope.global.topic,void 0,date).then(function(data){$scope.collections=data.splice(0,top)})},$scope.generateDownloadUrl=function(entity){var downloadTemplate='Download Data';return entity.hasDownload?$sce.trustAsHtml(downloadTemplate):"N/A"},$scope.showdetails=function(entity){var param={platform:entity.forumName,msgType:entity.msgType,topic:entity.topic,timestamp:entity.TimeStamp};$rootScope.popSubWin({fn:"getVoCDetailsBySpikeDetected",param:param})},$scope.finished=function(){$timeout(function(){$scope.$broadcast("start-get-data","home")},50)},listenServiceStatus(),$scope.getServiceStatus=function(){setInterval(listenServiceStatus,6e4)},$scope.getServiceStatus()}},{}],14:[function(require,module,exports){require("angular-sanitize");var app=angular.module("app.Ctrl",["720kb.datepicker","ngSanitize"]);app.controller("homeCtrl",require("./homeCtrl")),app.controller("socialCtrl",require("./socialCtrl")),app.controller("adminCtrl",require("./adminCtrl")),app.controller("notificationCtrl",require("./notificationCtrl")),module.exports="app.Ctrl"},{"./adminCtrl":12,"./homeCtrl":13,"./notificationCtrl":15,"./socialCtrl":16,"angular-sanitize":2}],15:[function(require,module,exports){module.exports=function($scope,$location,$timeout,$filter,$http,$sce,$rootScope,CONST){$scope.getTopic=function(){$scope.topic=$rootScope.global.topic,0===$scope.topic.length&&($scope.topic="all")}(),$scope.search={datasource:"all",topic:$scope.topic,messagetype:"all",bgTime:$filter("date")(function(d){return d.setDate(d.getDate()-1),d}(new Date),"yyyy-MM-dd"),egTime:$filter("date")(new Date,"yyyy-MM-dd"),downloadable:"all"},$scope.selectPlatform=function(platform){$scope.selectedPlatform=platform,$scope.$broadcast("admin-select-platform",platform)},$scope.collections=function(){return $scope.Notifications.collection.splice(0)}(),$scope.$watch("Notifications.collection",function(newV,oldV){if(newV.length){var notification=$scope.Notifications.collection.pop();"all"!==($scope.search.datasource||"all")&¬ification.forumName!==$scope.search.datasource||"all"!==($scope.search.topic||"all")&¬ification.topic!==$scope.search.topic||"all"!==($scope.search.messagetype||"all")&¬ification.msgType!==$scope.search.messagetype||"all"!==($scope.search.downloadable||"all")&¬ification.hasDownload!==(1===$scope.search.downloadable||-1!==$scope.search.downloadable&&null)||$scope.collections.push(notification)}},!0),$scope.getPlatforms=function(){$timeout(function(){$scope.platforms=CONST.ALL_ENABLED_PLARFORMS,$(".ui.fluid.dropdown").dropdown({}),$(".popup").popup()},50)}(),$scope.listNotification=function(){$("#nc-main").dimmer("show");var params=angular.copy($scope.search);params.bgTime=Math.floor(moment.utc(params.bgTime)/1e3),params.egTime=Math.floor(moment.utc(params.egTime).endOf("day")/1e3),$scope.service.getSysDetections(params.datasource,params.messagetype,params.topic,params.downloadable,params.bgTime,params.egTime).then(function(data){$("#nc-main").dimmer("hide"),$scope.collections=data})},$scope.listNotification(),$scope.generateDownloadUrl=function(entity){var downloadTemplate='Download Data';return entity.hasDownload?$sce.trustAsHtml(downloadTemplate):"N/A"},$scope.showdetails=function(entity){var param={platform:entity.forumName,msgType:entity.msgType,topic:entity.topic,timestamp:entity.TimeStamp};$rootScope.popSubWin({fn:"getVoCDetailsBySpikeDetected",param:param})},$scope.getTopics=function(){$scope.service.getCate().then(function(data){$scope.topics=data,$scope.resolveTopics()})},$scope.resolveTopics=function(){if("all"!=$scope.search.topic)if($scope.topics){for(var found=!1,i=0;i<$scope.topics.length;i++)if($scope.topics[i].TechCategoryName===$scope.search.topic){found=!0;break}!1===found&&($scope.search.topic="all")}else $scope.topics=[{TechCategoryName:$scope.search.topic,isGA:!0}]},$scope.getTopics(),$scope.resolveTopics()}},{}],16:[function(require,module,exports){module.exports=function($scope,$rootScope,$window,$timeout,$filter,$document,$location,utilitySrv,toastr){function getStatistic(){$("#summary div.content").dimmer("show"),$scope.service.getImpactSummary($scope.$stateParams.platform,$scope.topic,"all",$scope.query).then(function(data){data.vocinsights.objectcountthistime;$scope.serviceStatus="gery",$scope.statistic=data,$("#summary div.content").dimmer("hide"),$scope.$broadcast("data-got")})}function getUserDistribution(){$scope.service.getRegionDistribution($scope.$stateParams.platform,$scope.topic,"all",$scope.query).then(function(data){$scope.languageDistribution=$filter("orderBy")(data,"-uniqueusers")})}function getMentionedServiceTable(){$scope.service.getMentionedMostServiceList($scope.$stateParams.platform,$scope.topic,"all",$scope.query).then(function(data){$scope.mostMentionedService=data,$scope.$broadcast("data-got")})}function CheckDateRangeSize(){var diff=($scope.query.end-$scope.query.start)/1e3/3600/24;$scope.isLargeDateRange=diff>7,$timeout(function(){$scope.startGetData(),$scope.isLargeDateRange&&$(".large-date-range").find("div.echart").map(function(index,currentObj,array){echarts.getInstanceByDom(currentObj).resize()}),$scope.$apply()},0)}function RefreshCharts(){$timeout(function(){$scope.startGetData(),$(".large-date-range").find("div.echart").map(function(index,currentObj,array){echarts.getInstanceByDom(currentObj).resize()}),$scope.$apply()},0)}$scope.platform=$scope.$stateParams.platform.toLowerCase(),$scope.order=$filter("orderBy"),$scope.query={},$scope.path=$location.path().split("/"),$scope.dateRange="7",$scope.isLargeDateRange=!1,$scope.commonTrendTitle="Hourly Trend During a Week",$scope.popInfoScope="Hourly";var totalrequests=0,settings={};settings.timezoneOffset=6e4*(new Date).getTimezoneOffset(),settings.now=36e5*parseInt((new Date).valueOf()/36e5),settings.today=24*parseInt(settings.now/36e5/24)*36e5,settings.start=settings.today-6048e5,settings.end=settings.today-864e5,$scope.query.granularity=3,$scope.query.start=settings.start,$scope.query.end=settings.end;var dailyContainer=$($("#topic_select > div:nth-child(1) > div:nth-child(2) > span.daterange")[0]),hourlyContainer=$($("#topic_select > div:nth-child(1) > div:nth-child(2) > span.daterange")[1]);dailyContainer.children("input:nth-child(2)").attr("max",new Date(settings.end).toISOString()),hourlyContainer.children("input:nth-child(2)").attr("max",new Date(settings.now-36e5+settings.timezoneOffset).toISOString());var selectedDateRange=kendo.observable({granularity:$scope.query.granularity,start:new Date($scope.query.start+settings.timezoneOffset),end:new Date($scope.query.end+settings.timezoneOffset),granularities:[{text:"Daily",value:3},{text:"Hourly",value:2}],visibleDateTimePicker:function(){return 2===this.get("granularity")},visibleDatePicker:function(){return 2!==this.get("granularity")}});switch(selectedDateRange.bind("change",function(e){if("granularity"===e.field){var granularity=this.get("granularity");if($scope.query.granularity=granularity,3===granularity){var start=this.get("start"),end=this.get("end");start>settings.end&&this.set("start",new Date(settings.start+settings.timezoneOffset)),end>settings.end&&this.set("end",new Date(settings.end+settings.timezoneOffset))}$scope.startGetData()}else if("start"===e.field){var start=this.get("start").valueOf()-settings.timezoneOffset;$scope.query.start=start,CheckDateRangeSize()}else if("end"===e.field){var end=this.get("end").valueOf()-settings.timezoneOffset;$scope.query.end=end,CheckDateRangeSize()}}),kendo.bind($("#topic_select > div:nth-child(1) > div:nth-child(2)"),selectedDateRange),$scope.platform){case"twitter":totalrequests=14;break;default:totalrequests=15}$("#progress").progress({total:totalrequests}),$(".ui.accordion").accordion({exclusive:!1,animateChildren:!1,selector:{trigger:".segment .title",content:".segment"},onOpen:function(){$(this).find("div.echart").map(function(index,currentObj,array){echarts.getInstanceByDom(currentObj).resize()})}}),$("#server_status").popup({inline:!0,hoverable:!0,position:"bottom left"}),$scope.flags={m:!1,g:!1,r:!1},$scope.$watch("topic",function(nv,ov){nv&&$scope.startGetData()}),$scope.$watch("dateRange",function(newV,oldV){$scope.dateRange=newV,"7"!==newV?($scope.isLargeDateRange=!0,$scope.popInfoScope="Daily"):($scope.isLargeDateRange=!1,$scope.popInfoScope="Hourly"),$scope.commonTrendTitle="Daily Trend In Last "+newV+" Days";var timeRange={start:moment.utc().startOf("day").subtract(newV,"days").valueOf(),end:moment.utc().startOf("day").subtract(1,"days").valueOf()},timezoneOffset=60*(new Date).getTimezoneOffset()*1e3;$scope.dateList=utilitySrv.getTimeRange(timeRange.start,timeRange.end),$scope.startUTCDateLocalsString=utilitySrv.getDateTimeLocaleStringInMinute(timeRange.start+timezoneOffset),$scope.endUTCDateLocalsString=utilitySrv.getDateTimeLocaleStringInMinute(timeRange.end+timezoneOffset+864e5),$scope.startDateLocalsString=utilitySrv.getDateTimeLocaleStringInMinute(timeRange.start),$scope.endDateLocalsString=utilitySrv.getDateTimeLocaleStringInMinute(timeRange.end+864e5),RefreshCharts()}),$("#scrollspy .list .item .label").popup(),$("#topic_select").dimmer("show"),$scope.getTopics=function(){$scope.service.getCate($scope.$stateParams.platform).then(function(data){$scope.topics=[],data.map(function(item){var flage=!1;item.Platforms.map(function(obj){obj.PlatformName.toLowerCase()==$scope.$stateParams.platform&&(flage=obj.isEnabled)}),flage&&$scope.topics.push(item.TechCategoryName)}),$("#topic_select").dimmer("hide"),-1!==$scope.topics.indexOf($rootScope.global.topic)&&($scope.topic=$rootScope.global.topic,$scope.startGetData())})},$timeout(function(){$scope.getTopics()},0),$scope.$on("data-got",function(event,arg){$scope.flags.m=!0,$("#progress").progress("increment"),$("#progress").progress("get value")===totalrequests&&$timeout(function(){$("#progress").hide()},1e3)}),$scope.startGetData=function(){if(!$scope.topic)return!1;$rootScope.global.topic=$scope.topic,$scope.flags.m=!1,$("div.echart").map(function(){echarts.getInstanceByDom(this).clear()}),$("#progress").progress("reset"),$("#progress").show(),$scope.query.topic=$scope.topic,getStatistic(),getUserDistribution(),getMentionedServiceTable(),$scope.$broadcast("start-get-data","home")},$scope.getDownloadUrl=function(){return $scope.$stateParams.platform?$scope.topic?$scope.dateRange?void $scope.service.getDownloadUrl($scope.$stateParams.platform,$scope.topic,$scope.dateRange).then(function(url){window.open(url)}):(toastr.error("Date Range Required"),!1):(toastr.error("Topic Select Required"),!1):(toastr.error("Platform Required"),!1)}}},{}],17:[function(require,module,exports){module.exports=function(){return{restrict:"E",templateUrl:"public/template/adminCard.html?time="+(new Date).getTime(),replace:!0,transclude:!0,link:function(scope,e,a){console.log(scope.CONST.APP_NAME)},controller:function($scope){this.selectPlatform=$scope.selectPlatform}}}},{}],18:[function(require,module,exports){function initChart(echartObj,chartOpt,groupName){setTimeout(function(){echartObj.resize(),echartObj.setOption(chartOpt),groupName&&(echartObj.group=groupName)},100)}function afterInit(rootscope,scope,echartObj){scope.complete=!0,"getMentionedMostServiceList"!==scope.apiFn&&"getKeywordsMentionedMostMapping"!==scope.apiFn&&setTimeout(function(){echartObj.resize()},150),scope.group&&echarts.connect(scope.group),rootscope.$broadcast("data-got",echartObj)}function customInfluenceData(fnPromise,scope){var influenceSeries=function(raw){var influenceData=raw.map(function(item){return item.vocinfluence.voctotalvol}),influencePOSIData=raw.map(function(item){return item.vocinfluence.positiveinfluencedvol}),influenceNEGData=raw.map(function(item){return item.vocinfluence.negativeinfluencedvol}),seriesData=[];switch(scope.pnscope){case"posi":seriesData=influencePOSIData;break;case"neg":seriesData=influenceNEGData;break;default:seriesData=influenceData}return{yAxis:{axisLabel:{formatter:function(value){return scope.thousandsuffix(value,1)}}},xAxis:{data:scope.$root.dateList.map(function(dt){return moment(dt).utc().format("L")})},series:[{name:"Influence Vol",type:"line",data:seriesData}]}},fn=influenceSeries;return fnPromise.then(function(data){return scope.validData(data),fn(data)})}function customSpikesData(fnPromise,scope,utilitySrv){var xAxis={data:utilitySrv.getTimeRange(scope.query.start,scope.query.end).map(function(dt){return moment(dt).utc().format("L")})},seriesVolume=function(source){var volumes=source.map(function(entity){return entity.dailytotalvol});return{xAxis:xAxis,series:[{name:"VoC",type:"bar",data:volumes}]}},seriesSpike=function(source){var spikes=source.map(function(entity){return entity.dailyspikevol});return{xAxis:xAxis,series:[{name:"Spikes",type:"bar",data:spikes}]}},seriesVolumeSpike=function(source){var volumes=source.map(function(entity){return entity.dailytotalvol}),spikes=source.map(function(entity){return entity.dailyspikevol});return{xAxis:xAxis,yAxis:[{name:"VoC",type:"value",nameTextStyle:{color:"#2EC7C9"}},{name:"Spike",type:"value",nameTextStyle:{color:"#BAA7E0"}}],series:[{name:"VoC",type:"bar",data:volumes},{name:"Spikes",type:"line",yAxisIndex:1,data:spikes}]}};return fnPromise.then(function(data){switch(scope.validData(data),scope.type){case"volume":return seriesVolume(data);case"spike":return seriesSpike(data);default:return seriesVolumeSpike(data)}})}function customDistributionData(fnPromise,scope){return fnPromise.then(function(data){return scope.validData(data),{series:[{data:[{value:data.positivetotalvol,name:"POS"},{value:data.neutraltotalvol,name:"NEU"},{value:data.negativetotalvol,name:"NEG"}]}]}})}function customWordCloudData(fnPromise,scope){var pnscope=scope.pnscope;return fnPromise.then(function(data){return scope.validData(data),{series:{data:data.map(function(item){switch(pnscope){case"posi":var value=item.vocinfluence.positivetotalvol;break;case"neg":var value=item.vocinfluence.negativetotalvol;break;default:var value=item.vocinfluence.voctotalvol}if(!value)return!1;var tmp={name:item.attachedobject};return tmp.value=value,tmp})}}})}function customServicesDistributionData(fnPromise,scope){var propertySelect=scope.propertySelect;return fnPromise.then(function(data){scope.validData(data);var seriesData=data.map(function(item){var tmp={name:item.attachedobject,url:item.url};switch(propertySelect){case"messages":var value=item.vocinfluence.voctotalvol;break;case"users":var value=item.vocinfluence.uniqueusers;break;default:var value=item.vocinfluence.voctotalvol}return tmp.value=value,tmp});seriesData=scope.order(seriesData,"-value");for(var tops=seriesData.slice(0,10),rest=seriesData.slice(10),sum=0,total=0,i=0;i11){var other={name:"Others",value:sum};tops.push(other)}seriesData=tops;var toolbox=null;return"all"!==scope.platform&&(toolbox={feature:{myTool1:{show:!0,title:"Switch to Details List",icon:"path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891",onclick:function(){scope.swithside()}}},show:!0}),{series:[{data:seriesData}],toolbox:toolbox}})}function customHoriBarData(scope){return{yAxis:{axisLabel:{interval:0,inside:!0},z:10,data:Object.keys(scope.raw)},series:[{name:scope.pnscope+" Vol",type:"bar",itemStyle:{normal:{color:"#ffb980"}},data:Object.keys(scope.raw).map(function(key){return scope.raw[key]})}]}}function customWorldData(fnPromise,scope){var propertySelect=scope.propertySelect;return fnPromise.then(function(data){scope.validData(data);var seriesData=data.map(function(item){var tmp={name:item.name};switch(propertySelect){case"positive":var value=item.positivetotalvol;break;case"negative":var value=item.negativetotalvol;break;case"users":var value=item.uniqueusers}return tmp.url=item.url,tmp.value=value,tmp});return scope.$root.$broadcast("set-region-table-data",{data:seriesData,association:scope.association}),{toolbox:{feature:{myTool1:{show:!0,title:"Switch to Others List",icon:"path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891",onclick:function(){scope.swithside()}}},show:"true"!==scope.noSwap},series:[{name:scope.title,type:"map",mapType:"world",roam:!0,itemStyle:{emphasis:{label:{show:!0}}},data:seriesData}]}})}function customRegionData(fnPromise,scope){var xData=[];return fnPromise.then(function(data){scope.validData(data);var seriesData=data.map(function(item){return xData.push(item.name),item.uniqueusers});return{dataZoom:[{show:!0,realtime:!0,start:0,end:100}],xAxis:{data:xData},series:[{name:"Volume",type:"bar",data:seriesData}]}})}function stackAxisData(fnPromise,utility,scope){var seriesData={undif:[],posi:[],neg:[],neu:[]},xAxisDate=[];return fnPromise.then(function(data){scope.validData(data);var timeFormatType="7"===scope.days?"hourly":"daily";return data.map(function(item){xAxisDate.push(utility.timeToString(item.attachedobject.timeslot,timeFormatType));var entity={value:item.vocinfluence.undefinedtotalvol,symbolSize:4};seriesData.undif.push(entity);var entity={value:item.vocinfluence.positivetotalvol,symbolSize:4};seriesData.posi.push(entity);var entity={value:item.vocinfluence.negativetotalvol,symbolSize:4};seriesData.neg.push(entity);var entity={value:item.vocinfluence.neutraltotalvol,symbolSize:4};seriesData.neu.push(entity)}),{legend:{data:["Undefined","Positive","Negative","Neutral"]},series:[{name:"Undefined",type:"line",showAllSymbol:!0,areaStyle:{normal:{}},data:seriesData.undif},{name:"Positive",type:"line",showAllSymbol:!0,areaStyle:{normal:{}},data:seriesData.posi},{name:"Negative",type:"line",showAllSymbol:!0,areaStyle:{normal:{}},data:seriesData.neg},{name:"Neutral",type:"line",showAllSymbol:!0,areaStyle:{normal:{}},data:seriesData.neu}],xAxis:{type:"category",boundaryGap:!1,axisLine:{onZero:!1},data:xAxisDate}}})}function barNegativeData(fnPromise,scope){return fnPromise.then(function(data){scope.validData(data);var usedData=scope.order(data,"-(vocinfluence.positivetotalvol+vocinfluence.negativetotalvol)").splice(0,10),likeData=[],dislikeData=[],yAxisData=[];return usedData.map(function(item){yAxisData.push(item.attachedobject),likeData.push(item.vocinfluence.positivetotalvol),dislikeData.push(-1*item.vocinfluence.negativetotalvol)}),{xAxis:[{type:"value"}],yAxis:{type:"category",axisTick:{show:!1},axisLabel:{interval:0},data:yAxisData,z:10},grid:{top:30,left:20,right:20,bottom:0,containLabel:!0},series:[{name:"Like",type:"bar",stack:"volume",areaStyle:{normal:{}},data:likeData},{name:"Dislike",type:"bar",stack:"volume",itemStyle:{normal:{color:"#ffb980"}},areaStyle:{normal:{show:!0,position:"left"}},data:dislikeData}]}})}function sentimentconversionData(fnPromise,utility,scope){var seriesData={totalVol:[],initPostive:[],afterSptPostive:[],initNegative:[],afterSptNegative:[]},xAxisDate=[];return fnPromise.then(function(data){return scope.validData(data),data.map(function(item){xAxisDate.push(utility.timeToString(item.SclingTime,"daily")), -seriesData.totalVol.push(item.TotalVolume),seriesData.initPostive.push(item.InitialPostiveVolume),seriesData.afterSptPostive.push(item.AfterSupportPostiveVolume),seriesData.initNegative.push(item.InitialNegtiveVolume),seriesData.afterSptNegative.push(item.AfterSupportNegtiveVolume)}),{yAxis:[{type:"value"}],xAxis:[{type:"category",data:xAxisDate}],legend:{data:["Init Negative Volume","After Support Negative Volume"],show:!0},series:[{name:"Init Negative Volume",type:"line",areaStyle:{normal:{}},label:{normal:{show:!0}},data:seriesData.initNegative},{name:"After Support Negative Volume",type:"line",areaStyle:{normal:{}},label:{normal:{show:!0}},data:seriesData.afterSptNegative}]}})}function customHourlyData(fnPromise,key,utility,scope){var seriesData=[],xAxisDate=[],timeFormatType="7"===scope.days?"hourly":"daily";return fnPromise.then(function(data){return scope.validData(data),data.map(function(item){if(xAxisDate.push(utility.timeToString(item.attachedobject.timeslot,timeFormatType)),item.attachedobject.isspike)var entity={value:item.vocinfluence[key],symbol:"pin",symbolSize:20,label:{normal:{show:!0}}};else var entity={value:item.vocinfluence[key],symbolSize:4};seriesData.push(entity)}),{series:[{name:"Vol",type:"line",showAllSymbol:!0,data:seriesData,label:{normal:{formatter:function(params){return scope.thousandsuffix(params.value)}}}}],xAxis:{type:"category",boundaryGap:!1,axisLine:{onZero:!1},data:xAxisDate}}})}function initAxisChartOpt(scope){return{title:{textStyle:{fontSize:13}},tooltip:{trigger:"axis"},toolbox:{show:!1,trigger:"axis",feature:{saveAsImage:{show:!0,title:"Save as Image"}}},xAxis:{type:"category",data:[]},yAxis:[{type:"value",axisLabel:{formatter:"{value}"}}],series:[]}}function initHoriChartOpt(scope){return{title:{textStyle:{fontSize:13}},tooltip:{trigger:"axis"},grid:{left:"5%"},toolbox:{show:!1,trigger:"axis",feature:{saveAsImage:{show:!0,title:"Save as Image"}}},xAxis:{type:"value",axisLabel:{formatter:function(value){return scope.thousandsuffix(value,1)}}},yAxis:{type:"category",data:[]},series:[]}}function initPieChartOpt(scope){var opt={title:{textStyle:{fontSize:13}},grid:{bottom:0},tooltip:{trigger:"item",formatter:"{b} : {c} ({d}%)"},legend:{show:!0,orient:"horizontal",x:"center",y:"top",data:[]},toolbox:{feature:{myTool1:{show:!0,title:"Switch to Others List",icon:"path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891",onclick:function(){scope.swithside()}}},show:!0},series:[{name:"Tech Scope Distribution",type:"pie",radius:[0,"40%"],label:{normal:{label:{show:!0},labelLine:{show:!0},formatter:"{b}\n ({d}%)"}},data:[]}]};return"true"===scope.noSwap&&(opt.toolbox.show=!1),opt}function initCloudWordChartOpt(scope){return{title:{textStyle:{fontSize:13},x:"center"},tooltip:{trigger:"item",formatter:"{b} : {c}"},series:{type:"wordCloud",gridSize:0,sizeRange:[10,20],shape:"circle",width:"100%",height:"100%",textStyle:{normal:{color:function(){return"rgb("+[Math.round(160*Math.random()),Math.round(160*Math.random()),Math.round(160*Math.random())].join(",")+")"}},emphasis:{shadowBlur:10,shadowColor:"#333"}},data:[]}}}function initHourlyChartOpt(scope){return{title:{textStyle:{fontSize:13}},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},toolbox:{show:!1,trigger:"axis",feature:{saveAsImage:{show:!0,title:"Save as Image"}}},dataZoom:[{show:!0,realtime:!0,start:0,end:100},{type:"inside",realtime:!0,start:0,end:100}],xAxis:{data:[]},yAxis:{},series:[]}}function initWorldChartOpt(scope){return{title:{textStyle:{fontSize:13}},tooltip:{trigger:"item"},toolbox:{show:!1,trigger:"axis",feature:{saveAsImage:{show:!0,title:"Save as Image"}}},visualMap:{min:0,inRange:{color:["lightskyblue","yellow","orangered"]}},series:[]}}function isEmpty(obj){if(null==obj)return!0;if(obj.length>0)return!1;if(0===obj.length)return!0;if("object"!=typeof obj)return!0;for(var key in obj)if(hasOwnProperty.call(obj,key))return!1;return!0}module.exports=function($rootScope,$filter,$q,$location,$compile,$timeout,utilitySrv){return{restrict:"E",templateUrl:"public/template/chart.html?time="+(new Date).getTime(),replace:!0,scope:{title:"@",type:"@",platform:"@",pnscope:"@",propertySelect:"@",days:"@",apiFn:"@",subFn:"@",group:"@",query:"=",noPop:"@",association:"@",swithTool:"@",noSwap:"@",stack:"@",info:"@"},link:function(scope,element,attrs){var _=scope,echartDom=$(element).find("div.echart");_.service=$rootScope.service,_.complete=!1,_.query=_.query||{},_.thousandsuffix=$filter("thousandsuffix"),_.compile=function(chart,dom){var el=$compile(chart)(_.$parent);$(dom).append(el)},_.swithside=function(){$(element).parent().parent().parent().shape("flip up")},_.initChartOpt=function(){switch(_.type){case"pie":_.chartOpt=initPieChartOpt(_);break;case"hori":_.chartOpt=initHoriChartOpt(_);break;case"wordcloud":_.chartOpt=initCloudWordChartOpt(_);break;case"hourly":_.chartOpt=initHourlyChartOpt(_);break;case"world":_.chartOpt=initWorldChartOpt(_);break;default:_.chartOpt=initAxisChartOpt(_)}}(),_.chartObj=echarts.init(echartDom[0],"macarons"),_.chartObj.on("click",function(params){if(0!==params.value)if(void 0===attrs.noPop)switch(_.subFn){case"getVoCDetailsByDate":var param={platform:_.platform,topic:_.query.topic,pnscope:_.pnscope,date:Math.floor(moment.utc(params.name,"L")/1e3),granularity:_.query.granularity};$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getVoCDetailsByPN":var pnscope=params.name.toLowerCase();"pos"==pnscope&&(pnscope="posi");var param={platform:_.platform,topic:_.query.topic,pnscope:pnscope,granularity:_.query.granularity,start:_.query.start,end:_.query.end};$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getVoCDetailsByServiceName":var param={platform:_.platform,topic:_.query.topic,service:params.name,pnscope:_.pnscope,granularity:_.query.granularity,start:_.query.start,end:_.query.end};"Others"===params.name?_.swithside():$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getVoCDetailsByUser":var param={platform:_.platform,topic:_.query.topic,user:params.name,pnscope:_.pnscope,granularity:_.query.granularity,start:_.query.start,end:_.query.end};$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getVoCDetailsByCountry":var pnscope=_.pnscope;pnscope="positive"==pnscope?"posi":"negative"==pnscope?"neg":"neutral"==pnscope?"neu":null;var param={platform:_.platform,topic:_.query.topic,pnscope:pnscope,country:params.name.toLowerCase(),days:_.days};console.log(param),$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getSubPageVoCDetails":var date="7"===_.days?moment(params.name).utc():moment.utc(params.name),param={platform:_.platform,topic:_.query.topic,date:Math.floor(date/1e3),pnscope:_.pnscope,days:_.days};$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getSubPageVoCDetailsbyKeywords":var param={platform:_.platform,topic:_.query.topic,keywords:params.name,pnscope:_.pnscope,days:_.days};$rootScope.popSubWin({fn:_.subFn,param:param})}else if(attrs.redirect){var path="/";switch(params.name){case"twitter":path="/social/"+params.name;break;case"so":case"sf":case"su":path="/thirdParty/"+params.name;break;case"msdn":case"tn":path="/msPlatform/"+params.name}scope.$apply(function(){$location.path(path)})}}),_.getData=function(location){if(attrs.location===location){_.complete=!1;var apiFn=_.service[_.apiFn];switch(_.apiFn){case"getSpikes":var fnPromise=apiFn(_.platform,_.query.topic,_.query);customSpikesData(fnPromise,_,utilitySrv).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getInfluence":if(_.platform){var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query);customInfluenceData(fnPromise,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)})}else{_.platforms=_.$parent.enabledPlatforms,_.raw={},_.platforms.forEach(function(element){_.raw[element]=0},this);var fnPromises=_.platforms.map(function(item){return apiFn(item,_.query.topic,_.pnscope,{granularity:3,start:_.query.start,end:_.query.end}).then(function(data){var seriesData=data.map(function(raw){switch(_.pnscope){case"posi":var value=raw.vocinfluence.positiveinfluencedvol;break;case"neg":var value=raw.vocinfluence.negativeinfluencedvol;break;case"neu":var value=raw.vocinfluence.neutralinfluencedvol;break;case"undif":var value=raw.vocinfluence.undefinedinfluencedvol;break;default:var value=raw.vocinfluence.vocinfluencedvol}return value});_.raw[item]=seriesData.reduce(function(previousValue,currentValue,currentIndex,array){return previousValue+currentValue},0),_.hasData=!0})});$q.all(fnPromises).then(function(){var config=customHoriBarData(_);_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)})}break;case"getDistribution":var fnPromise=apiFn(_.platform,_.query.topic,_.query);customDistributionData(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getMentionedMostServiceList":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customWordCloudData;fn(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getMentionedMostServiceListByUserVol":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query);_.order=$filter("orderBy");var fn=customServicesDistributionData;switch(_.type){case"pie":fn=customServicesDistributionData;break;case"wordcloud":fn=customWordCloudData}fn(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getMentionedMostServiceDistribution":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query);_.order=$filter("orderBy");var fn=customServicesDistributionData;"hori"===_.type&&(fn=barNegativeData),fn(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getKeywordsMentionedMostMapping":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customWordCloudData;fn(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getUserVolSpikes":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customHourlyData;fn(fnPromise,"uniqueusers",utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getMessageVolSpikes":console.log(_);var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customHourlyData,key="";switch(_.pnscope){case"posi":key="positivetotalvol";break;case"neg":key="negativetotalvol";break;default:key="voctotalvol"}fn(fnPromise,key,utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getStackMessageVol":var fnPromise=_.service.getMessageVolSpikes(_.platform,_.query.topic,_.pnscope,_.query),fn=stackAxisData;fn(fnPromise,utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getInfluenceVolSpikes":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customHourlyData;fn(fnPromise,"vocinfluencedvol",utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getUserRegionVolSpikes":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customHourlyData;fn(fnPromise,"uniqueuserregion",utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getRegionDistribution":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query);if("world"===_.type)var fn=customWorldData;else var fn=customRegionData;_.hasData=!0,fn(fnPromise,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getVoCDetailsByServiceName1":var fnPromise=$q.resolve(!0),fn=barNegativeData;_.hasData=!0,fn(fnPromise,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"sentimentconversion":var fnPromise=_.service.getSentimentTrend(_.platform,_.query.topic,_.pnscope,_.days),fn=sentimentconversionData;fn(fnPromise,utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)})}}},_.$on("start-get-data",function(event,arg){_.complete=!1,_.getData(arg)}),_.$on("fresh-most-mentioned",function(evt,arg){if(("getMentionedMostServiceList"===_.apiFn||"getMentionedMostServiceListByUserVol"===_.apiFn)&&"home"===attrs.location){var apiFn=_.service[_.apiFn];if(arg.pnscope===_.pnscope){_.platform=arg.platform?arg.platform:_.platform,_.pnscope=arg.pnscope?arg.pnscope:_.pnscope,_.topic=arg.topic?arg.topic:_.topic;var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customWordCloudData;_.chartOpt=initCloudWordChartOpt(_),fn(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config);var clientWidth=element.parents(".sides").width();element.find(".echart").width(clientWidth),_.chartObj.setOption(_.chartOpt)})}}}),_.$on("set-sub-widows-charts-data",function(evt,arg){if("sub"===attrs.location){var config={};switch(_.type){case"pie":var raw=arg.data;_.validData(raw),config={series:[{data:[{value:raw.vocpositivecount,name:"POS"},{value:raw.vocneutralcount,name:"NEU"},{value:raw.vocnegativecount,name:"NEG"}]}]},_.chartOpt=angular.merge(_.chartOpt,config);break;case"wordcloud":for(var raw=arg.data.vocmentionedmost,seriesData=[],i=0;i
    {{ title }}
    ',link:function(scope,element,attrs,DropDownController){scope.dropdown_class="ui selection dropdown",scope.menu_class="menu transition hidden",scope.text_class="default text",scope.original_title=scope.title,"true"===scope.open?(scope.is_open=!0,scope.dropdown_class=scope.dropdown_class+" active visible",scope.menu_class=scope.menu_class+" visible"):scope.is_open=!1,scope.element=element,scope.$watch("model",function(value){DropDownController.update_title(value)}),element.bind("click",function(){!1===scope.is_open?scope.$apply(function(){scope.dropdown_class="ui selection dropdown active visible",scope.menu_class="menu transition visible"}):scope.$apply(function(){scope.dropdown_class="ui selection dropdown",scope.menu_class="menu transition hidden"}),scope.is_open=!scope.is_open})}}}).directive("dropdownGroup",function(){return{restrict:"AE",replace:!0,transclude:!0,require:"^dropdown",scope:{title:"=title",value:"=value"},template:'
    {{ item_title }}
    ',link:function(scope,element,attrs,DropDownController){void 0===scope.title?scope.item_title=attrs.title||element.children()[0].innerHTML:scope.item_title=scope.title,void 0===scope.value?scope.item_value=attrs.value||scope.item_title:scope.item_value=scope.value,DropDownController.add_option(scope.item_title,scope.item_value),element.bind("click",function(){DropDownController.update_model(scope.item_title,scope.item_value)}),scope.$on("$destroy",function(){DropDownController.remove_option(scope.item_title,scope.item_value)})}}});var app=angular.module("app.Directive",["ngSanitize","angularify.semantic.dropdown"]);app.directive("ngEchart",require("./chartDirective")),app.directive("ngStatistic",require("./statisticDirective")),app.directive("ngStatisticLabel",require("./statisticLabelDirective")),app.directive("ngScrollSpy",require("./scrollspyDirective")),app.directive("ngChartShape",require("./chartShapeDirective")),app.directive("userList",require("./userListDirective")),app.directive("subWindow",require("./subWindowDirective")),app.directive("topicQuery",require("./topicQueryDirective")),app.directive("selectPage",require("./selectPageDirective")),app.directive("mentionedTable",require("./mentionedTableDirective")),app.directive("regionTable",require("./regionTableDirective")),app.directive("adminCard",require("./adminCardDirective")),app.directive("platformCardContent",require("./platformCardContentDirective")),app.directive("scopeCardContent",require("./scopeCardContentDirective")),app.directive("scopeTagsEditer",require("./scopeTagsDirective")),app.directive("fittext",function($timeout){return{restrict:"A",scope:{fittext:"=",height:"@"},link:function(scope,element,attr){var regexp=/\d+(\.\d+)?/;$timeout(function(){for(;element.height()>scope.height;){var fontSize=element.css("font-size").match(regexp);element.css("font-size",fontSize[0]-1)}element.height(scope.height)},0)}}}),module.exports="app.Directive"},{"./adminCardDirective":17,"./chartDirective":18,"./chartShapeDirective":19,"./mentionedTableDirective":21,"./platformCardContentDirective":22,"./regionTableDirective":23,"./scopeCardContentDirective":24,"./scopeTagsDirective":25,"./scrollspyDirective":26,"./selectPageDirective":27,"./statisticDirective":28,"./statisticLabelDirective":29,"./subWindowDirective":30,"./topicQueryDirective":31,"./userListDirective":32}],21:[function(require,module,exports){module.exports=function($rootScope,$compile){return{restrict:"E",templateUrl:"public/template/mentioned_table.html?time="+(new Date).getTime(),replace:!0,scope:{platform:"@",query:"=",association:"@",days:"@"},link:function(scope,e,a){$rootScope.$on("set-mentioned-table-data",function(evt,arg){scope.association===arg.association&&(scope.total=arg.total,scope.mostMentionedService=arg.data)}),scope.popDetail=function(serverName){var param={platform:scope.platform,topic:scope.query.topic,service:serverName,PNScope:"all",days:scope.days};$rootScope.popSubWin({fn:"getVoCDetailsByServiceName",param:param})},scope.swithside=function(){$(e).parent().parent().parent().shape("flip up")},scope.getters={twitterInf:function(value){return value.user.followers_count+value.user.friends_count}}}}}},{}],22:[function(require,module,exports){module.exports=function(){return{restrict:"E",templateUrl:"public/template/platformCardContent.html?time="+(new Date).getTime(),replace:!0,link:function(scope,e,a){}}}},{}],23:[function(require,module,exports){module.exports=function($rootScope,$compile){return{restrict:"E",templateUrl:"public/template/region_table.html?time="+(new Date).getTime(),replace:!0,scope:{platform:"@",query:"=",association:"@",days:"@"},link:function(scope,e,a){$rootScope.$on("set-region-table-data",function(evt,arg){scope.association===arg.association&&(scope.total=arg.total,scope.data=arg.data)}),scope.swithside=function(){$(e).parent().parent().parent().shape("flip up")},scope.getters={twitterInf:function(value){return value.user.followers_count+value.user.friends_count}}}}}},{}],24:[function(require,module,exports){module.exports=function(CONST){return{restrict:"E",templateUrl:"public/template/scopeCardContent.html?time="+(new Date).getTime(),replace:!0,transclude:!0,link:function(scope,e,a,adminCardCtrl){console.log(adminCardCtrl),scope.CONST=CONST,(scope.init=function(){scope.twitterKeywords=[],scope.sotags=[],scope.sutags=[],scope.sftags=[],scope.msdncategorys=[],scope.tncategorys=[]})(),scope.decline=function(){scope.init()}}}}},{}],25:[function(require,module,exports){module.exports=function(){return{restrict:"E",templateUrl:"public/template/scopeTagsEditer.html?time="+(new Date).getTime(),replace:!0,link:function(scope,e,a){scope.$watch("selectedTopicIndex",function(nv,ov){scope.selectedPlatformIndex&&""!==scope.selectedTopicIndex&&(scope.kwds=scope.TopicWithForum[scope.selectedPlatformIndex].topics[scope.selectedTopicIndex].topicsettings.Keywords)})}}}},{}],26:[function(require,module,exports){module.exports=function(){return{restrict:"A",link:function(scope,e,a){scope.isSmall=window.innerWidth<1510?1:0,$(window).resize(function(){scope.$apply(function(){window.innerWidth<1510?scope.isSmall=1:scope.isSmall=0})})}}}},{}],27:[function(require,module,exports){module.exports=function(){return{restrict:"E",template:'
    ',link:function(scope,element,attrs){scope.$watch("currentPage",function(c){scope.inputPage=c})}}}},{}],28:[function(require,module,exports){var label_type={compared:"Compared with",spike:"Vol Spike Detected",string:""},dateRangeAppend=function(dateRange){return"7"===dateRange?" Last Week":" (Last "+dateRange+" days)"};module.exports=function($parse,$filter,$timeout){return{restrict:"E",templateUrl:"public/template/statistic.html?time="+(new Date).getTime(),replace:!0,scope:{data:"=",title:"@",comment:"@",color:"@",dayrange:"="},link:function(scope,e,a){var numberFormat=$filter("thousandsuffix");$filter("percentage");scope.volume=scope.data.volume,scope.comment&&(scope.comment=scope.data.comment,$($(e).find(".popup").get(0)).popup()),scope.randerUI=function(){switch(a.type){case"joinedusers":scope.volume=numberFormat(scope.data.objectcountthistime),"7"==scope.dayrange?scope.labels=[{text:label_type.compared+dateRangeAppend(scope.dayrange),volume:scope.data.comparedratio,type:"ratio",isCompared:!0},{text:label_type.spike+dateRangeAppend(scope.dayrange),volume:scope.data.detectedhourlyspikesvol,color:"red"}]:scope.labels=[{text:label_type.spike+dateRangeAppend(scope.dayrange),volume:scope.data.detectedhourlyspikesvol,color:"red"}];break;case"regionofusers":scope.volume=numberFormat(scope.data.objectcountthistime),scope.volume=0===scope.volume?"No Data Available":scope.volume,"twitter"!==scope.$parent.$parent.platform.toLowerCase()||"7"!==scope.dayrange?scope.labels=[]:scope.labels=[{text:label_type.compared+dateRangeAppend(scope.dayrange),volume:scope.data.comparedratio,type:"ratio",isCompared:!0},{text:label_type.spike+dateRangeAppend(scope.dayrange),volume:scope.data.detectedhourlyspikesvol,color:"red"}];break;case"influenceofusers":scope.volume=numberFormat(scope.data.objectcountthistime),"7"==scope.dayrange?scope.labels=[{text:label_type.compared+dateRangeAppend(scope.dayrange),volume:scope.data.comparedratio,type:"ratio",isCompared:!0},{text:label_type.spike+dateRangeAppend(scope.dayrange),volume:scope.data.detectedhourlyspikesvol,color:"red"}]:scope.labels=[{text:"Spike Detected (Last "+scope.dayrange+" days)",volume:scope.data.detectedhourlyspikesvol,color:"red"}];break;case"mentionedservicecount":scope.volume=numberFormat(scope.data.objectcountthistime),"7"==scope.dayrange?scope.labels=[{text:label_type.compared+dateRangeAppend(scope.dayrange),volume:scope.data.comparedratio,type:"ratio",isCompared:!0},{text:label_type.spike+dateRangeAppend(scope.dayrange),volume:scope.data.detectedhourlyspikesvol,color:"red"}]:scope.labels=[{text:label_type.spike+dateRangeAppend(scope.dayrange),volume:scope.data.detectedhourlyspikesvol,color:"red"}];break;case"mostmentionedservice":scope.volume=scope.data[0].attachedobject;var tmp=scope.data.map(function(item){return item.attachedobject+"("+item.occupyratio+"%)"});scope.labels=[{text:tmp.join(",")}];break;case"mostlikedservice":scope.volume=scope.data.mostlikedservice[0].attachedobject+":"+scope.data.mostdislikedservice[0].attachedobject,scope.style={"font-size":"26px"},scope.labels=[{text:scope.data.mostlikedservice.map(function(item){return item.attachedobject+"("+item.occupyratio+"%)"}).join(","),color:"green"},{text:scope.data.mostdislikedservice.map(function(item){return item.attachedobject+"("+item.occupyratio+"%)"}).join(","),color:"red"}];break;case"vocinsightsVol":scope.volume=numberFormat(scope.data.objectcountthistime.voctotalvol),"7"==scope.dayrange?scope.labels=[{text:label_type.compared+dateRangeAppend(scope.dayrange),volume:scope.data.comparedratio,type:"ratio",isCompared:!0},{text:label_type.spike+dateRangeAppend(scope.dayrange),volume:scope.data.detectedhourlyspikesvol,color:"red"}]:scope.labels=[{text:label_type.spike+dateRangeAppend(scope.dayrange),volume:scope.data.detectedhourlyspikesvol,color:"red"}];break;case"vocinsightsPN":var originBoj=scope.data.objectcountthistime;scope.volume=[numberFormat(originBoj.positivetotalvol,0),numberFormat(originBoj.negativetotalvol,0),numberFormat(originBoj.neutraltotalvol,0)],scope.subVolume=[originBoj.positivetotalvol/originBoj.voctotalvol,originBoj.negativetotalvol/originBoj.voctotalvol,originBoj.neutraltotalvol/originBoj.voctotalvol],scope.labels=[{text:"POS "+label_type.spike+dateRangeAppend(scope.dayrange),volume:originBoj.detectedposispikesvol,color:"green"},{text:"NEG "+label_type.spike+dateRangeAppend(scope.dayrange),volume:originBoj.detectednegspikesvol,color:"red"}];break;case"mostposifrom":var originBoj=scope.data.objectcountthistime;scope.volume=[numberFormat(originBoj.positiveinfluencedvol,0),numberFormat(originBoj.negativeinfluencedvol,0)],scope.subVolume=[originBoj.positiveinfluencedvol/originBoj.vocinfluencedvol,originBoj.negativeinfluencedvol/originBoj.vocinfluencedvol],scope.labels=[]}},scope.randerUI(),scope.isVolObj=function(){return angular.isArray(scope.volume)||angular.isObject(scope.volume)},scope.$watch("data",function(newV,oldV){$timeout(function(){scope.randerUI()},0)})}}}},{}],29:[function(require,module,exports){module.exports=function(){return{restrict:"AE",templateUrl:"public/template/statistic_label.html?time="+(new Date).getTime(),scope:{label:"="},link:function(scope,e,a){scope.render=function(){scope.label=scope.label||{},scope.style=scope.label.style||"",scope.volume=isNaN(Number(scope.label.volume))?null:Number(scope.label.volume),scope.text=scope.label.text||"",scope.color=scope.label.color||"black",scope.type=scope.label.type||"",scope.isCompared=scope.label.isCompared||"",scope.getColor=function(){return null===scope.volume?scope.color:""}},scope.$watch("label",function(nv,ov){scope.render()})}}}},{}],30:[function(require,module,exports){function initHourlyChartData(raw,utility){var seriesData=[],xAxisDate=[];raw.map(function(item){if(xAxisDate.push(utility.timeToString(item.attachedobject)),item.vocinfluence.detectedspikesvol)var entity={value:item.vocinfluence.voctotalvol,symbol:"pin",symbolSize:20,label:{normal:{show:!0}}};else var entity={value:item.vocinfluence.voctotalvol,symbolSize:4};seriesData.push(entity)});return{title:{text:"Volume Trend",textStyle:{fontSize:12},x:"center"},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},dataZoom:[{show:!0,realtime:!0,start:0,end:100},{type:"inside",realtime:!0,start:0,end:100}],xAxis:{type:"category",boundaryGap:!1,axisLine:{onZero:!1},data:xAxisDate},yAxis:{},series:[{name:"Vol",type:"line",showAllSymbol:!0,data:seriesData}]}}module.exports=function($rootScope,$window,$compile,$filter,utilitySrv,CONST){return{restrict:"E",templateUrl:"public/template/sub_window.html?time="+(new Date).getTime(),replace:!0,scope:{title:"@",platform:"@",query:"="},link:function(scope,e,a){scope.myChart=echarts.init($(e).find(".hourly-charts").get(0)),scope.getData=function(params){var country=(params.param.country||"").toLowerCase();"united states of america"===country&&(country="united states"),$window.threadOption={ -function:params.fn,platform:params.param.platform.toLowerCase(),topic:params.param.topic,pnscope:params.param.pnscope,days:params.param.days,params:{date:params.param.date,country:country,service:params.param.service,userid:params.param.userid,index:params.param.index,keywords:params.param.keywords,IsFuzzyQuery:params.param.IsFuzzyQuery,msgType:params.param.msgType,timestamp:params.param.timestamp}},$window.threadStore?($window.threadStore.threads.data([]),$window.threadStore.threads.page(1),$window.threadStore.set("RefreshTrigger",!$window.threadStore.RefreshTrigger)):($window.threadStore=kendo.observable({RefreshTrigger:!1,threads:new kendo.data.DataSource({transport:{read:{url:CONST.SERVICE_INFO.ENDPOINT+"GetDetailsByComplexFilter",dataType:"json",type:"POST",contentType:"application/x-www-form-urlencoded"},parameterMap:function(data,operation){if("read"===operation){var search;data.filter&&data.filter.filters&&data.filter.filters.length>0&&(search=data.filter.filters[0].value),$window.threadOption.search=search;var post={function:$window.threadOption.function,platform:$window.threadOption.platform,topic:$window.threadOption.topic,pnscope:$window.threadOption.pnscope,days:$window.threadOption.days,params:{},search:search,page:data.page,pagesize:data.pageSize,sortby:data.sort[0]?data.sort[0].field:"CreatedTime",sort:data.sort[0]?data.sort[0].dir:"desc"};return $window.threadOption.params&&$.each($window.threadOption.params,function(field,value){value&&(post.params[field]=value)}),kendo.stringify(post)}}},serverPaging:!0,pageSize:10,serverSorting:!0,sort:{field:"CreatedTime",dir:"desc"},serverFiltering:!0,schema:{total:"count",data:function(response){var data=response.messagesorthreads;return $.each(data,function(pos,data){data.CreatedTime=new Date(1e3*data.CreatedTime)}),data}}})}),kendo.bind($("#gridThreads"),$window.threadStore)),scope.needMentioned=!0,scope.platform=params.param.platform.toLowerCase();var fnPromise,fn=$rootScope.service[params.fn];switch(params.fn){case"getVoCDetailsByDate":fnPromise=fn(params.param.platform,params.param.topic,params.param.date,params.param.pnscope,params.param.granularity);break;case"getVoCDetailsByPN":fnPromise=fn(params.param.platform,params.param.topic,params.param.pnscope,params.param);break;case"getVoCDetailsByServiceName":scope.needMentioned=!1,fnPromise=fn(params.param.platform,params.param.topic,params.param.service,params.param.pnscope,params.param);break;case"getVoCDetailsByUser":fnPromise=fn(params.param.platform,params.param.topic,params.param.userid,params.param.index,params.param.pnscope,params.param);break;case"getVoCDetailsByCountry":fn=$rootScope.service.getVoCDetailsByPN,fnPromise=fn(params.param.platform,params.param.topic,params.param.country,params.param.days);break;case"getSubPageVoCDetails":fnPromise=fn(params.param.platform,params.param.topic,params.param.date,params.param.pnscope,params.param.days);break;case"getSubPageVoCDetailsbyKeywords":fnPromise=fn(params.param.platform,params.param.topic,params.param.keywords,params.param.pnscope,params.param.IsFuzzyQuery,params.param.days);break;case"getVoCDetailsBySpikeDetected":fnPromise=fn(params.param.platform,params.param.msgType,params.param.topic,params.param.timestamp)}fnPromise.then(function(data){scope.raw=data,scope.tabledata=data.messagesorthreads,scope.$broadcast("set-user-data",data.topusers),scope.$broadcast("set-sub-widows-charts-data",{data:data}),scope.chartOpt=initHourlyChartData(data.volhourlylist,utilitySrv),scope.myChart.setOption(scope.chartOpt),scope.myChart.resize(),scope.complete=!0})},scope.$on("start-get-data-in-window",function(event,arg){scope.raw=[],scope.tabledata=[],scope.chartOpt={},scope.$broadcast("set-user-data",[]),scope.getData(arg),scope.complete=!1}),scope.getters={twitterInf:function(value){return value.user.followers_count+value.user.friends_count}},scope.swithside=function(){$("#shape-pup").shape("flip up")}}}}},{}],31:[function(require,module,exports){module.exports=function(){return{restrict:"EA",templateUrl:"public/template/topicQuery.html?time="+(new Date).getTime(),replace:!0,link:function(scope,e,a){scope.isSmall=window.innerWidth<1510?1:0,$(window).resize(function(){scope.$apply(function(){window.innerWidth<1510?scope.isSmall=1:scope.isSmall=0})})}}}},{}],32:[function(require,module,exports){module.exports=function($rootScope){return{restrict:"E",templateUrl:"public/template/user_list.html?time="+(new Date).getTime(),replace:!0,scope:{title:"@",platform:"@",query:"=",pnscope:"@",noPop:"@",days:"@"},link:function(scope,e,a){scope.pnscope=scope.pnscope||"all",scope.getAvatorUrl=function(user){return user.attachedobject.url||"public/images/"+scope.platform.toLowerCase()+".png"},scope.onClick=function(user,index){if(void 0===a.noPop){var param={platform:scope.platform,topic:scope.query.topic,userid:user.attachedobject.userId,index:index,pnscope:scope.pnscope,granularity:scope.query.granularity,start:scope.query.start,end:scope.query.end};$rootScope.popSubWin({fn:"getVoCDetailsByUser",param:param})}},scope.getData=function(location,force){a.location===location&&$rootScope.service.getUser(scope.platform,5,scope.query.topic,scope.pnscope,scope.query).then(function(data){scope.users=data.slice(0,5),scope.complete=!0,$rootScope.$broadcast("data-got")})},scope.$on("start-get-data",function(event,arg){scope.complete=!1,scope.getData(arg)}),scope.$on("set-user-data",function(event,arg){"sub"==a.location&&(scope.users=arg,scope.complete=!0)})}}}},{}],33:[function(require,module,exports){var app=angular.module("app.Filter",["app.Srv"]);app.filter("percentage",["$window",function($window){return function(input,decimals,notAbsolute,suffix){var decimals=angular.isNumber(decimals)?decimals:3,suffix=suffix||"%";return $window.isNaN(input)?"":(notAbsolute||(input=Math.abs(input)),Math.round(input*Math.pow(10,decimals+2))/Math.pow(10,decimals)+suffix)}}]),app.filter("sentimentScore",["$window",function($window){var dict={"-1":"Undefined",0:"Negative",2:"Neutral",4:"Positive"};return function(input){return dict[input.toString()]}}]),app.filter("timetostring",["utilitySrv",function(utilitySrv){return function(input,type){return utilitySrv.timeToString(input,type)}}]),app.filter("timeToLocalString",["utilitySrv",function(utilitySrv){return function(input,type){return utilitySrv.timeToLocalString(input,type)}}]),app.filter("mankindTime2String",["utilitySrv",function(utilitySrv){return function(input){return utilitySrv.mankindTime2String(input)}}]),app.filter("thousandsuffix",["$window",function($window){return function(input,decimals){var exp,decimals=angular.isNumber(decimals)?decimals:2,suffixes=["k","M","G","T","P","E"];return $window.isNaN(input)?input:input<1e3?input:(exp=Math.floor(Math.log(input)/Math.log(1e3)),(input/Math.pow(1e3,exp)).toFixed(decimals)+suffixes[exp-1])}}]),app.filter("findObjectInArray",function(){return function(input,perproty,value){for(var i=0;i0&&($.each(notifications,function(i,notification){collection.push(notification)}),lastsynctime=new Date/1e3|0)})}catch(err){console.log("connection Error",err)}}var lastsynctime=new Date/1e3|0,collection=[];listenNewDetection();var timer=setInterval(listenNewDetection,6e4);return{collection:collection,status:function(){return timer?1:3},reconnect:function(){timer&&clearInterval(timer),timer=setInterval(listenNewDetection,1e4)}}}),app.factory("rawdataSrv",function(baseSrv){function setDateTimeRange(p,s){if(s){var granularity=s.granularity||3,start=s.start/1e3,end=(s.end+(2==granularity?36e5:864e5))/1e3;p=p||{},p.fromcycle=granularity,p.start=start,p.end=end}}return{getCate:function(platform){var params=params||{};return params.platform=platform||"all",baseSrv.get("GetAllEnabledTopicsByPlatform",params)},getUser:function(platform,topNum,topic,PNScope,source){var params=params||{};return params.platform=platform||"all",params.topNum=topNum||5,params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetTopUsers",params)},getSpikes:function(platform,topic,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",setDateTimeRange(params,source),baseSrv.get("GetDailyVolSpikes",params)},getDistribution:function(platform,topic,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",setDateTimeRange(params,source),baseSrv.get("GetPNDistribution",params)},getInfluence:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetDailyInfluence",params)},getMentionedMostServiceList:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetMentionedMostServiceList",params)},getMentionedMostServiceListByUserVol:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetMentionedMostServiceListByUserVol",params)},getMentionedMostServiceDistribution:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetMentionedMostServiceList",params)},getVoCDetailsByDate:function(platform,topic,date,PNScope,granularity){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.date=date||Math.floor((new Date).getTime()/1e3),params.PNScope=PNScope||"all",params.fromcycle=granularity||3,baseSrv.get("GetVoCDetailsByDate",params)},getVoCDetailsByPN:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetVoCDetailsByPN",params)},getVoCDetailsByServiceName:function(platform,topic,service,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.servicename=service||"webapp",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetVoCDetailsByServiceName",params)},getVoCDetailsByUser:function(platform,topic,user,index,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.userid=user||1234,params.index=void 0!==index?index:-1,params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetVoCDetailsByUser",params)},getImpactSummary:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetImpactSummary",params)},getUserVolSpikes:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetUserVolSpikes",params)},getMessageVolSpikes:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetMessageVolSpikes",params)},getInfluenceVolSpikes:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetInfluenceVolSpikes",params)},getUserRegionVolSpikes:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetUserRegionVolSpikes",params)},getKeywordsMentionedMostMapping:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetKeywordsMentionedMostMapping",params)},getSubPageVoCDetails:function(platform,topic,date,PNScope,days){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.Date=date||Math.floor((new Date).getTime()/1e3),params.PNScope=PNScope||"all",params.days=days||7,baseSrv.get("GetSubPageVoCDetails",params)},getSubPageVoCDetailsbyKeywords:function(platform,topic,keywords,PNScope,IsFuzzyQuery,days){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.keywords=keywords||"notworking",params.PNScope=PNScope||"all",params.IsFuzzyQuery=IsFuzzyQuery||"false",params.days=days||7,baseSrv.get("GetSubPageVoCDetailsbyKeywords",params)},getSysDetections:function(platform,msgType,topic,downloadable,bgTime,egTime){var params=params||{};return params.platform=platform||"all",params.msgType=msgType||"all",params.topic=topic||"all",params.downloadable=downloadable||"all",params.bgTime=bgTime||0,params.egTime=egTime||0,baseSrv.get("GetSysDetections",params)},getPlatformSyncSetting:function(platform){var params=params||{};return params.platform=platform||"all",baseSrv.get("GetPlatformSyncSetting",params)},getVoCDetailsBySpikeDetected:function(platform,msgType,topic,timestamp){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"azure",params.msgType=msgType||"all",params.timestamp=timestamp||0,baseSrv.get("GetVoCDetailsBySpikeDetected",params)},getUserLanguageDistribution:function(platform,topic,days){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"azure",params.days=days||7,baseSrv.get("GetUserLanguageDistribution",params)},getRegionDistribution:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"azure",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetRegionDistribution",params)},getSentimentTrend:function(platform,topic,PNScope,days){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"azure",params.PNScope=PNScope||"all",params.days=days||7,baseSrv.get("GetSentimentTrend",params)},saveForumServiceSetting:function(data){return baseSrv.post("SaveForumServiceSetting",data,{headers:{"Content-Type":"text/plain"}})},getDownloadUrl:function(platform,topic,days){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"azure",params.days=days||7,baseSrv.get("GetDownloadUrl",params)},getSubscribeSettings:function(platform,topic,msgtype,servicename){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",params.msgtype=msgtype||"all",params.servicename=servicename||"all",baseSrv.get("GetSubscribeSettings",params)},createSubscribe:function(params){var params=params||{};return baseSrv.post("CreateSubscribe",{groupid:params.id,email:params.email,subscription:{platforms:[params.platform||"all"],topics:params.topics,messagetypes:[params.msgtype||"all"]}},{headers:{"Content-Type":"text/plain"}})},removeSubscription:function(email){return baseSrv.get("DeleteSubscribeByEmail",{email:email})},removeSubscriptionRule:function(id){return baseSrv.get("DeleteSubscribeByGroupId",{groupId:id})},checkAdminAccessRights:function(email){var params=params||{};return params.email=email,baseSrv.get("CheckAdminAccessRights",params)}}}),module.exports="app.Srv"},{"./utility":35}],35:[function(require,module,exports){module.exports=function($filter){return Date.prototype.format=function(format){var o={"M+":this.getUTCMonth()+1,"d+":this.getUTCDate(),"h+":this.getUTCHours(),"m+":this.getUTCMinutes(),"s+":this.getUTCSeconds(),"q+":Math.floor((this.getUTCMonth()+3)/3),S:this.getUTCMilliseconds()};(/(y+)/.test(format)||/(Y+)/.test(format))&&(format=format.replace(RegExp.$1,(this.getUTCFullYear()+"").substr(4-RegExp.$1.length)));for(var k in o)new RegExp("("+k+")").test(format)&&(format=format.replace(RegExp.$1,1==RegExp.$1.length?o[k]:("00"+o[k]).substr((""+o[k]).length)));return format},{toPercent:function(data,decimal){return parseFloat(parseFloat(100*data).toFixed(decimal))},getLastXMonthDate:function(x){var m=new Date;return m.setDate(1),m.setUTCMonth(m.getUTCMonth()-parseInt(x)-1),m.getUTCFullYear()+"/"+(m.getUTCMonth()+1)+"/"+m.getUTCDate()},getDateTimeLocaleStringInMinute:function(date){var string=new Date(date).toLocaleString(),match=/(^[^:]*(:\d+)?)(:\d+)?$/g.exec(string);return match&&match.length>1?match[1]:string},getTimeRange:function(startDate,endDate,interval,needFormat,format){interval=interval||1,needFormat=needFormat||!0,format=format||"yyyy-MM-dd HH:mm";for(var retVal=[],current=new Date(startDate);current<=endDate;)retVal.push(new Date(current)),current=function(d){return d.setDate(d.getDate()+interval),d}(new Date(current));return retVal},timeToString:function(timestamp,type){var type=type||"hourly",timeString="";switch(type){case"hourly":timeString=moment(1e3*timestamp).format("YYYY-MM-DD HH:mm");break;case"daily":timeString=moment(1e3*timestamp).format("YYYY-MM-DD")}return timeString},timeToLocalString:function(timestamp,type){var type=type||"hourly",timeString="";switch(type){case"hourly":timeString=moment(1e3*timestamp).format("YYYY-MM-DD hh:mm");break;case"daily":timeString=moment(1e3*timestamp).format("YYYY-MM-DD")}return timeString},mankindTime2String:function(timestamp){return moment(1e3*timestamp).format("YYYY-MM-DD hh:mm A")}}}},{}]},{},[10]); \ No newline at end of file +angular.module("app.Route",["ui.router","AdalAngular","app.Constant"]).config(function($stateProvider,$urlRouterProvider,$locationProvider,adalAuthenticationServiceProvider,$httpProvider,CONST){$locationProvider.html5Mode(!0).hashPrefix("!"),$urlRouterProvider.otherwise("home.dashboard"),$stateProvider.state("login",{url:"/",template:"
    ",controller:function($scope,$state,adalAuthenticationService){$scope.userInfo.isAuthenticated?$state.go("home.dashboard"):adalAuthenticationService.login()}}).state("home",{abstract:!0,url:"/home",template:""}).state("home.about",{url:"/about",templateUrl:"templates/home.html"}).state("home.dashboard",{url:"/dashboard",requireADLogin:!0,templateUrl:"templates/dashboard.html",controller:"homeCtrl"}).state("social",{abstract:!0,url:"/social",template:""}).state("social.platform",{url:"/:platform",requireADLogin:!0,templateUrl:"templates/social.html",controller:"socialCtrl"}).state("thirdParty",{abstract:!0,url:"/thirdParty",template:""}).state("thirdParty.platform",{url:"/:platform",requireADLogin:!0,templateUrl:"templates/social.html",controller:"socialCtrl"}).state("msPlatform",{abstract:!0,url:"/msPlatform",template:""}).state("msPlatform.platform",{url:"/:platform",requireADLogin:!0,templateUrl:"templates/social.html",controller:"socialCtrl"}).state("admin",{url:"/admin",requireADLogin:!0,controller:"adminCtrl",templateUrl:"templates/admin.html"}).state("notification",{url:"/notification",controller:"notificationCtrl",templateUrl:"templates/notification_center.html",requireADLogin:!0}).state("report",{url:"/report",templateUrl:"templates/report.html",requireADLogin:!1}),adalAuthenticationServiceProvider.init({tenant:CONST.AD_CONFIG.TENANT_ID,clientId:CONST.AD_CONFIG.CLIENT_ID,redirectUri:window.location.origin+"/frameRedirect.html",cacheLocation:"localStorage",anonymousEndpoints:["public/","templates/"]},$httpProvider)}).run(function($rootScope,$state,$injector,adalAuthenticationService){}),module.exports="app.Route"},{}],12:[function(require,module,exports){module.exports=function($scope,$rootScope,$window,$location,$state,$timeout,$http,$filter,toastr){function generateNewScopeObj(platform){var newScope={topic:$scope.newTopicName,topicsettings:{topic:$scope.newTopicName}};switch(platform){case"so":case"sf":case"su":case"lithium":case"twitter":newScope.topicsettings.Keywords=[];break;case"msdn":case"tn":newScope.topicsettings.Tags=[]}return newScope}$scope.isAdmin||$state.go("home.dashboard"),$scope.platforms=[],$scope.search={datasource:"all",messagetype:"all",topic:"all"};$(".tabular.menu .item").tab(),$(".vertical.menu .item").tab(),$(".ui.checkbox").checkbox(),$scope.getPlatforms=function(){$timeout(function(){$scope.platforms=["twitter","so","sf","su","msdn","tn"]},500)}(),$scope.getConfigData=function(){$scope.service.getPlatformSyncSetting().then(function(data){$scope.MsdnTopicMapping=data.MsdnTopicMapping,$scope.TopicWithForum=data.TopicWithForum,$scope.originData=angular.copy($scope.TopicWithForum)})},$scope.init=function(){$timeout(function(){},50),$scope.getConfigData()},$scope.renderDimmer=function(){$timeout(function(){$(".hover.dimmer").dimmer({on:"hover"})},0)},$scope.selectPlatform=function(index){$scope.selectedPlatformIndex=index;var p=$scope.TopicWithForum[index];$scope.selectedPlatform=p.platform_Name,$scope.selectTopic("")},$scope.isSelectedPlatform=function(platform){return $scope.selectedPlatform===platform},$scope.selectTopic=function(index){if($scope.filterTags="",$scope.selectedTopicIndex=index,Number.isInteger(index)){var t=$scope.TopicWithForum[$scope.selectedPlatformIndex].topics[index];$scope.selectedTopic=t.topic}else $scope.selectedTopic=void 0},$scope.isSelectedTopic=function(t){return $scope.selectedTopic===t},$scope.autoScale=function(e){console.log(e)},$scope.addKwd=function(event){console.log(event),event.stopPropagation();var currentTopic=$scope.TopicWithForum[$scope.selectedPlatformIndex].topics[$scope.selectedTopicIndex],array=currentTopic.topicsettings.Keywords,string=(event.target.value||event.target.previousElementSibling.value).trim();""!==string&&-1===array.indexOf(string)&&array.push(string),event.target.value=""},$scope.cancelUpdate=function(){var src=angular.copy($scope.originData),dist=$scope.TopicWithForum;Number.isInteger($scope.selectedTopicIndex)?angular.extend(dist[$scope.selectedPlatformIndex].topics[$scope.selectedTopicIndex],src[$scope.selectedPlatformIndex].topics[$scope.selectedTopicIndex]):angular.extend(dist[$scope.selectedPlatformIndex],src[$scope.selectedPlatformIndex])},$scope.approveUpdate=function(){$scope.originData=angular.copy($scope.TopicWithForum),$scope.service.saveForumServiceSetting({MsdnTopicMapping:$scope.MsdnTopicMapping,TopicWithForum:$scope.originData}).then(function(data){1==data?toastr.success("Success","Operation Success!"):toastr.error("Error","Operation Failed!")})},$scope.forumSelectChanged=function(index){if(null===index)$scope.TopicWithForum[$scope.selectedPlatformIndex].topics[$scope.selectedTopicIndex].topicsettings={};else{console.log(index);var tagCfg=$filter("findObjectInArray")(angular.copy($scope.MsdnTopicMapping),"topic",index);console.log(angular.copy(tagCfg)),$scope.TopicWithForum[$scope.selectedPlatformIndex].topics[$scope.selectedTopicIndex].topicsettings=angular.copy(tagCfg)}},$scope.isDirty=function(){return!angular.equals(angular.copy($scope.originData),angular.copy($scope.TopicWithForum))},$scope.removeTopic=function(index){$("#removeConfirmModal").modal({onDeny:function(){},onApprove:function(){$scope.TopicWithForum[$scope.selectedPlatformIndex].topics.splice(index,1),$scope.selectedTopic=void 0,$scope.$digest()}}).modal("show")},$scope.newScope=function(){var newScope={};$("#newServiceModal").modal({onDeny:function(){$scope.newTopicName=""},onApprove:function(){""===$scope.newTopicName.trim()||(newScope=generateNewScopeObj($scope.selectedPlatform),$scope.TopicWithForum[$scope.selectedPlatformIndex].topics.push(newScope),$scope.newTopicName="",$scope.$digest())}}).modal("show")},$scope.init(),$scope.getTopics=function(){$scope.service.getCate().then(function(data){$scope.enabledTopics=data;var multipleSelectedTopics=[];$.each(data,function(i,topic){!0===topic.isGA&&multipleSelectedTopics.push(topic.TechCategoryName)}),$scope.multipleSelectedTopics=multipleSelectedTopics})}(),$scope.listSubscriptions=function(platform,topic,msgtype,servicename){platform=platform||$scope.search.datasource,topic=topic||$scope.search.topic,msgtype=msgtype||$scope.search.messagetype,$scope.service.getSubscribeSettings(platform,topic,msgtype,servicename).then(function(data){var swap=data.reduce(function(array,item){var platform=item.Platform.trim(),topic=item.Topic.trim(),msgtype=item.MsgType.trim();if(array[item.GroupId]){var e=array[item.GroupId];e.Platforms.indexOf(platform)<0&&(e.Platforms.push(platform),e.PlatformsText.push($rootScope.CONST.ALL_ENABLED_PLARFORMS[platform]||platform)),e.Topics.indexOf(topic)<0&&(e.Topics.push(topic),e.TopicsText.push(topic)),e.MsgTypes.indexOf(msgtype)<0&&(e.MsgTypes.push(msgtype),e.MsgTypesText.push($rootScope.CONST.MESSAGE_TYPES[msgtype]||msgtype))}else array[item.GroupId]={GroupId:item.GroupId,EMail:item.EMail,Platforms:[platform],PlatformsText:[$rootScope.CONST.ALL_ENABLED_PLARFORMS[platform]||platform],Topics:[topic],TopicsText:[topic],MsgTypes:[msgtype],MsgTypesText:[$rootScope.CONST.MESSAGE_TYPES[msgtype]||msgtype],ServiceName:item.ServiceName,IsEnabled:item.IsEnabled};return array},{});$scope.subscriptions=Object.keys(swap).map(function(groupId){var e=swap[groupId];return{GroupId:e.GroupId,EMail:e.EMail,Platform:e.PlatformsText.join(", "),Topic:e.TopicsText.join(", "),MsgType:e.MsgTypesText.join(", "),PlatformArrayJson:JSON.stringify(e.Platforms),TopicArrayJson:JSON.stringify(e.Topics),MsgTypeArrayJson:JSON.stringify(e.MsgTypes),ServiceName:e.ServiceName,IsEnabled:e.IsEnabled}})})},$scope.listSubscriptions(),$scope.$watch("selectedPlatform",function(nv,ov){switch($scope.selectedPlatform){case"sf":case"su":case"so":$scope.tagsCfg="stackExchange";break;case"twitter":$scope.tagsCfg="twitter";break;case"msdn":case"tn":$scope.tagsCfg="msdn"}})}},{}],13:[function(require,module,exports){module.exports=function($scope,$rootScope,$window,$timeout,$http,$q,$sce,$compile,$document,$websocket,CONST,utilitySrv){function datetimeChanged(){var dtStart=dtpStart.value(),dtEnd=dtpEnd.value();dtStart&&dtpEnd.min(new Date(dtStart)),dtEnd&&dtpStart.max(new Date(dtEnd)),$scope.startGetData($rootScope.global.topic)}function listenServiceStatus(){try{$http.get(CONST.SERVICE_INFO.TWITTER_SERVER_STATUS).then(function(data){$scope.twitter_status=data.data})}catch(err){console.log("connection Error",err)}try{$http.get(CONST.SERVICE_INFO.OTHERS_SERVER_STATUS).then(function(data){$scope.others_status=data.data})}catch(err){console.log("connection Error",err)}}var today=24*parseInt((new Date).valueOf()/36e5/24)*36e5+6e4*(new Date).getTimezoneOffset(),start=new Date(today-6048e5),end=new Date(today-864e5),outset=new Date(today-2592e6),dtpStart=$("#DateTimePickerStart").kendoDatePicker({value:outset,format:localeDateFormatString,change:datetimeChanged,min:new Date(2017,0,1),max:end}).data("kendoDatePicker"),dtpEnd=$("#DateTimePickerEnd").kendoDatePicker({value:end,format:localeDateFormatString,change:datetimeChanged,min:start,max:end}).data("kendoDatePicker");$scope.query={granularity:3};$scope.flags={m:!1,g:!1,r:!1},$(".popup").popup(),$("#scrollspy .list .item .label").popup(),$(".ui.accordion").accordion({exclusive:!1,animateChildren:!1,selector:{trigger:".segment .title",content:".segment .content"},onOpen:function(){$(this).find(".ui.segment").removeClass("visible"),$(this).find("div.echart").map(function(index,currentObj,array){echarts.getInstanceByDom(currentObj).resize()})}}),$scope.isSelected=function(section){return $scope.selected===section},$scope.getTopics=function(){$scope.service.getCate().then(function(data){$scope.topics=data,$rootScope.global.topic&&$scope.startGetData($rootScope.global.topic)})}(),$scope.$on("data-got",function(event,arg){$scope.flags.m=!0,$(".tabular.menu .item").tab({onVisible:function(tab){console.log(tab);var chartDom=$('.ui.tab[data-tab="'+tab+'"]').find("div.echart").get(0);chartDom&&echarts.getInstanceByDom(chartDom).resize()}}),$("#progress").progress("increment"),$("#progress").progress("get value")===$scope.totalrequests&&$timeout(function(){$("#progress").hide()},1e3)}),$scope.startGetData=function(topic){$rootScope.global.topic=topic,$scope.flags.m=!1,$("div.echart").map(function(){echarts.getInstanceByDom(this).clear()}),$("#progress").progress("reset"),$("#progress").show();var dtStart=dtpStart.value(),dtEnd=dtpEnd.value();dtStart=dtStart.valueOf()-6e4*dtStart.getTimezoneOffset(),dtEnd=dtEnd.valueOf()-6e4*dtEnd.getTimezoneOffset(),$scope.query.start=dtStart,$scope.query.end=dtEnd;var offsetDays=(dtEnd-dtStart)/3600/24/1e3;$("#volumes > div.content > div:nth-child(2)").attr("class","ui "+(offsetDays<=30?"three":offsetDays<=60?"two":"one")+" column grid"),$scope.query.topic!==topic?($scope.enabledPlatforms=[],$scope.query.topic=topic,$timeout(function(){$scope.topics.forEach(function(item){item.TechCategoryName.toLowerCase()===topic.toLowerCase()&&item.Platforms.forEach(function(p){p.isEnabled&&$scope.enabledPlatforms.push(p.PlatformName)})}),$scope.totalrequests=8*$scope.enabledPlatforms.length+0,$("#progress").progress({total:$scope.totalrequests}),$scope.selected=$scope.enabledPlatforms[0],$scope.listNotification(5)},50)):($scope.$broadcast("start-get-data","home"),$scope.selected=$scope.enabledPlatforms[0])},$scope.listNotification=function(top){var date=Math.floor(moment.utc().add(-1,"days").startOf("day")/1e3);$scope.service.getSysDetections(void 0,void 0,$rootScope.global.topic,void 0,date).then(function(data){$scope.collections=data.splice(0,top)})},$scope.generateDownloadUrl=function(entity){var downloadTemplate='Download Data';return entity.hasDownload?$sce.trustAsHtml(downloadTemplate):"N/A"},$scope.showdetails=function(entity){var param={platform:entity.forumName,msgType:entity.msgType,topic:entity.topic,timestamp:entity.TimeStamp};$rootScope.popSubWin({fn:"getVoCDetailsBySpikeDetected",param:param})},$scope.finished=function(){$timeout(function(){$scope.$broadcast("start-get-data","home")},50)},listenServiceStatus(),$scope.getServiceStatus=function(){setInterval(listenServiceStatus,6e4)},$scope.getServiceStatus()}},{}],14:[function(require,module,exports){require("angular-sanitize");var app=angular.module("app.Ctrl",["720kb.datepicker","ngSanitize"]);app.controller("homeCtrl",require("./homeCtrl")),app.controller("socialCtrl",require("./socialCtrl")),app.controller("adminCtrl",require("./adminCtrl")),app.controller("notificationCtrl",require("./notificationCtrl")),module.exports="app.Ctrl"},{"./adminCtrl":12,"./homeCtrl":13,"./notificationCtrl":15,"./socialCtrl":16,"angular-sanitize":2}],15:[function(require,module,exports){module.exports=function($scope,$location,$timeout,$filter,$http,$sce,$rootScope,CONST){$scope.getTopic=function(){$scope.topic=$rootScope.global.topic,0===$scope.topic.length&&($scope.topic="all")}(),$scope.search={datasource:"all",topic:$scope.topic,messagetype:"all",bgTime:$filter("date")(function(d){return d.setDate(d.getDate()-1),d}(new Date),"yyyy-MM-dd"),egTime:$filter("date")(new Date,"yyyy-MM-dd"),downloadable:"all"},$scope.selectPlatform=function(platform){$scope.selectedPlatform=platform,$scope.$broadcast("admin-select-platform",platform)},$scope.collections=function(){return $scope.Notifications.collection.splice(0)}(),$scope.$watch("Notifications.collection",function(newV,oldV){if(newV.length){var notification=$scope.Notifications.collection.pop();"all"!==($scope.search.datasource||"all")&¬ification.forumName!==$scope.search.datasource||"all"!==($scope.search.topic||"all")&¬ification.topic!==$scope.search.topic||"all"!==($scope.search.messagetype||"all")&¬ification.msgType!==$scope.search.messagetype||"all"!==($scope.search.downloadable||"all")&¬ification.hasDownload!==(1===$scope.search.downloadable||-1!==$scope.search.downloadable&&null)||$scope.collections.push(notification)}},!0),$scope.getPlatforms=function(){$timeout(function(){$scope.platforms=CONST.ALL_ENABLED_PLARFORMS,$(".ui.fluid.dropdown").dropdown({}),$(".popup").popup()},50)}(),$scope.listNotification=function(){$("#nc-main").dimmer("show");var params=angular.copy($scope.search);params.bgTime=Math.floor(moment.utc(params.bgTime)/1e3),params.egTime=Math.floor(moment.utc(params.egTime).endOf("day")/1e3),$scope.service.getSysDetections(params.datasource,params.messagetype,params.topic,params.downloadable,params.bgTime,params.egTime).then(function(data){$("#nc-main").dimmer("hide"),$scope.collections=data})},$scope.listNotification(),$scope.generateDownloadUrl=function(entity){var downloadTemplate='Download Data';return entity.hasDownload?$sce.trustAsHtml(downloadTemplate):"N/A"},$scope.showdetails=function(entity){var param={platform:entity.forumName,msgType:entity.msgType,topic:entity.topic,timestamp:entity.TimeStamp};$rootScope.popSubWin({fn:"getVoCDetailsBySpikeDetected",param:param})},$scope.getTopics=function(){$scope.service.getCate().then(function(data){$scope.topics=data,$scope.resolveTopics()})},$scope.resolveTopics=function(){if("all"!=$scope.search.topic)if($scope.topics){for(var found=!1,i=0;i<$scope.topics.length;i++)if($scope.topics[i].TechCategoryName===$scope.search.topic){found=!0;break}!1===found&&($scope.search.topic="all")}else $scope.topics=[{TechCategoryName:$scope.search.topic,isGA:!0}]},$scope.getTopics(),$scope.resolveTopics()}},{}],16:[function(require,module,exports){module.exports=function($scope,$rootScope,$window,$timeout,$filter,$document,$location,utilitySrv,toastr){function getStatistic(){$("#summary div.content").dimmer("show"),$scope.service.getImpactSummary($scope.$stateParams.platform,$scope.topic,"all",$scope.query).then(function(data){data.vocinsights.objectcountthistime;$scope.serviceStatus="gery",$scope.statistic=data,$("#summary div.content").dimmer("hide"),$scope.$broadcast("data-got")})}function getUserDistribution(){$scope.service.getRegionDistribution($scope.$stateParams.platform,$scope.topic,"all",$scope.query).then(function(data){$scope.languageDistribution=$filter("orderBy")(data,"-uniqueusers")})}function getMentionedServiceTable(){$scope.service.getMentionedMostServiceList($scope.$stateParams.platform,$scope.topic,"all",$scope.query).then(function(data){$scope.mostMentionedService=data,$scope.$broadcast("data-got")})}function CheckDateRangeSize(){$scope.query.days=($scope.query.end-$scope.query.start)/1e3/3600/24,$scope.isLargeDateRange=$scope.query.days>7,$timeout(function(){$scope.startGetData(),$scope.isLargeDateRange&&$(".large-date-range").find("div.echart").map(function(index,currentObj,array){echarts.getInstanceByDom(currentObj).resize()}),$scope.$apply()},0)}$scope.platform=$scope.$stateParams.platform.toLowerCase(),$scope.order=$filter("orderBy"),$scope.query={},$scope.path=$location.path().split("/"),$scope.isLargeDateRange=!1,$scope.popInfoScope="Hourly";var totalrequests=0,settings={};settings.timezoneOffset=6e4*(new Date).getTimezoneOffset(),settings.now=36e5*parseInt((new Date).valueOf()/36e5),settings.today=24*parseInt(settings.now/36e5/24)*36e5,settings.start=settings.today-6048e5,settings.end=settings.today-864e5,$scope.query.granularity=3,$scope.query.start=settings.start,$scope.query.end=settings.end,$scope.query.days=7;var dailyContainer=$($("#topic_select > div:nth-child(1) > div:nth-child(2) > span.daterange")[0]),hourlyContainer=$($("#topic_select > div:nth-child(1) > div:nth-child(2) > span.daterange")[1]);dailyContainer.children("input:nth-child(2)").attr("max",new Date(settings.end).toISOString()),hourlyContainer.children("input:nth-child(2)").attr("max",new Date(settings.now-36e5+settings.timezoneOffset).toISOString());var selectedDateRange=kendo.observable({granularity:$scope.query.granularity,start:new Date($scope.query.start+settings.timezoneOffset),end:new Date($scope.query.end+settings.timezoneOffset),granularities:[{text:"Daily",value:3},{text:"Hourly",value:2}],visibleDateTimePicker:function(){return 2===this.get("granularity")},visibleDatePicker:function(){return 2!==this.get("granularity")}});switch(selectedDateRange.bind("change",function(e){if("granularity"===e.field){var granularity=this.get("granularity");if($scope.query.granularity=granularity,2===granularity)$scope.popInfoScope="Hourly";else{$scope.popInfoScope="Daily";var start=this.get("start"),end=this.get("end");start>settings.end&&this.set("start",new Date(settings.start+settings.timezoneOffset)),end>settings.end&&this.set("end",new Date(settings.end+settings.timezoneOffset))}$scope.startGetData()}else if("start"===e.field){var start=this.get("start").valueOf()-settings.timezoneOffset;$scope.query.start=start,CheckDateRangeSize()}else if("end"===e.field){var end=this.get("end").valueOf()-settings.timezoneOffset;$scope.query.end=end,CheckDateRangeSize()}}),kendo.bind($("#topic_select > div:nth-child(1) > div:nth-child(2)"),selectedDateRange),$scope.platform){case"twitter":totalrequests=14;break;default:totalrequests=15}$("#progress").progress({total:totalrequests}),$(".ui.accordion").accordion({exclusive:!1,animateChildren:!1,selector:{trigger:".segment .title",content:".segment"},onOpen:function(){$(this).find("div.echart").map(function(index,currentObj,array){echarts.getInstanceByDom(currentObj).resize()})}}),$("#server_status").popup({inline:!0,hoverable:!0,position:"bottom left"}),$scope.flags={m:!1,g:!1,r:!1},$scope.$watch("topic",function(nv,ov){nv&&$scope.startGetData()}),$("#scrollspy .list .item .label").popup(),$("#topic_select").dimmer("show"),$scope.getTopics=function(){$scope.service.getCate($scope.$stateParams.platform).then(function(data){$scope.topics=[],data.map(function(item){var flage=!1;item.Platforms.map(function(obj){obj.PlatformName.toLowerCase()==$scope.$stateParams.platform&&(flage=obj.isEnabled)}),flage&&$scope.topics.push(item.TechCategoryName)}),$("#topic_select").dimmer("hide"),-1!==$scope.topics.indexOf($rootScope.global.topic)&&($scope.topic=$rootScope.global.topic,$scope.startGetData())})},$timeout(function(){$scope.getTopics()},0),$scope.$on("data-got",function(event,arg){$scope.flags.m=!0,$("#progress").progress("increment"),$("#progress").progress("get value")===totalrequests&&$timeout(function(){$("#progress").hide()},1e3)}),$scope.startGetData=function(){if(!$scope.topic)return!1;$rootScope.global.topic=$scope.topic,$scope.flags.m=!1,$("div.echart").map(function(){echarts.getInstanceByDom(this).clear()}),$("#progress").progress("reset"),$("#progress").show(),$scope.query.topic=$scope.topic,getStatistic(),getUserDistribution(),getMentionedServiceTable(),$scope.$broadcast("start-get-data","home")},$scope.getDownloadUrl=function(){return $scope.$stateParams.platform?$scope.topic?void $scope.service.getDownloadUrl($scope.$stateParams.platform,$scope.topic,$scope.query.start,$scope.query.end).then(function(url){window.open(url)}):(toastr.error("Topic Select Required"),!1):(toastr.error("Platform Required"),!1)}}},{}],17:[function(require,module,exports){module.exports=function(){return{restrict:"E",templateUrl:"public/template/adminCard.html?time="+(new Date).getTime(),replace:!0,transclude:!0,link:function(scope,e,a){console.log(scope.CONST.APP_NAME)},controller:function($scope){this.selectPlatform=$scope.selectPlatform}}}},{}],18:[function(require,module,exports){function initChart(echartObj,chartOpt,groupName){setTimeout(function(){echartObj.resize(),echartObj.setOption(chartOpt),groupName&&(echartObj.group=groupName)},100)}function afterInit(rootscope,scope,echartObj){scope.complete=!0,"getMentionedMostServiceList"!==scope.apiFn&&"getKeywordsMentionedMostMapping"!==scope.apiFn&&setTimeout(function(){echartObj.resize()},150),scope.group&&echarts.connect(scope.group),rootscope.$broadcast("data-got",echartObj)}function customInfluenceData(fnPromise,scope){var influenceSeries=function(raw){var influenceData=raw.map(function(item){return item.vocinfluence.voctotalvol}),influencePOSIData=raw.map(function(item){return item.vocinfluence.positiveinfluencedvol}),influenceNEGData=raw.map(function(item){return item.vocinfluence.negativeinfluencedvol}),seriesData=[];switch(scope.pnscope){case"posi":seriesData=influencePOSIData;break;case"neg":seriesData=influenceNEGData;break;default:seriesData=influenceData}return{yAxis:{axisLabel:{formatter:function(value){return scope.thousandsuffix(value,1)}}},xAxis:{data:scope.$root.dateList.map(function(dt){return moment(dt).utc().format("L")})},series:[{name:"Influence Vol",type:"line",data:seriesData}]}},fn=influenceSeries;return fnPromise.then(function(data){return scope.validData(data),fn(data)})}function customSpikesData(fnPromise,scope,utilitySrv){var xAxis={data:utilitySrv.getTimeRange(scope.query.start,scope.query.end).map(function(dt){return moment(dt).utc().format("L")})},seriesVolume=function(source){var volumes=source.map(function(entity){return entity.dailytotalvol});return{xAxis:xAxis,series:[{name:"VoC",type:"bar",data:volumes}]}},seriesSpike=function(source){var spikes=source.map(function(entity){return entity.dailyspikevol});return{xAxis:xAxis,series:[{name:"Spikes",type:"bar",data:spikes}]}},seriesVolumeSpike=function(source){var volumes=source.map(function(entity){return entity.dailytotalvol}),spikes=source.map(function(entity){return entity.dailyspikevol});return{xAxis:xAxis,yAxis:[{name:"VoC",type:"value",nameTextStyle:{color:"#2EC7C9"}},{name:"Spike",type:"value",nameTextStyle:{color:"#BAA7E0"}}],series:[{name:"VoC",type:"bar",data:volumes},{name:"Spikes",type:"line",yAxisIndex:1,data:spikes}]}};return fnPromise.then(function(data){switch(scope.validData(data),scope.type){case"volume":return seriesVolume(data);case"spike":return seriesSpike(data);default:return seriesVolumeSpike(data)}})}function customDistributionData(fnPromise,scope){return fnPromise.then(function(data){return scope.validData(data),{series:[{data:[{value:data.positivetotalvol,name:"POS"},{value:data.neutraltotalvol,name:"NEU"},{value:data.negativetotalvol,name:"NEG"}]}]}})}function customWordCloudData(fnPromise,scope){var pnscope=scope.pnscope;return fnPromise.then(function(data){return scope.validData(data),{series:{data:data.map(function(item){switch(pnscope){case"posi":var value=item.vocinfluence.positivetotalvol;break;case"neg":var value=item.vocinfluence.negativetotalvol;break;default:var value=item.vocinfluence.voctotalvol}if(!value)return!1;var tmp={name:item.attachedobject};return tmp.value=value,tmp})}}})}function customServicesDistributionData(fnPromise,scope){var propertySelect=scope.propertySelect;return fnPromise.then(function(data){scope.validData(data);var seriesData=data.map(function(item){var tmp={name:item.attachedobject,url:item.url};switch(propertySelect){case"messages":var value=item.vocinfluence.voctotalvol;break;case"users":var value=item.vocinfluence.uniqueusers;break;default:var value=item.vocinfluence.voctotalvol}return tmp.value=value,tmp});seriesData=scope.order(seriesData,"-value");for(var tops=seriesData.slice(0,10),rest=seriesData.slice(10),sum=0,total=0,i=0;i11){var other={name:"Others",value:sum};tops.push(other)}seriesData=tops;var toolbox=null;return"all"!==scope.platform&&(toolbox={feature:{myTool1:{show:!0,title:"Switch to Details List",icon:"path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891",onclick:function(){scope.swithside()}}},show:!0}),{series:[{data:seriesData}],toolbox:toolbox}})}function customHoriBarData(scope){return{yAxis:{axisLabel:{interval:0,inside:!0},z:10,data:Object.keys(scope.raw)},series:[{name:scope.pnscope+" Vol",type:"bar",itemStyle:{normal:{color:"#ffb980"}},data:Object.keys(scope.raw).map(function(key){return scope.raw[key]})}]}}function customWorldData(fnPromise,scope){var propertySelect=scope.propertySelect;return fnPromise.then(function(data){scope.validData(data);var seriesData=data.map(function(item){var tmp={name:item.name};switch(propertySelect){case"positive":var value=item.positivetotalvol;break;case"negative":var value=item.negativetotalvol;break;case"users":var value=item.uniqueusers}return tmp.url=item.url,tmp.value=value,tmp});return scope.$root.$broadcast("set-region-table-data",{data:seriesData,association:scope.association}),{toolbox:{feature:{myTool1:{show:!0,title:"Switch to Others List",icon:"path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891",onclick:function(){scope.swithside()}}},show:"true"!==scope.noSwap},series:[{name:scope.title,type:"map",mapType:"world",roam:!0,itemStyle:{emphasis:{label:{show:!0}}},data:seriesData}]}})}function customRegionData(fnPromise,scope){var xData=[];return fnPromise.then(function(data){scope.validData(data);var seriesData=data.map(function(item){return xData.push(item.name),item.uniqueusers});return{dataZoom:[{show:!0,realtime:!0,start:0,end:100}],xAxis:{data:xData},series:[{name:"Volume",type:"bar",data:seriesData}]}})}function stackAxisData(fnPromise,utility,scope){var seriesData={undif:[],posi:[],neg:[],neu:[]},xAxisDate=[];return fnPromise.then(function(data){scope.validData(data);var timeFormatType="7"===scope.days?"hourly":"daily";return data.map(function(item){xAxisDate.push(utility.timeToString(item.attachedobject.timeslot,timeFormatType));var entity={value:item.vocinfluence.undefinedtotalvol,symbolSize:4};seriesData.undif.push(entity);var entity={value:item.vocinfluence.positivetotalvol,symbolSize:4};seriesData.posi.push(entity);var entity={value:item.vocinfluence.negativetotalvol,symbolSize:4};seriesData.neg.push(entity);var entity={value:item.vocinfluence.neutraltotalvol,symbolSize:4};seriesData.neu.push(entity)}),{legend:{data:["Undefined","Positive","Negative","Neutral"]},series:[{name:"Undefined",type:"line",showAllSymbol:!0,areaStyle:{normal:{}},data:seriesData.undif},{name:"Positive",type:"line",showAllSymbol:!0,areaStyle:{normal:{}},data:seriesData.posi},{name:"Negative",type:"line",showAllSymbol:!0,areaStyle:{normal:{}},data:seriesData.neg},{name:"Neutral",type:"line",showAllSymbol:!0,areaStyle:{normal:{}},data:seriesData.neu}],xAxis:{type:"category",boundaryGap:!1,axisLine:{onZero:!1},data:xAxisDate}}})}function barNegativeData(fnPromise,scope){return fnPromise.then(function(data){scope.validData(data);var usedData=scope.order(data,"-(vocinfluence.positivetotalvol+vocinfluence.negativetotalvol)").splice(0,10),likeData=[],dislikeData=[],yAxisData=[];return usedData.map(function(item){yAxisData.push(item.attachedobject),likeData.push(item.vocinfluence.positivetotalvol),dislikeData.push(-1*item.vocinfluence.negativetotalvol)}),{xAxis:[{type:"value"}],yAxis:{type:"category",axisTick:{show:!1},axisLabel:{interval:0},data:yAxisData,z:10},grid:{top:30,left:20,right:20,bottom:0,containLabel:!0},series:[{name:"Like",type:"bar",stack:"volume",areaStyle:{normal:{}},data:likeData},{name:"Dislike",type:"bar",stack:"volume",itemStyle:{normal:{color:"#ffb980"}},areaStyle:{normal:{show:!0,position:"left"}},data:dislikeData}]}})}function sentimentconversionData(fnPromise,utility,scope){var seriesData={totalVol:[],initPostive:[],afterSptPostive:[],initNegative:[],afterSptNegative:[]},xAxisDate=[];return fnPromise.then(function(data){return scope.validData(data),data.map(function(item){xAxisDate.push(utility.timeToString(item.SclingTime,"daily")),seriesData.totalVol.push(item.TotalVolume),seriesData.initPostive.push(item.InitialPostiveVolume),seriesData.afterSptPostive.push(item.AfterSupportPostiveVolume),seriesData.initNegative.push(item.InitialNegtiveVolume),seriesData.afterSptNegative.push(item.AfterSupportNegtiveVolume)}),{yAxis:[{type:"value"}],xAxis:[{type:"category",data:xAxisDate}],legend:{data:["Init Negative Volume","After Support Negative Volume"],show:!0},series:[{name:"Init Negative Volume",type:"line",areaStyle:{normal:{}},label:{normal:{show:!0}},data:seriesData.initNegative},{name:"After Support Negative Volume",type:"line",areaStyle:{normal:{}},label:{normal:{show:!0}},data:seriesData.afterSptNegative}]}})}function customHourlyData(fnPromise,key,utility,scope){var seriesData=[],xAxisDate=[],timeFormatType="7"===scope.days?"hourly":"daily";return fnPromise.then(function(data){return scope.validData(data),data.map(function(item){if(xAxisDate.push(utility.timeToString(item.attachedobject.timeslot,timeFormatType)),item.attachedobject.isspike)var entity={value:item.vocinfluence[key],symbol:"pin",symbolSize:20,label:{normal:{show:!0}}};else var entity={value:item.vocinfluence[key],symbolSize:4};seriesData.push(entity)}),{series:[{name:"Vol",type:"line", +showAllSymbol:!0,data:seriesData,label:{normal:{formatter:function(params){return scope.thousandsuffix(params.value)}}}}],xAxis:{type:"category",boundaryGap:!1,axisLine:{onZero:!1},data:xAxisDate}}})}function initAxisChartOpt(scope){return{title:{textStyle:{fontSize:13}},tooltip:{trigger:"axis"},toolbox:{show:!1,trigger:"axis",feature:{saveAsImage:{show:!0,title:"Save as Image"}}},xAxis:{type:"category",data:[]},yAxis:[{type:"value",axisLabel:{formatter:"{value}"}}],series:[]}}function initHoriChartOpt(scope){return{title:{textStyle:{fontSize:13}},tooltip:{trigger:"axis"},grid:{left:"5%"},toolbox:{show:!1,trigger:"axis",feature:{saveAsImage:{show:!0,title:"Save as Image"}}},xAxis:{type:"value",axisLabel:{formatter:function(value){return scope.thousandsuffix(value,1)}}},yAxis:{type:"category",data:[]},series:[]}}function initPieChartOpt(scope){var opt={title:{textStyle:{fontSize:13}},grid:{bottom:0},tooltip:{trigger:"item",formatter:"{b} : {c} ({d}%)"},legend:{show:!0,orient:"horizontal",x:"center",y:"top",data:[]},toolbox:{feature:{myTool1:{show:!0,title:"Switch to Others List",icon:"path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891",onclick:function(){scope.swithside()}}},show:!0},series:[{name:"Tech Scope Distribution",type:"pie",radius:[0,"40%"],label:{normal:{label:{show:!0},labelLine:{show:!0},formatter:"{b}\n ({d}%)"}},data:[]}]};return"true"===scope.noSwap&&(opt.toolbox.show=!1),opt}function initCloudWordChartOpt(scope){return{title:{textStyle:{fontSize:13},x:"center"},tooltip:{trigger:"item",formatter:"{b} : {c}"},series:{type:"wordCloud",gridSize:0,sizeRange:[10,20],shape:"circle",width:"100%",height:"100%",textStyle:{normal:{color:function(){return"rgb("+[Math.round(160*Math.random()),Math.round(160*Math.random()),Math.round(160*Math.random())].join(",")+")"}},emphasis:{shadowBlur:10,shadowColor:"#333"}},data:[]}}}function initHourlyChartOpt(scope){return{title:{textStyle:{fontSize:13}},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},toolbox:{show:!1,trigger:"axis",feature:{saveAsImage:{show:!0,title:"Save as Image"}}},dataZoom:[{show:!0,realtime:!0,start:0,end:100},{type:"inside",realtime:!0,start:0,end:100}],xAxis:{data:[]},yAxis:{},series:[]}}function initWorldChartOpt(scope){return{title:{textStyle:{fontSize:13}},tooltip:{trigger:"item"},toolbox:{show:!1,trigger:"axis",feature:{saveAsImage:{show:!0,title:"Save as Image"}}},visualMap:{min:0,inRange:{color:["lightskyblue","yellow","orangered"]}},series:[]}}function isEmpty(obj){if(null==obj)return!0;if(obj.length>0)return!1;if(0===obj.length)return!0;if("object"!=typeof obj)return!0;for(var key in obj)if(hasOwnProperty.call(obj,key))return!1;return!0}module.exports=function($rootScope,$filter,$q,$location,$compile,$timeout,utilitySrv){return{restrict:"E",templateUrl:"public/template/chart.html?time="+(new Date).getTime(),replace:!0,scope:{title:"@",type:"@",platform:"@",pnscope:"@",propertySelect:"@",days:"@",apiFn:"@",subFn:"@",group:"@",query:"=",noPop:"@",association:"@",swithTool:"@",noSwap:"@",stack:"@",info:"@"},link:function(scope,element,attrs){var _=scope,echartDom=$(element).find("div.echart");_.service=$rootScope.service,_.complete=!1,_.query=_.query||{},_.thousandsuffix=$filter("thousandsuffix"),_.compile=function(chart,dom){var el=$compile(chart)(_.$parent);$(dom).append(el)},_.swithside=function(){$(element).parent().parent().parent().shape("flip up")},_.initChartOpt=function(){switch(_.type){case"pie":_.chartOpt=initPieChartOpt(_);break;case"hori":_.chartOpt=initHoriChartOpt(_);break;case"wordcloud":_.chartOpt=initCloudWordChartOpt(_);break;case"hourly":_.chartOpt=initHourlyChartOpt(_);break;case"world":_.chartOpt=initWorldChartOpt(_);break;default:_.chartOpt=initAxisChartOpt(_)}}(),_.chartObj=echarts.init(echartDom[0],"macarons"),_.chartObj.on("click",function(params){if(0!==params.value)if(void 0===attrs.noPop)switch(_.subFn){case"getVoCDetailsByDate":var param={platform:_.platform,topic:_.query.topic,pnscope:_.pnscope,date:Math.floor(moment.utc(params.name,"L")/1e3),granularity:_.query.granularity};$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getVoCDetailsByPN":var pnscope=params.name.toLowerCase();"pos"==pnscope&&(pnscope="posi");var param={platform:_.platform,topic:_.query.topic,pnscope:pnscope,granularity:_.query.granularity,start:_.query.start,end:_.query.end};$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getVoCDetailsByServiceName":var param={platform:_.platform,topic:_.query.topic,service:params.name,pnscope:_.pnscope,granularity:_.query.granularity,start:_.query.start,end:_.query.end};"Others"===params.name?_.swithside():$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getVoCDetailsByUser":var param={platform:_.platform,topic:_.query.topic,user:params.name,pnscope:_.pnscope,granularity:_.query.granularity,start:_.query.start,end:_.query.end};$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getVoCDetailsByCountry":var pnscope=_.pnscope;pnscope="positive"==pnscope?"posi":"negative"==pnscope?"neg":"neutral"==pnscope?"neu":null;var param={platform:_.platform,topic:_.query.topic,pnscope:pnscope,country:params.name.toLowerCase(),days:_.days};console.log(param),$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getSubPageVoCDetails":var date="7"===_.days?moment(params.name).utc():moment.utc(params.name),param={platform:_.platform,topic:_.query.topic,date:Math.floor(date/1e3),pnscope:_.pnscope,days:_.days};$rootScope.popSubWin({fn:_.subFn,param:param});break;case"getSubPageVoCDetailsbyKeywords":var param={platform:_.platform,topic:_.query.topic,keywords:params.name,pnscope:_.pnscope,days:_.days};$rootScope.popSubWin({fn:_.subFn,param:param})}else if(attrs.redirect){var path="/";switch(params.name){case"twitter":path="/social/"+params.name;break;case"so":case"sf":case"su":path="/thirdParty/"+params.name;break;case"msdn":case"tn":path="/msPlatform/"+params.name}scope.$apply(function(){$location.path(path)})}}),_.getData=function(location){if(attrs.location===location){_.complete=!1;var apiFn=_.service[_.apiFn];switch(_.apiFn){case"getSpikes":var fnPromise=apiFn(_.platform,_.query.topic,_.query);customSpikesData(fnPromise,_,utilitySrv).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getInfluence":if(_.platform){var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query);customInfluenceData(fnPromise,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)})}else{_.platforms=_.$parent.enabledPlatforms,_.raw={},_.platforms.forEach(function(element){_.raw[element]=0},this);var fnPromises=_.platforms.map(function(item){return apiFn(item,_.query.topic,_.pnscope,{granularity:3,start:_.query.start,end:_.query.end}).then(function(data){var seriesData=data.map(function(raw){switch(_.pnscope){case"posi":var value=raw.vocinfluence.positiveinfluencedvol;break;case"neg":var value=raw.vocinfluence.negativeinfluencedvol;break;case"neu":var value=raw.vocinfluence.neutralinfluencedvol;break;case"undif":var value=raw.vocinfluence.undefinedinfluencedvol;break;default:var value=raw.vocinfluence.vocinfluencedvol}return value});_.raw[item]=seriesData.reduce(function(previousValue,currentValue,currentIndex,array){return previousValue+currentValue},0),_.hasData=!0})});$q.all(fnPromises).then(function(){var config=customHoriBarData(_);_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)})}break;case"getDistribution":var fnPromise=apiFn(_.platform,_.query.topic,_.query);customDistributionData(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getMentionedMostServiceList":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customWordCloudData;fn(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getMentionedMostServiceListByUserVol":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query);_.order=$filter("orderBy");var fn=customServicesDistributionData;switch(_.type){case"pie":fn=customServicesDistributionData;break;case"wordcloud":fn=customWordCloudData}fn(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getMentionedMostServiceDistribution":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query);_.order=$filter("orderBy");var fn=customServicesDistributionData;"hori"===_.type&&(fn=barNegativeData),fn(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getKeywordsMentionedMostMapping":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customWordCloudData;fn(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getUserVolSpikes":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customHourlyData;fn(fnPromise,"uniqueusers",utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getMessageVolSpikes":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customHourlyData,key="";switch(_.pnscope){case"posi":key="positivetotalvol";break;case"neg":key="negativetotalvol";break;default:key="voctotalvol"}fn(fnPromise,key,utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getStackMessageVol":var fnPromise=_.service.getMessageVolSpikes(_.platform,_.query.topic,_.pnscope,_.query),fn=stackAxisData;fn(fnPromise,utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getInfluenceVolSpikes":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customHourlyData;fn(fnPromise,"vocinfluencedvol",utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getUserRegionVolSpikes":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customHourlyData;fn(fnPromise,"uniqueuserregion",utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt,_.group),afterInit($rootScope,_,_.chartObj)});break;case"getRegionDistribution":var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query);if("world"===_.type)var fn=customWorldData;else var fn=customRegionData;_.hasData=!0,fn(fnPromise,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"getVoCDetailsByServiceName1":var fnPromise=$q.resolve(!0),fn=barNegativeData;_.hasData=!0,fn(fnPromise,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)});break;case"sentimentconversion":var fnPromise=_.service.getSentimentTrend(_.platform,_.query.topic,_.pnscope,_.days),fn=sentimentconversionData;fn(fnPromise,utilitySrv,_).then(function(config){_.chartOpt=angular.extend(_.chartOpt,config),initChart(_.chartObj,_.chartOpt),afterInit($rootScope,_,_.chartObj)})}}},_.$on("start-get-data",function(event,arg){_.complete=!1,_.getData(arg)}),_.$on("fresh-most-mentioned",function(evt,arg){if(("getMentionedMostServiceList"===_.apiFn||"getMentionedMostServiceListByUserVol"===_.apiFn)&&"home"===attrs.location){var apiFn=_.service[_.apiFn];if(arg.pnscope===_.pnscope){_.platform=arg.platform?arg.platform:_.platform,_.pnscope=arg.pnscope?arg.pnscope:_.pnscope,_.topic=arg.topic?arg.topic:_.topic;var fnPromise=apiFn(_.platform,_.query.topic,_.pnscope,_.query),fn=customWordCloudData;_.chartOpt=initCloudWordChartOpt(_),fn(fnPromise,_).then(function(config){_.chartOpt=angular.merge(_.chartOpt,config);var clientWidth=element.parents(".sides").width();element.find(".echart").width(clientWidth),_.chartObj.setOption(_.chartOpt)})}}}),_.$on("set-sub-widows-charts-data",function(evt,arg){if("sub"===attrs.location){var config={};switch(_.type){case"pie":var raw=arg.data;_.validData(raw),config={series:[{data:[{value:raw.vocpositivecount,name:"POS"},{value:raw.vocneutralcount,name:"NEU"},{value:raw.vocnegativecount,name:"NEG"}]}]},_.chartOpt=angular.merge(_.chartOpt,config);break;case"wordcloud":for(var raw=arg.data.vocmentionedmost,seriesData=[],i=0;i
    {{ title }}
    ',link:function(scope,element,attrs,DropDownController){scope.dropdown_class="ui selection dropdown",scope.menu_class="menu transition hidden",scope.text_class="default text",scope.original_title=scope.title,"true"===scope.open?(scope.is_open=!0,scope.dropdown_class=scope.dropdown_class+" active visible",scope.menu_class=scope.menu_class+" visible"):scope.is_open=!1,scope.element=element,scope.$watch("model",function(value){DropDownController.update_title(value)}),element.bind("click",function(){!1===scope.is_open?scope.$apply(function(){scope.dropdown_class="ui selection dropdown active visible",scope.menu_class="menu transition visible"}):scope.$apply(function(){scope.dropdown_class="ui selection dropdown",scope.menu_class="menu transition hidden"}),scope.is_open=!scope.is_open})}}}).directive("dropdownGroup",function(){return{restrict:"AE",replace:!0,transclude:!0,require:"^dropdown",scope:{title:"=title",value:"=value"},template:'
    {{ item_title }}
    ',link:function(scope,element,attrs,DropDownController){void 0===scope.title?scope.item_title=attrs.title||element.children()[0].innerHTML:scope.item_title=scope.title,void 0===scope.value?scope.item_value=attrs.value||scope.item_title:scope.item_value=scope.value,DropDownController.add_option(scope.item_title,scope.item_value),element.bind("click",function(){DropDownController.update_model(scope.item_title,scope.item_value)}),scope.$on("$destroy",function(){DropDownController.remove_option(scope.item_title,scope.item_value)})}}});var app=angular.module("app.Directive",["ngSanitize","angularify.semantic.dropdown"]);app.directive("ngEchart",require("./chartDirective")),app.directive("ngStatistic",require("./statisticDirective")),app.directive("ngStatisticLabel",require("./statisticLabelDirective")),app.directive("ngScrollSpy",require("./scrollspyDirective")),app.directive("ngChartShape",require("./chartShapeDirective")),app.directive("userList",require("./userListDirective")),app.directive("subWindow",require("./subWindowDirective")),app.directive("topicQuery",require("./topicQueryDirective")),app.directive("selectPage",require("./selectPageDirective")),app.directive("mentionedTable",require("./mentionedTableDirective")),app.directive("regionTable",require("./regionTableDirective")),app.directive("adminCard",require("./adminCardDirective")),app.directive("platformCardContent",require("./platformCardContentDirective")),app.directive("scopeCardContent",require("./scopeCardContentDirective")),app.directive("scopeTagsEditer",require("./scopeTagsDirective")),app.directive("fittext",function($timeout){return{restrict:"A",scope:{fittext:"=",height:"@"},link:function(scope,element,attr){var regexp=/\d+(\.\d+)?/;$timeout(function(){for(;element.height()>scope.height;){var fontSize=element.css("font-size").match(regexp);element.css("font-size",fontSize[0]-1)}element.height(scope.height)},0)}}}),module.exports="app.Directive"},{"./adminCardDirective":17,"./chartDirective":18,"./chartShapeDirective":19,"./mentionedTableDirective":21,"./platformCardContentDirective":22,"./regionTableDirective":23,"./scopeCardContentDirective":24,"./scopeTagsDirective":25,"./scrollspyDirective":26,"./selectPageDirective":27,"./statisticDirective":28,"./statisticLabelDirective":29,"./subWindowDirective":30,"./topicQueryDirective":31,"./userListDirective":32}],21:[function(require,module,exports){module.exports=function($rootScope,$compile){return{restrict:"E",templateUrl:"public/template/mentioned_table.html?time="+(new Date).getTime(),replace:!0,scope:{platform:"@",query:"=",association:"@",days:"@"},link:function(scope,e,a){$rootScope.$on("set-mentioned-table-data",function(evt,arg){scope.association===arg.association&&(scope.total=arg.total,scope.mostMentionedService=arg.data)}),scope.popDetail=function(serverName){var param={platform:scope.platform,topic:scope.query.topic,service:serverName,PNScope:"all",days:scope.days};$rootScope.popSubWin({fn:"getVoCDetailsByServiceName",param:param})},scope.swithside=function(){$(e).parent().parent().parent().shape("flip up")},scope.getters={twitterInf:function(value){return value.user.followers_count+value.user.friends_count}}}}}},{}],22:[function(require,module,exports){module.exports=function(){return{restrict:"E",templateUrl:"public/template/platformCardContent.html?time="+(new Date).getTime(),replace:!0,link:function(scope,e,a){}}}},{}],23:[function(require,module,exports){module.exports=function($rootScope,$compile){return{restrict:"E",templateUrl:"public/template/region_table.html?time="+(new Date).getTime(),replace:!0,scope:{platform:"@",query:"=",association:"@",days:"@"},link:function(scope,e,a){$rootScope.$on("set-region-table-data",function(evt,arg){scope.association===arg.association&&(scope.total=arg.total,scope.data=arg.data)}),scope.swithside=function(){$(e).parent().parent().parent().shape("flip up")},scope.getters={twitterInf:function(value){return value.user.followers_count+value.user.friends_count}}}}}},{}],24:[function(require,module,exports){module.exports=function(CONST){return{restrict:"E",templateUrl:"public/template/scopeCardContent.html?time="+(new Date).getTime(),replace:!0,transclude:!0,link:function(scope,e,a,adminCardCtrl){console.log(adminCardCtrl),scope.CONST=CONST,(scope.init=function(){scope.twitterKeywords=[],scope.sotags=[],scope.sutags=[],scope.sftags=[],scope.msdncategorys=[],scope.tncategorys=[]})(),scope.decline=function(){scope.init()}}}}},{}],25:[function(require,module,exports){module.exports=function(){return{restrict:"E",templateUrl:"public/template/scopeTagsEditer.html?time="+(new Date).getTime(),replace:!0,link:function(scope,e,a){scope.$watch("selectedTopicIndex",function(nv,ov){scope.selectedPlatformIndex&&""!==scope.selectedTopicIndex&&(scope.kwds=scope.TopicWithForum[scope.selectedPlatformIndex].topics[scope.selectedTopicIndex].topicsettings.Keywords)})}}}},{}],26:[function(require,module,exports){module.exports=function(){return{restrict:"A",link:function(scope,e,a){scope.isSmall=window.innerWidth<1510?1:0,$(window).resize(function(){scope.$apply(function(){window.innerWidth<1510?scope.isSmall=1:scope.isSmall=0})})}}}},{}],27:[function(require,module,exports){module.exports=function(){return{restrict:"E",template:'
    ',link:function(scope,element,attrs){scope.$watch("currentPage",function(c){scope.inputPage=c})}}}},{}],28:[function(require,module,exports){var label_type={compared:"Compared with",spike:"Vol Spike Detected",string:""};module.exports=function($parse,$filter,$timeout){return{restrict:"E",templateUrl:"public/template/statistic.html?time="+(new Date).getTime(),replace:!0,scope:{data:"=",query:"=",title:"@",comment:"@",color:"@"},link:function(scope,e,a){var numberFormat=$filter("thousandsuffix");$filter("percentage");scope.volume=scope.data.volume,scope.comment&&(scope.comment=scope.data.comment,$($(e).find(".popup").get(0)).popup()),scope.randerUI=function(){switch(a.type){case"joinedusers":scope.volume=numberFormat(scope.data.objectcountthistime),scope.query.days<=7?scope.labels=[{text:label_type.compared+" (Last "+scope.query.days+" days)",volume:scope.data.comparedratio,type:"ratio",isCompared:!0},{text:label_type.spike+" (Last "+scope.query.days+" days)",volume:scope.data.detectedhourlyspikesvol,color:"red"}]:scope.labels=[{text:label_type.spike+" (Last "+scope.query.days+" days)",volume:scope.data.detectedhourlyspikesvol,color:"red"}];break;case"regionofusers":scope.volume=numberFormat(scope.data.objectcountthistime),scope.volume=0===scope.volume?"No Data Available":scope.volume,"twitter"!==scope.$parent.$parent.platform.toLowerCase()||scope.query.days>7?scope.labels=[]:scope.labels=[{text:label_type.compared+" (Last "+scope.query.days+" days)",volume:scope.data.comparedratio,type:"ratio",isCompared:!0},{text:label_type.spike+" (Last "+scope.query.days+" days)",volume:scope.data.detectedhourlyspikesvol,color:"red"}];break;case"influenceofusers":scope.volume=numberFormat(scope.data.objectcountthistime),scope.query.days<=7?scope.labels=[{text:label_type.compared+" (Last "+scope.query.days+" days)",volume:scope.data.comparedratio,type:"ratio",isCompared:!0},{text:label_type.spike+" (Last "+scope.query.days+" days)",volume:scope.data.detectedhourlyspikesvol,color:"red"}]:scope.labels=[{text:"Spike Detected (Last "+scope.query.days+" days)",volume:scope.data.detectedhourlyspikesvol,color:"red"}];break;case"mentionedservicecount":scope.volume=numberFormat(scope.data.objectcountthistime),scope.query.days<=7?scope.labels=[{text:label_type.compared+" (Last "+scope.query.days+" days)",volume:scope.data.comparedratio,type:"ratio",isCompared:!0},{text:label_type.spike+" (Last "+scope.query.days+" days)",volume:scope.data.detectedhourlyspikesvol,color:"red"}]:scope.labels=[{text:label_type.spike+" (Last "+scope.query.days+" days)",volume:scope.data.detectedhourlyspikesvol,color:"red"}];break;case"mostmentionedservice":scope.volume=scope.data[0].attachedobject;var tmp=scope.data.map(function(item){return item.attachedobject+"("+item.occupyratio+"%)"});scope.labels=[{text:tmp.join(",")}];break;case"mostlikedservice":scope.volume=scope.data.mostlikedservice[0].attachedobject+":"+scope.data.mostdislikedservice[0].attachedobject,scope.style={"font-size":"26px"},scope.labels=[{text:scope.data.mostlikedservice.map(function(item){return item.attachedobject+"("+item.occupyratio+"%)"}).join(","),color:"green"},{text:scope.data.mostdislikedservice.map(function(item){return item.attachedobject+"("+item.occupyratio+"%)"}).join(","),color:"red"}];break;case"vocinsightsVol":scope.volume=numberFormat(scope.data.objectcountthistime.voctotalvol),scope.query.days<=7?scope.labels=[{text:label_type.compared+" (Last "+scope.query.days+" days)",volume:scope.data.comparedratio,type:"ratio",isCompared:!0},{text:label_type.spike+" (Last "+scope.query.days+" days)",volume:scope.data.detectedhourlyspikesvol,color:"red"}]:scope.labels=[{text:label_type.spike+" (Last "+scope.query.days+" days)",volume:scope.data.detectedhourlyspikesvol,color:"red"}];break;case"vocinsightsPN":var originBoj=scope.data.objectcountthistime;scope.volume=[numberFormat(originBoj.positivetotalvol,0),numberFormat(originBoj.negativetotalvol,0),numberFormat(originBoj.neutraltotalvol,0)],scope.subVolume=[originBoj.positivetotalvol/originBoj.voctotalvol,originBoj.negativetotalvol/originBoj.voctotalvol,originBoj.neutraltotalvol/originBoj.voctotalvol],scope.labels=[{text:"POS "+label_type.spike+" (Last "+scope.query.days+" days)",volume:originBoj.detectedposispikesvol,color:"green"},{text:"NEG "+label_type.spike+" (Last "+scope.query.days+" days)",volume:originBoj.detectednegspikesvol,color:"red"}];break;case"mostposifrom":var originBoj=scope.data.objectcountthistime;scope.volume=[numberFormat(originBoj.positiveinfluencedvol,0),numberFormat(originBoj.negativeinfluencedvol,0)],scope.subVolume=[originBoj.positiveinfluencedvol/originBoj.vocinfluencedvol,originBoj.negativeinfluencedvol/originBoj.vocinfluencedvol],scope.labels=[]}},scope.randerUI(),scope.isVolObj=function(){return angular.isArray(scope.volume)||angular.isObject(scope.volume)},scope.$watch("data",function(newV,oldV){$timeout(function(){scope.randerUI()},0)})}}}},{}],29:[function(require,module,exports){module.exports=function(){return{restrict:"AE",templateUrl:"public/template/statistic_label.html?time="+(new Date).getTime(),scope:{label:"="},link:function(scope,e,a){scope.render=function(){scope.label=scope.label||{},scope.style=scope.label.style||"",scope.volume=isNaN(Number(scope.label.volume))?null:Number(scope.label.volume),scope.text=scope.label.text||"",scope.color=scope.label.color||"black",scope.type=scope.label.type||"",scope.isCompared=scope.label.isCompared||"",scope.getColor=function(){return null===scope.volume?scope.color:""}},scope.$watch("label",function(nv,ov){scope.render()})}}}},{}],30:[function(require,module,exports){function initHourlyChartData(raw,utility){var seriesData=[],xAxisDate=[];raw.map(function(item){if(xAxisDate.push(utility.timeToString(item.attachedobject)),item.vocinfluence.detectedspikesvol)var entity={value:item.vocinfluence.voctotalvol,symbol:"pin",symbolSize:20,label:{normal:{show:!0}}};else var entity={value:item.vocinfluence.voctotalvol,symbolSize:4};seriesData.push(entity)});return{title:{text:"Volume Trend",textStyle:{fontSize:12},x:"center"},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},dataZoom:[{show:!0,realtime:!0,start:0,end:100},{type:"inside",realtime:!0,start:0,end:100}],xAxis:{type:"category",boundaryGap:!1,axisLine:{onZero:!1},data:xAxisDate},yAxis:{},series:[{name:"Vol",type:"line",showAllSymbol:!0,data:seriesData}]}}module.exports=function($rootScope,$window,$compile,$filter,utilitySrv,CONST){return{restrict:"E",templateUrl:"public/template/sub_window.html?time="+(new Date).getTime(),replace:!0,scope:{title:"@",platform:"@",query:"="},link:function(scope,e,a){scope.myChart=echarts.init($(e).find(".hourly-charts").get(0)),scope.getData=function(params){var country=(params.param.country||"").toLowerCase();"united states of america"===country&&(country="united states"),$window.threadOption={function:params.fn,platform:params.param.platform.toLowerCase(),topic:params.param.topic,pnscope:params.param.pnscope,days:params.param.days,params:{date:params.param.date,country:country,service:params.param.service,userid:params.param.userid,index:params.param.index,keywords:params.param.keywords,IsFuzzyQuery:params.param.IsFuzzyQuery,msgType:params.param.msgType,timestamp:params.param.timestamp}},$window.threadStore?($window.threadStore.threads.data([]),$window.threadStore.threads.page(1),$window.threadStore.set("RefreshTrigger",!$window.threadStore.RefreshTrigger)):($window.threadStore=kendo.observable({RefreshTrigger:!1,threads:new kendo.data.DataSource({transport:{read:{url:CONST.SERVICE_INFO.ENDPOINT+"GetDetailsByComplexFilter",dataType:"json",type:"POST",contentType:"application/x-www-form-urlencoded"},parameterMap:function(data,operation){if("read"===operation){var search;data.filter&&data.filter.filters&&data.filter.filters.length>0&&(search=data.filter.filters[0].value),$window.threadOption.search=search;var post={function:$window.threadOption.function,platform:$window.threadOption.platform,topic:$window.threadOption.topic,pnscope:$window.threadOption.pnscope,days:$window.threadOption.days,params:{},search:search,page:data.page,pagesize:data.pageSize, +sortby:data.sort[0]?data.sort[0].field:"CreatedTime",sort:data.sort[0]?data.sort[0].dir:"desc"};return $window.threadOption.params&&$.each($window.threadOption.params,function(field,value){value&&(post.params[field]=value)}),kendo.stringify(post)}}},serverPaging:!0,pageSize:10,serverSorting:!0,sort:{field:"CreatedTime",dir:"desc"},serverFiltering:!0,schema:{total:"count",data:function(response){var data=response.messagesorthreads;return $.each(data,function(pos,data){data.CreatedTime=new Date(1e3*data.CreatedTime)}),data}}})}),kendo.bind($("#gridThreads"),$window.threadStore)),scope.needMentioned=!0,scope.platform=params.param.platform.toLowerCase();var fnPromise,fn=$rootScope.service[params.fn];switch(params.fn){case"getVoCDetailsByDate":fnPromise=fn(params.param.platform,params.param.topic,params.param.date,params.param.pnscope,params.param.granularity);break;case"getVoCDetailsByPN":fnPromise=fn(params.param.platform,params.param.topic,params.param.pnscope,params.param);break;case"getVoCDetailsByServiceName":scope.needMentioned=!1,fnPromise=fn(params.param.platform,params.param.topic,params.param.service,params.param.pnscope,params.param);break;case"getVoCDetailsByUser":fnPromise=fn(params.param.platform,params.param.topic,params.param.userid,params.param.index,params.param.pnscope,params.param);break;case"getVoCDetailsByCountry":fn=$rootScope.service.getVoCDetailsByPN,fnPromise=fn(params.param.platform,params.param.topic,params.param.country,params.param.days);break;case"getSubPageVoCDetails":fnPromise=fn(params.param.platform,params.param.topic,params.param.date,params.param.pnscope,params.param.days);break;case"getSubPageVoCDetailsbyKeywords":fnPromise=fn(params.param.platform,params.param.topic,params.param.keywords,params.param.pnscope,params.param.IsFuzzyQuery,params.param.days);break;case"getVoCDetailsBySpikeDetected":fnPromise=fn(params.param.platform,params.param.msgType,params.param.topic,params.param.timestamp)}fnPromise.then(function(data){scope.raw=data,scope.tabledata=data.messagesorthreads,scope.$broadcast("set-user-data",data.topusers),scope.$broadcast("set-sub-widows-charts-data",{data:data}),scope.chartOpt=initHourlyChartData(data.volhourlylist,utilitySrv),scope.myChart.setOption(scope.chartOpt),scope.myChart.resize(),scope.complete=!0})},scope.$on("start-get-data-in-window",function(event,arg){scope.raw=[],scope.tabledata=[],scope.chartOpt={},scope.$broadcast("set-user-data",[]),scope.getData(arg),scope.complete=!1}),scope.getters={twitterInf:function(value){return value.user.followers_count+value.user.friends_count}},scope.swithside=function(){$("#shape-pup").shape("flip up")}}}}},{}],31:[function(require,module,exports){module.exports=function(){return{restrict:"EA",templateUrl:"public/template/topicQuery.html?time="+(new Date).getTime(),replace:!0,link:function(scope,e,a){scope.isSmall=window.innerWidth<1510?1:0,$(window).resize(function(){scope.$apply(function(){window.innerWidth<1510?scope.isSmall=1:scope.isSmall=0})})}}}},{}],32:[function(require,module,exports){module.exports=function($rootScope){return{restrict:"E",templateUrl:"public/template/user_list.html?time="+(new Date).getTime(),replace:!0,scope:{title:"@",platform:"@",query:"=",pnscope:"@",noPop:"@",days:"@"},link:function(scope,e,a){scope.pnscope=scope.pnscope||"all",scope.getAvatorUrl=function(user){return user.attachedobject.url||"public/images/"+scope.platform.toLowerCase()+".png"},scope.onClick=function(user,index){if(void 0===a.noPop){var param={platform:scope.platform,topic:scope.query.topic,userid:user.attachedobject.userId,index:index,pnscope:scope.pnscope,granularity:scope.query.granularity,start:scope.query.start,end:scope.query.end};$rootScope.popSubWin({fn:"getVoCDetailsByUser",param:param})}},scope.getData=function(location,force){a.location===location&&$rootScope.service.getUser(scope.platform,5,scope.query.topic,scope.pnscope,scope.query).then(function(data){scope.users=data.slice(0,5),scope.complete=!0,$rootScope.$broadcast("data-got")})},scope.$on("start-get-data",function(event,arg){scope.complete=!1,scope.getData(arg)}),scope.$on("set-user-data",function(event,arg){"sub"==a.location&&(scope.users=arg,scope.complete=!0)})}}}},{}],33:[function(require,module,exports){var app=angular.module("app.Filter",["app.Srv"]);app.filter("percentage",["$window",function($window){return function(input,decimals,notAbsolute,suffix){var decimals=angular.isNumber(decimals)?decimals:3,suffix=suffix||"%";return $window.isNaN(input)?"":(notAbsolute||(input=Math.abs(input)),Math.round(input*Math.pow(10,decimals+2))/Math.pow(10,decimals)+suffix)}}]),app.filter("sentimentScore",["$window",function($window){var dict={"-1":"Undefined",0:"Negative",2:"Neutral",4:"Positive"};return function(input){return dict[input.toString()]}}]),app.filter("timetostring",["utilitySrv",function(utilitySrv){return function(input,type){return utilitySrv.timeToString(input,type)}}]),app.filter("timeToLocalString",["utilitySrv",function(utilitySrv){return function(input,type){return utilitySrv.timeToLocalString(input,type)}}]),app.filter("mankindTime2String",["utilitySrv",function(utilitySrv){return function(input){return utilitySrv.mankindTime2String(input)}}]),app.filter("thousandsuffix",["$window",function($window){return function(input,decimals){var exp,decimals=angular.isNumber(decimals)?decimals:2,suffixes=["k","M","G","T","P","E"];return $window.isNaN(input)?input:input<1e3?input:(exp=Math.floor(Math.log(input)/Math.log(1e3)),(input/Math.pow(1e3,exp)).toFixed(decimals)+suffixes[exp-1])}}]),app.filter("findObjectInArray",function(){return function(input,perproty,value){for(var i=0;i0&&($.each(notifications,function(i,notification){collection.push(notification)}),lastsynctime=new Date/1e3|0)})}catch(err){console.log("connection Error",err)}}var lastsynctime=new Date/1e3|0,collection=[];listenNewDetection();var timer=setInterval(listenNewDetection,6e4);return{collection:collection,status:function(){return timer?1:3},reconnect:function(){timer&&clearInterval(timer),timer=setInterval(listenNewDetection,1e4)}}}),app.factory("rawdataSrv",function(baseSrv){function setDateTimeRange(p,s){if(s){var granularity=s.granularity||3,start=s.start/1e3,end=(s.end+(2==granularity?36e5:864e5))/1e3;p=p||{},p.fromcycle=granularity,p.start=start,p.end=end}}return{getCate:function(platform){var params=params||{};return params.platform=platform||"all",baseSrv.get("GetAllEnabledTopicsByPlatform",params)},getUser:function(platform,topNum,topic,PNScope,source){var params=params||{};return params.platform=platform||"all",params.topNum=topNum||5,params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetTopUsers",params)},getSpikes:function(platform,topic,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",setDateTimeRange(params,source),baseSrv.get("GetDailyVolSpikes",params)},getDistribution:function(platform,topic,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",setDateTimeRange(params,source),baseSrv.get("GetPNDistribution",params)},getInfluence:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetDailyInfluence",params)},getMentionedMostServiceList:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetMentionedMostServiceList",params)},getMentionedMostServiceListByUserVol:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetMentionedMostServiceListByUserVol",params)},getMentionedMostServiceDistribution:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetMentionedMostServiceList",params)},getVoCDetailsByDate:function(platform,topic,date,PNScope,granularity){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.date=date||Math.floor((new Date).getTime()/1e3),params.PNScope=PNScope||"all",params.fromcycle=granularity||3,baseSrv.get("GetVoCDetailsByDate",params)},getVoCDetailsByPN:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetVoCDetailsByPN",params)},getVoCDetailsByServiceName:function(platform,topic,service,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.servicename=service||"webapp",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetVoCDetailsByServiceName",params)},getVoCDetailsByUser:function(platform,topic,user,index,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.userid=user||1234,params.index=void 0!==index?index:-1,params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetVoCDetailsByUser",params)},getImpactSummary:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetImpactSummary",params)},getUserVolSpikes:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetUserVolSpikes",params)},getMessageVolSpikes:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetMessageVolSpikes",params)},getInfluenceVolSpikes:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetInfluenceVolSpikes",params)},getUserRegionVolSpikes:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetUserRegionVolSpikes",params)},getKeywordsMentionedMostMapping:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetKeywordsMentionedMostMapping",params)},getSubPageVoCDetails:function(platform,topic,date,PNScope,days){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.Date=date||Math.floor((new Date).getTime()/1e3),params.PNScope=PNScope||"all",params.days=days||7,baseSrv.get("GetSubPageVoCDetails",params)},getSubPageVoCDetailsbyKeywords:function(platform,topic,keywords,PNScope,IsFuzzyQuery,days){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"all",params.keywords=keywords||"notworking",params.PNScope=PNScope||"all",params.IsFuzzyQuery=IsFuzzyQuery||"false",params.days=days||7,baseSrv.get("GetSubPageVoCDetailsbyKeywords",params)},getSysDetections:function(platform,msgType,topic,downloadable,bgTime,egTime){var params=params||{};return params.platform=platform||"all",params.msgType=msgType||"all",params.topic=topic||"all",params.downloadable=downloadable||"all",params.bgTime=bgTime||0,params.egTime=egTime||0,baseSrv.get("GetSysDetections",params)},getPlatformSyncSetting:function(platform){var params=params||{};return params.platform=platform||"all",baseSrv.get("GetPlatformSyncSetting",params)},getVoCDetailsBySpikeDetected:function(platform,msgType,topic,timestamp){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"azure",params.msgType=msgType||"all",params.timestamp=timestamp||0,baseSrv.get("GetVoCDetailsBySpikeDetected",params)},getUserLanguageDistribution:function(platform,topic,days){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"azure",params.days=days||7,baseSrv.get("GetUserLanguageDistribution",params)},getRegionDistribution:function(platform,topic,PNScope,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"azure",params.PNScope=PNScope||"all",setDateTimeRange(params,source),baseSrv.get("GetRegionDistribution",params)},getSentimentTrend:function(platform,topic,PNScope,days){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"azure",params.PNScope=PNScope||"all",params.days=days||7,baseSrv.get("GetSentimentTrend",params)},saveForumServiceSetting:function(data){return baseSrv.post("SaveForumServiceSetting",data,{headers:{"Content-Type":"text/plain"}})},getDownloadUrl:function(platform,topic,source){var params=params||{};return params.platform=platform||"twitter",params.topic=topic||"azure",setDateTimeRange(params,source),baseSrv.get("GetDownloadUrl",params)},getSubscribeSettings:function(platform,topic,msgtype,servicename){var params=params||{};return params.platform=platform||"all",params.topic=topic||"all",params.msgtype=msgtype||"all",params.servicename=servicename||"all",baseSrv.get("GetSubscribeSettings",params)},createSubscribe:function(params){var params=params||{};return baseSrv.post("CreateSubscribe",{groupid:params.id,email:params.email,subscription:{platforms:[params.platform||"all"],topics:params.topics,messagetypes:[params.msgtype||"all"]}},{headers:{"Content-Type":"text/plain"}})},removeSubscription:function(email){return baseSrv.get("DeleteSubscribeByEmail",{email:email})},removeSubscriptionRule:function(id){return baseSrv.get("DeleteSubscribeByGroupId",{groupId:id})},checkAdminAccessRights:function(email){var params=params||{};return params.email=email,baseSrv.get("CheckAdminAccessRights",params)}}}),module.exports="app.Srv"},{"./utility":35}],35:[function(require,module,exports){module.exports=function($filter){return Date.prototype.format=function(format){var o={"M+":this.getUTCMonth()+1,"d+":this.getUTCDate(),"h+":this.getUTCHours(),"m+":this.getUTCMinutes(),"s+":this.getUTCSeconds(),"q+":Math.floor((this.getUTCMonth()+3)/3),S:this.getUTCMilliseconds()};(/(y+)/.test(format)||/(Y+)/.test(format))&&(format=format.replace(RegExp.$1,(this.getUTCFullYear()+"").substr(4-RegExp.$1.length)));for(var k in o)new RegExp("("+k+")").test(format)&&(format=format.replace(RegExp.$1,1==RegExp.$1.length?o[k]:("00"+o[k]).substr((""+o[k]).length)));return format},{toPercent:function(data,decimal){return parseFloat(parseFloat(100*data).toFixed(decimal))},getLastXMonthDate:function(x){var m=new Date;return m.setDate(1),m.setUTCMonth(m.getUTCMonth()-parseInt(x)-1),m.getUTCFullYear()+"/"+(m.getUTCMonth()+1)+"/"+m.getUTCDate()},getDateTimeLocaleStringInMinute:function(date){var string=new Date(date).toLocaleString(),match=/(^[^:]*(:\d+)?)(:\d+)?$/g.exec(string);return match&&match.length>1?match[1]:string},getTimeRange:function(startDate,endDate,interval,needFormat,format){interval=interval||1,needFormat=needFormat||!0,format=format||"yyyy-MM-dd HH:mm";for(var retVal=[],current=new Date(startDate);current<=endDate;)retVal.push(new Date(current)),current=function(d){return d.setDate(d.getDate()+interval),d}(new Date(current));return retVal},timeToString:function(timestamp,type){var type=type||"hourly",timeString="";switch(type){case"hourly":timeString=moment(1e3*timestamp).format("YYYY-MM-DD HH:mm");break;case"daily":timeString=moment(1e3*timestamp).format("YYYY-MM-DD")}return timeString},timeToLocalString:function(timestamp,type){var type=type||"hourly",timeString="";switch(type){case"hourly":timeString=moment(1e3*timestamp).format("YYYY-MM-DD hh:mm");break;case"daily":timeString=moment(1e3*timestamp).format("YYYY-MM-DD")}return timeString},mankindTime2String:function(timestamp){return moment(1e3*timestamp).format("YYYY-MM-DD hh:mm A")}}}},{}]},{},[10]); \ No newline at end of file diff --git a/src/js/controller/homeCtrl.js b/src/js/controller/homeCtrl.js index c0091df..49c6902 100644 --- a/src/js/controller/homeCtrl.js +++ b/src/js/controller/homeCtrl.js @@ -58,7 +58,6 @@ module.exports = function ($scope, $rootScope, $window, $timeout, $http, $q, $sc // }, onOpen: function () { // debugger; - console.log($(this).find('.ui.segment.visible')) $(this).find('.ui.segment').removeClass('visible'); $(this).find('div.echart').map(function (index, currentObj, array) { echarts.getInstanceByDom(currentObj).resize(); diff --git a/src/js/controller/socialCtrl.js b/src/js/controller/socialCtrl.js index 6144c01..8b0b313 100644 --- a/src/js/controller/socialCtrl.js +++ b/src/js/controller/socialCtrl.js @@ -3,9 +3,7 @@ module.exports = function ($scope, $rootScope, $window, $timeout, $filter, $docu $scope.order = $filter('orderBy'); $scope.query = {}; $scope.path = $location.path().split("/"); - $scope.dateRange = '7'; $scope.isLargeDateRange = false; - $scope.commonTrendTitle = "Hourly Trend During a Week"; $scope.popInfoScope = "Hourly"; var totalrequests = 0; @@ -20,6 +18,7 @@ module.exports = function ($scope, $rootScope, $window, $timeout, $filter, $docu $scope.query.granularity = 3; $scope.query.start = settings.start; $scope.query.end = settings.end; + $scope.query.days = 7; var dailyContainer = $($("#topic_select > div:nth-child(1) > div:nth-child(2) > span.daterange")[0]); var hourlyContainer = $($("#topic_select > div:nth-child(1) > div:nth-child(2) > span.daterange")[1]); @@ -38,7 +37,10 @@ module.exports = function ($scope, $rootScope, $window, $timeout, $filter, $docu if (e.field === 'granularity') { var granularity = this.get('granularity'); $scope.query.granularity = granularity; - if (granularity === 3) { + if (granularity === 2) { + $scope.popInfoScope = "Hourly"; + } else { + $scope.popInfoScope = "Daily"; var start = this.get('start'); var end = this.get('end'); if (start > settings.end) { @@ -104,28 +106,6 @@ module.exports = function ($scope, $rootScope, $window, $timeout, $filter, $docu $scope.startGetData() } }) - $scope.$watch('dateRange', function (newV, oldV) { - $scope.dateRange = newV; - if (newV !== '7') { - $scope.isLargeDateRange = true; - $scope.popInfoScope = "Daily"; - } else { - $scope.isLargeDateRange = false; - $scope.popInfoScope = "Hourly"; - } - $scope.commonTrendTitle = "Daily Trend In Last " + newV + " Days"; - var timeRange = { - 'start': moment.utc().startOf('day').subtract(newV, 'days').valueOf(), - 'end': moment.utc().startOf('day').subtract(1, 'days').valueOf() - }; - var timezoneOffset = (new Date()).getTimezoneOffset() * 60 * 1000; - $scope.dateList = utilitySrv.getTimeRange(timeRange.start, timeRange.end); - $scope.startUTCDateLocalsString = utilitySrv.getDateTimeLocaleStringInMinute(timeRange.start + timezoneOffset); - $scope.endUTCDateLocalsString = utilitySrv.getDateTimeLocaleStringInMinute(timeRange.end + timezoneOffset + 24 * 60 * 60 * 1000); - $scope.startDateLocalsString = utilitySrv.getDateTimeLocaleStringInMinute(timeRange.start); - $scope.endDateLocalsString = utilitySrv.getDateTimeLocaleStringInMinute(timeRange.end + 24 * 60 * 60 * 1000); - RefreshCharts(); - }) $('#scrollspy .list .item .label').popup(); $('#topic_select').dimmer('show'); $scope.getTopics = function () { @@ -200,6 +180,19 @@ module.exports = function ($scope, $rootScope, $window, $timeout, $filter, $docu //getLanguageDistribution(); $scope.$broadcast('start-get-data', 'home'); } + $scope.getDownloadUrl = function () { + if (!$scope.$stateParams.platform) { + toastr.error('Platform Required'); + return false; + } + if (!$scope.topic) { + toastr.error('Topic Select Required'); + return false; + } + $scope.service.getDownloadUrl($scope.$stateParams.platform, $scope.topic, $scope.query.start, $scope.query.end).then(function (url) { + window.open(url); + }) + } // initLineCharts('.hourly-charts.home'); // echarts.connect('hourlyCharts'); function getStatistic() { @@ -217,7 +210,7 @@ module.exports = function ($scope, $rootScope, $window, $timeout, $filter, $docu $scope.languageDistribution = $filter('orderBy')(data, '-uniqueusers'); }) } - function getMentionedServiceTable () { + function getMentionedServiceTable() { $scope.service.getMentionedMostServiceList($scope.$stateParams.platform, $scope.topic, 'all', $scope.query).then(function (data) { $scope.mostMentionedService = data $scope.$broadcast('data-got'); @@ -229,27 +222,9 @@ module.exports = function ($scope, $rootScope, $window, $timeout, $filter, $docu }) }*/ - $scope.getDownloadUrl = function () { - if (!$scope.$stateParams.platform) { - toastr.error('Platform Required'); - return false; - } - if (!$scope.topic) { - toastr.error('Topic Select Required'); - return false; - } - if (!$scope.dateRange) { - toastr.error('Date Range Required'); - return false; - } - $scope.service.getDownloadUrl($scope.$stateParams.platform, $scope.topic, $scope.dateRange).then(function (url) { - window.open(url); - }) - } - function CheckDateRangeSize() { - var diff = ($scope.query.end - $scope.query.start) / 1000 / 3600 / 24; - $scope.isLargeDateRange = (diff > 7); + $scope.query.days = ($scope.query.end - $scope.query.start) / 1000 / 3600 / 24; + $scope.isLargeDateRange = ($scope.query.days > 7); $timeout(function () { $scope.startGetData(); if ($scope.isLargeDateRange) { diff --git a/src/js/directive/chartDirective.js b/src/js/directive/chartDirective.js index 3b4e391..786830d 100644 --- a/src/js/directive/chartDirective.js +++ b/src/js/directive/chartDirective.js @@ -362,7 +362,6 @@ module.exports = /*@ngInject*/ function ($rootScope, $filter, $q, $location, $co }) break; case 'getMessageVolSpikes': - console.log(_); var fnPromise = apiFn(_.platform, _.query.topic, _.pnscope, _.query); var fn = customHourlyData, key = ''; diff --git a/src/js/directive/statisticDirective.js b/src/js/directive/statisticDirective.js index 4628ff1..9ee3cab 100644 --- a/src/js/directive/statisticDirective.js +++ b/src/js/directive/statisticDirective.js @@ -29,14 +29,6 @@ var label_type = { spike: 'Vol Spike Detected', string: '' }; -var dateRangeAppend = function (dateRange) { - if (dateRange === '7') { - return ' Last Week' - } else { - return ' (Last ' + dateRange + ' days)'; - } - -} module.exports = function ($parse, $filter, $timeout) { var colors = ['red', 'orange', 'yellow', 'olive', 'green', 'teal', 'blue', 'violet', 'purple', 'pink', 'brown', 'grey', 'black']; return { @@ -45,10 +37,10 @@ module.exports = function ($parse, $filter, $timeout) { replace: true, scope: { data: "=", + query: "=", title: "@", comment: "@", - color: "@", - dayrange: "=" + color: "@" }, link: function (scope, e, a) { var numberFormat = $filter('thousandsuffix'); @@ -59,26 +51,24 @@ module.exports = function ($parse, $filter, $timeout) { scope.comment = scope.data.comment; $($(e).find('.popup').get(0)).popup(); } - // scope.data = $parse(scope.data); - // console.log(scope.data) scope.randerUI = function () { switch (a.type) { case 'joinedusers': scope.volume = numberFormat(scope.data.objectcountthistime) - if (scope.dayrange == '7') { + if (scope.query.days <= 7) { scope.labels = [{ - text: label_type.compared + dateRangeAppend(scope.dayrange), + text: label_type.compared + ' (Last ' + scope.query.days + ' days)', volume: scope.data.comparedratio, type: 'ratio', isCompared: true }, { - text: label_type.spike + dateRangeAppend(scope.dayrange), + text: label_type.spike + ' (Last ' + scope.query.days + ' days)', volume: scope.data.detectedhourlyspikesvol, color: 'red' }] } else { scope.labels = [{ - text: label_type.spike + dateRangeAppend(scope.dayrange), + text: label_type.spike + ' (Last ' + scope.query.days + ' days)', volume: scope.data.detectedhourlyspikesvol, color: 'red' }] @@ -88,16 +78,16 @@ module.exports = function ($parse, $filter, $timeout) { case 'regionofusers': scope.volume = numberFormat(scope.data.objectcountthistime) scope.volume = scope.volume === 0 ? "No Data Available" : scope.volume; - if ((scope.$parent.$parent.platform.toLowerCase() !== 'twitter') || scope.dayrange !== '7') { + if ((scope.$parent.$parent.platform.toLowerCase() !== 'twitter') || scope.query.days > 7) { scope.labels = [] } else { scope.labels = [{ - text: label_type.compared + dateRangeAppend(scope.dayrange), + text: label_type.compared + ' (Last ' + scope.query.days + ' days)', volume: scope.data.comparedratio, type: 'ratio', isCompared: true }, { - text: label_type.spike + dateRangeAppend(scope.dayrange), + text: label_type.spike + ' (Last ' + scope.query.days + ' days)', volume: scope.data.detectedhourlyspikesvol, color: 'red' }] @@ -106,20 +96,20 @@ module.exports = function ($parse, $filter, $timeout) { break; case 'influenceofusers': scope.volume = numberFormat(scope.data.objectcountthistime) - if (scope.dayrange == '7') { + if (scope.query.days <= 7) { scope.labels = [{ - text: label_type.compared + dateRangeAppend(scope.dayrange), + text: label_type.compared + ' (Last ' + scope.query.days + ' days)', volume: scope.data.comparedratio, type: 'ratio', isCompared: true }, { - text: label_type.spike + dateRangeAppend(scope.dayrange), + text: label_type.spike + ' (Last ' + scope.query.days + ' days)', volume: scope.data.detectedhourlyspikesvol, color: 'red' }] } else { scope.labels = [{ - text: "Spike Detected (Last " + scope.dayrange + " days)", + text: "Spike Detected (Last " + scope.query.days + " days)", volume: scope.data.detectedhourlyspikesvol, color: 'red' }] @@ -127,20 +117,20 @@ module.exports = function ($parse, $filter, $timeout) { break; case 'mentionedservicecount': scope.volume = numberFormat(scope.data.objectcountthistime) - if (scope.dayrange == '7') { + if (scope.query.days <= 7) { scope.labels = [{ - text: label_type.compared + dateRangeAppend(scope.dayrange), + text: label_type.compared + ' (Last ' + scope.query.days + ' days)', volume: scope.data.comparedratio, type: 'ratio', isCompared: true }, { - text: label_type.spike + dateRangeAppend(scope.dayrange), + text: label_type.spike + ' (Last ' + scope.query.days + ' days)', volume: scope.data.detectedhourlyspikesvol, color: 'red' }] } else { scope.labels = [{ - text: label_type.spike + dateRangeAppend(scope.dayrange), + text: label_type.spike + ' (Last ' + scope.query.days + ' days)', volume: scope.data.detectedhourlyspikesvol, color: 'red' }] @@ -179,20 +169,20 @@ module.exports = function ($parse, $filter, $timeout) { break; case 'vocinsightsVol': scope.volume = numberFormat(scope.data.objectcountthistime.voctotalvol) - if (scope.dayrange == '7') { + if (scope.query.days <= 7) { scope.labels = [{ - text: label_type.compared + dateRangeAppend(scope.dayrange), + text: label_type.compared + ' (Last ' + scope.query.days + ' days)', volume: scope.data.comparedratio, type: 'ratio', isCompared: true }, { - text: label_type.spike + dateRangeAppend(scope.dayrange), + text: label_type.spike + ' (Last ' + scope.query.days + ' days)', volume: scope.data.detectedhourlyspikesvol, color: 'red' }] } else { scope.labels = [{ - text: label_type.spike + dateRangeAppend(scope.dayrange), + text: label_type.spike + ' (Last ' + scope.query.days + ' days)', volume: scope.data.detectedhourlyspikesvol, color: 'red' }] @@ -230,11 +220,11 @@ module.exports = function ($parse, $filter, $timeout) { // + ":" // + percentage(originBoj.neutraltotalvol/originBoj.voctotalvol,0) scope.labels = [{ - text: 'POS ' + label_type.spike + dateRangeAppend(scope.dayrange), + text: 'POS ' + label_type.spike + ' (Last ' + scope.query.days + ' days)', volume: originBoj.detectedposispikesvol, color: 'green' }, { - text: 'NEG ' + label_type.spike + dateRangeAppend(scope.dayrange), + text: 'NEG ' + label_type.spike + ' (Last ' + scope.query.days + ' days)', volume: originBoj.detectednegspikesvol, color: 'red' }] diff --git a/src/js/service/index.js b/src/js/service/index.js index 60aa915..1630f0f 100644 --- a/src/js/service/index.js +++ b/src/js/service/index.js @@ -334,11 +334,11 @@ app.factory('rawdataSrv', function (baseSrv) { }); }, - getDownloadUrl: function (platform, topic, days) { + getDownloadUrl: function (platform, topic, source) { var params = params || {}; params.platform = platform || 'twitter'; params.topic = topic || 'azure'; - params.days = days || 7; + setDateTimeRange(params, source); return baseSrv.get('GetDownloadUrl', params); }, getSubscribeSettings: function (platform, topic, msgtype, servicename) { diff --git a/templates/social.html b/templates/social.html index fec07f7..db06d21 100644 --- a/templates/social.html +++ b/templates/social.html @@ -66,29 +66,27 @@

    Summary
    Users
    - +
    - +
    - +
    Services & Products
    - +
    - +
    Most Mentioned Service
    @@ -124,7 +122,7 @@
    Growth Ranking
    - +
    Most Liked Service
    @@ -161,20 +159,19 @@
    Most Disliked Service
    VoC
    - +
    - +
    - - + + + type="mostposifrom" query=query>-->
    @@ -188,42 +185,42 @@

    - +
    - +
    - + stack="volume">
    - +
    - +
    - +
    - +
    - +

    @@ -235,16 +232,16 @@

    + location='home' sub-fn="getVoCDetailsByPN" no-swap="true"> + pnscope="posi" location="home" sub-fn="getSubPageVoCDetailsbyKeywords"> + pnscope="neg" location="home" sub-fn="getSubPageVoCDetailsbyKeywords">
    - +
    @@ -253,11 +250,11 @@

    + api-fn="getRegionDistribution" location='home' sub-fn="getVoCDetailsByCountry" + no-pop="true" property-select="positive" association="positive">
    - +

    @@ -265,11 +262,11 @@

    + api-fn="getRegionDistribution" location='home' sub-fn="getVoCDetailsByCountry" + no-pop="true" property-select="negative" association="negative">
    - +

    @@ -287,11 +284,10 @@

    + property-select="messages" location="home" sub-fn="getVoCDetailsByServiceName" association="message">
    - +

    @@ -299,11 +295,10 @@

    + property-select="users" location="home" sub-fn="getVoCDetailsByServiceName" association="user">
    - +

    @@ -311,9 +306,8 @@

    - +
    @@ -374,8 +368,7 @@

    + location='home' sub-fn="getVoCDetailsByCountry" no-swap="true" property-select="users">
    @@ -421,17 +414,17 @@

    - + - + - +