-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathne-modules.min.js
More file actions
6 lines (6 loc) · 143 KB
/
ne-modules.min.js
File metadata and controls
6 lines (6 loc) · 143 KB
1
2
3
4
5
6
angular.module("neContentEditors",[]).factory("neMarkdown",["$document","NeRemarked","neMarked",function(e,t,n){function r(e,t,n){var r=e.inputValue.substring(e.start-t.length,e.start),i=e.inputValue.substring(e.end,e.end+n.length);return r===t&&i===n}function i(e,t,n,i){return i=i||"toggle",function(o){var s="";return e=e||"",t=t||"",o&&o.end>o.start&&"replace"!==i?"remove"===i||"toggle"===i&&r(o,e,t)?(s=o.inputValue.substring(0,o.start-e.length)+o.value+o.inputValue.substring(o.end+t.length,o.inputValue.length),o.select(o.start-e.length,o.end-e.length)):(s=e+o.value+t,s=o.inputValue.substring(0,o.start)+s+o.inputValue.substring(o.end,o.inputValue.length),o.select(o.start+e.length,o.end+e.length)):o&&(n||""===n)&&(s=o.inputValue.substring(0,o.start)+e+n+t+o.inputValue.substring(o.end,o.inputValue.length),o.select(o.start+e.length,o.start+n.length+e.length)),s}}function o(e,t){var n,r,i="\n";for(n=1;n<t+3;n++)for(r=1;r<e+1;r++)i+=1===r?"\n":" | ",i+=1===n?"col "+r:2===n?"-----":"row "+(n-2);return i+"\n"}var s,a={},l={link_list:!1,h1_setext:!1,h2_setext:!1,h_atx_suf:!1,gfm_code:!1,li_bullet:"*",hr_char:"-",indnt_str:" ",bold_char:"*",emph_char:"_",gfm_del:!0,gfm_tbls:!0,tbl_edges:!1,hash_lnks:!1,br_only:!1},u=new t(l);return a.parseHTML=function(e){return u.render(e||"")},s={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!0,smartypants:!1},n.setOptions(s),a.renderHTML=function(e){return n(e||"")},a.editor={bold:i("**","**","bold text"),italic:i("*","*","italic text"),strikethrough:i("~~","~~","strikethrough text"),h1:i("\n# ","","headline 1"),h2:i("\n## ","","headline 2"),h3:i("\n### ","","headline 3"),h4:i("\n#### ","","headline 4"),h5:i("\n##### ","","headline 5"),h6:i("\n###### ","","headline 6"),ol:i("\n1. ","","numbered list"),ul:i("\n- ","","bulleted list"),indent:i(" ","","","replace"),dedent:i(" ","","","remove"),blocquote:i("\n> ","","blocquote text"),hr:i("\n\n-----\n\n","","","replace"),link:function(e,t,n){return t||""===t||(t=prompt("Please enter link url","http://")),t?i("","[ "+(n||"link text")+" ]( "+t+" )","","replace")(e):""},image:function(e,t){return t||""===t||(t=prompt("Please enter image url","http://")),t?i("","',"","replace")(e):""},table:function(e,t,n){return t=parseInt(t,10),n=parseInt(n,10),t>0&&n>0?i("",o(t,n),"","add")(e):e.inputValue}},a}]).controller("NeMdCtrl",["$scope","neMarkdown",function(e,t){e.editor=t.editor}]).controller("NeWsCtrl",["$scope","neWysiwyg",function(e,t){e.editor=t.editor}]).factory("neWysiwyg",["$document","neModals",function(e,t){function n(e,t){var n,r,i,o,s,a,l,u,d=window.getSelection(),c=e.range;d.removeAllRanges(),c.deleteContents(),n=c.startContainer,r=c.startOffset,c=document.createRange(),3===n.nodeType&&3===t.nodeType?(n.insertData(r,t.nodeValue),c.setEnd(n,r+t.length),c.setStart(n,r+t.length)):(3===n.nodeType?(o=n,n=o.parentNode,s=o.nodeValue,a=s.substr(0,r),l=s.substr(r),u=document.createTextNode(a),i=document.createTextNode(l),n.insertBefore(i,o),n.insertBefore(t,i),n.insertBefore(u,t),n.removeChild(o)):(i=n.childNodes[r],n.insertBefore(t,i)),c.setEnd(i,0),c.setStart(i,0)),d.addRange(c)}function r(t,n){return function(r){return e[0].execCommand(t,!1,n),r.parent.html()}}var i=["#ffffff","#ffccc9","#ffce93","#fffc9e","#ffffc7","#9aff99","#96fffb","#cdffff","#cbcefb","#cfcfcf","#fd6864","#fe996b","#fffe65","#fcff2f","#67fd9a","#38fff8","#68fdff","#9698ed","#c0c0c0","#fe0000","#f8a102","#ffcc67","#f8ff00","#34ff34","#68cbd0","#34cdf9","#6665cd","#9b9b9b","#cb0000","#f56b00","#ffcb2f","#ffc702","#32cb00","#00d2cb","#3166ff","#6434fc","#656565","#9a0000","#ce6301","#cd9934","#999903","#009901","#329a9d","#3531ff","#6200c9","#343434","#680100","#963400","#986536","#646809","#036400","#34696d","#00009b","#303498","#000000","#330001","#643403","#663234","#343300","#013300","#003532","#010066","#340096"],o=[{name:"Extra Small",css:"xx-small",value:"1"},{name:"Small",css:"x-small",value:"2"},{name:"Medium",css:"small",value:"3"},{name:"Large",css:"medium",value:"4"},{name:"Extra Large",css:"large",value:"5"},{name:"Huge",css:"x-large",value:"6"}],s={undo:r("undo"),redo:r("redo"),bold:r("bold"),italic:r("italic"),strikethrough:r("strikeThrough"),underline:r("underline"),quote:r("quote"),h1:r("formatblock","<h1>"),h2:r("formatblock","<h2>"),h3:r("formatblock","<h3>"),h4:r("formatblock","<h4>"),h5:r("formatblock","<h5>"),h6:r("formatblock","<h6>"),fontSizes:o,fontSize:function(e,t){return r("fontsize",t)(e)},colors:i,color:function(e,t){return r("forecolor",t)(e)},bgColor:function(e,t){return r("hilitecolor",t)(e)},justifyLeft:r("justifyleft"),justifyCenter:r("justifycenter"),justifyRight:r("justifyright"),justifyFull:r("justifyfull"),ol:r("insertorderedlist"),ul:r("insertunorderedlist"),indent:r("indent"),outdent:r("outdent"),unlink:r("unlink"),link:function(e,t,r){if(t||""===t||(t=prompt("Please enter link url","http://")),t){return n(e,angular.element('<a href="'+t+'">'+(r||t)+"</a>")[0]),e.parent.html()}return""},image:function(e,t){if(t||""===t||(t=prompt("Please enter image url","http://")),t){return n(e,angular.element('<img src="'+t+'">')[0]),e.parent.html()}return""},table:function(t,r,i){var o,s,a,l,u,d,c,f,h,p;if(i=parseInt(i,10),r=parseInt(r,10),o=e[0],i>0&&r>0){for(s=o.createElement("table"),a=o.createElement("thead"),l=o.createElement("tbody"),d=o.createElement("tr"),h=0;h<r;h++)u=o.createElement("th"),u.innerHTML="col "+(h+1),f=o.createElement("br"),u.appendChild(f),d.appendChild(u);for(a.appendChild(d),p=0;p<i;p++){for(d=o.createElement("tr"),h=0;h<r;h++)c=o.createElement("td"),c.innerHTML="row "+(p+1),f=o.createElement("br"),c.appendChild(f),d.appendChild(c);l.appendChild(d)}s.appendChild(a),s.appendChild(l),n(t,s)}return t.parent.html()},hr:r("inserthorizontalrule")};return this.editor=s,this}]).directive("neContenteditable",["$sce",function(e){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){function i(e){var i=t.html();n.stripBr&&"<br>"===i&&(i=""),(e&&i||!e)&&r.$setViewValue(i)}r&&(n.contenteditable||t.attr("contenteditable","true"),r.$render=function(){t.html(r.$viewValue||"")},t.on("blur keyup change",function(){e.$apply(i)}),i(!0))}}}]).directive("neSelectionModel",[function(){return{restrict:"A",require:"^ngModel",scope:{neSelectionModel:"="},link:function(e,t,n,r){function i(){function t(e,t,n){e.focus(),e.setSelectionRange?e.setSelectionRange(t,n):e.createTextRange&&(e=e.createTextRange(),e.collapse(!0),e.moveEnd("character",n),e.moveStart("character",t),e.select())}function n(){var r=this,i=r.selectionStart,o=r.selectionEnd;e.$apply(function(){e.neSelectionModel={parent:angular.element(r),value:r.value.substring(i,o),inputValue:r.value,start:i,end:o,select:function(e,i){setTimeout(function(){t(r,e,i),n.call(r)},0)}}})}this.setSelection=t,this.getSelection=n}function o(e,t){for(;e;){if(t(e))return e;e=e.parentNode}}function s(t){function n(e,t,n){}function r(){var t=this,r=o(angular.element(t)[0],function(e){return"HTML"===e.tagName}).parentNode,i=r.getSelection(),s=i.getRangeAt(0).startOffset,a=i.getRangeAt(0).endOffset,l=angular.element(t);e.$apply(function(){e.neSelectionModel={range:i.getRangeAt(0),parent:l,value:l.html().substring(s,a),inputValue:l.html(),start:s,startElement:i.getRangeAt(0).startContainer,end:a,endElement:i.getRangeAt(0).endContainer,select:function(e,r,i,o){var s=i||this.startElement,a=o||this.endElement;setTimeout(function(){n(t,e,r,s,a)},0)}}})}this.setSelection=n,this.getSelection=r}if("TEXTAREA"!==t[0].nodeName&&"true"!==n.contenteditable)throw new Error('neSelectionModel directive can be used only on <textarea> or contentEditable="true" element');var a="TEXTAREA"===t[0].nodeName?new i:new s;t.on("mouseup keyup",a.getSelection),e.$on("$destroy",function(){t.unbind("mouseup keyup",a.getSelection),e.neSelectionModel=null})}}}]).factory("NeRemarked",[function(){return function(e){function t(e,r){if(!r)return e;for(var i in e)"Object"==n(r[i])?t(e[i],r[i]):void 0!==r[i]&&(e[i]=r[i])}function n(e){return Object.prototype.toString.call(e).slice(8,-1)}function r(e,t){for(var n="";t-- >0;)n+=e;return n}function i(e){for(var e=e.replace(/^\s\s*/,""),t=/\s/,n=e.length;t.test(e.charAt(--n)););return e.slice(0,n+1)}function o(e,t){var n,r,i;if(!e)return"";for(n="<"+e,i=0;i<t.attributes.length;i++)r=t.attributes.item(i),n+=" "+r.nodeName+'="'+r.nodeValue+'"';return n+">"}function s(e){return e?"</"+e+">":""}function a(e,t){return e.replace(/^/gm,t)}function l(e){return("#text"==e.nodeName?"txt":e.nodeName).toLowerCase()}function u(e,t){var n,r;return t instanceof Array?(n=t[0],r=t[1]):n=r=t,n=n instanceof Function?n.call(this,e):n,r=r instanceof Function?r.call(this,e):r,n+e+r}function d(e){return e.outerHTML||function(e){var t,n=document.createElement("div");return n.appendChild(e.cloneNode(!0)),t=n.innerHTML,n=null,t}(e)}var c,f,h=[],p={link_list:!1,h1_setext:!0,h2_setext:!0,h_atx_suf:!1,gfm_code:!1,li_bullet:"*-+"[0],hr_char:"-_*"[0],indnt_str:[" ","\t"," "][0],bold_char:"*_"[0],emph_char:"*_"[1],gfm_del:!0,gfm_tbls:!0,tbl_edges:!1,hash_lnks:!1,br_only:!1,col_pre:"col ",unsup_tags:{ignore:"script style noscript",inline:"span sup sub i u b center big",block2:"div form fieldset dl header footer address article aside figure hgroup section",block1c:"dt dd caption legend figcaption output",block2c:"canvas audio video iframe"},tag_remap:{i:"em",b:"strong"}};t(p,e),this.render=function(e){var t,n,i,o,s,a,u,d;if(h=[],"string"==typeof e&&(t=e,e=document.createElement("div"),e.innerHTML=t),n=new c.tag(e,null,0),i=n.rend().replace(/^[\t ]+\n/gm,"\n"),p.link_list&&h.length>0){for(i+="\n\n",o=0,s=0;s<h.length;s++)h[s].e.title&&(a=h[s].e.href.length)&&a>o&&(o=a);for(u=0;u<h.length;u++)d=h[u].e.title?r(" ",o+2-h[u].e.href.length)+'"'+h[u].e.title+'"':"",i+=" ["+(+u+1)+"]: "+("a"==l(h[u].e)?h[u].e.href:h[u].e.src)+d+"\n"}return i.replace(/^[\t ]+\n/gm,"\n")},c={},c.tag=klass({wrap:"",lnPfx:"",lnInd:0,init:function(e,t,n){this.e=e,this.p=t,this.i=n,this.c=[],this.tag=l(e),this.initK()},initK:function(){var e,t,n,r,i,o,s,a,u,d,f,g,m,y,v,b;if(this.e.hasChildNodes()){if(t=p.unsup_tags.inline,"table"==l(this.e)&&this.e.hasChildNodes()&&!this.e.tHead){if(i=document.createElement("thead"),o=this.e.tBodies[0],s=o.rows[0],a=s.cells[0],"th"==l(a))i.appendChild(s);else for(e=0,d=s.cells.length,f=i.insertRow();e++<d;)u=document.createElement("th"),u.textContent=p.col_pre+e,f.appendChild(u);this.e.insertBefore(i,o)}for(e in this.e.childNodes)if(/\d+/.test(e)&&(n=this.e.childNodes[e],r=l(n),r in p.tag_remap&&(r=p.tag_remap[r]),!p.unsup_tags.ignore.test(r))){if("txt"==r&&/^\s+$/.test(n.textContent)){if(0==e||e==this.e.childNodes.length-1)continue;if(g=this.e.childNodes[e-1],m=this.e.childNodes[e+1],g&&!l(g).match(t)||m&&!l(m).match(t))continue}y=null,c[r]||(v=p.unsup_tags,v.inline.test(r)?r="tinl":v.block2.test(r)?r="tblk":v.block1c.test(r)?r="ctblk":v.block2c.test(r)?(r="ctblk",y=["\n\n",""]):r="rawhtml"),b=new c[r](n,this,this.c.length),y&&(b.wrap=y),(b instanceof c.a&&n.href||b instanceof c.img)&&(b.lnkid=h.length,h.push(b)),this.c.push(b)}}},rend:function(){return this.rendK().replace(/\n{3,}/gm,"\n\n")},rendK:function(){var e,t,n="";for(t=0;t<this.c.length;t++)e=this.c[t],n+=(e.bef||"")+e.rend()+(e.aft||"");return n.replace(/^\n+|\n+$/,"")}}),c.blk=c.tag.extend({wrap:["\n\n",""],wrapK:null,tagr:!1,lnInd:null,init:function(e,t,n){this.supr(e,t,n),null===this.lnInd&&(this.p&&this.tagr&&this.c[0]instanceof c.blk?this.lnInd=4:this.lnInd=0),null===this.wrapK&&(this.tagr&&this.c[0]instanceof c.blk?this.wrapK="\n":this.wrapK="")},rend:function(){return u.call(this,(this.tagr?o(this.tag,this.e):"")+u.call(this,a(a(this.rendK(),this.lnPfx),r(" ",this.lnInd)),this.wrapK)+(this.tagr?s(this.tag):""),this.wrap)},rendK:function(){var e,t,n,r=this.supr();if(this.p instanceof c.li){if(e=null,!(t=r.match(/^[\t ]+/gm)))return r;for(n=0;n<t.length;n++)(null===e||t[n][0].length<e.length)&&(e=t[n][0]);return r.replace(new RegExp("^"+e),"")}return r}}),c.tblk=c.blk.extend({tagr:!0}),c.cblk=c.blk.extend({wrap:["\n",""]}),c.ctblk=c.cblk.extend({tagr:!0}),c.inl=c.tag.extend({rend:function(){return u.call(this,this.rendK(),this.wrap)}}),c.tinl=c.inl.extend({tagr:!0,rend:function(){return o(this.tag,this.e)+u.call(this,this.rendK(),this.wrap)+s(this.tag)}}),c.p=c.blk.extend({rendK:function(){return this.supr().replace(/^\s+/gm,"")}}),c.list=c.blk.extend({expn:!1,wrap:[function(){return this.p instanceof c.li?"\n":"\n\n"},""]}),c.ul=c.list.extend({}),c.ol=c.list.extend({}),c.li=c.cblk.extend({wrap:["\n",function(e){return this.p.expn||e.match(/\n{2}/gm)?"\n":""}],wrapK:[function(){return"ul"==this.p.tag?p.li_bullet+" ":this.i+1+". "},""],rendK:function(){return this.supr().replace(/\n([^\n])/gm,"\n"+p.indnt_str+"$1")}}),c.hr=c.blk.extend({wrap:["\n\n",r(p.hr_char,3)]}),c.h=c.blk.extend({}),c.h_setext=c.h.extend({}),p.h1_setext&&(c.h1=c.h_setext.extend({wrapK:["",function(e){return"\n"+r("=",e.length)}]})),p.h2_setext&&(c.h2=c.h_setext.extend({wrapK:["",function(e){return"\n"+r("-",e.length)}]})),c.h_atx=c.h.extend({wrapK:[function(e){return r("#",this.tag[1])+" "},function(e){return p.h_atx_suf?" "+r("#",this.tag[1]):""}]}),!p.h1_setext&&(c.h1=c.h_atx.extend({})),!p.h2_setext&&(c.h2=c.h_atx.extend({})),c.h3=c.h_atx.extend({}),c.h4=c.h_atx.extend({}),c.h5=c.h_atx.extend({}),c.h6=c.h_atx.extend({}),c.a=c.inl.extend({lnkid:null,rend:function(){var e=this.rendK(),t=this.e.getAttribute("href"),n=this.e.title?' "'+this.e.title+'"':"";return!t||t==e||"#"==t[0]&&!p.hash_lnks?e:p.link_list?"["+e+"] ["+(this.lnkid+1)+"]":"["+e+"]("+t+n+")"}}),c.img=c.inl.extend({lnkid:null,rend:function(){var e,t=this.e.alt,n=this.e.getAttribute("src");return p.link_list?"!["+t+"] ["+(this.lnkid+1)+"]":(e=this.e.title?' "'+this.e.title+'"':"","")}}),c.em=c.inl.extend({wrap:p.emph_char}),c.del=p.gfm_del?c.inl.extend({wrap:"~~"}):c.tinl.extend(),c.br=c.inl.extend({wrap:["",function(){var e=p.br_only?"<br>":" ";return this.p instanceof c.h?"<br>":e+"\n"}]}),c.strong=c.inl.extend({wrap:r(p.bold_char,2)}),c.blockquote=c.blk.extend({lnPfx:"> ",rend:function(){return this.supr().replace(/>[ \t]$/gm,">")}}),c.pre=c.blk.extend({tagr:!0,wrapK:"\n",lnInd:0}),c.code=c.blk.extend({tagr:!1,wrap:"",wrapK:function(e){return-1!==e.indexOf("`")?"``":"`"},lnInd:0,init:function(e,t,n){if(this.supr(e,t,n),this.p instanceof c.pre)if(this.p.tagr=!1,p.gfm_code){var r=this.e.getAttribute("class");r=(r||"").split(" ")[0],0===r.indexOf("lang-")&&(r=r.substr(5)),this.wrapK=["```"+r+"\n","\n```"]}else this.wrapK="",this.p.lnInd=4}}),c.table=p.gfm_tbls?c.blk.extend({cols:[],init:function(e,t,n){this.supr(e,t,n),this.cols=[]},rend:function(){var e,t,n;for(e=0;e<this.c.length;e++)for(t=0;t<this.c[e].c.length;t++)for(n=0;n<this.c[e].c[t].c.length;n++)this.c[e].c[t].c[n].prep();return this.supr()}}):c.tblk.extend(),c.thead=p.gfm_tbls?c.cblk.extend({wrap:["\n",function(e){var t,n,o,s,a="";for(t=0;t<this.p.cols.length;t++)n=this.p.cols[t],o="c"==n.a[0]?":":" ",s="r"==n.a[0]||"c"==n.a[0]?":":" ",a+=(0==t&&p.tbl_edges?"|":"")+o+r("-",n.w)+s+(t<this.p.cols.length-1||p.tbl_edges?"|":"");return"\n"+i(a)}]}):c.ctblk.extend(),c.tbody=p.gfm_tbls?c.cblk.extend():c.ctblk.extend(),c.tfoot=p.gfm_tbls?c.cblk.extend():c.ctblk.extend(),c.tr=p.gfm_tbls?c.cblk.extend({wrapK:[p.tbl_edges?"| ":"",p.tbl_edges?" |":""]}):c.ctblk.extend(),c.th=p.gfm_tbls?c.inl.extend({guts:null,wrap:[function(){var e,t=this.p.p.p.cols[this.i],n=0==this.i?"":" ",i=t.w-this.guts.length;switch(t.a[0]){case"r":e=r(" ",i);break;case"c":e=r(" ",Math.floor(i/2));break;default:e=""}return n+e},function(){var e,t=this.p.p.p.cols[this.i],n=this.i==this.p.c.length-1?"":" |",i=t.w-this.guts.length;switch(t.a[0]){case"r":e="";break;case"c":e=r(" ",Math.ceil(i/2));break;default:e=r(" ",i)}return e+n}],prep:function(){var e,t;this.guts=this.rendK(),this.rendK=function(){return this.guts},e=this.p.p.p.cols,e[this.i]||(e[this.i]={w:null,a:""}),t=e[this.i],t.w=Math.max(t.w||0,this.guts.length),this.e.align&&(t.a=this.e.align)}}):c.ctblk.extend(),c.td=c.th.extend(),c.txt=c.inl.extend({initK:function(){this.c=this.e.textContent.split(/^/gm)},rendK:function(){var e=this.c.join("").replace(/\r/gm,"");return this.p instanceof c.code||this.p instanceof c.pre||(e=e.replace(/^\s*#/gm,"\\#").replace(/\*/gm,"\\*")),0==this.i&&(e=e.replace(/^\n+/,"")),this.i==this.p.c.length-1&&(e=e.replace(/\n+$/,"")),e}}),c.rawhtml=c.blk.extend({initK:function(){this.guts=d(this.e)},rendK:function(){return this.guts}});for(f in p.unsup_tags)p.unsup_tags[f]=new RegExp("^(?:"+("inline"==f?"a|em|strong|img|code|del|":"")+p.unsup_tags[f].replace(/\s/g,"|")+")$")}}]).factory("neMarked",[function(){return function(){function e(e){this.tokens=[],this.tokens.links={},this.options=e||l.defaults,this.rules=d.normal,this.options.gfm&&(this.options.tables?this.rules=d.tables:this.rules=d.gfm)}function t(e,t){if(this.options=t||l.defaults,this.links=e,this.rules=u.normal,this.renderer=this.options.renderer||new n,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=u.breaks:this.rules=u.gfm:this.options.pedantic&&(this.rules=u.pedantic)}function n(){}function r(e){this.tokens=[],this.token=null,this.options=e||l.defaults,this.options.renderer=this.options.renderer||new n,this.renderer=this.options.renderer}function i(e,encode){return e.replace(encode?/&/g:/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function o(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,i),n):new RegExp(e,t)}}function s(){}function a(e){for(var t,n,r=1;r<arguments.length;r++){t=arguments[r];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}function l(t,n,o){var s,u;if(o||"function"==typeof n){o||(o=n,n=null),n=a({},l.defaults,n||{}),s=n.highlight,0;try{u=e.lex(t,n)}catch(e){return o(e)}return u.length,function(){var e,t;try{e=r.parse(u,n)}catch(e){t=e}return n.highlight=s,t?o(t):o(null,e)}()}try{return n&&(n=a({},l.defaults,n)),r.parse(e.lex(t,n),n)}catch(e){if(e.message+="\nPlease report this to https://github.com/chjj/marked.",(n||l.defaults).silent)return"<p>An error occured:</p><pre>"+i(e.message+"",!0)+"</pre>";throw e}}var u,d={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:s,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:s,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:s,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};d.bullet=/(?:[*+-]|\d+\.)/,d.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,d.item=o(d.item,"gm")(/bull/g,d.bullet)(),d.list=o(d.list)(/bull/g,d.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)(),d._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b",d.html=o(d.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,d._tag)(),d.paragraph=o(d.paragraph)("hr",d.hr)("heading",d.heading)("lheading",d.lheading)("blockquote",d.blockquote)("tag","<"+d._tag)("def",d.def)(),d.normal=a({},d),d.gfm=a({},d.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/}),d.gfm.paragraph=o(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|"+d.list.source.replace("\\1","\\3")+"|")(),d.tables=a({},d.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),e.rules=d,e.lex=function(t,n){return new e(n).lex(t)},e.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},e.prototype.token=function(e,t){for(var n,r,i,o,s,a,l,u,c,e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(t&&(i=this.rules.nptable.exec(e))){for(e=e.substring(i[0].length),a={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/\n$/,"").split("\n")},u=0;u<a.align.length;u++)/^ *-+: *$/.test(a.align[u])?a.align[u]="right":/^ *:-+: *$/.test(a.align[u])?a.align[u]="center":/^ *:-+ *$/.test(a.align[u])?a.align[u]="left":a.align[u]=null;for(u=0;u<a.cells.length;u++)a.cells[u]=a.cells[u].split(/ *\| */);this.tokens.push(a)}else if(i=this.rules.lheading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:"="===i[2]?1:2,text:i[1]});else if(i=this.rules.hr.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"hr"});else if(i=this.rules.blockquote.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"blockquote_start"}),i=i[0].replace(/^ *> ?/gm,""),this.token(i,t),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),o=i[2],this.tokens.push({type:"list_start",ordered:o.length>1}),i=i[0].match(this.rules.item),n=!1,c=i.length,u=0;u<c;u++)a=i[u],l=a.length,a=a.replace(/^ *([*+-]|\d+\.) +/,""),~a.indexOf("\n ")&&(l-=a.length,a=this.options.pedantic?a.replace(/^ {1,4}/gm,""):a.replace(new RegExp("^ {1,"+l+"}","gm"),"")),this.options.smartLists&&u!==c-1&&(s=d.bullet.exec(i[u+1])[0],o===s||o.length>1&&s.length>1||(e=i.slice(u+1).join("\n")+e,u=c-1)),r=n||/\n\n(?!\s*$)/.test(a),u!==c-1&&(n="\n"===a.charAt(a.length-1),r||(r=n)),this.tokens.push({type:r?"loose_item_start":"list_item_start"}),this.token(a,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:"pre"===i[1]||"script"===i[1]||"style"===i[1],text:i[0]});else if(t&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),this.tokens.links[i[1].toLowerCase()]={href:i[2],title:i[3]};else if(t&&(i=this.rules.table.exec(e))){for(e=e.substring(i[0].length),a={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u<a.align.length;u++)/^ *-+: *$/.test(a.align[u])?a.align[u]="right":/^ *:-+: *$/.test(a.align[u])?a.align[u]="center":/^ *:-+ *$/.test(a.align[u])?a.align[u]="left":a.align[u]=null;for(u=0;u<a.cells.length;u++)a.cells[u]=a.cells[u].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(a)}else if(t&&(i=this.rules.paragraph.exec(e)))e=e.substring(i[0].length),this.tokens.push({type:"paragraph",text:"\n"===i[1].charAt(i[1].length-1)?i[1].slice(0,-1):i[1]});else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"text",text:i[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens},u={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:s,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:s,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/},u._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,u._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,u.link=o(u.link)("inside",u._inside)("href",u._href)(),u.reflink=o(u.reflink)("inside",u._inside)(),u.normal=a({},u),u.pedantic=a({},u.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),u.gfm=a({},u.normal,{escape:o(u.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:o(u.text)("]|","~]|")("|","|https?://|")()}),u.breaks=a({},u.gfm,{br:o(u.br)("{2,}","*")(),text:o(u.gfm.text)("{2,}","*")()}),t.rules=u,t.output=function(e,n,r){return new t(n,r).output(e)},t.prototype.output=function(e){for(var t,n,r,o,s="";e;)if(o=this.rules.escape.exec(e))e=e.substring(o[0].length),s+=o[1];else if(o=this.rules.autolink.exec(e))e=e.substring(o[0].length),"@"===o[2]?(n=":"===o[1].charAt(6)?this.mangle(o[1].substring(7)):this.mangle(o[1]),r=this.mangle("mailto:")+n):(n=i(o[1]),r=n),s+=this.renderer.link(r,null,n);else if(o=this.rules.url.exec(e))e=e.substring(o[0].length),n=i(o[1]),r=n,s+=this.renderer.link(r,null,n);else if(o=this.rules.tag.exec(e))e=e.substring(o[0].length),s+=this.options.sanitize?i(o[0]):o[0];else if(o=this.rules.link.exec(e))e=e.substring(o[0].length),s+=this.outputLink(o,{href:o[2],title:o[3]});else if((o=this.rules.reflink.exec(e))||(o=this.rules.nolink.exec(e))){if(e=e.substring(o[0].length),t=(o[2]||o[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){s+=o[0].charAt(0),e=o[0].substring(1)+e;continue}s+=this.outputLink(o,t)}else if(o=this.rules.strong.exec(e))e=e.substring(o[0].length),s+=this.renderer.strong(this.output(o[2]||o[1]));else if(o=this.rules.em.exec(e))e=e.substring(o[0].length),s+=this.renderer.em(this.output(o[2]||o[1]));else if(o=this.rules.code.exec(e))e=e.substring(o[0].length),s+=this.renderer.codespan(i(o[2],!0));else if(o=this.rules.br.exec(e))e=e.substring(o[0].length),s+=this.renderer.br();else if(o=this.rules.del.exec(e))e=e.substring(o[0].length),s+=this.renderer.del(this.output(o[1]));else if(o=this.rules.text.exec(e))e=e.substring(o[0].length),s+=i(this.smartypants(o[0]));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return s},t.prototype.outputLink=function(e,t){var n=i(t.href),r=t.title?i(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,i(e[1]))},t.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/--/g,"—").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},t.prototype.mangle=function(e){for(var t,n="",r=e.length,i=0;i<r;i++)t=e.charCodeAt(i),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},n.prototype.code=function(e,t){return t?'<pre><code class="lang-'+t+'">'+i(e)+"\n</code></pre>\n":"<pre><code>"+i(e,!0)+"\n</code></pre>"},n.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},n.prototype.html=function(e){return e},n.prototype.heading=function(e,t,n,r){return"<h"+t+">"+e+"</h"+t+">\n"},n.prototype.hr=function(){return"<hr>\n"},n.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"</"+n+">\n"},n.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},n.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},n.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},n.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},n.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"},n.prototype.strong=function(e){return"<strong>"+e+"</strong>"},n.prototype.em=function(e){return"<em>"+e+"</em>"},n.prototype.codespan=function(e){return"<code>"+e+"</code>"},n.prototype.br=function(){return"<br>"},n.prototype.del=function(e){return"<del>"+e+"</del>"},n.prototype.link=function(e,t,n){var r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>"},n.prototype.image=function(e,t,n){var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=">"},r.parse=function(e,t,n){return new r(t,n).parse(e)},r.prototype.parse=function(e){this.inline=new t(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var n="";this.next();)n+=this.tok();return n},r.prototype.next=function(){return this.token=this.tokens.pop()},r.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},r.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},r.prototype.tok=function(){var e,t,n,r,i,o,s,a;switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth);case"code":return this.renderer.code(this.token.text,this.token.lang);case"table":for(e="",t="",i="",n=0;n<this.token.header.length;n++)({header:!0,align:this.token.align[n]}),i+=this.renderer.tablecell(this.inline.output(this.token.header[n]),{header:!0,align:this.token.align[n]});for(e+=this.renderer.tablerow(i),n=0;n<this.token.cells.length;n++){for(r=this.token.cells[n],i="",o=0;o<r.length;o++)i+=this.renderer.tablecell(this.inline.output(r[o]),{header:!1,align:this.token.align[o]});t+=this.renderer.tablerow(i)}return this.renderer.table(e,t);case"blockquote_start":for(t="";"blockquote_end"!==this.next().type;)t+=this.tok();return this.renderer.blockquote(t);case"list_start":for(t="",s=this.token.ordered;"list_end"!==this.next().type;)t+=this.tok();return this.renderer.list(t,s);case"list_item_start":for(t="";"list_item_end"!==this.next().type;)t+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(t);case"loose_item_start":for(t="";"list_item_end"!==this.next().type;)t+=this.tok();return this.renderer.listitem(t);case"html":return a=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text),this.renderer.html(a);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},s.exec=s,l.options=l.setOptions=function(e){return a(l.defaults,e),l},l.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!1,silent:!1,smartypants:!1,renderer:new n},l.Parser=r,l.parser=r.parse,l.Renderer=n,l.Lexer=e,l.lexer=e.lex,l.InlineLexer=t,l.inlineLexer=t.output,l.parse=l,"object"==typeof exports?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):this.marked=l}.call(function(){return this||("undefined"!=typeof window?window:global)}()),marked}]),function(e,t){"function"==typeof define?define(t):"undefined"!=typeof module?module.exports=t():this.klass=t()}(0,function(){function e(e){return i.call(t(e)?e:function(){},e,1)}function t(e){return typeof e===a}function n(e,t,n){return function(){var r,i=this.supr;return this.supr=n[u][e],r=t.apply(this,arguments),this.supr=i,r}}function r(e,r,i){for(var o in r)r.hasOwnProperty(o)&&(e[o]=t(r[o])&&t(i[u][o])&&l.test(r[o])?n(o,r[o],i):r[o])}function i(e,n){function i(){}function o(){this.init?this.init.apply(this,arguments):(n||l&&s.apply(this,arguments),d.apply(this,arguments))}i[u]=this[u];var s=this,a=new i,l=t(e),d=l?e:this,c=l?{}:e;return o.methods=function(e){return r(a,e,s),o[u]=a,this},o.methods.call(o,c).prototype.constructor=o,o.extend=arguments.callee,o[u].implement=o.statics=function(e,t){return e="string"==typeof e?function(){var n={};return n[e]=t,n}():e,r(this,e,s),this},o}var o=this,s=o.klass,a="function",l=/xyz/.test(function(){xyz})?/\bsupr\b/:/.*/,u="prototype";return e.noConflict=function(){return o.klass=s,this},o.klass=e,e}),
angular.module("neDirectives",["neObject"]).directive("neInitData",[function(){return{priority:1e3,restrict:"AE",compile:function(){return{pre:function(e,t,n){n.neInitData?e.$eval((n.neInitAs?n.neInitAs+"=":"")+n.neInitData):t.html()&&e.$eval((n.neInitAs?n.neInitAs+"=":"")+t.html()),n.neInitDone&&e.$eval(n.neInitDone)}}}}}]).service("neKeyPressHandler",[function(){return function(e,t,n){return function(r,i,o){function s(i){i.which===t&&(r.$apply(function(){r.$eval(o[e])}),n&&i.preventDefault())}var a;a="INPUT"===i[0].nodeName?i:angular.element(document),a.bind("keydown keypress",s),r.$on("$destroy",function(){a.unbind("keydown keypress",s)})}}}]).directive("neKeypressEnter",["neKeyPressHandler",function(e){return e("neKeypressEnter",13,!0)}]).directive("neKeypressEscape",["neKeyPressHandler",function(e){return e("neKeypressEscape",27,!0)}]).directive("neKeypressRight",["neKeyPressHandler",function(e){return e("neKeypressRight",39)}]).directive("neKeypressLeft",["neKeyPressHandler",function(e){return e("neKeypressLeft",37)}]).directive("neKeypressUp",["neKeyPressHandler",function(e){return e("neKeypressUp",38)}]).directive("neKeypressDown",["neKeyPressHandler",function(e){return e("neKeypressDown",40)}]).directive("neKeypressBackspace",["neKeyPressHandler",function(e){return e("neKeypressBackspace",8)}]).directive("neLoadingStart",["$timeout",function(e){return function(t,n,r){"IMG"===n[0].nodeName&&r.$observe("src",function(){e(function(){t.$eval(r.neLoadingStart)})})}}]).directive("neLoadingEnd",["$timeout",function(e){return function(t,n,r){function i(n){e(function(){t.$eval(r.neLoadingEnd)},5),n.preventDefault()}"IMG"===n[0].nodeName&&(n.bind("load",i),t.$on("$destroy",function(){n.unbind("load",i)}))}}]).directive("neStatusIcon",[function(){return{restrict:"A",compile:function(e,t){var n='<div class="right-inner-addon">'+("reverse"!==t.neStatusIcon?'<i class="fa fa-check text-success" ng-show="'+e.attr("ng-model")+'"></i>':"")+("reverse"===t.neStatusIcon?'<i class="fa fa-times text-danger" ng-show="!'+e.attr("ng-model")+'"></i>':"")+"</div>";e.wrap(n),e.removeAttr("status-icon")}}}]).directive("neMatchHrefPath",["$window","$location",function(e,t){return{priority:-100,link:function(n,r,i){function o(){(t.path()+"/").match(new RegExp("^"+s+"[/#?].*"))?r.addClass(l):r.removeClass(l)}var s,a,l=n.$eval(i.neMatchHrefPath)||i.neMatchHrefPath;if(l){if(i.href)try{s=n.$eval(i.href)}catch(e){s=i.href}else if(a=r.find("a")[0],s=a?a.getAttribute("href"):null,a&&s)try{s=n.$eval(s.replace("{{","").replace("}}",""))}catch(e){s=s}s&&-1===s.indexOf("#")?(s=s.replace(/^http:/g,"").replace(/^https:/g,"").replace(e.location.hostname,"").replace(/\/+/g,"/"),(e.location.pathname+"/").match(new RegExp("^"+s+"[/#?].*"))?r.addClass(l):r.removeClass(l)):s&&(s=s.match(/^([^\#]*)\#([^\#\?]*).*$/),s=s?s[s.length-1]:null,s&&n.$on("$locationChangeSuccess",o),o())}}}}]).directive("neFile",[function(){return{restrict:"E",template:'<input type="file" />',replace:!0,require:"ngModel",link:function(e,t,n,r){var i=function(){e.$apply(function(){var e,i;if(n.multiple||""===n.multiple){for(e=[],i=0;i<t[0].files.length;i++)e.push(t[0].files[i]);r.$setViewValue(e)}else r.$setViewValue(t[0].files[0])})};t.attr("accept",n.accept),t.bind("change",i)}}}]).constant("neFileDropAreaSystemFiles",["thumbs.db","desktop.ini",".DS_Store"]).service("neFileDropArea",["$q","neFileDropAreaSystemFiles",function(e,t){return this.bind=function(n,r,i,o){function s(e){e.stopPropagation(),e.preventDefault()}function a(e){s(e),g||(n.addClass("ne-dragover"),g=!0)}function l(e){s(e),n.removeClass("ne-dragover"),g=!1}function u(t){return e(function(e,n){t.file(e,n)})}function d(t){return e(function(e,n){t.readEntries(e,n)})}function c(n,r){return n.isFile?r&&t.indexOf(n.name)>-1?void 0:u(n):n.isDirectory?d(n.createReader()).then(function(t){var n,r,i=[];for(r=0;r<t.length;r++)(n=c(t[r],!0))&&i.push(n);return e.all(i).then(function(e){return[].concat.apply([],e)})}):void 0}function f(t){var n,r,i,o,s=t.dataTransfer.items;if(!s)return e.resolve(t.dataTransfer.files);if(!s[0].webkitGetAsEntry)return e.resolve(t.dataTransfer.files);for(n=[],r=[],o=0;o<s.length;o++)(i=c(s[o].webkitGetAsEntry()))&&r.push(i);return e.all(r).then(function(t){return n=[].concat.apply([],t),e.resolve(n)})}function h(e){l(e),f(e).then(function(e){var t,n=0,o=e[0];o&&(n+=o.fileSize,i?(t=new FileReader,t.onerror=function(e){alert("Cannot read file: "+e.target.error)},t.onload=function(e){return function(e){r(e.target.result)}}(),t[i](o)):r(e))}).catch(o)}var p=n[0],g=!1;return p.addEventListener("dragenter",a,!1),p.addEventListener("dragover",a,!1),p.addEventListener("dragleave",l,!1),p.addEventListener("drop",h,!1),{unbind:function(){g=null,p.removeEventListener("dragenter",a,!1),p.removeEventListener("dragover",a,!1),p.removeEventListener("dragleave",l,!1),p.removeEventListener("drop",h,!1)}}},this}]).directive("neFileDropArea",["neFileDropArea",function(e){return{restrict:"A",scope:{onError:"&neFileDropOnError",onDrop:"&neFileDrop",onDropAlias1:"&neFilesDrop",onDropAlias2:"&ondrop"},link:function(t,n,r,i){var o=r.neFileDropArea?new RegExp(r.neFileDropArea):null,s=e.bind(n,function(e){var n,r=[];for(n=0;n<e.length;n++)o&&!e[n].type.match(o)||r.push(e[n]);r.length&&(t.onDrop({files:r}),t.onDropAlias1({files:r}),t.onDropAlias2({files:r}))},null,function(e){t.onError({error:e})});t.$on("$destroy",s.unbind)}}}]).directive("neCopy",[function(){return{restrict:"A",link:function(e,t,n,r){function i(){e[a]=angular.copy(s)}function o(){var t,n=e[a];for(t in n)!n.hasOwnProperty(t)||"$"===t[0]&&"$"===t[1]||(s[t]=n[t])}var s=e.$eval(n.neCopy),a=e.alias||n.neCopyAlias||"$copy";e.$rollback=i,e.$commit=o,s.$commit=o,s.$rollback=i,e.$rollback()}}}]).directive("neFormChange",[function(){return{restrict:"A",require:"^form",link:function(e,t,n,r){e.$watch(function(){return r.$valid},function(t){e.$valid=e.$isValid=t,e.$eval(n.neFormChange)})}}}]).directive("neBindHtml",["$sce",function(e){return{restrict:"A",link:function(e,t,n){n.$observe("neBindHtml",function(e){t.html(e)})}}}]).filter("html",["$sce",function(e){return function(t){return e.trustAsHtml(t)}}]).filter("trusted",["$sce",function(e){return function(t){return e.trustAsHtml(t)}}]),angular.module("neDragdrop",[]).directive("draggable",[function(){return function(e,t,n){function r(e){return e.preventDefault(),!1}function i(t){var r;return n.drag&&(r=e.$apply(n.drag)),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",JSON.stringify(r||new Date)),this.classList.add("dragged"),!1}function o(t){return this.classList.remove("dragged"),n.dragEnd&&e.$apply(n.dragEnd),!1}var s=t[0];"false"===n.draggable?(s.addEventListener("dragstart",r),e.$on("$destroy",function(){s.removeEventListener("dragstart",r)})):(s.draggable=!0,s.addEventListener("dragstart",i),s.addEventListener("dragend",o),e.$on("$destroy",function(){s.removeEventListener("dragstart",i),s.removeEventListener("dragend",o)}))}}]).directive("droppable",[function(){return function(e,t,n){function r(t){return t.dataTransfer.dropEffect="move",t.preventDefault&&t.preventDefault(),(!n.droppable||n.droppable&&e.$apply(n.droppable))&&this.classList.add("dragover"),!1}function i(t){return(!n.droppable||n.droppable&&e.$apply(n.droppable))&&this.classList.add("dragover"),!1}function o(e){return this.classList.remove("dragover"),!1}function s(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault(),this.classList.remove("dragover");var r;try{r=JSON.parse(t.dataTransfer.getData("text")+"")}catch(e){}return n.drop&&(!n.droppable||n.droppable&&e.$eval(n.droppable))&&(e.$eval(n.drop,{data:r}),e.$apply()),!1}var a=t[0];a.addEventListener("dragover",r),a.addEventListener("dragenter",i),a.addEventListener("dragleave",o),a.addEventListener("drop",s),e.$on("$destroy",function(){a.removeEventListener("dragover",r),a.removeEventListener("dragenter",i),a.removeEventListener("dragleave",o),a.removeEventListener("drop",s)})}}]),angular.module("neGrid",["neObject","neLocal"]).run(["$templateCache",function(e){e.put("neGrid/pagination.html",'<div ng-if="!paginationDisabled" class="row text-{{fontSize}}"> <div class="col-xs-12 col-sm-9 col-md-10 text-center"> <div class="btn-group btn-group-{{size}}"> <button class="btn btn-default" ng-disabled="grid.prevDisabled" ng-click="grid.setPage(\'first\')"><span class="fa fa-fast-backward"></span></button> <button class="btn btn-default" ng-disabled="grid.prevDisabled" ng-click="grid.setPage(\'prev\')"><span class="fa fa-backward"></span></button> </div> <span> <span ng-if="grid.pagesCount"> {{\'page\'|translate}} </span> <input type="number" class="input-{{size}} width-sm" ng-model="grid.pagination.page" min="1" max="{{grid.pagination.pages||\'\'}}" ne-keypress-enter="grid.setPage(grid.pagination.page)"> <span ng-if="grid.pagesCount"> {{\'of\'|translate}} {{grid.pagesCount}} </span> <span ng-if="grid.pagesCount" class="hidden-xs">({{grid.pagination.count}} {{\'items\'|translate}})</span> </span> <div class="btn-group btn-group-{{size}}"> <button class="btn btn-default" ng-disabled="grid.nextDisabled" ng-click="grid.setPage(\'next\')"><span class="fa fa-forward"></span></button> <button class="btn btn-default" ng-disabled="grid.nextDisabled || !grid.pagesCount" ng-click="grid.setPage(\'last\')"><span class="fa fa-fast-forward"></span></button> </div> </div> <div class="col-sm-3 col-md-2 text-right hidden-xs"> <div class="input-group"> <input class="input-{{size}} width-sm" type="number" ng-model="grid.limit" ne-keypress-enter="grid.setPage(\'first\')" min="1" max="{{grid.maxLimit}}"> <span class="input-group-btn"> <button class="btn btn-default btn-{{size}}" ng-click="grid.setPage(\'first\')"><span class="fa fa-refresh"></span></button> </span> </div> </div></div>')}]).directive("neGridPagination",[function(){return{templateUrl:"neGrid/pagination.html",scope:{grid:"=neGridPagination"},link:function(e,t,n){e.size=n.neGridPaginationSize||"sm",e.fontSize="base","xs"===e.size&&(e.fontSize="sm"),"lg"===e.size&&(e.fontSize="lg")}}}]).directive("neGridUpdateBlur",["$timeout","neObject",function(e,t){return{restrict:"A",require:"?ngModel",link:function(e,n,r,i){function o(e){p=e,p?n.addClass(l):n.removeClass(l)}function s(t){a(),r.afterUpdate&&e.$eval(r.gridAfterUpdate)}function a(){o(!1),g=i.$viewValue}var l,u,d,c,f,h,p,g;if(i){if("ng-dirty"===(l=r.dirtyClass||"is-dirty"))throw new Error('dirtyClass cannot be equal to "ng-dirty", it is angular reserved class name');if(u=(r.neGridUpdateBlur||"").split(","),d=u[0]||"grid",c=u[1]||"item",f=t.deepGet(e,d),h=t.deepGet(e,c),!f)throw new Error('Scope has not grid with name "'+d+'"');if(!h)throw new Error('Scope has not grid item with name "'+c+'"');p=!1,n.on("blur",function(){p&&f.updateItem(h,s)}),n.bind("keydown keypress",function(e){13===e.which&&p&&"INPUT"===n[0].nodeName&&(f.updateItem(h,s),e.preventDefault())}),g="",e.$watch(i.$viewValue,function(){g=i.$viewValue}),i.$viewChangeListeners.push(function(){o(g!==i.$viewValue?!0:!1)})}}}}]).factory("NeGrid",["$timeout","neObject",function(e,t){function n(e){var q,L=[{},n.defaults];for(q=0;q<arguments.length;q++)L.push(arguments[q]);return e=angular.merge.apply(angular,L),this.id=e.id,this.idKey=e.idKey||"id",this.defaultLimit=e.defaultLimit||10,this.limit=e.limit||this.defaultLimit,this.maxLimit=e.maxLimit||100,this.defaultQuery=e.defaultQuery||{},this.defaultSort=e.defaultSort||{},this.interceptLoad=e.interceptLoad||e.beforeLoad||e.loadInterceptor,this.onQuery=e.onQueryChange||e.onQuery||e.onFilter,this.onLoad=e.onLoad,this.onFill=e.onFill||e.onData,this.onSelect=e.onSelect,this.onFocus=e.onFocus,this.onUpdate=e.onUpdate,this.onCreate=e.onCreate,this.onRemove=e.onRemove,this.resource=e.restResource||e.resource,this.getResourceMethod=e.getResourceMethod||e.resourceMethod||("function"==typeof this.resource?this.resource:null)||i,this.autoLoad=e.autoLoad||e.loadOnChange,this.multiSelect=e.multiSelect||e.multiselect||!1,this.silentMode=!1,this.pagination={page:e.page||this.defaultQuery.$page||1},this.page=this.pagination.page,this.pagesCount=1,this.query=t.extend("data",{},e.query||{},{$page:this.page,$limit:this.limit},this.defaultQuery),this.sort=t.extend("data",{},this.defaultSort||{},e.sort||{}),this.items=[],this.disabled=!0,this.doSilent=this.doSilent,this.fillItems=o,this.addItems=s,this.addItem=s,this.appendItems=s,this.appendItem=s,this.prependItems=a,this.prependItem=a,this.setSort=l,this.setSortSilent=r("setSort"),this.setSortBy=u,this.setSortBySilent=r("setSortBy"),this.updateQuery=h,this.updateQuerySilent=r("updateQuery"),this.setQuery=f,this.setQuerySilent=r("setQuery"),this.setFilter=f,this.setFilterSilent=r("setQuery"),this.setPage=c,this.setPageSilent=r("setPage"),this.load=d,this.refresh=d,this.createItem=p,this.updateItem=g,this.refreshItem=m,this.removeItem=y,this.selectItem=$,this.selectAll=k,this.toggleItemSelection=x,this.toggleSelection=w,this.focusItem=v,this.getFocusedItem=b,this.getSelectedItems=S,this.clearSelection=_,this}function r(e){return function(){var t=this;return t.silentMode=!0,t[e].apply(t,arguments),t.silentMode=!1,t}}function i(e,t){if(!this.resource)throw new Error("NeGrid: resource is undefined");return this.resource[e]}function o(e,t){var n=this;return t=t||{},n.items=e,n.pagination=t,n.pagesCount=Math.ceil(t.count/n.limit),t.page<=1?n.prevDisabled=!0:n.prevDisabled=!t.prev,t.spage>=n.pagesCount?n.nextDisabled=!0:n.nextDisabled=!t.next,"function"!=typeof n.onFill||n.silentMode||n.onFill(n.items,n.pagination,n.query),this}function s(e){return e=Array.isArray(e)?e:[e],Array.prototype.push.apply(this.items,e),this}function a(e){return e=Array.isArray(e)?e:[e],Array.prototype.unshift.apply(this.items,e),this}function l(e,t){var n=this;return n.sort=e,n.setPage("first",t)}function u(e,t){if(e){var n={};return n[e]=t||this.sortDir,this.setSort(n)}}function d(e,t){var n=this;return(!n.interceptLoad||n.interceptLoad&&!1!==n.interceptLoad(n.query))&&(n.disabled=!0,n.lastFindReqId=n.getResourceMethod("find")(n.query,function(t,r){n.lastFindReqId&&n.lastFindReqId!==this.requestId||("function"==typeof n.onLoad&&n.onLoad(t,r),n.fillItems(t,r),e&&e(),n.disabled=!1)},t)),n}function c(e,t,n){var r,i;return"function"==typeof arguments[0]&&(t=arguments[0],e=null),r=this,i="number"==typeof e?e:"first"===e?1:"next"===e?r.pagination.page+1:"last"===e?r.pagesCount:"prev"===e?r.pagination.page-1:"refresh"===e||null===e?r.pagination.page||1:1,r.pagesCount&&i>r.pagesCount&&"number"!=typeof e&&(i=r.pagesCount+0),i<=0&&(i=1),r.page=i,r.updateQuery(n),r.autoLoad&&!r.silentMode?r.load(t):(t&&t(),r)}function f(e,n){var r=this;return r.query=t.extend("data",{},r.defaultQuery||{},e||{}),r.setPage(r.query.$page||"first",n,e),r}function h(e){var n,r=this;return e=e||{},r.page=e.$page||r.page,r.limit=e.$limit||r.limit,r.sort=e.$sort||r.sort,r.page&&("number"!=typeof r.page||r.page<=0)&&(r.page=1),!r.limit||r.limit<0?r.limit=r.defaultLimit:r.limit>r.maxLimit&&(r.limit=r.maxLimit),n=t.extend("data",{},e,{$limit:r.limit,$sort:{},$page:r.page}),r.sort&&(n.$sort=r.sort),n.$sort=t.extend("data",{},r.defaultSort||{},n.$sort||{}),0===Object.keys(n.$sort).length&&delete n.$sort,delete r.query.$page,delete r.query.$sort,delete r.query.$limit,r.query=t.extend("data",n,r.query||{}),r.onQuery&&!r.silentMode&&r.onQuery(r.query),r}function p(e,t,n){var r=this;return r.getResourceMethod("create",e)(e,function(n){r.setPage("first",t),"function"==typeof r.onCreate&&r.onCreate(e),r.autoLoad||r.load(t)},n),r}function g(e,n,r){var i=this;return i.getResourceMethod("update",e)(e,function(r){var o=i.items.indexOf(e),s=angular.copy(e);i.items[o]=t.extend("data",i.items[o],r),i.onUpdate&&i.onUpdate(i.items[o],s),n&&n(i.items[o])},r),i}function m(e,n,r){var i=this,o=i.idKey,s={};return s[o]=t.deepGet(e,o),i.getResourceMethod("find",e)(s,function(r,o){var s=i.items.indexOf(e);i.items[s]=t.extend("data",i.items[s],r[0]),n&&n(i.items[s])},r),i}function y(e,t,n){var r=this;return r.getResourceMethod("remove",e)(e,function(n){r.items.splice(r.items.indexOf(e),1),r.onRemove&&r.onRemove(e),t&&t(e)},n),r}function v(e){var t,n=this;if(!0===e.$focused)return n;for(t=0;t<n.items.length;t++)n.items[t].$focused=!1;return e.$focused=!0,n.focusedItem=e,"function"==typeof n.onFocus&&n.onFocus(e),n}function b(){var e,t=this;for(e=0;e<t.items.length;e++)if(!0===t.items[e].$focused)return t.items[e]}function $(e,t){var n,r=this;if(!r.multiSelect)for(n=0;n<r.items.length;n++)delete r.items[n].$selected;return e.$selected="boolean"==typeof t?t:!e.$selected,"function"==typeof r.onSelect&&r.onSelect(e),r}function x(e){return this.selectItem(e)}function k(e){var t,n=this;if(!n.multiSelect)return n;for(t=0;t<n.items.length;t++)n.selectItem(n.items[t],e);return n}function w(){return this.selectAll()}function _(){var e,t=this;for(e=0;e<t.items.length;e++)delete t.items[e].$selected;return t}function S(){var e,t=this,n=[];for(e=0;e<t.items.length;e++)!0===t.items[e].$selected&&n.push(t.items[e]);return n}return n.defaults={},n.define=n.create=function(e){return new n(e)},n}]),angular.module("neLoading",[]).constant("neLoadingDebounce",350).constant("neLoadingEndDelay",300).factory("neLoading",["$timeout","neLoadingDebounce","neLoadingEndDelay",function(e,t,n){function r(e){var t=0,n=e/100;return t=n>=0&&n<.25?(3*Math.random()+3)/100:n>=.25&&n<.65?3*Math.random()/100:n>=.65&&n<.9?2*Math.random()/100:n>=.9&&n<.99?.005:0,e+Math.ceil(100*t)}var i={requestCount:0,isLoading:function(){return i.requestCount>0},statusTimeout:null,status:0,prevStatus:0,lastStart:(new Date).getTime(),statusListeners:[],fireStatusListeners:function(t){for(var n=0;n<i.statusListeners.length;n++)!function(n){e(function(){i.statusListeners[n](void 0!==t?t:i.status)},0,!1)}(n)},setStatus:function(o){if(i.statusTimeout&&e.cancel(i.statusTimeout),!(o<0)){i.prevStatus=i.status+0,i.status=o;var s=(new Date).getTime();0===i.prevStatus&&o>0&&(i.lastStart=s),s-i.lastStart>t&&i.fireStatusListeners(i.status),i.status>0&&i.status<99?i.statusTimeout=e(function(){i.setStatus(r(i.status))},t,!1):i.status>=100&&(i.status=0,i.prevStatus=0,i.statusTimeout=e(function(){i.setStatus(0),i.fireStatusListeners(0)},n,!1))}},reqStarted:function(e){0===i.status&&i.setStatus(1),i.requestCount++,e&&console.log(e,i.requestCount,i.status)},reqEnded:function(e){i.requestCount>0&&i.requestCount--,e&&console.log(e,i.requestCount,i.status),0===i.requestCount&&i.setStatus(100)}};return i}]).factory("neLoadingInterceptor",["$q","$cacheFactory","neLoading",function(e,t,n){function r(e){var n,r;return!!e&&("GET"!==e.method||!1===e.cache?(e.cached=!1,!1):(n=!0===e.cache?t.get("$http"):e.cache,r=void 0!==n&&void 0!==n.get(e.url),void 0!==e.cached&&r!==e.cached?e.cached:(e.cached=r,r)))}return{request:function(e){return e.ignoreLoading||r(e)||n.reqStarted(),e},response:function(e){return e.config.ignoreLoading||r(e.config)||n.reqEnded(),e},responseError:function(t){return t.config.ignoreLoading||r(t.config)||n.reqEnded(),e.reject(t)}}}]).config(["$httpProvider",function(e){e.interceptors.push("neLoadingInterceptor")}]).controller("NeLoadingCtrl",["$scope","neLoading",function(e,t){t.statusListeners.push(function(t){e.status=t,e.loading=t>0,e.$digest()})}]),angular.module("neLocal",[]).provider("neLocal",[function(){var e="default",t={default:{common:{}}},n="/";return this.translate=function(r){var i,o;return void 0===r||null===r?"":(i=r+"",o=t[e]||{},o.common=o.common||{},(o[n]?o[n][i]:null)||o.common[i]||(t.default[n]?t.default[n][i]:null)||t.default.common[i]||i||"")},this.setPath=function(e){n=e},this.language=function(t){return t&&(e=t),e},this.languages=function(e){return e?t[e]:t},this.getLanguageId=function(){return e},this.getLanguagePath=function(){return n},this.set=this.translations=function(e,n,r,i){if(t[e]=t[e]||{},t[e].common=t[e].common||{},4===arguments.length)t[e][n]=t[e][n]||{},t[e][n][r]=i;else if(3===arguments.length&&angular.isObject(r))t[e][n]=t[e][n]||{},angular.extend(t[e][n],r);else if(3===arguments.length)i=arguments[2],r=arguments[1],t[e].common[r]=i;else{if(2!==arguments.length)throw new Error("Wrong arguments");r=arguments[1];var o=angular.isObject(r.common);angular.extend(o?t[e]:t[e].common,r)}},this.$get=function(){return this},this}]).run(["$rootScope","$location","neLocal",function(e,t,n){e.$on("$routeChangeStart",function(e,r,i){n.setPath(t.path())})}]).filter("neTranslate",["neLocal",function(e){return function(t,n,r){return e.translate(t)}}]).filter("translate",["neLocal",function(e){return function(t,n,r){return e.translate(t)}}]),angular.module("neMenu",[]).factory("NeMenu",["$document","$timeout",function(e,t){function n(e,t){var n,r;if("string"!=typeof e)throw new Error("NeMenu: menu ID is required !");return i[e]?i[e]:(n={id:e},r=angular.merge(this,n,t||{}),r.items=[],i[e]=r,r)}function r(n){t(function(){function r(){t(function(){n.selected=!1,e.unbind("click",r)})}e.bind("click",r)},0,!1)}var i={};return n.prototype.set=function(e,t){var n=this;return n[e]=t,n.onChange&&n.onChange(e,t),n},n.prototype.toggle=function(e){var t=this;return t[e]=!t[e],t.onChange&&t.onChange(e,t[e]),t},n.prototype.select=n.prototype.selectItem=function(e,t){var n,i,o=this;for(t&&(e.onSelect||e.children&&e.children.length)&&(t.preventDefault(),e.selected||r(e)),i=0;i<o.items.length;i++)o.items[i].selected&&(n=o.items[i]),o.items[i]===e?o.items[i].selected=!o.items[i].selected:o.items[i].selected=!1;return o.onSelect&&o.onSelect(e,n),e.onSelect&&e.onSelect(e,n),o},n.prototype.get=n.prototype.getItem=function e(t,n){var r,i,o=this,s=(n?n.children:o.items)||[];for(i=0;i<s.length;i++)if(s[i].id===t)return s[i];for(i=0;i<s.length;i++)if(s[i].children&&(r=e(t,s[i])))return r},n.get=function(e){return i[e]},n}]),angular.module("neModals",[]).factory("neModals",["$timeout","$sce",function(e,t){function n(e){e=e||r.defaults;for(var n in e)this[n]=e[n];return this.id=e.id||"modal_"+Object.keys(r.items).length,this.backdrop=!0,!1===e.backdrop&&(this.backdrop=!1),this.backdropOpacity=this.backdropOpacity||r.defaults.backdropOpacity,this.css=this.css||r.defaults.css,this.zIndex=r.defaults.zIndex,this.showAfterCreate=void 0===this.showAfterCreate||this.showAfterCreate,this.removeOnClose=void 0===this.removeOnClose||this.removeOnClose,this.destroyOnClose=void 0===this.destroyOnClose||this.destroyOnClose,this.html=this.html?t.trustAsHtml(this.html):"",this.include=this.include||this.templateUrl||this.bodyTemplateUrl,this.allowResize=void 0===this.allowResize?r.defaults.allowResize:this.allowResize,this.show=this.open=function(){this.visible||(this.visible=!0,0===r.opened&&angular.element(document.getElementsByTagName("body")).addClass("modal-open"),r.opened++,this.zIndex=r.defaults.zIndex+11*r.opened,r.fireChangeListeners())},this.hide=this.close=function(){this.visible&&(this.visible=!1,r.opened--,this.removeOnClose&&this.destroyOnClose&&r.remove(this.id),0===r.opened&&angular.element(document.getElementsByTagName("body")).removeClass("modal-open"),r.fireChangeListeners(),"function"==typeof this.onClose&&this.onClose())},r.items[this.id]=this,this.showAfterCreate?this.show():r.fireChangeListeners(),this}var r={items:{},defaults:{visible:!1,backdrop:!0,backdropOpacity:.4,css:"",removeOnClose:!1,destroyOnClose:!1,showAfterCreate:!0,title:"modal title",allowResize:!0,zIndex:1040,text:"",html:"",include:"",buttons:[{text:"Cancel",disabled:!1,css:"btn-default",click:function(){}},{text:"Ok",disabled:!1,css:"btn-primary",click:function(){}}]},opened:0,changeListeners:[],fireChangeListeners:function(){for(var t=0;t<this.changeListeners.length;t++)!function(t){e(function(){r.changeListeners[t](r.items)},0,!1)}(t)}};return r.create=function(e){return new n(e)},r.get=function(e){return r.items[e]},r.remove=function(e){delete r.items[e]},r}]).controller("NeModalsCtrl",["$scope","neModals",function(e,t){t.changeListeners.push(function(t){e.modals=t,e.$digest()})}]).directive("neModalsContainer",[function(){return{templateUrl:"neModals/container.html"}}]).run(["$templateCache",function(e){e.put("neModals/container.html",'<div ng-controller="NeModalsCtrl"> <div ng-repeat="(id,modal) in modals"> <div class="modal ng-hide" ng-show="modal.visible" style="z-index:{{modal.zIndex}};"> <div class="modal-dialog {{modal.css}}" ng-class="{\'modal-full\':modal.wide,\'modal-lg\':modal.large||modal.lg,\'modal-xs\':modal.small||modal.xs}"> <div class="modal-content"> <div class="modal-header"> <button class="close" ng-click="modal.hide()"><i class="fa fa-times fa-fw fa-lg"></i></button> <button class="close" ng-if="modal.allowResize" ng-click="modal.wide = !modal.wide"> <i style="font-size:15px;margin-right:5px;" class="fa fa-fw" ng-class="{\'fa-expand\':!modal.wide,\'fa-compress\':modal.wide}"></i> </button> <h4 class="modal-title">{{modal.title|translate}}</h4> </div> <div class="modal-body"> {{modal.text|translate}} <div ng-bind-html="modal.html"></div> <div ng-include="modal.include"></div> </div> <div class="modal-footer" ng-show="modal.buttons"> <button ng-repeat="button in modal.buttons" type="button" ng-disabled="button.disabled" class="{{button.css}}" ng-click="button.click()">{{button.text|translate}}</button> </div> </div> </div> </div> <div class="modal-backdrop in" ng-show="modal.visible && modal.backdrop" ng-style="{\'z-index\':modal.zIndex-10,\'opacity\':modal.opacity}"></div> </div></div>')}]),angular.module("neNotifications",["neLoading"]).factory("neNotifications",["$timeout",function(e){function t(e,t,n,r){2===r.length&&"string"!=typeof r[1]&&(r[1],r[0],"")}var n=this;return n.timeout=3e3,n.queue=[],n.changeListeners=[],n.fireListeners=function(){for(var t=0;t<n.changeListeners.length;t++)!function(t){e(function(){n.changeListeners[t](n.queue)},0,!1)}(t)},n.add=n.show=n.create=function(t,r,i,o,s){function a(){n.remove(this.id)}function l(e){e=e||{},delete e.id;var t=n.getIndex(this.id);return t>-1&&(n.queue[t]=angular.merge(this,e)),n.fireListeners(),this}function u(t){var r,i=this;i.timeoutPromise&&e.cancel(i.timeoutPromise),i.fixed||"number"!=typeof t||(r=i.timeout-((new Date).getTime()-i.showTime),r=r<0?0:r,i.showTime=(new Date).getTime(),i.timeout=r+t,i.timeoutPromise=e(function(){n.remove(i.id)},i.timeout,!1))}var d,c,f,h={};return 4===arguments.length&&"string"!=typeof arguments[3]?(s=arguments[3],o=""):3===arguments.length&&"string"!=typeof arguments[2]?(s=arguments[2],i=arguments[1],r=""):2===arguments.length&&"string"!=typeof arguments[2]?(s=arguments[1],i=arguments[0],r="",t="info"):2===arguments.length&&"string"==typeof arguments[2]?(i=arguments[1],r=""):1===arguments.length&&angular.isObject(arguments[0])&&(h=arguments[0],t=h.type,r=h.title,o=h.icon,i=h.text,s=h.timeout),"error"!==t&&"danger"!==t||(t="danger"),d=(new Date).getTime()+Math.floor(100*Math.random()+1),c=angular.merge(h,{id:h.id||d,type:t,title:r,icon:o,text:i,timeout:0,fixed:!1,close:a,hide:a,destroy:a,update:l,postpone:u}),c.include=h.bodyTemplateUrl||h.include,f=n.getIndex(c.id),f>-1?n.queue[f]=c:n.queue.push(c),n.fireListeners(),!1!==s&&0!==s?(c.timeout=parseInt(s,10),c.showTime=(new Date).getTime(),c.timeoutPromise=e(function(){n.remove(c.id)},c.timeout||n.timeout,!1)):c.fixed=!0,c},n.error=n.danger=n.danger=function(e,r,i){return t(e,r,i,arguments),this.show("error",e,r,"fa fa-exclamation-circle fa-2x",void 0!==i?i:2*n.timeout)},n.success=function(e,n,r){return t(e,n,r,arguments),this.show("success",e,n,"fa fa-check-circle fa-2x",r)},n.warning=function(e,n,r){return t(e,n,r,arguments),this.show("warning",e,n,"fa fa-warning fa-2x",r)},n.info=function(e,n,r){return t(e,n,r,arguments),this.show("info",e,n,"fa fa-info-circle fa-2x",r)},n.getIndex=function(e){for(var t=0;t<n.queue.length;t++)if(n.queue[t].id===e)return t},n.get=function(e){return n.queue[n.getIndex(e)]},n.remove=n.hide=function(e){var t=n.getIndex(e);-1!==t&&(n.queue.splice(t,1),n.fireListeners())},n}]).controller("NeNotificationsCtrl",["$scope","neNotifications",function(e,t){t.changeListeners.push(function(t){e.notifications=t,e.$digest()})}]).directive("neNotificationsContainer",[function(){return{templateUrl:"neNotifications/container.html"}}]).run(["$templateCache",function(e){e.put("neNotifications/container.html",'<div class="notification-container" ng-controller="NeNotificationsCtrl"> <div ng-show="true" class="ng-hide"> <div ng-repeat="n in notifications" class="alert alert-{{n.type}}" ng-class="{expanded:n.expanded}" ng-click="n.fixed=true;n.postpone()" ng-mouseenter="n.postpone()" ng-mouseleave="n.postpone(1000)"> <i class="alert-pin fa fa-thumb-tack" ng-if="n.fixed"></i> <i class="alert-expand fa" ng-class="{\'fa-expand\':!n.expanded,\'fa-compress\':n.expanded}" ng-click="n.expanded=!n.expanded;n.fixed=true"></i> <i class="alert-close fa fa-times" ng-click="n.close()"></i> <table style="width:100%;word-wrap:break-word" class="table-fixed"> <tr> <td style="width:40px"> <i class="{{n.icon}}"></i> </td> <td style="padding:0px 5px"> <div class="notification-content" ng-if="!n.include"> <strong ng-if="n.title"><span ne-bind-html="{{n.title|translate}}"></span><br></strong> <span ne-bind-html="{{n.text|translate}}"></span> </div> <div ng-if="n.include" ng-include="n.include"></div> </td> </tr> </table> </div> <div class="alert alert-default" ng-show="loading" ng-controller="NeLoadingCtrl"> <table style="width:100%"> <tr> <td style="width:40px"> <i class="fa fa-fw fa-spinner fa-spin fa-2x"></i> </td> <td style="padding:0px 5px"> <strong>{{::\'Loading...\'|translate}}</strong> </td> </tr> </table> </div> </div></div>')}]),angular.module("neObject",[]).factory("neObject",["$timeout",function(e){function t(e){var t,n,r;if(!e||"[object Object]"!==Object.prototype.toString.call(e)||e.nodeType||e.setInterval)return!1;if(t=hasOwnProperty.call(e,"constructor"),n=hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"),e.constructor&&!t&&!n)return!1;for(r in e);return void 0===r||_.call(e,r)}function n(){var e,n,i,o,s,a,l=this.extendReservedInstances,u=this,d=arguments[0]||{},c=1,f=arguments.length,h=!1;for("boolean"!=typeof d&&"data"!==d||(h=d,d=arguments[1]||{},c=2),"object"!=typeof d&&"function"!=typeof d&&(d={});c<f;c++){if(e=arguments[c],r(e,l))return d=e;if(null!==e)for(n in e)if(i=d[n],o=e[n],r(o,l))d[n]=o;else if(d!==o)if(h&&o&&(t(o)||(s=Array.isArray(o)))){if(s){if(s=!1,"data"===h){d[n]=o.slice(0);continue}a=i&&Array.isArray(i)?i:[]}else a=i&&t(i)?i:{};d[n]=u.extend(h,a,o)}else d[n]=o}return d}function r(e,t){for(var n=0;n<t.length;n++)if(e instanceof t[n])return!0;return!1}function i(e,t,n){var r,o;if(angular.isObject(e)){n=n||"";for(o in e)angular.isObject(e[o])&&i(e[o],t,""===n?o:n+"."+o),r=t(""===n?o:n+"."+o,o,e[o]),void 0===r?delete e[o]:e[o]=r}}function o(e,t,n,r){var i,o=t.split("."),s=e
;if("this"===t)"push"===r?e.push(n):e=n.toString();else for(i=0;i<o.length;i++)i>=o.length-1?"push"===r?s[o[i]].push(n):s[o[i]]=n:s[o[i]]=void 0===s[o[i]]||null===s[o[i]]?{}:s[o[i]],s=s[o[i]];return e}function s(e,t){var n,r,i;if((e||!1===e||0===e)&&"function"!=typeof e){if("this"===t)return e;for(n=t.split("."),r=e,i=0;i<n.length;i++){if(!r[n[i]]&&!1!==r[n[i]]&&0!==r[n[i]])return;r=r[n[i]]}if("function"!=typeof r)return r}}function a(e,t){var n,r;if(e=e||{},t=t||"",n=t.split("."),0!==n.length){if(1===n.length)return void delete e[n[0]];for(r=0;r<n.length-1;r++)if(!(e=e[n[r]]))return;delete e[n[n.length-1]]}}function l(e,t,n){var r,i;2===arguments.length?$(e)?(r=e,n=arguments[1]):(n=arguments[1],t=1):(r={},r[e]=t);for(i in r)"asc"===r[i]&&(r[i]=1),"desc"===r[i]&&(r[i]=-1);return n.sort(function(e,t){for(var n in r){if(s(e,n)>s(t,n))return r[n];if(s(e,n)<s(t,n))return-r[n]}return 0}),n}function u(e,t,n){var r,i=[];for(r in e)"$key"!==r&&"$sortIndex"!==r&&e.hasOwnProperty(r)&&(e.$key=r,t&&(e.$sortIndex=s(e[r],t)),i.push(e[r]));return t?l("$sortIndex",n||"asc",i):i}function d(e,t){var n,r,i;if(!angular.isArray(e)||!t)return{};for(n={},i=0;i<e.length;i++)r=s(e[i],t),n[r]=e[i];return n}function c(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function f(e){return e&&e.window===e}function h(e){return e&&e.$evalAsync&&e.$watch}function p(e){if("$"===e[0]&&"$"===e[1])return!0}function g(e,t,n){if(n=n||p,e===t)return!0;if(null===e||null===t)return!1;if(e!==e&&t!==t)return!0;var r,i,o,s=typeof e,a=typeof t;if(s==a&&"object"==s){if(!angular.isArray(e)){if(angular.isDate(e))return!!angular.isDate(t)&&g(e.getTime(),t.getTime(),n);if(c(e))return!!c(t)&&e.toString()==t.toString();if(h(e)||h(t)||f(e)||f(t)||angular.isArray(t)||angular.isDate(t)||c(t))return!1;o=Object.create(null);for(i in e)if(!n(i)&&!angular.isFunction(e[i])){if(!g(e[i],t[i],n))return!1;o[i]=!0}for(i in t)if(!(i in o)&&!n(i)&&angular.isDefined(t[i])&&!angular.isFunction(t[i]))return!1;return!0}if(!angular.isArray(t))return!1;if((r=e.length)==t.length){for(i=0;i<r;i++)if(!g(e[i],t[i],n))return!1;return!0}}return!1}function m(t,n,r){n=angular.isUndefined(n)?0:n,r=!!angular.isUndefined(r)||r;var i;return function(){var o,s;return i&&e.cancel(i),o=this,s=arguments,i=e(function(){i=null,t.apply(o,s)},n,r)}}function y(e,t){var n,r,i,o;if(void 0===t&&(t=!0),"string"==typeof e&&(r=e.match(t?q:S)))return i=Date.parse(r[0]),isNaN(i)||(e=new Date(i)),e;if("object"!=typeof e)return e;for(o in e)n=e[o],"string"==typeof n&&(r=n.match(t?q:S))?(i=Date.parse(r[0]),isNaN(i)||(e[o]=new Date(i))):"object"==typeof n&&y(n,t);return e}function v(e,t){var n;try{n=JSON.parse(e)}catch(e){}return y(n,t)}function b(e,t){var n,r;if("object"!=typeof e||!t)return e;for(n in e)e.hasOwnProperty(n)&&(r=e[n],0===n.indexOf(t)?delete e[n]:"object"==typeof r&&b(r,t))}function $(e){return"[object Object]"===Object.prototype.toString.call(e)}function x(e){return Array.isArray(e)}function k(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function w(){return k()+k()+"-"+k()+"-"+k()+"-"+k()+"-"+k()+k()+k()}var _=Object.prototype.hasOwnProperty,S=/^(\d{4}|\+\d{6})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})\.(\d{1,})(Z|([\-+])(\d{2}):(\d{2}))?)?)?)?$/,q=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/;return{isObject:$,isArray:x,sortArray:l,extendReservedInstances:[File,FileList,Blob],extend:n,merge:n,setObjValue:o,deepSet:o,getObjValue:s,deepGet:s,deepReplace:i,deepRemove:a,deepEquals:g,deepEqual:g,objectToArray:u,arrayToObject:d,dateStringsToDates:y,fromJson:v,fromJSON:v,removePrefixedProps:b,debounce:m,guid:w}}]),angular.module("neQuery",["neLocal","neObject"]).config(["neLocalProvider",function(e){e.set("default",{$eq:"=",$lt:"<",$lte:"<=",$gt:">",$gte:">=",$regex_exact:"exact match",$regex_contains:"contains",$regex_begins:"begins with",$regex_ends:"ends with",$in:"is in",$ne:"not equal to",$regex_ncontains:"not contains",$regex_nbegins:"not begins with",$regex_nends:"not ends with",$nin:"is not in",$regex:"custom regex",$size:"items count",$exists:"exists",$and:"and",$or:"or",OR:"OR",AND:"AND",choose:"(choose)",qtype_short_number:"0-9",qtype_short_date:"Date",qtype_short_datetime:"Time",qtype_short_boolean:"Y/N",qtype_short_string:"A-Z",qtype_short_array:"[A]",qtype_short_object:"{O}",qtype_number:"Number",qtype_date:"Date",qtype_datetime:"Date & Time",qtype_boolean:"Boolean",qtype_string:"Text",qtype_array:"Array",qtype_object:"Object",qvalue_true:"True",qvalue_false:"False",Search:"Search","Order By":"Order By","choose field":"choose field","type value":"type value","empty value":"empty value"})}]).run(["$templateCache",function(e){e.put("neQuery/query.html",'<div class="visible-inline-block"><div ng-repeat-start="query in query track by $index" class="visible-inline-block" style="position:relative;margin:2px" ng-style="{\'margin-top\':$first ? \'0px\' : \'2px\'}"> <small ng-if="!$first && query.logical===\'OR\' && !query.length">{{query.logical | translate}}<br></small> <div ng-if="!query.length" class="visible-inline-block"> <div class="dropdown visible-inline-block" uib-dropdown keyboard-nav> <button ng-if="query.onlyPredefinedFields" class="btn btn-sm btn-default" ng-disabled="disabled" uib-dropdown-toggle style="width:142px"> <span class="nowrap" ng-if="query.fieldName">{{query.fieldName}}</span><span class="nowrap" ng-if="!query.fieldName">{{::\'choose field\'|translate}}</span> </button> <input ng-if="!query.onlyPredefinedFields" type="text" ng-disabled="disabled" placeholder="{{::\'choose field\'|translate}}" class="input-sm" uib-dropdown-toggle ng-change="query.setFieldByName(query.fieldName);onChange()" ng-model="query.fieldName"/> <ul ng-if="query.fields.filterByName(query.fieldName, query.field.name).length" class="dropdown-menu" style="max-height:250px;overflow:auto"> <li ng-repeat="field in query.fields.filterByName(query.fieldName, query.field.name)" ng-class="{\'active\':(field.name===query.fieldName)}"> <a href="" ng-click="query.setField(field);onChange()">\t\t\t {{field.name}}\t\t\t </a> </li> </ul> </div> <div class="dropdown visible-inline-block" uib-dropdown keyboard-nav> <button ng-disabled="query.field.disableOperator || disabled" class="btn btn-default btn-sm btn-intensive" uib-dropdown-toggle style="width:120px"> <span class="class="nowrap"">{{query.operator | translate}} </span> </button> <ul class="dropdown-menu" style="min-width:210px;overflow:auto"> <li ng-if="!query.field.disableType" class="text-center" style="padding-top:4px"> <div class="btn-group btngroup-xs"> <button class="btn btn-default btn-xs" ng-class="{\'btn-success\':(query.type.name===type)}" style="padding:2px;" uib-tooltip="{{\'qtype_\'+type | translate}}" tooltip-append-to-body="true" ng-repeat="type in query.types" ng-click="query.setType(type);$event.stopPropagation();"> {{\'qtype_short_\'+type | translate}} </button> </div> </li> <li ng-if="!query.field.disableType" class="divider"></li> <li ng-repeat="operator in query.type.operators" ng-if="!query.field.allowedOperatorIndexes || query.field.allowedOperatorIndexes.indexOf($index)>-1" ng-class="{\'active\':(query.operator===operator)}"> <a href="" ng-click="query.setOperator(operator);onChange()">\t\t\t <span>{{operator | translate}}</span>\t\t\t </a> </li> </ul> </div> <div class="visible-inline-block" ne-query-value="query"></div> <div class="btn-group btn-group-xs" ng-if="!disabled"> <button class="btn btn-default" ng-click="query.next(\'AND\');onChange()">{{::\'AND\' | translate}}</button> <button class="btn btn-default" ng-click="query.next(\'OR\');onChange()">{{::\'OR\' | translate}}</button> <button class="btn btn-default" ng-click="query.levelDown();onChange()"><i class="fa fa-fw fa-level-down"></i></button> <button class="btn btn-default" ng-click="close();query.remove();onChange()"><i class="fa fa-fw fa-minus"></i></button> </div> </div> <div ng-if="query.length" class="visible-inline-block" style="position:relative;"> <small>{{ ($first ? \' \' : query.logical) | translate}}<br></small> <div class="btn-group btn-group-xs" style="position:absolute;right:0px;top:1px" ng-if="!disabled"> <button class="btn btn-default" style="border:1px dashed #999;border-right:none;color:#999;border-bottom: 1px solid transparent;" ng-click="query.next(\'AND\')">{{::\'AND\' | translate}}</button> <button class="btn btn-default" style="border:none;border-top:1px dashed #999;color:#999;border-bottom: 1px solid transparent;" ng-click="query.next(\'OR\')">{{::\'OR\' | translate}}</button> <button class="btn btn-default" style="border:1px dashed #999;border-left:none;color:#999;border-bottom: 1px solid transparent;" ng-click="close();query.remove()"><i class="fa fa-minus"></i></button> </div> <div class="query-subquery visible-inline-block" ng-include="\'neQuery/query.html\'" style="border:1px dashed #999;padding:8px;margin:2px 0px;"></div> </div></div><br ng-repeat-end></div>'),e.put("neQuery/date.html",'<input type="text" class="input-sm" placeholder="{{(query.field.isEmptyValue(query.value) ? (query.field.placeholder||\'type value\') : \'empty value\')|translate}}" uib-datepicker-popup is-open="query.value_opened" ng-click="query.value_opened=!query.value_opened" ng-disabled="disabled" ng-model="query.value" ng-change="onChange()">'),e.put("neQuery/datetime.html",'<input type="text" class="input-sm" placeholder="{{(query.field.isEmptyValue(query.value) ? (query.field.placeholder||\'type value\') : \'empty value\')|translate}}" uib-datetimepicker-popup show-seconds="true" is-open="query.value_opened" ng-click="query.value_opened=!query.value_opened" ng-disabled="disabled" ng-model="query.value" ng-change="onChange()">'),e.put("neQuery/number.html",'<input type="number" class="input-sm" placeholder="{{(query.field.isEmptyValue(query.value) ? (query.field.placeholder||\'type value\') : \'empty value\')|translate}}" ng-disabled="disabled" ng-model="query.value" ng-change="onChange()" style="width:142px;">'),e.put("neQuery/list.html",'<select class="input-sm" ng-disabled="disabled" ng-model="query.value" ng-options="(value | translate) for value in query.field.values" ng-change="onChange()" style="width:142px;"></select>'),e.put("neQuery/boolean.html",'<select class="input-sm" ng-disabled="disabled" ng-model="query.value" ng-options="(\'qvalue_\'+value | translate) for value in [true,false]" ng-change="onChange()" style="width:142px;"></select>'),e.put("neQuery/string.html",'<input type="text" class="input-sm" placeholder="{{(query.field.isEmptyValue(query.value) ? (query.field.placeholder||\'type value\') : \'empty value\')|translate}}" ng-disabled="disabled" ng-model="query.value" ng-change="onChange()"/>'),e.put("neQuery/string-suggestions.html",'<div class="dropdown visible-inline-block" uib-dropdown keyboard-nav> <input type="text" class="input-sm" placeholder="{{(query.field.isEmptyValue(query.value) ? (query.field.placeholder||\'type value\') : \'empty value\')|translate}}" uib-dropdown-toggle ng-disabled="disabled" ng-model="query.suggestion" ng-click="(query.field.suggestionMinLength===0 && !query.suggestions) ? query.field.createSuggestions(query, query.suggestion) : null" ng-change="query.page=1;query.field.onlySuggestedValues ? query.value=null : query.value=query.suggestion;query.field.createSuggestions(query, query.suggestion, true);onChange()"> <ul ng-if="query.suggestions.length" class="dropdown-menu" style="max-height:250px;overflow:auto"> <li ng-if="query.field.pagination" class="text-center" style="padding-top:4px"> <button class="btn btn-xs btn-default" ng-disabled="!query.pagination.prev" ng-click="$event.stopPropagation();query.page=(query.page||1)-1;query.field.createSuggestions(query, query.suggestion)"><i class="fa fa-fw fa-backward"></i></button> {{query.page||1}} <button class="btn btn-xs btn-default" ng-disabled="!query.pagination.next" ng-click="$event.stopPropagation();query.page=(query.page||1)+1;query.field.createSuggestions(query, query.suggestion)"><i class="fa fa-fw fa-forward"></i></button> </li> <li ng-if="query.field.pagination" class="divider"></li> <li ng-repeat="value in query.suggestions" ng-class="{\'active\':(value===query.value)}"> <a href="" ng-click="query.value=value.key;query.suggestion=value.name;onChange()">\t\t {{value.name}}\t\t </a> </li> </ul></div>'),e.put("neQuery/disabled.html",'<input type="text" disabled="disabled" class="input-sm" ng-model="query.value">'),e.put("neQuery/sort.html",'<div class="visible-inline-block"><div ng-repeat-start="sort in query.sortBy track by $index" style="display:inline-block;position:relative;margin:2px" ng-style="{\'margin-top\':$first ? \'0px\' : \'2px\'}"> <small>{{::\'Order By\'|translate}}</small> <div class="visible-inline-block"> <div class="dropdown visible-inline-block" uib-dropdown keyboard-nav> <button ng-if="query.onlyPredefinedFields" ng-disabled="disabled" class="btn btn-sm btn-default" uib-dropdown-toggle style="width:142px"> <span class="nowrap" ng-if="sort.fieldName">{{sort.fieldName}}</span><span class="nowrap" ng-if="!sort.fieldName">{{::\'choose field\'|translate}}</span> </button> <input ng-if="!query.onlyPredefinedFields" type="text" ng-disabled="disabled" placeholder="{{::\'choose field\'|translate}}" class="input-sm" uib-dropdown-toggle ng-change="query.setSortByName(sort.fieldName, $index);onChange()" ng-model="sort.fieldName" /> <ul ng-if="query.fields.filterByName(sort.fieldName, sort.name).length" class="dropdown-menu" style="max-height:250px;overflow:auto"> <li ng-repeat="field in query.fields.filterByName(sort.fieldName, sort.name)" ng-class="{\'active\':(field.name===sort.fieldName)}"> <a href="" ng-click="query.setSortField(field,$parent.$index);onChange()"> \t\t\t {{field.name}} \t\t\t</a> </li> </ul> </div> <div class="btn-group btn-group-xs"> <button class="btn btn-default" ng-disabled="disabled" ng-click="query.toggleSortDirection($index);onChange()"> <i class="fa fa-fw" ng-class="{\'fa-sort-amount-asc\':sort.direction===1,\'fa-sort-amount-desc\':sort.direction===-1}"></i> </button> <button class="btn btn-default" ng-disabled="disabled" ng-click="query.addSort($index);onChange()"><i class="fa fa-fw fa-plus"></i></button> <button class="btn btn-default" ng-disabled="disabled" ng-click="query.removeSort($index);onChange()"><i class="fa fa-fw fa-minus"></i></button> </div> </div></div><br ng-repeat-end><button ng-if="!query.sortBy.length" class="btn btn-default btn-sm btn-intensive" ng-disabled="disabled" ng-click="query.addSort();onChange()"><i class="fa fa-fw fa-signal"></i> <span class="hidden-sm">{{::\'Order By\'|translate}}</span></button></div>')}]).directive("neQueryValue",[function(){return{restrict:"A",template:'<div ng-include="query.field.template||query.type.templates[query.operator]||query.type.template||query.templates[query.type.name]||query.templates.disabled"></div>',link:function(e,t,n,r){}}}]).directive("neQuerySearch",[function(){return{restrict:"A",template:'<div class="pull-left" ne-query="query" ne-query-change="onChange()" ne-query-disabled="disabled"></div><div class="pull-left hidden-xs" style="width:20px"> </div><div class="pull-left" ne-query-sort="query" ne-query-sort-change="onChange()" ne-query-sort-disabled="disabled"></div><button ng-disabled="disabled" class="btn btn-primary btn-sm btn-intensive" ng-click="searchClick()" style="margin-left:2px"> <i class="fa fa-fw fa-search"></i> <span class="hidden-sm">{{::\'Search\' | translate}}</span></button>',scope:{query:"=neQuerySearch",searchClick:"&neQuerySearchClick",onQuerySearchChange:"&neQuerySearchChange",querySearchEmpty:"=neQuerySearchEmpty",disabled:"=neQuerySearchDisabled"},link:function(e,t,n,r){var i=!!n.neQuerySearchEmpty;e.onChange=function(){e.query.setDirty(),i&&(e.querySearchEmpty=e.query.isEmpty()),e.onQuerySearchChange&&e.onQuerySearchChange()},i&&(e.querySearchEmpty=e.query.isEmpty())}}}]).directive("neQuery",[function(){return{restrict:"A",templateUrl:"neQuery/query.html",scope:{query:"=neQuery",onQueryChange:"&neQueryChange",queryEmpty:"=neQueryEmpty",disabled:"=neQueryDisabled"},link:function(e,t,n,r){var i=!!n.neQueryEmpty;e.onChange=function(){e.query.setDirty(),i&&(e.queryEmpty=e.query.isQueryEmpty()),e.onQueryChange&&e.onQueryChange()},i&&(e.queryEmpty=e.query.isQueryEmpty())}}}]).directive("neQuerySort",[function(){return{restrict:"A",templateUrl:"neQuery/sort.html",scope:{query:"=neQuerySort",onQuerySortChange:"&neQuerySortChange",querySortEmpty:"=neQuerySortEmpty",disabled:"=neQuerySortDisabled"},link:function(e,t,n,r){var i=!!n.neQuerySortEmpty;e.onChange=function(){e.query.setDirty(),i&&(e.querySortEmpty=e.query.isSortEmpty()),e.onQuerySortChange&&e.onQuerySortChange()},i&&(e.querySortEmpty=e.query.isSortEmpty())}}}]).constant("neQueryConfig",{useRegexBracketsWrap:!1,useStrictDateParser:!0}).factory("NeQuery",["neLocal","neObject","neQueryConfig",function(e,t,n){function r(e){var t,n,r;if(void 0===e)return!1;for(t={"-":!0,"[":!0,"]":!0,"/":!0,"{":!0,"}":!0,"(":!0,")":!0,"*":!0,"+":!0,"?":!0,".":!0,"\\":!0,"^":!0,$:!0,"|":!0},n=!1,r=0;r<e.length;r++)if("\\"===e[r]&&(n=!n),"\\"!==e[r+1]&&t[e[r]]&&!n)return!0;return!1}function i(e){return(e||"").replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function o(e){return(e||"").replace(/\\(?!\\)/g,"")}function s(e){var t,n;if(!e)return{};for(this,t={},t[R]={},n=0;n<e.length;n++)t[R][e[n].key]=e[n].direction;return t}function a(e){var t,n=this,r=[];if(n.sortBy=[],"[object Object]"===Object.prototype.toString.call(e))for(t in e)n.addSort(),n.setSortByName(t,n.sortBy.length-1).direction=e[t];return r}function l(e,t){if(["string","number","boolean"].indexOf(typeof e)>-1)return!0;if(null===t||void 0===t||"function"==typeof t)return!1;if(["string","number","boolean"].indexOf(typeof t)>-1)return!0;for(var n in t)if(void 0!==e[n]&&null!==e[n])return!0;return!1}function u(e,n){var r,i,o,a,d,c,f,h,p,g={};if(g=t.extend(!0,g,e.options),e.length){for(i=[],o=0,a=0;a<e.length;a++)a>0&&"OR"===e[a].logical&&o++,i[o]=i[o]||[],i[o].push(e[a]);if(0===o)for(c=!1,f=i[o],a=0;a<f.length;a++){d=u(f[a],!0);for(h in d)if(void 0!==g[h]&&null!==g[h])if(f[a].field.merge)g=f[a].field.merge(h,d,g);else{if(l(g[h],d[h])){delete g[h],g=z.AND.build(f),c=!0;break}g[h]=t.extend(!0,g[h],d[h])}else g[h]=d[h];if(c)break}else g=t.extend(!0,g,z.OR.build(i))}else e.operator&&e.field&&e.field.key&&(r=angular.copy(e.value),e.type.onBuild&&(r=e.type.onBuild(r)),e.field.isEmptyValue&&e.field.isEmptyValue(r)||void 0!==(r=z[e.operator].build("function"==typeof e.field.onBuild?e.field.onBuild(r):r))&&null!==r&&(e.field.build?(p=e.field.build(e.field.key,r,e),g[p.key||e.field.key]=p.key?p.value:p):g[e.field.key]=r));return n||(g=t.extend(!0,g,s.call(e,e.sortBy))),g}function d(e,t){function n(e,t,n){i=e.append(n),i.type=Q[t.typeName],i.value=t.value,i.setFieldByName(t.fieldName,!0),i.resolveValueNames(),i.operator=t.operator}var r,i,o,s,l,u,c,f,h,p=this,g=[];for(o in e)-1===["AND","OR","VALUE"].indexOf(o)&&(o===R?a.call(p,e[o]):z[o]||o[0]!==K&&-1===T.indexOf(o)?g.push(o):p.options[o]=e[o]);for(s=0;s<g.length;s++){for(o=g[s],l=null,u=0;u<p.fields.length;u++)if((p.fields[u].field===o||p.fields[u].match&&o.match(p.fields[u].match))&&p.fields[u].parse){l=p.fields[u].parse;break}if(c={},l&&(c=l(o,e[o],t),c&&c.key?(o=c.key,e[o]=c.value):c&&(e[o]=c),Array.isArray(e[o])))for(f in e[o])d.call(p,e[o][f].value,e[o][f].logical||t);else if(r=(z[o]||z.VALUE).parse(o,e[o])){if(Array.isArray(r))for(h=0;h<r.length;h++)n(p,r[h],0===s&&0===h?t:"AND");else if(r.queries)for(i=null,h=0;h<r.queries.length;h++)1!==g.length||t?i?i.parse(r.queries[h],r.logical):(i=p.append(t),i.parse(r.queries[h],r.logical)):p.parse(r.queries[h],0===h&&t?t:r.logical);else 0===s?n(p,r,t):n(p,r,"AND");c.key&&delete e[c.key]}else c.key&&delete e[c.key]}return p}function c(e){var t,r,i;return"boolean"==typeof e?t="boolean":"number"==typeof e?t="number":e instanceof Date?t=0===e.getHours()&&0===e.getMinutes()&&0===e.getSeconds()&&0===e.getMilliseconds()?"date":"datetime":"string"==typeof e&&(r=e.match(n.useStrictDateParser?B:F),r&&(i=Date.parse(r[0])),isNaN(i)?t="string":(e=new Date(i),t=0===e.getHours()&&0===e.getMinutes()&&0===e.getSeconds()&&0===e.getMilliseconds()?"date":"datetime")),{type:t,value:e}}function f(e){var n,r=[];return r.options={},r.sortBy=[],r.build=function(e){return u.call(this,this,e)},r.parse=function(e,t){return d.call(this,e,t)},r.fill=function(e){return this.splice(0,this.length),this.parse(e),this.parent&&this.parent()||0!==this.length||this.append("AND"),r.runValueNameResolver&&r.runValueNameResolver(),r.onFill&&r.onFill(),r},r.isEmpty=b,r.isQueryEmpty=$,r.isSortEmpty=x,r.isDirty=w,r.setDirty=k,r.clear=v,r.newQuery=f,r.templates=P,r.fields=this.fields,r.types=this.types,r.onlyPredefinedFields=this.onlyPredefinedFields,r.logical=e||"AND",r.append=h,r.next=g,r.levelDown=p,r.remove=m,r.reset=y,r.setFieldByName=_,r.resolveValueNames=S,r.setField=q,r.setOperator=L,r.setType=C,r.addSort=O,r.removeSort=E,r.toggleSortDirection=N,r.setSortByName=A,r.setSortField=I,r.root=r.getRoot=function(){return n?n.getRoot():r},r.parent=r.getParent=function(){return n},r.setParent=function(e){n=e},n||(r.runValueNameResolver=function(){var e=this,n={},r={};e.fields.forEach(function(e){var t,i={};if(r[e.key]=e,e.valueNames){for(t in e.valueNames)null!==e.valueNames[t]&&void 0!==e.valueNames[t]||(i[t]=null);n[e.key]=i,Object.keys(i).length?e.resolveValueNames&&e.resolveValueNames(i,function(t){t=t||{};for(var n in t)e.valueNames[n]=t[n]}):delete n[e.key]}}),e.resolveAllValueNames&&Object.keys(n).length&&e.resolveAllValueNames(n,r,function(n){e.fields.forEach(function(e){n[e.key]&&t.merge(e.valueNames,n[e.key])})})}),r.reset(),r}function h(e){var t=this.newQuery(e);return t.setParent(this),this.push(t),t}function p(e){var t,n,r=this;if(r.parent()&&!(r.parent().length<=1))return t=r.parent().indexOf(r),n=r.next(r.logical),r.parent().splice(t,1),r.logical="AND",r.setParent(n),n.push(r),n}function g(e){var t,n,r=this;if(r.parent())return t=r.parent().indexOf(r),n=this.newQuery(e),n.setParent(r.parent()),r.parent().splice(t+1,0,n),n}function m(){var e,t=this;if(t.parent()){if(!t.parent().parent()&&1===t.parent().length)return t.reset();if(1===t.parent().length)return t.parent().remove();e=t.parent().indexOf(t),t.parent().splice(e,1),t=null}}function y(){var e=this;if(e.fields.length){if(e.field=e.fields[0],e.type=Q[e.field.type],!e.type)throw new Error('Field type "'+e.field.type+'" not recognized, please choose one from "'+Object.keys(Q).join(", ")+'"');e.fieldName=e.field.name,e.operator=e.type.operators[e.field.operatorIndex||0]}else e.field=e.field||{},e.type=Q[e.type||e.types[0]],e.operator=e.type.operators[0];e.value=null}function v(){return this.splice(0,this.length),this.setDirty(!1),this}function b(e){return e=e||this.build(),this.isQueryEmpty(e)&&this.isSortEmpty(e)}function $(e){e=e||this.build();var t=Object.keys(e).length;return 0===t||1===t&&e.hasOwnProperty("$sort")}function x(e){return e=e||this.build(),0===Object.keys(e.$sort||{}).length}function k(e){return this.$dirty=!0,this.$touched=!0,this}function w(){return this.$dirty}function _(e,t){var n,r;if(t&&delete this.field,e)for(n=e.toLowerCase(),r=0;r<this.fields.length;r++){if(this.fields[r].key===e||this.fields[r].nameLower===n)return this.setField(this.fields[r]);if(this.fields[r].match&&(e.match(this.fields[r].match)||n.match(this.fields[r].match)))return this.field&&this.field.field===this.fields[r].field?void 0:this.setField(this.fields[r],e)}this.fieldName=e,this.field={key:e}}function S(){var e=this,t=e.getRoot(),n=t.fields.filter(function(t){return t.key===(e.field||{}).key})[0];n&&(n.valueNames=n.valueNames||{},Object.defineProperty(e,"suggestion",{get:function(){return n.valueNames[e.value]||e.value},set:function(t){n.valueNames[e.value]=t}}),n.valueNames[e.value]||(e.field.resolveValueName?e.field.resolveValueName(e.value,function(t){if("string"==typeof t)e.suggestion=t,n.valueNames[e.value]=t;else{Array.isArray(t)||(t=[t]);for(var r=0;r<t.length;r++)if(t[r].key===e.value)return e.suggestion=t[r].name,void(n.valueNames[e.value]=t[r].name)}}):n.valueNames[e.value]=null))}function q(e,t){if(this.type.name!==e.type){if(this.type=Q[e.type],!this.type)throw new Error('Field type "'+e.type+'" not recognized, please choose one from "'+Object.keys(Q).join(", ")+'"');this.value=null}var n=this.field;this.field=angular.copy(e||{}),this.fieldName=t||this.field.name,this.operator=this.type.operators[this.field.operatorIndex||0],e.onSet&&e.onSet(this,n)}function L(e){this.type.templates&&this.type.templates[this.operator]!==this.type.templates[e]&&(this.value=null),this.operator=e}function C(e){this.type=Q[e],this.operator=this.type.operators[0],this.value=null}function O(e){var t={};this.fields.length&&(t.fieldName=this.fields[0].name,t.name=this.fields[0].name,t.key=this.fields[0].key,t.direction=1),isNaN(e)?this.sortBy.push(t):this.sortBy.splice(e+1,0,t)}function E(e){this.sortBy.splice(isNaN(e)?this.sortBy.length-1:e,1)}function N(e){e=e||0,this.sortBy[e].direction=1===this.sortBy[e].direction?-1:1}function A(e,t){var n,r;if(t=t||0,e)for(n=e.toLowerCase(),r=0;r<this.fields.length;r++)if(this.fields[r].key===e||this.fields[r].nameLower===n)return this.sortBy[t].fieldName=this.fields[r].name,this.sortBy[t].name=this.fields[r].name,this.sortBy[t].key=this.fields[r].key,this.sortBy[t];return this.sortBy[t].fieldName=e,this.sortBy[t].key=e,this.sortBy[t]}function I(e,t){t=t||0,this.sortBy[t].fieldName=e.name,this.sortBy[t].name=e.name,this.sortBy[t].key=e.key}function j(e,t){var n,r=[],i=this,o=(e||"").toLowerCase();if(!e||e===t)return i;for(n=0;n<i.length;n++)i[n].nameLower&&i[n].nameLower.match(new RegExp(".*"+o+".*"))&&r.push(i[n]);return r}function D(n,r){var i,o,s,a,l,u,d,c={};for(1===arguments.length&&(Array.isArray(arguments[0])?(r=arguments[0],n=null):angular.isObject(arguments[0])&&(c=arguments[0],r=c.fields,n=c.name)),r=r||[],i=0;i<r.length;i++){if(r[i].key=r[i].key||r[i].field||r[i].property,r[i].name=e.translate(r[i].name||r[i].key),r[i].nameLower=(r[i].name||"").toLowerCase(),r[i].behaviour&&(o=null,s={},null,"string"==typeof r[i].behaviour?o=r[i].behaviour:(o=Object.keys(r[i].behaviour)[0],s=r[i].behaviour[o]),a=V[o])){l=a.call(r[i],s);for(u in l)r[i][u]=l[u]}r[i].type&&(r[i].disableType=!0),r[i].type=r[i].type||r[i].defaultType||M,r[i].allowedOperatorIndexes=r[i].allowedOperatorIndexes,r[i].operatorIndex>=0&&(r[i].disableOperator=!0),r[i].operatorIndex=r[i].operatorIndex||r[i].defaultOperatorIndex,r[i].values&&!r[i].template&&(r[i].template=P.list),r[i].emptyValues=r[i].emptyValues||r[i].ignoreValues,r[i].isEmptyValue=r[i].isEmptyValue||function(e){return null===e||void 0===e||!(!this.emptyValues&&!this.type.emptyValues)&&(this.emptyValues||this.type.emptyValues).indexOf(e)>-1},r[i].loadSuggestions=r[i].loadSuggestions||r[i].getSuggestions||r[i].suggestions,r[i].onlySuggestedValues=r[i].onlySuggestedValues,r[i].loadSuggestions&&(r[i].resetOnFieldChange=!0,r[i].onSet=r[i].onSet||function(e,t){t?(e.value=null,e.suggestion="",e.suggestions=[]):e.suggestion=e.suggestion||e.value},r[i].template=r[i].template||P.suggestions,r[i].createSuggestions=function(e){function n(t,n){n=n||"",t.page=t.page||e.page||1,t.limit=t.limit||e.limit||10,n.length>=e.suggestionMinLength&&e.loadSuggestions.call(t,n,function(e,n){t.suggestions=e.map(function(e){return{key:e.key||e,name:e.name||e.key||e}}),t.pagination=n,t.page=n.page||t.page,t.limit=n.limit||t.limit})}e.suggestionMinLength=e.suggestionMinLength>=0?e.suggestionMinLength:e.suggestionMinSearchLength>=0?e.suggestionMinSearchLength:3;var r=t.debounce(n,e.suggestionDebounce>=0?e.suggestionDebounce:350);return function(e,t,i){return i?r(e,t):n(e,t)}}(r[i]))}return r.filterByName=j,d=f.call({fields:r,types:Object.keys(Q)},"AND"),d.name=n,d.onlyPredefinedFields=c.onlyPredefinedFields,d.append("AND"),d}var P={query:"neQuery/query.html",sort:"neQuery/sort.html",disabled:"neQuery/disabled.html",number:"neQuery/number.html",string:"neQuery/string.html",boolean:"neQuery/boolean.html",date:"neQuery/date.html",datetime:"neQuery/datetime.html",list:"neQuery/list.html",suggestions:"neQuery/string-suggestions.html"},R="$sort",T=["$limit","$page","$skip","$sort"],K="$",M="string",Q={string:{name:"string",operators:["$regex_exact","$regex_contains","$regex_begins","$regex_ends","$in","$ne","$regex_ncontains","$regex_nbegins","$regex_nends","$nin","$regex"],template:P.string},number:{name:"number",operators:["$eq","$lt","$lte","$gt","$gte"],template:P.number},boolean:{name:"boolean",operators:["$eq"],template:P.boolean,onBuild:function(e){return-1!==[!0,"true","True",1,"yes","Yes"].indexOf(e)}},date:{name:"date",operators:["$eq","$lt","$lte","$gt","$gte"],template:P.date},datetime:{name:"datetime",operators:["$eq","$lt","$lte","$gt","$gte"],template:P.datetime},object:{name:"object",operators:["$exists"],template:P.boolean},array:{name:"array",operators:["$size"],template:P.string,templates:{$size:P.number}}},F=/^(\d{4}|\+\d{6})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})\.(\d{1,})(Z|([\-+])(\d{2}):(\d{2}))?)?)?)?$/,B=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/,z={AND:{build:function(e){var t,n,r=[];for(n=0;n<(e.length||0);n++)t=u(e[n],!0),Object.keys(t).length&&r.push(t);return r.length?{$and:r}:{}}},OR:{build:function(e){var t,n,r=[];for(n=0;n<(e.length||0);n++)t=u(e[n],!0),Object.keys(t).length&&r.push(t);return r.length?{$or:r}:{}}},VALUE:{parse:function(e,t){var n,r,i=[],o=c(t),s=o.type;if(t=o.value,"[object Object]"===Object.prototype.toString.call(t)){for(r in t)(n=(z[r]||z.VALUE).parse(e,t[r]))&&i.push(n);return i}if(s)return{fieldName:e,typeName:s,operator:"string"===s?"$regex_exact":"$eq",value:t}}},$and:{parse:function(e,t){return Array.isArray(t)?{logical:"AND",queries:t}:null}},$or:{parse:function(e,t){return Array.isArray(t)?{logical:"OR",queries:t}:null}},$eq:{build:function(e){return e},parse:function(e,t){var n=c(t),r=n.type;if(t=n.value,r)return{fieldName:e,typeName:r,operator:"string"===r?"$regex_exact":"$eq",value:t}}},$exists:{build:function(e){return{$exists:e}},parse:function(e,t){if("boolean"==typeof t)return{fieldName:e,typeName:"object",operator:"$exists",value:t}}},$size:{build:function(e){return{$size:e}},parse:function(e,t){if("number"==typeof t)return{fieldName:e,typeName:"array",operator:"$size",value:t}}},$lt:{build:function(e){return{$lt:e}},parse:function(e,t){var n=c(t),r=n.type;if(t=n.value,"number"===r||"date"===r||"datetime"===r)return{fieldName:e,typeName:r,operator:"$lt",value:t}}},$lte:{build:function(e){return{$lte:e}},parse:function(e,t){
var n=c(t),r=n.type;if(t=n.value,"number"===r||"date"===r||"datetime"===r)return{fieldName:e,typeName:r,operator:"$lte",value:t}}},$gt:{build:function(e){return{$gt:e}},parse:function(e,t){var n=c(t),r=n.type;if(t=n.value,"number"===r||"date"===r||"datetime"===r)return{fieldName:e,typeName:r,operator:"$gt",value:t}}},$gte:{build:function(e){return{$gte:e}},parse:function(e,t){var n=c(t),r=n.type;if(t=n.value,"number"===r||"date"===r||"datetime"===r)return{fieldName:e,typeName:r,operator:"$gte",value:t}}},$regex:{build:function(e){return n.useRegexBracketsWrap&&(e="("+e+")"),{$regex:e}},parse:function(e,t){var r,i,o,s;if(n.useRegexBracketsWrap&&"string"==typeof t&&"("===t[0]&&")"===t[t.length-1])t=t.slice(1,t.length-1);else for(s=0;s<Q.string.operators.length;s++)if(i=Q.string.operators[s],z[i]&&z[i].check&&void 0!==(o=z[i].check(t))){r=i,t=o;break}return{fieldName:e,typeName:"string",operator:r||"$regex",value:t}}},$regex_exact:{build:function(e){return e}},$regex_contains:{build:function(e){return e=i(e),{$regex:".*"+e+".*"}},check:function(e){if(e=(e.match(/^\.\*(.*)\.\*$/)||[])[1],!r(e))return void 0===e?void 0:o(e)}},$regex_ncontains:{build:function(e){return e=e=i(e),{$regex:"^((?!"+e+").)*$"}},check:function(e){if(e=(e.match(/^\^\(\(\?\!(.*)\)\.\)\*\$$/)||[])[1],!r(e))return void 0===e?void 0:o(e)}},$regex_begins:{build:function(e){return e=i(e),{$regex:"^"+e+".*"}},check:function(e){if(e=(e.match(/^\^(.*)\.\*$/)||[])[1],!r(e))return void 0===e?void 0:o(e)}},$regex_nbegins:{build:function(e){return e=i(e),{$regex:"^(?!"+e+").*$"}},check:function(e){if(e=(e.match(/^\^\(\?\!(.*)\)\.\*\$$/)||[])[1],!r(e))return void 0===e?void 0:o(e)}},$regex_ends:{build:function(e){return e=i(e),{$regex:".*"+e+"$"}},check:function(e){if(e=(e.match(/^\.\*(.*)\$$/)||[])[1],!r(e))return void 0===e?void 0:o(e)}},$regex_nends:{build:function(e){return e=i(e),{$regex:"^(?!.*"+e+"$)"}},check:function(e){if(e=(e.match(/^\^\(\?\!\.\*(.*)\$\)$/)||[])[1],!r(e))return void 0===e?void 0:o(e)}},$ne:{build:function(e){return{$ne:e}},parse:function(e,t){var n=c(t),r=n.type;if(t=n.value,r)return{fieldName:e,typeName:r,operator:"$ne",value:t}}},$in:{build:function(e){return"string"==typeof e&&(e=e.replace(/,\s+/g,",").replace(/\s+,/g,",").replace(/^,/,"").replace(/,$/,"").split(",")),{$in:e}},parse:function(e,t){if(Array.isArray(t))return{fieldName:e,typeName:"string",operator:"$in",value:t.join(", ")}}},$nin:{build:function(e){return"string"==typeof e&&(e=e.replace(/,\s+/g,",").replace(/\s+,/g,",").replace(/^,/,"").replace(/,$/,"").split(",")),{$nin:e}},parse:function(e,t){if(Array.isArray(t))return{fieldName:e,typeName:"string",operator:"$nin",value:t.join(", ")}}}},V={keyValueArray:function(e){var t=this,n=t.field,r=e.prefix||e.keyPrefix||"",i=e.key||e.idKey,o=e.value||e.valueKey;if(!i||!o)throw new Error('neQuery: Cannot set field behaviour, "idKey" or "valueKey" not defined');return{match:new RegExp(n+".*"),build:function(e,t,s){var a={};return a[i]=s.fieldName.replace(n+".",""),a[o]=t,{key:r+n,value:{$elemMatch:a}}},merge:function(e,t,n){return t[e].$elemMatch&&(n[e].$all?n[e].$all.push(t[e]):n[e]={$all:[n[e],t[e]]}),n},parse:function(e,t,s){var a,l,u;if(t.$elemMatch)return a=e+"."+t.$elemMatch[i],{key:a.replace(r,""),value:t.$elemMatch[o]};if(Array.isArray(t.$all)){for(l=[],u=0;u<t.$all.length;u++)t.$all[u].$elemMatch&&(l[u]={value:{},logical:u>0?"AND":s},l[u].value[n+"."+t.$all[u].$elemMatch[i]]=t.$all[u].$elemMatch[o]);return l}}}}};return D.templates=P,D.fieldBehaviours=V,D}]).factory("neQueryTests",["NeQuery","neObject",function(e,t){return function(){function n(e,n,i){var o=r.fill(n).build();t.deepEqual(i||n,o,function(e){return"$sort"===e})?console.log('Query test "'+e+'" - OK'):console.warn('Query test failed "'+e+'", input query do not match built one',i||n,o)}var r=new e;n("simple range query",{field1:{$gte:1,$lte:2}}),n("simple and[1,2]",{field1:"value1",field2:"value2"}),n("simple and[1,2] with $and operator",{$and:[{field1:"value1"},{field2:"value2"}]},{field1:"value1",field2:"value2"}),n("simple or[1,2] with $or operator",{$or:[{field1:"value1"},{field2:"value2"}]}),n("or[ and[1,2], or[1,2], and[1,2] ]",{$and:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]}),n("or[ or[1,2], and[1,2], or[1,2] ]",{$or:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{$and:[{field1_and1:"value1_and1"},{field2_and1:"value2_and1"}]},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]},{$or:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{field1_and1:"value1_and1",field2_and1:"value2_and1"},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]}),n("and[ or[1,2], and[1,2], or[1,2] ]",{$and:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{$and:[{field1_and1:"value1_and1"},{field2_and1:"value2_and1"}]},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]},{$and:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{field1_and1:"value1_and1",field2_and1:"value2_and1"},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]}),n("and[ or[1,2], or[1,2] ]",{$and:[{$or:[{field1_or1:"value1_or1"},{field2_or1:"value2_or1"}]},{$or:[{field1_or2:"value1_or2"},{field2_or2:"value2_or2"}]}]}),n("or[ and[1,2], and[1,2] ]",{$or:[{$and:[{field1_and1:"value1_and1"},{field2_and1:"value2_and1"}]},{$and:[{field1_and2:"value1_and2"},{field2_and2:"value2_and2"}]}]},{$or:[{field1_and1:"value1_and1",field2_and1:"value2_and1"},{field1_and2:"value1_and2",field2_and2:"value2_and2"}]}),n("or[ or[1,range], and[range,1,2], or[range,range] ]",{$or:[{$or:[{field1_or1:"value1_or1"},{field2_or1:{$gt:1,$lt:100}}]},{$and:[{field1_and1:{$gt:1,$lt:100}},{field1_and1:"value1_and1"},{field2_and1:"value2_and1"},{$or:[{field1_and1_or:{$gte:1,$lte:100}},{field2_and1_or:"value2_and1_or"}]}]},{$or:[{field1_or2:{$gte:1,$lte:100}},{field2_or2:{$gte:1,$lte:100}}]}]},{$or:[{$or:[{field1_or1:"value1_or1"},{field2_or1:{$gt:1,$lt:100}}]},{$and:[{field1_and1:{$gt:1}},{field1_and1:{$lt:100}},{field1_and1:"value1_and1"},{field2_and1:"value2_and1"},{$or:[{field1_and1_or:{$gte:1,$lte:100}},{field2_and1_or:"value2_and1_or"}]}]},{$or:[{field1_or2:{$gte:1,$lte:100}},{field2_or2:{$gte:1,$lte:100}}]}]})}}]),angular.module("neRest",["neObject","neNotifications","neLoading"]).config(["$httpProvider",function(e){e.defaults.headers.common["X-Requested-With"]="XMLHttpRequest"}]).factory("NeResourceTransformators.dateStringsToDates",["neObject",function(e){return e.dateStringsToDates}]).factory("NeResourceTransformators.removePrefixedProps",["neObject",function(e){return e.removePrefixedProps}]).factory("NeRestResource",["$http","$timeout","neObject","neNotifications","neLoading","NeResourceTransformators.dateStringsToDates","NeResourceTransformators.removePrefixedProps",function(e,t,n,r,i,o,s){function a(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function l(e,t,n){var r=new RegExp(a(t),"g");return e.replace(r,n)}function u(e){return e=e.indexOf("?")>-1?e.replace(/([^\/])\?/,"$1/?"):e+"/",e.replace(/([^:])(\/){2,}/g,"$1/")}function d(e){var t,n=(e||"").match(/\{([^\{\}]+)/g)||[];for(t=0;t<n.length;t++)n[t]=n[t].substring(1);return n}function c(e){return void 0===e||null===e?"":JSON.stringify(e).replace(/^"/,"").replace(/"$/,"")}function f(e,t,r,i){var o,s,a,d,f,h=this;for(t=u(t||""),o=e?e+"/"+t:t,s=h.options.commands[i].urlParams,f=0;f<s.length;f++)d=n.deepGet(r,s[f]),a="_command"===s[f]?i:void 0===d?"":d,"string"==typeof a&&(a=encodeURIComponent(a).replace(/\//g,"%2F").replace(/\?/g,"%3F").replace(/#/g,"%23")),o=l(o,"{"+s[f]+"}",c(a));return h.options.commands[i].isFile?u(o).replace(/\/$/,""):u(o)}function h(e,t){var n,r,i=this,o="",s=i.options.commands[t],a=i.options,l=s.queryKey||a.queryKey,u=s.urlParams;if(l)return Object.keys(e).length?"?"+l+"="+JSON.stringify(e):"";for(n in e)if(e.hasOwnProperty(n)&&-1===u.indexOf(n))if(Array.isArray(e[n]))for(r=0;r<e[n].length;r++)o+="&"+n+"="+c(e[n][r]);else void 0!==e[n]&&(o+="&"+n+"="+c(e[n]));return o?"?"+o.substring(1):""}function p(e,t,r,i){var o,s,a=e.commands[t],l=a.dataKey||e.dataKey,u=a.resourceKey||e.resourceKey,d=a.idKey||e.idKey;return i?i=n.deepGet(i,u):r&&(o=n.deepGet(r,l),i=n.deepGet(o,u)),i&&void 0!==(s=n.deepGet(i,d))&&(i.id=s),i}function g(e,t,r){var i,o,s=e.commands[t],a=(s.isList,s.dataKey||e.dataKey),l=s.resourceListKey||e.resourceListKey,u=n.deepGet(r,a);if(l&&(u=n.deepGet(u,l)),i=[],Array.isArray(u))for(o=0;o<u.length;o++)i.push(p(e,t,null,u[o]));return i}function m(e,t,r,i){var o=e.commands[t],s=o.queryPageKey||e.queryPageKey,a={count:n.deepGet(r,o.paginationCountKey||e.paginationCountKey)||0,page:n.deepGet(r,o.paginationPageKey||e.paginationPageKey)||n.deepGet(i,s)||0,pages:n.deepGet(r,o.paginationPagesCountKey||e.paginationPagesCountKey)||0,next:n.deepGet(r,o.paginationHasNextKey||e.paginationHasNextKey),prev:n.deepGet(r,o.paginationHasPrevKey||e.paginationHasPrevKey)};return void 0===a.page||void 0===a.pages||void 0!==a.next&&void 0!==a.prev||(a.next=a.page<a.pages,a.prev=a.page>1),a}function y(e,t,r,i){var o,s,a=e.commands[t],l=a.additionalDataKeys||e.additionalDataKeys;for(s in l)void 0!==(o=n.deepGet(r,s))&&n.deepSet(i,l[s],o);return i}function v(e,t){var n,r=[];for(n=2;n<arguments.length;n++)r.push(arguments[n]);for(n=0;n<t.length;n++)if("function"==typeof t[n]&&!0===t[n].apply(e,r))return}function b(e,t,n,r,i){return function(e){var o,s=e.config,a=n.commands[r],l=S(_(e.data),a.transformResponse),u=e.status,d=e.headers,c=a.isList;c?(o=g(n,r,l)||[],o.pagination=m(n,r,l,t)):o=p(n,r,l),o=y(n,r,l,o),v(s,[a.onData,n.onData],o,(o||{}).pagination,l,u,d,c,r),v(s,i,o,(o||{}).pagination,l,u,d)}}function $(e,t,r,i,o){return function(e){var t=e.config,s=r.commands[i],a=S(_(e.data),s.transformResponse),l=e.status,u=e.headers,d=o.concat([(s.responseErrors||{})[l]||(s.responseErrors||{}).default,r.responseErrors[l]||r.responseErrors.default]),c=s.errorKey||r.errorKey;v(t,d,n.deepGet(a,c),l,u,e.data)}}function x(e,n,r,o,s,a){function l(t,a){var l,u,d,c;if(t=t||{},l=t.getResponseHeader("content-type"),u=t.responseText,d=t.status?parseInt(t.status):0,l&&"application/json"===l.substring(0,16))try{u=JSON.parse(t.responseText)}catch(e){d=0}c={data:u,status:d,headers:t.headers,httpOpts:{}},h("removeEventListener"),k||i.reqEnded(),d>=200&&d<=299?b(r,n,g,e,o)(c):$(r,n,g,e,s)(c)}function u(e){l(e.target,"load")}function d(e){l(e.target,"error")}function c(e){l(e.target,"abort")}function f(e){a&&(e.lengthComputable?v(r,a,Math.ceil(100*e.loaded/e.total)):v(r,a,50))}function h(e){L[e]("load",u,!1),L[e]("error",d,!1),L[e]("abort",c,!1),L.upload[e]("progress",f,!1)}var p,g=this.options,m=r.url,y=r.headers,x=r.data,k=r.ignoreLoading,w=new FormData;for(p in x)x[p]instanceof Blob||x[p]instanceof File?w.append(p,x[p],x[p].name):w.append(p,x[p]);t(function(){h("addEventListener"),k||i.reqStarted(),L.open("POST",m,!0);for(var e in y)"content-type"!==e.toLowerCase()&&"content-length"!==e.toLowerCase()&&L.setRequestHeader(e,y[e]);L.send(w)})}function k(){var e,t,n,r,i=[{},k.defaults];for(e=0;e<arguments.length;e++)i.push(arguments[e]);t=angular.merge.apply(angular,i),t.baseUrl=u(t.baseUrl),n=this,n.options=t;for(r in t.commands)t.commands[r].transformRequest=angular.merge({},t.transformRequest,t.commands[r].transformRequest||{}),t.commands[r].transformResponse=angular.merge({},t.transformResponse,t.commands[r].transformResponse||{}),n[r]=function(e){return function(){var t,r=[e];for(t=0;t<arguments.length;t++)r.push(arguments[t]);return n.command.apply(n,r)}}(r);return n}function w(e,t,n,r,i){return"$page"!==t&&(e=i.deepSet(e,t,e.$page),delete e.$page),"$limit"!==n&&(e=i.deepSet(e,n,e.$limit),delete e.$limit),"$sort"!==r&&(e=i.deepSet(e,r,e.$sort),delete e.$sort),e}function _(e){var t=e;return"[object Object]"===Object.prototype.toString.call(e)&&(t=n.extend(!0,{},e)),Array.isArray(e)&&(t=n.extend(!0,[],e)),t}function S(e,t){t=t||{};for(var n in t)k.dataTransformators[n]&&k.dataTransformators[n](e,t[n]);return e}var q={baseUrl:"/yoururl",urlEndSlash:!1,headers:{"Content-Type":"application/json"},dataKey:"data",resourceListKey:"this",resourceKey:"this",idKey:"id",errorKey:"data",paginationCountKey:"pagination.count",paginationPageKey:"pagination.page",paginationPagesCountKey:"pagination.pages",paginationHasNextKey:"pagination.next",paginationHasPrevKey:"pagination.prev",additionalDataKeys:{},responseErrors:{400:function(e,t,n){var i,o=e;if(angular.isObject(e)){o="";for(i in e)o+=i+": "+e[i]+", "}r.error("Validation Failed",o)},403:function(e,t,n){r.error("Access Denied","Try logout and login again, please")},404:function(e,t,n){r.error("Document or his version not found","Try refresh page, please")},409:function(e,t,n){r.error(e)},default:function(e,t,n){r.error("Connection Failed","Try later, please")}},defaultQuery:{},urlBuilder:f,queryStringBuilder:h,queryKey:null,queryPageKey:"$page",queryLimitKey:"$limit",querySortKey:"$sort",transformRequest:{removePrefixedProps:"$"},transformResponse:{dateStringsToDates:!0},commands:{one:{method:"GET",url:"/{id}"},all:{method:"GET",isList:!0},find:{method:"GET",isList:!0},create:{method:"POST",url:"/{id}"},update:{method:"PUT",url:"/{id}"},remove:{method:"DELETE",url:"/{id}"}}},L=function(){try{return new XMLHttpRequest}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw new Error("This browser does not support XMLHttpRequest.")}();return k.defaults=q,k.define=k.create=function(e){return new k(e)},k.dataTransformators={dateStringsToDates:o,removePrefixedProps:s},k.prototype.command=function(t,r,i,o,s,a){var l,u,c,f,h,p,g,m,y,v,k,q,L,C,O,E,N,A,I,j,D,P,R,T,K,M,Q,F=this;if(!F.options.commands[t])throw new Error('This resource has no command "'+t+'" defined');if("function"==typeof arguments[1]?(a=arguments[3],s=arguments[2],o=arguments[1],r={},i=null):"function"==typeof arguments[2]&&(a=arguments[4],s=arguments[3],o=arguments[2],r=arguments[1],i=null),u=F.options,c=u.commands[t],f=("string"==typeof c.baseUrl?c.baseUrl:u.baseUrl)||"",h=(c.method||"GET").toLowerCase(),p=c.responseType||u.responseType,g="boolean"==typeof c.body?c.body:["options","post","post-multipart","upload","put","delete"].indexOf(h)>-1,m=c.headers||u.headers,y=("string"==typeof c.url?c.url:u.url)||"",v=c.urlBuilder||u.urlBuilder,k=c.urlEndSlash||u.urlEndSlash,q=c.queryStringBuilder||u.queryStringBuilder,L=c.defaultQuery||u.defaultQuery,C=void 0!==c.ignoreLoading?c.ignoreLoading:u.ignoreLoading,O=c.transformRequest,E=c.idKey||u.idKey,N=c.queryPageKey||u.queryPageKey,A=c.queryLimitKey||u.queryLimitKey,I=c.querySortKey||u.querySortKey,u.commands[t].urlParams=c.urlParams||d(y),null===i&&g&&angular.isObject(r)?(i=arguments[1],r=null,l={}):(l={},l=!r||"string"!=typeof r&&"number"!=typeof r?r:n.deepSet(l,E,r),l=angular.merge({},L,l||{})),0===l.$page)throw new Error("NeRestResource: query.$page is equal to zero, must be greater");return l=_(l),i&&(i=_(i)),l=w(l,N,A,I,n),i&&(i=w(i,N,A,I,n)),j=[o,c.onSuccess,u.onSuccess],D=[s,c.onError,u.onError],P=[a,c.onProgress,u.onProgress],R=angular.merge({},i||{},l||{}),T=v.call(F,f,y,R,t),k&&-1===T.indexOf("?")&&(T+="/"),K=q.call(F,l,t),T.indexOf("?")>-1&&0===K.indexOf("?")&&(K="&"+K.substring(1)),M=n.guid(),Q={url:T+K,method:h,data:S(i,O),headers:"function"==typeof m?m(u.headers,i,t,h,T+K):m,ignoreLoading:C,requestId:M,responseType:p},"post-multipart"===h||"upload"===h?x.call(F,t,l,Q,j,D,P):e(Q).then(b(Q,l,u,t,j),$(Q,l,u,t,D)),M},k}]),angular.module("neState",["ngCookies"]).factory("NeStateService",["$timeout","$location","$rootScope","$cookies","neObject",function(e,t,n,r,i){function o(e){return window.btoa(e)}function s(e){return window.atob(e)}function a(e){return e=e||{},angular.merge(this,{},c,e),this.history={},this.changeListeners=[],this}function l(e){return function(t){var n,r;if(!this.history[t])throw new Error('StateService: there is no registered state with id "'+t+'"');return n=this.getCurrentState(t),r=this.history[t].currentStateIndex+e,r<0&&(r=0),r>=this.history[t].length&&(r=this.history[t].length?this.history[t].length-1:0),this.history[t].currentStateIndex=r,n===this.getCurrentState(t)?this:this.fireChange(t,n)}}var u={encrypt:!1,prefix:"q",parser:function(e){var n=this.prefix,r=this.encrypt;e=e||t.search()[n];try{return r&&(e=s(e)),i.fromJson(e||"{}")||{}}catch(e){}return{}},builder:function(e){function t(t,n){return e[t]?Object.keys(e[t]).length?n:void 0:n}var n=(this.prefix,this.encrypt),r=JSON.stringify(e,t);return n&&(r=o(r)),r},autoUpdate:!1,autoFill:!1,sync:!1,_unbinders:{},init:function(e,t){var r=this;(r.autoFill||r.sync)&&(t&&(r._unbinders[t]={routeUpdate:n.$on("$routeUpdate",function(){r.fill(e,t)}),routeChangeSuccess:n.$on("$routeChangeSuccess",function(){r.fill(e,t)})}),r.fill(e,t))},destroy:function(e,t){return this.unbind(e,t)},unbind:function(e,t){var n,r,i=this,o=t?[t]:Object.keys(i._unbinders);for(n=0;n<o.length;n++)r=o[n],i._unbinders[r]&&(i._unbinders[r].routeUpdate(),i._unbinders[r].routeChangeSuccess())},fill:function(n,r){var i=this,o=t.search()[i.prefix],s=i.parser(o)||{};e(function(){if(r)n.change(r,s[r]||{},!0);else for(var e in n.history)n.change(e,s[e]||{},!0)})},update:function(e,n){var r,i=this;(i.autoUpdate||i.sync)&&(r=i.builder(e.getCurrentState()),t.search(i.prefix,r))}},d={prefix:"appState",path:"/",secure:!1,autoUpdate:!1,autoFill:!1,sync:!1,init:function(e,t){},destroy:function(e,t){},unbind:function(e,t){},fill:function(t,n){var i=this,o=r.getObject(i.prefix)||{};e(function(){if(n)t.change(n,o[n]||{},!0);else for(var e in t.history)t.change(e,o[e]||{},!0)})},update:function(e,t){var n=this;(n.autoUpdate||n.sync)&&r.putObject(n.prefix,e.getCurrentState(),{domain:n.domain,expires:n.expires,path:n.path,secure:n.secure})}},c={maxHistoryStates:5,store:u};return a.locationStore=u,a.cookiesStore=d,a.prototype.create=a.prototype.register=function(e,t){var n,r;return t=t||{},n=this,n.history[e]?n.history[e]:(r=[],r.maxHistoryStates=t.maxHistoryStates||n.maxHistoryStates,"location"===t.store&&(t.store=u),"cookies"===t.store&&(t.store=d),r.store=angular.merge({},n.store,t.store||{}),r.changeListeners=[],r.currentStateIndex=-1,n.history[e]=r,n.history[e].store.init(n,e),n.history[e])},a.prototype.changeState=a.prototype.change=function(e,t,n){var r,o,s,a;if(!angular.isObject(t))throw new Error('StateService: cannot change state, value have to be object and is "'+t+'"');return r=this,r.history[e]=r.history[e]||r.register(e),o=r.history[e].currentStateIndex,s=r.history[e].length?r.history[e].length-1-o:0,r.history[e].length>0&&i.deepEquals(r.history[e][o],t)?r:(r.history[e].splice(o+1,s),r.history[e].push(angular.merge({},t)),r.history[e].length>r.history[e].maxHistoryStates?r.history[e].splice(0,1):r.history[e].currentStateIndex++,n||r.history[e].store.update(r,e),a=n,r.fireChange(e,null,a))},a.prototype.updateState=a.prototype.update=function(e,t){var n,r;if(!angular.isObject(t))throw new Error('StateService: cannot change state, value have to be object and is "'+t+'"');return n=this,n.history[e]=n.history[e]||n.register(e),n.history[e].length?(r=n.history[e].currentStateIndex,n.history[e][r]=angular.merge({},t),n):n},a.prototype.fireChange=function(e,t,n){var r,i,o,s;if(!this.history[e])throw new Error('StateService: there is no registered state with id "'+e+'"');for(r=this.history[e].currentStateIndex,i=this.history[e].changeListeners,t=t||this.getPrevState(e)||{},o=this.getCurrentState(e)||{},s=0;s<i.length;s++)i[s](o,t,n,r);for(s=0;s<this.changeListeners.length;s++)this.changeListeners[s](e,o,t,n,r);return this},a.prototype.watch=a.prototype.onChange=function(e,t){var n=this;return 1===arguments.length&&(t=arguments[0],e=null),e?(n.history[e]=n.history[e]||n.register(e),n.history[e].changeListeners.push(t)):n.changeListeners.push(t),n},a.prototype.unWatch=a.prototype.unbindChange=a.prototype.offChange=function(e,t){1===arguments.length&&(t=arguments[0],e=null);var n;if(e){if(!this.history[e])throw new Error('StateService: there is no registered state with id "'+e+'"');n=this.history[e].changeListeners.indexOf(t),n>=0&&this.history[e].changeListeners.splice(n,1)}else(n=this.changeListeners.indexOf(t))>=0&&this.changeListeners.splice(n,1);return this},a.prototype.clear=function(e){return e?(this.history[e].splice(0,this.history[e].length),this.history[e].changeListeners=[],this.history[e].currentStateIndex=-1):(this.history={},this.changeListeners=[]),this},a.prototype.destroy=function(e){if(e)this.history[e].store.unbind(this,e),this.store.unbind(this,e),this.clear(e),delete this.history[e];else{this.history={},this.changeListeners=[],this.store.unbind(this,e);for(var t in this.history)this.history[t].store.unbind(this,t)}return this},a.prototype.getCurrentState=function(e){var t;if(0===arguments.length){t={};for(e in this.history)t[e]=this.history[e][this.history[e].currentStateIndex];return t}if(!this.history[e])throw new Error('StateService: there is no registered state with id "'+e+'"');return this.history[e][this.history[e].currentStateIndex]},a.prototype.getPrevState=function(e){if(!this.history[e])throw new Error('StateService: there is no registered state with id "'+e+'"');var t=this.history[e].currentStateIndex-1;return t<0?{}:this.history[e][t]},a.prototype.getNextState=function(e){if(!this.history[e])throw new Error('StateService: there is no registered state with id "'+e+'"');var t=this.history[e].currentStateIndex+1;return t>=this.history[e].length&&(t=this.history[e].length?this.history[e].length-1:0),this.history[e][t]},a.prototype.getFutureState=function(e,t){var n={};return 2===arguments.length?(n[e]=t,n=angular.merge({},this.getCurrentState(),n)):n=this.getCurrentState(),n},a.prototype.undo=l(-1),a.prototype.redo=l(1),a.prototype.undoAll=function(){for(var e in stateObj)this.undo(e)},a.prototype.redoAll=function(){for(var e in stateObj)this.redo(e)},a}]),angular.module("neTree",["neObject"]).run(["$templateCache",function(e){e.put("neTree/item.html","<div>{{item}}</div>"),e.put("neTree/child.html",'<div ng-include="tree.itemTemplate"></div><ul ng-show="item.$expanded"> <li ng-repeat="item in item.$children" ng-include="\'neTree/child.html\'"></li></ul>'),e.put("neTree/tree.html",'<div class="tree"> <ul> <li ng-repeat="item in tree.items" ng-include="\'neTree/child.html\'"></li> </ul> <div class="tree-backdrop" ng-show="tree.disabled"></div></div>'),e.put("neTree/tree-item-pagination.html",'<div ng-if="item.$expanded" class="tree-item-pagination" ng-class="{\'tree-item-pagination-border\':item.$children.length}"> <div ng-if="item.$pagination && !item.$paginationDisabled" class="btn-group btn-group-xs"> <button class="btn btn-light btn-xs" ng-click="tree.setPage(item, \'prev\')" ng-disabled="item.$prevDisabled"> <i class="fa fa-backward"></i> </button> <button class="btn btn-light btn-xs" ng-click="tree.addPage(item)" ng-disabled="item.$nextDisabled"> {{item.$pagination.page}} <span ng-if="item.$pagination.pagesCount">{{::\'of\'|translate}} {{item.$pagination.pagesCount}}</span> </button> <button class="btn btn-light btn-xs" ng-click="tree.setPage(item, \'next\')" ng-disabled="item.$nextDisabled"> <i class="fa fa-forward"></i> </button> </div></div>')}]).directive("neTreeUpdateBlur",["$timeout",function(e){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){function i(e){d=e,d?t.addClass(s):t.removeClass(s)}function o(){i(!1),c=r.$viewValue}var s,a,l,u,d,c;if(r){if("ng-dirty"===(s=n.dirtyClass||"is-dirty"))throw new Error('dirtyClass cannot be equal to "ng-dirty", it is angular reserved class name');if(a=(n.treeUpdateBlur||"").split(","),l=a[0]||"item",u=a[1]||"tree",!e[u])throw new Error('Scope has not grid with name "'+u+'"');if(!e[l])throw new Error('Scope has not grid item with name "'+l+'"');d=!1,t.on("blur",function(){d&&e[u].updateItem(e[l],o)}),t.bind("keydown keypress",function(n){13===n.which&&d&&"INPUT"===t[0].nodeName&&(e[u].updateItem(e[l],o),n.preventDefault())}),c="",e.$watch(r.$viewValue,function(){c=r.$viewValue}),r.$viewChangeListeners.push(function(){i(c!==r.$viewValue?!0:!1)})}}}}]).directive("neTree",[function(){return{restrict:"EA",templateUrl:"neTree/tree.html",scope:{tree:"=neTree"},replace:!0,link:function(e,t,n){e.tree.itemTemplate=e.tree.itemTemplate||"neTree/item.html"}}}]).directive("neTreeItemPagination",[function(){return{restrict:"EA",templateUrl:"neTree/tree-item-pagination.html",link:function(e,t,n){}}}]).factory("NeTree",["$timeout","neObject",function(e,t){function n(e){var f,p=[{},n.defaults];for(f=0;f<arguments.length;f++)p.push(arguments[f]);return e=angular.merge.apply(angular,p),this.id=e.id,this.idKey=e.idKey||"id",this.childrenKey=e.childrenKey,this.childrenCountKey=e.childrenCountKey,this.childrenReferenceKey=e.childrenReferenceKey,this.parentReferenceKey=e.parentReferenceKey,this.ancestorsReferenceKey=e.ancestorsReferenceKey,this.getChildrenQuery=e.getChildrenQuery||d,this.maintainReferences=e.maintainReferences||c,this.defaultLimit=e.defaultLimit||10,this.$limit=e.limit||this.defaultLimit,this.maxLimit=e.maxLimit||100,this.defaultQuery=e.defaultQuery||{},this.defaultSort=e.defaultSort||{},this.interceptLoad=e.interceptLoad||e.beforeLoad||e.loadInterceptor,this.onQuery=e.onQueryChange||e.onQuery||e.onFilter,this.onFill=e.onFill||e.onData||e.onLoad,this.onSelect=e.onSelect,this.onFocus=e.onFocus,this.onMove=e.onMove,this.onUpdate=e.onUpdate,this.onCreate=e.onCreate,this.resource=e.restResource||e.resource,this.getResourceMethod=e.getResourceMethod||e.resourceMethod||("function"==typeof this.resource?this.resource:null)||i,this.onRemove=e.onRemove,this.autoLoad=e.autoLoad||e.loadOnChange,this.multiSelect=e.multiSelect||e.multiselect||!1,this.silentMode=!1,this.$query=t.extend("data",{},{$page:this.$page,$limit:this.$limit},this.defaultQuery),this.items=[],this.itemTemplate=e.itemTemplate||e.include||"neTree/item.html",this.disabled=!0,this.fillItems=h,this.fill=h,this.addItems=x,this.addItem=x,this.appendItems=x,this.appendItem=x,this.prependItems=k,this.prependItem=k,this.setSort=g,this.setSortSilent=r("setSort"),this.setSortBy=m,this.setSortBySilent=r("setSortBy"),this.updateQuery=w,this.updateQuerySilent=r("updateQuery"),this.setQuery=b,this.setQuerySilent=r("setQuery"),this.setFilter=b,this.setFilterSilent=r("setQuery"),this.setPage=v,this.setPageSilent=r("setPage"),this.addPage=$,this.addPageSilent=r("addPage"),this.appendPage=$,this.appendPageSilent=r("addPage"),this.load=y,this.loadItems=y,this.refresh=y,this.refreshItems=y,this.refreshItem=L,this.createItem=S,this.copyItem=_,this.updateItem=q,this.removeItem=O,this.moveItem=C,this.selectItem=A,this.focusItem=E,this.getFocusedItem=N,this.getSelectedItems=I,this.selectedItems=[],this.focusedItem=null,this.walkItems=o,this.walk=o,this.getParentOf=s,this.getParentsOf=a,this.getAncestorsOf=a,this.getChildrenOf=l,this.getChildrenCountOf=u,this}function r(e){return function(){var t=this;return t.silentMode=!0,t[e].apply(t,arguments),t.silentMode=!1,t}}function i(e,t){if(!this.resource)throw new Error("NeTree: resource is undefined");return this.resource[e]}function o(e,t){1===arguments.length&&(t=arguments[0],e=null);var n=this;if(!e||e===n||!0!==t(e,n.getParentOf(e)))return function e(t,n,r){var i;for(t=t||[],i=0;i<t.length;i++)if(!0===r(t[i],n))return;for(i=0;i<t.length;i++)t[i].$children&&t[i].$children.length>0&&e(t[i].$children,t[i],r)}(e?e.$children||(e===n?n.items:[]):n.items,e,t)}function s(e){var t;return this.walkItems(function(n){return!!(n.$children&&n.$children.indexOf(e)>=0)&&(t=n,!0)}),t}function a(e,t){var n,r=this;return t=t||[],n=r.getParentOf(e),n?(t.unshift(n),r.getAncestorsOf(n,t)):t}function l(e){if(!e)throw new Error("Wrong arguments");return e.$children}function u(e){if(!e)throw new Error("Wrong arguments");return(e.$children||[]).length}function d(e){var n=this,r=n.idKey,i=n.ancestorsReferenceKey,o=n.parentReferenceKey,s=n.childrenReferenceKey,a={};if(i)e?(a.$and=[{},{}],a.$and[0][i]={$size:(t.deepGet(e,i)||[]).length+1},a.$and[1][i]=t.deepGet(e,r)):a[i]={$size:0};else if(o)a[o]=t.deepGet(e,r);else{if(!s)throw new Error('Cannot create query, "ancestorsReferenceKey", or "parentReferenceKey", or "childrenReferenceKey" not set');a[s]=t.deepGet(e,s)}return a}function c(e,n,r){var i,o,s,a,l,u,d,c,f,h,p,g,m;e&&n&&(i=this,o=i.idKey,s=i.ancestorsReferenceKey,a=i.parentReferenceKey,l=i.childrenReferenceKey,u=i.childrenCountKey,d=!1,s&&!r&&(c=[].concat(t.deepGet(e,s)||[]),c.push(t.deepGet(e,o)),t.deepSet(n,s,c)),a&&!r&&(f=t.deepGet(e,o),t.deepSet(n,a,f)),l&&(h=t.deepGet(e,l)||[],p=t.deepGet(n,o),r?(g=h.indexOf(p))>-1&&h.splice(g,1):-1===h.indexOf(p)?h.push(p):d=!0,t.deepSet(e,l,h)),u&&!d&&(m=t.deepGet(e,u)||0,t.deepSet(e,u,m+(r?-1:1))))}function f(e,t,n){var r=this;n=n||{},t[e+"limit"]=t[e+"limit"]||r.defaultLimit,t[e+"pagination"]=n,t[e+"pagesCount"]=Math.ceil(n.count/t[e+"limit"]),void 0!==n.prev?t[e+"prevDisabled"]=!n.prev:n.page<=1&&(t[e+"prevDisabled"]=!0),void 0!==n.next?t[e+"nextDisabled"]=!n.next:n.page>=t[e+"pagesCount"]&&(t[e+"nextDisabled"]=!0),t[e+"paginationDisabled"]=t[e+"prevDisabled"]&&t[e+"nextDisabled"]}function h(e,t,n,r){var i=this;return i.disabled=!1,Array.isArray(arguments[0])&&(n=arguments[1],t=arguments[0],e=null),3===arguments.length&&"string"==typeof arguments[2]&&(r=arguments[2],n=e?e.$pagination:null),t=Array.isArray(t)?t:[t],e?(["push","append"].indexOf(r)>-1?Array.prototype.push.apply(e.$children,t):["unshift","prepend"].indexOf(r)>-1?Array.prototype.unshift.apply(e.$children,t):e.$children=t,f("$",e,n)):(["push","append"].indexOf(r)>-1?Array.prototype.push.apply(i.items,t):["unshift","prepend"].indexOf(r)>-1?Array.prototype.unshift.apply(i.items,t):i.items=t,f("$",i,n)),p(i,e),"function"!=typeof i.onFill||i.silentMode||(e?i.onFill(e,e.$children,e.$pagination,e.$query):i.onFill(i,i.items,i.$pagination,i.$query)),this}function p(e,n){e.walkItems(n,function(n,r){if(e.childrenKey){var i=t.deepGet(n,e.childrenKey);i&&!n.$children&&(n.$children=i)}n.$level=r?r.$level+1:0})}function g(e,t,n){"function"==typeof arguments[1]&&(n=arguments[1],t=arguments[0],e=null);var r=this;return e?e.$sort=t:r.$sort=t,grid.setPage("first",e,n)}function m(e,t,n){if("string"==typeof arguments[0]&&(n=arguments[1],t=arguments[0],e=null),t){var r={};return r[t]=n,this.setSort(e,r)}}function y(e,n,r,i){var o,s,a,l=this;return 2===arguments.length&&"function"==typeof arguments[1]?(r=arguments[1],n=!1):1===arguments.length&&"function"==typeof arguments[0]&&(r=arguments[0],n=!1,e=null),o=e?l.getChildrenOf(e):l.items,s=e?l.getChildrenCountOf(e):l.items.length,!e||!o||o.length<s||n?(!l.interceptLoad||l.interceptLoad&&!1!==l.interceptLoad((e||l).$query,e))&&(a=e?e.$query||{}:l.$query||{},a=t.extend("data",{},{$page:1,$limit:l.$limit||l.defaultLimit},l.defaultQuery,a,l.getChildrenQuery(e)),a.$sort&&(a.$sort=t.extend("data",{},l.defaultSort,a.$sort)),e?e.$query=a:delete a.$limit,l.disabled=!0,l.lastFindReqId=l.getResourceMethod("find",e)(a,function(t,i){l.lastFindReqId&&l.lastFindReqId!==this.requestId||(l.fillItems(e,t,i,n),r&&r(t),l.disabled=!1)},i)):r&&r(l.items),l}function v(e,t,n,r){var i,o;return"function"==typeof arguments[0]?(n=arguments[0],t=null):"function"==typeof arguments[1]&&(n=arguments[1],t=arguments[0],e=null),i=this,e=e||i,e.$pagination=e.$pagination||{},o="number"==typeof t?t:"first"===t?1:"next"===t?e.$pagination.page+1:"last"===t?e.$pagesCount:"prev"===t?e.$pagination.page-1:"refresh"===t||null===t?e.$pagination.page||1:1,e.$pagesCount&&o>e.$pagesCount&&"number"!=typeof t&&(o=e.$pagesCount+0),o<=0&&(o=1),e.$page=o,i.updateQuery(e,r),i.autoLoad&&!i.silentMode?i.load(e,!0,n):(n&&n(),i)}function b(e,n,r){2===arguments.length&&(r=arguments[1],n=arguments[0],e=null),e=e||i;var i=this
;return e.$query=t.extend("data",{},i.defaultQuery||{},n||{}),i.setPage(e,e.$query.$page||"first",r,n),i}function $(e,t,n){"function"==typeof arguments[1]&&(n=arguments[1],"number"==typeof arguments[0]?(limit=arguments[0],e=null):limit=null);var r=this;return t=t||"next",r.setPageSilent(e,t),r.autoLoad&&!r.silentMode?r.load(e,"push",n):(n&&n(),r)}function x(e,t){1===arguments.length&&(t=arguments[0],e=null);var n=this;if(t)return n.fillItems(e,t,"push"),n}function k(e,t){1===arguments.length&&(t=arguments[0],e=null);var n=this;if(t)return n.fillItems(e,t,"unshift"),n}function w(e,n){var r,i;return 1===arguments.length&&(n=arguments[0],e=null),r=this,n=n||{},e=e||r,e.$page=n.$page||e.$page,e.$limit=n.$limit||e.$limit||r.$limit,e.$sort=n.$sort||e.$sort,e.$page&&("number"!=typeof e.$page||e.$page<=0)&&(e.$page=1),!e.$limit||e.$limit<0?e.$limit=r.defaultLimit:e.$limit>r.maxLimit&&(e.$limit=r.maxLimit),i=t.extend("data",{},n,{$limit:e.$limit,$sort:{},$page:e.$page}),e.$sort&&(i.$sort=e.$sort),i.$sort=t.extend("data",{},r.defaultSort||{},e.$sort||{}),0===Object.keys(i.$sort).length&&delete i.$sort,e.$query&&(delete e.$query.$page,delete e.$query.$sort,delete e.$query.$limit),e.$query=t.extend("data",i,e.$query||{}),r.onQuery&&!r.silentMode&&r.onQuery(e.$query,e),r}function _(e,n,r){var i=angular.copy(e);return t.deepRemove(i,this.idKey),this.createItem(this.getParentOf(e),i,n,r)}function S(e,n,r,i,o){var s=this;return"boolean"==typeof arguments[1]?(i=arguments[2],r=arguments[1],n=arguments[0],e=null):3===arguments.length&&"function"==typeof arguments[2]?(i=arguments[2],r=!1):2===arguments.length&&"function"==typeof arguments[1]?(i=arguments[1],n=arguments[0],e=null):1===arguments.length&&(n=arguments[0],e=null),s.maintainReferences(e,n),s.getResourceMethod("create",n,e)(n,function(o){n=t.extend("data",n,o),r&&e&&s.maintainReferences(e,n),r?e&&e.$children?(e.$expanded=!0,s.appendItems(e,o),"function"==typeof i&&i(o),"function"==typeof s.onCreate&&s.onCreate(o)):s.load(e,function(n){e&&(e.$expanded=!0);for(var r=0;r<n.length;r++)if(t.deepGet(n[r],s.idKey)===t.deepGet(o,s.idKey)){"function"==typeof i&&i(n[r]),"function"==typeof s.onCreate&&s.onCreate(n[r]);break}}):("function"==typeof i&&i(n),"function"==typeof s.onCreate&&s.onCreate(n))},o),s}function q(e,n,r){return this.getResourceMethod("update",e)(e,function(r){e=t.extend("data",e,r),n&&n(e)},r),this}function L(e,n,r){var i=this.idKey,o={};return o[i]=t.deepGet(e,i),this.getResourceMethod("find",e)(o,function(t){var r=e.$expanded;e=t,r?y(e,function(){n&&n(e)}):n&&n(e)},r),this}function C(e,t,n,r){}function O(e,t,n){var r=this;r.getResourceMethod("remove",e)(e,function(){r.maintainReferences(r.getParentOf(e),e,!0);var n=r.getParentOf(e);n?n.$children.splice(n.$children.indexOf(e),1):r.items.splice(r.items.indexOf(e),1),"function"==typeof t&&t()},n)}function E(e,t){var n=this,r=!!e.$focused;return n.focusedItem&&n.focusedItem!==e&&(n.focusedItem.$focused=!1),e.$focused=!t||!e.$focused,n.focusedItem=t&&r?null:e,"function"==typeof n.onFocus&&n.onFocus(e),n}function N(){return this.focusedItem}function A(e){var t,n,r=this,i=!r.multiSelect,o=e.$selected;if(i){for(t=0;t<r.selectedItems.length;t++)r.selectedItems[t].$selected&&(r.selectedItems[t].$selected=!1);o?r.selectedItems=[]:(e.$selected=!0,r.selectedItems=[e])}else e.$selected?(e.$selected=!1,(n=r.selectedItems.indexOf(e))>=0&&r.selectedItems.splice(n,1)):(e.$selected=!0,r.selectedItems.push(e));"function"==typeof r.onSelect&&r.onSelect(e,e.$selected)}function I(){return this.selectedItems}return n.defaults={},n}]),function(e,t){"use strict";var n,r,i,o=["ng","oc.lazyLoad"],s={},a=[],l=[],u=[],d=[],c=e.noop,f={},h=[];e.module("oc.lazyLoad",["ng"]).provider("$ocLazyLoad",["$controllerProvider","$provide","$compileProvider","$filterProvider","$injector","$animateProvider",function(n,p,g,m,y,v){function b(t,n,r){var s,a,l,d,p,g;if(n){for(d=[],s=n.length-1;s>=0;s--)if(a=n[s],e.isString(a)||(a=k(a)),a&&-1===h.indexOf(a)&&(!q[a]||-1!==u.indexOf(a))){if(p=-1===o.indexOf(a),l=i(a),p&&(o.push(a),b(t,l.requires,r)),l._runBlocks.length>0)for(f[a]=[];l._runBlocks.length>0;)f[a].push(l._runBlocks.shift());e.isDefined(f[a])&&(p||r.rerun)&&(d=d.concat(f[a])),x(t,l._invokeQueue,a,r.reconfig),x(t,l._configBlocks,a,r.reconfig),c(p?"ocLazyLoad.moduleLoaded":"ocLazyLoad.moduleReloaded",a),n.pop(),h.push(a)}g=t.getInstanceInjector(),e.forEach(d,function(e){g.invoke(e)})}}function $(t,n){function r(t,n){var r,o=!0;return n.length&&(r=i(t),e.forEach(n,function(e){o=o&&i(e)!==r})),o}function i(t){return e.isArray(t)?S(t.toString()):e.isObject(t)?S(_(t)):e.isDefined(t)&&null!==t?S(t.toString()):t}var o,a=t[2][0],l=t[1],u=!1;if(e.isUndefined(s[n])&&(s[n]={}),e.isUndefined(s[n][l])&&(s[n][l]={}),o=function(e,t){s[n][l].hasOwnProperty(e)||(s[n][l][e]=[]),r(t,s[n][l][e])&&(u=!0,s[n][l][e].push(t),c("ocLazyLoad.componentLoaded",[n,l,e]))},e.isString(a))o(a,t[2][1]);else{if(!e.isObject(a))return!1;e.forEach(a,function(t,n){e.isString(t)?o(t,a[1]):o(n,t)})}return u}function x(t,n,r,i){var o,s,l,u,d,c,f,h;if(n)for(o=0,s=n.length;o<s;o++)if(l=n[o],e.isArray(l)){if(null!==t){if(!t.hasOwnProperty(l[0]))throw new Error("unsupported provider "+l[0]);u=t[l[0]]}if(d=$(l,r),"invoke"!==l[1])d&&e.isDefined(u)&&u[l[1]].apply(u,l[2]);else if(c=function(t){var n=a.indexOf(r+"-"+t);(-1===n||i)&&(-1===n&&a.push(r+"-"+t),e.isDefined(u)&&u[l[1]].apply(u,l[2]))},e.isFunction(l[2][0]))c(l[2][0]);else if(e.isArray(l[2][0]))for(f=0,h=l[2][0].length;f<h;f++)e.isFunction(l[2][0][f])&&c(l[2][0][f])}}function k(t){var n=null;return e.isString(t)?n=t:e.isObject(t)&&t.hasOwnProperty("name")&&e.isString(t.name)&&(n=t.name),n}function w(t){if(!e.isString(t))return!1;try{return i(t)}catch(e){if(/No module/.test(e)||e.message.indexOf("$injector:nomod")>-1)return!1}}var _,S,q={},L={$controllerProvider:n,$compileProvider:g,$filterProvider:m,$provide:p,$injector:y,$animateProvider:v},C=!1,O=!1,E=[],N={};E.push=function(e){-1===this.indexOf(e)&&Array.prototype.push.apply(this,arguments)},this.config=function(t){e.isDefined(t.modules)&&(e.isArray(t.modules)?e.forEach(t.modules,function(e){q[e.name]=e}):q[t.modules.name]=t.modules),e.isDefined(t.debug)&&(C=t.debug),e.isDefined(t.events)&&(O=t.events)},this._init=function(n){var r,i,s,a,u;0===l.length&&(r=[n],i=["ng:app","ng-app","x-ng-app","data-ng-app"],s=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/,a=function(e){return e&&r.push(e)},e.forEach(i,function(t){i[t]=!0,a(document.getElementById(t)),t=t.replace(":","\\:"),void 0!==n[0]&&n[0].querySelectorAll&&(e.forEach(n[0].querySelectorAll("."+t),a),e.forEach(n[0].querySelectorAll("."+t+"\\:"),a),e.forEach(n[0].querySelectorAll("["+t+"]"),a))}),e.forEach(r,function(t){var r,o;0===l.length&&(r=" "+n.className+" ",o=s.exec(r),o?l.push((o[2]||"").replace(/\s+/g,",")):e.forEach(t.attributes,function(e){0===l.length&&i[e.name]&&l.push(e.value)}))})),0!==l.length||(t.jasmine||t.mocha)&&e.isDefined(e.mock)||console.error("No module found during bootstrap, unable to init ocLazyLoad. You should always use the ng-app directive or angular.boostrap when you use ocLazyLoad."),u=function t(n){if(-1===o.indexOf(n)){o.push(n);var r=e.module(n);x(null,r._invokeQueue,n),x(null,r._configBlocks,n),e.forEach(r.requires,t)}},e.forEach(l,function(e){u(e)}),l=[],d.pop()},_=function(t){try{return JSON.stringify(t)}catch(r){var n=[];return JSON.stringify(t,function(t,r){if(e.isObject(r)&&null!==r){if(-1!==n.indexOf(r))return;n.push(r)}return r})}},S=function(e){var t,n,r,i=0;if(0==e.length)return i;for(t=0,r=e.length;t<r;t++)n=e.charCodeAt(t),i=(i<<5)-i+n,i|=0;return i},this.$get=["$log","$rootElement","$rootScope","$cacheFactory","$q",function(t,n,a,u,f){function p(e){var n=f.defer();return t.error(e.message),n.reject(e),n.promise}var g,m=u("ocLazyLoad");return C||(t={},t.error=e.noop,t.warn=e.noop,t.info=e.noop),L.getInstanceInjector=function(){return g||(g=n.data("$injector")||e.injector())},c=function(e,n){O&&a.$broadcast(e,n),C&&t.info(e,n)},{_broadcast:c,_$log:t,_getFilesCache:function(){return m},toggleWatch:function(e){e?d.push(!0):d.pop()},getModuleConfig:function(t){if(!e.isString(t))throw new Error("You need to give the name of the module to get");return q[t]?e.copy(q[t]):null},setModuleConfig:function(t){if(!e.isObject(t))throw new Error("You need to give the module config object to set");return q[t.name]=t,t},getModules:function(){return o},isLoaded:function(t){var n,r,i=function(e){var t=o.indexOf(e)>-1;return t||(t=!!w(e)),t};if(e.isString(t)&&(t=[t]),e.isArray(t)){for(n=0,r=t.length;n<r;n++)if(!i(t[n]))return!1;return!0}throw new Error("You need to define the module(s) name(s)")},_getModuleName:k,_getModule:function(e){try{return i(e)}catch(t){throw(/No module/.test(t)||t.message.indexOf("$injector:nomod")>-1)&&(t.message='The module "'+_(e)+'" that you are trying to load does not exist. '+t.message),t}},moduleExists:w,_loadDependencies:function(t,n){var r,i,o,s=[],a=this;if(null===(t=a._getModuleName(t)))return f.when();try{r=a._getModule(t)}catch(e){return p(e)}return i=a.getRequires(r),e.forEach(i,function(r){var i,l;if(e.isString(r)){if(null===(i=a.getModuleConfig(r)))return void E.push(r);r=i,i.name=void 0}if(a.moduleExists(r.name))return o=r.files.filter(function(e){return a.getModuleConfig(r.name).files.indexOf(e)<0}),0!==o.length&&a._$log.warn('Module "',t,'" attempted to redefine configuration for dependency. "',r.name,'"\n Additional Files Loaded:',o),e.isDefined(a.filesLoader)?void s.push(a.filesLoader(r,n).then(function(){return a._loadDependencies(r)})):p(new Error("Error: New dependencies need to be loaded from external files ("+r.files+"), but no loader has been defined."));if(e.isArray(r)?(l=[],e.forEach(r,function(e){var t=a.getModuleConfig(e);null===t?l.push(e):t.files&&(l=l.concat(t.files))}),l.length>0&&(r={files:l})):e.isObject(r)&&r.hasOwnProperty("name")&&r.name&&(a.setModuleConfig(r),E.push(r.name)),e.isDefined(r.files)&&0!==r.files.length){if(!e.isDefined(a.filesLoader))return p(new Error('Error: the module "'+r.name+'" is defined in external files ('+r.files+"), but no loader has been defined."));s.push(a.filesLoader(r,n).then(function(){return a._loadDependencies(r)}))}}),f.all(s)},inject:function(t){var n,r,i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=!(arguments.length<=2||void 0===arguments[2])&&arguments[2],s=this,a=f.defer();if(e.isDefined(t)&&null!==t){if(e.isArray(t))return n=[],e.forEach(t,function(e){n.push(s.inject(e,i,o))}),f.all(n);s._addToLoadList(s._getModuleName(t),!0,o)}if(l.length>0)r=l.slice(),function e(t){E.push(t),N[t]=a.promise,s._loadDependencies(t,i).then(function(){try{h=[],b(L,E,i)}catch(e){return s._$log.error(e.message),void a.reject(e)}l.length>0?e(l.shift()):a.resolve(r)},function(e){a.reject(e)})}(l.shift());else{if(i&&i.name&&N[i.name])return N[i.name];a.resolve()}return a.promise},getRequires:function(t){var n=[];return e.forEach(t.requires,function(e){-1===o.indexOf(e)&&n.push(e)}),n},_invokeQueue:x,_registerInvokeList:$,_register:b,_addToLoadList:r,_unregister:function(t){e.isDefined(t)&&e.isArray(t)&&e.forEach(t,function(e){s[e]=void 0})}}}],this._init(e.element(t.document))}]),n=e.bootstrap,e.bootstrap=function(t,i,o){return e.forEach(i.slice(),function(e){r(e,!0,!0)}),n(t,i,o)},r=function(t,n,r){(d.length>0||n)&&e.isString(t)&&-1===l.indexOf(t)&&(l.push(t),r&&u.push(t))},i=e.module,e.module=function(e,t,n){return r(e,!1,!0),i(e,t,n)},"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="oc.lazyLoad")}(angular,window),function(e){"use strict";e.module("oc.lazyLoad").directive("ocLazyLoad",["$ocLazyLoad","$compile","$animate","$parse","$timeout",function(t,n,r,i,o){return{restrict:"A",terminal:!0,priority:1e3,compile:function(o,s){var a=o[0].innerHTML;return o.html(""),function(o,s,l){var u=i(l.ocLazyLoad);o.$watch(function(){return u(o)||l.ocLazyLoad},function(i){e.isDefined(i)&&t.load(i).then(function(){r.enter(a,s),n(s.contents())(o)})},!0)}}}}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q","$window","$interval",function(t,n,r,i){var o=!1,s=r.document.getElementsByTagName("head")[0]||r.document.getElementsByTagName("body")[0];return t.buildElement=function(a,l,u){var d,c,f,h,p,g,m,y,v,b,$,x=n.defer(),k=t._getFilesCache(),w=function(e){var t=(new Date).getTime();return e.indexOf("?")>=0?"&"===e.substring(0,e.length-1)?e+"_dc="+t:e+"&_dc="+t:e+"?_dc="+t};switch(e.isUndefined(k.get(l))&&k.put(l,x.promise),a){case"css":d=r.document.createElement("link"),d.type="text/css",d.rel="stylesheet",d.href=!1===u.cache?w(l):l;break;case"js":d=r.document.createElement("script"),d.src=!1===u.cache?w(l):l;break;default:k.remove(l),x.reject(new Error('Requested type "'+a+'" is not known. Could not inject "'+l+'"'))}return d.onload=d.onreadystatechange=function(e){d.readyState&&!/^c|loade/.test(d.readyState)||c||(d.onload=d.onreadystatechange=null,c=1,t._broadcast("ocLazyLoad.fileLoaded",l),x.resolve())},d.onerror=function(){k.remove(l),x.reject(new Error("Unable to load "+l))},d.async=u.serie?0:1,f=s.lastChild,u.insertBefore&&(h=e.element(e.isDefined(window.jQuery)?u.insertBefore:document.querySelector(u.insertBefore)))&&h.length>0&&(f=h[0]),f.parentNode.insertBefore(d,f),"css"==a&&(p=r.navigator.userAgent.toLowerCase(),/iP(hone|od|ad)/.test(r.navigator.platform)?(g=r.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),m=parseFloat([parseInt(g[1],10),parseInt(g[2],10),parseInt(g[3]||0,10)].join(".")),o=m<6):p.indexOf("android")>-1?(y=parseFloat(p.slice(p.indexOf("android")+8)),o=y<4.4):p.indexOf("safari")>-1&&(v=p.match(/version\/([\.\d]+)/i),o=v&&v[1]&&parseFloat(v[1])<6),o&&(b=1e3,$=i(function(){try{d.sheet.cssRules,i.cancel($),d.onload()}catch(e){--b<=0&&d.onerror()}},20))),x.promise},t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q",function(t,n){return t.filesLoader=function(r){var i,o,s,a,l,u,d=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],c=[],f=[],h=[],p=[],g=null,m=t._getFilesCache();return t.toggleWatch(!0),e.extend(d,r),i=function(n){var r,i=null;if(e.isObject(n)&&(i=n.type,n=n.path),g=m.get(n),e.isUndefined(g)||!1===d.cache){if(null!==(r=/^(css|less|html|htm|js)?(?=!)/.exec(n))&&(i=r[1],n=n.substr(r[1].length+1,n.length)),!i)if(null!==(r=/[.](css|less|html|htm|js)?((\?|#).*)?$/.exec(n)))i=r[1];else{if(t.jsLoader.hasOwnProperty("ocLazyLoadLoader")||!t.jsLoader.hasOwnProperty("requirejs"))return void t._$log.error("File type could not be determined. "+n);i="js"}"css"!==i&&"less"!==i||-1!==c.indexOf(n)?"html"!==i&&"htm"!==i||-1!==f.indexOf(n)?"js"===i||-1===h.indexOf(n)?h.push(n):t._$log.error("File type is not valid. "+n):f.push(n):c.push(n)}else g&&p.push(g)},d.serie?i(d.files.shift()):e.forEach(d.files,function(e){i(e)}),c.length>0&&(o=n.defer(),t.cssLoader(c,function(n){e.isDefined(n)&&t.cssLoader.hasOwnProperty("ocLazyLoadLoader")?(t._$log.error(n),o.reject(n)):o.resolve()},d),p.push(o.promise)),f.length>0&&(s=n.defer(),t.templatesLoader(f,function(n){e.isDefined(n)&&t.templatesLoader.hasOwnProperty("ocLazyLoadLoader")?(t._$log.error(n),s.reject(n)):s.resolve()},d),p.push(s.promise)),h.length>0&&(a=n.defer(),t.jsLoader(h,function(n){e.isDefined(n)&&(t.jsLoader.hasOwnProperty("ocLazyLoadLoader")||t.jsLoader.hasOwnProperty("requirejs"))?(t._$log.error(n),a.reject(n)):a.resolve()},d),p.push(a.promise)),0===p.length?(l=n.defer(),u="Error: no file to load has been found, if you're trying to load an existing module you should use the 'inject' method instead of 'load'.",t._$log.error(u),l.reject(u),l.promise):d.serie&&d.files.length>0?n.all(p).then(function(){return t.filesLoader(r,d)}):n.all(p).finally(function(e){return t.toggleWatch(!1),e})},t.load=function(r){var i,o,s,a=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],l=this,u=null,d=[],c=n.defer(),f=e.copy(r),h=e.copy(a);return e.isArray(f)?(e.forEach(f,function(e){d.push(l.load(e,h))}),n.all(d).then(function(e){c.resolve(e)},function(e){c.reject(e)}),c.promise):(e.isString(f)?(u=l.getModuleConfig(f))||(u={files:[f]}):e.isObject(f)&&(u=e.isDefined(f.path)&&e.isDefined(f.type)?{files:[f]}:l.setModuleConfig(f)),null===u?(o=l._getModuleName(f),i='Module "'+(o||"unknown")+'" is not configured, cannot load.',t._$log.error(i),c.reject(new Error(i)),c.promise):(e.isDefined(u.template)&&(e.isUndefined(u.files)&&(u.files=[]),e.isString(u.template)?u.files.push(u.template):e.isArray(u.template)&&u.files.concat(u.template)),s=e.extend({},h,u),e.isUndefined(u.files)&&e.isDefined(u.name)&&t.moduleExists(u.name)?t.inject(u.name,s,!0):(t.filesLoader(u,s).then(function(){t.inject(null,s).then(function(e){c.resolve(e)},function(e){c.reject(e)})},function(e){c.reject(e)}),c.promise)))},t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q",function(t,n){return t.cssLoader=function(r,i,o){var s=[];e.forEach(r,function(e){s.push(t.buildElement("css",e,o))}),n.all(s).then(function(){i()},function(e){i(e)})},t.cssLoader.ocLazyLoadLoader=!0,t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$q",function(t,n){return t.jsLoader=function(r,i,o){var s=[];e.forEach(r,function(e){s.push(t.buildElement("js",e,o))}),n.all(s).then(function(){i()},function(e){i(e)})},t.jsLoader.ocLazyLoadLoader=!0,t}])}])}(angular),function(e){"use strict";e.module("oc.lazyLoad").config(["$provide",function(t){t.decorator("$ocLazyLoad",["$delegate","$templateCache","$q","$http",function(t,n,r,i){return t.templatesLoader=function(o,s,a){var l=[],u=t._getFilesCache();return e.forEach(o,function(t){var o=r.defer();l.push(o.promise),i.get(t,a).success(function(r){e.isString(r)&&r.length>0&&e.forEach(e.element(r),function(e){"SCRIPT"===e.nodeName&&"text/ng-template"===e.type&&n.put(e.id,e.innerHTML)}),e.isUndefined(u.get(t))&&u.put(t,!0),o.resolve()}).error(function(e){o.reject(new Error('Unable to load template file "'+t+'": '+e))})}),r.all(l).then(function(){s()},function(e){s(e)})},t.templatesLoader.ocLazyLoadLoader=!0,t}])}])}(angular),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var n,r,i,o;if(null==this)throw new TypeError('"this" is null or not defined');if(r=Object(this),0===(i=r.length>>>0))return-1;if(o=+t||0,Math.abs(o)===1/0&&(o=0),o>=i)return-1;for(n=Math.max(o>=0?o:i-Math.abs(o),0);n<i;){if(n in r&&r[n]===e)return n;n++}return-1});
//# sourceMappingURL=./ne-modules.min.js.map