!function(){"use strict";function i(n){return angular.isUndefined(n)||null===n}var n={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,COMMAND:91,MAP:{91:"COMMAND",8:"BACKSPACE",9:"TAB",13:"ENTER",16:"SHIFT",17:"CTRL",18:"ALT",19:"PAUSEBREAK",20:"CAPSLOCK",27:"ESC",32:"SPACE",33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT",38:"UP",39:"RIGHT",40:"DOWN",43:"+",44:"PRINTSCREEN",45:"INSERT",46:"DELETE",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NUMLOCK",145:"SCROLLLOCK",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},isControl:function(t){var i=t.which;switch(i){case n.COMMAND:case n.SHIFT:case n.CTRL:case n.ALT:return!0}return!!(t.metaKey||t.ctrlKey||t.altKey)},isFunctionKey:function(n){return n=n.which?n.which:n,n>=112&&n<=123},isVerticalMovement:function(t){return~[n.UP,n.DOWN].indexOf(t)},isHorizontalMovement:function(t){return~[n.LEFT,n.RIGHT,n.BACKSPACE,n.DELETE].indexOf(t)},toSeparator:function(t){var i={ENTER:"\n",TAB:"\t",SPACE:" "}[t];return i?i:n[t]?void 0:t}},r,t;void 0===angular.element.prototype.querySelectorAll&&(angular.element.prototype.querySelectorAll=function(n){return angular.element(this[0].querySelectorAll(n))});void 0===angular.element.prototype.closest&&(angular.element.prototype.closest=function(n){for(var t=this[0],i=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t;){if(i.bind(t)(n))return t;t=t.parentElement}return!1});r=0;t=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:!0,sortable:!1,placeholder:"",refreshDelay:1e3,closeOnSelect:!0,skipFocusser:!1,dropdownPosition:"auto",removeSelected:!0,resetSearchInput:!0,generateId:function(){return r++},appendToBody:!1,spinnerEnabled:!1,spinnerClass:"glyphicon glyphicon-refresh ui-select-spin",backspaceReset:!0}).service("uiSelectMinErr",function(){var n=angular.$$minErr("ui.select");return function(){var t=n.apply(this,arguments),i=t.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(i)}}).directive("uisTranscludeAppend",function(){return{link:function(n,t,i,r,u){u(n,function(n){t.append(n)})}}}).filter("highlight",function(){function n(n){return(""+n).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(t,i){return i&&t?(""+t).replace(new RegExp(n(i),"gi"),'<span class="ui-select-highlight">$&<\/span>'):t}}).factory("uisOffset",["$document","$window",function(n,t){return function(i){var r=i[0].getBoundingClientRect();return{width:r.width||i.prop("offsetWidth"),height:r.height||i.prop("offsetHeight"),top:r.top+(t.pageYOffset||n[0].documentElement.scrollTop),left:r.left+(t.pageXOffset||n[0].documentElement.scrollLeft)}}}]);t.factory("$$uisDebounce",["$timeout",function(n){return function(t,i){var r;return function(){var u=this,f=Array.prototype.slice.call(arguments);r&&n.cancel(r);r=n(function(){t.apply(u,f)},i)}}}]);t.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(n,t,i,r,u){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){t.addClass("ui-select-choices");var i=t.parent().attr("theme")||n.theme;return i+"/choices.tpl.html"},compile:function(r,f){var s,l,h,c,e,o,a;if(!f.repeat)throw i("repeat","Expected 'repeat' expression.");if(s=f.groupBy,l=f.groupFilter,s){if(h=r.querySelectorAll(".ui-select-choices-group"),1!==h.length)throw i("rows","Expected 1 .ui-select-choices-group but got '{0}'.",h.length);h.attr("ng-repeat",t.getGroupNgRepeatExpression())}if(c=t.parse(f.repeat),e=r.querySelectorAll(".ui-select-choices-row"),1!==e.length)throw i("rows","Expected 1 .ui-select-choices-row but got '{0}'.",e.length);if(e.attr("ng-repeat",c.repeatExpression(s)).attr("ng-if","$select.open"),o=r.querySelectorAll(".ui-select-choices-row-inner"),1!==o.length)throw i("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",o.length);return o.attr("uis-transclude-append",""),a=u.document.addEventListener?e:o,a.attr("ng-click","$select.select("+c.itemName+",$select.skipFocusser,$event)"),function(t,i,u,f){f.parseRepeatAttr(u.repeat,s,l);f.disableChoiceExpression=u.uiDisableChoice;f.onHighlightCallback=u.onHighlight;f.minimumInputLength=parseInt(u.minimumInputLength)||0;f.dropdownPosition=u.position?u.position.toLowerCase():n.dropdownPosition;t.$watch("$select.search",function(n){n&&!f.open&&f.multiple&&f.activate(!1,!0);f.activeIndex=f.tagging.isActivated?-1:0;!u.minimumInputLength||f.search.length>=u.minimumInputLength?f.refresh(u.refresh):f.items=[]});u.$observe("refreshDelay",function(){var i=t.$eval(u.refreshDelay);f.refreshDelay=void 0!==i?i:n.refreshDelay});t.$watch("$select.open",function(n){n?(r.attr("role","listbox"),f.refresh(u.refresh)):i.removeAttr("role")})}}}}]);t.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function(t,r,u,f,e,o,s,h,c,l,a){function rt(n,t,i){if(n.findIndex)return n.findIndex(t,i);for(var f,u=Object(n),e=u.length>>>0,r=0;r<e;r++)if(f=u[r],t.call(i,f,r,u))return r;return-1}function w(){v.resetSearchInput&&(v.search=k,v.selected&&v.items.length&&!v.multiple&&(v.activeIndex=rt(v.items,function(n){return angular.equals(this,n)},v.selected)))}function ut(n,t){for(var i,u=[],r=0;r<t.length;r++)for(i=0;i<n.length;i++)n[i].name==[t[r]]&&u.push(n[i]);return u}function ft(n,t){var i=y.indexOf(n);t&&i===-1&&y.push(n);!t&&i>-1&&y.splice(i,1)}function b(n){return y.indexOf(n)>-1}function et(n){function i(n,i){var r=t.indexOf(n);i&&r===-1&&t.push(n);!i&&r>-1&&t.splice(r,1)}function r(n){return t.indexOf(n)>-1}if(n){var t=[];v.isLocked=function(n,t){var u=!1,f=v.selected[t];return f&&(n?(u=!!n.$eval(v.lockChoiceExpression),i(f,u)):u=r(f)),u}}}function ot(t){var f=!0,i,u,r;switch(t){case n.DOWN:if(!v.open&&v.multiple)v.activate(!1,!0);else if(v.activeIndex<v.items.length-1)for(i=++v.activeIndex;b(v.items[i])&&i<v.items.length;)v.activeIndex=++i;break;case n.UP:if(u=0===v.search.length&&v.tagging.isActivated?-1:0,!v.open&&v.multiple)v.activate(!1,!0);else if(v.activeIndex>u)for(r=--v.activeIndex;b(v.items[r])&&r>u;)v.activeIndex=--r;break;case n.TAB:v.multiple&&!v.open||v.select(v.items[v.activeIndex],!0);break;case n.ENTER:v.open&&(v.tagging.isActivated||v.activeIndex>=0)?v.select(v.items[v.activeIndex],v.skipFocusser):v.activate(!1,!0);break;case n.ESC:v.close();break;default:f=!1}return f}function it(){var n=r.querySelectorAll(".ui-select-choices-content"),u=n.querySelectorAll(".ui-select-choices-row");if(u.length<1)throw s("choices","Expected multiple .ui-select-choices-row but got '{0}'.",u.length);if(!(v.activeIndex<0)){var t=u[v.activeIndex],i=t.offsetTop+t.clientHeight-n[0].scrollTop,f=n[0].offsetHeight;i>f?n[0].scrollTop+=i-f:i<t.clientHeight&&(v.isGrouped&&0===v.activeIndex?n[0].scrollTop=0:n[0].scrollTop-=t.clientHeight-i)}}var v=this,k="",g,nt,y,p,d,tt;if(v.placeholder=h.placeholder,v.searchEnabled=h.searchEnabled,v.sortable=h.sortable,v.refreshDelay=h.refreshDelay,v.paste=h.paste,v.resetSearchInput=h.resetSearchInput,v.refreshing=!1,v.spinnerEnabled=h.spinnerEnabled,v.spinnerClass=h.spinnerClass,v.removeSelected=h.removeSelected,v.closeOnSelect=!0,v.skipFocusser=!1,v.search=k,v.activeIndex=0,v.items=[],v.open=!1,v.focus=!1,v.disabled=!1,v.selected=void 0,v.dropdownPosition="auto",v.focusser=void 0,v.multiple=void 0,v.disableChoiceExpression=void 0,v.tagging={isActivated:!1,fct:void 0},v.taggingTokens={isActivated:!1,tokens:void 0},v.lockChoiceExpression=void 0,v.clickTriggeredSelect=!1,v.$filter=f,v.$element=r,v.$animate=function(){try{return l.get("$animate")}catch(n){return null}}(),v.searchInput=r.querySelectorAll("input.ui-select-search"),1!==v.searchInput.length)throw s("searchInput","Expected 1 input.ui-select-search but got '{0}'.",v.searchInput.length);v.isEmpty=function(){return i(v.selected)||""===v.selected||v.multiple&&0===v.selected.length};v.activate=function(n,i){var e,o,f;v.disabled||v.open?v.open&&!v.searchEnabled&&v.close():(i||w(),t.$broadcast("uis:activate"),v.open=!0,v.activeIndex=v.activeIndex>=v.items.length?0:v.activeIndex,v.activeIndex===-1&&v.taggingLabel!==!1&&(v.activeIndex=0),e=r.querySelectorAll(".ui-select-choices-content"),o=r.querySelectorAll(".ui-select-search"),v.$animate&&v.$animate.on&&v.$animate.enabled(e[0])?(f=function(t,i){"start"===i&&0===v.items.length?(v.$animate.off("removeClass",o[0],f),u(function(){v.focusSearchInput(n)})):"close"===i&&(v.$animate.off("enter",e[0],f),u(function(){v.focusSearchInput(n)}))},v.items.length>0?v.$animate.on("enter",e[0],f):v.$animate.on("removeClass",o[0],f)):u(function(){v.focusSearchInput(n);!v.tagging.isActivated&&v.items.length>1&&it()}))};v.focusSearchInput=function(n){v.search=n||v.search;v.searchInput[0].focus()};v.findGroupByName=function(n){return v.groups&&v.groups.filter(function(t){return t.name===n})[0]};v.parseRepeatAttr=function(n,i,r){function e(n){var f=t.$eval(i),u;(v.groups=[],angular.forEach(n,function(n){var t=angular.isFunction(f)?f(n):n[f],i=v.findGroupByName(t);i?i.items.push(n):v.groups.push({name:t,items:[n]})}),r)&&(u=t.$eval(r),angular.isFunction(u)?v.groups=u(v.groups):angular.isArray(u)&&(v.groups=ut(v.groups,u)));v.items=[];v.groups.forEach(function(n){v.items=v.items.concat(n.items)})}function h(n){v.items=n||[]}v.setItemsFn=i?e:h;v.parserResult=o.parse(n);v.isGrouped=!!i;v.itemProperty=v.parserResult.itemName;var u=v.parserResult.source,f=function(){var n=u(t);t.$uisSource=Object.keys(n).map(function(t){var i={};return i[v.parserResult.keyName]=t,i.value=n[t],i})};v.parserResult.keyName&&(f(),v.parserResult.source=c("$uisSource"+v.parserResult.filters),t.$watch(u,function(n,t){n!==t&&f()},!0));v.refreshItems=function(n){var i,r;n=n||v.parserResult.source(t);i=v.selected;!v.isEmpty()&&(!angular.isArray(i)||i.length)&&v.multiple&&v.removeSelected?void 0!==n&&null!==n&&(r=n.filter(function(n){return angular.isArray(i)?i.every(function(t){return!angular.equals(n,t)}):!angular.equals(n,i)}),v.setItemsFn(r)):v.setItemsFn(n);"auto"!==v.dropdownPosition&&"up"!==v.dropdownPosition||t.calculateDropdownPos();t.$broadcast("uis:refresh")};t.$watchCollection(v.parserResult.source,function(n){if(void 0===n||null===n)v.items=[];else{if(!angular.isArray(n))throw s("items","Expected an array but got '{0}'.",n);v.refreshItems(n);angular.isDefined(v.ngModel.$modelValue)&&(v.ngModel.$modelValue=null)}})};v.refresh=function(n){void 0!==n&&(g&&u.cancel(g),g=u(function(){if(t.$select.search.length>=t.$select.minimumInputLength){var i=t.$eval(n);i&&angular.isFunction(i.then)&&!v.refreshing&&(v.refreshing=!0,i["finally"](function(){v.refreshing=!1}))}},v.refreshDelay))};v.isActive=function(n){if(!v.open)return!1;var i=v.items.indexOf(n[v.itemProperty]),t=i==v.activeIndex;return!(!t||i<0)&&(t&&!angular.isUndefined(v.onHighlightCallback)&&n.$eval(v.onHighlightCallback),t)};nt=function(n){return v.selected&&angular.isArray(v.selected)&&v.selected.filter(function(t){return angular.equals(t,n)}).length>0};y=[];v.isDisabled=function(n){if(v.open){var i=n[v.itemProperty],r=v.items.indexOf(i),t=!1;if(r>=0&&(angular.isDefined(v.disableChoiceExpression)||v.multiple)){if(i.isTag)return!1;v.multiple&&(t=nt(i));!t&&angular.isDefined(v.disableChoiceExpression)&&(t=!!n.$eval(v.disableChoiceExpression));ft(i,t)}return t}};v.select=function(n,r,u){if(i(n)||!b(n)){if(!v.items&&!v.search&&!v.tagging.isActivated)return;if(!n||!b(n)){if(v.clickTriggeredSelect=!1,u&&("click"===u.type||"touchend"===u.type)&&n&&(v.clickTriggeredSelect=!0),v.tagging.isActivated&&v.clickTriggeredSelect===!1){if(v.taggingLabel===!1)if(v.activeIndex<0){if(void 0===n&&(n=void 0!==v.tagging.fct?v.tagging.fct(v.search):v.search),!n||angular.equals(v.items[0],n))return}else n=v.items[v.activeIndex];else if(0===v.activeIndex){if(void 0===n)return;if(void 0!==v.tagging.fct&&"string"==typeof n){if(n=v.tagging.fct(n),!n)return}else"string"==typeof n&&(n=n.replace(v.taggingLabel,"").trim())}if(nt(n))return void v.close(r)}w();t.$broadcast("uis:select",n);v.closeOnSelect&&v.close(r)}}};v.close=function(n){v.open&&(v.ngModel&&v.ngModel.$setTouched&&v.ngModel.$setTouched(),v.open=!1,w(),t.$broadcast("uis:close",n))};v.setFocus=function(){v.focus||v.focusInput[0].focus()};v.clear=function(n){v.select(null);n.stopPropagation();u(function(){v.focusser[0].focus()},0,!1)};v.toggle=function(n){v.open?(v.close(),n.preventDefault(),n.stopPropagation()):v.activate()};v.isLocked=function(){return!1};t.$watch(function(){return angular.isDefined(v.lockChoiceExpression)&&""!==v.lockChoiceExpression},et);p=null;d=!1;v.sizeSearchInput=function(){var n=v.searchInput[0],f=v.$element[0],i=function(){return f.clientWidth*!!n.offsetParent},r=function(t){if(0===t)return!1;var i=t-n.offsetLeft;return i<50&&(i=t),v.searchInput.css("width",i+"px"),!0};v.searchInput.css("width","10px");u(function(){null!==p||r(i())||(p=t.$watch(function(){d||(d=!0,t.$$postDigest(function(){d=!1;r(i())&&(p(),p=null)}))},angular.noop))})};v.searchInput.on("keydown",function(i){var r=i.which;~[n.ENTER,n.ESC].indexOf(r)&&(i.preventDefault(),i.stopPropagation());t.$apply(function(){var f=!1,t;if((v.items.length>0||v.tagging.isActivated)&&(ot(r)||v.searchEnabled||(i.preventDefault(),i.stopPropagation()),v.taggingTokens.isActivated)){for(t=0;t<v.taggingTokens.tokens.length;t++)v.taggingTokens.tokens[t]===n.MAP[i.keyCode]&&v.search.length>0&&(f=!0);f&&u(function(){v.searchInput.triggerHandler("tagged");var t=v.search.replace(n.MAP[i.keyCode],"").trim();v.tagging.fct&&(t=v.tagging.fct(t));t&&v.select(t,!0)})}});n.isVerticalMovement(r)&&v.items.length>0&&it();r!==n.ENTER&&r!==n.ESC||(i.preventDefault(),i.stopPropagation())});v.searchInput.on("paste",function(t){var i,r,u,f,e;if(i=window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):(t.originalEvent||t).clipboardData.getData("text/plain"),i=v.search+i,i&&i.length>0)if(v.taggingTokens.isActivated){for(r=[],u=0;u<v.taggingTokens.tokens.length;u++)if(f=n.toSeparator(v.taggingTokens.tokens[u])||v.taggingTokens.tokens[u],i.indexOf(f)>-1){r=i.split(f);break}0===r.length&&(r=[i]);e=v.search;angular.forEach(r,function(n){var t=v.tagging.fct?v.tagging.fct(n):n;t&&v.select(t,!0)});v.search=e||k;t.preventDefault();t.stopPropagation()}else v.paste&&(v.paste(i),v.search=k,t.preventDefault(),t.stopPropagation())});v.searchInput.on("tagged",function(){u(function(){w()})});tt=e(function(){v.sizeSearchInput()},50);angular.element(a).bind("resize",tt);t.$on("$destroy",function(){v.searchInput.off("keyup keydown tagged blur paste");angular.element(a).off("resize",tt)});t.$watch("$select.activeIndex",function(n){n&&r.find("input").attr("aria-activedescendant","ui-select-choices-row-"+v.generatedId+"-"+n)});t.$watch("$select.open",function(n){n||r.find("input").removeAttr("aria-activedescendant")})}]);t.directive("uiSelect",["$document","uiSelectConfig","uiSelectMinErr","uisOffset","$compile","$parse","$timeout",function(n,t,i,r,u,f,e){return{restrict:"EA",templateUrl:function(n,i){var r=i.theme||t.theme;return r+(angular.isDefined(i.multiple)?"/select-multiple.tpl.html":"/select.tpl.html")},replace:!0,transclude:!0,require:["uiSelect","^ngModel"],scope:!0,controller:"uiSelectCtrl",controllerAs:"$select",compile:function(u,o){var s=/{(.*)}\s*{(.*)}/.exec(o.ngClass),h;return s&&(h="{"+s[1]+", "+s[2]+"}",o.ngClass=h,u.attr("ng-class",h)),angular.isDefined(o.multiple)?u.append("<ui-select-multiple/>").removeAttr("multiple"):u.append("<ui-select-single/>"),o.inputId&&(u.querySelectorAll("input.ui-select-search")[0].id=o.inputId),function(u,o,s,h,c){function w(n){var i,t,f,r;l.open&&(i=!1,(i=window.jQuery?window.jQuery.contains(o[0],n.target):o[0].contains(n.target),i||l.clickTriggeredSelect)||(l.skipFocusser?t=!0:(f=["input","button","textarea","select"],r=angular.element(n.target).controller("uiSelect"),t=r&&r!==l,t||(t=~f.indexOf(n.target.tagName.toLowerCase()))),l.close(t),u.$digest()),l.clickTriggeredSelect=!1)}function tt(){var t=r(o);v=angular.element('<div class="ui-select-placeholder"><\/div>');v[0].style.width=t.width+"px";v[0].style.height=t.height+"px";o.after(v);k=o[0].style.width;n.find("body").append(o);o[0].style.position="absolute";o[0].style.left=t.left+"px";o[0].style.top=t.top+"px";o[0].style.width=t.width+"px"}function b(){null!==v&&(v.replaceWith(o),v=null,o[0].style.position="",o[0].style.left="",o[0].style.top="",o[0].style.width=k,l.setFocus())}var l=h[0],it=h[1],p;l.generatedId=t.generateId();l.baseTitle=s.title||"Select box";l.focusserTitle=l.baseTitle+" focus";l.focusserId="focusser-"+l.generatedId;l.closeOnSelect=function(){return angular.isDefined(s.closeOnSelect)?f(s.closeOnSelect)():t.closeOnSelect}();u.$watch("skipFocusser",function(){var n=u.$eval(s.skipFocusser);l.skipFocusser=void 0!==n?n:t.skipFocusser});l.onSelectCallback=f(s.onSelect);l.onRemoveCallback=f(s.onRemove);l.ngModel=it;l.choiceGrouped=function(n){return l.isGrouped&&n&&n.name};s.tabindex&&s.$observe("tabindex",function(n){l.focusInput.attr("tabindex",n);o.removeAttr("tabindex")});u.$watch(function(){return u.$eval(s.searchEnabled)},function(n){l.searchEnabled=void 0!==n?n:t.searchEnabled});u.$watch("sortable",function(){var n=u.$eval(s.sortable);l.sortable=void 0!==n?n:t.sortable});s.$observe("backspaceReset",function(){var n=u.$eval(s.backspaceReset);l.backspaceReset=void 0===n||n});s.$observe("limit",function(){l.limit=angular.isDefined(s.limit)?parseInt(s.limit,10):void 0});u.$watch("removeSelected",function(){var n=u.$eval(s.removeSelected);l.removeSelected=void 0!==n?n:t.removeSelected});s.$observe("disabled",function(){l.disabled=void 0!==s.disabled&&s.disabled});s.$observe("resetSearchInput",function(){var n=u.$eval(s.resetSearchInput);l.resetSearchInput=void 0===n||n});s.$observe("paste",function(){l.paste=u.$eval(s.paste)});s.$observe("tagging",function(){if(void 0!==s.tagging){var n=u.$eval(s.tagging);l.tagging={isActivated:!0,fct:n!==!0?n:void 0}}else l.tagging={isActivated:!1,fct:void 0}});s.$observe("taggingLabel",function(){void 0!==s.tagging&&(l.taggingLabel="false"===s.taggingLabel?!1:void 0!==s.taggingLabel?s.taggingLabel:"(new)")});s.$observe("taggingTokens",function(){if(void 0!==s.tagging){var n=void 0!==s.taggingTokens?s.taggingTokens.split("|"):[",","ENTER"];l.taggingTokens={isActivated:!0,tokens:n}}});s.$observe("spinnerEnabled",function(){var n=u.$eval(s.spinnerEnabled);l.spinnerEnabled=void 0!==n?n:t.spinnerEnabled});s.$observe("spinnerClass",function(){var n=s.spinnerClass;l.spinnerClass=void 0!==n?s.spinnerClass:t.spinnerClass});angular.isDefined(s.autofocus)&&e(function(){l.setFocus()});angular.isDefined(s.focusOn)&&u.$on(s.focusOn,function(){e(function(){l.setFocus()})});n.on("click",w);u.$on("$destroy",function(){n.off("click",w)});c(u,function(n){var f=angular.element("<div>").append(n),r=f.querySelectorAll(".ui-select-match"),t,u;if(r.removeAttr("ui-select-match"),r.removeAttr("data-ui-select-match"),1!==r.length)throw i("transcluded","Expected 1 .ui-select-match but got '{0}'.",r.length);if(o.querySelectorAll(".ui-select-match").replaceWith(r),t=f.querySelectorAll(".ui-select-choices"),t.removeAttr("ui-select-choices"),t.removeAttr("data-ui-select-choices"),1!==t.length)throw i("transcluded","Expected 1 .ui-select-choices but got '{0}'.",t.length);o.querySelectorAll(".ui-select-choices").replaceWith(t);u=f.querySelectorAll(".ui-select-no-choice");u.removeAttr("ui-select-no-choice");u.removeAttr("data-ui-select-no-choice");1==u.length&&o.querySelectorAll(".ui-select-no-choice").replaceWith(u)});p=u.$eval(s.appendToBody);(void 0!==p?p:t.appendToBody)&&(u.$watch("$select.open",function(n){n?tt():b()}),u.$on("$destroy",function(){b()}));var v=null,k="",a=null,y="direction-up";u.$watch("$select.open",function(){"auto"!==l.dropdownPosition&&"up"!==l.dropdownPosition||u.calculateDropdownPos()});var d=function(n,t){n=n||r(o);t=t||r(a);a[0].style.position="absolute";a[0].style.top=t.height*-1+"px";o.addClass(y)},rt=function(n,t){o.removeClass(y);n=n||r(o);t=t||r(a);a[0].style.position="";a[0].style.top=""},g=function(){e(function(){if("up"===l.dropdownPosition)d();else{o.removeClass(y);var t=r(o),i=r(a),u=n[0].documentElement.scrollTop||n[0].body.scrollTop;t.top+t.height+i.height>u+n[0].documentElement.clientHeight?d(t,i):rt(t,i)}a[0].style.opacity=1})},nt=!1;u.calculateDropdownPos=function(){if(l.open){if(a=angular.element(o).querySelectorAll(".ui-select-dropdown"),0===a.length)return;if(""!==l.search||nt||(a[0].style.opacity=0,nt=!0),!r(a).height&&l.$animate&&l.$animate.on&&l.$animate.enabled(a)){var n=!0;l.$animate.on("enter",a,function(t,i){"close"===i&&n&&(g(),n=!1)})}else g()}else{if(null===a||0===a.length)return;a[0].style.opacity=0;a[0].style.position="";a[0].style.top="";o.removeClass(y)}}}}}}]);t.directive("uiSelectMatch",["uiSelectConfig",function(n){function t(n,t){return n[0].hasAttribute(t)?n.attr(t):n[0].hasAttribute("data-"+t)?n.attr("data-"+t):n[0].hasAttribute("x-"+t)?n.attr("x-"+t):void 0}return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(i){i.addClass("ui-select-match");var r=i.parent(),u=t(r,"theme")||n.theme,f=angular.isDefined(t(r,"multiple"));return u+(f?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(t,i,r,u){function f(n){u.allowClear=!!angular.isDefined(n)&&(""===n||"true"===n.toLowerCase())}u.lockChoiceExpression=r.uiLockChoice;r.$observe("placeholder",function(t){u.placeholder=void 0!==t?t:n.placeholder});r.$observe("allowClear",f);f(r.allowClear);u.multiple&&u.sizeSearchInput()}}}]);t.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(t,r){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function(n,t){var u,r=this,i=n.$select;angular.isUndefined(i.selected)&&(i.selected=[]);n.$evalAsync(function(){u=n.ngModel});r.activeMatchIndex=-1;r.updateModel=function(){u.$setViewValue(Date.now());r.refreshComponent()};r.refreshComponent=function(){i.refreshItems&&i.refreshItems();i.sizeSearchInput&&i.sizeSearchInput()};r.removeChoice=function(u){if(i.isLocked(null,u))return!1;var f=i.selected[u],e={};return e[i.parserResult.itemName]=f,i.selected.splice(u,1),r.activeMatchIndex=-1,i.sizeSearchInput(),t(function(){i.onRemoveCallback(n,{$item:f,$model:i.parserResult.modelMapper(n,e)})}),r.updateModel(),!0};r.getPlaceholder=function(){if(!i.selected||!i.selected.length)return i.placeholder}}],controllerAs:"$selectMultiple",link:function(u,f,e,o){function v(n){return angular.isNumber(n.selectionStart)?n.selectionStart:n.value.length}function y(t){function e(){switch(t){case n.LEFT:return~h.activeMatchIndex?f:r;case n.RIGHT:return~h.activeMatchIndex&&i!==r?l:(s.activate(),!1);case n.BACKSPACE:return~h.activeMatchIndex?h.removeChoice(i)?f:i:r;case n.DELETE:return!!~h.activeMatchIndex&&(h.removeChoice(h.activeMatchIndex),i)}}var o=v(s.searchInput[0]),c=s.selected.length,r=c-1,i=h.activeMatchIndex,l=h.activeMatchIndex+1,f=h.activeMatchIndex-1,u=i;return!(o>0||s.search.length&&t==n.RIGHT)&&(s.close(),u=e(),h.activeMatchIndex=s.selected.length&&u!==!1?Math.min(r,Math.max(0,u)):-1,!0)}function l(n){if(void 0===n||void 0===s.search)return!1;return n.filter(function(n){return void 0!==s.search.toUpperCase()&&void 0!==n&&n.toUpperCase()===s.search.toUpperCase()}).length>0}function a(n,t){var f=-1,r,i,u;if(angular.isArray(n))for(r=angular.copy(n),i=0;i<r.length;i++)void 0===s.tagging.fct?r[i]+" "+s.taggingLabel===t&&(f=i):(u=r[i],angular.isObject(u)&&(u.isTag=!0),angular.equals(u,t)&&(f=i));return f}var s=o[0],c=u.ngModel=o[1],h=u.$selectMultiple;s.multiple=!0;s.focusInput=s.searchInput;c.$isEmpty=function(n){return!n||0===n.length};c.$parsers.unshift(function(){for(var i,n={},r=[],t=s.selected.length-1;t>=0;t--)n={},n[s.parserResult.itemName]=s.selected[t],i=s.parserResult.modelMapper(u,n),r.unshift(i);return r});c.$formatters.unshift(function(n){var r,e=s.parserResult&&s.parserResult.source(u,{$select:{search:""}}),o={},t,f,i;if(!e)return n;if(t=[],f=function(n,i){var f,h,e;if(n&&n.length){for(f=n.length-1;f>=0;f--)if((o[s.parserResult.itemName]=n[f],r=s.parserResult.modelMapper(u,o),s.parserResult.trackByExp)&&(h=/(\w*)\./.exec(s.parserResult.trackByExp),e=/\.([^\s]+)/.exec(s.parserResult.trackByExp),h&&h.length>0&&h[1]==s.parserResult.itemName&&e&&e.length>0&&r[e[1]]==i[e[1]])||angular.equals(r,i))return t.unshift(n[f]),!0;return!1}},!n)return t;for(i=n.length-1;i>=0;i--)f(s.selected,n[i])||f(e,n[i])||t.unshift(n[i]);return t});u.$watchCollection(function(){return c.$modelValue},function(n,t){t!=n&&(angular.isDefined(c.$modelValue)&&(c.$modelValue=null),h.refreshComponent())});c.$render=function(){if(!angular.isArray(c.$viewValue)){if(!i(c.$viewValue))throw t("multiarr","Expected model value to be array but got '{0}'",c.$viewValue);c.$viewValue=[]}s.selected=c.$viewValue;h.refreshComponent();u.$evalAsync()};u.$on("uis:select",function(n,t){if(!(s.selected.length>=s.limit)){s.selected.push(t);var i={};i[s.parserResult.itemName]=t;r(function(){s.onSelectCallback(u,{$item:t,$model:s.parserResult.modelMapper(u,i)})});h.updateModel()}});u.$on("uis:activate",function(){h.activeMatchIndex=-1});u.$watch("$select.disabled",function(n,t){t&&!n&&s.sizeSearchInput()});s.searchInput.on("keydown",function(t){var i=t.which;u.$apply(function(){var r=!1;n.isHorizontalMovement(i)&&(r=y(i));r&&i!=n.TAB&&(t.preventDefault(),t.stopPropagation())})});s.searchInput.on("keyup",function(t){if(n.isVerticalMovement(t.which)||u.$evalAsync(function(){s.activeIndex=s.taggingLabel===!1?-1:0}),s.tagging.isActivated&&s.search.length>0){if(t.which===n.TAB||n.isControl(t)||n.isFunctionKey(t)||t.which===n.ESC||n.isVerticalMovement(t.which))return;if(s.activeIndex=s.taggingLabel===!1?-1:0,s.taggingLabel===!1)return;var r,v,e,h,i=angular.copy(s.items),f=angular.copy(s.items),o=!1,c=-1;if(void 0!==s.tagging.fct){if(e=s.$filter("filter")(i,{isTag:!0}),e.length>0&&(h=e[0]),i.length>0&&h&&(o=!0,i=i.slice(1,i.length),f=f.slice(1,f.length)),r=s.tagging.fct(s.search),f.some(function(n){return angular.equals(n,r)})||s.selected.some(function(n){return angular.equals(n,r)}))return void u.$evalAsync(function(){s.activeIndex=0;s.items=i});r&&(r.isTag=!0)}else{if(e=s.$filter("filter")(i,function(n){return n.match(s.taggingLabel)}),e.length>0&&(h=e[0]),v=i[0],void 0!==v&&i.length>0&&h&&(o=!0,i=i.slice(1,i.length),f=f.slice(1,f.length)),r=s.search+" "+s.taggingLabel,a(s.selected,s.search)>-1)return;if(l(f.concat(s.selected)))return void(o&&(i=f,u.$evalAsync(function(){s.activeIndex=0;s.items=i})));if(l(f))return void(o&&(s.items=f.slice(1,f.length)))}o&&(c=a(s.selected,r));c>-1?i=i.slice(c+1,i.length-1):(i=[],r&&i.push(r),i=i.concat(f));u.$evalAsync(function(){if(s.activeIndex=0,s.items=i,s.isGrouped){var n=r?i.slice(1):i;s.setItemsFn(n);r&&(s.items.unshift(r),s.groups.unshift({name:"",items:[r],tagging:!0}))}})}});s.searchInput.on("blur",function(){r(function(){h.activeMatchIndex=-1})})}}}]);t.directive("uiSelectNoChoice",["uiSelectConfig",function(n){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){t.addClass("ui-select-no-choice");var i=t.parent().attr("theme")||n.theme;return i+"/no-choice.tpl.html"}}}]);t.directive("uiSelectSingle",["$timeout","$compile",function(t,r){return{restrict:"EA",require:["^uiSelect","^ngModel"],link:function(u,f,e,o){var s=o[0],c=o[1],h;c.$parsers.unshift(function(n){if(i(n))return n;var r,t={};return t[s.parserResult.itemName]=n,r=s.parserResult.modelMapper(u,t)});c.$formatters.unshift(function(n){var o,t,f,e,r;if(i(n))return n;if(t=s.parserResult&&s.parserResult.source(u,{$select:{search:""}}),f={},t){if(e=function(t){return f[s.parserResult.itemName]=t,o=s.parserResult.modelMapper(u,f),o===n},s.selected&&e(s.selected))return s.selected;for(r=t.length-1;r>=0;r--)if(e(t[r]))return t[r]}return n});u.$watch("$select.selected",function(n){c.$viewValue!==n&&c.$setViewValue(n)});c.$render=function(){s.selected=c.$viewValue};u.$on("uis:select",function(n,r){s.selected=r;var f={};f[s.parserResult.itemName]=r;t(function(){s.onSelectCallback(u,{$item:r,$model:i(r)?r:s.parserResult.modelMapper(u,f)})})});u.$on("uis:close",function(n,i){t(function(){s.focusser.prop("disabled",!1);i||s.focusser[0].focus()},0,!1)});u.$on("uis:activate",function(){h.prop("disabled",!0)});h=angular.element("<input ng-disabled='$select.disabled' class='ui-select-focusser ui-select-offscreen' type='text' id='{{ $select.focusserId }}' aria-label='{{ $select.focusserTitle }}' aria-haspopup='true' role='button' />");r(h)(u);s.focusser=h;s.focusInput=h;f.parent().append(h);h.bind("focus",function(){u.$evalAsync(function(){s.focus=!0})});h.bind("blur",function(){u.$evalAsync(function(){s.focus=!1})});h.bind("keydown",function(t){return t.which===n.BACKSPACE&&s.backspaceReset!==!1?(t.preventDefault(),t.stopPropagation(),s.select(void 0),void u.$apply()):void(t.which===n.TAB||n.isControl(t)||n.isFunctionKey(t)||t.which===n.ESC||(t.which!=n.DOWN&&t.which!=n.UP&&t.which!=n.ENTER&&t.which!=n.SPACE||(t.preventDefault(),t.stopPropagation(),s.activate()),u.$digest()))});h.bind("keyup input",function(t){t.which===n.TAB||n.isControl(t)||n.isFunctionKey(t)||t.which===n.ESC||t.which==n.ENTER||t.which===n.BACKSPACE||(s.activate(h.val()),h.val(""),u.$digest())})}}}]);t.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function(n,t,i){return{require:["^^uiSelect","^ngModel"],link:function(t,r,u,f){if(null===t[u.uiSelectSort])throw i("sort","Expected a list to sort");var a=f[0],w=f[1],b=angular.extend({axis:"horizontal"},t.$eval(u.uiSelectSortOptions)),v=b.axis,h="dragging",c="dropping",o="dropping-before",s="dropping-after";t.$watch(function(){return a.sortable},function(n){n?r.attr("draggable",!0):r.removeAttr("draggable")});r.on("dragstart",function(n){r.addClass(h);(n.dataTransfer||n.originalEvent.dataTransfer).setData("text",t.$index.toString())});r.on("dragend",function(){e(h)});var y,k=function(n,t){this.splice(t,0,this.splice(n,1)[0])},e=function(n){angular.forEach(a.$element.querySelectorAll("."+n),function(t){angular.element(t).removeClass(n)})},p=function(n){n.preventDefault();var t="vertical"===v?n.offsetY||n.layerY||(n.originalEvent?n.originalEvent.offsetY:0):n.offsetX||n.layerX||(n.originalEvent?n.originalEvent.offsetX:0);t<this["vertical"===v?"offsetHeight":"offsetWidth"]/2?(e(s),r.addClass(o)):(e(o),r.addClass(s))},l=function(t){t.preventDefault();var i=parseInt((t.dataTransfer||t.originalEvent.dataTransfer).getData("text"),10);n.cancel(y);y=n(function(){d(i)},20)},d=function(n){var i=t.$eval(u.uiSelectSort),h=i[n],f=null;f=r.hasClass(o)?n<t.$index?t.$index-1:t.$index:n<t.$index?t.$index:t.$index+1;k.apply(i,[n,f]);w.$setViewValue(Date.now());t.$apply(function(){t.$emit("uiSelectSort:change",{array:i,item:h,from:n,to:f})});e(c);e(o);e(s);r.off("drop",l)};r.on("dragenter",function(){r.hasClass(h)||(r.addClass(c),r.on("dragover",p),r.on("drop",l))});r.on("dragleave",function(n){n.target==r&&(e(c),e(o),e(s),r.off("dragover",p),r.off("drop",l))})}}}]);t.directive("uisOpenClose",["$parse","$timeout",function(n,t){return{restrict:"A",require:"uiSelect",link:function(i,r,u,f){f.onOpenCloseCallback=n(u.uisOpenClose);i.$watch("$select.open",function(n,r){n!==r&&t(function(){f.onOpenCloseCallback(i,{isOpen:n})})})}}}]);t.service("uisRepeatParser",["uiSelectMinErr","$parse",function(n,t){var i=this;i.parse=function(i){var r,u,f,e;if(r=i.match(/^\s*(?:([\s\S]+?)\s+as\s+)?(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(\s*[\s\S]+?)?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),!r)throw n("iexp","Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",i);return u=r[5],f="",r[3]&&(u=r[5].replace(/(^\()|(\)$)/g,""),e=r[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/),e&&e[1].trim()&&(f=e[1],u=u.replace(f,""))),{itemName:r[4]||r[2],keyName:r[3],source:t(u),filters:f,trackByExp:r[6],modelMapper:t(r[1]||r[4]||r[2]),repeatExpression:function(n){var t=this.itemName+" in "+(n?"$group.items":"$select.items");return this.trackByExp&&(t+=" track by "+this.trackByExp),t}}};i.getGroupNgRepeatExpression=function(){return"$group in $select.groups track by $group.name"}}])}();angular.module("ui.select").run(["$templateCache",function(n){n.put("bootstrap/choices.tpl.html",'<ul class="ui-select-choices ui-select-choices-content ui-select-dropdown dropdown-menu" ng-show="$select.open && $select.items.length > 0"><li class="ui-select-choices-group" id="ui-select-choices-{{ $select.generatedId }}"><div class="divider" ng-show="$select.isGrouped && $index > 0"><\/div><div ng-show="$select.isGrouped" class="ui-select-choices-group-label dropdown-header" ng-bind="$group.name"><\/div><div ng-attr-id="ui-select-choices-row-{{ $select.generatedId }}-{{$index}}" class="ui-select-choices-row" ng-class="{active: $select.isActive(this), disabled: $select.isDisabled(this)}" role="option"><span class="ui-select-choices-row-inner"><\/span><\/div><\/li><\/ul>');n.put("bootstrap/match-multiple.tpl.html",'<span class="ui-select-match"><span ng-repeat="$item in $select.selected track by $index"><span class="ui-select-match-item btn btn-default btn-xs" tabindex="-1" type="button" ng-disabled="$select.disabled" ng-click="$selectMultiple.activeMatchIndex = $index;" ng-class="{\'btn-primary\':$selectMultiple.activeMatchIndex === $index, \'select-locked\':$select.isLocked(this, $index)}" ui-select-sort="$select.selected"><span class="close ui-select-match-close" ng-hide="$select.disabled" ng-click="$selectMultiple.removeChoice($index)">&nbsp;&times;<\/span> <span uis-transclude-append=""><\/span><\/span><\/span><\/span>');n.put("bootstrap/match.tpl.html",'<div class="ui-select-match" ng-hide="$select.open && $select.searchEnabled" ng-disabled="$select.disabled" ng-class="{\'btn-default-focus\':$select.focus}"><span tabindex="-1" class="btn btn-default form-control ui-select-toggle" aria-label="{{ $select.baseTitle }} activate" ng-disabled="$select.disabled" ng-click="$select.activate()" style="outline: 0;"><span ng-show="$select.isEmpty()" class="ui-select-placeholder text-muted">{{$select.placeholder}}<\/span> <span ng-hide="$select.isEmpty()" class="ui-select-match-text pull-left" ng-class="{\'ui-select-allow-clear\': $select.allowClear && !$select.isEmpty()}" ng-transclude=""><\/span> <i class="caret pull-right" ng-click="$select.toggle($event)"><\/i> <a ng-show="$select.allowClear && !$select.isEmpty() && ($select.disabled !== true)" aria-label="{{ $select.baseTitle }} clear" style="margin-right: 10px" ng-click="$select.clear($event)" class="btn btn-xs btn-link pull-right"><i class="glyphicon glyphicon-remove" aria-hidden="true"><\/i><\/a><\/span><\/div>');n.put("bootstrap/no-choice.tpl.html",'<ul class="ui-select-no-choice dropdown-menu" ng-show="$select.items.length == 0"><li ng-transclude=""><\/li><\/ul>');n.put("bootstrap/select-multiple.tpl.html",'<div class="ui-select-container ui-select-multiple ui-select-bootstrap dropdown form-control" ng-class="{open: $select.open}"><div><div class="ui-select-match"><\/div><input type="search" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="ui-select-search input-xs" placeholder="{{$selectMultiple.getPlaceholder()}}" ng-disabled="$select.disabled" ng-click="$select.activate()" ng-model="$select.search" role="combobox" aria-expanded="{{$select.open}}" aria-label="{{$select.baseTitle}}" ng-class="{\'spinner\': $select.refreshing}" ondrop="return false;"><\/div><div class="ui-select-choices"><\/div><div class="ui-select-no-choice"><\/div><\/div>');n.put("bootstrap/select.tpl.html",'<div class="ui-select-container ui-select-bootstrap dropdown" ng-class="{open: $select.open}"><div class="ui-select-match"><\/div><span ng-show="$select.open && $select.refreshing && $select.spinnerEnabled" class="ui-select-refreshing {{$select.spinnerClass}}"><\/span> <input type="search" autocomplete="off" tabindex="-1" aria-expanded="true" aria-label="{{ $select.baseTitle }}" aria-owns="ui-select-choices-{{ $select.generatedId }}" class="form-control ui-select-search" ng-class="{ \'ui-select-search-hidden\' : !$select.searchEnabled }" placeholder="{{$select.placeholder}}" ng-model="$select.search" ng-show="$select.open"><div class="ui-select-choices"><\/div><div class="ui-select-no-choice"><\/div><\/div>');n.put("select2/choices.tpl.html",'<ul tabindex="-1" class="ui-select-choices ui-select-choices-content select2-results"><li class="ui-select-choices-group" ng-class="{\'select2-result-with-children\': $select.choiceGrouped($group) }"><div ng-show="$select.choiceGrouped($group)" class="ui-select-choices-group-label select2-result-label" ng-bind="$group.name"><\/div><ul id="ui-select-choices-{{ $select.generatedId }}" ng-class="{\'select2-result-sub\': $select.choiceGrouped($group), \'select2-result-single\': !$select.choiceGrouped($group) }"><li role="option" ng-attr-id="ui-select-choices-row-{{ $select.generatedId }}-{{$index}}" class="ui-select-choices-row" ng-class="{\'select2-highlighted\': $select.isActive(this), \'select2-disabled\': $select.isDisabled(this)}"><div class="select2-result-label ui-select-choices-row-inner"><\/div><\/li><\/ul><\/li><\/ul>');n.put("select2/match-multiple.tpl.html",'<span class="ui-select-match"><li class="ui-select-match-item select2-search-choice" ng-repeat="$item in $select.selected track by $index" ng-class="{\'select2-search-choice-focus\':$selectMultiple.activeMatchIndex === $index, \'select2-locked\':$select.isLocked(this, $index)}" ui-select-sort="$select.selected"><span uis-transclude-append=""><\/span> <a href="javascript:;" class="ui-select-match-close select2-search-choice-close" ng-click="$selectMultiple.removeChoice($index)" tabindex="-1"><\/a><\/li><\/span>');n.put("select2/match.tpl.html",'<a class="select2-choice ui-select-match" ng-class="{\'select2-default\': $select.isEmpty()}" ng-click="$select.toggle($event)" aria-label="{{ $select.baseTitle }} select"><span ng-show="$select.isEmpty()" class="select2-chosen">{{$select.placeholder}}<\/span> <span ng-hide="$select.isEmpty()" class="select2-chosen" ng-transclude=""><\/span> <abbr ng-if="$select.allowClear && !$select.isEmpty()" class="select2-search-choice-close" ng-click="$select.clear($event)"><\/abbr> <span class="select2-arrow ui-select-toggle"><b><\/b><\/span><\/a>');n.put("select2/no-choice.tpl.html",'<div class="ui-select-no-choice dropdown" ng-show="$select.items.length == 0"><div class="dropdown-content"><div data-selectable="" ng-transclude=""><\/div><\/div><\/div>');n.put("select2/select-multiple.tpl.html",'<div class="ui-select-container ui-select-multiple select2 select2-container select2-container-multi" ng-class="{\'select2-container-active select2-dropdown-open open\': $select.open, \'select2-container-disabled\': $select.disabled}"><ul class="select2-choices"><span class="ui-select-match"><\/span><li class="select2-search-field"><input type="search" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="combobox" aria-expanded="true" aria-owns="ui-select-choices-{{ $select.generatedId }}" aria-label="{{ $select.baseTitle }}" aria-activedescendant="ui-select-choices-row-{{ $select.generatedId }}-{{ $select.activeIndex }}" class="select2-input ui-select-search" placeholder="{{$selectMultiple.getPlaceholder()}}" ng-disabled="$select.disabled" ng-hide="$select.disabled" ng-model="$select.search" ng-click="$select.activate()" style="width: 34px;" ondrop="return false;"><\/li><\/ul><div class="ui-select-dropdown select2-drop select2-with-searchbox select2-drop-active" ng-class="{\'select2-display-none\': !$select.open || $select.items.length === 0}"><div class="ui-select-choices"><\/div><\/div><\/div>');n.put("select2/select.tpl.html",'<div class="ui-select-container select2 select2-container" ng-class="{\'select2-container-active select2-dropdown-open open\': $select.open, \'select2-container-disabled\': $select.disabled, \'select2-container-active\': $select.focus, \'select2-allowclear\': $select.allowClear && !$select.isEmpty()}"><div class="ui-select-match"><\/div><div class="ui-select-dropdown select2-drop select2-with-searchbox select2-drop-active" ng-class="{\'select2-display-none\': !$select.open}"><div class="search-container" ng-class="{\'ui-select-search-hidden\':!$select.searchEnabled, \'select2-search\':$select.searchEnabled}"><input type="search" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" ng-class="{\'select2-active\': $select.refreshing}" role="combobox" aria-expanded="true" aria-owns="ui-select-choices-{{ $select.generatedId }}" aria-label="{{ $select.baseTitle }}" class="ui-select-search select2-input" ng-model="$select.search"><\/div><div class="ui-select-choices"><\/div><div class="ui-select-no-choice"><\/div><\/div><\/div>');n.put("selectize/choices.tpl.html",'<div ng-show="$select.open" class="ui-select-choices ui-select-dropdown selectize-dropdown" ng-class="{\'single\': !$select.multiple, \'multi\': $select.multiple}"><div class="ui-select-choices-content selectize-dropdown-content"><div class="ui-select-choices-group optgroup"><div ng-show="$select.isGrouped" class="ui-select-choices-group-label optgroup-header" ng-bind="$group.name"><\/div><div role="option" class="ui-select-choices-row" ng-class="{active: $select.isActive(this), disabled: $select.isDisabled(this)}"><div class="option ui-select-choices-row-inner" data-selectable=""><\/div><\/div><\/div><\/div><\/div>');n.put("selectize/match-multiple.tpl.html",'<div class="ui-select-match" data-value="" ng-repeat="$item in $select.selected track by $index" ng-click="$selectMultiple.activeMatchIndex = $index;" ng-class="{\'active\':$selectMultiple.activeMatchIndex === $index}" ui-select-sort="$select.selected"><span class="ui-select-match-item" ng-class="{\'select-locked\':$select.isLocked(this, $index)}"><span uis-transclude-append=""><\/span> <span class="remove ui-select-match-close" ng-hide="$select.disabled" ng-click="$selectMultiple.removeChoice($index)">&times;<\/span><\/span><\/div>');n.put("selectize/match.tpl.html",'<div ng-hide="$select.searchEnabled && ($select.open || $select.isEmpty())" class="ui-select-match"><span ng-show="!$select.searchEnabled && ($select.isEmpty() || $select.open)" class="ui-select-placeholder text-muted">{{$select.placeholder}}<\/span> <span ng-hide="$select.isEmpty() || $select.open" ng-transclude=""><\/span><\/div>');n.put("selectize/no-choice.tpl.html",'<div class="ui-select-no-choice selectize-dropdown" ng-show="$select.items.length == 0"><div class="selectize-dropdown-content"><div data-selectable="" ng-transclude=""><\/div><\/div><\/div>');n.put("selectize/select-multiple.tpl.html",'<div class="ui-select-container selectize-control multi plugin-remove_button" ng-class="{\'open\': $select.open}"><div class="selectize-input" ng-class="{\'focus\': $select.open, \'disabled\': $select.disabled, \'selectize-focus\' : $select.focus}" ng-click="$select.open && !$select.searchEnabled ? $select.toggle($event) : $select.activate()"><div class="ui-select-match"><\/div><input type="search" autocomplete="off" tabindex="-1" class="ui-select-search" ng-class="{\'ui-select-search-hidden\':!$select.searchEnabled}" placeholder="{{$selectMultiple.getPlaceholder()}}" ng-model="$select.search" ng-disabled="$select.disabled" aria-expanded="{{$select.open}}" aria-label="{{ $select.baseTitle }}" ondrop="return false;"><\/div><div class="ui-select-choices"><\/div><div class="ui-select-no-choice"><\/div><\/div>');n.put("selectize/select.tpl.html",'<div class="ui-select-container selectize-control single" ng-class="{\'open\': $select.open}"><div class="selectize-input" ng-class="{\'focus\': $select.open, \'disabled\': $select.disabled, \'selectize-focus\' : $select.focus}" ng-click="$select.open && !$select.searchEnabled ? $select.toggle($event) : $select.activate()"><div class="ui-select-match"><\/div><input type="search" autocomplete="off" tabindex="-1" class="ui-select-search ui-select-toggle" ng-class="{\'ui-select-search-hidden\':!$select.searchEnabled}" ng-click="$select.toggle($event)" placeholder="{{$select.placeholder}}" ng-model="$select.search" ng-hide="!$select.isEmpty() && !$select.open" ng-disabled="$select.disabled" aria-label="{{ $select.baseTitle }}"><\/div><div class="ui-select-choices"><\/div><div class="ui-select-no-choice"><\/div><\/div>')}]),function(){"use strict";function n(n){return{get:function(t,i){return n.get(t,i)},"delete":function(t,i){return n.delete(t,i)},post:function(t,i,r){return n.post(t,i,r)},put:function(t,i,r){return n.put(t,i,r)}}}angular.module("app").factory("dataContext",["$http",n])}(),function(n){"use strict";function t(n){var t=n("phone"),i=/\D+/g;return{require:"ngModel",link:function(n,r,u,f){f.$parsers.push(function(n){return n.replace(i,"")});f.$formatters.push(function(n){return t(n)})}}}n.module("app").directive("phoneInput",["$filter",t])}(angular),function(n){"use strict";n.module("app").directive("isoDate",["commonService",function(n){return{restrict:"A",require:"ngModel",link:function(t,i,r,u){function f(t){return n.fromIsoDate(t)}function e(t){return n.toIsoDate(t)}u.$parsers.push(e);u.$formatters.push(f)}}}])}(angular),function(n){"use strict";function t(){return{restrict:"A",scope:{errorClass:"=",ariaId:"@"},link:function(n,t,i){var r=i.ariaId||"";n.$watch("errorClass.$error",function(n){n?(t.find("input, select, textarea").attr("aria-describedby",r).attr("aria-invalid","true"),t.addClass("input-error")):(t.find("input, select, textarea").attr("aria-invalid","false"),t.removeClass("input-error"))})}}}function i(n){return{restrict:"A",scope:{errorLabel:"="},link:function(t,i,r){var f=r.errorLabel+Math.random(),u=f.replace(/\W+/g,"-");t.$watch("errorLabel.$error",function(r){r?(i.find("input, select, textarea").attr("area-described-by",u).attr("aria-invalid","true"),i.find("#"+u).length===0&&i.addClass("input-error").append(n('<p id="'+u+'" class="help-text error-text" ng-messages="errorLabel.$error" role="alert"><i class="icon-warning"><\/i> <span ng-message="serverValidation">{{ errorLabel.$error.message }}<\/span><\/p>')(t))):(i.find("input, select, textarea").attr("aria-invalid","false"),i.removeClass("input-error"),i.find("#"+u).remove())})}}}n.module("app").directive("errorClass",["$compile",t]);n.module("app").directive("errorLabel",["$compile",i])}(angular),function(n){"use strict";function t(){return{restrict:"A",scope:{warningClass:"=",ariaId:"@"},link:function(n,t,i){var r=i.ariaId||"";n.$watch("warningClass.$error",function(n){n?(t.find("input, select, textarea").attr("aria-describedby",r).attr("aria-invalid","true"),t.addClass("input-warning")):(t.find("input, select, textarea").attr("aria-invalid","false"),t.removeClass("input-warning"))})}}}function i(n){return{restrict:"A",scope:{warningLabel:"="},link:function(t,i,r){var f=r.warningLabel+Math.random(),u=f.replace(/\W+/g,"-");t.$watch("warningLabel.$error",function(r){r?(i.find("input, select, textarea").attr("area-described-by",u).attr("aria-invalid","true"),i.find("#"+u).length===0&&i.addClass("input-warning").append(n('<p id="'+u+'" class="help-text warning-text" ng-messages="warningLabel.$error" role="alert"><i class="icon-warning"><\/i> <span ng-message="serverValidation">{{ warningLabel.$error.message }}<\/span><\/p>')(t))):(i.find("input, select, textarea").attr("aria-invalid","false"),i.removeClass("input-warning"),i.find("#"+u).remove())})}}}n.module("app").directive("warningClass",["$compile",t]);n.module("app").directive("warningLabel",["$compile",i])}(angular),function(n,t){"use strict";function s(s){return{restrict:"E",replace:!0,template:'<input type="text" placeholder="MM/DD/YYYY" maxlength="10" ng-model="date.getterSetter" ng-model-options="{ getterSetter: true, updateOn: \'blur\' }" ng-disabled="date.disabled()" />',bindToController:{model:"=",disabled:"&",onChange:"&",validation:"="},controllerAs:"date",controller:function(){function a(r){var e=n.isDefined(r),u=h.model,f;if(e)u=l(r),h.validation?(f=r.trim()==="",u||f?(h.model=u?u:t,h.validation.onValid(),_.defer(function(){h.onChange({value:h.model})})):(h.validation.onInvalid(),h.model=r)):(h.model=u,_.defer(function(){h.onChange({value:h.model})}));else return h.validation?v(u)?s(u).format(i):(u=l(h.model),u)?s(u).format(i):h.model:u&&s(u).format(i)}function v(n){if(!n)return!1;var t=n.match(o);return!!t}function l(n){var t;return w(n)&&(t=n.match(u)),t?c(t[3],t[1],t[2]):y(n)}function y(n){if(!n)return t;var i=n.match(f);return i?c(i[1],i[2],i[3]):p(n)}function p(n){var u=n.match(e),i=t,r;return u&&(r=+n.substring(4,6),i=r>12?c(n.substring(4),n.substring(0,2),n.substring(2,4)):c(n.substring(0,4),n.substring(4,6),n.substring(6))),i}function c(n,i,u){var f=+n,o=+i,h=+u,e;return n<70?f+=2e3:n<100&&(f+=1900),e=s([f,o-1,h]),e.isValid()?e.format(r):t}function w(n){if(!n)return!1;var t=s(n,i);return t==null||!t.isValid()?!1:!0}var h=this;h.getterSetter=a},scope:{}}}var i="MM/DD/YYYY",r="YYYY-MM-DD",u=/^([01]?\d)[-\/\. ]([0-3]?\d)[-\/\. ](\d{2}|\d{4})$/,f=/^(\d{4})[-\/\. ]([01]?\d)[-\/\. ]([0-3]?\d)$/,e=/^\d{8}$/,o=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/;n.module("app").directive("textDateInput",["moment",s])}(angular),function(n){"use strict";n.module("app").directive("validationLabel",function(){return{restrict:"A",scope:{validationLabel:"="},link:function(n,t){n.$watch("validationLabel.$invalid && (validationLabel.$dirty || validationLabel.$touched)",function(n){n?t.addClass("input-error"):t.removeClass("input-error")})}}})}(angular),function(n){function i(n){return _.mapValues(n,t)}function t(n){var i=n;return typeof n=="string"?i=he.decode(n):typeof n=="object"&&(i=_.mapValues(n,t)),i}n.module("app").factory("localized",["localizedSource",i])}(angular),function(n,t,i,r){"use strict";function u(i,u,f,e,o,s,h,c){function v(n){l||(l=!0,e.all([y(n),p(n)]).then(function(t){l=!1;w(n,t[0])}))}function y(n){if(n.templateUrl)return o.get(n.templateUrl,{cache:f}).then(function(n){return n.data});if(n.template)return e.defer(n.template);throw Error("Specify either templateUrl or template");}function p(n){return n.onLoad?n.onLoad(n.data):e.defer()}function w(f,o){function tt(){var y=r.isFunction(f.onCancel)?f.onCancel:n.noop,w=r.isFunction(f.onClose)?f.onClose:n.noop,b=r.isFunction(f.onBeforeResult)?f.onBeforeResult:e.resolve,k=r.isFunction(f.onResult)?f.onResult:e.resolve,a;t("#"+d).length===0&&(o='<div id="'+d+'" class="'+nt(f)+'" role="dialog">'+o+"<\/div>",s=h.$new(),f.contentScope&&n.extend(s,f.contentScope),a=!1,n.extend(s,{data:f.data,save:function(){if(!a)return a=!0,b(s.data).then(k).then(l).catch(function(n){var t,r=n.data||{};t=r.message||n.statusText||n.message;i.error(t)}).finally(function(){a=!1})},cancel:function(){l();y()},close:function(){l();w()}}),v=u(o)(s),p=h.$watch(function(){return c.path()},function(){g||l();g=!1}))}function l(){r.isFunction(p)&&p();v.remove();b.remove();y.removeClass("modal-open");s.$destroy();t(window).off("keydown",w)}var v,y=n.element(document.body),b=n.element('<div class="modal-overlay"><\/div>'),k=n.element(f.container||y),d=f.id||"NamUsModal",s,p,g=!0,w;tt();o.length>0&&(k.append(b),k.append(v),y.addClass("modal-open"));w=f.escapeInvokesCancel&&r.isFunction(f.onCancel)?a(function(){l();f.onCancel()}):a(l);t(window).on("keydown",w)}function b(n){var t=!1;return r.forOwn(n,function(n){n.$error&&(t=!0)}),t}function k(n,t){var i,u,f;if(r.has(n,"data.validationErrors"))for(i=0;i<n.data.validationErrors.length;i++)u=n.data.validationErrors[i],r.has(t,u.fieldName)&&(f=r.get(t,u.fieldName),f.$error={serverValidation:!0,message:u.error})}function d(n){r.forOwn(n,function(n){n.$error=null})}function g(n){var t=!1;return r.forOwn(n,function(n){n.$error&&n.$error.disablePutPost===!0&&(t=!0)}),t}function a(n){return function(t){t.keyCode===27&&n()}}function nt(n){var t="namus-modal";return n.small&&(t+=" small-modal"),n.constant&&(t+=" constant-modal"),t}var l=!1;return{show:v,anyServerValidationErrors:b,setServerValidationErrors:k,clearServerValidationErrors:d,isPutPostDisabledByError:g}}n.module("app").factory("namusModal",["$log","$compile","$templateCache","$q","$http","$timeout","$rootScope","$location",u])}(angular,jQuery,Foundation,_),function(n){function t(n){return n.modalContent.toString()||console.error("You must set the modalContent property in templateUrls"),{restrict:"E",replace:!1,transclude:{header:"?header",content:"content",footer:"?modalFooter"},templateUrl:n.modalContent.toString(),bindToController:{modalTitle:"&",save:"&",cancel:"&",errors:"@",disable:"@",message:"&"},controllerAs:"modal",controller:[function(){}],scope:{}}}n.module("app").directive("modalContent",["templateUrls",t])}(angular),function(n){"use strict";function t(){function n(n,t,i){return n?0:(t.$error={serverValidation:!0,message:i},1)}return{validate:n}}n.module("app").factory("validation",[t])}(angular),function(n){"use strict";function i(n,i,r,u){function f(t,i,f){function o(){return!!e.errorMessage}var e={itemName:i,canDelete:!0,message:"",errorMessage:"",showError:o};r.show({small:!0,templateUrl:u.confirmItemDeletionModal.toString(),data:e,onResult:function(i){return _.isNil(t)||!t.hrefDelete?f?f():void 0:n.delete(t.hrefDelete).then(function(){return t._deleted=!0,f?f():void 0}).catch(function(n){if(t._deleted=!1,n&&n.data){i.errorMessage=n.data.message;throw n;}})}})}function e(t,i,f){function o(){return!!e.errorMessage}var e={itemName:i,canDelete:!0,message:"",errorMessage:"",showError:o};r.show({small:!0,templateUrl:u.confirmDuplicateDeletionModal.toString(),data:e,onResult:function(i){return n.delete(t.hrefDelete).then(function(){return t._deleted=!0,f?f():void 0}).catch(function(n){if(t._deleted=!1,n&&n.data){i.errorMessage=n.data.message;throw n;}})}})}function o(i,f,e,o){var s={edit:!1,isPublic:!1,canBePublic:f,noteType:i,description:"",errors:{description:{}},clearError:t},h={Description:s.errors.description};r.show({small:!0,templateUrl:u.noteAddEditModal.toString(),data:s,onResult:function(t){return r.clearServerValidationErrors(h),n.post(o,t).then(function(n){e.push(n.data)}).catch(function(n){r.setServerValidationErrors(n,h);throw n;})}})}function s(f,e,o,s){var h={edit:!0,id:s.id,isPublic:s.isPublic,canBePublic:e,noteType:f,description:s.description,errors:{description:{}},clearError:t},c={Description:h.errors.description};r.show({small:!0,templateUrl:u.noteAddEditModal.toString(),data:h,onResult:function(t){return t.description!==s.description||t.isPublic!==s.isPublic?(r.clearServerValidationErrors(c),n.put(s.hrefUpdate,t).then(function(n){var t=_.findIndex(o,{id:s.id});o[t]=n.data}).catch(function(n){r.setServerValidationErrors(n,c);throw n;})):i.when({})}})}function h(n,t){var i={message:n};r.show({small:!0,templateUrl:u.confirmModal.toString(),data:i,onResult:function(){return t()}})}function c(n){r.show({small:!0,templateUrl:u.confirmLeavingNamUsModal.toString(),data:{},onResult:function(){return n()}})}return{openConfirmItemDeletionDialog:f,openConfirmDuplicateDeletionDialog:e,openAddNoteDialog:o,openEditNoteDialog:s,openConfirmDialog:h,openConfirmLeavingNamUsDialog:c}}function t(n){n.$error=null}n.module("app").factory("commonModalService",["$http","$q","namusModal","templateUrls",i])}(angular),function(){"use strict";function n(n,t,i,r,u){function l(n){return n&&u(n).toDate()}function a(n){return n&&u(n).format("YYYY-MM-DD")}function o(){return n.get(i.ethnicities,{cache:!0}).then(function(n){return s=n.data},function(){return s=[]})}function v(){var t=i.getSexesApi;return n.get(t).then(function(n){e=n.data},function(){e=[]}),e}function y(n){return o().then(function(t){return _.isArray(n)?n&&n.length>0?r.demographics.mixedEthnicity:null:h(n,t)})}function p(n){return o().then(function(t){return _.isArray(n)?k(n,t):h(n,t)})}function w(n,t,i,r,u){for(var o,s,e=0;e<u.length;e++)o=f(n,t,e,u),s=f(i,r,e,u),!o&&s&&(r&&r.length>0?delete i[r][u[e]]:delete i[u[e]]),o&&!s&&(t&&t.length>0?delete n[t][u[e]]:delete n[u[e]])}function b(n,t,i,r,u){for(var o,s,e=0;e<u.length;e++)o=f(n,t,e,u),s=f(i,r,e,u),!o&&s&&(r.length>0?n[r][u[e]]=null:n[u[e]]=null),o&&!s&&(t.length>0?i[t][u[e]]=null:i[u[e]]=null)}function h(n,t){for(var i=0;i<t.length;i++)if(t[i].name===n||n===t[i].localizedName)return t[i].localizedName}function k(n,t){for(var i,u=[],r=0;r<n.length;r++)for(i=0;i<t.length;i++)if(n[r]===t[i].name||n[r]===t[i].localizedName){u.push(t[i].localizedName);break}return u}function f(n,t,i,r){var u;return(u=t.length>0?_.get(n,t.concat(".".concat(r[i])),!1):_.get(n,r[i],!1),u===!1)?!1:!0}var c={removePropertiesBeforeEqualityCheck:w,addPropertiesBeforeEqualityCheck:b,ethnicities:o,sexes:v,getRaceEthnicityFormattedLocalized:y,getRaceEthnicityLocalized:p,fromIsoDate:l,toIsoDate:a},s=[],e=[];return c}angular.module("app").factory("commonService",n);n.$inject=["$http","$q","hrefs","localized","moment"]}(),function(n){"use strict";function t(n,t){function i(i,r,u,f,e,o){if(u!==f||f&&e!==o){var s;return s={noKnownInformation:f,comment:f?o:null},r?(s.id=r.id,n.put(r.hrefUpdate,s)):n.post(i,s)}return t.when({data:r})}return{save:i}}n.module("app").factory("commonNoKnownInformationService",["$http","$q",t])}(angular);var saveAs=saveAs||function(n){"use strict";if(typeof n!="undefined"&&(typeof navigator=="undefined"||!/MSIE [1-9]\./.test(navigator.userAgent))){var s=n.document,r=function(){return n.URL||n.webkitURL||n},i=s.createElementNS("http://www.w3.org/1999/xhtml","a"),h="download"in i,c=function(n){var t=new MouseEvent("click");n.dispatchEvent(t)},l=/constructor/i.test(n.HTMLElement)||n.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent),a=function(t){(n.setImmediate||n.setTimeout)(function(){throw t;},0)},v="application/octet-stream",y=4e4,f=function(n){var t=function(){typeof n=="string"?r().revokeObjectURL(n):n.remove()};setTimeout(t,y)},p=function(n,t,i){var r,u;for(t=[].concat(t),r=t.length;r--;)if(u=n["on"+t[r]],typeof u=="function")try{u.call(n,i||n)}catch(f){a(f)}},e=function(n){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob([String.fromCharCode(65279),n],{type:n.type}):n},o=function(t,o,s){s||(t=e(t));var a=this,k=t.type,b=k===v,y,w=function(){p(a,"writestart progress write writeend".split(" "))},d=function(){var i,e;if((u||b&&l)&&n.FileReader){i=new FileReader;i.onloadend=function(){var t=u?i.result:i.result.replace(/^data:[^;]*;/,"data:attachment/file;"),r=n.open(t,"_blank");r||(n.location.href=t);t=undefined;a.readyState=a.DONE;w()};i.readAsDataURL(t);a.readyState=a.INIT;return}y||(y=r().createObjectURL(t));b?n.location.href=y:(e=n.open(y,"_blank"),e||(n.location.href=y));a.readyState=a.DONE;w();f(y)};if(a.readyState=a.INIT,h){y=r().createObjectURL(t);setTimeout(function(){i.href=y;i.download=o;c(i);w();f(y);a.readyState=a.DONE});return}d()},t=o.prototype,w=function(n,t,i){return new o(n,t||n.name||"download",i)};return typeof navigator!="undefined"&&navigator.msSaveOrOpenBlob?function(n,t,i){return t=t||n.name||"download",i||(n=e(n)),navigator.msSaveOrOpenBlob(n,t)}:(t.abort=function(){},t.readyState=t.INIT=0,t.WRITING=1,t.DONE=2,t.error=t.onwritestart=t.onprogress=t.onwrite=t.onabort=t.onerror=t.onwriteend=null,w)}}(typeof self!="undefined"&&self||typeof window!="undefined"&&window||this.content);typeof module!="undefined"&&module.exports?module.exports.saveAs=saveAs:typeof define!="undefined"&&define!==null&&define.amd!==null&&define("FileSaver.js",function(){return saveAs}),function(n){"use strict";function t(){function t(n,t){var i,r,u;if(!n||n.length===0||!t||t.length===0)return!1;for(i=0;i<n.length;i++)if((r=n[i],u=t[i],!r.code&&u.code)||r.code&&u.code&&r.code.toUpperCase()!==u.code.toUpperCase())return!0;return!1}function i(n){var t=null;return n&&(t=JSON.parse(JSON.stringify(n))),t}function r(t,i){for(var u,f=[],r=0;r<i;r++)u=n.find(t,function(n){return n.index===r}),f.push({code:u?u.code?u.code:"":"",index:r});return f}return{willOverwrite:t,copy:i,normalize:r}}angular.module("app").factory("codeCopyService",[t])}(_),function(n){"use strict";function t(n){function t(){try{return!!new Blob}catch(n){return!1}}function i(t,i){var t=new Blob([t],{type:"text/plain;charset=utf-8"});return n.saveAs(t,i)}return{isSupported:t,saveAsCsv:i,saveAs:n.saveAs}}n.module("app").factory("fileSaver",["$window",t])}(angular),function(n){"use strict";n.module("app").factory("OptionService",function(){function t(t){n=t}function i(){return n}var n=!1;return{getIsPrintMode:i,setIsPrintMode:t}})}(angular),function(n){"use strict";function t(n,t,i){var r=n("notDeleted");return{restrict:"E",replace:!1,templateUrl:i.attachmentListDirective.toString(),bindToController:{imageCategories:"@",documentCategories:"@"},controllerAs:"list",controller:function(){function o(){var n=u();return _.some(n)}function s(){var n=t.get();return r(n.images)}function h(){var n=t.get();return r(n.documents)}function u(){var n=_.filter(s(),y),t=_.filter(h(),p);return _.concat(n,t)}function c(n){var t=n.files||{};return t.original}function i(n){var t=n.files||{};return t.thumbnail}function l(n){var t=i(n);return t.width/16}function a(n){var t=i(n);return t.height/16}function v(n){return n.file}function y(n){return _.includes(f,n.category.name)}function p(n){return _.includes(e,n.category.name)}var n=this,f=n.imageCategories?n.imageCategories.split(","):[],e=n.documentCategories?n.documentCategories.split(","):[];n.any=o;n.attachments=u;n.getOriginal=c;n.getThumbnail=i;n.getThumbnailWidth=l;n.getThumbnailHeight=a;n.getDocument=v},scope:{}}}n.module("app").directive("attachmentList",["$filter","CaseService","templateUrls",t])}(angular),function(n){"use strict";function t(n,t,i,r,u){var f=n("phone");return{restrict:"E",replace:!1,transclude:!0,templateUrl:t.caseAgencyDirective.toString(),bindToController:{agency:"&",collapsed:"&",card:"&"},controllerAs:"caseAgency",controller:function(){function o(){return!n.collapsed()}function t(){return n.agency()||{}}function s(){return t().name}function h(){return t().hrefProfile}function c(){var n=t();return n.address!=null?append(n.address.address1,"\r\n",n.address.address2,"\r\n",n.address.city,", ",e(n.address.state)," ",n.address.zipCode):n.street1||n.street2||n.city||n.state||n.zipCode?append(n.street1,"\r\n",n.street2,"\r\n",n.city,", ",e(n.state)," ",n.zipCode):void 0}function e(n){if(n)return n.name?n.name:n}function l(){var n=t();return n&&n.address!=null&&n.address.county!=null?n.address.county.name:n.county?n.county.name:null}function a(){var n=t();return append(f(n.phone)," ext. ",n.phoneExtension)}function v(){return t().websiteUrl}function y(){return t().ori}function p(){return t().agencyType}function w(){return t().email}function b(){var n=t().jurisdiction;return n&&n.localizedName?n.localizedName:n!==null?n:null}function k(){var i=t(),n=i.tribalAccessParticipant;return n&&n.localizedName?n.localizedName:n!==null?n:null}function d(){var n=t().agencyType;return n&&n.localizedName?n.localizedName:n!==null?n:null}function g(){return i.hasPublicViewPermission()}function nt(){return n.hide()?!1:n.jurisdiction()==="Tribal"&&r.isCurrentUserNamUsPersonnel()?!0:void 0}function tt(){return u.getIsPrintMode()===!0}var n=this;n.expanded=o;n.name=s;n.profile=h;n.address=c;n.countyName=l;n.phone=a;n.website=v;n.ori=y;n.agencyType=p;n.email=w;n.jurisdiction=b;n.tribalAccessParticipant=k;n.agencyType=d;n.hide=g;n.showTribalAccessProgram=nt;n.isPrintMode=tt},scope:{}}}n.module("app").directive("caseAgency",["$filter","templateUrls","CaseService","identity","OptionService",t])}(angular),function(n){"use strict";function t(n,t,i,r){var u=n("phone");return{restrict:"E",replace:!1,transclude:!0,templateUrl:t.caseContactDirective.toString(),bindToController:{contact:"&",collapsed:"&",card:"&"},controllerAs:"caseContact",controller:function(){function s(){return!n.collapsed()}function t(){return n.contact()||{}}function h(){var n=t();return append(n.firstName," ",n.lastName,", ",c(n))}function c(n){return n.jobTitle?n.jobTitle:"--"}function l(){return t().hrefProfile}function a(){return r.getIsPrintMode()}function v(){return t().phone1Type&&t().phone1Type.localizedName}function y(){var n=t();return append(u(n.phone1)," ext. ",n.phone1Extension)}function f(){return t().isPublicPhone1}function p(){return t().phone2Type&&t().phone2Type.localizedName}function w(){var n=t();return append(u(n.phone2)," ext. ",n.phone2Extension)}function e(){return t().isPublicPhone2}function b(){return t().email}function o(){return t().isPublicEmail}function k(){return i.hasPublicViewPermission()}function d(){return f()||!i.hasPublicViewPermission()?!1:!0}function g(){return e()||!i.hasPublicViewPermission()?!1:!0}function nt(){return o()||!i.hasPublicViewPermission()?!1:!0}var n=this;n.expanded=s;n.name=h;n.profile=l;n.phone1Type=v;n.phone1=y;n.isPublicPhone1=f;n.phone2Type=p;n.phone2=w;n.isPublicPhone2=e;n.email=b;n.isPublicEmail=o;n.hide=k;n.hidePublicPhone1=d;n.hidePublicPhone2=g;n.hidePublicEmail=nt;n.isPrintMode=a},scope:{}}}n.module("app").directive("caseContact",["$filter","templateUrls","CaseService","OptionService",t])}(angular),function(n){"use strict";function t(t){return{restrict:"E",transclude:!0,replace:!1,templateUrl:t.checkboxSetDirective.toString(),bindToController:{description:"@",display:"@",alt:"@",value:"@",property:"=",items:"=",list:"&",canSelectAll:"&",largeColumns:"@",onChange:"&",tabIndexStartValue:"=",showOther:"&",otherModel:"="},controllerAs:"set",controller:function(){function f(n){return t.showOther(n)}function e(){for(var n=0;n<t.items.length;n++)i(t.items[n])===!1&&r(t.items[n])}function o(){for(var n=0;n<t.items.length;n++)i(t.items[n])===!0&&u(t.items[n])}function i(n){return _.some(t.property,function(i){return i[t.value]===n[t.value]})}function r(n){i(n)||t.property.push(n);t.onChange({value:t.property})}function u(n){i(n)&&_.remove(t.property,function(i){return i[t.value]===n[t.value]});t.onChange({value:t.property})}function s(t){return function(f){if(n.isDefined(f))f?r(t):u(t);else return i(t)}}function h(){return!!t.tabIndexStartValue}function c(n){var i=t.list()?[]:["small-12","medium-6","large-"+12/t.largeColumns,"columns"];return n&&i.push("end"),i.join(" ")}var t=this;t.property||(t.property=[]);t.display||(t.display="display");t.alt||(t.alt="alt");t.value||(t.value="value");t.largeColumns=t.largeColumns&&12%+t.largeColumns!=0?+t.largeColumns:2;t.selected=s;t.classes=c;t.selectAll=e;t.clearAll=o;t.setTabIndex=h;t.displayOther=f},scope:{}}}n.module("app").directive("checkboxSet",["templateUrls",t])}(angular),function(n){"use strict";function f(n,f){return{restrict:"E",replace:!1,templateUrl:f.dateRangeInputDirective.toString(),bindToController:{model:"=",exactDate:"<?"},controllerAs:"range",controller:function(){function e(){var e=!1;return f.model&&f.model.type==="between"&&(f.exactDate?(i(f.model.from)||i(f.model.to))&&(e=t(f.model.from)&&t(f.model.to)?n([f.model.to.year,f.model.to.month-1,f.model.to.day]).isBefore(n([f.model.from.year,f.model.from.month-1,f.model.from.day])):!0):t(f.model.from)&&t(f.model.to)?e=n([f.model.to.year,f.model.to.month-1,f.model.to.day]).isBefore(n([f.model.from.year,f.model.from.month-1,f.model.from.day])):r(f.model.from)&&r(f.model.to)?e=n([f.model.to.year,f.model.to.month-1,1]).isBefore(n([f.model.from.year,f.model.from.month-1,1])):u(f.model.from)&&u(f.model.to)&&(e=f.model.to.year<f.model.from.year)),e}var f=this;f.model||(f.model={});f.model.type||(f.model.type="between");f.isInvalid=e},scope:{}}}function i(n){var t=n&&(n.month||n.day||n.year);return!!t}function t(n){var t=n&&n.month&&n.day&&n.year;return!!t}function r(n){var t=n&&n.month&&!n.day&&n.year;return!!t}function u(n){var t=n&&!n.month&&!n.day&&n.year;return!!t}n.module("app").directive("dateRangeInput",["moment","templateUrls",f])}(angular),function(n){"use strict";function t(n){return{restrict:"E",replace:!0,templateUrl:n.fileUploadDirective.toString(),bindToController:{onDrop:"&"},controllerAs:"upload",link:function(n,t,i,r){var u=function(){var n=document.createElement("div");return("draggable"in n||"ondragstart"in n&&"ondrop"in n)&&"FormData"in window&&"FileReader"in window}();t.find('input[type="file"]').on("change",function(n){var t=n&&n.originalEvent&&n.originalEvent.target&&n.originalEvent.target.files||[];r.onDrop&&t.length>0&&r.onDrop()(t);$(this).val(null)});if(u){t.addClass("has-advanced-upload");t.on("drag dragstart dragend dragover dragenter dragleave drop",function(n){n.preventDefault();n.stopPropagation()}).on("dragover dragenter",function(){t.addClass("is-dragover")}).on("dragleave dragend drop",function(){t.removeClass("is-dragover")}).on("drop",function(n){var t=n&&n.originalEvent&&n.originalEvent.dataTransfer&&n.originalEvent.dataTransfer.files||[];r.onDrop&&t.length>0&&r.onDrop()(t)})}},controller:function(){},scope:{}}}n.module("app").directive("fileUpload",["templateUrls",t])}(angular),function(n,t,i){"use strict";function r(t){return{restrict:"E",replace:!1,templateUrl:t.heightInputDirective.toString(),bindToController:{model:"=",disabled:"&",onChange:"&"},controllerAs:"height",controller:function(){function r(r){var u=n.isDefined(r)?t.model||0:t.model;if(n.isDefined(r))u=Math.floor(r)*12+u%12,t.model=u===0?i:u;else return u?Math.floor(u/12):u===0?0:i}function u(r){var u=n.isDefined(r)?t.model||0:t.model;if(n.isDefined(r))u=Math.floor(u/12)*12+Math.floor(r),t.model=u===0?i:u;else return u?u%12:u===0?0:i}var t=this;t.fromFeet=r;t.fromInches=u},scope:{}}}n.module("app").directive("heightInput",["templateUrls",r])}(angular,_),function(n,t){"use strict";function i(){return{restrict:"E",replace:!0,template:'<input type="text" ng-model="integer.getterSetter" ng-model-options="{ getterSetter: true, updateOn: \'blur\' }" ng-disabled="integer.disabled()" ng-change="integer.onChange()" />',bindToController:{model:"=",disabled:"&",onChange:"&"},controllerAs:"integer",controller:function(){function r(r){var u=n.isDefined(r)?i.model||0:i.model;if(n.isDefined(r))u=parseInt(r),i.model=u||(u===0?0:t);else return u}var i=this;i.getterSetter=r},scope:{}}}n.module("app").directive("integerInput",[i])}(angular),function(n){"use strict";function t(n){return{restrict:"E",transclude:!0,templateUrl:n.noInformationEnteredDirective.toString(),bindToController:{when:"&",message:"@"},controllerAs:"noInformationEntered",controller:function(){},scope:{}}}n.module("app").directive("noInformationEntered",["templateUrls",t])}(angular),function(n){"use strict";function t(n){return{restrict:"E",transclude:!0,templateUrl:n.noKnownInformationDirective.toString(),bindToController:{when:"&",canEdit:"<",edit:"&",hideEditButton:"@",message:"@",comment:"<"},controllerAs:"noKnownInformation",controller:function(){},scope:{}}}n.module("app").directive("noKnownInformation",["templateUrls",t])}(angular),function(n){"use string";function t(n,t){return{restrict:"E",transclude:!0,templateUrl:t.noKnownInformationEditDirective.toString(),bindToController:{noInformationEntered:"&",noKnownInformation:"&",comment:"=",noKnownInformationMessage:"@"},controllerAs:"ctrl",controller:function(){}}}n.module("app").directive("noKnownInformationEdit",["$log","templateUrls",t])}(angular),function(n){"use strict";function t(n){return{restrict:"E",replace:!1,templateUrl:n.sideBySideDirective.toString(),transclude:{left:"left",right:"?right"},bindToController:{original:"&",others:"&"},link:function(n,t,i,r,u){var o=t.find(".original-item"),e=t.find(".other-item"),f=function(n,t){return function(i,u){u.comparer=r;u.row=t;n.append(i)}};u(f(o,r.left),null,"left");u.isSlotFilled("right")?u(f(e,r.right),null,"right"):u(f(e,r.right),null,"left")},controllerAs:"comparer",controller:function(){function i(){return n.others()||[]}function u(){var n=i();return n.length>0}function f(){var n=i();return n.length>1}function r(){var n=i(),r=Math.max(0,n.length-1);return t=Math.min(t,r)}function e(){return n.original()}function o(){var n=i(),t=r();return n[t]||{}}function s(){return t>0}function h(){t=Math.max(0,--t)}function c(){var n=i();return t<n.length-1}function l(){var n=i(),r=Math.max(0,n.length-1);t=Math.min(r,++t)}var n=this,t=0;n.any=u;n.many=f;n.current=r;n.left=e;n.right=o;n.hasPrevious=s;n.previous=h;n.hasNext=c;n.next=l},scope:{}}}n.module("app").directive("sideBySide",["templateUrls",t])}(angular),function(n,t){"use strict";function i(n,i){function r(t){return function(){return{start:t.since()&&+t.since()||1875,end:t.to()&&+t.to()||n().year()}}}function u(n){return function(t){n.years=f(t.start,t.end,n.default||"")}}function f(n,i,r){for(var u=i,f=[{display:r,value:t}];u>=n;)f.push({display:""+u,value:u}),u--;return f}return{restrict:"E",replace:!1,transclude:!0,templateUrl:i.yearsInputDirective.toString(),bindToController:{model:"=",since:"&",to:"&","default":"@",disabled:"&",onChange:"&"},controllerAs:"years",controller:function(){},scope:{},link:function(n){n.$watch(r(n.years),u(n.years),!0)}}}n.module("app").directive("yearsInput",["moment","templateUrls",i])}(angular),function(n){"use strict";function t(){function r(n,i){return new t({field:n,operator:"DoesNotContain",value:i})}function u(n,i){return new t({field:n,operator:"DoesNotEndWith",value:i})}function f(n){return new t({field:n,operator:"DoesNotExist"})}function e(n,i){return new t({field:n,operator:"DoesNotStartWith",value:i})}function o(n,i){return new t({field:n,operator:"EndsWith",value:i})}function s(n){return new t({field:n,operator:"Exists"})}function h(n,i){return new t({field:n,operator:"EqualTo",value:i})}function c(n,i){return new t({field:n,operator:"NotEqualTo",value:i})}function l(n,i){return new t({field:n,operator:"GreaterThan",value:i})}function a(n,i){return new t({field:n,operator:"GreaterThanOrEqualTo",value:i})}function v(r,u){return u=n.isArray(u)?u:i.call(arguments,1),new t({field:r,operator:"IsNotIn",values:u})}function y(n,i){return new t({field:n,operator:"LessThan",value:i})}function p(n,i){return new t({field:n,operator:"LessThanOrEqualTo",value:i})}function w(n,i,r){return new t({field:n,operator:"Between",from:i,to:r})}function b(n,i){return new t({field:n,operator:"Contains",value:i})}function k(r,u){return u=n.isArray(u)?u:i.call(arguments,1),new t({field:r,operator:"IsIn",values:u})}function d(r,u){return u=n.isArray(u)?u:i.call(arguments,1),new t({field:r,operator:"DoesNotMatch",predicates:u})}function g(r,u){return u=n.isArray(u)?u:i.call(arguments,1),new t({field:r,operator:"Matches",predicates:u})}function nt(r){return r=n.isArray(r)?r:i.call(arguments),r=n.map(r,function(t){return n.isArray(t)?t:[t]}),new t({predicates:r})}function tt(r){return r=n.isArray(r)?r:i.call(arguments),r=[n.flatMap(r)],new t({predicates:r})}function it(n,i){return new t({field:n,operator:"StartsWith",value:i})}function rt(n,i,r,u){return new t({field:n,operator:"WithinMilesOf",distance:i,latitude:r,longitude:u})}function t(t){n.defaults(this,t)}var i=Array.prototype.slice;return{between:w,doesNotContain:r,doesNotEndWith:u,doesNotExist:f,doesNotStartWith:e,endsWith:o,exists:s,greaterThan:l,lessThan:y,contains:b,doesNotMatch:d,equalTo:h,greaterThanOrEqualTo:a,isIn:k,isNotIn:v,lessThanOrEqualTo:p,matches:g,notEqualTo:c,startsWith:it,or:nt,and:tt,withinMilesOf:rt}}angular.module("app").factory("searchPredicateFactory",[t])}(_),function(n){"use strict";function t(t){function r(n){return new i(n)}function i(r){function h(t){n.find(f.projections,function(n){return n===t})||f.projections.push(t)}function c(t){n.find(f.documentFragments,function(n){return n===t})||f.documentFragments.push(t)}function l(n){n&&f.predicates.push(n)}function d(n){n&&f.computedFields.push(n)}function o(n){n&&n.field&&n.direction&&f.orderSpecifications.push(new oi(n))}function g(){return f.orderSpecifications=[],u}function nt(){return f.predicates=[],u}function tt(){return f.documentFragments=[],u}function it(){return f.projections=[],u}function rt(){return f.computedFields=[],u}function ut(){return new i(a())}function a(){var t={predicates:n.cloneDeep(f.predicates),take:f.take,skip:f.skip,projections:f.projections.slice(),orderSpecifications:n.cloneDeep(f.orderSpecifications)};return f.documentFragments.length>0&&(t.documentFragments=f.documentFragments.slice()),f.computedFields.length>0&&(t.computedFields=n.cloneDeep(f.computedFields)),t}function v(t,i){var r=n.extend({},{field:t,direction:"Ascending"},i);return t&&o(r),u}function y(t,i){var r=n.extend({},{field:t,direction:"Descending"},i);return t&&o(r),u}function ft(n,t,i){return v(n,{latitude:t,longitude:i})}function et(n,t,i){return y(n,{latitude:t,longitude:i})}function s(t){var i;if(f={computedFields:[],projections:[],predicates:[],documentFragments:[],orderSpecifications:[],skip:0,take:u.defaultTakeValue},!t)return u;if(t.skip!=null&&b(t.skip),t.take!=null&&k(t.take),t.calculatedFields&&n.isArray(t.calculatedFields))for(i=0;i<t.calculatedFields.length;i++)addCalculatedField(t.calculatedFields[i]);if(t.projections&&p(t.projections),t.documentFragments&&w(t.documentFragments),t.predicates&&n.isArray(t.predicates))for(i=0;i<t.predicates.length;i++)l(t.predicates[i]);if(t.orderSpecifications&&n.isArray(t.orderSpecifications))for(i=0;i<t.orderSpecifications.length;i++)o(t.orderSpecifications[i]);return u}function p(t){return t&&(n.isArray(t)?n.forEach(t,h):n.forEach(arguments,h)),u}function w(t){return t&&(n.isArray(t)?n.forEach(t,c):c(t)),u}function ot(n,t,i,r,f){return d({Computation:"DistanceInMiles",Field:n,LatitudeField:t,LongitudeField:i,Latitude:r,Longitude:f}),u}function b(n){return f.skip=n,u}function k(n){return f.take=n,u}function e(n){return l(n),u}function st(n,i){return e(t.doesNotContain(n,i))}function ht(n,i){return e(t.doesNotEndWith(n,i))}function ct(n,i){return e(t.doesNotExist(n,i))}function lt(n,i){return e(t.doesNotStartWith(n,i))}function at(n,i){return e(t.endsWith(n,i))}function vt(n,i){return e(t.exists(n,i))}function yt(n,i){return e(t.equalTo(n,i))}function pt(n,i){return e(t.notEqualTo(n,i))}function wt(n,i){return e(t.greaterThan(n,i))}function bt(n,i){return e(t.greaterThanOrEqualTo(n,i))}function kt(n,i){return e(t.lessThan(n,i))}function dt(n,i){return e(t.lessThanOrEqualTo(n,i))}function gt(n,i,r){return e(t.between(n,i,r))}function ni(n,i){return e(t.contains(n,i))}function ti(n,i){return e(t.isIn(n,i))}function ii(n,i){return e(t.isNotIn(n,i))}function ri(n,i){return e(t.doesNotMatch(n,i))}function ui(n,i){return e(t.matches(n,i))}function fi(n,i){return e(t.startsWith(n,i))}function ei(n,i,r,u){return e(t.withinMilesOf(n,i,r,u))}function oi(t){n.defaults(this,t)}var u=this,f={};u.clear=function(){return s()};u.reset=s;u.clearOrderSpecifications=g;u.clearDocumentFragments=tt;u.clearPredicates=nt;u.clearProjections=it;u.clearComputedFields=rt;u.clone=ut;u.orderBy=v;u.orderByDescending=y;u.orderByDistanceFrom=ft;u.orderByDistanceFromDescending=et;u.select=p;u.selectDocumentFragment=w;u.selectDistanceInMilesFrom=ot;u.skip=b;u.take=k;u.where=e;u.getJson=a;u.whereDoesNotContain=st;u.whereDoesNotEndWith=ht;u.whereDoesNotExist=ct;u.whereDoesNotStartWith=lt;u.whereEndsWith=at;u.whereExists=vt;u.whereGreaterThan=wt;u.whereIsNotIn=ii;u.whereLessThan=kt;u.whereNotEqualTo=pt;u.whereStartsWith=fi;u.whereEqualTo=yt;u.whereGreaterThanOrEqualTo=bt;u.whereLessThanOrEqualTo=dt;u.whereBetween=gt;u.whereContains=ni;u.whereIsIn=ti;u.whereDoesNotMatch=ri;u.whereMatches=ui;u.whereWithinMilesOf=ei;Object.defineProperty(u,"projections",{get:function(){return f.projections}});Object.defineProperty(u,"predicates",{get:function(){return f.predicates}});Object.defineProperty(u,"orderSpecifications",{get:function(){return f.orderSpecifications}});Object.defineProperty(u,"skipValue",{get:function(){return f.skip}});Object.defineProperty(u,"defaultTakeValue",{get:function(){return 25}});Object.defineProperty(u,"takeValue",{get:function(){return f.take}});s(r)}return{query:r}}angular.module("app").factory("searchQueryBuilder",["searchPredicateFactory",t])}(_),function(n){"use strict";function t(t,i,r){function u(n,t,i){return new f(n,t,i)}function f(u,f,e){function k(){l=[];c=0}function d(){return o.href?t.post(o.href,h.getJson()).then(function(t){var i=n.isFunction(e)?e:function(n){return n};return l=n.map(t.data.results||t.data.Results||[],i),c=t.data.count||t.data.Count||0,s=h.takeValue,a=h.skipValue,y=w(),v=b(),l}).catch(function(){l=[];c=0;s=h.takeValue;a=h.skipValue;y=w();v=b()}):i.resolve()}function g(n,r){if(!n)return i.resolve();var u=h.getJson();return u.export=r||{},u.export.fileType="Csv",t.post(n,u)}function w(){return c==null||c<=0?1:s==null||s<=0?1:c<=p?Math.ceil(c/s):Math.ceil(p/s)}function b(){return s==null||s<=0?1:a==null||a<=0?1:parseInt(a/s)+1}var o=this,h,c=-1,l=null,a=0,v=-1,y=1,s=-1,p=1e4;h=f&&n.isFunction(f.getJson)?f:r.query(f);s=h.defaultTakeValue;o.href=u;Object.defineProperty(o,"query",{get:function(){return h}});Object.defineProperty(o,"results",{get:function(){return l}});Object.defineProperty(o,"resultCount",{get:function(){return c}});Object.defineProperty(o,"page",{get:function(){return v}});Object.defineProperty(o,"pageSize",{get:function(){return s}});Object.defineProperty(o,"pageCount",{get:function(){return y}});o.executeQuery=d;o.downloadCsv=g;o.clearResults=k}return{create:u}}angular.module("app").factory("searchDataServiceFactory",["dataContext","$q","searchQueryBuilder",t])}(_),function(n){"use strict";var t,r,i;t=function(n){Array.remove||(Array.prototype.remove=function(n,t){if(typeof n!="number"||typeof t!="number")return this;var i=this.slice((t||n)+1||this.length);return this.length=n<0?this.length+n:n,this.push.apply(this,i)});this.baseUri=n;this.OrderBySettings={Property:null,Order:null,DefaultProperty:null,DefaultOrder:null,toString:function(){var n="$orderby="+(this.Property||this.DefaultProperty);return(this.DefaultOrder!==null||this.Order!==null)&&(n+=" "+(this.Order||this.DefaultOrder)),n},reset:function(){this.Property=null;this.Order=null},isSet:function(){return this.Property!==null||this.DefaultProperty!==null}};this.TopSettings={Top:null,DefaultTop:null,toString:function(){return"$top="+(this.Top!==null?this.Top:this.DefaultTop)},reset:function(){this.Top=null},isSet:function(){return this.Top!==null||this.DefaultTop!==null}};this.SkipSettings={Skip:null,DefaultSkip:null,toString:function(){return"$skip="+(this.Skip!==null?this.Skip:this.DefaultSkip)},reset:function(){this.Skip=null},isSet:function(){return this.Skip!==null||this.DefaultSkip!==null}};this.SelectSettings={Select:null,DefaultSelect:null,toString:function(){var n=this.Select||this.DefaultSelect;return"$select="+n.join(",")},reset:function(){this.Select=null},isSet:function(){return this.Select!==null||this.DefaultSelect!==null}};this.ExpandSettings={Expand:null,DefaultExpand:null,toString:function(){return"$expand="+(this.Expand||this.DefaultExpand)},reset:function(){this.Expand=null},isSet:function(){return this.Expand!==null||this.DefaultExpand!==null}};this.FormatSettings={Format:null,DefaultFormat:null,toString:function(){return"$format="+(this.Format||this.DefaultFormat)},reset:function(){this.Format=null},isSet:function(){return this.Format!==null||this.DefaultFormat!==null}};this.InlineCountSettings={InlineCount:null,DefaultInlineCount:null,toString:function(){return"$inlinecount="+(this.InlineCount||this.DefaultInlineCount)},reset:function(){this.InlineCount=null},isSet:function(){return this.InlineCount!==null||this.DefaultInlineCount!==null}};this.FilterSettings={Filters:[],DefaultFilters:[],CapturedFilter:[],toString:function(){var t,n,i;if(t=[],i="$filter=",this.DefaultFilters.length>0)for(n=0;n<this.DefaultFilters.length;n++)t.push(this.DefaultFilters[n]);for(n=0;n<this.Filters.length;n++)t.push(this.Filters[n]);for(n=0;n<t.length;n++)i+=t[n].toString(n);return i},reset:function(){if(this.Filters=[],this.CapturedFilter.length>0)for(var n=0;n<this.CapturedFilter.length;n++)this.Filters.push(this.CapturedFilter[n])},fullReset:function(){this.Filters=[];this.CapturedFilter=[]},isSet:function(){return this.Filters.length>0||this.DefaultFilters.length>0},loadFromJson:function(n){var i,u,e,o,f;for(o=function(n){for(var e,u=new t.PrecedenceGroup,i=0;i<n.clauses.length;i++)e=n.clauses[i],u.clauses.push(new r(f(e.filterObj),e.logicalOperator));return u},f=function(n){if(n.clauses!==undefined)return o(n);var i;e=new t.FilterClause;for(i in n)n.hasOwnProperty(i)&&(e[i]=n[i]);return e},i=0;i<n.Filters.length;i++)u=n.Filters[i],this.Filters.push(new r(f(u.filterObj),u.logicalOperator));for(i=0;i<n.DefaultFilters.length;i++)u=n.DefaultFilters[i],this.DefaultFilters.push(new r(f(u.filterObj),u.logicalOperator))}}};t.prototype={baseUri:"",currentHashRoute:"",updateHashRoute:function(n){this.currentHashRoute=n},setOrderByDefault:function(n,t){return this.OrderBySettings.DefaultProperty=n,this.OrderBySettings.DefaultOrder=t===undefined?"desc":t,this},toggleOrderBy:function(n,t){var i=this.OrderBySettings.Property===null||this.OrderBySettings.Order==="asc";return this.orderBy(n)[i?"desc":"asc"](),t&&typeof t=="function"&&t.call(this),this},orderBy:function(n){return this.OrderBySettings.Property=n,this},desc:function(){return this.OrderBySettings.Order="desc",this},asc:function(){return this.OrderBySettings.Order="asc",this},resetOrderBy:function(){return this.OrderBySettings.reset(),this},setTopDefault:function(n){return this.TopSettings.DefaultTop=n,this},top:function(n){return this.TopSettings.Top=n,this},resetTop:function(){return this.TopSettings.reset(),this},setSkipDefault:function(n){return this.SkipSettings.DefaultSkip=n,this},skip:function(n){return this.SkipSettings.Skip=n,this},resetSkip:function(){return this.SkipSettings.reset(),this},setSelectDefault:function(n){return this.SelectSettings.DefaultSelect=n,this},select:function(n){return this.SelectSettings.Select=n,this},resetSelect:function(){return this.SelectSettings.reset(),this},setExpandDefault:function(n){return this.ExpandSettings.DefaultExpand=n,this},expand:function(n){return this.ExpandSettings.Expand=n,this},resetExpand:function(){this.ExpandSettings.reset()},formatDefault:function(){var n=this;return this.atom=function(){return n.FormatSettings.DefaultFormat="atom",n},this.xml=function(){return n.FormatSettings.DefaultFormat="xml",n},this.json=function(){return n.FormatSettings.DefaultFormat="json",n},this.custom=function(t){return n.FormatSettings.DefaultFormat=t,n},n},format:function(){var n=this;return this.atom=function(){return n.FormatSettings.Format="atom",n},this.xml=function(){return n.FormatSettings.Format="xml",n},this.json=function(){return n.FormatSettings.Format="json",n},this.custom=function(t){return n.FormatSettings.Format=t,n},this},resetFormat:function(){this.FormatSettings.reset()},inlineCountDefault:function(){var n=this;return this.allPages=function(){return n.InlineCountSettings.DefaultInlineCount="allpages",n},this.none=function(){return n.InlineCountSettings.DefaultInlineCount="none",n},this},inlineCount:function(){var n=this;return this.allPages=function(){return n.InlineCountSettings.InlineCount="allpages",n},this.none=function(){return n.InlineCountSettings.InlineCount="none",n},this},resetInlineCount:function(){return this.InlineCountSettings.reset(),this},captureFilter:function(){this.FilterSettings.CapturedFilter=[];for(var n=0;n<this.FilterSettings.Filters.length;n++)this.FilterSettings.CapturedFilter.push(this.FilterSettings.Filters[n])},resetFilter:function(){return this.FilterSettings.fullReset(),this},resetToCapturedFilter:function(){return this.FilterSettings.reset(),this},removeFilter:function(n){var t;if(!this.FilterSettings.isSet())return this;for(t=0;t<this.FilterSettings.Filters.length;t++)this.FilterSettings.Filters[t].filterObj.Property===n&&this.FilterSettings.Filters.splice(t,1);return this},defaultFilter:function(n){return this.FilterSettings.DefaultFilters.push(new r(n)),this},defaultAndFilter:function(n){return this.FilterSettings.DefaultFilters.push(new r(n,"and")),this},defaultOrFilter:function(n){return this.FilterSettings.DefaultFilters.push(new r(n,"or")),this},filter:function(n){return this.FilterSettings.Filters.push(new r(n)),this},andFilter:function(n){return this.FilterSettings.Filters.push(new r(n,"and")),this},orFilter:function(n){return this.FilterSettings.Filters.push(new r(n,"or")),this},toString:function(){var t,n;return t=this.baseUri,n=[],this.OrderBySettings.isSet()&&n.push(this.OrderBySettings.toString()),this.TopSettings.isSet()&&n.push(this.TopSettings.toString()),this.SkipSettings.isSet()&&n.push(this.SkipSettings.toString()),this.SelectSettings.isSet()&&n.push(this.SelectSettings.toString()),this.FilterSettings.isSet()&&n.push(this.FilterSettings.toString()),this.ExpandSettings.isSet()&&n.push(this.ExpandSettings.toString()),this.FormatSettings.isSet()&&n.push(this.FormatSettings.toString()),this.InlineCountSettings.isSet()&&n.push(this.InlineCountSettings.toString()),n.length>0?t+"?"+n.join("&"):t},toJson:function(){var n={};return n.baseUri=this.baseUri,n.currentHashRoute=this.currentHashRoute,n.OrderBySettings=null,n.TopSettings=null,n.SkipSettings=null,n.SelectSettings=null,n.ExpandSettings=null,n.FormatSettings=null,n.InlineCountSettings=null,n.FilterSettings=null,n.defaults=this.defaults,this.OrderBySettings.isSet()&&(n.OrderBySettings=this.OrderBySettings),this.TopSettings.isSet()&&(n.TopSettings=this.TopSettings),this.SkipSettings.isSet()&&(n.SkipSettings=this.SkipSettings),this.SelectSettings.isSet()&&(n.SelectSettings=this.SelectSettings),this.ExpandSettings.isSet()&&(n.ExpandSettings=this.ExpandSettings),this.FormatSettings.isSet()&&(n.FormatSettings=this.FormatSettings),this.InlineCountSettings.isSet()&&(n.InlineCountSettings=this.InlineCountSettings),this.FilterSettings.isSet()&&(n.FilterSettings=this.FilterSettings),JSON.stringify(n)},saveLocal:function(n){var t,i;t=this.toJson();i=n||"joData.StorageKey";localStorage.setItem(i,t)}};t.loadLocal=function(n){var e,f,i,u,r;if(e=n||"joData.StorageKey",f=localStorage.getItem(e),f===null)return console.log("Nothing was found in localStorage"),null;if(i=JSON.parse(f),u=new t(i.baseUri),u.currentHashRoute=i.currentHashRoute,i.OrderBySettings!==null)for(r in i.OrderBySettings)i.OrderBySettings.hasOwnProperty(r)&&(u.OrderBySettings[r]=i.OrderBySettings[r]);if(i.TopSettings!==null)for(r in i.TopSettings)i.TopSettings.hasOwnProperty(r)&&(u.TopSettings[r]=i.TopSettings[r]);if(i.SkipSettings!==null)for(r in i.SkipSettings)i.SkipSettings.hasOwnProperty(r)&&(u.SkipSettings[r]=i.SkipSettings[r]);if(i.SelectSettings!==null)for(r in i.SelectSettings)i.SelectSettings.hasOwnProperty(r)&&(u.SelectSettings[r]=i.SelectSettings[r]);if(i.ExpandSettings!==null)for(r in i.ExpandSettings)i.ExpandSettings.hasOwnProperty(r)&&(u.ExpandSettings[r]=i.ExpandSettings[r]);if(i.FormatSettings!==null)for(r in i.FormatSettings)i.FormatSettings.hasOwnProperty(r)&&(u.FormatSettings[r]=i.FormatSettings[r]);if(i.InlineCountSettings!==null)for(r in i.InlineCountSettings)i.InlineCountSettings.hasOwnProperty(r)&&(u.InlineCountSettings[r]=i.InlineCountSettings[r]);return i.FilterSettings!==null&&u.FilterSettings.loadFromJson(i.FilterSettings),u};r=function(n,t){return this.filterObj=n,this.logicalOperator=null,t!==undefined&&t!==null&&(this.logicalOperator=t),this};r.prototype={filterObj:null,logicalOperator:null,toString:function(n){var t="";return this.logicalOperator!==null&&n>0?t+=" "+this.logicalOperator+" ":n>0&&this.logicalOperator===null&&(t+=" and "),t+this.filterObj.toString()}};t.PrecedenceGroup=function(n){if(!(n instanceof t.FilterClause))throw"filterClause must be of type jo.FilterClause!";return this.clauses=[],n!==undefined&&this.clauses.push(new r(n)),this};t.PrecedenceGroup.prototype={clauses:[],isEmpty:function(){return this.clauses.length===0},andFilter:function(n){if(!(n instanceof t.FilterClause))throw"filterClause must be of type jo.FilterClause!";return this.clauses.push(new r(n,"and")),this},orFilter:function(n){if(!(n instanceof t.FilterClause))throw"filterClause must be of type jo.FilterClause!";return this.clauses.push(new r(n,"or")),this},toString:function(){for(var t="(",n=0;n<this.clauses.length;n++)t+=this.clauses[n].toString(n);return t+")"}};t.literal=function(n){return"'"+n.toString()+"'"};t.datetime=function(n){return"datetime'"+n+"'"};t.decimal=function(n){return n+"m"};t.guid=function(n){return"guid'"+n+"'"};t.single=function(n){return n+"f"};t.double=function(n){return n+"d"};t.Concat=function(n,t){return this.LeftSide=n,this.RightSide=t,this};t.Concat.prototype={LeftSide:null,RightSide:null,toString:function(){function n(n){return typeof n=="object"?n.toString():typeof n=="function"?n.call(t):n.toString()}var t=this;return"concat("+n(this.LeftSide)+","+n(this.RightSide)+")"}};t.FilterClause=function(n){return this.Property=n,this.Components=[],this};t.FilterClause.prototype={Property:null,Value:null,IsClauseEmpty:!0,PropertyIncluded:!1,UsingNot:!1,FuncReturnType:null,transformFunc:null,Components:[],toString:function(){var n,t,i;for(n=[],this.PropertyIncluded||n.push(this.Property),t=0;t<this.Components.length;t++)n.push(this.Components[t]);return(i=n.join(" "),!this.UsingNot)?i:typeof this.FuncReturnType=="boolean"?"not "+i:"not ("+i+")"},isEmpty:function(){return this.IsClauseEmpty||this.PropertyIncluded&&this.UsingNot},add:function(n){return i.addArithmeticOperator(n,"add",this)},sub:function(n){return i.addArithmeticOperator(n,"sub",this)},mul:function(n){return i.addArithmeticOperator(n,"mul",this)},div:function(n){return i.addArithmeticOperator(n,"div",this)},mod:function(n){return i.addArithmeticOperator(n,"mod",this)},eq:function(n){return i.addLogicalOperator(n,"eq",this)},ne:function(n){return i.addLogicalOperator(n,"ne",this)},gt:function(n){return i.addLogicalOperator(n,"gt",this)},ge:function(n){return i.addLogicalOperator(n,"ge",this)},lt:function(n){return i.addLogicalOperator(n,"lt",this)},le:function(n){return i.addLogicalOperator(n,"le",this)},not:function(){return this.UsingNot=!0,this},substringof:function(n){this.PropertyIncluded=!0;this.FuncReturnType=Boolean();var i=this,t=this.Property;return this.transformFunc!==null&&(t=this.Components[this.Components.length-1],this.Components.splice(this.Components.length-1,1)),this.Components.push("substringof('"+n+"',"+t+")"),this},endswith:function(n){this.PropertyIncluded=!0;this.FuncReturnType=Boolean();var t=this;return this.Components.push("endswith("+t.Property+",'"+n+"')"),this},startswith:function(n){this.PropertyIncluded=!0;this.FuncReturnType=Boolean();var t=this;return this.Components.push("startswith("+t.Property+",'"+n+"')"),this},length:function(){this.PropertyIncluded=!0;this.FuncReturnType=Number();var n=this;return this.Components.push("length("+n.Property+")"),this},indexof:function(n){this.PropertyIncluded=!0;this.FuncReturnType=Number();var t=this;return this.Components.push("indexof("+t.Property+",'"+n+"')"),this},replace:function(n,t){this.PropertyIncluded=!0;this.FuncReturnType=String();var i=this;return this.Components.push("replace("+i.Property+",'"+n+"','"+t+"')"),this},substring:function(n,t){this.PropertyIncluded=!0;this.FuncReturnType=String();var i=[this.Property,n];return t!==undefined&&i.push(t),this.Components.push("substring("+i.join(",")+")"),this},toLower:function(){this.PropertyIncluded=!0;this.FuncReturnType=String();var n=this;return this.transformFunc=this.toLower,this.Components.push("tolower("+n.Property+")"),this},toUpper:function(){this.PropertyIncluded=!0;this.FuncReturnType=String();var n=this;return this.transformFunc=this.toUpper,this.Components.push("toupper("+n.Property+")"),this},trim:function(){this.PropertyIncluded=!0;this.FuncReturnType=String();var n=this;return this.transformFunc=this.trim,this.Components.push("trim("+n.Property+")"),this},Concat:function(n){this.PropertyIncluded=!0;this.FuncReturnType=String();var t=this;return t.Components.push(n.toString()),this},day:function(){return i.addMethodWrapper(this,"day")},hour:function(){return i.addMethodWrapper(this,"hour")},minute:function(){return i.addMethodWrapper(this,"minute")},month:function(){return i.addMethodWrapper(this,"month")},second:function(){return i.addMethodWrapper(this,"second")},year:function(){return i.addMethodWrapper(this,"year")},round:function(){return i.addMethodWrapper(this,"round")},floor:function(){return i.addMethodWrapper(this,"floor")},ceiling:function(){return i.addMethodWrapper(this,"ceiling")}};i={formatValue:function(n){var i,t,r,u;if(n.length>8&&n.substring(0,8)==="datetime"||n.length>4&&n.substring(0,4)==="guid")return n;if(typeof n=="string"){for(i=["m","f","d"],t=0;t<i.length;t++)if(r=i[t],n.indexOf(r,n.length-r.length)!==-1&&(u=n.substring(0,n.length-1),!isNaN(u)))return n;return"'"+n+"'"}return n},addLogicalOperator:function(n,t,i){return i.Value=n,i.IsClauseEmpty=!1,i.Components.push(t+" "+this.formatValue(n)),i},addArithmeticOperator:function(n,t,i){return i.Components.push(t+" "+n),i},addMethodWrapper:function(n,t){n.PropertyIncluded=!0;n.FuncReturnType=Number();var i=n;return n.Components.push(t+"("+i.Property+")"),n}};n.jo=t;n.jo.FilterObj=r}(window),function(n){"use strict";function t(t,i,r){function u(n,t){return new f(n,t)}function f(u,f){function p(){c=[];h=0}function w(){return e.href?t.get(e.href.concat("?$inlinecount=allpages&",s.getQueryString())).then(function(n){return c=n.data.results||n.data.Results||[],h=n.data.count||n.data.Count||0,o=s.takeValue,l=s.skipValue,v=k(),a=d(),c}):i.resolve()}function b(n,r){var u;return n?(u={},u.export=r||{},u.export.fileType="Csv",t.post(n.concat("?$inlinecount=allpages&",s.getQueryString()),u)):i.resolve()}function k(){return h==null||h<=0?1:o==null||o<=0?1:h<=y?Math.ceil(h/o):Math.ceil(y/o)}function d(){return o==null||o<=0?1:l==null||l<=0?1:parseInt(l/o)+1}var e=this,s,h=-1,c=null,l=0,a=-1,v=1,o=-1,y=1e4;s=f&&n.isFunction(f.getJson)?f:r.query(f);o=s.defaultTakeValue;e.href=u;Object.defineProperty(e,"query",{get:function(){return s}});Object.defineProperty(e,"results",{get:function(){return c}});Object.defineProperty(e,"resultCount",{get:function(){return h}});Object.defineProperty(e,"page",{get:function(){return a}});Object.defineProperty(e,"pageSize",{get:function(){return o}});Object.defineProperty(e,"pageCount",{get:function(){return v}});e.executeQuery=w;e.clearResults=p;e.downloadCsv=b}return{create:u}}angular.module("app").factory("odataServiceFactory",["dataContext","$q","odataQueryBuilder",t])}(_),function(n,t,i){"use strict";function r(){function e(n,i){return new t.FilterClause(n).eq(r(i))}function u(n,i){return new t.FilterClause(n).not().eq(r(i))}function s(n,i){return new t.FilterClause(n).not().substringof(r(i))}function h(n,i){return new t.FilterClause(n).not().endswith(r(i))}function c(n,i){return new t.FilterClause(n).not().startswith(r(i))}function l(n,i){return new t.FilterClause(n).endswith(r(i))}function a(n,i){return new t.FilterClause(n).gt(r(i))}function v(n,i){return new t.FilterClause(n).ge(r(i))}function y(n,i){return new t.FilterClause(n).lt(r(i))}function p(n,i){return new t.FilterClause(n).le(r(i))}function o(n,i){return new t.FilterClause(n).substringof(r(i))}function w(n,i){return new t.FilterClause(n).startswith(r(i))}function f(i){var u,r;if(i=n.isArray(i)?i:[i],i.length==1)return i;for(u=new t.PrecedenceGroup(i[0]),r=1;r<i.length;r++)u.orFilter(i[r]);return u}function b(t,i){var u=[],r;for(i=n.isArray(i)?i:[i],r=0;r<i.length;r++)u.push(e(t,i[r]));return f(u)}function k(i,r){var e,f;if(r=n.isArray(r)?r:[r],r.length===1)return u(i,r[0]);for(e=new t.PrecedenceGroup(u(i,r[0])),f=1;f<r.length;f++)e.andFilter(u(i,r[f]));return e}function d(t,i){var u=[],r;for(i=n.isArray(i)?i:[i],r=0;r<i.length;r++)u.push(o(t,i[r]));return f(u)}function r(n){return i.isDate(n)?t.datetime(n.toJSON()):i.isMoment(n)?t.datetime(n.toJSON()):typeof n=="string"?n.replace("'","''"):n}return{doesNotContain:s,doesNotEndWith:h,doesNotStartWith:c,endsWith:l,greaterThan:a,lessThan:y,contains:o,containsAny:d,equalTo:e,greaterThanOrEqualTo:v,lessThanOrEqualTo:p,notEqualTo:u,startsWith:w,or:f,isIn:b,isNotIn:k}}angular.module("app").factory("odataPredicateFactory",[r])}(_,jo,moment),function(n,t){"use strict";function i(i){function u(n){return new r(n)}function r(u){function l(t){n.find(e.projections,function(n){return n===t})||e.projections.push(t)}function s(n){n&&e.predicates.push(n)}function h(n){n&&n.field&&n.direction&&e.orderSpecifications.push(new kt(n))}function w(){return e.orderSpecifications=[],f}function b(){return e.predicates=[],f}function k(){return e.projections=[],f}function d(){return new r(a())}function a(){return{predicates:n.cloneDeep(e.predicates),take:e.take,skip:e.skip,projections:e.projections.slice(),orderSpecifications:n.cloneDeep(e.orderSpecifications)}}function g(){var i=new t,u=null,r,f;return e.predicates&&e.predicates.length&&n.forEach(e.predicates,function(n){i.filter(n)}),i.skip(e.skip),i.top(e.take),i.select(e.projections),e.orderSpecifications&&e.orderSpecifications.length&&(u=n(e.orderSpecifications).map(function(n){return n.direction==="Ascending"?"".concat(n.field," ","asc"):"".concat(n.field," ","desc")}).join(","),i.orderBy(u)),r=i.toString(),f=r.indexOf("?"),r.substring(f+1)}function nt(t,i){var r=n.extend({},{field:t,direction:"Ascending"},i);return t&&h(r),f}function tt(t,i){var r=n.extend({},{field:t,direction:"Descending"},i);return t&&h(r),f}function c(t){var i;if(e={computedFields:[],projections:[],predicates:[],documentFragments:[],orderSpecifications:[],skip:0,take:f.defaultTakeValue},!t)return f;if(t.skip!=null&&y(t.skip),t.take!=null&&p(t.take),t.projections&&v(t.projections),t.predicates&&n.isArray(t.predicates))for(i=0;i<t.predicates.length;i++)s(t.predicates[i]);if(t.orderSpecifications&&n.isArray(t.orderSpecifications))for(i=0;i<t.orderSpecifications.length;i++)h(t.orderSpecifications[i]);return f}function v(t){return t&&(n.isArray(t)?n.forEach(t,l):n.forEach(arguments,l)),f}function y(n){return e.skip=n,f}function p(n){return e.take=n,f}function o(t){return n.isArray(t)?n.forEach(t,s):s(t),f}function it(n,t){return o(i.doesNotContain(n,t))}function rt(n,t){return o(i.doesNotEndWith(n,t))}function ut(n,t){return o(i.doesNotStartWith(n,t))}function ft(n,t){return o(i.endsWith(n,t))}function et(n,t){return o(i.equalTo(n,t))}function ot(n,t){return o(i.notEqualTo(n,t))}function st(n,t){return o(i.greaterThan(n,t))}function ht(n,t){return o(i.greaterThanOrEqualTo(n,t))}function ct(n,t){return o(i.lessThan(n,t))}function lt(n,t){return o(i.lessThanOrEqualTo(n,t))}function at(n,t){return o(i.contains(n,t))}function vt(n,t){return o(i.containsAny(n,t))}function yt(t,r){var u=[];return n.forEach(t,function(n){u.push(i.contains(n,r))}),o(i.or(u))}function pt(n,t){return o(i.startsWith(n,t))}function wt(n,t){return o(i.isIn(n,t))}function bt(n,t){return o(i.isNotIn(n,t))}function kt(t){n.defaults(this,t)}var f=this,e={};f.clear=function(){return c()};f.reset=c;f.clearOrderSpecifications=w;f.clearPredicates=b;f.clearProjections=k;f.clone=d;f.orderBy=nt;f.orderByDescending=tt;f.select=v;f.skip=y;f.take=p;f.where=o;f.getJson=a;f.getQueryString=g;f.whereDoesNotContain=it;f.whereDoesNotEndWith=rt;f.whereDoesNotStartWith=ut;f.whereEndsWith=ft;f.whereGreaterThan=st;f.whereLessThan=ct;f.whereNotEqualTo=ot;f.whereStartsWith=pt;f.whereEqualTo=et;f.whereGreaterThanOrEqualTo=ht;f.whereLessThanOrEqualTo=lt;f.whereContains=at;f.whereContainsAny=vt;f.whereAnyContains=yt;f.whereIsIn=wt;f.whereIsNotIn=bt;Object.defineProperty(f,"projections",{get:function(){return e.projections}});Object.defineProperty(f,"predicates",{get:function(){return e.predicates}});Object.defineProperty(f,"orderSpecifications",{get:function(){return e.orderSpecifications}});Object.defineProperty(f,"skipValue",{get:function(){return e.skip}});Object.defineProperty(f,"defaultTakeValue",{get:function(){return 25}});Object.defineProperty(f,"takeValue",{get:function(){return e.take}});c(u)}return{query:u}}angular.module("app").factory("odataQueryBuilder",["odataPredicateFactory",i])}(_,jo),function(n){"use strict";function t(t,i,r,u,f,e){function s(){var t=r.isCurrentUserPublic();return n.isDefined(o.href)&&!t&&o.grantPermissionToPublish&&!r.isCurrentUserNamUsPersonnel()&&o.status.name===f.caseLifecycleStatus.Pending}function h(){s()&&i.show({small:!0,templateUrl:u.permissionToPublish.toString(),data:{},onResult:function(){t.post(o.href).then(function(){e.reload()})}})}var o=this;o.disableButton=o.disable;o.showPermissionToPublish=s;o.permissionToPublish=h}n.module("app").component("permissionToPublish",{controller:["$http","namusModal","identity","templateUrls","appConstants","CaseService",t],controllerAs:"data",templateUrl:["templateUrls",function(n){return n.permissionToPublishComponent.toString()}],bindings:{href:"=",status:"=",disable:"=",grantPermissionToPublish:"="}})}(angular,_),function(n){"use strict";function t(n,t,i,r){return{restrict:"E",replace:!0,templateUrl:i.militaryAssociation.toString(),bindToController:{model:"=",clearErrorMessage:"&"},controllerAs:"vm",controller:function(){function i(){return n.branch?!0:!1}function u(){n.branches=null}function f(){if(_.isNil(n.model.militaryBranches)&&(n.model.militaryBranches=[]),n.branch&&n.model.militaryBranches){var t={branchId:n.branch.id,branchName:n.branch.localizedName,serviceDescription:n.serviceDescription};n.model.militaryBranches.push(t);n.clearErrorMessage()}n.branch=null;n.serviceDescription=null}function e(t){var i=_.remove(n.model.militaryBranches,function(n){return n!==t});n.model.militaryBranches=i}function o(n){return n}function s(n){return n?n.serviceDescription?"".concat(n.branchName,": ",n.serviceDescription):n.branchName:null}var n=this;n.addBranch=f;n.deleteBranch=e;n.clearBranches=u;n.getBranchAssociationDetail=o;n.getMilitaryServiceDescription=s;n.showAdd=i;t.get(r.militaryBranches).then(function(t){n.branches=t.data})},scope:{}}}n.module("app").directive("militaryAssociation",["$q","$http","templateUrls","hrefs","localized",t])}(angular),function(n){"use strict";function t(){function t(){return n.searchDataService&&n.searchDataService.resultCount>1e4}var n=this;n.showWarning=t}n.module("app").component("searchResultsMaxResultWindowWarning",{controller:[t],controllerAs:"vm",templateUrl:["templateUrls",function(n){return n.searchResultsMaxResultWindowWarning.toString()}],bindings:{searchDataService:"<"}})}(angular,_),function(n,t,i){"use strict";function r(n,r){function a(){return f()===1}function v(){return f()===e()}function f(){if(!u.searchDataService)return 1;var n=u.searchDataService.page;return n>u.searchDataService.pageCount&&(n=u.searchDataService.pageCount),n<1?1:n}function e(){return u.searchDataService?u.searchDataService.pageCount:1}function y(){return c()?o(f()+1):n.resolve()}function p(){return h()?o(f()-1):n.resolve()}function s(){return o(1)}function w(){return o(e())}function o(n){if(u.searchDataService)return r.isNumeric(n)||(n=0),n=n>e()?e()-1:n-1,n<=0&&(n=0),u.searchDataService.query.skip(u.searchDataService.pageSize*n),u.searchDataService.executeQuery().then(function(n){var t=u.searchDataService.query.getJson();r.addCurrentToLocalStorage(n,u.searchDataService.href,u.searchDataService.pageCount,t);u.doNotScrollOnPageChange!==!0&&i("body").animate({scrollTop:0},"slow")})}function h(){return f()>1}function c(){return f()<e()}function l(t){return u.searchDataService?(u.searchDataService.query.take(t),t>u.searchDataService.resultCount?s():u.searchDataService.executeQuery().then(function(n){var t=u.searchDataService.query.getJson();r.addCurrentToLocalStorage(n,u.searchDataService.href,u.searchDataService.pageCount,t)})):n.resolve()}function b(){return u.searchDataService?u.searchDataService.query.takeValue:25}function k(){return t.range(1,e()+1)}var u=this;u.pageSizeOptions=u.pageSizeOptions||[25,50,75,100];u.atFirstPage=a;u.atLastPage=v;u.goToNextPage=y;u.goToPreviousPage=p;u.goToFirstPage=s;u.goToLastPage=w;u.goToPage=o;u.hasPreviousPage=h;u.hasNextPage=c;u.setPageSize=l;Object.defineProperty(u,"page",{get:f,set:o});Object.defineProperty(u,"pageCount",{get:e});Object.defineProperty(u,"pageSize",{get:b,set:l});Object.defineProperty(u,"pages",{get:k})}n.module("app").component("searchResultsPager",{controller:["$q","appUtility","localStorageService",r],controllerAs:"vm",template:'<ng-include src="vm.templateUrl"><\/ng-include>',bindings:{searchDataService:"<",pageSizeOptions:"<",templateUrl:"<",doNotScrollOnPageChange:"<"}})}(angular,_,$),function(n){"use strict";function t(){var n=this;Object.defineProperty(n,"records",{get:function(){return n.searchDataService==null?[]:n.searchDataService.results}});n.onRowDataBinding=function(t){return n.onRowDataBind({row:t})||t};n.onComparandDataBinding=function(t){return n.onComparandDataBind({row:t})||t}}n.module("app").component("searchResultsComparer",{controller:[t],controllerAs:"vm",templateUrl:["templateUrls",function(n){return n.searchResultsComparer.toString()}],bindings:{searchDataService:"<",comparand:"<",comparandTemplate:"<",rowTemplate:"<",onRowDataBind:"&",onComparandDataBind:"&"}})}(angular,_),function(n){"use strict";function t(){function r(){if(!n.searchDataService)return 0;var t=n.searchDataService.page;return t<1?1:t}function f(){return n.searchDataService?n.searchDataService.pageCount:0}function i(){return n.searchDataService?n.searchDataService.query.takeValue:0}function u(){var n=(r()-1)*i()+1;return n>t()&&(n=t()),n}function e(){var n=u()+i()-1;return n>t()&&(n=t()),n}function t(){return n.searchDataService?n.searchDataService.resultCount:0}var n=this;Object.defineProperty(n,"page",{get:r});Object.defineProperty(n,"pageCount",{get:f});Object.defineProperty(n,"pageSize",{get:i});Object.defineProperty(n,"startingRecordNumber",{get:u});Object.defineProperty(n,"endingRecordNumber",{get:e});Object.defineProperty(n,"recordCount",{get:t})}n.module("app").component("searchResultsSummary",{controller:[t],controllerAs:"vm",template:'<ng-include src="vm.templateUrl"><\/ng-include>',bindings:{searchDataService:"<",templateUrl:"<"}})}(angular,_),function(n,t){"use strict";function i(n,i){function l(){return r.searchDataService?r.searchDataService.query.orderSpecifications:""}function a(){var n=r.selected||[];return t.isArray(n)?n:[n]}function v(n){return n.ascendingLabel}function y(n){return n.descendingLabel}function p(n){n.sortDirection=u.ascending;e()}function w(n){n.sortDirection=u.descending;e()}function h(n){return t(n||[]).filter(function(n){return n.name!=null}).uniqBy(function(n){return n.name}).map(function(n){return new b(n)}).orderBy(function(n){return n.label}).value()}function e(){r.searchDataService&&(r.searchDataService.query.clearOrderSpecifications(),t.forEach(r.selectedOptions,function(n){n&&n.sortDirection===u.ascending?r.searchDataService.query.orderBy(n.name,n.args):n&&r.searchDataService.query.orderByDescending(n.name,n.args)}),r.searchDataService.executeQuery().then(function(n){var t=r.searchDataService.query.getJson();i.addCurrentToLocalStorage(n,r.searchDataService.href,r.searchDataService.pageCount,t)}))}function c(){var n=[];r.searchDataService&&(t.forEach(r.searchDataService.query.orderSpecifications,function(i){var u=t(r.sortColumnDefinitions).filter(function(n){return n.name===i.field}).head();u!=null&&(u.sortDirection=i.direction,n.push(u))}),f=n.length===1?n[0]:n)}function b(n){return n=n||{},{name:n.name,label:n.label||n.name,args:n.args,ascendingLabel:n.ascendingLabel,descendingLabel:n.descendingLabel,sortDirection:u.ascending}}var r=this,u={ascending:"Ascending",descending:"Descending"},f,o=h(r.sortColumnDefinitions),s=!0;r.sortDirections=u;Object.defineProperty(r,"selected",{get:function(){return f},set:function(n){s?(c(),s=!1):(f=n,e())}});Object.defineProperty(r,"selectedOptions",{get:a});Object.defineProperty(r,"sortColumnDefinitions",{get:function(){return o},set:function(n){o=h(n)}});r.selected=[];r.options=[];r.getAscendingLabel=v;r.getDescendingLabel=y;r.setAscending=p;r.setDescending=w;n.$watch(l,c,!0)}n.module("app").component("searchResultsDropdownSorter",{controller:["$scope","appUtility",i],controllerAs:"vm",templateUrl:["templateUrls",function(n){return n.searchResultsDropdownSorter.toString()}],bindings:{searchDataService:"<",sortColumnDefinitions:"<"}})}(angular,_),function(n,t,i){"use strict";function r(r,u,f,e,o,s,h){function k(){return c.searchDataService?{gridColumnDefinitions:c.gridColumnDefinitions,results:c.searchDataService.results}:{gridColumnDefinitions:c.gridColumnDefinitions}}function d(){if(c.grid){if(!t.isEqual(l,c.gridColumnDefinitions)){l=n.copy(c.gridColumnDefinitions);var i=g(c.grid.gridOptions.columnDefs,l);c.grid.gridOptions.columnDefs=i;c.grid.gridApi&&c.grid.gridApi.grid&&c.grid.gridApi.grid.refresh()}}else l=n.copy(c.gridColumnDefinitions),c.grid=nt(l);c.searchDataService&&(c.grid.gridOptions.totalItems=c.searchDataService.resultCount,c.grid.gridOptions.data=c.searchDataService.results||[{}],c.hasBeenInitialized=!0)}function g(n,i){var r=[];return t.forEach(i,function(i){var u=t.filter(n,function(n){return n.field==i.field});r.push(t.extend({},u,i))}),r}function nt(n){var o=c.gridOptions||{},s,l=0,i=ft(n);return c.searchDataService&&c.searchDataService.query.orderSpecifications.length>0&&t.forEach(c.searchDataService.query.orderSpecifications,function(n){s=t(i).filter(function(t){return t.field===n.field}).head();s&&(s.sort={direction:n.direction==="Ascending"?e.ASC:e.DESC,priority:l++})}),u.buildGrid({enableMultiSort:o.enableMultiSort==null?!1:o.enableMultiSort,enableColumnMenus:!1,showHeader:o.showHeader,rowHeight:o.rowHeight,enableGridMenu:o.enableGridMenu==null?!0:o.enableGridMenu,enablePagination:!1,enablePaginationControls:!1,rowTemplate:o.rowTemplate||f.rowTemplate,columns:i,currentPage:1,pageSize:o.initialPageSize==null?25:o.initialPageSize,onGridRowClick:it,rowsProcessor:ut,initializeState:function(){},onColumnVisibilityChanged:function(n){if(n){var r=t.filter(i,function(t){return t.field==n.field});r&&(r.visible=n.visible,p(i))}},onSortChanged:function(n){c.searchDataService.query.clearOrderSpecifications();t.forEach(n,function(n){switch(n.direction){case"asc":c.searchDataService.query.orderBy(n.sortField||n.columns&&t.head(n.columns)||n.field,n.args);break;case"desc":c.searchDataService.query.orderByDescending(n.sortField||n.columns&&t.head(n.columns)||n.field,n.args)}});c.searchDataService.executeQuery().then(function(n){var t=c.searchDataService.query.getJson();h.addCurrentToLocalStorage(n,c.searchDataService.href,c.searchDataService.pageCount,t)})},onPaginationChanged:function(n,t){var i=(n-1)*t,r=t;c.searchDataService.query.skip(i).take(r);c.searchDataService.executeQuery()},onColumnOrderChanged:function(n,t,r){var u,f;if(t>r)for(u=t;u>r;u--)i[u]=i[u-1];else if(r>t)for(f=t;f<r;f++)i[f]=i[f+1];i[r]=n;p(i)},onRegisterApi:function(){r.$watch(tt,rt,!0)}})}function tt(){return c.searchDataService?c.searchDataService.query.orderSpecifications:""}function it(n,i){if(t.isFunction(c.onRowClick))c.onRowClick({row:n.entity,index:i})}function rt(){c.searchDataService&&c.grid&&c.grid.gridApi&&c.grid.gridApi.grid&&(t.forEach(c.grid.gridApi.grid.columns,function(n){n.sort={}}),t.forEach(c.searchDataService.query.orderSpecifications,function(n,i){var r=t(c.grid.gridApi.grid.columns).filter(function(t){return n.field===(t.colDef.sortField||t.field)}).head(),u;r!=null&&(u=t(c.grid.gridApi.grid.columns).filter(function(n){return(n.colDef.sortField||n.field)===(r.colDef.sortField||r.field)}).head(),u!=null&&(u.sort={direction:n.direction==="Ascending"?e.ASC:e.DESC,priority:i}))}))}function ut(n){return t.forEach(n,function(n){return n.entity=c.onRowDataBind({row:n.entity})||n.entity,n})}function y(){return{columns:[]}}function ft(i){var r,u,f,e,o,s;if(i!=null&&t.isArray(i)){if(r=n.copy(i),u=v.get(a)||y(),u.columns.length===0)return r;for(f=[],e=0;e<u.columns.length;e++)for(o=0;o<r.length;o++)if(u.columns[e].field==r[o].field){s=r.splice(o,1)[0];s.visible=u.columns[e].visible;f.push(s);break}return r.length>0&&(f=t.concat(f,r)),f}}function p(n){var i=y();i.columns=t.map(n,function(n){return{field:n.field,visible:n.visible==null?!0:n.visible}});v.set(a,i)}function w(){return!!(c.gridOptions||{}).enableExport&&!!(c.gridOptions||{}).exportHref&&s.isSupported()}function b(n,t){if(w()&&c.grid&&c.grid.gridApi){var i=et(c.grid.gridApi.grid.columns),r=!!t&&!!t.href?t.href:c.gridOptions.exportHref;c.searchDataService.downloadCsv(r,{columns:i}).then(function(n){return s.saveAsCsv(n.data,ot())})}}function et(n){return t(n).filter(function(n){return n.visible&&n.colDef.cellTemplate!=f.selectedCellTemplate}).map(function(n){return{field:n.colDef.exportFieldName||n.field,label:n.displayName,formatString:n.colDef.exportFormat,prefixString:n.colDef.exportPrefix}}).value()}function ot(){return"download_".concat(i().format("MM-DD-YYYY.HH_mm_ss"),".csv")}var c=this,a="search-results-grid.settings",v=(c.gridOptions||{}).settingsStorageProvider||o,l;c.exportCsv=b;c.hasBeenInitialized=!1;Object.defineProperty(c,"enableExport",{get:w});Object.defineProperty(c,"records",{get:function(){return c.searchDataService==null?[]:c.searchDataService.results}});r.$watch(k,d,!0);r.$on(f.broadcastExportToCsv,b)}function u(){var n={};return{get:function(t){return n[t]},set:function(t,i){n[t]=i},clear:function(){n={}}}}n.module("app").constant("searchResultsGridConstants",{dashCellTemplate:"searchResultsGrid.dashCellTemplate",statusCellTemplate:"searchResultsGrid.statusCellTemplate",ncmecCellTemplate:"searchResultsGrid.ncmecCellTemplate",dateCellTemplate:"searchResultsGrid.dateCellTemplate",collapseMixedCellTemplate:"searchResultsGrid.collapseMixedCellTemplate",heightCellTemplate:"searchResultsGrid.heightCellTemplate",milesCellTemplate:"searchResultsGrid.milesCellTemplate",rangeCellTemplate:"searchResultsGrid.rangeCellTemplate",selectedCellTemplate:"searchResultsGrid.selectedCellTemplate",selectedHeaderCellTemplate:"searchResultsGrid.selectedHeaderCellTemplate",rowTemplate:"searchResultsGrid.rowTemplate",nonClickableRowTemplate:"searchResultsGrid.nonClickableRowTemplate",headerCellTemplate:"searchResultsGrid.headerCellTemplate",multilineHeaderCellTemplate:"searchResultsGrid.headerCellTemplateMultiline",missingPersonsGalleryRowTemplate:"searchResultsGrid.rowTemplate.gallery.missingPersons",unclaimedPersonsGalleryRowTemplate:"searchResultsGrid.rowTemplate.gallery.unclaimedPersons",unidentifiedPersonsGalleryRowTemplate:"searchResultsGrid.rowTemplate.gallery.unidentifiedPersons",broadcastExportToCsv:"search-results-grid.exportToCsv",investigatingAgencyCellTemplate:"searchResultsGrid.investigatingAgencyCellTemplate",idFormattedCellTemplate:"searchResultsGrid.idFormattedCellTemplate",primaryEthnicity:"searchResultsGrid.primaryEthnicity"}).factory("inMemoryStorageProvider",[u]).component("searchResultsGrid",{controller:["$scope","namusGrid","searchResultsGridConstants","uiGridConstants","inMemoryStorageProvider","fileSaver","appUtility",r],controllerAs:"vm",templateUrl:["templateUrls",function(n){return n.searchResultsGrid.toString()}],bindings:{searchDataService:"<",gridColumnDefinitions:"<",gridOptions:"<",onRowClick:"&",onRowDataBind:"&"}})}(angular,_,moment),function(n){"use strict";function t(){var n=this;Object.defineProperty(n,"records",{get:function(){return n.searchDataService==null?[]:n.searchDataService.results}});n.onRowDataBinding=function(t){return t.forPublicView=n.forPublicView,n.onRowDataBind({row:t})||t}}n.module("app").component("searchResultsGallery",{controller:[t],controllerAs:"vm",templateUrl:["templateUrls",function(n){return n.searchResultsGallery.toString()}],bindings:{forPublicView:"<",searchDataService:"<",gridOptions:"<",onRowClick:"&?",rowTemplate:"<",onRowDataBind:"&"}})}(angular),function(n){"use strict";function t(n){function u(){return i.description}function f(){return!!i.visibleToAllProfessionals}function r(){var t=i.loggedBy;return!t?!i.isSystem?{firstName:n.common.unknown}:{firstName:n.common.system}:t}function e(){var n=r(),t=n;return n.lastName?append(n.firstName," ",n.lastName):append(n.firstName)}function o(){var n=r();return n.hrefProfile}function s(){return i.loggedAt}function h(){return i.loggedByRoleName}var t=this,i=t.entry||{};t.description=u;t.visibleToAllProfessionals=f;t.fullName=e;t.hrefProfile=o;t.role=h;t.at=s}n.module("app").component("timelineActivityItem",{controller:["localized",t],controllerAs:"item",templateUrl:["globalTemplateUrls",function(n){return n.timelineActivityItem.toString()}],bindings:{entry:"<"}})}(angular),function(n){"use strict";function t(t,i,r,u,f){function b(n,t,i){var r=angular.copy(n.page);return l(n,t),e.query.skip(e.query.takeValue*(r+1)-e.query.takeValue),e.executeQuery().then(function(u){u.length>0&&(p(n,u,t),c(u[0],t),y(r+1,t),w(r+1,t),i())})}function k(n,t,i){var r=angular.copy(n.page);return l(n,t),e.query.skip(e.query.takeValue*(r-1)-e.query.takeValue),e.executeQuery().then(function(u){u.length>0&&(p(n,u,t),c(u[u.length-1].namus2Number,t),y(r-1,t),w(r-1,t),i(!0))})}function l(t,i){i==="Unknown"&&(i=o());var r=u.getFromStorage("".concat(i,".viewState"))||{};e.query.reset(r);e.query.clearPredicates();n.forEach(t.query.predicates,e.query.where);e.query.select("namus2Number");e.query.take(r.take)}function s(n){n==="Unknown"&&(n=o());return u.getFromStorage(a(n))||{}}function d(n){return n==="Unknown"&&(n=o()),u.getFromStorage(v(n))}function h(n,t){u.saveToStorage(a(t),n)}function g(n,t){u.saveToStorage(v(t),n)}function o(){var i=t.absUrl().split("/");return n.find(i,function(n){return n==="MissingPersons"})?"mp":n.find(i,function(n){return n==="UnidentifiedPersons"})?"up":n.find(i,function(n){return n==="UnclaimedPersons"})?"ucp":void 0}function a(n){return"".concat(n,".current")}function v(n){return"".concat(n,".viewState")}function nt(){return t.search().nav}function tt(n){var i=t.search();return i.nav?s(n):{}}function c(n,t){var r,u,f;t==="Unknown"&&(t=o());r=s(t);u=i.get();n?r.case=n:u&&u.id?r.case=u.id:(f=it(),r.case=parseInt(f,10));h(r,t)}function y(n,t){var i=s(t);i.page=n;h(i,t)}function p(t,i,r){t.cases=[];n.forEach(i,function(n){t.cases.push(n.namus2Number)});h(t,r)}function it(){var i=t.path();return n.replace(i,new RegExp("/","g"),"")}function w(n,t){var i=d(t),r=e.query.takeValue*n-e.query.takeValue;i.skip=r;g(i,t)}var e=r.create(f.search);return{queryForNextPageResults:b,queryForPreviousPageResults:k,setCurrentCaseIdInLocalStorage:c,urlContainsNav:nt,getCurrent:tt,determineCaseType:o}}angular.module("app").factory("caseNavigationService",["$location","CaseService","searchDataServiceFactory","appUtility","hrefs",t])}(_),function(n){"use strict";function t(n,t){return{restrict:"E",replace:!1,templateUrl:n.caseNavigationComponent.toString(),bindToController:{caseId:"@",caseType:"@"},controllerAs:"vm",controller:function(){function o(){var r,f,u;(n.showNext()||n.caseType==="Unknown")&&(r=t.getCurrent(n.caseType),(n.caseType==="Unknown"||r.case===null)&&(n.caseType=t.determineCaseType(),t.setCurrentCaseIdInLocalStorage(null,n.caseType),r=t.getCurrent(n.caseType)),f=_.findIndex(r.cases,function(n){return n===r.case}),u=r.cases[f+1],u&&u!==r.case?(e(u),t.setCurrentCaseIdInLocalStorage(u,n.caseType)):(t.queryForNextPageResults(r,n.caseType,n.goNext),r=t.getCurrent(n.caseType),r.cases.length>0&&(i=!0)))}function s(i){if(n.showPrevious()||n.caseType==="Unknown"){n.caseType==="Unknown"&&(n.caseType=t.determineCaseType(),t.setCurrentCaseIdInLocalStorage(null,n.caseType));var r=t.getCurrent(n.caseType),f=_.findIndex(r.cases,function(n){return n===r.case}),u=null;u=i||f===0?r.cases[f]:r.cases[f-1];u&&u!==r.case||i?(e(u),t.setCurrentCaseIdInLocalStorage(u,n.caseType)):t.queryForPreviousPageResults(r,n.caseType,n.goPrevious)}}function h(n){return n.cases[0]===n.case&&n.page===1?!0:!1}function c(n){return n.cases[n.cases.length-1]===n.case&&n.page===n.lastPage?!0:!1}function r(){var i=t.getCurrent(n.caseType);return i&&i.cases&&i.cases.length>1&&!h(i)||i.page>1?!0:!1}function u(){var r=t.getCurrent(n.caseType);return r&&r.cases&&r.cases.length>1&&!c(r)||i?!0:!1}function l(){var i=t.getCurrent(n.caseType);return n.caseId==="NotFound"&&t.urlContainsNav()&&f(i)?!0:(i&&i.cases&&i.cases.length===1||u()||r())&&f(i)?!0:!1}function f(n){return _.find(n.cases,function(t){return t===n.case})?!0:!1}function a(){return(n.caseType==="Unknown"&&(n.caseType=t.determineCaseType()),n.caseType==="mp")?"/MissingPersons/Search#/results":n.caseType==="up"?"/UnidentifiedPersons/Search#/results":n.caseType==="ucp"?"/UnclaimedPersons/Search#/results":void 0}function e(t){n.caseType==="mp"&&(document.location.href="/MissingPersons/Case#/"+t+"?nav");n.caseType==="up"&&(document.location.href="/UnidentifiedPersons/Case#/"+t+"?nav");n.caseType==="ucp"&&(document.location.href="/UnclaimedPersons/Case#/"+t+"?nav")}var n=this,i;n.showReturn=l;n.showPrevious=r;n.showNext=u;n.getReturnToListUrl=a;n.goPrevious=s;n.goNext=o;i=!1;t.setCurrentCaseIdInLocalStorage(null,n.caseType)},scope:{}}}n.module("app").directive("caseNavigation",["templateUrls","caseNavigationService",t])}(angular),function(n,t){"use strict";function i(i,r,u,f){function p(){w(e.model.status.masterCaseId)&&(e.isLoading=!0,r.get(u.case.replace("/0","/"+e.model.status.masterCaseId)).then(function(n){e.caseId=n.data.id;e.getCaseType=b(n.data.idFormatted);e.getPhotoUrl=k(n.data);e.showLifecycleStatus=ut(n.data);e.getLifecycleStatus=ft(n.data);e.getLifecycleStatusCssClass=et(n.data);e.getCaseNumber=ot(n.data);e.getFullName=st(n.data);e.getGender=ht(n.data);e.getEthnicities=ct(n.data);n.data.idFormatted.startsWith("MP")&&(e.getStatus=d(n.data),e.getStatusCssClass=tt(n.data),e.getMissingSince=v(n.data),e.getMissingFrom=lt(n.data),e.getCurrentAge=at(n.data),e.getMissingAge=vt(n.data));n.data.idFormatted.startsWith("UP")&&(e.getStatus=g(n.data),e.getStatusCssClass=it(n.data),e.dateFound=n.data.circumstances?n.data.circumstances.dateFound:null,e.locationFound=yt(n.data),e.ageRange=bt(n.data));n.data.idFormatted.startsWith("UCP")&&(e.getStatus=nt(n.data),e.getStatusCssClass=rt(n.data),e.dateFound=n.data.circumstances?n.data.circumstances.dateBodyFound:null,e.locationFound=pt(n.data),e.maxAge=kt(n.data),e.dateModified=dt(n.data));c(n.data.id)?e.showCase=!1:n.data.status.name==="Deleted"?(e.model.errors.caseId.$error={serverValidation:!0,message:f.status.caseDeleted,disablePutPost:!0},e.showCase=!1):e.showCase=!0;e.isLoading=!1},function(){e.showCase=!1;e.isLoading=!1;e.model.errors.caseId.$error={serverValidation:!0,message:f.status.caseIdRequired,disablePutPost:!0}}))}function c(n){if(n&&e.model.hrefUpdateCaseStatus){var t=e.model.hrefUpdateCaseStatus.indexOf("/"+n+"/");if(t===-1)return!1}return!0}function w(n){return n?isNaN(n)?(e.model.errors.caseId.$error={serverValidation:!0,message:f.status.numericOnly,disablePutPost:!0},!1):c(n)?(e.model.errors.caseId.$error={serverValidation:!0,message:f.status.sameCaseId,disablePutPost:!0},!1):!0:(e.model.errors.caseId.$error={serverValidation:!0,message:f.status.caseIdRequired,disablePutPost:!0},!1)}function b(n){if(n){if(n.startsWith("MP"))return"Missing Persons";if(n.startsWith("UP"))return"Unidentified Persons";if(n.startsWith("UCP"))return"Unclaimed Persons"}}function k(n){var i=n,r=i.images||[],u=i.defaultImage||{},f=u.defaultImageIdentityId,e=t.find(r,{identityId:f})||{},o=e.files||{},s=o.thumbnail||{};return s.href||i.hrefDefaultImageThumbnail}function d(n){var t=n.caseIsResolved;return t?f.status.found:f.status.missing}function g(n){var t=n.caseIsResolved;return t?f.status.identified:f.status.unidentified}function nt(n){var t=n.caseIsResolved;return t?f.status.claimed:f.status.unclaimed}function tt(n){var t=n.caseIsResolved;return t?"case-status-found":"case-status-missing"}function it(n){var t=n.caseIsResolved;return t?"case-status-identified":"case-status-unidentified"}function rt(n){var t=n.caseIsResolved;return t?"case-status-found":"case-status-missing"}function ut(n){var i=n.status,r=n.publicationStatus,u=i||r||{},t=u.name;return t&&t!=="Published"}function ft(n){var i=n.status,r=n.publicationStatus,t;return i?t=i.localizedDisplayName||"":r&&(t=r.localizedName||""),t.toUpperCase()}function et(n){var i=n.status,r=n.publicationStatus,t=i||r||{};return t.name==="Deleted"?"deleted-case":t.name==="Archived"?"archived-case":""}function ot(n){return n.idFormatted}function o(n){return n.subjectIdentification||{}}function l(n){return n.subjectDescription||{}}function s(n,t){return!n||n.length<=t?n:n.substring(0,t-3)+"..."}function st(n){var i=undefined,t=o(n);if(t){var r=s(t.firstName,20),u=s(t.middleName,10),f=s(t.lastName,30);(r||u||f)&&(i=append(r," ",u," ",f))}return i}function ht(n){var t=l(n);return t?t.sex?t.sex.localizedName:null:null}function ct(n){var r=l(n).ethnicities||[],i=t.map(r,"localizedName");return i.length>1?f.status.multiple:i[0]}function a(n){return n.sighting||{}}function v(n){var t=a(n);return t?t.date:null}function h(n,t,i){var r=", ";return n?t?"".concat(t,r,n):i?"".concat(i,r,n):n:t?t:null}function lt(t){var i=a(t);if(i&&i.address){var r=n.isDefined(i.address.city)?i.address.city:null,u=n.isDefined(i.address.county)?i.address.county.name:null,f=n.isDefined(i.address.state)?i.address.state.name:null;return h(f,r,u)}return null}function at(n){var t=o(n),c;if(t){var l=t.birthDate,i=t.currentAge,u=t.currentMinAge,e=t.currentMaxAge,r=undefined;if(l){var s=moment(l),h=moment(),a=h.diff(s,"years");r=h.isBefore(s)?null:a<2?h.diff(s,"months")+" "+f.months:a+" "+f.years}else i||i===0?r=i===0?"< 1 "+f.year:i+" "+f.years:(u||u===0||e||e===0)&&(c=y(u,e),r=c===0?"< 1 "+f.year:c+" "+f.years);return r}return null}function vt(n){var t=o(n),c;if(t){var l=t.birthDate,a=v(n),i=t.missingAge,u=t.computedMissingMinAge,e=t.computedMissingMaxAge,r=undefined;if(l&&a){var s=moment(a),h=moment(l),p=s.diff(h,"years");r=s.isBefore(h)?null:p<2?s.diff(h,"months")+" "+f.months:p+" "+f.years}else i||i===0?r=i===0?"< 1 "+f.year:i+" "+f.years:(u||u===0||e||e===0)&&(c=y(u,e),r=c===0?"< 1 "+f.year:c+" "+f.years);return r}return null}function y(n,t){var i=null;return(n||n===0)&&(t||t===0)?i=n===t?n:n+" - "+t:n||n===0?i=n:(t||t===0)&&(i=t),i}function yt(n){var t=n.circumstances;if(t){var i=t.address.city,r=t.address.county.name,u=t.address.state.name;return h(u,i,r)}return null}function pt(n){var t=n.circumstances;if(t&&t.address){var i=t.address.city,r=t.address.county?t.address.county.name:null,u=t.address.state?t.address.state.name:null;return h(u,i,r)}return null}function wt(n){return n.subjectDescription||{}}function bt(n){var t=wt(n);return t?{from:t.estimatedAgeFrom,to:t.estimatedAgeTo}:null}function kt(n){var i=n.subjectIdentification;if(i){var h=n.circumstances.dateBodyFound,r=i.birthDate,c=i.yearOfBirth,u=i.missingMaxAge,e=undefined;if(!t.isNil(u)&&u>=0)e=u;else if(h&&(r||c)){var o=r?moment(r):moment().year(c).month(0).date(1).hour(0).minute(0).second(0).millisecond(0),s=moment(h),l=s.diff(o,"years");e=s.isBefore(o)?null:l<2?s.diff(o,"months")+" "+f.common.months:l+" "+f.common.years}return e}return null}function dt(n){return n.modifiedDateTime}var e=this;e.showCase=!1;e.getCase=p}n.module("app").component("masterCase",{controller:["$scope","$http","hrefs","localized",i],controllerAs:"summary",templateUrl:["templateUrls",function(n){return n.masterCaseView.toString()}],bindings:{model:"="}})}(angular,_),function(n){"use strict";function t(){function t(t,i){var r;return n.hasOwnProperty(t)&&(r=n[t],r.hasOwnProperty(i))?r[i]:null}var n={};this.register=function(t,i){n[t]=i};this.hide=function(n){var i=t(n,"hide");return i?i():!1};this.isInvalid=function(n){var i=t(n,"isInvalid");return i?i():!1}}n.module("app").service("NavigationService",[t])}(angular),function(n){"use strict";function t(n,t,i){function f(){return u.getBoundingClientRect().top}function e(i){r.offset=i;t.getContextForScope(n).spies.forEach(function(n){n.offset=-i})}var r=this,u;r.hide=function(n){return i.hide(n)};r.isInvalid=function(n){return i.isInvalid(n)};r.offset=0;u=document.getElementById("scroll-baseline");n.$watch(f,e)}n.module("app").controller("NavigationController",["$scope","spyAPI","NavigationService",t])}(angular),function(n){"use strict";function t(n,t,i,r,u,f){function s(){return t.hasPublicViewPermission()}function o(){return t.get()}function e(){return o().enteringParty||{}}function h(){var n=o();return n&&n.caseOrigin&&n.caseOrigin.id===f.caseOrigin.legacyMigrated.id?n.isImported:!1}function c(){var n=o();return!!n.enteringParty&&n.enteringParty.id>0}function l(){var n=o().submittingAgency||{};return n.clientCaseNumber}function a(){return o().submittingAgency.agencyName||{}}function v(){var n=o().submittingAgency||{};return n.hrefProfile}function y(){var n=e();return append(n.firstName," ",n.lastName)}function p(){var n=e();return n.hrefProfile}function w(){return e().email}function b(){var n=e();return n.phoneType&&n.phoneType.localizedName}function k(){return e().phone}function d(){return e().extension}function g(){var n=e(),t=n.city,i=n.state&&n.state.localizedName;return append(t,", ",i)}function nt(){var n=e();return n.county&&n.county.name}function tt(){var n=e().relationship||{};return n.localizedName||n.relationshipOther}function it(){return!!e().restricted}function rt(){return u.enteringParty.restricted}n.hide=s;n.imported=h;n.available=c;n.clientCaseNumber=l;n.submittingAgency=a;n.submittingAgencyHref=v;n.name=y;n.href=p;n.email=w;n.phoneType=b;n.phone=k;n.phoneExtension=d;n.cityState=g;n.county=nt;n.relationship=tt;n.restricted=it;n.restrictedName=rt;r.register("EnteringParty",{hide:s})}n.module("app").controller("CommonCaseEnteringParty",["subSection","CaseService","identity","NavigationService","localized","appConstants",t])}(angular),function(n){"use strict";function t(n,t,i,r){function f(){var n=r.get();return n.id}function e(){return u}function o(n){return _.isArray(n)?_.some(n,function(n){return u===n}):u===n}function s(n){var r=f();r&&(i.path(""+r+"/"+n),t.scrollTo(0,1),t.scrollTo(0,0))}function h(){return i.path()}function c(n){var t=/^\/\d+\/(\w+)\/?/.exec(n),i=t&&t[1];u=i?i:"details"}var u;return n.$watch(h,c),{getPage:e,isCurrentPage:o,goToPage:s}}n.module("app").service("CaseNavigationService",["$rootScope","$window","$location","CaseService",t])}(angular),function(n){"use strict";function t(){function i(t){_.remove(n,{title:t.title});n.push(t)}function r(){return n}function u(n){return _.some(n.fields,t)}function t(n){return!n.isValid()}var n=[];return{register:i,getSections:r,sectionIsInvalid:u,fieldIsInvalid:t}}n.module("app").service("CaseValidationService",[t])}(angular),function(n){"use strict";function t(n,t,i){this.isCaseStatusPublic=function(){var n=i.get();return n.status?n.status.name==="Published":!1};this.hasInvalidSections=function(){var t=n.getSections();return _.some(t,n.sectionIsInvalid)};this.getInvalidSections=function(){var t=n.getSections();return _.filter(t,n.sectionIsInvalid)};this.getInvalidFieldNames=function(t){var i=t.fields,r=_.filter(i,n.fieldIsInvalid),u=_.map(r,"name");return _.join(u,", ")};this.showNoInvestigatingAgencyWarning=function(){var n=i.get();return n&&i.showRequiredFieldInfo(n)&&_.has(n,"hrefAddInvestigatingAgency")&&(!_.some(n.investigatingAgencies)||_.every(n.investigatingAgencies,"_deleted"))?!0:!1};this.enterInvestigatingAgency=function(){t.goToPage("contacts")}}n.module("app").controller("CaseValidation",["CaseValidationService","CaseNavigationService","CaseService",t])}(angular),function(n){"use strict";function t(t,i,r){function u(n,u){function e(n){n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null)}var f={afterAddFn:u,clearError:e,errors:{dueDate:{},description:{}},reminder:{},url:n},o={Description:f.errors.description,DueDate:f.errors.dueDate};e(f.errors.dueDate);e(f.errors.description);f.errors.dueDate.$error=null;i.show({small:!0,templateUrl:r.addEditReminder.toString(),data:f,onResult:function(n){if(n.errors.dueDate.$error)throw error;return t.post(n.url,n.reminder).then(function(t){_.isFunction(n.afterAddFn)&&n.afterAddFn(t.data)},function(n){i.setServerValidationErrors(n,o);throw n;})}})}function f(u,f,e){function s(n){n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null)}var o={afterEditFn:e,clearError:s,errors:{dueDate:{},description:{}},original:n.copy(f)||{},reminder:n.copy(f)||{},url:u},h={Description:o.errors.description,DueDate:o.errors.dueDate};s(o.errors.dueDate);s(o.errors.description);o.errors.dueDate.$error=null;i.show({small:!0,templateUrl:r.addEditReminder.toString(),data:o,onResult:function(n){if(n.errors.dueDate.$error)throw n.errors.dueDate.$error;if(n.reminder.dueDate!==n.original.dueDate||n.reminder.description!==n.original.description)return t.put(n.url,n.reminder).then(function(t){_.isFunction(n.afterEditFn)&&n.afterEditFn(t.data)}).catch(function(n){i.setServerValidationErrors(n,h);throw n;})}})}return{openAddModal:u,openEditModal:f}}n.module("app").service("ReminderModalService",["$http","namusModal","templateUrls",t])}(angular),function(n,t){"use strict";function i(n,i,r,u,f,e,o,s,h,c,l,a,v,y){function rt(n){n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null)}function ut(){return c.isCurrentUserPublic()?(p.subtab=2,!0):(p.subtab||(p.subtab=1),!1)}function ft(){return w().viewPermission==="public"}function et(){var n=w();return n.grantPermissionToPublish}function ot(){var n=w();return n.hrefPermissionToPublish}function st(){var n=w();return n.permissionToPublish}function ht(){var n=w();return!n.hrefAddExclusionExternal||p.subtab===1&&!!p.hideAddExclusionsButton?!1:!0}function ct(){var n=w();return!!n.hrefActivityLog}function lt(){var n=w();return!!n.hrefChronology}function at(){var n=w();return n.hrefGetExclusions?n.status&&n.status.id<=2&&c.isCurrentUserPublic()?!1:!0:!1}function vt(){return!_.isNil(g())||!_.isNil(nt())||!_.isNil(tt())}function yt(){var n=w();return n.hrefAddCaseReminder?!0:c.isCurrentUserAdministrator()&&n.reminder?!0:!1}function pt(){var n=w();return n.hrefAddCaseReminder?!0:!1}function wt(){p.hideAddExclusionsButton=!1}function bt(){p.hideAddExclusionsButton=!0}function kt(n){return w().viewPermission==="public"&&n==="private"}function dt(n){var t=i.isUnidentifiedPersonsCase(w());return!!t&&n==="additional"?!i.isUnidentifiedDeceased():!1}function w(){return i.get()}function k(){return!!w().hrefUpdateCaseStatus}function gt(){var t=w(),n=t.status||{};return n.localizedDisplayName||n.localizedName}function d(){var n=w();return!!n.hrefSubmit}function ni(){var n=w();return!!n.hrefPermissionToPublish}function ti(){var n=w();return n.id}function ii(){return r.getPage()}function ri(n){return r.isCurrentPage(n)}function ui(n){r.goToPage(n)}function fi(){return i.isValidAuthorizedCase()}function ei(){return i.isLoading()}function oi(){return i.isInvalidUnauthorizedCase()}function si(n,t){return _.isEmpty(t)||(n=n+" - "+t),document.title=n,!0}function hi(){var n=w();return n.id}function ci(){u.openAddModal(w().hrefAddCaseReminder,function(n){w().reminder=n})}function li(){var n=w();if(n.reminder)return n.reminder.description}function ai(){var n=w(),t={color:"#000000"},i,r;return n.reminder&&(i=y().startOf("day"),r=y(n.reminder.dueDate).startOf("day"),t=i.isAfter(r,"day")?{color:"#dd001b"}:{color:"#2199e8"}),t}function vi(){var n=w();if(n.reminder)return n.reminder.dueDate}function yi(){var t=w(),i;t.reminder&&(i=t.reminder.hrefDelete,n.delete(i).then(function(){t.reminder=null;p.reminderStyle={color:"black"}}))}function pi(){var n=w().reminder;n&&u.openEditModal(n.hrefUpdate,n,function(n){w().reminder=n})}function wi(){var t=window.location.href,n="";return/\/MissingPersons\//i.test(t)?n=l.missingPersonsSearchResults:/\/UnidentifiedPersons\//i.test(t)?n=l.unidentifiedPersonsSearchResults:/\/UnclaimedPersons\//i.test(t)&&(n=l.unclaimedPersonsSearchResults),n}function g(n){var t=w();return t.hrefGetPoster?n&&n!=="en"?t.hrefGetPoster.concat("?language=",n):t.hrefGetPoster:null}function nt(){var n=w();return n.hrefCaseReport}function bi(){var n=w();return n.hrefAddCaseReminder}function tt(){var n=w();return n.hrefChronologyReport}function it(t){function u(){o.hideBanner(_.findIndex(o.list(),["type","warning"]));o.show({priority:3,type:"success",message:[{content:a.banners.submitSuccess.case+" "+i.getFormattedCaseIdPrefix(r.hrefSubmit)+ti()+" "+a.banners.submitSuccess.submitted}]});!c.isCurrentUserNamUsPersonnel()&&ni()&&s.show({small:!0,templateUrl:h.permissionToPublish.toString(),data:{hrefPermissionToPublish:r.hrefPermissionToPublish},onResult:function(t){n.post(t.hrefPermissionToPublish).then(function(){i.reload()})},onCancel:function(){i.reload()}})}function l(){var n=f.getSections();return _.some(n,f.sectionIsInvalid)}function v(){var n=f.getSections();return _.filter(n,f.sectionIsInvalid)}function e(n){var t=n.fields,i=_.filter(t,f.fieldIsInvalid),r=_.map(i,"name");return _.join(r,", ")}t.stopPropagation();t.preventDefault();var r=w();l()?s.show({small:!0,templateUrl:h.submissionRequiredFieldsIncomplete.toString(),data:{failed:!1,getInvalidSections:v,getInvalidFieldNames:e}}):s.show({small:!0,templateUrl:h.submissionConfirmation.toString(),data:{hrefSubmit:r.hrefSubmit},onResult:function(t){n.post(t.hrefSubmit,{}).then(function(){s.show({small:!0,escapeInvokesCancel:!0,templateUrl:h.submissionSuccess.toString(),onResult:function(){u()},onCancel:function(){u()}})}).catch(function(n){function r(){var i,r;return t.length||(i=_.map(n.data.validationErrors,function(n){var t=n.error.split("-");return{title:t[0],field:t[1]}}),r=_.groupBy(i,"title"),t=_.map(r,function(n,t){return{title:t,fields:_.map(n,function(n){return{name:n.field,isValid:function(){return!1}}})}})),t}var t=[];s.show({small:!0,templateUrl:h.submissionRequiredFieldsIncomplete.toString(),data:{failed:!0,getInvalidSections:r,getInvalidFieldNames:e},onResult:function(){i.reload()}})})}})}function ki(n){n.stopPropagation();n.preventDefault();e.openCaseStatusModal(w())}var p=this,b;p.canSubmit=d;p.getPage=ii;p.isCurrentPage=ri;p.goToPage=ui;p.posterUrl=g;p.caseReportUrl=nt;p.caseReminderUrl=bi;p.chronologyReportUrl=tt;p.submit=it;p.hide=ft;p.canViewComparisonsTab=at;p.canViewNotesTab=ct;p.canViewChronology=lt;p.canViewToolsMenu=vt;p.hideByAccessibility=kt;p.hideByCaseKind=dt;p.hideSelector=ut;p.canAddExclusions=ht;p.onHideComparisonView=wt;p.onShowComparisonView=bt;p.isValidAuthorizedCase=fi;p.isLoading=ei;p.isInvalidUnauthorizedCase=oi;p.getSearchLink=wi;p.updatePageTitle=si;p.getCaseIdLink=hi;p.getCaseReminder=li;p.getDueDate=vi;p.clearCaseReminder=yi;p.editCaseReminder=pi;p.addCaseReminder=ci;p.canViewReminder=yt;p.canEditReminder=pt;p.getReminderStyle=ai;p.grantPermissionToPublish=et;p.getHrefPermissionToPublish=ot;p.disablePermissionToPublish=st;p.caseStatus=function(){var n=w();return n.publicationStatus};b={clearError:rt,errors:{description:{},dueDate:{}},validation:{dueDate:{onInvalid:function(){b.errors.dueDate.$error={serverValidation:!0,message:a.common.invalidDate,disablePutPost:!0}},onValid:function(){b.errors.dueDate.$error=null}}}};o.register(function(){var n=w(),t=[];return d()&&!k()&&t.push({priority:2,type:"warning",message:[{content:a.banners.submit.draft+" "+i.getFormattedCaseIdPrefix(n.hrefSubmit)+n.id},{content:a.banners.submit.submit,action:it}]}),t});v.registerCaseStatus(function(){var n=t;return k()&&(n={status:gt,changeCaseStatus:ki}),n})}n.module("app").controller("CasePage",["$http","CaseService","CaseNavigationService","ReminderModalService","CaseValidationService","CommonCaseStatusModalService","banner","namusModal","templateUrls","identity","hrefs","localized","AdminToolService","moment",i])}(angular),function(n){"use strict";function t(n,t){function s(){var n=i.activities();return n.length===0?!0:!1}function r(){return t.get()||{}}function o(){return!!r().hrefAddActivityLog}function h(){return o()&&!u&&!_.isNil(i.newNote.description)&&i.newNote.description.length>0}function c(){return t.hasPublicViewPermission()}function l(){var e=r(),t=e.hrefAddActivityLog;t&&(u=!0,n.post(t,i.newNote).then(function(n){f.unshift(n.data)}).then(function(){i.clearNote();u=!1}))}function a(){i.newNote={};r().activityLogCaseNote={}}function v(){var i=r(),t=i.hrefActivityLog;return t&&e!==t&&(e=t,n.get(t).then(function(n){f=n.data})),f}var i=this,e,u=!1,f=[];i.hasNoNotes=s;i.activities=v;i.canAdd=o;i.canSave=h;i.saveNote=l;i.clearNote=a;i.hide=c;i.newNote=r().activityLogCaseNote||{};i.$onInit=function(){r().activityLogCaseNote=i.newNote}}n.module("app").component("activityLog",{controller:["$http","CaseService",t],controllerAs:"vm",templateUrl:["templateUrls",function(n){return n.activityLog.toString()}]})}(angular),function(n,t){"use strict";function i(n,i,r,u,f,e){function l(n){f.openAddDialog(o(),n)}function a(n){f.openEditDialog(o(),n)}function v(n){u.openConfirmItemDeletionDialog(n,"attachment",function(){return f.deletePostProcessing(o())})}function y(){var n=o();return!e.getIsPrintMode()&&(_.has(n,"hrefAddImage")||_.has(n,"hrefAddDocument"))}function p(){return e.getIsPrintMode()}function w(n){if(n===t)return!1;var i=n&&n.isPublic,u=r.get();return!i&&u.viewPermission==="public"}function o(){return r.get()}function s(){var n=o(),t=n.images||[],i=n.documents||[],r=_.concat(t,i);return _.sortBy(c(r),["category.id","identityId"])}function b(){return s().length===0}function k(){return s().length===1}function d(){return s().length>1}function g(n){var i=n.caption||"",t=i.replace(/\s+$/,"");return t.length>80||t.split(/\r?\n/).length>2}function h(n){var t=n.files||{};return t.thumbnail}function nt(n){var t=h(n);return t.width/16}function tt(n){var t=h(n);return t.height/16}function it(n){var t=n.files||{};return t.original}function rt(n){return n.file}function ut(n){var t=!!n.files,i=o().defaultImage||{};return t&&n.identityId===i.defaultImageIdentityId}function ft(n){f.openDefaultDialog(o(),n)}var c=n("notDeleted");i.addAttachments=l;i.editAttachment=a;i.deleteAttachment=v;i.canEdit=y;i.hide=w;i.isPrintMode=p;i.attachments=s;i.none=b;i.singular=k;i.plural=d;i.shouldHoverCaption=g;i.getThumbnail=h;i.getThumbnailWidth=nt;i.getThumbnailHeight=tt;i.getOriginal=it;i.getDocument=rt;i.isDefault=ut;i.setDefault=ft}n.module("app").controller("CommonCaseAttachments",["$filter","subSection","CaseService","commonModalService","modalService","OptionService",i])}(angular),function(n,t){"use strict";function e(e,o,s,h,c,l,a,v){return{create:function(){function k(r,k){var g=o.defer(),d=_.map(k,function(n){var t=n.name||n.fileName,i=n.size||n.fileSize,r=!!t.match(u),e=!!t.match(f),o=a.isCurrentUserNamUsPersonnel()?v.maximumUploadFileSizeForNamUsPersonnel:v.maximumUploadFileSize;return{isImage:r,isDocument:e,include:(r||e)&&i<=o,isPrivate:!0,inelligibleExtension:!r&&!e,inelligibleSize:i>o,maximumFileSizeExceededMessage:l.attachments.maximumFileSizeExceededPattern.replace("{0}",o/1e6),size:i,name:t,file:n,errors:{category:{},caption:{},isPrivate:{},file:{}}}}),nt={imageCategories:[],documentCategories:[],attachments:d,categories:function(n){return n.isImage?this.imageCategories:this.documentCategories},errors:{category:{},caption:{}},totalAttachments:function(){return d.length},selectedAttachments:function(){return _.filter(d,"include").length},clearError:i,ok:function(){g.resolve()},canBePublic:p,defaultChanged:function(n){for(var t=0;t<d.length;t++)t!==n&&(d[t].isDefault=!1)},categoryChanged:w};s.show({onLoad:function(n){return o.all([e.get(c.imageCategories).then(function(t){n.imageCategories=t.data}),e.get(c.documentCategories).then(function(t){n.documentCategories=t.data})])},templateUrl:h.addAttachmentsModal.toString(),data:nt,onBeforeResult:function(n){var f=r.defaultImage||{},e=f.defaultImageIdentityId,s=_.find(r.images,{identityId:e}),t=_.filter(n.attachments,{inelligibleExtension:!1,inelligibleSize:!1,include:!0}),i=_.find(t,{isImage:!0,isDefault:!0,isPrivate:!1}),u=!1;return _.forEach(t,function(n){n.category?!n.isImage||s||i||n.isPrivate||!n.category.canBeDefault||(n.isDefault=!0,i=n):(u=!0,n.errors.category.$error={serverValidation:!0,message:l.attachments.categoryRequired})}),u?o.reject({data:{message:"onBeforeResult rejected the closing of the modal."}}):o.resolve(n)},onResult:function(i){var f=_.filter(i.attachments,{inelligibleExtension:!1,inelligibleSize:!1,include:!0}),u=null,h;return i.uploading=!0,i.currentAttachment=0,i.numberOfAttachmentsToUpload=f.length,h=_.reduce(f,function(f,h){return f.then(function(){var f=o.defer(),c=new FormData,l=b(h),a=h.isImage?r.hrefAddImage:r.hrefAddDocument;return i.currentAttachment+=1,h.uploading=!0,c.append("metadata",JSON.stringify(l)),c.append(h.name,h.file,h.name),e.post(a,c,{transformRequest:n.identity,headers:{"Content-Type":t}}).then(function(n){r.images||(r.images=[]);r.documents||(r.documents=[]);h.uploading=!1;h.uploadSuccess=!0;h.isImage?(r.images.push(n.data),h.isDefault&&(u=n.data.identityId)):h.isDocument&&r.documents.push(n.data);f.resolve()}).catch(function(n){s.setServerValidationErrors(n,{Category:h.errors.category,Caption:h.errors.caption,IsPublic:h.errors.isPrivate});h.uploading=!1;h.uploadError=!0;f.resolve()}),f.promise})},o.resolve()),h.then(function(){var f=o.when({}),t=null;return u&&(r.defaultImage&&r.defaultImage.hrefUpdate?(t=n.copy(r.defaultImage),t.defaultImageIdentityId=u,f=e.put(r.defaultImage.hrefUpdate,t).then(function(n){r.defaultImage=n.data})):r.hrefAddDefaultImage&&(t={},t.defaultImageIdentityId=u,f=e.post(r.hrefAddDefaultImage,t).then(function(n){r.defaultImage=n.data}))),i.uploadComplete=!0,f}).then(function(){return y(r)}),g.promise}})}function d(n,t){function a(n,t){return!n||!t?!1:(n.caption===t.caption||!n.caption&&!t.caption)&&n.category.id===t.category.id&&n.isPrivate===t.isPrivate&&(n.title===t.title||!n.title&&!t.title)}var l=r(t),u={isDocument:!!t.file,attachment:r(t),categories:[],errors:{isPrivate:{},category:{},title:{},caption:{}},canBePublic:p,categoryChanged:w,clearError:i},f={Category:u.errors.category,Caption:u.errors.caption,Title:u.errors.title};s.show({small:!0,onLoad:function(n){return e.get(n.isDocument?c.documentCategories:c.imageCategories).then(function(t){n.categories=t.data})},templateUrl:h.editAttachmentModal.toString(),data:u,onResult:function(i){var r=i.isDocument?n.documents:n.images;return s.clearServerValidationErrors(f),a(l,u.attachment)?o.when({}):e.put(t.hrefUpdate,b(i.attachment)).then(function(t){var i=_.findIndex(r,{identityId:t.data.identityId});return r[i]=t.data,y(n)}).catch(function(n){s.setServerValidationErrors(n,f);throw n;})}})}function g(t,i){var r=t.defaultImage||{};r.defaultImageIdentityId!==i.identityId&&i.isPublic&&s.show({small:!0,templateUrl:h.confirmModal.toString(),data:{message:l.attachments.confirmSetDefaultImage},onResult:function(){var u=n.copy(r);return u.defaultImageIdentityId=i.identityId,r.hrefUpdate?e.put(r.hrefUpdate,u).then(function(n){t.defaultImage=n.data}):t.hrefAddDefaultImage?e.post(t.hrefAddDefaultImage,u).then(function(n){t.defaultImage=n.data}):o.when()}})}function nt(n){return y(n)}function p(n){var t=n||{};return!!t.canBePublic}function w(n){n.errors&&i(n.errors.category);n.isPrivate=!n.category.canBePublic}function b(n){return{name:n.name,isPublic:n.category.canBePublic?!n.isPrivate:!1,category:n.category,title:n.title,caption:n.caption}}function y(t){var i=t.defaultImage||{},s=i.defaultImageIdentityId,r=_.find(t.images,{identityId:s})||{},h=r.category||{},c=r.isPublic,l=r._deleted,u=n.copy(i),f=o.when({});return r.identityId&&!l&&c&&h.canBePublic||(u.defaultImageIdentityId=(_.find(t.images,tt)||{}).identityId,i.defaultImageIdentityId!==u.defaultImageIdentityId&&(i.hrefUpdate?f=e.put(i.hrefUpdate,u).then(function(n){t.defaultImage=n.data}):t.hrefAddDefaultImage&&(f=e.post(t.hrefAddDefaultImage,u).then(function(n){t.defaultImage=n.data})))),f}function tt(n){var t=n.category||{};return!n._deleted&&n.isPublic&&!!t.canBeDefault}return{openAddDialog:k,openEditDialog:d,openDefaultDialog:g,deletePostProcessing:nt}}}}function r(t){return{isPrivate:!t.isPublic,category:n.copy(t.category),title:t.title,caption:t.caption}}function i(n){n.$error=null}var u=/\.(?:png|gif|jpe?g)$/i,f=/\.pdf$/i;n.module("app").service("CommonCaseAttachmentModalService",["$http","$q","namusModal","templateUrls","hrefs","localized","identity","globalConstants",e])}(angular),function(n){"use strict";function t(n,t,i,r,u,f){function o(){return i.get()}function p(){var n=y(h());return n.length}function w(n){return n.user.roleId===17||n.user.roleId===4}function b(){var n=o();return!f.getIsPrintMode()&&_.has(n,"hrefAddCaseContributor")}function k(){var n=o();return!f.getIsPrintMode()&&_.has(n,"hrefAddCaseContributor")}function d(n){return!f.getIsPrintMode()&&!!n.hrefUpdate}function g(n){return!f.getIsPrintMode()&&!!n.hrefDelete}function nt(n){var t=s(n);return!f.getIsPrintMode()&&!!t.hrefProfile}function tt(n){u.open(o(),n)}function it(n){r.openConfirmItemDeletionDialog(n,"contributor",i.reload)}function rt(){u.open(o(),{})}function h(){var n=o();return n.caseContributors||[]}function ut(n){return!e[n]}function ft(n){return e[n]}function et(){return f.getIsPrintMode()===!0?(ot(),!0):!1}function ot(){for(var t=h()||[],n=0;n<t.length;n++)e[n]=!0}function st(n){e[n]=!e[n]}function l(n){return n.user}function s(n){return l(n)||{}}function a(n){return n.agency}function v(n){return a(n)||{}}function ht(n){var t=v(n);return t.name}function ct(n){var t=s(n);return append(t.firstName," ",t.lastName,", ",t.role)}function lt(n){var t=s(n);return t.hrefProfile}function at(n){var t=s(n);return append(c(t.phone1)," ext. ",t.phone1Extension)}function vt(n){var t=s(n);return t.email}function yt(n){var t=v(n);return append(c(t.phone)," ext. ",t.phoneExtension)}function pt(n){return n&&!n.isPublic?i.hasPublicViewPermission():!1}var c=t("phone"),y=t("notDeleted"),e={};n.available=p;n.canEdit=b;n.canAddCaseContributor=k;n.canEditCaseContributor=d;n.canDeleteCaseContributor=g;n.canViewCaseContributor=nt;n.edit=tt;n.delete=it;n.add=rt;n.contributors=h;n.collapsed=ut;n.expanded=ft;n.shouldExpand=et;n.toggle=st;n.user=l;n.agency=a;n.nameOf=ct;n.userProfile=lt;n.contactPhone=at;n.contactEmail=vt;n.agencyName=ht;n.agencyPhone=yt;n.isNcmec=w;n.hide=pt}n.module("app").controller("CommonCaseContributors",["subSection","$filter","CaseService","commonModalService","CommonCaseContributorModalService","OptionService",t])}(angular),function(n){"use strict";function t(t,i,r,u,f,e){function o(n,o){function y(t){var i=_.findIndex(n.caseContributors,function(n){return!n._deleted&&n.user.id===t});return i!==-1}function p(n,i){return t.get(u.caseContributorSearch,{params:{prefix:i}}).then(function(t){a.contributors=n.search===i?t.data:[]})}var a={contributor:s(o),edit:!!o.hrefUpdate,relationships:[],contributors:[],isAlreadyOnCase:y,search:p,errors:{user:{},relationshp:{},relationshipOther:{}},clearError:l},v={User:a.errors.user,Relationship:a.errors.relationshp,RelationshipOther:a.errors.relationshipOther};r.show({onLoad:function(n){return t.get(u.caseContributorRelationships).then(function(t){var i,r,u;n.relationships=t.data;i=_.find(n.relationships,function(n){var t=a.contributor.relationship||{};return n.name===t.name});!i&&a.contributor.relationship&&(r=a.contributor.relationship||{},a.contributor.relationshipOther=r.name,u=_.find(n.relationships,function(n){return n.name==="Other"}),a.contributor.relationship=u)})},templateUrl:f.caseContributorModal.toString(),data:a,onResult:function(u){var s=u.edit?t.put:t.post,l=u.edit?u.contributor.hrefUpdate:n.hrefAddCaseContributor,f=h(u.contributor);return r.clearServerValidationErrors(v),c(o,f)?s(l,f).then(function(){e.reload()}).catch(function(n){r.setServerValidationErrors(n,v);throw n;}):i.when(u)}})}function s(t){var i=n.copy(t);return i.isPrivate=!t.isPublic,i}function h(t){var i=n.copy(t),r=i.relationship&&i.relationship.name;return i.isPublic=!t.isPrivate,r!=="Other"&&(i.relationshipOther=null),i}function c(t,i){return!n.equals(t.user,i.user)||!!t.isPublic!==i.isPublic||!n.equals(t.relationship,i.relationship)||!namus.textEquals(t.relationshipOther,i.relationshipOther)}function l(n){n.$error=null}return{open:o}}n.module("app").service("CommonCaseContributorModalService",["$http","$q","namusModal","hrefs","templateUrls","CaseService",t])}(angular),function(n){"use strict";function t(t,i,r,u,f){function e(e){function a(n){if(n.status.name!==n.initialStatus.name||n.status.isUnverifiable!=n.initialStatus.isUnverifiable||n.status.isHold!=n.initialStatus.isHold){var t=n.status.name==="Deleted"&&n.initialStatus.name!=="Deleted"?f.caseStatusConfirmDeletionModal.toString():f.caseStatusConfirmChangeModal.toString();u.show({small:!0,templateUrl:t,data:n,onResult:function(){return u.clearServerValidationErrors(n.fieldErrorMap),i.all([v(n)])}})}}function v(n){return t.put(n.hrefUpdateCaseStatus,n.status).then(function(n){e.status=n.data}).then(function(){r.refreshPotentialDuplicates();r.reload()}).catch(function(t){t.data.validationErrors.push({fieldName:"CaseId",error:t.data.message});u.setServerValidationErrors(t,n.fieldErrorMap);throw t;})}function y(n){n.$error=null}function p(){return s.name!=="New"&&s.name!=="Archived"&&!s.isAccepted&&s.name!=="Deleted"&&s.name!=="Published"}function w(){return s.name!=="Accepted"}function b(){return s.name!=="Published"&&s.name!=="Archived"&&!o.isUnverifiable&&!o.isHold&&s.name!=="Deleted"}function k(){return s.name!=="Archived"&&!o.isUnverifiable&&!o.isHold&&s.name!=="Deleted"}function d(){return s.name==="Archived"&&l}function g(n){return function(t){return _.some(t.pendingReviews,function(t){return t.hrefReview===n})}}function c(){o.isUnverifiable===!0?(o.name==="Published"||o.name==="Archived")&&(o.name="Accepted"):o.isHold===!0?(o.name==="Published"||o.name==="Archived")&&(o.name="Accepted"):o.name=s.name==="Archived"?"Accepted":s.name==="Deleted"?"Accepted":s.name}function nt(){o.isHold=!1;c()}function tt(){o.isUnverifiable=!1;c()}var s=n.copy(e.status),o=n.copy(e.status),l=!!e.caseResolutionDetails&&(!e.changes||!_.some(e.changes.entries,g(e.caseResolutionDetails.hrefUpdate))),h;c();h={initialStatus:s,status:o,hrefUpdateCaseStatus:e.hrefUpdateCaseStatus,onUnverifiableClick:nt,onHoldClick:tt,allowNew:p,allowAccepted:w,allowPublished:b,allowArchived:k,willDeleteCaseResolutionDetails:d,clearError:y,errors:{caseId:{},duplicate:{}}};h.fieldErrorMap={CaseId:h.errors.caseId,Duplicate:h.errors.duplicate};u.show({templateUrl:f.caseStatusModal.toString(),data:h,onResult:function(){a(h)}})}return{openCaseStatusModal:e}}n.module("app").service("CommonCaseStatusModalService",["$http","$q","CaseService","namusModal","templateUrls",t])}(angular),function(n){"use strict";function t(n,t,i,r){function e(){return i.hasPublicViewPermission()}function u(){return i.get()}function s(){var n=u();return!n.dentalChart||!n.dentalChart.dentalAvailability}function h(){var n=u();return n.dentalChart&&n.dentalChart.ncicDentalCodes&&n.dentalChart.ncicDentalCodes.length>0}function c(){var n=u();return n.dentalChart&&n.dentalChart.namUsDentalCodes&&n.dentalChart.namUsDentalCodes.length>0}function l(){var n=u();return!n.dentalChart||v()&&y()&&!n.dentalChart.dentalAvailability&&!n.dentalChart.commentText}function a(){return f().dentalAvailability==="NoKnownInformation"}function v(){var n=u();return!n.dentalChart||!n.dentalChart.artifacts||n.dentalChart.artifacts.length===0}function y(){var n=u();return!n.dentalChart||!n.dentalChart.descriptors||n.dentalChart.descriptors.length===0}function f(){return u().dentalChart||{}}function p(){return f().dentalAvailability}function w(){var n=f().artifacts,t=[];return n&&n.length>0&&(t=n),t}function b(){var n=f().descriptors,t=[];return n&&n.length>0&&(t=n),t}function k(n){var t=f();return o(n,t.ncicDentalCodes)}function d(n){var t=f();return o(n,t.namUsDentalCodes)}function o(n,t){if(t&&t.length!==0){var i=null;return n==="upper"?i=_.map(t.slice(0,16),"code"):n==="lower"&&(i=_.map(_.reverse(t.slice(16)),"code")),i}return new Array(16)}function g(){return f().commentText}function nt(){var n=u();return _.has(n,"hrefAddDentalChart")||_.has(n,"dentalChart.hrefUpdate")}n.hide=e;n.canEdit=nt;n.noChartingEntered=s;n.noInformationEntered=l;n.noKnownInformation=a;n.dentalAvailability=p;n.dentalArtifacts=w;n.dentalDescriptors=b;n.commentText=g;n.ncicDentalCodes=k;n.namUsDentalCodes=d;n.hasNCICDentalCodes=h;n.hasNamUsDentalCodes=c;r.register("Dental",{hide:e})}n.module("app").controller("commonCaseDental",["subSection","scope","CaseService","NavigationService",t])}(angular),function(n){"use strict";function t(){function t(t){if(t==null)return null;if(!i(t))return"";if(t==="V")return"N";if(t==="X")return"A";if(t.indexOf("C")!==-1)return t.indexOf("R")!==-1?"CR":"C";var r="",u=t.split("");return n.find(u,function(n){return"MODFL".indexOf(n)!==-1})&&(r+="F"),t.indexOf("R")!==-1&&(r+="R"),r}function i(n){if(n===null||n.trim()==="")return!1;var t=n.match(/[^XVMODFLCR/]/g);return t===null}return{mapNcicToNamUs:t}}angular.module("app").factory("commonDentalCodeMappingService",[t])}(_),function(n){"use strict";function t(){function f(n){var f=[];return i(n,9)||f.push("EachCodeMustBeNoLongerThan9Characters"),r(n)||f.push("EachCharacterMayAppearAtMostOnce"),u(n,"MODFLCR/XV")||f.push("NCICCodeMayOnlyContainTheCharactersMODFLCR"),o(n)||f.push("TheCharactersVAndXCannotBeUsedWithAnyOther"),t(n,"C","MODFL")||f.push("TheCCharacterShouldFollowMODFL"),c(n)||f.push("MODFLShouldBeInOrder"),f}function e(n){var t=[];return i(n,9)||t.push("EachCodeMustBeNoLongerThan9Characters"),r(n)||t.push("EachCharacterMayAppearAtMostOnce"),t}function i(n,t){var i=!0;return n&&(i=n.length<=t),i}function r(t){var i=!0,r,u;return t&&(r=t.split(""),u=n.groupBy(r),n.forOwn(u,function(n){n.length>1&&(i=!1)})),i}function u(n,t){var i=!0,r,u;return n&&(r=new RegExp("[^"+t+"]","g"),u=n.match(r),i=u===null),i}function o(n){var t=!0;return n&&(t=n.indexOf("V")===-1&&n.indexOf("X")===-1||n.length===1),t}function t(n,t,i){var r=!0;return n&&(r=!s(n,t,i)),r}function s(n,t,i){var f=!0,r,u;return n&&(r=n.indexOf(t),u=h(n,i.split("")),f=r>=0&&u>=0&&r<u),f}function h(t,i){var u=-1,r;return t&&(r=[],n.forEach(i,function(n){r.push(t.indexOf(n))}),u=r.reduce(function(n,t){return Math.max(n,t)})),u}function c(n){var i=!0;return n&&(i=t(n,"L","MODF")&&t(n,"F","MOD")&&t(n,"D","MO")&&t(n,"O","M")),i}return{validateNcic:f,validateNamUs:e,mayOnlyContainCharacters:u,doesNotProceed:t}}angular.module("app").factory("commonDentalCodeValidationService",[t])}(_),function(n){"use strict";function t(t,i,r,u,f,e,o,s){function h(h,c,l,a){function rt(n){n.$error=null}function b(){for(var n=0;n<32;n++)v.errors.ncicDentalCodes[n]={},v.errors.namUsDentalCodes[n]={}}function ut(){var n=v.noKnownInformation&&v.dentalChart&&(nt(v.dentalChart.artifacts)||nt(v.dentalChart.descriptors)||!_.every(v.dentalChart.ncicDentalCodes,y)||!_.every(v.dentalChart.namUsDentalCodes,y)),t=v.dentalChart&&v.dentalChart.dentalAvailability===v.availabilityCode.elsewhere&&(!_.every(v.dentalChart.ncicDentalCodes,y)||!_.every(v.dentalChart.namUsDentalCodes,y));return n||t}function k(){var n=v.dentalChart||{};return n.ncicDentalCodes&&n.ncicDentalCodes.length>0&&_.find(n.ncicDentalCodes,function(n){return n.code})&&!_.find(v.errors.ncicDentalCodes,function(n){return n.$error})}function ft(){var n=o.copy(v.mappedNamUsCodes);v.dentalChart.namUsDentalCodes=n;g()}function et(){var n=!1,t,i;return k()&&(t=v.dentalChart||{},i=o.normalize(t.namUsDentalCodes,32),n=o.willOverwrite(v.mappedNamUsCodes,i)),n}function d(){var n;ot();var i=v.dentalChart||{},r=o.normalize(i.ncicDentalCodes,32),t=[];for(n=0;n<32;n++)t.push({code:l.mapNcicToNamUs(r[n].code),index:n});v.mappedNamUsCodes=t}function ot(){for(var r,u,i,t,n=0;n<32;n++)v.errors.ncicDentalCodes[n]={};for(r=v.dentalChart||{},u=o.normalize(r.ncicDentalCodes,32),n=0;n<32;n++)for(i=a.validateNcic(u[n].code),t=0;t<i.length;t++)v.errors.ncicDentalCodes[n].$error={serverValidation:!1,message:e.dental.validationError[i[t]]}}function g(){for(var r,u,i,t,n=0;n<32;n++)v.errors.namUsDentalCodes[n]={};for(r=v.dentalChart||{},u=o.normalize(r.namUsDentalCodes,32),n=0;n<32;n++)for(i=a.validateNamUs(u[n].code),t=0;t<i.length;t++)v.errors.namUsDentalCodes[n].$error={serverValidation:!1,message:e.dental.validationError[i[t]]}}function st(n){return n.dentalAvailability==="NoKnownInformation"}function nt(n){return n&&n.length>0}function ht(n){var t=n;return _.every(v.dentalChart.ncicDentalCodes,y)&&delete t.ncicDentalCodes,_.every(v.dentalChart.namUsDentalCodes,y)&&delete t.namUsDentalCodes,t}function ct(u){var o,f,e,c;return u.noKnownInformation?(o={},u.dentalChart.dentalAvailability=u.availabilityCode.noKnownInfo,o.id=(u.dentist||{}).id,u.dentist=o,lt(u.dentalChart)):u.dentalChart.dentalAvailability===u.availabilityCode.noKnownInfo&&(u.dentalChart.dentalAvailability=null),u.dentalChart.dentalAvailability||_.every(u.dentalChart.ncicDentalCodes,y)&&_.every(u.dentalChart.namUsDentalCodes,y)||(u.dentalChart.dentalAvailability=u.availabilityCode.entered),f=n.copy(h.dentalChart),e=n.copy(u.dentalChart),!f||!e||!namus.textEquals(f.commentText,e.commentText)||s.removePropertiesBeforeEqualityCheck(f,"",e,"",["commentText"]),n.equals(ht(e),f)?i.when(u):(c=u.dentalChart.hrefUpdate?t.put(u.dentalChart.hrefUpdate,u.dentalChart):t.post(h.hrefAddDentalChart,u.dentalChart),c.then(function(n){return h.dentalChart=n.data,u}).catch(function(n){var i,t,o,s,f,e;if(r.setServerValidationErrors(n,w),u.hasErrors=!0,_.has(n,"data.validationErrors"))for(i=0;i<n.data.validationErrors.length;i++)t=n.data.validationErrors[i],o=t.fieldName.match(/NcicDentalCodes\[([0-9]+)\].Code/),o&&(f=parseInt(o[1]),e=u.dentalChart.ncicDentalCodes[f].index,u.errors.ncicDentalCodes[e].$error={serverValidation:!0,message:t.error}),s=t.fieldName.match(/NamUsDentalCodes\[([0-9]+)\].Code/),s&&(f=parseInt(s[1]),e=u.dentalChart.namUsDentalCodes[f].index,u.errors.namUsDentalCodes[e].$error={serverValidation:!0,message:t.error});throw n;}))}function lt(n){n&&(n.artifacts=[],n.descriptors=[],n.ncicDentalCodes=[],n.namUsDentalCodes=[])}function p(n,t){for(var r=[],i=0;i<16;i++)(function(t){r.push({code:function(i){var r=null;if(arguments.length>0)v.dentalChart||(v.dentalChart={}),v.dentalChart[n]||(v.dentalChart[n]=[]),r=_.find(v.dentalChart[n],{index:t}),r?r.code=i.toUpperCase():v.dentalChart[n].push({index:t,code:i.toUpperCase()});else return _.get(_.find(_.get(v.dentalChart,n),{index:t}),"code")}})})(t==="upper"?i:31-i);return r}function tt(n){return function(){return v.errors[n].some(function(n){return n.$error})}}function it(n){return function(){for(var t=v.errors[n].filter(function(n){return n.$error}).map(function(n){return n.$error.message}),i=t.length-1;i>0;i--)t.slice(0,i).indexOf(t[i])>=0&&t.splice(i,1);return t}}function y(n){return!n||!n.code?!0:n.code===""}var v={availabilityCode:{noKnownInfo:"NoKnownInformation",elsewhere:"Elsewhere",entered:"Entered"},edit:!c,hasNcicChartErrors:tt("ncicDentalCodes"),ncicChartErrors:it("ncicDentalCodes"),hasNamUsChartErrors:tt("namUsDentalCodes"),namUsChartErrors:it("namUsDentalCodes"),upperNcicCodes:p("ncicDentalCodes","upper"),lowerNcicCodes:p("ncicDentalCodes","lower"),upperNamUsCodes:p("namUsDentalCodes","upper"),lowerNamUsCodes:p("namUsDentalCodes","lower"),dataDeletionOnSave:ut,canConvertNcicToNamUs:k,convertNcicToNamUs:ft,convertingWillOverwriteNamUsCodes:et,mapNcicToNamUs:d,validateNamUs:g,dentalChart:n.copy(h.dentalChart),noKnownInformation:st(h.dentalChart||{}),artifacts:[],descriptors:[],errors:{city:{},email:{},firstName:{},lastName:{},phone:{},state:{},street1:{},street2:{},zipCode:{},ncicDentalCodes:[],namUsDentalCodes:[]},clearError:rt,hasErrors:!1},w={City:v.errors.city,Email:v.errors.email,First:v.errors.firstName,Last:v.errors.lastName,Phone:v.errors.phone,State:v.errors.state,Street1:v.errors.street1,Street2:v.errors.street2,ZipCode:v.errors.zipCode};return b(),d(),{onLoad:function(n){return i.all([t.get(u.dentalArtifacts).then(function(t){n.artifacts=t.data}),t.get(u.dentalDescriptors).then(function(t){n.descriptors=t.data})])},templateUrl:f.dentalModal.toString(),data:v,onResult:function(n){return r.clearServerValidationErrors(w),b(),ct(n)},fieldErrorMap:w}}return{prepareEditModal:h}}n.module("app").service("CommonCaseDentalModalService",["$http","$q","namusModal","hrefs","templateUrls","localized","codeCopyService","commonService",t])}(angular),function(n,t){"use strict";function i(t,i,u,f,e,o,s,h){function w(n){return n.dnaTestingNotPerformed===!0?"Not Tested":n.dnaSampleStatus?n.dnaSampleStatus.localizedName:void 0}function v(){return i.hasPublicViewPermission()}function l(){return i.get()}function b(n){var t=l();return!h.getIsPrintMode()&&_.has(t,"hrefAddDnaSample")&&(!k(n)||_.has(t,"canEditVerifiedDnaSamples"))}function k(t){if(!n.isDefined(t))return!1;var i=_.find(l().dnaSamples,{identityId:t.identityId});return i?!!i.verified:!1}function d(){return h.getIsPrintMode()===!0?(y(),!0):!1}function g(){var n=l().dnaNoKnownInformationIndicator||{};return n.noKnownInformation}function nt(){var n=l().dnaNoKnownInformationIndicator;return n?n.comment:""}function a(){return l().dnaSamples||[]}function tt(){return!_.some(p(a()))}function it(n){e.openDnaModal(l(),n)}function rt(n){f.openConfirmItemDeletionDialog(n,"DNA sample")}function ut(n){var i=n.dnaLabLocation||{},t=i.localizedName;return _.lowerCase(i.name)==="other"&&(t=n.dnaLabLocationOther||t),t}function ft(n){if(n.dnaTestingNotPerformed===!0)return"not-tested";return n.dnaSampleStatus&&n.dnaSampleStatus.name&&{Complete:"complete",Submitted:"submitted",Collected:"collected","Not Tested":"not-tested","No Results":"no-results",Pending:"pending","Not Available":"not-available"}[n.dnaSampleStatus.name]||"status-label-empty"}function et(n){return n&&n.dnaTests&&n.dnaTests.length>0?_.sortBy(n.dnaTests,[function(n){return n.dnaTechnology.id}]):[]}function y(){for(var i=a(),n=[0,c.length],t=0;t<i.length;t++)n.push(!0);Array.prototype.splice.apply(c,n)}function ot(){for(var i=a(),n=[0,c.length],t=0;t<i.length;t++)n.push(!1);Array.prototype.splice.apply(c,n)}function st(n){c[n]=!c[n]}function ht(n){return!c[n]}var p=u("notDeleted"),c=[];t.hide=v;t.canEdit=b;t.caseInfo=l;t.noKnownInformation=g;t.noKnownInformationComment=nt;t.samples=a;t.hasNoSamples=tt;t.editSample=it;t.deleteSample=rt;t.getLabLocation=ut;t.getStatusClass=ft;t.getTests=et;t.expandAllSamples=y;t.collapseAllSamples=ot;t.toggleSample=st;t.isSampleCollapsed=ht;t.yesno=r;t.shouldExpand=d;t.getStatus=w;s.register("biometrics",{hide:v});s.register("DNA",{hide:v})}function r(n,i,r){var u=t;return n===!0?u=i:n===!1&&(u=r),u}n.module("app").controller("commonCaseDNA",["subSection","CaseService","$filter","commonModalService","DnaModalService","appConstants","NavigationService","OptionService",i])}(angular),function(n,t){"use strict";function i(n,i,r,u,f,e){function s(){return h(o)}function c(n){return n.namus2Number}var h=i("notDeleted"),o=[];r.onCaseLoad(function(t){o=[];t.hrefDuplicates&&t.status.name!=e.caseLifecycleStatus.Deleted&&n.get(t.hrefDuplicates).then(function(n){n.data&&n.data.count>0&&(o=_.filter(n.data.results,function(n){var i=_.indexOf(t.nonDuplicates,c(n));return i===-1}))})});return f.registerDuplicates(function(){var n=t;return s().length&&(n={viewDuplicates:function(n){n.stopPropagation();n.preventDefault();u.goToPage("duplicates")}}),n}),{get:s}}n.module("app").service("DuplicatesService",["$http","$filter","CaseService","CaseNavigationService","AdminToolService","appConstants",i])}(angular),function(n){"use strict";function t(n,t,i,r,u,f,e,o,s){function l(){return r.hasPublicViewPermission()}function c(){return r.get()}function y(){return s.getIsPrintMode()}function p(){var n=c();return!s.getIsPrintMode()&&(_.has(n,"hrefAddFingerprintRecord")||_.has(n,"fingerprintRecord.hrefUpdate"))}function w(){f.openModal(c(),"edit",function(){})}function h(){return c().fingerprintRecord||{}}function b(){return h().availability==="NoKnownInformation"}function k(){return h().commentText}function d(){var n=h().availability,t=h().commentText;return n!=="Entered"&&n!=="Elsewhere"&&!t}function g(){var n=h().availability;return n==="Entered"}function nt(){var n=h().availability;return n==="Elsewhere"}function a(n){return n&&_.some(n)}function tt(){return a(h().ncicCodes)}function it(){return a(h().iafisCodes)}function v(n,t){return n?t==="right"?n.slice(0,5):n.slice(5,10):new Array(5)}function rt(n){return v(h().ncicCodes,n)}function ut(n){return v(h().iafisCodes,n)}function ft(){return h().commentText}function et(){if(h().uploadStatus==="Uploaded"&&h().uploadDate)return u.fingerprints.AFISUploadStatus_Loaded+" "+e(h().uploadDate).format("MMM D, YYYY");if(h().uploadStatus){var n="";return h().uploadStatus==="Uploaded"&&(n=u.fingerprints.AFISUploadStatus_Uploaded),h().uploadStatus==="NotUploaded"&&(n=u.fingerprints.AFISUploadStatus_NotUploaded),h().uploadStatus==="NotEligible"&&(n=u.fingerprints.AFISUploadStatus_NotEligible),n}return u.fingerprints.AFISUploadStatus_Unknown}n.hide=l;n.canEdit=p;n.edit=w;n.noKnownInformation=b;n.noKnownInformationComment=k;n.noInformationEntered=d;n.entered=g;n.enteredElsewhere=nt;n.hasNcicCodes=tt;n.hasIafisCodes=it;n.fingerprintCodesNcic=rt;n.fingerprintCodesIafis=ut;n.fingerprintRecordComments=ft;n.fingerprintUploadStatus=et;n.isPrintMode=y;o.register("Fingerprints",{hide:l})}n.module("app").controller("commonCaseFingerprints",["subSection","scope","$location","CaseService","localized","commonCaseFingerprintsModalService","moment","NavigationService","OptionService",t])}(angular),function(){"use strict";function n(){function t(t){return n(t,!0)}function i(t){return n(t,!1)}function n(n,t){var i;if(n==null)return null;if(n.length<2)return"";if(i=n.toUpperCase(),i==="AA"||i==="TT")return"AU";if(i==="XX"||i==="SR")return i;var u=i.substring(0,1),f=i.substring(1,1),r=parseInt(i,10);if(r!==NaN){if(t){if(r>50)return"RS";if(r<51)return"LS"}if(!t){if(r>50)return"LS";if(r<51)return"RS"}}return"PCXD".indexOf(u)>=0&&"IMO".indexOf(f)>=0?"WU":"UC"}return{mapNcicToIafisLeftHand:t,mapNcicToIafisRightHand:i}}angular.module("app").factory("commonFingerprintCodeMappingService",[n])}(_),function(n){"use strict";function t(){function i(n){var i=[];return t(n)||i.push("FingerprintCodesMustBeTwoCharacters"),u(n)||i.push("UnknownFingerprintCode"),i}function r(n){var i=[];return t(n)||i.push("FingerprintCodesMustBeTwoCharacters"),f(n)||i.push("UnknownFingerprintCode"),i}function t(n){var t=!0;return n&&(t=n.length===2),t}function u(t){var u=!0,i,f,e,r;return t&&t.length===2&&(i=t.toUpperCase(),f=["AA","TT","XX","SR"],n.find(f,function(n){return n===i})||(e=/^\d\d|[PCXD][IMO]$/,r=i.match(e),u=r&&r[0]===i)),u}function f(t){var i=!0,r,u;return t&&t.length===2&&(r=t.toUpperCase(),u=["WU","AU","RS","LS","SR","XX","UC","UP"],i=n.find(u,function(n){return n===r})!==undefined),i}return{validateNcic:i,validateIafis:r}}angular.module("app").factory("commonFingerprintCodeValidationService",[t])}(_),function(n,t){"use strict";function i(i,r,u,f,e,o,s,h,c,l,a){function v(f,e,v){function st(){y.fingerprintRecord.uploadDate=t;y.errors.uploadDate.$error=null}function ht(){y.fingerprintRecord.submissionDate=t;y.errors.submissionDate.$error=null}function nt(){for(var n=0;n<10;n++)y.errors.ncicCodes[n]={},w["NcicCodes["+n+"]"]=y.errors.ncicCodes[n],y.errors.iafisCodes[n]={},w["IafisCodes["+n+"]"]=y.errors.iafisCodes[n]}function ct(n){n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null)}function lt(n){var t=u.isPutPostDisabledByError(n);if(t)throw"put/post disabled";}function at(n){return n.availability||n.ncicCodes||n.iafisCodes}function k(n,t){var i=[],r;if(n&&n.length>=10)i=n.slice(t,t+5).map(function(n){return{code:n.code,index:n.index}});else for(r=0;r<5;r++)i.push({code:"",index:t}),t++;return i}function g(n){return n.availability==="NoKnownInformation"}function vt(){return(y.noKnownInformation||y.fingerprintRecord.availability==="Elsewhere")&&(b(_.concat(y.ncicRightCodes,y.ncicLeftCodes))||b(_.concat(y.iafisRightCodes,y.iafisLeftCodes))||!!y.fingerprintRecord.uploadStatus||!!y.fingerprintRecord.uploadDate||!!y.fingerprintRecord.submissionStatus||!!y.fingerprintRecord.submissionDate)}function tt(){return(_.find(y.ncicRightCodes,function(n){return n.code})||_.find(y.ncicLeftCodes,function(n){return n.code}))&&!_.find(y.errors.ncicCodes,function(n){return n.$error})}function yt(){var n=l.copy(y.mappedIafisRightCodes),t=l.copy(y.mappedIafisLeftCodes);y.iafisRightCodes=n;y.iafisLeftCodes=t;rt()}function pt(){var n=!1;return tt()&&(n=l.willOverwrite(y.mappedIafisRightCodes,y.iafisRightCodes)||l.willOverwrite(y.mappedIafisLeftCodes,y.iafisLeftCodes)),n}function it(){var t,i,n;for(wt(),t=[],i=[],n=0;n<5;n++)t.push({code:h.mapNcicToIafisRightHand(y.ncicRightCodes[n].code),index:n}),i.push({code:h.mapNcicToIafisLeftHand(y.ncicLeftCodes[n].code),index:n+5});y.mappedIafisRightCodes=t;y.mappedIafisLeftCodes=i}function wt(){for(var i,t,r=_.concat(y.ncicRightCodes,y.ncicLeftCodes).map(d),n=0;n<10;n++)for(y.errors.ncicCodes[n]={},w["NcicCodes["+n+"]"]=y.errors.ncicCodes[n],i=c.validateNcic(r[n].code),t=0;t<i.length;t++)y.errors.ncicCodes[n].$error={serverValidation:!1,message:s.fingerprints.validationError[i[t]]}}function rt(){for(var i,t,r=_.concat(y.iafisRightCodes,y.iafisLeftCodes).map(d),n=0;n<10;n++)for(y.errors.iafisCodes[n]={},w["IafisCodes["+n+"]"]=y.errors.iafisCodes[n],i=c.validateIafis(r[n].code),t=0;t<i.length;t++)y.errors.iafisCodes[n].$error={serverValidation:!1,message:s.fingerprints.validationError[i[t]]}}function d(n){return n?{code:n.code,index:n.index}:{code:"",index:""}}function bt(n){var t=n;return _.every(y.fingerprintRecord.ncicCodes,ut)&&delete t.ncicCodes,_.every(y.fingerprintRecord.iafisCodes,ut)&&delete t.iafisCodes,t}function ut(n){return!n||!n.code?!0:n.code===""}function kt(n){var e=n.edit||f.hrefAddFingerprintRecord,o=n.edit?i.put:i.post,t=_.concat(n.ncicRightCodes,n.ncicLeftCodes).map(d),u=_.concat(n.iafisRightCodes,n.iafisLeftCodes).map(d);return n.noKnownInformation?n.fingerprintRecord.availability="NoKnownInformation":g(p)&&g(n.fingerprintRecord)&&(n.fingerprintRecord.availability=null),b(t)||b(u)?(n.fingerprintRecord||(n.fingerprintRecord={}),n.fingerprintRecord.ncicCodes=t,n.fingerprintRecord.iafisCodes=u):n.fingerprintRecord&&(b(n.fingerprintRecord.ncicCodes)||b(n.fingerprintRecord.iafisCodes))&&(n.fingerprintRecord.ncicCodes=t,n.fingerprintRecord.iafisCodes=u),dt(bt(n.fingerprintRecord),f.fingerprintRecord)?r.when(n):o(e,n.fingerprintRecord).then(function(t){return f.fingerprintRecord=t.data,n})}function b(n){return n&&_.some(n,function(n){return(n.code||"").length>0})}function ft(n){return n.some(function(n){return n.$error})}function et(n){for(var t=n.filter(function(n){return n.$error}).map(function(n){return n.$error.message}),i=t.length-1;i>0;i--)t.slice(0,i).indexOf(t[i])>=0&&t.splice(i,1);return t}function dt(t,i){return t===i||!!t&&!!i&&namus.textEquals(t.commentText,i.commentText)&&ot(t.ncicCodes,i.ncicCodes)&&ot(t.iafisCodes,i.iafisCodes)&&_.every(["availability","uploadDate","uploadStatus","submissionDate","submissionStatus"],function(r){return n.equals(t[r],i[r])})}function ot(n,t){return n===t||!!n&&!!t&&_.every(_.zipWith(n,t,function(n,t){return n.code.toUpperCase()===t.code.toUpperCase()}),function(n){return n===!0})}var p=f&&(f.fingerprintRecord||{}),y={modalMode:e,edit:p.hrefUpdate,editFingerprintUploadStatus:a.isCurrentUserNamUsPersonnel(),fingerprintRecord:n.copy(p),fingerprintsAvailable:at(p),noKnownInformation:g(p),dataDeletionOnSave:vt,canConvertNcicToIafis:tt,convertNcicToIafis:yt,convertingWillOverwriteIafisCodes:pt,mapNcicToIafis:it,validateIafis:rt,hasNcicChartErrors:function(){return ft(y.errors.ncicCodes)},hasIafisChartErrors:function(){return ft(y.errors.iafisCodes)},ncicChartErrors:function(){return et(y.errors.ncicCodes)},iafisChartErrors:function(){return et(y.errors.iafisCodes)},ncicRightCodes:k(p.ncicCodes,0),ncicLeftCodes:k(p.ncicCodes,5),iafisRightCodes:k(p.iafisCodes,0),iafisLeftCodes:k(p.iafisCodes,5),errors:{ncicCodes:[],iafisCodes:[],uploadDate:{},submissionDate:{}},uploadDateValidation:{onInvalid:function(){y.errors.uploadDate.$error={serverValidation:!0,message:s.common.invalidDate,disablePutPost:!0}},onValid:function(){y.errors.uploadDate.$error=null}},submissionDateValidation:{onInvalid:function(){y.errors.submissionDate.$error={serverValidation:!0,message:s.common.invalidDate,disablePutPost:!0}},onValid:function(){y.errors.submissionDate.$error=null}},clearUploadDate:st,clearSubmissionDate:ht,clearError:ct},w={UploadDate:y.errors.uploadDate,SubmissionDate:y.errors.submissionDate};nt();it();u.show({templateUrl:o.fingerprintsModal.toString(),data:y,onResult:function(n){lt(w);nt();return kt(n).then(function(){v&&v()}).catch(function(n){u.setServerValidationErrors(n,w);throw n;})}})}return{openModal:v}}n.module("app").service("commonCaseFingerprintsModalService",["$http","$q","namusModal","appConstants","hrefs","templateUrls","localized","commonFingerprintCodeMappingService","commonFingerprintCodeValidationService","codeCopyService","identity",i])}(angular),function(n){"use strict";function t(t,i,r,u,f,e,o){function k(){var n=s();return!o.getIsPrintMode()&&(_.has(n,"hrefAddInvestigatingAgency")||_.has(n,"hrefAddCaseOwner")||_.has(n,"caseOwner.hrefUpdate"))}function s(){return i.get()}function d(){return i.hasPublicViewPermission()}function g(){return o.getIsPrintMode()===!0?(nt(),!0):!1}function nt(){for(var t=l()||[],n=0;n<t.length;n++)h[n]=!0}function tt(n,t){var r=s(),u=r.caseOwner||{},i=u.investigatingAgencyIdentityId;return n.type==="number"&&t.type==="number"?n.value===i?-1:t.value===i?1:n.value-t.value:n.index-t.index}function l(){var n=s();return n.investigatingAgencies||[]}function it(t){var i=t||{};return!n.isDefined(i.properties)}function c(n){return n.selection||n.properties||{}}function p(n){var t,i;return n.selection&&!it(n)?t=n.selection.contact?n.selection.contact:n.properties.contact:(i=c(n),t=i.contact),t}function a(n){return p(n)||{}}function w(n){var t=c(n);return t.agency}function v(n){return w(n)||{}}function rt(n){return h[n]}function ut(n){return!h[n]}function ft(n){h[n]=!h[n]}function et(n){var t=v(n);return t.name}function ot(n){var t=v(n);return t.hrefProfile}function st(n){var t=v(n);return append(y(t.phone)," ext. ",t.phoneExtension)}function ht(n){var t=a(n);return append(t.firstName," ",t.lastName,", ",ct(t))}function ct(n){return n.jobTitle?n.jobTitle:"--"}function lt(n){var t=a(n);return append(y(t.phone1)," ext. ",t.phone1Extension)}function at(n){var t=a(n);return t.email}function vt(n){var t=c(n);return t.caseNumber}function yt(n){var t=c(n);return t.dateReported}function pt(n){return e.isCurrentUserAdministrator()&&n.properties}function wt(){return!_.some(b(l()))}function bt(){f.openEditModal({},s())}function kt(n){f.openEditModal(n,s())}function dt(n){u.openConfirmItemDeletionDialog(n,"investigating agency",function(){return f.deletePostProcessing(s())})}function gt(n){var t=s().caseOwner||{};return n.id===t.investigatingAgencyIdentityId}var y=r("phone"),b=r("notDeleted"),h={};t.canEdit=k;t.comparer=tt;t.contact=p;t.agency=w;t.collapsed=ut;t.expanded=rt;t.toggle=ft;t.caseNumber=vt;t.dateReported=yt;t.investigatingAgencies=l;t.noInformationEntered=wt;t.addAgency=bt;t.editAgency=kt;t.deleteAgency=dt;t.isCaseOwner=gt;t.showCurationMsg=pt;t.agencyName=et;t.agencyProfile=ot;t.agencyPhone=st;t.contactName=ht;t.contactPhone1=lt;t.contactEmail=at;t.shouldExpand=g;t.hideNotes=d}n.module("app").controller("CommonCaseInvestigatingAgencies",["subSection","CaseService","$filter","commonModalService","CommonCaseInvestigatingAgenciesModalService","identity","OptionService",t])}(angular),function(n){"use strict";function t(t,i,r,u,f,e,o){function l(l,p){function k(){return!!l.properties}function nt(){return l.properties&&l.properties.agency||{}}function g(){return l.properties&&l.properties.contact||{}}function tt(){if(!k())return!1;var n=g();return!!n.firstName||!!n.lastName||!!n.email}function it(n){return w.canEditCaseOwner=!!p.hrefAddCaseOwner||!!p.caseOwner&&!!p.caseOwner.hrefUpdate,i.all([fi(),ui(n,l)])}function rt(n){var t=r.isPutPostDisabledByError(n);if(t)throw"put/post disabled";}function ut(n){var r=n.newContact&&n.newContact.id||n.contact&&n.contact.id,u=n.edit?t.put:t.post,f=n.edit?n.investigatingAgency.hrefUpdate:p.hrefAddInvestigatingAgency,e={properties:n.curationComplete?n.investigatingAgency.properties:null,selection:{id:n.investigatingAgency.selection&&n.investigatingAgency.selection.id,agency:{id:n.newAgency&&n.newAgency.id||n.agency&&n.agency.id},contact:!n.noInvestigatorEntered&&r?{id:r}:null},caseNumber:n.investigatingAgency.caseNumber,dateReported:n.investigatingAgency.dateReported,notes:n.investigatingAgency.notes};return ft(n,l)||et(n)?u(f,e).then(function(t){var i=_.findIndex(p.investigatingAgencies,{id:t.data.id});return t.data.properties&&(t.data.properties.agency=w.legacyAgency()),n.investigatingAgency=t.data,i===-1?p.investigatingAgencies.push(t.data):p.investigatingAgencies[i]=t.data,n}):i.when(n)}function ft(n,t){return n.curationComplete||n.newAgency||n.newContact||!namus.textEquals(n.investigatingAgency.caseNumber,t.caseNumber)||n.investigatingAgency.dateReported!==t.dateReported||!namus.textEquals(n.investigatingAgency.notes,t.notes)||!t.selection&&(n.agency||n.contact)||t.selection&&n.agency&&_.get(t,"selection.agency.id")!==_.get(n,"agency.id")||t.selection&&n.contact&&!n.noInvestigatorEntered&&_.get(t,"selection.contact.id")!==_.get(n,"contact.id")}function et(n){return n.noInvestigatorUponOpen!==n.noInvestigatorEntered?!n.noInvestigatorEntered&&!n.contact?!1:!0:!1}function ot(n){var r=p.caseOwner&&p.caseOwner.investigatingAgencyIdentityId,u=r>0&&n.investigatingAgency.id>0?r===n.investigatingAgency.id:!1,f=p.caseOwner&&p.caseOwner.hrefUpdate?t.put:t.post,e=p.caseOwner&&p.caseOwner.hrefUpdate||p.hrefAddCaseOwner,o={id:p.caseOwner&&p.caseOwner.id,investigatingAgencyIdentityId:n.isCaseOwner?n.investigatingAgency.id:null};return n.isCaseOwner!==u?f(e,o).then(function(t){return p.caseOwner=t.data,n}):i.when(n)}function st(t){var i=t.selection||t.properties||{},r=i.agency||{};return n.copy(r)}function ht(t){var i=(t.selection||{}).contact||(t.properties||{}).contact;return n.copy(i)}function ct(){w.newAgency=null}function lt(){w.newContact=null}function at(){var t=w.newAgency;return t?n.copy({name:t.name,address:{address1:t.address.address1,address2:t.address.address2,city:t.address.city,county:t.address.county,state:t.address.state,zipCode:t.address.zipCode},phone:t.phone,phoneExtension:t.phoneExtension,ori:t.ori,websiteUrl:t.websiteUrl,agencyType:t.type?t.type.localizedName:null,email:t.email,jurisdiction:t.jurisdiction?t.jurisdiction.localizedName:null,tribalAccessParticipant:t.tribalAccessParticipant?t.tribalAccessParticipant.localizedName:null},s):n.copy({},s),s}function vt(){var i=w.newContact,t;return i?(t=i.profile||{},n.copy({firstName:i.firstName,lastName:i.lastName,jobTitle:t.jobTitle,phone1Type:t.phone1Type,phone1:t.phone1,phone1Extension:t.phone1Extension,isPublicPhone1:t.isPublicPhone1,phone2Type:t.phone2Type,phone2:t.phone2,phone2Extension:t.phone2Extension,isPublicPhone2:t.isPublicPhone2,email:t.personalEmail,isPublicEmail:t.isPublicEmail},h)):n.copy({},h),h}function yt(n,t){w.agency=n;w.agencyData=n;w.contact=null;ei(n,t)}function pt(){w.contact=null}function wt(){w.contact=null}function bt(n){w.newAgency=n;w.contact=null;w.contacts=c;d()}function kt(n){w.newContact=n;d()}function dt(){return e.isCurrentUserAdministrator()}function gt(){return!!l.selection&&!!l.selection.contact||!!k()&&!!tt()}function ni(){return!gt()}function ti(){w.newAgency?w.agencyDataToPrepopulate=w.newAgency:(w.hasLegacyData()===!0||w.agency==null)&&(w.agencyDataToPrepopulate=l.properties==null?{}:n.copy(l.properties.agency));w.showAddAgency=!0;w.showAddContact=!1;w.showDefault=!1}function ii(){w.newContact?w.personDataToPrepopulate=w.newContact:(w.hasLegacyData()===!0||w.contact==null)&&(w.personDataToPrepopulate=l.properties==null?{}:n.copy(l.properties.contact));w.showAddAgency=!1;w.showAddContact=!0;w.showDefault=!1}function ri(n){w.personDataToPrepopulate={firstName:n.firstName,lastName:n.lastName,jobTitle:n.profile.jobTitle,phone1:n.profile.phone1,phone2:n.profile.phone2,email:n.profile.personalEmail};w.showAddAgency=!1;w.showAddContact=!0;w.showDefault=!1}function d(){w.showAddAgency=!1;w.showAddContact=!1;w.showDefault=!0}function ui(n,r){var o=r.selection||r.properties||{},f=o.agency||{},e=i.when({});return!f.id&&f.ori&&(e=t.get(u.agencyByOri+"?ori="+f.ori).then(function(t){n.agencyData.id=t.id})),e}function fi(){var f=l.properties||{},e=f.contact||{},n=e.email,o=u.contactsByEmail+"?email="+n,r=i.when();return n&&(r=t.get(o).then(function(n){c=n.data.results})),r}function ei(n,i){if(n&&n.id){var r=i&&i.id?"?existingContactId="+i.id:"";t.get(u.agencyContactsByAgencyId.replace(/(agency\/)\d+/i,"$1"+n.id)+r).then(function(n){if(n.data){var t=i&&(i.id?{id:i.id}:{lastName:i.lastName}),r=n.data;w.contacts=_.uniqBy(r,"id");w.contact=t&&_.find(w.contacts,t)}})}}function oi(n,t,i,r,u){var f=append(n," ",t);return f||(f="Unidentified Contact"),i&&(f=f+", "+i),r&&(f=f+", "+r),u&&(f=f+" ("+o.account.disabled+")"),f}var w={agencyDataToPrepopulate:{},personDataToPrepopulate:{},hasLegacyData:k,legacyAgency:nt,legacyContact:g,canEditCaseOwner:!1,investigatingAgency:n.copy(l),showCurationComplete:!!l.properties&&e.canCurrentUserManageCases(),isCaseOwner:!!p.caseOwner&&!!l.hrefUpdate&&l.id===p.caseOwner.investigatingAgencyIdentityId,noInvestigatorUponOpen:!!l.selection&&!l.selection.contact,noInvestigatorEntered:ni(),isAdmin:dt,showDefault:!0,showAddAgency:!1,showAddContact:!1,addAgency:ti,addContact:ii,editContact:ri,onAgencyAdded:bt,onAgencyContactAdded:kt,onCancel:d,getAgencyContactFullName:oi,edit:!!l.hrefUpdate,projectNewAgency:at,projectNewContact:vt,newAgency:null,newContact:null,onAgencyChanged:yt,onStateChanged:pt,onCountyChanged:wt,agencyData:st(l),personData:ht(l),selectExistingAgency:ct,selectExistingContact:lt,contacts:[],errors:{agency:{},contact:{},caseNumber:{},dateReported:{}},validation:{dateReported:{onInvalid:function(){w.errors.dateReported.$error={serverValidation:!0,message:o.common.invalidDate,disablePutPost:!0}},onValid:function(){w.errors.dateReported.$error=null}}},clearError:y},b={"Selection.Agency.Id":w.errors.agency,"Selection.Contact.Id":w.errors.contact,CaseNumber:w.errors.caseNumber,DateReported:w.errors.dateReported};r.show({onLoad:it,templateUrl:f.investigatingAgencyModal.toString(),data:w,onResult:function(n){return rt(b),r.clearServerValidationErrors(b),i.when(n).then(a).then(v).then(ut).then(ot).catch(function(n){r.setServerValidationErrors(n,b);throw n;})}})}function a(n){return n.newAgency?t.post(u.addAgencyApi,n.newAgency).then(function(t){return n.newAgency=t.data,n}):i.when(n)}function v(n){var r=n.newAgency&&n.newAgency.id||n.agency&&n.agency.id,f=u.addAgencyContactApi.replace(/(agencies\/)\d+/i,"$1"+r);return r&&n.newContact?t.post(f,n.newContact).then(function(t){return n.newContact.id=t.data,n}):i.when(n)}function y(n){n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null)}function p(r){var u=r.caseOwner||{},s=u.investigatingAgencyIdentityId,e=_.find(r.investigatingAgencies,{id:s}),o=i.when(),f;return e&&e._deleted&&(f=n.copy(u),f.investigatingAgencyIdentityId=null,u.hrefUpdate&&(o=t.put(u.hrefUpdate,f).then(function(){r.caseOwner={}}))),o}var c=[],s={},h={};return{openEditModal:l,deletePostProcessing:p}}n.module("app").service("CommonCaseInvestigatingAgenciesModalService",["$http","$q","namusModal","hrefs","templateUrls","identity","localized",t])}(angular),function(n){"use strict";function t(n,t,i,r,u,f,e,o){function a(){return t.hasPublicViewPermission()}function s(){return t.get()}function p(){var n=s();return!o.getIsPrintMode()&&_.has(n,"hrefAddMedicalFeatureDescription")}function h(){var n=s().medicalFeaturesNoKnownInformationIndicator||{};return n.noKnownInformation}function c(){var n=s().medicalFeaturesNoKnownInformationIndicator;return n?n.comment:""}function v(){return s().medicalFeatureDescriptions||[]}function l(){return!_.some(y(v()))}function w(){f.openFeaturesModal({},s(),h(),l(),c())}function b(n){f.openFeaturesModal(n,s(),h(),l(),c())}function k(n){r.openConfirmItemDeletionDialog(n,"medical feature")}var y=i("notDeleted");n.hide=a;n.canEdit=p;n.noKnownInformation=h;n.noKnownInformationComment=c;n.features=v;n.hasNoFeatures=l;n.addFeature=w;n.editFeature=b;n.deleteFeature=k;e.register("MedicalData",{hide:a})}n.module("app").controller("CommonCaseMedicalData",["subSection","CaseService","$filter","commonModalService","appConstants","MedicalDataModalService","NavigationService","OptionService",t])}(angular),function(n){"use strict";function t(t,r,u,f,e,o,s,h,c){function l(e,l,a,v,y){function b(i){var f=i.edit?t.put:t.post,o=i.edit?e.hrefUpdate:l.hrefAddMedicalFeatureDescription;return i.noKnownInformation||k(i.featureDescription,e)?r.when(i):f(o,i.featureDescription).then(function(t){var r=t.data;return i.edit?n.copy(r,e):l.medicalFeatureDescriptions.push(r),i}).catch(function(n){u.setServerValidationErrors(n,w);throw n;})}function k(t,i){c.removePropertiesBeforeEqualityCheck(t,"feature",i,"feature",["ordinal","instructions"]);return _.every(["description"],function(n){return namus.textEquals(_.get(t,n),_.get(i,n))})&&_.every(["feature"],function(r){return n.equals(_.get(t,r),_.get(i,r))})}function d(n){var t=!1,i=a||!1;return(i!==n.noKnownInformation||n.noKnownInformation&&y!==n.comment)&&(t=!0),t}function g(n){return d(n)?f.save(l.hrefAddMedicalFeaturesNoKnownInformationIndicator,l.medicalFeaturesNoKnownInformationIndicator,a,n.noKnownInformation,y,n.comment).then(function(t){return l.medicalFeaturesNoKnownInformationIndicator=t.data,n}):r.when(n)}function nt(n){var i=null,t=1200;p.disabled=p.featureDescription&&p.featureDescription.description&&p.featureDescription.description.length>t;p.disabled&&(i={serverValidation:!0,message:_.replace(_.replace(h.common.descriptionLengthExceeds,"{0}",t),"{1}",this.featureDescription.description.length-t)});n.$error=i}var p={edit:e.hrefUpdate,noKnownInformation:a,noInformationEntered:v,comment:y,featureDescription:n.copy(e),medicalFeatures:[],errors:{feature:{},description:{}},clearError:i,descriptionChanged:nt},w={Feature:p.errors.feature,Description:p.errors.description};u.show({small:!0,onLoad:function(n){return t.get(o.medicalFeatures).then(function(t){n.medicalFeatures=t.data})},templateUrl:s.medicalModal.toString(),data:p,onResult:function(n){u.clearServerValidationErrors(w);return g(n).then(b).catch(function(n){u.setServerValidationErrors(n,w);throw n;})}})}return{openFeaturesModal:l}}function i(n){n.$error=null}n.module("app").service("CommonCaseMedicalDataModalService",["$http","$q","namusModal","commonNoKnownInformationService","appConstants","hrefs","templateUrls","localized","commonService",t])}(angular),function(n){"use strict";function t(n,t,i,r,u,f,e,o,s,h){function c(){return t.get()}function l(){return c().physicalDescription||{}}function b(){var n=c();return!h.getIsPrintMode()&&(_.has(n,"hrefAddPhysicalDescription")||_.has(n,"physicalDescription.hrefUpdate"))}function rt(){return h.getIsPrintMode()}function ut(){e.openDescriptionModal(c())}function k(){return c().physicalFeatureDescriptions||[]}function v(){var n=c().physicalFeaturesNoKnownInformationIndicator||{};return n.noKnownInformation}function y(){var n=c().physicalFeaturesNoKnownInformationIndicator;return n?n.comment:""}function p(){return!_.some(it(k()))}function ft(){e.openFeaturesModal({},c(),v(),p(),y())}function et(n){e.openFeaturesModal(n,c(),v(),p(),y())}function ot(n){f.openConfirmItemDeletionDialog(n,"distinctive physical feature")}function a(){return b()&&t.showRequiredFieldInfo(c())}function d(){return!a()||!!l().hairColor}function g(){return!a()||!!l().leftEyeColor}function nt(){return!a()||!!l().rightEyeColor}function tt(){return r.sectionIsInvalid(w)}var it=u("notDeleted"),w;n.canEdit=b;n.description=l;n.edit=ut;n.isPrintMode=rt;n.features=k;n.noKnownInformation=v;n.noKnownInformationComment=y;n.hasNoFeatures=p;n.addFeature=ft;n.editFeature=et;n.deleteFeature=ot;n.showRequiredFieldInfo=a;n.isHairColorValid=d;n.isLeftEyeColorValid=g;n.isRightEyeColorValid=nt;w={title:o.physicalDescription.title,fields:[{name:o.physicalDescription.hairColor,isValid:d},{name:o.physicalDescription.eyeColor,isValid:function(){return g()&&nt()}}],canEdit:n.canEdit,edit:n.edit};r.register(w);i.register("PhysicalDescription",{isInvalid:tt});n.isInvalid=tt}n.module("app").controller("CommonCasePhysicalDescription",["subSection","CaseService","NavigationService","CaseValidationService","$filter","commonModalService","PhysicalDescriptionModalService","localized","appConstants","OptionService",t])}(angular),function(n){"use strict";function t(t,r,u,f,e,o,s,h,c,l){function a(i){function e(){u.specifyBothEyes||(u.physicalDescription.rightEyeColor=n.copy(u.physicalDescription.leftEyeColor))}function h(n,t){return _.every(["bodyHairDescription","facialHairDescription","headHairDescription","eyeDescription"],function(i){return namus.textEquals(_.get(n,i),_.get(t,i))})&&_.every(["hairColor.id","leftEyeColor.id","rightEyeColor.id","specifyBothEyes"],function(i){return _.get(n,i)===_.get(t,i)})}var u={showRequiredFieldInfo:c.showRequiredFieldInfo(i),physicalDescription:n.copy(i.physicalDescription)||{},hairColors:[],eyeColors:[],specifyBothEyes:i.physicalDescription&&n.equals(i.physicalDescription.leftEyeColor,i.physicalDescription.rightEyeColor)===!1,changeLeftEyeColor:e};f.show({onLoad:function(n){return r.all([t.get(o.eyeColors).then(function(t){n.eyeColors=t.data}),t.get(o.hairColors).then(function(t){n.hairColors=t.data})])},templateUrl:s.physicalDescriptionModal.toString(),data:u,onResult:function(n){var u=n.physicalDescription.hrefUpdate?t.put:t.post,f=n.physicalDescription.hrefUpdate||i.hrefAddPhysicalDescription;return e(),h(n.physicalDescription,i.physicalDescription)?r.when({}):u(f,n.physicalDescription).then(function(n){i.physicalDescription=n.data})}})}function v(e,c,a,v,y){function b(i){var u=i.edit?t.put:t.post,o=i.edit?e.hrefUpdate:c.hrefAddPhysicalFeatureDescription;return l.removePropertiesBeforeEqualityCheck(e,"physicalFeature",i.featureDescription,"physicalFeature",["ordinal","instructions"]),i.noKnownInformation||n.equals(i.featureDescription,e)?r.when({}):u(o,i.featureDescription).then(function(t){var r=t.data;return i.edit?n.copy(r,e):c.physicalFeatureDescriptions.push(r),i}).catch(function(n){f.setServerValidationErrors(n,w);throw n;})}function k(n){var t=!1,i=a||!1;return(i!==n.noKnownInformation||n.noKnownInformation&&y!==n.comment)&&(t=!0),t}function d(n){return k(n)?u.save(c.hrefAddPhysicalFeaturesNoKnownInformationIndicator,c.physicalFeaturesNoKnownInformationIndicator,a,n.noKnownInformation,y,n.comment).then(function(t){return c.physicalFeaturesNoKnownInformationIndicator=t.data,n}):r.when(n)}function g(n){var i=null,t=1200;p.disabled=p.featureDescription&&p.featureDescription.description&&p.featureDescription.description.length>t;p.disabled&&(i={serverValidation:!0,message:_.replace(_.replace(h.common.descriptionLengthExceeds,"{0}",t),"{1}",this.featureDescription.description.length-t)});n.$error=i}var p={edit:!!e.hrefUpdate,noKnownInformation:a,noInformationEntered:v,comment:y,featureDescription:n.copy(e),physicalFeatures:[],errors:{physicalFeature:{},description:{}},clearError:i,descriptionChanged:g},w={PhysicalFeature:p.errors.physicalFeature,Description:p.errors.description};f.show({small:!0,onLoad:function(n){return t.get(o.physicalFeatures).then(function(t){n.physicalFeatures=t.data})},templateUrl:s.physicalDistinctiveFeaturesModal.toString(),data:p,onResult:function(n){f.clearServerValidationErrors(w);return d(n).then(b).catch(function(n){f.setServerValidationErrors(n,w);throw n;})}})}return{openDescriptionModal:a,openFeaturesModal:v}}function i(n){n.$error=null}n.module("app").service("CommonCasePhysicalDescriptionModalService",["$http","$q","commonNoKnownInformationService","namusModal","appConstants","hrefs","templateUrls","localized","CaseService","commonService",t])}(angular),function(n){"use strict";function t(n,t,i){function f(){r.name=null;r.phone=null;r.email=null}var r=this,u=n.get();f();u.hrefGetRsaInformation?t.get(u.hrefGetRsaInformation).then(function(n){r.name="".concat(n.data.person.firstName," ",n.data.person.lastName);r.phone=n.data.profile.phone1;r.email=n.data.profile.personalEmail}).catch(function(n){n.status===404&&t.get(i.getOrganization).then(function(n){r.phone=n.data.primaryPhoneNumber;r.email=n.data.email})}):t.get(i.getOrganization).then(function(n){r.phone=n.data.primaryPhoneNumber;r.email=n.data.email})}n.module("app").component("caseContactInformation",{controller:["CaseService","dataContext","hrefs",t],controllerAs:"vm",templateUrl:["templateUrls",function(n){return n.caseContactInformation.toString()}]})}(angular),function(){"use strict";function n(n,t,i){function r(n){return t.get(n).then(function(n){return{status:n.status,data:n.data}})}function u(n,i){return t.post(n,i).then(function(n){return{status:n.status,data:n.data}})}function f(n,i){return t.put(n,i).then(function(n){return{status:n.status,data:n.data}})}return{get:r,put:f,post:u,getUser:function(n){return t.get(n).then(function(n){return{user:n}})},editProfile:function(n,i){return t.put(n,i).then(function(n){return{status:n.status}})},enableUser:function(n){return t.post(n).then(function(n){return{status:n.status}})},getAgencies:function(n){return t.get(n).then(function(n){return{status:n.status,agencies:n}})},getAgencyTypes:function(n){return t.get(n).then(function(n){return{status:n.status,agencyTypes:n.data}})},getJurisdictions:function(n){return t.get(n).then(function(n){return{status:n.status,jurisdictions:n.data}})},getYesNoUnknown:function(n){return t.get(n).then(function(n){return n})},getStates:function(){return t.get(i.states).then(function(n){return{status:n.status,data:n.data}})},getCounties:function(n){return t.get(n).then(function(n){return{status:n.status,data:n.data}})},getSecurityQuestions:function(n){return t.get(n).then(function(n){return{status:n.status,data:n.data}})},getAgency:function(n){return r(i.agency.replace(/(agencies\/)[^\/]+/i,"$1"+n))},editAgency:function(n,i){return t.put(n,i).then(function(n){return{status:n.status,data:n.data}})},deleteAgency:function(n){return t.delete(i.deleteAgencyApi.replace(/(agencies\/)[^\/]+/i,"$1"+n)).then(function(n){return{status:n.status}})},saveSecurityQuestions:function(n,i){return t.put(n,i).then(function(n){return{status:n.status,data:n.data}})}}}angular.module("app").factory("viewAgencyDataContext",["$log","$http","hrefs",n])}(),function(n,t){"use strict";function r(n,i,r,u){function l(){a()}function a(){var t=[v(),w(f.currentAgencyId)];n.all(t).then(function(n){f.allStates=n[0];f.selectedAgency=n[1];f.selectedState=b(f.currentStateName);f.selectedAgency!=null&&(f.selectedState=f.selectedAgency.address.state,f.selectedCounty=f.selectedAgency.address.county)}).then(function(){return s(f.selectedState)}).then(function(){if(f.selectedCounty)return h(f.selectedCounty)}).then(function(){if(f.selectedAgency)return c(f.selectedAgency)})}function o(n,i){var r=t.filter(i||[],function(t){return t.id===n.id});return r!=null&&r.length>0?r[0]:null}function v(){return i.getStates().then(function(n){return n.data})}function y(t){var r;if(t==null)return n.resolve();if(t.hrefGetCounties==null)if(r=o(t,f.allStates),r!=null)t=r;else return n.resolve();return i.get(t.hrefGetCounties).then(function(n){return n.data})}function p(r){var s,u;if(r==null)return n.resolve();if(r.hrefGetAgencies==null)if(s=o(r,f.stateCounties),s!=null)r=s;else return n.resolve();return u=r.hrefGetAgencies+"?a=1",f.extendAgencyName&&(u=u+"&includeExtendedInfo=true"),f.includeUncuratedAgencies&&(u=u+"&includeApprovedOnly=false"),f.includeOwnUncuratedAgencies&&(u=u+"&includeOwnUncuratedAgencies=true"),i.get(u).then(function(n){return r.id===e.countyId&&t.find(n.data,{id:e.agencyId})===undefined?t.concat(n.data,e.agency):n.data})}function w(t){if(!t)return n.resolve();var u=r.agency.replace(/(agencies\/)[^\/]+/i,"$1"+t)+"?withCountyAndState=true";return i.get(u).then(function(n){return t!==e.agencyId||!e||(e.agency=n.data,!n.data.county||(e.countyId=n.data.county.id)),n.data})}function b(i){return i?t.find(f.allStates,{name:i.name}):n.resolve()}function s(n){f.selectedState=n;f.onStateChange({item:n});return y(n).then(function(n){f.stateCounties=n;f.currentCountyName&&(f.selectedCounty=t.find(f.stateCounties,{name:f.currentCountyName.name}))})}function h(n){f.selectedCounty=n;f.onCountyChange({item:n});return p(n).then(function(n){f.countyAgencies=n;f.currentAgencyId&&(f.selectedAgency=t.find(f.countyAgencies,{id:f.currentAgencyId}))})}function c(n){f.selectedAgency=n;f.onAgencyChange({item:n})}function k(n){var t,i;return f.extendAgencyName?(t="",n.address.address1&&n.address.city&&(t=" - "+n.address.address1+", "+n.address.city),i=n.name+t,!n.approved&&u.agency&&u.agency.pendingApproval&&(i+=" ("+u.agency.pendingApproval+")"),i):n.name}var f=this,e={agency:null,agencyId:null,countyId:null};e.agencyId=f.currentAgencyId;f.selectedState={};f.selectedCounty={};f.selectedAgency={};f.allStates=[];f.stateCounties=[];f.countyAgencies=[];f.onStateChanged=s;f.onCountyChanged=h;f.onAgencyChanged=c;f.formatAgencyDisplay=k;f.$onInit=l()}var i=n.module("app");i.component("agencySelection",{controller:["$q","viewAgencyDataContext","hrefs","localized",r],controllerAs:"vm",templateUrl:["templateUrls",function(n){return n.agencySelection.toString()}],bindings:{extendAgencyName:"<",includeUncuratedAgencies:"<",includeOwnUncuratedAgencies:"<",currentAgencyId:"<",currentStateName:"=",currentCountyName:"=",currentAgencyEmail:"=",errors:"=",onStateChange:"&",onCountyChange:"&",onAgencyChange:"&"}})}(angular,_),function(n,t){"use strict";function r(n,i,r,u,f,e){function s(n,t){if(n){var i=c(n.name,t);i&&i.hrefGetCounties&&r.get(i.hrefGetCounties).then(function(n){n.status===200&&(o.stateCounties=n.data)})}}function c(n,t){return t.states.find(function(t){return t.name===n})}function l(){return o.agency.jurisdiction&&o.agency.jurisdiction.name==="Tribal"&&f.isCurrentUserNamUsPersonnel()?!0:!1}function a(n){var t=n.agency.state;s(t,n)}function v(n){n&&n.$error&&(n.$error=null)}function y(){o.onCancel&&o.onCancel()}function p(){w(o.persistOnSave,o.agency).then(function(){if(o.onAgencyAdded)o.onAgencyAdded({agency:o.agency})},function(n){e.setServerValidationErrors(n,h);throw n;})}function w(n,t){return n?r.post(u.addAgencyApi,t):r.post(u.validateAgencyApi,t)}var o=this,h;o.agency={};o.save=p;o.cancel=y;o.yesNoUnknown=[];o.showParticipatesInTap=l;o.stateChanged=a;o.clearError=v;o.newContact={};o.errors={name:{},jurisdiction:{},type:{},address1:{},city:{},state:{},county:{},zipCode:{},contacts:{},firstName:{},lastName:{},phone:{},email:{},websiteDisplayName:{},websiteUrl:{},ori:{}};h={Name:o.errors.name,Jurisdiction:o.errors.jurisdiction,Type:o.errors.type,Address1:o.errors.address1,City:o.errors.city,State:o.errors.state,County:o.errors.county,ZipCode:o.errors.zipCode,Contacts:o.errors.contacts,FirstName:o.errors.firstName,LastName:o.errors.lastName,Phone:o.errors.phone,Email:o.errors.email,WebsiteDisplayName:o.errors.websiteDisplayName,WebsiteUrl:o.errors.websiteUrl,ORI:o.errors.ori};o.$onInit=function(){function i(){return r.get(u.jurisdictions).then(function(n){return n.data})}function f(){return r.get(u.agencyTypes).then(function(n){return n.data})}function l(){return r.get(u.states).then(function(n){return o.states=n.data,r.get(u.yesNoUnknown).then(function(t){return o.yesNoUnknown=t.data,h(o.agencyData),n.data}),n.data})}function e(){o.agency&&!o.agency.address&&(o.agency.address={address1:null,address2:null,city:null,state:null,zipCode:null,county:null})}function h(n){n&&(o.agency.name=n.name,o.agency.phone=n.phone,o.agency.ori=n.ori,o.agency.websiteUrl=n.websiteUrl,o.agency.email=n.email,n.address?(e(),o.agency.address.address1=n.address.address1,o.agency.address.address2=n.address.address2,o.agency.address.city=n.address.city,o.agency.address.zipCode=n.address.zipCode,o.agency.address.county=n.address.county,n.address.state&&(o.agency.address.state=t.find(o.states,{id:n.address.state.id}),s(o.agency.address.state,o))):(n.street1||n.street2||n.city||n.zipCode||n.county)&&(e(),o.agency.address1=n.street1,o.agency.address2=n.street2,o.agency.city=n.city,o.agency.zipCode=n.zipCode,o.agency.county=n.county,n.state&&(o.agency.state=t.find(o.states,{id:n.state.id}),s(o.agency.state,o))),n.type&&(o.agencyTypes||f().then(function(i){o.agencyTypes=i;o.agency.type=t.find(o.agencyTypes,{id:n.type.id})})),n.jurisdiction&&(o.jurisdictions||i().then(function(i){o.jurisdictions=i;o.agency.jurisdiction=t.find(o.jurisdictions,{id:n.jurisdiction.id})})),n.tribalAccessParticipant&&(o.agency.tribalAccessParticipant=t.find(o.yesNoUnknown,{id:n.tribalAccessParticipant.id})))}var c=[i(),f(),l(),h(o.agencyData)];n.all(c).then(function(n){o.jurisdictions=n[0];o.agencyTypes=n[1]})}}var i=n.module("app");i.component("addAgency",{controller:["$q","$scope","dataContext","hrefs","identity","namusModal",r],controllerAs:"data",templateUrl:["templateUrls",function(n){return n.addAgency.toString()}],bindings:{agencyData:"=",persistOnSave:"=",onAgencyAdded:"&",onCancel:"&"}})}(angular,_),function(n){"use strict";function t(n,t,i){function f(){r.overridePersonCheck="true"}function e(){r.overridePersonCheck="false"}function o(n){e();n&&n.$error&&(n.$error=null);r.errors.personExistsInSystemCheck&&r.errors.personExistsInSystemCheck.$error&&(r.errors.personExistsInSystemCheck.$error=null);r.errors.personExistsInAgencyCheck&&r.errors.personExistsInAgencyCheck.$error&&(r.errors.personExistsInAgencyCheck.$error=null)}function s(){r.onCancel&&r.onCancel()}function h(){r.persistOnSave?c(r.person).then(function(n){r.person.id=n.data;r.onAgencyContactAdded({person:r.person})},function(n){i.setServerValidationErrors(n,u);r.errors.personExistsInSystemCheck.$error&&f();throw n;}):l(r.person).then(function(){r.onAgencyContactAdded({person:r.person})},function(n){i.setServerValidationErrors(n,u);r.errors.personExistsInSystemCheck.$error&&f();throw n;})}function c(){var i=0,u;return r.agency&&r.agency.id&&(i=r.agency.id),u=t.addAgencyContactApi.replace(/(\/agencies\/)\d+/i,"$1"+i).replace("contact/False","contact/"+r.overridePersonCheck),n.post(u,r.person).then(function(n){return{status:n.status,data:n.data}})}function l(){var i=0,u;return r.agency&&r.agency.id&&(i=r.agency.id),u=t.validateAgencyContactApi.replace(/(\/agencies\/)\d+/i,"$1"+i).replace("contact/False","contact/"+r.overridePersonCheck),n.post(u,r.person).then(function(n){return{status:n.status,data:n.data}})}var r=this,u;r.save=h;r.cancel=s;r.clearError=o;r.overridePersonCheck="false";r.errors={firstName:{},lastName:{},email:{},phone1:{},phone2:{},personExistsInSystemCheck:{},personExistsInAgencyCheck:{}};u={FirstName:r.errors.firstName,LastName:r.errors.lastName,Email:r.errors.email,Phone1:r.errors.phone1,Phone2:r.errors.phone2,PersonExistsInSystemCheckCheck:r.errors.personExistsInSystemCheck,PersonExistsInAgencyCheck:r.errors.personExistsInAgencyCheck};r.$onInit=function(){r.person.id=0;r.person.profile={jobTitle:r.person.jobTitle,phone1:r.person.phone1,phone2:r.person.phone2,personalEmail:r.person.email}}}n.module("app").component("addAgencyContact",{controller:["dataContext","hrefs","namusModal",t],controllerAs:"data",templateUrl:["templateUrls",function(n){return n.addAgencyContact.toString()}],bindings:{agency:"=",person:"=",persistOnSave:"=",onAgencyContactAdded:"&",onCancel:"&"}})}(angular,_),function(n,t,i){"use strict";function r(r,u,f,e,o,s,h,c){function w(n){var t={dateResolved:{},confirmedByInvestigator:{},confirmedByAgency:{},statusId:{},namusAssisted:{}},i={DateResolved:t.dateResolved,ConfirmedByInvestigator:t.confirmedByInvestigator,ConfirmedByAgency:t.confirmedByAgency,StatusId:t.statusId,NamusAssisted:t.namusAssisted},r={dateResolved:{onInvalid:function(){t.dateResolved.$error={serverValidation:!0,message:c.common.invalidDate,disablePutPost:!0}},onValid:function(){t.dateResolved.$error=null}}};return d(tt(n),s.caseResolutionModal.toString(),"Unclaimed",t,i,r)}function b(n){var t={dateIdentified:{},confirmedByInvestigator:{},confirmedByAgency:{},statusId:{},firstName:{},middleName:{},lastName:{},dateOfBirth:{},familyNotified:{},namusAssisted:{},missingPersonsCaseId:{},dateOfLastContact:{},cityMissing:{},stateMissing:{}},i={DateIdentified:t.dateIdentified,ConfirmedByInvestigator:t.confirmedByInvestigator,ConfirmedByAgency:t.confirmedByAgency,StatusId:t.statusId,FirstName:t.firstName,MiddleName:t.middleName,LastName:t.lastName,DateOfBirth:t.dateOfBirth,FamilyNotified:t.familyNotified,NamusAssisted:t.namusAssisted,MissingPersonsCaseId:t.missingPersonsCaseId,DateOfLastContact:t.dateOfLastContact,CityMissing:t.cityMissing,StateMissing:t.stateMissing},r={dateOfBirth:{onInvalid:function(){t.dateOfBirth.$error={serverValidation:!0,message:c.common.invalidDate,disablePutPost:!0}},onValid:function(){t.dateOfBirth.$error=null}},dateOfLastContact:{onInvalid:function(){t.dateOfLastContact.$error={serverValidation:!0,message:c.common.invalidDate,disablePutPost:!0}},onValid:function(){t.dateOfLastContact.$error=null}},dateIdentified:{onInvalid:function(){t.dateIdentified.$error={serverValidation:!0,message:c.common.invalidDate,disablePutPost:!0}},onValid:function(){t.dateIdentified.$error=null}}};return a(nt(n),s.caseResolutionModal.toString(),"Unidentified",t,i,r)}function k(n){var t={dateFound:{},dateIdentified:{},confirmedByInvestigator:{},confirmedByAgency:{},causeOfDeath:{},mannerOfDeathId:{},cityFound:{},stateFoundId:{},statusWhenFoundId:{},unidentifiedPersonsCaseId:{},familyNotified:{},namusAssisted:{}},i={DateFound:t.dateFound,DateIdentified:t.dateIdentified,ConfirmedByInvestigator:t.confirmedByInvestigator,ConfirmedByAgency:t.confirmedByAgency,CauseOfDeath:t.causeOfDeath,MannerOfDeathId:t.mannerOfDeathId,CityFound:t.cityFound,StateFoundId:t.stateFoundId,StatusWhenFoundId:t.statusWhenFoundId,UnidentifiedPersonsCaseId:t.unidentifiedPersonsCaseId,FamilyNotified:t.familyNotified,NamusAssisted:t.namusAssisted},r={dateFound:{onInvalid:function(){t.dateFound.$error={serverValidation:!0,message:c.common.invalidDate,disablePutPost:!0}},onValid:function(){t.dateFound.$error=null}},dateIdentified:{onInvalid:function(){t.dateIdentified.$error={serverValidation:!0,message:c.common.invalidDate,disablePutPost:!0}},onValid:function(){t.dateIdentified.$error=null}}};return a(g(n),s.caseResolutionModal.toString(),"Missing",t,i,r)}function a(s,h,c,l,a,w){function nt(i){if(i&&i.name){var r=t.find(b.resolution.raceEthnicities,function(n){return n.id===7});return n.isDefined(r)&&i.name==="Other"}return!1}function tt(){return!!k&&!!k.hrefCreateUcpCaseFromUpCase?!0:!1}function it(){return!!k&&!!k.ucpIdFormatted?!0:!1}function rt(){return s.isNew}function ut(){return e.get(o.states).then(function(n){b.states=n.data})}function ft(){if(o.mannersOfDeath)return e.get(o.mannersOfDeath).then(function(n){b.mannersOfDeath=n.data})}function et(){if(o.ethnicities)return e.get(o.ethnicities).then(function(i){b.ethnicities=i.data;var r=n.copy(b.resolution.raceEthnicities);b.resolution.raceEthnicities=[];t.isArray(r)&&t.forEach(r,function(n){var i=t.find(b.ethnicities,{name:n.name});i&&b.resolution.raceEthnicities.push(i)})})}function ot(){return e.get(o.sexes).then(function(n){b.sexes=n.data;b.resolution.unidentifiedPersonsSex&&(b.resolution.unidentifiedPersonsSex=t.find(b.sexes,{id:b.resolution.unidentifiedPersonsSex.id}))})}function st(){f.show({onLoad:function(){return u.all([ut(),ft(),et(),ot()])},templateUrl:h,data:b,onResult:function(n){ht(a);var o=null,h=!1;if(t.isFunction(n.resolution.onSave)&&n.resolution.onSave(),t.isNil(r.uPUcpAssociationCreated)||(r.uPUcpAssociationCreated=null),f.clearServerValidationErrors(a),n.resolution.caseStatusResolution!==c)if(s.isNew||n.resolution.id===null||n.resolution.id===i)o=e.post(k.hrefAddCaseResolution,d(n.resolution));else if(y(n.resolutionOriginal,n.resolution))if(b.convertUcpCaseRequested)h=!0,o=e.post(k.hrefCreateUcpCaseFromUpCase,g(k,n.resolution));else return u.resolve();else o=e.put(n.resolution.hrefUpdate,d(n.resolution));else o=e.delete(n.resolution.hrefDelete);return o.then(function(n){if(b.convertUcpCaseRequested&&!h)e.post(k.hrefCreateUcpCaseFromUpCase,g(k,n.data)).then(function(n){b.convertUcpCaseRequested=!1;r.uPUcpAssociationCreated={up:k.idFormatted,ucp:n.data.idFormatted};v().then(function(){window.open(n.data.hrefCaseReport.replace("CaseReport","Case"),n.data.idFormatted)})});else if(h)b.convertUcpCaseRequested=!1,r.uPUcpAssociationCreated={up:k.idFormatted,ucp:n.data.idFormatted},v().then(function(){window.open(n.data.hrefCaseReport.replace("CaseReport","Case"),n.data.idFormatted)});else return r.reload();return}).catch(function(n){f.setServerValidationErrors(n,b.fieldErrorMap);b.hasErrors=!0;throw n;})}})}function d(n){var i=t.find(n.raceEthnicities,function(n){return n.name==="Other"});return i||(n.ethnicitiesOther=null),n}function g(n,i){return n?(n.clothingAndAccessoriesArticles=t.remove(n.clothingAndAccessoriesArticles,function(n){return!n._deleted||n._deleted!=!0}),!i||(n.caseResolutionDetails=i,n.caseIsResolved=!0),n):n}function ht(n){var t=f.isPutPostDisabledByError(n);if(t)throw"put/post disabled";}var k=r.get(),b={canUnresolve:s.isNew===!1,isNewResolution:rt,clearError:p,resolution:s,resolutionOriginal:n.copy(s),errors:l,fieldErrorMap:a,states:[],ethnicities:[],sexes:[],hasErrors:!1,validation:w,hasAssociatedUcpCase:it,canCreateUcpCaseAssociation:tt,convertUcpCaseRequested:!1,showEthnicitiesOther:nt};return st()}function d(o,s,h,c,l,a){function b(){return o.isNew}function k(){f.show({onLoad:function(){return u.all([])},templateUrl:s,data:v,onResult:function(n){d(l);var s=null;if(t.isFunction(n.resolution.onSave)&&n.resolution.onSave(),f.clearServerValidationErrors(l),n.resolution.caseStatusResolution!==h)if(o.isNew||n.resolution.id===null||n.resolution.id===i)s=e.post(w.hrefAddCaseResolution,n.resolution);else{if(y(n.resolutionOriginal,n.resolution))return u.resolve();s=e.put(n.resolution.hrefUpdate,n.resolution)}else s=e.delete(n.resolution.hrefDelete);return s.then(function(){return r.reload()}).catch(function(n){f.setServerValidationErrors(n,v.fieldErrorMap);v.hasErrors=!0;throw n;})}})}function d(n){var t=f.isPutPostDisabledByError(n);if(t)throw"put/post disabled";}var w=r.get(),v={canUnresolve:o.isNew===!1,isNewResolution:b,clearError:p,resolution:o,resolutionOriginal:n.copy(o),errors:c,fieldErrorMap:l,hasErrors:!1,validation:a};return k()}function v(){var n=u.defer();return n.resolve(r.reload()),n.promise}function y(r,u){var f=n.copy(r),e=n.copy(u),o;!e.raceEthnicities||f.raceEthnicities||(f.raceEthnicities=[]);for(o in e)f[o]||e[o]!=null&&e[o]!=i||(f[o]=e[o]);if(t.has(f,"raceEthnicities")&&t.has(e,"raceEthnicities")){var s=t.map(f.raceEthnicities,"name"),h=t.map(e.raceEthnicities,"name"),c=t.intersection(s,h);if(!t.isEqual(s.length,h.length)||!t.isEqual(s.length,c.length))return!1;delete f.raceEthnicities;delete e.raceEthnicities}if(t.has(f,"status")&&t.has(e,"status")){if(!t.isEqual(f.status.id,e.status.id))return!1;delete f.status;delete e.status}return t.has(f,"missingPersonsCaseId")&&t.has(e,"missingPersonsCaseId")&&(!f.missingPersonsCaseId||!e.missingPersonsCaseId||(f.missingPersonsCaseId=f.missingPersonsCaseId.toString())),t.has(f,"unidentifiedPersonsCaseId")&&t.has(e,"unidentifiedPersonsCaseId")&&(!f.unidentifiedPersonsCaseId||!e.unidentifiedPersonsCaseId||(f.unidentifiedPersonsCaseId=f.unidentifiedPersonsCaseId.toString())),n.equals(f,e)}function p(n){n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null)}function g(n){function r(){l(t);t.statusWhenFoundId=t.caseStatusResolution;t.unidentifiedPersonsCaseId!=null&&(t.unidentifiedPersonsCaseId=t.unidentifiedPersonsCaseId.toString().replace(/\D/g,""))}var t=n||{};return t&&t.statusWhenFound&&(t.caseStatusResolution=t.statusWhenFound.name),t.isNew=n==null||n==i,t.onSave=r,t}function nt(t){function u(){l(r);r.status=r.caseStatusResolution=="Identified"?{id:2,name:r.caseStatusResolution,localizedName:""}:{id:0,name:r.caseStatusResolution,localizedName:""}}var r=n.copy(t)||{};return r.caseStatusResolution=r&&r.status?r.status.name:"Identified",r.isNew=t==null||t==i,r.onSave=u,r}function tt(t){function u(){l(r);r.status=r.caseStatusResolution=="Claimed"?{id:1,name:r.caseStatusResolution,localizedName:""}:{id:0,name:r.caseStatusResolution,localizedName:""}}var r=n.copy(t)||{};return r.caseStatusResolution=r&&r.status?r.status.name:"Claimed",r.isNew=t==null||t==i,r.onSave=u,r}function l(n){for(var i in n)typeof n[i]=="string"&&t.trim(n[i])===""&&(n[i]=null)}return{openMissingPersonsModal:k,openUnidentifiedPersonsModal:b,openUnclaimedPersonsModal:w}}n.module("app").service("CommonCaseResolutionModalService",["CaseService","$q","namusModal","dataContext","hrefs","templateUrls","identity","localized","banner",r])}(angular,_),function(n){"use strict";function t(t,i){function r(){var r=t.get();return i.openUnclaimedPersonsModal(n.copy(r.caseResolutionDetails))}return{openModal:r}}n.module("app").service("CaseResolutionModalService",["CaseService","CommonCaseResolutionModalService",t])}(angular),function(n){"user strict";function t(n,t,i,r,u,f,e,o,s,h){function a(){return n.get()}function l(){return a().circumstances||{}}function ot(){return n.getCaseCreationFormattedDate()}function y(){var n=a();return!s.getIsPrintMode()&&_.has(n,"circumstances.hrefUpdate")}function st(){return!h.currentUserHasPublicUcpView()}function w(){e.openEditDialog(a())}function ht(){var n=l();return n.dateBodyFound}function ct(){return l().locationFoundSpecificity}function lt(){var n=l();if(n.address){var t=n.address.address1,i=n.address.address2,r=null;return(t||i)&&(r=append(t,"\r\n",i)),r}}function at(){var n=l(),t=n.street1,i=n.street2,r=null;return(t||i)&&(r=append(t," "+f.circumstances.and+" ",i)),r}function vt(){return l().description}function yt(){var n=l();if(n.address){var t=n.address.city,i=b(),r=n.address.zipCode,u=null;return(t||i||r)&&(u=append(t,", ",i," ",r)),u}}function pt(){var n=l();if(n.address&&n.address.county)return n.address.county.name}function b(){var n=l();if(n.address&&n.address.state)return n.address.state.name}function wt(){var t=l(),n=t.privateGeolocation||t.publicGeolocation;return n&&!s.getIsPrintMode()?"http://www.google.com/maps/place/"+n.coordinates.lat+","+n.coordinates.lon:null}function k(){return l().circumstancesOfRecovery}function d(){var t=null,n=l();return!n||!n.foundOnTribalLand||(t=n.foundOnTribalLand.localizedName),t}function bt(){var t=null,n=l();return!n||!n.incident||(t=n.incident.localizedName),t}function g(){return!v()||!!ht()}function nt(){return!v()||!!l().address.city}function tt(){return!v()||!!l().address.state}function it(){return!v()||!!l().address.county}function rt(){return!v()||!!k()}function ut(){return!v()||!!d()}function v(){return y()&&n.showRequiredFieldInfo(a())}function ft(){return i.sectionIsInvalid(p)}function kt(){return y()||et().length>0}function et(){return _.filter(a().notes,{noteType:u.noteType.circumstances})}function dt(){o.openAddNoteDialog(u.noteType.circumstances,!0,a().notes,a().hrefAddNote)}function gt(n){o.openEditNoteDialog(u.noteType.circumstances,!0,a().notes,n)}function ni(n){o.openConfirmItemDeletionDialog(n,"circumstances note")}var c=this,p;c.canEdit=y;c.canViewProfessionalFields=st;c.edit=w;c.dateBodyFound=r.getDateFound;c.caseCreated=ot;c.locationFoundSpecificity=ct;c.foundCityStateZip=yt;c.foundStreetAddress=lt;c.foundIntersection=at;c.foundGeneralLocation=vt;c.countyName=pt;c.stateName=b;c.mapLink=wt;c.circumstancesOfRecovery=k;c.foundOnTribalLandValue=d;c.incidentName=bt;c.canViewNotes=kt;c.notes=et;c.addNote=dt;c.editNote=gt;c.deleteNote=ni;c.isDateBodyFoundValid=g;c.isCityValid=nt;c.isStateValid=tt;c.isCountyValid=it;c.isCircumstancesOfRecoveryValid=rt;c.isFoundOnTribalLandValid=ut;c.showRequiredFieldInfo=v;p={title:f.circumstances.title,fields:[{name:f.circumstances.dateBodyFound,isValid:g},{name:f.circumstances.city,isValid:nt},{name:f.circumstances.state,isValid:tt},{name:f.circumstances.county,isValid:it},{name:f.circumstances.foundOnTribalLand,isValid:ut},{name:f.circumstances.circumstancesOfRecovery,isValid:rt}],canEdit:y,edit:w};i.register(p);t.register("Circumstances",{isInvalid:ft});this.isInvalid=ft}n.module("app").controller("Circumstances",["CaseService","NavigationService","CaseValidationService","SummaryProjection","appConstants","localized","CircumstancesModalService","commonModalService","OptionService","identity",t])}(angular),function(n){"use strict";function t(t,i,r,u,f,e,o){function s(s){function l(n){n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null)}function a(n){var t=r.isPutPostDisabledByError(n);if(t)throw"put/post disabled";}function v(n){if(n&&n.circumstances){switch(n.circumstances.locationFoundSpecificity){case"Address":delete n.circumstances.street1;delete n.circumstances.street2;delete n.circumstances.description;break;case"Intersection":delete n.circumstances.address.address1;delete n.circumstances.address.address2;delete n.circumstances.description;break;case"GeneralLocation":delete n.circumstances.street1;delete n.circumstances.street2;delete n.circumstances.address.address1;delete n.circumstances.address.address2}n.circumstances.foundOnTribalLand||delete n.circumstances.foundOnTribalLand;n.circumstances.incident||delete n.circumstances.incident}}function y(n){var i=t.put(n.circumstances.hrefUpdate,n.circumstances);return i.then(function(t){return s.circumstances=t.data,n})}function p(t){if(!t||!t.circumstances)return!1;return!n.equals(t.circumstances,s.circumstances)}function w(i){var u,r;i.circumstances&&i.circumstances.address&&i.circumstances.address.state&&(u=i.circumstances.address.state,n.isDefined(u)&&(r=i.states.find(function(n){return n.name===u.name}),r&&r.hrefGetCounties&&t.get(r.hrefGetCounties).then(function(n){n.status===200&&(i.stateCounties=n.data)})))}var h={clearError:l,showRequiredFieldInfo:e.showRequiredFieldInfo(s),circumstances:n.copy(s.circumstances),states:[],stateCounties:[],yesNoUnknown:[],incidents:[],loadCounties:w,errors:{dateBodyFound:{},zipCode:{}},validation:{dateBodyFound:{onInvalid:function(){h.errors.dateBodyFound.$error={serverValidation:!0,message:o.common.invalidDate,disablePutPost:!0}},onValid:function(){h.errors.dateBodyFound.$error=null}}}},c={DateBodyFound:h.errors.dateBodyFound,ZipCode:h.errors.zipCode};r.show({onLoad:function(n){return i.all([t.get(u.states).then(function(t){n.states=t.data;n.loadCounties(n)}),t.get(u.yesNoUnknown).then(function(t){n.yesNoUnknown=t.data}),t.get(u.incidents).then(function(t){n.incidents=t.data})])},templateUrl:f.circumstancesModal.toString(),data:h,onResult:function(n){if(a(c),v(n),!p(n)||!n.circumstances.hrefUpdate)return i.when(n);return y(n).then(e.reload).catch(function(n){r.setServerValidationErrors(n,c);throw n;})}})}return{openEditDialog:s}}n.module("app").service("CircumstancesModalService",["$http","$q","namusModal","hrefs","templateUrls","CaseService","localized",t])}(angular),function(n){"use strict";function t(n,t,i,r,u){function s(){var n=o();return!n.caseResolutionDetails}function o(){return n.get()}function c(){var n=o();return _.has(n,"hrefAddCaseResolution")}function h(){return u.openModal(e())}function e(){return o().caseResolutionDetails||{}}function l(){return e().confirmedByAgency}function a(){return e().confirmedByInvestigator}function v(){return e().dateResolved}function y(){return e().detailsOfResolution}function p(){var n=e().statusWhenFound;if(n)return n.localizedName}function w(){return e().namusAssisted===!0?i.common.yes:e().namusAssisted===!1?i.common.no:void 0}var f=this;f.hide=s;f.canEdit=c;f.edit=h;f.confirmedByAgencyName=l;f.confirmedByContactName=a;f.detailsOfResolution=y;f.edit=h;f.statusAtResolution=p;f.whetherNamUsAssisted=w;f.dateResolved=v;t.register("CaseResolutionDetails",{hide:s})}n.module("app").controller("CaseResolutionDetails",["CaseService","NavigationService","localized","identity","CaseResolutionModalService","hrefs",t])}(angular),function(n){"user strict";function t(n,t,i){function e(){return n.hasPublicViewPermission()||y()}function o(){var n=f();return _.has(n,"hrefAddDispositionOfRemains")||_.has(n,"dispositionOfRemains.hrefUpdate")}function s(){t.openEditModal(f())}function f(){return n.get()}function u(){return f().dispositionOfRemains||{}}function h(){return u().coolerNumber}function c(){return u().cemeteryName}function l(){return u().plotNumber}function a(){return u().dateBuried}function v(){return u().dispositionNotes}function y(){var n=f();return n.circumstances&&n.circumstances.status&&n.circumstances.status.name==="Unidentified Living"}var r=this;r.hide=e;r.canEdit=o;r.edit=s;r.coolerNumber=h;r.cemeteryName=c;r.plotNumber=l;r.dateBuried=a;r.dispositionNotes=v;i.register("additional",{hide:e});i.register("DispositionOfRemains",{hide:e})}n.module("app").controller("DispositionOfRemains",["CaseService","DispositionOfRemainsModalService","NavigationService",t])}(angular),function(n){"use strict";function t(t,i,r,u,f,e){function o(u){var o={dispositionOfRemains:n.copy(u.dispositionOfRemains),errors:{dateBuried:{}},dateBuriedValidation:{onInvalid:function(){o.errors.dateBuried.$error={serverValidation:!0,message:e.common.invalidDate,disablePutPost:!0}},onValid:function(){o.errors.dateBuried.$error=null}}},h={DateBuried:o.errors.dateBuried};r.show({templateUrl:f.dispositionOfRemainsEditModal.toString(),data:o,onResult:function(f){if(s(h),r.clearServerValidationErrors(h),n.equals(f.dispositionOfRemains,u.dispositionOfRemains))return i.when({});var e=f.dispositionOfRemains.hrefUpdate?f.dispositionOfRemains.hrefUpdate:u.hrefAddDispositionOfRemains,o=f.dispositionOfRemains.hrefUpdate?t.put:t.post;return o(e,f.dispositionOfRemains).then(function(n){u.dispositionOfRemains=n.data}).catch(function(n){r.setServerValidationErrors(n,h);throw n;})}})}function s(n){var t=r.isPutPostDisabledByError(n);if(t)throw"put/post disabled";}return{openEditModal:o}}n.module("app").service("DispositionOfRemainsModalService",["$http","$q","namusModal","hrefs","templateUrls","localized",t])}(angular),function(n){"use strict";function t(n,t){var i=this;t("CommonCaseEnteringParty",{subSection:i,$scope:n})}n.module("app").controller("EnteringParty",["$scope","$controller",t])}(angular),function(n){"use strict";function t(n){var t=this;n("CommonCaseContributors",{subSection:t})}n.module("app").controller("CaseContributors",["$controller",t])}(angular),function(n){"use strict";function t(n){var t=this;n("CommonCaseInvestigatingAgencies",{subSection:t})}n.module("app").controller("InvestigatingAgencies",["$controller",t])}(angular),function(n){"use strict";function t(n,t,i,r,u,f,e,o){function a(){var n=l();return!o.getIsPrintMode()&&(_.has(n,"hrefAddSubjectIdentification")||_.has(n,"hrefAddSubjectDescription")||_.has(n,"subjectIdentification.hrefUpdate")||_.has(n,"subjectDescription.hrefUpdate"))}function rt(){return!n.hasPublicViewPermission()}function y(){e.openEditModal(l())}function l(){return n.get()}function h(){return l().subjectIdentification||{}}function ut(){return h().firstName}function ft(){return h().middleName}function et(){return h().lastName}function ot(){return h().maidenName}function st(){return h().nicknames}function ht(){var t=h(),n=t.birthDate;return n?u("date")(n,"longDate"):null}function ct(){var n=h();return n.yearOfBirth}function lt(){var t=h(),n={minAge:t.missingMinAge,maxAge:t.missingMaxAge};return n?n.minAge+" - "+n.maxAge:null}function at(){var n=h(),t=_.isFinite(n.missingMinAge),i=_.isFinite(n.missingMaxAge);return!!i||!!t}function p(){var i=h(),t=null,r=i.birthDate,f=i.yearOfBirth,n={minAge:i.missingMinAge,maxAge:i.missingMaxAge};return r?(s.isBirthDate=!0,s.isBirthYear=!1,s.isAgeRange=!1,t=u("date")(r,"longDate")):f?(s.isBirthDate=!1,s.isBirthYear=!0,s.isAgeRange=!1,t=f):at()?(s.isBirthDate=!1,s.isBirthYear=!1,s.isAgeRange=!0,t=n.minAge===n.maxAge||_.isNil(n.maxAge)?n.minAge:(n.minAge?n.minAge:"0")+" - "+(n.maxAge?n.maxAge:"0")):(s.isBirthDate=!0,s.isBirthYear=!1,s.isAgeRange=!1,t=null),t}function vt(){return h().placeOfBirth}function w(){var n=h().sex;return n?n.localizedName:null}function yt(){var n=h();return n.militaryBranches}function pt(){var n=h();if(n.militaryAffiliation)return n.militaryAffiliation.localizedName}function wt(n){return n?n.serviceDescription?"".concat(n.branchName,": ",n.serviceDescription):n.branchName:null}function b(){var n=h(),t=n.ethnicities,i=null;return t&&t.length>0&&(i=_.map(t,function(t){return t.name==="Other"&&n.ethnicitiesOther?t.localizedName+" - "+n.ethnicitiesOther:t.localizedName}).join(", ")),i}function k(){return!c()||!!h().firstName}function d(){return!c()||!!h().lastName}function g(){return!c()||!!p()}function nt(){return!c()||!!w()}function tt(){return!c()||!!b()}function it(){return i.sectionIsInvalid(v)}function c(){return a()&&n.showRequiredFieldInfo(l())}var s=this,v;s.canEdit=a;s.canViewProfessionalFields=rt;s.edit=y;s.firstName=ut;s.middleName=ft;s.lastName=et;s.maidenName=ot;s.nicknames=st;s.birthdate=ht;s.yearOfBirth=ct;s.ageRange=lt;s.birthAgeData=p;s.placeOfBirth=vt;s.gender=w;s.ethnicitiesDescription=b;s.maxAge=r.getMaxAge;s.isBirthDate=!0;s.isBirthYear=!1;s.isAgeRange=!1;s.showRequiredFieldInfo=c;s.getMilitaryBranches=yt;s.getMilitaryServiceDescription=wt;s.getMilitaryAffiliation=pt;s.isFirstNameValid=k;s.isLastNameValid=d;s.isDateOfBirthValid=g;s.isEthnicitiesValid=tt;s.isGenderValid=nt;v={title:f.demographics.title,fields:[{name:f.demographics.firstName,isValid:k},{name:f.demographics.lastName,isValid:d},{name:f.demographics.dateOfBirth,isValid:g},{name:f.demographics.gender,isValid:nt},{name:f.demographics.raceEthnicity,isValid:tt}],canEdit:a,edit:y};i.register(v);t.register("Demographics",{isInvalid:it});this.isInvalid=it}n.module("app").controller("Demographics",["CaseService","NavigationService","CaseValidationService","SummaryProjection","$filter","localized","DemographicsModalService","OptionService","identity",t])}(angular),function(n){"use strict";function t(t,i,r,u,f,e,o){function s(s){function y(n){n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null);h.selectedBirthDataType===c.dateOfBirth&&(l=!1)}function p(){var t=h.errors,i=h.selectedBirthDataType,n={};h.selectedBirthDataType!==c.dateOfBirth?h.errors.dob.$error&&h.errors.dob.$error.message&&(l=h.errors.dob.$error.message===o.common.invalidDate||l?!0:!1):l&&h.birthDateValidation.onInvalid();$.each(["dob","yob","missingMinAge","missingMaxAge"],function(r,u){n=t[u];n.$error&&n!==t[i]&&(n.$error=null)})}function w(){return h&&h.subjectIdentification&&h.subjectIdentification.militaryAffiliation&&h.subjectIdentification.militaryAffiliation.name==="Yes"?!0:!1}function b(t){if(t&&t.name&&h&&h.subjectIdentification){var i=_.find(h.subjectIdentification.ethnicities,function(n){return n.id===7});return n.isDefined(i)&&t.name==="Other"}return!1}function k(n){if(n){var t=_.find(n.ethnicities,function(n){return n.name==="Other"});!t&&n.ethnicitiesOther&&(n.ethnicitiesOther=null)}return n}function d(n){var t=r.isPutPostDisabledByError(n);if(t)throw"put/post disabled";}function g(){var n=_.isFinite(h.subjectIdentification.missingMinAge),t=_.isFinite(h.subjectIdentification.missingMaxAge);return!!t||!!n}function nt(){h.selectedBirthDataType=h.subjectIdentification.birthDate?c.dateOfBirth:h.subjectIdentification.yearOfBirth?c.yearOfBirth:g()?c.ageRange:c.dateOfBirth}function tt(n){function t(t){n[t]&&delete n[t]}return h.isbirthTypeAgeRange()?(t("birthDate"),t("yearOfBirth")):h.isbirthTypeYob()?(t("missingMinAge"),t("missingMaxAge"),t("birthDate")):h.isbirthTypeDob()&&(t("missingMinAge"),t("missingMaxAge"),t("yearOfBirth")),_.get(n,"missingMinAge")&&_.get(n,"missingMaxAge")&&n.missingMinAge===n.missingMaxAge&&delete n.missingMaxAge,_.get(n,"missingMinAge")==undefined&&_.get(n,"missingMaxAge")&&(n.missingMinAge=n.missingMaxAge,delete n.missingMaxAge),n}function it(n){var i;return i=n.hrefUpdate?t.put(n.hrefUpdate,n):t.post(h.hrefAddSubjectIdentification,n),i.then(function(t){return s.subjectIdentification=t.data,s.subjectIdentification.militaryBranches=n.militaryBranches,n})}function rt(n){return n.militaryAffiliation&&n.militaryAffiliation.id===1||(n.militaryBranches=null),n}function ut(t,i){var r=v(t),u=v(i);return ft(t,i),n.equals(r,u)}function v(n){if(n)for(var t in n)n.hasOwnProperty(t)&&Array.isArray(n[t])&&n[t].length===0&&delete n[t];return n}function ft(n,t){for(var i in t)(n.hasOwnProperty(i)||t[i]!=="")&&t[i]!==null||delete t[i]}var c={dateOfBirth:"dob",yearOfBirth:"yob",ageRange:"ageRange"},h={clearError:y,clearNonSelectedBirthAgeDataErrors:p,showRequiredFieldInfo:e.showRequiredFieldInfo(s),subjectIdentification:n.copy(s.subjectIdentification)||{},hrefAddSubjectIdentification:s.hrefAddSubjectIdentification,selectedBirthDataType:c.dateOfBirth,birthDataTypes:[{shortName:c.dateOfBirth,name:o.demographics.dateOfBirth},{shortName:c.yearOfBirth,name:o.demographics.birthYear},{shortName:c.ageRange,name:o.demographics.ageRange}],isbirthTypeYob:function(){return h.selectedBirthDataType===c.yearOfBirth},isbirthTypeDob:function(){return h.selectedBirthDataType===c.dateOfBirth},isbirthTypeAgeRange:function(){return h.selectedBirthDataType===c.ageRange},ethnicities:[],sexes:[],showMilitaryAssociation:w,showEthnicitiesOther:b,errors:{firstName:{},middleName:{},lastName:{},maidenName:{},nicknames:{},dob:{},placeOfBirth:{},sex:{},ethnicities:{},missingMinAge:{},missingMaxAge:{},yob:{},militaryAffiliation:{},militaryBranches:{}},birthDateValidation:{onInvalid:function(){h.errors.dob.$error={serverValidation:!0,message:o.common.invalidDate,disablePutPost:!0}},onValid:function(){h.errors.dob.$error=null}}},a={FirstName:h.errors.firstName,MiddleName:h.errors.middleName,LastName:h.errors.lastName,MaidenName:h.errors.maidenName,Nicknames:h.errors.nicknames,BirthDate:h.errors.dob,YearOfBirth:h.errors.yob,PlaceOfBirth:h.errors.placeOfBirth,Sex:h.errors.sex,Ethnicities:h.errors.ethnicities,MissingMinAge:h.errors.missingMinAge,MissingMaxAge:h.errors.missingMaxAge,MilitaryAffiliation:h.errors.militaryAffiliation,MilitaryBranches:h.errors.militaryBranches},l=!1;h.specifyMissingAgeRange=h.subjectIdentification.hasOwnProperty("missingMinAge");r.show({onLoad:function(n){return i.all([t.get(u.ethnicities).then(function(t){n.ethnicities=t.data}),t.get(u.sexes).then(function(t){n.sexes=t.data}),t.get(u.militaryAffiliations,{cache:!0}).then(function(t){n.militaryAffiliations=t.data})])},templateUrl:f.demographicsEditModal.toString(),data:h,onResult:function(t){var u,f;return(d(a),u=tt(n.copy(t.subjectIdentification)),f=s.subjectIdentification||{},u=rt(u),u=k(u),ut(f,u))?i.when({}):it(u).catch(function(n){r.setServerValidationErrors(n,a);throw n;})}});nt()}return{openEditModal:s}}n.module("app").service("DemographicsModalService",["$http","$q","namusModal","hrefs","templateUrls","CaseService","localized",t])}(angular),function(n){"use strict";function t(n,t,i,r,u){function e(){return n.get()}function h(){var n=e();return!u.getIsPrintMode()&&_.has(n,"hrefAddClothingAndAccessoriesArticle")}function o(){return e().clothingAndAccessoriesArticles||[]}function c(){return!_.some(s(o()))}function l(){r.openDialog({},e())}function a(n){r.openDialog(n,e())}function v(n){i.openConfirmItemDeletionDialog(n,n.article.name.toLowerCase())}var f=this,s=t("notDeleted");f.canEdit=h;f.articles=o;f.hasNoArticles=c;f.addArticle=l;f.editArticle=a;f.deleteArticle=v}n.module("app").controller("ClothingAndAccessories",["CaseService","$filter","commonModalService","ClothingAndAccessoriesModalService","OptionService",t])}(angular),function(n){"use strict";function t(t,r,u,f,e,o){function h(h,l){function y(n){var i=null,t=1200;a.disabled=a.article&&a.article.description&&a.article.description.length>t;a.disabled&&(i={serverValidation:!0,message:_.replace(_.replace(o.common.descriptionLengthExceeds,"{0}",t),"{1}",this.article.description.length-t)});n.$error=i}var a={edit:!!h.hrefUpdate,article:n.copy(h),clothingAndAccessoriesArticles:[],errors:{article:{},description:{}},clearError:i,descriptionChanged:y},v={Article:a.errors.article,Description:a.errors.description};u.show({small:!0,onLoad:function(n){return t.get(f.clothingAndAccessoriesArticles).then(function(t){n.clothingAndAccessoriesArticles=t.data})},templateUrl:e.clothingAccessoriesModal.toString(),data:a,onResult:function(i){var f=i.edit?h.hrefUpdate:l.hrefAddClothingAndAccessoriesArticle,e=i.edit?t.put:t.post,o=i.edit?c:s;return u.clearServerValidationErrors(v),n.equals(h,i.article)?r.when({}):e(f,i.article).then(function(n){o(l,n.data)}).catch(function(n){u.setServerValidationErrors(n,v);throw n;})}})}function c(n,t){_.remove(n.clothingAndAccessoriesArticles,{identityId:t.identityId});s(n,t)}function s(n,t){var i=_.findIndex(n.clothingAndAccessoriesArticles,function(n){var i=t.article.ordinal,r=n.article.ordinal,u=t.identityId,f=n.identityId;return i<r||i===r&&u<f});i===-1&&(i=n.clothingAndAccessoriesArticles.length);n.clothingAndAccessoriesArticles.splice(i,0,t)}return{openDialog:h}}function i(n){n.$error=null}n.module("app").service("ClothingAndAccessoriesModalService",["$http","$q","namusModal","hrefs","templateUrls","localized",t])}(angular),function(n){"use strict";function t(n,t){var i=this;t("CommonCasePhysicalDescription",{subSection:i,$scope:n})}n.module("app").controller("PhysicalDescription",["$scope","$controller",t])}(angular),function(n){"use strict";function t(n){return{openDescriptionModal:n.openDescriptionModal,openFeaturesModal:n.openFeaturesModal}}n.module("app").service("PhysicalDescriptionModalService",["CommonCasePhysicalDescriptionModalService",t])}(angular),function(n){"use strict";function t(n,t){var i=this;t("CommonCaseMedicalData",{subSection:i,$scope:n})}n.module("app").controller("MedicalData",["$scope","$controller",t])}(angular),function(n){"use strict";function t(n){return{openFeaturesModal:n.openFeaturesModal,descriptionChanged:n.descriptionChanged}}n.module("app").service("MedicalDataModalService",["CommonCaseMedicalDataModalService",t])}(angular),function(n,t,i){"use strict";function r(n,r,u,f,e,o,s,h){function a(){var n=l();return n.id}function l(){return r.get()}function v(){return!e.isLoggedIn()||e.isCurrentUserPublic()}function y(){var n=l();return n&&n.hrefAddCaseTracker!=null&&n.hrefRemoveCaseTracker!=null}function p(){var n=l();return n.currentUserIsTracking?s.tracking.untrackCase:s.tracking.trackCase}function w(){var n=l();n.currentUserIsTracking?(u.delete(n.hrefRemoveCaseTracker),n.currentUserIsTracking=!1):(u.post(n.hrefAddCaseTracker),n.currentUserIsTracking=!0)}function b(){return r.hasPublicViewPermission()}function k(){var n=l();return n.caseResolutionDetails===null||n.caseResolutionDetails===i?s.resolution.resolveCase:s.resolution.editResolution}function d(){var n=l();return t.has(n,"hrefAddCaseResolution")}var c=this;o.setIsPrintMode(!1);c.hide=b;c.canTrackCase=y;c.trackCaseButtonText=p;c.trackCase=w;c.photoUrl=f.getPhotoUrl;c.caseNumber=f.getCaseNumber;c.caseId=a;c.fullName=f.getFullName;c.gender=f.getGender;c.ethnicities=f.getEthnicities;c.status=f.getStatus;c.statusCssClass=f.getStatusCssClass;c.showLifecycleStatus=f.showLifecycleStatus;c.lifecycleStatus=f.getLifecycleStatus;c.lifecycleStatusCssClass=f.getLifecycleStatusCssClass;c.dateFound=f.getDateFound;c.locationFound=f.getLocationFound;c.maxAge=f.getMaxAge;c.dateModified=f.getDateModified;c.currentUserIsVisitorOrPublic=v;c.resolveCase=h.openModal;c.resolveCaseButtonText=k;c.canResolveCase=d}n.module("app").controller("Summary",["$scope","CaseService","dataContext","SummaryProjection","identity","OptionService","localized","CaseResolutionModalService",r])}(angular,_),function(n){"use strict";function t(n,t,i){var r=this;t("CommonCaseAttachments",{subSection:r,$scope:n,modalService:i})}n.module("app").controller("Attachments",["$scope","$controller","AttachmentsModalService",t])}(angular),function(n){"use strict";function t(n){return n.create()}n.module("app").service("AttachmentsModalService",["CommonCaseAttachmentModalService",t])}(angular)