(function(){var a;a=angular.module("qcloud-ui",["ui.bootstrap.position"]),a.directive("jstreenas",function(){return{restrict:"A",scope:{jstreenas:"=",destpath:"=",fetchData:"=fetchdata",currentdevice:"="},link:function(a,b,c){return a.$watch("currentdevice",function(){return a.currentdevice?$(b).jstree({plugins:["themes","json_data","ui"],json_data:{data:function(b,c){var d;return d=-1===b?"/":b.data("path"),a.$apply(function(){return a.fetchData(d,c)})}},themes:{theme:"classic",dots:!1}}).bind("select_node.jstree",function(b,c){return a.destpath=c.rslt.obj.data("path"),a.$apply()}):void 0})}}}),a.directive("jstree",function(){return{restrict:"A",scope:{jstree:"=",destpath:"=",rootpath:"=",fetchData:"=fetchdata"},link:function(a,b,c){return a.rootpath||(a.rootpath="/"),a.$watch("jstree",function(){return a.jstree?$(b).jstree({plugins:["themes","json_data","ui"],json_data:{data:function(b,c){var d;return d=-1===b?a.rootpath:b.data("path"),a.$apply(function(){return a.fetchData(d,c)})}},themes:{theme:"classic",dots:!1}}).bind("select_node.jstree",function(b,c){return a.destpath=c.rslt.obj.data("path"),a.$apply()}):void 0})}}}),a.directive("jstreecheckbox",["$log",function(a){return{restrict:"A",scope:{jstreecheckbox:"=",checkedpath:"=",checkmaps:"=",whitelisting:"=",ischange:"=",uncheckedpath:"=",firstloadedit:"=",fetchData:"=fetchdata"},link:function(b,c,d){var e;return e=function(){return b.uncheckedpath=[],$(c).jstree("get_container_ul").find("li").each(function(a,c){return-1!==$(c).attr("class").indexOf("jstree-unchecked")?b.uncheckedpath.push($(c).attr("fullpath")):void 0}),b.checkedpath=[],$(c).jstree("get_checked").each(function(a,c){var d;return d=$(c).attr("fullpath"),b.checkedpath.push(d)})},b.$watch("jstreecheckbox",function(){return b.jstreecheckbox?(b.$watch("whitelisting",function(){return null!=b.whitelisting?(null!=b.firstloadedit&&(b.firstloadedit||(b.checkmaps=null,b.ischange=!0)),b.whitelisting===!0?$(c).jstree("uncheck_all"):$(c).jstree("check_all"),e()):void 0}),$(c).jstree({plugins:["themes","json_data","checkbox","ui"],json_data:{data:function(a,c){var d;return d=-1===a?"/":a.data("path"),b.fetchData(d,c)}},themes:{theme:"classic",dots:!1}}).on("check_node.jstree",function(a,c){return b.ischange=!0,e()}).on("uncheck_node.jstree",function(a,c){return b.ischange=!0,e()}).on("loaded.jstree",function(a,d){return b.checkmaps&&0!==b.checkmaps.length?"/"===b.checkmaps[0]?$(c).jstree("check_all"):void 0:($(c).jstree("check_all"),e())}).on("load_node.jstree",function(d,e){return a.debug("scope.checkmaps",b.checkmaps),b.checkmaps?$(e.rslt.obj).find("li").each(function(a,d){var f,g,h,i,j,k,l,m,n;if(h=$(d).attr("fullpath"),b.whitelisting){if(-1!==b.checkmaps.indexOf(h))return $(c).jstree("check_node",$(d))}else{for($(e.rslt.obj).removeClass("jstree-undetermined"),f=!0,m=b.checkmaps,i=0,k=m.length;k>i;i++){if(g=m[i],h===g){$(c).jstree("check_node",$(d)),$(c).jstree("uncheck_node",$(d)),f=!1;break}if(-1!==g.indexOf(h)){f=!1;break}}if(f)for(n=b.checkmaps,j=0,l=n.length;l>j;j++)if(g=n[j],-1!==h.indexOf(g)){f=!1;break}if(f)return $(c).jstree("check_node",$(d))}}):void 0})):void 0})}}}]),a.directive("autoFocus",["$timeout",function(a){return{restrict:"A",link:function(b,c,d){return a(function(){return c[0].focus()})}}}]),a.directive("onKeyRight",["$parse",function(a){return function(b,c,d){var e;return e=a(d.onKeyRight),$(document).bind("keydown",function(a){return 39===a.which?b.$apply(function(){return e(b)}):void 0})}}]),a.directive("onKeyLeft",["$parse",function(a){return function(b,c,d){var e;return e=a(d.onKeyLeft),$(document).bind("keydown",function(a){return 37===a.which?b.$apply(function(){return e(b)}):void 0})}}]),a.directive("blurOnEnter",["$parse",function(a){return function(a,b,c){return b.bind("keydown",function(a){return 13===a.which?b.blur():void 0})}}]),a.directive("onEsc",["$parse",function(a){return function(b,c,d){var e;return d.onEsc?(e=a(d.onEsc),$(document).bind("keydown",function(a){return 27===a.which?b.$apply(function(){return e(b)}):void 0})):void 0}}]),a.directive("qTooltip",["$compile","$timeout","$parse","$document","$position","$interpolate",function(a,b,c,d,e,f){var g,h,i,j,k,l,m,n,o,p;return h={trigger:"mouseenter",placement:"top",animation:!0,popupDelay:0},p={mouseenter:{show:"mouseenter",hide:"mouseleave"},click:{show:"click",hide:"click"},focus:{show:"focus",hide:"blur"}},j=function(a){return null==a&&(a=k.trigger),p[a]},l="qTooltip",k=angular.extend({},h),n=f.startSymbol(),i=f.endSymbol(),g="ng-bind",m=function(a){var b;return b='
'},o=m(g),{restrict:"EA",scope:!0,link:function(f,h,i){var n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E;return g=f.$eval(i.qTooltipHtml)?"ng-bind-html":"ng-bind",o=m(g),B=a(o)(f),C=void 0,x=void 0,p=angular.isDefined(k.appendToBody)?k.appendToBody:!0,D=j(void 0),s=!1,r=angular.isDefined(i[l+"Enable"]),v=!1,f.tt_isOpen=!1,A=function(){f.tt_isOpen?u():z()},z=function(){(!r||f.$eval(i[l+"Enable"]))&&(f.tt_popupDelay?x=b(y,f.tt_popupDelay):f.$apply(y))},u=function(){f.$apply(function(){t()})},y=function(){var a,c,g,j;if(a=void 0,j=void 0,c=void 0,g=void 0,f.tt_content&&!f.tt_disabled){switch(C&&b.cancel(C),B.css({top:0,left:0,display:"block"}),p?d.find("body").append(B):h.after(B),a=p?e.offset(h):e.position(h),v=f.$eval(i[l+"Wrap"]),v?(B.css({"word-break":"break-all"}),B.find(".tooltip-inner").css({"white-space":"pre-wrap","max-width":"400px"})):B.find(".tooltip-inner").css({"white-space":"pre","max-width":"none"}),j=B.prop("offsetWidth"),c=B.prop("offsetHeight"),f.tt_placement){case"bottom-left":g={top:a.top+a.height,left:a.left+a.width-j};break;case"bottom-right":g={top:a.top+a.height,left:a.left};break;case"top-left":g={top:a.top-c,left:a.left+a.width-j};break;case"top-right":g={top:a.top-c,left:a.left};break;case"right":g={top:a.top+a.height/2-c/2,left:a.left+a.width};break;case"bottom":g={top:a.top+a.height,left:a.left+a.width/2-j/2};break;case"left":g={top:a.top+a.height/2-c/2,left:a.left-j};break;default:g={top:a.top-c,left:a.left+a.width/2-j/2}}g.top+="px",g.left+="px",B.css(g),null!=f.tt_menaul?"true"===f.tt_menaul&&(f.tt_isOpen=!0):f.tt_isOpen=!0}},t=function(){f.tt_isOpen=!1,b.cancel(x),f.tt_animation?C=b(function(){B.remove()},500):B.remove()},i.$observe(l,function(a){f.tt_content=a,!a&&f.tt_isOpen&&t()}),i.$observe(l+"Title",function(a){f.tt_title=a}),i.$observe(l+"Placement",function(a){f.tt_placement=angular.isDefined(a)?a:k.placement}),i.$observe(l+"PopupDelay",function(a){var b;b=parseInt(a,10),f.tt_popupDelay=isNaN(b)?k.popupDelay:b}),i.$observe(l+"Manual",function(a){f.tt_menaul=a}),i.$observe(l+"UserControl",function(a){return"true"===a?b(y,0):t()}),i.$observe(l+"Disabled",function(a){return f.tt_disabled="true"===a?!0:!1}),E=function(){s&&null!=D&&(h.unbind(D.show,z),h.unbind(D.hide,u))},f.$watch(i.qTooltipTrigger,function(a){E(),D=j(a),D&&(D.show===D.hide?h.bind(D.show,A):(h.bind(D.show,z),h.bind(D.hide,u)),s=!0)}),n=f.$eval(i[l+"Animation"]),f.tt_animation=angular.isDefined(n)?!!n:k.animation,i.$observe(l+"AppendToBody",function(a){p=angular.isDefined(a)?c(a)(f):p}),v=f.$eval(i[l+"Wrap"]),p&&f.$on("$locationChangeSuccess",q=function(){f.tt_isOpen&&t()}),f.$on("$destroy",w=function(){b.cancel(C),b.cancel(x),E(),B.remove(),B.unbind(),B=null})}}}]),a.directive("jScrollPane",["$window","$timeout","$log",function(a,b,c){return{restrict:"A",link:function(d,e,f){var g,h,i;return i=e,g=!1,i.jScrollPane({hideFocus:!0,contentWidth:5,mouseWheelSpeed:50}),h=function(){var a,b;return b=i.data("jsp"),b?(b.reinitialise(),a=i.find(".jspPane"),a.css({width:"100%"})):void 0},angular.element(a).resize(h),f.scrollResetEvent&&d.$on(f.scrollResetEvent,function(){return b(h)}),f.scrollToBottom?i.bind("jsp-scroll-y",function(a,b,e,h){var i;return i=g,g=h,h&&!i?(c.debug("scroll to bottom, run",f.scrollToBottom),d.$apply(f.scrollToBottom)):void 0}):void 0}}}]),a.directive("scrollToBottomToLoad",function(){return{restrict:"A",link:function(a,b,c,d){var e;return e=b[0],b.scroll(function(){return e.scrollTop+e.offsetHeight>=e.scrollHeight?a.$apply(c.scrollToBottomToLoad):void 0})}}}),a.directive("emailAutoComplete",function(){return{restrict:"A",link:function(a,b,c,d){var e;return e={suggClass:"eac-sugg",domains:["yahoo.com","hotmail.com","gmail.com","me.com","aol.com","mac.com","live.com","comcast.net","googlemail.com","msn.com","hotmail.co.uk","yahoo.co.uk","facebook.com","verizon.net","sbcglobal.net","att.net","gmx.com","outlook.com","icloud.com","163.com","126.com","189.cn","sina.com","sina.cn","qq.com","aliyun.com","china.com","sohu.com","excite.co.jp","mail.goo.ne.jp","goo.jp","yandex.com","mail.ru","qip.ru ","naver.com","daum.net","hanmail.net","nate.com"]},b.emailautocomplete(e)}}}),a.directive("disappearDialog",["$window","$timeout","$log",function(a,b,c){return{restrict:"A",scope:{close_trigger:"=closeTrigger",target_id:"=targetId",finished_call:"=finishedCall"},link:function(a,b,c){var d,e,f,g,h,i;return d=b,i=$("#"+a.target_id),g=!0,h=500,f=d.width(),e=d.height(),a.$watch("close_trigger",function(){var b,c,j;return a.close_trigger===!0?($("body").append(""),c=$("#fxdialog"),b=function(){return c.remove(),a.finished_call()},j=function(a,b,d){var e;return e=1-(b+.15)>0?1-(b+.15):0,c.css("transform","scale("+e+","+e+")")},g&&(d.clone().prependTo(c),c.css({border:"0",background:"none"})),c.css({width:f,height:e,left:Math.round(d.offset().left)+30,top:Math.round(d.offset().top),display:"block",opacity:g?.8:1}).animate({opacity:.3,left:i.offset().left+i.width()/2-f/2+50,top:i.offset().top+i.height()/2-e/2-5},{duration:h,progress:j,complete:b})):void 0})}}}]),a.directive("setFocusOn",["$timeout",function(a){return{link:function(b,c,d){return b.$watch(d.setFocusOn,function(e){return e?a(function(){return b.$eval(d.setFocusOn)?c.focus():void 0},0,!1):void 0})}}}]),a.filter("rawHtml",["$sce",function(a){return function(b){return a.trustAsHtml(b)}}]),a.directive("showHtmlContent",["$compile",function(a){return{scope:!0,link:function(b,c,d){return d.$observe("template",function(d){var e;return e=a(""+d+"
")(b),c.html(""),c.append(e)})}}}]),a.directive("numbersOnly",function(){return{require:"ngModel",link:function(a,b,c,d){return d.$parsers.push(function(a){var b;return void 0===a?0:(b=a.replace(/[^0-9]/g,""),b!==a&&(d.$setViewValue(b),d.$render()),b)})}}})}).call(this),function(){var a;a=angular.module("check_site_ip_match",["common"]),a.controller("checkSiteIpCtrl",["$scope","$rootScope","$window","$location","$log","messageService",function(a,b,c,d,e,f){a.closeDialog=function(b){return a.$close(b)}}])}.call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n;b=[{value:"en",name:"English",en_name:"English"},{value:"zh_TW",name:"繁體中文",en_name:"Traditional Chinese"},{value:"zh",name:"简体中文",en_name:"Simplified Chinese"},{value:"cs",name:"Czech",en_name:"Czech"},{value:"da",name:"Dansk",en_name:"Danish"},{value:"de",name:"Deutsch",en_name:"German"},{value:"es",name:"Español",en_name:"Spanish"},{value:"fr",name:"Français",en_name:"French"},{value:"it",name:"Italiano",en_name:"Italian"},{value:"ja",name:"日本語",en_name:"Japanese"},{value:"ko",name:"한국",en_name:"Korean"},{value:"no",name:"Norsk",en_name:"Norwegian"},{value:"pl",name:"Polski",en_name:"Polish"},{value:"ru",name:"Русский",en_name:"Russian"},{value:"fi",name:"Suomi",en_name:"Finnish"},{value:"sv",name:"Svenska",en_name:"Swedish"},{value:"nl",name:"Nederlands",en_name:"Dutch"},{value:"tr",name:"Turk dili",en_name:"Turkish"},{value:"th",name:"ไทย",en_name:"Thai"},{value:"pt",name:"Português",en_name:"Portuguese"},{value:"hu",name:"Magyar",en_name:"Hungarian"},{value:"el",name:"Ελληνικά",en_name:"Greek"},{value:"ro",name:"Român",en_name:"Romanian"}],a={en:"http://www.qnap.com/en/index.php?lang=en&sn=829",zh_TW:"http://www.qnap.com/cht/index.php?lang=zh-tw&sn=123",zh:"http://www.qnap.com/cn/index.php?lang=zh-cn&sn=790",de:"http://www.qnap.com/de/index.php?lang=de&sn=374",es:"http://www.qnap.com/es/index.php?lang=es&sn=420",fr:"http://www.qnap.com/fr/index.php?lang=fr&sn=460",it:"http://www.qnap.com/it/index.php?lang=it&sn=499",nl:"http://www.qnap.com/nl/index.php?lang=nl&sn=538",pt:"http://www.qnap.com/pt/index.php?lang=pt&sn=578",ru:"http://qnap.ru/about",ja:"http://www.qnap.com/jp/index.php?lang=jp&sn=706",ko:"http://www.qnap.com/kr/index.php?lang=kr&sn=751"},c={WebAdministration:{display_name:"QTS Desktop",img_file:"qts-sq.jpg",order:0,is_admin:!0},NVRWebAdministration:{display_name:"QVR Desktop",img_file:"qts-sq.jpg",order:0,is_admin:!0},WebFileManager:{display_name:"File Station",img_file:"file_80.png",order:1},WebServer:{display_name:"Web Server",img_file:"web-server-sq.jpg",order:2},MultimediaStation:{display_name:"Multimedia Station",img_file:"multi_80.png",order:3},PhotoStation:{display_name:"Photo Station",img_file:"photo_80.png",order:4},MusicStation:{display_name:"Music Station",img_file:"music_80.png",order:5},FTP:{display_name:"FTP",img_file:"ftp.jpg",order:6},SFTPServer:{display_name:"SFTP",img_file:"ftp.jpg",order:7},Telnet:{display_name:"Telnet",img_file:"telnet-ssh.jpg",order:8},SSH:{display_name:"SSH",img_file:"telnet-ssh.jpg",order:9},RemoteReplication:{display_name:"Remote Replication",img_file:"remote-replication.jpg",order:10},ManagementServer:{display_name:"Management Server",img_file:"management-server-sq.png",order:0,is_admin:!0},FileServer:{display_name:"File Server",img_file:"file-server-sq.png",order:1}},d=angular.module("common",["ngCookies","session","ng.deviceDetector","ui.bootstrap","check_site_ip_match"]),d.config(["$logProvider",function(a){var b;return b="undefined"!=typeof QCONFIG&&null!==QCONFIG?QCONFIG.debug:void 0,null==b&&(b=!0),a.debugEnabled(b)}]),d.run(["$rootScope","$timeout","$cookies","$window","$log","$modal","$location","session","loginRecords","apiService","deviceDetector",function(d,e,h,i,j,k,l,n,o,p,q){var r,s;return r=null,d.SUPPORTED_LANGUAGES=b,d.SUPPORTED_SERVICES=c,d.is_sign_in=null!=h.get("access_token"),d.cms_url=QCONFIG.cms_url,d.current_lang=g(),d.per_data=window.performance.timing,s=function(){var a,b;return b=new Date,a=new Date(b.getFullYear(),b.getMonth(),b.getDate(),b.getHours()+24),h.put("not_notice_site_ip_check",!0,{path:"/",expires:a})},d.checkPageLoadTime=function(){var a,b,c;return b=d.per_data.loadEventEnd-d.per_data.navigationStart,j.debug("loadEventEnd",d.per_data.loadEventEnd),j.debug("page_load_time",d.per_data.navigationStart),a=d.per_data.responseEnd-d.per_data.requestStart,c=d.per_data.domComplete-d.per_data.domLoading,j.debug("domLoading",d.per_data.domLoading),j.debug("domComplete",d.per_data.domComplete),j.debug("page_load_time",b),j.debug("connect_time",a),j.debug("render_time",c)},d.loginDevice=function(a,b,c,e,g,i){var k,l;return null==i&&(i=null),k=c+h.get("access_token"),a&&b?l={user_name:a,password:b}:h.get("qtoken_"+k)&&(l={user_name:h.get("nas_user_"+k),qtoken:h.get("qtoken_"+k)}),null!=l?(d.$broadcast("evt_device_login",["logged_start"]),p.deviceLogin(c,l,e,g).then(function(b){return o.setLoginRecord(c),g&&a&&(h.put("qtoken_"+k,b.result.qtoken,{expires:f()}),h.put("nas_user_"+k,a,{expires:f()})),d.$broadcast("evt_device_login",["logged_in",i])},function(a){switch(a.code){case 1129005:return d.$broadcast("evt_device_login",["login_failed",a]);case 1129006:return d.$broadcast("evt_device_login",["security_code_required",a]);default:return j.debug("login failed",a),d.$broadcast("evt_device_login",["other",a])}})["finally"](function(){return d.$broadcast("evt_device_login",["logged_end"])})):void 0},d.logoutDevice=function(a){return j.debug("Logging out device",a),p.deviceLogout(a).then(function(b){var c;return j.debug("Device "+a+" logged out"),o.cleanupLoginRecord(a),c=a+h.get("access_token"),h.remove("qtoken_"+c),h.remove("nas_user_"+c),d.$broadcast("evt_device_logout",["logout_success"])},function(a){return d.$broadcast("evt_device_logout",["logout_fail",a])})},d.signin=function(a){var b,c,d;return b=QCONFIG.auth_path,c=QCONFIG.redirect_uri,d=new URI(b+"/oauth/auth"),null!=h.get("not_notice_site_ip_check")&&d.setQuery("not_notice","yes"),d.setQuery("lang",g()),d.setQuery("response_type","token"),d.setQuery("client_id",QCONFIG.client_id),d.setQuery("redirect_uri",c),j.debug("state",a),a?d.setQuery("state",a):d.setQuery("state","/u"),i.location.href=d.href()},d.signup=function(){return d.gotoAuthCenter("/signup")},d.getCurrentPortalSiteUrl=function(a,b){var c,d,f,h,k;switch(null==b&&(b=!1),a){case"global":d=QCONFIG.portal_domain;break;case"china":d=QCONFIG.portal_cn_domain}return b&&(h=l.search(),h.not_notice="yes",l.search(h)),c=new URI(l.absUrl()),f=c.host(),c.setQuery("lang",g()),k=c.href(),f!==d&&(k=k.replace(f,d)),j.debug("redirect_uri",k),e(function(){i.location.href=k},1e3)},d.showWarningSiteIpNotMatchDialog=function(a,b){var c;return j.debug("showWarningSiteIpNotMatchDialog site",b),r?void 0:(c=d.$new(),c.is_manually=a,r=k.open({templateUrl:m("/partials/dialog/site_ip_warning"),controller:"checkSiteIpCtrl",scope:c}),r.result.then(function(c){return j.debug("result",c),c?d.getCurrentPortalSiteUrl(b,a):s()})["finally"](function(){return r=null}))},d.signout=function(){var a;return j.debug("do signout"),a=function(){if(null==h.get("q_pair"))return d.gotoAuthCenter("/signout");switch(q.browser){case"chrome":case"firefox":case"safari":return p.removePair(h.get("q_pair")).then(function(a){return h.remove("q_pair"),d.gotoAuthCenter("/signout")},function(a){return d.gotoAuthCenter("/signout")});default:return d.gotoAuthCenter("/signout")}},p.deviceLogoutAll().then(function(b){return j.debug("do deviceLogoutAll success"),a()},function(b){return j.debug("do deviceLogoutAll error"),a()})},d.logout=function(){return j.debug("do rootScope.logout"),h.remove("access_token"),h.remove("refresh_token_count"),n.clear(),i.location.href="/logout"},d.chrome_unsubscribe=function(){return navigator.serviceWorker.ready.then(function(a){return a.pushManager.getSubscription().then(function(a){return a?a.unsubscribe().then(function(a){return p.removePair(h.get("q_pair")).then(function(a){return h.remove("q_pair"),!0})})["catch"](function(a){return!1}):!1})["catch"](function(a){return!1})})},d.gotoAuthCenter=function(a,b){var c,d,e;return null==a&&(a=""),e=new URI(QCONFIG.auth_path+a),null!=h.get("not_notice_site_ip_check")&&e.setQuery("not_notice","yes"),e.setQuery("app_id",QCONFIG.client_id),e.setQuery("lang",g()),e.setQuery("redirect_uri",QCONFIG.portal_path+"/receive_auth"),c=new URI,d="/u"!==c.path()?"/u":c.href(),e.setQuery("state",d),j.debug("gotoAuthCenter",e.href()),b?i.open(e):i.location.href=e.href()},d.gotoInternalUrl=function(a,b){a=m(a),b?i.open(a):i.location.href=a},d.gotoCMS=function(a,b){var c,d;c=QCONFIG.cms_url+"/"+a.replace(/^\//,""),d=new URI(c),d=m(d.href()),b?i.open(d):i.location.href=d},d.gotoStatus=function(a,b){var c,d;c=QCONFIG.status_url+"/"+a.replace(/^\//,""),d=new URI(c),d=m(d.href()),b?i.open(d):i.location.href=d},d.gotoAboutUs=function(){var b;b=a[g()],b||(b=a.en),i.open(b)},d.onRootMousedown=function(a){return d.$broadcast("evt_root_mousedown",arguments)},d.onRootClick=function(a){return d.$broadcast("evt_root_click",arguments)},d.checkIpMeetTheSite=function(){var a,b;return a=l.search(),j.debug("checkIpMeetTheSite not_notice",a),j.debug("checkIpMeetTheSite not_notice_site_ip_check",h.get("not_notice_site_ip_check")),null!=a.not_notice&&(s(),delete a.not_notice,l.search(a)),h.get("not_notice_site_ip_check")||(j.debug("do show it"),QCONFIG.china_site===QCONFIG.ip_in_china)?void 0:(b="china",QCONFIG.china_site&&(b="global"),d.showWarningSiteIpNotMatchDialog(!1,b))},d.localizedUrl=m,d.$on("evt_call_device_login",function(a,b){return d.loginDevice(b[0],b[1],b[2],b[3],b[4])})}]),d.service("loginRecords",["session",function(a){return this.setLoginRecord=function(b){var c;return c=a.get("device_login_records"),c||(c={}),c[b]="1",a.put("device_login_records",c)},this.cleanupLoginRecord=function(b){var c;return c=a.get("device_login_records"),c&&c[b]?(delete c[b],a.put("device_login_records",c)):void 0},this.hasLoggedIn=function(b){var c;return c=a.get("device_login_records"),null!=c&&null!=c[b]},this}]),d.service("messageService",function(){return this.getText=function(a,b,c){var d,e;if(c||"object"!=typeof b||(c=b,b=null),e=$("#message_"+a).text()||b||a,null!=c)for(d in c)e=e.replace("{"+d+"}",c[d]);return e},this.getHtml=function(a,b,c,d){var e,f,g;if("object"==typeof b&&angular.isFunction(c)&&(d=c,c=b,b=null),c||"object"!=typeof b||(c=b,b=null),f=angular.isFunction(d)?d($("#message_"+a).clone()):$("#message_"+a).html(),g=f||b||a,null!=c)for(e in c)g=g.replace("{"+e+"}",c[e]);return g},this}),d.service("utilities",["$window",function(a){var b;return b=[[1099511627776,"TB"],[1073741824,"GB"],[1048576,"MB"],[1024,"KB"]],this.FILE_NAME_PATTERN=new RegExp('^[^/|\\\\?<>*"]+$'),this.checkFileName=function(a){return a.length<=0?"error_filename_empty":a.length>253?"error_filename_too_long":this.FILE_NAME_PATTERN.test(a)?void 0:"error_filename_invalid"},this.getReadableFileSize=function(a){var c,d,e;for(d=0;d=b[d][0]||d===b.length-1){c=b[d][0],e=b[d][1];break}d++}return(Math.round(100*a/c)/100).toString()+e},this.localizedDateTime=function(a,b){var c;return null==b&&(b="YYYY-MM-DD HH:mm:ss"),c=moment().zone(),moment.utc(a).zone(c).format(b)},this.resolvePath=function(){var a,b,c,d,e;for(b=[],d=0,e=arguments.length;e>d;d++)a=arguments[d],null!=a?b.push(a.trim()):b.push("");return c=b.join("/"),c="/"+c,c=c.replace(/[\/]+/g,"/"),c.length>1&&"/"===c.slice(-1)&&(c=c.slice(0,-1)),c},this.getParentPath=function(a){var b;return null==a&&(a="/"),"/"===!a[0]&&(a="/"+a),"/"===a?null:(b=a.split("/"),2===b.length?"/":b.slice(0,b.length-1).join("/"))},this.goTopPath=function(a){var b;return null==a&&(a="/"),"/"===!a[0]&&(a="/"+a),b=a.split("/"),b.length>1?"/"+b[1]:"/"},this.openWindow=function(b,c,d){var e,f;return(null==c||0>=c)&&(c=640),(null==d||0>=d)&&(d=480),f=(screen.height-d)/2,e=(screen.width-c)/2,a.open(b,"myQNAPcloud","status=1,resizable=1,scrollbars=1,location=0,titlebar=0,toolbar=0,menubar=0,width="+c+",height="+d+",left="+e+",top="+f)},this.isEmail=function(a){var b;return b=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,b.test(a)},this.getQueryParam=i,this}]),d.filter("moment",["utilities",function(a){return function(b,c){return b?(null==c&&(c="YYYY-MM-DD HH:mm:ss"),a.localizedDateTime(b,c)):""}}]),window.console&&window.console.log||(window.console={log:function(){}}),Array.prototype.remove=function(){var a,b,c,d,e;for(d=void 0,b=arguments,a=b.length,c=void 0,e=[];a&&this.length;)d=b[--a],e.push(function(){var a;for(a=[];-1!==(c=this.indexOf(d));)a.push(this.splice(c,1));return a}.call(this));return e},i=function(a){var b;return b=(new URI).query(!0),b[a]},window.getQueryParam=i,n=function(a,b){var c,d,e,f;if(f=a.split("?"),f.length>=2){for(e=encodeURIComponent(b)+"=",d=f[1].split(/[&;]/g),c=d.length;c-->0;)-1!==d[c].lastIndexOf(e,0)&&d.splice(c,1);return a=f[0]+(d.length>0?"?"+d.join("&"):"")}return a},window.removeQueryParameter=n,f=function(){var a,b;return b=new Date,a=new Date(b.getFullYear()+50,b.getMonth(),b.getDate())},window.getCookieExpireDate=f,e=function(a){var b;return b=document.createElement("textarea"),b.innerText=a,document.body.appendChild(b),b.select(),document.execCommand("copy"),b.remove()},window.copyText=e,g=function(){var a,c,d,e,g,h,i,j,k,l;for(h="lang=",e=null,c=document.cookie.split(";"),i=0,k=c.length;k>i;i++){for(a=c[i];" "===a.charAt(0);)a=a.substring(1);if(0===a.indexOf(h)){e=a.substring(h.length,a.length);break}}for(e||(e=navigator.userLanguage||navigator.language,e="zh-TW"===e?"zh_TW":e.substring(0,2)),d=!1,j=0,l=b.length;l>j;j++)if(g=b[j],e===g.value){d=!0;break}return d||(e="en"),document.cookie="lang="+e+"; path=/; expires="+f(),e?e.replace("-","_"):void 0},window.getCurrentLang=g,h=function(){return(new URI).path()},window.getCurrentPath=h,m=function(a,b){return a=new URI(a),b||(b=g()),a.href()},window.localizedUrl=m,String.prototype.startsWith=function(a){return this.substr(0,a.length)===a},j=function(a){var b;return b=/\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:)))(%.+)?\s*/,b.test(a)},window.isUrlIPV6=j,l=["common"],k=function(a){return a?a.length?l=l.concat(a):l.push(a):void 0},window.loadModule=k,$(function(){return window.console&&console.log&&console.log("angularjs bootstrap",l),angular.bootstrap(document,l)})}.call(this),function(){var a;a=angular.module("session",["ngCookies"]),a.factory("session",["$cookieStore","$cookies","$log",function(a,b,c){var d;return d="__qcss",this.getAll=function(){var e;return e=b.get(d),(null==e||"object"!=typeof e)&&(c.debug("init cookie session"),e={},a.put(d,e)),e},this.put=function(b,c){var e;return e=this.getAll(),e[b]=c,a.put(d,e)},this.get=function(a){return this.getAll()[a]},this.remove=function(b){var c;return c=this.getAll(),delete c[b],a.put(d,c)},this.clear=function(){return a.remove(d)},this}])}.call(this),function(){var a;a=angular.module("pref",[]),a.service("preference",["$cookieStore","$log",function(a,b){var c,d;return c="__qcpref",d={},this.get=function(b,e){var f;return f=a.get(c),f||(f=d,a.put(c,f)),f[b]||null==e||(f[b]=e,a.put(c,f)),f[b]},this.put=function(b,e){var f;return f=a.get(c)||angular.copy(d),f[b]=e,a.put(c,f)},this.clear=function(){return a.remove(c)},this}])}.call(this);