(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";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";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("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);angular.module("input-ssn",[]).directive("ssn",function(){function n(n){var i=n,t=n?n.toString():"";return t.length>3&&(i=t.substr(0,3)+"-",t.length>5?(i+=t.substr(3,2)+"-",i+=t.substr(5,4)):i+=t.substr(3)),i}return{restrict:"A",require:"ngModel",link:function(t,i,r,u){u.$formatters.push(function(t){return n(t)});u.$parsers.push(function(t){var e=i[0].selectionStart,o=t.toString().length,r=t.replace(/[^0-9]/g,""),f;return r.length>9&&(r=r.substr(0,9)),f=n(r),u.$setViewValue(f),u.$render(),i[0].setSelectionRange(e+f.length-o,e+f.length-o),r})}}});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(){"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){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(){"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(){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(){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(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(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){"use strict";function t(n,t,i,r,u){return{restrict:"E",replace:!0,templateUrl:i.tribeRecognition.toString(),bindToController:{model:"=",clearErrorMessage:"&"},controllerAs:"vm",controller:function(){function f(){n.tribes=null}function e(){n.tribeState=null;f()}function o(){return _.isNil(n.tribeEnrollmentAffiliation)||_.isEmpty(n.tribeEnrollmentAffiliation)?!0:!1}function s(){return _.isNil(n.tribeRecognition)||_.isEmpty(n.tribeRecognition)?!0:!1}function h(){return _.isNil(n.tribeState)||_.isNil(n.tribeRecognition)||_.isNil(n.tribeEnrollmentAffiliation)?!0:n.tribe&&n.tribe.id===0?!0:(i||n.tribes&&n.tribes!==null||(i=!0,t.get(r.tribalRecognition+"?stateId="+n.tribeState.id+"&levelName="+n.tribeRecognition).then(function(t){t.data.length>0?n.tribes=t.data:(n.tribes=[{name:u.demographics.noTribesIn+n.tribeState.name+".",id:0}],n.tribe=n.tribes[0]);i=!1})),!1)}function c(){return _.isNil(n.tribe)||_.isEmpty(n.tribe)||n.tribe.id===0?!0:!1}function l(){if(_.isNil(n.model.tribeAssociations)&&(n.model.tribeAssociations=[]),n.tribe&&n.tribeEnrollmentAffiliation){var t=n.tribeEnrollmentAffiliation==="Affiliated"?!1:!0,i=_.find(n.model.tribeAssociations,function(i){return i.tribe.tribeId===n.tribe.id&&i.isEnrolled===t});i||n.model.tribeAssociations.push({tribe:{tribeId:n.tribe.id,tribeName:n.tribe.name},isEnrolled:t});n.clearErrorMessage()}n.tribe=null}function a(t){var i=_.remove(n.model.tribeAssociations,function(n){return n.tribe.tribeId!==t});n.model.tribeAssociations=i}function v(n,t){var i=u.demographics.affiliated;return n&&(i=u.demographics.enrolled),i+" "+u.demographics.with+" "+t}var n=this,i=!1;n.addTribe=l;n.deleteTribe=a;n.disableTribeRecognition=o;n.disableTribeState=s;n.disableTribe=h;n.disableAdd=c;n.clearTribes=f;n.clearSelectedState=e;n.getTribeAssociationDetail=v;t.get(r.states).then(function(t){n.tribeStates=t.data})},scope:{}}}n.module("app").directive("tribeRecognition",["$q","$http","templateUrls","hrefs","localized",t])}(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){"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,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(){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,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,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(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),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 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){"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(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";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,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){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,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(n,r,u,f,e,o,s,h,c,l,a,v,y,p){function k(){return c.get().length>0}function d(n){n.stopPropagation();n.preventDefault();h.goToPage("duplicates")}function g(){var n=b();return n.id}function nt(){var n=b();return t.has(n,"hrefAddCaseResolution")}function b(){return e.get()}function tt(){var n=b();return n&&n.hrefAddCaseTracker!=null&&n.hrefRemoveCaseTracker!=null}function it(){var n=b();return n.currentUserIsTracking?l.tracking.untrackCase:l.tracking.trackCase}function rt(){var n=b();return n&&n.caseOrigin&&(n.caseOrigin.id===a.caseOrigin.uploaded.id||n.caseOrigin.id===a.caseOrigin.serverToServer.id)?!0:!1}function ut(){var n=b();return n.caseResolutionDetails===null||n.caseResolutionDetails===i?l.resolution.resolveCase:l.resolution.editResolution}function ft(){var n=b();n.currentUserIsTracking?(o.delete(n.hrefRemoveCaseTracker),n.currentUserIsTracking=!1):(o.post(n.hrefAddCaseTracker),n.currentUserIsTracking=!0)}function et(){return e.hasPublicViewPermission()}function ot(){var n=b();return n.status&&n.status.id<=2&&v.isCurrentUserPublic()?!1:n.viewPermission==="professional"?!0:!1}var w=this;y.setIsPrintMode(!1);w.hasDuplicates=k;w.showDuplicates=d;w.hide=et;w.canTrackCase=tt;w.trackCaseButtonText=it;w.trackCase=ft;w.showImportPill=rt;w.showMatches=ot;w.photoUrl=s.getPhotoUrl;w.caseNumber=s.getCaseNumber;w.caseId=g;w.fullName=s.getFullName;w.gender=s.getGender;w.ethnicities=s.getEthnicities;w.status=s.getStatus;w.statusCssClass=s.getStatusCssClass;w.showLifecycleStatus=s.showLifecycleStatus;w.lifecycleStatus=s.getLifecycleStatus;w.lifecycleStatusCssClass=s.getLifecycleStatusCssClass;w.missingSince=s.getMissingSince;w.missingFrom=s.getMissingFrom;w.currentAge=s.getCurrentAge;w.missingAge=s.getMissingAge;w.matchCount=0;w.currentDuplicate=0;w.resolveCase=p.openModal;w.resolveCaseButtonText=ut;w.canResolveCase=nt;n.$on("missingPersons.caseMatching.matchCountUpdated",function(n,t){t&&t.count!==null&&(w.matchCount=t.count)})}n.module("app").controller("Summary",["$scope","$http","namusModal","templateUrls","CaseService","dataContext","SummaryProjection","CaseNavigationService","DuplicatesService","localized","appConstants","identity","OptionService","CaseResolutionModalService",r])}(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,t,i){"use strict";function r(n,r,u,f,e,o,s,h,c,l,a,v,y,p){function g(n,t){return n?(t||(t=0),n+t):null}function pt(n){return n?i(n).format("MM/DD/YYYY"):null}function dt(){return{biometrics:{selected:w.biometrics.selected,enabled:w.biometrics.enabled},gender:{all:w.gender.all,selected:w.gender.selected,enabled:w.gender.enabled},ethnicity:{all:w.ethnicity.all,selected:w.ethnicity.selected,enabled:w.ethnicity.enabled},height:{from:w.height.heightFrom,to:w.height.heightTo,includeUndefined:w.height.includeUndefined,enabled:w.height.enabled},weight:{from:w.weight.weightFrom,to:w.weight.weightTo,includeUndefined:w.weight.includeUndefined,enabled:w.weight.enabled},sightingDate:{from:w.sightingDate.dateFrom,to:w.sightingDate.dateTo,enabled:w.sightingDate.enabled},sightingState:{all:w.sightingState.all,selected:w.sightingState.selected,enabled:w.sightingState.enabled},locationRadius:{radius:w.locationRadius.radius,enabled:w.locationRadius.enabled},birthYear:{from:w.birthYear.birthYearFrom,to:w.birthYear.birthYearTo,includeUndefined:w.birthYear.includeUndefined,enabled:w.birthYear.enabled},excludedCaseIds:{ids:t(k.internalCaseExclusions).map(function(n){return n.excludedCaseId}).uniq().value()}}}function gt(){var n=di().then(function(n){if(ut=!(n&&(a.isCurrentUserAdministrator(n)||a.isCurrentUserProfessional(n))),ti(ut)){b.userCanViewPotentialMatches=!0;var t=ri(),i=ui(),r=oi(),u=ki(),f=fi(),o=ei();return w.biometrics.all.push({value:w.biometrics.values.dnaSamples,display:e.dna.dnaSamples},{value:w.biometrics.values.fingerprints,display:e.fingerprints.fingerprintClassificationOrCards},{value:w.biometrics.values.dental,display:e.dental.dentalRadiographOrCharts}),s.all([t,i,r,u,f,o])}})}function ni(){var n=t(nt).map("field").filter(function(n){return n!="distanceFromLastKnownLocation"}).value();d=u.create(o.unidentifiedPersonsSearchApi);d.query.select(n).select(["circumstancesOfRecovery","defaultImageIdentityId","leftEyeColor","rightEyeColor","hairColor","stateOfRecovery"]).selectDocumentFragment(["images","ncicNumber"]).orderBy("dateFound")}function ti(n){return!n}function wt(){for(var n in w)w.hasOwnProperty(n)&&w[n]&&t.isFunction(w[n].setDefaults)&&w[n].setDefaults();w.locationRadius.enabled&&(w.sightingState.enabled=!1)}function ii(){for(var n in w)w.hasOwnProperty(n)&&w[n]&&t.isFunction(w[n].clear)&&w[n].clear()}function ri(){return f.get(o.sexes).then(function(n){w.gender.all=t.map(t.sortBy(n.data,["id"]),function(n){return it.genders[n.name]=n.localizedName,{value:n.name,display:n.localizedName}})})}function ui(){return f.get(o.ethnicities).then(function(n){w.ethnicity.all=t.map(t.sortBy(n.data,["id"]),function(n){var t=n.localizedName;return(n.localizedName==="Uncertain"||n.localizedName==="Incierto")&&(t=e.uncertainNotProvided),it.ethnicities[n.name]=n.localizedName,{value:n.name,display:t}})})}function fi(){return f.get(o.eyeColors).then(function(n){t.forEach(n.data,function(n){it.eyeColors[n.name]=n.localizedName})})}function ei(){return f.get(o.hairColors).then(function(n){t.forEach(n.data,function(n){it.hairColors[n.name]=n.localizedName})})}function oi(){return f.get(o.states).then(function(n){w.sightingState.all=t.map(n.data,function(n){return n.name})})}function ft(n,i,r,u,f,o){if(!i&&!r&&!n.includeUndefined)return null;t.isFunction(o)||(o=function(n){return(n||"").toString()});var s=null;return i&&r?s=i===r?o(i):"".concat(e.from," ",o(i)," ",e.to," ",o(r)):!i&&r?s="".concat(e.lessThanOrEqualTo," ",o(r)):i&&!r&&(s="".concat(e.greaterThanOrEqualTo," ",o(i))),u&&(s?s+=" | ":s="",s+=f),s}function si(){var i=hi(),r;return(vt=ci(),!b.caseHasLoaded||!b.userCanViewPotentialMatches)?s.resolve():(d.query.skipValue+d.query.takeValue===d.resultCount&&d.query.skipValue>0&&d.query.skip(d.query.skipValue-1),d.query.clearPredicates(),i&&i.length&&t.forEach(i,d.query.where),r=t(k.internalCaseExclusions).map(function(n){return n.excludedCaseId}).uniq().value(),r.length&&d.query.whereIsNotIn("namus2Number",r),d.query.whereEqualTo("publicationStatus","Published"),d.executeQuery().then(function(){n.$root.$broadcast("missingPersons.caseMatching.matchCountUpdated",{count:d.resultCount});d.resultCount===0&&bt()}))}function hi(){var n,i,r=[];for(n in w)w.hasOwnProperty(n)&&w[n]&&w[n].enabled===!0&&t.isFunction(w[n].getPredicates)&&(i=w[n].getPredicates(),i&&(t.isArray(i)?r=r.concat(i):r.push(i)));return r}function ci(){var n,i,r=[];for(n in w)w.hasOwnProperty(n)&&w[n]&&w[n].enabled===!0&&t.isFunction(w[n].getTag)&&(i=w[n].getTag(),i&&r.push(i));return r}function ct(){return t(nt).filter(function(n){return n.enableSorting}).map(function(n){return{name:n.sortField||n.field,label:n.displayName,args:n.sortArgs}}).value()}function li(n,i){n&&t.isArray(i)&&(n.enabled=i.length>0)}function ai(){w.locationRadius.enabled=w.locationRadius.radius!=null}function et(n){var t;if(n.includeUndefined){n.enabled=!0;return}for(t=0;t<n.selected.length;t++)if(n.selected[t]&&n.selected[t].value){n.enabled=!0;return}n.enabled=!1}function vi(n){var t;if(n.includeUndefined){n.enabled=!0;return}for(t=0;t<n.selected.length;t++)if(n.selected[t]){n.enabled=!0;return}n.enabled=!1}function yi(n,t){lt(n,t)}function pi(n,t){lt(n,t)}function wi(n){return n._hasBeenBound===!0?n:(n.fullCaseHref=n.link,n.responsive=yt,n.estimatedAgeFormatted=n.estimatedAgeFrom==null?null:n.estimatedAgeTo==null?n.estimatedAgeFrom:"".concat(n.estimatedAgeFrom," - ",n.estimatedAgeTo),n.heightRangeFormatted=n.heightFrom==null?null:n.heightTo==null?l.toFeetAndInches(n.heightFrom):"".concat(l.toFeetAndInches(n.heightFrom)," - ",l.toFeetAndInches(n.heightTo)),n.weightRangeFormatted=n.weightFrom==null?null:n.weightTo==null?n.weightFrom:"".concat(n.weightFrom," - ",n.weightTo),n.sexFormatted=n.sex,n.leftEyeColorFormatted=it.eyeColors[n.leftEyeColor],n.rightEyeColorFormatted=it.eyeColors[n.rightEyeColor],n.hairColorFormatted=it.hairColors[n.hairColor],y.getRaceEthnicityLocalized(n.raceEthnicity).then(function(t){n.raceEthnicity=t}),y.getRaceEthnicityFormattedLocalized(n.raceEthnicity).then(function(t){n.raceEthnicityFormatted=t}),n.document=n.document||{},n.document.images=t(n.document.images).filter(function(n){return n.files!=null}).sortBy(function(t){return!t.category||!t.category.name?null:t.identityId===n.defaultImageIdentityId?-1:rt[t.category.name]}).map(function(t){return t.files=t.files||{},t.files.thumbnail=t.files.thumbnail||{},t.files.thumbnail.href=o.getUnidentifiedPersonsImageApi.replace("/caseId/","".concat("/",n.namus2Number,"/")).replace("/identityId/","".concat("/",t.identityId,"/")).replace("/purpose","/Thumbnail"),t.files.original=t.files.original||{},t.files.original.href=o.getUnidentifiedPersonsImageApi.replace("/caseId/","".concat("/",n.namus2Number,"/")).replace("/identityId/","".concat("/",t.identityId,"/")).replace("/purpose","/Original"),t}).value(),n._hasBeenBound=!0,n)}function bi(n){return n._hasBeenBound===!0?n:(n.responsive=yt,n.subjectDescription=n.subjectDescription||{},n.sighting=n.sighting||{},n.subjectDescription.ethnicities&&n.subjectDescription.ethnicities.length>0&&(n.subjectDescription.ethnicityFormatted=t.map(n.subjectDescription.ethnicities,function(n){return n.localizedName}).join(", ")),n.subjectDescription.heightRangeFormatted=n.subjectDescription.heightFrom==null?null:n.subjectDescription.heightTo==null?l.toFeetAndInches(n.subjectDescription.heightFrom):"".concat(l.toFeetAndInches(n.subjectDescription.heightFrom)," - ",l.toFeetAndInches(n.subjectDescription.heightTo)),n.subjectDescription.weightRangeFormatted=n.subjectDescription.weightFrom==null?null:n.subjectDescription.weightTo==null?n.subjectDescription.weightFrom:"".concat(n.subjectDescription.weightFrom," - ",n.subjectDescription.weightTo),t.isNil(n.sighting.city)||t.isNil(n.sighting.state)?!t.isNil(n.sighting.city)&&t.isNil(n.sighting.state)?n.sighting.missingFrom=n.sighting.city:t.isNil(n.sighting.city)&&!t.isNil(n.sighting.state)&&(n.sighting.missingFrom=n.sighting.state):n.sighting.missingFrom="".concat(n.sighting.city,", ",n.sighting.state),n.physicalDescription&&(n.physicalDescription.leftEyeColor=n.physicalDescription.leftEyeColor||{},n.physicalDescription.rightEyeColor=n.physicalDescription.rightEyeColor||{},n.physicalDescription.hairColor=n.physicalDescription.hairColor||{}),n.imagesSorted=t(n.images).filter(function(n){return n.files!==null}).sortBy(function(t){return!t.category||!t.category.name?null:t.identityId===n.defaultImageIdentityId?-1:rt[t.category.name]}).value()||[],n._hasBeenBound=!0,n)}function lt(n,t){n&&(b.dataService.clearResults(),b.dataService.query.skip(b.dataService.query.skipValue+t));tt=b.dataService.pageSize;ht=b.displayType;b.displayType=b.displayTypes.comparison;b.dataService.query.take(1);b.dataService.executeQuery();c.scrollTo(0,1);c.scrollTo(0,0);b.isRevising=!1;b.onShowComparisonView&&b.onShowComparisonView()}function bt(){if(ht){var n=b.dataService.page*b.dataService.pageSize-1,i=tt?parseInt(n/tt):1,t=tt?n%tt:0;b.displayType=ht;b.dataService.clearResults();b.dataService.query.skip(i*tt);b.dataService.query.take(tt);b.dataService.executeQuery().then(function(){b.dataService.results&&b.dataService.results.length>t&&(b.dataService.results[t]._selected=!0)});b.onHideComparisonView&&b.onHideComparisonView()}}function ki(){return f.get(o.imageCategories,function(n){rt=[];t.forEach(n.data,function(n){rt[n.name]=n.ordinal})})}function di(){return a.getCurrentUserOrWait().then(function(n){return n.subject==null?s.resolve(null):n})}var b=this,ot=3,at=5,st=15,d=null,tt=null,ht=null,rt=[],ut=!0,it={genders:[],ethnicities:[],hairColors:[],eyeColors:[]},k,vt=[],w={biometrics:{values:{dnaSamples:"DnaSamples",fingerprints:"Fingerprints",dental:"Dental"},all:[],enabled:!1,selected:[],getPredicates:function(){var n=[],i;if(t.filter(w.biometrics.selected,{value:w.biometrics.values.dnaSamples}).length&&(i=r.isIn("dnaSampleStatus",["Complete","Collected","Submitted"]),n.push(r.matches("dnaSamples",i))),t.filter(w.biometrics.selected,{value:w.biometrics.values.fingerprints}).length){var u=[],e=r.matches("fingerprintNcicCodes",[]),o=r.matches("fingerprintIAFISCodes",[]),s=r.or([e,o]);u.push(s);var h=r.equalTo("fingerprintRecordAvailability",2),c=r.isIn("imageCategory","FingerprintCard"),l=r.matches("images",c),a=r.or([u,l,h]);n.push(a)}if(t.filter(w.biometrics.selected,{value:w.biometrics.values.dental}).length){var f=[],v=r.matches("dentalChartCodes",[]),y=r.matches("dentalChartNamUsCodes",[]),p=r.or([v,y]);f.push(p);var b=r.equalTo("dentalChartAvailability",2),k=r.isIn("imageCategory",["DentalChart","DentalRadiograph","DentalOther"]),d=r.matches("images",k),g=r.or([f,d,b]);n.push(g)}return n.length===0?null:n},getTag:function(){var n=null;return w.biometrics.selected.length&&(n={name:e.search.availableBiometrics,display:[],clear:w.biometrics.clear},t.filter(w.biometrics.selected,{value:w.biometrics.values.dnaSamples}).length&&n.display.push(e.dna.dnaSamples),t.filter(w.biometrics.selected,{value:w.biometrics.values.fingerprints}).length&&n.display.push(e.fingerprints.fingerprintClassificationOrCards),t.filter(w.biometrics.selected,{value:w.biometrics.values.dental}).length&&n.display.push(e.dental.dentalRadiographOrCharts),n.display=n.display.join(" | ")),n},clear:function(){w.biometrics.selected=[];w.biometrics.enabled=!1},setDefaults:function(){w.biometrics.clear()}},gender:{all:[],enabled:!1,selected:[],getPredicates:function(){var n=null,i=null;return w.gender.selected.length?(n=r.isIn("sex",t.map(w.gender.selected,"value")),i=r.doesNotExist("sex",""),n&&i?r.or([n,i]):n?n:i?i:null):null},getTag:function(){var n=null;return w.gender.selected.length&&(n={name:e.demographics.gender,display:[],clear:w.gender.clear},t.forEach(w.gender.selected,function(i){var r=t(w.gender.all).filter(function(n){return n.value===i.value}).map("display").value();r&&r.length&&(r=r[0],n.display.push(r))}),n.display=n.display.join(" | ")),n},clear:function(){w.gender.selected=[];w.gender.enabled=!1},setDefaults:function(){w.gender.clear();k.subjectDescription&&k.subjectDescription.sex&&((k.subjectDescription&&k.subjectDescription.sex.name==="Male"||k.subjectDescription.sex.name==="Female")&&w.gender.selected.push({value:k.subjectDescription.sex.name},{value:"Unsure"},{value:"Other"}),k.subjectDescription&&k.subjectDescription.sex.name==="Unsure"&&w.gender.selected.push({value:"Male"},{value:"Female"},{value:"Unsure"}),k.subjectDescription&&k.subjectDescription.sex.name==="Other"&&w.gender.selected.push({value:"Male"},{value:"Female"},{value:"Other"}),w.gender.enabled=!0)}},ethnicity:{all:[],enabled:!1,selected:[],getPredicates:function(){var n,i,u,f;return w.ethnicity.selected.length?(n=t.map(w.ethnicity.selected,"value"),i=[],t.includes(n,"Uncertain")&&(u=r.exists("raceEthnicity",""),f=r.doesNotMatch("ethnicities",u),i.push([f])),n.length&&i.push([r.matches("ethnicities",r.isIn("raceEthnicity",n))]),r.or(i)):null},getTag:function(){var n=null;return w.ethnicity.selected.length&&(n={name:e.demographics.raceEthnicity,display:[],clear:w.ethnicity.clear},t.forEach(w.ethnicity.selected,function(i){var r=t(w.ethnicity.all).filter(function(n){return n.value===i.value}).map("display").value();r&&r.length&&(r=r[0],n.display.push(r))}),n.display=n.display.join(" | ")),n},clear:function(){w.ethnicity.selected=[];w.ethnicity.enabled=!1},setDefaults:function(){w.ethnicity.clear();k.subjectDescription&&k.subjectDescription.ethnicities&&k.subjectDescription.ethnicities.length&&(w.ethnicity.selected=t.map(k.subjectDescription.ethnicities,function(n){return{value:n.name}}),w.ethnicity.enabled=!0)}},height:{all:[],enabled:!1,selected:[[],[]],getPredicates:function(){var n=[],i,u,t;return w.height.enabled?(i=w.height.getHeightFrom(),u=w.height.getHeightTo(),i||u?(t=[],i&&t.push(r.greaterThanOrEqualTo("heightTo",i)),u&&t.push(r.lessThanOrEqualTo("heightFrom",u)),w.height.includeUndefined?n.push(r.or([t,[r.isIn("heightCertainty","Cannot Estimate")]])):n=t):w.height.includeUndefined&&n.push(r.isIn("heightCertainty","Cannot Estimate")),n.length===0)?null:n:null},get heightFrom(){return w.height.getHeightFrom()},set heightFrom(n){w.height.selected&&t.isArray(w.height.selected)&&w.height.selected.length&&w.height.selected[0]&&(w.height.selected[0].value=n)},get heightTo(){return w.height.getHeightTo()},set heightTo(n){w.height.selected&&t.isArray(w.height.selected)&&w.height.selected.length>=1&&w.height.selected[1]&&(w.height.selected[1].value=n);w.height.selected[1].value=n},getHeightFrom:function(n){return w.height.selected.length?g(w.height.selected[0].value,n):null},getHeightTo:function(n){return!w.height.selected.length||w.height.selected.length!==2?null:g(w.height.selected[1].value,n)},includeUndefined:!1,getTag:function(){var n=null;return w.height.enabled?w.height.selected.length&&(n={name:e.demographics.height,display:ft(w.height,w.height.getHeightFrom(),w.height.getHeightTo(),w.height.includeUndefined,e.demographics.cannotEstimateHeight,l.toFeetAndInches),clear:w.height.clear},n.display==null)?null:n:n},clear:function(){w.height.heightFrom=null;w.height.heightTo=null;w.height.enabled=!1;w.height.includeUndefined=!1},setDefaults:function(){if(w.height.clear(),k.subjectDescription&&k.subjectDescription.heightFrom){var i=g(k.subjectDescription.heightFrom,-1*ot)||null,n=g(k.subjectDescription.heightTo,ot);n||(n=g(k.subjectDescription.heightFrom,ot));w.height.selected=t.map([i,n],function(n){return{value:n}});w.height.enabled=!0}}},weight:{all:[],enabled:!1,selected:[[],[]],getPredicates:function(){var n=[],i,u,t;return w.weight.enabled?(i=w.weight.getWeightFrom(),u=w.weight.getWeightTo(),i||u?(t=[],i&&t.push(r.greaterThanOrEqualTo("weightTo",i)),u&&t.push(r.lessThanOrEqualTo("weightFrom",u)),w.weight.includeUndefined?n.push(r.or([t,[r.isIn("weightCertainty","Cannot Estimate")]])):n=t):w.weight.includeUndefined&&n.push(r.isIn("weightCertainty","Cannot Estimate")),n.length===0)?null:n:null},get weightFrom(){return w.weight.getWeightFrom()},set weightFrom(n){w.weight.selected&&t.isArray(w.weight.selected)&&w.weight.selected.length&&w.weight.selected[0]&&(w.weight.selected[0].value=n)},get weightTo(){return w.weight.getWeightTo()},set weightTo(n){w.weight.selected&&t.isArray(w.weight.selected)&&w.weight.selected.length>=1&&w.weight.selected[1]&&(w.weight.selected[1].value=n);w.weight.selected[1].value=n},getWeightFrom:function(n){return w.weight.selected.length?g(w.weight.selected[0].value,n):null},getWeightTo:function(n){return!w.weight.selected.length||w.weight.selected.length!==2?null:g(w.weight.selected[1].value,n)},includeUndefined:!1,getTag:function(){var n=null;return w.weight.enabled?w.weight.selected.length&&(n={name:e.demographics.weight,display:ft(w.weight,w.weight.getWeightFrom(),w.weight.getWeightTo(),w.weight.includeUndefined,e.demographics.cannotEstimateWeight),clear:w.weight.clear},n.display==null)?null:n:n},clear:function(){w.weight.weightFrom=null;w.weight.weightTo=null;w.weight.enabled=!1;w.weight.includeUndefined=!1},setDefaults:function(){if(w.weight.clear(),k.subjectDescription&&k.subjectDescription.weightFrom){var i=g(k.subjectDescription.weightFrom,-1*st)||null,n=g(k.subjectDescription.weightTo,st);n||(n=g(k.subjectDescription.weightFrom,st));w.weight.selected=t.map([i,n],function(n){return{value:n}})}}},sightingDate:{all:[],enabled:!1,selected:[[],[]],getPredicates:function(){var f=[],n,t,u;return w.sightingDate.enabled?(n=w.sightingDate.getValueFrom(),t=w.sightingDate.getValueTo(),(n||t)&&(u=[],n&&u.push(r.greaterThanOrEqualTo("dateFound",i(n))),t&&u.push(r.lessThanOrEqualTo("dateFound",i(t))),f=u),f.length===0)?null:f:null},get dateFrom(){return w.sightingDate.getValueFrom()},set dateFrom(n){w.sightingDate.selected&&t.isArray(w.sightingDate.selected)&&w.sightingDate.selected.length&&w.sightingDate.selected[0]&&(w.sightingDate.selected[0].value=n)},get dateTo(){return w.sightingDate.getValueTo()},set dateTo(n){w.sightingDate.selected&&t.isArray(w.sightingDate.selected)&&w.sightingDate.selected.length>=1&&w.sightingDate.selected[1]&&(w.sightingDate.selected[1].value=n);w.sightingDate.selected[1].value=n},getValueFrom:function(){return w.sightingDate.selected.length?w.sightingDate.selected[0].value:null},getValueTo:function(){return!w.sightingDate.selected.length||w.sightingDate.selected.length!==2?null:w.sightingDate.selected[1].value},getTag:function(){var n=null;return w.sightingDate.enabled?w.sightingDate.selected.length&&(n={name:e.circumstances.dateBodyFoundAcronym,display:ft(w.sightingDate,pt(w.sightingDate.getValueFrom()),pt(w.sightingDate.getValueTo()),!1,null,null),clear:w.sightingDate.clear},n.display==null)?null:n:n},clear:function(){w.sightingDate.dateFrom=null;w.sightingDate.dateTo=null;w.sightingDate.enabled=!1},setDefaults:function(){if(w.sightingDate.clear(),k.sighting&&k.sighting.date){var n=k.sighting.date||null;w.sightingDate.selected=t.map([n,null],function(n){return{value:n}});w.sightingDate.enabled=!0}}},sightingState:{all:[],enabled:!1,selected:[],getPredicates:function(){return w.sightingState.selected.length?r.isIn("stateOfRecovery",w.sightingState.selected,"value"):null},getTag:function(){var n=null;return w.sightingState.selected.length&&(n={name:e.circumstances.locationFound,display:[],clear:w.sightingState.clear},t.forEach(w.sightingState.selected,function(t){var i=w.sightingState.all.filter(function(n){return n===t});i&&i.length&&(i=i[0],n.display.push(i))}),n.display=n.display.join(" | ")),n},clear:function(){w.sightingState.selected=[];w.sightingState.enabled=!1},setDefaults:function(){w.sightingState.clear();k.sighting&&k.sighting.state&&(w.sightingState.selected=t.map([{name:k.sighting.state}],function(n){return n.name}),w.sightingState.enabled=!0)}},locationRadius:{all:[],enabled:!1,radius:null,radiusOptions:[25,50,100,200,300,500,750],canBeEnabled:function(){return k&&k.sighting&&(k.sighting.privateGeolocation||k.sighting.publicGeolocation)},getPredicates:function(){if(w.locationRadius.canBeEnabled()&&w.locationRadius.radius){var t=ut?"publicGeolocation":"privateGeolocation",n=k.sighting.privateGeolocation||k.sighting.publicGeolocation;return r.withinMilesOf(t,w.locationRadius.radius,n.coordinates.lat,n.coordinates.lon)}return null},getTag:function(){var n=null;return w.locationRadius.canBeEnabled()&&w.locationRadius.radius&&(n={name:e.circumstances.locationFound,display:"".concat(w.locationRadius.radius," ",e.circumstances.milesFromLastKnownLocation),clear:w.locationRadius.clear}),n},clear:function(){w.locationRadius.radius=null;w.locationRadius.enabled=!1},setDefaults:function(){w.locationRadius.clear();w.locationRadius.canBeEnabled()&&(w.locationRadius.enabled=!0,w.locationRadius.radius=100)}},birthYear:{all:[],enabled:!1,selected:[[],[]],getPredicates:function(){var n=[],i,u,f,e,t;return w.birthYear.enabled?(f=w.birthYear.getBirthYearFrom(),e=w.birthYear.getBirthYearTo(),f||e?(t=[],f&&t.push(r.greaterThanOrEqualTo("estimatedYearOfBirthTo",f)),e&&t.push(r.lessThanOrEqualTo("estimatedYearOfBirthFrom",e)),w.birthYear.includeUndefined?(i=r.doesNotExist("estimatedYearOfBirthFrom",""),u=r.doesNotExist("estimatedYearOfBirthTo",""),n.push(r.or([t,[i,u]]))):n=t):w.birthYear.includeUndefined&&(i=r.doesNotExist("estimatedYearOfBirthFrom",""),u=r.doesNotExist("estimatedYearOfBirthTo",""),n.push(i,u)),n.length===0)?null:n:null},get birthYearFrom(){return w.birthYear.getBirthYearFrom()},set birthYearFrom(n){w.birthYear.selected&&t.isArray(w.birthYear.selected)&&w.birthYear.selected.length&&w.birthYear.selected[0]&&(w.birthYear.selected[0].value=n)},get birthYearTo(){return w.birthYear.getBirthYearTo()},set birthYearTo(n){w.birthYear.selected&&t.isArray(w.birthYear.selected)&&w.birthYear.selected.length>=1&&w.birthYear.selected[1]&&(w.birthYear.selected[1].value=n);w.birthYear.selected[1].value=n},getBirthYearFrom:function(n){return w.birthYear.selected.length?g(w.birthYear.selected[0].value,n):null},getBirthYearTo:function(n){return!w.birthYear.selected.length||w.birthYear.selected.length!==2?null:g(w.birthYear.selected[1].value,n)},includeUndefined:!1,getTag:function(){var n=null;return w.birthYear.enabled?w.birthYear.selected.length&&(n={name:e.demographics.birthYear,display:ft(w.birthYear,w.birthYear.getBirthYearFrom(),w.birthYear.getBirthYearTo(),w.birthYear.includeUndefined,e.demographics.cannotEstimateBirthYear),clear:w.birthYear.clear},n.display==null)?null:n:n},clear:function(){w.birthYear.birthYearFrom=null;w.birthYear.birthYearTo=null;w.birthYear.enabled=!1;w.birthYear.includeUndefined=!1},setDefaults:function(){if(w.birthYear.clear(),k.subjectIdentification&&k.subjectIdentification.birthDate){var n=i(k.subjectIdentification.birthDate),r=g(n.year(),-1*at)||null,u=g(n.year(),at);w.birthYear.selected=t.map([r,u],function(n){return{value:n}});w.birthYear.includeUndefined=!0;w.birthYear.enabled=!0}}}},kt={enableGridMenu:!1,enableExport:!0,exportHref:o.export},nt=[{field:"namus2Number",enableSorting:!1,visible:!1},{field:"idFormatted",sortField:"namus2Number",displayName:e.search.columns.case,headerTooltip:e.search.columns.case,width:80,enableSorting:!0,cellTemplate:h.dashCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"dateFound",displayName:e.circumstances.dateBodyFoundAcronym,headerTooltip:e.circumstances.dateBodyFound,type:"date",width:90,cellFilter:"date",enableSorting:!0,cellTemplate:h.dateCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate,exportFormat:"MM/dd/yyyy"},{field:"estimatedAgeFrom",displayName:e.search.columns.estimatedAgeFromAbbreviated,headerTooltip:e.search.columns.estimatedAgeFromAbbreviated,enableSorting:!0,cellTemplate:h.dashCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"estimatedAgeTo",displayName:e.search.columns.estimatedAgeToAbbreviated,headerTooltip:e.search.columns.estimatedAgeToAbbreviated,enableSorting:!0,cellTemplate:h.dashCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"heightFrom",displayName:e.search.columns.heightFrom,headerTooltip:e.search.columns.heightFrom,enableSorting:!0,cellTemplate:h.heightCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"heightTo",displayName:e.search.columns.heightTo,headerTooltip:e.search.columns.heightTo,enableSorting:!0,cellTemplate:h.heightCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"weightFrom",displayName:e.search.columns.weightFrom,headerTooltip:e.search.columns.weightFrom,enableSorting:!0,cellTemplate:h.dashCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"weightTo",displayName:e.search.columns.weightTo,headerTooltip:e.search.columns.weightTo,enableSorting:!0,cellTemplate:h.dashCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"cityOfRecovery",displayName:e.circumstances.city,headerTooltip:e.circumstances.city,enableSorting:!0,cellTemplate:h.dashCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"stateDisplayNameOfRecovery",displayName:e.circumstances.state,headerTooltip:e.circumstances.state,width:70,enableSorting:!0,cellTemplate:h.dashCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"countyDisplayNameOfRecovery",displayName:e.circumstances.county,headerTooltip:e.circumstances.county,enableSorting:!0,cellTemplate:h.dashCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"sex",displayName:e.demographics.gender,headerTooltip:e.demographics.gender,enableSorting:!0,width:80,cellTemplate:h.dashCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"raceEthnicity",displayName:e.demographics.raceEthnicity,headerTooltip:e.demographics.raceEthnicity,enableSorting:!1,cellTemplate:h.collapseMixedCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},{field:"modifiedDateTime",displayName:e.search.columns.dateModified,headerTooltip:e.search.columns.dateModified,type:"date",cellFilter:"date",width:90,cellTemplate:h.dateCellTemplate,visible:!1,exportFormat:"MM/dd/yyyy"}],yt=[{breakpoint:1024,settings:{slidesToShow:3,slidesToScroll:3,infinite:!0,centerMode:!0,centerPadding:"3.75rem",dots:!0}},{breakpoint:600,settings:{slidesToShow:3,slidesToScroll:3,centerMode:!0,centerPadding:"3.75rem"}},{breakpoint:480,settings:{slidesToShow:1,slidesToScroll:1,centerMode:!0,centerPadding:"3.75rem"}}];ni();Object.defineProperty(b,"case",{get:function(){return k}});b.displayTypes={gallery:"gallery",list:"list",comparison:"comparison"};b.exportToCsvLinkName=e.common.exportToCsvLinkName;b.canExportToCsv=function(){return p.isSupported&&b.displayType===b.displayTypes.list};b.exportToCsv=function(){n.$root.$broadcast(h.broadcastExportToCsv)};b.comparandTemplate="missingPersonsComparandTemplate";b.comparisonRowTemplate="unidentifiedPersonsComparisonRowTemplate";b.displayType=b.displayTypes.list;b.isRevising=!1;b.onGridRowClick=yi;b.onGalleryRowClick=pi;b.onGalleryRowDataBind=wi;b.onComparandDataBind=bi;b.setDefaultsFromCase=wt;b.clearAll=ii;b.maintainLocationRadiusSectionInclusion=ai;b.maintainCheckboxSectionInclusion=li;b.maintainHeightSectionInclusion=function(){et(w.height)};b.maintainWeightSectionInclusion=function(){et(w.weight)};b.maintainSightingDateSectionInclusion=function(){et(w.sightingDate)};b.maintainBirthYearSectionInclusion=function(){et(w.birthYear)};b.maintainSightingStateSectionInclusion=function(){vi(w.sightingState)};b.transitionToComparisonView=lt;b.transitionFromComparisonView=bt;b.columnsForSorter=ct();Object.defineProperty(b,"gridColumnDefinitions",{get:function(){return nt}});Object.defineProperty(b,"possibleMatchCount",{get:function(){return d.resultCount<0?0:d.resultCount}});Object.defineProperty(b,"dataService",{get:function(){return d}});Object.defineProperty(b,"criteria",{get:function(){return w}});Object.defineProperty(b,"criteriaTags",{get:function(){return vt}});Object.defineProperty(b,"gridOptions",{get:function(){return kt}});b.$onInit=gt;v.onCaseLoad(function(i){var r,f,o,u,s;if(i&&i.id)if(k=i,wt(),b.caseHasLoaded=!0,n.$watch(dt,si,!0),r=k.sighting&&(k.sighting.privateGeolocation||k.sighting.publicGeolocation),f=ut?"publicGeolocation":"privateGeolocation",r){for(d.query.selectDistanceInMilesFrom("distanceFromLastKnownLocation",f.concat("Latitude"),f.concat("Longitude"),r.coordinates.lat,r.coordinates.lon),o={field:"distanceFromLastKnownLocation",sortField:f,sortArgs:{latitude:r.coordinates.lat,longitude:r.coordinates.lon},displayName:e.circumstances.distance,headerTooltip:e.circumstances.distance,enableSorting:!0,exportFormat:"0.0",cellTemplate:h.milesCellTemplate,headerCellTemplate:h.multilineHeaderCellTemplate},u=0;u<nt.length;u++)nt[u].field=="countyDisplayNameOfRecovery"&&nt.splice(u+1,0,o);b.columnsForSorter=ct()}else d.query.clearComputedFields(),t.filter(d.query.orderSpecifications,function(n){return n.field.indexOf("geolocation")>=0}).length&&(d.query.clearOrderSpecifications(),d.query.orderBy("dateFound")),s=t.filter(nt,function(n){return n.field!="distanceFromLastKnownLocation"}),nt=s,b.columnsForSorter=ct()})}n.module("app").component("caseMatching",{controller:["$scope","searchPredicateFactory","searchDataServiceFactory","dataContext","localized","hrefs","$q","searchResultsGridConstants","$window","appUtility","identity","CaseService","commonService","fileSaver",r],controllerAs:"vm",templateUrl:["templateUrls",function(n){return n.caseMatching.toString()}],bindings:{onHideComparisonView:"&",onShowComparisonView:"&"}})}(angular,_,moment),function(n,t){"use strict";function i(n,i,r){function e(){return i.openMissingPersonsModal(u,f.excludedCaseId).then(function(n){n&&n.status===i.resultStatuses.exclusionAdded&&n.exclusion&&(n.exclusion.unidentifiedPersonsCaseId?(t.isArray(u.internalCaseExclusions)||(u.internalCaseExclusions=[]),u.internalCaseExclusions.push({id:n.exclusion.id,excludedCaseId:n.exclusion.unidentifiedPersonsCaseId})):u.externalCaseExclusionIds.push(n.exclusion.id))})}function o(){return i.openUnidentifiedPersonsModal(u,f.excludedCaseId).then(function(n){n&&n.status===i.resultStatuses.exclusionAdded&&n.exclusion&&(n.exclusion.missingPersonsCaseId?(t.isArray(u.internalCaseExclusions)||(u.internalCaseExclusions=[]),u.internalCaseExclusions.push({id:n.exclusion.id,excludedCaseId:n.exclusion.missingPersonsCaseId})):u.externalCaseExclusionIds.push(n.exclusion.id))})}function s(){return u&&!!u.hrefAddExclusionInternal}var f=this,u;f.canEdit=s;f.addMissingPersonsExclusion=e;f.addUnidentifiedPersonsExclusion=o;r.onCaseLoad(function(n){n&&n.id&&(u=n,f.caseHasLoaded=!0)})}n.module("app").component("caseExclusionAdd",{controller:["$scope","caseExclusionAddModalService","CaseService",i],controllerAs:"vm",template:'<ng-include src="vm.templateUrl"><\/ng-include>',bindings:{excludedCaseId:"<",templateUrl:"<"}})}(angular,_),function(n,t,i){"use strict";function r(n,r,u,f,e,o){function c(n,t){var i={adapterConstructor:k,getExcludedCaseUrl:y,getExcludedCaseApiUrl:v,excludedCaseAdapterConstructor:g,excludedExternalCaseAdapterConstructor:tt,excludedCaseNotFoundError:{fieldName:"UnidentifiedPersonsCaseId",error:o.search.noUnidentifiedPersonsCasesFound}};return h(n,t,i)}function l(n,t){var i={adapterConstructor:d,getExcludedCaseUrl:w,getExcludedCaseApiUrl:p,excludedCaseAdapterConstructor:nt,excludedExternalCaseAdapterConstructor:it,excludedCaseNotFoundError:{fieldName:"MissingPersonsCaseId",error:o.search.noMissingPersonsCasesFound}};return h(n,t,i)}function h(i,h,c){function w(){var t=[];l.externalCase=new c.excludedExternalCaseAdapterConstructor;var i=e.get(u.getCaseExclusionReasonsApi).then(function(n){l.caseExclusionReasons=n.data}),r=ft().then(function(n){l.states=n.data}),f=et().then(function(n){l.exclusionsInfo=n.data});t.push(i);t.push(r);t.push(f);n.when(t).then(k);h!=null&&p(h)}function k(){r.show({templateUrl:f.caseExclusionAddModal.toString(),data:l,onResult:g,onClose:nt,onCancel:tt})}function d(){l.clearError(l.errors.stateId);ot()}function p(n){if(l.displaySpinner!==!0)return(l.excludedCase=null,n==null||t.isEmpty(n.toString()))?void 0:(it(),l.displaySpinner=!0,e.get(c.getExcludedCaseApiUrl(n.toString().replace(/\D/g,""))).then(function(n){return l.displaySpinner=!1,l.excludedCase=new c.excludedCaseAdapterConstructor(n.data),!0}).catch(function(){return r.setServerValidationErrors({data:{validationErrors:[c.excludedCaseNotFoundError]}},v),l.displaySpinner=!1,!1}))}function g(){var n;return rt(v),r.clearServerValidationErrors(v),n=l.isExternal?i.hrefAddExclusionExternal:i.hrefAddExclusionInternal,e.post(n,ut()).then(function(n){y.resolve({status:s.exclusionAdded,exclusion:n.data})},function(n){r.setServerValidationErrors(n,v);throw n;})}function nt(){y.resolve({status:s.modalClosed})}function tt(){y.resolve({status:s.modalCancelled})}function it(){r.clearServerValidationErrors(v)}function rt(n){var t=r.isPutPostDisabledByError(n);if(t)throw"put/post disabled";}function ut(){var r={caseExclusionReasonId:l.caseExclusionReasonId,description:l.description},n;return l.excludedCase!=null&&l.isExternal===!1?n=l.excludedCase.getPostData(i):l.externalCase!=null&&l.isExternal===!0&&(n=l.externalCase.getPostData(i)),t.extend(r,n)}function ft(){return e.get(u.states)}function et(){return e.get(u.exclusionsInfo)}function ot(){l.externalCase&&st(l.externalCase.stateId).then(function(n){l.counties=n.data})}function st(i){var r=t(l.states).filter(function(n){return n.id===i}).first();return r&&r.hrefGetCounties?e.get(r.hrefGetCounties):n.resolve()}var y=n.defer(),l={allowCaseEntry:h==null,caseObj:new c.adapterConstructor(i),caseExclusionReasons:[],displaySpinner:!1,excludedCaseId:h,excludedCaseIdFormatted:null,excludedCase:null,externalCase:null,exclusion:{caseExclusionReasonId:null,description:null},isExternal:!1,states:[],counties:[],exclusionsInfo:{},getCaseUrl:c.getExcludedCaseUrl,getPersonUrl:b,loadExcludedCaseInformation:p,onStateChange:d,errors:{agencyName:{},agencyCaseNumber:{},stateId:{},countyId:{},caseExclusionReasonId:{},dateFound:{},unidentifiedPersonsCaseId:{},firstName:{},lastName:{},dateOfLastContact:{},missingPersonsCaseId:{},birthYear:{}},validation:{dateFound:{onInvalid:function(){l.errors.dateFound.$error={serverValidation:!0,message:o.common.invalidDate,disablePutPost:!0}},onValid:function(){l.errors.dateFound.$error=null}},dateOfLastContact:{onInvalid:function(){l.errors.dateOfLastContact.$error={serverValidation:!0,message:o.common.invalidDate,disablePutPost:!0}},onValid:function(){l.errors.dateOfLastContact.$error=null}}},clearError:a},v={AgencyName:l.errors.agencyName,AgencyCaseNumber:l.errors.agencyCaseNumber,StateId:l.errors.stateId,CountyId:l.errors.countyId,CaseExclusionReasonId:l.errors.caseExclusionReasonId,DateFound:l.errors.dateFound,UnidentifiedPersonsCaseId:l.errors.unidentifiedPersonsCaseId,FirstName:l.errors.firstName,LastName:l.errors.lastName,DateOfLastContact:l.errors.dateOfLastContact,MissingPersonsCaseId:l.errors.missingPersonsCaseId,BirthYear:l.errors.birthYear};return w(),y.promise}function a(n){n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null)}function v(n){return u.unidentifiedPersonsCase.replace("/0","".concat("/",n))}function y(n){return"".concat("/UnidentifiedPersons/Case#/",n)}function p(n){return u.missingPersonsCase.replace("/0","".concat("/",n))}function w(n){return"".concat("/MissingPersons/Case#/",n)}function b(n){return"".concat("/Persons#/",n)}function k(n){function i(){if(n.subjectDescription&&n.subjectDescription.ethnicities)return t.map(n.subjectDescription.ethnicities,function(n){return n.localizedName}).join(", ")}function r(){return n.subjectDescription&&n.subjectDescription.sex?n.subjectDescription.sex.localizedName:null}function u(){var t=[];return n.subjectIdentification&&(n.subjectIdentification.firstName&&t.push(n.subjectIdentification.firstName),n.subjectIdentification.middleName&&t.push(n.subjectIdentification.middleName),n.subjectIdentification.lastName&&t.push(n.subjectIdentification.lastName)),t.join(" ")}var f=this;return n=n||{},{id:n.id,idFormatted:n.idFormatted,gender:r(),ethnicity:i(),fullName:u()}}function d(n){function i(){if(n.subjectDescription&&n.subjectDescription.ethnicities)return t.map(n.subjectDescription.ethnicities,function(n){return n.localizedName}).join(", ")}function r(){return n.subjectDescription&&n.subjectDescription.sex?n.subjectDescription.sex.localizedName:null}var u=this;return n=n||{},{id:n.id,idFormatted:n.idFormatted,gender:r(),ethnicity:i()}}function g(n){function e(n){return{missingPersonsCaseId:n.id,unidentifiedPersonsCaseId:f()}}function f(){return i.id}function o(){return i.idFormatted}function s(){if(i.subjectDescription&&i.subjectDescription.sex)return i.subjectDescription.sex.localizedName}function h(){if(i.circumstances&&i.circumstances.address&&i.circumstances.address.county.displayName)return i.circumstances.address.county.displayName}function c(){if(i.circumstances&&i.circumstances.address&&i.circumstances.address.state.name)return i.circumstances.address.state.name}function l(){if(i.circumstances&&i.circumstances.address&&i.circumstances.address.city)return i.circumstances.address.city}function a(){if(i.subjectDescription)return t.map(i.subjectDescription.ethnicities,function(n){return n.localizedName})}function v(){if(i.circumstances)return i.circumstances.dateFound}function y(){var f,n;i.caseOwner&&(f=i.caseOwner.investigatingAgencyIdentityId,n=t(i.investigatingAgencies).filter(function(n){return n.id==f}).first(),n&&((n.selection||n.properties||{}).agency&&(r=(n.selection||n.properties||{}).agency.name),u=n.caseNumber))}var p=this,i=n||{},r=null,u=null;return y(),{id:f(),idFormatted:o(),gender:s(),ethnicities:a(),city:l(),county:h(),state:c(),dateFound:v(),agencyName:r,agencyCaseNumber:u,hrefDefaultImageThumbnail:i.hrefDefaultImageThumbnail,getPostData:e}}function nt(n){function o(n){return{unidentifiedPersonsCaseId:n.id,missingPersonsCaseId:e()}}function e(){return r.id}function s(){return r.idFormatted}function h(){if(r.subjectDescription&&r.subjectDescription.sex)return r.subjectDescription.sex.localizedName}function c(){if(r.sighting&&r.sighting.address)return r.sighting.address.county.name}function l(){if(r.sighting&&r.sighting.address)return r.sighting.address.state.name}function a(){if(r.sighting&&r.sighting.address)return r.sighting.address.city}function v(){if(r.subjectDescription)return t.map(r.subjectDescription.ethnicities,function(n){return n.localizedName})}function y(){if(r.subjectIdentification&&r.subjectIdentification.birthDate)return i(r.subjectIdentification.birthDate).year()}function p(){if(r.sighting)return r.sighting.date}function w(){var i,n;r.caseOwner&&(i=r.caseOwner.investigatingAgencyIdentityId,n=t(r.investigatingAgencies).filter(function(n){return n.id==i}).first(),n&&(u=(n.selection||n.properties||{}).agency.name,f=n.caseNumber))}function b(){var n=[];return r.subjectIdentification&&(r.subjectIdentification.firstName&&n.push(r.subjectIdentification.firstName),r.subjectIdentification.middleName&&n.push(r.subjectIdentification.middleName),r.subjectIdentification.lastName&&n.push(r.subjectIdentification.lastName)),n.join(" ")}var k=this,r=n||{},u=null,f=null;return w(),{id:e(),idFormatted:s(),gender:h(),ethnicities:v(),fullName:b(),city:a(),county:c(),state:l(),dateOfLastContact:p(),birthYear:y(),agencyName:u,agencyCaseNumber:f,hrefDefaultImageThumbnail:r.hrefDefaultImageThumbnail,getPostData:o}}function tt(){function t(t){return{missingPersonsCaseId:t.id,countyId:n.countyId,stateId:n.stateId,dateFound:n.dateFound,agencyName:n.agencyName,agencyCaseNumber:n.agencyCaseNumber}}var n=this;n.countyId=null;n.stateId=null;n.dateFound=null;n.agencyName=null;n.agencyCaseNumber=null;n.getPostData=t}function it(){function t(t){return{unidentifiedPersonsCaseId:t.id,countyId:n.countyId,stateId:n.stateId,dateOfLastContact:n.dateOfLastContact,firstName:n.firstName,lastName:n.lastName,birthYear:n.birthYear,agencyName:n.agencyName,agencyCaseNumber:n.agencyCaseNumber}}var n=this;n.countyId=null;n.stateId=null;n.dateOfLastContact=null;n.firstName=null;n.lastName=null;n.birthYear=null;n.agencyName=null;n.agencyCaseNumber=null;n.getPostData=t}var s={exclusionAdded:"exclusion_added",modalCancelled:"cancelled",modalClosed:"closed"};return{openMissingPersonsModal:c,openUnidentifiedPersonsModal:l,resultStatuses:s}}n.module("app").factory("caseExclusionAddModalService",["$q","namusModal","hrefs","templateUrls","dataContext","localized",r])}(angular,_,moment),function(n,t){"use strict";function i(n,i,r,u,f,e){function o(t,r){function w(){return y.caseObj&&!!y.caseObj.hrefDeleteExclusionInternal}function b(){i.show({templateUrl:u.caseExclusionModal.toString(),data:y,onResult:g,onClose:nt,onCancel:tt})}function k(){var n="";return!this.exclusion.enteredByFirstName||(n=this.exclusion.enteredByFirstName+" "+this.exclusion.enteredByLastName),!n||!this.exclusion.enteredByRoleName||(n=n+", "+this.exclusion.enteredByRoleName),n}function d(){var n=this.getEnteredByFullName(),t=e.isCurrentUserAdministrator();return!!n&&!!t}function g(n){o.resolve(n)}function nt(){o.resolve()}function tt(){o.resolve()}var o=n.defer(),y={forPublicView:e.currentUserHasPublicUpView(),isExternal:r.External===!0,canEdit:w,caseObj:t,deleteExclusion:!1,getCaseEthnicity:c,getCaseUrl:a,getPersonUrl:v,getCaseFullName:l,getEnteredByFullName:k,showEnteredByAsLink:d},p=r.External?s:h;return f.get(p(t.id,r.ExclusionId)).then(function(n){y.exclusion=n.data;b()}),o.promise}function s(n,t){return(r.getMissingPersonsCaseExternalExclusionApi||"").replace(/\/caseId\//i,"/".concat(n,"/")).replace(/\/exclusionId/i,"/".concat(t))}function h(n,t){return(r.getMissingPersonsCaseInternalExclusionApi||"").replace(/\/caseId\//i,"/".concat(n,"/")).replace(/\/exclusionId/i,"/".concat(t))}function c(n){if(n&&n.subjectDescription&&n.subjectDescription.ethnicities)return t.map(n.subjectDescription.ethnicities,function(n){return n.localizedName}).join(",")}function l(n){var t=[];return n.subjectIdentification&&(n.subjectIdentification.firstName&&t.push(n.subjectIdentification.firstName),n.subjectIdentification.middleName&&t.push(n.subjectIdentification.middleName),n.subjectIdentification.lastName&&t.push(n.subjectIdentification.lastName)),t.join(" ")}function a(n){return"".concat("/UnidentifiedPersons/Case#/",n)}function v(n){return"".concat("/Persons#/",n)}return{open:o}}n.module("app").factory("caseExclusionModalService",["$q","namusModal","hrefs","templateUrls","dataContext","identity",i])}(angular,_),function(n){"use strict";function t(n,t,i,r,u,f,e){function c(n,t){return(i.getMissingPersonsCaseExternalExclusionApi||"").replace(/\/caseId\//i,"/".concat(n,"/")).replace(/\/exclusionId/i,"/".concat(t))}function l(n,t){return(i.getMissingPersonsCaseInternalExclusionApi||"").replace(/\/caseId\//i,"/".concat(n,"/")).replace(/\/exclusionId/i,"/".concat(t))}function a(n){return"".concat("/UnidentifiedPersons/Case#/",n)}function v(n){return"".concat("/Persons#/",n)}function y(){return o?s:{}}var h=this,o,s;h.getCaseExclusions=y;s=[];u.onCaseLoad(function(n){n&&n.id&&(o=n,h.caseHasLoaded=!0,r.create(o.hrefGetExclusions).executeQuery().then(function(n){var t;n.forEach(function(n){var r=n.External?c:l,i={};i.isExternal=n.External===!0;i.getCaseUrl=a;i.forPublicView=e.currentUserHasPublicUpView();i.getPersonUrl=v;i.getBirthYear=function(){var n=this.exclusion||{};return{from:n.subjectMinBirthYear,to:n.subjectMaxBirthYear}};i.getEnteredByFullName=function(){return t="",!n.EnteredByFirstName||(t=n.EnteredByFirstName+" "+n.EnteredByLastName),!t||!n.EnteredByRoleName||(t=t+", "+n.EnteredByRoleName),t};i.showEnteredByAsLink=function(){var n=e.isCurrentUserAdministrator();return!!t&&!!n};f.get(r(n.CaseId,n.ExclusionId)).then(function(n){i.exclusion=n.data;s.push(i)})})}))})}n.module("app").controller("CaseExclusions",["$scope","$q","hrefs","odataServiceFactory","CaseService","dataContext","identity",t])}(angular),function(n,t){"use strict";function i(n,i,r,u,f,e,o,s,h,c,l,a){function d(){return y?y.status&&y.status.id<=2&&s.isCurrentUserPublic()?!1:t.has(y,"hrefGetExclusions"):!1}function g(){return{internal:(y||{}).internalCaseExclusions,external:(y||{}).externalCaseExclusionIds}}function nt(){if(y)return p=i.create(y.hrefGetExclusions),p.executeQuery()}function tt(){return t(w).filter(function(n){return n.enableSorting}).map(function(n){return{name:n.sortField||n.field,label:n.displayName,args:n.sortArgs}}).value()}function it(n){h.open(y,n).then(function(n){if(n&&!!n.deleteExclusion){var t=n.exclusion.external?n.caseObj.hrefDeleteExclusionExternal:n.caseObj.hrefDeleteExclusionInternal,i=(t||"").replace(/\/exclusionId/i,"/".concat(n.exclusion.exclusionId));n.exclusion.hrefDelete=i;c.openConfirmItemDeletionDialog(n.exclusion,"exclusion",function(){ut(n.exclusion.exclusionId,n.exclusion.external)})}})}function rt(n){return n._hasBeenBound===!0?n:(n.EnteredByLastName&&(n.EnteredByLastName=n.EnteredByFirstName+" "+n.EnteredByLastName+" - "+n.EnteredByRoleName),n._hasBeenBound=!0,n)}function ut(n,i){i?t.remove(y.externalCaseExclusionIds,function(t){return t===n}):t.remove(y.internalCaseExclusions,function(t){return t.id===n})}var v=this,p=null,y,b={enableGridMenu:!1,enableExport:!0,exportHref:u.exclusionsExport},w=[{field:"namus2Number",enableSorting:!1,visible:!1},{field:"ExcludedCaseIdFormatted",sortField:"ExcludedCaseId",displayName:r.search.columns.case,headerTooltip:r.search.columns.case,width:80,enableSorting:!0,cellTemplate:e.dashCellTemplate,headerCellTemplate:e.multilineHeaderCellTemplate},{field:"KeyDate",displayName:r.circumstances.dateBodyFoundAcronym,headerTooltip:r.circumstances.dateBodyFound,type:"date",cellFilter:"date",enableSorting:!0,cellTemplate:e.dateCellTemplate,headerCellTemplate:e.multilineHeaderCellTemplate},{field:"CountyName",displayName:r.circumstances.county,headerTooltip:r.circumstances.county,enableSorting:!0,cellTemplate:e.dashCellTemplate,headerCellTemplate:e.multilineHeaderCellTemplate},{field:"StateName",displayName:r.circumstances.state,headerTooltip:r.circumstances.state,enableSorting:!0,cellTemplate:e.dashCellTemplate,headerCellTemplate:e.multilineHeaderCellTemplate},{field:"ReasonName",displayName:r.search.columns.reason,headerTooltip:r.search.columns.reason,enableSorting:!0,cellTemplate:e.dashCellTemplate,headerCellTemplate:e.multilineHeaderCellTemplate},{field:"EnteredByLastName",displayName:r.search.columns.enteredBy,headerTooltip:r.search.columns.enteredBy,enableSorting:!0,cellTemplate:e.dashCellTemplate,headerCellTemplate:e.multilineHeaderCellTemplate},{field:"EnteredOnDateTime",displayName:r.search.columns.enteredOn,headerTooltip:r.search.columns.enteredOn,enableSorting:!0,cellTemplate:e.dateCellTemplate,headerCellTemplate:e.multilineHeaderCellTemplate}],k;v.displayTypes={gallery:"gallery",list:"list",comparison:"comparison"};k=!0;s.getCurrentUserOrWait().then(function(n){n&&n.id&&(k=!1)});v.exportToCsvLinkName=r.common.exportToCsvLinkName;v.exportHoverText=r.exclusions.exportHoverText;v.canExportToCsv=function(){return a.isSupported&&!k&&v.displayType===v.displayTypes.list};v.exportToCsv=function(){n.$root.$broadcast(e.broadcastExportToCsv,b)};v.forPublicView=s.currentUserHasPublicUpView();v.displayType=v.displayTypes.list;v.onRowClick=it;v.onRowDataBind=rt;v.columnsForSorter=tt();Object.defineProperty(v,"gridColumnDefinitions",{get:function(){return w}});Object.defineProperty(v,"exclusionsCount",{get:function(){return(p||{}).resultCount<0?0:(p||{}).resultCount}});Object.defineProperty(v,"dataService",{get:function(){return p}});Object.defineProperty(v,"gridOptions",{get:function(){return b}});l.onCaseLoad(function(t){t&&t.id&&(y=t,v.caseHasLoaded=!0,d()&&(s.currentUserHasPublicUpView()&&w.splice(w.length-3,3),n.$watch(g,nt,!0)),b.exportHref=u.exclusionsExport.replace("/0","/"+y.id))})}n.module("app").component("caseExclusions",{controller:["$scope","odataServiceFactory","localized","hrefs","$q","searchResultsGridConstants","$window","identity","caseExclusionModalService","commonModalService","CaseService","fileSaver",i],controllerAs:"vm",templateUrl:["templateUrls",function(n){return n.caseExclusions.toString()}]})}(angular,_,moment),function(n){"use strict";function t(n,t,i,r,u,f){function h(){var n=s();return!n.caseResolutionDetails}function s(){return n.get()}function a(){return r.isCurrentUserAdministrator()}function v(){return"".concat(f.unidentifiedPersonsCaseDetail,"#/",o().unidentifiedPersonsCaseId)}function y(){var n=s();return _.has(n,"hrefAddCaseResolution")}function c(){return u.openModal(o())}function o(){return s().caseResolutionDetails||{}}function l(){return o().causeOfDeath}function p(){var n=o().mannerOfDeath||{};return n.localizedName}function w(){return o().confirmedByAgency}function b(){return o().unidentifiedPersonsCaseId}function k(){return o().unidentifiedPersonsCaseIdFormatted}function d(){var n=o();if(n&&n.address&&n.address.state)return n.address.state.name}function g(){var n=o();if(n&&n.address)return n.address.city}function nt(){return o().confirmedByInvestigator}function tt(){return o().dateFound}function it(){return o().dateIdentified}function rt(){return o().circumstancesOfResolution}function ut(){return o().familyNotified===!0?i.common.yes:o().familyNotified===!1?i.common.no:void 0}function ft(){var n=[],t=o();return _.forEach(t,function(t,r){if(r.indexOf("methodOfId")===0&&!!t){var u=r.split("_")[1],f=i.resolution[_.camelCase(u)];n.push(f)}}),n}function ot(){var n=o().statusWhenFound;if(n)return n.localizedName}function st(){var n=o().statusWhenFound;if(n)return n.name}function ht(){if(o().statusWhenFound)return o().statusWhenFound.name}function ct(){return o().namusAssisted===!0?i.common.yes:o().namusAssisted===!1?i.common.no:void 0}var e=this;e.hide=h;e.canEdit=y;e.edit=c;e.causeOfDeath=l;e.confirmedByAgencyName=w;e.confirmedByContactName=nt;e.dateFound=tt;e.detailsOfRecoveryIdentification=rt;e.edit=c;e.familyNotified=ut;e.foundByItems=ft;e.mannerOfDeath=p;e.statusAtResolution=ot;e.statusIdAtResolution=st;e.whetherNamUsAssisted=ct;e.causeOfDeath=l;e.dateIdentified=it;e.cityFound=g;e.stateFound=d;e.unidentifiedPersonsCaseId=b;e.showLinkedHref=a;e.unidentifiedPersonsCaseIdFormatted=k;e.linkedCaseHref=v;e.statusWhenFound=ht;t.register("CaseResolutionDetails",{hide:h})}n.module("app").controller("CaseResolutionDetails",["CaseService","NavigationService","localized","identity","CaseResolutionModalService","hrefs",t])}(angular),function(n){"use strict";function t(n,t,i){function e(){return n.hasPublicViewPermission()&&!o()}function s(){return n.hasPublicViewPermission()}function u(){return n.get()}function h(){var n=u();return _.has(n,"hrefAddCaseIdentification")||_.has(n,"caseIdentification.hrefUpdate")}function c(){t.openEditModal(u())}function f(){return u().caseIdentification||{}}function l(){return f().ncicNumber}function a(){return f().vicapNumber}function o(){return f().ncmecNumber}var r=this;r.hide=e;r.hideData=s;r.canEdit=h;r.edit=c;r.ncicNumber=l;r.vicapNumber=a;r.ncmecNumber=o;i.register("CaseNumbers",{hide:e})}n.module("app").controller("CaseNumbers",["CaseService","CaseNumbersModalService","NavigationService",t])}(angular),function(n){"use strict";function t(t,i,r,u){function f(f){function s(n,u,e){var s,c;return h(u,e)?s=i.when({}):(c=e.hrefUpdate?t.put(e.hrefUpdate,e):t.post(n,e),s=c.then(function(n){f.caseIdentification=n.data}).catch(function(n){r.setServerValidationErrors(n,o);throw n;})),s}function h(n,t){return namus.textEquals(n.ncicNumber,t.ncicNumber)&&namus.textEquals(n.ncmecNumber,t.ncmecNumber)&&namus.textEquals(n.vicapNumber,t.vicapNumber)}var e={caseIdentification:n.copy(f.caseIdentification)||{},hrefAddCaseIdentification:f.hrefAddCaseIdentification,errors:{ncicNumber:{}}},o={NcicNumber:e.errors.ncicNumber};r.show({templateUrl:u.caseNumbersEditModal.toString(),data:e,onResult:function(n){return s(f.hrefAddCaseIdentification,f.caseIdentification||{},n.caseIdentification)}})}return{openEditModal:f}}n.module("app").service("CaseNumbersModalService",["$http","$q","namusModal","templateUrls",t])}(angular),function(n,t){"use strict";function i(n,i,r,u,f,e,o,s,h,c){function p(){return i.get()}function w(){var n=p();return!o.getIsPrintMode()&&(_.has(n,"hrefAddSubjectIdentification")||_.has(n,"hrefAddSubjectDescription")||_.has(n,"subjectIdentification.hrefUpdate")||_.has(n,"subjectDescription.hrefUpdate"))}function wt(){return!i.hasPublicViewPermission()}function g(){e.openEditModal(p())}function b(){var n=a().ethnicities;return!!n&&!!_.find(n,{id:c.ethnicities.indian.id})}function v(){return p().subjectIdentification||{}}function a(){return p().subjectDescription||{}}function nt(){return v().firstName}function bt(){return v().middleName}function tt(){return v().lastName}function kt(){return v().maidenName}function dt(){return v().nicknames}function it(){return v().birthDate}function gt(){return v().placeOfBirth}function ni(){var n=v().ssn,t="";return n&&(t=n.slice(0,3)+"-"+n.slice(3,5)+"-"+n.slice(5,9)),t}function ti(){var n=v().ssn,t="";return n&&(t="XXX-XX-"+n.slice(5,9)),t}function ii(){var t=n.absUrl();return t.match("/CaseReport#")?!1:h.isCurrentUserNamUsPersonnel()&&h.canCurrentUserManageCases()}function rt(){var n=a().sex;return n?n.localizedName:null}function ri(){var n=a();return n.tribeAssociations}function ui(){var n=a();return n.militaryBranches}function fi(){var n=a();if(n.militaryAffiliation)return n.militaryAffiliation.localizedName}function ei(n){return n?n.serviceDescription?"".concat(n.branchName,": ",n.serviceDescription):n.branchName:null}function ut(){var n=a(),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 oi(){var n=a().tribalAffiliation;return n?n.localizedName:null}function si(n,t){var i=f.demographics.affiliated;return n&&(i=f.demographics.enrolled),i+" "+f.demographics.with+" "+t}function hi(){var n=a().bloodType;return n?n.localizedName:null}function k(n){var t=Math.floor(n/12),i=n%12;return t+"' "+i+'"'}function ft(){var t=a().heightTo,n=a().heightFrom;return n?t?""+k(n)+" - "+k(t):""+k(n):null}function ci(){var t=a().heightTo,n=a().heightFrom;return n?t?"("+n+" - "+t+" "+f.inches+")":"("+n+" "+f.inches+")":""}function et(){var n=a().weightFrom,t=a().weightTo;return!n&&!t?null:t?"".concat(n," - ",t," ",f.pounds):"".concat(n," ",f.pounds)}function y(){return w()&&i.showRequiredFieldInfo(p())}function ot(){return!y()||!!nt()}function st(){return!y()||!!tt()}function ht(){return!y()||!!ut()}function ct(){return!y()||!!rt()}function lt(){return!y()||!!ft()}function at(){return!y()||!!et()}function vt(){return!y()||!!it()||_.get(v(),"missingMinAge")!=t}function yt(){return!y()||!b()||b()&&!!a().tribalAffiliation}function pt(){return u.sectionIsInvalid(d)}var l=this,d;l.canEdit=w;l.canViewProfessionalFields=wt;l.edit=g;l.firstName=nt;l.middleName=bt;l.lastName=tt;l.maidenName=kt;l.nicknames=dt;l.birthdate=it;l.placeOfBirth=gt;l.ssn=ni;l.maskedSsn=ti;l.showSSN=ii;l.gender=rt;l.ethnicitiesDescription=ut;l.tribalAffiliationLocalizedName=oi;l.bloodType=hi;l.heightFeet=ft;l.heightInches=ci;l.weight=et;l.currentAge=s.getCurrentAge;l.missingAge=s.getMissingAge;l.showRequiredFieldInfo=y;l.showTribalAffiliationData=b;l.getTribeAssociations=ri;l.getTribeAssociationDetail=si;l.getMilitaryBranches=ui;l.getMilitaryServiceDescription=ei;l.getMilitaryAffiliation=fi;l.isFirstNameValid=ot;l.isLastNameValid=st;l.isEthnicitiesValid=ht;l.isGenderValid=ct;l.isHeightValid=lt;l.isWeightValid=at;l.isDateOfBirthOrMissingAgeRangeValid=vt;l.isTribalAffiliationDataValid=yt;d={title:f.demographics.title,fields:[{name:f.demographics.firstName,isValid:ot},{name:f.demographics.lastName,isValid:st},{name:f.demographics.raceEthnicity,isValid:ht},{name:f.demographics.gender,isValid:ct},{name:f.demographics.height,isValid:lt},{name:f.demographics.weight,isValid:at},{name:f.demographics.dateOfBirthOrMissingAgeRange,isValid:vt},{name:f.demographics.tribeEnrollmentAffiliation,isValid:yt}],canEdit:w,edit:g};u.register(d);r.register("Demographics",{isInvalid:pt});this.isInvalid=pt}n.module("app").controller("Demographics",["$location","CaseService","NavigationService","CaseValidationService","localized","DemographicsModalService","OptionService","SummaryProjection","identity","appConstants",i])}(angular),function(n,t){"use strict";function i(i,r,u,f,e,o,s,h,c){function l(l){function v(n){n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null)}function d(){v(a.errors.heightFrom);v(a.errors.heightTo)}function g(){v(a.errors.weightFrom);v(a.errors.weightTo)}function p(){var n=_.find(a.ethnicities,{name:"American Indian / Alaska Native"});return n?!!_.find(a.subjectDescription.ethnicities,{id:n.id}):!1}function nt(){return!!p()}function tt(){return a.subjectDescription.tribalAffiliation&&a.subjectDescription.tribalAffiliation.name==="Yes"?!0:!1}function it(){return c.isCurrentUserNamUsPersonnel()&&c.canCurrentUserManageCases()}function rt(){return a.subjectDescription.militaryAffiliation&&a.subjectDescription.militaryAffiliation.name==="Yes"?!0:!1}function ut(t){if(t&&t.name&&a&&a.subjectDescription){var i=_.find(a.subjectDescription.ethnicities,function(n){return n.id===7});return n.isDefined(i)&&t.name==="Other"}return!1}function ft(n){if(n&&(n.subjectDescription&&(n.specifyMissingAgeRange?(delete n.subjectIdentification.birthDate,_.get(n.subjectIdentification,"missingMinAge")&&_.get(n.subjectIdentification,"missingMaxAge")&&n.subjectIdentification.missingMinAge===n.subjectIdentification.missingMaxAge&&delete n.subjectIdentification.missingMaxAge,_.get(n.subjectIdentification,"missingMinAge")==t&&_.get(n.subjectIdentification,"missingMaxAge")&&(n.subjectIdentification.missingMinAge=n.subjectIdentification.missingMaxAge,delete n.subjectIdentification.missingMaxAge)):(delete n.subjectIdentification.missingMinAge,delete n.subjectIdentification.missingMaxAge)),n.subjectDescription)){var i=_.find(n.subjectDescription.ethnicities,function(n){return n.name==="Other"});!i&&n.subjectDescription.ethnicitiesOther&&delete n.subjectDescription.ethnicitiesOther;p()||delete n.subjectDescription.tribalAffiliation;(n.subjectDescription.tribalAffiliation&&n.subjectDescription.tribalAffiliation.name!=="Yes"||!p())&&delete n.subjectDescription.tribeAssociations;n.subjectDescription.militaryAffiliation&&n.subjectDescription.militaryAffiliation.id===1||delete n.subjectDescription.militaryBranches}}function et(n){var t=u.isPutPostDisabledByError(n);if(t)throw"put/post disabled";}function ot(n){if(n.subjectIdentification&&!ht(l.subjectIdentification||{},n.subjectIdentification)){var t;return t=n.subjectIdentification.hrefUpdate?i.put(n.subjectIdentification.hrefUpdate,n.subjectIdentification):i.post(l.hrefAddSubjectIdentification,n.subjectIdentification),t.then(function(t){return l.subjectIdentification=t.data,y=!0,n})}return r.when(n)}function st(n){if(n.subjectDescription&&!ct(l.subjectDescription||{},n.subjectDescription)){var t;return t=n.subjectDescription.hrefUpdate?i.put(n.subjectDescription.hrefUpdate,n.subjectDescription):i.post(l.hrefAddSubjectDescription,n.subjectDescription),t.then(function(t){return l.subjectDescription=t.data,y=!0,n})}return r.when(n)}function ht(t,i){b(t,i);n.isDefined(t.birthDate)||i.birthDate!==null||(t.birthDate=null);return _.every(["firstName","middleName","maidenName","lastName","nicknames","placeOfBirth","birthDate","ssn"],function(n){return namus.textEquals(t[n],i[n])})&&t.missingMinAge==i.missingMinAge&&t.missingMaxAge==i.missingMaxAge}function ct(t,i){h.addPropertiesBeforeEqualityCheck(t,"",i,"",["bloodType"]);b(t,i);k(t);k(i);var r=n.copy(t),u=n.copy(i);if(namus.textEquals(r.bloodType,u.bloodType))h.removePropertiesBeforeEqualityCheck(r,"",u,"",["bloodType"]);else return!1;return n.equals(r,u)}function b(n,t){for(var i in t)(n.hasOwnProperty(i)||t[i]!=="")&&t[i]!==null||delete t[i]}function k(n){if(n)for(var t in n)n.hasOwnProperty(t)&&Array.isArray(n[t])&&n[t].length===0&&delete n[t];return n}var y=!1,a={clearError:v,showRequiredFieldInfo:o.showRequiredFieldInfo(l),showTribalAffiliationQuestion:nt,showTribeRecognition:tt,showSSN:it,heightOnChange:d,weightOnChange:g,subjectIdentification:n.copy(l.subjectIdentification)||{},subjectDescription:n.copy(l.subjectDescription)||{},hrefAddSubjectIdentification:l.hrefAddSubjectIdentification,hrefAddSubjectDescription:l.hrefAddSubjectDescription,sighting:n.copy(l.sighting),bloodTypes:[],ethnicities:[],sexes:[],tribalAffiliations:[],showMilitaryAssociation:rt,showEthnicitiesOther:ut,duplicateSearchData:{subjectIdentification:n.copy(l.subjectIdentification),subjectDescription:n.copy(l.subjectDescription),location:n.copy(l.sighting)},errors:{firstName:{},middleName:{},lastName:{},maidenName:{},nicknames:{},dob:{},placeOfBirth:{},sex:{},ethnicities:{},bloodType:{},heightFrom:{},heightTo:{},weightFrom:{},weightTo:{},missingMinAge:{},missingMaxAge:{},tribalAffiliation:{},tribeAssociations:{},militaryAffiliation:{},militaryBranches:{},ssn:{}},birthDateValidation:{onInvalid:function(){a.errors.dob.$error={serverValidation:!0,message:s.common.invalidDate,disablePutPost:!0}},onValid:function(){a.errors.dob.$error=null}}},w={FirstName:a.errors.firstName,MiddleName:a.errors.middleName,LastName:a.errors.lastName,MaidenName:a.errors.maidenName,Nicknames:a.errors.nicknames,BirthDate:a.errors.dob,PlaceOfBirth:a.errors.placeOfBirth,Sex:a.errors.sex,Ethnicities:a.errors.ethnicities,BloodType:a.errors.bloodType,HeightFrom:a.errors.heightFrom,HeightTo:a.errors.heightTo,WeightFrom:a.errors.weightFrom,WeightTo:a.errors.weightTo,MissingMinAge:a.errors.missingMinAge,MissingMaxAge:a.errors.missingMaxAge,TribalAffiliation:a.errors.tribalAffiliation,TribeAssociations:a.errors.tribeAssociations,MilitaryAffiliation:a.errors.militaryAffiliation,MilitaryBranches:a.errors.militaryBranches,SSN:a.errors.ssn};a.specifyMissingAgeRange=!a.subjectIdentification.hasOwnProperty("birthDate");u.show({onLoad:function(n){return r.all([i.get(f.bloodTypes).then(function(t){n.bloodTypes=t.data}),i.get(f.ethnicities,{cache:!0}).then(function(t){n.ethnicities=t.data}),i.get(f.sexes).then(function(t){n.sexes=t.data}),i.get(f.tribalAffiliations,{cache:!0}).then(function(t){n.tribalAffiliations=t.data}),i.get(f.militaryAffiliations,{cache:!0}).then(function(t){n.militaryAffiliations=t.data})])},templateUrl:e.demographicsEditModal.toString(),data:a,onResult:function(n){et(w);ft(n);return ot(n).then(st).then(function(){y&&(o.refreshPotentialDuplicates(n.duplicateSearchData),o.reload())}).catch(function(n){u.setServerValidationErrors(n,w);throw n;})}})}return{openEditModal:l}}n.module("app").service("DemographicsModalService",["$http","$q","namusModal","hrefs","templateUrls","CaseService","localized","commonService","identity",i])}(angular),function(n){"use strict";function t(n,t,i){function e(){return n.get()}function o(){var n=e();return{namus2Number:n.id,image:n.hrefDefaultImageThumbnail,document:n,firstName:n.subjectIdentification&&n.subjectIdentification.firstName,lastName:n.subjectIdentification&&n.subjectIdentification.lastName,birthDate:n.subjectIdentification&&n.subjectIdentification.birthDate,dateOfLastContact:n.sighting&&n.sighting.date,cityOfLastContact:n.sighting&&n.sighting.city,countyOfLastContact:n.sighting&&n.sighting.county,stateOfLastContact:n.sighting&&n.sighting.state,ncicNumber:n.ncicNumber}}function s(n){return n/-32+"rem"}function h(n){return n/16+"rem"}function f(){return t.get()}function u(){return f().length}function c(){return u()>0}function l(){return u()>1}function a(){return u()===0}function v(){return u()===1}function y(n){return n.namus2Number}function p(n){return n.link}function w(n){return n.hrefDelete}function b(n){i.openConfirmDuplicateDeletionDialog(n,"duplicate")}function k(n){return n.image}function d(n){return append(n.firstName," ",n.lastName)}function g(n){return n.birthDate}function nt(n){return n.dateOfLastContact}function tt(n){return append(n.cityOfLastContact,", ",n.stateOfLastContact)}function it(n){return n.countyOfLastContact}function rt(n){return n.ncicNumber}var r=this;r.original=o;r.responsive=[{breakpoint:1024,settings:{slidesToShow:3,slidesToScroll:3,infinite:!0,centerMode:!0,centerPadding:"3.75rem",dots:!0}},{breakpoint:600,settings:{slidesToShow:3,slidesToScroll:3,centerMode:!0,centerPadding:"3.75rem"}},{breakpoint:480,settings:{slidesToShow:1,slidesToScroll:1,centerMode:!0,centerPadding:"3.75rem"}}];r.margin=s;r.dimension=h;r.duplicates=f;r.count=u;r.any=c;r.many=l;r.none=a;r.one=v;r.id=y;r.href=p;r.deleteHref=w;r.delete=b;r.defaultImage=k;r.name=d;r.birthDate=g;r.dateOfLastContact=nt;r.location=tt;r.county=it;r.ncicNumber=rt}n.module("app").controller("Duplicates",["CaseService","DuplicatesService","commonModalService",t])}(angular),function(n,t){"use strict";function i(n,i,r,u,f,e,o,s,h){function l(){return n.get()}function st(){return e.missing}function ht(){return n.getCaseCreationFormattedDate()}function k(){return v().date}function p(){var n=l();return!h.getIsPrintMode()&&(_.has(n,"hrefAddFoulPlayIndicator")||_.has(n,"hrefAddCircumstances")||_.has(n,"foulPlay.hrefUpdate")||_.has(n,"circumstances.hrefUpdate"))}function d(){s.openEditDialog(l())}function ct(){return l().foulPlayIndicator&&l().foulPlayIndicator.foulPlayIndicator&&l().foulPlayIndicator.foulPlayIndicator.name}function v(){return l().sighting||{}}function lt(){return v().specificity}function at(){var n=y(),r=null,t,i;return n&&(t=n.address1,i=n.address2,(t||i)&&(r=append(t,"<br/>",i))),r}function vt(){var n=v(),t=n.street1,i=n.street2,r=null;return(t||i)&&(r=append(t," "+e.and+" ",i)),r}function yt(){return v().description}function pt(){var n=y(),u=null,t,i,r;return n&&(t=n.city,i=n.zipCode),n&&n.state&&(r=n.state.name),(t||r||i)&&(u=append(t,", ",r," ",i)),u}function wt(){var n=y();return n&&n.county?n.county.name:null}function bt(){var t=v(),n=t.privateGeolocation||t.publicGeolocation;return n&&!h.getIsPrintMode()?"http://www.google.com/maps/place/"+n.coordinates.lat+","+n.coordinates.lon:null}function kt(){return l().circumstances||{}}function g(){return kt().circumstancesOfDisappearance}function dt(){return p()||nt().length>0}function nt(){return _.filter(l().notes,{noteType:o.noteType.circumstances})}function gt(){f.openAddNoteDialog(o.noteType.circumstances,!0,l().notes,l().hrefAddNote)}function ni(n){f.openEditNoteDialog(o.noteType.circumstances,!0,l().notes,n)}function ti(n){f.openConfirmItemDeletionDialog(n,"circumstances note")}function a(){return p()&&n.showRequiredFieldInfo(l())}function tt(){var n=null,t=l();return t.sighting&&t.sighting.missingFromTribalLand&&(n=l().sighting.missingFromTribalLand.localizedName),n}function ii(){var n=null,t=l();return t.sighting&&t.sighting.primaryResidenceOnTribalLand&&(n=l().sighting.primaryResidenceOnTribalLand.localizedName),n}function ri(n,i,r,u){var f=t;return n===!0?f=i:n===!1?f=r:_.isNull(n)&&(f=u),f}function y(){return v().address||{}}function it(){return!a()||!!k()}function w(){return!a()||!!y().city}function rt(){return!a()||!!y().state}function ui(){return w()&&rt()}function ut(){return!a()||!!y().county}function ft(){return!a()||!!g()}function et(){return!a()||!!tt()}function ot(){return u.sectionIsInvalid(b)}var c=this,b;c.canEdit=p;c.edit=d;c.isInvalid=ot;c.foulPlayIndicator=ct;c.specificity=lt;c.lastKnownStreetAddress=at;c.lastKnownIntersection=vt;c.lastKnownGeneralLocation=yt;c.lastKnownCityStateZip=pt;c.lastKnownCounty=wt;c.mapLink=bt;c.circumstancesOfDisappearance=g;c.missingSince=k;c.status=st;c.caseCreationDate=ht;c.showRequiredFieldInfo=a;c.missingFromTribalLand=tt;c.primaryResidenceOnTribalLand=ii;c.yesno=ri;c.canViewNotes=dt;c.notes=nt;c.addNote=gt;c.editNote=ni;c.deleteNote=ti;c.isDateOfLastContactValid=it;c.isCityValid=w;c.isCityAndStateValid=ui;c.isCountyValid=ut;c.isMissingFromTribalLandValid=et;c.isCircumstancesOfDisappearanceValid=ft;b={title:e.circumstances.title,fields:[{name:e.circumstances.dateOfLastContact,isValid:it},{name:e.circumstances.city,isValid:w},{name:e.circumstances.state,isValid:rt},{name:e.circumstances.county,isValid:ut},{name:e.circumstances.circumstancesOfDisappearance,isValid:ft},{name:e.circumstances.missingFromTribalLand,isValid:et}],canEdit:p,edit:d};u.register(b);r.register("Circumstances",{isInvalid:ot})}n.module("app").controller("Circumstances",["CaseService","identity","NavigationService","CaseValidationService","commonModalService","localized","appConstants","CircumstancesModalService","OptionService",i])}(angular),function(n){"use strict";function t(t,i,r,u,f,e,o,s,h){function c(c){function p(n){n&&n.$error&&!!n.$error.disablePutPost==!1&&(n.$error=null)}function w(){return c?r.isCurrentUserNamUsPersonnel()||o.isUserCaseContributor(r.getCurrentUser(),c.caseContributors)?!0:!1:!1}function b(n){var t=u.isPutPostDisabledByError(n);if(t)throw"put/post disabled";}function k(n){if(n&&n.sighting)switch(n.sighting.specificity){case"Address":delete n.sighting.street1;delete n.sighting.street2;delete n.sighting.description;break;case"Intersection":delete n.sighting.address.address1;delete n.sighting.address.address2;delete n.sighting.description;break;case"GeneralLocation":delete n.sighting.street1;delete n.sighting.street2;delete n.sighting.address.address1;delete n.sighting.address.address2}}function d(r){if(r.foulPlayIndicator.foulPlayIndicator&&!n.equals(r.foulPlayIndicator,c.foulPlayIndicator)){var u;return u=r.foulPlayIndicator.hrefUpdate?t.put(r.foulPlayIndicator.hrefUpdate,r.foulPlayIndicator):t.post(c.hrefAddFoulPlayIndicator,r.foulPlayIndicator),u.then(function(n){return c.foulPlayIndicator=n.data,r})}return i.when(r)}function g(r){if(r.circumstances&&!n.equals(r.circumstances,c.circumstances)){var u;return u=r.circumstances.hrefUpdate?t.put(r.circumstances.hrefUpdate,r.circumstances):t.post(c.hrefAddCircumstances,r.circumstances),u.then(function(n){return c.circumstances=n.data,a=!0,r})}return i.when(r)}function nt(t){return t.sighting||(t.sighting={}),c.sighting||(c.sighting={}),t.sighting&&!tt(t.sighting,c.sighting)?y(t):n.equals(t.sighting.address,c.sighting.address)?i.when(t):y(t)}function y(n){n.sighting&&n.sighting.address&&(n.sighting.address.state&&(n.sighting.address.stateId=n.sighting.address.state.id),n.sighting.address.county&&(n.sighting.address.countyId=n.sighting.address.county.id));var i;return i=n.sighting.hrefUpdate?t.put(n.sighting.hrefUpdate,n.sighting):t.post(c.hrefAddSighting,n.sighting),i.then(function(t){return c.sighting=t.data,a=!0,n})}function tt(t,i){return _.every(["address1","address2","street1","street2","description","city","zipCode","missingFromTribalLand","primaryResidenceOnTribalLand"],function(n){return namus.textEquals(_.get(t,n),_.get(i,n))})&&_.every(["specificity","address","date"],function(r){return n.equals(_.get(t,r),_.get(i,r))})}function it(i){var u,r;l.sighting&&l.sighting.address&&(u=l.sighting.address.state,n.isDefined(u)&&(r=i.find(function(n){return n.name===u.name}),r&&r.hrefGetCounties&&t.get(r.hrefGetCounties).then(function(n){n.status===200&&(l.stateCounties=n.data)})))}var a=!1,l={clearError:p,showRequiredFieldInfo:o.showRequiredFieldInfo(c),foulPlayIndicator:n.copy(c.foulPlayIndicator)||{},circumstances:n.copy(c.circumstances),sighting:n.copy(c.sighting)||{},states:[],stateCounties:[],yesNoUnknown:[],loadCounties:it,foulPlayIndicators:[],showPrimaryResidenceOnTribalLand:w,duplicateSearchData:{subjectIdentification:n.copy(c.subjectIdentification),subjectDescription:n.copy(c.subjectDescription),location:n.copy(c.sighting)},errors:{date:{},zipCode:{}},validation:{sightingDate:{onInvalid:function(){l.errors.date.$error={serverValidation:!0,message:s.common.invalidDate,disablePutPost:!0}},onValid:function(){l.errors.date.$error=null}}}},v={Date:l.errors.date,ZipCode:l.errors.zipCode};l.sighting.specificity||(l.sighting.specificity="Address");u.show({onLoad:function(n){return i.all([t.get(f.foulPlayIndicators).then(function(t){n.foulPlayIndicators=t.data}),t.get(f.states).then(function(t){n.states=t.data;n.loadCounties(n.states)}),t.get(f.yesNoUnknown).then(function(t){n.yesNoUnknown=t.data})])},templateUrl:e.circumstancesModal.toString(),data:l,onResult:function(n){b(v);k(n);return d(n).then(g).then(nt).then(function(){a&&(o.refreshPotentialDuplicates(n.duplicateSearchData),o.reload())}).catch(function(n){u.setServerValidationErrors(n,v);throw n;})}})}return{openEditDialog:c}}n.module("app").service("CircumstancesModalService",["$http","$q","identity","namusModal","hrefs","templateUrls","CaseService","localized","OptionService",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){"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,s){function c(c,a){function p(n){var i=null,t=1200;v.disabled=v.article&&v.article.description&&v.article.description.length>t;v.disabled&&(i={serverValidation:!0,message:_.replace(_.replace(o.common.descriptionLengthExceeds,"{0}",t),"{1}",this.article.description.length-t)});n.$error=i}var v={edit:!!c.hrefUpdate,article:n.copy(c),clothingAndAccessoriesArticles:[],errors:{article:{},description:{}},clearError:i,descriptionChanged:p},y={Article:v.errors.article,Description:v.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:v,onResult:function(i){var f=i.edit?c.hrefUpdate:a.hrefAddClothingAndAccessoriesArticle,e=i.edit?t.put:t.post,o=i.edit?l:h;return u.clearServerValidationErrors(y),s.removePropertiesBeforeEqualityCheck(i,"article.article",c,"article",["ordinal"]),n.equals(c,i.article)?r.when({}):e(f,i.article).then(function(n){o(a,n.data)}).catch(function(n){u.setServerValidationErrors(n,y);throw n;})}})}function l(n,t){_.remove(n.clothingAndAccessoriesArticles,{identityId:t.identityId});h(n,t)}function h(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:c}}function i(n){n.$error=null}n.module("app").service("ClothingAndAccessoriesModalService",["$http","$q","namusModal","hrefs","templateUrls","localized","commonService",t])}(angular),function(n){"use strict";function t(n,t){function r(){return i.caseInfo()}function u(n){var i=n.dnaRelationship||{},r=i.name,t=i.localizedName;return r==="Other"?n.dnaRelationshipOther?n.dnaRelationshipOther:null:(r==="Missing Individual"&&(t=append(t,", ",n.dnaRelationshipOther)),t)}function f(){t.openDnaModal(r(),{dnaTests:[]})}var i=this;n("commonCaseDNA",{subSection:i});i.getRelationship=u;i.addSample=f}n.module("app").controller("DNA",["$controller","DnaModalService",t])}(angular),function(n){"use strict";function i(i,r,u,f,e,o,s,h,c){function v(u,e){function k(){return u.canEditVerifiedDnaSamples&&v.sample.dnaSampleStatus&&(v.sample.dnaSampleStatus.name===s.dnaStatusName.Complete||v.sample.dnaSampleStatus.name===s.dnaStatusName.NotTested||v.sample.dnaSampleStatus.name===s.dnaStatusName.NoResults)?!0:v.sample.dnaTestingNotPerformed===!0?!0:!1}function tt(){return v.sample.verified===!0}function it(n,t){if(!n)return null;return{dnaTechnology:n,profileAvailability:null,profileUploadedToCodis:null,selected:t}}function w(n,t){return _.find(n,function(n){return n.dnaTechnology.id===t})}function d(n){var t=w(v.sample.dnaTests,n.id);return!!t&&!!t.selected}function g(n){var t=w(v.sample.dnaTests,n.id);return!!t&&!!t.selected&&!!t.profileAvailability&&t.profileAvailability.id===s.profileAvailability.yes.id}function rt(n){var t=w(v.sampleOriginal.dnaTests,n.id);return!d(n)&&!!t&&!!t.profileAvailability}function ut(n){var t=w(v.sampleOriginal.dnaTests,n.id);return!g(n)&&!!t&&!!t.profileUploadedToCodis}function ft(t){return function(i){var u,r;if(n.isDefined(i)){if(u=_.find(v.sample.dnaTests,function(n){return n.dnaTechnology.id===t.id}),!u)return null;u.selected=i}else return r=_.find(v.sample.dnaTests,function(n){return n.dnaTechnology.id===t.id}),r||(r=it(t,!1),v.sample.dnaTests.push(r)),_.has(r,"selected")||(r.selected=!0),_.some(v.sample.dnaTests,function(n){return n.dnaTechnology.id===r.dnaTechnology.id&&!!n.selected})}}function et(t,i){return function(r){var u=w(v.sample.dnaTests,t.id);if(u&&n.isDefined(r))u.profileAvailability=i;else if(n.isDefined(u)&&u.profileAvailability)return u&&u.profileAvailability&&u.profileAvailability.id;return!1}}function ot(t,i){return function(r){var u=w(v.sample.dnaTests,t.id);if(n.isDefined(r))u.profileUploadedToCodis=i;else if(n.isDefined(u)&&u&&u.profileUploadedToCodis)return u.profileUploadedToCodis.id;return!1}}function st(n){return at(n)?f.save(u.hrefAddDnaNoKnownInformationIndicator,u.dnaNoKnownInformationIndicator,p.noKnownInformation,n.noKnownInformation,p.noKnownInformation?p.comment:"",n.noKnownInformationComment).then(function(n){return u.dnaNoKnownInformationIndicator=n.data,v}):r.when(n)}function ht(n){k()||delete n.verified}function ct(n){var t=e.hrefUpdate||u.hrefAddDnaSample,f=e.hrefUpdate?i.put:i.post;return _.remove(n.sample.dnaTests,function(n){return!n.selected}),_.forEach(n.sample.dnaTests,function(n){n.selected&&delete n.selected}),ht(n.sample),n.noKnownInformation||lt(e,n.sample)?r.when(n):f(t,n.sample).then(function(t){_.remove(u.dnaSamples,{identityId:t.data.identityId});var i=_.findIndex(u.dnaSamples,function(n){return l(n)>l(t.data)||l(n)===l(t.data)&&n.identityId>t.data.identityId});return u.dnaSamples.splice(i===-1?u.dnaSamples.length:i,0,t.data),n})}function lt(t,i){var r=["comment","referenceNumber"];(n.equals(t.dnaRelationship,i.dnaRelationship)||i.dnaRelationship&&i.dnaRelationship.name==="Missing individual"||i.dnaRelationship.name==="Other")&&r.push("dnaRelationshipOther");(n.equals(t.dnaLabLocation,i.dnaLabLocation)||i.dnaLabLocation&&i.dnaLabLocation.name==="Other")&&r.push("dnaLabLocationOther");var u=_.every(["dnaLabLocation","dnaRelationship","dnaSampleStatus","dnaTests","dnaTestingNotPerformed"],function(r){return n.equals(t[r],i[r])}),f=_.every(r,function(n){return namus.textEquals(t[n],i[n])}),e=_.every(["profilesUploadedToCodis","verified"],function(n){return namus.boolEquals(t[n],i[n])});return u&&f&e}function at(n){var t=!1,i=p.noKnownInformation||!1;return(i!==n.noKnownInformation||p.noKnownInformation&&!namus.textEquals(p.comment,n.noKnownInformationComment))&&(t=!0),t}var nt=!_.some(a(u.dnaSamples)),p=u.dnaNoKnownInformationIndicator||{},v={edit:!!e.hrefUpdate,noInformationEntered:nt,noKnownInformation:p.noKnownInformation,sample:n.copy(e),sampleOriginal:n.copy(e),dnaLabLocations:[],dnaRelationships:[],dnaSampleStatuses:[],dnaTechnologies:[],dnaProfileAvailabilities:[],getterSetter:ft,profileGetterSetter:et,profileUploadedGetterSetter:ot,showProfileAvailability:d,showProfileUploadedToCodis:g,showProfileAvailabilityWarning:rt,showProfileUploadedToCodisWarning:ut,showVerified:k,disableContent:tt,anyTestsSelected:function(){return _.some(v.sample.dnaTests,"selected",!0)},errors:{relationship:{},sampleStatus:{}},clearError:y},b={DnaRelationship:v.errors.relationship,DnaSampleStatus:v.errors.sampleStatus};p.noKnownInformation&&p.comment&&(v.noKnownInformationComment=p.comment);o.show({onLoad:function(n){return r.all([i.get(h.dnaLabLocations).then(function(i){t.apply(n.dnaLabLocations,i.data)}),i.get(h.dnaRelationships).then(function(i){t.apply(n.dnaRelationships,i.data)}),i.get(h.dnaSampleStatuses).then(function(i){t.apply(n.dnaSampleStatuses,i.data)}),i.get(h.dnaTechnologies).then(function(i){t.apply(n.dnaTechnologies,i.data)}),i.get(h.dnaProfileAvailabilities).then(function(i){t.apply(n.dnaProfileAvailabilities,i.data)})])},templateUrl:c.dnaModal.toString(),data:v,onResult:function(n){return o.clearServerValidationErrors(b),st(n).then(ct).catch(function(n){o.setServerValidationErrors(n,b);throw n;})}})}function y(n){n.$error=null}function l(n){var t=n.dnaSampleStatus||{};return t.ordinal||0}var a=u("notDeleted");return{openDnaModal:v}}var t=Array.prototype.push;n.module("app").service("DnaModalService",["$http","$q","$filter","commonNoKnownInformationService","CaseService","namusModal","appConstants","hrefs","templateUrls","localized",i])}(angular),function(n){"use strict";function t(n,t){var i=this;n("commonCaseFingerprints",{subSection:i,scope:t})}n.module("app").controller("Fingerprints",["$controller","$scope",t])}(angular),function(n){"use strict";function t(n,t,i,r,u){function e(){return i.get()}function s(){return u.getIsPrintMode()}function h(){return f.noChartingEntered()&&f.noInformationEntered()&&f.noDentistEntered()}function c(){var n=o(),t=n.first||n.last||n.street1||n.street2||n.city||n.state||n.zipCode||n.phone||n.email;return!t}function o(){return e().dentist||{}}function l(){var n=o();return append(n.street1,"\n",n.street2,"\n",n.city,", ",n.state," ",n.zipCode)}function a(){r.openEditModal(e())}function v(){r.openEditModal(e(),!0)}var f=this;n("commonCaseDental",{subSection:f,scope:t});f.edit=a;f.add=v;f.noDentalEntered=h;f.noDentistEntered=c;f.dentist=o;f.dentistAddress=l;f.isPrintMode=s}n.module("app").controller("Dental",["$controller","$scope","CaseService","MissingPersonsDentalModalService","OptionService",t])}(angular),function(){"use strict";function n(n){return{mapNcicToNamUs:n.mapNcicToNamUs}}angular.module("app").factory("dentalCodeMappingService",["commonDentalCodeMappingService",n])}(_),function(){"use strict";function n(n){function i(t){var r=n.validateNcic(t),i=[];return u(t)||i.push("TheOnlyCharacterCombinedWithSlash"),n.doesNotProceed(t,"R","MODFLC/")||i.push("TheRCharacterShouldFollowMODFLCSlash"),r.concat(i)}function r(t){var r=n.validateNamUs(t),i=[];return n.mayOnlyContainCharacters(t,"NFCBRAIO")||i.push("NamUsCodeMayOnlyContainNFCBRAIO"),f(t)||i.push("TheCharacterNCanOnlyBeCombinedWithIOrO"),e(t)||i.push("TheCharacterACanOnlyBeCombinedWithO"),r.concat(i)}function u(n){var t=!0;return n&&(t=n.indexOf("/")===-1||n==="/"||n==="/R"),t}function f(n){var i=!0;return n&&(i=n.indexOf("N")===-1||t(n,"NIO")),i}function e(n){var i=!0;return n&&(i=n.indexOf("A")===-1||t(n,"AO")),i}function t(n,t){for(var r=!0,i=0,i=0;i<n.length;++i)if(t.indexOf(n[i])===-1){r=!1;break}return r}return{validateNcic:i,validateNamUs:r}}angular.module("app").factory("dentalCodeValidationService",["commonDentalCodeValidationService",n])}(_),function(n){"use strict";function t(t,i,r,u,f,e,o){function s(s,h){function w(n){return n&&(n.first||n.last||n.street1||n.street2||n.city||n.state||n.zipCode||n.phone||n.email)}function l(n,t){return t&&_.forEach(n,function(i,r){n[r]!==""&&n[r]!==null||t[r]||delete n[r]}),_.omit(n,["id","hrefUpdate"])}function a(r,f){var e=s.hrefAddDentist,o,h,a;return!f||(e+="?validateOnly=true"),o=l(r.dentist,s.dentist),h=l(s.dentist),n.equals(o,h)?i.when({}):(a=r.dentist.hrefUpdate?t.put(e,r.dentist):r.dentist.id?t.put(e,r.dentist):t.post(e,r.dentist),a.then(function(n){s.dentist=n.data}).catch(function(n){u.setServerValidationErrors(n,c.fieldErrorMap);r.hasErrors=!0;throw n;}))}var c=r.prepareEditModal(s,h,e,o),v=c.onLoad,y=c.data.dentalAvailable,p=c.onResult;c.onLoad=function(n){return i.all([t.get(f.states).then(function(t){n.states=t.data}),v(n)])};c.data.dentist=n.copy(s.dentist);c.data.states=[];c.data.dentalAvailable=y||w(s.dentist);c.onResult=function(n){return a(n,!0).then(function(){return p(n)}).then(function(){return a(n,!1)}).catch(function(t){u.setServerValidationErrors(t,c.fieldErrorMap);n.hasErrors=!0;throw t;})};u.show(c)}return{openEditModal:s}}n.module("app").service("MissingPersonsDentalModalService",["$http","$q","CommonCaseDentalModalService","namusModal","hrefs","dentalCodeMappingService","dentalCodeValidationService",t])}(angular),function(n){"use strict";function t(n,t,i,r,u,f){function s(){return n.hasPublicViewPermission()}function o(){return n.get()}function l(){var n=o();return!f.getIsPrintMode()&&_.has(n,"hrefAddElectronicDevice")}function h(){return o().electronicDevices||[]}function a(){return!_.some(c(h()))}function v(){r.openDialog({},o())}function y(n){r.openDialog(n,o())}function p(n){i.openConfirmItemDeletionDialog(n,n.electronicDevice.name.toLowerCase())}var e=this,c=t("notDeleted");e.hide=s;e.canEdit=l;e.devices=h;e.hasNoDevices=a;e.addDevice=v;e.editDevice=y;e.deleteDevice=p;u.register("PersonalElectronics",{hide:s})}n.module("app").controller("PersonalElectronics",["CaseService","$filter","commonModalService","PersonalElectronicsModalSerice","NavigationService","OptionService",t])}(angular),function(n){"use strict";function t(t,r,u,f,e,o,s){function c(c,a){function p(n){var i=null,t=1200;v.disabled=v.device&&v.device.description&&v.device.description.length>t;v.disabled&&(i={serverValidation:!0,message:_.replace(_.replace(o.common.descriptionLengthExceeds,"{0}",t),"{1}",this.device.description.length-t)});n.$error=i}var v={edit:!!c.hrefUpdate,device:n.copy(c),electronicDevices:[],errors:{electronicDevice:{},description:{}},clearError:i,descriptionChanged:p},y={ElectronicDevice:v.errors.electronicDevice,Description:v.errors.description};u.show({small:!0,onLoad:function(n){return t.get(f.electronicDevices).then(function(t){n.electronicDevices=t.data})},templateUrl:e.personalElectronicsModal.toString(),data:v,onResult:function(i){var f=v.edit?c.hrefUpdate:a.hrefAddElectronicDevice,e=v.edit?t.put:t.post,o=v.edit?l:h;return u.clearServerValidationErrors(y),s.removePropertiesBeforeEqualityCheck(i,"device.electronicDevice",c,"electronicDevice",["ordinal"]),n.equals(c,i.device)?r.when({}):e(f,i.device).then(function(n){o(a,n.data)}).catch(function(n){u.setServerValidationErrors(n,y);throw n;})}})}function l(n,t){_.remove(n.electronicDevices,{identityId:t.identityId});h(n,t)}function h(n,t){var i=_.findIndex(n.electronicDevices,function(n){var i=t.electronicDevice.ordinal,r=n.electronicDevice.ordinal,u=t.identityId,f=n.identityId;return i<r||i===r&&u<f});i===-1&&(i=n.electronicDevices.length);n.electronicDevices.splice(i,0,t)}return{openDialog:c}}function i(n){n.$error=null}n.module("app").service("PersonalElectronicsModalSerice",["$http","$q","namusModal","hrefs","templateUrls","localized","commonService",t])}(angular),function(n){"use strict";function t(n,t,i,r,u,f){function a(){return n.hasPublicViewPermission()}function o(){return n.get()}function c(){var n=o();return!f.getIsPrintMode()&&_.has(n,"hrefAddVehicle")}function s(){return o().vehicles||[]}function v(){return!_.some(s(),h)}function y(n){return append(n.vehicleYear," ",n.vehicleMake," ",n.vehicleModel)}function p(){o().vehicles||(o().vehicles=[]);u.openEditDialog({},o().hrefAddVehicle,s())}function w(n){u.openEditDialog(n)}function b(n){i.openConfirmItemDeletionDialog(n,"vehicle")}function k(){return c()||l().length>0}function l(){return _.filter(o().notes,{noteType:r.noteType.transportation})}function d(){i.openAddNoteDialog("Transportation",!0,o().notes,o().hrefAddNote)}function g(n){i.openEditNoteDialog("Transportation",!0,o().notes,n)}function nt(n){i.openConfirmItemDeletionDialog(n,"transportation note")}function tt(){return!_.some(e.transportationNotes(),h)}var e=this,h=t("notDeleted");e.canEdit=c;e.vehicles=s;e.hasNoVehicles=v;e.getYearMakeModel=y;e.addVehicle=p;e.editVehicle=w;e.deleteVehicle=b;e.hideVin=a;e.canViewNotes=k;e.notes=l;e.hasNoNotes=tt;e.addNote=d;e.editNote=g;e.deleteNote=nt}n.module("app").controller("Transportation",["CaseService","$filter","commonModalService","appConstants","TransportationModalService","OptionService",t])}(angular),function(n){"use strict";function t(t,i,r,u,f){function e(e,o,s){function l(n,t){return namus.textEquals(n.vehicleIdentificationNumber,t.vehicleIdentificationNumber)&&namus.textEquals(n.tagNumber,t.tagNumber)&&namus.textEquals(n.comment,t.comment)&&_.every(["tagExpirationYear","tagState","vehicleColor","vehicleMake","vehicleModel","vehicleStyle","vehicleYear"],function(i){return n[i]===t[i]})}var h={edit:e.hrefUpdate,vehicle:n.copy(e),errors:{vehicleYear:{},tagExpirationYear:{}},loadModels:function(n,i){i||(n.vehicle.vehicleModel=null);var u=n.vehicle.vehicleMake,r=_.find(n.makes,function(n){return n.make===u});r&&r.hrefGetModels&&t.get(r.hrefGetModels).then(function(t){n.models=t.data})}},c={VehicleYear:h.errors.vehicleYear,TagExpirationYear:h.errors.tagExpirationYear};r.show({onLoad:function(n){return i.all([t.get(u.vehicleMakes).then(function(t){n.makes=t.data;n.loadModels(n,!0)}),t.get(u.vehicleStyles).then(function(t){n.styles=t.data}),t.get(u.vehicleColors).then(function(t){n.colors=t.data}),t.get(u.states).then(function(t){n.states=t.data})])},templateUrl:f.transportationModal.toString(),data:h,onResult:function(u){var f,h;return r.clearServerValidationErrors(c),l(e,u.vehicle)?f=i.when():(h=e.hrefUpdate?t.put(e.hrefUpdate,u.vehicle):t.post(o,u.vehicle),f=h.then(function(t){n.copy(t.data,e);s&&s.push(e)},function(n){r.setServerValidationErrors(n,c);throw n;})),f}})}return{openEditDialog:e}}n.module("app").service("TransportationModalService",["$http","$q","namusModal","hrefs","templateUrls",t])}(angular),function(n){"use strict";function t(n){var t=this;n("CommonCaseInvestigatingAgencies",{subSection:t})}n.module("app").controller("InvestigatingAgencies",["$controller","$scope",t])}(angular),function(n){"use strict";function t(n,t,i,r,u,f,e,o){function c(){var n=h();return!_.has(n,"hrefViewFamilyContact")}function h(){return n.get()}function v(){var n=h();return!o.getIsPrintMode()&&!c()&&_.has(n,"hrefAddFamilyContact")}function y(){return o.getIsPrintMode()}function l(){return h().familyContacts||[]}function p(){return!_.some(a(l()))}function w(){r.openEditModal({},l(),h().hrefAddFamilyContact)}function b(n){r.openEditModal(n)}function k(n){i.openConfirmItemDeletionDialog(n,"family contact")}function d(n){if(!n)return null;var t="";return!n.familyRelationship||(t=n.familyRelationship.localizedName),append(n.first," ",n.last,", ",t,", ",n.description)}function g(n){return append(n.street1,"\n",n.street2,"\n",n.city,", ",n.state," ",n.zipCode)}function nt(){return _.filter(h().notes,{noteType:f.noteType.familyContacts})}function tt(){i.openAddNoteDialog(f.noteType.familyContacts,!1,h().notes,h().hrefAddNote)}function it(n){i.openEditNoteDialog(f.noteType.familyContacts,!1,h().notes,n)}function rt(n){i.openConfirmItemDeletionDialog(n,"family contact note")}var s=this,a=t("notDeleted");s.hide=c;s.canEdit=v;s.contacts=l;s.noInformationEntered=p;s.addContact=w;s.editContact=b;s.deleteContact=k;s.fullName=d;s.formatAddress=g;s.isPrintMode=y;e.register("FamilyContacts",{hide:c});s.notes=nt;s.addNote=tt;s.editNote=it;s.deleteNote=rt}n.module("app").controller("FamilyContacts",["CaseService","$filter","commonModalService","FamilyContactsModalService","identity","appConstants","NavigationService","OptionService",t])}(angular),function(n){"use strict";function t(t,i,r,u,f){function e(e,o,s){function l(n){n.$error=null}var h={edit:e.hrefUpdate,familyContact:n.copy(e)||{},states:[],familyRelationships:[],errors:{address1:{},address2:{},city:{},description:{},email:{},familyRelationship:{},firstName:{},lastName:{},phoneNumber:{},state:{},zipCode:{}},clearError:l},c={Address1:h.errors.address1,Address2:h.errors.address2,City:h.errors.city,Description:h.errors.description,Email:h.errors.email,FamilyRelationship:h.errors.familyRelationship,First:h.errors.firstName,Last:h.errors.lastName,Phone:h.errors.phoneNumber,State:h.errors.state,ZipCode:h.errors.zipCode};r.show({onLoad:function(n){return i.all([t.get(u.states).then(function(t){n.states=t.data}),t.get(u.familyRelationships).then(function(t){n.familyRelationships=t.data})])},templateUrl:f.familyContactsModal.toString(),data:h,onResult:function(u){if(r.clearServerValidationErrors(c),n.equals(u.familyContact,e))return i.when({});var f;return f=u.familyContact.hrefUpdate?t.put(u.familyContact.hrefUpdate,u.familyContact):t.post(s,u.familyContact),f.then(function(t){n.copy(t.data,e);o&&o.push(e)},function(n){r.setServerValidationErrors(n,c);throw n;})}})}return{openEditModal:e}}n.module("app").service("FamilyContactsModalService",["$http","$q","namusModal","hrefs","templateUrls",t])}(angular),function(n){"use strict";function t(n,t,i,r){function f(){return n.get()}function e(){var n=f();return _.has(n.enteringParty,"hrefUpdate")}function o(){var n=f();t.openEditModal(n.enteringParty)}var u=this;u.canEditEnteringParty=e;u.editEnteringParty=o;r("CommonCaseEnteringParty",{subSection:u,$scope:i})}n.module("app").controller("EnteringParty",["CaseService","EnteringPartyModalService","$scope","$controller",t])}(angular),function(n){"use strict";function t(t,i,r,u,f,e){function o(o){var s={canEditEnteringPartyRestricted:!1,enteringParty:n.copy(o),relationships:[]};u.show({onLoad:function(n){return r.all([t.get(i.relationships).then(function(t){n.relationships=t.data}),e.getCurrentUserOrWait().then(function(t){n.canEditEnteringPartyRestricted=e.isCurrentUserAdministrator(t)})])},templateUrl:f.enteringPartyEditModal.toString(),data:s,onResult:function(i){if(n.equals(o,i.enteringParty))return r.when({});var u=i.enteringParty;return t.put(i.enteringParty.hrefUpdate,u).then(function(n){o.id=n.data.id;o.relationship=n.data.relationship;o.restricted=n.data.restricted}).catch(function(n){throw n;})}})}return{openEditModal:o}}n.module("app").service("EnteringPartyModalService",["$http","hrefs","$q","namusModal","templateUrls","identity",t])}(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),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.openMissingPersonsModal(n.copy(r.caseResolutionDetails))}return{openModal:r}}n.module("app").service("CaseResolutionModalService",["CaseService","CommonCaseResolutionModalService",t])}(angular)