diff --git a/404.html b/404.html index 099cb5c..94456ea 100644 --- a/404.html +++ b/404.html @@ -17,6 +17,6 @@ - + \ No newline at end of file diff --git a/9-es2015.9ed15443d3235cfe451e.js b/9-es2015.633aeacda97fdc73c96d.js similarity index 65% rename from 9-es2015.9ed15443d3235cfe451e.js rename to 9-es2015.633aeacda97fdc73c96d.js index a50f45b..28b1654 100644 --- a/9-es2015.9ed15443d3235cfe451e.js +++ b/9-es2015.633aeacda97fdc73c96d.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{"+UUc":function(t,e,n){"use strict";var i=n("k/06");e.isInteropObservable=function(t){return t&&"function"==typeof t[i.observable]}},"/UiO":function(t,e,n){"use strict";var i=n("qiMw"),r=n("6Br6"),s=n("k/06");e.scheduleObservable=function(t,e){return new i.Observable((function(n){var i=new r.Subscription;return i.add(e.schedule((function(){var r=t[s.observable]();i.add(r.subscribe({next:function(t){i.add(e.schedule((function(){return n.next(t)})))},error:function(t){i.add(e.schedule((function(){return n.error(t)})))},complete:function(){i.add(e.schedule((function(){return n.complete()})))}}))}))),i}))}},"1hPV":function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=n("v2vP"),s=n("uzuk"),o=n("6Br6"),a=n("7oWP"),c=n("QuXn"),u=n("tpAt"),l=function(t){function e(n,i,r){var o=t.call(this)||this;switch(o.syncErrorValue=null,o.syncErrorThrown=!1,o.syncErrorThrowable=!1,o.isStopped=!1,arguments.length){case 0:o.destination=s.empty;break;case 1:if(!n){o.destination=s.empty;break}if("object"==typeof n){n instanceof e?(o.syncErrorThrowable=n.syncErrorThrowable,o.destination=n,n.add(o)):(o.syncErrorThrowable=!0,o.destination=new h(o,n));break}default:o.syncErrorThrowable=!0,o.destination=new h(o,n,i,r)}return o}return i(e,t),e.prototype[a.rxSubscriber]=function(){return this},e.create=function(t,n,i){var r=new e(t,n,i);return r.syncErrorThrowable=!1,r},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(o.Subscription);e.Subscriber=l;var h=function(t){function e(e,n,i,o){var a,c=t.call(this)||this;c._parentSubscriber=e;var u=c;return r.isFunction(n)?a=n:n&&(a=n.next,i=n.error,o=n.complete,n!==s.empty&&(u=Object.create(n),r.isFunction(u.unsubscribe)&&c.add(u.unsubscribe.bind(u)),u.unsubscribe=c.unsubscribe.bind(c))),c._context=u,c._next=a,c._error=i,c._complete=o,c}return i(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;c.config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,n=c.config.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):u.hostReportError(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;u.hostReportError(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};c.config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(n){if(this.unsubscribe(),c.config.useDeprecatedSynchronousErrorHandling)throw n;u.hostReportError(n)}},e.prototype.__tryOrSetError=function(t,e,n){if(!c.config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(i){return c.config.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=i,t.syncErrorThrown=!0,!0):(u.hostReportError(i),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(l);e.SafeSubscriber=h},"4mxr":function(t,e,n){"use strict";var i=n("/UiO"),r=n("i84P"),s=n("uHtI"),o=n("i6J5"),a=n("+UUc"),c=n("xKJD"),u=n("VTS6"),l=n("vfqg");e.scheduled=function(t,e){if(null!=t){if(a.isInteropObservable(t))return i.scheduleObservable(t,e);if(c.isPromise(t))return r.schedulePromise(t,e);if(u.isArrayLike(t))return s.scheduleArray(t,e);if(l.isIterable(t)||"string"==typeof t)return o.scheduleIterable(t,e)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}},"6Br6":function(t,e,n){"use strict";var i=n("D9en"),r=n("a96P"),s=n("v2vP"),o=n("ZGdk");function a(t){return t.reduce((function(t,e){return t.concat(e instanceof o.UnsubscriptionError?e.errors:e)}),[])}e.Subscription=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this._parentOrParents,c=this._unsubscribe,u=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof t)n.remove(this);else if(null!==n)for(var l=0;l{if(-1==(t-=1))return{display:"None",value:-1};let e=t%2==0;return{display:`row: ${Math.round((t+1)/2)}, ${e?"right":"left"}`,value:t}})}]},{heading:"Points",questions:[{id:"points_issues_present",type:"select-checkbox",label:"Are there any issues with the occurrences?",options:[{display:"Missing critical known subpopulation",value:"missing_subpopulation"},{display:"Possible outliers",value:"outliers"},{display:"Possible Cleaning failure",value:"cleaning_outliers_failure"},{display:"Severe sampling bias",value:"sampling_bias"}]},{id:"points_comments",type:"input",label:"General points comments?",placeholder:"..."}]},{heading:"Range",questions:[{id:"range_issues_present",type:"select-checkbox",label:"Are there any issues with the range?",options:[{display:"Range map imprecise",value:"range_map_imprecise"},{display:"Range map too broad",value:"range_map_too_broad"},{display:"Range map missing subpopulation",value:"range_map_missing_subpopulation"}]},{id:"range_comments",type:"input",label:"General rangemap comments?",placeholder:"..."}]},{heading:"Taxonomy feedback",questions:[{id:"taxonomy_comments",type:"input",label:"Are there any taxonomic issues with any part of this species?",placeholder:"..."}]}],a=["prediction_overall_rating"],c=[{title:"Prediction: False presence",name:"fb_false_presence",description:""},{title:"Prediction: False absence",name:"fb_false_absence",description:""},{title:"Prediction: Potential prediction artifacts",name:"fb_pred_artifacts",description:""},{title:"Prediction: Prefer an alternate threshold",name:"fb_alt_threshold",description:""},{title:"Prediction: Does not match expert range",name:"fb_range_not_matched",description:""},{title:"Range: Incorrect range/name misalignment",name:"fb_alignment_issue",description:""},{title:"Occurrence: Filtering issue",name:"fb_points_issue",description:""},{title:"Other: Species is not native to the range",name:"fb_nonnative",description:""},{title:"Other: Taxonomic issue",name:"fb_tax_issue",description:""},{title:"Other: Fatal technical issue",name:"fb_tech_issue",description:""},{title:"Other",name:"fb_other",description:""}];var u=n("OZ4H"),l=n("EM62");function h(t,e){if(1&t&&(l.Vb(0,"td"),l.Hc(1),l.ic(2,"number"),l.Ub()),2&t){const t=l.hc().$implicit;l.Cb(1),l.Ic(l.jc(2,1,t.value))}}function f(t,e){if(1&t&&(l.Vb(0,"td"),l.Hc(1),l.Ub()),2&t){const t=l.hc().$implicit;l.Cb(1),l.Jc(" ",t.value," ")}}function d(t,e){if(1&t&&(l.Vb(0,"li"),l.Hc(1),l.Ub()),2&t){const t=e.$implicit;l.Cb(1),l.Ic(t)}}function p(t,e){if(1&t&&(l.Vb(0,"td"),l.Vb(1,"ul"),l.Fc(2,d,2,1,"li",1),l.Ub(),l.Ub()),2&t){const t=l.hc().$implicit;l.Cb(2),l.mc("ngForOf",t.value)}}function b(t,e){if(1&t&&(l.Vb(0,"tr"),l.Vb(1,"th"),l.Hc(2),l.Ub(),l.Fc(3,h,3,3,"td",0),l.Fc(4,f,2,1,"td",0),l.Fc(5,p,3,1,"td",0),l.Ub()),2&t){const t=e.$implicit;l.Cb(2),l.Ic(t.name),l.Cb(1),l.mc("ngIf","number"===t.type),l.Cb(1),l.mc("ngIf",!t.type),l.Cb(1),l.mc("ngIf","list"===t.type)}}function m(t,e){if(1&t&&(l.Vb(0,"div"),l.Vb(1,"h4"),l.Hc(2,"Model Metadata"),l.Ub(),l.Vb(3,"table"),l.Fc(4,b,6,4,"tr",1),l.Ub(),l.Ub()),2&t){const t=l.hc();l.Cb(4),l.mc("ngForOf",t.modelInfo)}}let g=(()=>{class t{constructor(t){this.data=t,this.info=t.info,this.setMetadata()}ngOnInit(){}ngOnChanges(t){t.info&&this.setMetadata()}setMetadata(){this.modelInfo=[{name:"Taxa",value:this.info.taxa},{name:"Scientific Name",value:this.info.scientificname.replaceAll("_"," ")},{name:"Season",value:this.info.season||"N/A"},{name:"Landcover",value:this.info.landcover||"N/A"},{name:"Prediction Name",value:this.info.prediction_name},{name:"Prediction Rank",value:this.info.prediction_rank},{name:"AUC",value:this.info.AUC,type:"number"},{name:"Boyce",value:this.info.Boyce},{name:"Elevation Offset",value:this.info.elevOffset},{name:"Range Offset",value:this.info.rangeOffset},{name:"Range Area",value:this.info.range_area,type:"number"},{name:"Number of Points",value:this.info.noPts},{name:"Sensitivity",value:this.info.Sensitivity},{name:"Specificity",value:this.info.Specificity},{name:"Model Version",value:this.info.version},{name:"SPS Threshold",value:this.info.SPSthreshold},{name:"TSS",value:this.info.TSS},{name:"Environmental Variables",value:this.info.envVars.split("|"),type:"list"}]}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(u.a))},t.\u0275cmp=l.Jb({type:t,selectors:[["mol-metadata"]],features:[l.Ab],decls:1,vars:1,consts:[[4,"ngIf"],[4,"ngFor","ngForOf"]],template:function(t,e){1&t&&l.Fc(0,m,5,1,"div",0),2&t&&l.mc("ngIf",e.info)},directives:[i.t,i.s],pipes:[i.g],styles:["table[_ngcontent-%COMP%]{border:1px solid #000;width:100%;border-collapse:collapse}table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{font-weight:700;width:40%;text-align:left;padding-left:4px}table[_ngcontent-%COMP%] td[_ngcontent-%COMP%], table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{border:1px solid #afafaf;padding-top:6px;padding-bottom:6px;font-size:14pt}table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{-moz-column-span:2;column-span:2;width:60%;text-align:center;word-wrap:break-word;word-break:break-all;text-align:left;padding-left:6px}h4[_ngcontent-%COMP%]{text-align:center;font-weight:700;font-size:20pt}"]}),t})();var _,v,y=n("nIj0"),w=function(t,e){return te?1:t>=e?0:NaN};1===(_=w).length&&(v=_,_=function(t,e){return w(v(t),e)}),Math.sqrt(50),Math.sqrt(10),Math.sqrt(2);var x={value:function(){}};function C(){for(var t,e=0,n=arguments.length,i={};e=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function O(t,e){for(var n,i=0,r=t.length;i0)for(var n,i,r=new Array(n),s=0;se?1:t>=e?0:NaN}I.prototype={constructor:I,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var R="http://www.w3.org/1999/xhtml",L={svg:"http://www.w3.org/2000/svg",xhtml:R,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},H=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),L.hasOwnProperty(e)?{space:L[e],local:t}:t};function B(t){return function(){this.removeAttribute(t)}}function z(t){return function(){this.removeAttributeNS(t.space,t.local)}}function q(t,e){return function(){this.setAttribute(t,e)}}function Y(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function $(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function J(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}var W=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function X(t){return function(){this.style.removeProperty(t)}}function Q(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Z(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function G(t,e){return t.style.getPropertyValue(e)||W(t).getComputedStyle(t,null).getPropertyValue(e)}function K(t){return function(){delete this[t]}}function tt(t,e){return function(){this[t]=e}}function et(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function nt(t){return t.trim().split(/^|\s+/)}function it(t){return t.classList||new rt(t)}function rt(t){this._node=t,this._names=nt(t.getAttribute("class")||"")}function st(t,e){for(var n=it(t),i=-1,r=e.length;++i=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var yt=function(t){var e=H(t);return(e.local?vt:_t)(e)};function wt(){return null}function xt(){var t=this.parentNode;t&&t.removeChild(this)}function Ct(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function kt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}var St={},Ot=null;function Mt(t,e,n){return t=Pt(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function Pt(t,e,n){return function(i){var r=Ot;Ot=i;try{t.call(this,this.__data__,e,n)}finally{Ot=r}}}function Ft(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function Tt(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,s=e.length;i=w&&(w=y+1);!(v=g[w])&&++w=0;)(i=r[s])&&(o&&4^i.compareDocumentPosition(o)&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=N);for(var n=this._groups,i=n.length,r=new Array(i),s=0;s1?this.each((null==e?X:"function"==typeof e?Z:Q)(t,e,null==n?"":n)):G(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?K:"function"==typeof e?et:tt)(t,e)):this.node()[t]},classed:function(t,e){var n=nt(t+"");if(arguments.length<2){for(var i=it(this.node()),r=-1,s=n.length;++rs&&(r=e.slice(s,r),a[o]?a[o]+=r:a[++o]=r),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,c.push({i:o,x:zt(n,i)})),s=Yt.lastIndex;return s=0&&e._call.call(null,t),e=e._next;--Jt}()}finally{Jt=0,function(){for(var t,e,n=Nt,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Nt=e);Rt=t,ae(i)}(),Zt=0}}function oe(){var t=Kt.now(),e=t-Qt;e>1e3&&(Gt-=e,Qt=t)}function ae(t){Jt||(Wt&&(Wt=clearTimeout(Wt)),t-Zt>24?(t<1/0&&(Wt=setTimeout(se,t-Kt.now()-Gt)),Xt&&(Xt=clearInterval(Xt))):(Xt||(Qt=Kt.now(),Xt=setInterval(oe,1e3)),Jt=1,te(se)))}ie.prototype=re.prototype={constructor:ie,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?ee():+n)+(null==e?0:+e),this._next||Rt===this||(Rt?Rt._next=this:Nt=this,Rt=this),this._call=t,this._time=n,ae()},stop:function(){this._call&&(this._call=null,this._time=1/0,ae())}};var ce=function(t,e,n){var i=new ie;return i.restart((function(n){i.stop(),t(n+e)}),e=null==e?0:+e,n),i},ue=P("start","end","cancel","interrupt"),le=[],he=function(t,e,n,i,r,s){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var i,r=t.__transition;function s(c){var u,l,h,f;if(1!==n.state)return a();for(u in r)if((f=r[u]).name===n.name){if(3===f.state)return ce(s);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete r[u]):+u0)throw new Error("too late; already scheduled");return n}function de(t,e){var n=pe(t,e);if(n.state>3)throw new Error("too late; already running");return n}function pe(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var be,me,ge,_e,ve=180/Math.PI,ye={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},we=function(t,e,n,i,r,s){var o,a,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*n+e*i)&&(n-=t*c,i-=e*c),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,c/=a),t*i180?e+=360:e-t>180&&(t+=360),s.push({i:n.push(r(n)+"rotate(",null,i)-2,x:zt(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(s.rotate,o.rotate,a,c),function(t,e,n,s){t!==e?s.push({i:n.push(r(n)+"skewX(",null,i)-2,x:zt(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(s.skewX,o.skewX,a,c),function(t,e,n,i,s,o){if(t!==n||e!==i){var a=s.push(r(s)+"scale(",null,",",null,")");o.push({i:a-4,x:zt(t,n)},{i:a-2,x:zt(e,i)})}else 1===n&&1===i||s.push(r(s)+"scale("+n+","+i+")")}(s.scaleX,s.scaleY,o.scaleX,o.scaleY,a,c),s=o=null,function(t){for(var e,n=-1,i=c.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?fe:de;return function(){var o=s(this,t),a=o.on;a!==i&&(r=(i=a).copy()).on(e,n),o.on=r}}var Ye=Lt.prototype.constructor;function $e(t){return function(){this.style.removeProperty(t)}}function Je(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function We(t,e,n){var i,r;function s(){var s=e.apply(this,arguments);return s!==r&&(i=(r=s)&&Je(t,s,n)),i}return s._value=e,s}function Xe(t){return function(e){this.textContent=t.call(this,e)}}function Qe(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&Xe(i)),e}return i._value=t,i}var Ze=0;function Ge(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Ke(){return++Ze}var tn=Lt.prototype;Ge.prototype=(function(t){return Lt().transition(t)}).prototype={constructor:Ge,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=T(t));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete s[r]):o=!1;o&&delete t.__transition}}(this,t)}))},Lt.prototype.transition=function(t){var e,n;t instanceof Ge?(e=t._id,t=t._name):(e=Ke(),(n=en).time=ee(),t=null==t?null:t+"");for(var i=this._groups,r=i.length,s=0;s1e-6)if(Math.abs(l*a-c*u)>1e-6&&r){var f=n-s,d=i-o,p=a*a+c*c,b=f*f+d*d,m=Math.sqrt(p),g=Math.sqrt(h),_=r*Math.tan((sn-Math.acos((p+h-b)/(2*m*g)))/2),v=_/g,y=_/m;Math.abs(v-1)>1e-6&&(this._+="L"+(t+v*u)+","+(e+v*l)),this._+="A"+r+","+r+",0,0,"+ +(l*f>u*d)+","+(this._x1=t+y*a)+","+(this._y1=e+y*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e)},arc:function(t,e,n,i,r,s){t=+t,e=+e,s=!!s;var o=(n=+n)*Math.cos(i),a=n*Math.sin(i),c=t+o,u=e+a,l=1^s,h=s?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+u:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-u)>1e-6)&&(this._+="L"+c+","+u),n&&(h<0&&(h=h%on+on),h>an?this._+="A"+n+","+n+",0,1,"+l+","+(t-o)+","+(e-a)+"A"+n+","+n+",0,1,"+l+","+(this._x1=c)+","+(this._y1=u):h>1e-6&&(this._+="A"+n+","+n+",0,"+ +(h>=sn)+","+l+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}},un.prototype=ln.prototype={constructor:un,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var fn=ln.prototype;function dn(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,s,o,a,c,u,l,h,f,d=t._root,p={data:i},b=t._x0,m=t._y0,g=t._x1,_=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((u=e>=(s=(b+g)/2))?b=s:g=s,(l=n>=(o=(m+_)/2))?m=o:_=o,r=d,!(d=d[h=l<<1|u]))return r[h]=p,t;if(a=+t._x.call(null,d.data),c=+t._y.call(null,d.data),e===a&&n===c)return p.next=d,r?r[h]=p:t._root=p,t;do{r=r?r[h]=new Array(4):t._root=new Array(4),(u=e>=(s=(b+g)/2))?b=s:g=s,(l=n>=(o=(m+_)/2))?m=o:_=o}while((h=l<<1|u)==(f=(c>=o)<<1|a>=s));return r[f]=d,r[h]=p,t}hn.prototype=(function(t,e){var n=new hn;if(t instanceof hn)t.each((function(t){n.add(t)}));else if(t){var i=-1,r=t.length;if(null==e)for(;++il&&(l=i),rh&&(h=r));if(c>l||u>h)return this;for(this.cover(c,u).cover(l,h),n=0;nt||t>=r||i>e||e>=s;)switch(a=(ef||(s=c.y0)>d||(o=c.x1)=g)<<1|t>=m)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=c)}else{var _=t-+this._x.call(null,b.data),v=e-+this._y.call(null,b.data),y=_*_+v*v;if(y=(a=(p+m)/2))?p=a:m=a,(l=o>=(c=(b+g)/2))?b=c:g=c,e=d,!(d=d[h=l<<1|u]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,f=h)}for(;d.data!==t;)if(i=d,!(d=d.next))return this;return(r=d.next)&&delete d.next,i?(r?i.next=r:delete i.next,this):e?(r?e[h]=r:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[f]=d:this._root=d),this):(this._root=r,this)},vn.removeAll=function(t){for(var e=0,n=t.length;e1);return t+n*s*Math.sqrt(-2*Math.log(r)/r)}}return n.source=t,n}(yn)),xn=(function t(e){function n(){var t=wn.source(e).apply(this,arguments);return function(){return Math.exp(t())}}return n.source=t,n}(yn),function t(e){function n(t){return function(){for(var n=0,i=0;i=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function kn(t){if(!(e=Cn.exec(t)))throw new Error("invalid format: "+t);var e;return new Sn({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Sn(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}kn.prototype=Sn.prototype,Sn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var On,Mn=Array.prototype.map;void 0===(On={decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}).grouping||void 0===On.thousands||Mn.call(On.grouping,Number),void 0===On.numerals||Mn.call(On.numerals,String);var Pn=new Date,Fn=new Date;function Tn(t,e,n,i){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=function(e){return t(e=new Date(+e)),e},r.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},r.round=function(t){var e=r(t),n=r.ceil(t);return t-e0))return a;do{a.push(o=new Date(+n)),e(n,s),t(n)}while(o=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,i){if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););}))},n&&(r.count=function(e,i){return Pn.setTime(+e),Fn.setTime(+i),t(Pn),t(Fn),Math.floor(n(Pn,Fn))},r.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?function(e){return i(e)%t==0}:function(e){return r.count(0,e)%t==0}):r:null}),r}var Un=Tn((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Un.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Tn((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var En=Un;function Dn(t){return Tn((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}Tn((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}));var jn=Dn(0),In=Dn(1),An=(Dn(2),Dn(3),Dn(4)),Vn=(Dn(5),Dn(6),Tn((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1}))),Nn=(Tn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),Tn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),Tn((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),Tn((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t})));function Rn(t){return Tn((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}Nn.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Tn((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Nn:null};var Ln=Rn(0),Hn=Rn(1),Bn=(Rn(2),Rn(3),Rn(4)),zn=(Rn(5),Rn(6),Tn((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}))),qn=Tn((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));qn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Tn((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Yn=qn;var $n={"-":"",_:" ",0:"0"},Jn=/[\\^$*+?|[\]().{}]/g;function Wn(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",s=r.length;return i+(s=4||0===e?An(t):An.ceil(t)}function li(t,e){return t=ui(t),Wn(An.count(En(t),t)+(4===En(t).getDay()),e,2)}function hi(t){return t.getDay()}function fi(t,e){return Wn(In.count(En(t)-1,t),e,2)}function di(t,e){return Wn(t.getFullYear()%100,e,2)}function pi(t,e){return Wn((t=ui(t)).getFullYear()%100,e,2)}function bi(t,e){return Wn(t.getFullYear()%1e4,e,4)}function mi(t,e){var n=t.getDay();return Wn((t=n>=4||0===n?An(t):An.ceil(t)).getFullYear()%1e4,e,4)}function gi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Wn(e/60|0,"0",2)+Wn(e%60,"0",2)}function _i(t,e){return Wn(t.getUTCDate(),e,2)}function vi(t,e){return Wn(t.getUTCHours(),e,2)}function yi(t,e){return Wn(t.getUTCHours()%12||12,e,2)}function wi(t,e){return Wn(1+zn.count(Yn(t),t),e,3)}function xi(t,e){return Wn(t.getUTCMilliseconds(),e,3)}function Ci(t,e){return xi(t,e)+"000"}function ki(t,e){return Wn(t.getUTCMonth()+1,e,2)}function Si(t,e){return Wn(t.getUTCMinutes(),e,2)}function Oi(t,e){return Wn(t.getUTCSeconds(),e,2)}function Mi(t){var e=t.getUTCDay();return 0===e?7:e}function Pi(t,e){return Wn(Ln.count(Yn(t)-1,t),e,2)}function Fi(t){var e=t.getUTCDay();return e>=4||0===e?Bn(t):Bn.ceil(t)}function Ti(t,e){return t=Fi(t),Wn(Bn.count(Yn(t),t)+(4===Yn(t).getUTCDay()),e,2)}function Ui(t){return t.getUTCDay()}function Ei(t,e){return Wn(Hn.count(Yn(t)-1,t),e,2)}function Di(t,e){return Wn(t.getUTCFullYear()%100,e,2)}function ji(t,e){return Wn((t=Fi(t)).getUTCFullYear()%100,e,2)}function Ii(t,e){return Wn(t.getUTCFullYear()%1e4,e,4)}function Ai(t,e){var n=t.getUTCDay();return Wn((t=n>=4||0===n?Bn(t):Bn.ceil(t)).getUTCFullYear()%1e4,e,4)}function Vi(){return"+0000"}function Ni(){return"%"}function Ri(t){return+t}function Li(t){return Math.floor(+t/1e3)}function Hi(){this._=null}function Bi(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function zi(t,e){var n=e,i=e.R,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.R=i.L,n.R&&(n.R.U=n),i.L=n}function qi(t,e){var n=e,i=e.L,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.L=i.R,n.L&&(n.L.U=n),i.R=n}function Yi(t){for(;t.L;)t=t.L;return t}(function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,s=t.days,o=t.shortDays,a=t.months,c=t.shortMonths,u=(Qn(r),Zn(r),Qn(s),Zn(s),Qn(o),Zn(o),Qn(a),Zn(a),Qn(c),Zn(c),{a:function(t){return o[t.getDay()]},A:function(t){return s[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:Gn,e:Gn,f:ii,g:pi,G:mi,H:Kn,I:ti,j:ei,L:ni,m:ri,M:si,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ri,s:Li,S:oi,u:ai,U:ci,V:li,w:hi,W:fi,x:null,X:null,y:di,Y:bi,Z:gi,"%":Ni}),l={a:function(t){return o[t.getUTCDay()]},A:function(t){return s[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:_i,e:_i,f:Ci,g:ji,G:Ai,H:vi,I:yi,j:wi,L:xi,m:ki,M:Si,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ri,s:Li,S:Oi,u:Mi,U:Pi,V:Ti,w:Ui,W:Ei,x:null,X:null,y:Di,Y:Ii,Z:Vi,"%":Ni};function h(t,e){return function(n){var i,r,s,o=[],a=-1,c=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++a0)){if(s/=f,f<0){if(s0){if(s>h)return;s>l&&(l=s)}if(s=i-c,f||!(s<0)){if(s/=f,f<0){if(s>h)return;s>l&&(l=s)}else if(f>0){if(s0)){if(s/=d,d<0){if(s0){if(s>h)return;s>l&&(l=s)}if(s=r-u,d||!(s<0)){if(s/=d,d<0){if(s>h)return;s>l&&(l=s)}else if(d>0){if(s0||h<1)||(l>0&&(t[0]=[c+l*f,u+l*d]),h<1&&(t[1]=[c+h*f,u+h*d]),!0)}}}}}function Zi(t,e,n,i,r){var s=t[1];if(s)return!0;var o,a,c=t[0],u=t.left,l=t.right,h=u[0],f=u[1],d=l[0],p=l[1],b=(h+d)/2;if(p===f){if(b=i)return;if(h>d){if(c){if(c[1]>=r)return}else c=[b,n];s=[b,r]}else{if(c){if(c[1]1)if(h>d){if(c){if(c[1]>=r)return}else c=[(n-a)/o,n];s=[(r-a)/o,r]}else{if(c){if(c[1]=i)return}else c=[e,o*e+a];s=[i,o*i+a]}else{if(c){if(c[0]=-vr)){var d=c*c+u*u,p=l*l+h*h,b=(h*d-u*p)/f,m=(c*p-l*d)/f,g=nr.pop()||new ir;g.arc=t,g.site=r,g.x=b+o,g.y=(g.cy=m+a)+Math.sqrt(b*b+m*m),t.circle=g;for(var _=null,v=mr._;v;)if(g.y_r)a=a.L;else{if(!((r=s-dr(a,o))>_r)){i>-_r?(e=a.P,n=a):r>-_r?(e=a,n=a.N):e=n=a;break}if(!a.R){e=a;break}a=a.R}!function(t){br[t.index]={site:t,halfedges:[]}}(t);var c=cr(t);if(pr.insert(e,c),e||n){if(e===n)return sr(e),n=cr(e.site),pr.insert(c,n),c.edge=n.edge=Ji(e.site,c.site),rr(e),void rr(n);if(n){sr(e),sr(n);var u=e.site,l=u[0],h=u[1],f=t[0]-l,d=t[1]-h,p=n.site,b=p[0]-l,m=p[1]-h,g=2*(f*m-d*b),_=f*f+d*d,v=b*b+m*m,y=[(m*_-d*v)/g+l,(f*v-b*_)/g+h];Xi(n.edge,u,p,y),c.edge=Ji(u,t,null,y),n.edge=Ji(t,p,null,y),rr(e),rr(n)}else c.edge=Ji(e.site,c.site)}}function fr(t,e){var n=t.site,i=n[0],r=n[1],s=r-e;if(!s)return i;var o=t.P;if(!o)return-1/0;var a=(n=o.site)[0],c=n[1],u=c-e;if(!u)return a;var l=a-i,h=1/s-1/u,f=l/u;return h?(-f+Math.sqrt(f*f-2*h*(l*l/(-2*u)-c+u/2+r-s/2)))/h+i:(i+a)/2}function dr(t,e){var n=t.N;if(n)return fr(n,e);var i=t.site;return i[1]===e?i[0]:1/0}var pr,br,mr,gr,_r=1e-6,vr=1e-12;function yr(t,e){return e[1]-t[1]||e[0]-t[0]}function wr(t,e){var n,i,r,s=t.sort(yr).pop();for(gr=[],br=new Array(t.length),pr=new $i,mr=new $i;;)if(r=er,s&&(!r||s[1]_r||Math.abs(r[0][1]-r[1][1])>_r)||delete gr[s]}(o,a,c,u),function(t,e,n,i){var r,s,o,a,c,u,l,h,f,d,p,b,m=br.length,g=!0;for(r=0;r_r||Math.abs(b-f)>_r)&&(c.splice(a,0,gr.push(Wi(o,d,Math.abs(p-t)<_r&&i-b>_r?[t,Math.abs(h-t)<_r?f:i]:Math.abs(b-i)<_r&&n-p>_r?[Math.abs(f-i)<_r?h:n,i]:Math.abs(p-n)<_r&&b-e>_r?[n,Math.abs(h-n)<_r?f:e]:Math.abs(b-e)<_r&&p-t>_r?[Math.abs(f-e)<_r?h:t,e]:null))-1),++u);u&&(g=!1)}if(g){var _,v,y,w=1/0;for(r=0,g=null;r=a)return null;var c=t-r.site[0],u=e-r.site[1],l=c*c+u*u;do{r=s.cells[i=o],o=null,r.halfedges.forEach((function(n){var i=s.edges[n],a=i.left;if(a!==r.site&&a||(a=i.right)){var c=t-a[0],u=e-a[1],h=c*c+u*u;h{class t{constructor(t,e,n,i){this.map=t,this.predictions=e,this.auth=n,this._snackBar=i,this.drawOn=!0,this.addDisabled=!1,this.nowDrawingIn=new l.o,this.setFeatures=new l.o,this.show=!0,this.features={type:"FeatureCollection",features:[]},this.feedbackLabels={false_presence:"False Presence",false_absence:"False Absence",note:"Note"},this.feedbackOptions=[{value:"false_presence",display:""},{value:"false_absence",display:""},{value:"note",display:""}],this.feedbackType="false_presence",this.newFeatureSubscription=null,this.noteField="",this.user="",this.feedbackOptions.forEach(t=>{t.display=this.feedbackLabels[t.value]}),this.auth.currentUser.subscribe(t=>{this.user="MOL_USER_"+t.id})}ngOnInit(){this.newFeatureSubscription=this.map.newUserFeature.subscribe(t=>{console.log("old features",this.features),t&&(t.properties={feedback_id:(this.features.features.length+1).toString(),issue:this.issue,selected:this.drawOn},this.addDisabled&&(this.features.features.push(Object.assign({},t)),this.predictions.setVisibleFeatures(this.issue,this.features),this.setFeatures.emit({issue:this.issue,features:this.features})))})}addFeature(){this.localFeatures=Object.assign({},this.features),this.localFeatures&&this.localFeatures[this.issue]?(this.features=Object.assign({},this.localFeatures[this.issue]),this.features.features.forEach(t=>t.properties.selected=this.drawOn),this.predictions.setVisibleFeatures(this.issue,this.features)):this.features={type:"FeatureCollection",features:[]}}ngOnChanges(t){t.addDisabled||(this._snackBar.dismiss(),this.map.updateMapState("MAP")),null!=t.features&&this.addFeature()}remove(t){this.predictions.removeSpatialFeedback(t,this.id).subscribe(e=>{let n=this.features.features.findIndex(e=>e.properties.feedback_id===t);this.features.features.splice(n,1),this.features.features=this.features.features.map((t,e)=>(t.properties.feedback_index=e+1,t)),this.map.userFeaturesSet(this.features)})}openSnackBar(t,e){this._snackBar.open(t,e,{panelClass:["in-draw"]})}add(){this.addDisabled=!this.addDisabled,this.addDisabled?this.openSnackBar("Now drawing spatial feedback for: "+this.issue,""):this._snackBar.dismiss(),this.nowDrawingIn.emit(this.issue),this.map.updateMapState(this.addDisabled?"DRAW":"MAP")}showInfo(){}init(){this.predictions.fetchSpatialFeedback(this.id).subscribe(t=>{this.features=t,this.map.userFeaturesSet(this.features)})}getKeepFeatures(t,e=!1){let n={type:"FeatureCollection",features:[]};for(var i in this.localFeatures)(i!=t||e)&&(console.log("feature key",this.localFeatures[i]),n.features.push(...this.localFeatures[i].features));return n}ngOnDestroy(){this.newFeatureSubscription.unsubscribe(),this.predictions.removeVisibleFeatures(this.issue)}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(s.d),l.Pb(s.e),l.Pb(s.b),l.Pb(Ar.a))},t.\u0275cmp=l.Jb({type:t,selectors:[["mol-spatial-feedback"]],inputs:{id:"id",scientificname:"scientificname",issue:"issue",drawOn:"drawOn",addDisabled:"addDisabled",clear:"clear",features:"features"},outputs:{nowDrawingIn:"nowDrawingIn",setFeatures:"setFeatures"},features:[l.Ab],decls:1,vars:1,consts:[["mat-icon-button","",3,"click",4,"ngIf"],["mat-icon-button","",3,"click"],[3,"color"]],template:function(t,e){1&t&&l.Fc(0,Vr,3,1,"button",0),2&t&&l.mc("ngIf",e.drawOn)},directives:[i.t,Tr.b,jr.a],styles:[".card-title[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.card-title[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0}.card-title.feedback-list[_ngcontent-%COMP%]{width:100%}.card-title[_ngcontent-%COMP%] .left[_ngcontent-%COMP%]{display:flex;flex-direction:row}[_nghost-%COMP%]{width:95%}.note-text[_ngcontent-%COMP%]{line-height:smaller;font-size:smaller;color:#7f7f7f;padding-left:15px}.mat-icon-button[_ngcontent-%COMP%]{margin-left:2px}.mat-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:right}.feedback-icon[_ngcontent-%COMP%]{min-width:20px;max-width:20px;min-height:20px;max-height:20px;margin-right:5px}.false_presence[_ngcontent-%COMP%]{background-color:#00c814}.false_absence[_ngcontent-%COMP%]{background-color:#c80000}.note[_ngcontent-%COMP%]{background-color:#7f7f7f} .in-draw{background:#fff;color:#000}"]}),t})();var Rr=n("s2Ay");function Lr(t,e){if(1&t&&(l.Vb(0,"mat-option",32),l.Hc(1),l.Ub()),2&t){const t=e.$implicit;l.mc("value",t.prediction_id),l.Cb(1),l.Lc(" ",t.version," - Rank: ",t.prediction_rank,", ",t.range_offset?"":"No ","Range offset, AUC: ",t.auc," ")}}function Hr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div",44),l.Vb(1,"div",45),l.Vb(2,"div",46),l.Vb(3,"h4"),l.Hc(4),l.ic(5,"translate"),l.Ub(),l.Ub(),l.Vb(6,"div",15),l.Vb(7,"ngx-slider",47),l.dc("userChangeEnd",(function(e){l.xc(t);const n=l.hc().$implicit;return l.hc(2).setOpacity(n,e)})),l.Ub(),l.Ub(),l.Ub(),l.Ub()}if(2&t){const t=l.hc().$implicit,e=l.hc(2);l.Cb(4),l.Ic(l.jc(5,3,"opacity")),l.Cb(3),l.mc("formControlName",t.sliderName)("options",e.sliderOpts)}}function Br(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div",33),l.Vb(1,"div",34),l.Vb(2,"mol-checkbox",35),l.dc("stateChange",(function(n){l.xc(t);const i=e.$implicit;return l.hc(2).toggleLayer(i,n)})),l.ic(3,"translate"),l.Ub(),l.Vb(4,"div",36),l.Vb(5,"button",37),l.dc("click",(function(n){l.xc(t);const i=e.$implicit;return l.hc(2).showOpacity(i,n)})),l.Vb(6,"mat-icon",38),l.ic(7,"translate"),l.Hc(8,"opacity"),l.Ub(),l.Ub(),l.Vb(9,"button",39),l.dc("click",(function(){return l.xc(t),l.hc(2).zoom()})),l.Vb(10,"mat-icon",38),l.ic(11,"translate"),l.Hc(12,"zoom_in"),l.Ub(),l.Ub(),l.Vb(13,"button",40),l.dc("click",(function(){l.xc(t);const n=e.$implicit;return l.hc(2).showInfo(n)})),l.Qb(14,"i",41),l.ic(15,"translate"),l.Ub(),l.Vb(16,"div"),l.Qb(17,"img",42),l.Ub(),l.Ub(),l.Ub(),l.Fc(18,Hr,8,5,"div",43),l.Ub()}if(2&t){const t=e.$implicit;l.Cb(2),l.mc("label",l.jc(3,9,t.title))("checked",t.checked),l.Cb(3),l.mc("disabled",!t.checked),l.Cb(1),l.mc("matTooltip",l.jc(7,11,"change_opacity")),l.Cb(3),l.mc("disabled",!0),l.Cb(1),l.mc("matTooltip",l.jc(11,13,"zoom_to_layer")),l.Cb(4),l.mc("matTooltip",l.jc(15,15,t.info)),l.Cb(3),l.mc("src",t.img,l.zc),l.Cb(1),l.mc("ngIf",t.opacity)}}function zr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div",11),l.Vb(1,"mat-form-field",12),l.Vb(2,"mat-label"),l.Hc(3),l.ic(4,"translate"),l.Ub(),l.Vb(5,"input",48),l.dc("change",(function(){return l.xc(t),l.hc(2).onMinMaxChange()})),l.Ub(),l.Ub(),l.Ub()}2&t&&(l.Cb(3),l.Ic(l.jc(4,1,"max")))}function qr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"ngx-slider",49),l.dc("userChangeEnd",(function(){return l.xc(t),l.hc(2).updateMap()}))("valueChange",(function(e){return l.xc(t),l.hc(2).minThreshold=e})),l.Ub()}if(2&t){const t=l.hc(2);l.mc("value",t.minThreshold)("options",t.predictionSliderOpts)}}function Yr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"ngx-slider",50),l.dc("userChangeEnd",(function(){return l.xc(t),l.hc(2).updateMap()}))("valueChange",(function(e){return l.xc(t),l.hc(2).minThreshold=e}))("highValueChange",(function(e){return l.xc(t),l.hc(2).maxThreshold=e})),l.Ub()}if(2&t){const t=l.hc(2);l.mc("value",t.minThreshold)("highValue",t.maxThreshold)("options",t.predictionSliderOpts)}}function $r(t,e){1&t&&(l.Vb(0,"span"),l.Hc(1),l.ic(2,"translate"),l.Ub()),2&t&&(l.Cb(1),l.Ic(l.jc(2,1,"very_poor")))}function Jr(t,e){1&t&&(l.Vb(0,"span"),l.Hc(1),l.ic(2,"translate"),l.Ub()),2&t&&(l.Cb(1),l.Ic(l.jc(2,1,"excellent")))}function Wr(t,e){if(1&t&&(l.Vb(0,"div",51),l.Qb(1,"mat-radio-button",52),l.Vb(2,"span"),l.Vb(3,"strong"),l.Hc(4),l.Ub(),l.Ub(),l.Fc(5,$r,3,3,"span",0),l.Fc(6,Jr,3,3,"span",0),l.Ub()),2&t){const t=e.$implicit,n=l.hc(2);l.Cb(1),l.mc("value",t)("checked",n.feedback.rating==t),l.Cb(3),l.Ic(t),l.Cb(1),l.mc("ngIf",1==t),l.Cb(1),l.mc("ngIf",5==t)}}function Xr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mol-spatial-feedback",58),l.dc("setFeatures",(function(e){return l.xc(t),l.hc(3).setFeatures(e)}))("nowDrawingIn",(function(e){return l.xc(t),l.hc(3).nowDrawingIn(e)})),l.Ub()}if(2&t){const t=l.hc().$implicit,e=l.hc(2);l.mc("addDisabled",e.drawingIn==t.title)("issue",t.title)("features",e.feedback.spatialFeedbacks)}}const Qr=function(){return{standalone:!0}};function Zr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mat-form-field",59),l.Vb(1,"mat-label"),l.Hc(2),l.ic(3,"translate"),l.Ub(),l.Vb(4,"textarea",60),l.dc("ngModelChange",(function(e){return l.xc(t),l.hc().$implicit.comment=e}))("change",(function(){return l.xc(t),l.hc(3).onTextAreaChanged()})),l.Ub(),l.Ub()}if(2&t){const t=l.hc().$implicit;l.Cb(2),l.Ic(l.jc(3,3,"leave_comment")),l.Cb(2),l.mc("ngModel",t.comment)("ngModelOptions",l.oc(5,Qr))}}function Gr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div"),l.Vb(1,"div",53),l.Vb(2,"mol-checkbox",35),l.dc("stateChange",(function(n){l.xc(t);const i=e.$implicit;return l.hc(2).toggleFeedback(i,n)})),l.ic(3,"translate"),l.Ub(),l.Vb(4,"button",54),l.Qb(5,"i",41),l.Ub(),l.Fc(6,Xr,1,3,"mol-spatial-feedback",55),l.Ub(),l.Vb(7,"div",56),l.Fc(8,Zr,5,6,"mat-form-field",57),l.Ub(),l.Ub()}if(2&t){const t=e.$implicit;l.Cb(2),l.mc("label",l.jc(3,5,t.name))("checked",t.selected),l.Cb(3),l.mc("matTooltip",t.description),l.Cb(1),l.mc("ngIf",t.selected),l.Cb(2),l.mc("ngIf",t.selected)}}function Kr(t,e){if(1&t&&(l.Vb(0,"mat-option",32),l.Hc(1),l.Ub()),2&t){const t=e.$implicit;l.mc("value",t),l.Cb(1),l.Ic(t.mol_id)}}function ts(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mol-spatial-feedback",67),l.dc("setFeatures",(function(e){return l.xc(t),l.hc(5).setFeatures(e)}))("nowDrawingIn",(function(e){return l.xc(t),l.hc(5).nowDrawingIn(e)})),l.Ub()}if(2&t){const t=l.hc().$implicit,e=l.hc(4);l.mc("issue",t)("drawOn",!1)("features",e.selectedExpert.spatial_feedback)}}function es(t,e){if(1&t&&(l.Vb(0,"div",56),l.Vb(1,"textarea",68),l.Hc(2),l.Ub(),l.Ub()),2&t){const t=l.hc(5);l.Cb(2),l.Ic(t.selectedExpert.issue_comments[t.issue])}}function ns(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div"),l.Vb(1,"mol-checkbox",64),l.dc("stateChange",(function(n){l.xc(t);const i=e.$implicit;return l.hc(4).toggleOtherFeedback(i,n)})),l.Ub(),l.Fc(2,ts,1,3,"mol-spatial-feedback",65),l.Fc(3,es,3,1,"div",66),l.Ub()}if(2&t){const t=e.$implicit,n=l.hc(4);l.Cb(1),l.mc("label",t)("checked",n.selectedExpert.selected[t]),l.Cb(1),l.mc("ngIf",n.selectedExpert.selected[t]),l.Cb(1),l.mc("ngIf",n.selectedExpert.issue_comments&&n.selectedExpert.issue_comments[n.issue])}}function is(t,e){if(1&t&&(l.Vb(0,"div"),l.Fc(1,ns,4,4,"div",27),l.Ub()),2&t){const t=l.hc(3);l.Cb(1),l.mc("ngForOf",t.selectedExpert.issues.split(";"))}}function rs(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div",61),l.Vb(1,"h4"),l.Vb(2,"strong"),l.Hc(3),l.ic(4,"translate"),l.Ub(),l.Ub(),l.Vb(5,"mat-form-field",62),l.Vb(6,"mat-label"),l.Hc(7,"Expert ID"),l.Ub(),l.Vb(8,"mat-select",63),l.dc("selectionChange",(function(){return{}}))("valueChange",(function(e){return l.xc(t),l.hc(2).selectedExpert=e})),l.Fc(9,Kr,2,2,"mat-option",6),l.Ub(),l.Ub(),l.Fc(10,is,2,1,"div",0),l.Ub()}if(2&t){const t=l.hc(2);l.Cb(3),l.Ic(l.jc(4,4,"existing_feedback")),l.Cb(5),l.mc("value",t.selectedExpert),l.Cb(1),l.mc("ngForOf",t.othersFeedback),l.Cb(1),l.mc("ngIf",t.selectedExpert)}}const ss=function(){return[1,2,3,4,5]};function os(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mat-card"),l.Vb(1,"h2",1),l.Vb(2,"div"),l.Vb(3,"strong"),l.Hc(4),l.Ub(),l.Ub(),l.Ub(),l.Vb(5,"form",2),l.Vb(6,"div",3),l.Vb(7,"mat-form-field",4),l.Vb(8,"mat-select",5),l.Fc(9,Lr,2,5,"mat-option",6),l.Ub(),l.Ub(),l.Ub(),l.Fc(10,Br,19,17,"div",7),l.Vb(11,"div",8),l.Vb(12,"div",9),l.Vb(13,"mat-slide-toggle",10),l.dc("toggleChange",(function(){return l.xc(t),l.hc().updateToggle("binary")})),l.Hc(14),l.ic(15,"translate"),l.Ub(),l.Ub(),l.Vb(16,"div",11),l.Vb(17,"mat-form-field",12),l.Vb(18,"mat-label"),l.Hc(19),l.ic(20,"translate"),l.Ub(),l.Vb(21,"input",13),l.dc("change",(function(){return l.xc(t),l.hc().onMinMaxChange()})),l.Ub(),l.Ub(),l.Ub(),l.Fc(22,zr,6,3,"div",14),l.Ub(),l.Vb(23,"div",15),l.Fc(24,qr,1,2,"ngx-slider",16),l.Fc(25,Yr,1,3,"ngx-slider",17),l.Ub(),l.Vb(26,"div",18),l.Vb(27,"div",19),l.Vb(28,"small"),l.Hc(29),l.ic(30,"translate"),l.Ub(),l.Ub(),l.Vb(31,"div",20),l.Vb(32,"span"),l.Hc(33),l.ic(34,"translate"),l.Ub(),l.Vb(35,"span"),l.Hc(36),l.ic(37,"translate"),l.Ub(),l.Ub(),l.Ub(),l.Qb(38,"mat-divider"),l.Vb(39,"div",21),l.Vb(40,"button",22),l.dc("click",(function(){return l.xc(t),l.hc().submitFeedback()})),l.Hc(41),l.ic(42,"translate"),l.Ub(),l.Ub(),l.Vb(43,"div",23),l.Vb(44,"h4"),l.Vb(45,"strong"),l.Hc(46),l.ic(47,"translate"),l.Ub(),l.Ub(),l.Vb(48,"mat-radio-group",24),l.dc("change",(function(e){return l.xc(t),l.hc().setRating(e)})),l.Fc(49,Wr,7,5,"div",25),l.Ub(),l.Ub(),l.Vb(50,"div",26),l.Vb(51,"h4"),l.Vb(52,"strong"),l.Hc(53),l.ic(54,"translate"),l.Ub(),l.Ub(),l.Fc(55,Gr,9,7,"div",27),l.Ub(),l.Vb(56,"div",28),l.Vb(57,"button",29),l.dc("click",(function(){return l.xc(t),l.hc().getPreviousSpecies()})),l.Hc(58),l.ic(59,"translate"),l.Ub(),l.Vb(60,"button",30),l.dc("click",(function(){return l.xc(t),l.hc().getNextSpecies()})),l.Hc(61),l.ic(62,"translate"),l.Ub(),l.Ub(),l.Fc(63,rs,11,6,"div",31),l.Ub(),l.Ub()}if(2&t){const t=l.hc();l.Cb(4),l.Ic(t.modelInfo.sciname),l.Cb(1),l.mc("formGroup",t.predictionsForm),l.Cb(4),l.mc("ngForOf",t.modelList),l.Cb(1),l.mc("ngForOf",t.layers),l.Cb(3),l.mc("checked",t.binaryMap),l.Cb(1),l.Jc(" ",l.jc(15,25,"binary")," "),l.Cb(5),l.Ic(l.jc(20,27,"min")),l.Cb(3),l.mc("ngIf",!t.binaryMap),l.Cb(2),l.mc("ngIf",t.binaryMap),l.Cb(1),l.mc("ngIf",!t.binaryMap),l.Cb(1),l.mc("hidden",t.binaryMap),l.Cb(3),l.Ic(l.jc(30,29,"sdm_legend")),l.Cb(4),l.Ic(l.jc(34,31,"less_likely")),l.Cb(3),l.Ic(l.jc(37,33,"highly_likely")),l.Cb(4),l.mc("disabled",t.disableSave),l.Cb(1),l.Jc(" ",l.jc(42,35,"save")," "),l.Cb(5),l.Ic(l.jc(47,37,"pred_rating")),l.Cb(3),l.mc("ngForOf",l.oc(45,ss)),l.Cb(4),l.Ic(l.jc(54,39,"feedback")),l.Cb(2),l.mc("ngForOf",t.commonProblemsLocal),l.Cb(2),l.mc("disabled",t.worksheetEmpty),l.Cb(1),l.Jc(" ",l.jc(59,41,"previous_species")," "),l.Cb(2),l.mc("disabled",t.worksheetEmpty),l.Cb(1),l.Jc(" ",l.jc(62,43,"next_species")," "),l.Cb(2),l.mc("ngIf",t.othersFeedback&&0!=t.othersFeedback.length)}}function as(t,e){1&t&&(l.Vb(0,"div"),l.Vb(1,"mat-card"),l.Vb(2,"mat-card-title"),l.Hc(3,"Loading..."),l.Ub(),l.Ub(),l.Ub())}let cs=(()=>{class t{constructor(t,e,n){this.predictionsService=t,this.map=e,this.translate=n,this.showBackground=new l.o,this.refreshPrediction=new l.o,this.modelChange=new l.o,this.nextSpecies=new l.o,this.previousSpecies=new l.o,this.openMetadata=new l.o,this.PDF=new l.o,this.updateThreshold=new l.o,this.commonProblemsLocal=null,this.drawDisabled=!1,this.othersFeedback=["a","b"],this.disableSave=!0,this.predictionsForm=new y.i({model:new y.f,min:new y.f,max:new y.f,mask:new y.f(!0),updateMinROC:new y.f(!0),points:new y.f(1),range:new y.f(.3),rangemap:new y.f(.8),feedback:new y.f(1),prediction:new y.f(1)}),this.sliderOpts={step:.05,floor:0,ceil:1,showSelectionBar:!0,showTicks:!1},this.feedback={rating:-1,spatialFeedbacks:{},issue_comments:{}},this.layers=[{title:"layers_prediction",checked:!0,opacity:!1,sliderName:"prediction",layerIndex:2,img:"https://cdn.mol.org/static/images/legends/datatypes/model.png",info:"info_layers_prediction"},{title:"layers_expert_range",checked:!1,opacity:!1,sliderName:"rangemap",layerIndex:0,img:"https://cdn.mol.org/static/images/legends/datatypes/range.png",info:"info_layers_expert_range"},{title:"layers_model_input",checked:!0,opacity:!1,sliderName:"range",layerIndex:1,img:"https://cdn.mol.org/static/images/legends/datatypes/range.png",info:"info_layers_model_input"},{title:"layers_points",checked:!0,opacity:!1,sliderName:"points",layerIndex:3,img:"https://mapoflife.github.io/experts-next/assets/points.png",bgImg:"https://mapoflife.github.io/experts-next/assets/background_points.png",info:"info_layers_points"}],this.predictionSliderOpts=null,this.modelInfo=null,this.backgroundPoints=!1,this.binaryMap=!0,this.logMap=!1,this.map.clickedFeatures.subscribe(t=>{var e,n;if(t&&t.length>0){console.log("clicked feature",null===(e=t[0])||void 0===e?void 0:e.getProperties());let i=null===(n=t[0])||void 0===n?void 0:n.getProperties(),r=this.feedback.spatialFeedbacks[null==i?void 0:i.issue],s=r.features.findIndex(t=>t.properties.feedback_id==(null==i?void 0:i.feedback_id));r.features.splice(s,1),r.features=r.features.map((t,e)=>(t.properties.feedback_index=e+1,t)),this.predictionsService.setVisibleFeatures(null==i?void 0:i.issue,r)}}),this.predictionsService.visibleFeatures.subscribe(t=>{let e={type:"FeatureCollection",features:[]};for(var n in t)e.features.push(...t[n].features);this.map.userFeaturesSet(e)})}ngOnInit(){this.toggleLayer(this.layers[1],!1)}ngOnChanges(t){var e;t.info&&(this.predictionSliderOpts={floor:.01*this.minThreshold,step:.001*this.minThreshold,ceil:this.maxThreshold,translate:(t,e)=>{switch(e){case Cr.a.Ceil:case Cr.a.Floor:return""+t.toExponential(0)+"";default:return""+t.toExponential(2)+""}}},this.setupInfo()),this.commonProblemsLocal=[...c],this.feedback.project_id=this.project_id,this.feedback.prediction_id=this.info.prediction_id,this.othersFeedback=null,this.selectedExpert=null,this.predictionsService.getFeedbackOthers(this.project_id,this.info.prediction_id).subscribe(t=>{t.forEach(t=>{var e;t.selected=null===(e=t.issues)||void 0===e?void 0:e.split(";").reduce((t,e)=>(t[e]=!1,t),{})}),this.othersFeedback=t}),this.predictionsService.getSDMFeedbackv2(this.project_id,this.info.prediction_id).subscribe(t=>{var e,n,i,r;this.feedback.spatialFeedbacks=null!==(e=(t=(null==t?void 0:t.length)>0?t[0]:{}).spatial_feedback)&&void 0!==e?e:{},this.feedback.rating=null!==(n=t.rating)&&void 0!==n?n:-1;let s=null!==(r=null===(i=t.issues)||void 0===i?void 0:i.split(";"))&&void 0!==r?r:[];this.commonProblemsLocal.forEach(e=>{e.selected=s.indexOf(e.title)>-1,e.comment=(null==t?void 0:t.issue_comments)?null==t?void 0:t.issue_comments[e.title]:"",this.disableSave=!0})}),(null===(e=t.predictionOptions)||void 0===e?void 0:e.currentValue.min)&&this.predictionsForm.patchValue({min:Number(t.predictionOptions.currentValue.min).toExponential(2),max:Number(t.predictionOptions.currentValue.max).toExponential(2)})}ngAfterViewInit(){this.drawLegend()}submitFeedback(){let t=this.commonProblemsLocal.filter(t=>t.selected).map(t=>t.title).join(";");this.feedback.issues=t,this.feedback.rating>0&&(this.predictionsService.submitFeedback(this.feedback).subscribe(t=>{}),this.disableSave=!0)}shouldUpdateMin(t){return void 0!==t.predictionOptions&&void 0!==t.predictionOptions.currentValue&&t.predictionOptions.currentValue.min!==this.predictionsForm.get("min").value}setupInfo(){if(this.info){const t=this.info.scientificname.replaceAll("_"," ");this.modelInfo={sciname:t,SPSthreshold:this.info.sps_threshold,noRangeOffsetModel:this.info.noRangeOffsetModel,noRangeOffsetModelIndex:this.info.noRangeOffsetModelIndex,isBest:this.info.isBest},this.setPredictionsForm()}}toggleOtherFeedback(t,e){this.selectedExpert.selected[t]=e}setPredictionsForm(){this.predictionsForm.patchValue({model:this.info.prediction_id,min:this.minThreshold.toExponential(2),max:this.maxThreshold.toExponential(2)},{emitEvent:!1})}showOpacity(t,e){e.pointerId>0&&(t.opacity=!t.opacity)}zoom(){}showInfo(t){"rangemap"===t.sliderName&&this.openMetadata.emit("rangemap")}setOpacity(t,e){this.map.updateLayerOpacity(e.value,t.layerIndex)}toggleLayer(t,e){t.checked=e,t.checked?this.map.updateLayerOpacity(this.predictionsForm.get(t.sliderName).value,t.layerIndex):(this.map.updateLayerOpacity(0,t.layerIndex),t.opacity=!1)}toggleFeedback(t,e){this.disableSave=!1,t.selected=e}toggleBackground(){this.backgroundPoints=!this.backgroundPoints,this.showBackground.emit(this.backgroundPoints)}updateToggle(t){"binary"===t?this.binaryMap=!this.binaryMap:"log"===t&&(this.logMap=!this.logMap),this.updateMap()}updateMap(){console.log({min:this.minThreshold,max:this.maxThreshold,binary:this.binaryMap}),this.refreshPrediction.emit({min:this.minThreshold,max:this.maxThreshold,binary:this.binaryMap})}getNextSpecies(){this.drawingIn="",this.nextSpecies.emit()}getPreviousSpecies(){this.drawingIn="",this.previousSpecies.emit()}triggerModelAction(t){switch(t){case"Metadata":this.openMetadata.emit("model");break;case"PDF":this.PDF.emit();break;case"Species":const t="http://mol.org/species/map/"+this.scientificname.split(" ").slice(0,2).join("_");window.open(t,"_blank")}}drawLegend(){let t=("#legend",new At([[document.querySelector("#legend")]],[document.documentElement])).append("svg").attr("width",400).attr("height",10),e=t.append("g");t.append("defs").append("linearGradient").attr("id","linear-gradient").selectAll("stop").data([{offset:"0%",color:"#de2d26"},{offset:"50%",color:"#ffff8c"},{offset:"100%",color:"#2ca25f"}]).enter().append("stop").attr("offset",t=>t.offset).attr("stop-color",t=>t.color).attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%"),e.append("rect").attr("width",350).attr("height",20).style("fill","url(#linear-gradient)")}addSpatialFeedback(){this.drawDisabled=!this.drawDisabled,this.map.updateMapState(this.drawDisabled?"DRAW":"MAP")}setFeatures(t){this.disableSave=!1,this.feedback.spatialFeedbacks[t.issue]=t.features}setRating(t){this.disableSave=!1,this.feedback.rating=t.value}nowDrawingIn(t){this.drawingIn=t}onTextAreaChanged(){this.feedback.issue_comments=Object.assign({},...this.commonProblemsLocal.filter(t=>t.selected).map(t=>({[t.title]:t.comment})))}onMinMaxChange(){this.minThreshold=this.predictionsForm.controls.min.value,this.maxThreshold=this.predictionsForm.controls.max.value,this.updateMap()}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(s.e),l.Pb(s.d),l.Pb(s.j))},t.\u0275cmp=l.Jb({type:t,selectors:[["mol-model-info"]],inputs:{id:"id",project_id:"project_id",info:"info",modelList:"modelList",predictionOptions:"predictionOptions",scientificname:"scientificname",worksheetEmpty:"worksheetEmpty",minThreshold:"minThreshold",maxThreshold:"maxThreshold"},outputs:{showBackground:"showBackground",refreshPrediction:"refreshPrediction",modelChange:"modelChange",nextSpecies:"nextSpecies",previousSpecies:"previousSpecies",openMetadata:"openMetadata",PDF:"PDF",updateThreshold:"updateThreshold"},features:[l.Ab],decls:2,vars:2,consts:[[4,"ngIf"],[1,"species-title"],[3,"formGroup"],[1,"models"],["appearance","fill"],["formControlName","model","name","model"],[3,"value",4,"ngFor","ngForOf"],["class","layers-wrapper",4,"ngFor","ngForOf"],[1,"threshold-toggle"],[1,"binary-toggle"],[3,"checked","toggleChange"],[1,"value-wrapper"],["appearance","fill",1,"max"],["matInput","","formControlName","min",3,"change"],["class","value-wrapper",4,"ngIf"],[1,"mrs-slider","custom-slider"],[3,"value","options","userChangeEnd","valueChange",4,"ngIf"],[3,"value","highValue","options","userChangeEnd","valueChange","highValueChange",4,"ngIf"],[3,"hidden"],["id","legend"],[1,"scale"],[1,"button-box"],["color","primary","mat-raised-button","",3,"disabled","click"],[1,"prediction-score-block"],["aria-label","Select an option",1,"prediction-score",3,"change"],["class","prediction-score score-item",4,"ngFor","ngForOf"],[1,"prediction-feedback"],[4,"ngFor","ngForOf"],[1,"buttons"],["mat-stroked-button","","color","accent",2,"align-items","left",3,"disabled","click"],["mat-stroked-button","","color","accent",2,"align-items","right",3,"disabled","click"],["class","existing-feedback",4,"ngIf"],[3,"value"],[1,"layers-wrapper"],[1,"value-wrapper","layers"],["color","accent",3,"label","checked","stateChange"],[1,"icons"],["mat-icon-button","","aria-label","opacity",3,"disabled","click"],["matTooltipClass","tooltip",3,"matTooltip"],["mat-icon-button","","aria-label","zoom",3,"disabled","click"],["mat-icon-button","","aria-label","info",3,"click"],["matTooltipClass","tooltip",1,"fa","fa-info",3,"matTooltip"],["height","20px","width","20px",1,"legend-img",3,"src"],["class","opacity",4,"ngIf"],[1,"opacity"],[1,"mrs-slider-box"],[1,"mrs","stat","title"],[3,"formControlName","options","userChangeEnd"],["matInput","","formControlName","max",3,"change"],[3,"value","options","userChangeEnd","valueChange"],[3,"value","highValue","options","userChangeEnd","valueChange","highValueChange"],[1,"prediction-score","score-item"],[3,"value","checked"],[1,"feedback-item"],["mat-icon-button","","aria-label","info"],[3,"addDisabled","issue","features","setFeatures","nowDrawingIn",4,"ngIf"],[1,"comment-box"],["class","example-full-width",4,"ngIf"],[3,"addDisabled","issue","features","setFeatures","nowDrawingIn"],[1,"example-full-width"],["matInput","","placeholder","",3,"ngModel","ngModelOptions","ngModelChange","change"],[1,"existing-feedback"],["appearance","standard",1,"dropdown-container"],[3,"value","selectionChange","valueChange"],[3,"label","checked","stateChange"],[3,"issue","drawOn","features","setFeatures","nowDrawingIn",4,"ngIf"],["class","comment-box",4,"ngIf"],[3,"issue","drawOn","features","setFeatures","nowDrawingIn"],["readonly",""]],template:function(t,e){1&t&&(l.Fc(0,os,64,46,"mat-card",0),l.Fc(1,as,4,0,"div",0)),2&t&&(l.mc("ngIf",e.info),l.Cb(1),l.mc("ngIf",!e.info))},directives:[i.t,kr.a,y.H,y.s,y.j,Sr.c,Or.a,y.r,y.h,i.s,Mr.a,Sr.g,Pr.b,y.c,Fr.a,Tr.b,Ur.c,Er.n,Dr.a,jr.a,Ir.a,Cr.c,Ur.b,Nr,y.u,kr.e],pipes:[Rr.c],styles:[".mrs-slider-box{display:flex;justify-content:center;align-items:center;flex-direction:row;place-content:space-between}.mrs-slider-box .mrs{text-align:right;padding-right:5px}.mrs-slider-box .mrs-slider{width:80%}.threshold-toggle{padding-top:27px;height:45px}.threshold-toggle,.value-wrapper{display:flex;justify-content:space-around;align-items:center}.value-wrapper{flex-direction:row}.value-wrapper mat-form-field{max-width:65px}.value-wrapper.binary-toggle{justify-content:flex-end}.value-wrapper.layers,.value-wrapper.options{justify-content:space-between;height:30px}h2{display:flex;flex-direction:row;justify-content:space-between;margin-bottom:5px}h2 small{padding:3px}h4{margin-bottom:11px}h3{margin-bottom:0}.models mat-form-field{width:90%}.icons{display:flex;align-items:center}.colors{display:flex;flex-direction:row}.background,.occurence{width:10px;height:10px;margin:.5em}.break{padding-top:20px}.species-title{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:space-between}h2{margin:0!important}.buttons{width:100%;display:flex;flex-direction:row;justify-content:space-between;margin-top:4px;align-items:center}.buttons button{height:30px}.card-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.actions{margin-top:1.5em}#legend{margin-top:10px}.scale{display:flex;justify-content:space-between}.prediction-score{display:flex;align-items:flex-start;flex-wrap:wrap;justify-content:space-around;align-content:space-around}.score-item{display:flex;flex-direction:column;width:60px;align-items:center}mat-radio-button{width:20px}mat-card{padding:5px 16px!important}.prediction-score-block{margin-top:15px}.prediction-feedback h4,.prediction-score-block h4{margin:3px}mat-selection-list{padding:0}mat-list-option{height:20px}.feedback-item{display:flex;align-items:center;white-space:nowrap;height:25px;margin-left:15px}.comment-box{margin-left:40px}.comment-box mat-form-field{width:300px}.button-box{position:absolute;right:0;margin-top:4px}.existing-feedback{margin-top:7px}.existing-feedback mat-form-field{margin-left:15px}"],encapsulation:2}),t})();var us=n("47ST"),ls=n("NiQx"),hs=n("SSAN"),fs=n("bl/x"),ds=n("mWib"),ps=n("jxfh"),bs=n("J7xr"),ms=n("cZZj"),gs=n("qvOF"),_s=n("5XID"),vs=n("fAiE"),ys=n("ZTXN"),ws=n("KTx3"),xs=n("g6G6"),Cs=n("xVbo"),ks=n("kuMc"),Ss=n("Ohay"),Os=n("YtkY"),Ms=n("J+dc"),Ps=n("jIqt"),Fs=n("f7+R"),Ts=n("5lCh"),Us=n("sg/T"),Es=n("E5oP");const Ds=["*"];function js(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div",2),l.dc("click",(function(){return l.xc(t),l.hc()._onBackdropClicked()})),l.Ub()}if(2&t){const t=l.hc();l.Gb("mat-drawer-shown",t._isShowingBackdrop())}}function Is(t,e){1&t&&(l.Vb(0,"mat-drawer-content"),l.kc(1,2),l.Ub())}const As=[[["mat-drawer"]],[["mat-drawer-content"]],"*"],Vs=["mat-drawer","mat-drawer-content","*"],Ns={transformDrawer:Object(Fs.n)("transform",[Object(Fs.k)("open, open-instant",Object(Fs.l)({transform:"none",visibility:"visible"})),Object(Fs.k)("void",Object(Fs.l)({"box-shadow":"none",visibility:"hidden"})),Object(Fs.m)("void => open-instant",Object(Fs.e)("0ms")),Object(Fs.m)("void <=> open, open-instant => void",Object(Fs.e)("400ms cubic-bezier(0.25, 0.8, 0.25, 1)"))])};function Rs(t){throw Error(`A drawer was already declared for 'position="${t}"'`)}const Ls=new l.r("MAT_DRAWER_DEFAULT_AUTOSIZE",{providedIn:"root",factory:function(){return!1}}),Hs=new l.r("MAT_DRAWER_CONTAINER");let Bs=(()=>{class t extends gs.a{constructor(t,e,n,i,r){super(n,i,r),this._changeDetectorRef=t,this._container=e}ngAfterContentInit(){this._container._contentMarginChanges.subscribe(()=>{this._changeDetectorRef.markForCheck()})}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(l.h),l.Pb(Object(l.U)(()=>qs)),l.Pb(l.l),l.Pb(gs.c),l.Pb(l.A))},t.\u0275cmp=l.Jb({type:t,selectors:[["mat-drawer-content"]],hostAttrs:[1,"mat-drawer-content"],hostVars:4,hostBindings:function(t,e){2&t&&l.Ec("margin-left",e._container._contentMargins.left,"px")("margin-right",e._container._contentMargins.right,"px")},features:[l.zb],ngContentSelectors:Ds,decls:1,vars:0,template:function(t,e){1&t&&(l.lc(),l.kc(0))},encapsulation:2,changeDetection:0}),t})(),zs=(()=>{class t{constructor(t,e,n,i,r,s,o){this._elementRef=t,this._focusTrapFactory=e,this._focusMonitor=n,this._platform=i,this._ngZone=r,this._doc=s,this._container=o,this._elementFocusedBeforeDrawerWasOpened=null,this._enableAnimations=!1,this._position="start",this._mode="over",this._disableClose=!1,this._opened=!1,this._animationStarted=new ys.a,this._animationEnd=new ys.a,this._animationState="void",this.openedChange=new l.o(!0),this._destroyed=new ys.a,this.onPositionChanged=new l.o,this._modeChanged=new ys.a,this.openedChange.subscribe(t=>{t?(this._doc&&(this._elementFocusedBeforeDrawerWasOpened=this._doc.activeElement),this._takeFocus()):this._restoreFocus()}),this._ngZone.runOutsideAngular(()=>{Object(ws.a)(this._elementRef.nativeElement,"keydown").pipe(Object(Cs.a)(t=>t.keyCode===vs.e&&!this.disableClose&&!Object(vs.q)(t)),Object(ks.a)(this._destroyed)).subscribe(t=>this._ngZone.run(()=>{this.close(),t.stopPropagation(),t.preventDefault()}))}),this._animationEnd.pipe(Object(Ss.a)((t,e)=>t.fromState===e.fromState&&t.toState===e.toState)).subscribe(t=>{const{fromState:e,toState:n}=t;(0===n.indexOf("open")&&"void"===e||"void"===n&&0===e.indexOf("open"))&&this.openedChange.emit(this._opened)})}get position(){return this._position}set position(t){(t="end"===t?"end":"start")!=this._position&&(this._position=t,this.onPositionChanged.emit())}get mode(){return this._mode}set mode(t){this._mode=t,this._updateFocusTrapState(),this._modeChanged.next()}get disableClose(){return this._disableClose}set disableClose(t){this._disableClose=Object(_s.c)(t)}get autoFocus(){const t=this._autoFocus;return null==t?"side"!==this.mode:t}set autoFocus(t){this._autoFocus=Object(_s.c)(t)}get opened(){return this._opened}set opened(t){this.toggle(Object(_s.c)(t))}get _openedStream(){return this.openedChange.pipe(Object(Cs.a)(t=>t),Object(Os.a)(()=>{}))}get openedStart(){return this._animationStarted.pipe(Object(Cs.a)(t=>t.fromState!==t.toState&&0===t.toState.indexOf("open")),Object(Os.a)(()=>{}))}get _closedStream(){return this.openedChange.pipe(Object(Cs.a)(t=>!t),Object(Os.a)(()=>{}))}get closedStart(){return this._animationStarted.pipe(Object(Cs.a)(t=>t.fromState!==t.toState&&"void"===t.toState),Object(Os.a)(()=>{}))}_takeFocus(){this.autoFocus&&this._focusTrap&&this._focusTrap.focusInitialElementWhenReady().then(t=>{t||"function"!=typeof this._elementRef.nativeElement.focus||this._elementRef.nativeElement.focus()})}_restoreFocus(){if(!this.autoFocus)return;const t=this._doc&&this._doc.activeElement;t&&this._elementRef.nativeElement.contains(t)&&(this._elementFocusedBeforeDrawerWasOpened?this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened,this._openedVia):this._elementRef.nativeElement.blur()),this._elementFocusedBeforeDrawerWasOpened=null,this._openedVia=null}ngAfterContentInit(){this._focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement),this._updateFocusTrapState()}ngAfterContentChecked(){this._platform.isBrowser&&(this._enableAnimations=!0)}ngOnDestroy(){this._focusTrap&&this._focusTrap.destroy(),this._animationStarted.complete(),this._animationEnd.complete(),this._modeChanged.complete(),this._destroyed.next(),this._destroyed.complete()}open(t){return this.toggle(!0,t)}close(){return this.toggle(!1)}toggle(t=!this.opened,e="program"){return this._opened=t,t?(this._animationState=this._enableAnimations?"open":"open-instant",this._openedVia=e):(this._animationState="void",this._restoreFocus()),this._updateFocusTrapState(),new Promise(t=>{this.openedChange.pipe(Object(Ms.a)(1)).subscribe(e=>t(e?"open":"close"))})}get _width(){return this._elementRef.nativeElement&&this._elementRef.nativeElement.offsetWidth||0}_updateFocusTrapState(){this._focusTrap&&(this._focusTrap.enabled=this.opened&&"side"!==this.mode)}_animationStartListener(t){this._animationStarted.next(t)}_animationDoneListener(t){this._animationEnd.next(t)}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(l.l),l.Pb(Us.i),l.Pb(Us.h),l.Pb(ms.a),l.Pb(l.A),l.Pb(i.e,8),l.Pb(Hs,8))},t.\u0275cmp=l.Jb({type:t,selectors:[["mat-drawer"]],hostAttrs:["tabIndex","-1",1,"mat-drawer"],hostVars:12,hostBindings:function(t,e){1&t&&l.Hb("@transform.start",(function(t){return e._animationStartListener(t)}))("@transform.done",(function(t){return e._animationDoneListener(t)})),2&t&&(l.Db("align",null),l.Mc("@transform",e._animationState),l.Gb("mat-drawer-end","end"===e.position)("mat-drawer-over","over"===e.mode)("mat-drawer-push","push"===e.mode)("mat-drawer-side","side"===e.mode)("mat-drawer-opened",e.opened))},inputs:{position:"position",mode:"mode",disableClose:"disableClose",autoFocus:"autoFocus",opened:"opened"},outputs:{openedChange:"openedChange",onPositionChanged:"positionChanged",_openedStream:"opened",openedStart:"openedStart",_closedStream:"closed",closedStart:"closedStart"},exportAs:["matDrawer"],ngContentSelectors:Ds,decls:2,vars:0,consts:[[1,"mat-drawer-inner-container"]],template:function(t,e){1&t&&(l.lc(),l.Vb(0,"div",0),l.kc(1),l.Ub())},encapsulation:2,data:{animation:[Ns.transformDrawer]},changeDetection:0}),t})(),qs=(()=>{class t{constructor(t,e,n,i,r,s=!1,o){this._dir=t,this._element=e,this._ngZone=n,this._changeDetectorRef=i,this._animationMode=o,this._drawers=new l.E,this.backdropClick=new l.o,this._destroyed=new ys.a,this._doCheckSubject=new ys.a,this._contentMargins={left:null,right:null},this._contentMarginChanges=new ys.a,t&&t.change.pipe(Object(ks.a)(this._destroyed)).subscribe(()=>{this._validateDrawers(),this.updateContentMargins()}),r.change().pipe(Object(ks.a)(this._destroyed)).subscribe(()=>this.updateContentMargins()),this._autosize=s}get start(){return this._start}get end(){return this._end}get autosize(){return this._autosize}set autosize(t){this._autosize=Object(_s.c)(t)}get hasBackdrop(){return null==this._backdropOverride?!this._start||"side"!==this._start.mode||!this._end||"side"!==this._end.mode:this._backdropOverride}set hasBackdrop(t){this._backdropOverride=null==t?null:Object(_s.c)(t)}get scrollable(){return this._userContent||this._content}ngAfterContentInit(){this._allDrawers.changes.pipe(Object(Ps.a)(this._allDrawers),Object(ks.a)(this._destroyed)).subscribe(t=>{this._drawers.reset(t.filter(t=>!t._container||t._container===this)),this._drawers.notifyOnChanges()}),this._drawers.changes.pipe(Object(Ps.a)(null)).subscribe(()=>{this._validateDrawers(),this._drawers.forEach(t=>{this._watchDrawerToggle(t),this._watchDrawerPosition(t),this._watchDrawerMode(t)}),(!this._drawers.length||this._isDrawerOpen(this._start)||this._isDrawerOpen(this._end))&&this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),this._doCheckSubject.pipe(Object(ds.a)(10),Object(ks.a)(this._destroyed)).subscribe(()=>this.updateContentMargins())}ngOnDestroy(){this._contentMarginChanges.complete(),this._doCheckSubject.complete(),this._drawers.destroy(),this._destroyed.next(),this._destroyed.complete()}open(){this._drawers.forEach(t=>t.open())}close(){this._drawers.forEach(t=>t.close())}updateContentMargins(){let t=0,e=0;if(this._left&&this._left.opened)if("side"==this._left.mode)t+=this._left._width;else if("push"==this._left.mode){const n=this._left._width;t+=n,e-=n}if(this._right&&this._right.opened)if("side"==this._right.mode)e+=this._right._width;else if("push"==this._right.mode){const n=this._right._width;e+=n,t-=n}t=t||null,e=e||null,t===this._contentMargins.left&&e===this._contentMargins.right||(this._contentMargins={left:t,right:e},this._ngZone.run(()=>this._contentMarginChanges.next(this._contentMargins)))}ngDoCheck(){this._autosize&&this._isPushed()&&this._ngZone.runOutsideAngular(()=>this._doCheckSubject.next())}_watchDrawerToggle(t){t._animationStarted.pipe(Object(Cs.a)(t=>t.fromState!==t.toState),Object(ks.a)(this._drawers.changes)).subscribe(t=>{"open-instant"!==t.toState&&"NoopAnimations"!==this._animationMode&&this._element.nativeElement.classList.add("mat-drawer-transition"),this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),"side"!==t.mode&&t.openedChange.pipe(Object(ks.a)(this._drawers.changes)).subscribe(()=>this._setContainerClass(t.opened))}_watchDrawerPosition(t){t&&t.onPositionChanged.pipe(Object(ks.a)(this._drawers.changes)).subscribe(()=>{this._ngZone.onMicrotaskEmpty.asObservable().pipe(Object(Ms.a)(1)).subscribe(()=>{this._validateDrawers()})})}_watchDrawerMode(t){t&&t._modeChanged.pipe(Object(ks.a)(Object(xs.a)(this._drawers.changes,this._destroyed))).subscribe(()=>{this.updateContentMargins(),this._changeDetectorRef.markForCheck()})}_setContainerClass(t){const e=this._element.nativeElement.classList,n="mat-drawer-container-has-open";t?e.add(n):e.remove(n)}_validateDrawers(){this._start=this._end=null,this._drawers.forEach(t=>{"end"==t.position?(null!=this._end&&Rs("end"),this._end=t):(null!=this._start&&Rs("start"),this._start=t)}),this._right=this._left=null,this._dir&&"rtl"===this._dir.value?(this._left=this._end,this._right=this._start):(this._left=this._start,this._right=this._end)}_isPushed(){return this._isDrawerOpen(this._start)&&"over"!=this._start.mode||this._isDrawerOpen(this._end)&&"over"!=this._end.mode}_onBackdropClicked(){this.backdropClick.emit(),this._closeModalDrawer()}_closeModalDrawer(){[this._start,this._end].filter(t=>t&&!t.disableClose&&this._canHaveBackdrop(t)).forEach(t=>t.close())}_isShowingBackdrop(){return this._isDrawerOpen(this._start)&&this._canHaveBackdrop(this._start)||this._isDrawerOpen(this._end)&&this._canHaveBackdrop(this._end)}_canHaveBackdrop(t){return"side"!==t.mode||!!this._backdropOverride}_isDrawerOpen(t){return null!=t&&t.opened}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(Es.c,8),l.Pb(l.l),l.Pb(l.A),l.Pb(l.h),l.Pb(gs.e),l.Pb(Ls),l.Pb(Ts.a,8))},t.\u0275cmp=l.Jb({type:t,selectors:[["mat-drawer-container"]],contentQueries:function(t,e,n){var i;1&t&&(l.Ib(n,Bs,!0),l.Ib(n,zs,!0)),2&t&&(l.sc(i=l.ec())&&(e._content=i.first),l.sc(i=l.ec())&&(e._allDrawers=i))},viewQuery:function(t,e){var n;1&t&&l.Nc(Bs,!0),2&t&&l.sc(n=l.ec())&&(e._userContent=n.first)},hostAttrs:[1,"mat-drawer-container"],hostVars:2,hostBindings:function(t,e){2&t&&l.Gb("mat-drawer-container-explicit-backdrop",e._backdropOverride)},inputs:{autosize:"autosize",hasBackdrop:"hasBackdrop"},outputs:{backdropClick:"backdropClick"},exportAs:["matDrawerContainer"],features:[l.Bb([{provide:Hs,useExisting:t}])],ngContentSelectors:Vs,decls:4,vars:2,consts:[["class","mat-drawer-backdrop",3,"mat-drawer-shown","click",4,"ngIf"],[4,"ngIf"],[1,"mat-drawer-backdrop",3,"click"]],template:function(t,e){1&t&&(l.lc(As),l.Fc(0,js,1,2,"div",0),l.kc(1),l.kc(2,1),l.Fc(3,Is,2,0,"mat-drawer-content",1)),2&t&&(l.mc("ngIf",e.hasBackdrop),l.Cb(3),l.mc("ngIf",!e._content))},directives:[i.t,Bs],styles:[".mat-drawer-container{position:relative;z-index:1;box-sizing:border-box;-webkit-overflow-scrolling:touch;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:background-color,visibility}.cdk-high-contrast-active .mat-drawer-backdrop{opacity:.5}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-transition .mat-drawer-content{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%, 0, 0)}.cdk-high-contrast-active .mat-drawer,.cdk-high-contrast-active [dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}.cdk-high-contrast-active [dir=rtl] .mat-drawer,.cdk-high-contrast-active .mat-drawer.mat-drawer-end{border-left:solid 1px currentColor;border-right:none}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer{transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer.mat-drawer-end{left:0;right:auto;transform:translate3d(-100%, 0, 0)}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.mat-sidenav-fixed{position:fixed}\n"],encapsulation:2,changeDetection:0}),t})(),Ys=(()=>{class t{}return t.\u0275mod=l.Nb({type:t}),t.\u0275inj=l.Mb({factory:function(e){return new(e||t)},imports:[[i.c,Er.i,ms.b,gs.b],gs.b,Er.i]}),t})();var $s=n("nts4"),Js=n("sOKj"),Ws=n("SoR6");function Xs(t,e){if(1&t){const t=l.Wb();l.Vb(0,"google-chart",1),l.dc("select",(function(e){return l.xc(t),l.hc().changeMin(e)})),l.Ub()}if(2&t){const t=l.hc();l.mc("dynamicResize",t.dynamicResize)("data",t.rocChart.data)("type",t.rocChart.type)("title",t.rocChart.title)("columns",t.rocChart.columns)("options",t.rocChart.options)}}let Qs=(()=>{class t{constructor(t){this.predictionsService=t,this.updateMin=new l.o,this.rocChart=null}ngOnInit(){}ngOnChanges(t){t.chartData&&this.chartData&&this.graphChart()}changeMin(t){1==t.selection[0].column&&this.updateMin.emit(this.rocChart.data[t.selection[0].row][2])}graphChart(){let t=this.chartData.map(t=>[t.fpr,t.tpr,t.thresh,`FPR: ${t.fpr}, TPR: ${t.tpr}, TH: ${t.thresh}`,t.fpr]);this.rocChart={title:"ROC",type:Ws.a.LineChart,data:t,columns:[{type:"number",id:"fpr",label:"fpr"},{type:"number",id:"tpr",label:"tpr"},{type:"number",id:"thresh",label:"thresh",role:"annotationText"},{type:"string",role:"tooltip",id:"tooltip",p:{html:!0}},{type:"number",id:"fpr",label:"fpr"}],colors:["#e0440e","#e6693e"],options:{hAxis:{title:"False Positive Rate"},vAxis:{title:"True Positive Rate "},width:398,legend:{position:"none"},tooltip:{isHtml:!0,ignoreBounds:!0}}}}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(s.e))},t.\u0275cmp=l.Jb({type:t,selectors:[["mol-roc-chart"]],inputs:{id:"id",chartData:"chartData"},outputs:{updateMin:"updateMin"},features:[l.Ab],decls:1,vars:1,consts:[["class","gchart",3,"dynamicResize","data","type","title","columns","options","select",4,"ngIf"],[1,"gchart",3,"dynamicResize","data","type","title","columns","options","select"]],template:function(t,e){1&t&&l.Fc(0,Xs,1,6,"google-chart",0),2&t&&l.mc("ngIf",e.rocChart)},directives:[i.t,Ws.b],styles:["[_nghost-%COMP%]{width:398px}"]}),t})();const Zs=["mol-model-info"];function Gs(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mol-model-info",9),l.dc("showBackground",(function(e){return l.xc(t),l.hc().fetchPoints(e)}))("refreshPrediction",(function(e){return l.xc(t),l.hc().refreshMap(e)}))("modelChange",(function(e){return l.xc(t),l.hc().modelChange(e)}))("nextSpecies",(function(){return l.xc(t),l.hc().getNextSpecies()}))("previousSpecies",(function(){return l.xc(t),l.hc().getPreviousSpecies()}))("openMetadata",(function(e){return l.xc(t),l.hc().openMetadataDialog(e)}))("updateThreshold",(function(e){return l.xc(t),l.hc().updateThreshold(e)}))("PDF",(function(){return l.xc(t),l.hc().getPDF()})),l.Ub()}if(2&t){const t=l.hc();l.mc("id",t.id)("project_id",t.project_id)("info",t.info)("modelList",t.modelList)("predictionOptions",t.predictionOptions)("scientificname",t.scientificname)("minThreshold",t.predictionOptions.min)("maxThreshold",t.predictionOptions.max)("worksheetEmpty",t.worksheetEmpty)}}function Ks(t,e){if(1&t){const t=l.Wb();l.Vb(0,"button",10),l.dc("click",(function(){l.xc(t);const e=l.hc();return e.showMetadata=!e.showMetadata})),l.Hc(1),l.ic(2,"translate"),l.Ub()}if(2&t){const t=l.hc();l.Cb(1),l.Jc(" ",t.showMetadata?"hide_metadata":l.jc(2,1,"show_metadata")," ")}}function to(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mol-roc-chart",11),l.dc("updateMin",(function(e){return l.xc(t),l.hc().updateMinFromROC(e)})),l.Ub()}if(2&t){const t=l.hc();l.mc("chartData",t.chartData)}}function eo(t,e){1&t&&l.Qb(0,"mat-divider")}function no(t,e){1&t&&l.Qb(0,"mat-divider")}const io=[{path:":scientificname",component:(()=>{class t{constructor(t,e,n,i,r,s,c,u,l){this.mapService=t,this.predictionsService=e,this.datasetService=n,this.route=i,this.router=r,this.auth=s,this.matDialog=c,this._snackBar=u,this.translate=l,this.id=null,this.scientificname=null,this.info=null,this.chartData=null,this.pdfLink=null,this.questions=o,this.requiredQuestions=a,this.taxa="",this.binary=!0,this.modelList=null,this.storedSpecies=[],this.nextSpecies="",this.previousModel="",this.worksheetEmpty=!1,this.showBackground=!1,this.showMetaData=!1,this.existingFeedback=[],this.project_id=null,this.showMetadata=!1,this.speciesIndex=0,this.taxaDatasets={amphibians:"83cfa8fb-dd6e-4031-8215-1079abddb8a7",ants:null,butterflies:"8f316f82-7356-44ee-823d-8f830f241fab",mammals:"ec694c34-bddd-4111-ba99-926a5f7866e8",odonates:"5b1bb9d6-1bf9-4d3b-aec6-3cfbc96d88f7",reptiles:"f00b03ed-8345-4497-b194-3fced6ee155c",trees:"f7b134d9-d2ce-43b2-8f2d-7e6441d7c747"},this.alternativeAnswers={},this.query={scientificname:"",status:"",taxa:""},this.modelFilters={version:"",auc:{value:0,highValue:1},evaluated_by_me:0,evaluated_by_others:0}}ngOnInit(){this.scientificname=this.route.snapshot.paramMap.get("scientificname").replace("_"," "),this.route.queryParams.subscribe(t=>{this.id=t.prediction_id,this.project_id=t.project_id,this.init()});let t=this.route.snapshot.queryParamMap;this.project_id=t.get("project_id"),this.query.scientificname=t.get("scientificname")||"",this.query.status=t.get("status")||"",this.query.taxa=t.get("taxa")||"",this.modelFilters.version=t.get("version")||"",this.modelFilters.auc.value=Number(t.get("aucMin"))||0,this.modelFilters.auc.highValue=Number(t.get("aucMax"))||1,this.predictionsService.predictionsRequested||this.predictionsService.predictions("A",this.project_id,this.query,this.modelFilters),this.auth.currentUser.subscribe(t=>{this.role=t.role});let e=JSON.parse(localStorage.getItem("Species")||"{}"),n=JSON.parse(localStorage.getItem("EvaluatedSpecies")||"{}");e.length>0&&n.length>0&&n.forEach(t=>{e.splice(e.indexOf(t.replace("_"," ")),1)})}init(){this.predictionsService.speciesDetailed(this.scientificname,this.id).pipe(Object(fs.a)(1)).subscribe(t=>{this.info=t.predictions.find(this.id?t=>t.prediction_id===this.id:t=>1===t.model_rank),this.info||(this.info=t.predictions[0]),this.id||(this.id=this.info.prediction_id),this.pdfLink=t.pdf,this.modelList=t.predictions,this.chartData=t.roc;let e=this.taxaDatasets[this.info.taxa];if(e){let t=this.scientificname.split(" ").slice(0,2).join(" ");this.mapService.updateTileParams({url:`https://next-tiles.mol.org/0.x/tiles/species/detailed/3857/{z}/{x}/{y}.mvt?scientificname=${t}&dsids=${e}`,index:0})}this.mapService.updateTileParams({url:t.range_map.url,index:1}),this.mapService.updateGeoJsonFeatures(t.points),this.updateBounds(t.points),this.predictionOptions={max:4*this.info.sps_threshold,min:this.info.sps_threshold,binary:this.binary},this.refreshMap(this.predictionOptions),this.taxa=this.info.taxa,this.links=[{name:"Prediction Table",route:"/predictions/taxa/"+this.taxa,data:Object.assign({prediction_id:null,project_id:this.project_id},this.route.snapshot.queryParams)}],this.getNonSpatialFeedback()})}updateThreshold(t){this.alternativeAnswers={alternative_threshold:t}}updateBounds(t){let e=t.features.filter(t=>"Occurrence"===t.properties.what)[0];e=e.geometry.coordinates;let n=e.map(t=>t[1]),i=e.map(t=>t[0]),r=Math.min(...n),s=Math.min(...i),o=Math.max(...n),a=Math.max(...i);this.mapService.zoomToDatasetExtent({buffer:100,northEast:{lat:o,lng:a},southWest:{lat:r,lng:s}})}fetchPoints(t){this.showBackground=t,this.predictionsService.fetchPoints(this.id,this.showBackground).subscribe(t=>{this.mapService.updateGeoJsonFeatures(t),this.updateBounds(t)})}refreshMap(t){this.binary=t.binary,this.predictionOptions=Object.assign({},t),this.predictionsService.fetchMap(this.id,t).pipe(Object(ds.a)(500)).subscribe(t=>{this.mapService.updateTileParams({url:t.url,index:2})})}modelChange(t){this.id=t,this.predictionsService.fetchMap(this.id,void 0).subscribe(t=>{this.mapService.updateTileParams({url:t.url,index:2})}),this.predictionsService.fetchROC(this.id).subscribe(t=>{this.chartData=t.roc}),this.info=this.modelList.find(t=>t.prediction_id===this.id),this.router.navigate([],{relativeTo:this.route,queryParams:{prediction_id:this.id},queryParamsHandling:"merge"})}updateMinFromROC(t){this.refreshMap({binary:this.predictionOptions.binary,min:t,max:this.predictionOptions.max})}updateMinMaxThreshold(t){console.log("update min max",t),this.refreshMap({binary:this.predictionOptions.binary,min:t.min,max:t.max})}openMetadataDialog(t){if("rangemap"===t){let t=this.taxaDatasets[this.info.taxa];t&&this.datasetService.metadata(t).subscribe(e=>{this.matDialog.open(ps.d,{data:{info:e.metadata,dataset_id:t,heading:"Expert range map for "+this.info.taxa}})})}else this.matDialog.open(g,{height:"80%",width:"800px",data:{info:Object.assign(Object.assign({},this.info),this.info.modelinfo)}})}getNextSpecies(){this.speciesIndex+=1,this.getSpecies()}getSpecies(){let t=this.predictionsService.getSpeciesAtIndex(this.speciesIndex);this.scientificname=t.scientificname.split(" ").join("_"),this.id=t.prediction_id,this.router.navigate(["/predictions/species/",this.scientificname],{queryParams:Object.assign(Object.assign({prediction_id:this.id,project_id:this.project_id},this.query),this.modelFilters),relativeTo:this.route})}getPreviousSpecies(){this.speciesIndex>0&&(this.speciesIndex-=1),this.getSpecies()}speciesEvaluated(){let t=[],e=[],n=[],i=this.id;Object.keys(localStorage),null!==localStorage.getItem("Evaluated")?(t=JSON.parse(localStorage.getItem("Evaluated")||"{}"),-1===t.indexOf(i)&&t.push(i)):t.push(i),null!==localStorage.getItem("EvaluatedSpecies")?(e=JSON.parse(localStorage.getItem("EvaluatedSpecies")),-1===e.indexOf(this.scientificname)&&e.push(this.scientificname)):e.push(this.scientificname),localStorage.setItem("EvaluatedSpecies",JSON.stringify(e)),n=JSON.parse(localStorage.getItem("Species")||"{}"),n.length>0&&e.forEach(t=>{n.splice(n.indexOf(t.replace("_"," ")),1)}),localStorage.setItem("Evaluated",JSON.stringify(t))}feedbackSubmitted(t){this.auth.currentUser.pipe(Object(ls.switchMap)(e=>this.predictionsService.submitNonSpatialFeedback(e.id,this.id,t)),Object(hs.catchError)(t=>Object(us.a)(t))).subscribe(t=>{this.openSnackBar(t.message,"Close"),this.speciesEvaluated()},t=>{this.openSnackBar(t,"Close")}),JSON.parse(localStorage.getItem("Species")||"{}")}getNonSpatialFeedback(){this.predictionsService.getNonSpatialFeedback(this.id).subscribe(t=>{t.forEach(t=>{const e=t.detailed.prediction_overall_rating,n=o[0].questions[0].options.findIndex(t=>t.value==e),i=o[0].questions[0].options[n];t.detailed.prediction_overall_rating=void 0!==i?i.display:t.detailed.prediction_overall_rating,t.feedback_id=t.feedback_id,t.created_at=t.created_at.slice(0,16);const r=o[0].questions[2].options;let s=[];t.detailed.prediction_issues_present&&(t.detailed.prediction_issues_present.forEach(t=>{const e=r.findIndex(e=>e.value==t);s.push(r[e].display)}),t.detailed.prediction_issues_present=s.toString().replace(",",", "));const a=o[1].questions[0].options;let c=[];t.detailed.points_issues_present&&(t.detailed.points_issues_present.forEach(t=>{const e=a.findIndex(e=>e.value==t);c.push(a[e].display)}),t.detailed.points_issues_present=c.toString().replace(",",", "));const u=o[2].questions[0].options;let l=[];t.detailed.range_issues_present&&(t.detailed.range_issues_present.forEach(t=>{const e=u.findIndex(e=>e.value==t);l.push(u[e].display)}),t.detailed.range_issues_present=l.toString().replace(",",", "))}),this.existingFeedback=t})}handleFeedbackError(t){this.openSnackBar("Please fill out the required questions","Close"),console.error("feedback error: ",t)}openSnackBar(t,e){this._snackBar.open(t,e)}getPDF(){window.open(this.pdfLink,"_blank")}ngOnDestroy(){this.mapService.updateTileParams({url:"OFF",index:0}),this.mapService.updateTileParams({url:"OFF",index:1}),this.mapService.updateTileParams({url:"OFF",index:2}),this.mapService.updateGeoJsonFeatures({type:"FeatureCollection",features:[]})}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(s.d),l.Pb(s.e),l.Pb(s.c),l.Pb(r.a),l.Pb(r.f),l.Pb(s.b),l.Pb(u.b),l.Pb(Ar.a),l.Pb(s.j))},t.\u0275cmp=l.Jb({type:t,selectors:[["mol-predictions-root"]],viewQuery:function(t,e){var n;1&t&&l.Nc(Zs,!0),2&t&&l.sc(n=l.ec())&&(e.modelInfo=n.first)},decls:11,vars:6,consts:[[3,"links"],[1,"predictions-container"],["mode","side","opened","",1,"drawer"],[3,"id","project_id","info","modelList","predictionOptions","scientificname","minThreshold","maxThreshold","worksheetEmpty","showBackground","refreshPrediction","modelChange","nextSpecies","previousSpecies","openMetadata","updateThreshold","PDF",4,"ngIf"],["class","metadata-button","mat-raised-button","",3,"click",4,"ngIf"],[3,"chartData","updateMin",4,"ngIf"],[4,"ngIf"],[1,"map-container"],["mode","experts"],[3,"id","project_id","info","modelList","predictionOptions","scientificname","minThreshold","maxThreshold","worksheetEmpty","showBackground","refreshPrediction","modelChange","nextSpecies","previousSpecies","openMetadata","updateThreshold","PDF"],["mat-raised-button","",1,"metadata-button",3,"click"],[3,"chartData","updateMin"]],template:function(t,e){1&t&&(l.Qb(0,"mol-nav",0),l.Vb(1,"mat-drawer-container",1),l.Vb(2,"mat-drawer",2),l.Fc(3,Gs,1,9,"mol-model-info",3),l.Fc(4,Ks,3,3,"button",4),l.Fc(5,to,1,1,"mol-roc-chart",5),l.Fc(6,eo,1,0,"mat-divider",6),l.Fc(7,no,1,0,"mat-divider",6),l.Ub(),l.Vb(8,"mat-drawer-content",7),l.Qb(9,"mol-spinner"),l.Qb(10,"mol-map",8),l.Ub(),l.Ub()),2&t&&(l.mc("links",e.links),l.Cb(3),l.mc("ngIf",e.info),l.Cb(1),l.mc("ngIf",e.info),l.Cb(1),l.mc("ngIf",e.info&&e.showMetadata),l.Cb(1),l.mc("ngIf",e.info),l.Cb(1),l.mc("ngIf",e.info))},directives:[bs.a,qs,zs,i.t,Bs,$s.a,Js.a,cs,Tr.b,Qs,Fr.a],pipes:[Rr.c],styles:[".predictions-container[_ngcontent-%COMP%]{height:calc(100vh - 52px - 85px)}mat-drawer-container[_ngcontent-%COMP%]{box-shadow:3px 0 2px -2px #aaa}.drawer[_ngcontent-%COMP%], mat-drawer-container[_ngcontent-%COMP%]{overflow-x:hidden;overflow-y:auto}.drawer[_ngcontent-%COMP%]{width:400px;min-height:100%} .mat-drawer-inner-container{overflow-x:hidden!important}.card-title[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.metadata-button[_ngcontent-%COMP%]{margin:5px 0 5px 5px}"]}),t})()}];let ro=(()=>{class t{}return t.\u0275mod=l.Nb({type:t}),t.\u0275inj=l.Mb({factory:function(e){return new(e||t)},imports:[[i.c,r.j.forChild(io)],r.j]}),t})();var so=n("M0ag"),oo=n("+Tre"),ao=n("nKqi");let co=(()=>{class t{}return t.\u0275mod=l.Nb({type:t}),t.\u0275inj=l.Mb({factory:function(e){return new(e||t)},imports:[[i.c,so.a,ps.c,kr.d,Fr.b,Ys,jr.b,Ir.b,ps.b,Tr.c,Cr.b,y.l,y.B,Fr.b,Pr.c,oo.b,Ws.c,Or.b,ps.f,ps.e,u.f,Mr.b,ps.a,Ur.d,ao.b,Rr.b]]}),t})(),uo=(()=>{class t{}return t.\u0275mod=l.Nb({type:t}),t.\u0275inj=l.Mb({factory:function(e){return new(e||t)},imports:[[ro,co]]}),t})()},QuXn:function(t,e,n){"use strict";var i=!1;e.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){var e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else i&&console.log("RxJS: Back to a better error behavior. Thank you. <3");i=t},get useDeprecatedSynchronousErrorHandling(){return i}}},R4cV:function(t,e,n){"use strict";var i=n("qiMw"),r=n("ihxi"),s=n("4mxr");e.from=function(t,e){return e?s.scheduled(t,e):t instanceof i.Observable?t:new i.Observable(r.subscribeTo(t))}},RKpm:function(t,e,n){"use strict";e.identity=function(t){return t}},SSAN:function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=n("dmvN"),s=n("d4zx"),o=n("kZSD");e.catchError=function(t){return function(e){var n=new a(t),i=e.lift(n);return n.caught=i}};var a=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.selector,this.caught))},t}(),c=function(t){function e(e,n,i){var r=t.call(this,e)||this;return r.selector=n,r.caught=i,r}return i(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=void 0;try{n=this.selector(e,this.caught)}catch(a){return void t.prototype.error.call(this,a)}this._unsubscribeAndRecycle();var i=new s.InnerSubscriber(this,void 0,void 0);this.add(i);var r=o.subscribeToResult(this,n,void 0,void 0,i);r!==i&&this.add(r)}},e}(r.OuterSubscriber)},VTS6:function(t,e,n){"use strict";e.isArrayLike=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t}},Yfti:function(t,e,n){"use strict";var i=n("1hPV"),r=n("7oWP"),s=n("uzuk");e.toSubscriber=function(t,e,n){if(t){if(t instanceof i.Subscriber)return t;if(t[r.rxSubscriber])return t[r.rxSubscriber]()}return t||e||n?new i.Subscriber(t,e,n):new i.Subscriber(s.empty)}},ZGdk:function(t,e,n){"use strict";e.UnsubscriptionError=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}()},a96P:function(t,e,n){"use strict";e.isObject=function(t){return null!==t&&"object"==typeof t}},d0I2:function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=n("1hPV");e.map=function(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new s(t,e))}};var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new o(t,this.project,this.thisArg))},t}();e.MapOperator=s;var o=function(t){function e(e,n,i){var r=t.call(this,e)||this;return r.project=n,r.count=0,r.thisArg=i||r,r}return i(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(n){return void this.destination.error(n)}this.destination.next(e)},e}(r.Subscriber)},d4zx:function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();e.InnerSubscriber=function(t){function e(e,n,i){var r=t.call(this)||this;return r.parent=e,r.outerValue=n,r.outerIndex=i,r.index=0,r}return i(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(n("1hPV").Subscriber)},dmvN:function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();e.OuterSubscriber=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.notifyNext=function(t,e,n,i,r){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(n("1hPV").Subscriber)},i6J5:function(t,e,n){"use strict";var i=n("qiMw"),r=n("6Br6"),s=n("7bXj");e.scheduleIterable=function(t,e){if(!t)throw new Error("Iterable cannot be null");return new i.Observable((function(n){var i,o=new r.Subscription;return o.add((function(){i&&"function"==typeof i.return&&i.return()})),o.add(e.schedule((function(){i=t[s.iterator](),o.add(e.schedule((function(){if(!n.closed){var t,e;try{var r=i.next();t=r.value,e=r.done}catch(s){return void n.error(s)}e?n.complete():(n.next(t),this.schedule())}})))}))),o}))}},i84P:function(t,e,n){"use strict";var i=n("qiMw"),r=n("6Br6");e.schedulePromise=function(t,e){return new i.Observable((function(n){var i=new r.Subscription;return i.add(e.schedule((function(){return t.then((function(t){i.add(e.schedule((function(){n.next(t),i.add(e.schedule((function(){return n.complete()})))})))}),(function(t){i.add(e.schedule((function(){return n.error(t)})))}))}))),i}))}},ihxi:function(t,e,n){"use strict";var i=n("sBpz"),r=n("lTUY"),s=n("GB03"),o=n("Lbxd"),a=n("VTS6"),c=n("xKJD"),u=n("a96P"),l=n("7bXj"),h=n("k/06");e.subscribeTo=function(t){if(t&&"function"==typeof t[h.observable])return o.subscribeToObservable(t);if(a.isArrayLike(t))return i.subscribeToArray(t);if(c.isPromise(t))return r.subscribeToPromise(t);if(t&&"function"==typeof t[l.iterator])return s.subscribeToIterable(t);var e=u.isObject(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+e+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},"k/06":function(t,e,n){"use strict";e.observable=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},kZSD:function(t,e,n){"use strict";var i=n("d4zx"),r=n("ihxi"),s=n("qiMw");e.subscribeToResult=function(t,e,n,o,a){if(void 0===a&&(a=new i.InnerSubscriber(t,n,o)),!a.closed)return e instanceof s.Observable?e.subscribe(a):r.subscribeTo(e)(a)}},lTUY:function(t,e,n){"use strict";var i=n("tpAt");e.subscribeToPromise=function(t){return function(e){return t.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,i.hostReportError),e}}},qiMw:function(t,e,n){"use strict";var i=n("JJ8B"),r=n("Yfti"),s=n("k/06"),o=n("E/Xc"),a=n("QuXn");function c(t){if(t||(t=a.config.Promise||Promise),!t)throw new Error("no Promise impl found");return t}e.Observable=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var i=this.operator,s=r.toSubscriber(t,e,n);if(s.add(i?i.call(s,this.source):this.source||a.config.useDeprecatedSynchronousErrorHandling&&!s.syncErrorThrowable?this._subscribe(s):this._trySubscribe(s)),a.config.useDeprecatedSynchronousErrorHandling&&s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),i.canReportError(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=c(e))((function(e,i){var r;r=n.subscribe((function(e){try{t(e)}catch(n){i(n),r&&r.unsubscribe()}}),i,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[s.observable]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e{if(-1==(t-=1))return{display:"None",value:-1};let e=t%2==0;return{display:`row: ${Math.round((t+1)/2)}, ${e?"right":"left"}`,value:t}})}]},{heading:"Points",questions:[{id:"points_issues_present",type:"select-checkbox",label:"Are there any issues with the occurrences?",options:[{display:"Missing critical known subpopulation",value:"missing_subpopulation"},{display:"Possible outliers",value:"outliers"},{display:"Possible Cleaning failure",value:"cleaning_outliers_failure"},{display:"Severe sampling bias",value:"sampling_bias"}]},{id:"points_comments",type:"input",label:"General points comments?",placeholder:"..."}]},{heading:"Range",questions:[{id:"range_issues_present",type:"select-checkbox",label:"Are there any issues with the range?",options:[{display:"Range map imprecise",value:"range_map_imprecise"},{display:"Range map too broad",value:"range_map_too_broad"},{display:"Range map missing subpopulation",value:"range_map_missing_subpopulation"}]},{id:"range_comments",type:"input",label:"General rangemap comments?",placeholder:"..."}]},{heading:"Taxonomy feedback",questions:[{id:"taxonomy_comments",type:"input",label:"Are there any taxonomic issues with any part of this species?",placeholder:"..."}]}],a=["prediction_overall_rating"],c=[{title:"Prediction: False presence",name:"fb_false_presence",description:""},{title:"Prediction: False absence",name:"fb_false_absence",description:""},{title:"Prediction: Potential prediction artifacts",name:"fb_pred_artifacts",description:""},{title:"Prediction: Prefer an alternate threshold",name:"fb_alt_threshold",description:""},{title:"Prediction: Does not match expert range",name:"fb_range_not_matched",description:""},{title:"Range: Incorrect range/name misalignment",name:"fb_alignment_issue",description:""},{title:"Occurrence: Filtering issue",name:"fb_points_issue",description:""},{title:"Other: Species is not native to the range",name:"fb_nonnative",description:""},{title:"Other: Taxonomic issue",name:"fb_tax_issue",description:""},{title:"Other: Fatal technical issue",name:"fb_tech_issue",description:""},{title:"Other",name:"fb_other",description:""}];var u=n("OZ4H"),l=n("EM62");function h(t,e){if(1&t&&(l.Vb(0,"td"),l.Hc(1),l.ic(2,"number"),l.Ub()),2&t){const t=l.hc().$implicit;l.Cb(1),l.Ic(l.jc(2,1,t.value))}}function f(t,e){if(1&t&&(l.Vb(0,"td"),l.Hc(1),l.Ub()),2&t){const t=l.hc().$implicit;l.Cb(1),l.Jc(" ",t.value," ")}}function d(t,e){if(1&t&&(l.Vb(0,"li"),l.Hc(1),l.Ub()),2&t){const t=e.$implicit;l.Cb(1),l.Ic(t)}}function p(t,e){if(1&t&&(l.Vb(0,"td"),l.Vb(1,"ul"),l.Fc(2,d,2,1,"li",1),l.Ub(),l.Ub()),2&t){const t=l.hc().$implicit;l.Cb(2),l.mc("ngForOf",t.value)}}function b(t,e){if(1&t&&(l.Vb(0,"tr"),l.Vb(1,"th"),l.Hc(2),l.Ub(),l.Fc(3,h,3,3,"td",0),l.Fc(4,f,2,1,"td",0),l.Fc(5,p,3,1,"td",0),l.Ub()),2&t){const t=e.$implicit;l.Cb(2),l.Ic(t.name),l.Cb(1),l.mc("ngIf","number"===t.type),l.Cb(1),l.mc("ngIf",!t.type),l.Cb(1),l.mc("ngIf","list"===t.type)}}function m(t,e){if(1&t&&(l.Vb(0,"div"),l.Vb(1,"h4"),l.Hc(2,"Model Metadata"),l.Ub(),l.Vb(3,"table"),l.Fc(4,b,6,4,"tr",1),l.Ub(),l.Ub()),2&t){const t=l.hc();l.Cb(4),l.mc("ngForOf",t.modelInfo)}}let g=(()=>{class t{constructor(t){this.data=t,this.info=t.info,this.setMetadata()}ngOnInit(){}ngOnChanges(t){t.info&&this.setMetadata()}setMetadata(){this.modelInfo=[{name:"Taxa",value:this.info.taxa},{name:"Scientific Name",value:this.info.scientificname.replaceAll("_"," ")},{name:"Season",value:this.info.season||"N/A"},{name:"Landcover",value:this.info.landcover||"N/A"},{name:"Prediction Name",value:this.info.prediction_name},{name:"Prediction Rank",value:this.info.prediction_rank},{name:"AUC",value:this.info.AUC,type:"number"},{name:"Boyce",value:this.info.Boyce},{name:"Elevation Offset",value:this.info.elevOffset},{name:"Range Offset",value:this.info.rangeOffset},{name:"Range Area",value:this.info.range_area,type:"number"},{name:"Number of Points",value:this.info.noPts},{name:"Sensitivity",value:this.info.Sensitivity},{name:"Specificity",value:this.info.Specificity},{name:"Model Version",value:this.info.version},{name:"SPS Threshold",value:this.info.SPSthreshold},{name:"TSS",value:this.info.TSS},{name:"Environmental Variables",value:this.info.envVars.split("|"),type:"list"}]}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(u.a))},t.\u0275cmp=l.Jb({type:t,selectors:[["mol-metadata"]],features:[l.Ab],decls:1,vars:1,consts:[[4,"ngIf"],[4,"ngFor","ngForOf"]],template:function(t,e){1&t&&l.Fc(0,m,5,1,"div",0),2&t&&l.mc("ngIf",e.info)},directives:[i.t,i.s],pipes:[i.g],styles:["table[_ngcontent-%COMP%]{border:1px solid #000;width:100%;border-collapse:collapse}table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{font-weight:700;width:40%;text-align:left;padding-left:4px}table[_ngcontent-%COMP%] td[_ngcontent-%COMP%], table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{border:1px solid #afafaf;padding-top:6px;padding-bottom:6px;font-size:14pt}table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{-moz-column-span:2;column-span:2;width:60%;text-align:center;word-wrap:break-word;word-break:break-all;text-align:left;padding-left:6px}h4[_ngcontent-%COMP%]{text-align:center;font-weight:700;font-size:20pt}"]}),t})();var _,v,y=n("nIj0"),w=function(t,e){return te?1:t>=e?0:NaN};1===(_=w).length&&(v=_,_=function(t,e){return w(v(t),e)}),Math.sqrt(50),Math.sqrt(10),Math.sqrt(2);var x={value:function(){}};function C(){for(var t,e=0,n=arguments.length,i={};e=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function O(t,e){for(var n,i=0,r=t.length;i0)for(var n,i,r=new Array(n),s=0;se?1:t>=e?0:NaN}I.prototype={constructor:I,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var R="http://www.w3.org/1999/xhtml",L={svg:"http://www.w3.org/2000/svg",xhtml:R,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},H=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),L.hasOwnProperty(e)?{space:L[e],local:t}:t};function B(t){return function(){this.removeAttribute(t)}}function z(t){return function(){this.removeAttributeNS(t.space,t.local)}}function q(t,e){return function(){this.setAttribute(t,e)}}function Y(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function $(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function J(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}var W=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function X(t){return function(){this.style.removeProperty(t)}}function Q(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Z(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function G(t,e){return t.style.getPropertyValue(e)||W(t).getComputedStyle(t,null).getPropertyValue(e)}function K(t){return function(){delete this[t]}}function tt(t,e){return function(){this[t]=e}}function et(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function nt(t){return t.trim().split(/^|\s+/)}function it(t){return t.classList||new rt(t)}function rt(t){this._node=t,this._names=nt(t.getAttribute("class")||"")}function st(t,e){for(var n=it(t),i=-1,r=e.length;++i=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var yt=function(t){var e=H(t);return(e.local?vt:_t)(e)};function wt(){return null}function xt(){var t=this.parentNode;t&&t.removeChild(this)}function Ct(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function kt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}var St={},Ot=null;function Mt(t,e,n){return t=Pt(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function Pt(t,e,n){return function(i){var r=Ot;Ot=i;try{t.call(this,this.__data__,e,n)}finally{Ot=r}}}function Ft(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function Tt(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,s=e.length;i=w&&(w=y+1);!(v=g[w])&&++w=0;)(i=r[s])&&(o&&4^i.compareDocumentPosition(o)&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=N);for(var n=this._groups,i=n.length,r=new Array(i),s=0;s1?this.each((null==e?X:"function"==typeof e?Z:Q)(t,e,null==n?"":n)):G(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?K:"function"==typeof e?et:tt)(t,e)):this.node()[t]},classed:function(t,e){var n=nt(t+"");if(arguments.length<2){for(var i=it(this.node()),r=-1,s=n.length;++rs&&(r=e.slice(s,r),a[o]?a[o]+=r:a[++o]=r),(n=n[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,c.push({i:o,x:zt(n,i)})),s=Yt.lastIndex;return s=0&&e._call.call(null,t),e=e._next;--Jt}()}finally{Jt=0,function(){for(var t,e,n=Nt,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Nt=e);Rt=t,ae(i)}(),Zt=0}}function oe(){var t=Kt.now(),e=t-Qt;e>1e3&&(Gt-=e,Qt=t)}function ae(t){Jt||(Wt&&(Wt=clearTimeout(Wt)),t-Zt>24?(t<1/0&&(Wt=setTimeout(se,t-Kt.now()-Gt)),Xt&&(Xt=clearInterval(Xt))):(Xt||(Qt=Kt.now(),Xt=setInterval(oe,1e3)),Jt=1,te(se)))}ie.prototype=re.prototype={constructor:ie,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?ee():+n)+(null==e?0:+e),this._next||Rt===this||(Rt?Rt._next=this:Nt=this,Rt=this),this._call=t,this._time=n,ae()},stop:function(){this._call&&(this._call=null,this._time=1/0,ae())}};var ce=function(t,e,n){var i=new ie;return i.restart((function(n){i.stop(),t(n+e)}),e=null==e?0:+e,n),i},ue=P("start","end","cancel","interrupt"),le=[],he=function(t,e,n,i,r,s){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var i,r=t.__transition;function s(c){var u,l,h,f;if(1!==n.state)return a();for(u in r)if((f=r[u]).name===n.name){if(3===f.state)return ce(s);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete r[u]):+u0)throw new Error("too late; already scheduled");return n}function de(t,e){var n=pe(t,e);if(n.state>3)throw new Error("too late; already running");return n}function pe(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var be,me,ge,_e,ve=180/Math.PI,ye={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},we=function(t,e,n,i,r,s){var o,a,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*n+e*i)&&(n-=t*c,i-=e*c),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,c/=a),t*i180?e+=360:e-t>180&&(t+=360),s.push({i:n.push(r(n)+"rotate(",null,i)-2,x:zt(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(s.rotate,o.rotate,a,c),function(t,e,n,s){t!==e?s.push({i:n.push(r(n)+"skewX(",null,i)-2,x:zt(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(s.skewX,o.skewX,a,c),function(t,e,n,i,s,o){if(t!==n||e!==i){var a=s.push(r(s)+"scale(",null,",",null,")");o.push({i:a-4,x:zt(t,n)},{i:a-2,x:zt(e,i)})}else 1===n&&1===i||s.push(r(s)+"scale("+n+","+i+")")}(s.scaleX,s.scaleY,o.scaleX,o.scaleY,a,c),s=o=null,function(t){for(var e,n=-1,i=c.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?fe:de;return function(){var o=s(this,t),a=o.on;a!==i&&(r=(i=a).copy()).on(e,n),o.on=r}}var Ye=Lt.prototype.constructor;function $e(t){return function(){this.style.removeProperty(t)}}function Je(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function We(t,e,n){var i,r;function s(){var s=e.apply(this,arguments);return s!==r&&(i=(r=s)&&Je(t,s,n)),i}return s._value=e,s}function Xe(t){return function(e){this.textContent=t.call(this,e)}}function Qe(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&Xe(i)),e}return i._value=t,i}var Ze=0;function Ge(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Ke(){return++Ze}var tn=Lt.prototype;Ge.prototype=(function(t){return Lt().transition(t)}).prototype={constructor:Ge,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=T(t));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete s[r]):o=!1;o&&delete t.__transition}}(this,t)}))},Lt.prototype.transition=function(t){var e,n;t instanceof Ge?(e=t._id,t=t._name):(e=Ke(),(n=en).time=ee(),t=null==t?null:t+"");for(var i=this._groups,r=i.length,s=0;s1e-6)if(Math.abs(l*a-c*u)>1e-6&&r){var f=n-s,d=i-o,p=a*a+c*c,b=f*f+d*d,m=Math.sqrt(p),g=Math.sqrt(h),_=r*Math.tan((sn-Math.acos((p+h-b)/(2*m*g)))/2),v=_/g,y=_/m;Math.abs(v-1)>1e-6&&(this._+="L"+(t+v*u)+","+(e+v*l)),this._+="A"+r+","+r+",0,0,"+ +(l*f>u*d)+","+(this._x1=t+y*a)+","+(this._y1=e+y*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e)},arc:function(t,e,n,i,r,s){t=+t,e=+e,s=!!s;var o=(n=+n)*Math.cos(i),a=n*Math.sin(i),c=t+o,u=e+a,l=1^s,h=s?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+u:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-u)>1e-6)&&(this._+="L"+c+","+u),n&&(h<0&&(h=h%on+on),h>an?this._+="A"+n+","+n+",0,1,"+l+","+(t-o)+","+(e-a)+"A"+n+","+n+",0,1,"+l+","+(this._x1=c)+","+(this._y1=u):h>1e-6&&(this._+="A"+n+","+n+",0,"+ +(h>=sn)+","+l+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}},un.prototype=ln.prototype={constructor:un,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var fn=ln.prototype;function dn(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,s,o,a,c,u,l,h,f,d=t._root,p={data:i},b=t._x0,m=t._y0,g=t._x1,_=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((u=e>=(s=(b+g)/2))?b=s:g=s,(l=n>=(o=(m+_)/2))?m=o:_=o,r=d,!(d=d[h=l<<1|u]))return r[h]=p,t;if(a=+t._x.call(null,d.data),c=+t._y.call(null,d.data),e===a&&n===c)return p.next=d,r?r[h]=p:t._root=p,t;do{r=r?r[h]=new Array(4):t._root=new Array(4),(u=e>=(s=(b+g)/2))?b=s:g=s,(l=n>=(o=(m+_)/2))?m=o:_=o}while((h=l<<1|u)==(f=(c>=o)<<1|a>=s));return r[f]=d,r[h]=p,t}hn.prototype=(function(t,e){var n=new hn;if(t instanceof hn)t.each((function(t){n.add(t)}));else if(t){var i=-1,r=t.length;if(null==e)for(;++il&&(l=i),rh&&(h=r));if(c>l||u>h)return this;for(this.cover(c,u).cover(l,h),n=0;nt||t>=r||i>e||e>=s;)switch(a=(ef||(s=c.y0)>d||(o=c.x1)=g)<<1|t>=m)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=c)}else{var _=t-+this._x.call(null,b.data),v=e-+this._y.call(null,b.data),y=_*_+v*v;if(y=(a=(p+m)/2))?p=a:m=a,(l=o>=(c=(b+g)/2))?b=c:g=c,e=d,!(d=d[h=l<<1|u]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,f=h)}for(;d.data!==t;)if(i=d,!(d=d.next))return this;return(r=d.next)&&delete d.next,i?(r?i.next=r:delete i.next,this):e?(r?e[h]=r:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[f]=d:this._root=d),this):(this._root=r,this)},vn.removeAll=function(t){for(var e=0,n=t.length;e1);return t+n*s*Math.sqrt(-2*Math.log(r)/r)}}return n.source=t,n}(yn)),xn=(function t(e){function n(){var t=wn.source(e).apply(this,arguments);return function(){return Math.exp(t())}}return n.source=t,n}(yn),function t(e){function n(t){return function(){for(var n=0,i=0;i=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function kn(t){if(!(e=Cn.exec(t)))throw new Error("invalid format: "+t);var e;return new Sn({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Sn(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}kn.prototype=Sn.prototype,Sn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var On,Mn=Array.prototype.map;void 0===(On={decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}).grouping||void 0===On.thousands||Mn.call(On.grouping,Number),void 0===On.numerals||Mn.call(On.numerals,String);var Pn=new Date,Fn=new Date;function Tn(t,e,n,i){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=function(e){return t(e=new Date(+e)),e},r.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},r.round=function(t){var e=r(t),n=r.ceil(t);return t-e0))return a;do{a.push(o=new Date(+n)),e(n,s),t(n)}while(o=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,i){if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););}))},n&&(r.count=function(e,i){return Pn.setTime(+e),Fn.setTime(+i),t(Pn),t(Fn),Math.floor(n(Pn,Fn))},r.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?function(e){return i(e)%t==0}:function(e){return r.count(0,e)%t==0}):r:null}),r}var Un=Tn((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Un.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Tn((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var En=Un;function Dn(t){return Tn((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}Tn((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}));var jn=Dn(0),In=Dn(1),An=(Dn(2),Dn(3),Dn(4)),Vn=(Dn(5),Dn(6),Tn((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1}))),Nn=(Tn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),Tn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),Tn((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),Tn((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t})));function Rn(t){return Tn((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}Nn.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Tn((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Nn:null};var Ln=Rn(0),Hn=Rn(1),Bn=(Rn(2),Rn(3),Rn(4)),zn=(Rn(5),Rn(6),Tn((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}))),qn=Tn((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));qn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Tn((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Yn=qn;var $n={"-":"",_:" ",0:"0"},Jn=/[\\^$*+?|[\]().{}]/g;function Wn(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",s=r.length;return i+(s=4||0===e?An(t):An.ceil(t)}function li(t,e){return t=ui(t),Wn(An.count(En(t),t)+(4===En(t).getDay()),e,2)}function hi(t){return t.getDay()}function fi(t,e){return Wn(In.count(En(t)-1,t),e,2)}function di(t,e){return Wn(t.getFullYear()%100,e,2)}function pi(t,e){return Wn((t=ui(t)).getFullYear()%100,e,2)}function bi(t,e){return Wn(t.getFullYear()%1e4,e,4)}function mi(t,e){var n=t.getDay();return Wn((t=n>=4||0===n?An(t):An.ceil(t)).getFullYear()%1e4,e,4)}function gi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Wn(e/60|0,"0",2)+Wn(e%60,"0",2)}function _i(t,e){return Wn(t.getUTCDate(),e,2)}function vi(t,e){return Wn(t.getUTCHours(),e,2)}function yi(t,e){return Wn(t.getUTCHours()%12||12,e,2)}function wi(t,e){return Wn(1+zn.count(Yn(t),t),e,3)}function xi(t,e){return Wn(t.getUTCMilliseconds(),e,3)}function Ci(t,e){return xi(t,e)+"000"}function ki(t,e){return Wn(t.getUTCMonth()+1,e,2)}function Si(t,e){return Wn(t.getUTCMinutes(),e,2)}function Oi(t,e){return Wn(t.getUTCSeconds(),e,2)}function Mi(t){var e=t.getUTCDay();return 0===e?7:e}function Pi(t,e){return Wn(Ln.count(Yn(t)-1,t),e,2)}function Fi(t){var e=t.getUTCDay();return e>=4||0===e?Bn(t):Bn.ceil(t)}function Ti(t,e){return t=Fi(t),Wn(Bn.count(Yn(t),t)+(4===Yn(t).getUTCDay()),e,2)}function Ui(t){return t.getUTCDay()}function Ei(t,e){return Wn(Hn.count(Yn(t)-1,t),e,2)}function Di(t,e){return Wn(t.getUTCFullYear()%100,e,2)}function ji(t,e){return Wn((t=Fi(t)).getUTCFullYear()%100,e,2)}function Ii(t,e){return Wn(t.getUTCFullYear()%1e4,e,4)}function Ai(t,e){var n=t.getUTCDay();return Wn((t=n>=4||0===n?Bn(t):Bn.ceil(t)).getUTCFullYear()%1e4,e,4)}function Vi(){return"+0000"}function Ni(){return"%"}function Ri(t){return+t}function Li(t){return Math.floor(+t/1e3)}function Hi(){this._=null}function Bi(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function zi(t,e){var n=e,i=e.R,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.R=i.L,n.R&&(n.R.U=n),i.L=n}function qi(t,e){var n=e,i=e.L,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.L=i.R,n.L&&(n.L.U=n),i.R=n}function Yi(t){for(;t.L;)t=t.L;return t}(function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,s=t.days,o=t.shortDays,a=t.months,c=t.shortMonths,u=(Qn(r),Zn(r),Qn(s),Zn(s),Qn(o),Zn(o),Qn(a),Zn(a),Qn(c),Zn(c),{a:function(t){return o[t.getDay()]},A:function(t){return s[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:Gn,e:Gn,f:ii,g:pi,G:mi,H:Kn,I:ti,j:ei,L:ni,m:ri,M:si,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ri,s:Li,S:oi,u:ai,U:ci,V:li,w:hi,W:fi,x:null,X:null,y:di,Y:bi,Z:gi,"%":Ni}),l={a:function(t){return o[t.getUTCDay()]},A:function(t){return s[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:_i,e:_i,f:Ci,g:ji,G:Ai,H:vi,I:yi,j:wi,L:xi,m:ki,M:Si,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ri,s:Li,S:Oi,u:Mi,U:Pi,V:Ti,w:Ui,W:Ei,x:null,X:null,y:Di,Y:Ii,Z:Vi,"%":Ni};function h(t,e){return function(n){var i,r,s,o=[],a=-1,c=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++a0)){if(s/=f,f<0){if(s0){if(s>h)return;s>l&&(l=s)}if(s=i-c,f||!(s<0)){if(s/=f,f<0){if(s>h)return;s>l&&(l=s)}else if(f>0){if(s0)){if(s/=d,d<0){if(s0){if(s>h)return;s>l&&(l=s)}if(s=r-u,d||!(s<0)){if(s/=d,d<0){if(s>h)return;s>l&&(l=s)}else if(d>0){if(s0||h<1)||(l>0&&(t[0]=[c+l*f,u+l*d]),h<1&&(t[1]=[c+h*f,u+h*d]),!0)}}}}}function Zi(t,e,n,i,r){var s=t[1];if(s)return!0;var o,a,c=t[0],u=t.left,l=t.right,h=u[0],f=u[1],d=l[0],p=l[1],b=(h+d)/2;if(p===f){if(b=i)return;if(h>d){if(c){if(c[1]>=r)return}else c=[b,n];s=[b,r]}else{if(c){if(c[1]1)if(h>d){if(c){if(c[1]>=r)return}else c=[(n-a)/o,n];s=[(r-a)/o,r]}else{if(c){if(c[1]=i)return}else c=[e,o*e+a];s=[i,o*i+a]}else{if(c){if(c[0]=-vr)){var d=c*c+u*u,p=l*l+h*h,b=(h*d-u*p)/f,m=(c*p-l*d)/f,g=nr.pop()||new ir;g.arc=t,g.site=r,g.x=b+o,g.y=(g.cy=m+a)+Math.sqrt(b*b+m*m),t.circle=g;for(var _=null,v=mr._;v;)if(g.y_r)a=a.L;else{if(!((r=s-dr(a,o))>_r)){i>-_r?(e=a.P,n=a):r>-_r?(e=a,n=a.N):e=n=a;break}if(!a.R){e=a;break}a=a.R}!function(t){br[t.index]={site:t,halfedges:[]}}(t);var c=cr(t);if(pr.insert(e,c),e||n){if(e===n)return sr(e),n=cr(e.site),pr.insert(c,n),c.edge=n.edge=Ji(e.site,c.site),rr(e),void rr(n);if(n){sr(e),sr(n);var u=e.site,l=u[0],h=u[1],f=t[0]-l,d=t[1]-h,p=n.site,b=p[0]-l,m=p[1]-h,g=2*(f*m-d*b),_=f*f+d*d,v=b*b+m*m,y=[(m*_-d*v)/g+l,(f*v-b*_)/g+h];Xi(n.edge,u,p,y),c.edge=Ji(u,t,null,y),n.edge=Ji(t,p,null,y),rr(e),rr(n)}else c.edge=Ji(e.site,c.site)}}function fr(t,e){var n=t.site,i=n[0],r=n[1],s=r-e;if(!s)return i;var o=t.P;if(!o)return-1/0;var a=(n=o.site)[0],c=n[1],u=c-e;if(!u)return a;var l=a-i,h=1/s-1/u,f=l/u;return h?(-f+Math.sqrt(f*f-2*h*(l*l/(-2*u)-c+u/2+r-s/2)))/h+i:(i+a)/2}function dr(t,e){var n=t.N;if(n)return fr(n,e);var i=t.site;return i[1]===e?i[0]:1/0}var pr,br,mr,gr,_r=1e-6,vr=1e-12;function yr(t,e){return e[1]-t[1]||e[0]-t[0]}function wr(t,e){var n,i,r,s=t.sort(yr).pop();for(gr=[],br=new Array(t.length),pr=new $i,mr=new $i;;)if(r=er,s&&(!r||s[1]_r||Math.abs(r[0][1]-r[1][1])>_r)||delete gr[s]}(o,a,c,u),function(t,e,n,i){var r,s,o,a,c,u,l,h,f,d,p,b,m=br.length,g=!0;for(r=0;r_r||Math.abs(b-f)>_r)&&(c.splice(a,0,gr.push(Wi(o,d,Math.abs(p-t)<_r&&i-b>_r?[t,Math.abs(h-t)<_r?f:i]:Math.abs(b-i)<_r&&n-p>_r?[Math.abs(f-i)<_r?h:n,i]:Math.abs(p-n)<_r&&b-e>_r?[n,Math.abs(h-n)<_r?f:e]:Math.abs(b-e)<_r&&p-t>_r?[Math.abs(f-e)<_r?h:t,e]:null))-1),++u);u&&(g=!1)}if(g){var _,v,y,w=1/0;for(r=0,g=null;r=a)return null;var c=t-r.site[0],u=e-r.site[1],l=c*c+u*u;do{r=s.cells[i=o],o=null,r.halfedges.forEach((function(n){var i=s.edges[n],a=i.left;if(a!==r.site&&a||(a=i.right)){var c=t-a[0],u=e-a[1],h=c*c+u*u;h{class t{constructor(t,e,n,i){this.map=t,this.predictions=e,this.auth=n,this._snackBar=i,this.drawOn=!0,this.addDisabled=!1,this.nowDrawingIn=new l.o,this.setFeatures=new l.o,this.show=!0,this.features={type:"FeatureCollection",features:[]},this.feedbackLabels={false_presence:"False Presence",false_absence:"False Absence",note:"Note"},this.feedbackOptions=[{value:"false_presence",display:""},{value:"false_absence",display:""},{value:"note",display:""}],this.feedbackType="false_presence",this.newFeatureSubscription=null,this.noteField="",this.user="",this.feedbackOptions.forEach(t=>{t.display=this.feedbackLabels[t.value]}),this.auth.currentUser.subscribe(t=>{this.user="MOL_USER_"+t.id})}ngOnInit(){this.newFeatureSubscription=this.map.newUserFeature.subscribe(t=>{console.log("old features",this.features),t&&(t.properties={feedback_id:(this.features.features.length+1).toString(),issue:this.issue,selected:this.drawOn},this.addDisabled&&(this.features.features.push(Object.assign({},t)),this.predictions.setVisibleFeatures(this.issue,this.features),this.setFeatures.emit({issue:this.issue,features:this.features})))})}addFeature(){this.localFeatures=Object.assign({},this.features),this.localFeatures&&this.localFeatures[this.issue]?(this.features=Object.assign({},this.localFeatures[this.issue]),this.features.features.forEach(t=>t.properties.selected=this.drawOn),this.predictions.setVisibleFeatures(this.issue,this.features)):this.features={type:"FeatureCollection",features:[]}}ngOnChanges(t){t.addDisabled||(this._snackBar.dismiss(),this.map.updateMapState("MAP")),null!=t.features&&this.addFeature()}remove(t){this.predictions.removeSpatialFeedback(t,this.id).subscribe(e=>{let n=this.features.features.findIndex(e=>e.properties.feedback_id===t);this.features.features.splice(n,1),this.features.features=this.features.features.map((t,e)=>(t.properties.feedback_index=e+1,t)),this.map.userFeaturesSet(this.features)})}openSnackBar(t,e){this._snackBar.open(t,e,{panelClass:["in-draw"]})}add(){this.addDisabled=!this.addDisabled,this.addDisabled?this.openSnackBar("Now drawing spatial feedback for: "+this.issue,""):this._snackBar.dismiss(),this.nowDrawingIn.emit(this.issue),this.map.updateMapState(this.addDisabled?"DRAW":"MAP")}showInfo(){}init(){this.predictions.fetchSpatialFeedback(this.id).subscribe(t=>{this.features=t,this.map.userFeaturesSet(this.features)})}getKeepFeatures(t,e=!1){let n={type:"FeatureCollection",features:[]};for(var i in this.localFeatures)(i!=t||e)&&(console.log("feature key",this.localFeatures[i]),n.features.push(...this.localFeatures[i].features));return n}ngOnDestroy(){this.newFeatureSubscription.unsubscribe(),this.predictions.removeVisibleFeatures(this.issue)}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(s.d),l.Pb(s.e),l.Pb(s.b),l.Pb(Ar.a))},t.\u0275cmp=l.Jb({type:t,selectors:[["mol-spatial-feedback"]],inputs:{id:"id",scientificname:"scientificname",issue:"issue",drawOn:"drawOn",addDisabled:"addDisabled",clear:"clear",features:"features"},outputs:{nowDrawingIn:"nowDrawingIn",setFeatures:"setFeatures"},features:[l.Ab],decls:1,vars:1,consts:[["mat-icon-button","",3,"click",4,"ngIf"],["mat-icon-button","",3,"click"],[3,"color"]],template:function(t,e){1&t&&l.Fc(0,Vr,3,1,"button",0),2&t&&l.mc("ngIf",e.drawOn)},directives:[i.t,Tr.b,jr.a],styles:[".card-title[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.card-title[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0}.card-title.feedback-list[_ngcontent-%COMP%]{width:100%}.card-title[_ngcontent-%COMP%] .left[_ngcontent-%COMP%]{display:flex;flex-direction:row}[_nghost-%COMP%]{width:95%}.note-text[_ngcontent-%COMP%]{line-height:smaller;font-size:smaller;color:#7f7f7f;padding-left:15px}.mat-icon-button[_ngcontent-%COMP%]{margin-left:2px}.mat-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:right}.feedback-icon[_ngcontent-%COMP%]{min-width:20px;max-width:20px;min-height:20px;max-height:20px;margin-right:5px}.false_presence[_ngcontent-%COMP%]{background-color:#00c814}.false_absence[_ngcontent-%COMP%]{background-color:#c80000}.note[_ngcontent-%COMP%]{background-color:#7f7f7f} .in-draw{background:#fff;color:#000}"]}),t})();var Rr=n("s2Ay");function Lr(t,e){if(1&t&&(l.Vb(0,"mat-option",32),l.Hc(1),l.Ub()),2&t){const t=e.$implicit;l.mc("value",t.prediction_id),l.Cb(1),l.Lc(" ",t.version," - Rank: ",t.prediction_rank,", ",t.range_offset?"":"No ","Range offset, AUC: ",t.auc," ")}}function Hr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div",44),l.Vb(1,"div",45),l.Vb(2,"div",46),l.Vb(3,"h4"),l.Hc(4),l.ic(5,"translate"),l.Ub(),l.Ub(),l.Vb(6,"div",15),l.Vb(7,"ngx-slider",47),l.dc("userChangeEnd",(function(e){l.xc(t);const n=l.hc().$implicit;return l.hc(2).setOpacity(n,e)})),l.Ub(),l.Ub(),l.Ub(),l.Ub()}if(2&t){const t=l.hc().$implicit,e=l.hc(2);l.Cb(4),l.Ic(l.jc(5,3,"opacity")),l.Cb(3),l.mc("formControlName",t.sliderName)("options",e.sliderOpts)}}function Br(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div",33),l.Vb(1,"div",34),l.Vb(2,"mol-checkbox",35),l.dc("stateChange",(function(n){l.xc(t);const i=e.$implicit;return l.hc(2).toggleLayer(i,n)})),l.ic(3,"translate"),l.Ub(),l.Vb(4,"div",36),l.Vb(5,"button",37),l.dc("click",(function(n){l.xc(t);const i=e.$implicit;return l.hc(2).showOpacity(i,n)})),l.Vb(6,"mat-icon",38),l.ic(7,"translate"),l.Hc(8,"opacity"),l.Ub(),l.Ub(),l.Vb(9,"button",39),l.dc("click",(function(){return l.xc(t),l.hc(2).zoom()})),l.Vb(10,"mat-icon",38),l.ic(11,"translate"),l.Hc(12,"zoom_in"),l.Ub(),l.Ub(),l.Vb(13,"button",40),l.dc("click",(function(){l.xc(t);const n=e.$implicit;return l.hc(2).showInfo(n)})),l.Qb(14,"i",41),l.ic(15,"translate"),l.Ub(),l.Vb(16,"div"),l.Qb(17,"img",42),l.Ub(),l.Ub(),l.Ub(),l.Fc(18,Hr,8,5,"div",43),l.Ub()}if(2&t){const t=e.$implicit;l.Cb(2),l.mc("label",l.jc(3,9,t.title))("checked",t.checked),l.Cb(3),l.mc("disabled",!t.checked),l.Cb(1),l.mc("matTooltip",l.jc(7,11,"change_opacity")),l.Cb(3),l.mc("disabled",!0),l.Cb(1),l.mc("matTooltip",l.jc(11,13,"zoom_to_layer")),l.Cb(4),l.mc("matTooltip",l.jc(15,15,t.info)),l.Cb(3),l.mc("src",t.img,l.zc),l.Cb(1),l.mc("ngIf",t.opacity)}}function zr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div",11),l.Vb(1,"mat-form-field",12),l.Vb(2,"mat-label"),l.Hc(3),l.ic(4,"translate"),l.Ub(),l.Vb(5,"input",48),l.dc("change",(function(){return l.xc(t),l.hc(2).onMinMaxChange()})),l.Ub(),l.Ub(),l.Ub()}2&t&&(l.Cb(3),l.Ic(l.jc(4,1,"max")))}function qr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"ngx-slider",49),l.dc("userChangeEnd",(function(){return l.xc(t),l.hc(2).updateMap()}))("valueChange",(function(e){return l.xc(t),l.hc(2).minThreshold=e})),l.Ub()}if(2&t){const t=l.hc(2);l.mc("value",t.minThreshold)("options",t.predictionSliderOpts)}}function Yr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"ngx-slider",50),l.dc("userChangeEnd",(function(){return l.xc(t),l.hc(2).updateMap()}))("valueChange",(function(e){return l.xc(t),l.hc(2).minThreshold=e}))("highValueChange",(function(e){return l.xc(t),l.hc(2).maxThreshold=e})),l.Ub()}if(2&t){const t=l.hc(2);l.mc("value",t.minThreshold)("highValue",t.maxThreshold)("options",t.predictionSliderOpts)}}function $r(t,e){1&t&&(l.Vb(0,"span"),l.Hc(1),l.ic(2,"translate"),l.Ub()),2&t&&(l.Cb(1),l.Ic(l.jc(2,1,"very_poor")))}function Jr(t,e){1&t&&(l.Vb(0,"span"),l.Hc(1),l.ic(2,"translate"),l.Ub()),2&t&&(l.Cb(1),l.Ic(l.jc(2,1,"excellent")))}function Wr(t,e){if(1&t&&(l.Vb(0,"div",51),l.Qb(1,"mat-radio-button",52),l.Vb(2,"span"),l.Vb(3,"strong"),l.Hc(4),l.Ub(),l.Ub(),l.Fc(5,$r,3,3,"span",0),l.Fc(6,Jr,3,3,"span",0),l.Ub()),2&t){const t=e.$implicit,n=l.hc(2);l.Cb(1),l.mc("value",t)("checked",n.feedback.rating==t),l.Cb(3),l.Ic(t),l.Cb(1),l.mc("ngIf",1==t),l.Cb(1),l.mc("ngIf",5==t)}}function Xr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mol-spatial-feedback",58),l.dc("setFeatures",(function(e){return l.xc(t),l.hc(3).setFeatures(e)}))("nowDrawingIn",(function(e){return l.xc(t),l.hc(3).nowDrawingIn(e)})),l.Ub()}if(2&t){const t=l.hc().$implicit,e=l.hc(2);l.mc("addDisabled",e.drawingIn==t.title)("issue",t.title)("features",e.feedback.spatialFeedbacks)}}const Qr=function(){return{standalone:!0}};function Zr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mat-form-field",59),l.Vb(1,"mat-label"),l.Hc(2),l.ic(3,"translate"),l.Ub(),l.Vb(4,"textarea",60),l.dc("ngModelChange",(function(e){return l.xc(t),l.hc().$implicit.comment=e}))("change",(function(){return l.xc(t),l.hc(3).onTextAreaChanged()})),l.Ub(),l.Ub()}if(2&t){const t=l.hc().$implicit;l.Cb(2),l.Ic(l.jc(3,3,"leave_comment")),l.Cb(2),l.mc("ngModel",t.comment)("ngModelOptions",l.oc(5,Qr))}}function Gr(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div"),l.Vb(1,"div",53),l.Vb(2,"mol-checkbox",35),l.dc("stateChange",(function(n){l.xc(t);const i=e.$implicit;return l.hc(2).toggleFeedback(i,n)})),l.ic(3,"translate"),l.Ub(),l.Vb(4,"button",54),l.Qb(5,"i",41),l.Ub(),l.Fc(6,Xr,1,3,"mol-spatial-feedback",55),l.Ub(),l.Vb(7,"div",56),l.Fc(8,Zr,5,6,"mat-form-field",57),l.Ub(),l.Ub()}if(2&t){const t=e.$implicit;l.Cb(2),l.mc("label",l.jc(3,5,t.name))("checked",t.selected),l.Cb(3),l.mc("matTooltip",t.description),l.Cb(1),l.mc("ngIf",t.selected),l.Cb(2),l.mc("ngIf",t.selected)}}function Kr(t,e){if(1&t&&(l.Vb(0,"mat-option",32),l.Hc(1),l.Ub()),2&t){const t=e.$implicit;l.mc("value",t),l.Cb(1),l.Ic(t.mol_id)}}function ts(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mol-spatial-feedback",67),l.dc("setFeatures",(function(e){return l.xc(t),l.hc(5).setFeatures(e)}))("nowDrawingIn",(function(e){return l.xc(t),l.hc(5).nowDrawingIn(e)})),l.Ub()}if(2&t){const t=l.hc().$implicit,e=l.hc(4);l.mc("issue",t)("drawOn",!1)("features",e.selectedExpert.spatial_feedback)}}function es(t,e){if(1&t&&(l.Vb(0,"div",56),l.Vb(1,"textarea",68),l.Hc(2),l.Ub(),l.Ub()),2&t){const t=l.hc(5);l.Cb(2),l.Ic(t.selectedExpert.issue_comments[t.issue])}}function ns(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div"),l.Vb(1,"mol-checkbox",64),l.dc("stateChange",(function(n){l.xc(t);const i=e.$implicit;return l.hc(4).toggleOtherFeedback(i,n)})),l.Ub(),l.Fc(2,ts,1,3,"mol-spatial-feedback",65),l.Fc(3,es,3,1,"div",66),l.Ub()}if(2&t){const t=e.$implicit,n=l.hc(4);l.Cb(1),l.mc("label",t)("checked",n.selectedExpert.selected[t]),l.Cb(1),l.mc("ngIf",n.selectedExpert.selected[t]),l.Cb(1),l.mc("ngIf",n.selectedExpert.issue_comments&&n.selectedExpert.issue_comments[n.issue])}}function is(t,e){if(1&t&&(l.Vb(0,"div"),l.Fc(1,ns,4,4,"div",27),l.Ub()),2&t){const t=l.hc(3);l.Cb(1),l.mc("ngForOf",t.selectedExpert.issues.split(";"))}}function rs(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div",61),l.Vb(1,"h4"),l.Vb(2,"strong"),l.Hc(3),l.ic(4,"translate"),l.Ub(),l.Ub(),l.Vb(5,"mat-form-field",62),l.Vb(6,"mat-label"),l.Hc(7,"Expert ID"),l.Ub(),l.Vb(8,"mat-select",63),l.dc("selectionChange",(function(){return{}}))("valueChange",(function(e){return l.xc(t),l.hc(2).selectedExpert=e})),l.Fc(9,Kr,2,2,"mat-option",6),l.Ub(),l.Ub(),l.Fc(10,is,2,1,"div",0),l.Ub()}if(2&t){const t=l.hc(2);l.Cb(3),l.Ic(l.jc(4,4,"existing_feedback")),l.Cb(5),l.mc("value",t.selectedExpert),l.Cb(1),l.mc("ngForOf",t.othersFeedback),l.Cb(1),l.mc("ngIf",t.selectedExpert)}}const ss=function(){return[1,2,3,4,5]};function os(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mat-card"),l.Vb(1,"h2",1),l.Vb(2,"div"),l.Vb(3,"strong"),l.Hc(4),l.Ub(),l.Ub(),l.Ub(),l.Vb(5,"form",2),l.Vb(6,"div",3),l.Vb(7,"mat-form-field",4),l.Vb(8,"mat-select",5),l.Fc(9,Lr,2,5,"mat-option",6),l.Ub(),l.Ub(),l.Ub(),l.Fc(10,Br,19,17,"div",7),l.Vb(11,"div",8),l.Vb(12,"div",9),l.Vb(13,"mat-slide-toggle",10),l.dc("toggleChange",(function(){return l.xc(t),l.hc().updateToggle("binary")})),l.Hc(14),l.ic(15,"translate"),l.Ub(),l.Ub(),l.Vb(16,"div",11),l.Vb(17,"mat-form-field",12),l.Vb(18,"mat-label"),l.Hc(19),l.ic(20,"translate"),l.Ub(),l.Vb(21,"input",13),l.dc("change",(function(){return l.xc(t),l.hc().onMinMaxChange()})),l.Ub(),l.Ub(),l.Ub(),l.Fc(22,zr,6,3,"div",14),l.Ub(),l.Vb(23,"div",15),l.Fc(24,qr,1,2,"ngx-slider",16),l.Fc(25,Yr,1,3,"ngx-slider",17),l.Ub(),l.Vb(26,"div",18),l.Vb(27,"div",19),l.Vb(28,"small"),l.Hc(29),l.ic(30,"translate"),l.Ub(),l.Ub(),l.Vb(31,"div",20),l.Vb(32,"span"),l.Hc(33),l.ic(34,"translate"),l.Ub(),l.Vb(35,"span"),l.Hc(36),l.ic(37,"translate"),l.Ub(),l.Ub(),l.Ub(),l.Qb(38,"mat-divider"),l.Vb(39,"div",21),l.Vb(40,"button",22),l.dc("click",(function(){return l.xc(t),l.hc().submitFeedback()})),l.Hc(41),l.ic(42,"translate"),l.Ub(),l.Ub(),l.Vb(43,"div",23),l.Vb(44,"h4"),l.Vb(45,"strong"),l.Hc(46),l.ic(47,"translate"),l.Ub(),l.Ub(),l.Vb(48,"mat-radio-group",24),l.dc("change",(function(e){return l.xc(t),l.hc().setRating(e)})),l.Fc(49,Wr,7,5,"div",25),l.Ub(),l.Ub(),l.Vb(50,"div",26),l.Vb(51,"h4"),l.Vb(52,"strong"),l.Hc(53),l.ic(54,"translate"),l.Ub(),l.Ub(),l.Fc(55,Gr,9,7,"div",27),l.Ub(),l.Vb(56,"div",28),l.Vb(57,"button",29),l.dc("click",(function(){return l.xc(t),l.hc().getPreviousSpecies()})),l.Hc(58),l.ic(59,"translate"),l.Ub(),l.Vb(60,"button",30),l.dc("click",(function(){return l.xc(t),l.hc().getNextSpecies()})),l.Hc(61),l.ic(62,"translate"),l.Ub(),l.Ub(),l.Fc(63,rs,11,6,"div",31),l.Ub(),l.Ub()}if(2&t){const t=l.hc();l.Cb(4),l.Ic(t.modelInfo.sciname),l.Cb(1),l.mc("formGroup",t.predictionsForm),l.Cb(4),l.mc("ngForOf",t.modelList),l.Cb(1),l.mc("ngForOf",t.layers),l.Cb(3),l.mc("checked",t.binaryMap),l.Cb(1),l.Jc(" ",l.jc(15,25,"binary")," "),l.Cb(5),l.Ic(l.jc(20,27,"min")),l.Cb(3),l.mc("ngIf",!t.binaryMap),l.Cb(2),l.mc("ngIf",t.binaryMap),l.Cb(1),l.mc("ngIf",!t.binaryMap),l.Cb(1),l.mc("hidden",t.binaryMap),l.Cb(3),l.Ic(l.jc(30,29,"sdm_legend")),l.Cb(4),l.Ic(l.jc(34,31,"less_likely")),l.Cb(3),l.Ic(l.jc(37,33,"highly_likely")),l.Cb(4),l.mc("disabled",t.disableSave),l.Cb(1),l.Jc(" ",l.jc(42,35,"save")," "),l.Cb(5),l.Ic(l.jc(47,37,"pred_rating")),l.Cb(3),l.mc("ngForOf",l.oc(45,ss)),l.Cb(4),l.Ic(l.jc(54,39,"feedback")),l.Cb(2),l.mc("ngForOf",t.commonProblemsLocal),l.Cb(2),l.mc("disabled",t.worksheetEmpty),l.Cb(1),l.Jc(" ",l.jc(59,41,"previous_species")," "),l.Cb(2),l.mc("disabled",t.worksheetEmpty),l.Cb(1),l.Jc(" ",l.jc(62,43,"next_species")," "),l.Cb(2),l.mc("ngIf",t.othersFeedback&&0!=t.othersFeedback.length)}}function as(t,e){1&t&&(l.Vb(0,"div"),l.Vb(1,"mat-card"),l.Vb(2,"mat-card-title"),l.Hc(3,"Loading..."),l.Ub(),l.Ub(),l.Ub())}let cs=(()=>{class t{constructor(t,e,n){this.predictionsService=t,this.map=e,this.translate=n,this.showBackground=new l.o,this.refreshPrediction=new l.o,this.modelChange=new l.o,this.nextSpecies=new l.o,this.previousSpecies=new l.o,this.openMetadata=new l.o,this.PDF=new l.o,this.updateThreshold=new l.o,this.commonProblemsLocal=null,this.drawDisabled=!1,this.othersFeedback=["a","b"],this.disableSave=!0,this.predictionsForm=new y.i({model:new y.f,min:new y.f,max:new y.f,mask:new y.f(!0),updateMinROC:new y.f(!0),points:new y.f(1),range:new y.f(.3),rangemap:new y.f(.8),feedback:new y.f(1),prediction:new y.f(1)}),this.sliderOpts={step:.05,floor:0,ceil:1,showSelectionBar:!0,showTicks:!1},this.feedback={rating:-1,spatialFeedbacks:{},issue_comments:{}},this.layers=[{title:"layers_prediction",checked:!0,opacity:!1,sliderName:"prediction",layerIndex:2,img:"https://cdn.mol.org/static/images/legends/datatypes/model.png",info:"info_layers_prediction"},{title:"layers_expert_range",checked:!1,opacity:!1,sliderName:"rangemap",layerIndex:0,img:"https://cdn.mol.org/static/images/legends/datatypes/range.png",info:"info_layers_expert_range"},{title:"layers_model_input",checked:!0,opacity:!1,sliderName:"range",layerIndex:1,img:"https://cdn.mol.org/static/images/legends/datatypes/range.png",info:"info_layers_model_input"},{title:"layers_points",checked:!0,opacity:!1,sliderName:"points",layerIndex:3,img:"https://mapoflife.github.io/experts-next/assets/points.png",bgImg:"https://mapoflife.github.io/experts-next/assets/background_points.png",info:"info_layers_points"}],this.predictionSliderOpts=null,this.modelInfo=null,this.backgroundPoints=!1,this.binaryMap=!0,this.logMap=!1,this.map.clickedFeatures.subscribe(t=>{var e,n;if(t&&t.length>0){console.log("clicked feature",null===(e=t[0])||void 0===e?void 0:e.getProperties());let i=null===(n=t[0])||void 0===n?void 0:n.getProperties(),r=this.feedback.spatialFeedbacks[null==i?void 0:i.issue],s=r.features.findIndex(t=>t.properties.feedback_id==(null==i?void 0:i.feedback_id));r.features.splice(s,1),r.features=r.features.map((t,e)=>(t.properties.feedback_index=e+1,t)),this.predictionsService.setVisibleFeatures(null==i?void 0:i.issue,r)}}),this.predictionsService.visibleFeatures.subscribe(t=>{let e={type:"FeatureCollection",features:[]};for(var n in t)e.features.push(...t[n].features);this.map.userFeaturesSet(e)})}ngOnInit(){this.toggleLayer(this.layers[1],!1)}ngOnChanges(t){var e;t.info&&(this.predictionSliderOpts={floor:.01*this.minThreshold,step:.001*this.minThreshold,ceil:this.maxThreshold,translate:(t,e)=>{switch(e){case Cr.a.Ceil:case Cr.a.Floor:return""+t.toExponential(0)+"";default:return""+t.toExponential(2)+""}}},this.setupInfo(),this.commonProblemsLocal=[...c],this.feedback.project_id=this.project_id,this.feedback.prediction_id=this.info.prediction_id,this.othersFeedback=null,this.selectedExpert=null,this.predictionsService.getFeedbackOthers(this.project_id,this.info.prediction_id).subscribe(t=>{t.forEach(t=>{var e;t.selected=null===(e=t.issues)||void 0===e?void 0:e.split(";").reduce((t,e)=>(t[e]=!1,t),{})}),this.othersFeedback=t}),this.predictionsService.getSDMFeedbackv2(this.project_id,this.info.prediction_id).subscribe(t=>{var e,n,i,r;this.feedback.spatialFeedbacks=null!==(e=(t=(null==t?void 0:t.length)>0?t[0]:{}).spatial_feedback)&&void 0!==e?e:{},this.feedback.rating=null!==(n=t.rating)&&void 0!==n?n:-1;let s=null!==(r=null===(i=t.issues)||void 0===i?void 0:i.split(";"))&&void 0!==r?r:[];this.commonProblemsLocal.forEach(e=>{e.selected=s.indexOf(e.title)>-1,e.comment=(null==t?void 0:t.issue_comments)?null==t?void 0:t.issue_comments[e.title]:"",this.disableSave=!0})})),(null===(e=t.predictionOptions)||void 0===e?void 0:e.currentValue.min)&&this.predictionsForm.patchValue({min:Number(t.predictionOptions.currentValue.min).toExponential(2),max:Number(t.predictionOptions.currentValue.max).toExponential(2)})}ngAfterViewInit(){this.drawLegend()}submitFeedback(){let t=this.commonProblemsLocal.filter(t=>t.selected).map(t=>t.title).join(";");this.feedback.issues=t,this.feedback.rating>0&&(this.predictionsService.submitFeedback(this.feedback).subscribe(t=>{}),this.disableSave=!0)}shouldUpdateMin(t){return void 0!==t.predictionOptions&&void 0!==t.predictionOptions.currentValue&&t.predictionOptions.currentValue.min!==this.predictionsForm.get("min").value}setupInfo(){if(this.info){const t=this.info.scientificname.replaceAll("_"," ");this.modelInfo={sciname:t,SPSthreshold:this.info.sps_threshold,noRangeOffsetModel:this.info.noRangeOffsetModel,noRangeOffsetModelIndex:this.info.noRangeOffsetModelIndex,isBest:this.info.isBest},this.setPredictionsForm()}}toggleOtherFeedback(t,e){this.selectedExpert.selected[t]=e}setPredictionsForm(){this.predictionsForm.patchValue({model:this.info.prediction_id,min:this.minThreshold.toExponential(2),max:this.maxThreshold.toExponential(2)},{emitEvent:!1})}showOpacity(t,e){e.pointerId>0&&(t.opacity=!t.opacity)}zoom(){}showInfo(t){"rangemap"===t.sliderName&&this.openMetadata.emit("rangemap")}setOpacity(t,e){this.map.updateLayerOpacity(e.value,t.layerIndex)}toggleLayer(t,e){t.checked=e,t.checked?this.map.updateLayerOpacity(this.predictionsForm.get(t.sliderName).value,t.layerIndex):(this.map.updateLayerOpacity(0,t.layerIndex),t.opacity=!1)}toggleFeedback(t,e){this.disableSave=!1,t.selected=e}toggleBackground(){this.backgroundPoints=!this.backgroundPoints,this.showBackground.emit(this.backgroundPoints)}updateToggle(t){"binary"===t?this.binaryMap=!this.binaryMap:"log"===t&&(this.logMap=!this.logMap),this.updateMap()}updateMap(){this.refreshPrediction.emit({min:this.minThreshold,max:this.maxThreshold,binary:this.binaryMap})}getNextSpecies(){this.drawingIn="",this.nextSpecies.emit()}getPreviousSpecies(){this.drawingIn="",this.previousSpecies.emit()}triggerModelAction(t){switch(t){case"Metadata":this.openMetadata.emit("model");break;case"PDF":this.PDF.emit();break;case"Species":const t="http://mol.org/species/map/"+this.scientificname.split(" ").slice(0,2).join("_");window.open(t,"_blank")}}drawLegend(){let t=("#legend",new At([[document.querySelector("#legend")]],[document.documentElement])).append("svg").attr("width",400).attr("height",10),e=t.append("g");t.append("defs").append("linearGradient").attr("id","linear-gradient").selectAll("stop").data([{offset:"0%",color:"#de2d26"},{offset:"50%",color:"#ffff8c"},{offset:"100%",color:"#2ca25f"}]).enter().append("stop").attr("offset",t=>t.offset).attr("stop-color",t=>t.color).attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%"),e.append("rect").attr("width",350).attr("height",20).style("fill","url(#linear-gradient)")}addSpatialFeedback(){this.drawDisabled=!this.drawDisabled,this.map.updateMapState(this.drawDisabled?"DRAW":"MAP")}setFeatures(t){this.disableSave=!1,this.feedback.spatialFeedbacks[t.issue]=t.features}setRating(t){this.disableSave=!1,this.feedback.rating=t.value}nowDrawingIn(t){this.drawingIn=t}onTextAreaChanged(){this.feedback.issue_comments=Object.assign({},...this.commonProblemsLocal.filter(t=>t.selected).map(t=>({[t.title]:t.comment})))}onMinMaxChange(){this.minThreshold=this.predictionsForm.controls.min.value,this.maxThreshold=this.predictionsForm.controls.max.value,this.updateMap()}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(s.e),l.Pb(s.d),l.Pb(s.j))},t.\u0275cmp=l.Jb({type:t,selectors:[["mol-model-info"]],inputs:{id:"id",project_id:"project_id",info:"info",modelList:"modelList",predictionOptions:"predictionOptions",scientificname:"scientificname",worksheetEmpty:"worksheetEmpty",minThreshold:"minThreshold",maxThreshold:"maxThreshold"},outputs:{showBackground:"showBackground",refreshPrediction:"refreshPrediction",modelChange:"modelChange",nextSpecies:"nextSpecies",previousSpecies:"previousSpecies",openMetadata:"openMetadata",PDF:"PDF",updateThreshold:"updateThreshold"},features:[l.Ab],decls:2,vars:2,consts:[[4,"ngIf"],[1,"species-title"],[3,"formGroup"],[1,"models"],["appearance","fill"],["formControlName","model","name","model"],[3,"value",4,"ngFor","ngForOf"],["class","layers-wrapper",4,"ngFor","ngForOf"],[1,"threshold-toggle"],[1,"binary-toggle"],[3,"checked","toggleChange"],[1,"value-wrapper"],["appearance","fill",1,"max"],["matInput","","formControlName","min",3,"change"],["class","value-wrapper",4,"ngIf"],[1,"mrs-slider","custom-slider"],[3,"value","options","userChangeEnd","valueChange",4,"ngIf"],[3,"value","highValue","options","userChangeEnd","valueChange","highValueChange",4,"ngIf"],[3,"hidden"],["id","legend"],[1,"scale"],[1,"button-box"],["color","primary","mat-raised-button","",3,"disabled","click"],[1,"prediction-score-block"],["aria-label","Select an option",1,"prediction-score",3,"change"],["class","prediction-score score-item",4,"ngFor","ngForOf"],[1,"prediction-feedback"],[4,"ngFor","ngForOf"],[1,"buttons"],["mat-stroked-button","","color","accent",2,"align-items","left",3,"disabled","click"],["mat-stroked-button","","color","accent",2,"align-items","right",3,"disabled","click"],["class","existing-feedback",4,"ngIf"],[3,"value"],[1,"layers-wrapper"],[1,"value-wrapper","layers"],["color","accent",3,"label","checked","stateChange"],[1,"icons"],["mat-icon-button","","aria-label","opacity",3,"disabled","click"],["matTooltipClass","tooltip",3,"matTooltip"],["mat-icon-button","","aria-label","zoom",3,"disabled","click"],["mat-icon-button","","aria-label","info",3,"click"],["matTooltipClass","tooltip",1,"fa","fa-info",3,"matTooltip"],["height","20px","width","20px",1,"legend-img",3,"src"],["class","opacity",4,"ngIf"],[1,"opacity"],[1,"mrs-slider-box"],[1,"mrs","stat","title"],[3,"formControlName","options","userChangeEnd"],["matInput","","formControlName","max",3,"change"],[3,"value","options","userChangeEnd","valueChange"],[3,"value","highValue","options","userChangeEnd","valueChange","highValueChange"],[1,"prediction-score","score-item"],[3,"value","checked"],[1,"feedback-item"],["mat-icon-button","","aria-label","info"],[3,"addDisabled","issue","features","setFeatures","nowDrawingIn",4,"ngIf"],[1,"comment-box"],["class","example-full-width",4,"ngIf"],[3,"addDisabled","issue","features","setFeatures","nowDrawingIn"],[1,"example-full-width"],["matInput","","placeholder","",3,"ngModel","ngModelOptions","ngModelChange","change"],[1,"existing-feedback"],["appearance","standard",1,"dropdown-container"],[3,"value","selectionChange","valueChange"],[3,"label","checked","stateChange"],[3,"issue","drawOn","features","setFeatures","nowDrawingIn",4,"ngIf"],["class","comment-box",4,"ngIf"],[3,"issue","drawOn","features","setFeatures","nowDrawingIn"],["readonly",""]],template:function(t,e){1&t&&(l.Fc(0,os,64,46,"mat-card",0),l.Fc(1,as,4,0,"div",0)),2&t&&(l.mc("ngIf",e.info),l.Cb(1),l.mc("ngIf",!e.info))},directives:[i.t,kr.a,y.H,y.s,y.j,Sr.c,Or.a,y.r,y.h,i.s,Mr.a,Sr.g,Pr.b,y.c,Fr.a,Tr.b,Ur.c,Er.n,Dr.a,jr.a,Ir.a,Cr.c,Ur.b,Nr,y.u,kr.e],pipes:[Rr.c],styles:[".mrs-slider-box{display:flex;justify-content:center;align-items:center;flex-direction:row;place-content:space-between}.mrs-slider-box .mrs{text-align:right;padding-right:5px}.mrs-slider-box .mrs-slider{width:80%}.threshold-toggle{padding-top:27px;height:45px}.threshold-toggle,.value-wrapper{display:flex;justify-content:space-around;align-items:center}.value-wrapper{flex-direction:row}.value-wrapper mat-form-field{max-width:65px}.value-wrapper.binary-toggle{justify-content:flex-end}.value-wrapper.layers,.value-wrapper.options{justify-content:space-between;height:30px}h2{display:flex;flex-direction:row;justify-content:space-between;margin-bottom:5px}h2 small{padding:3px}h4{margin-bottom:11px}h3{margin-bottom:0}.models mat-form-field{width:90%}.icons{display:flex;align-items:center}.colors{display:flex;flex-direction:row}.background,.occurence{width:10px;height:10px;margin:.5em}.break{padding-top:20px}.species-title{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:space-between}h2{margin:0!important}.buttons{width:100%;display:flex;flex-direction:row;justify-content:space-between;margin-top:4px;align-items:center}.buttons button{height:30px}.card-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.actions{margin-top:1.5em}#legend{margin-top:10px}.scale{display:flex;justify-content:space-between}.prediction-score{display:flex;align-items:flex-start;flex-wrap:wrap;justify-content:space-around;align-content:space-around}.score-item{display:flex;flex-direction:column;width:60px;align-items:center}mat-radio-button{width:20px}mat-card{padding:5px 16px!important}.prediction-score-block{margin-top:15px}.prediction-feedback h4,.prediction-score-block h4{margin:3px}mat-selection-list{padding:0}mat-list-option{height:20px}.feedback-item{display:flex;align-items:center;white-space:nowrap;height:25px;margin-left:15px}.comment-box{margin-left:40px}.comment-box mat-form-field{width:300px}.button-box{position:absolute;right:0;margin-top:4px}.existing-feedback{margin-top:7px}.existing-feedback mat-form-field{margin-left:15px}"],encapsulation:2}),t})();var us=n("47ST"),ls=n("NiQx"),hs=n("SSAN"),fs=n("bl/x"),ds=n("mWib"),ps=n("jxfh"),bs=n("J7xr"),ms=n("cZZj"),gs=n("qvOF"),_s=n("5XID"),vs=n("fAiE"),ys=n("ZTXN"),ws=n("KTx3"),xs=n("g6G6"),Cs=n("xVbo"),ks=n("kuMc"),Ss=n("Ohay"),Os=n("YtkY"),Ms=n("J+dc"),Ps=n("jIqt"),Fs=n("f7+R"),Ts=n("5lCh"),Us=n("sg/T"),Es=n("E5oP");const Ds=["*"];function js(t,e){if(1&t){const t=l.Wb();l.Vb(0,"div",2),l.dc("click",(function(){return l.xc(t),l.hc()._onBackdropClicked()})),l.Ub()}if(2&t){const t=l.hc();l.Gb("mat-drawer-shown",t._isShowingBackdrop())}}function Is(t,e){1&t&&(l.Vb(0,"mat-drawer-content"),l.kc(1,2),l.Ub())}const As=[[["mat-drawer"]],[["mat-drawer-content"]],"*"],Vs=["mat-drawer","mat-drawer-content","*"],Ns={transformDrawer:Object(Fs.n)("transform",[Object(Fs.k)("open, open-instant",Object(Fs.l)({transform:"none",visibility:"visible"})),Object(Fs.k)("void",Object(Fs.l)({"box-shadow":"none",visibility:"hidden"})),Object(Fs.m)("void => open-instant",Object(Fs.e)("0ms")),Object(Fs.m)("void <=> open, open-instant => void",Object(Fs.e)("400ms cubic-bezier(0.25, 0.8, 0.25, 1)"))])};function Rs(t){throw Error(`A drawer was already declared for 'position="${t}"'`)}const Ls=new l.r("MAT_DRAWER_DEFAULT_AUTOSIZE",{providedIn:"root",factory:function(){return!1}}),Hs=new l.r("MAT_DRAWER_CONTAINER");let Bs=(()=>{class t extends gs.a{constructor(t,e,n,i,r){super(n,i,r),this._changeDetectorRef=t,this._container=e}ngAfterContentInit(){this._container._contentMarginChanges.subscribe(()=>{this._changeDetectorRef.markForCheck()})}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(l.h),l.Pb(Object(l.U)(()=>qs)),l.Pb(l.l),l.Pb(gs.c),l.Pb(l.A))},t.\u0275cmp=l.Jb({type:t,selectors:[["mat-drawer-content"]],hostAttrs:[1,"mat-drawer-content"],hostVars:4,hostBindings:function(t,e){2&t&&l.Ec("margin-left",e._container._contentMargins.left,"px")("margin-right",e._container._contentMargins.right,"px")},features:[l.zb],ngContentSelectors:Ds,decls:1,vars:0,template:function(t,e){1&t&&(l.lc(),l.kc(0))},encapsulation:2,changeDetection:0}),t})(),zs=(()=>{class t{constructor(t,e,n,i,r,s,o){this._elementRef=t,this._focusTrapFactory=e,this._focusMonitor=n,this._platform=i,this._ngZone=r,this._doc=s,this._container=o,this._elementFocusedBeforeDrawerWasOpened=null,this._enableAnimations=!1,this._position="start",this._mode="over",this._disableClose=!1,this._opened=!1,this._animationStarted=new ys.a,this._animationEnd=new ys.a,this._animationState="void",this.openedChange=new l.o(!0),this._destroyed=new ys.a,this.onPositionChanged=new l.o,this._modeChanged=new ys.a,this.openedChange.subscribe(t=>{t?(this._doc&&(this._elementFocusedBeforeDrawerWasOpened=this._doc.activeElement),this._takeFocus()):this._restoreFocus()}),this._ngZone.runOutsideAngular(()=>{Object(ws.a)(this._elementRef.nativeElement,"keydown").pipe(Object(Cs.a)(t=>t.keyCode===vs.e&&!this.disableClose&&!Object(vs.q)(t)),Object(ks.a)(this._destroyed)).subscribe(t=>this._ngZone.run(()=>{this.close(),t.stopPropagation(),t.preventDefault()}))}),this._animationEnd.pipe(Object(Ss.a)((t,e)=>t.fromState===e.fromState&&t.toState===e.toState)).subscribe(t=>{const{fromState:e,toState:n}=t;(0===n.indexOf("open")&&"void"===e||"void"===n&&0===e.indexOf("open"))&&this.openedChange.emit(this._opened)})}get position(){return this._position}set position(t){(t="end"===t?"end":"start")!=this._position&&(this._position=t,this.onPositionChanged.emit())}get mode(){return this._mode}set mode(t){this._mode=t,this._updateFocusTrapState(),this._modeChanged.next()}get disableClose(){return this._disableClose}set disableClose(t){this._disableClose=Object(_s.c)(t)}get autoFocus(){const t=this._autoFocus;return null==t?"side"!==this.mode:t}set autoFocus(t){this._autoFocus=Object(_s.c)(t)}get opened(){return this._opened}set opened(t){this.toggle(Object(_s.c)(t))}get _openedStream(){return this.openedChange.pipe(Object(Cs.a)(t=>t),Object(Os.a)(()=>{}))}get openedStart(){return this._animationStarted.pipe(Object(Cs.a)(t=>t.fromState!==t.toState&&0===t.toState.indexOf("open")),Object(Os.a)(()=>{}))}get _closedStream(){return this.openedChange.pipe(Object(Cs.a)(t=>!t),Object(Os.a)(()=>{}))}get closedStart(){return this._animationStarted.pipe(Object(Cs.a)(t=>t.fromState!==t.toState&&"void"===t.toState),Object(Os.a)(()=>{}))}_takeFocus(){this.autoFocus&&this._focusTrap&&this._focusTrap.focusInitialElementWhenReady().then(t=>{t||"function"!=typeof this._elementRef.nativeElement.focus||this._elementRef.nativeElement.focus()})}_restoreFocus(){if(!this.autoFocus)return;const t=this._doc&&this._doc.activeElement;t&&this._elementRef.nativeElement.contains(t)&&(this._elementFocusedBeforeDrawerWasOpened?this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened,this._openedVia):this._elementRef.nativeElement.blur()),this._elementFocusedBeforeDrawerWasOpened=null,this._openedVia=null}ngAfterContentInit(){this._focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement),this._updateFocusTrapState()}ngAfterContentChecked(){this._platform.isBrowser&&(this._enableAnimations=!0)}ngOnDestroy(){this._focusTrap&&this._focusTrap.destroy(),this._animationStarted.complete(),this._animationEnd.complete(),this._modeChanged.complete(),this._destroyed.next(),this._destroyed.complete()}open(t){return this.toggle(!0,t)}close(){return this.toggle(!1)}toggle(t=!this.opened,e="program"){return this._opened=t,t?(this._animationState=this._enableAnimations?"open":"open-instant",this._openedVia=e):(this._animationState="void",this._restoreFocus()),this._updateFocusTrapState(),new Promise(t=>{this.openedChange.pipe(Object(Ms.a)(1)).subscribe(e=>t(e?"open":"close"))})}get _width(){return this._elementRef.nativeElement&&this._elementRef.nativeElement.offsetWidth||0}_updateFocusTrapState(){this._focusTrap&&(this._focusTrap.enabled=this.opened&&"side"!==this.mode)}_animationStartListener(t){this._animationStarted.next(t)}_animationDoneListener(t){this._animationEnd.next(t)}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(l.l),l.Pb(Us.i),l.Pb(Us.h),l.Pb(ms.a),l.Pb(l.A),l.Pb(i.e,8),l.Pb(Hs,8))},t.\u0275cmp=l.Jb({type:t,selectors:[["mat-drawer"]],hostAttrs:["tabIndex","-1",1,"mat-drawer"],hostVars:12,hostBindings:function(t,e){1&t&&l.Hb("@transform.start",(function(t){return e._animationStartListener(t)}))("@transform.done",(function(t){return e._animationDoneListener(t)})),2&t&&(l.Db("align",null),l.Mc("@transform",e._animationState),l.Gb("mat-drawer-end","end"===e.position)("mat-drawer-over","over"===e.mode)("mat-drawer-push","push"===e.mode)("mat-drawer-side","side"===e.mode)("mat-drawer-opened",e.opened))},inputs:{position:"position",mode:"mode",disableClose:"disableClose",autoFocus:"autoFocus",opened:"opened"},outputs:{openedChange:"openedChange",onPositionChanged:"positionChanged",_openedStream:"opened",openedStart:"openedStart",_closedStream:"closed",closedStart:"closedStart"},exportAs:["matDrawer"],ngContentSelectors:Ds,decls:2,vars:0,consts:[[1,"mat-drawer-inner-container"]],template:function(t,e){1&t&&(l.lc(),l.Vb(0,"div",0),l.kc(1),l.Ub())},encapsulation:2,data:{animation:[Ns.transformDrawer]},changeDetection:0}),t})(),qs=(()=>{class t{constructor(t,e,n,i,r,s=!1,o){this._dir=t,this._element=e,this._ngZone=n,this._changeDetectorRef=i,this._animationMode=o,this._drawers=new l.E,this.backdropClick=new l.o,this._destroyed=new ys.a,this._doCheckSubject=new ys.a,this._contentMargins={left:null,right:null},this._contentMarginChanges=new ys.a,t&&t.change.pipe(Object(ks.a)(this._destroyed)).subscribe(()=>{this._validateDrawers(),this.updateContentMargins()}),r.change().pipe(Object(ks.a)(this._destroyed)).subscribe(()=>this.updateContentMargins()),this._autosize=s}get start(){return this._start}get end(){return this._end}get autosize(){return this._autosize}set autosize(t){this._autosize=Object(_s.c)(t)}get hasBackdrop(){return null==this._backdropOverride?!this._start||"side"!==this._start.mode||!this._end||"side"!==this._end.mode:this._backdropOverride}set hasBackdrop(t){this._backdropOverride=null==t?null:Object(_s.c)(t)}get scrollable(){return this._userContent||this._content}ngAfterContentInit(){this._allDrawers.changes.pipe(Object(Ps.a)(this._allDrawers),Object(ks.a)(this._destroyed)).subscribe(t=>{this._drawers.reset(t.filter(t=>!t._container||t._container===this)),this._drawers.notifyOnChanges()}),this._drawers.changes.pipe(Object(Ps.a)(null)).subscribe(()=>{this._validateDrawers(),this._drawers.forEach(t=>{this._watchDrawerToggle(t),this._watchDrawerPosition(t),this._watchDrawerMode(t)}),(!this._drawers.length||this._isDrawerOpen(this._start)||this._isDrawerOpen(this._end))&&this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),this._doCheckSubject.pipe(Object(ds.a)(10),Object(ks.a)(this._destroyed)).subscribe(()=>this.updateContentMargins())}ngOnDestroy(){this._contentMarginChanges.complete(),this._doCheckSubject.complete(),this._drawers.destroy(),this._destroyed.next(),this._destroyed.complete()}open(){this._drawers.forEach(t=>t.open())}close(){this._drawers.forEach(t=>t.close())}updateContentMargins(){let t=0,e=0;if(this._left&&this._left.opened)if("side"==this._left.mode)t+=this._left._width;else if("push"==this._left.mode){const n=this._left._width;t+=n,e-=n}if(this._right&&this._right.opened)if("side"==this._right.mode)e+=this._right._width;else if("push"==this._right.mode){const n=this._right._width;e+=n,t-=n}t=t||null,e=e||null,t===this._contentMargins.left&&e===this._contentMargins.right||(this._contentMargins={left:t,right:e},this._ngZone.run(()=>this._contentMarginChanges.next(this._contentMargins)))}ngDoCheck(){this._autosize&&this._isPushed()&&this._ngZone.runOutsideAngular(()=>this._doCheckSubject.next())}_watchDrawerToggle(t){t._animationStarted.pipe(Object(Cs.a)(t=>t.fromState!==t.toState),Object(ks.a)(this._drawers.changes)).subscribe(t=>{"open-instant"!==t.toState&&"NoopAnimations"!==this._animationMode&&this._element.nativeElement.classList.add("mat-drawer-transition"),this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),"side"!==t.mode&&t.openedChange.pipe(Object(ks.a)(this._drawers.changes)).subscribe(()=>this._setContainerClass(t.opened))}_watchDrawerPosition(t){t&&t.onPositionChanged.pipe(Object(ks.a)(this._drawers.changes)).subscribe(()=>{this._ngZone.onMicrotaskEmpty.asObservable().pipe(Object(Ms.a)(1)).subscribe(()=>{this._validateDrawers()})})}_watchDrawerMode(t){t&&t._modeChanged.pipe(Object(ks.a)(Object(xs.a)(this._drawers.changes,this._destroyed))).subscribe(()=>{this.updateContentMargins(),this._changeDetectorRef.markForCheck()})}_setContainerClass(t){const e=this._element.nativeElement.classList,n="mat-drawer-container-has-open";t?e.add(n):e.remove(n)}_validateDrawers(){this._start=this._end=null,this._drawers.forEach(t=>{"end"==t.position?(null!=this._end&&Rs("end"),this._end=t):(null!=this._start&&Rs("start"),this._start=t)}),this._right=this._left=null,this._dir&&"rtl"===this._dir.value?(this._left=this._end,this._right=this._start):(this._left=this._start,this._right=this._end)}_isPushed(){return this._isDrawerOpen(this._start)&&"over"!=this._start.mode||this._isDrawerOpen(this._end)&&"over"!=this._end.mode}_onBackdropClicked(){this.backdropClick.emit(),this._closeModalDrawer()}_closeModalDrawer(){[this._start,this._end].filter(t=>t&&!t.disableClose&&this._canHaveBackdrop(t)).forEach(t=>t.close())}_isShowingBackdrop(){return this._isDrawerOpen(this._start)&&this._canHaveBackdrop(this._start)||this._isDrawerOpen(this._end)&&this._canHaveBackdrop(this._end)}_canHaveBackdrop(t){return"side"!==t.mode||!!this._backdropOverride}_isDrawerOpen(t){return null!=t&&t.opened}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(Es.c,8),l.Pb(l.l),l.Pb(l.A),l.Pb(l.h),l.Pb(gs.e),l.Pb(Ls),l.Pb(Ts.a,8))},t.\u0275cmp=l.Jb({type:t,selectors:[["mat-drawer-container"]],contentQueries:function(t,e,n){var i;1&t&&(l.Ib(n,Bs,!0),l.Ib(n,zs,!0)),2&t&&(l.sc(i=l.ec())&&(e._content=i.first),l.sc(i=l.ec())&&(e._allDrawers=i))},viewQuery:function(t,e){var n;1&t&&l.Nc(Bs,!0),2&t&&l.sc(n=l.ec())&&(e._userContent=n.first)},hostAttrs:[1,"mat-drawer-container"],hostVars:2,hostBindings:function(t,e){2&t&&l.Gb("mat-drawer-container-explicit-backdrop",e._backdropOverride)},inputs:{autosize:"autosize",hasBackdrop:"hasBackdrop"},outputs:{backdropClick:"backdropClick"},exportAs:["matDrawerContainer"],features:[l.Bb([{provide:Hs,useExisting:t}])],ngContentSelectors:Vs,decls:4,vars:2,consts:[["class","mat-drawer-backdrop",3,"mat-drawer-shown","click",4,"ngIf"],[4,"ngIf"],[1,"mat-drawer-backdrop",3,"click"]],template:function(t,e){1&t&&(l.lc(As),l.Fc(0,js,1,2,"div",0),l.kc(1),l.kc(2,1),l.Fc(3,Is,2,0,"mat-drawer-content",1)),2&t&&(l.mc("ngIf",e.hasBackdrop),l.Cb(3),l.mc("ngIf",!e._content))},directives:[i.t,Bs],styles:[".mat-drawer-container{position:relative;z-index:1;box-sizing:border-box;-webkit-overflow-scrolling:touch;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:background-color,visibility}.cdk-high-contrast-active .mat-drawer-backdrop{opacity:.5}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-transition .mat-drawer-content{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%, 0, 0)}.cdk-high-contrast-active .mat-drawer,.cdk-high-contrast-active [dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}.cdk-high-contrast-active [dir=rtl] .mat-drawer,.cdk-high-contrast-active .mat-drawer.mat-drawer-end{border-left:solid 1px currentColor;border-right:none}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer{transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer.mat-drawer-end{left:0;right:auto;transform:translate3d(-100%, 0, 0)}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.mat-sidenav-fixed{position:fixed}\n"],encapsulation:2,changeDetection:0}),t})(),Ys=(()=>{class t{}return t.\u0275mod=l.Nb({type:t}),t.\u0275inj=l.Mb({factory:function(e){return new(e||t)},imports:[[i.c,Er.i,ms.b,gs.b],gs.b,Er.i]}),t})();var $s=n("nts4"),Js=n("sOKj"),Ws=n("SoR6");function Xs(t,e){if(1&t){const t=l.Wb();l.Vb(0,"google-chart",1),l.dc("select",(function(e){return l.xc(t),l.hc().changeMin(e)})),l.Ub()}if(2&t){const t=l.hc();l.mc("dynamicResize",t.dynamicResize)("data",t.rocChart.data)("type",t.rocChart.type)("title",t.rocChart.title)("columns",t.rocChart.columns)("options",t.rocChart.options)}}let Qs=(()=>{class t{constructor(t){this.predictionsService=t,this.updateMin=new l.o,this.rocChart=null}ngOnInit(){}ngOnChanges(t){t.chartData&&this.chartData&&this.graphChart()}changeMin(t){1==t.selection[0].column&&this.updateMin.emit(this.rocChart.data[t.selection[0].row][2])}graphChart(){let t=this.chartData.map(t=>[t.fpr,t.tpr,t.thresh,`FPR: ${t.fpr}, TPR: ${t.tpr}, TH: ${t.thresh}`,t.fpr]);this.rocChart={title:"ROC",type:Ws.a.LineChart,data:t,columns:[{type:"number",id:"fpr",label:"fpr"},{type:"number",id:"tpr",label:"tpr"},{type:"number",id:"thresh",label:"thresh",role:"annotationText"},{type:"string",role:"tooltip",id:"tooltip",p:{html:!0}},{type:"number",id:"fpr",label:"fpr"}],colors:["#e0440e","#e6693e"],options:{hAxis:{title:"False Positive Rate"},vAxis:{title:"True Positive Rate "},width:398,legend:{position:"none"},tooltip:{isHtml:!0,ignoreBounds:!0}}}}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(s.e))},t.\u0275cmp=l.Jb({type:t,selectors:[["mol-roc-chart"]],inputs:{id:"id",chartData:"chartData"},outputs:{updateMin:"updateMin"},features:[l.Ab],decls:1,vars:1,consts:[["class","gchart",3,"dynamicResize","data","type","title","columns","options","select",4,"ngIf"],[1,"gchart",3,"dynamicResize","data","type","title","columns","options","select"]],template:function(t,e){1&t&&l.Fc(0,Xs,1,6,"google-chart",0),2&t&&l.mc("ngIf",e.rocChart)},directives:[i.t,Ws.b],styles:["[_nghost-%COMP%]{width:398px}"]}),t})();const Zs=["mol-model-info"];function Gs(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mol-model-info",9),l.dc("showBackground",(function(e){return l.xc(t),l.hc().fetchPoints(e)}))("refreshPrediction",(function(e){return l.xc(t),l.hc().refreshMap(e)}))("modelChange",(function(e){return l.xc(t),l.hc().modelChange(e)}))("nextSpecies",(function(){return l.xc(t),l.hc().getNextSpecies()}))("previousSpecies",(function(){return l.xc(t),l.hc().getPreviousSpecies()}))("openMetadata",(function(e){return l.xc(t),l.hc().openMetadataDialog(e)}))("updateThreshold",(function(e){return l.xc(t),l.hc().updateThreshold(e)}))("PDF",(function(){return l.xc(t),l.hc().getPDF()})),l.Ub()}if(2&t){const t=l.hc();l.mc("id",t.id)("project_id",t.project_id)("info",t.info)("modelList",t.modelList)("predictionOptions",t.predictionOptions)("scientificname",t.scientificname)("minThreshold",t.predictionOptions.min)("maxThreshold",t.predictionOptions.max)("worksheetEmpty",t.worksheetEmpty)}}function Ks(t,e){if(1&t){const t=l.Wb();l.Vb(0,"button",10),l.dc("click",(function(){l.xc(t);const e=l.hc();return e.showMetadata=!e.showMetadata})),l.Hc(1),l.ic(2,"translate"),l.Ub()}if(2&t){const t=l.hc();l.Cb(1),l.Jc(" ",t.showMetadata?"hide_metadata":l.jc(2,1,"show_metadata")," ")}}function to(t,e){if(1&t){const t=l.Wb();l.Vb(0,"mol-roc-chart",11),l.dc("updateMin",(function(e){return l.xc(t),l.hc().updateMinFromROC(e)})),l.Ub()}if(2&t){const t=l.hc();l.mc("chartData",t.chartData)}}function eo(t,e){1&t&&l.Qb(0,"mat-divider")}function no(t,e){1&t&&l.Qb(0,"mat-divider")}const io=[{path:":scientificname",component:(()=>{class t{constructor(t,e,n,i,r,s,c,u,l){this.mapService=t,this.predictionsService=e,this.datasetService=n,this.route=i,this.router=r,this.auth=s,this.matDialog=c,this._snackBar=u,this.translate=l,this.id=null,this.scientificname=null,this.info=null,this.chartData=null,this.pdfLink=null,this.questions=o,this.requiredQuestions=a,this.taxa="",this.binary=!0,this.modelList=null,this.storedSpecies=[],this.nextSpecies="",this.previousModel="",this.worksheetEmpty=!1,this.showBackground=!1,this.showMetaData=!1,this.existingFeedback=[],this.project_id=null,this.showMetadata=!1,this.speciesIndex=0,this.taxaDatasets={amphibians:"83cfa8fb-dd6e-4031-8215-1079abddb8a7",ants:null,butterflies:"8f316f82-7356-44ee-823d-8f830f241fab",mammals:"ec694c34-bddd-4111-ba99-926a5f7866e8",odonates:"5b1bb9d6-1bf9-4d3b-aec6-3cfbc96d88f7",reptiles:"f00b03ed-8345-4497-b194-3fced6ee155c",trees:"f7b134d9-d2ce-43b2-8f2d-7e6441d7c747"},this.alternativeAnswers={},this.query={scientificname:"",status:"",taxa:""},this.modelFilters={version:"",auc:{value:0,highValue:1},evaluated_by_me:0,evaluated_by_others:0}}ngOnInit(){this.scientificname=this.route.snapshot.paramMap.get("scientificname").replace("_"," "),this.route.queryParams.subscribe(t=>{this.id=t.prediction_id,this.project_id=t.project_id,this.init()});let t=this.route.snapshot.queryParamMap;this.project_id=t.get("project_id"),this.query.scientificname=t.get("scientificname")||"",this.query.status=t.get("status")||"",this.query.taxa=t.get("taxa")||"",this.modelFilters.version=t.get("version")||"",this.modelFilters.auc.value=Number(t.get("aucMin"))||0,this.modelFilters.auc.highValue=Number(t.get("aucMax"))||1,this.predictionsService.predictionsRequested||this.predictionsService.predictions("A",this.project_id,this.query,this.modelFilters),this.auth.currentUser.subscribe(t=>{this.role=t.role});let e=JSON.parse(localStorage.getItem("Species")||"{}"),n=JSON.parse(localStorage.getItem("EvaluatedSpecies")||"{}");e.length>0&&n.length>0&&n.forEach(t=>{e.splice(e.indexOf(t.replace("_"," ")),1)})}init(){this.predictionsService.speciesDetailed(this.scientificname,this.id).pipe(Object(fs.a)(1)).subscribe(t=>{this.info=t.predictions.find(this.id?t=>t.prediction_id===this.id:t=>1===t.model_rank),this.info||(this.info=t.predictions[0]),this.id||(this.id=this.info.prediction_id),this.pdfLink=t.pdf,this.modelList=t.predictions,this.chartData=t.roc;let e=this.taxaDatasets[this.info.taxa];if(e){let t=this.scientificname.split(" ").slice(0,2).join(" ");this.mapService.updateTileParams({url:`https://next-tiles.mol.org/0.x/tiles/species/detailed/3857/{z}/{x}/{y}.mvt?scientificname=${t}&dsids=${e}`,index:0})}this.mapService.updateTileParams({url:t.range_map.url,index:1}),this.mapService.updateGeoJsonFeatures(t.points),this.updateBounds(t.points),this.predictionOptions={max:4*this.info.sps_threshold,min:this.info.sps_threshold,binary:this.binary},this.refreshMap(this.predictionOptions),this.taxa=this.info.taxa,this.links=[{name:"Prediction Table",route:"/predictions/taxa/"+this.taxa,data:Object.assign({prediction_id:null,project_id:this.project_id},this.route.snapshot.queryParams)}],this.getNonSpatialFeedback()})}updateThreshold(t){this.alternativeAnswers={alternative_threshold:t}}updateBounds(t){let e=t.features.filter(t=>"Occurrence"===t.properties.what)[0];e=e.geometry.coordinates;let n=e.map(t=>t[1]),i=e.map(t=>t[0]),r=Math.min(...n),s=Math.min(...i),o=Math.max(...n),a=Math.max(...i);this.mapService.zoomToDatasetExtent({buffer:100,northEast:{lat:o,lng:a},southWest:{lat:r,lng:s}})}fetchPoints(t){this.showBackground=t,this.predictionsService.fetchPoints(this.id,this.showBackground).subscribe(t=>{this.mapService.updateGeoJsonFeatures(t),this.updateBounds(t)})}refreshMap(t){this.binary=t.binary,this.predictionOptions=Object.assign({},t),this.predictionsService.fetchMap(this.id,t).pipe(Object(ds.a)(500)).subscribe(t=>{this.mapService.updateTileParams({url:t.url,index:2})})}modelChange(t){this.id=t,this.predictionsService.fetchMap(this.id,void 0).subscribe(t=>{this.mapService.updateTileParams({url:t.url,index:2})}),this.predictionsService.fetchROC(this.id).subscribe(t=>{this.chartData=t.roc}),this.info=this.modelList.find(t=>t.prediction_id===this.id),this.router.navigate([],{relativeTo:this.route,queryParams:{prediction_id:this.id},queryParamsHandling:"merge"})}updateMinFromROC(t){this.refreshMap({binary:this.predictionOptions.binary,min:t,max:this.predictionOptions.max})}updateMinMaxThreshold(t){console.log("update min max",t),this.refreshMap({binary:this.predictionOptions.binary,min:t.min,max:t.max})}openMetadataDialog(t){if("rangemap"===t){let t=this.taxaDatasets[this.info.taxa];t&&this.datasetService.metadata(t).subscribe(e=>{this.matDialog.open(ps.d,{data:{info:e.metadata,dataset_id:t,heading:"Expert range map for "+this.info.taxa}})})}else this.matDialog.open(g,{height:"80%",width:"800px",data:{info:Object.assign(Object.assign({},this.info),this.info.modelinfo)}})}getNextSpecies(){this.speciesIndex+=1,this.getSpecies()}getSpecies(){let t=this.predictionsService.getSpeciesAtIndex(this.speciesIndex);this.scientificname=t.scientificname.split(" ").join("_"),this.id=t.prediction_id,this.router.navigate(["/predictions/species/",this.scientificname],{queryParams:Object.assign(Object.assign({prediction_id:this.id,project_id:this.project_id},this.query),this.modelFilters),relativeTo:this.route})}getPreviousSpecies(){this.speciesIndex>0&&(this.speciesIndex-=1),this.getSpecies()}speciesEvaluated(){let t=[],e=[],n=[],i=this.id;Object.keys(localStorage),null!==localStorage.getItem("Evaluated")?(t=JSON.parse(localStorage.getItem("Evaluated")||"{}"),-1===t.indexOf(i)&&t.push(i)):t.push(i),null!==localStorage.getItem("EvaluatedSpecies")?(e=JSON.parse(localStorage.getItem("EvaluatedSpecies")),-1===e.indexOf(this.scientificname)&&e.push(this.scientificname)):e.push(this.scientificname),localStorage.setItem("EvaluatedSpecies",JSON.stringify(e)),n=JSON.parse(localStorage.getItem("Species")||"{}"),n.length>0&&e.forEach(t=>{n.splice(n.indexOf(t.replace("_"," ")),1)}),localStorage.setItem("Evaluated",JSON.stringify(t))}feedbackSubmitted(t){this.auth.currentUser.pipe(Object(ls.switchMap)(e=>this.predictionsService.submitNonSpatialFeedback(e.id,this.id,t)),Object(hs.catchError)(t=>Object(us.a)(t))).subscribe(t=>{this.openSnackBar(t.message,"Close"),this.speciesEvaluated()},t=>{this.openSnackBar(t,"Close")}),JSON.parse(localStorage.getItem("Species")||"{}")}getNonSpatialFeedback(){this.predictionsService.getNonSpatialFeedback(this.id).subscribe(t=>{t.forEach(t=>{const e=t.detailed.prediction_overall_rating,n=o[0].questions[0].options.findIndex(t=>t.value==e),i=o[0].questions[0].options[n];t.detailed.prediction_overall_rating=void 0!==i?i.display:t.detailed.prediction_overall_rating,t.feedback_id=t.feedback_id,t.created_at=t.created_at.slice(0,16);const r=o[0].questions[2].options;let s=[];t.detailed.prediction_issues_present&&(t.detailed.prediction_issues_present.forEach(t=>{const e=r.findIndex(e=>e.value==t);s.push(r[e].display)}),t.detailed.prediction_issues_present=s.toString().replace(",",", "));const a=o[1].questions[0].options;let c=[];t.detailed.points_issues_present&&(t.detailed.points_issues_present.forEach(t=>{const e=a.findIndex(e=>e.value==t);c.push(a[e].display)}),t.detailed.points_issues_present=c.toString().replace(",",", "));const u=o[2].questions[0].options;let l=[];t.detailed.range_issues_present&&(t.detailed.range_issues_present.forEach(t=>{const e=u.findIndex(e=>e.value==t);l.push(u[e].display)}),t.detailed.range_issues_present=l.toString().replace(",",", "))}),this.existingFeedback=t})}handleFeedbackError(t){this.openSnackBar("Please fill out the required questions","Close"),console.error("feedback error: ",t)}openSnackBar(t,e){this._snackBar.open(t,e)}getPDF(){window.open(this.pdfLink,"_blank")}ngOnDestroy(){this.mapService.updateTileParams({url:"OFF",index:0}),this.mapService.updateTileParams({url:"OFF",index:1}),this.mapService.updateTileParams({url:"OFF",index:2}),this.mapService.updateGeoJsonFeatures({type:"FeatureCollection",features:[]})}}return t.\u0275fac=function(e){return new(e||t)(l.Pb(s.d),l.Pb(s.e),l.Pb(s.c),l.Pb(r.a),l.Pb(r.f),l.Pb(s.b),l.Pb(u.b),l.Pb(Ar.a),l.Pb(s.j))},t.\u0275cmp=l.Jb({type:t,selectors:[["mol-predictions-root"]],viewQuery:function(t,e){var n;1&t&&l.Nc(Zs,!0),2&t&&l.sc(n=l.ec())&&(e.modelInfo=n.first)},decls:11,vars:6,consts:[[3,"links"],[1,"predictions-container"],["mode","side","opened","",1,"drawer"],[3,"id","project_id","info","modelList","predictionOptions","scientificname","minThreshold","maxThreshold","worksheetEmpty","showBackground","refreshPrediction","modelChange","nextSpecies","previousSpecies","openMetadata","updateThreshold","PDF",4,"ngIf"],["class","metadata-button","mat-raised-button","",3,"click",4,"ngIf"],[3,"chartData","updateMin",4,"ngIf"],[4,"ngIf"],[1,"map-container"],["mode","experts"],[3,"id","project_id","info","modelList","predictionOptions","scientificname","minThreshold","maxThreshold","worksheetEmpty","showBackground","refreshPrediction","modelChange","nextSpecies","previousSpecies","openMetadata","updateThreshold","PDF"],["mat-raised-button","",1,"metadata-button",3,"click"],[3,"chartData","updateMin"]],template:function(t,e){1&t&&(l.Qb(0,"mol-nav",0),l.Vb(1,"mat-drawer-container",1),l.Vb(2,"mat-drawer",2),l.Fc(3,Gs,1,9,"mol-model-info",3),l.Fc(4,Ks,3,3,"button",4),l.Fc(5,to,1,1,"mol-roc-chart",5),l.Fc(6,eo,1,0,"mat-divider",6),l.Fc(7,no,1,0,"mat-divider",6),l.Ub(),l.Vb(8,"mat-drawer-content",7),l.Qb(9,"mol-spinner"),l.Qb(10,"mol-map",8),l.Ub(),l.Ub()),2&t&&(l.mc("links",e.links),l.Cb(3),l.mc("ngIf",e.info),l.Cb(1),l.mc("ngIf",e.info),l.Cb(1),l.mc("ngIf",e.info&&e.showMetadata),l.Cb(1),l.mc("ngIf",e.info),l.Cb(1),l.mc("ngIf",e.info))},directives:[bs.a,qs,zs,i.t,Bs,$s.a,Js.a,cs,Tr.b,Qs,Fr.a],pipes:[Rr.c],styles:[".predictions-container[_ngcontent-%COMP%]{height:calc(100vh - 52px - 85px)}mat-drawer-container[_ngcontent-%COMP%]{box-shadow:3px 0 2px -2px #aaa}.drawer[_ngcontent-%COMP%], mat-drawer-container[_ngcontent-%COMP%]{overflow-x:hidden;overflow-y:auto}.drawer[_ngcontent-%COMP%]{width:400px;min-height:100%} .mat-drawer-inner-container{overflow-x:hidden!important}.card-title[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.metadata-button[_ngcontent-%COMP%]{margin:5px 0 5px 5px}"]}),t})()}];let ro=(()=>{class t{}return t.\u0275mod=l.Nb({type:t}),t.\u0275inj=l.Mb({factory:function(e){return new(e||t)},imports:[[i.c,r.j.forChild(io)],r.j]}),t})();var so=n("M0ag"),oo=n("+Tre"),ao=n("nKqi");let co=(()=>{class t{}return t.\u0275mod=l.Nb({type:t}),t.\u0275inj=l.Mb({factory:function(e){return new(e||t)},imports:[[i.c,so.a,ps.c,kr.d,Fr.b,Ys,jr.b,Ir.b,ps.b,Tr.c,Cr.b,y.l,y.B,Fr.b,Pr.c,oo.b,Ws.c,Or.b,ps.f,ps.e,u.f,Mr.b,ps.a,Ur.d,ao.b,Rr.b]]}),t})(),uo=(()=>{class t{}return t.\u0275mod=l.Nb({type:t}),t.\u0275inj=l.Mb({factory:function(e){return new(e||t)},imports:[[ro,co]]}),t})()},QuXn:function(t,e,n){"use strict";var i=!1;e.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){var e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else i&&console.log("RxJS: Back to a better error behavior. Thank you. <3");i=t},get useDeprecatedSynchronousErrorHandling(){return i}}},R4cV:function(t,e,n){"use strict";var i=n("qiMw"),r=n("ihxi"),s=n("4mxr");e.from=function(t,e){return e?s.scheduled(t,e):t instanceof i.Observable?t:new i.Observable(r.subscribeTo(t))}},RKpm:function(t,e,n){"use strict";e.identity=function(t){return t}},SSAN:function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=n("dmvN"),s=n("d4zx"),o=n("kZSD");e.catchError=function(t){return function(e){var n=new a(t),i=e.lift(n);return n.caught=i}};var a=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.selector,this.caught))},t}(),c=function(t){function e(e,n,i){var r=t.call(this,e)||this;return r.selector=n,r.caught=i,r}return i(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=void 0;try{n=this.selector(e,this.caught)}catch(a){return void t.prototype.error.call(this,a)}this._unsubscribeAndRecycle();var i=new s.InnerSubscriber(this,void 0,void 0);this.add(i);var r=o.subscribeToResult(this,n,void 0,void 0,i);r!==i&&this.add(r)}},e}(r.OuterSubscriber)},VTS6:function(t,e,n){"use strict";e.isArrayLike=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t}},Yfti:function(t,e,n){"use strict";var i=n("1hPV"),r=n("7oWP"),s=n("uzuk");e.toSubscriber=function(t,e,n){if(t){if(t instanceof i.Subscriber)return t;if(t[r.rxSubscriber])return t[r.rxSubscriber]()}return t||e||n?new i.Subscriber(t,e,n):new i.Subscriber(s.empty)}},ZGdk:function(t,e,n){"use strict";e.UnsubscriptionError=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}()},a96P:function(t,e,n){"use strict";e.isObject=function(t){return null!==t&&"object"==typeof t}},d0I2:function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=n("1hPV");e.map=function(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new s(t,e))}};var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new o(t,this.project,this.thisArg))},t}();e.MapOperator=s;var o=function(t){function e(e,n,i){var r=t.call(this,e)||this;return r.project=n,r.count=0,r.thisArg=i||r,r}return i(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(n){return void this.destination.error(n)}this.destination.next(e)},e}(r.Subscriber)},d4zx:function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();e.InnerSubscriber=function(t){function e(e,n,i){var r=t.call(this)||this;return r.parent=e,r.outerValue=n,r.outerIndex=i,r.index=0,r}return i(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(n("1hPV").Subscriber)},dmvN:function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();e.OuterSubscriber=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.notifyNext=function(t,e,n,i,r){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(n("1hPV").Subscriber)},i6J5:function(t,e,n){"use strict";var i=n("qiMw"),r=n("6Br6"),s=n("7bXj");e.scheduleIterable=function(t,e){if(!t)throw new Error("Iterable cannot be null");return new i.Observable((function(n){var i,o=new r.Subscription;return o.add((function(){i&&"function"==typeof i.return&&i.return()})),o.add(e.schedule((function(){i=t[s.iterator](),o.add(e.schedule((function(){if(!n.closed){var t,e;try{var r=i.next();t=r.value,e=r.done}catch(s){return void n.error(s)}e?n.complete():(n.next(t),this.schedule())}})))}))),o}))}},i84P:function(t,e,n){"use strict";var i=n("qiMw"),r=n("6Br6");e.schedulePromise=function(t,e){return new i.Observable((function(n){var i=new r.Subscription;return i.add(e.schedule((function(){return t.then((function(t){i.add(e.schedule((function(){n.next(t),i.add(e.schedule((function(){return n.complete()})))})))}),(function(t){i.add(e.schedule((function(){return n.error(t)})))}))}))),i}))}},ihxi:function(t,e,n){"use strict";var i=n("sBpz"),r=n("lTUY"),s=n("GB03"),o=n("Lbxd"),a=n("VTS6"),c=n("xKJD"),u=n("a96P"),l=n("7bXj"),h=n("k/06");e.subscribeTo=function(t){if(t&&"function"==typeof t[h.observable])return o.subscribeToObservable(t);if(a.isArrayLike(t))return i.subscribeToArray(t);if(c.isPromise(t))return r.subscribeToPromise(t);if(t&&"function"==typeof t[l.iterator])return s.subscribeToIterable(t);var e=u.isObject(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+e+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},"k/06":function(t,e,n){"use strict";e.observable=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},kZSD:function(t,e,n){"use strict";var i=n("d4zx"),r=n("ihxi"),s=n("qiMw");e.subscribeToResult=function(t,e,n,o,a){if(void 0===a&&(a=new i.InnerSubscriber(t,n,o)),!a.closed)return e instanceof s.Observable?e.subscribe(a):r.subscribeTo(e)(a)}},lTUY:function(t,e,n){"use strict";var i=n("tpAt");e.subscribeToPromise=function(t){return function(e){return t.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,i.hostReportError),e}}},qiMw:function(t,e,n){"use strict";var i=n("JJ8B"),r=n("Yfti"),s=n("k/06"),o=n("E/Xc"),a=n("QuXn");function c(t){if(t||(t=a.config.Promise||Promise),!t)throw new Error("no Promise impl found");return t}e.Observable=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var i=this.operator,s=r.toSubscriber(t,e,n);if(s.add(i?i.call(s,this.source):this.source||a.config.useDeprecatedSynchronousErrorHandling&&!s.syncErrorThrowable?this._subscribe(s):this._trySubscribe(s)),a.config.useDeprecatedSynchronousErrorHandling&&s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),i.canReportError(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=c(e))((function(e,i){var r;r=n.subscribe((function(e){try{t(e)}catch(n){i(n),r&&r.unsubscribe()}}),i,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[s.observable]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;et.length)&&(e=t.length);for(var n=0,i=new Array(e);ne?1:t>=e?0:NaN};1===(k=M).length&&(C=k,k=function(t,e){return M(C(t),e)}),Math.sqrt(50),Math.sqrt(10),Math.sqrt(2);var P={value:function(){}};function T(){for(var t,e=0,n=arguments.length,i={};e=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function E(t,e){for(var n,i=0,r=t.length;i0)for(var n,i,r=new Array(n),o=0;oe?1:t>=e?0:NaN}H.prototype={constructor:H,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Y="http://www.w3.org/1999/xhtml",J={svg:"http://www.w3.org/2000/svg",xhtml:Y,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},$=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),J.hasOwnProperty(e)?{space:J[e],local:t}:t};function W(t){return function(){this.removeAttribute(t)}}function X(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Q(t,e){return function(){this.setAttribute(t,e)}}function Z(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function G(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function K(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}var tt=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function et(t){return function(){this.style.removeProperty(t)}}function nt(t,e,n){return function(){this.style.setProperty(t,e,n)}}function it(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function rt(t,e){return t.style.getPropertyValue(e)||tt(t).getComputedStyle(t,null).getPropertyValue(e)}function ot(t){return function(){delete this[t]}}function at(t,e){return function(){this[t]=e}}function st(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ct(t){return t.trim().split(/^|\s+/)}function ut(t){return t.classList||new lt(t)}function lt(t){this._node=t,this._names=ct(t.getAttribute("class")||"")}function ht(t,e){for(var n=ut(t),i=-1,r=e.length;++i=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Ot=function(t){var e=$(t);return(e.local?St:Ct)(e)};function Mt(){return null}function Pt(){var t=this.parentNode;t&&t.removeChild(this)}function Tt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ft(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}var Ut={},Et=null;function Dt(t,e,n){return t=jt(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function jt(t,e,n){return function(i){var r=Et;Et=i;try{t.call(this,this.__data__,e,n)}finally{Et=r}}}function At(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function It(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,o=e.length;i=w&&(w=y+1);!(_=v[w])&&++w=0;)(i=r[o])&&(a&&4^i.compareDocumentPosition(a)&&a.parentNode.insertBefore(i,a),a=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=q);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o1?this.each((null==e?et:"function"==typeof e?it:nt)(t,e,null==n?"":n)):rt(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?ot:"function"==typeof e?st:at)(t,e)):this.node()[t]},classed:function(t,e){var n=ct(t+"");if(arguments.length<2){for(var i=ut(this.node()),r=-1,o=n.length;++ro&&(r=e.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,c.push({i:a,x:Xt(n,i)})),o=Zt.lastIndex;return o=0&&e._call.call(null,t),e=e._next;--Kt}()}finally{Kt=0,function(){for(var t,e,n=qt,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:qt=e);Yt=t,de(i)}(),ie=0}}function fe(){var t=oe.now(),e=t-ne;e>1e3&&(re-=e,ne=t)}function de(t){Kt||(te&&(te=clearTimeout(te)),t-ie>24?(t<1/0&&(te=setTimeout(he,t-oe.now()-re)),ee&&(ee=clearInterval(ee))):(ee||(ne=oe.now(),ee=setInterval(fe,1e3)),Kt=1,ae(he)))}ue.prototype=le.prototype={constructor:ue,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?se():+n)+(null==e?0:+e),this._next||Yt===this||(Yt?Yt._next=this:qt=this,Yt=this),this._call=t,this._time=n,de()},stop:function(){this._call&&(this._call=null,this._time=1/0,de())}};var pe=function(t,e,n){var i=new ue;return i.restart((function(n){i.stop(),t(n+e)}),e=null==e?0:+e,n),i},be=j("start","end","cancel","interrupt"),me=[],ve=function(t,e,n,i,r,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var i,r=t.__transition;function o(c){var u,l,h,f;if(1!==n.state)return s();for(u in r)if((f=r[u]).name===n.name){if(3===f.state)return pe(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete r[u]):+u0)throw new Error("too late; already scheduled");return n}function _e(t,e){var n=ye(t,e);if(n.state>3)throw new Error("too late; already running");return n}function ye(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var we,xe,ke,Ce,Se=180/Math.PI,Oe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Me=function(t,e,n,i,r,o){var a,s,c;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(c=t*n+e*i)&&(n-=t*c,i-=e*c),(s=Math.sqrt(n*n+i*i))&&(n/=s,i/=s,c/=s),t*i180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:Xt(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(o.rotate,a.rotate,s,c),function(t,e,n,o){t!==e?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:Xt(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(o.skewX,a.skewX,s,c),function(t,e,n,i,o,a){if(t!==n||e!==i){var s=o.push(r(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Xt(t,n)},{i:s-2,x:Xt(e,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,c),o=a=null,function(t){for(var e,n=-1,i=c.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?ge:_e;return function(){var a=o(this,t),s=a.on;s!==i&&(r=(i=s).copy()).on(e,n),a.on=r}}var Ze=Jt.prototype.constructor;function Ge(t){return function(){this.style.removeProperty(t)}}function Ke(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function tn(t,e,n){var i,r;function o(){var o=e.apply(this,arguments);return o!==r&&(i=(r=o)&&Ke(t,o,n)),i}return o._value=e,o}function en(t){return function(e){this.textContent=t.call(this,e)}}function nn(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&en(i)),e}return i._value=t,i}var rn=0;function on(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function an(){return++rn}var sn=Jt.prototype;on.prototype=(function(t){return Jt().transition(t)}).prototype={constructor:on,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=I(t));for(var i=this._groups,r=i.length,o=new Array(r),a=0;a2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[r]):a=!1;a&&delete t.__transition}}(this,t)}))},Jt.prototype.transition=function(t){var e,n;t instanceof on?(e=t._id,t=t._name):(e=an(),(n=cn).time=se(),t=null==t?null:t+"");for(var i=this._groups,r=i.length,o=0;o1e-6)if(Math.abs(l*s-c*u)>1e-6&&r){var f=n-o,d=i-a,p=s*s+c*c,b=f*f+d*d,m=Math.sqrt(p),v=Math.sqrt(h),g=r*Math.tan((hn-Math.acos((p+h-b)/(2*m*v)))/2),_=g/v,y=g/m;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*u)+","+(e+_*l)),this._+="A"+r+","+r+",0,0,"+ +(l*f>u*d)+","+(this._x1=t+y*s)+","+(this._y1=e+y*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e)},arc:function(t,e,n,i,r,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(i),s=n*Math.sin(i),c=t+a,u=e+s,l=1^o,h=o?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+u:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-u)>1e-6)&&(this._+="L"+c+","+u),n&&(h<0&&(h=h%fn+fn),h>dn?this._+="A"+n+","+n+",0,1,"+l+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+l+","+(this._x1=c)+","+(this._y1=u):h>1e-6&&(this._+="A"+n+","+n+",0,"+ +(h>=hn)+","+l+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}},bn.prototype=mn.prototype={constructor:bn,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var gn=mn.prototype;function _n(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,o,a,s,c,u,l,h,f,d=t._root,p={data:i},b=t._x0,m=t._y0,v=t._x1,g=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((u=e>=(o=(b+v)/2))?b=o:v=o,(l=n>=(a=(m+g)/2))?m=a:g=a,r=d,!(d=d[h=l<<1|u]))return r[h]=p,t;if(s=+t._x.call(null,d.data),c=+t._y.call(null,d.data),e===s&&n===c)return p.next=d,r?r[h]=p:t._root=p,t;do{r=r?r[h]=new Array(4):t._root=new Array(4),(u=e>=(o=(b+v)/2))?b=o:v=o,(l=n>=(a=(m+g)/2))?m=a:g=a}while((h=l<<1|u)==(f=(c>=a)<<1|s>=o));return r[f]=d,r[h]=p,t}vn.prototype=(function(t,e){var n=new vn;if(t instanceof vn)t.each((function(t){n.add(t)}));else if(t){var i=-1,r=t.length;if(null==e)for(;++il&&(l=i),rh&&(h=r));if(c>l||u>h)return this;for(this.cover(c,u).cover(l,h),n=0;nt||t>=r||i>e||e>=o;)switch(s=(ef||(o=c.y0)>d||(a=c.x1)=v)<<1|t>=m)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=c)}else{var g=t-+this._x.call(null,b.data),_=e-+this._y.call(null,b.data),y=g*g+_*_;if(y=(s=(p+m)/2))?p=s:m=s,(l=a>=(c=(b+v)/2))?b=c:v=c,e=d,!(d=d[h=l<<1|u]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,f=h)}for(;d.data!==t;)if(i=d,!(d=d.next))return this;return(r=d.next)&&delete d.next,i?(r?i.next=r:delete i.next,this):e?(r?e[h]=r:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[f]=d:this._root=d),this):(this._root=r,this)},Sn.removeAll=function(t){for(var e=0,n=t.length;e1);return t+n*o*Math.sqrt(-2*Math.log(r)/r)}}return n.source=t,n}(On)),Pn=(function t(e){function n(){var t=Mn.source(e).apply(this,arguments);return function(){return Math.exp(t())}}return n.source=t,n}(On),function t(e){function n(t){return function(){for(var n=0,i=0;i":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}Tn.prototype,Tn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Fn,Un=Array.prototype.map;void 0===(Fn={decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}).grouping||void 0===Fn.thousands||Un.call(Fn.grouping,Number),void 0===Fn.numerals||Un.call(Fn.numerals,String);var En=new Date,Dn=new Date;function jn(t,e,n,i){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=function(e){return t(e=new Date(+e)),e},r.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},r.round=function(t){var e=r(t),n=r.ceil(t);return t-e0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,i){if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););}))},n&&(r.count=function(e,i){return En.setTime(+e),Dn.setTime(+i),t(En),t(Dn),Math.floor(n(En,Dn))},r.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?function(e){return i(e)%t==0}:function(e){return r.count(0,e)%t==0}):r:null}),r}var An=jn((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));An.every=function(t){return isFinite(t=Math.floor(t))&&t>0?jn((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var In=An;function Vn(t){return jn((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}jn((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}));var Nn=Vn(0),Rn=Vn(1),Ln=(Vn(2),Vn(3),Vn(4)),Hn=(Vn(5),Vn(6),jn((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1}))),Bn=(jn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),jn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),jn((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),jn((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t})));function zn(t){return jn((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}Bn.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?jn((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Bn:null};var qn=zn(0),Yn=zn(1),Jn=(zn(2),zn(3),zn(4)),$n=(zn(5),zn(6),jn((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}))),Wn=jn((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Wn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?jn((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Xn=Wn,Qn={"-":"",_:" ",0:"0"},Zn=/[\\^$*+?|[\]().{}]/g;function Gn(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o=4||0===e?Ln(t):Ln.ceil(t)}function pi(t,e){return t=di(t),Gn(Ln.count(In(t),t)+(4===In(t).getDay()),e,2)}function bi(t){return t.getDay()}function mi(t,e){return Gn(Rn.count(In(t)-1,t),e,2)}function vi(t,e){return Gn(t.getFullYear()%100,e,2)}function gi(t,e){return Gn((t=di(t)).getFullYear()%100,e,2)}function _i(t,e){return Gn(t.getFullYear()%1e4,e,4)}function yi(t,e){var n=t.getDay();return Gn((t=n>=4||0===n?Ln(t):Ln.ceil(t)).getFullYear()%1e4,e,4)}function wi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Gn(e/60|0,"0",2)+Gn(e%60,"0",2)}function xi(t,e){return Gn(t.getUTCDate(),e,2)}function ki(t,e){return Gn(t.getUTCHours(),e,2)}function Ci(t,e){return Gn(t.getUTCHours()%12||12,e,2)}function Si(t,e){return Gn(1+$n.count(Xn(t),t),e,3)}function Oi(t,e){return Gn(t.getUTCMilliseconds(),e,3)}function Mi(t,e){return Oi(t,e)+"000"}function Pi(t,e){return Gn(t.getUTCMonth()+1,e,2)}function Ti(t,e){return Gn(t.getUTCMinutes(),e,2)}function Fi(t,e){return Gn(t.getUTCSeconds(),e,2)}function Ui(t){var e=t.getUTCDay();return 0===e?7:e}function Ei(t,e){return Gn(qn.count(Xn(t)-1,t),e,2)}function Di(t){var e=t.getUTCDay();return e>=4||0===e?Jn(t):Jn.ceil(t)}function ji(t,e){return t=Di(t),Gn(Jn.count(Xn(t),t)+(4===Xn(t).getUTCDay()),e,2)}function Ai(t){return t.getUTCDay()}function Ii(t,e){return Gn(Yn.count(Xn(t)-1,t),e,2)}function Vi(t,e){return Gn(t.getUTCFullYear()%100,e,2)}function Ni(t,e){return Gn((t=Di(t)).getUTCFullYear()%100,e,2)}function Ri(t,e){return Gn(t.getUTCFullYear()%1e4,e,4)}function Li(t,e){var n=t.getUTCDay();return Gn((t=n>=4||0===n?Jn(t):Jn.ceil(t)).getUTCFullYear()%1e4,e,4)}function Hi(){return"+0000"}function Bi(){return"%"}function zi(t){return+t}function qi(t){return Math.floor(+t/1e3)}function Yi(){this._=null}function Ji(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function $i(t,e){var n=e,i=e.R,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.R=i.L,n.R&&(n.R.U=n),i.L=n}function Wi(t,e){var n=e,i=e.L,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.L=i.R,n.L&&(n.L.U=n),i.R=n}function Xi(t){for(;t.L;)t=t.L;return t}(function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,a=t.shortDays,s=t.months,c=t.shortMonths,u=(ti(r),ei(r),ti(o),ei(o),ti(a),ei(a),ti(s),ei(s),ti(c),ei(c),{a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:ni,e:ni,f:si,g:gi,G:yi,H:ii,I:ri,j:oi,L:ai,m:ci,M:ui,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:zi,s:qi,S:li,u:hi,U:fi,V:pi,w:bi,W:mi,x:null,X:null,y:vi,Y:_i,Z:wi,"%":Bi}),l={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:xi,e:xi,f:Mi,g:Ni,G:Li,H:ki,I:Ci,j:Si,L:Oi,m:Pi,M:Ti,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:zi,s:qi,S:Fi,u:Ui,U:Ei,V:ji,w:Ai,W:Ii,x:null,X:null,y:Vi,Y:Ri,Z:Hi,"%":Bi};function h(t,e){return function(n){var i,r,o,a=[],s=-1,c=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++s0)){if(o/=f,f<0){if(o0){if(o>h)return;o>l&&(l=o)}if(o=i-c,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>l&&(l=o)}else if(f>0){if(o0)){if(o/=d,d<0){if(o0){if(o>h)return;o>l&&(l=o)}if(o=r-u,d||!(o<0)){if(o/=d,d<0){if(o>h)return;o>l&&(l=o)}else if(d>0){if(o0||h<1)||(l>0&&(t[0]=[c+l*f,u+l*d]),h<1&&(t[1]=[c+h*f,u+h*d]),!0)}}}}}function er(t,e,n,i,r){var o=t[1];if(o)return!0;var a,s,c=t[0],u=t.left,l=t.right,h=u[0],f=u[1],d=l[0],p=l[1],b=(h+d)/2;if(p===f){if(b=i)return;if(h>d){if(c){if(c[1]>=r)return}else c=[b,n];o=[b,r]}else{if(c){if(c[1]1)if(h>d){if(c){if(c[1]>=r)return}else c=[(n-s)/a,n];o=[(r-s)/a,r]}else{if(c){if(c[1]=i)return}else c=[e,a*e+s];o=[i,a*i+s]}else{if(c){if(c[0]=-kr)){var d=c*c+u*u,p=l*l+h*h,b=(h*d-u*p)/f,m=(c*p-l*d)/f,v=ar.pop()||new sr;v.arc=t,v.site=r,v.x=b+a,v.y=(v.cy=m+s)+Math.sqrt(b*b+m*m),t.circle=v;for(var g=null,_=yr._;_;)if(v.y<_.y||v.y===_.y&&v.x<=_.x){if(!_.L){g=_.P;break}_=_.L}else{if(!_.R){g=_;break}_=_.R}yr.insert(g,v),g||(or=v)}}}}function ur(t){var e=t.circle;e&&(e.P||(or=e.N),yr.remove(e),ar.push(e),Ji(e),t.circle=null)}var lr=[];function hr(){Ji(this),this.edge=this.site=this.circle=null}function fr(t){var e=lr.pop()||new hr;return e.site=t,e}function dr(t){ur(t),gr.remove(t),lr.push(t),Ji(t)}function pr(t){var e=t.circle,n=e.x,i=e.cy,r=[n,i],o=t.P,a=t.N,s=[t];dr(t);for(var c=o;c.circle&&Math.abs(n-c.circle.x)xr)s=s.L;else{if(!((r=o-vr(s,a))>xr)){i>-xr?(e=s.P,n=s):r>-xr?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}!function(t){_r[t.index]={site:t,halfedges:[]}}(t);var c=fr(t);if(gr.insert(e,c),e||n){if(e===n)return ur(e),n=fr(e.site),gr.insert(c,n),c.edge=n.edge=Zi(e.site,c.site),cr(e),void cr(n);if(n){ur(e),ur(n);var u=e.site,l=u[0],h=u[1],f=t[0]-l,d=t[1]-h,p=n.site,b=p[0]-l,m=p[1]-h,v=2*(f*m-d*b),g=f*f+d*d,_=b*b+m*m,y=[(m*g-d*_)/v+l,(f*_-b*g)/v+h];Ki(n.edge,u,p,y),c.edge=Zi(u,t,null,y),n.edge=Zi(t,p,null,y),cr(e),cr(n)}else c.edge=Zi(e.site,c.site)}}function mr(t,e){var n=t.site,i=n[0],r=n[1],o=r-e;if(!o)return i;var a=t.P;if(!a)return-1/0;var s=(n=a.site)[0],c=n[1],u=c-e;if(!u)return s;var l=s-i,h=1/o-1/u,f=l/u;return h?(-f+Math.sqrt(f*f-2*h*(l*l/(-2*u)-c+u/2+r-o/2)))/h+i:(i+s)/2}function vr(t,e){var n=t.N;if(n)return mr(n,e);var i=t.site;return i[1]===e?i[0]:1/0}var gr,_r,yr,wr,xr=1e-6,kr=1e-12;function Cr(t,e){return e[1]-t[1]||e[0]-t[0]}function Sr(t,e){var n,i,r,o=t.sort(Cr).pop();for(wr=[],_r=new Array(t.length),gr=new Qi,yr=new Qi;;)if(r=or,o&&(!r||o[1]xr||Math.abs(r[0][1]-r[1][1])>xr)||delete wr[o]}(a,s,c,u),function(t,e,n,i){var r,o,a,s,c,u,l,h,f,d,p,b,m=_r.length,v=!0;for(r=0;rxr||Math.abs(b-f)>xr)&&(c.splice(s,0,wr.push(Gi(a,d,Math.abs(p-t)xr?[t,Math.abs(h-t)xr?[Math.abs(f-i)xr?[n,Math.abs(h-n)xr?[Math.abs(f-e)=s)return null;var c=t-r.site[0],u=e-r.site[1],l=c*c+u*u;do{r=o.cells[i=a],a=null,r.halfedges.forEach((function(n){var i=o.edges[n],s=i.left;if(s!==r.site&&s||(s=i.right)){var c=t-s[0],u=e-s[1],h=c*c+u*u;h1&&void 0!==arguments[1]&&arguments[1],n={type:"FeatureCollection",features:[]};for(var i in this.localFeatures){var r;(i!=t||e)&&(console.log("feature key",this.localFeatures[i]),(r=n.features).push.apply(r,s(this.localFeatures[i].features)))}return n}},{key:"ngOnDestroy",value:function(){this.newFeatureSubscription.unsubscribe(),this.predictions.removeVisibleFeatures(this.issue)}}]),t}()).\u0275fac=function(t){return new(t||Br)(b.Pb(l.d),b.Pb(l.e),b.Pb(l.b),b.Pb(Lr.a))},Br.\u0275cmp=b.Jb({type:Br,selectors:[["mol-spatial-feedback"]],inputs:{id:"id",scientificname:"scientificname",issue:"issue",drawOn:"drawOn",addDisabled:"addDisabled",clear:"clear",features:"features"},outputs:{nowDrawingIn:"nowDrawingIn",setFeatures:"setFeatures"},features:[b.Ab],decls:1,vars:1,consts:[["mat-icon-button","",3,"click",4,"ngIf"],["mat-icon-button","",3,"click"],[3,"color"]],template:function(t,e){1&t&&b.Fc(0,Hr,3,1,"button",0),2&t&&b.mc("ngIf",e.drawOn)},directives:[c.t,jr.b,Nr.a],styles:[".card-title[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.card-title[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0}.card-title.feedback-list[_ngcontent-%COMP%]{width:100%}.card-title[_ngcontent-%COMP%] .left[_ngcontent-%COMP%]{display:flex;flex-direction:row}[_nghost-%COMP%]{width:95%}.note-text[_ngcontent-%COMP%]{line-height:smaller;font-size:smaller;color:#7f7f7f;padding-left:15px}.mat-icon-button[_ngcontent-%COMP%]{margin-left:2px}.mat-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:right}.feedback-icon[_ngcontent-%COMP%]{min-width:20px;max-width:20px;min-height:20px;max-height:20px;margin-right:5px}.false_presence[_ngcontent-%COMP%]{background-color:#00c814}.false_absence[_ngcontent-%COMP%]{background-color:#c80000}.note[_ngcontent-%COMP%]{background-color:#7f7f7f} .in-draw{background:#fff;color:#000}"]}),Br),qr=o("s2Ay");function Yr(t,e){if(1&t&&(b.Vb(0,"mat-option",32),b.Hc(1),b.Ub()),2&t){var n=e.$implicit;b.mc("value",n.prediction_id),b.Cb(1),b.Lc(" ",n.version," - Rank: ",n.prediction_rank,", ",n.range_offset?"":"No ","Range offset, AUC: ",n.auc," ")}}function Jr(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div",44),b.Vb(1,"div",45),b.Vb(2,"div",46),b.Vb(3,"h4"),b.Hc(4),b.ic(5,"translate"),b.Ub(),b.Ub(),b.Vb(6,"div",15),b.Vb(7,"ngx-slider",47),b.dc("userChangeEnd",(function(t){b.xc(n);var e=b.hc().$implicit;return b.hc(2).setOpacity(e,t)})),b.Ub(),b.Ub(),b.Ub(),b.Ub()}if(2&t){var i=b.hc().$implicit,r=b.hc(2);b.Cb(4),b.Ic(b.jc(5,3,"opacity")),b.Cb(3),b.mc("formControlName",i.sliderName)("options",r.sliderOpts)}}function $r(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div",33),b.Vb(1,"div",34),b.Vb(2,"mol-checkbox",35),b.dc("stateChange",(function(t){b.xc(n);var i=e.$implicit;return b.hc(2).toggleLayer(i,t)})),b.ic(3,"translate"),b.Ub(),b.Vb(4,"div",36),b.Vb(5,"button",37),b.dc("click",(function(t){b.xc(n);var i=e.$implicit;return b.hc(2).showOpacity(i,t)})),b.Vb(6,"mat-icon",38),b.ic(7,"translate"),b.Hc(8,"opacity"),b.Ub(),b.Ub(),b.Vb(9,"button",39),b.dc("click",(function(){return b.xc(n),b.hc(2).zoom()})),b.Vb(10,"mat-icon",38),b.ic(11,"translate"),b.Hc(12,"zoom_in"),b.Ub(),b.Ub(),b.Vb(13,"button",40),b.dc("click",(function(){b.xc(n);var t=e.$implicit;return b.hc(2).showInfo(t)})),b.Qb(14,"i",41),b.ic(15,"translate"),b.Ub(),b.Vb(16,"div"),b.Qb(17,"img",42),b.Ub(),b.Ub(),b.Ub(),b.Fc(18,Jr,8,5,"div",43),b.Ub()}if(2&t){var i=e.$implicit;b.Cb(2),b.mc("label",b.jc(3,9,i.title))("checked",i.checked),b.Cb(3),b.mc("disabled",!i.checked),b.Cb(1),b.mc("matTooltip",b.jc(7,11,"change_opacity")),b.Cb(3),b.mc("disabled",!0),b.Cb(1),b.mc("matTooltip",b.jc(11,13,"zoom_to_layer")),b.Cb(4),b.mc("matTooltip",b.jc(15,15,i.info)),b.Cb(3),b.mc("src",i.img,b.zc),b.Cb(1),b.mc("ngIf",i.opacity)}}function Wr(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div",11),b.Vb(1,"mat-form-field",12),b.Vb(2,"mat-label"),b.Hc(3),b.ic(4,"translate"),b.Ub(),b.Vb(5,"input",48),b.dc("change",(function(){return b.xc(n),b.hc(2).onMinMaxChange()})),b.Ub(),b.Ub(),b.Ub()}2&t&&(b.Cb(3),b.Ic(b.jc(4,1,"max")))}function Xr(t,e){if(1&t){var n=b.Wb();b.Vb(0,"ngx-slider",49),b.dc("userChangeEnd",(function(){return b.xc(n),b.hc(2).updateMap()}))("valueChange",(function(t){return b.xc(n),b.hc(2).minThreshold=t})),b.Ub()}if(2&t){var i=b.hc(2);b.mc("value",i.minThreshold)("options",i.predictionSliderOpts)}}function Qr(t,e){if(1&t){var n=b.Wb();b.Vb(0,"ngx-slider",50),b.dc("userChangeEnd",(function(){return b.xc(n),b.hc(2).updateMap()}))("valueChange",(function(t){return b.xc(n),b.hc(2).minThreshold=t}))("highValueChange",(function(t){return b.xc(n),b.hc(2).maxThreshold=t})),b.Ub()}if(2&t){var i=b.hc(2);b.mc("value",i.minThreshold)("highValue",i.maxThreshold)("options",i.predictionSliderOpts)}}function Zr(t,e){1&t&&(b.Vb(0,"span"),b.Hc(1),b.ic(2,"translate"),b.Ub()),2&t&&(b.Cb(1),b.Ic(b.jc(2,1,"very_poor")))}function Gr(t,e){1&t&&(b.Vb(0,"span"),b.Hc(1),b.ic(2,"translate"),b.Ub()),2&t&&(b.Cb(1),b.Ic(b.jc(2,1,"excellent")))}function Kr(t,e){if(1&t&&(b.Vb(0,"div",51),b.Qb(1,"mat-radio-button",52),b.Vb(2,"span"),b.Vb(3,"strong"),b.Hc(4),b.Ub(),b.Ub(),b.Fc(5,Zr,3,3,"span",0),b.Fc(6,Gr,3,3,"span",0),b.Ub()),2&t){var n=e.$implicit,i=b.hc(2);b.Cb(1),b.mc("value",n)("checked",i.feedback.rating==n),b.Cb(3),b.Ic(n),b.Cb(1),b.mc("ngIf",1==n),b.Cb(1),b.mc("ngIf",5==n)}}function to(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mol-spatial-feedback",58),b.dc("setFeatures",(function(t){return b.xc(n),b.hc(3).setFeatures(t)}))("nowDrawingIn",(function(t){return b.xc(n),b.hc(3).nowDrawingIn(t)})),b.Ub()}if(2&t){var i=b.hc().$implicit,r=b.hc(2);b.mc("addDisabled",r.drawingIn==i.title)("issue",i.title)("features",r.feedback.spatialFeedbacks)}}var eo=function(){return{standalone:!0}};function no(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mat-form-field",59),b.Vb(1,"mat-label"),b.Hc(2),b.ic(3,"translate"),b.Ub(),b.Vb(4,"textarea",60),b.dc("ngModelChange",(function(t){return b.xc(n),b.hc().$implicit.comment=t}))("change",(function(){return b.xc(n),b.hc(3).onTextAreaChanged()})),b.Ub(),b.Ub()}if(2&t){var i=b.hc().$implicit;b.Cb(2),b.Ic(b.jc(3,3,"leave_comment")),b.Cb(2),b.mc("ngModel",i.comment)("ngModelOptions",b.oc(5,eo))}}function io(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div"),b.Vb(1,"div",53),b.Vb(2,"mol-checkbox",35),b.dc("stateChange",(function(t){b.xc(n);var i=e.$implicit;return b.hc(2).toggleFeedback(i,t)})),b.ic(3,"translate"),b.Ub(),b.Vb(4,"button",54),b.Qb(5,"i",41),b.Ub(),b.Fc(6,to,1,3,"mol-spatial-feedback",55),b.Ub(),b.Vb(7,"div",56),b.Fc(8,no,5,6,"mat-form-field",57),b.Ub(),b.Ub()}if(2&t){var i=e.$implicit;b.Cb(2),b.mc("label",b.jc(3,5,i.name))("checked",i.selected),b.Cb(3),b.mc("matTooltip",i.description),b.Cb(1),b.mc("ngIf",i.selected),b.Cb(2),b.mc("ngIf",i.selected)}}function ro(t,e){if(1&t&&(b.Vb(0,"mat-option",32),b.Hc(1),b.Ub()),2&t){var n=e.$implicit;b.mc("value",n),b.Cb(1),b.Ic(n.mol_id)}}function oo(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mol-spatial-feedback",67),b.dc("setFeatures",(function(t){return b.xc(n),b.hc(5).setFeatures(t)}))("nowDrawingIn",(function(t){return b.xc(n),b.hc(5).nowDrawingIn(t)})),b.Ub()}if(2&t){var i=b.hc().$implicit,r=b.hc(4);b.mc("issue",i)("drawOn",!1)("features",r.selectedExpert.spatial_feedback)}}function ao(t,e){if(1&t&&(b.Vb(0,"div",56),b.Vb(1,"textarea",68),b.Hc(2),b.Ub(),b.Ub()),2&t){var n=b.hc(5);b.Cb(2),b.Ic(n.selectedExpert.issue_comments[n.issue])}}function so(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div"),b.Vb(1,"mol-checkbox",64),b.dc("stateChange",(function(t){b.xc(n);var i=e.$implicit;return b.hc(4).toggleOtherFeedback(i,t)})),b.Ub(),b.Fc(2,oo,1,3,"mol-spatial-feedback",65),b.Fc(3,ao,3,1,"div",66),b.Ub()}if(2&t){var i=e.$implicit,r=b.hc(4);b.Cb(1),b.mc("label",i)("checked",r.selectedExpert.selected[i]),b.Cb(1),b.mc("ngIf",r.selectedExpert.selected[i]),b.Cb(1),b.mc("ngIf",r.selectedExpert.issue_comments&&r.selectedExpert.issue_comments[r.issue])}}function co(t,e){if(1&t&&(b.Vb(0,"div"),b.Fc(1,so,4,4,"div",27),b.Ub()),2&t){var n=b.hc(3);b.Cb(1),b.mc("ngForOf",n.selectedExpert.issues.split(";"))}}function uo(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div",61),b.Vb(1,"h4"),b.Vb(2,"strong"),b.Hc(3),b.ic(4,"translate"),b.Ub(),b.Ub(),b.Vb(5,"mat-form-field",62),b.Vb(6,"mat-label"),b.Hc(7,"Expert ID"),b.Ub(),b.Vb(8,"mat-select",63),b.dc("selectionChange",(function(){return{}}))("valueChange",(function(t){return b.xc(n),b.hc(2).selectedExpert=t})),b.Fc(9,ro,2,2,"mat-option",6),b.Ub(),b.Ub(),b.Fc(10,co,2,1,"div",0),b.Ub()}if(2&t){var i=b.hc(2);b.Cb(3),b.Ic(b.jc(4,4,"existing_feedback")),b.Cb(5),b.mc("value",i.selectedExpert),b.Cb(1),b.mc("ngForOf",i.othersFeedback),b.Cb(1),b.mc("ngIf",i.selectedExpert)}}var lo=function(){return[1,2,3,4,5]};function ho(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mat-card"),b.Vb(1,"h2",1),b.Vb(2,"div"),b.Vb(3,"strong"),b.Hc(4),b.Ub(),b.Ub(),b.Ub(),b.Vb(5,"form",2),b.Vb(6,"div",3),b.Vb(7,"mat-form-field",4),b.Vb(8,"mat-select",5),b.Fc(9,Yr,2,5,"mat-option",6),b.Ub(),b.Ub(),b.Ub(),b.Fc(10,$r,19,17,"div",7),b.Vb(11,"div",8),b.Vb(12,"div",9),b.Vb(13,"mat-slide-toggle",10),b.dc("toggleChange",(function(){return b.xc(n),b.hc().updateToggle("binary")})),b.Hc(14),b.ic(15,"translate"),b.Ub(),b.Ub(),b.Vb(16,"div",11),b.Vb(17,"mat-form-field",12),b.Vb(18,"mat-label"),b.Hc(19),b.ic(20,"translate"),b.Ub(),b.Vb(21,"input",13),b.dc("change",(function(){return b.xc(n),b.hc().onMinMaxChange()})),b.Ub(),b.Ub(),b.Ub(),b.Fc(22,Wr,6,3,"div",14),b.Ub(),b.Vb(23,"div",15),b.Fc(24,Xr,1,2,"ngx-slider",16),b.Fc(25,Qr,1,3,"ngx-slider",17),b.Ub(),b.Vb(26,"div",18),b.Vb(27,"div",19),b.Vb(28,"small"),b.Hc(29),b.ic(30,"translate"),b.Ub(),b.Ub(),b.Vb(31,"div",20),b.Vb(32,"span"),b.Hc(33),b.ic(34,"translate"),b.Ub(),b.Vb(35,"span"),b.Hc(36),b.ic(37,"translate"),b.Ub(),b.Ub(),b.Ub(),b.Qb(38,"mat-divider"),b.Vb(39,"div",21),b.Vb(40,"button",22),b.dc("click",(function(){return b.xc(n),b.hc().submitFeedback()})),b.Hc(41),b.ic(42,"translate"),b.Ub(),b.Ub(),b.Vb(43,"div",23),b.Vb(44,"h4"),b.Vb(45,"strong"),b.Hc(46),b.ic(47,"translate"),b.Ub(),b.Ub(),b.Vb(48,"mat-radio-group",24),b.dc("change",(function(t){return b.xc(n),b.hc().setRating(t)})),b.Fc(49,Kr,7,5,"div",25),b.Ub(),b.Ub(),b.Vb(50,"div",26),b.Vb(51,"h4"),b.Vb(52,"strong"),b.Hc(53),b.ic(54,"translate"),b.Ub(),b.Ub(),b.Fc(55,io,9,7,"div",27),b.Ub(),b.Vb(56,"div",28),b.Vb(57,"button",29),b.dc("click",(function(){return b.xc(n),b.hc().getPreviousSpecies()})),b.Hc(58),b.ic(59,"translate"),b.Ub(),b.Vb(60,"button",30),b.dc("click",(function(){return b.xc(n),b.hc().getNextSpecies()})),b.Hc(61),b.ic(62,"translate"),b.Ub(),b.Ub(),b.Fc(63,uo,11,6,"div",31),b.Ub(),b.Ub()}if(2&t){var i=b.hc();b.Cb(4),b.Ic(i.modelInfo.sciname),b.Cb(1),b.mc("formGroup",i.predictionsForm),b.Cb(4),b.mc("ngForOf",i.modelList),b.Cb(1),b.mc("ngForOf",i.layers),b.Cb(3),b.mc("checked",i.binaryMap),b.Cb(1),b.Jc(" ",b.jc(15,25,"binary")," "),b.Cb(5),b.Ic(b.jc(20,27,"min")),b.Cb(3),b.mc("ngIf",!i.binaryMap),b.Cb(2),b.mc("ngIf",i.binaryMap),b.Cb(1),b.mc("ngIf",!i.binaryMap),b.Cb(1),b.mc("hidden",i.binaryMap),b.Cb(3),b.Ic(b.jc(30,29,"sdm_legend")),b.Cb(4),b.Ic(b.jc(34,31,"less_likely")),b.Cb(3),b.Ic(b.jc(37,33,"highly_likely")),b.Cb(4),b.mc("disabled",i.disableSave),b.Cb(1),b.Jc(" ",b.jc(42,35,"save")," "),b.Cb(5),b.Ic(b.jc(47,37,"pred_rating")),b.Cb(3),b.mc("ngForOf",b.oc(45,lo)),b.Cb(4),b.Ic(b.jc(54,39,"feedback")),b.Cb(2),b.mc("ngForOf",i.commonProblemsLocal),b.Cb(2),b.mc("disabled",i.worksheetEmpty),b.Cb(1),b.Jc(" ",b.jc(59,41,"previous_species")," "),b.Cb(2),b.mc("disabled",i.worksheetEmpty),b.Cb(1),b.Jc(" ",b.jc(62,43,"next_species")," "),b.Cb(2),b.mc("ngIf",i.othersFeedback&&0!=i.othersFeedback.length)}}function fo(t,e){1&t&&(b.Vb(0,"div"),b.Vb(1,"mat-card"),b.Vb(2,"mat-card-title"),b.Hc(3,"Loading..."),b.Ub(),b.Ub(),b.Ub())}var po,bo=((po=function(){function t(e,n,i){var o=this;r(this,t),this.predictionsService=e,this.map=n,this.translate=i,this.showBackground=new b.o,this.refreshPrediction=new b.o,this.modelChange=new b.o,this.nextSpecies=new b.o,this.previousSpecies=new b.o,this.openMetadata=new b.o,this.PDF=new b.o,this.updateThreshold=new b.o,this.commonProblemsLocal=null,this.drawDisabled=!1,this.othersFeedback=["a","b"],this.disableSave=!0,this.predictionsForm=new O.i({model:new O.f,min:new O.f,max:new O.f,mask:new O.f(!0),updateMinROC:new O.f(!0),points:new O.f(1),range:new O.f(.3),rangemap:new O.f(.8),feedback:new O.f(1),prediction:new O.f(1)}),this.sliderOpts={step:.05,floor:0,ceil:1,showSelectionBar:!0,showTicks:!1},this.feedback={rating:-1,spatialFeedbacks:{},issue_comments:{}},this.layers=[{title:"layers_prediction",checked:!0,opacity:!1,sliderName:"prediction",layerIndex:2,img:"https://cdn.mol.org/static/images/legends/datatypes/model.png",info:"info_layers_prediction"},{title:"layers_expert_range",checked:!1,opacity:!1,sliderName:"rangemap",layerIndex:0,img:"https://cdn.mol.org/static/images/legends/datatypes/range.png",info:"info_layers_expert_range"},{title:"layers_model_input",checked:!0,opacity:!1,sliderName:"range",layerIndex:1,img:"https://cdn.mol.org/static/images/legends/datatypes/range.png",info:"info_layers_model_input"},{title:"layers_points",checked:!0,opacity:!1,sliderName:"points",layerIndex:3,img:"https://mapoflife.github.io/experts-next/assets/points.png",bgImg:"https://mapoflife.github.io/experts-next/assets/background_points.png",info:"info_layers_points"}],this.predictionSliderOpts=null,this.modelInfo=null,this.backgroundPoints=!1,this.binaryMap=!0,this.logMap=!1,this.map.clickedFeatures.subscribe((function(t){var e,n;if(t&&t.length>0){console.log("clicked feature",null===(e=t[0])||void 0===e?void 0:e.getProperties());var i=null===(n=t[0])||void 0===n?void 0:n.getProperties(),r=o.feedback.spatialFeedbacks[null==i?void 0:i.issue],a=r.features.findIndex((function(t){return t.properties.feedback_id==(null==i?void 0:i.feedback_id)}));r.features.splice(a,1),r.features=r.features.map((function(t,e){return t.properties.feedback_index=e+1,t})),o.predictionsService.setVisibleFeatures(null==i?void 0:i.issue,r)}})),this.predictionsService.visibleFeatures.subscribe((function(t){var e={type:"FeatureCollection",features:[]};for(var n in t){var i;(i=e.features).push.apply(i,s(t[n].features))}o.map.userFeaturesSet(e)}))}return a(t,[{key:"ngOnInit",value:function(){this.toggleLayer(this.layers[1],!1)}},{key:"ngOnChanges",value:function(t){var e,n=this;t.info&&(this.predictionSliderOpts={floor:.01*this.minThreshold,step:.001*this.minThreshold,ceil:this.maxThreshold,translate:function(t,e){switch(e){case Mr.a.Ceil:case Mr.a.Floor:return""+t.toExponential(0)+"";default:return""+t.toExponential(2)+""}}},this.setupInfo()),this.commonProblemsLocal=[].concat(d),this.feedback.project_id=this.project_id,this.feedback.prediction_id=this.info.prediction_id,this.othersFeedback=null,this.selectedExpert=null,this.predictionsService.getFeedbackOthers(this.project_id,this.info.prediction_id).subscribe((function(t){t.forEach((function(t){var e;t.selected=null===(e=t.issues)||void 0===e?void 0:e.split(";").reduce((function(t,e){return t[e]=!1,t}),{})})),n.othersFeedback=t})),this.predictionsService.getSDMFeedbackv2(this.project_id,this.info.prediction_id).subscribe((function(t){var e,i,r,o;n.feedback.spatialFeedbacks=null!==(e=(t=(null==t?void 0:t.length)>0?t[0]:{}).spatial_feedback)&&void 0!==e?e:{},n.feedback.rating=null!==(i=t.rating)&&void 0!==i?i:-1;var a=null!==(o=null===(r=t.issues)||void 0===r?void 0:r.split(";"))&&void 0!==o?o:[];n.commonProblemsLocal.forEach((function(e){e.selected=a.indexOf(e.title)>-1,e.comment=(null==t?void 0:t.issue_comments)?null==t?void 0:t.issue_comments[e.title]:"",n.disableSave=!0}))})),(null===(e=t.predictionOptions)||void 0===e?void 0:e.currentValue.min)&&this.predictionsForm.patchValue({min:Number(t.predictionOptions.currentValue.min).toExponential(2),max:Number(t.predictionOptions.currentValue.max).toExponential(2)})}},{key:"ngAfterViewInit",value:function(){this.drawLegend()}},{key:"submitFeedback",value:function(){var t=this.commonProblemsLocal.filter((function(t){return t.selected})).map((function(t){return t.title})).join(";");this.feedback.issues=t,this.feedback.rating>0&&(this.predictionsService.submitFeedback(this.feedback).subscribe((function(t){})),this.disableSave=!0)}},{key:"shouldUpdateMin",value:function(t){return void 0!==t.predictionOptions&&void 0!==t.predictionOptions.currentValue&&t.predictionOptions.currentValue.min!==this.predictionsForm.get("min").value}},{key:"setupInfo",value:function(){if(this.info){var t=this.info.scientificname.replaceAll("_"," ");this.modelInfo={sciname:t,SPSthreshold:this.info.sps_threshold,noRangeOffsetModel:this.info.noRangeOffsetModel,noRangeOffsetModelIndex:this.info.noRangeOffsetModelIndex,isBest:this.info.isBest},this.setPredictionsForm()}}},{key:"toggleOtherFeedback",value:function(t,e){this.selectedExpert.selected[t]=e}},{key:"setPredictionsForm",value:function(){this.predictionsForm.patchValue({model:this.info.prediction_id,min:this.minThreshold.toExponential(2),max:this.maxThreshold.toExponential(2)},{emitEvent:!1})}},{key:"showOpacity",value:function(t,e){e.pointerId>0&&(t.opacity=!t.opacity)}},{key:"zoom",value:function(){}},{key:"showInfo",value:function(t){"rangemap"===t.sliderName&&this.openMetadata.emit("rangemap")}},{key:"setOpacity",value:function(t,e){this.map.updateLayerOpacity(e.value,t.layerIndex)}},{key:"toggleLayer",value:function(t,e){t.checked=e,t.checked?this.map.updateLayerOpacity(this.predictionsForm.get(t.sliderName).value,t.layerIndex):(this.map.updateLayerOpacity(0,t.layerIndex),t.opacity=!1)}},{key:"toggleFeedback",value:function(t,e){this.disableSave=!1,t.selected=e}},{key:"toggleBackground",value:function(){this.backgroundPoints=!this.backgroundPoints,this.showBackground.emit(this.backgroundPoints)}},{key:"updateToggle",value:function(t){"binary"===t?this.binaryMap=!this.binaryMap:"log"===t&&(this.logMap=!this.logMap),this.updateMap()}},{key:"updateMap",value:function(){console.log({min:this.minThreshold,max:this.maxThreshold,binary:this.binaryMap}),this.refreshPrediction.emit({min:this.minThreshold,max:this.maxThreshold,binary:this.binaryMap})}},{key:"getNextSpecies",value:function(){this.drawingIn="",this.nextSpecies.emit()}},{key:"getPreviousSpecies",value:function(){this.drawingIn="",this.previousSpecies.emit()}},{key:"triggerModelAction",value:function(t){switch(t){case"Metadata":this.openMetadata.emit("model");break;case"PDF":this.PDF.emit();break;case"Species":var e="http://mol.org/species/map/"+this.scientificname.split(" ").slice(0,2).join("_");window.open(e,"_blank")}}},{key:"drawLegend",value:function(){var t=new Bt([[document.querySelector("#legend")]],[document.documentElement]).append("svg").attr("width",400).attr("height",10),e=t.append("g");t.append("defs").append("linearGradient").attr("id","linear-gradient").selectAll("stop").data([{offset:"0%",color:"#de2d26"},{offset:"50%",color:"#ffff8c"},{offset:"100%",color:"#2ca25f"}]).enter().append("stop").attr("offset",(function(t){return t.offset})).attr("stop-color",(function(t){return t.color})).attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%"),e.append("rect").attr("width",350).attr("height",20).style("fill","url(#linear-gradient)")}},{key:"addSpatialFeedback",value:function(){this.drawDisabled=!this.drawDisabled,this.map.updateMapState(this.drawDisabled?"DRAW":"MAP")}},{key:"setFeatures",value:function(t){this.disableSave=!1,this.feedback.spatialFeedbacks[t.issue]=t.features}},{key:"setRating",value:function(t){this.disableSave=!1,this.feedback.rating=t.value}},{key:"nowDrawingIn",value:function(t){this.drawingIn=t}},{key:"onTextAreaChanged",value:function(){this.feedback.issue_comments=Object.assign.apply(Object,[{}].concat(s(this.commonProblemsLocal.filter((function(t){return t.selected})).map((function(t){return e={},n=t.title,i=t.comment,n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e;var e,n,i})))))}},{key:"onMinMaxChange",value:function(){this.minThreshold=this.predictionsForm.controls.min.value,this.maxThreshold=this.predictionsForm.controls.max.value,this.updateMap()}}]),t}()).\u0275fac=function(t){return new(t||po)(b.Pb(l.e),b.Pb(l.d),b.Pb(l.j))},po.\u0275cmp=b.Jb({type:po,selectors:[["mol-model-info"]],inputs:{id:"id",project_id:"project_id",info:"info",modelList:"modelList",predictionOptions:"predictionOptions",scientificname:"scientificname",worksheetEmpty:"worksheetEmpty",minThreshold:"minThreshold",maxThreshold:"maxThreshold"},outputs:{showBackground:"showBackground",refreshPrediction:"refreshPrediction",modelChange:"modelChange",nextSpecies:"nextSpecies",previousSpecies:"previousSpecies",openMetadata:"openMetadata",PDF:"PDF",updateThreshold:"updateThreshold"},features:[b.Ab],decls:2,vars:2,consts:[[4,"ngIf"],[1,"species-title"],[3,"formGroup"],[1,"models"],["appearance","fill"],["formControlName","model","name","model"],[3,"value",4,"ngFor","ngForOf"],["class","layers-wrapper",4,"ngFor","ngForOf"],[1,"threshold-toggle"],[1,"binary-toggle"],[3,"checked","toggleChange"],[1,"value-wrapper"],["appearance","fill",1,"max"],["matInput","","formControlName","min",3,"change"],["class","value-wrapper",4,"ngIf"],[1,"mrs-slider","custom-slider"],[3,"value","options","userChangeEnd","valueChange",4,"ngIf"],[3,"value","highValue","options","userChangeEnd","valueChange","highValueChange",4,"ngIf"],[3,"hidden"],["id","legend"],[1,"scale"],[1,"button-box"],["color","primary","mat-raised-button","",3,"disabled","click"],[1,"prediction-score-block"],["aria-label","Select an option",1,"prediction-score",3,"change"],["class","prediction-score score-item",4,"ngFor","ngForOf"],[1,"prediction-feedback"],[4,"ngFor","ngForOf"],[1,"buttons"],["mat-stroked-button","","color","accent",2,"align-items","left",3,"disabled","click"],["mat-stroked-button","","color","accent",2,"align-items","right",3,"disabled","click"],["class","existing-feedback",4,"ngIf"],[3,"value"],[1,"layers-wrapper"],[1,"value-wrapper","layers"],["color","accent",3,"label","checked","stateChange"],[1,"icons"],["mat-icon-button","","aria-label","opacity",3,"disabled","click"],["matTooltipClass","tooltip",3,"matTooltip"],["mat-icon-button","","aria-label","zoom",3,"disabled","click"],["mat-icon-button","","aria-label","info",3,"click"],["matTooltipClass","tooltip",1,"fa","fa-info",3,"matTooltip"],["height","20px","width","20px",1,"legend-img",3,"src"],["class","opacity",4,"ngIf"],[1,"opacity"],[1,"mrs-slider-box"],[1,"mrs","stat","title"],[3,"formControlName","options","userChangeEnd"],["matInput","","formControlName","max",3,"change"],[3,"value","options","userChangeEnd","valueChange"],[3,"value","highValue","options","userChangeEnd","valueChange","highValueChange"],[1,"prediction-score","score-item"],[3,"value","checked"],[1,"feedback-item"],["mat-icon-button","","aria-label","info"],[3,"addDisabled","issue","features","setFeatures","nowDrawingIn",4,"ngIf"],[1,"comment-box"],["class","example-full-width",4,"ngIf"],[3,"addDisabled","issue","features","setFeatures","nowDrawingIn"],[1,"example-full-width"],["matInput","","placeholder","",3,"ngModel","ngModelOptions","ngModelChange","change"],[1,"existing-feedback"],["appearance","standard",1,"dropdown-container"],[3,"value","selectionChange","valueChange"],[3,"label","checked","stateChange"],[3,"issue","drawOn","features","setFeatures","nowDrawingIn",4,"ngIf"],["class","comment-box",4,"ngIf"],[3,"issue","drawOn","features","setFeatures","nowDrawingIn"],["readonly",""]],template:function(t,e){1&t&&(b.Fc(0,ho,64,46,"mat-card",0),b.Fc(1,fo,4,0,"div",0)),2&t&&(b.mc("ngIf",e.info),b.Cb(1),b.mc("ngIf",!e.info))},directives:[c.t,Pr.a,O.H,O.s,O.j,Tr.c,Fr.a,O.r,O.h,c.s,Ur.a,Tr.g,Er.b,O.c,Dr.a,jr.b,Ar.c,Ir.n,Vr.a,Nr.a,Rr.a,Mr.c,Ar.b,zr,O.u,Pr.e],pipes:[qr.c],styles:[".mrs-slider-box{display:flex;justify-content:center;align-items:center;flex-direction:row;place-content:space-between}.mrs-slider-box .mrs{text-align:right;padding-right:5px}.mrs-slider-box .mrs-slider{width:80%}.threshold-toggle{padding-top:27px;height:45px}.threshold-toggle,.value-wrapper{display:flex;justify-content:space-around;align-items:center}.value-wrapper{flex-direction:row}.value-wrapper mat-form-field{max-width:65px}.value-wrapper.binary-toggle{justify-content:flex-end}.value-wrapper.layers,.value-wrapper.options{justify-content:space-between;height:30px}h2{display:flex;flex-direction:row;justify-content:space-between;margin-bottom:5px}h2 small{padding:3px}h4{margin-bottom:11px}h3{margin-bottom:0}.models mat-form-field{width:90%}.icons{display:flex;align-items:center}.colors{display:flex;flex-direction:row}.background,.occurence{width:10px;height:10px;margin:.5em}.break{padding-top:20px}.species-title{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:space-between}h2{margin:0!important}.buttons{width:100%;display:flex;flex-direction:row;justify-content:space-between;margin-top:4px;align-items:center}.buttons button{height:30px}.card-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.actions{margin-top:1.5em}#legend{margin-top:10px}.scale{display:flex;justify-content:space-between}.prediction-score{display:flex;align-items:flex-start;flex-wrap:wrap;justify-content:space-around;align-content:space-around}.score-item{display:flex;flex-direction:column;width:60px;align-items:center}mat-radio-button{width:20px}mat-card{padding:5px 16px!important}.prediction-score-block{margin-top:15px}.prediction-feedback h4,.prediction-score-block h4{margin:3px}mat-selection-list{padding:0}mat-list-option{height:20px}.feedback-item{display:flex;align-items:center;white-space:nowrap;height:25px;margin-left:15px}.comment-box{margin-left:40px}.comment-box mat-form-field{width:300px}.button-box{position:absolute;right:0;margin-top:4px}.existing-feedback{margin-top:7px}.existing-feedback mat-form-field{margin-left:15px}"],encapsulation:2}),po),mo=o("47ST"),vo=o("NiQx"),go=o("SSAN"),_o=o("bl/x"),yo=o("mWib"),wo=o("jxfh"),xo=o("J7xr"),ko=o("cZZj"),Co=o("qvOF"),So=o("5XID"),Oo=o("fAiE"),Mo=o("ZTXN"),Po=o("KTx3"),To=o("g6G6"),Fo=o("xVbo"),Uo=o("kuMc"),Eo=o("Ohay"),Do=o("YtkY"),jo=o("J+dc"),Ao=o("jIqt"),Io=o("f7+R"),Vo=o("5lCh"),No=o("sg/T"),Ro=o("E5oP"),Lo=["*"];function Ho(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div",2),b.dc("click",(function(){return b.xc(n),b.hc()._onBackdropClicked()})),b.Ub()}if(2&t){var i=b.hc();b.Gb("mat-drawer-shown",i._isShowingBackdrop())}}function Bo(t,e){1&t&&(b.Vb(0,"mat-drawer-content"),b.kc(1,2),b.Ub())}var zo=[[["mat-drawer"]],[["mat-drawer-content"]],"*"],qo=["mat-drawer","mat-drawer-content","*"],Yo={transformDrawer:Object(Io.n)("transform",[Object(Io.k)("open, open-instant",Object(Io.l)({transform:"none",visibility:"visible"})),Object(Io.k)("void",Object(Io.l)({"box-shadow":"none",visibility:"hidden"})),Object(Io.m)("void => open-instant",Object(Io.e)("0ms")),Object(Io.m)("void <=> open, open-instant => void",Object(Io.e)("400ms cubic-bezier(0.25, 0.8, 0.25, 1)"))])};function Jo(t){throw Error("A drawer was already declared for 'position=\"".concat(t,"\"'"))}var $o,Wo,Xo,Qo,Zo=new b.r("MAT_DRAWER_DEFAULT_AUTOSIZE",{providedIn:"root",factory:function(){return!1}}),Go=new b.r("MAT_DRAWER_CONTAINER"),Ko=((Qo=function(n){!function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&t(e,n)}(o,n);var i=e(o);function o(t,e,n,a,s){var c;return r(this,o),(c=i.call(this,n,a,s))._changeDetectorRef=t,c._container=e,c}return a(o,[{key:"ngAfterContentInit",value:function(){var t=this;this._container._contentMarginChanges.subscribe((function(){t._changeDetectorRef.markForCheck()}))}}]),o}(Co.a)).\u0275fac=function(t){return new(t||Qo)(b.Pb(b.h),b.Pb(Object(b.U)((function(){return ea}))),b.Pb(b.l),b.Pb(Co.c),b.Pb(b.A))},Qo.\u0275cmp=b.Jb({type:Qo,selectors:[["mat-drawer-content"]],hostAttrs:[1,"mat-drawer-content"],hostVars:4,hostBindings:function(t,e){2&t&&b.Ec("margin-left",e._container._contentMargins.left,"px")("margin-right",e._container._contentMargins.right,"px")},features:[b.zb],ngContentSelectors:Lo,decls:1,vars:0,template:function(t,e){1&t&&(b.lc(),b.kc(0))},encapsulation:2,changeDetection:0}),Qo),ta=((Xo=function(){function t(e,n,i,o,a,s,c){var u=this;r(this,t),this._elementRef=e,this._focusTrapFactory=n,this._focusMonitor=i,this._platform=o,this._ngZone=a,this._doc=s,this._container=c,this._elementFocusedBeforeDrawerWasOpened=null,this._enableAnimations=!1,this._position="start",this._mode="over",this._disableClose=!1,this._opened=!1,this._animationStarted=new Mo.a,this._animationEnd=new Mo.a,this._animationState="void",this.openedChange=new b.o(!0),this._destroyed=new Mo.a,this.onPositionChanged=new b.o,this._modeChanged=new Mo.a,this.openedChange.subscribe((function(t){t?(u._doc&&(u._elementFocusedBeforeDrawerWasOpened=u._doc.activeElement),u._takeFocus()):u._restoreFocus()})),this._ngZone.runOutsideAngular((function(){Object(Po.a)(u._elementRef.nativeElement,"keydown").pipe(Object(Fo.a)((function(t){return t.keyCode===Oo.e&&!u.disableClose&&!Object(Oo.q)(t)})),Object(Uo.a)(u._destroyed)).subscribe((function(t){return u._ngZone.run((function(){u.close(),t.stopPropagation(),t.preventDefault()}))}))})),this._animationEnd.pipe(Object(Eo.a)((function(t,e){return t.fromState===e.fromState&&t.toState===e.toState}))).subscribe((function(t){var e=t.fromState,n=t.toState;(0===n.indexOf("open")&&"void"===e||"void"===n&&0===e.indexOf("open"))&&u.openedChange.emit(u._opened)}))}return a(t,[{key:"_takeFocus",value:function(){var t=this;this.autoFocus&&this._focusTrap&&this._focusTrap.focusInitialElementWhenReady().then((function(e){e||"function"!=typeof t._elementRef.nativeElement.focus||t._elementRef.nativeElement.focus()}))}},{key:"_restoreFocus",value:function(){if(this.autoFocus){var t=this._doc&&this._doc.activeElement;t&&this._elementRef.nativeElement.contains(t)&&(this._elementFocusedBeforeDrawerWasOpened?this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened,this._openedVia):this._elementRef.nativeElement.blur()),this._elementFocusedBeforeDrawerWasOpened=null,this._openedVia=null}}},{key:"ngAfterContentInit",value:function(){this._focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement),this._updateFocusTrapState()}},{key:"ngAfterContentChecked",value:function(){this._platform.isBrowser&&(this._enableAnimations=!0)}},{key:"ngOnDestroy",value:function(){this._focusTrap&&this._focusTrap.destroy(),this._animationStarted.complete(),this._animationEnd.complete(),this._modeChanged.complete(),this._destroyed.next(),this._destroyed.complete()}},{key:"open",value:function(t){return this.toggle(!0,t)}},{key:"close",value:function(){return this.toggle(!1)}},{key:"toggle",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!this.opened,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"program";return this._opened=e,e?(this._animationState=this._enableAnimations?"open":"open-instant",this._openedVia=n):(this._animationState="void",this._restoreFocus()),this._updateFocusTrapState(),new Promise((function(e){t.openedChange.pipe(Object(jo.a)(1)).subscribe((function(t){return e(t?"open":"close")}))}))}},{key:"_updateFocusTrapState",value:function(){this._focusTrap&&(this._focusTrap.enabled=this.opened&&"side"!==this.mode)}},{key:"_animationStartListener",value:function(t){this._animationStarted.next(t)}},{key:"_animationDoneListener",value:function(t){this._animationEnd.next(t)}},{key:"position",get:function(){return this._position},set:function(t){(t="end"===t?"end":"start")!=this._position&&(this._position=t,this.onPositionChanged.emit())}},{key:"mode",get:function(){return this._mode},set:function(t){this._mode=t,this._updateFocusTrapState(),this._modeChanged.next()}},{key:"disableClose",get:function(){return this._disableClose},set:function(t){this._disableClose=Object(So.c)(t)}},{key:"autoFocus",get:function(){var t=this._autoFocus;return null==t?"side"!==this.mode:t},set:function(t){this._autoFocus=Object(So.c)(t)}},{key:"opened",get:function(){return this._opened},set:function(t){this.toggle(Object(So.c)(t))}},{key:"_openedStream",get:function(){return this.openedChange.pipe(Object(Fo.a)((function(t){return t})),Object(Do.a)((function(){})))}},{key:"openedStart",get:function(){return this._animationStarted.pipe(Object(Fo.a)((function(t){return t.fromState!==t.toState&&0===t.toState.indexOf("open")})),Object(Do.a)((function(){})))}},{key:"_closedStream",get:function(){return this.openedChange.pipe(Object(Fo.a)((function(t){return!t})),Object(Do.a)((function(){})))}},{key:"closedStart",get:function(){return this._animationStarted.pipe(Object(Fo.a)((function(t){return t.fromState!==t.toState&&"void"===t.toState})),Object(Do.a)((function(){})))}},{key:"_width",get:function(){return this._elementRef.nativeElement&&this._elementRef.nativeElement.offsetWidth||0}}]),t}()).\u0275fac=function(t){return new(t||Xo)(b.Pb(b.l),b.Pb(No.i),b.Pb(No.h),b.Pb(ko.a),b.Pb(b.A),b.Pb(c.e,8),b.Pb(Go,8))},Xo.\u0275cmp=b.Jb({type:Xo,selectors:[["mat-drawer"]],hostAttrs:["tabIndex","-1",1,"mat-drawer"],hostVars:12,hostBindings:function(t,e){1&t&&b.Hb("@transform.start",(function(t){return e._animationStartListener(t)}))("@transform.done",(function(t){return e._animationDoneListener(t)})),2&t&&(b.Db("align",null),b.Mc("@transform",e._animationState),b.Gb("mat-drawer-end","end"===e.position)("mat-drawer-over","over"===e.mode)("mat-drawer-push","push"===e.mode)("mat-drawer-side","side"===e.mode)("mat-drawer-opened",e.opened))},inputs:{position:"position",mode:"mode",disableClose:"disableClose",autoFocus:"autoFocus",opened:"opened"},outputs:{openedChange:"openedChange",onPositionChanged:"positionChanged",_openedStream:"opened",openedStart:"openedStart",_closedStream:"closed",closedStart:"closedStart"},exportAs:["matDrawer"],ngContentSelectors:Lo,decls:2,vars:0,consts:[[1,"mat-drawer-inner-container"]],template:function(t,e){1&t&&(b.lc(),b.Vb(0,"div",0),b.kc(1),b.Ub())},encapsulation:2,data:{animation:[Yo.transformDrawer]},changeDetection:0}),Xo),ea=((Wo=function(){function t(e,n,i,o,a){var s=this,c=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6?arguments[6]:void 0;r(this,t),this._dir=e,this._element=n,this._ngZone=i,this._changeDetectorRef=o,this._animationMode=u,this._drawers=new b.E,this.backdropClick=new b.o,this._destroyed=new Mo.a,this._doCheckSubject=new Mo.a,this._contentMargins={left:null,right:null},this._contentMarginChanges=new Mo.a,e&&e.change.pipe(Object(Uo.a)(this._destroyed)).subscribe((function(){s._validateDrawers(),s.updateContentMargins()})),a.change().pipe(Object(Uo.a)(this._destroyed)).subscribe((function(){return s.updateContentMargins()})),this._autosize=c}return a(t,[{key:"ngAfterContentInit",value:function(){var t=this;this._allDrawers.changes.pipe(Object(Ao.a)(this._allDrawers),Object(Uo.a)(this._destroyed)).subscribe((function(e){t._drawers.reset(e.filter((function(e){return!e._container||e._container===t}))),t._drawers.notifyOnChanges()})),this._drawers.changes.pipe(Object(Ao.a)(null)).subscribe((function(){t._validateDrawers(),t._drawers.forEach((function(e){t._watchDrawerToggle(e),t._watchDrawerPosition(e),t._watchDrawerMode(e)})),(!t._drawers.length||t._isDrawerOpen(t._start)||t._isDrawerOpen(t._end))&&t.updateContentMargins(),t._changeDetectorRef.markForCheck()})),this._doCheckSubject.pipe(Object(yo.a)(10),Object(Uo.a)(this._destroyed)).subscribe((function(){return t.updateContentMargins()}))}},{key:"ngOnDestroy",value:function(){this._contentMarginChanges.complete(),this._doCheckSubject.complete(),this._drawers.destroy(),this._destroyed.next(),this._destroyed.complete()}},{key:"open",value:function(){this._drawers.forEach((function(t){return t.open()}))}},{key:"close",value:function(){this._drawers.forEach((function(t){return t.close()}))}},{key:"updateContentMargins",value:function(){var t=this,e=0,n=0;if(this._left&&this._left.opened)if("side"==this._left.mode)e+=this._left._width;else if("push"==this._left.mode){var i=this._left._width;e+=i,n-=i}if(this._right&&this._right.opened)if("side"==this._right.mode)n+=this._right._width;else if("push"==this._right.mode){var r=this._right._width;n+=r,e-=r}n=n||null,(e=e||null)===this._contentMargins.left&&n===this._contentMargins.right||(this._contentMargins={left:e,right:n},this._ngZone.run((function(){return t._contentMarginChanges.next(t._contentMargins)})))}},{key:"ngDoCheck",value:function(){var t=this;this._autosize&&this._isPushed()&&this._ngZone.runOutsideAngular((function(){return t._doCheckSubject.next()}))}},{key:"_watchDrawerToggle",value:function(t){var e=this;t._animationStarted.pipe(Object(Fo.a)((function(t){return t.fromState!==t.toState})),Object(Uo.a)(this._drawers.changes)).subscribe((function(t){"open-instant"!==t.toState&&"NoopAnimations"!==e._animationMode&&e._element.nativeElement.classList.add("mat-drawer-transition"),e.updateContentMargins(),e._changeDetectorRef.markForCheck()})),"side"!==t.mode&&t.openedChange.pipe(Object(Uo.a)(this._drawers.changes)).subscribe((function(){return e._setContainerClass(t.opened)}))}},{key:"_watchDrawerPosition",value:function(t){var e=this;t&&t.onPositionChanged.pipe(Object(Uo.a)(this._drawers.changes)).subscribe((function(){e._ngZone.onMicrotaskEmpty.asObservable().pipe(Object(jo.a)(1)).subscribe((function(){e._validateDrawers()}))}))}},{key:"_watchDrawerMode",value:function(t){var e=this;t&&t._modeChanged.pipe(Object(Uo.a)(Object(To.a)(this._drawers.changes,this._destroyed))).subscribe((function(){e.updateContentMargins(),e._changeDetectorRef.markForCheck()}))}},{key:"_setContainerClass",value:function(t){var e=this._element.nativeElement.classList,n="mat-drawer-container-has-open";t?e.add(n):e.remove(n)}},{key:"_validateDrawers",value:function(){var t=this;this._start=this._end=null,this._drawers.forEach((function(e){"end"==e.position?(null!=t._end&&Jo("end"),t._end=e):(null!=t._start&&Jo("start"),t._start=e)})),this._right=this._left=null,this._dir&&"rtl"===this._dir.value?(this._left=this._end,this._right=this._start):(this._left=this._start,this._right=this._end)}},{key:"_isPushed",value:function(){return this._isDrawerOpen(this._start)&&"over"!=this._start.mode||this._isDrawerOpen(this._end)&&"over"!=this._end.mode}},{key:"_onBackdropClicked",value:function(){this.backdropClick.emit(),this._closeModalDrawer()}},{key:"_closeModalDrawer",value:function(){var t=this;[this._start,this._end].filter((function(e){return e&&!e.disableClose&&t._canHaveBackdrop(e)})).forEach((function(t){return t.close()}))}},{key:"_isShowingBackdrop",value:function(){return this._isDrawerOpen(this._start)&&this._canHaveBackdrop(this._start)||this._isDrawerOpen(this._end)&&this._canHaveBackdrop(this._end)}},{key:"_canHaveBackdrop",value:function(t){return"side"!==t.mode||!!this._backdropOverride}},{key:"_isDrawerOpen",value:function(t){return null!=t&&t.opened}},{key:"start",get:function(){return this._start}},{key:"end",get:function(){return this._end}},{key:"autosize",get:function(){return this._autosize},set:function(t){this._autosize=Object(So.c)(t)}},{key:"hasBackdrop",get:function(){return null==this._backdropOverride?!this._start||"side"!==this._start.mode||!this._end||"side"!==this._end.mode:this._backdropOverride},set:function(t){this._backdropOverride=null==t?null:Object(So.c)(t)}},{key:"scrollable",get:function(){return this._userContent||this._content}}]),t}()).\u0275fac=function(t){return new(t||Wo)(b.Pb(Ro.c,8),b.Pb(b.l),b.Pb(b.A),b.Pb(b.h),b.Pb(Co.e),b.Pb(Zo),b.Pb(Vo.a,8))},Wo.\u0275cmp=b.Jb({type:Wo,selectors:[["mat-drawer-container"]],contentQueries:function(t,e,n){var i;1&t&&(b.Ib(n,Ko,!0),b.Ib(n,ta,!0)),2&t&&(b.sc(i=b.ec())&&(e._content=i.first),b.sc(i=b.ec())&&(e._allDrawers=i))},viewQuery:function(t,e){var n;1&t&&b.Nc(Ko,!0),2&t&&b.sc(n=b.ec())&&(e._userContent=n.first)},hostAttrs:[1,"mat-drawer-container"],hostVars:2,hostBindings:function(t,e){2&t&&b.Gb("mat-drawer-container-explicit-backdrop",e._backdropOverride)},inputs:{autosize:"autosize",hasBackdrop:"hasBackdrop"},outputs:{backdropClick:"backdropClick"},exportAs:["matDrawerContainer"],features:[b.Bb([{provide:Go,useExisting:Wo}])],ngContentSelectors:qo,decls:4,vars:2,consts:[["class","mat-drawer-backdrop",3,"mat-drawer-shown","click",4,"ngIf"],[4,"ngIf"],[1,"mat-drawer-backdrop",3,"click"]],template:function(t,e){1&t&&(b.lc(zo),b.Fc(0,Ho,1,2,"div",0),b.kc(1),b.kc(2,1),b.Fc(3,Bo,2,0,"mat-drawer-content",1)),2&t&&(b.mc("ngIf",e.hasBackdrop),b.Cb(3),b.mc("ngIf",!e._content))},directives:[c.t,Ko],styles:[".mat-drawer-container{position:relative;z-index:1;box-sizing:border-box;-webkit-overflow-scrolling:touch;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:background-color,visibility}.cdk-high-contrast-active .mat-drawer-backdrop{opacity:.5}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-transition .mat-drawer-content{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%, 0, 0)}.cdk-high-contrast-active .mat-drawer,.cdk-high-contrast-active [dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}.cdk-high-contrast-active [dir=rtl] .mat-drawer,.cdk-high-contrast-active .mat-drawer.mat-drawer-end{border-left:solid 1px currentColor;border-right:none}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer{transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer.mat-drawer-end{left:0;right:auto;transform:translate3d(-100%, 0, 0)}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.mat-sidenav-fixed{position:fixed}\n"],encapsulation:2,changeDetection:0}),Wo),na=(($o=function t(){r(this,t)}).\u0275mod=b.Nb({type:$o}),$o.\u0275inj=b.Mb({factory:function(t){return new(t||$o)},imports:[[c.c,Ir.i,ko.b,Co.b],Co.b,Ir.i]}),$o),ia=o("nts4"),ra=o("sOKj"),oa=o("SoR6");function aa(t,e){if(1&t){var n=b.Wb();b.Vb(0,"google-chart",1),b.dc("select",(function(t){return b.xc(n),b.hc().changeMin(t)})),b.Ub()}if(2&t){var i=b.hc();b.mc("dynamicResize",i.dynamicResize)("data",i.rocChart.data)("type",i.rocChart.type)("title",i.rocChart.title)("columns",i.rocChart.columns)("options",i.rocChart.options)}}var sa,ca=((sa=function(){function t(e){r(this,t),this.predictionsService=e,this.updateMin=new b.o,this.rocChart=null}return a(t,[{key:"ngOnInit",value:function(){}},{key:"ngOnChanges",value:function(t){t.chartData&&this.chartData&&this.graphChart()}},{key:"changeMin",value:function(t){1==t.selection[0].column&&this.updateMin.emit(this.rocChart.data[t.selection[0].row][2])}},{key:"graphChart",value:function(){var t=this.chartData.map((function(t){return[t.fpr,t.tpr,t.thresh,"FPR: ".concat(t.fpr,", TPR: ").concat(t.tpr,", TH: ").concat(t.thresh),t.fpr]}));this.rocChart={title:"ROC",type:oa.a.LineChart,data:t,columns:[{type:"number",id:"fpr",label:"fpr"},{type:"number",id:"tpr",label:"tpr"},{type:"number",id:"thresh",label:"thresh",role:"annotationText"},{type:"string",role:"tooltip",id:"tooltip",p:{html:!0}},{type:"number",id:"fpr",label:"fpr"}],colors:["#e0440e","#e6693e"],options:{hAxis:{title:"False Positive Rate"},vAxis:{title:"True Positive Rate "},width:398,legend:{position:"none"},tooltip:{isHtml:!0,ignoreBounds:!0}}}}}]),t}()).\u0275fac=function(t){return new(t||sa)(b.Pb(l.e))},sa.\u0275cmp=b.Jb({type:sa,selectors:[["mol-roc-chart"]],inputs:{id:"id",chartData:"chartData"},outputs:{updateMin:"updateMin"},features:[b.Ab],decls:1,vars:1,consts:[["class","gchart",3,"dynamicResize","data","type","title","columns","options","select",4,"ngIf"],[1,"gchart",3,"dynamicResize","data","type","title","columns","options","select"]],template:function(t,e){1&t&&b.Fc(0,aa,1,6,"google-chart",0),2&t&&b.mc("ngIf",e.rocChart)},directives:[c.t,oa.b],styles:["[_nghost-%COMP%]{width:398px}"]}),sa),ua=["mol-model-info"];function la(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mol-model-info",9),b.dc("showBackground",(function(t){return b.xc(n),b.hc().fetchPoints(t)}))("refreshPrediction",(function(t){return b.xc(n),b.hc().refreshMap(t)}))("modelChange",(function(t){return b.xc(n),b.hc().modelChange(t)}))("nextSpecies",(function(){return b.xc(n),b.hc().getNextSpecies()}))("previousSpecies",(function(){return b.xc(n),b.hc().getPreviousSpecies()}))("openMetadata",(function(t){return b.xc(n),b.hc().openMetadataDialog(t)}))("updateThreshold",(function(t){return b.xc(n),b.hc().updateThreshold(t)}))("PDF",(function(){return b.xc(n),b.hc().getPDF()})),b.Ub()}if(2&t){var i=b.hc();b.mc("id",i.id)("project_id",i.project_id)("info",i.info)("modelList",i.modelList)("predictionOptions",i.predictionOptions)("scientificname",i.scientificname)("minThreshold",i.predictionOptions.min)("maxThreshold",i.predictionOptions.max)("worksheetEmpty",i.worksheetEmpty)}}function ha(t,e){if(1&t){var n=b.Wb();b.Vb(0,"button",10),b.dc("click",(function(){b.xc(n);var t=b.hc();return t.showMetadata=!t.showMetadata})),b.Hc(1),b.ic(2,"translate"),b.Ub()}if(2&t){var i=b.hc();b.Cb(1),b.Jc(" ",i.showMetadata?"hide_metadata":b.jc(2,1,"show_metadata")," ")}}function fa(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mol-roc-chart",11),b.dc("updateMin",(function(t){return b.xc(n),b.hc().updateMinFromROC(t)})),b.Ub()}if(2&t){var i=b.hc();b.mc("chartData",i.chartData)}}function da(t,e){1&t&&b.Qb(0,"mat-divider")}function pa(t,e){1&t&&b.Qb(0,"mat-divider")}var ba,ma,va,ga,_a=[{path:":scientificname",component:(ba=function(){function t(e,n,i,o,a,s,c,u,l){r(this,t),this.mapService=e,this.predictionsService=n,this.datasetService=i,this.route=o,this.router=a,this.auth=s,this.matDialog=c,this._snackBar=u,this.translate=l,this.id=null,this.scientificname=null,this.info=null,this.chartData=null,this.pdfLink=null,this.questions=h,this.requiredQuestions=f,this.taxa="",this.binary=!0,this.modelList=null,this.storedSpecies=[],this.nextSpecies="",this.previousModel="",this.worksheetEmpty=!1,this.showBackground=!1,this.showMetaData=!1,this.existingFeedback=[],this.project_id=null,this.showMetadata=!1,this.speciesIndex=0,this.taxaDatasets={amphibians:"83cfa8fb-dd6e-4031-8215-1079abddb8a7",ants:null,butterflies:"8f316f82-7356-44ee-823d-8f830f241fab",mammals:"ec694c34-bddd-4111-ba99-926a5f7866e8",odonates:"5b1bb9d6-1bf9-4d3b-aec6-3cfbc96d88f7",reptiles:"f00b03ed-8345-4497-b194-3fced6ee155c",trees:"f7b134d9-d2ce-43b2-8f2d-7e6441d7c747"},this.alternativeAnswers={},this.query={scientificname:"",status:"",taxa:""},this.modelFilters={version:"",auc:{value:0,highValue:1},evaluated_by_me:0,evaluated_by_others:0}}return a(t,[{key:"ngOnInit",value:function(){var t=this;this.scientificname=this.route.snapshot.paramMap.get("scientificname").replace("_"," "),this.route.queryParams.subscribe((function(e){t.id=e.prediction_id,t.project_id=e.project_id,t.init()}));var e=this.route.snapshot.queryParamMap;this.project_id=e.get("project_id"),this.query.scientificname=e.get("scientificname")||"",this.query.status=e.get("status")||"",this.query.taxa=e.get("taxa")||"",this.modelFilters.version=e.get("version")||"",this.modelFilters.auc.value=Number(e.get("aucMin"))||0,this.modelFilters.auc.highValue=Number(e.get("aucMax"))||1,this.predictionsService.predictionsRequested||this.predictionsService.predictions("A",this.project_id,this.query,this.modelFilters),this.auth.currentUser.subscribe((function(e){t.role=e.role}));var n=JSON.parse(localStorage.getItem("Species")||"{}"),i=JSON.parse(localStorage.getItem("EvaluatedSpecies")||"{}");n.length>0&&i.length>0&&i.forEach((function(t){n.splice(n.indexOf(t.replace("_"," ")),1)}))}},{key:"init",value:function(){var t=this;this.predictionsService.speciesDetailed(this.scientificname,this.id).pipe(Object(_o.a)(1)).subscribe((function(e){t.info=e.predictions.find(t.id?function(e){return e.prediction_id===t.id}:function(t){return 1===t.model_rank}),t.info||(t.info=e.predictions[0]),t.id||(t.id=t.info.prediction_id),t.pdfLink=e.pdf,t.modelList=e.predictions,t.chartData=e.roc;var n=t.taxaDatasets[t.info.taxa];if(n){var i=t.scientificname.split(" ").slice(0,2).join(" ");t.mapService.updateTileParams({url:"https://next-tiles.mol.org/0.x/tiles/species/detailed/3857/{z}/{x}/{y}.mvt?scientificname=".concat(i,"&dsids=").concat(n),index:0})}t.mapService.updateTileParams({url:e.range_map.url,index:1}),t.mapService.updateGeoJsonFeatures(e.points),t.updateBounds(e.points),t.predictionOptions={max:4*t.info.sps_threshold,min:t.info.sps_threshold,binary:t.binary},t.refreshMap(t.predictionOptions),t.taxa=t.info.taxa,t.links=[{name:"Prediction Table",route:"/predictions/taxa/"+t.taxa,data:Object.assign({prediction_id:null,project_id:t.project_id},t.route.snapshot.queryParams)}],t.getNonSpatialFeedback()}))}},{key:"updateThreshold",value:function(t){this.alternativeAnswers={alternative_threshold:t}}},{key:"updateBounds",value:function(t){var e=t.features.filter((function(t){return"Occurrence"===t.properties.what}))[0],n=(e=e.geometry.coordinates).map((function(t){return t[1]})),i=e.map((function(t){return t[0]})),r=Math.min.apply(Math,s(n)),o=Math.min.apply(Math,s(i)),a=Math.max.apply(Math,s(n)),c=Math.max.apply(Math,s(i));this.mapService.zoomToDatasetExtent({buffer:100,northEast:{lat:a,lng:c},southWest:{lat:r,lng:o}})}},{key:"fetchPoints",value:function(t){var e=this;this.showBackground=t,this.predictionsService.fetchPoints(this.id,this.showBackground).subscribe((function(t){e.mapService.updateGeoJsonFeatures(t),e.updateBounds(t)}))}},{key:"refreshMap",value:function(t){var e=this;this.binary=t.binary,this.predictionOptions=Object.assign({},t),this.predictionsService.fetchMap(this.id,t).pipe(Object(yo.a)(500)).subscribe((function(t){e.mapService.updateTileParams({url:t.url,index:2})}))}},{key:"modelChange",value:function(t){var e=this;this.id=t,this.predictionsService.fetchMap(this.id,void 0).subscribe((function(t){e.mapService.updateTileParams({url:t.url,index:2})})),this.predictionsService.fetchROC(this.id).subscribe((function(t){e.chartData=t.roc})),this.info=this.modelList.find((function(t){return t.prediction_id===e.id})),this.router.navigate([],{relativeTo:this.route,queryParams:{prediction_id:this.id},queryParamsHandling:"merge"})}},{key:"updateMinFromROC",value:function(t){this.refreshMap({binary:this.predictionOptions.binary,min:t,max:this.predictionOptions.max})}},{key:"updateMinMaxThreshold",value:function(t){console.log("update min max",t),this.refreshMap({binary:this.predictionOptions.binary,min:t.min,max:t.max})}},{key:"openMetadataDialog",value:function(t){var e=this;if("rangemap"===t){var n=this.taxaDatasets[this.info.taxa];n&&this.datasetService.metadata(n).subscribe((function(t){e.matDialog.open(wo.d,{data:{info:t.metadata,dataset_id:n,heading:"Expert range map for "+e.info.taxa}})}))}else this.matDialog.open(S,{height:"80%",width:"800px",data:{info:Object.assign(Object.assign({},this.info),this.info.modelinfo)}})}},{key:"getNextSpecies",value:function(){this.speciesIndex+=1,this.getSpecies()}},{key:"getSpecies",value:function(){var t=this.predictionsService.getSpeciesAtIndex(this.speciesIndex);this.scientificname=t.scientificname.split(" ").join("_"),this.id=t.prediction_id,this.router.navigate(["/predictions/species/",this.scientificname],{queryParams:Object.assign(Object.assign({prediction_id:this.id,project_id:this.project_id},this.query),this.modelFilters),relativeTo:this.route})}},{key:"getPreviousSpecies",value:function(){this.speciesIndex>0&&(this.speciesIndex-=1),this.getSpecies()}},{key:"speciesEvaluated",value:function(){var t=[],e=[],n=[],i=this.id;Object.keys(localStorage),null!==localStorage.getItem("Evaluated")?-1===(t=JSON.parse(localStorage.getItem("Evaluated")||"{}")).indexOf(i)&&t.push(i):t.push(i),null!==localStorage.getItem("EvaluatedSpecies")?-1===(e=JSON.parse(localStorage.getItem("EvaluatedSpecies"))).indexOf(this.scientificname)&&e.push(this.scientificname):e.push(this.scientificname),localStorage.setItem("EvaluatedSpecies",JSON.stringify(e)),(n=JSON.parse(localStorage.getItem("Species")||"{}")).length>0&&e.forEach((function(t){n.splice(n.indexOf(t.replace("_"," ")),1)})),localStorage.setItem("Evaluated",JSON.stringify(t))}},{key:"feedbackSubmitted",value:function(t){var e=this;this.auth.currentUser.pipe(Object(vo.switchMap)((function(n){return e.predictionsService.submitNonSpatialFeedback(n.id,e.id,t)})),Object(go.catchError)((function(t){return Object(mo.a)(t)}))).subscribe((function(t){e.openSnackBar(t.message,"Close"),e.speciesEvaluated()}),(function(t){e.openSnackBar(t,"Close")})),JSON.parse(localStorage.getItem("Species")||"{}")}},{key:"getNonSpatialFeedback",value:function(){var t=this;this.predictionsService.getNonSpatialFeedback(this.id).subscribe((function(e){e.forEach((function(t){var e=t.detailed.prediction_overall_rating,n=h[0].questions[0].options.findIndex((function(t){return t.value==e})),i=h[0].questions[0].options[n];t.detailed.prediction_overall_rating=void 0!==i?i.display:t.detailed.prediction_overall_rating,t.feedback_id=t.feedback_id,t.created_at=t.created_at.slice(0,16);var r=h[0].questions[2].options,o=[];t.detailed.prediction_issues_present&&(t.detailed.prediction_issues_present.forEach((function(t){var e=r.findIndex((function(e){return e.value==t}));o.push(r[e].display)})),t.detailed.prediction_issues_present=o.toString().replace(",",", "));var a=h[1].questions[0].options,s=[];t.detailed.points_issues_present&&(t.detailed.points_issues_present.forEach((function(t){var e=a.findIndex((function(e){return e.value==t}));s.push(a[e].display)})),t.detailed.points_issues_present=s.toString().replace(",",", "));var c=h[2].questions[0].options,u=[];t.detailed.range_issues_present&&(t.detailed.range_issues_present.forEach((function(t){var e=c.findIndex((function(e){return e.value==t}));u.push(c[e].display)})),t.detailed.range_issues_present=u.toString().replace(",",", "))})),t.existingFeedback=e}))}},{key:"handleFeedbackError",value:function(t){this.openSnackBar("Please fill out the required questions","Close"),console.error("feedback error: ",t)}},{key:"openSnackBar",value:function(t,e){this._snackBar.open(t,e)}},{key:"getPDF",value:function(){window.open(this.pdfLink,"_blank")}},{key:"ngOnDestroy",value:function(){this.mapService.updateTileParams({url:"OFF",index:0}),this.mapService.updateTileParams({url:"OFF",index:1}),this.mapService.updateTileParams({url:"OFF",index:2}),this.mapService.updateGeoJsonFeatures({type:"FeatureCollection",features:[]})}}]),t}(),ba.\u0275fac=function(t){return new(t||ba)(b.Pb(l.d),b.Pb(l.e),b.Pb(l.c),b.Pb(u.a),b.Pb(u.f),b.Pb(l.b),b.Pb(p.b),b.Pb(Lr.a),b.Pb(l.j))},ba.\u0275cmp=b.Jb({type:ba,selectors:[["mol-predictions-root"]],viewQuery:function(t,e){var n;1&t&&b.Nc(ua,!0),2&t&&b.sc(n=b.ec())&&(e.modelInfo=n.first)},decls:11,vars:6,consts:[[3,"links"],[1,"predictions-container"],["mode","side","opened","",1,"drawer"],[3,"id","project_id","info","modelList","predictionOptions","scientificname","minThreshold","maxThreshold","worksheetEmpty","showBackground","refreshPrediction","modelChange","nextSpecies","previousSpecies","openMetadata","updateThreshold","PDF",4,"ngIf"],["class","metadata-button","mat-raised-button","",3,"click",4,"ngIf"],[3,"chartData","updateMin",4,"ngIf"],[4,"ngIf"],[1,"map-container"],["mode","experts"],[3,"id","project_id","info","modelList","predictionOptions","scientificname","minThreshold","maxThreshold","worksheetEmpty","showBackground","refreshPrediction","modelChange","nextSpecies","previousSpecies","openMetadata","updateThreshold","PDF"],["mat-raised-button","",1,"metadata-button",3,"click"],[3,"chartData","updateMin"]],template:function(t,e){1&t&&(b.Qb(0,"mol-nav",0),b.Vb(1,"mat-drawer-container",1),b.Vb(2,"mat-drawer",2),b.Fc(3,la,1,9,"mol-model-info",3),b.Fc(4,ha,3,3,"button",4),b.Fc(5,fa,1,1,"mol-roc-chart",5),b.Fc(6,da,1,0,"mat-divider",6),b.Fc(7,pa,1,0,"mat-divider",6),b.Ub(),b.Vb(8,"mat-drawer-content",7),b.Qb(9,"mol-spinner"),b.Qb(10,"mol-map",8),b.Ub(),b.Ub()),2&t&&(b.mc("links",e.links),b.Cb(3),b.mc("ngIf",e.info),b.Cb(1),b.mc("ngIf",e.info),b.Cb(1),b.mc("ngIf",e.info&&e.showMetadata),b.Cb(1),b.mc("ngIf",e.info),b.Cb(1),b.mc("ngIf",e.info))},directives:[xo.a,ea,ta,c.t,Ko,ia.a,ra.a,bo,jr.b,ca,Dr.a],pipes:[qr.c],styles:[".predictions-container[_ngcontent-%COMP%]{height:calc(100vh - 52px - 85px)}mat-drawer-container[_ngcontent-%COMP%]{box-shadow:3px 0 2px -2px #aaa}.drawer[_ngcontent-%COMP%], mat-drawer-container[_ngcontent-%COMP%]{overflow-x:hidden;overflow-y:auto}.drawer[_ngcontent-%COMP%]{width:400px;min-height:100%} .mat-drawer-inner-container{overflow-x:hidden!important}.card-title[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.metadata-button[_ngcontent-%COMP%]{margin:5px 0 5px 5px}"]}),ba)}],ya=((ma=function t(){r(this,t)}).\u0275mod=b.Nb({type:ma}),ma.\u0275inj=b.Mb({factory:function(t){return new(t||ma)},imports:[[c.c,u.j.forChild(_a)],u.j]}),ma),wa=o("M0ag"),xa=o("+Tre"),ka=o("nKqi"),Ca=((ga=function t(){r(this,t)}).\u0275mod=b.Nb({type:ga}),ga.\u0275inj=b.Mb({factory:function(t){return new(t||ga)},imports:[[c.c,wa.a,wo.c,Pr.d,Dr.b,na,Nr.b,Rr.b,wo.b,jr.c,Mr.b,O.l,O.B,Dr.b,Er.c,xa.b,oa.c,Fr.b,wo.f,wo.e,p.f,Ur.b,wo.a,Ar.d,ka.b,qr.b]]}),ga),Sa=((va=function t(){r(this,t)}).\u0275mod=b.Nb({type:va}),va.\u0275inj=b.Mb({factory:function(t){return new(t||va)},imports:[[ya,Ca]]}),va)},QuXn:function(t,e,n){"use strict";var i=!1;e.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){var e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else i&&console.log("RxJS: Back to a better error behavior. Thank you. <3");i=t},get useDeprecatedSynchronousErrorHandling(){return i}}},R4cV:function(t,e,n){"use strict";var i=n("qiMw"),r=n("ihxi"),o=n("4mxr");e.from=function(t,e){return e?o.scheduled(t,e):t instanceof i.Observable?t:new i.Observable(r.subscribeTo(t))}},RKpm:function(t,e,n){"use strict";e.identity=function(t){return t}},SSAN:function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=n("dmvN"),a=n("d4zx"),s=n("kZSD");e.catchError=function(t){return function(e){var n=new c(t),i=e.lift(n);return n.caught=i}};var c=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.selector,this.caught))},t}(),u=function(t){function e(e,n,i){var r=t.call(this,e)||this;return r.selector=n,r.caught=i,r}return r(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=void 0;try{n=this.selector(e,this.caught)}catch(o){return void t.prototype.error.call(this,o)}this._unsubscribeAndRecycle();var i=new a.InnerSubscriber(this,void 0,void 0);this.add(i);var r=s.subscribeToResult(this,n,void 0,void 0,i);r!==i&&this.add(r)}},e}(o.OuterSubscriber)},VTS6:function(t,e,n){"use strict";e.isArrayLike=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t}},Yfti:function(t,e,n){"use strict";var i=n("1hPV"),r=n("7oWP"),o=n("uzuk");e.toSubscriber=function(t,e,n){if(t){if(t instanceof i.Subscriber)return t;if(t[r.rxSubscriber])return t[r.rxSubscriber]()}return t||e||n?new i.Subscriber(t,e,n):new i.Subscriber(o.empty)}},ZGdk:function(t,e,n){"use strict";e.UnsubscriptionError=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}()},a96P:function(t,e,n){"use strict";e.isObject=function(t){return null!==t&&"object"==typeof t}},d0I2:function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=n("1hPV");e.map=function(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new a(t,e))}};var a=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.project,this.thisArg))},t}();e.MapOperator=a;var s=function(t){function e(e,n,i){var r=t.call(this,e)||this;return r.project=n,r.count=0,r.thisArg=i||r,r}return r(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(n){return void this.destination.error(n)}this.destination.next(e)},e}(o.Subscriber)},d4zx:function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.InnerSubscriber=function(t){function e(e,n,i){var r=t.call(this)||this;return r.parent=e,r.outerValue=n,r.outerIndex=i,r.index=0,r}return r(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(n("1hPV").Subscriber)},dmvN:function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.OuterSubscriber=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.notifyNext=function(t,e,n,i,r){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(n("1hPV").Subscriber)},i6J5:function(t,e,n){"use strict";var i=n("qiMw"),r=n("6Br6"),o=n("7bXj");e.scheduleIterable=function(t,e){if(!t)throw new Error("Iterable cannot be null");return new i.Observable((function(n){var i,a=new r.Subscription;return a.add((function(){i&&"function"==typeof i.return&&i.return()})),a.add(e.schedule((function(){i=t[o.iterator](),a.add(e.schedule((function(){if(!n.closed){var t,e;try{var r=i.next();t=r.value,e=r.done}catch(o){return void n.error(o)}e?n.complete():(n.next(t),this.schedule())}})))}))),a}))}},i84P:function(t,e,n){"use strict";var i=n("qiMw"),r=n("6Br6");e.schedulePromise=function(t,e){return new i.Observable((function(n){var i=new r.Subscription;return i.add(e.schedule((function(){return t.then((function(t){i.add(e.schedule((function(){n.next(t),i.add(e.schedule((function(){return n.complete()})))})))}),(function(t){i.add(e.schedule((function(){return n.error(t)})))}))}))),i}))}},ihxi:function(t,e,n){"use strict";var i=n("sBpz"),r=n("lTUY"),o=n("GB03"),a=n("Lbxd"),s=n("VTS6"),c=n("xKJD"),u=n("a96P"),l=n("7bXj"),h=n("k/06");e.subscribeTo=function(t){if(t&&"function"==typeof t[h.observable])return a.subscribeToObservable(t);if(s.isArrayLike(t))return i.subscribeToArray(t);if(c.isPromise(t))return r.subscribeToPromise(t);if(t&&"function"==typeof t[l.iterator])return o.subscribeToIterable(t);var e=u.isObject(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+e+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},"k/06":function(t,e,n){"use strict";e.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},kZSD:function(t,e,n){"use strict";var i=n("d4zx"),r=n("ihxi"),o=n("qiMw");e.subscribeToResult=function(t,e,n,a,s){if(void 0===s&&(s=new i.InnerSubscriber(t,n,a)),!s.closed)return e instanceof o.Observable?e.subscribe(s):r.subscribeTo(e)(s)}},lTUY:function(t,e,n){"use strict";var i=n("tpAt");e.subscribeToPromise=function(t){return function(e){return t.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,i.hostReportError),e}}},qiMw:function(t,e,n){"use strict";var i=n("JJ8B"),r=n("Yfti"),o=n("k/06"),a=n("E/Xc"),s=n("QuXn");function c(t){if(t||(t=s.config.Promise||Promise),!t)throw new Error("no Promise impl found");return t}e.Observable=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var i=this.operator,o=r.toSubscriber(t,e,n);if(o.add(i?i.call(o,this.source):this.source||s.config.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),s.config.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){s.config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),i.canReportError(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=c(e))((function(e,i){var r;r=n.subscribe((function(e){try{t(e)}catch(n){i(n),r&&r.unsubscribe()}}),i,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[o.observable]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;et.length)&&(e=t.length);for(var n=0,i=new Array(e);ne?1:t>=e?0:NaN};1===(k=M).length&&(C=k,k=function(t,e){return M(C(t),e)}),Math.sqrt(50),Math.sqrt(10),Math.sqrt(2);var P={value:function(){}};function F(){for(var t,e=0,n=arguments.length,i={};e=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function E(t,e){for(var n,i=0,r=t.length;i0)for(var n,i,r=new Array(n),o=0;oe?1:t>=e?0:NaN}H.prototype={constructor:H,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Y="http://www.w3.org/1999/xhtml",J={svg:"http://www.w3.org/2000/svg",xhtml:Y,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},$=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),J.hasOwnProperty(e)?{space:J[e],local:t}:t};function W(t){return function(){this.removeAttribute(t)}}function X(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Q(t,e){return function(){this.setAttribute(t,e)}}function Z(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function G(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function K(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}var tt=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function et(t){return function(){this.style.removeProperty(t)}}function nt(t,e,n){return function(){this.style.setProperty(t,e,n)}}function it(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function rt(t,e){return t.style.getPropertyValue(e)||tt(t).getComputedStyle(t,null).getPropertyValue(e)}function ot(t){return function(){delete this[t]}}function at(t,e){return function(){this[t]=e}}function st(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ct(t){return t.trim().split(/^|\s+/)}function ut(t){return t.classList||new lt(t)}function lt(t){this._node=t,this._names=ct(t.getAttribute("class")||"")}function ft(t,e){for(var n=ut(t),i=-1,r=e.length;++i=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Ot=function(t){var e=$(t);return(e.local?St:Ct)(e)};function Mt(){return null}function Pt(){var t=this.parentNode;t&&t.removeChild(this)}function Ft(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Tt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}var Ut={},Et=null;function Dt(t,e,n){return t=jt(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function jt(t,e,n){return function(i){var r=Et;Et=i;try{t.call(this,this.__data__,e,n)}finally{Et=r}}}function At(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function It(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,o=e.length;i=w&&(w=y+1);!(_=v[w])&&++w=0;)(i=r[o])&&(a&&4^i.compareDocumentPosition(a)&&a.parentNode.insertBefore(i,a),a=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=q);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o1?this.each((null==e?et:"function"==typeof e?it:nt)(t,e,null==n?"":n)):rt(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?ot:"function"==typeof e?st:at)(t,e)):this.node()[t]},classed:function(t,e){var n=ct(t+"");if(arguments.length<2){for(var i=ut(this.node()),r=-1,o=n.length;++ro&&(r=e.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,c.push({i:a,x:Xt(n,i)})),o=Zt.lastIndex;return o=0&&e._call.call(null,t),e=e._next;--Kt}()}finally{Kt=0,function(){for(var t,e,n=qt,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:qt=e);Yt=t,de(i)}(),ie=0}}function he(){var t=oe.now(),e=t-ne;e>1e3&&(re-=e,ne=t)}function de(t){Kt||(te&&(te=clearTimeout(te)),t-ie>24?(t<1/0&&(te=setTimeout(fe,t-oe.now()-re)),ee&&(ee=clearInterval(ee))):(ee||(ne=oe.now(),ee=setInterval(he,1e3)),Kt=1,ae(fe)))}ue.prototype=le.prototype={constructor:ue,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?se():+n)+(null==e?0:+e),this._next||Yt===this||(Yt?Yt._next=this:qt=this,Yt=this),this._call=t,this._time=n,de()},stop:function(){this._call&&(this._call=null,this._time=1/0,de())}};var pe=function(t,e,n){var i=new ue;return i.restart((function(n){i.stop(),t(n+e)}),e=null==e?0:+e,n),i},be=j("start","end","cancel","interrupt"),me=[],ve=function(t,e,n,i,r,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var i,r=t.__transition;function o(c){var u,l,f,h;if(1!==n.state)return s();for(u in r)if((h=r[u]).name===n.name){if(3===h.state)return pe(o);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[u]):+u0)throw new Error("too late; already scheduled");return n}function _e(t,e){var n=ye(t,e);if(n.state>3)throw new Error("too late; already running");return n}function ye(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var we,xe,ke,Ce,Se=180/Math.PI,Oe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Me=function(t,e,n,i,r,o){var a,s,c;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(c=t*n+e*i)&&(n-=t*c,i-=e*c),(s=Math.sqrt(n*n+i*i))&&(n/=s,i/=s,c/=s),t*i180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:Xt(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(o.rotate,a.rotate,s,c),function(t,e,n,o){t!==e?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:Xt(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(o.skewX,a.skewX,s,c),function(t,e,n,i,o,a){if(t!==n||e!==i){var s=o.push(r(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Xt(t,n)},{i:s-2,x:Xt(e,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,c),o=a=null,function(t){for(var e,n=-1,i=c.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?ge:_e;return function(){var a=o(this,t),s=a.on;s!==i&&(r=(i=s).copy()).on(e,n),a.on=r}}var Ze=Jt.prototype.constructor;function Ge(t){return function(){this.style.removeProperty(t)}}function Ke(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function tn(t,e,n){var i,r;function o(){var o=e.apply(this,arguments);return o!==r&&(i=(r=o)&&Ke(t,o,n)),i}return o._value=e,o}function en(t){return function(e){this.textContent=t.call(this,e)}}function nn(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&en(i)),e}return i._value=t,i}var rn=0;function on(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function an(){return++rn}var sn=Jt.prototype;on.prototype=(function(t){return Jt().transition(t)}).prototype={constructor:on,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=I(t));for(var i=this._groups,r=i.length,o=new Array(r),a=0;a2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[r]):a=!1;a&&delete t.__transition}}(this,t)}))},Jt.prototype.transition=function(t){var e,n;t instanceof on?(e=t._id,t=t._name):(e=an(),(n=cn).time=se(),t=null==t?null:t+"");for(var i=this._groups,r=i.length,o=0;o1e-6)if(Math.abs(l*s-c*u)>1e-6&&r){var h=n-o,d=i-a,p=s*s+c*c,b=h*h+d*d,m=Math.sqrt(p),v=Math.sqrt(f),g=r*Math.tan((fn-Math.acos((p+f-b)/(2*m*v)))/2),_=g/v,y=g/m;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*u)+","+(e+_*l)),this._+="A"+r+","+r+",0,0,"+ +(l*h>u*d)+","+(this._x1=t+y*s)+","+(this._y1=e+y*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e)},arc:function(t,e,n,i,r,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(i),s=n*Math.sin(i),c=t+a,u=e+s,l=1^o,f=o?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+u:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-u)>1e-6)&&(this._+="L"+c+","+u),n&&(f<0&&(f=f%hn+hn),f>dn?this._+="A"+n+","+n+",0,1,"+l+","+(t-a)+","+(e-s)+"A"+n+","+n+",0,1,"+l+","+(this._x1=c)+","+(this._y1=u):f>1e-6&&(this._+="A"+n+","+n+",0,"+ +(f>=fn)+","+l+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}},bn.prototype=mn.prototype={constructor:bn,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var gn=mn.prototype;function _n(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,o,a,s,c,u,l,f,h,d=t._root,p={data:i},b=t._x0,m=t._y0,v=t._x1,g=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((u=e>=(o=(b+v)/2))?b=o:v=o,(l=n>=(a=(m+g)/2))?m=a:g=a,r=d,!(d=d[f=l<<1|u]))return r[f]=p,t;if(s=+t._x.call(null,d.data),c=+t._y.call(null,d.data),e===s&&n===c)return p.next=d,r?r[f]=p:t._root=p,t;do{r=r?r[f]=new Array(4):t._root=new Array(4),(u=e>=(o=(b+v)/2))?b=o:v=o,(l=n>=(a=(m+g)/2))?m=a:g=a}while((f=l<<1|u)==(h=(c>=a)<<1|s>=o));return r[h]=d,r[f]=p,t}vn.prototype=(function(t,e){var n=new vn;if(t instanceof vn)t.each((function(t){n.add(t)}));else if(t){var i=-1,r=t.length;if(null==e)for(;++il&&(l=i),rf&&(f=r));if(c>l||u>f)return this;for(this.cover(c,u).cover(l,f),n=0;nt||t>=r||i>e||e>=o;)switch(s=(eh||(o=c.y0)>d||(a=c.x1)=v)<<1|t>=m)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=c)}else{var g=t-+this._x.call(null,b.data),_=e-+this._y.call(null,b.data),y=g*g+_*_;if(y=(s=(p+m)/2))?p=s:m=s,(l=a>=(c=(b+v)/2))?b=c:v=c,e=d,!(d=d[f=l<<1|u]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}for(;d.data!==t;)if(i=d,!(d=d.next))return this;return(r=d.next)&&delete d.next,i?(r?i.next=r:delete i.next,this):e?(r?e[f]=r:delete e[f],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=r,this)},Sn.removeAll=function(t){for(var e=0,n=t.length;e1);return t+n*o*Math.sqrt(-2*Math.log(r)/r)}}return n.source=t,n}(On)),Pn=(function t(e){function n(){var t=Mn.source(e).apply(this,arguments);return function(){return Math.exp(t())}}return n.source=t,n}(On),function t(e){function n(t){return function(){for(var n=0,i=0;i":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}Fn.prototype,Fn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Tn,Un=Array.prototype.map;void 0===(Tn={decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}).grouping||void 0===Tn.thousands||Un.call(Tn.grouping,Number),void 0===Tn.numerals||Un.call(Tn.numerals,String);var En=new Date,Dn=new Date;function jn(t,e,n,i){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=function(e){return t(e=new Date(+e)),e},r.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},r.round=function(t){var e=r(t),n=r.ceil(t);return t-e0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,i){if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););}))},n&&(r.count=function(e,i){return En.setTime(+e),Dn.setTime(+i),t(En),t(Dn),Math.floor(n(En,Dn))},r.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?function(e){return i(e)%t==0}:function(e){return r.count(0,e)%t==0}):r:null}),r}var An=jn((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));An.every=function(t){return isFinite(t=Math.floor(t))&&t>0?jn((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var In=An;function Vn(t){return jn((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}jn((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}));var Nn=Vn(0),Rn=Vn(1),Ln=(Vn(2),Vn(3),Vn(4)),Hn=(Vn(5),Vn(6),jn((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1}))),Bn=(jn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),jn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),jn((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),jn((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t})));function zn(t){return jn((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}Bn.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?jn((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Bn:null};var qn=zn(0),Yn=zn(1),Jn=(zn(2),zn(3),zn(4)),$n=(zn(5),zn(6),jn((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}))),Wn=jn((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Wn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?jn((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Xn=Wn,Qn={"-":"",_:" ",0:"0"},Zn=/[\\^$*+?|[\]().{}]/g;function Gn(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o=4||0===e?Ln(t):Ln.ceil(t)}function pi(t,e){return t=di(t),Gn(Ln.count(In(t),t)+(4===In(t).getDay()),e,2)}function bi(t){return t.getDay()}function mi(t,e){return Gn(Rn.count(In(t)-1,t),e,2)}function vi(t,e){return Gn(t.getFullYear()%100,e,2)}function gi(t,e){return Gn((t=di(t)).getFullYear()%100,e,2)}function _i(t,e){return Gn(t.getFullYear()%1e4,e,4)}function yi(t,e){var n=t.getDay();return Gn((t=n>=4||0===n?Ln(t):Ln.ceil(t)).getFullYear()%1e4,e,4)}function wi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Gn(e/60|0,"0",2)+Gn(e%60,"0",2)}function xi(t,e){return Gn(t.getUTCDate(),e,2)}function ki(t,e){return Gn(t.getUTCHours(),e,2)}function Ci(t,e){return Gn(t.getUTCHours()%12||12,e,2)}function Si(t,e){return Gn(1+$n.count(Xn(t),t),e,3)}function Oi(t,e){return Gn(t.getUTCMilliseconds(),e,3)}function Mi(t,e){return Oi(t,e)+"000"}function Pi(t,e){return Gn(t.getUTCMonth()+1,e,2)}function Fi(t,e){return Gn(t.getUTCMinutes(),e,2)}function Ti(t,e){return Gn(t.getUTCSeconds(),e,2)}function Ui(t){var e=t.getUTCDay();return 0===e?7:e}function Ei(t,e){return Gn(qn.count(Xn(t)-1,t),e,2)}function Di(t){var e=t.getUTCDay();return e>=4||0===e?Jn(t):Jn.ceil(t)}function ji(t,e){return t=Di(t),Gn(Jn.count(Xn(t),t)+(4===Xn(t).getUTCDay()),e,2)}function Ai(t){return t.getUTCDay()}function Ii(t,e){return Gn(Yn.count(Xn(t)-1,t),e,2)}function Vi(t,e){return Gn(t.getUTCFullYear()%100,e,2)}function Ni(t,e){return Gn((t=Di(t)).getUTCFullYear()%100,e,2)}function Ri(t,e){return Gn(t.getUTCFullYear()%1e4,e,4)}function Li(t,e){var n=t.getUTCDay();return Gn((t=n>=4||0===n?Jn(t):Jn.ceil(t)).getUTCFullYear()%1e4,e,4)}function Hi(){return"+0000"}function Bi(){return"%"}function zi(t){return+t}function qi(t){return Math.floor(+t/1e3)}function Yi(){this._=null}function Ji(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function $i(t,e){var n=e,i=e.R,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.R=i.L,n.R&&(n.R.U=n),i.L=n}function Wi(t,e){var n=e,i=e.L,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.L=i.R,n.L&&(n.L.U=n),i.R=n}function Xi(t){for(;t.L;)t=t.L;return t}(function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,a=t.shortDays,s=t.months,c=t.shortMonths,u=(ti(r),ei(r),ti(o),ei(o),ti(a),ei(a),ti(s),ei(s),ti(c),ei(c),{a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:ni,e:ni,f:si,g:gi,G:yi,H:ii,I:ri,j:oi,L:ai,m:ci,M:ui,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:zi,s:qi,S:li,u:fi,U:hi,V:pi,w:bi,W:mi,x:null,X:null,y:vi,Y:_i,Z:wi,"%":Bi}),l={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:xi,e:xi,f:Mi,g:Ni,G:Li,H:ki,I:Ci,j:Si,L:Oi,m:Pi,M:Fi,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:zi,s:qi,S:Ti,u:Ui,U:Ei,V:ji,w:Ai,W:Ii,x:null,X:null,y:Vi,Y:Ri,Z:Hi,"%":Bi};function f(t,e){return function(n){var i,r,o,a=[],s=-1,c=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++s0)){if(o/=h,h<0){if(o0){if(o>f)return;o>l&&(l=o)}if(o=i-c,h||!(o<0)){if(o/=h,h<0){if(o>f)return;o>l&&(l=o)}else if(h>0){if(o0)){if(o/=d,d<0){if(o0){if(o>f)return;o>l&&(l=o)}if(o=r-u,d||!(o<0)){if(o/=d,d<0){if(o>f)return;o>l&&(l=o)}else if(d>0){if(o0||f<1)||(l>0&&(t[0]=[c+l*h,u+l*d]),f<1&&(t[1]=[c+f*h,u+f*d]),!0)}}}}}function er(t,e,n,i,r){var o=t[1];if(o)return!0;var a,s,c=t[0],u=t.left,l=t.right,f=u[0],h=u[1],d=l[0],p=l[1],b=(f+d)/2;if(p===h){if(b=i)return;if(f>d){if(c){if(c[1]>=r)return}else c=[b,n];o=[b,r]}else{if(c){if(c[1]1)if(f>d){if(c){if(c[1]>=r)return}else c=[(n-s)/a,n];o=[(r-s)/a,r]}else{if(c){if(c[1]=i)return}else c=[e,a*e+s];o=[i,a*i+s]}else{if(c){if(c[0]=-kr)){var d=c*c+u*u,p=l*l+f*f,b=(f*d-u*p)/h,m=(c*p-l*d)/h,v=ar.pop()||new sr;v.arc=t,v.site=r,v.x=b+a,v.y=(v.cy=m+s)+Math.sqrt(b*b+m*m),t.circle=v;for(var g=null,_=yr._;_;)if(v.y<_.y||v.y===_.y&&v.x<=_.x){if(!_.L){g=_.P;break}_=_.L}else{if(!_.R){g=_;break}_=_.R}yr.insert(g,v),g||(or=v)}}}}function ur(t){var e=t.circle;e&&(e.P||(or=e.N),yr.remove(e),ar.push(e),Ji(e),t.circle=null)}var lr=[];function fr(){Ji(this),this.edge=this.site=this.circle=null}function hr(t){var e=lr.pop()||new fr;return e.site=t,e}function dr(t){ur(t),gr.remove(t),lr.push(t),Ji(t)}function pr(t){var e=t.circle,n=e.x,i=e.cy,r=[n,i],o=t.P,a=t.N,s=[t];dr(t);for(var c=o;c.circle&&Math.abs(n-c.circle.x)xr)s=s.L;else{if(!((r=o-vr(s,a))>xr)){i>-xr?(e=s.P,n=s):r>-xr?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}!function(t){_r[t.index]={site:t,halfedges:[]}}(t);var c=hr(t);if(gr.insert(e,c),e||n){if(e===n)return ur(e),n=hr(e.site),gr.insert(c,n),c.edge=n.edge=Zi(e.site,c.site),cr(e),void cr(n);if(n){ur(e),ur(n);var u=e.site,l=u[0],f=u[1],h=t[0]-l,d=t[1]-f,p=n.site,b=p[0]-l,m=p[1]-f,v=2*(h*m-d*b),g=h*h+d*d,_=b*b+m*m,y=[(m*g-d*_)/v+l,(h*_-b*g)/v+f];Ki(n.edge,u,p,y),c.edge=Zi(u,t,null,y),n.edge=Zi(t,p,null,y),cr(e),cr(n)}else c.edge=Zi(e.site,c.site)}}function mr(t,e){var n=t.site,i=n[0],r=n[1],o=r-e;if(!o)return i;var a=t.P;if(!a)return-1/0;var s=(n=a.site)[0],c=n[1],u=c-e;if(!u)return s;var l=s-i,f=1/o-1/u,h=l/u;return f?(-h+Math.sqrt(h*h-2*f*(l*l/(-2*u)-c+u/2+r-o/2)))/f+i:(i+s)/2}function vr(t,e){var n=t.N;if(n)return mr(n,e);var i=t.site;return i[1]===e?i[0]:1/0}var gr,_r,yr,wr,xr=1e-6,kr=1e-12;function Cr(t,e){return e[1]-t[1]||e[0]-t[0]}function Sr(t,e){var n,i,r,o=t.sort(Cr).pop();for(wr=[],_r=new Array(t.length),gr=new Qi,yr=new Qi;;)if(r=or,o&&(!r||o[1]xr||Math.abs(r[0][1]-r[1][1])>xr)||delete wr[o]}(a,s,c,u),function(t,e,n,i){var r,o,a,s,c,u,l,f,h,d,p,b,m=_r.length,v=!0;for(r=0;rxr||Math.abs(b-h)>xr)&&(c.splice(s,0,wr.push(Gi(a,d,Math.abs(p-t)xr?[t,Math.abs(f-t)xr?[Math.abs(h-i)xr?[n,Math.abs(f-n)xr?[Math.abs(h-e)=s)return null;var c=t-r.site[0],u=e-r.site[1],l=c*c+u*u;do{r=o.cells[i=a],a=null,r.halfedges.forEach((function(n){var i=o.edges[n],s=i.left;if(s!==r.site&&s||(s=i.right)){var c=t-s[0],u=e-s[1],f=c*c+u*u;f1&&void 0!==arguments[1]&&arguments[1],n={type:"FeatureCollection",features:[]};for(var i in this.localFeatures){var r;(i!=t||e)&&(console.log("feature key",this.localFeatures[i]),(r=n.features).push.apply(r,s(this.localFeatures[i].features)))}return n}},{key:"ngOnDestroy",value:function(){this.newFeatureSubscription.unsubscribe(),this.predictions.removeVisibleFeatures(this.issue)}}]),t}()).\u0275fac=function(t){return new(t||Br)(b.Pb(l.d),b.Pb(l.e),b.Pb(l.b),b.Pb(Lr.a))},Br.\u0275cmp=b.Jb({type:Br,selectors:[["mol-spatial-feedback"]],inputs:{id:"id",scientificname:"scientificname",issue:"issue",drawOn:"drawOn",addDisabled:"addDisabled",clear:"clear",features:"features"},outputs:{nowDrawingIn:"nowDrawingIn",setFeatures:"setFeatures"},features:[b.Ab],decls:1,vars:1,consts:[["mat-icon-button","",3,"click",4,"ngIf"],["mat-icon-button","",3,"click"],[3,"color"]],template:function(t,e){1&t&&b.Fc(0,Hr,3,1,"button",0),2&t&&b.mc("ngIf",e.drawOn)},directives:[c.t,jr.b,Nr.a],styles:[".card-title[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.card-title[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0}.card-title.feedback-list[_ngcontent-%COMP%]{width:100%}.card-title[_ngcontent-%COMP%] .left[_ngcontent-%COMP%]{display:flex;flex-direction:row}[_nghost-%COMP%]{width:95%}.note-text[_ngcontent-%COMP%]{line-height:smaller;font-size:smaller;color:#7f7f7f;padding-left:15px}.mat-icon-button[_ngcontent-%COMP%]{margin-left:2px}.mat-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:right}.feedback-icon[_ngcontent-%COMP%]{min-width:20px;max-width:20px;min-height:20px;max-height:20px;margin-right:5px}.false_presence[_ngcontent-%COMP%]{background-color:#00c814}.false_absence[_ngcontent-%COMP%]{background-color:#c80000}.note[_ngcontent-%COMP%]{background-color:#7f7f7f} .in-draw{background:#fff;color:#000}"]}),Br),qr=o("s2Ay");function Yr(t,e){if(1&t&&(b.Vb(0,"mat-option",32),b.Hc(1),b.Ub()),2&t){var n=e.$implicit;b.mc("value",n.prediction_id),b.Cb(1),b.Lc(" ",n.version," - Rank: ",n.prediction_rank,", ",n.range_offset?"":"No ","Range offset, AUC: ",n.auc," ")}}function Jr(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div",44),b.Vb(1,"div",45),b.Vb(2,"div",46),b.Vb(3,"h4"),b.Hc(4),b.ic(5,"translate"),b.Ub(),b.Ub(),b.Vb(6,"div",15),b.Vb(7,"ngx-slider",47),b.dc("userChangeEnd",(function(t){b.xc(n);var e=b.hc().$implicit;return b.hc(2).setOpacity(e,t)})),b.Ub(),b.Ub(),b.Ub(),b.Ub()}if(2&t){var i=b.hc().$implicit,r=b.hc(2);b.Cb(4),b.Ic(b.jc(5,3,"opacity")),b.Cb(3),b.mc("formControlName",i.sliderName)("options",r.sliderOpts)}}function $r(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div",33),b.Vb(1,"div",34),b.Vb(2,"mol-checkbox",35),b.dc("stateChange",(function(t){b.xc(n);var i=e.$implicit;return b.hc(2).toggleLayer(i,t)})),b.ic(3,"translate"),b.Ub(),b.Vb(4,"div",36),b.Vb(5,"button",37),b.dc("click",(function(t){b.xc(n);var i=e.$implicit;return b.hc(2).showOpacity(i,t)})),b.Vb(6,"mat-icon",38),b.ic(7,"translate"),b.Hc(8,"opacity"),b.Ub(),b.Ub(),b.Vb(9,"button",39),b.dc("click",(function(){return b.xc(n),b.hc(2).zoom()})),b.Vb(10,"mat-icon",38),b.ic(11,"translate"),b.Hc(12,"zoom_in"),b.Ub(),b.Ub(),b.Vb(13,"button",40),b.dc("click",(function(){b.xc(n);var t=e.$implicit;return b.hc(2).showInfo(t)})),b.Qb(14,"i",41),b.ic(15,"translate"),b.Ub(),b.Vb(16,"div"),b.Qb(17,"img",42),b.Ub(),b.Ub(),b.Ub(),b.Fc(18,Jr,8,5,"div",43),b.Ub()}if(2&t){var i=e.$implicit;b.Cb(2),b.mc("label",b.jc(3,9,i.title))("checked",i.checked),b.Cb(3),b.mc("disabled",!i.checked),b.Cb(1),b.mc("matTooltip",b.jc(7,11,"change_opacity")),b.Cb(3),b.mc("disabled",!0),b.Cb(1),b.mc("matTooltip",b.jc(11,13,"zoom_to_layer")),b.Cb(4),b.mc("matTooltip",b.jc(15,15,i.info)),b.Cb(3),b.mc("src",i.img,b.zc),b.Cb(1),b.mc("ngIf",i.opacity)}}function Wr(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div",11),b.Vb(1,"mat-form-field",12),b.Vb(2,"mat-label"),b.Hc(3),b.ic(4,"translate"),b.Ub(),b.Vb(5,"input",48),b.dc("change",(function(){return b.xc(n),b.hc(2).onMinMaxChange()})),b.Ub(),b.Ub(),b.Ub()}2&t&&(b.Cb(3),b.Ic(b.jc(4,1,"max")))}function Xr(t,e){if(1&t){var n=b.Wb();b.Vb(0,"ngx-slider",49),b.dc("userChangeEnd",(function(){return b.xc(n),b.hc(2).updateMap()}))("valueChange",(function(t){return b.xc(n),b.hc(2).minThreshold=t})),b.Ub()}if(2&t){var i=b.hc(2);b.mc("value",i.minThreshold)("options",i.predictionSliderOpts)}}function Qr(t,e){if(1&t){var n=b.Wb();b.Vb(0,"ngx-slider",50),b.dc("userChangeEnd",(function(){return b.xc(n),b.hc(2).updateMap()}))("valueChange",(function(t){return b.xc(n),b.hc(2).minThreshold=t}))("highValueChange",(function(t){return b.xc(n),b.hc(2).maxThreshold=t})),b.Ub()}if(2&t){var i=b.hc(2);b.mc("value",i.minThreshold)("highValue",i.maxThreshold)("options",i.predictionSliderOpts)}}function Zr(t,e){1&t&&(b.Vb(0,"span"),b.Hc(1),b.ic(2,"translate"),b.Ub()),2&t&&(b.Cb(1),b.Ic(b.jc(2,1,"very_poor")))}function Gr(t,e){1&t&&(b.Vb(0,"span"),b.Hc(1),b.ic(2,"translate"),b.Ub()),2&t&&(b.Cb(1),b.Ic(b.jc(2,1,"excellent")))}function Kr(t,e){if(1&t&&(b.Vb(0,"div",51),b.Qb(1,"mat-radio-button",52),b.Vb(2,"span"),b.Vb(3,"strong"),b.Hc(4),b.Ub(),b.Ub(),b.Fc(5,Zr,3,3,"span",0),b.Fc(6,Gr,3,3,"span",0),b.Ub()),2&t){var n=e.$implicit,i=b.hc(2);b.Cb(1),b.mc("value",n)("checked",i.feedback.rating==n),b.Cb(3),b.Ic(n),b.Cb(1),b.mc("ngIf",1==n),b.Cb(1),b.mc("ngIf",5==n)}}function to(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mol-spatial-feedback",58),b.dc("setFeatures",(function(t){return b.xc(n),b.hc(3).setFeatures(t)}))("nowDrawingIn",(function(t){return b.xc(n),b.hc(3).nowDrawingIn(t)})),b.Ub()}if(2&t){var i=b.hc().$implicit,r=b.hc(2);b.mc("addDisabled",r.drawingIn==i.title)("issue",i.title)("features",r.feedback.spatialFeedbacks)}}var eo=function(){return{standalone:!0}};function no(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mat-form-field",59),b.Vb(1,"mat-label"),b.Hc(2),b.ic(3,"translate"),b.Ub(),b.Vb(4,"textarea",60),b.dc("ngModelChange",(function(t){return b.xc(n),b.hc().$implicit.comment=t}))("change",(function(){return b.xc(n),b.hc(3).onTextAreaChanged()})),b.Ub(),b.Ub()}if(2&t){var i=b.hc().$implicit;b.Cb(2),b.Ic(b.jc(3,3,"leave_comment")),b.Cb(2),b.mc("ngModel",i.comment)("ngModelOptions",b.oc(5,eo))}}function io(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div"),b.Vb(1,"div",53),b.Vb(2,"mol-checkbox",35),b.dc("stateChange",(function(t){b.xc(n);var i=e.$implicit;return b.hc(2).toggleFeedback(i,t)})),b.ic(3,"translate"),b.Ub(),b.Vb(4,"button",54),b.Qb(5,"i",41),b.Ub(),b.Fc(6,to,1,3,"mol-spatial-feedback",55),b.Ub(),b.Vb(7,"div",56),b.Fc(8,no,5,6,"mat-form-field",57),b.Ub(),b.Ub()}if(2&t){var i=e.$implicit;b.Cb(2),b.mc("label",b.jc(3,5,i.name))("checked",i.selected),b.Cb(3),b.mc("matTooltip",i.description),b.Cb(1),b.mc("ngIf",i.selected),b.Cb(2),b.mc("ngIf",i.selected)}}function ro(t,e){if(1&t&&(b.Vb(0,"mat-option",32),b.Hc(1),b.Ub()),2&t){var n=e.$implicit;b.mc("value",n),b.Cb(1),b.Ic(n.mol_id)}}function oo(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mol-spatial-feedback",67),b.dc("setFeatures",(function(t){return b.xc(n),b.hc(5).setFeatures(t)}))("nowDrawingIn",(function(t){return b.xc(n),b.hc(5).nowDrawingIn(t)})),b.Ub()}if(2&t){var i=b.hc().$implicit,r=b.hc(4);b.mc("issue",i)("drawOn",!1)("features",r.selectedExpert.spatial_feedback)}}function ao(t,e){if(1&t&&(b.Vb(0,"div",56),b.Vb(1,"textarea",68),b.Hc(2),b.Ub(),b.Ub()),2&t){var n=b.hc(5);b.Cb(2),b.Ic(n.selectedExpert.issue_comments[n.issue])}}function so(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div"),b.Vb(1,"mol-checkbox",64),b.dc("stateChange",(function(t){b.xc(n);var i=e.$implicit;return b.hc(4).toggleOtherFeedback(i,t)})),b.Ub(),b.Fc(2,oo,1,3,"mol-spatial-feedback",65),b.Fc(3,ao,3,1,"div",66),b.Ub()}if(2&t){var i=e.$implicit,r=b.hc(4);b.Cb(1),b.mc("label",i)("checked",r.selectedExpert.selected[i]),b.Cb(1),b.mc("ngIf",r.selectedExpert.selected[i]),b.Cb(1),b.mc("ngIf",r.selectedExpert.issue_comments&&r.selectedExpert.issue_comments[r.issue])}}function co(t,e){if(1&t&&(b.Vb(0,"div"),b.Fc(1,so,4,4,"div",27),b.Ub()),2&t){var n=b.hc(3);b.Cb(1),b.mc("ngForOf",n.selectedExpert.issues.split(";"))}}function uo(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div",61),b.Vb(1,"h4"),b.Vb(2,"strong"),b.Hc(3),b.ic(4,"translate"),b.Ub(),b.Ub(),b.Vb(5,"mat-form-field",62),b.Vb(6,"mat-label"),b.Hc(7,"Expert ID"),b.Ub(),b.Vb(8,"mat-select",63),b.dc("selectionChange",(function(){return{}}))("valueChange",(function(t){return b.xc(n),b.hc(2).selectedExpert=t})),b.Fc(9,ro,2,2,"mat-option",6),b.Ub(),b.Ub(),b.Fc(10,co,2,1,"div",0),b.Ub()}if(2&t){var i=b.hc(2);b.Cb(3),b.Ic(b.jc(4,4,"existing_feedback")),b.Cb(5),b.mc("value",i.selectedExpert),b.Cb(1),b.mc("ngForOf",i.othersFeedback),b.Cb(1),b.mc("ngIf",i.selectedExpert)}}var lo=function(){return[1,2,3,4,5]};function fo(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mat-card"),b.Vb(1,"h2",1),b.Vb(2,"div"),b.Vb(3,"strong"),b.Hc(4),b.Ub(),b.Ub(),b.Ub(),b.Vb(5,"form",2),b.Vb(6,"div",3),b.Vb(7,"mat-form-field",4),b.Vb(8,"mat-select",5),b.Fc(9,Yr,2,5,"mat-option",6),b.Ub(),b.Ub(),b.Ub(),b.Fc(10,$r,19,17,"div",7),b.Vb(11,"div",8),b.Vb(12,"div",9),b.Vb(13,"mat-slide-toggle",10),b.dc("toggleChange",(function(){return b.xc(n),b.hc().updateToggle("binary")})),b.Hc(14),b.ic(15,"translate"),b.Ub(),b.Ub(),b.Vb(16,"div",11),b.Vb(17,"mat-form-field",12),b.Vb(18,"mat-label"),b.Hc(19),b.ic(20,"translate"),b.Ub(),b.Vb(21,"input",13),b.dc("change",(function(){return b.xc(n),b.hc().onMinMaxChange()})),b.Ub(),b.Ub(),b.Ub(),b.Fc(22,Wr,6,3,"div",14),b.Ub(),b.Vb(23,"div",15),b.Fc(24,Xr,1,2,"ngx-slider",16),b.Fc(25,Qr,1,3,"ngx-slider",17),b.Ub(),b.Vb(26,"div",18),b.Vb(27,"div",19),b.Vb(28,"small"),b.Hc(29),b.ic(30,"translate"),b.Ub(),b.Ub(),b.Vb(31,"div",20),b.Vb(32,"span"),b.Hc(33),b.ic(34,"translate"),b.Ub(),b.Vb(35,"span"),b.Hc(36),b.ic(37,"translate"),b.Ub(),b.Ub(),b.Ub(),b.Qb(38,"mat-divider"),b.Vb(39,"div",21),b.Vb(40,"button",22),b.dc("click",(function(){return b.xc(n),b.hc().submitFeedback()})),b.Hc(41),b.ic(42,"translate"),b.Ub(),b.Ub(),b.Vb(43,"div",23),b.Vb(44,"h4"),b.Vb(45,"strong"),b.Hc(46),b.ic(47,"translate"),b.Ub(),b.Ub(),b.Vb(48,"mat-radio-group",24),b.dc("change",(function(t){return b.xc(n),b.hc().setRating(t)})),b.Fc(49,Kr,7,5,"div",25),b.Ub(),b.Ub(),b.Vb(50,"div",26),b.Vb(51,"h4"),b.Vb(52,"strong"),b.Hc(53),b.ic(54,"translate"),b.Ub(),b.Ub(),b.Fc(55,io,9,7,"div",27),b.Ub(),b.Vb(56,"div",28),b.Vb(57,"button",29),b.dc("click",(function(){return b.xc(n),b.hc().getPreviousSpecies()})),b.Hc(58),b.ic(59,"translate"),b.Ub(),b.Vb(60,"button",30),b.dc("click",(function(){return b.xc(n),b.hc().getNextSpecies()})),b.Hc(61),b.ic(62,"translate"),b.Ub(),b.Ub(),b.Fc(63,uo,11,6,"div",31),b.Ub(),b.Ub()}if(2&t){var i=b.hc();b.Cb(4),b.Ic(i.modelInfo.sciname),b.Cb(1),b.mc("formGroup",i.predictionsForm),b.Cb(4),b.mc("ngForOf",i.modelList),b.Cb(1),b.mc("ngForOf",i.layers),b.Cb(3),b.mc("checked",i.binaryMap),b.Cb(1),b.Jc(" ",b.jc(15,25,"binary")," "),b.Cb(5),b.Ic(b.jc(20,27,"min")),b.Cb(3),b.mc("ngIf",!i.binaryMap),b.Cb(2),b.mc("ngIf",i.binaryMap),b.Cb(1),b.mc("ngIf",!i.binaryMap),b.Cb(1),b.mc("hidden",i.binaryMap),b.Cb(3),b.Ic(b.jc(30,29,"sdm_legend")),b.Cb(4),b.Ic(b.jc(34,31,"less_likely")),b.Cb(3),b.Ic(b.jc(37,33,"highly_likely")),b.Cb(4),b.mc("disabled",i.disableSave),b.Cb(1),b.Jc(" ",b.jc(42,35,"save")," "),b.Cb(5),b.Ic(b.jc(47,37,"pred_rating")),b.Cb(3),b.mc("ngForOf",b.oc(45,lo)),b.Cb(4),b.Ic(b.jc(54,39,"feedback")),b.Cb(2),b.mc("ngForOf",i.commonProblemsLocal),b.Cb(2),b.mc("disabled",i.worksheetEmpty),b.Cb(1),b.Jc(" ",b.jc(59,41,"previous_species")," "),b.Cb(2),b.mc("disabled",i.worksheetEmpty),b.Cb(1),b.Jc(" ",b.jc(62,43,"next_species")," "),b.Cb(2),b.mc("ngIf",i.othersFeedback&&0!=i.othersFeedback.length)}}function ho(t,e){1&t&&(b.Vb(0,"div"),b.Vb(1,"mat-card"),b.Vb(2,"mat-card-title"),b.Hc(3,"Loading..."),b.Ub(),b.Ub(),b.Ub())}var po,bo=((po=function(){function t(e,n,i){var o=this;r(this,t),this.predictionsService=e,this.map=n,this.translate=i,this.showBackground=new b.o,this.refreshPrediction=new b.o,this.modelChange=new b.o,this.nextSpecies=new b.o,this.previousSpecies=new b.o,this.openMetadata=new b.o,this.PDF=new b.o,this.updateThreshold=new b.o,this.commonProblemsLocal=null,this.drawDisabled=!1,this.othersFeedback=["a","b"],this.disableSave=!0,this.predictionsForm=new O.i({model:new O.f,min:new O.f,max:new O.f,mask:new O.f(!0),updateMinROC:new O.f(!0),points:new O.f(1),range:new O.f(.3),rangemap:new O.f(.8),feedback:new O.f(1),prediction:new O.f(1)}),this.sliderOpts={step:.05,floor:0,ceil:1,showSelectionBar:!0,showTicks:!1},this.feedback={rating:-1,spatialFeedbacks:{},issue_comments:{}},this.layers=[{title:"layers_prediction",checked:!0,opacity:!1,sliderName:"prediction",layerIndex:2,img:"https://cdn.mol.org/static/images/legends/datatypes/model.png",info:"info_layers_prediction"},{title:"layers_expert_range",checked:!1,opacity:!1,sliderName:"rangemap",layerIndex:0,img:"https://cdn.mol.org/static/images/legends/datatypes/range.png",info:"info_layers_expert_range"},{title:"layers_model_input",checked:!0,opacity:!1,sliderName:"range",layerIndex:1,img:"https://cdn.mol.org/static/images/legends/datatypes/range.png",info:"info_layers_model_input"},{title:"layers_points",checked:!0,opacity:!1,sliderName:"points",layerIndex:3,img:"https://mapoflife.github.io/experts-next/assets/points.png",bgImg:"https://mapoflife.github.io/experts-next/assets/background_points.png",info:"info_layers_points"}],this.predictionSliderOpts=null,this.modelInfo=null,this.backgroundPoints=!1,this.binaryMap=!0,this.logMap=!1,this.map.clickedFeatures.subscribe((function(t){var e,n;if(t&&t.length>0){console.log("clicked feature",null===(e=t[0])||void 0===e?void 0:e.getProperties());var i=null===(n=t[0])||void 0===n?void 0:n.getProperties(),r=o.feedback.spatialFeedbacks[null==i?void 0:i.issue],a=r.features.findIndex((function(t){return t.properties.feedback_id==(null==i?void 0:i.feedback_id)}));r.features.splice(a,1),r.features=r.features.map((function(t,e){return t.properties.feedback_index=e+1,t})),o.predictionsService.setVisibleFeatures(null==i?void 0:i.issue,r)}})),this.predictionsService.visibleFeatures.subscribe((function(t){var e={type:"FeatureCollection",features:[]};for(var n in t){var i;(i=e.features).push.apply(i,s(t[n].features))}o.map.userFeaturesSet(e)}))}return a(t,[{key:"ngOnInit",value:function(){this.toggleLayer(this.layers[1],!1)}},{key:"ngOnChanges",value:function(t){var e,n=this;t.info&&(this.predictionSliderOpts={floor:.01*this.minThreshold,step:.001*this.minThreshold,ceil:this.maxThreshold,translate:function(t,e){switch(e){case Mr.a.Ceil:case Mr.a.Floor:return""+t.toExponential(0)+"";default:return""+t.toExponential(2)+""}}},this.setupInfo(),this.commonProblemsLocal=[].concat(d),this.feedback.project_id=this.project_id,this.feedback.prediction_id=this.info.prediction_id,this.othersFeedback=null,this.selectedExpert=null,this.predictionsService.getFeedbackOthers(this.project_id,this.info.prediction_id).subscribe((function(t){t.forEach((function(t){var e;t.selected=null===(e=t.issues)||void 0===e?void 0:e.split(";").reduce((function(t,e){return t[e]=!1,t}),{})})),n.othersFeedback=t})),this.predictionsService.getSDMFeedbackv2(this.project_id,this.info.prediction_id).subscribe((function(t){var e,i,r,o;n.feedback.spatialFeedbacks=null!==(e=(t=(null==t?void 0:t.length)>0?t[0]:{}).spatial_feedback)&&void 0!==e?e:{},n.feedback.rating=null!==(i=t.rating)&&void 0!==i?i:-1;var a=null!==(o=null===(r=t.issues)||void 0===r?void 0:r.split(";"))&&void 0!==o?o:[];n.commonProblemsLocal.forEach((function(e){e.selected=a.indexOf(e.title)>-1,e.comment=(null==t?void 0:t.issue_comments)?null==t?void 0:t.issue_comments[e.title]:"",n.disableSave=!0}))}))),(null===(e=t.predictionOptions)||void 0===e?void 0:e.currentValue.min)&&this.predictionsForm.patchValue({min:Number(t.predictionOptions.currentValue.min).toExponential(2),max:Number(t.predictionOptions.currentValue.max).toExponential(2)})}},{key:"ngAfterViewInit",value:function(){this.drawLegend()}},{key:"submitFeedback",value:function(){var t=this.commonProblemsLocal.filter((function(t){return t.selected})).map((function(t){return t.title})).join(";");this.feedback.issues=t,this.feedback.rating>0&&(this.predictionsService.submitFeedback(this.feedback).subscribe((function(t){})),this.disableSave=!0)}},{key:"shouldUpdateMin",value:function(t){return void 0!==t.predictionOptions&&void 0!==t.predictionOptions.currentValue&&t.predictionOptions.currentValue.min!==this.predictionsForm.get("min").value}},{key:"setupInfo",value:function(){if(this.info){var t=this.info.scientificname.replaceAll("_"," ");this.modelInfo={sciname:t,SPSthreshold:this.info.sps_threshold,noRangeOffsetModel:this.info.noRangeOffsetModel,noRangeOffsetModelIndex:this.info.noRangeOffsetModelIndex,isBest:this.info.isBest},this.setPredictionsForm()}}},{key:"toggleOtherFeedback",value:function(t,e){this.selectedExpert.selected[t]=e}},{key:"setPredictionsForm",value:function(){this.predictionsForm.patchValue({model:this.info.prediction_id,min:this.minThreshold.toExponential(2),max:this.maxThreshold.toExponential(2)},{emitEvent:!1})}},{key:"showOpacity",value:function(t,e){e.pointerId>0&&(t.opacity=!t.opacity)}},{key:"zoom",value:function(){}},{key:"showInfo",value:function(t){"rangemap"===t.sliderName&&this.openMetadata.emit("rangemap")}},{key:"setOpacity",value:function(t,e){this.map.updateLayerOpacity(e.value,t.layerIndex)}},{key:"toggleLayer",value:function(t,e){t.checked=e,t.checked?this.map.updateLayerOpacity(this.predictionsForm.get(t.sliderName).value,t.layerIndex):(this.map.updateLayerOpacity(0,t.layerIndex),t.opacity=!1)}},{key:"toggleFeedback",value:function(t,e){this.disableSave=!1,t.selected=e}},{key:"toggleBackground",value:function(){this.backgroundPoints=!this.backgroundPoints,this.showBackground.emit(this.backgroundPoints)}},{key:"updateToggle",value:function(t){"binary"===t?this.binaryMap=!this.binaryMap:"log"===t&&(this.logMap=!this.logMap),this.updateMap()}},{key:"updateMap",value:function(){this.refreshPrediction.emit({min:this.minThreshold,max:this.maxThreshold,binary:this.binaryMap})}},{key:"getNextSpecies",value:function(){this.drawingIn="",this.nextSpecies.emit()}},{key:"getPreviousSpecies",value:function(){this.drawingIn="",this.previousSpecies.emit()}},{key:"triggerModelAction",value:function(t){switch(t){case"Metadata":this.openMetadata.emit("model");break;case"PDF":this.PDF.emit();break;case"Species":var e="http://mol.org/species/map/"+this.scientificname.split(" ").slice(0,2).join("_");window.open(e,"_blank")}}},{key:"drawLegend",value:function(){var t=new Bt([[document.querySelector("#legend")]],[document.documentElement]).append("svg").attr("width",400).attr("height",10),e=t.append("g");t.append("defs").append("linearGradient").attr("id","linear-gradient").selectAll("stop").data([{offset:"0%",color:"#de2d26"},{offset:"50%",color:"#ffff8c"},{offset:"100%",color:"#2ca25f"}]).enter().append("stop").attr("offset",(function(t){return t.offset})).attr("stop-color",(function(t){return t.color})).attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%"),e.append("rect").attr("width",350).attr("height",20).style("fill","url(#linear-gradient)")}},{key:"addSpatialFeedback",value:function(){this.drawDisabled=!this.drawDisabled,this.map.updateMapState(this.drawDisabled?"DRAW":"MAP")}},{key:"setFeatures",value:function(t){this.disableSave=!1,this.feedback.spatialFeedbacks[t.issue]=t.features}},{key:"setRating",value:function(t){this.disableSave=!1,this.feedback.rating=t.value}},{key:"nowDrawingIn",value:function(t){this.drawingIn=t}},{key:"onTextAreaChanged",value:function(){this.feedback.issue_comments=Object.assign.apply(Object,[{}].concat(s(this.commonProblemsLocal.filter((function(t){return t.selected})).map((function(t){return e={},n=t.title,i=t.comment,n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e;var e,n,i})))))}},{key:"onMinMaxChange",value:function(){this.minThreshold=this.predictionsForm.controls.min.value,this.maxThreshold=this.predictionsForm.controls.max.value,this.updateMap()}}]),t}()).\u0275fac=function(t){return new(t||po)(b.Pb(l.e),b.Pb(l.d),b.Pb(l.j))},po.\u0275cmp=b.Jb({type:po,selectors:[["mol-model-info"]],inputs:{id:"id",project_id:"project_id",info:"info",modelList:"modelList",predictionOptions:"predictionOptions",scientificname:"scientificname",worksheetEmpty:"worksheetEmpty",minThreshold:"minThreshold",maxThreshold:"maxThreshold"},outputs:{showBackground:"showBackground",refreshPrediction:"refreshPrediction",modelChange:"modelChange",nextSpecies:"nextSpecies",previousSpecies:"previousSpecies",openMetadata:"openMetadata",PDF:"PDF",updateThreshold:"updateThreshold"},features:[b.Ab],decls:2,vars:2,consts:[[4,"ngIf"],[1,"species-title"],[3,"formGroup"],[1,"models"],["appearance","fill"],["formControlName","model","name","model"],[3,"value",4,"ngFor","ngForOf"],["class","layers-wrapper",4,"ngFor","ngForOf"],[1,"threshold-toggle"],[1,"binary-toggle"],[3,"checked","toggleChange"],[1,"value-wrapper"],["appearance","fill",1,"max"],["matInput","","formControlName","min",3,"change"],["class","value-wrapper",4,"ngIf"],[1,"mrs-slider","custom-slider"],[3,"value","options","userChangeEnd","valueChange",4,"ngIf"],[3,"value","highValue","options","userChangeEnd","valueChange","highValueChange",4,"ngIf"],[3,"hidden"],["id","legend"],[1,"scale"],[1,"button-box"],["color","primary","mat-raised-button","",3,"disabled","click"],[1,"prediction-score-block"],["aria-label","Select an option",1,"prediction-score",3,"change"],["class","prediction-score score-item",4,"ngFor","ngForOf"],[1,"prediction-feedback"],[4,"ngFor","ngForOf"],[1,"buttons"],["mat-stroked-button","","color","accent",2,"align-items","left",3,"disabled","click"],["mat-stroked-button","","color","accent",2,"align-items","right",3,"disabled","click"],["class","existing-feedback",4,"ngIf"],[3,"value"],[1,"layers-wrapper"],[1,"value-wrapper","layers"],["color","accent",3,"label","checked","stateChange"],[1,"icons"],["mat-icon-button","","aria-label","opacity",3,"disabled","click"],["matTooltipClass","tooltip",3,"matTooltip"],["mat-icon-button","","aria-label","zoom",3,"disabled","click"],["mat-icon-button","","aria-label","info",3,"click"],["matTooltipClass","tooltip",1,"fa","fa-info",3,"matTooltip"],["height","20px","width","20px",1,"legend-img",3,"src"],["class","opacity",4,"ngIf"],[1,"opacity"],[1,"mrs-slider-box"],[1,"mrs","stat","title"],[3,"formControlName","options","userChangeEnd"],["matInput","","formControlName","max",3,"change"],[3,"value","options","userChangeEnd","valueChange"],[3,"value","highValue","options","userChangeEnd","valueChange","highValueChange"],[1,"prediction-score","score-item"],[3,"value","checked"],[1,"feedback-item"],["mat-icon-button","","aria-label","info"],[3,"addDisabled","issue","features","setFeatures","nowDrawingIn",4,"ngIf"],[1,"comment-box"],["class","example-full-width",4,"ngIf"],[3,"addDisabled","issue","features","setFeatures","nowDrawingIn"],[1,"example-full-width"],["matInput","","placeholder","",3,"ngModel","ngModelOptions","ngModelChange","change"],[1,"existing-feedback"],["appearance","standard",1,"dropdown-container"],[3,"value","selectionChange","valueChange"],[3,"label","checked","stateChange"],[3,"issue","drawOn","features","setFeatures","nowDrawingIn",4,"ngIf"],["class","comment-box",4,"ngIf"],[3,"issue","drawOn","features","setFeatures","nowDrawingIn"],["readonly",""]],template:function(t,e){1&t&&(b.Fc(0,fo,64,46,"mat-card",0),b.Fc(1,ho,4,0,"div",0)),2&t&&(b.mc("ngIf",e.info),b.Cb(1),b.mc("ngIf",!e.info))},directives:[c.t,Pr.a,O.H,O.s,O.j,Fr.c,Tr.a,O.r,O.h,c.s,Ur.a,Fr.g,Er.b,O.c,Dr.a,jr.b,Ar.c,Ir.n,Vr.a,Nr.a,Rr.a,Mr.c,Ar.b,zr,O.u,Pr.e],pipes:[qr.c],styles:[".mrs-slider-box{display:flex;justify-content:center;align-items:center;flex-direction:row;place-content:space-between}.mrs-slider-box .mrs{text-align:right;padding-right:5px}.mrs-slider-box .mrs-slider{width:80%}.threshold-toggle{padding-top:27px;height:45px}.threshold-toggle,.value-wrapper{display:flex;justify-content:space-around;align-items:center}.value-wrapper{flex-direction:row}.value-wrapper mat-form-field{max-width:65px}.value-wrapper.binary-toggle{justify-content:flex-end}.value-wrapper.layers,.value-wrapper.options{justify-content:space-between;height:30px}h2{display:flex;flex-direction:row;justify-content:space-between;margin-bottom:5px}h2 small{padding:3px}h4{margin-bottom:11px}h3{margin-bottom:0}.models mat-form-field{width:90%}.icons{display:flex;align-items:center}.colors{display:flex;flex-direction:row}.background,.occurence{width:10px;height:10px;margin:.5em}.break{padding-top:20px}.species-title{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:space-between}h2{margin:0!important}.buttons{width:100%;display:flex;flex-direction:row;justify-content:space-between;margin-top:4px;align-items:center}.buttons button{height:30px}.card-title{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.actions{margin-top:1.5em}#legend{margin-top:10px}.scale{display:flex;justify-content:space-between}.prediction-score{display:flex;align-items:flex-start;flex-wrap:wrap;justify-content:space-around;align-content:space-around}.score-item{display:flex;flex-direction:column;width:60px;align-items:center}mat-radio-button{width:20px}mat-card{padding:5px 16px!important}.prediction-score-block{margin-top:15px}.prediction-feedback h4,.prediction-score-block h4{margin:3px}mat-selection-list{padding:0}mat-list-option{height:20px}.feedback-item{display:flex;align-items:center;white-space:nowrap;height:25px;margin-left:15px}.comment-box{margin-left:40px}.comment-box mat-form-field{width:300px}.button-box{position:absolute;right:0;margin-top:4px}.existing-feedback{margin-top:7px}.existing-feedback mat-form-field{margin-left:15px}"],encapsulation:2}),po),mo=o("47ST"),vo=o("NiQx"),go=o("SSAN"),_o=o("bl/x"),yo=o("mWib"),wo=o("jxfh"),xo=o("J7xr"),ko=o("cZZj"),Co=o("qvOF"),So=o("5XID"),Oo=o("fAiE"),Mo=o("ZTXN"),Po=o("KTx3"),Fo=o("g6G6"),To=o("xVbo"),Uo=o("kuMc"),Eo=o("Ohay"),Do=o("YtkY"),jo=o("J+dc"),Ao=o("jIqt"),Io=o("f7+R"),Vo=o("5lCh"),No=o("sg/T"),Ro=o("E5oP"),Lo=["*"];function Ho(t,e){if(1&t){var n=b.Wb();b.Vb(0,"div",2),b.dc("click",(function(){return b.xc(n),b.hc()._onBackdropClicked()})),b.Ub()}if(2&t){var i=b.hc();b.Gb("mat-drawer-shown",i._isShowingBackdrop())}}function Bo(t,e){1&t&&(b.Vb(0,"mat-drawer-content"),b.kc(1,2),b.Ub())}var zo=[[["mat-drawer"]],[["mat-drawer-content"]],"*"],qo=["mat-drawer","mat-drawer-content","*"],Yo={transformDrawer:Object(Io.n)("transform",[Object(Io.k)("open, open-instant",Object(Io.l)({transform:"none",visibility:"visible"})),Object(Io.k)("void",Object(Io.l)({"box-shadow":"none",visibility:"hidden"})),Object(Io.m)("void => open-instant",Object(Io.e)("0ms")),Object(Io.m)("void <=> open, open-instant => void",Object(Io.e)("400ms cubic-bezier(0.25, 0.8, 0.25, 1)"))])};function Jo(t){throw Error("A drawer was already declared for 'position=\"".concat(t,"\"'"))}var $o,Wo,Xo,Qo,Zo=new b.r("MAT_DRAWER_DEFAULT_AUTOSIZE",{providedIn:"root",factory:function(){return!1}}),Go=new b.r("MAT_DRAWER_CONTAINER"),Ko=((Qo=function(n){!function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&t(e,n)}(o,n);var i=e(o);function o(t,e,n,a,s){var c;return r(this,o),(c=i.call(this,n,a,s))._changeDetectorRef=t,c._container=e,c}return a(o,[{key:"ngAfterContentInit",value:function(){var t=this;this._container._contentMarginChanges.subscribe((function(){t._changeDetectorRef.markForCheck()}))}}]),o}(Co.a)).\u0275fac=function(t){return new(t||Qo)(b.Pb(b.h),b.Pb(Object(b.U)((function(){return ea}))),b.Pb(b.l),b.Pb(Co.c),b.Pb(b.A))},Qo.\u0275cmp=b.Jb({type:Qo,selectors:[["mat-drawer-content"]],hostAttrs:[1,"mat-drawer-content"],hostVars:4,hostBindings:function(t,e){2&t&&b.Ec("margin-left",e._container._contentMargins.left,"px")("margin-right",e._container._contentMargins.right,"px")},features:[b.zb],ngContentSelectors:Lo,decls:1,vars:0,template:function(t,e){1&t&&(b.lc(),b.kc(0))},encapsulation:2,changeDetection:0}),Qo),ta=((Xo=function(){function t(e,n,i,o,a,s,c){var u=this;r(this,t),this._elementRef=e,this._focusTrapFactory=n,this._focusMonitor=i,this._platform=o,this._ngZone=a,this._doc=s,this._container=c,this._elementFocusedBeforeDrawerWasOpened=null,this._enableAnimations=!1,this._position="start",this._mode="over",this._disableClose=!1,this._opened=!1,this._animationStarted=new Mo.a,this._animationEnd=new Mo.a,this._animationState="void",this.openedChange=new b.o(!0),this._destroyed=new Mo.a,this.onPositionChanged=new b.o,this._modeChanged=new Mo.a,this.openedChange.subscribe((function(t){t?(u._doc&&(u._elementFocusedBeforeDrawerWasOpened=u._doc.activeElement),u._takeFocus()):u._restoreFocus()})),this._ngZone.runOutsideAngular((function(){Object(Po.a)(u._elementRef.nativeElement,"keydown").pipe(Object(To.a)((function(t){return t.keyCode===Oo.e&&!u.disableClose&&!Object(Oo.q)(t)})),Object(Uo.a)(u._destroyed)).subscribe((function(t){return u._ngZone.run((function(){u.close(),t.stopPropagation(),t.preventDefault()}))}))})),this._animationEnd.pipe(Object(Eo.a)((function(t,e){return t.fromState===e.fromState&&t.toState===e.toState}))).subscribe((function(t){var e=t.fromState,n=t.toState;(0===n.indexOf("open")&&"void"===e||"void"===n&&0===e.indexOf("open"))&&u.openedChange.emit(u._opened)}))}return a(t,[{key:"_takeFocus",value:function(){var t=this;this.autoFocus&&this._focusTrap&&this._focusTrap.focusInitialElementWhenReady().then((function(e){e||"function"!=typeof t._elementRef.nativeElement.focus||t._elementRef.nativeElement.focus()}))}},{key:"_restoreFocus",value:function(){if(this.autoFocus){var t=this._doc&&this._doc.activeElement;t&&this._elementRef.nativeElement.contains(t)&&(this._elementFocusedBeforeDrawerWasOpened?this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened,this._openedVia):this._elementRef.nativeElement.blur()),this._elementFocusedBeforeDrawerWasOpened=null,this._openedVia=null}}},{key:"ngAfterContentInit",value:function(){this._focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement),this._updateFocusTrapState()}},{key:"ngAfterContentChecked",value:function(){this._platform.isBrowser&&(this._enableAnimations=!0)}},{key:"ngOnDestroy",value:function(){this._focusTrap&&this._focusTrap.destroy(),this._animationStarted.complete(),this._animationEnd.complete(),this._modeChanged.complete(),this._destroyed.next(),this._destroyed.complete()}},{key:"open",value:function(t){return this.toggle(!0,t)}},{key:"close",value:function(){return this.toggle(!1)}},{key:"toggle",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!this.opened,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"program";return this._opened=e,e?(this._animationState=this._enableAnimations?"open":"open-instant",this._openedVia=n):(this._animationState="void",this._restoreFocus()),this._updateFocusTrapState(),new Promise((function(e){t.openedChange.pipe(Object(jo.a)(1)).subscribe((function(t){return e(t?"open":"close")}))}))}},{key:"_updateFocusTrapState",value:function(){this._focusTrap&&(this._focusTrap.enabled=this.opened&&"side"!==this.mode)}},{key:"_animationStartListener",value:function(t){this._animationStarted.next(t)}},{key:"_animationDoneListener",value:function(t){this._animationEnd.next(t)}},{key:"position",get:function(){return this._position},set:function(t){(t="end"===t?"end":"start")!=this._position&&(this._position=t,this.onPositionChanged.emit())}},{key:"mode",get:function(){return this._mode},set:function(t){this._mode=t,this._updateFocusTrapState(),this._modeChanged.next()}},{key:"disableClose",get:function(){return this._disableClose},set:function(t){this._disableClose=Object(So.c)(t)}},{key:"autoFocus",get:function(){var t=this._autoFocus;return null==t?"side"!==this.mode:t},set:function(t){this._autoFocus=Object(So.c)(t)}},{key:"opened",get:function(){return this._opened},set:function(t){this.toggle(Object(So.c)(t))}},{key:"_openedStream",get:function(){return this.openedChange.pipe(Object(To.a)((function(t){return t})),Object(Do.a)((function(){})))}},{key:"openedStart",get:function(){return this._animationStarted.pipe(Object(To.a)((function(t){return t.fromState!==t.toState&&0===t.toState.indexOf("open")})),Object(Do.a)((function(){})))}},{key:"_closedStream",get:function(){return this.openedChange.pipe(Object(To.a)((function(t){return!t})),Object(Do.a)((function(){})))}},{key:"closedStart",get:function(){return this._animationStarted.pipe(Object(To.a)((function(t){return t.fromState!==t.toState&&"void"===t.toState})),Object(Do.a)((function(){})))}},{key:"_width",get:function(){return this._elementRef.nativeElement&&this._elementRef.nativeElement.offsetWidth||0}}]),t}()).\u0275fac=function(t){return new(t||Xo)(b.Pb(b.l),b.Pb(No.i),b.Pb(No.h),b.Pb(ko.a),b.Pb(b.A),b.Pb(c.e,8),b.Pb(Go,8))},Xo.\u0275cmp=b.Jb({type:Xo,selectors:[["mat-drawer"]],hostAttrs:["tabIndex","-1",1,"mat-drawer"],hostVars:12,hostBindings:function(t,e){1&t&&b.Hb("@transform.start",(function(t){return e._animationStartListener(t)}))("@transform.done",(function(t){return e._animationDoneListener(t)})),2&t&&(b.Db("align",null),b.Mc("@transform",e._animationState),b.Gb("mat-drawer-end","end"===e.position)("mat-drawer-over","over"===e.mode)("mat-drawer-push","push"===e.mode)("mat-drawer-side","side"===e.mode)("mat-drawer-opened",e.opened))},inputs:{position:"position",mode:"mode",disableClose:"disableClose",autoFocus:"autoFocus",opened:"opened"},outputs:{openedChange:"openedChange",onPositionChanged:"positionChanged",_openedStream:"opened",openedStart:"openedStart",_closedStream:"closed",closedStart:"closedStart"},exportAs:["matDrawer"],ngContentSelectors:Lo,decls:2,vars:0,consts:[[1,"mat-drawer-inner-container"]],template:function(t,e){1&t&&(b.lc(),b.Vb(0,"div",0),b.kc(1),b.Ub())},encapsulation:2,data:{animation:[Yo.transformDrawer]},changeDetection:0}),Xo),ea=((Wo=function(){function t(e,n,i,o,a){var s=this,c=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6?arguments[6]:void 0;r(this,t),this._dir=e,this._element=n,this._ngZone=i,this._changeDetectorRef=o,this._animationMode=u,this._drawers=new b.E,this.backdropClick=new b.o,this._destroyed=new Mo.a,this._doCheckSubject=new Mo.a,this._contentMargins={left:null,right:null},this._contentMarginChanges=new Mo.a,e&&e.change.pipe(Object(Uo.a)(this._destroyed)).subscribe((function(){s._validateDrawers(),s.updateContentMargins()})),a.change().pipe(Object(Uo.a)(this._destroyed)).subscribe((function(){return s.updateContentMargins()})),this._autosize=c}return a(t,[{key:"ngAfterContentInit",value:function(){var t=this;this._allDrawers.changes.pipe(Object(Ao.a)(this._allDrawers),Object(Uo.a)(this._destroyed)).subscribe((function(e){t._drawers.reset(e.filter((function(e){return!e._container||e._container===t}))),t._drawers.notifyOnChanges()})),this._drawers.changes.pipe(Object(Ao.a)(null)).subscribe((function(){t._validateDrawers(),t._drawers.forEach((function(e){t._watchDrawerToggle(e),t._watchDrawerPosition(e),t._watchDrawerMode(e)})),(!t._drawers.length||t._isDrawerOpen(t._start)||t._isDrawerOpen(t._end))&&t.updateContentMargins(),t._changeDetectorRef.markForCheck()})),this._doCheckSubject.pipe(Object(yo.a)(10),Object(Uo.a)(this._destroyed)).subscribe((function(){return t.updateContentMargins()}))}},{key:"ngOnDestroy",value:function(){this._contentMarginChanges.complete(),this._doCheckSubject.complete(),this._drawers.destroy(),this._destroyed.next(),this._destroyed.complete()}},{key:"open",value:function(){this._drawers.forEach((function(t){return t.open()}))}},{key:"close",value:function(){this._drawers.forEach((function(t){return t.close()}))}},{key:"updateContentMargins",value:function(){var t=this,e=0,n=0;if(this._left&&this._left.opened)if("side"==this._left.mode)e+=this._left._width;else if("push"==this._left.mode){var i=this._left._width;e+=i,n-=i}if(this._right&&this._right.opened)if("side"==this._right.mode)n+=this._right._width;else if("push"==this._right.mode){var r=this._right._width;n+=r,e-=r}n=n||null,(e=e||null)===this._contentMargins.left&&n===this._contentMargins.right||(this._contentMargins={left:e,right:n},this._ngZone.run((function(){return t._contentMarginChanges.next(t._contentMargins)})))}},{key:"ngDoCheck",value:function(){var t=this;this._autosize&&this._isPushed()&&this._ngZone.runOutsideAngular((function(){return t._doCheckSubject.next()}))}},{key:"_watchDrawerToggle",value:function(t){var e=this;t._animationStarted.pipe(Object(To.a)((function(t){return t.fromState!==t.toState})),Object(Uo.a)(this._drawers.changes)).subscribe((function(t){"open-instant"!==t.toState&&"NoopAnimations"!==e._animationMode&&e._element.nativeElement.classList.add("mat-drawer-transition"),e.updateContentMargins(),e._changeDetectorRef.markForCheck()})),"side"!==t.mode&&t.openedChange.pipe(Object(Uo.a)(this._drawers.changes)).subscribe((function(){return e._setContainerClass(t.opened)}))}},{key:"_watchDrawerPosition",value:function(t){var e=this;t&&t.onPositionChanged.pipe(Object(Uo.a)(this._drawers.changes)).subscribe((function(){e._ngZone.onMicrotaskEmpty.asObservable().pipe(Object(jo.a)(1)).subscribe((function(){e._validateDrawers()}))}))}},{key:"_watchDrawerMode",value:function(t){var e=this;t&&t._modeChanged.pipe(Object(Uo.a)(Object(Fo.a)(this._drawers.changes,this._destroyed))).subscribe((function(){e.updateContentMargins(),e._changeDetectorRef.markForCheck()}))}},{key:"_setContainerClass",value:function(t){var e=this._element.nativeElement.classList,n="mat-drawer-container-has-open";t?e.add(n):e.remove(n)}},{key:"_validateDrawers",value:function(){var t=this;this._start=this._end=null,this._drawers.forEach((function(e){"end"==e.position?(null!=t._end&&Jo("end"),t._end=e):(null!=t._start&&Jo("start"),t._start=e)})),this._right=this._left=null,this._dir&&"rtl"===this._dir.value?(this._left=this._end,this._right=this._start):(this._left=this._start,this._right=this._end)}},{key:"_isPushed",value:function(){return this._isDrawerOpen(this._start)&&"over"!=this._start.mode||this._isDrawerOpen(this._end)&&"over"!=this._end.mode}},{key:"_onBackdropClicked",value:function(){this.backdropClick.emit(),this._closeModalDrawer()}},{key:"_closeModalDrawer",value:function(){var t=this;[this._start,this._end].filter((function(e){return e&&!e.disableClose&&t._canHaveBackdrop(e)})).forEach((function(t){return t.close()}))}},{key:"_isShowingBackdrop",value:function(){return this._isDrawerOpen(this._start)&&this._canHaveBackdrop(this._start)||this._isDrawerOpen(this._end)&&this._canHaveBackdrop(this._end)}},{key:"_canHaveBackdrop",value:function(t){return"side"!==t.mode||!!this._backdropOverride}},{key:"_isDrawerOpen",value:function(t){return null!=t&&t.opened}},{key:"start",get:function(){return this._start}},{key:"end",get:function(){return this._end}},{key:"autosize",get:function(){return this._autosize},set:function(t){this._autosize=Object(So.c)(t)}},{key:"hasBackdrop",get:function(){return null==this._backdropOverride?!this._start||"side"!==this._start.mode||!this._end||"side"!==this._end.mode:this._backdropOverride},set:function(t){this._backdropOverride=null==t?null:Object(So.c)(t)}},{key:"scrollable",get:function(){return this._userContent||this._content}}]),t}()).\u0275fac=function(t){return new(t||Wo)(b.Pb(Ro.c,8),b.Pb(b.l),b.Pb(b.A),b.Pb(b.h),b.Pb(Co.e),b.Pb(Zo),b.Pb(Vo.a,8))},Wo.\u0275cmp=b.Jb({type:Wo,selectors:[["mat-drawer-container"]],contentQueries:function(t,e,n){var i;1&t&&(b.Ib(n,Ko,!0),b.Ib(n,ta,!0)),2&t&&(b.sc(i=b.ec())&&(e._content=i.first),b.sc(i=b.ec())&&(e._allDrawers=i))},viewQuery:function(t,e){var n;1&t&&b.Nc(Ko,!0),2&t&&b.sc(n=b.ec())&&(e._userContent=n.first)},hostAttrs:[1,"mat-drawer-container"],hostVars:2,hostBindings:function(t,e){2&t&&b.Gb("mat-drawer-container-explicit-backdrop",e._backdropOverride)},inputs:{autosize:"autosize",hasBackdrop:"hasBackdrop"},outputs:{backdropClick:"backdropClick"},exportAs:["matDrawerContainer"],features:[b.Bb([{provide:Go,useExisting:Wo}])],ngContentSelectors:qo,decls:4,vars:2,consts:[["class","mat-drawer-backdrop",3,"mat-drawer-shown","click",4,"ngIf"],[4,"ngIf"],[1,"mat-drawer-backdrop",3,"click"]],template:function(t,e){1&t&&(b.lc(zo),b.Fc(0,Ho,1,2,"div",0),b.kc(1),b.kc(2,1),b.Fc(3,Bo,2,0,"mat-drawer-content",1)),2&t&&(b.mc("ngIf",e.hasBackdrop),b.Cb(3),b.mc("ngIf",!e._content))},directives:[c.t,Ko],styles:[".mat-drawer-container{position:relative;z-index:1;box-sizing:border-box;-webkit-overflow-scrolling:touch;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:background-color,visibility}.cdk-high-contrast-active .mat-drawer-backdrop{opacity:.5}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-transition .mat-drawer-content{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%, 0, 0)}.cdk-high-contrast-active .mat-drawer,.cdk-high-contrast-active [dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}.cdk-high-contrast-active [dir=rtl] .mat-drawer,.cdk-high-contrast-active .mat-drawer.mat-drawer-end{border-left:solid 1px currentColor;border-right:none}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer{transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer.mat-drawer-end{left:0;right:auto;transform:translate3d(-100%, 0, 0)}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.mat-sidenav-fixed{position:fixed}\n"],encapsulation:2,changeDetection:0}),Wo),na=(($o=function t(){r(this,t)}).\u0275mod=b.Nb({type:$o}),$o.\u0275inj=b.Mb({factory:function(t){return new(t||$o)},imports:[[c.c,Ir.i,ko.b,Co.b],Co.b,Ir.i]}),$o),ia=o("nts4"),ra=o("sOKj"),oa=o("SoR6");function aa(t,e){if(1&t){var n=b.Wb();b.Vb(0,"google-chart",1),b.dc("select",(function(t){return b.xc(n),b.hc().changeMin(t)})),b.Ub()}if(2&t){var i=b.hc();b.mc("dynamicResize",i.dynamicResize)("data",i.rocChart.data)("type",i.rocChart.type)("title",i.rocChart.title)("columns",i.rocChart.columns)("options",i.rocChart.options)}}var sa,ca=((sa=function(){function t(e){r(this,t),this.predictionsService=e,this.updateMin=new b.o,this.rocChart=null}return a(t,[{key:"ngOnInit",value:function(){}},{key:"ngOnChanges",value:function(t){t.chartData&&this.chartData&&this.graphChart()}},{key:"changeMin",value:function(t){1==t.selection[0].column&&this.updateMin.emit(this.rocChart.data[t.selection[0].row][2])}},{key:"graphChart",value:function(){var t=this.chartData.map((function(t){return[t.fpr,t.tpr,t.thresh,"FPR: ".concat(t.fpr,", TPR: ").concat(t.tpr,", TH: ").concat(t.thresh),t.fpr]}));this.rocChart={title:"ROC",type:oa.a.LineChart,data:t,columns:[{type:"number",id:"fpr",label:"fpr"},{type:"number",id:"tpr",label:"tpr"},{type:"number",id:"thresh",label:"thresh",role:"annotationText"},{type:"string",role:"tooltip",id:"tooltip",p:{html:!0}},{type:"number",id:"fpr",label:"fpr"}],colors:["#e0440e","#e6693e"],options:{hAxis:{title:"False Positive Rate"},vAxis:{title:"True Positive Rate "},width:398,legend:{position:"none"},tooltip:{isHtml:!0,ignoreBounds:!0}}}}}]),t}()).\u0275fac=function(t){return new(t||sa)(b.Pb(l.e))},sa.\u0275cmp=b.Jb({type:sa,selectors:[["mol-roc-chart"]],inputs:{id:"id",chartData:"chartData"},outputs:{updateMin:"updateMin"},features:[b.Ab],decls:1,vars:1,consts:[["class","gchart",3,"dynamicResize","data","type","title","columns","options","select",4,"ngIf"],[1,"gchart",3,"dynamicResize","data","type","title","columns","options","select"]],template:function(t,e){1&t&&b.Fc(0,aa,1,6,"google-chart",0),2&t&&b.mc("ngIf",e.rocChart)},directives:[c.t,oa.b],styles:["[_nghost-%COMP%]{width:398px}"]}),sa),ua=["mol-model-info"];function la(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mol-model-info",9),b.dc("showBackground",(function(t){return b.xc(n),b.hc().fetchPoints(t)}))("refreshPrediction",(function(t){return b.xc(n),b.hc().refreshMap(t)}))("modelChange",(function(t){return b.xc(n),b.hc().modelChange(t)}))("nextSpecies",(function(){return b.xc(n),b.hc().getNextSpecies()}))("previousSpecies",(function(){return b.xc(n),b.hc().getPreviousSpecies()}))("openMetadata",(function(t){return b.xc(n),b.hc().openMetadataDialog(t)}))("updateThreshold",(function(t){return b.xc(n),b.hc().updateThreshold(t)}))("PDF",(function(){return b.xc(n),b.hc().getPDF()})),b.Ub()}if(2&t){var i=b.hc();b.mc("id",i.id)("project_id",i.project_id)("info",i.info)("modelList",i.modelList)("predictionOptions",i.predictionOptions)("scientificname",i.scientificname)("minThreshold",i.predictionOptions.min)("maxThreshold",i.predictionOptions.max)("worksheetEmpty",i.worksheetEmpty)}}function fa(t,e){if(1&t){var n=b.Wb();b.Vb(0,"button",10),b.dc("click",(function(){b.xc(n);var t=b.hc();return t.showMetadata=!t.showMetadata})),b.Hc(1),b.ic(2,"translate"),b.Ub()}if(2&t){var i=b.hc();b.Cb(1),b.Jc(" ",i.showMetadata?"hide_metadata":b.jc(2,1,"show_metadata")," ")}}function ha(t,e){if(1&t){var n=b.Wb();b.Vb(0,"mol-roc-chart",11),b.dc("updateMin",(function(t){return b.xc(n),b.hc().updateMinFromROC(t)})),b.Ub()}if(2&t){var i=b.hc();b.mc("chartData",i.chartData)}}function da(t,e){1&t&&b.Qb(0,"mat-divider")}function pa(t,e){1&t&&b.Qb(0,"mat-divider")}var ba,ma,va,ga,_a=[{path:":scientificname",component:(ba=function(){function t(e,n,i,o,a,s,c,u,l){r(this,t),this.mapService=e,this.predictionsService=n,this.datasetService=i,this.route=o,this.router=a,this.auth=s,this.matDialog=c,this._snackBar=u,this.translate=l,this.id=null,this.scientificname=null,this.info=null,this.chartData=null,this.pdfLink=null,this.questions=f,this.requiredQuestions=h,this.taxa="",this.binary=!0,this.modelList=null,this.storedSpecies=[],this.nextSpecies="",this.previousModel="",this.worksheetEmpty=!1,this.showBackground=!1,this.showMetaData=!1,this.existingFeedback=[],this.project_id=null,this.showMetadata=!1,this.speciesIndex=0,this.taxaDatasets={amphibians:"83cfa8fb-dd6e-4031-8215-1079abddb8a7",ants:null,butterflies:"8f316f82-7356-44ee-823d-8f830f241fab",mammals:"ec694c34-bddd-4111-ba99-926a5f7866e8",odonates:"5b1bb9d6-1bf9-4d3b-aec6-3cfbc96d88f7",reptiles:"f00b03ed-8345-4497-b194-3fced6ee155c",trees:"f7b134d9-d2ce-43b2-8f2d-7e6441d7c747"},this.alternativeAnswers={},this.query={scientificname:"",status:"",taxa:""},this.modelFilters={version:"",auc:{value:0,highValue:1},evaluated_by_me:0,evaluated_by_others:0}}return a(t,[{key:"ngOnInit",value:function(){var t=this;this.scientificname=this.route.snapshot.paramMap.get("scientificname").replace("_"," "),this.route.queryParams.subscribe((function(e){t.id=e.prediction_id,t.project_id=e.project_id,t.init()}));var e=this.route.snapshot.queryParamMap;this.project_id=e.get("project_id"),this.query.scientificname=e.get("scientificname")||"",this.query.status=e.get("status")||"",this.query.taxa=e.get("taxa")||"",this.modelFilters.version=e.get("version")||"",this.modelFilters.auc.value=Number(e.get("aucMin"))||0,this.modelFilters.auc.highValue=Number(e.get("aucMax"))||1,this.predictionsService.predictionsRequested||this.predictionsService.predictions("A",this.project_id,this.query,this.modelFilters),this.auth.currentUser.subscribe((function(e){t.role=e.role}));var n=JSON.parse(localStorage.getItem("Species")||"{}"),i=JSON.parse(localStorage.getItem("EvaluatedSpecies")||"{}");n.length>0&&i.length>0&&i.forEach((function(t){n.splice(n.indexOf(t.replace("_"," ")),1)}))}},{key:"init",value:function(){var t=this;this.predictionsService.speciesDetailed(this.scientificname,this.id).pipe(Object(_o.a)(1)).subscribe((function(e){t.info=e.predictions.find(t.id?function(e){return e.prediction_id===t.id}:function(t){return 1===t.model_rank}),t.info||(t.info=e.predictions[0]),t.id||(t.id=t.info.prediction_id),t.pdfLink=e.pdf,t.modelList=e.predictions,t.chartData=e.roc;var n=t.taxaDatasets[t.info.taxa];if(n){var i=t.scientificname.split(" ").slice(0,2).join(" ");t.mapService.updateTileParams({url:"https://next-tiles.mol.org/0.x/tiles/species/detailed/3857/{z}/{x}/{y}.mvt?scientificname=".concat(i,"&dsids=").concat(n),index:0})}t.mapService.updateTileParams({url:e.range_map.url,index:1}),t.mapService.updateGeoJsonFeatures(e.points),t.updateBounds(e.points),t.predictionOptions={max:4*t.info.sps_threshold,min:t.info.sps_threshold,binary:t.binary},t.refreshMap(t.predictionOptions),t.taxa=t.info.taxa,t.links=[{name:"Prediction Table",route:"/predictions/taxa/"+t.taxa,data:Object.assign({prediction_id:null,project_id:t.project_id},t.route.snapshot.queryParams)}],t.getNonSpatialFeedback()}))}},{key:"updateThreshold",value:function(t){this.alternativeAnswers={alternative_threshold:t}}},{key:"updateBounds",value:function(t){var e=t.features.filter((function(t){return"Occurrence"===t.properties.what}))[0],n=(e=e.geometry.coordinates).map((function(t){return t[1]})),i=e.map((function(t){return t[0]})),r=Math.min.apply(Math,s(n)),o=Math.min.apply(Math,s(i)),a=Math.max.apply(Math,s(n)),c=Math.max.apply(Math,s(i));this.mapService.zoomToDatasetExtent({buffer:100,northEast:{lat:a,lng:c},southWest:{lat:r,lng:o}})}},{key:"fetchPoints",value:function(t){var e=this;this.showBackground=t,this.predictionsService.fetchPoints(this.id,this.showBackground).subscribe((function(t){e.mapService.updateGeoJsonFeatures(t),e.updateBounds(t)}))}},{key:"refreshMap",value:function(t){var e=this;this.binary=t.binary,this.predictionOptions=Object.assign({},t),this.predictionsService.fetchMap(this.id,t).pipe(Object(yo.a)(500)).subscribe((function(t){e.mapService.updateTileParams({url:t.url,index:2})}))}},{key:"modelChange",value:function(t){var e=this;this.id=t,this.predictionsService.fetchMap(this.id,void 0).subscribe((function(t){e.mapService.updateTileParams({url:t.url,index:2})})),this.predictionsService.fetchROC(this.id).subscribe((function(t){e.chartData=t.roc})),this.info=this.modelList.find((function(t){return t.prediction_id===e.id})),this.router.navigate([],{relativeTo:this.route,queryParams:{prediction_id:this.id},queryParamsHandling:"merge"})}},{key:"updateMinFromROC",value:function(t){this.refreshMap({binary:this.predictionOptions.binary,min:t,max:this.predictionOptions.max})}},{key:"updateMinMaxThreshold",value:function(t){console.log("update min max",t),this.refreshMap({binary:this.predictionOptions.binary,min:t.min,max:t.max})}},{key:"openMetadataDialog",value:function(t){var e=this;if("rangemap"===t){var n=this.taxaDatasets[this.info.taxa];n&&this.datasetService.metadata(n).subscribe((function(t){e.matDialog.open(wo.d,{data:{info:t.metadata,dataset_id:n,heading:"Expert range map for "+e.info.taxa}})}))}else this.matDialog.open(S,{height:"80%",width:"800px",data:{info:Object.assign(Object.assign({},this.info),this.info.modelinfo)}})}},{key:"getNextSpecies",value:function(){this.speciesIndex+=1,this.getSpecies()}},{key:"getSpecies",value:function(){var t=this.predictionsService.getSpeciesAtIndex(this.speciesIndex);this.scientificname=t.scientificname.split(" ").join("_"),this.id=t.prediction_id,this.router.navigate(["/predictions/species/",this.scientificname],{queryParams:Object.assign(Object.assign({prediction_id:this.id,project_id:this.project_id},this.query),this.modelFilters),relativeTo:this.route})}},{key:"getPreviousSpecies",value:function(){this.speciesIndex>0&&(this.speciesIndex-=1),this.getSpecies()}},{key:"speciesEvaluated",value:function(){var t=[],e=[],n=[],i=this.id;Object.keys(localStorage),null!==localStorage.getItem("Evaluated")?-1===(t=JSON.parse(localStorage.getItem("Evaluated")||"{}")).indexOf(i)&&t.push(i):t.push(i),null!==localStorage.getItem("EvaluatedSpecies")?-1===(e=JSON.parse(localStorage.getItem("EvaluatedSpecies"))).indexOf(this.scientificname)&&e.push(this.scientificname):e.push(this.scientificname),localStorage.setItem("EvaluatedSpecies",JSON.stringify(e)),(n=JSON.parse(localStorage.getItem("Species")||"{}")).length>0&&e.forEach((function(t){n.splice(n.indexOf(t.replace("_"," ")),1)})),localStorage.setItem("Evaluated",JSON.stringify(t))}},{key:"feedbackSubmitted",value:function(t){var e=this;this.auth.currentUser.pipe(Object(vo.switchMap)((function(n){return e.predictionsService.submitNonSpatialFeedback(n.id,e.id,t)})),Object(go.catchError)((function(t){return Object(mo.a)(t)}))).subscribe((function(t){e.openSnackBar(t.message,"Close"),e.speciesEvaluated()}),(function(t){e.openSnackBar(t,"Close")})),JSON.parse(localStorage.getItem("Species")||"{}")}},{key:"getNonSpatialFeedback",value:function(){var t=this;this.predictionsService.getNonSpatialFeedback(this.id).subscribe((function(e){e.forEach((function(t){var e=t.detailed.prediction_overall_rating,n=f[0].questions[0].options.findIndex((function(t){return t.value==e})),i=f[0].questions[0].options[n];t.detailed.prediction_overall_rating=void 0!==i?i.display:t.detailed.prediction_overall_rating,t.feedback_id=t.feedback_id,t.created_at=t.created_at.slice(0,16);var r=f[0].questions[2].options,o=[];t.detailed.prediction_issues_present&&(t.detailed.prediction_issues_present.forEach((function(t){var e=r.findIndex((function(e){return e.value==t}));o.push(r[e].display)})),t.detailed.prediction_issues_present=o.toString().replace(",",", "));var a=f[1].questions[0].options,s=[];t.detailed.points_issues_present&&(t.detailed.points_issues_present.forEach((function(t){var e=a.findIndex((function(e){return e.value==t}));s.push(a[e].display)})),t.detailed.points_issues_present=s.toString().replace(",",", "));var c=f[2].questions[0].options,u=[];t.detailed.range_issues_present&&(t.detailed.range_issues_present.forEach((function(t){var e=c.findIndex((function(e){return e.value==t}));u.push(c[e].display)})),t.detailed.range_issues_present=u.toString().replace(",",", "))})),t.existingFeedback=e}))}},{key:"handleFeedbackError",value:function(t){this.openSnackBar("Please fill out the required questions","Close"),console.error("feedback error: ",t)}},{key:"openSnackBar",value:function(t,e){this._snackBar.open(t,e)}},{key:"getPDF",value:function(){window.open(this.pdfLink,"_blank")}},{key:"ngOnDestroy",value:function(){this.mapService.updateTileParams({url:"OFF",index:0}),this.mapService.updateTileParams({url:"OFF",index:1}),this.mapService.updateTileParams({url:"OFF",index:2}),this.mapService.updateGeoJsonFeatures({type:"FeatureCollection",features:[]})}}]),t}(),ba.\u0275fac=function(t){return new(t||ba)(b.Pb(l.d),b.Pb(l.e),b.Pb(l.c),b.Pb(u.a),b.Pb(u.f),b.Pb(l.b),b.Pb(p.b),b.Pb(Lr.a),b.Pb(l.j))},ba.\u0275cmp=b.Jb({type:ba,selectors:[["mol-predictions-root"]],viewQuery:function(t,e){var n;1&t&&b.Nc(ua,!0),2&t&&b.sc(n=b.ec())&&(e.modelInfo=n.first)},decls:11,vars:6,consts:[[3,"links"],[1,"predictions-container"],["mode","side","opened","",1,"drawer"],[3,"id","project_id","info","modelList","predictionOptions","scientificname","minThreshold","maxThreshold","worksheetEmpty","showBackground","refreshPrediction","modelChange","nextSpecies","previousSpecies","openMetadata","updateThreshold","PDF",4,"ngIf"],["class","metadata-button","mat-raised-button","",3,"click",4,"ngIf"],[3,"chartData","updateMin",4,"ngIf"],[4,"ngIf"],[1,"map-container"],["mode","experts"],[3,"id","project_id","info","modelList","predictionOptions","scientificname","minThreshold","maxThreshold","worksheetEmpty","showBackground","refreshPrediction","modelChange","nextSpecies","previousSpecies","openMetadata","updateThreshold","PDF"],["mat-raised-button","",1,"metadata-button",3,"click"],[3,"chartData","updateMin"]],template:function(t,e){1&t&&(b.Qb(0,"mol-nav",0),b.Vb(1,"mat-drawer-container",1),b.Vb(2,"mat-drawer",2),b.Fc(3,la,1,9,"mol-model-info",3),b.Fc(4,fa,3,3,"button",4),b.Fc(5,ha,1,1,"mol-roc-chart",5),b.Fc(6,da,1,0,"mat-divider",6),b.Fc(7,pa,1,0,"mat-divider",6),b.Ub(),b.Vb(8,"mat-drawer-content",7),b.Qb(9,"mol-spinner"),b.Qb(10,"mol-map",8),b.Ub(),b.Ub()),2&t&&(b.mc("links",e.links),b.Cb(3),b.mc("ngIf",e.info),b.Cb(1),b.mc("ngIf",e.info),b.Cb(1),b.mc("ngIf",e.info&&e.showMetadata),b.Cb(1),b.mc("ngIf",e.info),b.Cb(1),b.mc("ngIf",e.info))},directives:[xo.a,ea,ta,c.t,Ko,ia.a,ra.a,bo,jr.b,ca,Dr.a],pipes:[qr.c],styles:[".predictions-container[_ngcontent-%COMP%]{height:calc(100vh - 52px - 85px)}mat-drawer-container[_ngcontent-%COMP%]{box-shadow:3px 0 2px -2px #aaa}.drawer[_ngcontent-%COMP%], mat-drawer-container[_ngcontent-%COMP%]{overflow-x:hidden;overflow-y:auto}.drawer[_ngcontent-%COMP%]{width:400px;min-height:100%} .mat-drawer-inner-container{overflow-x:hidden!important}.card-title[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.metadata-button[_ngcontent-%COMP%]{margin:5px 0 5px 5px}"]}),ba)}],ya=((ma=function t(){r(this,t)}).\u0275mod=b.Nb({type:ma}),ma.\u0275inj=b.Mb({factory:function(t){return new(t||ma)},imports:[[c.c,u.j.forChild(_a)],u.j]}),ma),wa=o("M0ag"),xa=o("+Tre"),ka=o("nKqi"),Ca=((ga=function t(){r(this,t)}).\u0275mod=b.Nb({type:ga}),ga.\u0275inj=b.Mb({factory:function(t){return new(t||ga)},imports:[[c.c,wa.a,wo.c,Pr.d,Dr.b,na,Nr.b,Rr.b,wo.b,jr.c,Mr.b,O.l,O.B,Dr.b,Er.c,xa.b,oa.c,Tr.b,wo.f,wo.e,p.f,Ur.b,wo.a,Ar.d,ka.b,qr.b]]}),ga),Sa=((va=function t(){r(this,t)}).\u0275mod=b.Nb({type:va}),va.\u0275inj=b.Mb({factory:function(t){return new(t||va)},imports:[[ya,Ca]]}),va)},QuXn:function(t,e,n){"use strict";var i=!1;e.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){var e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else i&&console.log("RxJS: Back to a better error behavior. Thank you. <3");i=t},get useDeprecatedSynchronousErrorHandling(){return i}}},R4cV:function(t,e,n){"use strict";var i=n("qiMw"),r=n("ihxi"),o=n("4mxr");e.from=function(t,e){return e?o.scheduled(t,e):t instanceof i.Observable?t:new i.Observable(r.subscribeTo(t))}},RKpm:function(t,e,n){"use strict";e.identity=function(t){return t}},SSAN:function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=n("dmvN"),a=n("d4zx"),s=n("kZSD");e.catchError=function(t){return function(e){var n=new c(t),i=e.lift(n);return n.caught=i}};var c=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.selector,this.caught))},t}(),u=function(t){function e(e,n,i){var r=t.call(this,e)||this;return r.selector=n,r.caught=i,r}return r(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=void 0;try{n=this.selector(e,this.caught)}catch(o){return void t.prototype.error.call(this,o)}this._unsubscribeAndRecycle();var i=new a.InnerSubscriber(this,void 0,void 0);this.add(i);var r=s.subscribeToResult(this,n,void 0,void 0,i);r!==i&&this.add(r)}},e}(o.OuterSubscriber)},VTS6:function(t,e,n){"use strict";e.isArrayLike=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t}},Yfti:function(t,e,n){"use strict";var i=n("1hPV"),r=n("7oWP"),o=n("uzuk");e.toSubscriber=function(t,e,n){if(t){if(t instanceof i.Subscriber)return t;if(t[r.rxSubscriber])return t[r.rxSubscriber]()}return t||e||n?new i.Subscriber(t,e,n):new i.Subscriber(o.empty)}},ZGdk:function(t,e,n){"use strict";e.UnsubscriptionError=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}()},a96P:function(t,e,n){"use strict";e.isObject=function(t){return null!==t&&"object"==typeof t}},d0I2:function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=n("1hPV");e.map=function(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new a(t,e))}};var a=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new s(t,this.project,this.thisArg))},t}();e.MapOperator=a;var s=function(t){function e(e,n,i){var r=t.call(this,e)||this;return r.project=n,r.count=0,r.thisArg=i||r,r}return r(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(n){return void this.destination.error(n)}this.destination.next(e)},e}(o.Subscriber)},d4zx:function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.InnerSubscriber=function(t){function e(e,n,i){var r=t.call(this)||this;return r.parent=e,r.outerValue=n,r.outerIndex=i,r.index=0,r}return r(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(n("1hPV").Subscriber)},dmvN:function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.OuterSubscriber=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.notifyNext=function(t,e,n,i,r){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(n("1hPV").Subscriber)},i6J5:function(t,e,n){"use strict";var i=n("qiMw"),r=n("6Br6"),o=n("7bXj");e.scheduleIterable=function(t,e){if(!t)throw new Error("Iterable cannot be null");return new i.Observable((function(n){var i,a=new r.Subscription;return a.add((function(){i&&"function"==typeof i.return&&i.return()})),a.add(e.schedule((function(){i=t[o.iterator](),a.add(e.schedule((function(){if(!n.closed){var t,e;try{var r=i.next();t=r.value,e=r.done}catch(o){return void n.error(o)}e?n.complete():(n.next(t),this.schedule())}})))}))),a}))}},i84P:function(t,e,n){"use strict";var i=n("qiMw"),r=n("6Br6");e.schedulePromise=function(t,e){return new i.Observable((function(n){var i=new r.Subscription;return i.add(e.schedule((function(){return t.then((function(t){i.add(e.schedule((function(){n.next(t),i.add(e.schedule((function(){return n.complete()})))})))}),(function(t){i.add(e.schedule((function(){return n.error(t)})))}))}))),i}))}},ihxi:function(t,e,n){"use strict";var i=n("sBpz"),r=n("lTUY"),o=n("GB03"),a=n("Lbxd"),s=n("VTS6"),c=n("xKJD"),u=n("a96P"),l=n("7bXj"),f=n("k/06");e.subscribeTo=function(t){if(t&&"function"==typeof t[f.observable])return a.subscribeToObservable(t);if(s.isArrayLike(t))return i.subscribeToArray(t);if(c.isPromise(t))return r.subscribeToPromise(t);if(t&&"function"==typeof t[l.iterator])return o.subscribeToIterable(t);var e=u.isObject(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+e+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},"k/06":function(t,e,n){"use strict";e.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},kZSD:function(t,e,n){"use strict";var i=n("d4zx"),r=n("ihxi"),o=n("qiMw");e.subscribeToResult=function(t,e,n,a,s){if(void 0===s&&(s=new i.InnerSubscriber(t,n,a)),!s.closed)return e instanceof o.Observable?e.subscribe(s):r.subscribeTo(e)(s)}},lTUY:function(t,e,n){"use strict";var i=n("tpAt");e.subscribeToPromise=function(t){return function(e){return t.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,i.hostReportError),e}}},qiMw:function(t,e,n){"use strict";var i=n("JJ8B"),r=n("Yfti"),o=n("k/06"),a=n("E/Xc"),s=n("QuXn");function c(t){if(t||(t=s.config.Promise||Promise),!t)throw new Error("no Promise impl found");return t}e.Observable=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var i=this.operator,o=r.toSubscriber(t,e,n);if(o.add(i?i.call(o,this.source):this.source||s.config.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),s.config.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){s.config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),i.canReportError(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=c(e))((function(e,i){var r;r=n.subscribe((function(e){try{t(e)}catch(n){i(n),r&&r.unsubscribe()}}),i,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[o.observable]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e - + \ No newline at end of file diff --git a/runtime-es2015.b7d0c393509d8107f3e0.js b/runtime-es2015.1e15dade2a1bbca06cc1.js similarity index 90% rename from runtime-es2015.b7d0c393509d8107f3e0.js rename to runtime-es2015.1e15dade2a1bbca06cc1.js index 124fff3..d9c78a1 100644 --- a/runtime-es2015.b7d0c393509d8107f3e0.js +++ b/runtime-es2015.1e15dade2a1bbca06cc1.js @@ -1 +1 @@ -!function(e){function r(r){for(var n,c,u=r[0],f=r[1],i=r[2],p=0,s=[];p