From 393179f86d06d3057776ba3475e4bcde077b7590 Mon Sep 17 00:00:00 2001
From: Lauri Himanen <lauri.himanen@gmail.com>
Date: Thu, 23 Jun 2022 11:04:43 +0300
Subject: [PATCH] Fixed issues with viewers.

---
 client/bundle.js                       |  2 +-
 client/src/material-mod/MaterialMod.js | 31 +++++---------------------
 2 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/client/bundle.js b/client/bundle.js
index f55bd364..907d98fe 100644
--- a/client/bundle.js
+++ b/client/bundle.js
@@ -1 +1 @@
-(()=>{var e={462:(e,t,s)=>{"use strict";let i=s(212),n=s(719),a=document.querySelector("#flagging-form-popup-bg"),l=document.querySelector("#flagging-form-popup");l.innerHTML='\n\n<div> <img src="img/cross.svg"  height="12px"\n  style="float: right; cursor: pointer" />\n</div>\n\n<div class="form-wrapper">\n  <div class="popup-title"> Error reporting</div>\n  <br>\n  <div> Material: <span id="error-material-id"></span></div>\n  <select id="flagging-category" name="category">\n    <option value="">Select a category *</option>\n    <option value="structure">Structure</option>\n    <option value="electronicstruct">Electronic structure</option>\n    <option value="methodology">Methodology</option>\n    <option value="thermalprops">Thermal properties</option>\n  </select>\n\n  <select id="flagging-subcategory" name="subcategory">\n\n  </select>\n\n  <textarea id="subject" name="subject" style="height:200px"\n  placeholder="Write a short explanation about the error" ></textarea>\n\n  <div id="form-validation-msg"> </div>\n\n  <div style="display: flex; justify-content: space-evenly;">\n    <button style="display: block">Send</button>\n  </div>\n\n\n</div>\n';let r=l.querySelector("#flagging-category"),o=r.querySelector('option[value="electronicstruct"]'),d=r.querySelector('option[value="thermalprops"]'),h=l.querySelector("#flagging-subcategory"),c=l.querySelector("img"),u=l.querySelector("#form-validation-msg"),p=l.querySelector("button"),m=l.querySelector("#error-material-id"),y=null;function v(){a.style.visibility="hidden",l.style.visibility="hidden",r.selectedIndex=0,h.selectedIndex=0,l.querySelector("textarea").value="",u.innerHTML=""}function g(e,t){let s=document.createElement("option");return s.value=void 0===t?e:t,s.innerHTML=e,s}c.addEventListener("click",(e=>{v()})),p.addEventListener("click",(e=>{let t=r.options[r.selectedIndex];var s=window.keycloak;if(!s.authenticated)return void(u.innerHTML="Your authentication has expired. Please login again.");if(!r.disabled&&""===t.value)return void(u.innerHTML="The category fields must be set");if(r.disabled&&""===h.value&&t.value!==i.MAT_VIEW.methodology)return void(u.innerHTML="The subcategory fields must be set");u.innerHTML="Sending report...";let a=l.querySelector("textarea").value,o=n.getMaterialData().material_id;s.loadUserProfile().then((function(e){let s={};s.server=i.getServerLocation(),s.username=e.username,s.email=e.email,s.first_name=e.firstName,s.last_name=e.lastName,s.message=a,s.category=t.text,r.disabled?s.subcategory=h.options[h.selectedIndex].text:s.representatives=n.getRepresentatives(),i.serverReqPOST(i.getReportURL(o),JSON.stringify(s),(e=>{204===e.target.status?v():u.innerHTML="Could not connect to the service. Please check your connection and try again later."}))})).catch((e=>{console.log(e),u.innerHTML="Could not connect to the service. Please check your connection and try again later."}))})),e.exports={show:function(e){y=e.eStructCalcs,o.style.display=n.hasElecStructureData()?"block":"none",d.style.display=n.hasThermalData()?"block":"none",function(e){h.innerHTML="";let t=n.getMaterialData().material_id;if(m.textContent=t,null===e)r.disabled=!1,h.style.display="none";else switch(r.disabled=!0,h.style.display="block",h.appendChild(g("Choose the subcategory *","")),e){case i.MAT_VIEW.structure:r.selectedIndex=1,h.appendChild(g("Structure representation")),h.appendChild(g("Calculation tree")),h.appendChild(g("Summary")),h.appendChild(g("Specific calculation"));break;case i.MAT_VIEW.electronicstruct:r.selectedIndex=2,h.appendChild(g("Calculation tree")),h.appendChild(g("Summary")),h.appendChild(g("Band structure")),h.appendChild(g("DOS")),h.appendChild(g("Brillouin zone"));break;case i.MAT_VIEW.methodology:r.selectedIndex=3,h.style.display="none";break;case i.MAT_VIEW.thermalprops:r.selectedIndex=4,h.appendChild(g("Calculation tree")),h.appendChild(g("Phonon dispersion")),h.appendChild(g("Phonon DOS")),h.appendChild(g("Specific heat")),h.appendChild(g("Helmholtz free energy"))}}(e.pageId);let t=l.getBoundingClientRect(),s=(window.innerWidth-t.width)/2,c=(window.innerHeight-t.height)/2;l.style.left=s+"px",l.style.top=c-20+"px",l.style.visibility="visible",a.style.visibility="visible"},hide:v}},223:(e,t,s)=>{"use strict";let i=s(212),n=s(951),a=document.querySelector("#info-tooltip"),l=document.querySelector("#tooltip-content"),r=[],o=null,d=!1,h=null;function c(){null!==o&&window.clearTimeout(o),o=window.setTimeout((e=>a.style.display="none"),1e3)}let u=new n(i.IMAGE_DIR+"switch");function p(e){e.addEventListener("mouseover",m),e.addEventListener("mouseout",(t=>{c(),e.style.cursor="inherit"})),e.className="info-sys-label"}function m(e){let t=e.target.getBoundingClientRect(),s=e.target.getAttribute("info-sys-data"),i=s.indexOf(".value");if(i>0){let e=h[s.split("-").join(" ").substring(0,i)];if(void 0===e.value_template){let t=e.values[s.split(":")[1]];l.innerHTML=v(t)}else{let t=e.value_template;t.text=y(t.text,s.split(":")[1]),t.link=y(t.link,s.split(":")[1]),l.innerHTML=v(t)}}else l.innerHTML=v(h[s.split("-").join(" ")]);a.style.visibility="hidden",a.style.display="block";let n=a.getBoundingClientRect(),r=n.width-t.width,d=t.left-r/2;d+n.width>window.innerWidth&&(d=window.innerWidth-n.width);let c=-window.pageYOffset;a.style.left=(d<0?5:d)+"px",a.style.top=t.top+t.height-c+"px",a.style.visibility="visible",window.clearTimeout(o),e.target.style.cursor="help"}function y(e,t){let s=e.indexOf("${"),i=e.indexOf("}");return s>=0&&i>=0&&i>s?e.substring(0,s)+t+e.substring(i+1):e}function v(e){let t="";return void 0===e.text||(t+=e.text),void 0!==e.link&&(void 0!==e.text&&(t+="<br>"),t+='<a href="'+e.link+'" target="_blank">More information</a>'),t}document.querySelector("#info-sys-switch-box").appendChild(u.element),u.setListener((e=>{d=!e,e?r.forEach((e=>{e.removeEventListener("mouseover",m),e.className=""})):(null===h&&i.serverReq("infosys.json",(e=>h=JSON.parse(e.target.response))),r.forEach(p)),a.addEventListener("mouseover",(e=>{window.clearTimeout(o)})),a.addEventListener("mouseout",(e=>{c()}))})),e.exports={addToInfoSystem:function(e){let t=e.querySelectorAll("span[info-sys-data]");for(let e=0;e<t.length;++e)r.push(t[e]);if(d)for(let e=0;e<t.length;++e)p(t[e])},addElementToInfoSystem:function(e,t){r.push(e),e.setAttribute("info-sys-data",t),d&&p(e)}}},971:(e,t,s)=>{"use strict";let i=s(584);const n="http://www.w3.org/2000/svg";e.exports=class{constructor(e={left:20,right:0,top:0,bottom:20}){this.margins=e,this.svg=document.createElementNS(n,"svg"),this.parentElement=null,this.plotContent=null,this.axisGroup=null,this.yAxisLabelsGroup=null,this.yLabelText=null,this.noDataGroup=null,this.yZoom=1,this.yOffset=0,this.repaintListener=null,this.nodataLabel=null,this.outOfRangeColorActivated=!0}attach(e,t,s){this.parentElement=e,this.parentElement.appendChild(this.svg),this.width=void 0!==t?t:this.parentElement.clientWidth,this.height=void 0!==s?s:this.svg.width,this.svg.setAttribute("width",this.width),this.svg.setAttribute("height",this.height),this.plotRangeX=this.width-this.margins.left-this.margins.right,this.plotRangeY=this.height-this.margins.top-this.margins.bottom,this.yAxisArea=document.createElementNS(n,"svg"),this.svg.appendChild(this.yAxisArea);let a=this.margins.left;this.plotAreaHeight=this.height-this.margins.bottom-this.margins.top,this.yAxisArea.setAttribute("width",a),this.yAxisArea.setAttribute("height",this.plotAreaHeight),this.yAxisArea.setAttribute("x",0),this.yAxisArea.setAttribute("y",0),this.plotArea=document.createElementNS(n,"svg"),this.svg.appendChild(this.plotArea),this.plotAreaWidth=this.width-this.margins.left-this.margins.right,this.plotArea.setAttribute("width",this.plotAreaWidth),this.plotArea.setAttribute("height",this.plotAreaHeight),this.plotArea.setAttribute("x",this.margins.left),this.plotArea.setAttribute("y",this.margins.top),this.plotAreaBg=i.addRect(this.plotArea,0,0,this.plotAreaWidth,this.plotAreaHeight),this.plotAreaBg.setAttribute("class","moveable-plot"),this.plotAreaBg.setAttribute("opacity",0),this._events()}isAttached(){return null!==this.parentElement}setAxisRangeAndLabels(e,t,s,n,a,l,r,o,d,h=2){this.xLabel=e,this.xMin=t,this.xMax=s,this.yMinInit=a,this.yMaxInit=l,this.yMin=r,this.yMax=o,this.yLabelGapInit=d,this.xRel=this.plotRangeX/(this.xMax-this.xMin),this.yRel=this.plotRangeY/(this.yMaxInit-this.yMinInit),this._resetAxisGroup(),i.addLine(this.axisGroup,0,0,this.plotRangeX,0,"main-axis"),i.addLine(this.axisGroup,0,0,0,-this.plotRangeY,"main-axis"),i.addLine(this.axisGroup,this.plotRangeX,0,this.plotRangeX,-this.plotRangeY,"main-axis"),i.addLine(this.axisGroup,0,-this.plotRangeY,this.plotRangeX,-this.plotRangeY,"main-axis"),null!==n&&(this.yLabelText=i.addText(this.svg,0,0,n,"middle","axis-steps-big"),this.yLabelText.setAttribute("transform","translate(15,"+(this.plotRangeY/2+this.margins.top)+") rotate(-90)")),null!==e&&i.addText(this.axisGroup,this.plotRangeX/2,this.margins.bottom-12,this.xLabel,"middle","axis-steps-big"),this._resetYAxisLabelGroup(),this.precalculation_1=this.plotAreaHeight+this.yMinInit*this.yRel,this.precalculation_2=this.precalculation_1}_events(){let e;this.plotArea.addEventListener("wheel",(e=>{e.preventDefault(),e.deltaY>0&&this.yZoom>.5?this.yZoom-=.2:e.deltaY<0&&this.yZoom<2&&(this.yZoom+=.2),this.repaint(),null!==this.repaintListener&&this.repaintListener(this.yZoom,this.yOffset)})),this.plotArea.addEventListener("mousedown",(t=>{t.preventDefault(),e=t.clientY+this.yOffset,this.plotArea.addEventListener("mousemove",s),this.plotArea.addEventListener("mouseup",(e=>{this.plotArea.removeEventListener("mousemove",s)})),this.plotArea.addEventListener("mouseout",(e=>{this.plotArea.removeEventListener("mousemove",s)}))}));let t=this;function s(s){t.yOffset=e-s.clientY,t.precalculation_2=t.precalculation_1-t.yOffset,t.repaint(),null!==t.repaintListener&&t.repaintListener(t.yZoom,t.yOffset)}}setYZoomAndOffset(e,t){this.yZoom=e,this.yOffset=t,this.precalculation_2=this.precalculation_1-this.yOffset}setExternalYAxisMax(e){this.externalYAxisMax=e}getYAxisMax(){return this.yAxisMax}repaint(){let e;this._resetYAxisLabelGroup(),e=this.yZoom>1?this.yLabelGapInit/5:this.yLabelGapInit;let t=Math.floor(this.yMin/e)*e,s=Math.ceil(this.yMax/e)*e;if(this.yAxisMax=s,void 0!==this.externalYAxisMax&&(s=this.externalYAxisMax),null!==this.yLabelText)for(let n=t;n<s+1;n+=e)i.addLine(this.yAxisLabelsGroup,this.margins.left,this.transformY(n),this.margins.left-3,this.transformY(n)),i.addText(this.yAxisLabelsGroup,this.margins.left-5,this.transformY(n)+5,n,"end","axis-steps");this._resetPlotContent(),this.outOfRangeColorActivated&&(i.addRect(this.plotContent,0,this.transformY(this.yMax)-2*this.plotAreaHeight,this.plotAreaWidth,2*this.plotAreaHeight).setAttribute("class","out-of-range"),i.addRect(this.plotContent,0,this.transformY(this.yMin),this.plotAreaWidth,2*this.plotAreaHeight).setAttribute("class","out-of-range")),i.addLine(this.plotContent,0,this.transformY(0),this.plotRangeX,this.transformY(0),"zeroline"),this.repaintData(t,s),this.plotArea.removeChild(this.plotAreaBg),this.plotArea.appendChild(this.plotAreaBg)}setRepaintListener(e){this.repaintListener=e}transformY(e){return-e*this.yZoom*this.yRel+this.precalculation_2}_resetPlotContent(){null!==this.plotContent&&this.plotArea.removeChild(this.plotContent),this.plotContent=document.createElementNS(n,"g"),this.plotArea.appendChild(this.plotContent)}_resetAxisGroup(){null!==this.axisGroup&&this.svg.removeChild(this.axisGroup),this.axisGroup=document.createElementNS(n,"g"),this.svg.appendChild(this.axisGroup),this.axisGroup.setAttribute("transform","matrix(1 0 0 1 "+this.margins.left+" "+(this.height-this.margins.bottom)+")")}_resetYAxisLabelGroup(){null!==this.yLabelText&&(null!==this.yAxisLabelsGroup&&this.yAxisArea.removeChild(this.yAxisLabelsGroup),this.yAxisLabelsGroup=document.createElementNS(n,"g"),this.yAxisArea.appendChild(this.yAxisLabelsGroup))}_reset(){this.yZoom=1,this.yOffset=0,this._resetPlotContent(),null!==this.yLabelText&&(this.svg.removeChild(this.yLabelText),this.yLabelText=null),null!==this.noDataGroup&&(this.svg.removeChild(this.noDataGroup),this.noDataGroup=null)}setNoData(){this._resetYAxisLabelGroup(),this._resetPlotContent(),this._resetAxisGroup(),null===this.noDataGroup&&(this.noDataGroup=document.createElementNS(n,"g"),this.svg.appendChild(this.noDataGroup),i.addRect(this.noDataGroup,0,0,this.width,this.height),this.noDataGroup.setAttribute("fill","#EEE"),i.addText(this.noDataGroup,this.width/2,this.height/2+10,"NO DATA","middle","nodata"))}}},317:(e,t,s)=>{"use strict";s(212);let i=document.querySelector("#loading-popup"),n=new Set;e.exports={show:function(e){n.add(e,!0);let t=i.getBoundingClientRect(),s=(window.innerWidth-t.width)/2,a=(window.innerHeight-t.height)/2;i.style.left=s+"px",i.style.top=a-100+"px",i.style.visibility="visible"},hide:function(e){n.delete(e),0===n.size&&(i.style.visibility="hidden")},reset:function(){n=new Set,i.style.visibility="hidden"}}},666:(e,t,s)=>{"use strict";let i=s(584);const n="http://www.w3.org/2000/svg";e.exports=class{constructor(e={left:20,right:0,top:10,bottom:20}){this.svg=document.createElementNS(n,"svg"),this.plotArea=document.createElementNS(n,"g"),this.svg.appendChild(this.plotArea),this.margins=e,this.parentElement=null,this.yLabelText=null,this.noDataGroup=null}attach(e,t,s){this.parentElement=e,this.parentElement.appendChild(this.svg),this.width=void 0!==t?t:this.parentElement.clientWidth,this.height=void 0!==s?s:this.svg.width,this.svg.setAttribute("width",this.width),this.svg.setAttribute("height",this.height),this.plotRangeX=this.width-this.margins.left-this.margins.right,this.plotRangeY=this.height-this.margins.top-this.margins.bottom}isAttached(){return null!==this.parentElement}setRangeAndLabels(e,t,s,i,n,a){this.xLabel=e,this.xMin=t,this.xMax=s,this.yLabel=i,this.yMin=n,this.yMax=a,this.xRel=this.plotRangeX/(this.xMax-this.xMin),this.yRel=this.plotRangeY/(this.yMax-this.yMin)}drawAxis(e=0,t=0,s=2){if(this.plotArea.setAttribute("transform","matrix(1 0 0 1 "+this.margins.left+" "+(this.height-this.margins.bottom)+")"),this.yLabelText=i.addText(this.svg,0,0,this.yLabel,"middle","axis-steps-big"),this.yLabelText.setAttribute("transform","translate(13,"+(this.plotRangeY/2+this.margins.top)+") rotate(-90)"),i.addText(this.plotArea,this.plotRangeX/2,this.margins.bottom-1,this.xLabel,"middle","axis-steps-big"),null!==e){let t=this.plotRangeX/e;for(let n=0;n<=e;n++)i.addLine(this.plotArea,t*n,0,t*n,4,1),i.addText(this.plotArea,t*n,14,+(t*n/this.xRel+this.xMin).toFixed(s),"middle","statisticsviewersteps")}if(null===t&&this.yMax>0&&this.yMin<0){let e=1;for(;this.yMax*e>this.yMin;){i.addLine(this.plotArea,0,this.transformY(this.yMax*e),-3,this.transformY(this.yMax*e),1);let t=this.yMax*e,n=Math.abs(t)>=1e4?t.toExponential(s):t.toFixed(s);i.addText(this.plotArea,-5,this.transformY(this.yMax*e)+3,n,"end","statisticsviewersteps"),e--}}if(null!==t){let e=this.plotRangeY/t;for(let n=0;n<=t;n++){i.addLine(this.plotArea,0,-e*n,-3,-e*n,1);let t=e*n/this.yRel+this.yMin;t=Math.abs(t)>=1e4?t.toExponential(s):t.toFixed(s),Math.abs(t)<.01&&(t=0),i.addText(this.plotArea,-5,-(e*n-3),t,"end","statisticsviewersteps")}}i.addLine(this.plotArea,0,0,this.plotRangeX+1,0,"main-axis"),i.addLine(this.plotArea,0,0,0,-(this.plotRangeY+1),"main-axis"),i.addLine(this.plotArea,this.plotRangeX,0,this.plotRangeX,-this.plotRangeY,"main-axis"),i.addLine(this.plotArea,0,-this.plotRangeY,this.plotRangeX,-this.plotRangeY,"main-axis")}clear(){this.svg.removeChild(this.plotArea),this.plotArea=document.createElementNS(n,"g"),this.svg.appendChild(this.plotArea),this.plotArea.setAttribute("transform","matrix(1 0 0 1 "+this.margins.left+" "+(this.height-this.margins.bottom)+")"),null!==this.yLabelText&&(this.svg.removeChild(this.yLabelText),this.yLabelText=null),null!==this.noDataGroup&&(this.svg.removeChild(this.noDataGroup),this.noDataGroup=null)}setNoData(){this.clear(),null===this.noDataGroup&&(this.noDataGroup=document.createElementNS(n,"g"),this.svg.appendChild(this.noDataGroup),i.addRect(this.noDataGroup,0,0,this.width,this.height),this.noDataGroup.setAttribute("fill","#EEE"),i.addText(this.noDataGroup,this.width/2,this.height/2+10,"NO DATA","middle","nodata"))}transformY(e){return-this.yRel*(e-this.yMin)}}},292:e=>{"use strict";var t=new Map,s=-1;e.exports={subscribe:function(e,i){if("function"!=typeof i)return!1;t.has(e)||t.set(e,new Map);var n="uid_"+String(++s);return t.get(e).set(n,i),n},publish:function(e,s){return!!(t.has(e)&&t.get(e).size>0)&&(setTimeout((function(){t.get(e).forEach((function(e,t){e(s)}))}),0),!0)}}},794:(e,t,s)=>{"use strict";let i=s(317),n=new Map;window.addEventListener("hashchange",r);var a=[window.location.hash],l=window.history.length;function r(){var e=window.location.hash,t=window.history.length;a.length&&l==t?a[a.length-2]==e?a=a.slice(0,-1):a.push(e):(a.push(e),l=t);let s,r,o,d=document.location.hash.substring(2);d.lastIndexOf("/")===d.length-1&&(d=d.substring(0,d.length-1));let h=d.indexOf("&state");if(-1!=h&&(d=d.substring(0,h)),d.indexOf("/")>0){let e=d.split("/");s=e[0],r=e[1],o=e[2]}else s=d;n.has(s)&&(i.reset(),n.get(s)(r,o))}e.exports={add:function(e,t){n.set(e,t)},route:r}},584:e=>{"use strict";const t="http://www.w3.org/2000/svg";e.exports={addPoint:function(e,s,i,n,a){let l=document.createElementNS(t,"circle");return l.setAttribute("r",n),l.setAttribute("cx",s),l.setAttribute("cy",i),void 0!==a&&l.setAttribute("class",a),e.appendChild(l),l},addCircle:function(e,s,i,n,a,l,r){let o=document.createElementNS(t,"circle");return o.setAttribute("r",n),o.setAttribute("cx",s),o.setAttribute("cy",i),o.setAttribute("fill",a),o.setAttribute("stroke",l),o.setAttribute("stroke-width",r),e.appendChild(o),o},addLine:function(e,s,i,n,a,l){let r=document.createElementNS(t,"line");return r.setAttribute("x1",s),r.setAttribute("y1",i),r.setAttribute("x2",n),r.setAttribute("y2",a),void 0!==l&&r.setAttribute("class",l),e.appendChild(r),r},addRect:function(e,s,i,n,a,l){let r=document.createElementNS(t,"rect");return r.setAttribute("x",s),r.setAttribute("y",i),r.setAttribute("width",n),r.setAttribute("height",a),void 0!==l&&r.setAttribute("class",l),e.appendChild(r),r},addText:function(e,s,i,n,a="start",l){let r=document.createElementNS(t,"text");return r.setAttribute("x",s),r.setAttribute("y",i),r.textContent=n,r.setAttribute("text-anchor",a),void 0!==l&&r.setAttribute("class",l),e.appendChild(r),r},addPolyline:function(e,s,i){let n=document.createElementNS(t,"polyline");n.setAttribute("points",s),void 0!==i&&n.setAttribute("class",i),e.appendChild(n)},removeElement:function(e){e.parentElement.removeChild(e)}}},951:(e,t,s)=>{s(212),e.exports=class{constructor(e){this.off=!0,this.element=document.createElement("span"),this.element.innerHTML+=`\n       <img src="${e}_off.png" width="24px"\n        style="margin-bottom: -1px; cursor: pointer"/>\n    `,this.image=this.element.querySelector("img"),this.element.addEventListener("click",(t=>{this.off=!this.off;let s=this.off?e+"_off":e;this.image.setAttribute("src",s+".png"),this.listener(this.off)}))}setListener(e){this.listener=e}}},882:e=>{"use strict";let t,s,i,n,a,l=document.querySelector("body"),r=[],o=[],d=[],h=!1;function c(e,t){let s=document.createElement("div");return s.setAttribute("class","user-guidance"),s.innerHTML='<img src="img/tip'+e+'.png" width="'+t+'px" />',s.style.position="absolute",s.style.display="none",l.appendChild(s),s}function u(e){if(8===e&&!h)return;if(4===e&&!h)return;let t=o[e].domTarget.getBoundingClientRect();r[e].style.top=t.top+o[e].top+window.pageYOffset+"px",r[e].style.left=t.left+o[e].left+"px",r[e].style.display="block"}function p(e){r[e].style.display="none",localStorage.setItem("tip"+e,"off"),d[e]="off"}function m(e){switch(e.preventDefault(),e.target.style.display="none",t){case 2:t=5;break;case 6:t=8;break;default:t++}v(t),u(t)}function y(e,t){null===d[e]&&(t?u(e):r[e].style.display="none")}function v(e){t=e,localStorage.setItem("currentTip",e)}e.exports={init:function(e,t,l,h){s=e,i=t,n=l,a=h,d[3]=localStorage.getItem("tip3"),d[4]=localStorage.getItem("tip4"),d[7]=localStorage.getItem("tip7"),0===r.length&&(r[1]=c(1,220),o[1]={domTarget:s,top:-70,left:-240},r[2]=c(2,280),o[2]={domTarget:s,top:-110,left:80},r[3]=c(3,180),o[3]={domTarget:i,top:180,left:720},r[4]=c(4,240),o[4]={domTarget:n,top:45,left:-250},r[5]=c(5,210),o[5]={domTarget:s,top:-130,left:70},r[6]=c(6,240),o[6]={domTarget:s,top:-100,left:370},r[7]=c(7,220),o[7]={domTarget:a,top:160,left:-40},r[8]=c(8,240),o[8]={domTarget:n,top:30,left:760},r[1].addEventListener("click",m),r[2].addEventListener("click",m),r[3].addEventListener("click",(e=>{p(3)})),r[4].addEventListener("click",(e=>{p(4)})),r[5].addEventListener("click",m),r[6].addEventListener("click",m),r[7].addEventListener("click",(e=>{p(7)})),r[8].addEventListener("click",(e=>{e.target.style.display="none",v(10)})));let u=localStorage.getItem("currentTip");null===u?v(1):(u=parseInt(u),u<10&&v(u))},setFinal:function(){h=!0,t<10&&(r[t].style.display="none",v(8),u(t)),y(4,!0)},show:function(e,s,i){t<10&&(e?u(t):r[t].style.display="none"),y(3,e&&s),y(4,e),y(7,e&&i)},showIndependentTip:y}},212:e=>{"use strict";const t=window.nomadEnv.apiRoot;function s(e){let t="";for(let s=0;s<e.length;s++)e.charCodeAt(s)>=47&&e.charCodeAt(s)<58?t+="<sub>"+e[s]+"</sub>":t+=e[s];return t}function i(e){let t=e.substring(1,e.length-1).split(","),s=[];for(var i=0;i<t.length;i++)s.push(parseFloat(t[i]));return s}function n(e){return(e*(180/Math.PI)).toFixed(0)+"&deg;"}e.exports={searchResults:!1,materialId:null,MAT_VIEW:{structure:"structure",electronicstruct:"electronicstruct",methodology:"methodology",thermalprops:"thermalprops",elasticconst:"elasticconst"},IMAGE_DIR:"img/",ELEMENTS:["H","He","Li","Be","B","C","N","O","F","Ne","Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca","Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn","Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr","Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd","In","Sn","Sb","Te","I","Xe","Cs","Ba","La","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu","Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg","Tl","Pb","Bi","Po","At","Rn","Fr","Ra","Ac","Th","Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md","No","Lr","Rf","Ha","Sg","Ns","Hs","Mt","Ds","Rg","Cn","Nh","Fl","Mc","Lv","Ts","Og"],getUserData:function(){return null},getServerLocation:function(){return document.location.hostname},serverReq:function(e,t){var s=new XMLHttpRequest;s.addEventListener("load",t),s.open("GET",e);var i=window.keycloak;return i.authenticated&&s.setRequestHeader("Authorization","Bearer "+i.token),s.send(),s},convert2d:function(e,t){let s=[];for(var i=0;i<e.length;i++){let a=e[i],l=[];for(var n=0;n<a.length;n++)l.push(a[n]*t);s.push(l)}return s},serverReqPOST:function(e,t,s){var i=new XMLHttpRequest;i.addEventListener("load",s),i.open("POST",e),i.setRequestHeader("Content-Type","application/json");var n=window.keycloak;return n.authenticated&&i.setRequestHeader("Authorization","Bearer "+n.token),i.send(t),i},getShortCode:function(e){if((e.startsWith("eos/")||e.startsWith("par/"))&&32==e.length)return e.substring(0,12);if(28==e.length)return e.substring(0,8);throw"The given identifier could not be shortened as it does not have the right initial length."},getSearchURL:function(){return t+"materials/"},getSuggestionURL:function(e){return t+"suggestions?property="+e},getMaterialURL:function(e){return t+"materials/"+e},getMaterialCalcURL:function(e,s,i=""){return t+"materials/"+e+"/calculations/"+s+(""===i?"":"?property="+i)},getMaterialGroupURL:function(e,s,i){return t+"materials/"+e+"/groups/"+s+"/"+i},getMaterialStatsURL:function(e){return t+"materials/"+e+"/statistics"},getMaterialXsURL:function(e,s){return t+"materials/"+s+"/"+e},getCalcEnergiesURL:function(e,s){return t+"materials/"+e+"/calculations/"+s+"/energies"},getReportURL:function(e){return t+"materials/"+e+"/reports"},setBrowserHashPath:function(e,t){document.location=void 0===t?"#/"+e:"#/"+e+"/"+t},loadLib:function(e){let t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(t)},getNumberArray:i,J2eV:function(e,t){let s=e/1602176565e-28;return void 0===t?s<.01?s.toFixed(6):s.toFixed(3):s.toFixed(t)},eV2J:function(e){return 1602176565e-28*e},m2Angstrom:function(e){return(e/1e-10).toFixed(3)+" &#197;"},getLatticeAnglesValues:function(e,t,s){let a=[0,0,0];return e.forEach((e=>{if(void 0!==e.lattice_parameters&&null!==e.lattice_parameters){let t=i(e.lattice_parameters);a[0]+=t[3],a[1]+=t[4],a[2]+=t[5]}})),s?`<div>&alpha; = ${n(a[0]/e.size)}</div>\n    <div>&beta; = ${n(a[1]/e.size)}</div>\n    <div>&gamma; = ${n(a[2]/e.size)}</div>`:t?`<div>&alpha; = ${n(a[0]/e.size)}</div>`:""},rad2degree:n,m3ToAngstrom3:function(e){return(e/1e-30).toFixed(3)+" &#197;<sup>3</sup>"},toAngstromMinus3:function(e){return(1e-30*e).toFixed(3)+" &#197;<sup>-3</sup>"},getMaterialTitle:function(e,t){let i;return i=s(e.formula_reduced),void 0!==t&&!1===t&&(i=e.formula_reduced),null!==e.space_group_number&&void 0!==e.space_group_number&&(i+=" - space group "+e.space_group_number),i},getMinMaxHTML:function(e,t){let s=[];return e.forEach((e=>{s.push(e[t])})),"("+Math.min.apply(null,s)+" ... "+Math.max.apply(null,s)+")"},getSubscriptedFormula:s,getAverage:function(e){let t=0;for(var s=0;s<e.length;s++)t+=e[s];return t/e.length},numberWithCommas:function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},generateDiagramSteps:function(e,t=4){let s=-Math.floor(Math.log(e/t)*Math.LOG10E),i=Math.pow(10,s),n=Math.ceil(e*i/t),a=[];for(var l=0;l<=t;l++)a[l]=n*l/i;return s=s<0?0:s,[a,s]},getCalcMapByFunctional:function(e){let t=new Map;return e.forEach((e=>{if(t.has(e.functional_type))t.get(e.functional_type).add(e.calc_id);else{let s=new Set;s.add(e.calc_id),t.set(e.functional_type,s)}})),t},getDefault:function(e,t="unavailable"){return null==e?t:e},scale:function(e,t){let s;return Array.isArray(e)?(s=[],function e(s,i){if(Array.isArray(s[0]))for(let t=0,n=s.length;t<n;++t){const n=[];i.push(n),e(s[t],n)}else for(let e=0,n=s.length;e<n;++e)i.push(s[e]*t)}(e,s)):s=e*t,s},distance:function(e,t){return e.map(((e,s)=>Math.abs(e-t[s])**2)).reduce(((e,t)=>e+t))**.5}}},51:(e,t,s)=>{let i=s(507),n=s(94);s(584),e.exports=class{constructor(){this.element=document.createElement("div"),this.element.setAttribute("style","margin: 0 auto"),this.parentElement=null,this.bsPlotter=new i,this.dosPlotter=new n({left:4,right:20,top:0,bottom:30}),this.dosYAxisLabeled=!1}attach(e,t,s){e.appendChild(this.element),this.bsPlotter.attach(this.element,s,s),this.height=s,this.dosPlotter.attach(this.element,this.height/2+20,s),this.parentElement=e}isAttached(){return null!==this.parentElement}setUpAndData(e,t,s){let i;if(this.hasDispData=null!=e,this.hasDosData=null!=t,i=!(!this.hasDosData||this.hasDispData),this.dosYAxisLabeled!==i){this.element.removeChild(this.dosPlotter.svg);let e=i?40:4;this.dosPlotter=new n({left:e,right:20,top:0,bottom:30});let t=this.height/2+e;this.dosPlotter.attach(this.element,t,this.height)}this.dosYAxisLabeled=i,this.hasDispData?(this.bsPlotter.setBandStructureData(e),this.hasDosData&&this.bsPlotter.setRepaintListener(((e,t)=>{this.dosPlotter.setYZoomAndOffset(e,t),this.dosPlotter.repaint()}))):this.bsPlotter.setNoData(),this.hasDosData?(this.dosPlotter.setPoints(t,s),this.hasDispData&&(this.bsPlotter.setExternalYAxisMax(this.dosPlotter.getYAxisMax()),this.dosPlotter.setRepaintListener(((e,t)=>{this.bsPlotter.setYZoomAndOffset(e,t),this.bsPlotter.repaint()})),this.dosPlotter.svg.removeChild(this.dosPlotter.yLabelText),this.dosPlotter.yLabelText=null)):this.dosPlotter.setNoData(),this.dosPlotter.setYAxisLabelsVisibility(i)}setNoData(){this.bsPlotter.setNoData(),this.dosPlotter.setNoData()}}},507:(e,t,s)=>{"use strict";let i=s(971),n=s(584);function a(e){return"Gamma"===e||"G"===e?"Γ":e}s(212),e.exports=class extends i{constructor(){super({left:55,right:5,top:0,bottom:30}),this.phononMode=!1,this.factor=1602176565e-28}setPhononMode(){this.phononMode=!0,this.factor=1986445681679957e-38,this.outOfRangeColorActivated=!1}attach(e,t,s){super.attach(e,t,s)}getTopAndLowestPoints(e){let t=e[0].band_energies[0][0][0],s=e[0].band_energies[0][0][0];for(let i=0;i<e.length;i++){for(let n=0;n<e[i].band_energies[0].length;n++){let a=Math.max.apply(null,e[i].band_energies[0][n]);a>t&&(t=a),a=Math.min.apply(null,e[i].band_energies[0][n]),a<s&&(s=a)}if(2===e[i].band_energies.length)for(let n=0;n<e[i].band_energies[1].length;n++){let a=Math.max.apply(null,e[i].band_energies[1][n]);a>t&&(t=a),a=Math.min.apply(null,e[i].band_energies[1][n]),a<s&&(s=a)}}return[(s-this.energyOffset)/this.factor,(t-this.energyOffset)/this.factor]}drawKPointLabel(e,t){n.addText(this.axisGroup,e*this.xRel,16,t,"middle","steps")}setBandStructureData(e){let t=e.section_k_band_segment;if(this.bandGapData=void 0,this.energyOffset=void 0!==e.energy_highest_occupied?e.energy_highest_occupied:0,void 0!==e.section_band_gap){let t=1/0,s=0;for(let i=0;i<e.section_band_gap.length;++i){let n=e.section_band_gap[i].value;n<t&&(t=n,s=i)}0!=t&&(this.bandGapData=e.section_band_gap[s],this.bandGapData.cbmDistances=[],this.bandGapData.vbmDistances=[])}this.bandsDataSpin1=[],this.bandsDataSpin2=[],this.segmentLimitsX=[],this._reset();let s=this.getTopAndLowestPoints(t),i=s[0],n=s[1];this.phononMode?this.setAxisRangeAndLabels("",0,1,"Frequency (cm⁻¹)",-50,320,i,n,100):this.setAxisRangeAndLabels("",0,1,"Energy (eV)",-6,11,i,n,5);let l=0,r=null,o=!1,d=t[t.length-1].k_path_distances,h=d[d.length-1];for(let e=0;e<t.length;e++){let s=t[e],i=s.band_segm_labels,n=s.band_energies[0],d=s.band_energies[1],c=s.k_path_distances;this.bandsDataSpin1.push([]),this.bandsDataSpin2.push([]);let u=c[c.length-1]-c[0];this.segmentLimitsX.push(l/h),null!==i&&(null!==r&&r!==i[0]?this.drawKPointLabel(l/h,a(r)+"|"+a(i[0])):this.drawKPointLabel(l/h,a(i[0])),e===t.length-1&&this.drawKPointLabel(1,a(i[1])),r=i[1]);for(let t=0;t<c.length;t++){let s=c[t]/h;for(let i=0;i<n[t].length;i++){0===t&&(this.bandsDataSpin1[e][i]=[]);let a=(n[t][i]-this.energyOffset)/this.factor;this.bandsDataSpin1[e][i].push({x:s,y:a}),!o&&a>1e4&&(o=!0)}if(void 0!==d)for(let i=0;i<d[t].length;i++){0===t&&(this.bandsDataSpin2[e][i]=[]);let n=(d[t][i]-this.energyOffset)/this.factor;this.bandsDataSpin2[e][i].push({x:s,y:n}),!o&&n>1e4&&(o=!0)}}l+=u}if(o)throw"Plotter Data Overflow: Probably the energy data is not in correct units";this.repaint()}repaintData(e,t){let s;this.segmentLimitsX.forEach((s=>{let i=this.transformY(e),a=this.transformY(t);this.phononMode&&(i+=200,a-=200),n.addLine(this.plotContent,s*this.xRel,i,s*this.xRel,a,"segment")}));for(var i=0;i<this.bandsDataSpin1.length;i++)for(var a=0;a<this.bandsDataSpin1[i].length;a++){s="";for(var l=0;l<this.bandsDataSpin1[i][a].length;l++)s+=" "+this.xRel*this.bandsDataSpin1[i][a][l].x+" "+this.transformY(this.bandsDataSpin1[i][a][l].y);n.addPolyline(this.plotContent,s,"plotSpin1")}if(this.bandsDataSpin2.length>0)for(i=0;i<this.bandsDataSpin2.length;i++)for(a=0;a<this.bandsDataSpin2[i].length;a++){for(s="",l=0;l<this.bandsDataSpin2[i][a].length;l++)s+=" "+this.xRel*this.bandsDataSpin2[i][a][l].x+" "+this.transformY(this.bandsDataSpin2[i][a][l].y);n.addPolyline(this.plotContent,s,"plotSpin2")}void 0!==this.bandGapData&&(this.bandGapData.cbmDistances.forEach((e=>{let t=this.xRel*e,s=this.transformY((this.bandGapData.conduction_band_min_energy-this.energyOffset)/this.factor);n.addPoint(this.plotContent,t,s,3,"cbm-vbm-points"),n.addText(this.plotContent,t+4,s-6,"CBM")})),this.bandGapData.vbmDistances.forEach((e=>{let t=this.xRel*e,s=this.transformY((this.bandGapData.valence_band_max_energy-this.energyOffset)/this.factor);n.addPoint(this.plotContent,t,s,3,"cbm-vbm-points"),n.addText(this.plotContent,t+4,s+14,"VBM")})))}}},370:e=>{e.exports=class{constructor(e,t){this.first=!0,this.last=!1,this.element=document.createElement("div"),this.element.className=e,void 0!==t&&(this.element.style.width=t),this.element.innerHTML='\n      <div class="prev-sel-btn" style="float: left; width: 20%;">\n        <div style="padding-left: 10%;">\n          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10.069 11.872" width="20px">\n            <path transform="scale(0.7) translate(-346.291 -664.481)"\n              d="M356.36,666.024l-1.544-1.544-8.525,8.513,8.493,8.447,1.544-1.544-6.8-6.9Z" />\n          </svg>\n        </div>\n      </div>\n      <div class="calc-sel-text" style="float: left; width: 60%;">\n       NOT Calculation\n      </div>\n      <div class="next-sel-btn" style="float: right; width: 20%;">\n        <div style="padding-right: 10%;">\n          <svg xmlns="http://www.w3.org/2000/svg" viewBox="-10.069 -11.872 10.069 11.872" width="20px">\n            <g transform="rotate(180) scale(0.7)">\n              <path d="M10.069,1.544,8.525,0,0,8.513,8.493,16.96l1.544-1.544-6.8-6.9Z"/>\n            </g>\n          </svg>\n        </div>\n      </div>\n      <div style="clear: both;"></div>\n    ',this.prevBtn=this.element.querySelector(".prev-sel-btn"),this.prevIcon=this.element.querySelector(".prev-sel-btn path"),this.calcSelectorTxt=this.element.querySelector(".calc-sel-text"),this.nextBtn=this.element.querySelector(".next-sel-btn"),this.nextIcon=this.element.querySelector(".next-sel-btn path"),this._styleButtons(),this._events()}_events(){this.prevBtn.addEventListener("click",(e=>{e.preventDefault(),this.first||(this.first=this.prevListener(),this.last=!1,this._styleButtons())})),this.nextBtn.addEventListener("click",(e=>{e.preventDefault(),this.last||(this.first=!1,this.last=this.nextListener(),this._styleButtons())}))}_styleButtons(){this.prevIcon.setAttribute("class","calc-selector-icon"+(this.first?"-disabled":"")),this.nextIcon.setAttribute("class","calc-selector-icon"+(this.last?"-disabled":""))}setPrevListener(e){this.prevListener=e}setNextListener(e){this.nextListener=e}setState(e,t,s){this.calcSelectorTxt.innerHTML=e,this.first=t,this.last=s,this._styleButtons()}}},94:(e,t,s)=>{"use strict";let i=s(971),n=s(584),a=s(212);const l=1602176565e-28;e.exports=class extends i{constructor(e){super(e)}attach(e,t,s){super.attach(e,t,s)}setPoints(e,t){this.pointsSpin1=[],this.pointsSpin2=[],this._reset();let s=e.dos_values[0],i=null;2===e.dos_values.length&&(i=e.dos_values[1]);let r=void 0!==e.energy_highest_occupied?e.energy_highest_occupied:0,o=e.dos_energies,d=[],h=[];for(var c=0;c<o.length;c++){let e=(o[c]-r)/1602176565e-28,t=s[c]*l;if(d.push(t),h.push(e),this.pointsSpin1.push({x:t,y:e}),null!==i){let t=i[c]*l;this.pointsSpin2.push({x:t,y:e}),d.push(t)}}let u=Math.max.apply(null,d),p=Math.max.apply(null,h),m=Math.min.apply(null,h),y=a.generateDiagramSteps(u,3),v=y[0];y[1],this.setAxisRangeAndLabels(null,0,v[v.length-1],"Energy (eV)",-6,11,m,p,5),n.addText(this.axisGroup,this.plotRangeX/2,this.margins.bottom,"DOS (states/eV/cell)","middle","axis-steps-big");for(let e=0;e<v.length;e++){let t=this.plotRangeX*v[e]/v[v.length-1];n.addLine(this.axisGroup,t,0,t,3,1);let s=v[e];s=Math.abs(s)>=1e4||Math.abs(s)<=1e-4?s.toExponential(1):parseFloat(s.toFixed(3)),n.addText(this.axisGroup,t,13,0===e?"0":s,"middle","axis-steps-smaller")}this.repaint()}repaintData(){let e="";for(var t=0;t<this.pointsSpin1.length;t++)e+=" "+this.xRel*this.pointsSpin1[t].x+" "+this.transformY(this.pointsSpin1[t].y);for(n.addPolyline(this.plotContent,e,"plotSpin1"),e="",t=0;t<this.pointsSpin2.length;t++)e+=" "+this.xRel*this.pointsSpin2[t].x+" "+this.transformY(this.pointsSpin2[t].y);n.addPolyline(this.plotContent,e,"plotSpin2")}setYAxisLabelsVisibility(e){null!==this.yAxisLabelsGroup&&(this.yAxisLabelsGroup.style.visibility=e?"visible":"hidden")}}},719:(e,t,s)=>{let i,n,a,l,r,o,d,h,c=s(212),u=new Map,p=!1;function m(e){return e.substring(0,3)}function y(e){return"eos/"===e.substring(0,4)||"par/"===e.substring(0,4)}function v(e){return e.substring(4)}e.exports={getRepresentatives:function(){return r},setMaterialData:function(e){i=e},getMaterialData:function(){return i},getCalculations:function(){return l},setCalculations:function(e){l=e.results,l.forEach((function(e,t){let s=c.getDefault(e.functional_type),i=c.getDefault(e.core_electron_treatment);this[t].functional_type=s,this[t].core_electron_treatment=i}),l),r=e.representatives;for(let e=0;e<l.length;e++)u.set(l[e].calc_id,l[e]);let t=r.electronic_band_structure,s=r.electronic_dos,i=r.thermodynamical_properties;h=void 0!==t||void 0!==s,d=void 0!==i},getCalc:function(e){return u.get(e)},getGroups:function(){return n},setGroups:function(e){let t=new Map(Object.entries(e.groups_eos)),s=new Map(Object.entries(e.groups_par));n=new Map,n.set("eos",t),n.set("par",s),a=new Set,t.forEach(((e,t)=>{e.forEach(a.add,a)}))},getGroupId:v,isGroup:y,getGroupType:m,getReprCalc:function(e){if(y(e)){let t=m(e),s=v(e);return n.get(t).get(s)[0]}return e},isInAnyGroup:function(e){return a.has(e)},isInAnyNotDisabledGroup:function(e){return a.has(e)},getGroupLeafId:function(e){let t=null;return n.forEach(((s,i)=>{s.calculation_set.has(e)&&(t=i)})),t},isReady:function(e){if(void 0!==i){if(p&&e==i.material_id)return!0;if(void 0!==o&&void 0!==l&&void 0!==n&&e===i.material_id)return!0}return!1},setMissing:function(e){p=e},getMissing:function(){return p},clear:function(){i=void 0,l=void 0,n=void 0,o=void 0,p=!1},setIdealizedStructure:function(e){o=e},getIdealizedStructure:function(){return o},hasThermalData:function(e){return d},hasElecStructureData:function(e){return h}}},155:(e,t,s)=>{"use strict";let i=s(212),n=s(719);e.exports=class{constructor(e){this.element=document.createElement("div"),this.element.setAttribute("id",e),this.loadedMatId=null,this.gotoResultsListener=null,this.gotoOverviewListener=null,this.element.innerHTML='<div class="material-title"></div>',this.element.style.display="none"}attachAndSetEvents(e){e.appendChild(this.element),this.materialTitle=this.element.querySelector(".material-title")}attachNavTree(e){e.attach(this.navTreeWrapper)}setVisible(){this.element.style.display="block"}load(){let e=n.getMaterialData().material_id;this.loadedMatId!==e&&(this.loadedMatId=e,this.setMaterialData())}setMaterialData(){this.materialTitle.innerHTML=i.getMaterialTitle(n.getMaterialData())}updateCalcs(e){}updateMarkedCalc(e){}}},373:(e,t,s)=>{"use strict";let i=s(155),n=(s(212),s(223));e.exports=class extends i{constructor(){super("Elastic constants"),this.sortedLeafs=[],this.markedCalc=null,this.element.innerHTML+='\n\n      <div style="float: left; width: 27%;">\n        <div class="view-box">\n          <div class="title">Calculation </div>\n          <div class="navTreeWrapper"></div>\n        </div>\n      </div>\n\n      <div style="float: right; width: 73%;">\n        <div class="view-box">\n          <div class="title">Elastic constants</div>\n\n          <div>Parameters</div>\n          <div ></div>\n\n\n        </div>\n      </div>\n\n      <div style="clear: both;"></div>\n    ',this.navTreeWrapper=this.element.querySelector(".navTreeWrapper"),n.addToInfoSystem(this.element),this._events()}_events(){}updateSelection(e){console.log("ElasticDetails updateSelection ",e)}updateMarkedLeaf(e){}}},285:(e,t,s)=>{"use strict";let i=s(155),n=s(212),a=s(414),l=s(223),r=(s(370),s(624)),o=s(51),d=(new(s(666)),s(719)),h=s(317);class c{constructor(e){this.calcMapByFunctional=null,this.hostElement=e,this.viewType="text",this.functional=null,this.nBins=15,this.hostElement.innerHTML+='\n      <div style="float: left" >\n        <svg xmlns="http://www.w3.org/2000/svg" class="chart-tab"\n          viewBox="0 0 15 15" width="15" height="15" style="fill: #c7c7c7;">\n            <rect x="0" y="0"  width="2" height="15" />\n            <rect   x="3" y="5"  width="1.8" height="7"  />\n            <rect  x="6" y="3"  width="1.8" height="9"  />\n            <rect   x="9" y="6"  width="1.8" height="6"  />\n            <rect  x="12" y="2"  width="1.8" height="10"  />\n            <rect x="2" y="13"   width="13" height="2" />\n        </svg>\n        <svg xmlns="http://www.w3.org/2000/svg" class="text-tab"\n          viewBox="0 0 15 15" width="15" height="15" style="fill: #777;">\n            <rect x="0" y="1"   width="15" height="2.5" />\n            <rect   x="0" y="6"  width="15" height="2.5"  />\n            <rect  x="0" y="11"  width="15" height="2.5"  />\n        </svg>\n      </div>\n\n      <div class="functional-tabs" style="float: right">\n      </div>\n\n      <div style="clear: both;"></div>\n\n      <div class="content-placeholder" >\n\n        <div style="display: block" class="text-panel" >\n\n          <div><b><span info-sys-data="band gap">Band gap</span></b> (eV):\n            <div class="stats-fields summary-bandgap-field" > </div>\n          </div>\n        </div>\n\n        <div style="display:none" class="chart-panel" >\n          <div class="charts-placeholder" > </div>\n        </div>\n\n      </div>\n    ',this.chartTab=this.hostElement.querySelector(".chart-tab"),this.textTab=this.hostElement.querySelector(".text-tab"),this.functionalTabs=this.hostElement.querySelector(".functional-tabs"),this.chartPanel=this.hostElement.querySelector(".chart-panel"),this.textPanel=this.hostElement.querySelector(".text-panel"),this.bandgapField=this.hostElement.querySelector(".summary-bandgap-field"),this.statsViewer=new r,this.chartsPlaceholder=this.hostElement.querySelector(".charts-placeholder"),this.chartTab.addEventListener("click",(e=>{this.chartTab.style.fill="#777",this.viewType="chart",this.textTab.style.fill="#c7c7c7",this.chartPanel.style.display="block",this.textPanel.style.display="none"})),this.textTab.addEventListener("click",(e=>{this.textTab.style.fill="#777",this.viewType="text",this.chartTab.style.fill="#c7c7c7",this.textPanel.style.display="block",this.chartPanel.style.display="none"})),this.functionalTabs.addEventListener("click",(e=>{"tab"===e.target.className&&(this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab",this.functional=e.target.getAttribute("data-tab"),this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab-selected",this._setData())}))}_setData(){this.functional;let e=Array.from(this.calcMapByFunctional.get(this.functional)),t=d.getMaterialData().material_id,s=JSON.stringify({calculations:e,properties:["band_gap"],n_histogram_bins:this.nBins});n.serverReqPOST(n.getMaterialStatsURL(t),s,(e=>{let t=JSON.parse(e.target.response).band_gap;if(void 0===t)return this.bandgapField.innerHTML="No band gap data available",this.statsViewer.clear(),void(this.chartsPlaceholder.textContent="No band gap data available");this.chartsPlaceholder.textContent="",this.statsViewer.attach(this.chartsPlaceholder,250,150),t.min*=6241509e12,t.avg*=6241509e12,t.max*=6241509e12,t.histogram.values=t.histogram.values.map((e=>6241509e12*e));let s=t.avg.toFixed(3)+' &nbsp; <span style="font-size: 0.9em">['+t.min.toFixed(3)+" , "+t.max.toFixed(3)+"]</span>";this.bandgapField.innerHTML=s,this.statsViewer.clear(),this.statsViewer.drawPoints(t.histogram,"Band gap (eV)",this.nBins)}))}build(e){this.calcMapByFunctional=e,this.graphTrigger=null,this.statsViewer.clear(),this.unfoldedElement=null,this.functionalQuantityMap=new Map,this.functionalTabs.innerHTML="",this.calcMapByFunctional.forEach(((e,t)=>{this.functionalTabs.innerHTML+='<span class="tab" data-tab="'+t+'">'+t+"</span>"}));let t=Array.from(this.calcMapByFunctional.keys());(null===this.functional||t.indexOf(this.functional)<0)&&(this.functional=t[0]),this._setData(),this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab-selected",l.addToInfoSystem(this.hostElement)}}class u{constructor(e){this.hostElement=e,this.loaded=!1,this.bzViewer=new materia.BrillouinZoneViewer(this.hostElement,{view:{autoResize:!1,autoFit:!0,fitMargin:.07},layout:{viewRotation:{alignments:[["up","a"],["front","segments"]],rotations:[[0,1,0,45],[1,0,0,25]]}},basis:{offset:.025,size:.035,a:{color:"#f44336"},b:{color:"#4caf50"},c:{color:"#5c6bc0"}},faces:{outline:{width:.002}},kpoints:{label:{size:.03},point:{size:.01}}})}setCalcData(e){const t=n.scale(e.reciprocal_cell,1e-10),s=new Set,i=[],a=[];e.section_k_band_segment.forEach((e=>{a.push(e.band_segm_start_end);for(let t=0;t<2;++t){const n=e.band_segm_labels[t];s.has(n)||(i.push([n,e.band_segm_start_end[t]]),s.add(n))}}));const l={basis:t,kpoints:i,segments:a};this.bzViewer.load(l),this.hostElement.style.visibility="visible",this.loaded=!0,this.resize()}setNoData(){this.hostElement.style.visibility="hidden"}resize(){this.bzViewer.resizeCanvasToHostElement(),this.loaded&&(this.bzViewer.fitToCanvas(),this.bzViewer.render())}}e.exports=class extends i{constructor(){super("Electronic Structure"),this.navTree=new a,this.element.innerHTML+='\n      <div style="float: left; width: 30%;">\n        <div class="view-box">\n          <div class="title">Calculations </div>\n          <div class="navTreeWrapper"></div>\n\n          <div class="summary-title">Summary</div>\n          <div class="footer summary-box" style="border-top: 0"></div>\n        </div>\n      </div>\n\n      <div style="float: right; width: 70%;">\n        <div class="view-box e-structure-box">\n\n          <div class="title">Electronic structure</div>\n\n          <div style="padding-top: 10px; " >\n            <div class="tree-leaf-title"></div>\n          </div>\n\n          <div>\n\n            <div  style="padding: 30px  100px 20px 100px; ">\n              <div class="info-fields-label" style="float: left; width: 54%; ">\n                <span info-sys-data="band-structure">Band structure</span>\n              </div>\n              <div class="info-fields-label" style="float: left;">\n                <span info-sys-data="DOS">DOS</span>\n              </div>\n              <div style="clear: both;"></div>\n\n              <div class="calc-bs-dos-plotter" >\n              </div>\n\n              <div>\n              <div class="band-gap-field" style="float: left; width: 56%; text-align: right">\n                <b><span info-sys-data="band-gap">Band gap</span></b>:\n                <span class="band-gap-value" ></span>\n              </div>\n              <div style="clear: both;"></div>\n\n              </div>\n            </div>\n\n            <div class="spin-legend" style="font-size: 0.9em; padding: 0 30px 10px; display: none">\n              <svg width="15px" height="10px"> <polyline points="0,5 15,5" class="plotSpin1"/></svg>\n              Spin <span style=\'font-size: 1.1em\'>⇧</span>  &nbsp;&nbsp;&nbsp;\n              <svg width="15px" height="10px"> <polyline points="0,5 15,5" class="plotSpin2"/></svg>\n              Spin <span style=\'font-size: 1.1em\'>⇩</span>\n            </div>\n\n          </div>\n\n          <div class="footer lower-section">\n\n            <div  style="float: left">\n              <div style="padding: 16px; ">\n                <div class="info-fields-label" >\n                  <span info-sys-data="brillouin-zone-viewer">Brillouin zone</span>\n                </div>\n                <div class="bz-viewer-wrapper" style="width: 400px; height: 400px">\n                </div>\n              </div>\n            </div>\n\n            <div class="band" style="float: right; width: 40%;">\n              <div style="padding: 16px; ">\n                <div class="info-fields-label" >\n                  \x3c!-- <span info-sys-data="fermi-surface">Fermi surface </span> --\x3e\n                </div>\n                <div class="fermi-box" >      </div>\n              </div>\n            </div>\n\n            <div style="clear: both;"></div>\n\n          </div> \x3c!-- footer --\x3e\n\n        </div>\n\n      </div> \x3c!-- view-box --\x3e\n    ',this.navTreeWrapper=this.element.getElementsByClassName("navTreeWrapper")[0],this.leafTitle=this.element.querySelector(".tree-leaf-title"),this.rightBox=this.element.querySelector(".e-structure-box"),this.summaryByFunctionals=null,this.summaryBox=this.element.querySelector(".summary-box"),this.summaryByFunctionals=new c(this.summaryBox),this.bsDosPlotter=new o,this.bandGapField=this.element.querySelector(".band-gap-field"),this.bandGapValue=this.element.querySelector(".band-gap-value"),this.spinLegend=this.element.querySelector(".spin-legend"),this.lowerSection=this.element.querySelector(".lower-section"),this.fermiBox=this.element.getElementsByClassName("fermi-box")[0],this.bzViewerWrapper=new u(this.element.querySelector(".bz-viewer-wrapper")),l.addToInfoSystem(this.element)}setVisible(){this.element.style.display="block",this.bzViewerWrapper.resize()}setMaterialData(){let e=d.getMaterialData();super.setMaterialData(e);let t=null===e.material_name?e.formula:e.material_name;this.navTree.build(t,"electronic"),this.navTree.selectAll(),this.navTree.setHeight(400),this.navTree.setMarkedLeafIfNoneMarked(null),this.attachNavTree(this.navTree),this.updateSelection(this.navTree.getTreeSelectedCalcs()),this.updateMarkedLeaf(this.navTree.getMarkedLeaf()),this.navTree.setTreeSelectionListener((e=>{this.updateSelection(e)})),this.navTree.setLeafMarkedListener((e=>{this.updateMarkedLeaf(e)}))}updateSelection(e){if(e.size>0){let t=[];e.forEach((e=>{t.push(d.getCalc(e))}));let s=n.getCalcMapByFunctional(t);this.summaryByFunctionals.build(s)}else this.summaryBox.style.visibility="hidden"}updateMarkedLeaf(e){null===e?this.leafTitle.innerHTML="NO SELECTION":(this.leafTitle.innerHTML=n.getShortCode(e),this._loadGraphData(e))}_updateSelectorState(e){this.leafTitle.innerHTML=n.getShortCode(e)}_loadGraphData(e){let t=d.getCalc(e);if(this.bsDosPlotter.isAttached()||this.bsDosPlotter.attach(this.element.querySelector(".calc-bs-dos-plotter"),void 0,360),null===t||!t.has_band_structure&&!t.has_dos)this.bsDosPlotter.setNoData(),this.bzViewerWrapper.setNoData(),this.bandGapField.style.display="none",this.lowerSection.style.display="none";else{h.show("electronic_structure");let e=d.getMaterialData().material_id,s=n.getMaterialCalcURL(e,t.calc_id),i=JSON.stringify({properties:["electronic_band_structure","electronic_dos","band_gap"]});n.serverReqPOST(s,i,(e=>{let s=JSON.parse(e.target.response),i=s.electronic_dos,a=s.electronic_band_structure,l=s.band_gap;(function(e,t){return void 0!==e&&2===e.section_k_band_segment[0].band_energies.length||void 0!==t&&2===t.dos_values.length})(a,i)&&(this.spinLegend.style.display="block"),this.bsDosPlotter.setUpAndData(a,i,t),void 0!==l?(this.bandGapValue.textContent=n.J2eV(l,2)+" eV ",this.bandGapField.style.display="block"):(this.bandGapValue.textContent="",this.bandGapField.style.display="none"),void 0!==a&&void 0!==a.reciprocal_cell?(this.lowerSection.style.display="block",this.bzViewerWrapper.setCalcData(a)):(this.lowerSection.style.display="none",this.bzViewerWrapper.setNoData()),h.hide("electronic_structure")}))}}setPrevCalcListener(e){this.prevCalcListener=e}setNextCalcListener(e){this.nextCalcListener=e}}},290:(e,t,s)=>{"use strict";let i=s(212),n=s(584),a=s(666);e.exports=class extends a{constructor(){super({left:60,right:20,top:30,bottom:40}),this.tooltip,this.calcPointMap=new Map,this.pointSelected=null}draw(e,t,s,a){for(let e=0;e<t.length;e++)555!==t[e]&&(t[e]-=a);let l=function(e){let t=[];return e.forEach((e=>{555!==e&&t.push(e)})),t}(t),r=Math.min.apply(null,e),o=Math.max.apply(null,e),d=0,h=Math.max.apply(null,l);if(r===o)r-=1,o+=1;else{let e=o-r;r-=.1*e,o+=.1*e}if(d===h)d-=1,h+=1;else{let e=h-d;d-=.15*e,h+=.1*e}this.setRangeAndLabels("Volume (ų)",r,o,"E - Eₘᵢₙ (eV)",d,h),this.drawAxis(2,2),n.addLine(this.plotArea,0,this.y(0),this.plotRangeX,this.y(0),"zeroline"),n.addText(this.plotArea,this.x(o),this.y(0)+12,"Eₘᵢₙ: "+a.toFixed(3)+" eV","end","axis-steps");for(let a=0;a<e.length;a++){let l=0===a?"eos-viewer-sel":"eos-viewer",r=0===a?6:3,o=555===t[a]?20:this.y(t[a]),d=n.addPoint(this.plotArea,this.x(e[a]),o,r,l);0===a&&(this.pointSelected=d),d.addEventListener("mouseover",(e=>{this.tooltip=n.addText(this.plotArea,e.target.getBBox().x+10,e.target.getBBox().y-10,"Calc "+i.getShortCode(s[a]),"middle","tooltip")})),d.addEventListener("mouseout",(e=>{n.removeElement(this.tooltip)})),d.addEventListener("click",(e=>{this.clickPointListener(s[a])})),this.calcPointMap.set(s[a],d)}}selectCalc(e){this.pointSelected.setAttribute("class","eos-viewer"),this.pointSelected.setAttribute("r",3),this.pointSelected=this.calcPointMap.get(e),this.pointSelected.setAttribute("class","eos-viewer-sel"),this.pointSelected.setAttribute("r",6)}setClickPointListener(e){this.clickPointListener=e}x(e){return this.xRel*(e-this.xMin)}y(e){return-this.yRel*(e-this.yMin)}}},195:(e,t,s)=>{"use strict";let i=s(584),n=s(666);e.exports=class extends n{constructor(){super({left:50,right:16,top:10,bottom:32}),this.tooltip}setData(e,t){this.clear();let s,n=[],a=[];for(let s=0;s<e.length;++s){let i=e[s],l=t[s];null!==i&null!==l&&(n.push(i),a.push(l))}for(let t=0;t<e.length;++t)if(e[t]>600){s=t-1;break}void 0===s&&(s=e.length-1),e=e.slice(0,s+1),t=t.slice(0,s+1);let l=Math.max.apply(null,t),r=200*Math.ceil(l/200),o=e[s],d=50*Math.ceil(o/50);this.setRangeAndLabels("T (K)",0,d,"Cv (J/K/kg)",0,r),this.drawAxis(4,4,0);let h="";e.forEach(((e,s)=>{let i=t[s];h+=" "+this.xRel*e+" -"+this.yRel*(i-this.yMin)})),i.addPolyline(this.plotArea,h,"plotSpin1")}}},842:(e,t,s)=>{"use strict";let i=s(584),n=s(666);e.exports=class extends n{constructor(){super({left:70,right:16,top:10,bottom:32}),this.tooltip}setData(e,t){this.clear();let s,n=[],a=[];for(let s=0;s<e.length;++s){let i=e[s],l=t[s];null!==i&null!==l&&(n.push(i),a.push(l))}for(let t=0;t<e.length;++t)if(e[t]>600){s=t-1;break}void 0===s&&(s=e.length-1),e=e.slice(0,s+1),t=t.slice(0,s+1);let l=Math.max.apply(null,t),r=Math.min.apply(null,t),o=5e3*Math.ceil(l/5e3),d=5e3*Math.floor(r/5e3),h=e[s],c=50*Math.floor(h/50);this.setRangeAndLabels("T (K)",0,c,"F (J/kg)",d,o),this.drawAxis(4,4,2);let u="";e.forEach(((e,s)=>{let i=t[s];u+=" "+this.xRel*e+" -"+this.yRel*(i-this.yMin)})),i.addPolyline(this.plotArea,u,"plotSpin1")}}},95:(e,t,s)=>{let i=s(584),n=s(212),a=(s(414),s(576)),l=s(763),r=s(285),o=s(650),d=s(346),h=s(373),c=s(719),u=s(317),p={eStruct:null,thermalProps:null};class m{constructor(e){this.hostElement=e,this.viewer=new materia.StructureViewer(e,{layout:{viewCenter:"COP"},view:{autoResize:!1,autoFit:!0,fitMargin:2},atoms:{scale:.7},bonds:{threshold:1.4}}),this.legendElement=document.createElement("div"),this.legendElement.setAttribute("class","element-labels"),this.legendElement.setAttribute("style","position: absolute; bottom: 50px; right: 0"),this.hostElement.appendChild(this.legendElement),this.footerElement=document.createElement("div"),this.footerElement.setAttribute("class","structure-viewer-legend"),this.hostElement.appendChild(this.footerElement),this.footerElement.innerHTML=`\n\n    <div style="float: left; padding-right: 12px" >\n      <input type="checkbox" class="show-axis" checked> Show axis\n    </div>\n\n    <div style="float: left; padding-right: 18px" >\n      <input type="checkbox" class="show-bonds" checked> Show bonds\n    </div>\n\n    <div style="float: left; position:relative;" >\n      <img class="view-reset" style="cursor: pointer;" height="18px"\n        src="${n.IMAGE_DIR}reset.svg" />\n      <div class="view-reset-tooltip" > Reset view </div>\n    </div>\n\n    <div class="vr-download" style="float: right"> </div>\n\n    <div style="clear: both;"></div>\n    `,this.axisCheckbox=this.footerElement.querySelector(".show-axis"),this.axisCheckbox.addEventListener("click",(e=>{this.viewer.setOptions({latticeConstants:{enabled:this.axisCheckbox.checked}})})),this.bondsCheckbox=this.footerElement.querySelector(".show-bonds"),this.bondsCheckbox.addEventListener("click",(e=>{this.viewer.setOptions({bonds:{enabled:this.bondsCheckbox.checked}})})),this.labelsContainer=this.hostElement.querySelector(".element-labels");let t=this.hostElement.querySelector(".view-reset");t.addEventListener("click",(e=>this.viewer.reset())),t.addEventListener("mouseover",(e=>{this.hostElement.querySelector(".view-reset-tooltip").style.display="block"})),t.addEventListener("mouseout",(e=>{this.hostElement.querySelector(".view-reset-tooltip").style.display="none"}))}load(e){const t=e.periodicity;let s,i;e=this.getCellDataForViewer(e);let n=0,a=[],l=t[0],r=t[1],o=t[2];if(l&&r&&o)n=3;else if(l||r||o)for(let e=0;e<3;++e){let s=t[e],i=t[(e+1)%3],l=t[(e+2)%3];if(s&&!i&&!l){n=1,a.push(e);break}if(s&&i&&!l){n=2,a.push(e),a.push((e+1)%3);break}}else n=0;function d(e,t){let s=Math.sqrt(e.reduce(((e,t)=>e+t*t),0));return Math.max(Math.floor(t/s),1)}if(2==n){let t=a[0],n=a[1],l=0;for(let e=0;e<3;++e)if(e!==t&&e!==n){l=e;break}const r=12,o=d(e.cell[t],r),h=d(e.cell[n],r),c=[1,1,1];c[t]=o,c[n]=h;const u=["a","b","c"],p=u[t],m=u[n],y=u[l];let v,g,f;0===t&&1===n||1===t&&0===n?(v="gamma",g="alpha",f="beta"):1===t&&2===n||2===t&&1===n?(v="alpha",g="beta",f="gamma"):(2===t&&0===n||0===t&&2===n)&&(v="beta",g="alpha",f="gamma"),s={periodicity:c,viewRotation:{alignments:[["right",p],["up",m]],rotations:[[1,0,0,-20]]}},i={[v]:{enabled:!0,label:"γ"},[g]:{enabled:!1},[f]:{enabled:!1},[p]:{enabled:!0,label:"a",color:"#C52929"},[m]:{enabled:!0,label:"b",color:"#47A823"},[y]:{enabled:!1,label:"c",color:"#3B5796"}}}else if(1===n){let t,n,l=a[0];for(let e=0;e<3;++e)if(e===l){t=(e+1)%3,n=(e+2)%3;break}const r=15,o=d(e.cell[l],r),h=[1,1,1];h[l]=o;const c=["a","b","c"],u=c[l],p=c[t];s={periodicity:h,viewRotation:{alignments:[["right",u],["up",p]],rotations:[[0,1,0,-20],[1,0,0,20]]}},i={alpha:{enabled:!1},beta:{enabled:!1},gamma:{enabled:!1},[u]:{enabled:!0,label:"a",color:"#C52929"},[p]:{enabled:!1},[c[n]]:{enabled:!1}}}else s={periodicity:"boundary",viewRotation:{alignments:[["up","c"],["right","b"]],rotations:[[0,1,0,60],[1,0,0,30]]}},i={a:{enabled:!0,color:"#C52929",label:"a"},b:{enabled:!0,color:"#47A823",label:"b"},c:{enabled:!0,color:"#3B5796",label:"c"},alpha:{enabled:!0,color:"#ffffff",label:"α"},beta:{enabled:!0,color:"#ffffff",label:"β"},gamma:{enabled:!0,color:"#ffffff",label:"γ"}};this.viewer.setOptions({layout:s,latticeConstants:i},!1),this.viewer.load(e),this.viewer.saveReset(),this.createElementLegend()}resizeCanvasToHostElement(){this.viewer.resizeCanvasToHostElement()}setMaterialId(e){}changeHostElement(e){this.hostElement!==e&&(this.hostElement.removeChild(this.legendElement),this.hostElement.removeChild(this.footerElement),this.hostElement=e,this.viewer.changeHostElement(e),this.hostElement.appendChild(this.legendElement),this.hostElement.appendChild(this.footerElement)),this.viewer.resizeCanvasToHostElement(),this.viewer.reset(),this.viewer.fitToCanvas(),this.viewer.saveReset(),this.viewer.render()}getCellDataForViewer(e){return{pbc:e.periodicity,species:e.atom_labels,cell:n.convert2d(e.lattice_vectors,1e10),positions:e.atom_positions,fractional:!0}}createElementLegend(){this.labelsContainer.innerHTML="";let e=this.viewer.elements,t=[];for(let s in e)e.hasOwnProperty(s)&&t.push([s,e[s][0],e[s][1]]);t.sort((function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0}));let s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width",50),s.setAttribute("height",25*t.length),this.labelsContainer.appendChild(s);for(let e=0;e<t.length;++e){let n=t[e][0],a=t[e][1];i.addCircle(s,10,25*e+12,8,a,"#777",1),i.addText(s,24,25*e+18,n,"start","structure-viewer-legend-labels")}}}e.exports=class{constructor(){this.element=document.createElement("div"),this.element.setAttribute("id","material-module"),this.missingPrompt=document.createElement("div"),this.missingPrompt.id="missing-prompt",this.element.appendChild(this.missingPrompt),this.overview=new a,this.overview.attachAndSetEvents(this.element),this.structureViewer=new m(this.overview.vizBox),this.structureDetails=new l,this.structureDetails.attachAndSetEvents(this.element),this.electronicStructDetails=new r,this.electronicStructDetails.attachAndSetEvents(this.element),this.methodologyDetails=new o,this.methodologyDetails.attachAndSetEvents(this.element),this.thermalDetails=new d,this.thermalDetails.attachAndSetEvents(this.element),this.elasticDetails=new h,this.elasticDetails.attachAndSetEvents(this.element),this.currentDetailView=null}setMaterialView(e){this._loadMaterial(e.material_id,e.view)}getCurrentPageStatus(){let e=null;return null===this.currentDetailView&&(e=this.overview.getEStructChosenCalcs()),{pageId:this.currentDetailViewId,eStructCalcs:e}}_setView(e){null===this.currentDetailView?this.overview.element.style.display="none":this.currentDetailView.element.style.display="none",void 0===e?(this.currentDetailView=null,this.currentDetailViewId=null,this.overview.setVisible()):(this.currentDetailViewId=e,this._setDetailView(n.MAT_VIEW[e]))}_setCellViewer(e){this.structureViewer.changeHostElement(e)}_setDetailView(e){e===n.MAT_VIEW.structure?this.currentDetailView=this.structureDetails:e===n.MAT_VIEW.electronicstruct?this.currentDetailView=this.electronicStructDetails:e===n.MAT_VIEW.methodology?this.currentDetailView=this.methodologyDetails:e===n.MAT_VIEW.thermalprops&&(this.currentDetailView=this.thermalDetails),this.currentDetailView.setVisible()}_loadMaterial(e,t){let s=()=>{const s=document.getElementById("missing-prompt");if(c.getMissing()){null===this.currentDetailView?this.overview.element.style.display="none":this.currentDetailView.element.style.display="none";const t=`\n          Could not find information for material with identifier ${e}.\n          Either the material does not exist or is not yet visible in the Encyclopedia.\n        `;s.textContent=t,s.style.display="block"}else{s.style.display="none",this._setView(t);let e=c.getMaterialData();c.getIdealizedStructure(),null!==this.currentDetailView?(this.currentDetailView.load(),t===n.MAT_VIEW.structure&&this._setCellViewer(this.structureDetails.vizBox),t===n.MAT_VIEW.methodology&&this.methodologyDetails.updateSelection()):(document.querySelector("title").innerHTML="NOMAD Encyclopedia - "+n.getMaterialTitle(e,!1),this.overview.setMaterialData(),null===e.material_name?e.formula:e.material_name,this.overview.setCalcsData(p),this._setCellViewer(this.overview.vizBox))}},i=()=>{let t=c.isReady(e);return t&&s(),t};i()||(c.clear(),this.overview.clearCalcsData(),u.reset(),this.structureViewer.axisCheckbox.checked=!0,this.structureViewer.bondsCheckbox.checked=!0,document.getElementById("methodology-ov").style.visibility="hidden",document.getElementById("structure-ov").style.visibility="hidden",document.getElementById("e-structure-ov").style.display="none",document.getElementById("e-structure-ov").style.visibility="hidden",document.getElementById("thermal-props-ov").style.visibility="hidden",u.show("load_basic"),n.serverReq(n.getMaterialURL(e),(t=>{let s=t.target.status;if(s>=400&&s<500)c.setMissing(!0),c.setMaterialData({material_id:e});else{let e=JSON.parse(t.target.response);c.setMaterialData(e),n.materialId=e.material_id}i(),u.hide("load_basic")})),u.show("load_calculations"),n.serverReq(n.getMaterialXsURL("calculations",e),(t=>{let s=t.target.status;if(s>=400&&s<500)c.setMissing(!0);else{let s=JSON.parse(t.target.response),a=s.representatives.idealized_structure;c.setCalculations(s);let l=JSON.stringify({properties:["idealized_structure"]});u.show("load_idealized"),n.serverReqPOST(n.getMaterialCalcURL(e,a),l,(e=>{let t=e.target.status;if(t>=400&&t<500)c.setMissing(!0);else{let t=JSON.parse(e.target.response).idealized_structure;c.setIdealizedStructure(t),this.structureViewer.load(t),document.getElementById("structure-ov").style.visibility="visible",document.getElementById("methodology-ov").style.visibility="visible"}i(),u.hide("load_idealized")}))}u.hide("load_calculations")})),u.show("load_groups"),n.serverReq(n.getMaterialXsURL("groups",e),(e=>{let t=e.target.status;if(t>=400&&t<500)c.setMissing(!0);else{let t=JSON.parse(e.target.response);c.setGroups(t)}i(),u.hide("load_groups")})))}}},650:(e,t,s)=>{"use strict";let i=s(155),n=s(212),a=s(223),l=s(719),r=s(101);var o=window.location,d=o.protocol+"//"+o.host+"/"+o.pathname;let h=d.slice(0,d.lastIndexOf("/",d.lastIndexOf("/")-1))+"/gui/entry/id";const c=new Map([["single point","Single point"],["GW calculation","GW"],["geometry optimization","Geometry optimization"],["molecular dynamics","Molecular dynamics"],["phonon calculation","Phonon"],["equation of state","Equation of state"],["parameter variation","Parameter variation"],["QHA calculation","QHA"]]);class u{constructor(e){this.element=document.createElement("div"),this.element.className=e,this.filtersOn=[],this.folded=!0,this.element.innerHTML+=`\n      <div style="padding: 0rem 2.5rem">\n        <div style="display: flex; justify-content: flex-end;">\n          <div class="filter-groups-c-folded" >\n            <span style="vertical-align: top;">Filtering &nbsp;&nbsp;</span>\n          </div>\n          <div class="filter-c-btn" >\n             <img src="${n.IMAGE_DIR}folded.png" />\n            \x3c!--<button class="on">filter</button> --\x3e\n          </div>\n        </div>\n        <div class="filter-groups-c-unfolded" style="display: none; padding-bottom: 1rem">\n          <table style="width: 100%;">\n            <thead>\n            <tr>\n              <th style="width: 20%;">\n                <span>Type</span>\n              </th>\n              <th style="width: 20%;">\n                <span info-sys-data="functional-type">Density functional</span>\n              </th>\n              <th style="width: 20%;">\n                <span info-sys-data="code-name">Code</span>\n              </th>\n              <th style="width: 20%;">\n                <span info-sys-data="pseudopotential-type">Potential</span>\n              </th>\n              <th style="width: 20%;">\n                <span info-sys-data="basis-set-type">Basis set</span>\n              </th>\n            </tr>\n            </thead>\n            <tbody>\n              <tr id="filter-items-row"></tr>\n            </tbody>\n          </table>\n        </div>\n      </div>\n    `,this.unfoldedPanel=this.element.querySelector(".filter-groups-c-unfolded"),this.filterItemsRow=this.element.querySelector("#filter-items-row"),this.foldBtn=this.element.querySelector("img"),this.foldBtn.addEventListener("click",(e=>{this.folded=!this.folded,this.foldBtn.src=this.folded?n.IMAGE_DIR+"folded.png":n.IMAGE_DIR+"unfolded.png",this.unfoldedPanel.style.display=this.folded?"none":"block"})),this.element.addEventListener("click",(e=>{if("INPUT"===e.target.tagName){let t=this.filtersOn.indexOf(e.target.value);t>=0?this.filtersOn.splice(t,1):this.filtersOn.push(e.target.value),this.itemListener(this.filtersOn)}}))}addGroupsItems(e){let t=new Map,s=new Map,i=new Map,n=new Map,a=new Map;e.forEach((e=>{t.has(e.type)||t.set(e.type,c.get(e.type)),s.has(e.functional_type)||s.set(e.functional_type,e.functional_type),i.has(e.code)||i.set(e.code,e.code),n.has(e.core_electron_treatment)||n.set(e.core_electron_treatment,e.core_electron_treatment),a.has(e.basis_set_type)||a.set(e.basis_set_type,e.basis_set_type)})),this.filterItemsRow.innerHTML="",this.filtersOn=[],this.addGroupItems(t),this.addGroupItems(s),this.addGroupItems(i),this.addGroupItems(n),this.addGroupItems(a)}addGroupItems(e){let t="<td>  ";e.forEach(((e,s)=>{this.filtersOn.push(s),t+='<input type="checkbox" value="'+s+'" checked><span style="vertical-align: 20%">'+e+"</span> &nbsp;&nbsp; <br> "})),this.filterItemsRow.innerHTML+=t+"</td>"}setItemListener(e){this.itemListener=e}}function p(e){return null==e?"":"("+e+")"}e.exports=class extends i{constructor(){super("Methodology"),this.sortedCalcs=[],this.markedCalc=null,this.element.innerHTML+='\n\n      <div>\n        <div class="view-box">\n          <div class="title">Methodology</div>\n\n          <div class="filter-placeholder"></div>\n\n          <div class="dataTableWrapper"></div>\n        </div>\n      </div>\n    ',this.dataTableWrapper=this.element.querySelector(".dataTableWrapper"),this.dataTableWrapper.innerHTML+='\n      <table id="methodology-data">\n        <thead>\n        <tr>\n          <th style="width: 12%;">\n            <span>Calculation ID</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 16%;">\n            <span>Type</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 18%;">\n            <span info-sys-data="functional-type">Density functional</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 12%;">\n            <span info-sys-data="code-name">Code</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 16%;">\n            <span info-sys-data="pseudopotential-type">Potential</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 11%;">\n            <span info-sys-data="basis-set-type">Basis set</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 4%;">\n            <span info-sys-data="basis-set-type">Link</span>\n          </th>\n        </tr>\n        </thead>\n        <tbody>\n        </tbody>\n      </table>\n    ',this.tbody=this.dataTableWrapper.querySelector("tbody"),this.moreInfoRow=document.createElement("tr"),this.moreInfoRow.className="moreinfo",this.moreInfoCalcId=null,this.filterComponent=new u("meth-filter-component"),this.element.querySelector(".filter-placeholder").appendChild(this.filterComponent.element),this.filterComponent.setItemListener((e=>{this.sortedCalcs.forEach((t=>{let s=t.dataCalcProps.split(","),i=!0;s.forEach((t=>{e.indexOf(t)<0&&(i=!1)})),t.visible=!!i})),this._render()})),this.sortingButtonWrappers=this.dataTableWrapper.querySelectorAll(".sorting-button"),this.sortingButtons=[];let e=new Map([["calc_id",void 0],["type",void 0],["functional_type",void 0],["code",void 0],["core_electron_treatment",void 0],["basis_set_type",void 0]]).keys();this.sortingButtonWrappers.forEach((t=>{let s=e.next().value,i=new r(s);t.appendChild(i.element),this.sortingButtons.push(i),i.setListener(((e,t)=>{this.sortingButtons.forEach((e=>{e!==i&&e.init()})),this._sortRowsCalcDataBy(e,t),this._render()}))})),a.addToInfoSystem(this.element)}updateSelection(e){this.sortedCalcs=[],l.getCalculations().forEach((e=>{let t=e.run_type;l.getGroups().has(e.calc_id)&&(t=l.getGroupType(e.calc_id)),this.sortedCalcs.push({calc_id:e.calc_id,type:t,functional_type:e.functional_type,code:e.code_name,core_electron_treatment:e.core_electron_treatment,basis_set_type:e.basis_set_type,dataCalcProps:t+","+e.functional_type+","+e.code_name+","+e.core_electron_treatment+","+e.basis_set_type,visible:!0})})),this.filterComponent.addGroupsItems(this.sortedCalcs),this._sortRowsCalcDataBy(!0,"calc_id"),this._render()}_sortRowsCalcDataBy(e,t){this.sortedCalcs.sort(((s,i)=>{let n=e?-1:1;return s[t]<i[t]?n:-n}))}updateMarkedLeaf(e){}_render(){let e="";this.sortedCalcs.forEach((t=>{t.visible&&(e+=function(e){let t=l.getCalc(e.calc_id),s=e.type,i=`<a href="${h}/${t.upload_id}/${t.calc_id}" target="blank"><img src="img/download.svg" height="20px" /> </a>`,a=`<a href="https://labdev-nomad.esc.rzg.mpg.de/remotevis/cM/start/${l.getMaterialData().material_id}+${t.calc_id}" target="blank"><img src="img/monitor_icon.png" height="20px" /> </a>`;return`\n        <tr data-calc-id="${t.calc_id}" class="data-row">\n        <td>${n.getShortCode(t.calc_id)}</td>\n        <td>\n          <span info-sys-data="calculation-type.value:${s}">\n          ${s}</span>\n        </td>\n        <td>\n          <span info-sys-data="functional-type.value:${e.functional_type}">\n            ${e.functional_type}</span>\n          ${p(t.functional_long_name)}\n        </td>\n        <td>\n          <span info-sys-data="code-name.value:${t.code_name}">\n            ${t.code_name}</span>\n           ${p(t.code_version)}\n        </td>\n\n        <td>\n          <span info-sys-data="core-electron-treatment.value:${e.core_electron_treatment}">\n          ${e.core_electron_treatment}</span>\n        </td>\n        <td>\n          <span info-sys-data="basis-set-type.value:${t.basis_set_type}">\n            ${t.basis_set_type}</span>\n           ${p(t.basis_set_quality_quantifier)}\n        </td>\n\n        <td style="padding-top: 8px;padding-bottom: 4px;">${i}\n        </td>\n\n        \x3c!--\n        <td style="padding-top: 8px;padding-bottom: 4px;">${a}\n        </td>--\x3e\n\n        </tr>`}(t))})),this.tbody.innerHTML=e,a.addToInfoSystem(this.tbody)}}},414:(e,t,s)=>{"use strict";let i=s(212),n=s(719);function a(e,t){if(e.className.indexOf("material-l")>=0)return;let s=e.parentElement;for(let t=0;t<s.children.length;t++){let i=s.children[t++];if(i!==e&&i.className.indexOf("selected")<0)return}let i=s.previousElementSibling;if(t)i.className+=" node-selected";else{let e=i.className.indexOf(" node-selected");i.className=i.className.substring(0,e)}a(i,t)}e.exports=class{constructor(){this.selectedCalcs=new Set,this.element=document.createElement("div"),this.element.setAttribute("id","navigation-tree"),this.parentElement=null,this.markedNode=null,this._events()}attach(e){null!==this.parentElement&&this.parentElement.removeChild(this.element),this.parentElement=e,this.parentElement.appendChild(this.element)}build(e,t){function s(e,t,s,i=0){let n="node-"+(s?"unfolded":"folded"),a=document.createElement("div");a.className=e;let l=document.createElement("span");l.className=n,a.appendChild(l);let r=document.createElement("span");r.className="node-checkbox",a.appendChild(r);let o=document.createElement("span");if(o.className="node-label",o.textContent=t,a.appendChild(o),0!==i){let e=document.createElement("span");e.className="node-counter",e.textContent="("+i+")",a.appendChild(e)}return a}function a(e,t,s,n,a){let l=document.createElement("div");l.className="calc-l",l.setAttribute("data-calc-id",e);let r=document.createElement("span");l.appendChild(r);let d=document.createElement("span");d.className="node-checkbox",l.appendChild(d);let h=document.createElement("span");h.className="node-label",n&&h.appendChild(o),h.textContent=t+s+" ",h.appendChild(a),l.appendChild(h);let c=document.createElement("div");c.id="icon-container",c.style.float="right",c.style.padding="1px 10px 0 0",c.style.display="none";let u=document.createElement("img");return u.setAttribute("src",i.IMAGE_DIR+"next.png"),c.appendChild(u),l.appendChild(c),l}function l(e){let t=document.createElement("div");t.className="calc-graph-aval";let s=document.createElement("span");if(e.has_band_structure){let e=document.createElement("span");e.className="tooltip",e.textContent="B";let t=document.createElement("span");t.className="tooltiptext",t.textContent="Band structure",e.appendChild(t),s.appendChild(e)}if(e.has_dos){let e=document.createElement("span");e.className="tooltip",e.textContent="D";let t=document.createElement("span");t.className="tooltiptext",t.textContent="Density of states",e.appendChild(t),s.appendChild(e)}if(e.has_fermi_surface){let e=document.createElement("span");e.className="tooltip",e.textContent="F";let t=document.createElement("span");t.className="tooltiptext",t.textContent="Fermi surface",e.appendChild(t),s.appendChild(e)}if(e.has_thermal_properties){let e=document.createElement("span");e.className="tooltip",e.textContent="T";let t=document.createElement("span");t.className="tooltiptext",t.textContent="Phonons",e.appendChild(t),s.appendChild(e)}return t.appendChild(s),t}this.selectedCalcs.clear(),this.markedNode=null,this.element.innerHTML="",this.calcsInGroups=n.getGroups();let r=n.getCalculations(),o=document.createElement("img");o.className="folder-icon",o.src=i.IMAGE_DIR+"folder.png";let d=function(e,t,s){let i=new Map;function a(e,t){e.forEach(((e,s)=>{let a=n.getCalc(e[0]),l=a.code_name.trim(),r=a.functional_type;if("exciting"===l)if(i.has(r)){let e=i.get(r);e.has(l)?e.get(l).push(t+s):e.set(l,[t+s])}else if("unavailable"!==r){let e=new Map;e.set(l,[t+s]),i.set(r,e)}}))}function l(e,t){let s=e.code_name.trim(),n=e.functional_type;if(i.has(n)){let e=i.get(n);e.has(s)?e.get(s).push(t):e.set(s,[t])}else{let e=new Map;e.set(s,[t]),i.set(n,e)}}return"structure"===s&&(a(t.get("eos"),"eos/"),a(t.get("par"),"par/")),e.forEach((e=>{n.isInAnyNotDisabledGroup(e.calc_id)||("electronic"===s?(e.has_dos||e.has_band_structure)&&l(e,e.calc_id):"thermal"===s?e.has_thermal_properties&&l(e,e.calc_id):l(e,e.calc_id))})),i}(r,this.calcsInGroups,t),h=document.createElement("div");h.appendChild(s("material-l",e,!0));let c=document.createElement("div");h.appendChild(c),d.forEach(((e,t)=>{c.appendChild(s("functional-l",t,!0));let r=document.createElement("div");c.appendChild(r),e.forEach(((e,t)=>{r.appendChild(s("code-l",t,!1,e.length));let o=document.createElement("div");r.appendChild(o),o.style.display="none";for(var d=0;d<e.length;d++){let t=e[d],s="",r=i.getShortCode(t),h=n.isGroup(t);if(h){let e,i=n.getGroupType(t),a=t.substring(4);e=this.calcsInGroups.get(i).get(a),s="("+e.length+")"}let c=n.getReprCalc(t),u=a(t,r,s,h,l(n.getCalc(c)));o.appendChild(u),o.appendChild(document.createElement("div"))}}))})),this.element.appendChild(h),this.showCalcsGraphDataAvailability("structure"!==t)}selectAll(e){let t=this.element.children[0].children[0];this._recursiveNodeSelection(t,!0),a(t,!0)}getMarkedLeaf(){return null===this.markedNode?null:this.markedNode.getAttribute("data-calc-id")}setMarkedLeafIfNoneMarked(e){if(null===this.getMarkedLeaf())if(null===e)this._markFirstSelectedNode();else{let t=this.element.querySelector('div[data-calc-id="'+e+'"]');this._setMarkedCalc(t)}}_events(){this.element.addEventListener("click",(e=>{let t=e.target.className;if(t.indexOf("folded")>=0)this._foldTreeNode(e.target);else if(t.indexOf("node-checkbox")>=0){let t=e.target.parentElement.className.indexOf("selected")<0;this._recursiveNodeSelection(e.target.parentElement,t),a(e.target.parentElement,t),this.treeSelectionListener(this.selectedCalcs),this._keepCalcMarked(t)}else t.indexOf("node-label")>=0&&"calc-l node-selected"===e.target.parentElement.className&&this._setMarkedCalc(e.target.parentElement)}))}_foldTreeNode(e){let t=e.parentElement.nextElementSibling;e.className.indexOf("-folded")>=0?(e.className=e.className.replace("folded","unfolded"),t.style.display="block"):(e.className=e.className.replace("unfolded","folded"),t.style.display="none")}_recursiveNodeSelection(e,t){if(e.children[1],t)e.className+=" node-selected";else{let t=e.className.indexOf(" node-selected");e.className=e.className.substring(0,t)}if(e.className.indexOf("calc-l")>=0){let s=e.getAttribute("data-calc-id");t?this.selectedCalcs.add(s):this.selectedCalcs.delete(s)}else{let s=e.nextElementSibling;for(let e=0;e<s.children.length;e++)this._recursiveNodeSelection(s.children[e++],t)}}setTreeSelectionListener(e){this.treeSelectionListener=e}setLeafMarkedListener(e){this.leafMarkedListener=e}getTreeSelectedCalcs(){return this.selectedCalcs}_keepCalcMarked(e){if(e&&null===this.markedNode)this._markFirstSelectedNode();else if(!e){let e=parseInt(this.markedNode.getAttribute("data-calc-id"));0===this.selectedCalcs.size?(this.markedNode.className=this.markedNode.className.replace("-marked",""),this.markedNode=null,this.leafMarkedListener(null)):this.selectedCalcs.has(e)||this._markFirstSelectedNode()}}_markFirstSelectedNode(){let e=this.element.getElementsByClassName("calc-l");for(var t=0;t<e.length;t++)if(e[t].className.indexOf("node-selected")>=0)return void this._setMarkedCalc(e[t])}_setMarkedCalc(e){if(null!==this.markedNode){this.markedNode.className=this.markedNode.className.replace("-marked",""),this.markedNode.querySelector("#icon-container").style.display="none";let e=this.markedNode.querySelector(".folder-icon");null!==e&&(e.src=i.IMAGE_DIR+"folder.png")}e.className+="-marked";let t=e.querySelector(".folder-icon");null!==t&&(t.src=i.IMAGE_DIR+"folder-sel.png"),e.querySelector("#icon-container").style.display="block",this.markedNode=e;let s=e.parentElement.previousElementSibling.firstElementChild;"node-folded"===s.className&&(s.className="node-unfolded",s.parentElement.nextElementSibling.style.display="block"),void 0!==this.leafMarkedListener&&this.leafMarkedListener(e.getAttribute("data-calc-id"))}showCalcsGraphDataAvailability(e){let t=this.element.getElementsByClassName("calc-graph-aval");for(var s=0;s<t.length;s++)t[s].style.display=e?"inline":"none"}setHeight(e){this.element.style.height=e+"px"}}},576:(e,t,s)=>{"use strict";let i=s(212),n=s(223),a=s(317),l=s(507),r=s(94),o=s(195),d=(s(95),s(719)),h=s(39).SimilarityFinder;e.exports=class{constructor(){this.element=document.createElement("div"),this.element.setAttribute("id","overview"),this.materialId,this.calcMaterialId=null,this.element.innerHTML='\n\n    <div class="material-title">\n    </div>\n\n    <div style="float: left; width: 40%;">\n\n      <div id="structure-ov" class="view-box">\n        <div class="title">Structure\n          <img style="float: right" class="to-detail" src="img/more.svg" />\n          <div style="clear: both;"></div>\n        </div>\n\n        <div class="viz-box-container" style="height: 260px; position: relative">\n          <div class="viz-box" style="height: 90%"></div>\n        </div>\n\n        <div class="footer">\n          <div ><b><span>Material type</span></b>:\n            <span class="material-type-field" ></span>\n          </div>\n          <div class="space-group-field" style="display: none">\n            <b><span info-sys-data="space_group_number">Space group</span></b>:\n            <span class="space-group-value" ></span>\n          </div>\n          <div class="structure-type-field" style="display: none">\n            <b><span info-sys-data="structure_type">Structure type</span></b>:\n            <span class="structure-type-value" ></span>\n          </div>\n        </div>\n      </div>\n\n\n\x3c!-- ***** Elastic Constants Box\n\n      <div id="elastic-ov" class="view-box">\n        <div class="title">Elastic constants\n          <img style="float: right" class="to-detail" src="img/more.svg" />\n          <div style="clear: both;"></div>\n        </div>\n\n        <div class="info-fields">\n          Not analyzed yet\n        </div>\n\n      </div>\n--\x3e\n\n\n      <div id="methodology-ov" class="view-box">\n        <div class="title">Methodology\n          <img style="float: right" class="to-detail" src="img/more.svg" />\n          <div style="clear: both;"></div>\n        </div>\n\n        <div class="info-fields">\n\n          <div class="info-fields-label" > Available calculations </div>\n\n          <div style="float: left; width: 45%" >\n            <b><span info-sys-data="functional_type">Functional</span></b>\n            <div class="functional-field" > </div>\n          </div>\n          <div style="float: right; width: 45%" >\n            <b><span info-sys-data="code_name">Code</span></b>\n            <div class="code-field"> </div>\n           </div>\n           <div style="clear: both;"></div>\n        </div>\n\n      </div>\n\n    </div>\n\n    <div style="float: right; width: 60%;">\n\n      <div id="e-structure-ov" class="view-box" style="display: block">\n        <div class="title">Electronic structure\n          <img style="float: right" class="to-detail" src="img/more.svg" />\n          <div style="clear: both;"></div>\n        </div>\n\n        <div > \x3c!-- style="margin: 12% 0; " --\x3e\n\n        <div style="float: left; width: 60%;  ">\n        <div style="padding: 20px 0 20px 30px">\n          <div  class="info-fields-label">\n            <span info-sys-data="band-structure">Band structure</span>\n          </div>\n          <div>\n              <div id="band-plotter" >  </div>\n          </div>\n\n          <div class="footer-bs-calc"></div>\n        </div>\n        </div>\n\n        <div style="float: left; width: 40%;  ">\n          <div style="padding: 20px 30px 20px 40px">\n            <div class="info-fields-label">\n              <span info-sys-data="DOS">DOS</span>\n            </div>\n\n            <div>\n                <div id="dos-plotter" >  </div>\n            </div>\n            <div class="footer-dos-calc"></div>\n          </div>\n        </div>\n\n\n\n        <div style="clear: both;"></div>\n        <table style="width: 100%">\n        <tr>\n          <td class="spin-legend" style="font-size: 0.9em; padding: 6px 30px 10px; display: none;">\n            <svg width="15px" height="10px"> <polyline points="0,5 15,5" class="plotSpin1"/></svg>\n              Spin <span style=\'font-size: 1.1em\'>⇧</span>  &nbsp;&nbsp;&nbsp;\n\n              <svg width="15px" height="10px"> <polyline points="0,5 15,5" class="plotSpin2"/></svg>\n              Spin <span style=\'font-size: 1.1em\'>⇩</span>\n          </td>\n          <td class = "similarity-data-field">\n          <div style="float: right; padding: 0px 50px 10px 0px; margin-top: 1px;" class="similarity-finder">\n          </div>\n          </td>\n          </tr>\n          </table>\n        </div>\n        <div style="clear: both;"></div>\n        \x3c!--\n        <div class="footer">\n\n          <b>Band gap</b>: <span class="e-struct-field" ></span>\n        </div>\n        --\x3e\n      </div>\n\n      <div id="thermal-props-ov" class="view-box" style="visibility: hidden">\n        <div class="title">Vibrational and thermal properties\n          <img style="float: right" class="to-detail thermal-props" src="img/more.svg" />\n          <div style="clear: both;"></div>\n        </div>\n\n        <div style="padding: 36px; ">\n          <div class="info-fields-label">\n            <span info-sys-data="heat-capacity-cv">Specific heat</span>\n          </div>\n\n\n          <div>\n              <div id="heat-plotter" >  </div>\n          </div>\n          <div class="footer-heat-calc" style="text-align: center"></div>\n        </div>\n\n      </div>\n\n    </div>\n\n    <div style="clear: both;"></div>\n    ',this.materialTitle=this.element.getElementsByClassName("material-title")[0],this.systemType=this.element.querySelector(".material-type-field"),this.spaceGroupField=this.element.querySelector(".space-group-field"),this.spaceGroupValue=this.element.querySelector(".space-group-value"),this.structTypeField=this.element.querySelector(".structure-type-field"),this.structTypeValue=this.element.querySelector(".structure-type-value"),this.functional=this.element.querySelector(".functional-field"),this.code=this.element.querySelector(".code-field");let e=this.element.getElementsByClassName("to-detail");this.structureDetailBtn=e[0],this.electronicStructDetailBtn=e[2],this.methodologyDetailBtn=e[1],this.thermalDetailBtn=e[3],this.vizBox=this.element.getElementsByClassName("viz-box")[0],this.bandPlotter=null,this.bsCalcIdBox=this.element.getElementsByClassName("footer-bs-calc")[0],this.dosPlotter=null,this.dosCalcIdBox=this.element.getElementsByClassName("footer-dos-calc")[0],this.heatPlotter=null,this.heatCalcIdBox=this.element.querySelector(".footer-heat-calc"),this.spinLegend=this.element.querySelector(".spin-legend"),n.addToInfoSystem(this.element),this.eStructCalcs={bs:null,dos:null}}attachAndSetEvents(e){e.appendChild(this.element),this._events()}_events(){this.structureDetailBtn.addEventListener("click",(e=>{i.setBrowserHashPath("material",this.materialId+"/"+i.MAT_VIEW.structure)})),this.electronicStructDetailBtn.addEventListener("click",(e=>{i.setBrowserHashPath("material",this.materialId+"/"+i.MAT_VIEW.electronicstruct)})),this.methodologyDetailBtn.addEventListener("click",(e=>{i.setBrowserHashPath("material",this.materialId+"/"+i.MAT_VIEW.methodology)})),this.thermalDetailBtn.addEventListener("click",(e=>{i.setBrowserHashPath("material",this.materialId+"/"+i.MAT_VIEW.thermalprops)}))}getEStructChosenCalcs(){return this.eStructCalcs}setDetailViewsListener(e){this.detailViewsListener=e}setVisible(){this.element.style.display="block"}setMaterialData(){let e=d.getMaterialData();this.materialTitle.innerHTML=i.getMaterialTitle(e),this.materialId=e.material_id;let t="bulk"===e.material_type;if(this.systemType.textContent=e.material_type,this.structTypeField.style.display=t&&null!==e.structure_type?"block":"none",this.spaceGroupField.style.display=t?"block":"none",t&&(this.structTypeValue.textContent=e.structure_type,this.spaceGroupValue.textContent=e.space_group_number+" ("+e.space_group_international_short_symbol+")",n.addElementToInfoSystem(this.spaceGroupValue,"space_group_number.value:"+e.space_group_number)),this.similarityFinder&&this.similarityFinder.element.remove(),e.similarity){this.similarityFinder=new h({left:40,right:16,top:0,bottom:30});const t=this.element.querySelector(".similarity-finder");this.similarityFinder.setSimilarityData(e.similarity),t.appendChild(this.similarityFinder.element),this.similartyDataField=this.element.querySelector(".similarity-data-field"),n.addToInfoSystem(this.similartyDataField)}}isLoaded(e,t,s){let i=d.getMaterialData().material_id;return!(this.calcMaterialId!==i||e&&!this.bsLoaded||t&&!this.dosLoaded||s&&!this.phononLoaded)}clearCalcsData(){this.materialId=null,this.calcMaterialId=null}setCalcsData(e){let t=d.getMaterialData(),s=d.getCalculations(),h=new Map,c=new Map,u=d.getCalc(d.getRepresentatives().electronic_band_structure),p=d.getCalc(d.getRepresentatives().electronic_dos),m=d.getCalc(d.getRepresentatives().thermodynamical_properties);if(this.isLoaded(void 0!==u,void 0!==p,void 0!==m))return;this.calcMaterialId=t.material_id,this.bsLoaded=!1,this.dosLoaded=!1,this.phononLoaded=!1;for(let e=0;e<s.length;e++){if(h.has(s[e].functional_type)){let t=h.get(s[e].functional_type);h.set(s[e].functional_type,++t)}else h.set(s[e].functional_type,1);let t=s[e].code_name.trim();if(c.has(t)){let e=c.get(t);c.set(t,++e)}else c.set(t,1)}void 0!==u&&(this.eStructCalcs.bs=u.calc_id),void 0!==p&&(this.eStructCalcs.dos=p.calc_id);let y=null;void 0!==u?y=u.calc_id:void 0!==p&&(y=p.calc_id),e.eStruct=null===y?null:+y,e.thermalProps=void 0===m?null:+m.calc_id,this.functional.textContent="";let v=document.createElement("div");h.forEach(((e,t)=>{let s=document.createElement("span");s.setAttribute("info-sys-data","functional_type.value:"+i.getDefault(t)),s.textContent=e+" "+i.getDefault(t),v.appendChild(s);let n=document.createElement("br");v.appendChild(n)})),this.functional.append(v),n.addToInfoSystem(this.functional),this.code.textContent="";let g=document.createElement("div");if(c.forEach(((e,t)=>{let s=document.createElement("span");s.setAttribute("info-sys-data","code_name.value:"+t),s.textContent=e+" "+t,g.appendChild(s);let i=document.createElement("br");g.appendChild(i)})),this.code.append(g),n.addToInfoSystem(this.code),d.hasElecStructureData()){document.getElementById("e-structure-ov").style.display="block";let e=()=>{this.dosLoaded&&this.bsLoaded&&(document.getElementById("e-structure-ov").style.visibility="visible")};if(null===this.bandPlotter&&(this.bandPlotter=new l,this.bandPlotter.attach(document.getElementById("band-plotter"),void 0,316)),null===this.dosPlotter&&(this.dosPlotter=new r({left:40,right:20,top:0,bottom:30}),this.dosPlotter.attach(document.getElementById("dos-plotter"),void 0,317)),void 0===u)this.bandPlotter.setNoData(),this.bsCalcIdBox.innerHTML="",this.bsLoaded=!0;else{let t=i.getMaterialCalcURL(this.materialId,u.calc_id);a.show("overview_electronic_band_structure");let s=JSON.stringify({properties:["electronic_band_structure"]});i.serverReqPOST(t,s,(t=>{if(200===t.target.status){let e=JSON.parse(t.target.response).electronic_band_structure;this.bandPlotter.setBandStructureData(e),this.bsCalcIdBox.innerHTML="From calculation <b>"+i.getShortCode(u.calc_id)+'</b><br><span style="font-size: 0.8em">('+u.functional_type+" - "+u.code_name+")</span>",2===e.section_k_band_segment[0].band_energies.length&&(this.spinLegend.style.display="block")}else this.bandPlotter.setNoData();this.bsLoaded=!0,e(),a.hide("overview_electronic_band_structure")}))}if(void 0===p)this.dosPlotter.setNoData(),this.dosCalcIdBox.innerHTML="",this.dosLoaded=!0;else{let t=i.getMaterialCalcURL(this.materialId,p.calc_id);a.show("overview_electronic_dos");let s=JSON.stringify({properties:["electronic_dos"]});i.serverReqPOST(t,s,(t=>{if(200===t.target.status){let e=JSON.parse(t.target.response).electronic_dos;this.dosPlotter.setPoints(e,p),this.dosCalcIdBox.innerHTML="From calculation <b>"+i.getShortCode(p.calc_id)+'</b><br><span style="font-size: 0.8em">('+p.functional_type+" - "+p.code_name+")</span>",2===e.dos_values.length&&(this.spinLegend.style.display="block")}else this.dosPlotter.setNoData();this.dosLoaded=!0,e(),a.hide("overview_electronic_dos")}))}}if(d.hasThermalData())if(document.getElementById("thermal-props-ov").style.display="block",null===this.heatPlotter&&(this.heatPlotter=new o,this.heatPlotter.attach(document.getElementById("heat-plotter"),void 0,317)),void 0===m)this.heatPlotter.setNoData(),this.heatCalcIdBox.innerHTML="";else{let e=i.getMaterialCalcURL(this.materialId,m.calc_id);a.show("overview_thermodynamical");let t=JSON.stringify({properties:["thermodynamical_properties"]});i.serverReqPOST(e,t,(e=>{if(200===e.target.status){let t=JSON.parse(e.target.response).thermodynamical_properties,s=t.thermodynamical_property_temperature;this.heatPlotter.setData(s,t.specific_heat_capacity),this.heatCalcIdBox.innerHTML="From calculation <b>"+i.getShortCode(m.calc_id)+'</b></b> <span style="font-size: 0.8em">('+m.functional_type+" - "+m.code_name+")</span>",this.phononLoaded=!0,document.getElementById("thermal-props-ov").style.visibility="visible"}a.hide("overview_thermodynamical")}))}else document.getElementById("thermal-props-ov").style.display="none"}}},828:(e,t,s)=>{let i=s(507),n=s(971),a=s(584),l=s(212);class r extends n{constructor(){super({left:4,right:16,top:0,bottom:30}),this.outOfRangeColorActivated=!1}attach(e,t,s){super.attach(e,s/2+this.margins.left,s)}setPoints(e){this.pointsSpin1=[],this.pointsSpin2=[],this._reset();let t=e.dos_values[0],s=null;2===e.dos_values.length&&(s=e.dos_values[1]);let i=e.dos_energies,n=[],r=[];for(var o=0;o<i.length;o++){let e,a=5034117012222e10*i[o],l=.029979*t[o];null!==s&&(e=.029979246*s[o]),n.push(l),null!==s&&n.push(e),r.push(a),this.pointsSpin1.push({x:l,y:a}),null!==s&&this.pointsSpin2.push({x:e,y:a})}let d=Math.max.apply(null,n),h=Math.max.apply(null,r),c=Math.min.apply(null,r),u=l.generateDiagramSteps(d),p=u[0],m=u[1];this.setAxisRangeAndLabels(null,0,p[p.length-1],null,-50,320,c,h,100),a.addText(this.axisGroup,this.plotRangeX/2,this.margins.bottom,"DOS (states/cm⁻¹)","middle","axis-steps-big");for(let e=0;e<p.length;e++){let t=this.plotRangeX*p[e]/p[p.length-1];a.addLine(this.axisGroup,t,0,t,3,1),a.addText(this.axisGroup,t,13,0===e?"0":p[e].toFixed(m),"middle","axis-steps-smaller")}this.repaint()}repaintData(){let e="";for(var t=0;t<this.pointsSpin1.length;t++)e+=" "+this.xRel*this.pointsSpin1[t].x+" "+this.transformY(this.pointsSpin1[t].y);for(a.addPolyline(this.plotContent,e,"plotSpin1"),e="",t=0;t<this.pointsSpin2.length;t++)e+=" "+this.xRel*this.pointsSpin2[t].x+" "+this.transformY(this.pointsSpin2[t].y);a.addPolyline(this.plotContent,e,"plotSpin2")}}e.exports=class{constructor(){this.element=document.createElement("div"),this.parentElement=null,this.dispPlotter=new i,this.dispPlotter.setPhononMode(),this.dosPlotter=new r}attach(e,t,s){e.appendChild(this.element),this.dispPlotter.attach(this.element,s,s),this.dosPlotter.attach(this.element,void 0,s),this.parentElement=e}isAttached(){return null!==this.parentElement}setUpAndData(e,t){this.hasDispData=null!=e,this.hasDosData=null!=t,this.hasDispData?(this.dispPlotter.setBandStructureData(e),this.hasDosData&&this.dispPlotter.setRepaintListener(((e,t)=>{this.dosPlotter.setYZoomAndOffset(e,t),this.dosPlotter.repaint()}))):this.dispPlotter.setNoData(),this.hasDosData?(this.dosPlotter.setPoints(t),this.hasDispData&&this.dosPlotter.setRepaintListener(((e,t)=>{this.dispPlotter.setYZoomAndOffset(e,t),this.dispPlotter.repaint()}))):this.dosPlotter.setNoData()}setNoData(){this.dispPlotter.setNoData(),this.dosPlotter.setNoData()}}},39:(e,t,s)=>{let i=s(212);e.exports={SimilarityFinder:class{constructor(){this.folded=!0,this.element=document.createElement("span"),this.element.style="float : right; border: 2px solid #DDD; padding: 2px 2px 0px 3px;",this.element.innerHTML+=`\n        <span info-sys-data="similar-materials" style="vertical-align: 30%;">Similar materials</span>\n        <img style="cursor: pointer" src="${i.IMAGE_DIR}folded.png" />\n\n      <div class="vr-download-panel" style="position: relative; display: none;">\n\n      </div>\n    `,this.element.tabIndex="0",this.element.style.outline="none",this.foldingPanel=this.element.querySelector(".vr-download-panel"),this.foldBtn=this.element.querySelector("img"),this.foldBtn.addEventListener("click",(e=>{this.folded=!this.folded,this.foldBtn.src=this.folded?i.IMAGE_DIR+"folded.png":i.IMAGE_DIR+"unfolded.png",this.foldingPanel.style.display=this.folded?"none":"block"})),this.element.addEventListener("blur",(e=>{setTimeout((()=>{this.folded=!0,this.foldBtn.src=i.IMAGE_DIR+"folded.png",this.foldingPanel.style.display="none"}),300)}))}setSimilarityData(e){e.sort((function(e,t){return e.value<t.value?1:e.value>t.value?-1:0}));const t=e.slice(0,5),s=document.createElement("table");s.setAttribute("class","similar-materials-panel-unfolded"),s.style="width: 230px; padding-left: 5px;",this.foldingPanel.appendChild(s);const n=document.createElement("tr");n.style="padding: 5px; ",n.innerHTML='<th style = "text-align: left;">Formula (space group)</th><th>:</th><th style = "text-align: left;">Tc</th>',s.appendChild(n),t.forEach((function(e){const t=document.createElement("tr");t.style="padding: 5px; font-family: 'Arimo', sans-serif; font-size: 10pt; ";const n=`${window.location.toString().replace(/#.*$/,"")}#/material/${e.material_id}`;t.innerHTML=`<td><a href="${n}" target="_${e.material_id}" style="color:#777; font-family: 'Arimo', sans-serif; font-size: 10pt;">${i.getSubscriptedFormula(e.formula)} (${e.space_group_number})</a></td><td>:</td> <td>${e.value.toPrecision(3)}</td>`,s.appendChild(t)}))}}}},101:(e,t,s)=>{s(212),e.exports=class{constructor(e){this.id=e,this.ascending=!0,this.element=document.createElement("span"),this.element.innerHTML+='\n       <img src="img/sorting_init.png" width="12px"\n        style="margin-bottom: -1px; cursor: pointer"/>\n    ',this.image=this.element.querySelector("img"),"id"===e&&this.image.setAttribute("src","img/sorting_ascending.png"),this.element.addEventListener("click",(e=>{this.ascending=!this.ascending,this.image.setAttribute("src","img/sorting_"+(this.ascending?"ascending":"descending")+".png"),this.listener(this.ascending,this.id)}))}init(){this.image.setAttribute("src","img/sorting_init.png")}setListener(e){this.listener=e}}},624:(e,t,s)=>{"use strict";let i=s(584),n=s(666);class a extends n{constructor(){super({left:54,right:20,top:20,bottom:30})}drawBars(e,t,s,n,a,l){for(let r=0;r<e.length;++r){let o,d=(t[r]-s)*this.xRel,h=e[r]*this.yRel;o=0==a?(n-s)/l*this.xRel:a*this.xRel,i.addRect(this.plotArea,d,-h,o,h,"bar")}}}e.exports=class{constructor(){this.freqGraph=new a}attach(e,t,s){this.freqGraph.attach(e,t,s)}drawPoints(e,t,s){let i,n,a,l=e.occurrences,r=e.values,o=Math.max(...l);if(1==r.length){let e=r[0];0!==e?(i=.9*e,n=1.1*e+.2*e/s):(i=0,n=e+1),a=0}else i=r[0],a=r[1]-r[0],n=r[r.length-1]+a;this.freqGraph.setRangeAndLabels(t,i,n,"Occurrence",0,o),this.freqGraph.drawAxis(n===i?null:5,2,i>1e3?0:2),this.freqGraph.drawBars(l,r,i,n,a,s)}clear(){this.freqGraph.clear()}}},763:(e,t,s)=>{"use strict";let i=s(155),n=s(212),a=s(223),l=s(414),r=s(370),o=s(624),d=s(290),h=s(719);class c{constructor(e){this.groupCalcs=null,this.element=document.createElement("div"),this.element.innerHTML='\n    <div>\n\n      <div class="group-components" style="display: none">\n        <div style="padding: 10px 0 30px 10px; " class="eos-host">\n        </div>\n\n        <div style="padding-top: 10px; " class="calc-selector-host">\n        </div>\n      </div>\n\n      <div class="info-fields">\n        <div><b>Lattice constants</b></div>\n        <div class="latt-constants"></div>\n        <div class="volume-field"><b><span info-sys-data="cell-volume">Volume</span></b>:\n          <span class="volume-value" ></span>\n        </div>\n        \x3c!-- <div><b>Pressure</b>: <span class="" ></span>  </div>--\x3e\n        <div class="density-field"><b>Density</b>:\n            <div class="stats-fields" >\n              <span info-sys-data="mass-density">Mass density</span> =\n              <span class="mass-density-value" ></span>\n            </div>\n            <div class="stats-fields" >\n              <span info-sys-data="atomic-density">Atomic density</span> =\n              <span class="atomic-density-value" ></span>\n            </div>\n        </div>\n\n        <div class="energy-field"><b><span info-sys-data="energies">Energies</span></b> (code-specific)</div>\n        <div class="energy-descomp"> </div>\n\n        <div class="wyckoff-pos-calc-field" >\n          <b><span info-sys-data="free-wyckoff-parameters">Wyckoff sites</span></b>\n          (fractional coordinates)\n          <div class="wyckoff-pos-calc-table"> </div>\n        </div>\n\n      </div>\n\n    </div>\n    ',this.groupComponents=this.element.querySelector(".group-components"),this.calcSelector=new r("calc-selector-bar","60%"),this.element.querySelector(".calc-selector-host").appendChild(this.calcSelector.element),this.lattConstantsField=this.element.querySelector(".latt-constants"),this.volumeField=this.element.querySelector(".volume-field"),this.volumeValue=this.element.querySelector(".volume-value"),this.densityField=this.element.querySelector(".density-field"),this.massDensityValue=this.element.querySelector(".mass-density-value"),this.atomicDensityValue=this.element.querySelector(".atomic-density-value"),this.energyField=this.element.querySelector(".energy-field"),this.energyDescompValue=this.element.querySelector(".energy-descomp"),this.wyckoffPosField=this.element.querySelector(".wyckoff-pos-calc-field"),this.wyckoffPosTable=this.element.querySelector(".wyckoff-pos-calc-table"),this.eosViewer=new d,this.eosViewer.attach(this.element.querySelector(".eos-host"),320,280),this.eosViewer.setClickPointListener((e=>{this.groupCalcUpdate(e+"")})),a.addToInfoSystem(this.element),this._events()}_events(){this.calcSelector.setPrevListener((e=>{if(this.groupIndex>0)return this.groupCalcUpdate(this.groupCalcs[--this.groupIndex]+""),0===this.groupIndex})),this.calcSelector.setNextListener((e=>{if(this.groupIndex<this.groupCalcs.length-1)return this.groupCalcUpdate(this.groupCalcs[++this.groupIndex]+""),this.groupIndex===this.groupCalcs.length-1}))}update(e,t){if(this.representative=e,this.isGroup=t,t){let t=h.getGroupType(e),s=h.getGroupId(e),i=h.getMaterialData().material_id,a=n.serverReq(n.getMaterialGroupURL(i,t,s),(()=>{if(200===a.status){let e=JSON.parse(a.response),t=e.volumes.map((e=>e/1e-30)),s=e.energies.map((e=>e/1602176565e-28)),i=e.calculations,n=s[0];this.groupCalcs=i,this.groupIndex=0,this.groupComponents.style.display="block",this.eosViewer.clear(),this.eosViewer.draw(t,s,this.groupCalcs,n),this.groupCalcUpdate(i[0])}}))}else this.groupComponents.style.display="none",this.groupCalcUpdate(e)}groupCalcUpdate(e){if(null!==e){if(null!==this.groupCalcs&&(this.groupIndex=this.groupCalcs.indexOf(e),this.groupIndex>=0)){let t=n.getShortCode(e)+" ("+(this.groupIndex+1)+"/"+this.groupCalcs.length+")";this.calcSelector.setState(t,0===this.groupIndex,this.groupIndex===this.groupCalcs.length-1),this.eosViewer.selectCalc(e)}let t=h.getMaterialData(),s=t.material_id,i="2D"===t.material_type,a="bulk"===t.material_type,l=(h.getCalc(e),h.getMaterialData().has_free_wyckoff_parameters),r=["energies","lattice_parameters","mass_density","atomic_density","cell_volume"];l&&r.push("wyckoff_sets");let o=JSON.stringify({properties:r}),d=n.serverReqPOST(n.getMaterialCalcURL(s,e),o,(()=>{if(200===d.status){let e=JSON.parse(d.response),t=e.lattice_parameters,s=i||a?`<div>b = ${n.m2Angstrom(t.b)}</div>`:"";s+=a?`<div>c = ${n.m2Angstrom(t.c)}</div>`:"";let r=a?`<div>&alpha; = ${n.rad2degree(t.alpha)}</div>\n              <div>&beta; = ${n.rad2degree(t.beta)}</div>`:"";r+=i||a?`<div>&gamma; = ${n.rad2degree(t.gamma)}</div>`:"",this.lattConstantsField.innerHTML=`\n            <div style="float: left; ">\n              <div>a = ${n.m2Angstrom(t.a)}</div>\n              ${s}\n            </div>\n            <div style="float: left; padding-left: 40px;">\n              ${r}\n            </div>\n            <div style="clear: both;padding: 0"></div>\n          `,this.densityField.style.display=a?"block":"none",this.volumeField.style.display=a?"block":"none",a&&(this.volumeValue.innerHTML=n.m3ToAngstrom3(e.cell_volume),this.atomicDensityValue.innerHTML=n.toAngstromMinus3(e.atomic_density),this.massDensityValue.innerHTML=e.mass_density.toFixed(1)+" kg/m<sup>3</sup>");let o=!1,h=e.energies;if(void 0!==h){let e=h.energy_total;void 0!==e&&(o=!0,this.energyDescompValue.innerHTML="<div>Total E = &nbsp; "+n.J2eV(e)+" eV</div>")}if(this.energyField.style.display=o?"block":"none",this.energyDescompValue.style.display=o?"block":"none",this.wyckoffPosField.style.display=l?"block":"none",l){let t=new Map;e.wyckoff_sets.forEach((e=>{let s="",i=!1,n=e.variables;if(void 0!==n&&(i=!0,["x","y","z"].forEach((e=>{if(e in n){let t=n[e];s+=e+" = "+t.toFixed(2)+"<br>"}}))),i){let i=[];i.push(e.wyckoff_letter),i.push(s),t.has(e.element)?t.get(e.element).push(i):t.set(e.element,[i])}}));let s="";t.forEach(((e,t)=>{e.sort(((e,t)=>e[0]>t[0]?1:-1));let i=!0;s+='<tr > <td style="width: 30%;">'+t+" </td>",e.forEach((e=>{i?(i=!1,s+='<td style="width: 30%; ">'+e[0]+'</td><td style="width: 40%;">'+e[1]+"</td></tr>"):s+="<tr><td> </td><td>"+e[0]+"</td><td>"+e[1]+"</td></tr>"}))})),this.wyckoffPosTable.innerHTML='<table id="calc-wyckoff">'+s+"</table>"}}}))}}}class u{constructor(e){this.calcMapByFunctional=null,this.quantitiesMap=null,this.hostElement=e,this.graphTrigger=null,this.viewType="text",this.functional=null,this.nBins=15,this.hostElement.innerHTML+='\n      <div style="float: left" >\n        <svg xmlns="http://www.w3.org/2000/svg" class="chart-tab"\n          viewBox="0 0 15 15" width="15" height="15" style="fill: #c7c7c7;">\n            <rect x="0" y="0"  width="2" height="15" />\n            <rect   x="3" y="5"  width="1.8" height="7"  />\n            <rect  x="6" y="3"  width="1.8" height="9"  />\n            <rect   x="9" y="6"  width="1.8" height="6"  />\n            <rect  x="12" y="2"  width="1.8" height="10"  />\n            <rect x="2" y="13"   width="13" height="2" />\n        </svg>\n        <svg xmlns="http://www.w3.org/2000/svg" class="text-tab"\n          viewBox="0 0 15 15" width="15" height="15" style="fill: #777;">\n            <rect x="0" y="1"   width="15" height="2.5" />\n            <rect   x="0" y="6"  width="15" height="2.5"  />\n            <rect  x="0" y="11"  width="15" height="2.5"  />\n        </svg>\n      </div>\n\n      <div class="functional-tabs" style="float: right">\n      </div>\n\n      <div style="clear: both;"></div>\n\n      <div class="content-placeholder" >\n\n        <div style="display: block" class="text-panel" >\n          <div><b>Lattice constants</b>:\n            <div class="stats-fields latt-constants-field" >\n            </div>\n          </div>\n          <div class="volume-field"><b><span info-sys-data="cell-volume">Volume</span></b> (&#197;<sup>3</sup>):\n            <div class="stats-fields volume-value" > </div>\n          </div>\n          <div class="density-field"><b>Density</b> :\n            <div >\n              <div class="stats-fields" >\n                <span info-sys-data="mass-density">Mass density</span> (kg/m<sup>3</sup>) =\n                <span class="mass-density-value" ></span>\n              </div>\n              <div class="stats-fields" >\n                <span info-sys-data="atomic-density">Atomic density</span> (&#197;<sup>-3</sup>) =\n                <span class="atomic-density-value" ></span>\n              </div>\n            </div>\n          </div>\n        </div>\n\n        <div style="display:none" class="chart-panel" >\n          <div class="charts-placeholder" > </div>\n          <div class="charts-selector" >\n\n          </div>\n        </div>\n\n      </div>\n    ',this.chartTab=this.hostElement.querySelector(".chart-tab"),this.textTab=this.hostElement.querySelector(".text-tab"),this.functionalTabs=this.hostElement.querySelector(".functional-tabs"),this.chartPanel=this.hostElement.querySelector(".chart-panel"),this.textPanel=this.hostElement.querySelector(".text-panel"),this.lattConstantsField=this.hostElement.querySelector(".latt-constants-field"),this.volumeField=this.hostElement.querySelector(".volume-field"),this.volumeFieldValue=this.hostElement.querySelector(".volume-value"),this.densityField=this.hostElement.querySelector(".density-field"),this.massDensityValue=this.hostElement.querySelector(".mass-density-value"),this.atomicDensityValue=this.hostElement.querySelector(".atomic-density-value"),this.statsViewer=new o;let t=this.hostElement.querySelector(".charts-placeholder");this.statsViewer.attach(t,350,200),this.chartsSelector=this.hostElement.querySelector(".charts-selector"),this.chartTab.addEventListener("click",(e=>{this.chartTab.style.fill="#777",this.viewType="chart",this.textTab.style.fill="#c7c7c7",this.chartPanel.style.display="block",this.textPanel.style.display="none"})),this.textTab.addEventListener("click",(e=>{this.textTab.style.fill="#777",this.viewType="text",this.chartTab.style.fill="#c7c7c7",this.textPanel.style.display="block",this.chartPanel.style.display="none"})),this.functionalTabs.addEventListener("click",(e=>{"tab"===e.target.className&&(this.statsViewer.clear(),this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab",this.functional=e.target.getAttribute("data-tab"),this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab-selected",this._setData())})),this.chartsSelector.addEventListener("click",(e=>{if(0===e.target.className.indexOf("quantity")){this.statsViewer.clear();let t=e.target.getAttribute("data-quantity"),s=this.quantitiesMap.get(t),i=s.label,n=s.stats;this.statsViewer.drawPoints(n.histogram,i,this.nBins),this.chartsSelector.querySelector(".quantity-selected").className="quantity",e.target.className="quantity-selected"}}))}_setData(){let e="2D"===h.getMaterialData().material_type,t="bulk"===h.getMaterialData().material_type,s=(this.functional,Array.from(this.calcMapByFunctional.get(this.functional))),i=h.getMaterialData().material_id,a=new Map;a.set("lattice_a",{label:"a (Å)"}),e|t&&(a.set("lattice_b",{label:"b (Å)"}),a.set("gamma",{label:"&gamma"})),t&&(a.set("cell_volume",{label:"Volume (ų)"}),a.set("atomic_density",{label:"Atomic density (Å⁻³)"}),a.set("mass_density",{label:"Mass density (kg/m³)"}),a.set("lattice_c",{label:"c ()"}),a.set("alpha",{label:"&alpha"}),a.set("beta",{label:"&beta"}));let l=JSON.stringify({calculations:s,properties:Array.from(a.keys()),n_histogram_bins:this.nBins});n.serverReqPOST(n.getMaterialStatsURL(i),l,(s=>{let i=JSON.parse(s.target.response);for(let e of a.keys()){let t=i[e];"cell_volume"==e?(t.min*=1e30,t.avg*=1e30,t.max*=1e30,t.histogram.values=t.histogram.values.map((e=>1e30*e))):"atomic_density"==e?(t.min*=1e-30,t.avg*=1e-30,t.max*=1e-30,t.histogram.values=t.histogram.values.map((e=>1e-30*e))):e.startsWith("lattice_")&&(t.min*=1e10,t.avg*=1e10,t.max*=1e10,t.histogram.values=t.histogram.values.map((e=>1e10*e)));let s=a.get(e).label;t.equal=t.min===t.max;let l=s.split(":");t.label=l[0],2===l.length?t.units=l[1]:t.units="";let r,o=3;"mass_density"===e&&(o=1),r="alpha"==e||"beta"==e||"gamma"==e?n.rad2degree(t.avg.toFixed(o)):t.avg.toFixed(o)+' &nbsp; <span style="font-size: 0.9em">['+t.min.toFixed(o)+" , "+t.max.toFixed(o)+"]</span>",a.get(e).html=r,a.get(e).stats=t}let l=e||t?`<div>b (&#197;) = ${a.get("lattice_b").html}</div>`:"";l+=t?`<div>c (&#197;) = ${a.get("lattice_c").html}</div>`:"";let r=t?`<div>&alpha; = ${a.get("alpha").html}</div>\n          <div>&beta; = ${a.get("beta").html}</div>`:"";r+=e||t?`<div>&gamma; = ${a.get("gamma").html}</div>`:"",this.lattConstantsField.innerHTML=`\n        <div style="float: left; ">\n          <div>a (&#197;) = ${a.get("lattice_a").html}</div>\n          ${l}\n        </div>\n      <div style="float: left; padding-left: 40px;">\n        ${r}\n      </div>\n        <div style="clear: both;padding: 0"></div>\n        `;let o='\n      <span class="quantity-selected" data-quantity="lattice_a">a</span>\n      ';(e||t)&&(o+='<span class="quantity" data-quantity="lattice_b">b</span>'),this.densityField.style.display=t?"block":"none",this.volumeField.style.display=t?"block":"none",t&&(this.volumeFieldValue.innerHTML=a.get("cell_volume").html,this.massDensityValue.innerHTML=a.get("mass_density").html,this.atomicDensityValue.innerHTML=a.get("atomic_density").html,o+='\n          <span class="quantity" data-quantity="lattice_c">c</span>\n          <span class="quantity" data-quantity="cell_volume">volume</span>\n          <span class="quantity" data-quantity="mass_density">mass density</span>\n          <span class="quantity" data-quantity="atomic_density">atomic density</span>\n        '),this.chartsSelector.innerHTML=o,this.quantitiesMap=a;let d=i.lattice_a.histogram;this.statsViewer.drawPoints(d,a.get("lattice_a").label,this.nBins)}))}build(e){this.calcMapByFunctional=e,this.graphTrigger=null,this.statsViewer.clear(),this.unfoldedElement=null,this.functionalQuantityMap=new Map,this.functionalTabs.innerHTML="",this.calcMapByFunctional.forEach(((e,t)=>{this.functionalTabs.innerHTML+='<span class="tab" data-tab="'+t+'">'+t+"</span>"}));let t=Array.from(this.calcMapByFunctional.keys());(null===this.functional||t.indexOf(this.functional)<0)&&(this.functional=t[0]),this._setData(),this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab-selected",a.addToInfoSystem(this.hostElement)}}e.exports=class extends i{constructor(){super("Structure"),this.navTree=new l,this.groupsData,this.element.innerHTML+='\n\n      <div style="float: left; width: 36%;">\n        <div class="view-box">\n          <div class="title">Structure </div>\n          <div class="viz-box-container" style="height: 400px; position: relative">\n            <div class="viz-box" style="height: 90%"></div>\n          </div>\n\n          <div class="footer-flex-wrapper">\n\n            <div class="fields-container">\n              <div><b><span>System type</span></b>:\n                <span class="struct-field" ></span>\n              </div>\n              <div class="structure-type-field" style="display: none">\n                <b><span info-sys-data="structure_type">Structure type</span></b>:\n                <span class="structure-type-value" ></span>\n              </div>\n              <div class="structure-prototype-field" style="display: none">\n                <b><span info-sys-data="structure_prototype">Structure prototype</span></b>:\n                <span class="structure-prototype-value" ></span>\n              </div>\n              <div class="strukturbericht-field" style="display: none">\n                <b><span info-sys-data="strukturbericht">Strukturbericht designation</span></b>:\n                <span class="strukturbericht-value" ></span>\n              </div>\n            </div>\n\n            <div class="footer-flex" style="display: none">\n\n              <div class="fields-container"\n                style="flex-basis: 70%; border-right: 1px solid #E4E4E4; ">\n\n                <div>\n                  <b><span info-sys-data="crystal_system">Lattice</span></b>:\n                  <span class="lattice-value" ></span>\n                </div>\n                <div>\n                  <b><span info-sys-data="space_group_number">Space group</span></b>:\n                  <span class="space-group-value" ></span>\n                </div>\n                <div>\n                  <b><span info-sys-data="point-group">Point group</span></b>:\n                  <span class="point-group-value" ></span>\n                </div>\n              </div>\n\n              <div style="flex-basis: 30%; margin-left: 30px;">\n                <div class="fields-container">\n                  <div><b><span info-sys-data="wyckoff-position-population">Wyckoff sites</span></b></div>\n                  <div class="wyckoff-sites-value"> </div>\n                </div>\n              </div>\n\n            </div>\n\n          </div>\n\n        </div>\n      </div>\n\n      <div style="float: left; width: 36%;">\n        <div class="view-box">\n          <div class="title">Calculations</div>\n          <div class="navTreeWrapper"></div>\n\n          <div class="summary-title">Summary  </div>\n          <div style="font-size: 0.85em; text-align: center; padding: 4px;">Based on the calculations selected above</div>\n\n          <div class="info-fields summary-box">\n          \x3c!-- Lattice constants Cell volume, Density panel dynamically generated\n            --\x3e\n          </div>\n        </div>\n      </div>\n\n      <div style="float: right; width: 28%;">\n        <div class="calc-specifics-box">\n          <div style="padding-top: 10px; " >\n            <div class="tree-leaf-title"></div>\n          </div>\n          <div class="tree-leaf-viewer-host"></div>\n          </div>\n        </div>\n      </div>\n    </div>\n    ',this.navTreeWrapper=this.element.getElementsByClassName("navTreeWrapper")[0];let e=this.element.getElementsByClassName("struct-field");this.systemTypeField=e[0],this.structTypeField=this.element.querySelector(".structure-type-field"),this.structTypeValue=this.element.querySelector(".structure-type-value"),this.structPrototypeField=this.element.querySelector(".structure-prototype-field"),this.structPrototypeValue=this.element.querySelector(".structure-prototype-value"),this.strukturberichtField=this.element.querySelector(".strukturbericht-field"),this.strukturberichtValue=this.element.querySelector(".strukturbericht-value"),this.lowerBox=this.element.querySelector(".footer-flex"),this.latticeValue=this.element.querySelector(".lattice-value"),this.spaceGroupValue=this.element.querySelector(".space-group-value"),this.pointGroupValue=this.element.querySelector(".point-group-value"),this.wyckoffValue=this.element.querySelector(".wyckoff-sites-value"),this.summaryByFunctionals=null,this.leafTitle=this.element.querySelector(".tree-leaf-title"),this.summaryBox=this.element.querySelector(".summary-box"),this.summaryByFunctionals=new u(this.summaryBox),this.calcSpecificsBox=this.element.querySelector(".calc-specifics-box"),this.treeLeafViewer=new c,this.element.querySelector(".tree-leaf-viewer-host").appendChild(this.treeLeafViewer.element),this.vizBox=this.element.querySelector(".viz-box"),a.addToInfoSystem(this.element)}setMaterialData(){let e=h.getMaterialData(),t=h.getIdealizedStructure();super.setMaterialData(e);let s=null===e.material_name?e.formula:e.material_name;if(this.navTree.build(s,"structure"),this.navTree.selectAll(),this.navTree.setHeight(250),this.navTree.setMarkedLeafIfNoneMarked(null),this.attachNavTree(this.navTree),this.updateSelection(this.navTree.getTreeSelectedCalcs()),this.updateMarkedLeaf(this.navTree.getMarkedLeaf()),this.navTree.setTreeSelectionListener((e=>{this.updateSelection(e)})),this.navTree.setLeafMarkedListener((e=>{this.updateMarkedLeaf(e)})),this.isBulk="bulk"===e.material_type,this.systemTypeField.textContent=e.material_type,this.structTypeField.style.display=this.isBulk&&null!==e.structure_type?"block":"none",this.structPrototypeField.style.display=this.isBulk&&null!==e.structure_prototype?"block":"none",this.strukturberichtField.style.display=this.isBulk&&null!==e.strukturbericht_designation?"block":"none",this.lowerBox.style.display=this.isBulk?"flex":"none",this.isBulk){this.structTypeValue.textContent=e.structure_type,this.structPrototypeValue.textContent=e.structure_prototype,this.strukturberichtValue.textContent=e.strukturbericht_designation,this.spaceGroupValue.textContent=e.space_group_number+" ("+e.space_group_international_short_symbol+")",this.pointGroupValue.textContent=e.point_group,this.latticeValue.textContent=e.crystal_system;let s=new Map;new Set;for(var i=0;i<t.wyckoff_sets.length;i++){let e=t.wyckoff_sets[i],n=e.element;if(s.has(n))s.get(n).add(e.wyckoff_letter);else{let t=new Set;t.add(e.wyckoff_letter),s.set(n,t)}}let n="";s.forEach(((e,t)=>{let s=!0;n+="<tr> <td>"+t+": </td>",e.forEach((e=>{s?(s=!1,n+="<td>"+e+"</td></tr>"):n+="<tr><td> </td><td>"+e+"</td></tr>"}))})),this.wyckoffValue.innerHTML="<table>"+n+"</table>"}a.addElementToInfoSystem(this.spaceGroupValue,"space_group_number.value:"+e.space_group_number),a.addElementToInfoSystem(this.latticeValue,"crystal_system.value:"+e.crystal_system),a.addElementToInfoSystem(this.pointGroupValue,"point-group.value:"+e.point_group)}updateSelection(e){if(e.size>0){let t=[];e.forEach((e=>{if(h.isGroup(e)){let s=h.getGroupType(e),i=h.getGroupId(e),n=h.getGroups().get(s).get(i);t.push(h.getCalc(n[0]))}else t.push(h.getCalc(e))})),this.summaryBox.style.visibility="visible";let s=n.getCalcMapByFunctional(t);this.summaryByFunctionals.build(s)}else this.summaryBox.style.visibility="hidden"}updateMarkedLeaf(e){let t=!1;if(null!==e)if(this.calcSpecificsBox.style.visibility="visible",t=h.isGroup(e),t){let t,s=h.getGroupType(e),i=h.getGroupId(e);t=h.getGroups().get(s).get(i),this.leafTitle.innerHTML=n.getShortCode(e)+" ("+t.length+")"}else this.leafTitle.innerHTML=n.getShortCode(e);else this.calcSpecificsBox.style.visibility="hidden";this.treeLeafViewer.update(e,t)}}},346:(e,t,s)=>{"use strict";let i=s(155),n=s(212),a=s(414),l=s(223),r=s(719),o=s(317),d=s(195),h=s(842),c=s(828);e.exports=class extends i{constructor(){super("Thermal Properties"),this.firstId,this.lastId,this.navTree=new a,this.element.innerHTML+='\n      <div style="float: left; width: 30%;">\n        <div class="view-box">\n          <div class="title">Calculations </div>\n          <div class="navTreeWrapper"></div>\n        </div>\n      </div>\n\n      <div style="float: right; width: 70%;">\n        <div class="view-box thermal-properties-box">\n\n          <div class="title">Vibrational and thermal properties</div>\n\n          <div style="padding-top: 10px;">\n            <div class="tree-leaf-title"></div>\n          </div>\n\n          <div class="calc-disp-dos-plotter" style="padding: 30px 100px; ">\n            <div class="info-fields-label" style="float: left; width: 52%; ">\n              <span info-sys-data="phonon-dispersion">Phonon dispersion </span>\n            </div>\n            <div class="info-fields-label" style="float: left;">\n              <span info-sys-data="phonon-DOS">Phonon DOS  </span>\n            </div>\n            <div style="clear: both;"></div>\n          </div>\n\n\n          <div class="band" >\n            <div style="padding: 30px 50px; display: flex; justify-content: space-around; ">\n\n              <div >\n                <div class="info-fields-label" >\n                  <span info-sys-data="specific-heat-cv">Specific heat</span>\n                </div>\n                <div class="heat-plotter" >      </div>\n              </div>\n\n              <div>\n                <div class="info-fields-label" >\n                  <span info-sys-data="helmholtz-free-energy">Helmholtz free energy</span>\n                </div>\n                <div class="helmholtz-plotter" >      </div>\n              </div>\n\n            </div>\n          </div>\n\n        </div>\n      </div>\n    ',this.navTreeWrapper=this.element.getElementsByClassName("navTreeWrapper")[0],this.rightBox=this.element.querySelector(".thermal-properties-box"),this.leafTitle=this.element.querySelector(".tree-leaf-title"),this.dispDosPlotter=new c,this.heatPlotter=new d,this.helmholtzPlotter=new h,l.addToInfoSystem(this.element)}_events(){super._events()}setMaterialData(){let e=r.getMaterialData();super.setMaterialData(e);let t=null===e.material_name?e.formula:e.material_name;this.navTree.build(t,"thermal"),this.navTree.selectAll(),this.navTree.setHeight(600),this.navTree.setMarkedLeafIfNoneMarked(null),this.attachNavTree(this.navTree),this.updateSelection(this.navTree.getTreeSelectedCalcs()),this.updateMarkedLeaf(this.navTree.getMarkedLeaf()),this.navTree.setTreeSelectionListener((e=>{this.updateSelection(e)})),this.navTree.setLeafMarkedListener((e=>{this.updateMarkedLeaf(e)}))}updateSelection(e){}updateMarkedLeaf(e){if(null===e)return this.leafTitle.innerHTML="NO SELECTION",this.dispDosPlotter.setNoData(),this.heatPlotter.setNoData(),void this.helmholtzPlotter.setNoData();this.leafTitle.innerHTML=n.getShortCode(e);let t=r.getCalc(e);this.dispDosPlotter.isAttached()||(this.dispDosPlotter.attach(this.element.querySelector(".calc-disp-dos-plotter"),void 0,360),this.heatPlotter.attach(this.element.querySelector(".heat-plotter"),317,317),this.helmholtzPlotter.attach(this.element.querySelector(".helmholtz-plotter"),317,317)),o.show("thermal_properties");let s=r.getMaterialData().material_id,i=n.getMaterialCalcURL(s,t.calc_id),a=JSON.stringify({properties:["phonon_band_structure","phonon_dos","thermodynamical_properties"]});n.serverReqPOST(i,a,(e=>{let t=JSON.parse(e.target.response),s=t.phonon_dos,i=t.phonon_band_structure,n=t.thermodynamical_properties;if(void 0!==s?this.dispDosPlotter.setUpAndData(i,s):this.dispDosPlotter.setNoData(),void 0!==n){let e=n.thermodynamical_property_temperature;this.heatPlotter.setData(e,n.specific_heat_capacity),this.helmholtzPlotter.setData(e,n.specific_vibrational_free_energy_at_constant_volume)}else this.heatPlotter.setNoData(),this.helmholtzPlotter.setNoData();document.getElementById("thermal-props-ov").style.visibility="visible",o.hide("thermal_properties")}))}setPrevCalcListener(e){this.prevCalcListener=e}setNextCalcListener(e){this.nextCalcListener=e}}},423:e=>{"use strict";e.exports=class{constructor(e="",t="",s=!0){this.id=e,this.element=document.createElement("div"),this.element.className=`AutocompleteMultiselectTextfield ${e}-autocomplete-multiselect-textfield`,this.element.innerHTML=`\n      <input type="text" placeholder="${t}" /> \n      <div class="AutocompleteMultiselectTextfield-dropdown ${this.id}-autocomplete-multiselect-dropdown"></div> \n      <div class="AutocompleteMultiselectTextfield-selected-box"></div> \n    `,this.input=this.element.querySelector("input"),this.selectedItemsBox=this.element.querySelector(".AutocompleteMultiselectTextfield-selected-box"),this.listContainer=this.element.querySelector(".AutocompleteMultiselectTextfield-dropdown"),this.selectListener,this.valueList,this.selectedValues=new Set,this.allowEmptyInput=s,this.input.addEventListener("click",(e=>{this._processInput(),e.stopPropagation()})),this.input.addEventListener("input",(e=>{this._processInput()})),this.element.addEventListener("mouseleave",(e=>{this._cleanList()})),this.selectedItemsBox.addEventListener("click",(e=>{let t=event.target.closest("span");this._removeSelectedValue(t.dataset.value)})),this.listContainer.addEventListener("click",(e=>{let t=event.target.closest("div");this._toggleItem(t)})),this.listContainer.addEventListener("mouseover",(e=>{let t=event.target.closest("div");this._setActiveListItem(t)}))}getValues(){return Array.from(this.selectedValues)}disable(e){this.input.disabled=e}setAutocompleteList(e){this.valueList=e}setSelectListener(e){this.selectListener=e}_processInput(){const e=this.input.value;if(this._cleanList(),!this.allowEmptyInput&&!e)return!1;let t=0;const s=this.valueList.filter((s=>{const i=s.toUpperCase().includes(e.toUpperCase());return i&&t++,t<=15&&i}));this.listContainer.innerHTML="",s.forEach((t=>{const s=function(e,t,s){const i=document.createElement("div");let n=`<input class="value-checkbox" type="checkbox" data-value="${e}" ${s?"checked":""}>`;if(t){const s=e.toUpperCase().indexOf(t.toUpperCase());n+=`${e.substring(0,s)}<strong>${e.substring(s,s+t.length)}</strong>${e.substring(s+t.length)}`}else n+=e;return i.innerHTML=n,i}(t,e,this.selectedValues.has(t));this.listContainer.append(s),t.toUpperCase()===e.toUpperCase()&&this._setActiveListItem(s)}))}_removeSelectedValue(e){this.selectedValues.delete(e),this.selectedItemsBox.querySelector('span[data-value="'+e+'"]').remove();const t=this.listContainer.querySelector('input[data-value="'+e+'"]');t&&(t.checked=!1),this.element.dispatchEvent(new Event("change",{bubbles:!0}))}_toggleItem(e){const t=e.textContent,s=this.selectedValues.has(t);e.querySelector("input").checked=!s,s?(this.selectedValues.delete(t),this.selectedItemsBox.querySelector('span[data-value="'+t+'"]').remove()):(this.selectedValues.add(t),this.selectedItemsBox.append(function(e){const t=document.createElement("span");t.className="selectedItemLabel",t.dataset.value=e;const s=document.createElement("div");s.textContent=`${e}`;const i=document.createElement("img");return i.src="img/cross-maroon.svg",i.width=10,i.height=10,t.appendChild(s),t.appendChild(i),t}(t))),this.selectListener&&this.selectListener(t),this.element.dispatchEvent(new Event("change",{bubbles:!0}))}_setActiveListItem(e){const t=this.listContainer.querySelector(".autocomplete-active");t&&t.classList.remove("autocomplete-active"),e.classList.add("autocomplete-active")}_cleanList(){this.listContainer.innerHTML=""}}},191:(e,t,s)=>{"use strict";let i=s(212);const n=new Map([[1,["H","Li","Na","K","Rb","Cs","Fr"]],[2,["Be","Mg","Ca","Sr","Ba","Ra"]],[3,["Sc","Y"]],[4,["Ti","Zr","Hf","Rf"]],[5,["V","Nb","Ta","Ha"]],[6,["Cr","Mo","W","Sg"]],[7,["Mn","Tc","Re","Ns"]],[8,["Fe","Ru","Os","Hs"]],[9,["Co","Rh","Ir","Mt"]],[10,["Ni","Pd","Pt","Ds"]],[11,["Cu","Ag","Au","Rg"]],[12,["Zn","Cd","Hg","Cn"]],[13,["B","Al","Ga","In","Tl","Nh"]],[14,["C","Si","Ge","Sn","Pb","Fl"]],[15,["N","P","As","Sb","Bi","Mc"]],[16,["O","S","Se","Te","Po","Lv"]],[17,["F","Cl","Br","I","At","Ts"]],[18,["He","Ne","Ar","Kr","Xe","Rn","Og"]],[19,["La","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu"]],[20,["Ac","Th","Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md","No","Lr"]]]),a=new Map([["metalloids",["B","Si","Ge","As","Sb","Te","Po"]],["other-non-metals",["H","C","N","O","P","S","Se"]],["halogens",["F","Cl","Br","I","At","Ts"]],["noble-gases",["He","Ne","Ar","Kr","Xe","Rn","Og"]],["alkali-metals",["Li","Na","K","Rb","Cs","Fr"]],["alkaline-earth-metals",["Be","Mg","Ca","Sr","Ba","Ra"]],["lanthanoids",["La","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu"]],["actinoids",["Ac","Th","Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md","No","Lr"]],["transition-metals",["Sc","Y","Ti","Zr","Hf","Rf","V","Nb","Ta","Ha","Cr","Mo","W","Sg","Mn","Tc","Re","Ns","Fe","Ru","Os","Hs","Co","Rh","Ir","Mt","Ni","Pd","Pt","Ds","Cu","Ag","Au","Rg","Zn","Cd","Hg","Cn"]],["post-transition-metals",["Al","Ga","In","Tl","Nh","Sn","Pb","Fl","Bi","Mc","Lv"]]]),l=new Map([["metalloids","#F9E298"],["other-non-metals","#F2B01D"],["halogens","#85ADC1"],["noble-gases","#F7D660"],["alkali-metals","#D04629"],["alkaline-earth-metals","#F7B57D"],["transition-metals","#F58737"],["post-transition-metals","#AE4747"],["lanthanoids","#3B91AE"],["actinoids","#E97147"]]);let r=["Hydrogen","Helium","Lithium","Beryllium","Boron","Carbon","Nitrogen","Oxygen","Fluorine","Neon","Sodium","Magnesium","Aluminum","Silicon","Phosphorus","Sulfur","Chlorine","Argon","Potassium","Calcium","Scandium","Titanium","Vanadium","Chromium","Manganese","Iron","Cobalt","Nickel","Copper","Zinc","Gallium","Germanium","Arsenic","Selenium","Bromine","Krypton","Rubidium","Strontium","Yttrium","Zirconium","Niobium","Molybdenum","Technetium","Ruthenium","Rhodium","Palladium","Silver","Cadmium","Indium","Tin","Antimony","Tellurium","Iodine","Xenon","Cesium","Barium","Lanthanum","Cerium","Praseodymium","Neodymium","Promethium","Samarium","Europium","Gadolinium","Terbium","Dysprosium","Holmium","Erbium","Thulium","Ytterbium","Lutetium","Hafnium","Tantalum","Tungsten","Rhenium","Osmium","Iridium","Platinum","Gold","Mercury","Thallium","Lead","Bismuth","Polonium","Astatine","Radon","Francium","Radium","Actinium","Thorium","Protactinium","Uranium","Neptunium","Plutonium","Americium","Curium","Berkelium","Californium","Einsteinium","Fermium","Mendelevium","Nobelium","Lawrencium","Rutherfordium","Dubnium","Seaborgium","Bohrium","Hassium","Meitnerium","Darmstadtium","Roentgenium","Copernicium","Nihonium","Flerovium","Moscovium","Livermorium","Tennessine","Oganesson"];function o(e){let t;return a.forEach((function(s,i){s.indexOf(e)>=0&&(t=i)})),t}function d(e){let t=i.ELEMENTS[e-1];return'<td class="cell '+o(t)+'" data-el="el-'+t+'"><b>'+t+"</b> <div>"+e+"</div> </td>"}function h(e){let t=null,s=null;if(e.target.className.indexOf("cell ")>=0?(t=e.target,s=e.target.className):e.target.parentElement.className.indexOf("cell ")>=0&&(t=e.target.parentElement,s=e.target.parentElement.className),null===t)return null;{let e=t.innerHTML,s=e.substring(3,e.indexOf("<",3));return"&nbsp;"===s?null:s}}e.exports=class{constructor(){this.element=document.createElement("div"),this.element.setAttribute("id","elementable");let e='<div class="element-info"></div>';e+='<div class="ptWrapper">',e+='<table id="pt-main">',e+="<tbody>",e+="<tr>"+d(1),e+='<td class="cellpad" colspan="16"></td>',e+=d(2)+"</tr>";let t=t=>{e+="<tr>"+d(t)+d(t+1),e+='<td class="cellpad" colspan="10"></td>';for(let s=t+2;s<t+8;s++)e+=d(s);e+="</tr>"};t(3),t(11);let s=19;for(let t=0;t<4;t++){e+="<tr>";for(let t=0;t<18;t++)57===s||89===s?(e+=(n=s,'<td class="cellpad '+o(i.ELEMENTS[n-1])+'" data-el="el-X"><b>&nbsp;</b> <div>&nbsp;</div> </td>'),s+=15):(e+=d(s),s++);e+="</tr>"}var n;e+="</tbody></table>",e+='<div id="specialRows"><table id="pt-laac">';for(let t=0;t<2;t++){e+="<tr>",s=0===t?57:89;for(let t=0;t<15;t++)e+=d(s),s++;e+="</tr>"}e+="</table></div>",e+='<div class="legend">\n      <div class="alkali-metals">Alkali metals</div>\n      <div class="alkaline-earth-metals">Alkaline earth metals</div>\n      <div class="transition-metals">Transition metals</div>\n      <div class="post-transition-metals">Post-transition metals</div>\n      <div class="metalloids">Metalloids</div>\n      <div class="other-non-metals">Other nonmetals</div>\n      <div class="halogens">Halogens</div>\n      <div class="noble-gases">Noble gases</div>\n      <div class="lanthanoids">Lanthanoids</div>\n      <div class="actinoids">Actinoids</div>\n    </div>',e+='<div class="perm-tooltip search-option" style="margin-right: 10px">\n        <input id="allow-other-elements" name="allow-other-elements" type="checkbox" checked>\n        <label for="allow-other-elements" class="perm-tooltip">Allow other elements</label>\n        <span class="tooltiptext">If selected, the returned materials may also contain other elements.</span>\n    </div>',e+="</div>",this.element.innerHTML=e,this.elementInfo=this.element.getElementsByClassName("element-info")[0],this.tableZone=this.element.getElementsByClassName("ptWrapper")[0],this._events()}_events(){this.tableZone.addEventListener("click",(e=>{if(e.target!==e.currentTarget){let s=e.target.className,i=e.target;if(""===s&&(i=e.target.parentElement,s=e.target.parentElement.className),s.indexOf("cellpad")>=0)return;if(s.indexOf("group-sel")>=0){let e=n.get(parseInt(i.getAttribute("data-group")));this.clickListener(e);for(var t=0;t<e.length;t++)this.selectElement(e[t])}else if(s.indexOf("cell")>=0){let e=i.innerHTML,t=e.substring(3,e.indexOf("<",3));if("&nbsp;"===t)return;this.clickListener([t])}}}),!0),this.tableZone.addEventListener("mouseover",(e=>{let t=h(e);if(null!==t){this.elementInfo.style.display="block";let e=l.get(o(t));this.elementInfo.style.borderColor=e;let s=i.ELEMENTS.indexOf(t)+1;this.elementInfo.innerHTML=`\n          <div>\n            <div style="float: right; padding: 3px 4px;border-left: 3px solid ${e};\n              border-bottom: 3px solid ${e}" > ${s} </div>\n            <div style="clear: right;"></div>\n          </div>\n          <div class="symbol">${t} </div>\n          <div class="">${r[s-1]}  </div>\n          `}})),this.tableZone.addEventListener("mouseout",(e=>{null!==h(e)&&(this.elementInfo.style.display="none")}))}setClickListener(e){this.clickListener=e}setDeselectListener(e){this.deselectListener=e}selectElement(e){this.element.querySelector('td[data-el="el-'+e+'"]').className="cell el-selected"}deselectElement(e){this.element.querySelector('td[data-el="el-'+e+'"]').className="cell "+o(e)}deselectAllElements(){let e=this.element.querySelectorAll("td.el-selected");for(let t=0;t<e.length;++t){let s=e[t].getAttribute("data-el").substring(3);e[t].className="cell "+o(s)}}}},430:(e,t,s)=>{"use strict";let i=s(212),n=s(223),a=s(423);const l=.2;class r{constructor(e,t,s){this.commonId=t,this.element=document.createElement("div"),this.element.className="filter-quantity-box",this.element.innerHTML=`<div class="field-title">\n        <span info-sys-data="${t}">${e}</span>\n      </div>`,s.forEach((e=>{let s=t||e.id,i=t?s+".value:"+e.value:s,n=document.createElement("div");n.innerHTML=`\n          <input type="checkbox" class="${s}-field" value="${e.value}">\n          <span info-sys-data="${i}">${e.text}</span>\n      `,this.element.append(n)})),this.checkboxes=this.element.querySelectorAll("input")}getValues(){if(this.commonId){let e=[];return this.checkboxes.forEach((t=>{t.checked&&e.push(t.value)})),{fieldId:this.commonId,value:e}}{let e=[];return this.checkboxes.forEach((t=>{if(t.checked){let s=t.className;e.push({fieldId:s.substring(0,s.indexOf("-field")),value:[!0]})}})),e}}highlightSelected(e){this.checkboxes.forEach((t=>{t.checked?t.parentElement.style.opacity="":t.parentElement.style.opacity=e?l:""}))}}class o{constructor(e,t){this.fieldId=t,this.element=document.createElement("div"),this.element.className="filter-quantity-box",this.element.innerHTML=`\n      <div class="field-title"> <span info-sys-data="${t}">${e}</span></div>\n      <input type="text" class="${t}-textfield" style="">\n    `,this.input=this.element.querySelector("input")}getValues(){let e=this.input.value;return""===e.trim()?null:{fieldId:this.fieldId,value:[e]}}highlightSelected(e){null===this.getValues()&&(this.input.style.opacity=e?l:"")}}class d{constructor(e,t){this.fieldId=t,this.element=document.createElement("div"),this.element.className="filter-quantity-box",this.element.innerHTML=`<div class="field-title">\n        <span info-sys-data="${t}">${e}</span>\n      </div>`,this.autocomplete=new a(t,"Search and select options"),this.element.append(this.autocomplete.element);let s=i.serverReq(i.getSuggestionURL(this.fieldId),(e=>{let t=JSON.parse(s.response)[this.fieldId];this.autocomplete.setAutocompleteList(t)}))}getValues(){const e=this.autocomplete.getValues();return 0===e.length?null:{fieldId:this.fieldId,value:e}}highlightSelected(e){null===this.getValues()&&(this.autocomplete.element.style.opacity=e?l:"")}}class h{constructor(e,t,s){this.fieldId=t,this.element=document.createElement("div"),this.element.className="filter-quantity-box",this.element.innerHTML=`\n      <div class="field-title">\n        <span info-sys-data="${t}">${e}</span> \n        <span style="font-weight: normal;">${s?`(${s})`:""}</span>\n      </div>\n      <div style="display: flex; flex-direction: row; align-items: center">\n        <div>\n          <input type="text" placeholder="min" style="width: 100%"/>\n        </div>\n        <div style="padding: 0px 5px">-</div>\n        <div>\n          <input type="text" placeholder="max" style="width: 100%"/>\n        </div>\n      </div>\n    `,this.inputs=this.element.querySelectorAll("input")}getValues(){let e=":";return""!==this.inputs[0].value.trim()&&(e=this.inputs[0].value+e),""!==this.inputs[1].value.trim()&&(e+=this.inputs[1].value),":"===e?null:{fieldId:this.fieldId,value:[e]}}highlightSelected(e){null===this.getValues()&&(this.inputs[0].parentElement.style.opacity=e?l:"")}}e.exports=class{constructor(){this.element=document.createElement("div"),this.element.setAttribute("id","filter-panel-placeholder"),this.fields=[];let e=this.createPropsGroupBox("Structure");this.element.append(e);const t=new r("System type","material_type",[{value:"bulk",text:"Bulk"},{value:"2D",text:"2D"},{value:"1D",text:"1D"}]);this.fields.push(t),e.append(t.element);const s=new r("Crystal system","crystal_system",[{value:"cubic",text:"Cubic"},{value:"hexagonal",text:"Hexagonal"},{value:"trigonal",text:"Trigonal"},{value:"tetragonal",text:"Tetragonal"},{value:"orthorhombic",text:"Orthorhombic"},{value:"monoclinic",text:"Monoclinic"},{value:"triclinic",text:"Triclinic"}]);this.fields.push(s),e.append(s.element);const i=new o("Space group number","space_group_number");this.fields.push(i),e.append(i.element);const a=new d("Structure type","structure_type");this.fields.push(a),e.append(a.element);let l=this.createPropsGroupBox("Properties");this.element.append(l);const c=new h("Band gap","band_gap","eV");this.fields.push(c),l.append(c.element);const u=new r("Results containing...",void 0,[{value:"Band structure",text:"Band structure",id:"has_band_structure"},{value:"DOS",text:"DOS",id:"has_dos"},{value:"Thermal properties",text:"Thermal properties",id:"has_thermal_properties"}]);this.fields.push(u),l.append(u.element);let p=this.createPropsGroupBox("Method");this.element.append(p);const m=new d("Basis set","basis_set");this.fields.push(m),p.append(m.element);const y=new d("Functional type","functional_type");this.fields.push(y),p.append(y.element);const v=new d("Code","code_name");this.fields.push(v),p.append(v.element);const g=document.createElement("div");g.className="filter-quantity-box";const f=document.createElement("div");f.className="perm-tooltip search-option restricted-search-option";const b=document.createElement("input");b.id="restricted-search",b.name="restricted-search",b.type="checkbox";const x=document.createElement("label");x.for="restricted-search",x.className="perm-tooltip",x.textContent="Restrict to individual calculations";const S=document.createElement("span");S.className="tooltiptext",S.textContent="If selected, the query will return materials that have individual calculations simultaneously matching your methodology and properties criteria.",f.append(b),f.append(x),f.append(S),g.append(f),this.element.append(g),n.addToInfoSystem(this.element),this.element.addEventListener("change",(e=>{this.addPropsChangeListener&&this.addPropsChangeListener(this.getValues())}))}createPropsGroupBox(e){const t=document.createElement("div");return t.className="filter-section-box",t.innerHTML='<div class="filter-section-title"><div>'+e+"</div></div>",t}getValues(){let e=new Map;return this.fields.forEach((t=>{const s=t.getValues();Array.isArray(s)&&s.length>0?s.forEach((t=>e.set(t.fieldId,t.value))):s&&s.value&&s.value.length>0&&e.set(s.fieldId,s.value)})),e}setPropsChangeListener(e){this.addPropsChangeListener=e}showSelectedProps(e){this.fields.forEach((t=>{t.highlightSelected(e)}))}}},541:(e,t,s)=>{let i=s(212);e.exports=class{constructor(e){this.formula=e,this.formulaMap=this._parseFormula(e),console.log("this.formulaMap: ",this.formulaMap)}_parseFormula(e){let t,s=0,n=new Map;for(;s<e.length;){let a=e.substring(s,s+2),l=e.substring(s,s+1);if(i.ELEMENTS.indexOf(a)>=0)n.set(a,1),s+=2,t=a;else if(i.ELEMENTS.indexOf(l)>=0)n.set(l,1),s++,t=l;else{let e=parseInt(a);e>=10?s+=2:s++,n.set(t,e)}}return n}getOptimadeSubquery(e){const t=[];return this.formulaMap.forEach(((e,s)=>{const i='"'+s+(1===e?"":+e)+'"';t.push(i)})),"formula HAS "+(e?"ALL ":"ONLY ")+t.join(", ")}getFragments(){const e=[];return this.formulaMap.forEach(((t,s)=>{const i='"'+s+(1===t?"":+t)+'"';e.push(i)})),e}}},926:(e,t,s)=>{"use strict";let i=s(212),n=s(223),a=s(317);class l{constructor(){this.element=document.createElement("div"),this.element.innerHTML='\n      <div class="results-total" >Results</div>\n\n      <div class="pag-header" >\n        <span class="prevButton">\n          <img src="img/prev.svg" style="display: inline;" width="7px"/> &nbsp; prev\n        </span>   &nbsp;&nbsp;\n        <span class="page"> X </span> &nbsp;&nbsp;\n        <span class="nextButton"> next &nbsp;\n          <img src="img/next.svg" width="7px" />\n        </span>\n      </div>\n    ',this.titleBox=this.element.querySelector(".results-total"),this.prevButton=this.element.querySelector(".prevButton"),this.pageElement=this.element.querySelector(".page"),this.nextButton=this.element.querySelector(".nextButton"),this.prevButton.addEventListener("click",(e=>{1!==this.pagesData.page&&this.prevPageListener(this.pagesData.page-1)})),this.nextButton.addEventListener("click",(e=>{this.pagesData.page!==this.pagesData.pages&&this.nextPageListener(this.pagesData.page+1)})),this.pagesData}set(e){this.pagesData=e,this.titleBox.innerHTML="Results (total: "+e.total+")",this.pageElement.innerHTML="page "+e.page+" / "+e.pages}setPrevPageListener(e){this.prevPageListener=e}setNextPageListener(e){this.nextPageListener=e}}class r{constructor(){this.element=document.createElement("div"),this.element.className="mat-list-container",this.element.innerHTML='\n      <table>\n          <thead> <tr>\n            <th style="width: 24%;"></th>\n            <th style="width: 16%;">\n              <span info-sys-data="space-group">Space group</span>\n            </th>\n            <th style="width: 20%;">\n              <span >Space gr. int. symbol</span>\n            </th>\n\n            <th style="width: 22%;">\n              <span info-sys-data="structure-type">Structure type</span>\n            </th>\n            <th style="width: 18%;">Nº calculations</th>\n          </tr> </thead>\n\n          <tbody> </tbody> \n      </table>\n    ',this.tbody=this.element.querySelector("tbody"),this.tbody.addEventListener("click",(e=>{let t=event.target.closest("tr.mat-row");t&&i.setBrowserHashPath("material",t.getAttribute("data-mat-id")),e.stopPropagation()}))}updateList(e){if(0===e.size)return void(this.tbody.innerHTML="");let t="";e.forEach(((e,s)=>{let n=i.getSubscriptedFormula(s);t+='<tr> <td class="formula" colspan="5"><b>'+n+"</b>",e.length>1&&(t+='<span style="font-size: 0.86em;"> ('+e.length+" structures)</span>"),t+="</td></tr>",e.forEach((e=>{let s=e.material_name?e.material_name:n;t+=`<tr class="mat-row" data-mat-id="${e.material_id}">\n            <td  > ${s} [${e.formula}] </td>\n            <td style="text-align:center" >\n              ${e.space_group_number?e.space_group_number:""}\n            </td>\n            <td>\n              ${e.space_group_international_short_symbol?e.space_group_international_short_symbol:""}\n            </td>\n            <td> ${e.structure_type?e.structure_type:""} </td>\n            <td style="text-align:center" > ${e.n_calculations?e.n_calculations:""} </td>\n          </tr>`}))})),this.tbody.innerHTML=t,n.addToInfoSystem(this.element)}}e.exports=class{constructor(){this.element=document.createElement("div"),this.element.className="MaterialList",this.visible=!1,this.noResults=!0,this.matMap=new Map,this.optimadeQuery=null,this.newestQuery=null,this.noResultsBox=document.createElement("div"),this.noResultsBox.style="text-align: center; font-weight: bold",this.noResultsBox.innerHTML="NO RESULTS FOUND",this.element.append(this.noResultsBox),this.matListWrapper=document.createElement("div"),this.element.append(this.matListWrapper),this.pagControl=new l,this.matListWrapper.append(this.pagControl.element),this.pagControl.setPrevPageListener((e=>{this._search(e)})),this.pagControl.setNextPageListener((e=>{this._search(e)})),this.matListContainer=new r,this.matListWrapper.append(this.matListContainer.element)}attachAndSetEvents(e){e.appendChild(this.element),this._render()}invalidateSearch(){this.visible=!1,this._render()}initSearch(e){this.optimadeQuery=e,this._search()}_search(e){this.matMap.clear(),a.show("searching");let t={query:this.optimadeQuery,search_by:{}};e&&(t.search_by={page:e});let s=document.getElementById("restricted-search");t.search_by.restricted=s.checked?"1":"0";const n=Date.now();this.newestQuery=n,document.querySelector("#syntax-error").style.visibility="hidden";let l={"Content-Type":"application/json;charset=utf-8"},r=window.keycloak;r.authenticated&&(l.Authorization="Bearer "+r.token),fetch(i.getSearchURL(),{method:"POST",headers:l,body:JSON.stringify(t)}).then((e=>e.json())).then((e=>{this.newestQuery===n&&(this.noResults=0===e.results.length,this._setMatList(e.results),this.pagControl.set(e.pages),this.visible=!0,this._render())})).catch((e=>{console.log("Error"),document.querySelector("#syntax-error").style.visibility="visible"})).finally((()=>{a.hide("searching")}))}_render(){this.element.style.display=this.visible?"":"none",this.visible&&(this.noResultsBox.style.display=this.noResults?"":"none",this.matListWrapper.style.display=this.noResults?"none":"",this.matListContainer.updateList(this.matMap))}_setMatList(e){e.length>0?e.forEach((e=>{this.matMap.has(e.formula_reduced)?this.matMap.get(e.formula_reduced).push(e):this.matMap.set(e.formula_reduced,[e])})):this.matMap.clear()}}},226:(e,t,s)=>{"use strict";let i=s(212),n=(s(882),s(23)),a=s(191),l=s(926),r=s(430),o=s(951);class d{constructor(e){this.element=document.createElement("div"),this.element.className="TextBox";const t=document.createElement("div");t.style.display="flex",t.style.flexDirection="column";const s=document.createElement("div");s.style.display="flex",s.style.flexDirection="row",this.textField=document.createElement("input"),this.textField.type="text",this.textField.placeholder=e,s.append(this.textField),this.button=document.createElement("button"),this.button.className="adding-btn",this.button.disabled=!0,this.button.textContent="Add to query",s.append(this.button),t.append(s),this.element.append(t),this.button.addEventListener("click",(e=>{this.addListener(this.textField.value),this.textField.value=""})),this.textField.addEventListener("keypress",(e=>{13==e.keyCode&&(this.addListener(this.textField.value),this.textField.value="")})),this.textField.addEventListener("input",(e=>{this.button.disabled=""===this.textField.value}))}setAddListener(e){this.addListener=e}disableInput(){this.textField.disabled=!0,this.button.disabled=!0}enableInput(){this.textField.disabled=!1,this.button.disabled=!1}}class h extends d{constructor(e){super(e);const t=document.createElement("div");t.className="perm-tooltip search-option",t.style.marginRight="10px";const s=document.createElement("input");s.id="allow-other-elements",s.name="allow-other-elements",s.type="checkbox",s.checked=!0,t.append(s);const i=document.createElement("label");i.for="allow-other-elements",i.className="perm-tooltip",i.textContent="Allow other elements",t.append(i);const n=document.createElement("span");n.className="tooltiptext",n.textContent="If selected, the returned materials may also contain other elements.",t.append(n),this.element.children[0].append(t)}}e.exports=class{constructor(){this.userGuidance=!0,this.searchFilters=[],this.isVisible=!0,this.element=document.createElement("div"),this.element.setAttribute("id","search-module"),this.element.innerHTML='\n      <div class="search-filter-side">\n      </div>\n      <div class="search-main-side">\n        <div class="composition">\n          <div class="search-box-placeholder" > </div>\n          <div class="add-buttons" >\n            <div class="tab-buttons" style="width: 70%; display: inline-block">\n              <button class="element-add-btn" id="add-tab-selected">Element<img class="search-fold-icon" src="img/unfolded.png"></button><button class="formula-add-btn">Formula<img class="search-fold-icon" src="img/unfolded.png"></button><button class="name-add-btn">Name<img class="search-fold-icon" src="img/unfolded.png"></button>\n            </div>\n            <div class="bool-buttons" style="width: 28%; display: inline-block" >\n              OR <span id="and-or-switch" ></span> AND\n              <button class="not-button">NOT</button>\n              <button class="open-parentheses" >(</button>\n              <button class="close-parentheses">)</button>\n            </div>\n          </div>\n        </div>\n        <div class="add-box">\n          <div class="add-panel">\n          </div>\n        </div>\n        <div class="results-panel">\n        </div>\n      </div>\n    ',this.filterSidePanel=this.element.querySelector(".search-filter-side"),this.addBox=this.element.querySelector(".add-box"),this.searchBox=new n,this.searchBox.setBoolOperator("AND"),this.element.querySelector(".search-box-placeholder").append(this.searchBox.element),this.searchBox.setRemoveElementListener((e=>{this.elementTable.deselectElement(e)})),this.searchBox.setCleanSearchQueryListener((()=>{this.addFormulaButton.disabled=!1,this.addMatNameButton.disabled=!1,this.addElementButton.disabled=!1,this.formulaBox.enableInput(),this.materialNameBox.enableInput(),this.elementTable.deselectAllElements()})),this.searchBox.setSearchQueryChangeListener((()=>{})),this.searchButton=this.searchBox.getSearchButtonElement(),this.searchButton.addEventListener("click",(e=>{this.sendQuery(),this.addBox.style.display="none",this.isVisible=!1,this.currentTabElement.querySelector(".search-fold-icon").src="img/folded.png"})),this.addButtonsBox=this.element.querySelector(".add-buttons"),this.addElementButton=this.addButtonsBox.querySelector(".element-add-btn"),this.addFormulaButton=this.addButtonsBox.querySelector(".formula-add-btn"),this.addMatNameButton=this.addButtonsBox.querySelector(".name-add-btn"),this.currentTabElement=this.addElementButton,this.currentTab="element",this.addPanel=this.element.querySelector(".add-panel");let e=new o(i.IMAGE_DIR+"switch_new");this.element.querySelector("#and-or-switch").appendChild(e.element),e.setListener((e=>{this.searchBox.setBoolOperator(e?"AND":"OR")})),this.notButton=this.element.querySelector(".not-button"),this.notButton.addEventListener("click",(e=>{this.searchBox.addNOT()})),this.openParenthButton=this.element.querySelector(".open-parentheses"),this.closeParenthButton=this.element.querySelector(".close-parentheses"),this.openParenthButton.addEventListener("click",(e=>{this.searchBox.addParentheses(!0)})),this.closeParenthButton.addEventListener("click",(e=>{this.searchBox.addParentheses(!1)})),this.elementTable=new a,this.elementTable.setClickListener((e=>{this.searchBox.addElements(e),this.addMatNameButton.disabled=!0,this.addFormulaButton.disabled=!0})),this.elementTable.setDeselectListener((e=>{this.searchBox.removeElementORFormulaInSearchQuery(e)})),this.formulaBox=new h("Add formula to the search query above"),this.formulaBox.setAddListener((e=>{""!==e.trim()&&(this.searchBox.addTag(e,"formula"),this.addElementButton.disabled=!0,this.addMatNameButton.disabled=!0)})),this.materialNameBox=new d("Add material name to the search query above"),this.materialNameBox.setAddListener((e=>{""!==e.trim()&&(this.searchBox.addTag(e,"material"),this.addElementButton.disabled=!0,this.addFormulaButton.disabled=!0)})),this.filterPanel=new r,this.filterSidePanel.appendChild(this.filterPanel.element),this.filterPanel.setPropsChangeListener((e=>{this.sendQuery()})),this.materialList=new l,this.resultsPage=this.element.querySelector(".results-panel"),this.materialList.attachAndSetEvents(this.resultsPage),this.addPanel.appendChild(this.elementTable.element),this.allowOtherElementsCheckbox=this.element.querySelector("#allow-other-elements"),this.allowOtherElementsCheckbox.addEventListener("change",(e=>{})),this._events()}_events(){this.addButtonsBox.addEventListener("click",(e=>{if(e.target!==e.currentTarget){let t=e.target.className,s=t.indexOf("add-btn");if(s>0){let i,n=t.substring(0,s-1);"element"===n?i=this.elementTable.element:"name"===n?i=this.materialNameBox.element:"formula"===n&&(i=this.formulaBox.element),this.addPanel.replaceChild(i,this.addPanel.lastChild);const a=e.target.querySelector(".search-fold-icon");this.currentTab==n?(this.isVisible?(this.addBox.style.display="none",a.src="img/folded.png"):(this.addBox.style.display="block",a.src="img/unfolded.png"),this.isVisible=!this.isVisible):(this.addBox.style.display="block",a.src="img/unfolded.png",this.isVisible=!0);let l=this.element.querySelector("."+this.currentTab+"-add-btn");this._setTabSelectedStyles(l,!1),this._setTabSelectedStyles(e.target,!0),this.currentTab=n,this.currentTabElement=l}}}))}sendQuery(){const e=document.getElementById("allow-other-elements");let t=!0;e&&(t=e.checked);const s=this.searchBox.getOptimadeQuery(t),i=function(e){let t="";return e.forEach(((e,s)=>{if("band_gap"===s){const[s,i]=e[0].split(":");""!==s&&(t+=(""===t?"":" AND ")+`(band_gap >= ${s})`),""!==i&&(t+=(""===t?"":" AND ")+`(band_gap <= ${i})`)}else{let i="";e.forEach((e=>{i+=(""===i?"":" OR ")+s+"="+(!0===e?"TRUE":'"'+e+'"')})),t+=(""===t?"":" AND ")+`(${i})`}})),t}(this.filterPanel.getValues()),n=""!==s&&""!==i?" AND ":"";this.materialList.initSearch(s+n+i)}_addFiltersInSearchQuery(e,t){let s={bool:{}};return s.bool.must=[],s.bool.must.push(t),e.forEach(((e,t)=>{let i=t.split("-").join("_");"mass-density"===t||"band-gap"===t?s.bool.must.push(this._getFieldESRange(i,e)):"band-gap-type"===t?"both"!==e&&s.bool.must.push(this._getESSimpleMatch("band_gap_direct","direct"===e)):t.startsWith("has")?s.bool.must.push(this._getESSimpleMatch(i,e,!1)):s.bool.must.push(this._getESTermsArray(i,e))})),s}_setTabSelectedStyles(e,t){e.id=t?"add-tab-selected":""}_sortElements(e){let t=[],s=[];return e.forEach((e=>t.push(i.ELEMENTS.indexOf(e)))),t.sort(((e,t)=>e-t)),t.forEach((e=>s.push(i.ELEMENTS[e]))),s}_reduceFormula(e,t=!0){let s,n=0,a=new Map;for(;n<e.length;){let t=e.substring(n,n+2),l=e.substring(n,n+1);if(i.ELEMENTS.indexOf(t)>=0)a.set(t,1),n+=2,s=t;else if(i.ELEMENTS.indexOf(l)>=0)a.set(l,1),n++,s=l;else{let e=parseInt(t);e>=10?n+=2:n++,a.set(s,e)}}let l=0;for(;!r(a);){let e=1;if(o(a,2)?e=2:o(a,3)?e=3:o(a,5)?e=5:o(a,7)?e=7:o(a,11)&&(e=11),a.forEach(((t,s)=>{a.set(s,t/e)})),l++,l>5)break}function r(e){let t=100;return e.forEach(((e,s)=>{e<t&&(t=e)})),1===t}function o(e,t){let s=!0;return e.forEach(((e,i)=>{e%t!=0&&(s=!1)})),s}let d=[],h="";return t?a.forEach(((e,t)=>d.push(t+e))):this._sortElements(Array.from(a.keys())).forEach((e=>{h+=e+a.get(e)})),console.log("_reduceFormula RETURN: ",a,d,h),t?d:h}_processFormula(e,t){let s,n=0,a=new Map;for(;n<e.length;){let t=e.substring(n,n+2),l=e.substring(n,n+1);if(i.ELEMENTS.indexOf(t)>=0)a.set(t,1),n+=2,s=t;else if(i.ELEMENTS.indexOf(l)>=0)a.set(l,1),n++,s=l;else{let e=parseInt(t);e>=10?n+=2:n++,a.set(s,e)}}if("tokens"===t){let e=[];return a.forEach(((t,s)=>e.push(s+t))),console.log("_processFormula RETURN: ",a,e),e}{let e=this._sortElements(Array.from(a.keys()));if("canonical-formula"===t){let t="";return e.forEach((e=>{t+=e+a.get(e)})),console.log("_processFormula RETURN: ",a,t),t}{let t="",s=[];return e.forEach((e=>{t+=e;let i=a.get(e);0!==i&&s.push(e+i)})),console.log("_processFormula RETURN: ",a,[s,t]),[s,t]}}}}},305:(e,t,s)=>{let i=s(541);e.exports=class{constructor(){}translate(e,t,s){let n=[...e],a=[...t];for(let e=0;e<n.length;++e){let t=n[e],s=a[e];"E"!==s&&"MN"!==s||(n[e]=`"${t}"`)}for(let e=0;e<n.length;++e){let t=n[e];if("F"===a[e]){const s=new i(t),a=[];s.formulaMap.forEach(((e,t)=>{const s='"'+t+(1===e?"":+e)+'"';a.push(s)})),n[e]=a.join(", ")}}[n,a]=this.simplify(n,a);for(let e=0;e<n.length;++e){let t=n[e],i=a[e];"E"===i?t=s?"elements HAS ALL "+t:"elements HAS ONLY "+t:"F"===i?t=s?"formula HAS ALL "+t:"formula HAS ONLY "+t:"MN"===i&&(t="material_name = "+t),n[e]=t}let l="("+n.join(" ")+")";return console.log("FINAL OPTIMADE QUERY:"),console.log(l),l}combineANDIn(e,t){const s=[],i=[];for(let n=0;n<e.length;){const a=e[n-1],l=(t[n-1],e[n]),r=t[n],o=e[n+1],d=(t[n+1],e[n+2]),h=t[n+2];if(("E"===r&&"E"===h||"F"===r&&"F"===h)&&"AND"===o&&"NOT"!==a){let a=!0,r=h,o=[l,d];for(n+=3;a;){const l=e[n],d=(t[n],e[n+1]),h=t[n+1];"AND"===l&&h===r?(o.push(d),n+=2):(a=!1,s.push(o.join(", ")),i.push(r))}}else s.push(l),i.push(r),n+=1}return[s,i]}findPairs(e,t){const s=new Map;for(let i=0;i<e.length;++i){const n=e[i];if(t[i],"("===n){let n=0;for(let a=i+1;a<e.length;++a){const l=e[a];if(t[a],"("===l&&(n+=1),")"===l){if(0==n){s.set(i,a),s.set(a,i);break}n-=1}}}}return s}removeParenthesis(e,t){const s=this.findPairs(e,t);let i=[];for(let n=0;n<e.length;++n){const a=e[n];if(t[n],"("===a){let a=s.get(n);if(0===n&&a==e.length-1)i.push(a),i.push(n);else{e.slice(n+1,a);const s=t.slice(n+1,a);let l=!0;for(let e of s)if("S"===e){l=!1;break}l&&(i.push(a),i.push(n))}}}for(let n=0;n<e.length;++n){const a=e[n];if(t[n],e[n+1],t[n+1],"("===a&&"("===a){let e=s.get(n);s.get(n+1)==e-1&&(i.push(n),i.push(e))}}i=i.sort(((e,t)=>t-e));for(let s=0;s<i.length;++s)e.splice(i[s],1),t.splice(i[s],1);return[e,t]}combineANDOut(e,t){let s=e,i=t;const n=this.findPairs(e,t);let a=!1;for(let l=0;l<e.length;++l){const r=e[l],o=(t[l],e[l+1]),d=(t[l+1],e[l+2]);if(t[l+2],"AND"===o&&(")"===r||"("===d)){let o,h,c,u,p,m;a=!0,")"===r?(m=n.get(l),o=e.slice(m,l+1),h=t.slice(m,l+1)):(m="NOT"===e[l-1]?l-1:l,o=e.slice(m,l+1),h=t.slice(m,l+1),o.unshift("("),h.unshift("P"),o.push(")"),h.push("P")),"("===d?(p=n.get(l+2)+1,c=e.slice(l+2,p),u=t.slice(l+2,p)):(p="NOT"===e[l+2]?l+4:l+3,c=e.slice(l+2,p),u=t.slice(l+2,p),c.unshift("("),u.unshift("P"),c.push(")"),u.push("P"));const y=[];let v=1;for(let e=1;e<c.length-1;++e)"OR"===c[e]?(y.push([c.slice(v,e),u.slice(v,e)]),v=e+1):e===c.length-2&&y.push([c.slice(v,e+1),u.slice(v,e+1)]);let g=[],f=[];for(let e=0;e<y.length;++e){let t=[],s=[];t=t.concat(y[e][0]),s=s.concat(y[e][1]),t.push("AND"),s.push("S"),t=t.concat(o),s=s.concat(h),0===e?(y.length>1&&(g.push("("),f.push("P")),g=g.concat(t),f=f.concat(s),y.length>1&&(g.push(")"),f.push("P"))):(g.push("OR"),f.push("S"),g.push("("),f.push("P"),g=g.concat(t),f=f.concat(s),g.push(")"),f.push("P"))}g.unshift("("),f.unshift("P"),g.push(")"),f.push("P"),s=e.slice(0,m).concat(g).concat(e.slice(p,e.length)),i=t.slice(0,m).concat(f).concat(t.slice(p,e.length));break}}return[s,i,a]}simplify(e,t){let s;return[e,t]=this.removeParenthesis(e,t),[e,t]=this.combineANDIn(e,t),[e,t]=this.removeParenthesis(e,t),[e,t,s]=this.combineANDOut(e,t),s?[e,t]=this.simplify(e,t):([e,t]=this.removeParenthesis(e,t),[e,t]=this.combineANDIn(e,t),[e,t]=this.removeParenthesis(e,t)),[e,t]}}},23:(e,t,s)=>{"use strict";let i=s(212),n=s(305);s(541),e.exports=class{constructor(){this.currentConnector,this.notItem,this.inSubquery,this.rootQuery,this._resetState(),this.element=document.createElement("div"),this.element.className="search-box",this.element.innerHTML=' \n      <div id="composition-title" class="filter-section-title" style>\n        <div>Composition</div>\n      </div>\n      <div class="search-query-wrapper" >\n        <div id="syntax-error">\n          <div>Invalid query syntax</div>\n        </div>\n        <div class="search-query-box" style="float: left;"></div>\n        <button class="clean-btn" style="float: right;">Clear</button>\n      </div>\n      \x3c!-- this button should be out of the search box because its functionality\n           is not part of the search box, it\'s general for the search module\n           and it\'s probably being removed eventually --\x3e \n      <button class="search-btn" >Search</button>\n    ',this.cleanButton=this.element.querySelector(".clean-btn"),this.cleanButton.addEventListener("click",(e=>{this._resetState(),this.renderQuery(),this.cleanSearchQueryListener()})),this.searchQueryBox=this.element.querySelector(".search-query-box"),this.searchQueryBox.addEventListener("click",(e=>{if("remove-label"===e.target.className){let t=e.target.parentElement.getAttribute("data-el");this.removeElementORFormulaInSearchQuery(t)}}))}_resetState(){this.notItem=!1,this.inSubquery=!1,this.rootQuery={type:"query",value:[],not:!1}}getOldQueryFormat(){const e=[];this.rootQuery.value.forEach((t=>{e.push(...i(t))}));const t=[],s=[];return e.forEach((e=>{t.push(e.split(":")[0]),s.push(e.split(":")[1])})),console.log("OLD F:",e,t,s),[t,s];function i(e){const t=[];if(e.not&&t.push("NOT:S"),"query"===e.type)t.push("(:S"),e.value.forEach((e=>{t.push(...i(e))})),t.push("):S");else{let s=e.value+":";"element"===e.type?s+="E":"formula"===e.type?s+="F":"material"===e.type?s+="MN":s+="S",t.push(s)}return t}}getOptimadeQuery(e){if(0===this.rootQuery.value.length)return"";const t=new n,[s,i]=this.getOldQueryFormat();return t.translate(s,i,e)}setBoolOperator(e){this.currentConnector=e}renderQuery(){function e(e){return`<span class="search-query-symbol">${e}</span>`}document.querySelector("#syntax-error").style.visibility="hidden",this.searchQueryBox.innerHTML=function t(s){if("connector"===s.type)return e(s.value);if(!s.type&&s.not)return e(" NOT");if("element"===s.type||"formula"===s.type||"material"===s.type)return(s.not?e(" NOT"):"")+`<span class="search-label" data-el="${n=s.value}" >\n          ${"formula"===s.type?i.getSubscriptedFormula(n):n}\n          <img src="img/cross.svg" height="6px" class="remove-label"\n            style="vertical-align: middle; padding: 4px 3px 6px 5px;" />\n          </span>`;{let i="";s.value.forEach((e=>{i+=t(e)}));const n=s.not?e(" NOT"):"",a=s.open;return n+(void 0===a?i:e(" (")+i+(a?"":e(") ")))}var n}(this.rootQuery),this.searchQueryChangeListener&&this.searchQueryChangeListener()}_addItem(e){const t=this.rootQuery.value,s=this.inSubquery?t[t.length-1].value:t;if(s.length>0&&"connector"!==s[s.length-1].type&&s.push({type:"connector",value:this.currentConnector}),"NOT"===e)s.push({not:!0});else if("SUBQUERY"===e)t.push({type:"query",value:[],open:!0,not:!1});else{const[t,i]=e.split(":");s.push({type:t,value:i,not:!1})}console.log("ROOT QUERY ",this.rootQuery),this.renderQuery()}addTag(e,t){if(this.notItem){const s=this.rootQuery.value,i=this.inSubquery?s[s.length-1].value:s;i[i.length-1].type=t,i[i.length-1].value=e,this.notItem=!1,this.renderQuery()}else this._addItem(t+":"+e)}addElements(e){let t=e.length;for(;t--;)this.addTag(e[t],"element");return!0}addParentheses(e){const t=this.rootQuery.value;e&&(this.notItem?(t[t.length-1].type="query",t[t.length-1].value=[],this.notItem=!1):this._addItem("SUBQUERY")),t[t.length-1].open=e,this.renderQuery(),this.inSubquery=e}addNOT(){this._addItem("NOT"),this.notItem=!0}removeElementORFormulaInSearchQuery(e){return function e(t,s){const i=t.value;for(let t=0;t<i.length;t++){if(i[t].value===s){i[t+1]&&"connector"===i[t+1].type?i.splice(t,2):i.splice(t,1);break}"query"===i[t].type&&(e(i[t],s),0==i[t].value.length&&(i[t+1]&&"connector"===i[t+1].type?i.splice(t,2):i.splice(t,1)))}}(this.rootQuery,e),this.renderQuery(),console.log("ROOT QUERY REMOVING ",this.rootQuery),i.ELEMENTS.indexOf(e)>=0&&this.removeElementListener(e),0===this.rootQuery.value.length&&this.cleanSearchQueryListener(),!0}setCleanSearchQueryListener(e){this.cleanSearchQueryListener=e}setRemoveElementListener(e){this.removeElementListener=e}setSearchQueryChangeListener(e){this.searchQueryChangeListener=e}getSearchButtonElement(){return this.element.querySelector(".search-btn")}}}},t={};function s(i){var n=t[i];if(void 0!==n)return n.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,s),a.exports}(()=>{"use strict";let e=s(212),t=(s(317),s(462)),i=s(292),n=s(794),a=s(95),l=s(226),r=s(882),o=s(719),d=document.getElementById("content"),h=document.querySelector("title");var c=window.location,u=c.protocol+"//"+c.host+"/"+c.pathname;i.subscribe("authenticated",(e=>{let t=document.location.hash.substring(2);t.lastIndexOf("/")===t.length-1&&(t=t.substring(0,t.length-1)),t.indexOf("/")>0&&"material"===t.split("/")[0]&&(g.style.visibility="visible")}));var p=new Keycloak({url:window.nomadEnv.keycloakBase,realm:window.nomadEnv.keycloakRealm,clientId:window.nomadEnv.keycloakClientId});window.keycloak=p,window.keycloak.onAuthLogout=function(){alert("logout")},window.keycloak.onTokenExpired=function(){alert("expired")};let m=document.querySelector("#login-button"),y=document.querySelector("#logout-button"),v=document.querySelector("#user-name");p.init({onLoad:"check-sso",checkLoginIframe:!1,silentCheckSsoRedirectUri:`${u}silent-check-sso.html`,promiseType:"native"}).then((e=>{e?p.loadUserProfile().then((function(e){v.textContent=`${e.firstName} ${e.lastName}`,m.style.display="none",y.style.display="inline",i.publish("authenticated")})).catch((function(){console.log("Failed to load user profile.")})):(m.style.display="inline",y.style.display="none",v.textContent="Guest"),i.publish("keycloak")})),m.onclick=()=>{p.login({redirectUri:`${u}#/search`}).catch((()=>{console.log("Authentication error.")}))},y.onclick=()=>{p.logout()};let g=document.getElementById("calc-flagging-tab");g.style.top=window.innerHeight/2+"px",g.addEventListener("click",(e=>{t.show(b.getCurrentPageStatus())}));let f,b,x,S,w=new class{constructor(){this.element=document.querySelector("#breadcrumb-placeholder"),this.element.innerHTML='\n      <span class="goto-page Search">Search</span>\n      <span class="goto-page Results">&nbsp; > &nbsp; <span>Results</span></span>\n      <span class="goto-page Overview">&nbsp; > &nbsp; <span>Overview</span></span>\n      <span class="Details">\n        &nbsp; > &nbsp;\n        <select class="details-dropdown" >\n          <option value="structure">Structure</option>\n          <option value="electronicstruct">Electronic structure</option>\n          <option value="methodology">Methodology</option>\n          <option value="thermalprops">Thermal Properties</option>\n          \x3c!-- elasticconst--\x3e\n        </select>\n      </span>\n    ',this.resultsSel=this.element.querySelector(".Results"),this.overviewSel=this.element.querySelector(".Overview"),this.detailsSel=this.element.querySelector(".Details"),this.detailsDropDown=this.element.querySelector(".details-dropdown"),this.element.querySelector(".Search").addEventListener("click",(t=>{e.setBrowserHashPath("search")})),this.resultsSel.addEventListener("click",(t=>{e.setBrowserHashPath("search/results")})),this.overviewSel.addEventListener("click",(()=>{e.setBrowserHashPath("material",e.materialId)})),this.detailsDropDown.addEventListener("change",(t=>{e.setBrowserHashPath("material",o.getMaterialData().material_id+"/"+t.target.value)}));let t=this;this.detailsDropDown.addEventListener("focus",(function e(){let s=t.detailsDropDown.querySelector('option[value="electronicstruct"]');o.hasElecStructureData()||t.detailsDropDown.removeChild(s);let i=t.detailsDropDown.querySelector('option[value="thermalprops"]');o.hasThermalData()||t.detailsDropDown.removeChild(i),t.detailsDropDown.removeEventListener("focus",e)}))}setState(t,s){this.resultsSel.querySelector("span").style.fontWeight="normal";let i=this.overviewSel.querySelector("span");i.style.fontWeight="normal","search"===t?(this.overviewSel.style.display="none",this.detailsSel.style.display="none","results"===s?(this.resultsSel.style.display="inline",this.resultsSel.querySelector("span").style.fontWeight="bold",this.element.style.visibility="visible"):this.element.style.visibility="hidden"):"material"===t&&(this.element.style.visibility="visible",this.resultsSel.style.display=e.searchResults?"inline":"none",this.overviewSel.style.display="inline",void 0===s?(this.detailsSel.style.display="none",i.style.fontWeight="bold"):(this.detailsSel.style.display="inline",this.detailsDropDown.value=s))}},_=!1;function E(e){S&&d.removeChild(S),S=e,d.appendChild(S)}i.subscribe("show-material",(e=>{w.setState("material",e.view),void 0===x&&(b=new a,x=b.element),E(x),b.setMaterialView(e),r.show(!1),p.authenticated&&(g.style.visibility="visible")})),i.subscribe("show-search",(e=>{g.style.visibility="hidden",h.innerHTML="NOMAD Encyclopedia - Search",w.setState("search",e),E(f.element),_=!0})),i.subscribe("keycloak",(e=>{_&&f.sendQuery()})),n.add("search",(e=>i.publish("show-search",e))),n.add("material",((e,t)=>i.publish("show-material",{material_id:e,view:t}))),document.querySelector("#text-logo").onclick=()=>{e.setBrowserHashPath("search")},f=new l,""===document.location.hash&&(document.location+="#/search"),n.route(),document.querySelector("#user-name");let L=function(e){let t=("; "+document.cookie).split("; user_info=");if(2===t.length)return t.pop().split(";").shift()}();if(void 0!==L){let e=JSON.parse((C=L).substring(1,C.length-1).replace(/\\054/g,",").replace(/\\/g,""));setAppAuthenticated(e)}var C})()})();
\ No newline at end of file
+(()=>{var e={462:(e,t,s)=>{"use strict";let i=s(212),n=s(719),a=document.querySelector("#flagging-form-popup-bg"),l=document.querySelector("#flagging-form-popup");l.innerHTML='\n\n<div> <img src="img/cross.svg"  height="12px"\n  style="float: right; cursor: pointer" />\n</div>\n\n<div class="form-wrapper">\n  <div class="popup-title"> Error reporting</div>\n  <br>\n  <div> Material: <span id="error-material-id"></span></div>\n  <select id="flagging-category" name="category">\n    <option value="">Select a category *</option>\n    <option value="structure">Structure</option>\n    <option value="electronicstruct">Electronic structure</option>\n    <option value="methodology">Methodology</option>\n    <option value="thermalprops">Thermal properties</option>\n  </select>\n\n  <select id="flagging-subcategory" name="subcategory">\n\n  </select>\n\n  <textarea id="subject" name="subject" style="height:200px"\n  placeholder="Write a short explanation about the error" ></textarea>\n\n  <div id="form-validation-msg"> </div>\n\n  <div style="display: flex; justify-content: space-evenly;">\n    <button style="display: block">Send</button>\n  </div>\n\n\n</div>\n';let r=l.querySelector("#flagging-category"),o=r.querySelector('option[value="electronicstruct"]'),d=r.querySelector('option[value="thermalprops"]'),h=l.querySelector("#flagging-subcategory"),c=l.querySelector("img"),u=l.querySelector("#form-validation-msg"),p=l.querySelector("button"),m=l.querySelector("#error-material-id"),y=null;function v(){a.style.visibility="hidden",l.style.visibility="hidden",r.selectedIndex=0,h.selectedIndex=0,l.querySelector("textarea").value="",u.innerHTML=""}function g(e,t){let s=document.createElement("option");return s.value=void 0===t?e:t,s.innerHTML=e,s}c.addEventListener("click",(e=>{v()})),p.addEventListener("click",(e=>{let t=r.options[r.selectedIndex];var s=window.keycloak;if(!s.authenticated)return void(u.innerHTML="Your authentication has expired. Please login again.");if(!r.disabled&&""===t.value)return void(u.innerHTML="The category fields must be set");if(r.disabled&&""===h.value&&t.value!==i.MAT_VIEW.methodology)return void(u.innerHTML="The subcategory fields must be set");u.innerHTML="Sending report...";let a=l.querySelector("textarea").value,o=n.getMaterialData().material_id;s.loadUserProfile().then((function(e){let s={};s.server=i.getServerLocation(),s.username=e.username,s.email=e.email,s.first_name=e.firstName,s.last_name=e.lastName,s.message=a,s.category=t.text,r.disabled?s.subcategory=h.options[h.selectedIndex].text:s.representatives=n.getRepresentatives(),i.serverReqPOST(i.getReportURL(o),JSON.stringify(s),(e=>{204===e.target.status?v():u.innerHTML="Could not connect to the service. Please check your connection and try again later."}))})).catch((e=>{console.log(e),u.innerHTML="Could not connect to the service. Please check your connection and try again later."}))})),e.exports={show:function(e){y=e.eStructCalcs,o.style.display=n.hasElecStructureData()?"block":"none",d.style.display=n.hasThermalData()?"block":"none",function(e){h.innerHTML="";let t=n.getMaterialData().material_id;if(m.textContent=t,null===e)r.disabled=!1,h.style.display="none";else switch(r.disabled=!0,h.style.display="block",h.appendChild(g("Choose the subcategory *","")),e){case i.MAT_VIEW.structure:r.selectedIndex=1,h.appendChild(g("Structure representation")),h.appendChild(g("Calculation tree")),h.appendChild(g("Summary")),h.appendChild(g("Specific calculation"));break;case i.MAT_VIEW.electronicstruct:r.selectedIndex=2,h.appendChild(g("Calculation tree")),h.appendChild(g("Summary")),h.appendChild(g("Band structure")),h.appendChild(g("DOS")),h.appendChild(g("Brillouin zone"));break;case i.MAT_VIEW.methodology:r.selectedIndex=3,h.style.display="none";break;case i.MAT_VIEW.thermalprops:r.selectedIndex=4,h.appendChild(g("Calculation tree")),h.appendChild(g("Phonon dispersion")),h.appendChild(g("Phonon DOS")),h.appendChild(g("Specific heat")),h.appendChild(g("Helmholtz free energy"))}}(e.pageId);let t=l.getBoundingClientRect(),s=(window.innerWidth-t.width)/2,c=(window.innerHeight-t.height)/2;l.style.left=s+"px",l.style.top=c-20+"px",l.style.visibility="visible",a.style.visibility="visible"},hide:v}},223:(e,t,s)=>{"use strict";let i=s(212),n=s(951),a=document.querySelector("#info-tooltip"),l=document.querySelector("#tooltip-content"),r=[],o=null,d=!1,h=null;function c(){null!==o&&window.clearTimeout(o),o=window.setTimeout((e=>a.style.display="none"),1e3)}let u=new n(i.IMAGE_DIR+"switch");function p(e){e.addEventListener("mouseover",m),e.addEventListener("mouseout",(t=>{c(),e.style.cursor="inherit"})),e.className="info-sys-label"}function m(e){let t=e.target.getBoundingClientRect(),s=e.target.getAttribute("info-sys-data"),i=s.indexOf(".value");if(i>0){let e=h[s.split("-").join(" ").substring(0,i)];if(void 0===e.value_template){let t=e.values[s.split(":")[1]];l.innerHTML=v(t)}else{let t=e.value_template;t.text=y(t.text,s.split(":")[1]),t.link=y(t.link,s.split(":")[1]),l.innerHTML=v(t)}}else l.innerHTML=v(h[s.split("-").join(" ")]);a.style.visibility="hidden",a.style.display="block";let n=a.getBoundingClientRect(),r=n.width-t.width,d=t.left-r/2;d+n.width>window.innerWidth&&(d=window.innerWidth-n.width);let c=-window.pageYOffset;a.style.left=(d<0?5:d)+"px",a.style.top=t.top+t.height-c+"px",a.style.visibility="visible",window.clearTimeout(o),e.target.style.cursor="help"}function y(e,t){let s=e.indexOf("${"),i=e.indexOf("}");return s>=0&&i>=0&&i>s?e.substring(0,s)+t+e.substring(i+1):e}function v(e){let t="";return void 0===e.text||(t+=e.text),void 0!==e.link&&(void 0!==e.text&&(t+="<br>"),t+='<a href="'+e.link+'" target="_blank">More information</a>'),t}document.querySelector("#info-sys-switch-box").appendChild(u.element),u.setListener((e=>{d=!e,e?r.forEach((e=>{e.removeEventListener("mouseover",m),e.className=""})):(null===h&&i.serverReq("infosys.json",(e=>h=JSON.parse(e.target.response))),r.forEach(p)),a.addEventListener("mouseover",(e=>{window.clearTimeout(o)})),a.addEventListener("mouseout",(e=>{c()}))})),e.exports={addToInfoSystem:function(e){let t=e.querySelectorAll("span[info-sys-data]");for(let e=0;e<t.length;++e)r.push(t[e]);if(d)for(let e=0;e<t.length;++e)p(t[e])},addElementToInfoSystem:function(e,t){r.push(e),e.setAttribute("info-sys-data",t),d&&p(e)}}},971:(e,t,s)=>{"use strict";let i=s(584);const n="http://www.w3.org/2000/svg";e.exports=class{constructor(e={left:20,right:0,top:0,bottom:20}){this.margins=e,this.svg=document.createElementNS(n,"svg"),this.parentElement=null,this.plotContent=null,this.axisGroup=null,this.yAxisLabelsGroup=null,this.yLabelText=null,this.noDataGroup=null,this.yZoom=1,this.yOffset=0,this.repaintListener=null,this.nodataLabel=null,this.outOfRangeColorActivated=!0}attach(e,t,s){this.parentElement=e,this.parentElement.appendChild(this.svg),this.width=void 0!==t?t:this.parentElement.clientWidth,this.height=void 0!==s?s:this.svg.width,this.svg.setAttribute("width",this.width),this.svg.setAttribute("height",this.height),this.plotRangeX=this.width-this.margins.left-this.margins.right,this.plotRangeY=this.height-this.margins.top-this.margins.bottom,this.yAxisArea=document.createElementNS(n,"svg"),this.svg.appendChild(this.yAxisArea);let a=this.margins.left;this.plotAreaHeight=this.height-this.margins.bottom-this.margins.top,this.yAxisArea.setAttribute("width",a),this.yAxisArea.setAttribute("height",this.plotAreaHeight),this.yAxisArea.setAttribute("x",0),this.yAxisArea.setAttribute("y",0),this.plotArea=document.createElementNS(n,"svg"),this.svg.appendChild(this.plotArea),this.plotAreaWidth=this.width-this.margins.left-this.margins.right,this.plotArea.setAttribute("width",this.plotAreaWidth),this.plotArea.setAttribute("height",this.plotAreaHeight),this.plotArea.setAttribute("x",this.margins.left),this.plotArea.setAttribute("y",this.margins.top),this.plotAreaBg=i.addRect(this.plotArea,0,0,this.plotAreaWidth,this.plotAreaHeight),this.plotAreaBg.setAttribute("class","moveable-plot"),this.plotAreaBg.setAttribute("opacity",0),this._events()}isAttached(){return null!==this.parentElement}setAxisRangeAndLabels(e,t,s,n,a,l,r,o,d,h=2){this.xLabel=e,this.xMin=t,this.xMax=s,this.yMinInit=a,this.yMaxInit=l,this.yMin=r,this.yMax=o,this.yLabelGapInit=d,this.xRel=this.plotRangeX/(this.xMax-this.xMin),this.yRel=this.plotRangeY/(this.yMaxInit-this.yMinInit),this._resetAxisGroup(),i.addLine(this.axisGroup,0,0,this.plotRangeX,0,"main-axis"),i.addLine(this.axisGroup,0,0,0,-this.plotRangeY,"main-axis"),i.addLine(this.axisGroup,this.plotRangeX,0,this.plotRangeX,-this.plotRangeY,"main-axis"),i.addLine(this.axisGroup,0,-this.plotRangeY,this.plotRangeX,-this.plotRangeY,"main-axis"),null!==n&&(this.yLabelText=i.addText(this.svg,0,0,n,"middle","axis-steps-big"),this.yLabelText.setAttribute("transform","translate(15,"+(this.plotRangeY/2+this.margins.top)+") rotate(-90)")),null!==e&&i.addText(this.axisGroup,this.plotRangeX/2,this.margins.bottom-12,this.xLabel,"middle","axis-steps-big"),this._resetYAxisLabelGroup(),this.precalculation_1=this.plotAreaHeight+this.yMinInit*this.yRel,this.precalculation_2=this.precalculation_1}_events(){let e;this.plotArea.addEventListener("wheel",(e=>{e.preventDefault(),e.deltaY>0&&this.yZoom>.5?this.yZoom-=.2:e.deltaY<0&&this.yZoom<2&&(this.yZoom+=.2),this.repaint(),null!==this.repaintListener&&this.repaintListener(this.yZoom,this.yOffset)})),this.plotArea.addEventListener("mousedown",(t=>{t.preventDefault(),e=t.clientY+this.yOffset,this.plotArea.addEventListener("mousemove",s),this.plotArea.addEventListener("mouseup",(e=>{this.plotArea.removeEventListener("mousemove",s)})),this.plotArea.addEventListener("mouseout",(e=>{this.plotArea.removeEventListener("mousemove",s)}))}));let t=this;function s(s){t.yOffset=e-s.clientY,t.precalculation_2=t.precalculation_1-t.yOffset,t.repaint(),null!==t.repaintListener&&t.repaintListener(t.yZoom,t.yOffset)}}setYZoomAndOffset(e,t){this.yZoom=e,this.yOffset=t,this.precalculation_2=this.precalculation_1-this.yOffset}setExternalYAxisMax(e){this.externalYAxisMax=e}getYAxisMax(){return this.yAxisMax}repaint(){let e;this._resetYAxisLabelGroup(),e=this.yZoom>1?this.yLabelGapInit/5:this.yLabelGapInit;let t=Math.floor(this.yMin/e)*e,s=Math.ceil(this.yMax/e)*e;if(this.yAxisMax=s,void 0!==this.externalYAxisMax&&(s=this.externalYAxisMax),null!==this.yLabelText)for(let n=t;n<s+1;n+=e)i.addLine(this.yAxisLabelsGroup,this.margins.left,this.transformY(n),this.margins.left-3,this.transformY(n)),i.addText(this.yAxisLabelsGroup,this.margins.left-5,this.transformY(n)+5,n,"end","axis-steps");this._resetPlotContent(),this.outOfRangeColorActivated&&(i.addRect(this.plotContent,0,this.transformY(this.yMax)-2*this.plotAreaHeight,this.plotAreaWidth,2*this.plotAreaHeight).setAttribute("class","out-of-range"),i.addRect(this.plotContent,0,this.transformY(this.yMin),this.plotAreaWidth,2*this.plotAreaHeight).setAttribute("class","out-of-range")),i.addLine(this.plotContent,0,this.transformY(0),this.plotRangeX,this.transformY(0),"zeroline"),this.repaintData(t,s),this.plotArea.removeChild(this.plotAreaBg),this.plotArea.appendChild(this.plotAreaBg)}setRepaintListener(e){this.repaintListener=e}transformY(e){return-e*this.yZoom*this.yRel+this.precalculation_2}_resetPlotContent(){null!==this.plotContent&&this.plotArea.removeChild(this.plotContent),this.plotContent=document.createElementNS(n,"g"),this.plotArea.appendChild(this.plotContent)}_resetAxisGroup(){null!==this.axisGroup&&this.svg.removeChild(this.axisGroup),this.axisGroup=document.createElementNS(n,"g"),this.svg.appendChild(this.axisGroup),this.axisGroup.setAttribute("transform","matrix(1 0 0 1 "+this.margins.left+" "+(this.height-this.margins.bottom)+")")}_resetYAxisLabelGroup(){null!==this.yLabelText&&(null!==this.yAxisLabelsGroup&&this.yAxisArea.removeChild(this.yAxisLabelsGroup),this.yAxisLabelsGroup=document.createElementNS(n,"g"),this.yAxisArea.appendChild(this.yAxisLabelsGroup))}_reset(){this.yZoom=1,this.yOffset=0,this._resetPlotContent(),null!==this.yLabelText&&(this.svg.removeChild(this.yLabelText),this.yLabelText=null),null!==this.noDataGroup&&(this.svg.removeChild(this.noDataGroup),this.noDataGroup=null)}setNoData(){this._resetYAxisLabelGroup(),this._resetPlotContent(),this._resetAxisGroup(),null===this.noDataGroup&&(this.noDataGroup=document.createElementNS(n,"g"),this.svg.appendChild(this.noDataGroup),i.addRect(this.noDataGroup,0,0,this.width,this.height),this.noDataGroup.setAttribute("fill","#EEE"),i.addText(this.noDataGroup,this.width/2,this.height/2+10,"NO DATA","middle","nodata"))}}},317:(e,t,s)=>{"use strict";s(212);let i=document.querySelector("#loading-popup"),n=new Set;e.exports={show:function(e){n.add(e,!0);let t=i.getBoundingClientRect(),s=(window.innerWidth-t.width)/2,a=(window.innerHeight-t.height)/2;i.style.left=s+"px",i.style.top=a-100+"px",i.style.visibility="visible"},hide:function(e){n.delete(e),0===n.size&&(i.style.visibility="hidden")},reset:function(){n=new Set,i.style.visibility="hidden"}}},666:(e,t,s)=>{"use strict";let i=s(584);const n="http://www.w3.org/2000/svg";e.exports=class{constructor(e={left:20,right:0,top:10,bottom:20}){this.svg=document.createElementNS(n,"svg"),this.plotArea=document.createElementNS(n,"g"),this.svg.appendChild(this.plotArea),this.margins=e,this.parentElement=null,this.yLabelText=null,this.noDataGroup=null}attach(e,t,s){this.parentElement=e,this.parentElement.appendChild(this.svg),this.width=void 0!==t?t:this.parentElement.clientWidth,this.height=void 0!==s?s:this.svg.width,this.svg.setAttribute("width",this.width),this.svg.setAttribute("height",this.height),this.plotRangeX=this.width-this.margins.left-this.margins.right,this.plotRangeY=this.height-this.margins.top-this.margins.bottom}isAttached(){return null!==this.parentElement}setRangeAndLabels(e,t,s,i,n,a){this.xLabel=e,this.xMin=t,this.xMax=s,this.yLabel=i,this.yMin=n,this.yMax=a,this.xRel=this.plotRangeX/(this.xMax-this.xMin),this.yRel=this.plotRangeY/(this.yMax-this.yMin)}drawAxis(e=0,t=0,s=2){if(this.plotArea.setAttribute("transform","matrix(1 0 0 1 "+this.margins.left+" "+(this.height-this.margins.bottom)+")"),this.yLabelText=i.addText(this.svg,0,0,this.yLabel,"middle","axis-steps-big"),this.yLabelText.setAttribute("transform","translate(13,"+(this.plotRangeY/2+this.margins.top)+") rotate(-90)"),i.addText(this.plotArea,this.plotRangeX/2,this.margins.bottom-1,this.xLabel,"middle","axis-steps-big"),null!==e){let t=this.plotRangeX/e;for(let n=0;n<=e;n++)i.addLine(this.plotArea,t*n,0,t*n,4,1),i.addText(this.plotArea,t*n,14,+(t*n/this.xRel+this.xMin).toFixed(s),"middle","statisticsviewersteps")}if(null===t&&this.yMax>0&&this.yMin<0){let e=1;for(;this.yMax*e>this.yMin;){i.addLine(this.plotArea,0,this.transformY(this.yMax*e),-3,this.transformY(this.yMax*e),1);let t=this.yMax*e,n=Math.abs(t)>=1e4?t.toExponential(s):t.toFixed(s);i.addText(this.plotArea,-5,this.transformY(this.yMax*e)+3,n,"end","statisticsviewersteps"),e--}}if(null!==t){let e=this.plotRangeY/t;for(let n=0;n<=t;n++){i.addLine(this.plotArea,0,-e*n,-3,-e*n,1);let t=e*n/this.yRel+this.yMin;t=Math.abs(t)>=1e4?t.toExponential(s):t.toFixed(s),Math.abs(t)<.01&&(t=0),i.addText(this.plotArea,-5,-(e*n-3),t,"end","statisticsviewersteps")}}i.addLine(this.plotArea,0,0,this.plotRangeX+1,0,"main-axis"),i.addLine(this.plotArea,0,0,0,-(this.plotRangeY+1),"main-axis"),i.addLine(this.plotArea,this.plotRangeX,0,this.plotRangeX,-this.plotRangeY,"main-axis"),i.addLine(this.plotArea,0,-this.plotRangeY,this.plotRangeX,-this.plotRangeY,"main-axis")}clear(){this.svg.removeChild(this.plotArea),this.plotArea=document.createElementNS(n,"g"),this.svg.appendChild(this.plotArea),this.plotArea.setAttribute("transform","matrix(1 0 0 1 "+this.margins.left+" "+(this.height-this.margins.bottom)+")"),null!==this.yLabelText&&(this.svg.removeChild(this.yLabelText),this.yLabelText=null),null!==this.noDataGroup&&(this.svg.removeChild(this.noDataGroup),this.noDataGroup=null)}setNoData(){this.clear(),null===this.noDataGroup&&(this.noDataGroup=document.createElementNS(n,"g"),this.svg.appendChild(this.noDataGroup),i.addRect(this.noDataGroup,0,0,this.width,this.height),this.noDataGroup.setAttribute("fill","#EEE"),i.addText(this.noDataGroup,this.width/2,this.height/2+10,"NO DATA","middle","nodata"))}transformY(e){return-this.yRel*(e-this.yMin)}}},292:e=>{"use strict";var t=new Map,s=-1;e.exports={subscribe:function(e,i){if("function"!=typeof i)return!1;t.has(e)||t.set(e,new Map);var n="uid_"+String(++s);return t.get(e).set(n,i),n},publish:function(e,s){return!!(t.has(e)&&t.get(e).size>0)&&(setTimeout((function(){t.get(e).forEach((function(e,t){e(s)}))}),0),!0)}}},794:(e,t,s)=>{"use strict";let i=s(317),n=new Map;window.addEventListener("hashchange",r);var a=[window.location.hash],l=window.history.length;function r(){var e=window.location.hash,t=window.history.length;a.length&&l==t?a[a.length-2]==e?a=a.slice(0,-1):a.push(e):(a.push(e),l=t);let s,r,o,d=document.location.hash.substring(2);d.lastIndexOf("/")===d.length-1&&(d=d.substring(0,d.length-1));let h=d.indexOf("&state");if(-1!=h&&(d=d.substring(0,h)),d.indexOf("/")>0){let e=d.split("/");s=e[0],r=e[1],o=e[2]}else s=d;n.has(s)&&(i.reset(),n.get(s)(r,o))}e.exports={add:function(e,t){n.set(e,t)},route:r}},584:e=>{"use strict";const t="http://www.w3.org/2000/svg";e.exports={addPoint:function(e,s,i,n,a){let l=document.createElementNS(t,"circle");return l.setAttribute("r",n),l.setAttribute("cx",s),l.setAttribute("cy",i),void 0!==a&&l.setAttribute("class",a),e.appendChild(l),l},addCircle:function(e,s,i,n,a,l,r){let o=document.createElementNS(t,"circle");return o.setAttribute("r",n),o.setAttribute("cx",s),o.setAttribute("cy",i),o.setAttribute("fill",a),o.setAttribute("stroke",l),o.setAttribute("stroke-width",r),e.appendChild(o),o},addLine:function(e,s,i,n,a,l){let r=document.createElementNS(t,"line");return r.setAttribute("x1",s),r.setAttribute("y1",i),r.setAttribute("x2",n),r.setAttribute("y2",a),void 0!==l&&r.setAttribute("class",l),e.appendChild(r),r},addRect:function(e,s,i,n,a,l){let r=document.createElementNS(t,"rect");return r.setAttribute("x",s),r.setAttribute("y",i),r.setAttribute("width",n),r.setAttribute("height",a),void 0!==l&&r.setAttribute("class",l),e.appendChild(r),r},addText:function(e,s,i,n,a="start",l){let r=document.createElementNS(t,"text");return r.setAttribute("x",s),r.setAttribute("y",i),r.textContent=n,r.setAttribute("text-anchor",a),void 0!==l&&r.setAttribute("class",l),e.appendChild(r),r},addPolyline:function(e,s,i){let n=document.createElementNS(t,"polyline");n.setAttribute("points",s),void 0!==i&&n.setAttribute("class",i),e.appendChild(n)},removeElement:function(e){e.parentElement.removeChild(e)}}},951:(e,t,s)=>{s(212),e.exports=class{constructor(e){this.off=!0,this.element=document.createElement("span"),this.element.innerHTML+=`\n       <img src="${e}_off.png" width="24px"\n        style="margin-bottom: -1px; cursor: pointer"/>\n    `,this.image=this.element.querySelector("img"),this.element.addEventListener("click",(t=>{this.off=!this.off;let s=this.off?e+"_off":e;this.image.setAttribute("src",s+".png"),this.listener(this.off)}))}setListener(e){this.listener=e}}},882:e=>{"use strict";let t,s,i,n,a,l=document.querySelector("body"),r=[],o=[],d=[],h=!1;function c(e,t){let s=document.createElement("div");return s.setAttribute("class","user-guidance"),s.innerHTML='<img src="img/tip'+e+'.png" width="'+t+'px" />',s.style.position="absolute",s.style.display="none",l.appendChild(s),s}function u(e){if(8===e&&!h)return;if(4===e&&!h)return;let t=o[e].domTarget.getBoundingClientRect();r[e].style.top=t.top+o[e].top+window.pageYOffset+"px",r[e].style.left=t.left+o[e].left+"px",r[e].style.display="block"}function p(e){r[e].style.display="none",localStorage.setItem("tip"+e,"off"),d[e]="off"}function m(e){switch(e.preventDefault(),e.target.style.display="none",t){case 2:t=5;break;case 6:t=8;break;default:t++}v(t),u(t)}function y(e,t){null===d[e]&&(t?u(e):r[e].style.display="none")}function v(e){t=e,localStorage.setItem("currentTip",e)}e.exports={init:function(e,t,l,h){s=e,i=t,n=l,a=h,d[3]=localStorage.getItem("tip3"),d[4]=localStorage.getItem("tip4"),d[7]=localStorage.getItem("tip7"),0===r.length&&(r[1]=c(1,220),o[1]={domTarget:s,top:-70,left:-240},r[2]=c(2,280),o[2]={domTarget:s,top:-110,left:80},r[3]=c(3,180),o[3]={domTarget:i,top:180,left:720},r[4]=c(4,240),o[4]={domTarget:n,top:45,left:-250},r[5]=c(5,210),o[5]={domTarget:s,top:-130,left:70},r[6]=c(6,240),o[6]={domTarget:s,top:-100,left:370},r[7]=c(7,220),o[7]={domTarget:a,top:160,left:-40},r[8]=c(8,240),o[8]={domTarget:n,top:30,left:760},r[1].addEventListener("click",m),r[2].addEventListener("click",m),r[3].addEventListener("click",(e=>{p(3)})),r[4].addEventListener("click",(e=>{p(4)})),r[5].addEventListener("click",m),r[6].addEventListener("click",m),r[7].addEventListener("click",(e=>{p(7)})),r[8].addEventListener("click",(e=>{e.target.style.display="none",v(10)})));let u=localStorage.getItem("currentTip");null===u?v(1):(u=parseInt(u),u<10&&v(u))},setFinal:function(){h=!0,t<10&&(r[t].style.display="none",v(8),u(t)),y(4,!0)},show:function(e,s,i){t<10&&(e?u(t):r[t].style.display="none"),y(3,e&&s),y(4,e),y(7,e&&i)},showIndependentTip:y}},212:e=>{"use strict";const t=window.nomadEnv.apiRoot;function s(e){let t="";for(let s=0;s<e.length;s++)e.charCodeAt(s)>=47&&e.charCodeAt(s)<58?t+="<sub>"+e[s]+"</sub>":t+=e[s];return t}function i(e){let t=e.substring(1,e.length-1).split(","),s=[];for(var i=0;i<t.length;i++)s.push(parseFloat(t[i]));return s}function n(e){return(e*(180/Math.PI)).toFixed(0)+"&deg;"}e.exports={searchResults:!1,materialId:null,MAT_VIEW:{structure:"structure",electronicstruct:"electronicstruct",methodology:"methodology",thermalprops:"thermalprops",elasticconst:"elasticconst"},IMAGE_DIR:"img/",ELEMENTS:["H","He","Li","Be","B","C","N","O","F","Ne","Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca","Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn","Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr","Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd","In","Sn","Sb","Te","I","Xe","Cs","Ba","La","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu","Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg","Tl","Pb","Bi","Po","At","Rn","Fr","Ra","Ac","Th","Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md","No","Lr","Rf","Ha","Sg","Ns","Hs","Mt","Ds","Rg","Cn","Nh","Fl","Mc","Lv","Ts","Og"],getUserData:function(){return null},getServerLocation:function(){return document.location.hostname},serverReq:function(e,t){var s=new XMLHttpRequest;s.addEventListener("load",t),s.open("GET",e);var i=window.keycloak;return i.authenticated&&s.setRequestHeader("Authorization","Bearer "+i.token),s.send(),s},convert2d:function(e,t){let s=[];for(var i=0;i<e.length;i++){let a=e[i],l=[];for(var n=0;n<a.length;n++)l.push(a[n]*t);s.push(l)}return s},serverReqPOST:function(e,t,s){var i=new XMLHttpRequest;i.addEventListener("load",s),i.open("POST",e),i.setRequestHeader("Content-Type","application/json");var n=window.keycloak;return n.authenticated&&i.setRequestHeader("Authorization","Bearer "+n.token),i.send(t),i},getShortCode:function(e){if((e.startsWith("eos/")||e.startsWith("par/"))&&32==e.length)return e.substring(0,12);if(28==e.length)return e.substring(0,8);throw"The given identifier could not be shortened as it does not have the right initial length."},getSearchURL:function(){return t+"materials/"},getSuggestionURL:function(e){return t+"suggestions?property="+e},getMaterialURL:function(e){return t+"materials/"+e},getMaterialCalcURL:function(e,s,i=""){return t+"materials/"+e+"/calculations/"+s+(""===i?"":"?property="+i)},getMaterialGroupURL:function(e,s,i){return t+"materials/"+e+"/groups/"+s+"/"+i},getMaterialStatsURL:function(e){return t+"materials/"+e+"/statistics"},getMaterialXsURL:function(e,s){return t+"materials/"+s+"/"+e},getCalcEnergiesURL:function(e,s){return t+"materials/"+e+"/calculations/"+s+"/energies"},getReportURL:function(e){return t+"materials/"+e+"/reports"},setBrowserHashPath:function(e,t){document.location=void 0===t?"#/"+e:"#/"+e+"/"+t},loadLib:function(e){let t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e),document.getElementsByTagName("head")[0].appendChild(t)},getNumberArray:i,J2eV:function(e,t){let s=e/1602176565e-28;return void 0===t?s<.01?s.toFixed(6):s.toFixed(3):s.toFixed(t)},eV2J:function(e){return 1602176565e-28*e},m2Angstrom:function(e){return(e/1e-10).toFixed(3)+" &#197;"},getLatticeAnglesValues:function(e,t,s){let a=[0,0,0];return e.forEach((e=>{if(void 0!==e.lattice_parameters&&null!==e.lattice_parameters){let t=i(e.lattice_parameters);a[0]+=t[3],a[1]+=t[4],a[2]+=t[5]}})),s?`<div>&alpha; = ${n(a[0]/e.size)}</div>\n    <div>&beta; = ${n(a[1]/e.size)}</div>\n    <div>&gamma; = ${n(a[2]/e.size)}</div>`:t?`<div>&alpha; = ${n(a[0]/e.size)}</div>`:""},rad2degree:n,m3ToAngstrom3:function(e){return(e/1e-30).toFixed(3)+" &#197;<sup>3</sup>"},toAngstromMinus3:function(e){return(1e-30*e).toFixed(3)+" &#197;<sup>-3</sup>"},getMaterialTitle:function(e,t){let i;return i=s(e.formula_reduced),void 0!==t&&!1===t&&(i=e.formula_reduced),null!==e.space_group_number&&void 0!==e.space_group_number&&(i+=" - space group "+e.space_group_number),i},getMinMaxHTML:function(e,t){let s=[];return e.forEach((e=>{s.push(e[t])})),"("+Math.min.apply(null,s)+" ... "+Math.max.apply(null,s)+")"},getSubscriptedFormula:s,getAverage:function(e){let t=0;for(var s=0;s<e.length;s++)t+=e[s];return t/e.length},numberWithCommas:function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},generateDiagramSteps:function(e,t=4){let s=-Math.floor(Math.log(e/t)*Math.LOG10E),i=Math.pow(10,s),n=Math.ceil(e*i/t),a=[];for(var l=0;l<=t;l++)a[l]=n*l/i;return s=s<0?0:s,[a,s]},getCalcMapByFunctional:function(e){let t=new Map;return e.forEach((e=>{if(t.has(e.functional_type))t.get(e.functional_type).add(e.calc_id);else{let s=new Set;s.add(e.calc_id),t.set(e.functional_type,s)}})),t},getDefault:function(e,t="unavailable"){return null==e?t:e},scale:function(e,t){let s;return Array.isArray(e)?(s=[],function e(s,i){if(Array.isArray(s[0]))for(let t=0,n=s.length;t<n;++t){const n=[];i.push(n),e(s[t],n)}else for(let e=0,n=s.length;e<n;++e)i.push(s[e]*t)}(e,s)):s=e*t,s},distance:function(e,t){return e.map(((e,s)=>Math.abs(e-t[s])**2)).reduce(((e,t)=>e+t))**.5}}},51:(e,t,s)=>{let i=s(507),n=s(94);s(584),e.exports=class{constructor(){this.element=document.createElement("div"),this.element.setAttribute("style","margin: 0 auto"),this.parentElement=null,this.bsPlotter=new i,this.dosPlotter=new n({left:4,right:20,top:0,bottom:30}),this.dosYAxisLabeled=!1}attach(e,t,s){e.appendChild(this.element),this.bsPlotter.attach(this.element,s,s),this.height=s,this.dosPlotter.attach(this.element,this.height/2+20,s),this.parentElement=e}isAttached(){return null!==this.parentElement}setUpAndData(e,t,s){let i;if(this.hasDispData=null!=e,this.hasDosData=null!=t,i=!(!this.hasDosData||this.hasDispData),this.dosYAxisLabeled!==i){this.element.removeChild(this.dosPlotter.svg);let e=i?40:4;this.dosPlotter=new n({left:e,right:20,top:0,bottom:30});let t=this.height/2+e;this.dosPlotter.attach(this.element,t,this.height)}this.dosYAxisLabeled=i,this.hasDispData?(this.bsPlotter.setBandStructureData(e),this.hasDosData&&this.bsPlotter.setRepaintListener(((e,t)=>{this.dosPlotter.setYZoomAndOffset(e,t),this.dosPlotter.repaint()}))):this.bsPlotter.setNoData(),this.hasDosData?(this.dosPlotter.setPoints(t,s),this.hasDispData&&(this.bsPlotter.setExternalYAxisMax(this.dosPlotter.getYAxisMax()),this.dosPlotter.setRepaintListener(((e,t)=>{this.bsPlotter.setYZoomAndOffset(e,t),this.bsPlotter.repaint()})),this.dosPlotter.svg.removeChild(this.dosPlotter.yLabelText),this.dosPlotter.yLabelText=null)):this.dosPlotter.setNoData(),this.dosPlotter.setYAxisLabelsVisibility(i)}setNoData(){this.bsPlotter.setNoData(),this.dosPlotter.setNoData()}}},507:(e,t,s)=>{"use strict";let i=s(971),n=s(584);function a(e){return"Gamma"===e||"G"===e?"Γ":e}s(212),e.exports=class extends i{constructor(){super({left:55,right:5,top:0,bottom:30}),this.phononMode=!1,this.factor=1602176565e-28}setPhononMode(){this.phononMode=!0,this.factor=1986445681679957e-38,this.outOfRangeColorActivated=!1}attach(e,t,s){super.attach(e,t,s)}getTopAndLowestPoints(e){let t=e[0].band_energies[0][0][0],s=e[0].band_energies[0][0][0];for(let i=0;i<e.length;i++){for(let n=0;n<e[i].band_energies[0].length;n++){let a=Math.max.apply(null,e[i].band_energies[0][n]);a>t&&(t=a),a=Math.min.apply(null,e[i].band_energies[0][n]),a<s&&(s=a)}if(2===e[i].band_energies.length)for(let n=0;n<e[i].band_energies[1].length;n++){let a=Math.max.apply(null,e[i].band_energies[1][n]);a>t&&(t=a),a=Math.min.apply(null,e[i].band_energies[1][n]),a<s&&(s=a)}}return[(s-this.energyOffset)/this.factor,(t-this.energyOffset)/this.factor]}drawKPointLabel(e,t){n.addText(this.axisGroup,e*this.xRel,16,t,"middle","steps")}setBandStructureData(e){let t=e.section_k_band_segment;if(this.bandGapData=void 0,this.energyOffset=void 0!==e.energy_highest_occupied?e.energy_highest_occupied:0,void 0!==e.section_band_gap){let t=1/0,s=0;for(let i=0;i<e.section_band_gap.length;++i){let n=e.section_band_gap[i].value;n<t&&(t=n,s=i)}0!=t&&(this.bandGapData=e.section_band_gap[s],this.bandGapData.cbmDistances=[],this.bandGapData.vbmDistances=[])}this.bandsDataSpin1=[],this.bandsDataSpin2=[],this.segmentLimitsX=[],this._reset();let s=this.getTopAndLowestPoints(t),i=s[0],n=s[1];this.phononMode?this.setAxisRangeAndLabels("",0,1,"Frequency (cm⁻¹)",-50,320,i,n,100):this.setAxisRangeAndLabels("",0,1,"Energy (eV)",-6,11,i,n,5);let l=0,r=null,o=!1,d=t[t.length-1].k_path_distances,h=d[d.length-1];for(let e=0;e<t.length;e++){let s=t[e],i=s.band_segm_labels,n=s.band_energies[0],d=s.band_energies[1],c=s.k_path_distances;this.bandsDataSpin1.push([]),this.bandsDataSpin2.push([]);let u=c[c.length-1]-c[0];this.segmentLimitsX.push(l/h),null!==i&&(null!==r&&r!==i[0]?this.drawKPointLabel(l/h,a(r)+"|"+a(i[0])):this.drawKPointLabel(l/h,a(i[0])),e===t.length-1&&this.drawKPointLabel(1,a(i[1])),r=i[1]);for(let t=0;t<c.length;t++){let s=c[t]/h;for(let i=0;i<n[t].length;i++){0===t&&(this.bandsDataSpin1[e][i]=[]);let a=(n[t][i]-this.energyOffset)/this.factor;this.bandsDataSpin1[e][i].push({x:s,y:a}),!o&&a>1e4&&(o=!0)}if(void 0!==d)for(let i=0;i<d[t].length;i++){0===t&&(this.bandsDataSpin2[e][i]=[]);let n=(d[t][i]-this.energyOffset)/this.factor;this.bandsDataSpin2[e][i].push({x:s,y:n}),!o&&n>1e4&&(o=!0)}}l+=u}if(o)throw"Plotter Data Overflow: Probably the energy data is not in correct units";this.repaint()}repaintData(e,t){let s;this.segmentLimitsX.forEach((s=>{let i=this.transformY(e),a=this.transformY(t);this.phononMode&&(i+=200,a-=200),n.addLine(this.plotContent,s*this.xRel,i,s*this.xRel,a,"segment")}));for(var i=0;i<this.bandsDataSpin1.length;i++)for(var a=0;a<this.bandsDataSpin1[i].length;a++){s="";for(var l=0;l<this.bandsDataSpin1[i][a].length;l++)s+=" "+this.xRel*this.bandsDataSpin1[i][a][l].x+" "+this.transformY(this.bandsDataSpin1[i][a][l].y);n.addPolyline(this.plotContent,s,"plotSpin1")}if(this.bandsDataSpin2.length>0)for(i=0;i<this.bandsDataSpin2.length;i++)for(a=0;a<this.bandsDataSpin2[i].length;a++){for(s="",l=0;l<this.bandsDataSpin2[i][a].length;l++)s+=" "+this.xRel*this.bandsDataSpin2[i][a][l].x+" "+this.transformY(this.bandsDataSpin2[i][a][l].y);n.addPolyline(this.plotContent,s,"plotSpin2")}void 0!==this.bandGapData&&(this.bandGapData.cbmDistances.forEach((e=>{let t=this.xRel*e,s=this.transformY((this.bandGapData.conduction_band_min_energy-this.energyOffset)/this.factor);n.addPoint(this.plotContent,t,s,3,"cbm-vbm-points"),n.addText(this.plotContent,t+4,s-6,"CBM")})),this.bandGapData.vbmDistances.forEach((e=>{let t=this.xRel*e,s=this.transformY((this.bandGapData.valence_band_max_energy-this.energyOffset)/this.factor);n.addPoint(this.plotContent,t,s,3,"cbm-vbm-points"),n.addText(this.plotContent,t+4,s+14,"VBM")})))}}},370:e=>{e.exports=class{constructor(e,t){this.first=!0,this.last=!1,this.element=document.createElement("div"),this.element.className=e,void 0!==t&&(this.element.style.width=t),this.element.innerHTML='\n      <div class="prev-sel-btn" style="float: left; width: 20%;">\n        <div style="padding-left: 10%;">\n          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10.069 11.872" width="20px">\n            <path transform="scale(0.7) translate(-346.291 -664.481)"\n              d="M356.36,666.024l-1.544-1.544-8.525,8.513,8.493,8.447,1.544-1.544-6.8-6.9Z" />\n          </svg>\n        </div>\n      </div>\n      <div class="calc-sel-text" style="float: left; width: 60%;">\n       NOT Calculation\n      </div>\n      <div class="next-sel-btn" style="float: right; width: 20%;">\n        <div style="padding-right: 10%;">\n          <svg xmlns="http://www.w3.org/2000/svg" viewBox="-10.069 -11.872 10.069 11.872" width="20px">\n            <g transform="rotate(180) scale(0.7)">\n              <path d="M10.069,1.544,8.525,0,0,8.513,8.493,16.96l1.544-1.544-6.8-6.9Z"/>\n            </g>\n          </svg>\n        </div>\n      </div>\n      <div style="clear: both;"></div>\n    ',this.prevBtn=this.element.querySelector(".prev-sel-btn"),this.prevIcon=this.element.querySelector(".prev-sel-btn path"),this.calcSelectorTxt=this.element.querySelector(".calc-sel-text"),this.nextBtn=this.element.querySelector(".next-sel-btn"),this.nextIcon=this.element.querySelector(".next-sel-btn path"),this._styleButtons(),this._events()}_events(){this.prevBtn.addEventListener("click",(e=>{e.preventDefault(),this.first||(this.first=this.prevListener(),this.last=!1,this._styleButtons())})),this.nextBtn.addEventListener("click",(e=>{e.preventDefault(),this.last||(this.first=!1,this.last=this.nextListener(),this._styleButtons())}))}_styleButtons(){this.prevIcon.setAttribute("class","calc-selector-icon"+(this.first?"-disabled":"")),this.nextIcon.setAttribute("class","calc-selector-icon"+(this.last?"-disabled":""))}setPrevListener(e){this.prevListener=e}setNextListener(e){this.nextListener=e}setState(e,t,s){this.calcSelectorTxt.innerHTML=e,this.first=t,this.last=s,this._styleButtons()}}},94:(e,t,s)=>{"use strict";let i=s(971),n=s(584),a=s(212);const l=1602176565e-28;e.exports=class extends i{constructor(e){super(e)}attach(e,t,s){super.attach(e,t,s)}setPoints(e,t){this.pointsSpin1=[],this.pointsSpin2=[],this._reset();let s=e.dos_values[0],i=null;2===e.dos_values.length&&(i=e.dos_values[1]);let r=void 0!==e.energy_highest_occupied?e.energy_highest_occupied:0,o=e.dos_energies,d=[],h=[];for(var c=0;c<o.length;c++){let e=(o[c]-r)/1602176565e-28,t=s[c]*l;if(d.push(t),h.push(e),this.pointsSpin1.push({x:t,y:e}),null!==i){let t=i[c]*l;this.pointsSpin2.push({x:t,y:e}),d.push(t)}}let u=Math.max.apply(null,d),p=Math.max.apply(null,h),m=Math.min.apply(null,h),y=a.generateDiagramSteps(u,3),v=y[0];y[1],this.setAxisRangeAndLabels(null,0,v[v.length-1],"Energy (eV)",-6,11,m,p,5),n.addText(this.axisGroup,this.plotRangeX/2,this.margins.bottom,"DOS (states/eV/cell)","middle","axis-steps-big");for(let e=0;e<v.length;e++){let t=this.plotRangeX*v[e]/v[v.length-1];n.addLine(this.axisGroup,t,0,t,3,1);let s=v[e];s=Math.abs(s)>=1e4||Math.abs(s)<=1e-4?s.toExponential(1):parseFloat(s.toFixed(3)),n.addText(this.axisGroup,t,13,0===e?"0":s,"middle","axis-steps-smaller")}this.repaint()}repaintData(){let e="";for(var t=0;t<this.pointsSpin1.length;t++)e+=" "+this.xRel*this.pointsSpin1[t].x+" "+this.transformY(this.pointsSpin1[t].y);for(n.addPolyline(this.plotContent,e,"plotSpin1"),e="",t=0;t<this.pointsSpin2.length;t++)e+=" "+this.xRel*this.pointsSpin2[t].x+" "+this.transformY(this.pointsSpin2[t].y);n.addPolyline(this.plotContent,e,"plotSpin2")}setYAxisLabelsVisibility(e){null!==this.yAxisLabelsGroup&&(this.yAxisLabelsGroup.style.visibility=e?"visible":"hidden")}}},719:(e,t,s)=>{let i,n,a,l,r,o,d,h,c=s(212),u=new Map,p=!1;function m(e){return e.substring(0,3)}function y(e){return"eos/"===e.substring(0,4)||"par/"===e.substring(0,4)}function v(e){return e.substring(4)}e.exports={getRepresentatives:function(){return r},setMaterialData:function(e){i=e},getMaterialData:function(){return i},getCalculations:function(){return l},setCalculations:function(e){l=e.results,l.forEach((function(e,t){let s=c.getDefault(e.functional_type),i=c.getDefault(e.core_electron_treatment);this[t].functional_type=s,this[t].core_electron_treatment=i}),l),r=e.representatives;for(let e=0;e<l.length;e++)u.set(l[e].calc_id,l[e]);let t=r.electronic_band_structure,s=r.electronic_dos,i=r.thermodynamical_properties;h=void 0!==t||void 0!==s,d=void 0!==i},getCalc:function(e){return u.get(e)},getGroups:function(){return n},setGroups:function(e){let t=new Map(Object.entries(e.groups_eos)),s=new Map(Object.entries(e.groups_par));n=new Map,n.set("eos",t),n.set("par",s),a=new Set,t.forEach(((e,t)=>{e.forEach(a.add,a)}))},getGroupId:v,isGroup:y,getGroupType:m,getReprCalc:function(e){if(y(e)){let t=m(e),s=v(e);return n.get(t).get(s)[0]}return e},isInAnyGroup:function(e){return a.has(e)},isInAnyNotDisabledGroup:function(e){return a.has(e)},getGroupLeafId:function(e){let t=null;return n.forEach(((s,i)=>{s.calculation_set.has(e)&&(t=i)})),t},isReady:function(e){if(void 0!==i){if(p&&e==i.material_id)return!0;if(void 0!==o&&void 0!==l&&void 0!==n&&e===i.material_id)return!0}return!1},setMissing:function(e){p=e},getMissing:function(){return p},clear:function(){i=void 0,l=void 0,n=void 0,o=void 0,p=!1},setIdealizedStructure:function(e){o=e},getIdealizedStructure:function(){return o},hasThermalData:function(e){return d},hasElecStructureData:function(e){return h}}},155:(e,t,s)=>{"use strict";let i=s(212),n=s(719);e.exports=class{constructor(e){this.element=document.createElement("div"),this.element.setAttribute("id",e),this.loadedMatId=null,this.gotoResultsListener=null,this.gotoOverviewListener=null,this.element.innerHTML='<div class="material-title"></div>',this.element.style.display="none"}attachAndSetEvents(e){e.appendChild(this.element),this.materialTitle=this.element.querySelector(".material-title")}attachNavTree(e){e.attach(this.navTreeWrapper)}setVisible(){this.element.style.display="block"}load(){let e=n.getMaterialData().material_id;this.loadedMatId!==e&&(this.loadedMatId=e,this.setMaterialData())}setMaterialData(){this.materialTitle.innerHTML=i.getMaterialTitle(n.getMaterialData())}updateCalcs(e){}updateMarkedCalc(e){}}},373:(e,t,s)=>{"use strict";let i=s(155),n=(s(212),s(223));e.exports=class extends i{constructor(){super("Elastic constants"),this.sortedLeafs=[],this.markedCalc=null,this.element.innerHTML+='\n\n      <div style="float: left; width: 27%;">\n        <div class="view-box">\n          <div class="title">Calculation </div>\n          <div class="navTreeWrapper"></div>\n        </div>\n      </div>\n\n      <div style="float: right; width: 73%;">\n        <div class="view-box">\n          <div class="title">Elastic constants</div>\n\n          <div>Parameters</div>\n          <div ></div>\n\n\n        </div>\n      </div>\n\n      <div style="clear: both;"></div>\n    ',this.navTreeWrapper=this.element.querySelector(".navTreeWrapper"),n.addToInfoSystem(this.element),this._events()}_events(){}updateSelection(e){console.log("ElasticDetails updateSelection ",e)}updateMarkedLeaf(e){}}},285:(e,t,s)=>{"use strict";let i=s(155),n=s(212),a=s(414),l=s(223),r=(s(370),s(624)),o=s(51),d=(new(s(666)),s(719)),h=s(317);class c{constructor(e){this.calcMapByFunctional=null,this.hostElement=e,this.viewType="text",this.functional=null,this.nBins=15,this.hostElement.innerHTML+='\n      <div style="float: left" >\n        <svg xmlns="http://www.w3.org/2000/svg" class="chart-tab"\n          viewBox="0 0 15 15" width="15" height="15" style="fill: #c7c7c7;">\n            <rect x="0" y="0"  width="2" height="15" />\n            <rect   x="3" y="5"  width="1.8" height="7"  />\n            <rect  x="6" y="3"  width="1.8" height="9"  />\n            <rect   x="9" y="6"  width="1.8" height="6"  />\n            <rect  x="12" y="2"  width="1.8" height="10"  />\n            <rect x="2" y="13"   width="13" height="2" />\n        </svg>\n        <svg xmlns="http://www.w3.org/2000/svg" class="text-tab"\n          viewBox="0 0 15 15" width="15" height="15" style="fill: #777;">\n            <rect x="0" y="1"   width="15" height="2.5" />\n            <rect   x="0" y="6"  width="15" height="2.5"  />\n            <rect  x="0" y="11"  width="15" height="2.5"  />\n        </svg>\n      </div>\n\n      <div class="functional-tabs" style="float: right">\n      </div>\n\n      <div style="clear: both;"></div>\n\n      <div class="content-placeholder" >\n\n        <div style="display: block" class="text-panel" >\n\n          <div><b><span info-sys-data="band gap">Band gap</span></b> (eV):\n            <div class="stats-fields summary-bandgap-field" > </div>\n          </div>\n        </div>\n\n        <div style="display:none" class="chart-panel" >\n          <div class="charts-placeholder" > </div>\n        </div>\n\n      </div>\n    ',this.chartTab=this.hostElement.querySelector(".chart-tab"),this.textTab=this.hostElement.querySelector(".text-tab"),this.functionalTabs=this.hostElement.querySelector(".functional-tabs"),this.chartPanel=this.hostElement.querySelector(".chart-panel"),this.textPanel=this.hostElement.querySelector(".text-panel"),this.bandgapField=this.hostElement.querySelector(".summary-bandgap-field"),this.statsViewer=new r,this.chartsPlaceholder=this.hostElement.querySelector(".charts-placeholder"),this.chartTab.addEventListener("click",(e=>{this.chartTab.style.fill="#777",this.viewType="chart",this.textTab.style.fill="#c7c7c7",this.chartPanel.style.display="block",this.textPanel.style.display="none"})),this.textTab.addEventListener("click",(e=>{this.textTab.style.fill="#777",this.viewType="text",this.chartTab.style.fill="#c7c7c7",this.textPanel.style.display="block",this.chartPanel.style.display="none"})),this.functionalTabs.addEventListener("click",(e=>{"tab"===e.target.className&&(this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab",this.functional=e.target.getAttribute("data-tab"),this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab-selected",this._setData())}))}_setData(){this.functional;let e=Array.from(this.calcMapByFunctional.get(this.functional)),t=d.getMaterialData().material_id,s=JSON.stringify({calculations:e,properties:["band_gap"],n_histogram_bins:this.nBins});n.serverReqPOST(n.getMaterialStatsURL(t),s,(e=>{let t=JSON.parse(e.target.response).band_gap;if(void 0===t)return this.bandgapField.innerHTML="No band gap data available",this.statsViewer.clear(),void(this.chartsPlaceholder.textContent="No band gap data available");this.chartsPlaceholder.textContent="",this.statsViewer.attach(this.chartsPlaceholder,250,150),t.min*=6241509e12,t.avg*=6241509e12,t.max*=6241509e12,t.histogram.values=t.histogram.values.map((e=>6241509e12*e));let s=t.avg.toFixed(3)+' &nbsp; <span style="font-size: 0.9em">['+t.min.toFixed(3)+" , "+t.max.toFixed(3)+"]</span>";this.bandgapField.innerHTML=s,this.statsViewer.clear(),this.statsViewer.drawPoints(t.histogram,"Band gap (eV)",this.nBins)}))}build(e){this.calcMapByFunctional=e,this.graphTrigger=null,this.statsViewer.clear(),this.unfoldedElement=null,this.functionalQuantityMap=new Map,this.functionalTabs.innerHTML="",this.calcMapByFunctional.forEach(((e,t)=>{this.functionalTabs.innerHTML+='<span class="tab" data-tab="'+t+'">'+t+"</span>"}));let t=Array.from(this.calcMapByFunctional.keys());(null===this.functional||t.indexOf(this.functional)<0)&&(this.functional=t[0]),this._setData(),this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab-selected",l.addToInfoSystem(this.hostElement)}}class u{constructor(e){this.hostElement=e,this.loaded=!1,this.bzViewer=new materia.BrillouinZoneViewer(this.hostElement,{view:{autoResize:!1,autoFit:!0,fitMargin:.07},layout:{viewRotation:{alignments:[["up","a"],["front","segments"]],rotations:[[0,1,0,45],[1,0,0,25]]}},basis:{offset:.025,size:.035,a:{color:"#f44336"},b:{color:"#4caf50"},c:{color:"#5c6bc0"}},faces:{outline:{width:.002}},kpoints:{label:{size:.03},point:{size:.01}}})}setCalcData(e){const t=n.scale(e.reciprocal_cell,1e-10),s=new Set,i=[],a=[];e.section_k_band_segment.forEach((e=>{a.push(e.band_segm_start_end);for(let t=0;t<2;++t){const n=e.band_segm_labels[t];s.has(n)||(i.push([n,e.band_segm_start_end[t]]),s.add(n))}}));const l={basis:t,kpoints:i,segments:a};this.bzViewer.load(l),this.hostElement.style.visibility="visible",this.loaded=!0,this.resize()}setNoData(){this.hostElement.style.visibility="hidden"}resize(){this.bzViewer.resizeCanvasToHostElement(),this.loaded&&(this.bzViewer.fitToCanvas(),this.bzViewer.render())}}e.exports=class extends i{constructor(){super("Electronic Structure"),this.navTree=new a,this.element.innerHTML+='\n      <div style="float: left; width: 30%;">\n        <div class="view-box">\n          <div class="title">Calculations </div>\n          <div class="navTreeWrapper"></div>\n\n          <div class="summary-title">Summary</div>\n          <div class="footer summary-box" style="border-top: 0"></div>\n        </div>\n      </div>\n\n      <div style="float: right; width: 70%;">\n        <div class="view-box e-structure-box">\n\n          <div class="title">Electronic structure</div>\n\n          <div style="padding-top: 10px; " >\n            <div class="tree-leaf-title"></div>\n          </div>\n\n          <div>\n\n            <div  style="padding: 30px  100px 20px 100px; ">\n              <div class="info-fields-label" style="float: left; width: 54%; ">\n                <span info-sys-data="band-structure">Band structure</span>\n              </div>\n              <div class="info-fields-label" style="float: left;">\n                <span info-sys-data="DOS">DOS</span>\n              </div>\n              <div style="clear: both;"></div>\n\n              <div class="calc-bs-dos-plotter" >\n              </div>\n\n              <div>\n              <div class="band-gap-field" style="float: left; width: 56%; text-align: right">\n                <b><span info-sys-data="band-gap">Band gap</span></b>:\n                <span class="band-gap-value" ></span>\n              </div>\n              <div style="clear: both;"></div>\n\n              </div>\n            </div>\n\n            <div class="spin-legend" style="font-size: 0.9em; padding: 0 30px 10px; display: none">\n              <svg width="15px" height="10px"> <polyline points="0,5 15,5" class="plotSpin1"/></svg>\n              Spin <span style=\'font-size: 1.1em\'>⇧</span>  &nbsp;&nbsp;&nbsp;\n              <svg width="15px" height="10px"> <polyline points="0,5 15,5" class="plotSpin2"/></svg>\n              Spin <span style=\'font-size: 1.1em\'>⇩</span>\n            </div>\n\n          </div>\n\n          <div class="footer lower-section">\n\n            <div  style="float: left">\n              <div style="padding: 16px; ">\n                <div class="info-fields-label" >\n                  <span info-sys-data="brillouin-zone-viewer">Brillouin zone</span>\n                </div>\n                <div class="bz-viewer-wrapper" style="width: 400px; height: 400px">\n                </div>\n              </div>\n            </div>\n\n            <div class="band" style="float: right; width: 40%;">\n              <div style="padding: 16px; ">\n                <div class="info-fields-label" >\n                  \x3c!-- <span info-sys-data="fermi-surface">Fermi surface </span> --\x3e\n                </div>\n                <div class="fermi-box" >      </div>\n              </div>\n            </div>\n\n            <div style="clear: both;"></div>\n\n          </div> \x3c!-- footer --\x3e\n\n        </div>\n\n      </div> \x3c!-- view-box --\x3e\n    ',this.navTreeWrapper=this.element.getElementsByClassName("navTreeWrapper")[0],this.leafTitle=this.element.querySelector(".tree-leaf-title"),this.rightBox=this.element.querySelector(".e-structure-box"),this.summaryByFunctionals=null,this.summaryBox=this.element.querySelector(".summary-box"),this.summaryByFunctionals=new c(this.summaryBox),this.bsDosPlotter=new o,this.bandGapField=this.element.querySelector(".band-gap-field"),this.bandGapValue=this.element.querySelector(".band-gap-value"),this.spinLegend=this.element.querySelector(".spin-legend"),this.lowerSection=this.element.querySelector(".lower-section"),this.fermiBox=this.element.getElementsByClassName("fermi-box")[0],this.bzViewerWrapper=new u(this.element.querySelector(".bz-viewer-wrapper")),l.addToInfoSystem(this.element)}setVisible(){this.element.style.display="block",this.bzViewerWrapper.resize()}setMaterialData(){let e=d.getMaterialData();super.setMaterialData(e);let t=null===e.material_name?e.formula:e.material_name;this.navTree.build(t,"electronic"),this.navTree.selectAll(),this.navTree.setHeight(400),this.navTree.setMarkedLeafIfNoneMarked(null),this.attachNavTree(this.navTree),this.updateSelection(this.navTree.getTreeSelectedCalcs()),this.updateMarkedLeaf(this.navTree.getMarkedLeaf()),this.navTree.setTreeSelectionListener((e=>{this.updateSelection(e)})),this.navTree.setLeafMarkedListener((e=>{this.updateMarkedLeaf(e)}))}updateSelection(e){if(e.size>0){let t=[];e.forEach((e=>{t.push(d.getCalc(e))}));let s=n.getCalcMapByFunctional(t);this.summaryByFunctionals.build(s)}else this.summaryBox.style.visibility="hidden"}updateMarkedLeaf(e){null===e?this.leafTitle.innerHTML="NO SELECTION":(this.leafTitle.innerHTML=n.getShortCode(e),this._loadGraphData(e))}_updateSelectorState(e){this.leafTitle.innerHTML=n.getShortCode(e)}_loadGraphData(e){let t=d.getCalc(e);if(this.bsDosPlotter.isAttached()||this.bsDosPlotter.attach(this.element.querySelector(".calc-bs-dos-plotter"),void 0,360),null===t||!t.has_band_structure&&!t.has_dos)this.bsDosPlotter.setNoData(),this.bzViewerWrapper.setNoData(),this.bandGapField.style.display="none",this.lowerSection.style.display="none";else{h.show("electronic_structure");let e=d.getMaterialData().material_id,s=n.getMaterialCalcURL(e,t.calc_id),i=JSON.stringify({properties:["electronic_band_structure","electronic_dos","band_gap"]});n.serverReqPOST(s,i,(e=>{let s=JSON.parse(e.target.response),i=s.electronic_dos,a=s.electronic_band_structure,l=s.band_gap;(function(e,t){return void 0!==e&&2===e.section_k_band_segment[0].band_energies.length||void 0!==t&&2===t.dos_values.length})(a,i)&&(this.spinLegend.style.display="block"),this.bsDosPlotter.setUpAndData(a,i,t),void 0!==l?(this.bandGapValue.textContent=n.J2eV(l,2)+" eV ",this.bandGapField.style.display="block"):(this.bandGapValue.textContent="",this.bandGapField.style.display="none"),void 0!==a&&void 0!==a.reciprocal_cell?(this.lowerSection.style.display="block",this.bzViewerWrapper.setCalcData(a)):(this.lowerSection.style.display="none",this.bzViewerWrapper.setNoData()),h.hide("electronic_structure")}))}}setPrevCalcListener(e){this.prevCalcListener=e}setNextCalcListener(e){this.nextCalcListener=e}}},290:(e,t,s)=>{"use strict";let i=s(212),n=s(584),a=s(666);e.exports=class extends a{constructor(){super({left:60,right:20,top:30,bottom:40}),this.tooltip,this.calcPointMap=new Map,this.pointSelected=null}draw(e,t,s,a){for(let e=0;e<t.length;e++)555!==t[e]&&(t[e]-=a);let l=function(e){let t=[];return e.forEach((e=>{555!==e&&t.push(e)})),t}(t),r=Math.min.apply(null,e),o=Math.max.apply(null,e),d=0,h=Math.max.apply(null,l);if(r===o)r-=1,o+=1;else{let e=o-r;r-=.1*e,o+=.1*e}if(d===h)d-=1,h+=1;else{let e=h-d;d-=.15*e,h+=.1*e}this.setRangeAndLabels("Volume (ų)",r,o,"E - Eₘᵢₙ (eV)",d,h),this.drawAxis(2,2),n.addLine(this.plotArea,0,this.y(0),this.plotRangeX,this.y(0),"zeroline"),n.addText(this.plotArea,this.x(o),this.y(0)+12,"Eₘᵢₙ: "+a.toFixed(3)+" eV","end","axis-steps");for(let a=0;a<e.length;a++){let l=0===a?"eos-viewer-sel":"eos-viewer",r=0===a?6:3,o=555===t[a]?20:this.y(t[a]),d=n.addPoint(this.plotArea,this.x(e[a]),o,r,l);0===a&&(this.pointSelected=d),d.addEventListener("mouseover",(e=>{this.tooltip=n.addText(this.plotArea,e.target.getBBox().x+10,e.target.getBBox().y-10,"Calc "+i.getShortCode(s[a]),"middle","tooltip")})),d.addEventListener("mouseout",(e=>{n.removeElement(this.tooltip)})),d.addEventListener("click",(e=>{this.clickPointListener(s[a])})),this.calcPointMap.set(s[a],d)}}selectCalc(e){this.pointSelected.setAttribute("class","eos-viewer"),this.pointSelected.setAttribute("r",3),this.pointSelected=this.calcPointMap.get(e),this.pointSelected.setAttribute("class","eos-viewer-sel"),this.pointSelected.setAttribute("r",6)}setClickPointListener(e){this.clickPointListener=e}x(e){return this.xRel*(e-this.xMin)}y(e){return-this.yRel*(e-this.yMin)}}},195:(e,t,s)=>{"use strict";let i=s(584),n=s(666);e.exports=class extends n{constructor(){super({left:50,right:16,top:10,bottom:32}),this.tooltip}setData(e,t){this.clear();let s,n=[],a=[];for(let s=0;s<e.length;++s){let i=e[s],l=t[s];null!==i&null!==l&&(n.push(i),a.push(l))}for(let t=0;t<e.length;++t)if(e[t]>600){s=t-1;break}void 0===s&&(s=e.length-1),e=e.slice(0,s+1),t=t.slice(0,s+1);let l=Math.max.apply(null,t),r=200*Math.ceil(l/200),o=e[s],d=50*Math.ceil(o/50);this.setRangeAndLabels("T (K)",0,d,"Cv (J/K/kg)",0,r),this.drawAxis(4,4,0);let h="";e.forEach(((e,s)=>{let i=t[s];h+=" "+this.xRel*e+" -"+this.yRel*(i-this.yMin)})),i.addPolyline(this.plotArea,h,"plotSpin1")}}},842:(e,t,s)=>{"use strict";let i=s(584),n=s(666);e.exports=class extends n{constructor(){super({left:70,right:16,top:10,bottom:32}),this.tooltip}setData(e,t){this.clear();let s,n=[],a=[];for(let s=0;s<e.length;++s){let i=e[s],l=t[s];null!==i&null!==l&&(n.push(i),a.push(l))}for(let t=0;t<e.length;++t)if(e[t]>600){s=t-1;break}void 0===s&&(s=e.length-1),e=e.slice(0,s+1),t=t.slice(0,s+1);let l=Math.max.apply(null,t),r=Math.min.apply(null,t),o=5e3*Math.ceil(l/5e3),d=5e3*Math.floor(r/5e3),h=e[s],c=50*Math.floor(h/50);this.setRangeAndLabels("T (K)",0,c,"F (J/kg)",d,o),this.drawAxis(4,4,2);let u="";e.forEach(((e,s)=>{let i=t[s];u+=" "+this.xRel*e+" -"+this.yRel*(i-this.yMin)})),i.addPolyline(this.plotArea,u,"plotSpin1")}}},95:(e,t,s)=>{let i=s(584),n=s(212),a=(s(414),s(576)),l=s(763),r=s(285),o=s(650),d=s(346),h=s(373),c=s(719),u=s(317),p={eStruct:null,thermalProps:null};class m{constructor(e){this.hostElement=e,this.viewer=new materia.StructureViewer(e,{layout:{viewCenter:"COP"},view:{autoResize:!1,autoFit:!0,fitMargin:2},atoms:{scale:.7},bonds:{threshold:1.4}}),this.legendElement=document.createElement("div"),this.legendElement.setAttribute("class","element-labels"),this.legendElement.setAttribute("style","position: absolute; bottom: 50px; right: 0"),this.hostElement.appendChild(this.legendElement),this.footerElement=document.createElement("div"),this.footerElement.setAttribute("class","structure-viewer-legend"),this.hostElement.appendChild(this.footerElement),this.footerElement.innerHTML=`\n\n    <div style="float: left; padding-right: 12px" >\n      <input type="checkbox" class="show-axis" checked> Show axis\n    </div>\n\n    <div style="float: left; padding-right: 18px" >\n      <input type="checkbox" class="show-bonds" checked> Show bonds\n    </div>\n\n    <div style="float: left; position:relative;" >\n      <img class="view-reset" style="cursor: pointer;" height="18px"\n        src="${n.IMAGE_DIR}reset.svg" />\n      <div class="view-reset-tooltip" > Reset view </div>\n    </div>\n\n    <div class="vr-download" style="float: right"> </div>\n\n    <div style="clear: both;"></div>\n    `,this.axisCheckbox=this.footerElement.querySelector(".show-axis"),this.axisCheckbox.addEventListener("click",(e=>{this.viewer.setOptions({latticeConstants:{enabled:this.axisCheckbox.checked}})})),this.bondsCheckbox=this.footerElement.querySelector(".show-bonds"),this.bondsCheckbox.addEventListener("click",(e=>{this.viewer.setOptions({bonds:{enabled:this.bondsCheckbox.checked}})})),this.labelsContainer=this.hostElement.querySelector(".element-labels");let t=this.hostElement.querySelector(".view-reset");t.addEventListener("click",(e=>this.viewer.reset())),t.addEventListener("mouseover",(e=>{this.hostElement.querySelector(".view-reset-tooltip").style.display="block"})),t.addEventListener("mouseout",(e=>{this.hostElement.querySelector(".view-reset-tooltip").style.display="none"}))}load(e){const t=e.periodicity;let s,i;e=this.getCellDataForViewer(e);let n=0,a=[];for(let e=0;e<3;++e)t[e]&&(a.push(e),++n);function l(e,t){let s=Math.sqrt(e.reduce(((e,t)=>e+t*t),0));return Math.max(Math.floor(t/s),1)}if(2==n){let t=a[0],n=a[1],r=0;for(let e=0;e<3;++e)if(e!==t&&e!==n){r=e;break}const o=12,d=l(e.cell[t],o),h=l(e.cell[n],o),c=[1,1,1];c[t]=d,c[n]=h;const u=["a","b","c"],p=u[t],m=u[n],y=u[r];let v,g,f;0===t&&1===n||1===t&&0===n?(v="gamma",g="alpha",f="beta"):1===t&&2===n||2===t&&1===n?(v="alpha",g="beta",f="gamma"):(2===t&&0===n||0===t&&2===n)&&(v="beta",g="alpha",f="gamma"),s={periodicity:c,viewRotation:{alignments:[["right",p],["up",m]],rotations:[[1,0,0,-20]]}},i={[v]:{enabled:!0,label:"γ"},[g]:{enabled:!1},[f]:{enabled:!1},[p]:{enabled:!0,label:"a",color:"#C52929"},[m]:{enabled:!0,label:"b",color:"#47A823"},[y]:{enabled:!1,label:"c",color:"#3B5796"}}}else if(1===n){let t,n,r=a[0];for(let e=0;e<3;++e)if(e===r){t=(e+1)%3,n=(e+2)%3;break}const o=15,d=l(e.cell[r],o),h=[1,1,1];h[r]=d;const c=["a","b","c"],u=c[r],p=c[t];s={periodicity:h,viewRotation:{alignments:[["right",u],["up",p]],rotations:[[0,1,0,-20],[1,0,0,20]]}},i={alpha:{enabled:!1},beta:{enabled:!1},gamma:{enabled:!1},[u]:{enabled:!0,label:"a",color:"#C52929"},[p]:{enabled:!1},[c[n]]:{enabled:!1}}}else s={periodicity:"boundary",viewRotation:{alignments:[["up","c"],["right","b"]],rotations:[[0,1,0,60],[1,0,0,30]]}},i={a:{enabled:!0,color:"#C52929",label:"a"},b:{enabled:!0,color:"#47A823",label:"b"},c:{enabled:!0,color:"#3B5796",label:"c"},alpha:{enabled:!0,color:"#ffffff",label:"α"},beta:{enabled:!0,color:"#ffffff",label:"β"},gamma:{enabled:!0,color:"#ffffff",label:"γ"}};this.viewer.setOptions({layout:s,latticeConstants:i},!1),this.viewer.load(e),this.viewer.saveReset(),this.createElementLegend()}resizeCanvasToHostElement(){this.viewer.resizeCanvasToHostElement()}setMaterialId(e){}changeHostElement(e){this.hostElement!==e&&(this.hostElement.removeChild(this.legendElement),this.hostElement.removeChild(this.footerElement),this.hostElement=e,this.viewer.changeHostElement(e),this.hostElement.appendChild(this.legendElement),this.hostElement.appendChild(this.footerElement)),this.viewer.resizeCanvasToHostElement(),this.viewer.reset(),this.viewer.fitToCanvas(),this.viewer.saveReset(),this.viewer.render()}getCellDataForViewer(e){return{pbc:e.periodicity,species:e.atom_labels,cell:n.convert2d(e.lattice_vectors,1e10),positions:e.atom_positions,fractional:!0}}createElementLegend(){this.labelsContainer.innerHTML="";let e=this.viewer.elements,t=[];for(let s in e)e.hasOwnProperty(s)&&t.push([s,e[s][0],e[s][1]]);t.sort((function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0}));let s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width",50),s.setAttribute("height",25*t.length),this.labelsContainer.appendChild(s);for(let e=0;e<t.length;++e){let n=t[e][0],a=t[e][1];i.addCircle(s,10,25*e+12,8,a,"#777",1),i.addText(s,24,25*e+18,n,"start","structure-viewer-legend-labels")}}}e.exports=class{constructor(){this.element=document.createElement("div"),this.element.setAttribute("id","material-module"),this.missingPrompt=document.createElement("div"),this.missingPrompt.id="missing-prompt",this.element.appendChild(this.missingPrompt),this.overview=new a,this.overview.attachAndSetEvents(this.element),this.structureViewer=new m(this.overview.vizBox),this.structureDetails=new l,this.structureDetails.attachAndSetEvents(this.element),this.electronicStructDetails=new r,this.electronicStructDetails.attachAndSetEvents(this.element),this.methodologyDetails=new o,this.methodologyDetails.attachAndSetEvents(this.element),this.thermalDetails=new d,this.thermalDetails.attachAndSetEvents(this.element),this.elasticDetails=new h,this.elasticDetails.attachAndSetEvents(this.element),this.currentDetailView=null}setMaterialView(e){this._loadMaterial(e.material_id,e.view)}getCurrentPageStatus(){let e=null;return null===this.currentDetailView&&(e=this.overview.getEStructChosenCalcs()),{pageId:this.currentDetailViewId,eStructCalcs:e}}_setView(e){null===this.currentDetailView?this.overview.element.style.display="none":this.currentDetailView.element.style.display="none",void 0===e?(this.currentDetailView=null,this.currentDetailViewId=null,this.overview.setVisible()):(this.currentDetailViewId=e,this._setDetailView(n.MAT_VIEW[e]))}_setCellViewer(e){this.structureViewer.changeHostElement(e)}_setDetailView(e){e===n.MAT_VIEW.structure?this.currentDetailView=this.structureDetails:e===n.MAT_VIEW.electronicstruct?this.currentDetailView=this.electronicStructDetails:e===n.MAT_VIEW.methodology?this.currentDetailView=this.methodologyDetails:e===n.MAT_VIEW.thermalprops&&(this.currentDetailView=this.thermalDetails),this.currentDetailView.setVisible()}_loadMaterial(e,t){let s=()=>{const s=document.getElementById("missing-prompt");if(c.getMissing()){null===this.currentDetailView?this.overview.element.style.display="none":this.currentDetailView.element.style.display="none";const t=`\n          Could not find information for material with identifier ${e}.\n          Either the material does not exist or is not yet visible in the Encyclopedia.\n        `;s.textContent=t,s.style.display="block"}else{s.style.display="none",this._setView(t);let e=c.getMaterialData();c.getIdealizedStructure(),null!==this.currentDetailView?(this.currentDetailView.load(),t===n.MAT_VIEW.structure&&this._setCellViewer(this.structureDetails.vizBox),t===n.MAT_VIEW.methodology&&this.methodologyDetails.updateSelection()):(document.querySelector("title").innerHTML="NOMAD Encyclopedia - "+n.getMaterialTitle(e,!1),this.overview.setMaterialData(),null===e.material_name?e.formula:e.material_name,this.overview.setCalcsData(p),this._setCellViewer(this.overview.vizBox))}},i=()=>{let t=c.isReady(e);return t&&s(),t};i()||(c.clear(),this.overview.clearCalcsData(),u.reset(),this.structureViewer.axisCheckbox.checked=!0,this.structureViewer.bondsCheckbox.checked=!0,document.getElementById("methodology-ov").style.visibility="hidden",document.getElementById("structure-ov").style.visibility="hidden",document.getElementById("e-structure-ov").style.display="none",document.getElementById("e-structure-ov").style.visibility="hidden",document.getElementById("thermal-props-ov").style.visibility="hidden",u.show("load_basic"),n.serverReq(n.getMaterialURL(e),(t=>{let s=t.target.status;if(s>=400&&s<500)c.setMissing(!0),c.setMaterialData({material_id:e});else{let e=JSON.parse(t.target.response);c.setMaterialData(e),n.materialId=e.material_id}i(),u.hide("load_basic")})),u.show("load_calculations"),n.serverReq(n.getMaterialXsURL("calculations",e),(t=>{let s=t.target.status;if(s>=400&&s<500)c.setMissing(!0);else{let s=JSON.parse(t.target.response),a=s.representatives.idealized_structure;c.setCalculations(s);let l=JSON.stringify({properties:["idealized_structure"]});u.show("load_idealized"),n.serverReqPOST(n.getMaterialCalcURL(e,a),l,(e=>{let t=e.target.status;if(t>=400&&t<500)c.setMissing(!0);else{let t=JSON.parse(e.target.response).idealized_structure;c.setIdealizedStructure(t),this.structureViewer.load(t),document.getElementById("structure-ov").style.visibility="visible",document.getElementById("methodology-ov").style.visibility="visible"}i(),u.hide("load_idealized")}))}u.hide("load_calculations")})),u.show("load_groups"),n.serverReq(n.getMaterialXsURL("groups",e),(e=>{let t=e.target.status;if(t>=400&&t<500)c.setMissing(!0);else{let t=JSON.parse(e.target.response);c.setGroups(t)}i(),u.hide("load_groups")})))}}},650:(e,t,s)=>{"use strict";let i=s(155),n=s(212),a=s(223),l=s(719),r=s(101);var o=window.location,d=o.protocol+"//"+o.host+"/"+o.pathname;let h=d.slice(0,d.lastIndexOf("/",d.lastIndexOf("/")-1))+"/gui/entry/id";const c=new Map([["single point","Single point"],["GW calculation","GW"],["geometry optimization","Geometry optimization"],["molecular dynamics","Molecular dynamics"],["phonon calculation","Phonon"],["equation of state","Equation of state"],["parameter variation","Parameter variation"],["QHA calculation","QHA"]]);class u{constructor(e){this.element=document.createElement("div"),this.element.className=e,this.filtersOn=[],this.folded=!0,this.element.innerHTML+=`\n      <div style="padding: 0rem 2.5rem">\n        <div style="display: flex; justify-content: flex-end;">\n          <div class="filter-groups-c-folded" >\n            <span style="vertical-align: top;">Filtering &nbsp;&nbsp;</span>\n          </div>\n          <div class="filter-c-btn" >\n             <img src="${n.IMAGE_DIR}folded.png" />\n            \x3c!--<button class="on">filter</button> --\x3e\n          </div>\n        </div>\n        <div class="filter-groups-c-unfolded" style="display: none; padding-bottom: 1rem">\n          <table style="width: 100%;">\n            <thead>\n            <tr>\n              <th style="width: 20%;">\n                <span>Type</span>\n              </th>\n              <th style="width: 20%;">\n                <span info-sys-data="functional-type">Density functional</span>\n              </th>\n              <th style="width: 20%;">\n                <span info-sys-data="code-name">Code</span>\n              </th>\n              <th style="width: 20%;">\n                <span info-sys-data="pseudopotential-type">Potential</span>\n              </th>\n              <th style="width: 20%;">\n                <span info-sys-data="basis-set-type">Basis set</span>\n              </th>\n            </tr>\n            </thead>\n            <tbody>\n              <tr id="filter-items-row"></tr>\n            </tbody>\n          </table>\n        </div>\n      </div>\n    `,this.unfoldedPanel=this.element.querySelector(".filter-groups-c-unfolded"),this.filterItemsRow=this.element.querySelector("#filter-items-row"),this.foldBtn=this.element.querySelector("img"),this.foldBtn.addEventListener("click",(e=>{this.folded=!this.folded,this.foldBtn.src=this.folded?n.IMAGE_DIR+"folded.png":n.IMAGE_DIR+"unfolded.png",this.unfoldedPanel.style.display=this.folded?"none":"block"})),this.element.addEventListener("click",(e=>{if("INPUT"===e.target.tagName){let t=this.filtersOn.indexOf(e.target.value);t>=0?this.filtersOn.splice(t,1):this.filtersOn.push(e.target.value),this.itemListener(this.filtersOn)}}))}addGroupsItems(e){let t=new Map,s=new Map,i=new Map,n=new Map,a=new Map;e.forEach((e=>{t.has(e.type)||t.set(e.type,c.get(e.type)),s.has(e.functional_type)||s.set(e.functional_type,e.functional_type),i.has(e.code)||i.set(e.code,e.code),n.has(e.core_electron_treatment)||n.set(e.core_electron_treatment,e.core_electron_treatment),a.has(e.basis_set_type)||a.set(e.basis_set_type,e.basis_set_type)})),this.filterItemsRow.innerHTML="",this.filtersOn=[],this.addGroupItems(t),this.addGroupItems(s),this.addGroupItems(i),this.addGroupItems(n),this.addGroupItems(a)}addGroupItems(e){let t="<td>  ";e.forEach(((e,s)=>{this.filtersOn.push(s),t+='<input type="checkbox" value="'+s+'" checked><span style="vertical-align: 20%">'+e+"</span> &nbsp;&nbsp; <br> "})),this.filterItemsRow.innerHTML+=t+"</td>"}setItemListener(e){this.itemListener=e}}function p(e){return null==e?"":"("+e+")"}e.exports=class extends i{constructor(){super("Methodology"),this.sortedCalcs=[],this.markedCalc=null,this.element.innerHTML+='\n\n      <div>\n        <div class="view-box">\n          <div class="title">Methodology</div>\n\n          <div class="filter-placeholder"></div>\n\n          <div class="dataTableWrapper"></div>\n        </div>\n      </div>\n    ',this.dataTableWrapper=this.element.querySelector(".dataTableWrapper"),this.dataTableWrapper.innerHTML+='\n      <table id="methodology-data">\n        <thead>\n        <tr>\n          <th style="width: 12%;">\n            <span>Calculation ID</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 16%;">\n            <span>Type</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 18%;">\n            <span info-sys-data="functional-type">Density functional</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 12%;">\n            <span info-sys-data="code-name">Code</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 16%;">\n            <span info-sys-data="pseudopotential-type">Potential</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 11%;">\n            <span info-sys-data="basis-set-type">Basis set</span>\n            <span class="sorting-button"></span>\n          </th>\n          <th style="width: 4%;">\n            <span info-sys-data="basis-set-type">Link</span>\n          </th>\n        </tr>\n        </thead>\n        <tbody>\n        </tbody>\n      </table>\n    ',this.tbody=this.dataTableWrapper.querySelector("tbody"),this.moreInfoRow=document.createElement("tr"),this.moreInfoRow.className="moreinfo",this.moreInfoCalcId=null,this.filterComponent=new u("meth-filter-component"),this.element.querySelector(".filter-placeholder").appendChild(this.filterComponent.element),this.filterComponent.setItemListener((e=>{this.sortedCalcs.forEach((t=>{let s=t.dataCalcProps.split(","),i=!0;s.forEach((t=>{e.indexOf(t)<0&&(i=!1)})),t.visible=!!i})),this._render()})),this.sortingButtonWrappers=this.dataTableWrapper.querySelectorAll(".sorting-button"),this.sortingButtons=[];let e=new Map([["calc_id",void 0],["type",void 0],["functional_type",void 0],["code",void 0],["core_electron_treatment",void 0],["basis_set_type",void 0]]).keys();this.sortingButtonWrappers.forEach((t=>{let s=e.next().value,i=new r(s);t.appendChild(i.element),this.sortingButtons.push(i),i.setListener(((e,t)=>{this.sortingButtons.forEach((e=>{e!==i&&e.init()})),this._sortRowsCalcDataBy(e,t),this._render()}))})),a.addToInfoSystem(this.element)}updateSelection(e){this.sortedCalcs=[],l.getCalculations().forEach((e=>{let t=e.run_type;l.getGroups().has(e.calc_id)&&(t=l.getGroupType(e.calc_id)),this.sortedCalcs.push({calc_id:e.calc_id,type:t,functional_type:e.functional_type,code:e.code_name,core_electron_treatment:e.core_electron_treatment,basis_set_type:e.basis_set_type,dataCalcProps:t+","+e.functional_type+","+e.code_name+","+e.core_electron_treatment+","+e.basis_set_type,visible:!0})})),this.filterComponent.addGroupsItems(this.sortedCalcs),this._sortRowsCalcDataBy(!0,"calc_id"),this._render()}_sortRowsCalcDataBy(e,t){this.sortedCalcs.sort(((s,i)=>{let n=e?-1:1;return s[t]<i[t]?n:-n}))}updateMarkedLeaf(e){}_render(){let e="";this.sortedCalcs.forEach((t=>{t.visible&&(e+=function(e){let t=l.getCalc(e.calc_id),s=e.type,i=`<a href="${h}/${t.upload_id}/${t.calc_id}" target="blank"><img src="img/download.svg" height="20px" /> </a>`,a=`<a href="https://labdev-nomad.esc.rzg.mpg.de/remotevis/cM/start/${l.getMaterialData().material_id}+${t.calc_id}" target="blank"><img src="img/monitor_icon.png" height="20px" /> </a>`;return`\n        <tr data-calc-id="${t.calc_id}" class="data-row">\n        <td>${n.getShortCode(t.calc_id)}</td>\n        <td>\n          <span info-sys-data="calculation-type.value:${s}">\n          ${s}</span>\n        </td>\n        <td>\n          <span info-sys-data="functional-type.value:${e.functional_type}">\n            ${e.functional_type}</span>\n          ${p(t.functional_long_name)}\n        </td>\n        <td>\n          <span info-sys-data="code-name.value:${t.code_name}">\n            ${t.code_name}</span>\n           ${p(t.code_version)}\n        </td>\n\n        <td>\n          <span info-sys-data="core-electron-treatment.value:${e.core_electron_treatment}">\n          ${e.core_electron_treatment}</span>\n        </td>\n        <td>\n          <span info-sys-data="basis-set-type.value:${t.basis_set_type}">\n            ${t.basis_set_type}</span>\n           ${p(t.basis_set_quality_quantifier)}\n        </td>\n\n        <td style="padding-top: 8px;padding-bottom: 4px;">${i}\n        </td>\n\n        \x3c!--\n        <td style="padding-top: 8px;padding-bottom: 4px;">${a}\n        </td>--\x3e\n\n        </tr>`}(t))})),this.tbody.innerHTML=e,a.addToInfoSystem(this.tbody)}}},414:(e,t,s)=>{"use strict";let i=s(212),n=s(719);function a(e,t){if(e.className.indexOf("material-l")>=0)return;let s=e.parentElement;for(let t=0;t<s.children.length;t++){let i=s.children[t++];if(i!==e&&i.className.indexOf("selected")<0)return}let i=s.previousElementSibling;if(t)i.className+=" node-selected";else{let e=i.className.indexOf(" node-selected");i.className=i.className.substring(0,e)}a(i,t)}e.exports=class{constructor(){this.selectedCalcs=new Set,this.element=document.createElement("div"),this.element.setAttribute("id","navigation-tree"),this.parentElement=null,this.markedNode=null,this._events()}attach(e){null!==this.parentElement&&this.parentElement.removeChild(this.element),this.parentElement=e,this.parentElement.appendChild(this.element)}build(e,t){function s(e,t,s,i=0){let n="node-"+(s?"unfolded":"folded"),a=document.createElement("div");a.className=e;let l=document.createElement("span");l.className=n,a.appendChild(l);let r=document.createElement("span");r.className="node-checkbox",a.appendChild(r);let o=document.createElement("span");if(o.className="node-label",o.textContent=t,a.appendChild(o),0!==i){let e=document.createElement("span");e.className="node-counter",e.textContent="("+i+")",a.appendChild(e)}return a}function a(e,t,s,n,a){let l=document.createElement("div");l.className="calc-l",l.setAttribute("data-calc-id",e);let r=document.createElement("span");l.appendChild(r);let d=document.createElement("span");d.className="node-checkbox",l.appendChild(d);let h=document.createElement("span");h.className="node-label",n&&h.appendChild(o),h.textContent=t+s+" ",h.appendChild(a),l.appendChild(h);let c=document.createElement("div");c.id="icon-container",c.style.float="right",c.style.padding="1px 10px 0 0",c.style.display="none";let u=document.createElement("img");return u.setAttribute("src",i.IMAGE_DIR+"next.png"),c.appendChild(u),l.appendChild(c),l}function l(e){let t=document.createElement("div");t.className="calc-graph-aval";let s=document.createElement("span");if(e.has_band_structure){let e=document.createElement("span");e.className="tooltip",e.textContent="B";let t=document.createElement("span");t.className="tooltiptext",t.textContent="Band structure",e.appendChild(t),s.appendChild(e)}if(e.has_dos){let e=document.createElement("span");e.className="tooltip",e.textContent="D";let t=document.createElement("span");t.className="tooltiptext",t.textContent="Density of states",e.appendChild(t),s.appendChild(e)}if(e.has_fermi_surface){let e=document.createElement("span");e.className="tooltip",e.textContent="F";let t=document.createElement("span");t.className="tooltiptext",t.textContent="Fermi surface",e.appendChild(t),s.appendChild(e)}if(e.has_thermal_properties){let e=document.createElement("span");e.className="tooltip",e.textContent="T";let t=document.createElement("span");t.className="tooltiptext",t.textContent="Phonons",e.appendChild(t),s.appendChild(e)}return t.appendChild(s),t}this.selectedCalcs.clear(),this.markedNode=null,this.element.innerHTML="",this.calcsInGroups=n.getGroups();let r=n.getCalculations(),o=document.createElement("img");o.className="folder-icon",o.src=i.IMAGE_DIR+"folder.png";let d=function(e,t,s){let i=new Map;function a(e,t){e.forEach(((e,s)=>{let a=n.getCalc(e[0]),l=a.code_name.trim(),r=a.functional_type;if("exciting"===l)if(i.has(r)){let e=i.get(r);e.has(l)?e.get(l).push(t+s):e.set(l,[t+s])}else if("unavailable"!==r){let e=new Map;e.set(l,[t+s]),i.set(r,e)}}))}function l(e,t){let s=e.code_name.trim(),n=e.functional_type;if(i.has(n)){let e=i.get(n);e.has(s)?e.get(s).push(t):e.set(s,[t])}else{let e=new Map;e.set(s,[t]),i.set(n,e)}}return"structure"===s&&(a(t.get("eos"),"eos/"),a(t.get("par"),"par/")),e.forEach((e=>{n.isInAnyNotDisabledGroup(e.calc_id)||("electronic"===s?(e.has_dos||e.has_band_structure)&&l(e,e.calc_id):"thermal"===s?e.has_thermal_properties&&l(e,e.calc_id):l(e,e.calc_id))})),i}(r,this.calcsInGroups,t),h=document.createElement("div");h.appendChild(s("material-l",e,!0));let c=document.createElement("div");h.appendChild(c),d.forEach(((e,t)=>{c.appendChild(s("functional-l",t,!0));let r=document.createElement("div");c.appendChild(r),e.forEach(((e,t)=>{r.appendChild(s("code-l",t,!1,e.length));let o=document.createElement("div");r.appendChild(o),o.style.display="none";for(var d=0;d<e.length;d++){let t=e[d],s="",r=i.getShortCode(t),h=n.isGroup(t);if(h){let e,i=n.getGroupType(t),a=t.substring(4);e=this.calcsInGroups.get(i).get(a),s="("+e.length+")"}let c=n.getReprCalc(t),u=a(t,r,s,h,l(n.getCalc(c)));o.appendChild(u),o.appendChild(document.createElement("div"))}}))})),this.element.appendChild(h),this.showCalcsGraphDataAvailability("structure"!==t)}selectAll(e){let t=this.element.children[0].children[0];this._recursiveNodeSelection(t,!0),a(t,!0)}getMarkedLeaf(){return null===this.markedNode?null:this.markedNode.getAttribute("data-calc-id")}setMarkedLeafIfNoneMarked(e){if(null===this.getMarkedLeaf())if(null===e)this._markFirstSelectedNode();else{let t=this.element.querySelector('div[data-calc-id="'+e+'"]');this._setMarkedCalc(t)}}_events(){this.element.addEventListener("click",(e=>{let t=e.target.className;if(t.indexOf("folded")>=0)this._foldTreeNode(e.target);else if(t.indexOf("node-checkbox")>=0){let t=e.target.parentElement.className.indexOf("selected")<0;this._recursiveNodeSelection(e.target.parentElement,t),a(e.target.parentElement,t),this.treeSelectionListener(this.selectedCalcs),this._keepCalcMarked(t)}else t.indexOf("node-label")>=0&&"calc-l node-selected"===e.target.parentElement.className&&this._setMarkedCalc(e.target.parentElement)}))}_foldTreeNode(e){let t=e.parentElement.nextElementSibling;e.className.indexOf("-folded")>=0?(e.className=e.className.replace("folded","unfolded"),t.style.display="block"):(e.className=e.className.replace("unfolded","folded"),t.style.display="none")}_recursiveNodeSelection(e,t){if(e.children[1],t)e.className+=" node-selected";else{let t=e.className.indexOf(" node-selected");e.className=e.className.substring(0,t)}if(e.className.indexOf("calc-l")>=0){let s=e.getAttribute("data-calc-id");t?this.selectedCalcs.add(s):this.selectedCalcs.delete(s)}else{let s=e.nextElementSibling;for(let e=0;e<s.children.length;e++)this._recursiveNodeSelection(s.children[e++],t)}}setTreeSelectionListener(e){this.treeSelectionListener=e}setLeafMarkedListener(e){this.leafMarkedListener=e}getTreeSelectedCalcs(){return this.selectedCalcs}_keepCalcMarked(e){if(e&&null===this.markedNode)this._markFirstSelectedNode();else if(!e){let e=parseInt(this.markedNode.getAttribute("data-calc-id"));0===this.selectedCalcs.size?(this.markedNode.className=this.markedNode.className.replace("-marked",""),this.markedNode=null,this.leafMarkedListener(null)):this.selectedCalcs.has(e)||this._markFirstSelectedNode()}}_markFirstSelectedNode(){let e=this.element.getElementsByClassName("calc-l");for(var t=0;t<e.length;t++)if(e[t].className.indexOf("node-selected")>=0)return void this._setMarkedCalc(e[t])}_setMarkedCalc(e){if(null!==this.markedNode){this.markedNode.className=this.markedNode.className.replace("-marked",""),this.markedNode.querySelector("#icon-container").style.display="none";let e=this.markedNode.querySelector(".folder-icon");null!==e&&(e.src=i.IMAGE_DIR+"folder.png")}e.className+="-marked";let t=e.querySelector(".folder-icon");null!==t&&(t.src=i.IMAGE_DIR+"folder-sel.png"),e.querySelector("#icon-container").style.display="block",this.markedNode=e;let s=e.parentElement.previousElementSibling.firstElementChild;"node-folded"===s.className&&(s.className="node-unfolded",s.parentElement.nextElementSibling.style.display="block"),void 0!==this.leafMarkedListener&&this.leafMarkedListener(e.getAttribute("data-calc-id"))}showCalcsGraphDataAvailability(e){let t=this.element.getElementsByClassName("calc-graph-aval");for(var s=0;s<t.length;s++)t[s].style.display=e?"inline":"none"}setHeight(e){this.element.style.height=e+"px"}}},576:(e,t,s)=>{"use strict";let i=s(212),n=s(223),a=s(317),l=s(507),r=s(94),o=s(195),d=(s(95),s(719)),h=s(39).SimilarityFinder;e.exports=class{constructor(){this.element=document.createElement("div"),this.element.setAttribute("id","overview"),this.materialId,this.calcMaterialId=null,this.element.innerHTML='\n\n    <div class="material-title">\n    </div>\n\n    <div style="float: left; width: 40%;">\n\n      <div id="structure-ov" class="view-box">\n        <div class="title">Structure\n          <img style="float: right" class="to-detail" src="img/more.svg" />\n          <div style="clear: both;"></div>\n        </div>\n\n        <div class="viz-box-container" style="height: 260px; position: relative">\n          <div class="viz-box" style="height: 90%"></div>\n        </div>\n\n        <div class="footer">\n          <div ><b><span>Material type</span></b>:\n            <span class="material-type-field" ></span>\n          </div>\n          <div class="space-group-field" style="display: none">\n            <b><span info-sys-data="space_group_number">Space group</span></b>:\n            <span class="space-group-value" ></span>\n          </div>\n          <div class="structure-type-field" style="display: none">\n            <b><span info-sys-data="structure_type">Structure type</span></b>:\n            <span class="structure-type-value" ></span>\n          </div>\n        </div>\n      </div>\n\n\n\x3c!-- ***** Elastic Constants Box\n\n      <div id="elastic-ov" class="view-box">\n        <div class="title">Elastic constants\n          <img style="float: right" class="to-detail" src="img/more.svg" />\n          <div style="clear: both;"></div>\n        </div>\n\n        <div class="info-fields">\n          Not analyzed yet\n        </div>\n\n      </div>\n--\x3e\n\n\n      <div id="methodology-ov" class="view-box">\n        <div class="title">Methodology\n          <img style="float: right" class="to-detail" src="img/more.svg" />\n          <div style="clear: both;"></div>\n        </div>\n\n        <div class="info-fields">\n\n          <div class="info-fields-label" > Available calculations </div>\n\n          <div style="float: left; width: 45%" >\n            <b><span info-sys-data="functional_type">Functional</span></b>\n            <div class="functional-field" > </div>\n          </div>\n          <div style="float: right; width: 45%" >\n            <b><span info-sys-data="code_name">Code</span></b>\n            <div class="code-field"> </div>\n           </div>\n           <div style="clear: both;"></div>\n        </div>\n\n      </div>\n\n    </div>\n\n    <div style="float: right; width: 60%;">\n\n      <div id="e-structure-ov" class="view-box" style="display: block">\n        <div class="title">Electronic structure\n          <img style="float: right" class="to-detail" src="img/more.svg" />\n          <div style="clear: both;"></div>\n        </div>\n\n        <div > \x3c!-- style="margin: 12% 0; " --\x3e\n\n        <div style="float: left; width: 60%;  ">\n        <div style="padding: 20px 0 20px 30px">\n          <div  class="info-fields-label">\n            <span info-sys-data="band-structure">Band structure</span>\n          </div>\n          <div>\n              <div id="band-plotter" >  </div>\n          </div>\n\n          <div class="footer-bs-calc"></div>\n        </div>\n        </div>\n\n        <div style="float: left; width: 40%;  ">\n          <div style="padding: 20px 30px 20px 40px">\n            <div class="info-fields-label">\n              <span info-sys-data="DOS">DOS</span>\n            </div>\n\n            <div>\n                <div id="dos-plotter" >  </div>\n            </div>\n            <div class="footer-dos-calc"></div>\n          </div>\n        </div>\n\n\n\n        <div style="clear: both;"></div>\n        <table style="width: 100%">\n        <tr>\n          <td class="spin-legend" style="font-size: 0.9em; padding: 6px 30px 10px; display: none;">\n            <svg width="15px" height="10px"> <polyline points="0,5 15,5" class="plotSpin1"/></svg>\n              Spin <span style=\'font-size: 1.1em\'>⇧</span>  &nbsp;&nbsp;&nbsp;\n\n              <svg width="15px" height="10px"> <polyline points="0,5 15,5" class="plotSpin2"/></svg>\n              Spin <span style=\'font-size: 1.1em\'>⇩</span>\n          </td>\n          <td class = "similarity-data-field">\n          <div style="float: right; padding: 0px 50px 10px 0px; margin-top: 1px;" class="similarity-finder">\n          </div>\n          </td>\n          </tr>\n          </table>\n        </div>\n        <div style="clear: both;"></div>\n        \x3c!--\n        <div class="footer">\n\n          <b>Band gap</b>: <span class="e-struct-field" ></span>\n        </div>\n        --\x3e\n      </div>\n\n      <div id="thermal-props-ov" class="view-box" style="visibility: hidden">\n        <div class="title">Vibrational and thermal properties\n          <img style="float: right" class="to-detail thermal-props" src="img/more.svg" />\n          <div style="clear: both;"></div>\n        </div>\n\n        <div style="padding: 36px; ">\n          <div class="info-fields-label">\n            <span info-sys-data="heat-capacity-cv">Specific heat</span>\n          </div>\n\n\n          <div>\n              <div id="heat-plotter" >  </div>\n          </div>\n          <div class="footer-heat-calc" style="text-align: center"></div>\n        </div>\n\n      </div>\n\n    </div>\n\n    <div style="clear: both;"></div>\n    ',this.materialTitle=this.element.getElementsByClassName("material-title")[0],this.systemType=this.element.querySelector(".material-type-field"),this.spaceGroupField=this.element.querySelector(".space-group-field"),this.spaceGroupValue=this.element.querySelector(".space-group-value"),this.structTypeField=this.element.querySelector(".structure-type-field"),this.structTypeValue=this.element.querySelector(".structure-type-value"),this.functional=this.element.querySelector(".functional-field"),this.code=this.element.querySelector(".code-field");let e=this.element.getElementsByClassName("to-detail");this.structureDetailBtn=e[0],this.electronicStructDetailBtn=e[2],this.methodologyDetailBtn=e[1],this.thermalDetailBtn=e[3],this.vizBox=this.element.getElementsByClassName("viz-box")[0],this.bandPlotter=null,this.bsCalcIdBox=this.element.getElementsByClassName("footer-bs-calc")[0],this.dosPlotter=null,this.dosCalcIdBox=this.element.getElementsByClassName("footer-dos-calc")[0],this.heatPlotter=null,this.heatCalcIdBox=this.element.querySelector(".footer-heat-calc"),this.spinLegend=this.element.querySelector(".spin-legend"),n.addToInfoSystem(this.element),this.eStructCalcs={bs:null,dos:null}}attachAndSetEvents(e){e.appendChild(this.element),this._events()}_events(){this.structureDetailBtn.addEventListener("click",(e=>{i.setBrowserHashPath("material",this.materialId+"/"+i.MAT_VIEW.structure)})),this.electronicStructDetailBtn.addEventListener("click",(e=>{i.setBrowserHashPath("material",this.materialId+"/"+i.MAT_VIEW.electronicstruct)})),this.methodologyDetailBtn.addEventListener("click",(e=>{i.setBrowserHashPath("material",this.materialId+"/"+i.MAT_VIEW.methodology)})),this.thermalDetailBtn.addEventListener("click",(e=>{i.setBrowserHashPath("material",this.materialId+"/"+i.MAT_VIEW.thermalprops)}))}getEStructChosenCalcs(){return this.eStructCalcs}setDetailViewsListener(e){this.detailViewsListener=e}setVisible(){this.element.style.display="block"}setMaterialData(){let e=d.getMaterialData();this.materialTitle.innerHTML=i.getMaterialTitle(e),this.materialId=e.material_id;let t="bulk"===e.material_type;if(this.systemType.textContent=e.material_type,this.structTypeField.style.display=t&&null!==e.structure_type?"block":"none",this.spaceGroupField.style.display=t?"block":"none",t&&(this.structTypeValue.textContent=e.structure_type,this.spaceGroupValue.textContent=e.space_group_number+" ("+e.space_group_international_short_symbol+")",n.addElementToInfoSystem(this.spaceGroupValue,"space_group_number.value:"+e.space_group_number)),this.similarityFinder&&this.similarityFinder.element.remove(),e.similarity){this.similarityFinder=new h({left:40,right:16,top:0,bottom:30});const t=this.element.querySelector(".similarity-finder");this.similarityFinder.setSimilarityData(e.similarity),t.appendChild(this.similarityFinder.element),this.similartyDataField=this.element.querySelector(".similarity-data-field"),n.addToInfoSystem(this.similartyDataField)}}isLoaded(e,t,s){let i=d.getMaterialData().material_id;return!(this.calcMaterialId!==i||e&&!this.bsLoaded||t&&!this.dosLoaded||s&&!this.phononLoaded)}clearCalcsData(){this.materialId=null,this.calcMaterialId=null}setCalcsData(e){let t=d.getMaterialData(),s=d.getCalculations(),h=new Map,c=new Map,u=d.getCalc(d.getRepresentatives().electronic_band_structure),p=d.getCalc(d.getRepresentatives().electronic_dos),m=d.getCalc(d.getRepresentatives().thermodynamical_properties);if(this.isLoaded(void 0!==u,void 0!==p,void 0!==m))return;this.calcMaterialId=t.material_id,this.bsLoaded=!1,this.dosLoaded=!1,this.phononLoaded=!1;for(let e=0;e<s.length;e++){if(h.has(s[e].functional_type)){let t=h.get(s[e].functional_type);h.set(s[e].functional_type,++t)}else h.set(s[e].functional_type,1);let t=s[e].code_name.trim();if(c.has(t)){let e=c.get(t);c.set(t,++e)}else c.set(t,1)}void 0!==u&&(this.eStructCalcs.bs=u.calc_id),void 0!==p&&(this.eStructCalcs.dos=p.calc_id);let y=null;void 0!==u?y=u.calc_id:void 0!==p&&(y=p.calc_id),e.eStruct=null===y?null:+y,e.thermalProps=void 0===m?null:+m.calc_id,this.functional.textContent="";let v=document.createElement("div");h.forEach(((e,t)=>{let s=document.createElement("span");s.setAttribute("info-sys-data","functional_type.value:"+i.getDefault(t)),s.textContent=e+" "+i.getDefault(t),v.appendChild(s);let n=document.createElement("br");v.appendChild(n)})),this.functional.append(v),n.addToInfoSystem(this.functional),this.code.textContent="";let g=document.createElement("div");if(c.forEach(((e,t)=>{let s=document.createElement("span");s.setAttribute("info-sys-data","code_name.value:"+t),s.textContent=e+" "+t,g.appendChild(s);let i=document.createElement("br");g.appendChild(i)})),this.code.append(g),n.addToInfoSystem(this.code),d.hasElecStructureData()){document.getElementById("e-structure-ov").style.display="block";let e=()=>{this.dosLoaded&&this.bsLoaded&&(document.getElementById("e-structure-ov").style.visibility="visible")};if(null===this.bandPlotter&&(this.bandPlotter=new l,this.bandPlotter.attach(document.getElementById("band-plotter"),void 0,316)),null===this.dosPlotter&&(this.dosPlotter=new r({left:40,right:20,top:0,bottom:30}),this.dosPlotter.attach(document.getElementById("dos-plotter"),void 0,317)),void 0===u)this.bandPlotter.setNoData(),this.bsCalcIdBox.innerHTML="",this.bsLoaded=!0;else{let t=i.getMaterialCalcURL(this.materialId,u.calc_id);a.show("overview_electronic_band_structure");let s=JSON.stringify({properties:["electronic_band_structure"]});i.serverReqPOST(t,s,(t=>{if(200===t.target.status){let e=JSON.parse(t.target.response).electronic_band_structure;this.bandPlotter.setBandStructureData(e),this.bsCalcIdBox.innerHTML="From calculation <b>"+i.getShortCode(u.calc_id)+'</b><br><span style="font-size: 0.8em">('+u.functional_type+" - "+u.code_name+")</span>",2===e.section_k_band_segment[0].band_energies.length&&(this.spinLegend.style.display="block")}else this.bandPlotter.setNoData();this.bsLoaded=!0,e(),a.hide("overview_electronic_band_structure")}))}if(void 0===p)this.dosPlotter.setNoData(),this.dosCalcIdBox.innerHTML="",this.dosLoaded=!0;else{let t=i.getMaterialCalcURL(this.materialId,p.calc_id);a.show("overview_electronic_dos");let s=JSON.stringify({properties:["electronic_dos"]});i.serverReqPOST(t,s,(t=>{if(200===t.target.status){let e=JSON.parse(t.target.response).electronic_dos;this.dosPlotter.setPoints(e,p),this.dosCalcIdBox.innerHTML="From calculation <b>"+i.getShortCode(p.calc_id)+'</b><br><span style="font-size: 0.8em">('+p.functional_type+" - "+p.code_name+")</span>",2===e.dos_values.length&&(this.spinLegend.style.display="block")}else this.dosPlotter.setNoData();this.dosLoaded=!0,e(),a.hide("overview_electronic_dos")}))}}if(d.hasThermalData())if(document.getElementById("thermal-props-ov").style.display="block",null===this.heatPlotter&&(this.heatPlotter=new o,this.heatPlotter.attach(document.getElementById("heat-plotter"),void 0,317)),void 0===m)this.heatPlotter.setNoData(),this.heatCalcIdBox.innerHTML="";else{let e=i.getMaterialCalcURL(this.materialId,m.calc_id);a.show("overview_thermodynamical");let t=JSON.stringify({properties:["thermodynamical_properties"]});i.serverReqPOST(e,t,(e=>{if(200===e.target.status){let t=JSON.parse(e.target.response).thermodynamical_properties,s=t.thermodynamical_property_temperature;this.heatPlotter.setData(s,t.specific_heat_capacity),this.heatCalcIdBox.innerHTML="From calculation <b>"+i.getShortCode(m.calc_id)+'</b></b> <span style="font-size: 0.8em">('+m.functional_type+" - "+m.code_name+")</span>",this.phononLoaded=!0,document.getElementById("thermal-props-ov").style.visibility="visible"}a.hide("overview_thermodynamical")}))}else document.getElementById("thermal-props-ov").style.display="none"}}},828:(e,t,s)=>{let i=s(507),n=s(971),a=s(584),l=s(212);class r extends n{constructor(){super({left:4,right:16,top:0,bottom:30}),this.outOfRangeColorActivated=!1}attach(e,t,s){super.attach(e,s/2+this.margins.left,s)}setPoints(e){this.pointsSpin1=[],this.pointsSpin2=[],this._reset();let t=e.dos_values[0],s=null;2===e.dos_values.length&&(s=e.dos_values[1]);let i=e.dos_energies,n=[],r=[];for(var o=0;o<i.length;o++){let e,a=5034117012222e10*i[o],l=.029979*t[o];null!==s&&(e=.029979246*s[o]),n.push(l),null!==s&&n.push(e),r.push(a),this.pointsSpin1.push({x:l,y:a}),null!==s&&this.pointsSpin2.push({x:e,y:a})}let d=Math.max.apply(null,n),h=Math.max.apply(null,r),c=Math.min.apply(null,r),u=l.generateDiagramSteps(d),p=u[0],m=u[1];this.setAxisRangeAndLabels(null,0,p[p.length-1],null,-50,320,c,h,100),a.addText(this.axisGroup,this.plotRangeX/2,this.margins.bottom,"DOS (states/cm⁻¹)","middle","axis-steps-big");for(let e=0;e<p.length;e++){let t=this.plotRangeX*p[e]/p[p.length-1];a.addLine(this.axisGroup,t,0,t,3,1),a.addText(this.axisGroup,t,13,0===e?"0":p[e].toFixed(m),"middle","axis-steps-smaller")}this.repaint()}repaintData(){let e="";for(var t=0;t<this.pointsSpin1.length;t++)e+=" "+this.xRel*this.pointsSpin1[t].x+" "+this.transformY(this.pointsSpin1[t].y);for(a.addPolyline(this.plotContent,e,"plotSpin1"),e="",t=0;t<this.pointsSpin2.length;t++)e+=" "+this.xRel*this.pointsSpin2[t].x+" "+this.transformY(this.pointsSpin2[t].y);a.addPolyline(this.plotContent,e,"plotSpin2")}}e.exports=class{constructor(){this.element=document.createElement("div"),this.parentElement=null,this.dispPlotter=new i,this.dispPlotter.setPhononMode(),this.dosPlotter=new r}attach(e,t,s){e.appendChild(this.element),this.dispPlotter.attach(this.element,s,s),this.dosPlotter.attach(this.element,void 0,s),this.parentElement=e}isAttached(){return null!==this.parentElement}setUpAndData(e,t){this.hasDispData=null!=e,this.hasDosData=null!=t,this.hasDispData?(this.dispPlotter.setBandStructureData(e),this.hasDosData&&this.dispPlotter.setRepaintListener(((e,t)=>{this.dosPlotter.setYZoomAndOffset(e,t),this.dosPlotter.repaint()}))):this.dispPlotter.setNoData(),this.hasDosData?(this.dosPlotter.setPoints(t),this.hasDispData&&this.dosPlotter.setRepaintListener(((e,t)=>{this.dispPlotter.setYZoomAndOffset(e,t),this.dispPlotter.repaint()}))):this.dosPlotter.setNoData()}setNoData(){this.dispPlotter.setNoData(),this.dosPlotter.setNoData()}}},39:(e,t,s)=>{let i=s(212);e.exports={SimilarityFinder:class{constructor(){this.folded=!0,this.element=document.createElement("span"),this.element.style="float : right; border: 2px solid #DDD; padding: 2px 2px 0px 3px;",this.element.innerHTML+=`\n        <span info-sys-data="similar-materials" style="vertical-align: 30%;">Similar materials</span>\n        <img style="cursor: pointer" src="${i.IMAGE_DIR}folded.png" />\n\n      <div class="vr-download-panel" style="position: relative; display: none;">\n\n      </div>\n    `,this.element.tabIndex="0",this.element.style.outline="none",this.foldingPanel=this.element.querySelector(".vr-download-panel"),this.foldBtn=this.element.querySelector("img"),this.foldBtn.addEventListener("click",(e=>{this.folded=!this.folded,this.foldBtn.src=this.folded?i.IMAGE_DIR+"folded.png":i.IMAGE_DIR+"unfolded.png",this.foldingPanel.style.display=this.folded?"none":"block"})),this.element.addEventListener("blur",(e=>{setTimeout((()=>{this.folded=!0,this.foldBtn.src=i.IMAGE_DIR+"folded.png",this.foldingPanel.style.display="none"}),300)}))}setSimilarityData(e){e.sort((function(e,t){return e.value<t.value?1:e.value>t.value?-1:0}));const t=e.slice(0,5),s=document.createElement("table");s.setAttribute("class","similar-materials-panel-unfolded"),s.style="width: 230px; padding-left: 5px;",this.foldingPanel.appendChild(s);const n=document.createElement("tr");n.style="padding: 5px; ",n.innerHTML='<th style = "text-align: left;">Formula (space group)</th><th>:</th><th style = "text-align: left;">Tc</th>',s.appendChild(n),t.forEach((function(e){const t=document.createElement("tr");t.style="padding: 5px; font-family: 'Arimo', sans-serif; font-size: 10pt; ";const n=`${window.location.toString().replace(/#.*$/,"")}#/material/${e.material_id}`;t.innerHTML=`<td><a href="${n}" target="_${e.material_id}" style="color:#777; font-family: 'Arimo', sans-serif; font-size: 10pt;">${i.getSubscriptedFormula(e.formula)} (${e.space_group_number})</a></td><td>:</td> <td>${e.value.toPrecision(3)}</td>`,s.appendChild(t)}))}}}},101:(e,t,s)=>{s(212),e.exports=class{constructor(e){this.id=e,this.ascending=!0,this.element=document.createElement("span"),this.element.innerHTML+='\n       <img src="img/sorting_init.png" width="12px"\n        style="margin-bottom: -1px; cursor: pointer"/>\n    ',this.image=this.element.querySelector("img"),"id"===e&&this.image.setAttribute("src","img/sorting_ascending.png"),this.element.addEventListener("click",(e=>{this.ascending=!this.ascending,this.image.setAttribute("src","img/sorting_"+(this.ascending?"ascending":"descending")+".png"),this.listener(this.ascending,this.id)}))}init(){this.image.setAttribute("src","img/sorting_init.png")}setListener(e){this.listener=e}}},624:(e,t,s)=>{"use strict";let i=s(584),n=s(666);class a extends n{constructor(){super({left:54,right:20,top:20,bottom:30})}drawBars(e,t,s,n,a,l){for(let r=0;r<e.length;++r){let o,d=(t[r]-s)*this.xRel,h=e[r]*this.yRel;o=0==a?(n-s)/l*this.xRel:a*this.xRel,i.addRect(this.plotArea,d,-h,o,h,"bar")}}}e.exports=class{constructor(){this.freqGraph=new a}attach(e,t,s){this.freqGraph.attach(e,t,s)}drawPoints(e,t,s){let i,n,a,l=e.occurrences,r=e.values,o=Math.max(...l);if(1==r.length){let e=r[0];0!==e?(i=.9*e,n=1.1*e+.2*e/s):(i=0,n=e+1),a=0}else i=r[0],a=r[1]-r[0],n=r[r.length-1]+a;this.freqGraph.setRangeAndLabels(t,i,n,"Occurrence",0,o),this.freqGraph.drawAxis(n===i?null:5,2,i>1e3?0:2),this.freqGraph.drawBars(l,r,i,n,a,s)}clear(){this.freqGraph.clear()}}},763:(e,t,s)=>{"use strict";let i=s(155),n=s(212),a=s(223),l=s(414),r=s(370),o=s(624),d=s(290),h=s(719);class c{constructor(e){this.groupCalcs=null,this.element=document.createElement("div"),this.element.innerHTML='\n    <div>\n\n      <div class="group-components" style="display: none">\n        <div style="padding: 10px 0 30px 10px; " class="eos-host">\n        </div>\n\n        <div style="padding-top: 10px; " class="calc-selector-host">\n        </div>\n      </div>\n\n      <div class="info-fields">\n        <div><b>Lattice constants</b></div>\n        <div class="latt-constants"></div>\n        <div class="volume-field"><b><span info-sys-data="cell-volume">Volume</span></b>:\n          <span class="volume-value" ></span>\n        </div>\n        \x3c!-- <div><b>Pressure</b>: <span class="" ></span>  </div>--\x3e\n        <div class="density-field"><b>Density</b>:\n            <div class="stats-fields" >\n              <span info-sys-data="mass-density">Mass density</span> =\n              <span class="mass-density-value" ></span>\n            </div>\n            <div class="stats-fields" >\n              <span info-sys-data="atomic-density">Atomic density</span> =\n              <span class="atomic-density-value" ></span>\n            </div>\n        </div>\n\n        <div class="energy-field"><b><span info-sys-data="energies">Energies</span></b> (code-specific)</div>\n        <div class="energy-descomp"> </div>\n\n        <div class="wyckoff-pos-calc-field" >\n          <b><span info-sys-data="free-wyckoff-parameters">Wyckoff sites</span></b>\n          (fractional coordinates)\n          <div class="wyckoff-pos-calc-table"> </div>\n        </div>\n\n      </div>\n\n    </div>\n    ',this.groupComponents=this.element.querySelector(".group-components"),this.calcSelector=new r("calc-selector-bar","60%"),this.element.querySelector(".calc-selector-host").appendChild(this.calcSelector.element),this.lattConstantsField=this.element.querySelector(".latt-constants"),this.volumeField=this.element.querySelector(".volume-field"),this.volumeValue=this.element.querySelector(".volume-value"),this.densityField=this.element.querySelector(".density-field"),this.massDensityValue=this.element.querySelector(".mass-density-value"),this.atomicDensityValue=this.element.querySelector(".atomic-density-value"),this.energyField=this.element.querySelector(".energy-field"),this.energyDescompValue=this.element.querySelector(".energy-descomp"),this.wyckoffPosField=this.element.querySelector(".wyckoff-pos-calc-field"),this.wyckoffPosTable=this.element.querySelector(".wyckoff-pos-calc-table"),this.eosViewer=new d,this.eosViewer.attach(this.element.querySelector(".eos-host"),320,280),this.eosViewer.setClickPointListener((e=>{this.groupCalcUpdate(e+"")})),a.addToInfoSystem(this.element),this._events()}_events(){this.calcSelector.setPrevListener((e=>{if(this.groupIndex>0)return this.groupCalcUpdate(this.groupCalcs[--this.groupIndex]+""),0===this.groupIndex})),this.calcSelector.setNextListener((e=>{if(this.groupIndex<this.groupCalcs.length-1)return this.groupCalcUpdate(this.groupCalcs[++this.groupIndex]+""),this.groupIndex===this.groupCalcs.length-1}))}update(e,t){if(this.representative=e,this.isGroup=t,t){let t=h.getGroupType(e),s=h.getGroupId(e),i=h.getMaterialData().material_id,a=n.serverReq(n.getMaterialGroupURL(i,t,s),(()=>{if(200===a.status){let e=JSON.parse(a.response),t=e.volumes.map((e=>e/1e-30)),s=e.energies.map((e=>e/1602176565e-28)),i=e.calculations,n=s[0];this.groupCalcs=i,this.groupIndex=0,this.groupComponents.style.display="block",this.eosViewer.clear(),this.eosViewer.draw(t,s,this.groupCalcs,n),this.groupCalcUpdate(i[0])}}))}else this.groupComponents.style.display="none",this.groupCalcUpdate(e)}groupCalcUpdate(e){if(null!==e){if(null!==this.groupCalcs&&(this.groupIndex=this.groupCalcs.indexOf(e),this.groupIndex>=0)){let t=n.getShortCode(e)+" ("+(this.groupIndex+1)+"/"+this.groupCalcs.length+")";this.calcSelector.setState(t,0===this.groupIndex,this.groupIndex===this.groupCalcs.length-1),this.eosViewer.selectCalc(e)}let t=h.getMaterialData(),s=t.material_id,i="2D"===t.material_type,a="bulk"===t.material_type,l=(h.getCalc(e),h.getMaterialData().has_free_wyckoff_parameters),r=["energies","lattice_parameters","mass_density","atomic_density","cell_volume"];l&&r.push("wyckoff_sets");let o=JSON.stringify({properties:r}),d=n.serverReqPOST(n.getMaterialCalcURL(s,e),o,(()=>{if(200===d.status){let e=JSON.parse(d.response),t=e.lattice_parameters,s=i||a?`<div>b = ${n.m2Angstrom(t.b)}</div>`:"";s+=a?`<div>c = ${n.m2Angstrom(t.c)}</div>`:"";let r=a?`<div>&alpha; = ${n.rad2degree(t.alpha)}</div>\n              <div>&beta; = ${n.rad2degree(t.beta)}</div>`:"";r+=i||a?`<div>&gamma; = ${n.rad2degree(t.gamma)}</div>`:"",this.lattConstantsField.innerHTML=`\n            <div style="float: left; ">\n              <div>a = ${n.m2Angstrom(t.a)}</div>\n              ${s}\n            </div>\n            <div style="float: left; padding-left: 40px;">\n              ${r}\n            </div>\n            <div style="clear: both;padding: 0"></div>\n          `,this.densityField.style.display=a?"block":"none",this.volumeField.style.display=a?"block":"none",a&&(this.volumeValue.innerHTML=n.m3ToAngstrom3(e.cell_volume),this.atomicDensityValue.innerHTML=n.toAngstromMinus3(e.atomic_density),this.massDensityValue.innerHTML=e.mass_density.toFixed(1)+" kg/m<sup>3</sup>");let o=!1,h=e.energies;if(void 0!==h){let e=h.energy_total;void 0!==e&&(o=!0,this.energyDescompValue.innerHTML="<div>Total E = &nbsp; "+n.J2eV(e)+" eV</div>")}if(this.energyField.style.display=o?"block":"none",this.energyDescompValue.style.display=o?"block":"none",this.wyckoffPosField.style.display=l?"block":"none",l){let t=new Map;e.wyckoff_sets.forEach((e=>{let s="",i=!1,n=e.variables;if(void 0!==n&&(i=!0,["x","y","z"].forEach((e=>{if(e in n){let t=n[e];s+=e+" = "+t.toFixed(2)+"<br>"}}))),i){let i=[];i.push(e.wyckoff_letter),i.push(s),t.has(e.element)?t.get(e.element).push(i):t.set(e.element,[i])}}));let s="";t.forEach(((e,t)=>{e.sort(((e,t)=>e[0]>t[0]?1:-1));let i=!0;s+='<tr > <td style="width: 30%;">'+t+" </td>",e.forEach((e=>{i?(i=!1,s+='<td style="width: 30%; ">'+e[0]+'</td><td style="width: 40%;">'+e[1]+"</td></tr>"):s+="<tr><td> </td><td>"+e[0]+"</td><td>"+e[1]+"</td></tr>"}))})),this.wyckoffPosTable.innerHTML='<table id="calc-wyckoff">'+s+"</table>"}}}))}}}class u{constructor(e){this.calcMapByFunctional=null,this.quantitiesMap=null,this.hostElement=e,this.graphTrigger=null,this.viewType="text",this.functional=null,this.nBins=15,this.hostElement.innerHTML+='\n      <div style="float: left" >\n        <svg xmlns="http://www.w3.org/2000/svg" class="chart-tab"\n          viewBox="0 0 15 15" width="15" height="15" style="fill: #c7c7c7;">\n            <rect x="0" y="0"  width="2" height="15" />\n            <rect   x="3" y="5"  width="1.8" height="7"  />\n            <rect  x="6" y="3"  width="1.8" height="9"  />\n            <rect   x="9" y="6"  width="1.8" height="6"  />\n            <rect  x="12" y="2"  width="1.8" height="10"  />\n            <rect x="2" y="13"   width="13" height="2" />\n        </svg>\n        <svg xmlns="http://www.w3.org/2000/svg" class="text-tab"\n          viewBox="0 0 15 15" width="15" height="15" style="fill: #777;">\n            <rect x="0" y="1"   width="15" height="2.5" />\n            <rect   x="0" y="6"  width="15" height="2.5"  />\n            <rect  x="0" y="11"  width="15" height="2.5"  />\n        </svg>\n      </div>\n\n      <div class="functional-tabs" style="float: right">\n      </div>\n\n      <div style="clear: both;"></div>\n\n      <div class="content-placeholder" >\n\n        <div style="display: block" class="text-panel" >\n          <div><b>Lattice constants</b>:\n            <div class="stats-fields latt-constants-field" >\n            </div>\n          </div>\n          <div class="volume-field"><b><span info-sys-data="cell-volume">Volume</span></b> (&#197;<sup>3</sup>):\n            <div class="stats-fields volume-value" > </div>\n          </div>\n          <div class="density-field"><b>Density</b> :\n            <div >\n              <div class="stats-fields" >\n                <span info-sys-data="mass-density">Mass density</span> (kg/m<sup>3</sup>) =\n                <span class="mass-density-value" ></span>\n              </div>\n              <div class="stats-fields" >\n                <span info-sys-data="atomic-density">Atomic density</span> (&#197;<sup>-3</sup>) =\n                <span class="atomic-density-value" ></span>\n              </div>\n            </div>\n          </div>\n        </div>\n\n        <div style="display:none" class="chart-panel" >\n          <div class="charts-placeholder" > </div>\n          <div class="charts-selector" >\n\n          </div>\n        </div>\n\n      </div>\n    ',this.chartTab=this.hostElement.querySelector(".chart-tab"),this.textTab=this.hostElement.querySelector(".text-tab"),this.functionalTabs=this.hostElement.querySelector(".functional-tabs"),this.chartPanel=this.hostElement.querySelector(".chart-panel"),this.textPanel=this.hostElement.querySelector(".text-panel"),this.lattConstantsField=this.hostElement.querySelector(".latt-constants-field"),this.volumeField=this.hostElement.querySelector(".volume-field"),this.volumeFieldValue=this.hostElement.querySelector(".volume-value"),this.densityField=this.hostElement.querySelector(".density-field"),this.massDensityValue=this.hostElement.querySelector(".mass-density-value"),this.atomicDensityValue=this.hostElement.querySelector(".atomic-density-value"),this.statsViewer=new o;let t=this.hostElement.querySelector(".charts-placeholder");this.statsViewer.attach(t,350,200),this.chartsSelector=this.hostElement.querySelector(".charts-selector"),this.chartTab.addEventListener("click",(e=>{this.chartTab.style.fill="#777",this.viewType="chart",this.textTab.style.fill="#c7c7c7",this.chartPanel.style.display="block",this.textPanel.style.display="none"})),this.textTab.addEventListener("click",(e=>{this.textTab.style.fill="#777",this.viewType="text",this.chartTab.style.fill="#c7c7c7",this.textPanel.style.display="block",this.chartPanel.style.display="none"})),this.functionalTabs.addEventListener("click",(e=>{"tab"===e.target.className&&(this.statsViewer.clear(),this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab",this.functional=e.target.getAttribute("data-tab"),this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab-selected",this._setData())})),this.chartsSelector.addEventListener("click",(e=>{if(0===e.target.className.indexOf("quantity")){this.statsViewer.clear();let t=e.target.getAttribute("data-quantity"),s=this.quantitiesMap.get(t),i=s.label,n=s.stats;this.statsViewer.drawPoints(n.histogram,i,this.nBins),this.chartsSelector.querySelector(".quantity-selected").className="quantity",e.target.className="quantity-selected"}}))}_setData(){let e="2D"===h.getMaterialData().material_type,t="bulk"===h.getMaterialData().material_type,s=(this.functional,Array.from(this.calcMapByFunctional.get(this.functional))),i=h.getMaterialData().material_id,a=new Map;a.set("lattice_a",{label:"a (Å)"}),e|t&&(a.set("lattice_b",{label:"b (Å)"}),a.set("gamma",{label:"&gamma"})),t&&(a.set("cell_volume",{label:"Volume (ų)"}),a.set("atomic_density",{label:"Atomic density (Å⁻³)"}),a.set("mass_density",{label:"Mass density (kg/m³)"}),a.set("lattice_c",{label:"c ()"}),a.set("alpha",{label:"&alpha"}),a.set("beta",{label:"&beta"}));let l=JSON.stringify({calculations:s,properties:Array.from(a.keys()),n_histogram_bins:this.nBins});n.serverReqPOST(n.getMaterialStatsURL(i),l,(s=>{let i=JSON.parse(s.target.response);for(let e of a.keys()){let t=i[e];"cell_volume"==e?(t.min*=1e30,t.avg*=1e30,t.max*=1e30,t.histogram.values=t.histogram.values.map((e=>1e30*e))):"atomic_density"==e?(t.min*=1e-30,t.avg*=1e-30,t.max*=1e-30,t.histogram.values=t.histogram.values.map((e=>1e-30*e))):e.startsWith("lattice_")&&(t.min*=1e10,t.avg*=1e10,t.max*=1e10,t.histogram.values=t.histogram.values.map((e=>1e10*e)));let s=a.get(e).label;t.equal=t.min===t.max;let l=s.split(":");t.label=l[0],2===l.length?t.units=l[1]:t.units="";let r,o=3;"mass_density"===e&&(o=1),r="alpha"==e||"beta"==e||"gamma"==e?n.rad2degree(t.avg.toFixed(o)):t.avg.toFixed(o)+' &nbsp; <span style="font-size: 0.9em">['+t.min.toFixed(o)+" , "+t.max.toFixed(o)+"]</span>",a.get(e).html=r,a.get(e).stats=t}let l=e||t?`<div>b (&#197;) = ${a.get("lattice_b").html}</div>`:"";l+=t?`<div>c (&#197;) = ${a.get("lattice_c").html}</div>`:"";let r=t?`<div>&alpha; = ${a.get("alpha").html}</div>\n          <div>&beta; = ${a.get("beta").html}</div>`:"";r+=e||t?`<div>&gamma; = ${a.get("gamma").html}</div>`:"",this.lattConstantsField.innerHTML=`\n        <div style="float: left; ">\n          <div>a (&#197;) = ${a.get("lattice_a").html}</div>\n          ${l}\n        </div>\n      <div style="float: left; padding-left: 40px;">\n        ${r}\n      </div>\n        <div style="clear: both;padding: 0"></div>\n        `;let o='\n      <span class="quantity-selected" data-quantity="lattice_a">a</span>\n      ';(e||t)&&(o+='<span class="quantity" data-quantity="lattice_b">b</span>'),this.densityField.style.display=t?"block":"none",this.volumeField.style.display=t?"block":"none",t&&(this.volumeFieldValue.innerHTML=a.get("cell_volume").html,this.massDensityValue.innerHTML=a.get("mass_density").html,this.atomicDensityValue.innerHTML=a.get("atomic_density").html,o+='\n          <span class="quantity" data-quantity="lattice_c">c</span>\n          <span class="quantity" data-quantity="cell_volume">volume</span>\n          <span class="quantity" data-quantity="mass_density">mass density</span>\n          <span class="quantity" data-quantity="atomic_density">atomic density</span>\n        '),this.chartsSelector.innerHTML=o,this.quantitiesMap=a;let d=i.lattice_a.histogram;this.statsViewer.drawPoints(d,a.get("lattice_a").label,this.nBins)}))}build(e){this.calcMapByFunctional=e,this.graphTrigger=null,this.statsViewer.clear(),this.unfoldedElement=null,this.functionalQuantityMap=new Map,this.functionalTabs.innerHTML="",this.calcMapByFunctional.forEach(((e,t)=>{this.functionalTabs.innerHTML+='<span class="tab" data-tab="'+t+'">'+t+"</span>"}));let t=Array.from(this.calcMapByFunctional.keys());(null===this.functional||t.indexOf(this.functional)<0)&&(this.functional=t[0]),this._setData(),this.functionalTabs.querySelector('[data-tab="'+this.functional+'"]').className="tab-selected",a.addToInfoSystem(this.hostElement)}}e.exports=class extends i{constructor(){super("Structure"),this.navTree=new l,this.groupsData,this.element.innerHTML+='\n\n      <div style="float: left; width: 36%;">\n        <div class="view-box">\n          <div class="title">Structure </div>\n          <div class="viz-box-container" style="height: 400px; position: relative">\n            <div class="viz-box" style="height: 90%"></div>\n          </div>\n\n          <div class="footer-flex-wrapper">\n\n            <div class="fields-container">\n              <div><b><span>System type</span></b>:\n                <span class="struct-field" ></span>\n              </div>\n              <div class="structure-type-field" style="display: none">\n                <b><span info-sys-data="structure_type">Structure type</span></b>:\n                <span class="structure-type-value" ></span>\n              </div>\n              <div class="structure-prototype-field" style="display: none">\n                <b><span info-sys-data="structure_prototype">Structure prototype</span></b>:\n                <span class="structure-prototype-value" ></span>\n              </div>\n              <div class="strukturbericht-field" style="display: none">\n                <b><span info-sys-data="strukturbericht">Strukturbericht designation</span></b>:\n                <span class="strukturbericht-value" ></span>\n              </div>\n            </div>\n\n            <div class="footer-flex" style="display: none">\n\n              <div class="fields-container"\n                style="flex-basis: 70%; border-right: 1px solid #E4E4E4; ">\n\n                <div>\n                  <b><span info-sys-data="crystal_system">Lattice</span></b>:\n                  <span class="lattice-value" ></span>\n                </div>\n                <div>\n                  <b><span info-sys-data="space_group_number">Space group</span></b>:\n                  <span class="space-group-value" ></span>\n                </div>\n                <div>\n                  <b><span info-sys-data="point-group">Point group</span></b>:\n                  <span class="point-group-value" ></span>\n                </div>\n              </div>\n\n              <div style="flex-basis: 30%; margin-left: 30px;">\n                <div class="fields-container">\n                  <div><b><span info-sys-data="wyckoff-position-population">Wyckoff sites</span></b></div>\n                  <div class="wyckoff-sites-value"> </div>\n                </div>\n              </div>\n\n            </div>\n\n          </div>\n\n        </div>\n      </div>\n\n      <div style="float: left; width: 36%;">\n        <div class="view-box">\n          <div class="title">Calculations</div>\n          <div class="navTreeWrapper"></div>\n\n          <div class="summary-title">Summary  </div>\n          <div style="font-size: 0.85em; text-align: center; padding: 4px;">Based on the calculations selected above</div>\n\n          <div class="info-fields summary-box">\n          \x3c!-- Lattice constants Cell volume, Density panel dynamically generated\n            --\x3e\n          </div>\n        </div>\n      </div>\n\n      <div style="float: right; width: 28%;">\n        <div class="calc-specifics-box">\n          <div style="padding-top: 10px; " >\n            <div class="tree-leaf-title"></div>\n          </div>\n          <div class="tree-leaf-viewer-host"></div>\n          </div>\n        </div>\n      </div>\n    </div>\n    ',this.navTreeWrapper=this.element.getElementsByClassName("navTreeWrapper")[0];let e=this.element.getElementsByClassName("struct-field");this.systemTypeField=e[0],this.structTypeField=this.element.querySelector(".structure-type-field"),this.structTypeValue=this.element.querySelector(".structure-type-value"),this.structPrototypeField=this.element.querySelector(".structure-prototype-field"),this.structPrototypeValue=this.element.querySelector(".structure-prototype-value"),this.strukturberichtField=this.element.querySelector(".strukturbericht-field"),this.strukturberichtValue=this.element.querySelector(".strukturbericht-value"),this.lowerBox=this.element.querySelector(".footer-flex"),this.latticeValue=this.element.querySelector(".lattice-value"),this.spaceGroupValue=this.element.querySelector(".space-group-value"),this.pointGroupValue=this.element.querySelector(".point-group-value"),this.wyckoffValue=this.element.querySelector(".wyckoff-sites-value"),this.summaryByFunctionals=null,this.leafTitle=this.element.querySelector(".tree-leaf-title"),this.summaryBox=this.element.querySelector(".summary-box"),this.summaryByFunctionals=new u(this.summaryBox),this.calcSpecificsBox=this.element.querySelector(".calc-specifics-box"),this.treeLeafViewer=new c,this.element.querySelector(".tree-leaf-viewer-host").appendChild(this.treeLeafViewer.element),this.vizBox=this.element.querySelector(".viz-box"),a.addToInfoSystem(this.element)}setMaterialData(){let e=h.getMaterialData(),t=h.getIdealizedStructure();super.setMaterialData(e);let s=null===e.material_name?e.formula:e.material_name;if(this.navTree.build(s,"structure"),this.navTree.selectAll(),this.navTree.setHeight(250),this.navTree.setMarkedLeafIfNoneMarked(null),this.attachNavTree(this.navTree),this.updateSelection(this.navTree.getTreeSelectedCalcs()),this.updateMarkedLeaf(this.navTree.getMarkedLeaf()),this.navTree.setTreeSelectionListener((e=>{this.updateSelection(e)})),this.navTree.setLeafMarkedListener((e=>{this.updateMarkedLeaf(e)})),this.isBulk="bulk"===e.material_type,this.systemTypeField.textContent=e.material_type,this.structTypeField.style.display=this.isBulk&&null!==e.structure_type?"block":"none",this.structPrototypeField.style.display=this.isBulk&&null!==e.structure_prototype?"block":"none",this.strukturberichtField.style.display=this.isBulk&&null!==e.strukturbericht_designation?"block":"none",this.lowerBox.style.display=this.isBulk?"flex":"none",this.isBulk){this.structTypeValue.textContent=e.structure_type,this.structPrototypeValue.textContent=e.structure_prototype,this.strukturberichtValue.textContent=e.strukturbericht_designation,this.spaceGroupValue.textContent=e.space_group_number+" ("+e.space_group_international_short_symbol+")",this.pointGroupValue.textContent=e.point_group,this.latticeValue.textContent=e.crystal_system;let s=new Map;new Set;for(var i=0;i<t.wyckoff_sets.length;i++){let e=t.wyckoff_sets[i],n=e.element;if(s.has(n))s.get(n).add(e.wyckoff_letter);else{let t=new Set;t.add(e.wyckoff_letter),s.set(n,t)}}let n="";s.forEach(((e,t)=>{let s=!0;n+="<tr> <td>"+t+": </td>",e.forEach((e=>{s?(s=!1,n+="<td>"+e+"</td></tr>"):n+="<tr><td> </td><td>"+e+"</td></tr>"}))})),this.wyckoffValue.innerHTML="<table>"+n+"</table>"}a.addElementToInfoSystem(this.spaceGroupValue,"space_group_number.value:"+e.space_group_number),a.addElementToInfoSystem(this.latticeValue,"crystal_system.value:"+e.crystal_system),a.addElementToInfoSystem(this.pointGroupValue,"point-group.value:"+e.point_group)}updateSelection(e){if(e.size>0){let t=[];e.forEach((e=>{if(h.isGroup(e)){let s=h.getGroupType(e),i=h.getGroupId(e),n=h.getGroups().get(s).get(i);t.push(h.getCalc(n[0]))}else t.push(h.getCalc(e))})),this.summaryBox.style.visibility="visible";let s=n.getCalcMapByFunctional(t);this.summaryByFunctionals.build(s)}else this.summaryBox.style.visibility="hidden"}updateMarkedLeaf(e){let t=!1;if(null!==e)if(this.calcSpecificsBox.style.visibility="visible",t=h.isGroup(e),t){let t,s=h.getGroupType(e),i=h.getGroupId(e);t=h.getGroups().get(s).get(i),this.leafTitle.innerHTML=n.getShortCode(e)+" ("+t.length+")"}else this.leafTitle.innerHTML=n.getShortCode(e);else this.calcSpecificsBox.style.visibility="hidden";this.treeLeafViewer.update(e,t)}}},346:(e,t,s)=>{"use strict";let i=s(155),n=s(212),a=s(414),l=s(223),r=s(719),o=s(317),d=s(195),h=s(842),c=s(828);e.exports=class extends i{constructor(){super("Thermal Properties"),this.firstId,this.lastId,this.navTree=new a,this.element.innerHTML+='\n      <div style="float: left; width: 30%;">\n        <div class="view-box">\n          <div class="title">Calculations </div>\n          <div class="navTreeWrapper"></div>\n        </div>\n      </div>\n\n      <div style="float: right; width: 70%;">\n        <div class="view-box thermal-properties-box">\n\n          <div class="title">Vibrational and thermal properties</div>\n\n          <div style="padding-top: 10px;">\n            <div class="tree-leaf-title"></div>\n          </div>\n\n          <div class="calc-disp-dos-plotter" style="padding: 30px 100px; ">\n            <div class="info-fields-label" style="float: left; width: 52%; ">\n              <span info-sys-data="phonon-dispersion">Phonon dispersion </span>\n            </div>\n            <div class="info-fields-label" style="float: left;">\n              <span info-sys-data="phonon-DOS">Phonon DOS  </span>\n            </div>\n            <div style="clear: both;"></div>\n          </div>\n\n\n          <div class="band" >\n            <div style="padding: 30px 50px; display: flex; justify-content: space-around; ">\n\n              <div >\n                <div class="info-fields-label" >\n                  <span info-sys-data="specific-heat-cv">Specific heat</span>\n                </div>\n                <div class="heat-plotter" >      </div>\n              </div>\n\n              <div>\n                <div class="info-fields-label" >\n                  <span info-sys-data="helmholtz-free-energy">Helmholtz free energy</span>\n                </div>\n                <div class="helmholtz-plotter" >      </div>\n              </div>\n\n            </div>\n          </div>\n\n        </div>\n      </div>\n    ',this.navTreeWrapper=this.element.getElementsByClassName("navTreeWrapper")[0],this.rightBox=this.element.querySelector(".thermal-properties-box"),this.leafTitle=this.element.querySelector(".tree-leaf-title"),this.dispDosPlotter=new c,this.heatPlotter=new d,this.helmholtzPlotter=new h,l.addToInfoSystem(this.element)}_events(){super._events()}setMaterialData(){let e=r.getMaterialData();super.setMaterialData(e);let t=null===e.material_name?e.formula:e.material_name;this.navTree.build(t,"thermal"),this.navTree.selectAll(),this.navTree.setHeight(600),this.navTree.setMarkedLeafIfNoneMarked(null),this.attachNavTree(this.navTree),this.updateSelection(this.navTree.getTreeSelectedCalcs()),this.updateMarkedLeaf(this.navTree.getMarkedLeaf()),this.navTree.setTreeSelectionListener((e=>{this.updateSelection(e)})),this.navTree.setLeafMarkedListener((e=>{this.updateMarkedLeaf(e)}))}updateSelection(e){}updateMarkedLeaf(e){if(null===e)return this.leafTitle.innerHTML="NO SELECTION",this.dispDosPlotter.setNoData(),this.heatPlotter.setNoData(),void this.helmholtzPlotter.setNoData();this.leafTitle.innerHTML=n.getShortCode(e);let t=r.getCalc(e);this.dispDosPlotter.isAttached()||(this.dispDosPlotter.attach(this.element.querySelector(".calc-disp-dos-plotter"),void 0,360),this.heatPlotter.attach(this.element.querySelector(".heat-plotter"),317,317),this.helmholtzPlotter.attach(this.element.querySelector(".helmholtz-plotter"),317,317)),o.show("thermal_properties");let s=r.getMaterialData().material_id,i=n.getMaterialCalcURL(s,t.calc_id),a=JSON.stringify({properties:["phonon_band_structure","phonon_dos","thermodynamical_properties"]});n.serverReqPOST(i,a,(e=>{let t=JSON.parse(e.target.response),s=t.phonon_dos,i=t.phonon_band_structure,n=t.thermodynamical_properties;if(void 0!==s?this.dispDosPlotter.setUpAndData(i,s):this.dispDosPlotter.setNoData(),void 0!==n){let e=n.thermodynamical_property_temperature;this.heatPlotter.setData(e,n.specific_heat_capacity),this.helmholtzPlotter.setData(e,n.specific_vibrational_free_energy_at_constant_volume)}else this.heatPlotter.setNoData(),this.helmholtzPlotter.setNoData();document.getElementById("thermal-props-ov").style.visibility="visible",o.hide("thermal_properties")}))}setPrevCalcListener(e){this.prevCalcListener=e}setNextCalcListener(e){this.nextCalcListener=e}}},423:e=>{"use strict";e.exports=class{constructor(e="",t="",s=!0){this.id=e,this.element=document.createElement("div"),this.element.className=`AutocompleteMultiselectTextfield ${e}-autocomplete-multiselect-textfield`,this.element.innerHTML=`\n      <input type="text" placeholder="${t}" /> \n      <div class="AutocompleteMultiselectTextfield-dropdown ${this.id}-autocomplete-multiselect-dropdown"></div> \n      <div class="AutocompleteMultiselectTextfield-selected-box"></div> \n    `,this.input=this.element.querySelector("input"),this.selectedItemsBox=this.element.querySelector(".AutocompleteMultiselectTextfield-selected-box"),this.listContainer=this.element.querySelector(".AutocompleteMultiselectTextfield-dropdown"),this.selectListener,this.valueList,this.selectedValues=new Set,this.allowEmptyInput=s,this.input.addEventListener("click",(e=>{this._processInput(),e.stopPropagation()})),this.input.addEventListener("input",(e=>{this._processInput()})),this.element.addEventListener("mouseleave",(e=>{this._cleanList()})),this.selectedItemsBox.addEventListener("click",(e=>{let t=event.target.closest("span");this._removeSelectedValue(t.dataset.value)})),this.listContainer.addEventListener("click",(e=>{let t=event.target.closest("div");this._toggleItem(t)})),this.listContainer.addEventListener("mouseover",(e=>{let t=event.target.closest("div");this._setActiveListItem(t)}))}getValues(){return Array.from(this.selectedValues)}disable(e){this.input.disabled=e}setAutocompleteList(e){this.valueList=e}setSelectListener(e){this.selectListener=e}_processInput(){const e=this.input.value;if(this._cleanList(),!this.allowEmptyInput&&!e)return!1;let t=0;const s=this.valueList.filter((s=>{const i=s.toUpperCase().includes(e.toUpperCase());return i&&t++,t<=15&&i}));this.listContainer.innerHTML="",s.forEach((t=>{const s=function(e,t,s){const i=document.createElement("div");let n=`<input class="value-checkbox" type="checkbox" data-value="${e}" ${s?"checked":""}>`;if(t){const s=e.toUpperCase().indexOf(t.toUpperCase());n+=`${e.substring(0,s)}<strong>${e.substring(s,s+t.length)}</strong>${e.substring(s+t.length)}`}else n+=e;return i.innerHTML=n,i}(t,e,this.selectedValues.has(t));this.listContainer.append(s),t.toUpperCase()===e.toUpperCase()&&this._setActiveListItem(s)}))}_removeSelectedValue(e){this.selectedValues.delete(e),this.selectedItemsBox.querySelector('span[data-value="'+e+'"]').remove();const t=this.listContainer.querySelector('input[data-value="'+e+'"]');t&&(t.checked=!1),this.element.dispatchEvent(new Event("change",{bubbles:!0}))}_toggleItem(e){const t=e.textContent,s=this.selectedValues.has(t);e.querySelector("input").checked=!s,s?(this.selectedValues.delete(t),this.selectedItemsBox.querySelector('span[data-value="'+t+'"]').remove()):(this.selectedValues.add(t),this.selectedItemsBox.append(function(e){const t=document.createElement("span");t.className="selectedItemLabel",t.dataset.value=e;const s=document.createElement("div");s.textContent=`${e}`;const i=document.createElement("img");return i.src="img/cross-maroon.svg",i.width=10,i.height=10,t.appendChild(s),t.appendChild(i),t}(t))),this.selectListener&&this.selectListener(t),this.element.dispatchEvent(new Event("change",{bubbles:!0}))}_setActiveListItem(e){const t=this.listContainer.querySelector(".autocomplete-active");t&&t.classList.remove("autocomplete-active"),e.classList.add("autocomplete-active")}_cleanList(){this.listContainer.innerHTML=""}}},191:(e,t,s)=>{"use strict";let i=s(212);const n=new Map([[1,["H","Li","Na","K","Rb","Cs","Fr"]],[2,["Be","Mg","Ca","Sr","Ba","Ra"]],[3,["Sc","Y"]],[4,["Ti","Zr","Hf","Rf"]],[5,["V","Nb","Ta","Ha"]],[6,["Cr","Mo","W","Sg"]],[7,["Mn","Tc","Re","Ns"]],[8,["Fe","Ru","Os","Hs"]],[9,["Co","Rh","Ir","Mt"]],[10,["Ni","Pd","Pt","Ds"]],[11,["Cu","Ag","Au","Rg"]],[12,["Zn","Cd","Hg","Cn"]],[13,["B","Al","Ga","In","Tl","Nh"]],[14,["C","Si","Ge","Sn","Pb","Fl"]],[15,["N","P","As","Sb","Bi","Mc"]],[16,["O","S","Se","Te","Po","Lv"]],[17,["F","Cl","Br","I","At","Ts"]],[18,["He","Ne","Ar","Kr","Xe","Rn","Og"]],[19,["La","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu"]],[20,["Ac","Th","Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md","No","Lr"]]]),a=new Map([["metalloids",["B","Si","Ge","As","Sb","Te","Po"]],["other-non-metals",["H","C","N","O","P","S","Se"]],["halogens",["F","Cl","Br","I","At","Ts"]],["noble-gases",["He","Ne","Ar","Kr","Xe","Rn","Og"]],["alkali-metals",["Li","Na","K","Rb","Cs","Fr"]],["alkaline-earth-metals",["Be","Mg","Ca","Sr","Ba","Ra"]],["lanthanoids",["La","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu"]],["actinoids",["Ac","Th","Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md","No","Lr"]],["transition-metals",["Sc","Y","Ti","Zr","Hf","Rf","V","Nb","Ta","Ha","Cr","Mo","W","Sg","Mn","Tc","Re","Ns","Fe","Ru","Os","Hs","Co","Rh","Ir","Mt","Ni","Pd","Pt","Ds","Cu","Ag","Au","Rg","Zn","Cd","Hg","Cn"]],["post-transition-metals",["Al","Ga","In","Tl","Nh","Sn","Pb","Fl","Bi","Mc","Lv"]]]),l=new Map([["metalloids","#F9E298"],["other-non-metals","#F2B01D"],["halogens","#85ADC1"],["noble-gases","#F7D660"],["alkali-metals","#D04629"],["alkaline-earth-metals","#F7B57D"],["transition-metals","#F58737"],["post-transition-metals","#AE4747"],["lanthanoids","#3B91AE"],["actinoids","#E97147"]]);let r=["Hydrogen","Helium","Lithium","Beryllium","Boron","Carbon","Nitrogen","Oxygen","Fluorine","Neon","Sodium","Magnesium","Aluminum","Silicon","Phosphorus","Sulfur","Chlorine","Argon","Potassium","Calcium","Scandium","Titanium","Vanadium","Chromium","Manganese","Iron","Cobalt","Nickel","Copper","Zinc","Gallium","Germanium","Arsenic","Selenium","Bromine","Krypton","Rubidium","Strontium","Yttrium","Zirconium","Niobium","Molybdenum","Technetium","Ruthenium","Rhodium","Palladium","Silver","Cadmium","Indium","Tin","Antimony","Tellurium","Iodine","Xenon","Cesium","Barium","Lanthanum","Cerium","Praseodymium","Neodymium","Promethium","Samarium","Europium","Gadolinium","Terbium","Dysprosium","Holmium","Erbium","Thulium","Ytterbium","Lutetium","Hafnium","Tantalum","Tungsten","Rhenium","Osmium","Iridium","Platinum","Gold","Mercury","Thallium","Lead","Bismuth","Polonium","Astatine","Radon","Francium","Radium","Actinium","Thorium","Protactinium","Uranium","Neptunium","Plutonium","Americium","Curium","Berkelium","Californium","Einsteinium","Fermium","Mendelevium","Nobelium","Lawrencium","Rutherfordium","Dubnium","Seaborgium","Bohrium","Hassium","Meitnerium","Darmstadtium","Roentgenium","Copernicium","Nihonium","Flerovium","Moscovium","Livermorium","Tennessine","Oganesson"];function o(e){let t;return a.forEach((function(s,i){s.indexOf(e)>=0&&(t=i)})),t}function d(e){let t=i.ELEMENTS[e-1];return'<td class="cell '+o(t)+'" data-el="el-'+t+'"><b>'+t+"</b> <div>"+e+"</div> </td>"}function h(e){let t=null,s=null;if(e.target.className.indexOf("cell ")>=0?(t=e.target,s=e.target.className):e.target.parentElement.className.indexOf("cell ")>=0&&(t=e.target.parentElement,s=e.target.parentElement.className),null===t)return null;{let e=t.innerHTML,s=e.substring(3,e.indexOf("<",3));return"&nbsp;"===s?null:s}}e.exports=class{constructor(){this.element=document.createElement("div"),this.element.setAttribute("id","elementable");let e='<div class="element-info"></div>';e+='<div class="ptWrapper">',e+='<table id="pt-main">',e+="<tbody>",e+="<tr>"+d(1),e+='<td class="cellpad" colspan="16"></td>',e+=d(2)+"</tr>";let t=t=>{e+="<tr>"+d(t)+d(t+1),e+='<td class="cellpad" colspan="10"></td>';for(let s=t+2;s<t+8;s++)e+=d(s);e+="</tr>"};t(3),t(11);let s=19;for(let t=0;t<4;t++){e+="<tr>";for(let t=0;t<18;t++)57===s||89===s?(e+=(n=s,'<td class="cellpad '+o(i.ELEMENTS[n-1])+'" data-el="el-X"><b>&nbsp;</b> <div>&nbsp;</div> </td>'),s+=15):(e+=d(s),s++);e+="</tr>"}var n;e+="</tbody></table>",e+='<div id="specialRows"><table id="pt-laac">';for(let t=0;t<2;t++){e+="<tr>",s=0===t?57:89;for(let t=0;t<15;t++)e+=d(s),s++;e+="</tr>"}e+="</table></div>",e+='<div class="legend">\n      <div class="alkali-metals">Alkali metals</div>\n      <div class="alkaline-earth-metals">Alkaline earth metals</div>\n      <div class="transition-metals">Transition metals</div>\n      <div class="post-transition-metals">Post-transition metals</div>\n      <div class="metalloids">Metalloids</div>\n      <div class="other-non-metals">Other nonmetals</div>\n      <div class="halogens">Halogens</div>\n      <div class="noble-gases">Noble gases</div>\n      <div class="lanthanoids">Lanthanoids</div>\n      <div class="actinoids">Actinoids</div>\n    </div>',e+='<div class="perm-tooltip search-option" style="margin-right: 10px">\n        <input id="allow-other-elements" name="allow-other-elements" type="checkbox" checked>\n        <label for="allow-other-elements" class="perm-tooltip">Allow other elements</label>\n        <span class="tooltiptext">If selected, the returned materials may also contain other elements.</span>\n    </div>',e+="</div>",this.element.innerHTML=e,this.elementInfo=this.element.getElementsByClassName("element-info")[0],this.tableZone=this.element.getElementsByClassName("ptWrapper")[0],this._events()}_events(){this.tableZone.addEventListener("click",(e=>{if(e.target!==e.currentTarget){let s=e.target.className,i=e.target;if(""===s&&(i=e.target.parentElement,s=e.target.parentElement.className),s.indexOf("cellpad")>=0)return;if(s.indexOf("group-sel")>=0){let e=n.get(parseInt(i.getAttribute("data-group")));this.clickListener(e);for(var t=0;t<e.length;t++)this.selectElement(e[t])}else if(s.indexOf("cell")>=0){let e=i.innerHTML,t=e.substring(3,e.indexOf("<",3));if("&nbsp;"===t)return;this.clickListener([t])}}}),!0),this.tableZone.addEventListener("mouseover",(e=>{let t=h(e);if(null!==t){this.elementInfo.style.display="block";let e=l.get(o(t));this.elementInfo.style.borderColor=e;let s=i.ELEMENTS.indexOf(t)+1;this.elementInfo.innerHTML=`\n          <div>\n            <div style="float: right; padding: 3px 4px;border-left: 3px solid ${e};\n              border-bottom: 3px solid ${e}" > ${s} </div>\n            <div style="clear: right;"></div>\n          </div>\n          <div class="symbol">${t} </div>\n          <div class="">${r[s-1]}  </div>\n          `}})),this.tableZone.addEventListener("mouseout",(e=>{null!==h(e)&&(this.elementInfo.style.display="none")}))}setClickListener(e){this.clickListener=e}setDeselectListener(e){this.deselectListener=e}selectElement(e){this.element.querySelector('td[data-el="el-'+e+'"]').className="cell el-selected"}deselectElement(e){this.element.querySelector('td[data-el="el-'+e+'"]').className="cell "+o(e)}deselectAllElements(){let e=this.element.querySelectorAll("td.el-selected");for(let t=0;t<e.length;++t){let s=e[t].getAttribute("data-el").substring(3);e[t].className="cell "+o(s)}}}},430:(e,t,s)=>{"use strict";let i=s(212),n=s(223),a=s(423);const l=.2;class r{constructor(e,t,s){this.commonId=t,this.element=document.createElement("div"),this.element.className="filter-quantity-box",this.element.innerHTML=`<div class="field-title">\n        <span info-sys-data="${t}">${e}</span>\n      </div>`,s.forEach((e=>{let s=t||e.id,i=t?s+".value:"+e.value:s,n=document.createElement("div");n.innerHTML=`\n          <input type="checkbox" class="${s}-field" value="${e.value}">\n          <span info-sys-data="${i}">${e.text}</span>\n      `,this.element.append(n)})),this.checkboxes=this.element.querySelectorAll("input")}getValues(){if(this.commonId){let e=[];return this.checkboxes.forEach((t=>{t.checked&&e.push(t.value)})),{fieldId:this.commonId,value:e}}{let e=[];return this.checkboxes.forEach((t=>{if(t.checked){let s=t.className;e.push({fieldId:s.substring(0,s.indexOf("-field")),value:[!0]})}})),e}}highlightSelected(e){this.checkboxes.forEach((t=>{t.checked?t.parentElement.style.opacity="":t.parentElement.style.opacity=e?l:""}))}}class o{constructor(e,t){this.fieldId=t,this.element=document.createElement("div"),this.element.className="filter-quantity-box",this.element.innerHTML=`\n      <div class="field-title"> <span info-sys-data="${t}">${e}</span></div>\n      <input type="text" class="${t}-textfield" style="">\n    `,this.input=this.element.querySelector("input")}getValues(){let e=this.input.value;return""===e.trim()?null:{fieldId:this.fieldId,value:[e]}}highlightSelected(e){null===this.getValues()&&(this.input.style.opacity=e?l:"")}}class d{constructor(e,t){this.fieldId=t,this.element=document.createElement("div"),this.element.className="filter-quantity-box",this.element.innerHTML=`<div class="field-title">\n        <span info-sys-data="${t}">${e}</span>\n      </div>`,this.autocomplete=new a(t,"Search and select options"),this.element.append(this.autocomplete.element);let s=i.serverReq(i.getSuggestionURL(this.fieldId),(e=>{let t=JSON.parse(s.response)[this.fieldId];this.autocomplete.setAutocompleteList(t)}))}getValues(){const e=this.autocomplete.getValues();return 0===e.length?null:{fieldId:this.fieldId,value:e}}highlightSelected(e){null===this.getValues()&&(this.autocomplete.element.style.opacity=e?l:"")}}class h{constructor(e,t,s){this.fieldId=t,this.element=document.createElement("div"),this.element.className="filter-quantity-box",this.element.innerHTML=`\n      <div class="field-title">\n        <span info-sys-data="${t}">${e}</span> \n        <span style="font-weight: normal;">${s?`(${s})`:""}</span>\n      </div>\n      <div style="display: flex; flex-direction: row; align-items: center">\n        <div>\n          <input type="text" placeholder="min" style="width: 100%"/>\n        </div>\n        <div style="padding: 0px 5px">-</div>\n        <div>\n          <input type="text" placeholder="max" style="width: 100%"/>\n        </div>\n      </div>\n    `,this.inputs=this.element.querySelectorAll("input")}getValues(){let e=":";return""!==this.inputs[0].value.trim()&&(e=this.inputs[0].value+e),""!==this.inputs[1].value.trim()&&(e+=this.inputs[1].value),":"===e?null:{fieldId:this.fieldId,value:[e]}}highlightSelected(e){null===this.getValues()&&(this.inputs[0].parentElement.style.opacity=e?l:"")}}e.exports=class{constructor(){this.element=document.createElement("div"),this.element.setAttribute("id","filter-panel-placeholder"),this.fields=[];let e=this.createPropsGroupBox("Structure");this.element.append(e);const t=new r("System type","material_type",[{value:"bulk",text:"Bulk"},{value:"2D",text:"2D"},{value:"1D",text:"1D"}]);this.fields.push(t),e.append(t.element);const s=new r("Crystal system","crystal_system",[{value:"cubic",text:"Cubic"},{value:"hexagonal",text:"Hexagonal"},{value:"trigonal",text:"Trigonal"},{value:"tetragonal",text:"Tetragonal"},{value:"orthorhombic",text:"Orthorhombic"},{value:"monoclinic",text:"Monoclinic"},{value:"triclinic",text:"Triclinic"}]);this.fields.push(s),e.append(s.element);const i=new o("Space group number","space_group_number");this.fields.push(i),e.append(i.element);const a=new d("Structure type","structure_type");this.fields.push(a),e.append(a.element);let l=this.createPropsGroupBox("Properties");this.element.append(l);const c=new h("Band gap","band_gap","eV");this.fields.push(c),l.append(c.element);const u=new r("Results containing...",void 0,[{value:"Band structure",text:"Band structure",id:"has_band_structure"},{value:"DOS",text:"DOS",id:"has_dos"},{value:"Thermal properties",text:"Thermal properties",id:"has_thermal_properties"}]);this.fields.push(u),l.append(u.element);let p=this.createPropsGroupBox("Method");this.element.append(p);const m=new d("Basis set","basis_set");this.fields.push(m),p.append(m.element);const y=new d("Functional type","functional_type");this.fields.push(y),p.append(y.element);const v=new d("Code","code_name");this.fields.push(v),p.append(v.element);const g=document.createElement("div");g.className="filter-quantity-box";const f=document.createElement("div");f.className="perm-tooltip search-option restricted-search-option";const b=document.createElement("input");b.id="restricted-search",b.name="restricted-search",b.type="checkbox";const x=document.createElement("label");x.for="restricted-search",x.className="perm-tooltip",x.textContent="Restrict to individual calculations";const S=document.createElement("span");S.className="tooltiptext",S.textContent="If selected, the query will return materials that have individual calculations simultaneously matching your methodology and properties criteria.",f.append(b),f.append(x),f.append(S),g.append(f),this.element.append(g),n.addToInfoSystem(this.element),this.element.addEventListener("change",(e=>{this.addPropsChangeListener&&this.addPropsChangeListener(this.getValues())}))}createPropsGroupBox(e){const t=document.createElement("div");return t.className="filter-section-box",t.innerHTML='<div class="filter-section-title"><div>'+e+"</div></div>",t}getValues(){let e=new Map;return this.fields.forEach((t=>{const s=t.getValues();Array.isArray(s)&&s.length>0?s.forEach((t=>e.set(t.fieldId,t.value))):s&&s.value&&s.value.length>0&&e.set(s.fieldId,s.value)})),e}setPropsChangeListener(e){this.addPropsChangeListener=e}showSelectedProps(e){this.fields.forEach((t=>{t.highlightSelected(e)}))}}},541:(e,t,s)=>{let i=s(212);e.exports=class{constructor(e){this.formula=e,this.formulaMap=this._parseFormula(e),console.log("this.formulaMap: ",this.formulaMap)}_parseFormula(e){let t,s=0,n=new Map;for(;s<e.length;){let a=e.substring(s,s+2),l=e.substring(s,s+1);if(i.ELEMENTS.indexOf(a)>=0)n.set(a,1),s+=2,t=a;else if(i.ELEMENTS.indexOf(l)>=0)n.set(l,1),s++,t=l;else{let e=parseInt(a);e>=10?s+=2:s++,n.set(t,e)}}return n}getOptimadeSubquery(e){const t=[];return this.formulaMap.forEach(((e,s)=>{const i='"'+s+(1===e?"":+e)+'"';t.push(i)})),"formula HAS "+(e?"ALL ":"ONLY ")+t.join(", ")}getFragments(){const e=[];return this.formulaMap.forEach(((t,s)=>{const i='"'+s+(1===t?"":+t)+'"';e.push(i)})),e}}},926:(e,t,s)=>{"use strict";let i=s(212),n=s(223),a=s(317);class l{constructor(){this.element=document.createElement("div"),this.element.innerHTML='\n      <div class="results-total" >Results</div>\n\n      <div class="pag-header" >\n        <span class="prevButton">\n          <img src="img/prev.svg" style="display: inline;" width="7px"/> &nbsp; prev\n        </span>   &nbsp;&nbsp;\n        <span class="page"> X </span> &nbsp;&nbsp;\n        <span class="nextButton"> next &nbsp;\n          <img src="img/next.svg" width="7px" />\n        </span>\n      </div>\n    ',this.titleBox=this.element.querySelector(".results-total"),this.prevButton=this.element.querySelector(".prevButton"),this.pageElement=this.element.querySelector(".page"),this.nextButton=this.element.querySelector(".nextButton"),this.prevButton.addEventListener("click",(e=>{1!==this.pagesData.page&&this.prevPageListener(this.pagesData.page-1)})),this.nextButton.addEventListener("click",(e=>{this.pagesData.page!==this.pagesData.pages&&this.nextPageListener(this.pagesData.page+1)})),this.pagesData}set(e){this.pagesData=e,this.titleBox.innerHTML="Results (total: "+e.total+")",this.pageElement.innerHTML="page "+e.page+" / "+e.pages}setPrevPageListener(e){this.prevPageListener=e}setNextPageListener(e){this.nextPageListener=e}}class r{constructor(){this.element=document.createElement("div"),this.element.className="mat-list-container",this.element.innerHTML='\n      <table>\n          <thead> <tr>\n            <th style="width: 24%;"></th>\n            <th style="width: 16%;">\n              <span info-sys-data="space-group">Space group</span>\n            </th>\n            <th style="width: 20%;">\n              <span >Space gr. int. symbol</span>\n            </th>\n\n            <th style="width: 22%;">\n              <span info-sys-data="structure-type">Structure type</span>\n            </th>\n            <th style="width: 18%;">Nº calculations</th>\n          </tr> </thead>\n\n          <tbody> </tbody> \n      </table>\n    ',this.tbody=this.element.querySelector("tbody"),this.tbody.addEventListener("click",(e=>{let t=event.target.closest("tr.mat-row");t&&i.setBrowserHashPath("material",t.getAttribute("data-mat-id")),e.stopPropagation()}))}updateList(e){if(0===e.size)return void(this.tbody.innerHTML="");let t="";e.forEach(((e,s)=>{let n=i.getSubscriptedFormula(s);t+='<tr> <td class="formula" colspan="5"><b>'+n+"</b>",e.length>1&&(t+='<span style="font-size: 0.86em;"> ('+e.length+" structures)</span>"),t+="</td></tr>",e.forEach((e=>{let s=e.material_name?e.material_name:n;t+=`<tr class="mat-row" data-mat-id="${e.material_id}">\n            <td  > ${s} [${e.formula}] </td>\n            <td style="text-align:center" >\n              ${e.space_group_number?e.space_group_number:""}\n            </td>\n            <td>\n              ${e.space_group_international_short_symbol?e.space_group_international_short_symbol:""}\n            </td>\n            <td> ${e.structure_type?e.structure_type:""} </td>\n            <td style="text-align:center" > ${e.n_calculations?e.n_calculations:""} </td>\n          </tr>`}))})),this.tbody.innerHTML=t,n.addToInfoSystem(this.element)}}e.exports=class{constructor(){this.element=document.createElement("div"),this.element.className="MaterialList",this.visible=!1,this.noResults=!0,this.matMap=new Map,this.optimadeQuery=null,this.newestQuery=null,this.noResultsBox=document.createElement("div"),this.noResultsBox.style="text-align: center; font-weight: bold",this.noResultsBox.innerHTML="NO RESULTS FOUND",this.element.append(this.noResultsBox),this.matListWrapper=document.createElement("div"),this.element.append(this.matListWrapper),this.pagControl=new l,this.matListWrapper.append(this.pagControl.element),this.pagControl.setPrevPageListener((e=>{this._search(e)})),this.pagControl.setNextPageListener((e=>{this._search(e)})),this.matListContainer=new r,this.matListWrapper.append(this.matListContainer.element)}attachAndSetEvents(e){e.appendChild(this.element),this._render()}invalidateSearch(){this.visible=!1,this._render()}initSearch(e){this.optimadeQuery=e,this._search()}_search(e){this.matMap.clear(),a.show("searching");let t={query:this.optimadeQuery,search_by:{}};e&&(t.search_by={page:e});let s=document.getElementById("restricted-search");t.search_by.restricted=s.checked?"1":"0";const n=Date.now();this.newestQuery=n,document.querySelector("#syntax-error").style.visibility="hidden";let l={"Content-Type":"application/json;charset=utf-8"},r=window.keycloak;r.authenticated&&(l.Authorization="Bearer "+r.token),fetch(i.getSearchURL(),{method:"POST",headers:l,body:JSON.stringify(t)}).then((e=>e.json())).then((e=>{this.newestQuery===n&&(this.noResults=0===e.results.length,this._setMatList(e.results),this.pagControl.set(e.pages),this.visible=!0,this._render())})).catch((e=>{console.log("Error"),document.querySelector("#syntax-error").style.visibility="visible"})).finally((()=>{a.hide("searching")}))}_render(){this.element.style.display=this.visible?"":"none",this.visible&&(this.noResultsBox.style.display=this.noResults?"":"none",this.matListWrapper.style.display=this.noResults?"none":"",this.matListContainer.updateList(this.matMap))}_setMatList(e){e.length>0?e.forEach((e=>{this.matMap.has(e.formula_reduced)?this.matMap.get(e.formula_reduced).push(e):this.matMap.set(e.formula_reduced,[e])})):this.matMap.clear()}}},226:(e,t,s)=>{"use strict";let i=s(212),n=(s(882),s(23)),a=s(191),l=s(926),r=s(430),o=s(951);class d{constructor(e){this.element=document.createElement("div"),this.element.className="TextBox";const t=document.createElement("div");t.style.display="flex",t.style.flexDirection="column";const s=document.createElement("div");s.style.display="flex",s.style.flexDirection="row",this.textField=document.createElement("input"),this.textField.type="text",this.textField.placeholder=e,s.append(this.textField),this.button=document.createElement("button"),this.button.className="adding-btn",this.button.disabled=!0,this.button.textContent="Add to query",s.append(this.button),t.append(s),this.element.append(t),this.button.addEventListener("click",(e=>{this.addListener(this.textField.value),this.textField.value=""})),this.textField.addEventListener("keypress",(e=>{13==e.keyCode&&(this.addListener(this.textField.value),this.textField.value="")})),this.textField.addEventListener("input",(e=>{this.button.disabled=""===this.textField.value}))}setAddListener(e){this.addListener=e}disableInput(){this.textField.disabled=!0,this.button.disabled=!0}enableInput(){this.textField.disabled=!1,this.button.disabled=!1}}class h extends d{constructor(e){super(e);const t=document.createElement("div");t.className="perm-tooltip search-option",t.style.marginRight="10px";const s=document.createElement("input");s.id="allow-other-elements",s.name="allow-other-elements",s.type="checkbox",s.checked=!0,t.append(s);const i=document.createElement("label");i.for="allow-other-elements",i.className="perm-tooltip",i.textContent="Allow other elements",t.append(i);const n=document.createElement("span");n.className="tooltiptext",n.textContent="If selected, the returned materials may also contain other elements.",t.append(n),this.element.children[0].append(t)}}e.exports=class{constructor(){this.userGuidance=!0,this.searchFilters=[],this.isVisible=!0,this.element=document.createElement("div"),this.element.setAttribute("id","search-module"),this.element.innerHTML='\n      <div class="search-filter-side">\n      </div>\n      <div class="search-main-side">\n        <div class="composition">\n          <div class="search-box-placeholder" > </div>\n          <div class="add-buttons" >\n            <div class="tab-buttons" style="width: 70%; display: inline-block">\n              <button class="element-add-btn" id="add-tab-selected">Element<img class="search-fold-icon" src="img/unfolded.png"></button><button class="formula-add-btn">Formula<img class="search-fold-icon" src="img/unfolded.png"></button><button class="name-add-btn">Name<img class="search-fold-icon" src="img/unfolded.png"></button>\n            </div>\n            <div class="bool-buttons" style="width: 28%; display: inline-block" >\n              OR <span id="and-or-switch" ></span> AND\n              <button class="not-button">NOT</button>\n              <button class="open-parentheses" >(</button>\n              <button class="close-parentheses">)</button>\n            </div>\n          </div>\n        </div>\n        <div class="add-box">\n          <div class="add-panel">\n          </div>\n        </div>\n        <div class="results-panel">\n        </div>\n      </div>\n    ',this.filterSidePanel=this.element.querySelector(".search-filter-side"),this.addBox=this.element.querySelector(".add-box"),this.searchBox=new n,this.searchBox.setBoolOperator("AND"),this.element.querySelector(".search-box-placeholder").append(this.searchBox.element),this.searchBox.setRemoveElementListener((e=>{this.elementTable.deselectElement(e)})),this.searchBox.setCleanSearchQueryListener((()=>{this.addFormulaButton.disabled=!1,this.addMatNameButton.disabled=!1,this.addElementButton.disabled=!1,this.formulaBox.enableInput(),this.materialNameBox.enableInput(),this.elementTable.deselectAllElements()})),this.searchBox.setSearchQueryChangeListener((()=>{})),this.searchButton=this.searchBox.getSearchButtonElement(),this.searchButton.addEventListener("click",(e=>{this.sendQuery(),this.addBox.style.display="none",this.isVisible=!1,this.currentTabElement.querySelector(".search-fold-icon").src="img/folded.png"})),this.addButtonsBox=this.element.querySelector(".add-buttons"),this.addElementButton=this.addButtonsBox.querySelector(".element-add-btn"),this.addFormulaButton=this.addButtonsBox.querySelector(".formula-add-btn"),this.addMatNameButton=this.addButtonsBox.querySelector(".name-add-btn"),this.currentTabElement=this.addElementButton,this.currentTab="element",this.addPanel=this.element.querySelector(".add-panel");let e=new o(i.IMAGE_DIR+"switch_new");this.element.querySelector("#and-or-switch").appendChild(e.element),e.setListener((e=>{this.searchBox.setBoolOperator(e?"AND":"OR")})),this.notButton=this.element.querySelector(".not-button"),this.notButton.addEventListener("click",(e=>{this.searchBox.addNOT()})),this.openParenthButton=this.element.querySelector(".open-parentheses"),this.closeParenthButton=this.element.querySelector(".close-parentheses"),this.openParenthButton.addEventListener("click",(e=>{this.searchBox.addParentheses(!0)})),this.closeParenthButton.addEventListener("click",(e=>{this.searchBox.addParentheses(!1)})),this.elementTable=new a,this.elementTable.setClickListener((e=>{this.searchBox.addElements(e),this.addMatNameButton.disabled=!0,this.addFormulaButton.disabled=!0})),this.elementTable.setDeselectListener((e=>{this.searchBox.removeElementORFormulaInSearchQuery(e)})),this.formulaBox=new h("Add formula to the search query above"),this.formulaBox.setAddListener((e=>{""!==e.trim()&&(this.searchBox.addTag(e,"formula"),this.addElementButton.disabled=!0,this.addMatNameButton.disabled=!0)})),this.materialNameBox=new d("Add material name to the search query above"),this.materialNameBox.setAddListener((e=>{""!==e.trim()&&(this.searchBox.addTag(e,"material"),this.addElementButton.disabled=!0,this.addFormulaButton.disabled=!0)})),this.filterPanel=new r,this.filterSidePanel.appendChild(this.filterPanel.element),this.filterPanel.setPropsChangeListener((e=>{this.sendQuery()})),this.materialList=new l,this.resultsPage=this.element.querySelector(".results-panel"),this.materialList.attachAndSetEvents(this.resultsPage),this.addPanel.appendChild(this.elementTable.element),this.allowOtherElementsCheckbox=this.element.querySelector("#allow-other-elements"),this.allowOtherElementsCheckbox.addEventListener("change",(e=>{})),this._events()}_events(){this.addButtonsBox.addEventListener("click",(e=>{if(e.target!==e.currentTarget){let t=e.target.className,s=t.indexOf("add-btn");if(s>0){let i,n=t.substring(0,s-1);"element"===n?i=this.elementTable.element:"name"===n?i=this.materialNameBox.element:"formula"===n&&(i=this.formulaBox.element),this.addPanel.replaceChild(i,this.addPanel.lastChild);const a=e.target.querySelector(".search-fold-icon");this.currentTab==n?(this.isVisible?(this.addBox.style.display="none",a.src="img/folded.png"):(this.addBox.style.display="block",a.src="img/unfolded.png"),this.isVisible=!this.isVisible):(this.addBox.style.display="block",a.src="img/unfolded.png",this.isVisible=!0);let l=this.element.querySelector("."+this.currentTab+"-add-btn");this._setTabSelectedStyles(l,!1),this._setTabSelectedStyles(e.target,!0),this.currentTab=n,this.currentTabElement=l}}}))}sendQuery(){const e=document.getElementById("allow-other-elements");let t=!0;e&&(t=e.checked);const s=this.searchBox.getOptimadeQuery(t),i=function(e){let t="";return e.forEach(((e,s)=>{if("band_gap"===s){const[s,i]=e[0].split(":");""!==s&&(t+=(""===t?"":" AND ")+`(band_gap >= ${s})`),""!==i&&(t+=(""===t?"":" AND ")+`(band_gap <= ${i})`)}else{let i="";e.forEach((e=>{i+=(""===i?"":" OR ")+s+"="+(!0===e?"TRUE":'"'+e+'"')})),t+=(""===t?"":" AND ")+`(${i})`}})),t}(this.filterPanel.getValues()),n=""!==s&&""!==i?" AND ":"";this.materialList.initSearch(s+n+i)}_addFiltersInSearchQuery(e,t){let s={bool:{}};return s.bool.must=[],s.bool.must.push(t),e.forEach(((e,t)=>{let i=t.split("-").join("_");"mass-density"===t||"band-gap"===t?s.bool.must.push(this._getFieldESRange(i,e)):"band-gap-type"===t?"both"!==e&&s.bool.must.push(this._getESSimpleMatch("band_gap_direct","direct"===e)):t.startsWith("has")?s.bool.must.push(this._getESSimpleMatch(i,e,!1)):s.bool.must.push(this._getESTermsArray(i,e))})),s}_setTabSelectedStyles(e,t){e.id=t?"add-tab-selected":""}_sortElements(e){let t=[],s=[];return e.forEach((e=>t.push(i.ELEMENTS.indexOf(e)))),t.sort(((e,t)=>e-t)),t.forEach((e=>s.push(i.ELEMENTS[e]))),s}_reduceFormula(e,t=!0){let s,n=0,a=new Map;for(;n<e.length;){let t=e.substring(n,n+2),l=e.substring(n,n+1);if(i.ELEMENTS.indexOf(t)>=0)a.set(t,1),n+=2,s=t;else if(i.ELEMENTS.indexOf(l)>=0)a.set(l,1),n++,s=l;else{let e=parseInt(t);e>=10?n+=2:n++,a.set(s,e)}}let l=0;for(;!r(a);){let e=1;if(o(a,2)?e=2:o(a,3)?e=3:o(a,5)?e=5:o(a,7)?e=7:o(a,11)&&(e=11),a.forEach(((t,s)=>{a.set(s,t/e)})),l++,l>5)break}function r(e){let t=100;return e.forEach(((e,s)=>{e<t&&(t=e)})),1===t}function o(e,t){let s=!0;return e.forEach(((e,i)=>{e%t!=0&&(s=!1)})),s}let d=[],h="";return t?a.forEach(((e,t)=>d.push(t+e))):this._sortElements(Array.from(a.keys())).forEach((e=>{h+=e+a.get(e)})),console.log("_reduceFormula RETURN: ",a,d,h),t?d:h}_processFormula(e,t){let s,n=0,a=new Map;for(;n<e.length;){let t=e.substring(n,n+2),l=e.substring(n,n+1);if(i.ELEMENTS.indexOf(t)>=0)a.set(t,1),n+=2,s=t;else if(i.ELEMENTS.indexOf(l)>=0)a.set(l,1),n++,s=l;else{let e=parseInt(t);e>=10?n+=2:n++,a.set(s,e)}}if("tokens"===t){let e=[];return a.forEach(((t,s)=>e.push(s+t))),console.log("_processFormula RETURN: ",a,e),e}{let e=this._sortElements(Array.from(a.keys()));if("canonical-formula"===t){let t="";return e.forEach((e=>{t+=e+a.get(e)})),console.log("_processFormula RETURN: ",a,t),t}{let t="",s=[];return e.forEach((e=>{t+=e;let i=a.get(e);0!==i&&s.push(e+i)})),console.log("_processFormula RETURN: ",a,[s,t]),[s,t]}}}}},305:(e,t,s)=>{let i=s(541);e.exports=class{constructor(){}translate(e,t,s){let n=[...e],a=[...t];for(let e=0;e<n.length;++e){let t=n[e],s=a[e];"E"!==s&&"MN"!==s||(n[e]=`"${t}"`)}for(let e=0;e<n.length;++e){let t=n[e];if("F"===a[e]){const s=new i(t),a=[];s.formulaMap.forEach(((e,t)=>{const s='"'+t+(1===e?"":+e)+'"';a.push(s)})),n[e]=a.join(", ")}}[n,a]=this.simplify(n,a);for(let e=0;e<n.length;++e){let t=n[e],i=a[e];"E"===i?t=s?"elements HAS ALL "+t:"elements HAS ONLY "+t:"F"===i?t=s?"formula HAS ALL "+t:"formula HAS ONLY "+t:"MN"===i&&(t="material_name = "+t),n[e]=t}let l="("+n.join(" ")+")";return console.log("FINAL OPTIMADE QUERY:"),console.log(l),l}combineANDIn(e,t){const s=[],i=[];for(let n=0;n<e.length;){const a=e[n-1],l=(t[n-1],e[n]),r=t[n],o=e[n+1],d=(t[n+1],e[n+2]),h=t[n+2];if(("E"===r&&"E"===h||"F"===r&&"F"===h)&&"AND"===o&&"NOT"!==a){let a=!0,r=h,o=[l,d];for(n+=3;a;){const l=e[n],d=(t[n],e[n+1]),h=t[n+1];"AND"===l&&h===r?(o.push(d),n+=2):(a=!1,s.push(o.join(", ")),i.push(r))}}else s.push(l),i.push(r),n+=1}return[s,i]}findPairs(e,t){const s=new Map;for(let i=0;i<e.length;++i){const n=e[i];if(t[i],"("===n){let n=0;for(let a=i+1;a<e.length;++a){const l=e[a];if(t[a],"("===l&&(n+=1),")"===l){if(0==n){s.set(i,a),s.set(a,i);break}n-=1}}}}return s}removeParenthesis(e,t){const s=this.findPairs(e,t);let i=[];for(let n=0;n<e.length;++n){const a=e[n];if(t[n],"("===a){let a=s.get(n);if(0===n&&a==e.length-1)i.push(a),i.push(n);else{e.slice(n+1,a);const s=t.slice(n+1,a);let l=!0;for(let e of s)if("S"===e){l=!1;break}l&&(i.push(a),i.push(n))}}}for(let n=0;n<e.length;++n){const a=e[n];if(t[n],e[n+1],t[n+1],"("===a&&"("===a){let e=s.get(n);s.get(n+1)==e-1&&(i.push(n),i.push(e))}}i=i.sort(((e,t)=>t-e));for(let s=0;s<i.length;++s)e.splice(i[s],1),t.splice(i[s],1);return[e,t]}combineANDOut(e,t){let s=e,i=t;const n=this.findPairs(e,t);let a=!1;for(let l=0;l<e.length;++l){const r=e[l],o=(t[l],e[l+1]),d=(t[l+1],e[l+2]);if(t[l+2],"AND"===o&&(")"===r||"("===d)){let o,h,c,u,p,m;a=!0,")"===r?(m=n.get(l),o=e.slice(m,l+1),h=t.slice(m,l+1)):(m="NOT"===e[l-1]?l-1:l,o=e.slice(m,l+1),h=t.slice(m,l+1),o.unshift("("),h.unshift("P"),o.push(")"),h.push("P")),"("===d?(p=n.get(l+2)+1,c=e.slice(l+2,p),u=t.slice(l+2,p)):(p="NOT"===e[l+2]?l+4:l+3,c=e.slice(l+2,p),u=t.slice(l+2,p),c.unshift("("),u.unshift("P"),c.push(")"),u.push("P"));const y=[];let v=1;for(let e=1;e<c.length-1;++e)"OR"===c[e]?(y.push([c.slice(v,e),u.slice(v,e)]),v=e+1):e===c.length-2&&y.push([c.slice(v,e+1),u.slice(v,e+1)]);let g=[],f=[];for(let e=0;e<y.length;++e){let t=[],s=[];t=t.concat(y[e][0]),s=s.concat(y[e][1]),t.push("AND"),s.push("S"),t=t.concat(o),s=s.concat(h),0===e?(y.length>1&&(g.push("("),f.push("P")),g=g.concat(t),f=f.concat(s),y.length>1&&(g.push(")"),f.push("P"))):(g.push("OR"),f.push("S"),g.push("("),f.push("P"),g=g.concat(t),f=f.concat(s),g.push(")"),f.push("P"))}g.unshift("("),f.unshift("P"),g.push(")"),f.push("P"),s=e.slice(0,m).concat(g).concat(e.slice(p,e.length)),i=t.slice(0,m).concat(f).concat(t.slice(p,e.length));break}}return[s,i,a]}simplify(e,t){let s;return[e,t]=this.removeParenthesis(e,t),[e,t]=this.combineANDIn(e,t),[e,t]=this.removeParenthesis(e,t),[e,t,s]=this.combineANDOut(e,t),s?[e,t]=this.simplify(e,t):([e,t]=this.removeParenthesis(e,t),[e,t]=this.combineANDIn(e,t),[e,t]=this.removeParenthesis(e,t)),[e,t]}}},23:(e,t,s)=>{"use strict";let i=s(212),n=s(305);s(541),e.exports=class{constructor(){this.currentConnector,this.notItem,this.inSubquery,this.rootQuery,this._resetState(),this.element=document.createElement("div"),this.element.className="search-box",this.element.innerHTML=' \n      <div id="composition-title" class="filter-section-title" style>\n        <div>Composition</div>\n      </div>\n      <div class="search-query-wrapper" >\n        <div id="syntax-error">\n          <div>Invalid query syntax</div>\n        </div>\n        <div class="search-query-box" style="float: left;"></div>\n        <button class="clean-btn" style="float: right;">Clear</button>\n      </div>\n      \x3c!-- this button should be out of the search box because its functionality\n           is not part of the search box, it\'s general for the search module\n           and it\'s probably being removed eventually --\x3e \n      <button class="search-btn" >Search</button>\n    ',this.cleanButton=this.element.querySelector(".clean-btn"),this.cleanButton.addEventListener("click",(e=>{this._resetState(),this.renderQuery(),this.cleanSearchQueryListener()})),this.searchQueryBox=this.element.querySelector(".search-query-box"),this.searchQueryBox.addEventListener("click",(e=>{if("remove-label"===e.target.className){let t=e.target.parentElement.getAttribute("data-el");this.removeElementORFormulaInSearchQuery(t)}}))}_resetState(){this.notItem=!1,this.inSubquery=!1,this.rootQuery={type:"query",value:[],not:!1}}getOldQueryFormat(){const e=[];this.rootQuery.value.forEach((t=>{e.push(...i(t))}));const t=[],s=[];return e.forEach((e=>{t.push(e.split(":")[0]),s.push(e.split(":")[1])})),console.log("OLD F:",e,t,s),[t,s];function i(e){const t=[];if(e.not&&t.push("NOT:S"),"query"===e.type)t.push("(:S"),e.value.forEach((e=>{t.push(...i(e))})),t.push("):S");else{let s=e.value+":";"element"===e.type?s+="E":"formula"===e.type?s+="F":"material"===e.type?s+="MN":s+="S",t.push(s)}return t}}getOptimadeQuery(e){if(0===this.rootQuery.value.length)return"";const t=new n,[s,i]=this.getOldQueryFormat();return t.translate(s,i,e)}setBoolOperator(e){this.currentConnector=e}renderQuery(){function e(e){return`<span class="search-query-symbol">${e}</span>`}document.querySelector("#syntax-error").style.visibility="hidden",this.searchQueryBox.innerHTML=function t(s){if("connector"===s.type)return e(s.value);if(!s.type&&s.not)return e(" NOT");if("element"===s.type||"formula"===s.type||"material"===s.type)return(s.not?e(" NOT"):"")+`<span class="search-label" data-el="${n=s.value}" >\n          ${"formula"===s.type?i.getSubscriptedFormula(n):n}\n          <img src="img/cross.svg" height="6px" class="remove-label"\n            style="vertical-align: middle; padding: 4px 3px 6px 5px;" />\n          </span>`;{let i="";s.value.forEach((e=>{i+=t(e)}));const n=s.not?e(" NOT"):"",a=s.open;return n+(void 0===a?i:e(" (")+i+(a?"":e(") ")))}var n}(this.rootQuery),this.searchQueryChangeListener&&this.searchQueryChangeListener()}_addItem(e){const t=this.rootQuery.value,s=this.inSubquery?t[t.length-1].value:t;if(s.length>0&&"connector"!==s[s.length-1].type&&s.push({type:"connector",value:this.currentConnector}),"NOT"===e)s.push({not:!0});else if("SUBQUERY"===e)t.push({type:"query",value:[],open:!0,not:!1});else{const[t,i]=e.split(":");s.push({type:t,value:i,not:!1})}console.log("ROOT QUERY ",this.rootQuery),this.renderQuery()}addTag(e,t){if(this.notItem){const s=this.rootQuery.value,i=this.inSubquery?s[s.length-1].value:s;i[i.length-1].type=t,i[i.length-1].value=e,this.notItem=!1,this.renderQuery()}else this._addItem(t+":"+e)}addElements(e){let t=e.length;for(;t--;)this.addTag(e[t],"element");return!0}addParentheses(e){const t=this.rootQuery.value;e&&(this.notItem?(t[t.length-1].type="query",t[t.length-1].value=[],this.notItem=!1):this._addItem("SUBQUERY")),t[t.length-1].open=e,this.renderQuery(),this.inSubquery=e}addNOT(){this._addItem("NOT"),this.notItem=!0}removeElementORFormulaInSearchQuery(e){return function e(t,s){const i=t.value;for(let t=0;t<i.length;t++){if(i[t].value===s){i[t+1]&&"connector"===i[t+1].type?i.splice(t,2):i.splice(t,1);break}"query"===i[t].type&&(e(i[t],s),0==i[t].value.length&&(i[t+1]&&"connector"===i[t+1].type?i.splice(t,2):i.splice(t,1)))}}(this.rootQuery,e),this.renderQuery(),console.log("ROOT QUERY REMOVING ",this.rootQuery),i.ELEMENTS.indexOf(e)>=0&&this.removeElementListener(e),0===this.rootQuery.value.length&&this.cleanSearchQueryListener(),!0}setCleanSearchQueryListener(e){this.cleanSearchQueryListener=e}setRemoveElementListener(e){this.removeElementListener=e}setSearchQueryChangeListener(e){this.searchQueryChangeListener=e}getSearchButtonElement(){return this.element.querySelector(".search-btn")}}}},t={};function s(i){var n=t[i];if(void 0!==n)return n.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,s),a.exports}(()=>{"use strict";let e=s(212),t=(s(317),s(462)),i=s(292),n=s(794),a=s(95),l=s(226),r=s(882),o=s(719),d=document.getElementById("content"),h=document.querySelector("title");var c=window.location,u=c.protocol+"//"+c.host+"/"+c.pathname;i.subscribe("authenticated",(e=>{let t=document.location.hash.substring(2);t.lastIndexOf("/")===t.length-1&&(t=t.substring(0,t.length-1)),t.indexOf("/")>0&&"material"===t.split("/")[0]&&(g.style.visibility="visible")}));var p=new Keycloak({url:window.nomadEnv.keycloakBase,realm:window.nomadEnv.keycloakRealm,clientId:window.nomadEnv.keycloakClientId});window.keycloak=p,window.keycloak.onAuthLogout=function(){alert("logout")},window.keycloak.onTokenExpired=function(){alert("expired")};let m=document.querySelector("#login-button"),y=document.querySelector("#logout-button"),v=document.querySelector("#user-name");p.init({onLoad:"check-sso",checkLoginIframe:!1,silentCheckSsoRedirectUri:`${u}silent-check-sso.html`,promiseType:"native"}).then((e=>{e?p.loadUserProfile().then((function(e){v.textContent=`${e.firstName} ${e.lastName}`,m.style.display="none",y.style.display="inline",i.publish("authenticated")})).catch((function(){console.log("Failed to load user profile.")})):(m.style.display="inline",y.style.display="none",v.textContent="Guest"),i.publish("keycloak")})),m.onclick=()=>{p.login({redirectUri:`${u}#/search`}).catch((()=>{console.log("Authentication error.")}))},y.onclick=()=>{p.logout()};let g=document.getElementById("calc-flagging-tab");g.style.top=window.innerHeight/2+"px",g.addEventListener("click",(e=>{t.show(b.getCurrentPageStatus())}));let f,b,x,S,w=new class{constructor(){this.element=document.querySelector("#breadcrumb-placeholder"),this.element.innerHTML='\n      <span class="goto-page Search">Search</span>\n      <span class="goto-page Results">&nbsp; > &nbsp; <span>Results</span></span>\n      <span class="goto-page Overview">&nbsp; > &nbsp; <span>Overview</span></span>\n      <span class="Details">\n        &nbsp; > &nbsp;\n        <select class="details-dropdown" >\n          <option value="structure">Structure</option>\n          <option value="electronicstruct">Electronic structure</option>\n          <option value="methodology">Methodology</option>\n          <option value="thermalprops">Thermal Properties</option>\n          \x3c!-- elasticconst--\x3e\n        </select>\n      </span>\n    ',this.resultsSel=this.element.querySelector(".Results"),this.overviewSel=this.element.querySelector(".Overview"),this.detailsSel=this.element.querySelector(".Details"),this.detailsDropDown=this.element.querySelector(".details-dropdown"),this.element.querySelector(".Search").addEventListener("click",(t=>{e.setBrowserHashPath("search")})),this.resultsSel.addEventListener("click",(t=>{e.setBrowserHashPath("search/results")})),this.overviewSel.addEventListener("click",(()=>{e.setBrowserHashPath("material",e.materialId)})),this.detailsDropDown.addEventListener("change",(t=>{e.setBrowserHashPath("material",o.getMaterialData().material_id+"/"+t.target.value)}));let t=this;this.detailsDropDown.addEventListener("focus",(function e(){let s=t.detailsDropDown.querySelector('option[value="electronicstruct"]');o.hasElecStructureData()||t.detailsDropDown.removeChild(s);let i=t.detailsDropDown.querySelector('option[value="thermalprops"]');o.hasThermalData()||t.detailsDropDown.removeChild(i),t.detailsDropDown.removeEventListener("focus",e)}))}setState(t,s){this.resultsSel.querySelector("span").style.fontWeight="normal";let i=this.overviewSel.querySelector("span");i.style.fontWeight="normal","search"===t?(this.overviewSel.style.display="none",this.detailsSel.style.display="none","results"===s?(this.resultsSel.style.display="inline",this.resultsSel.querySelector("span").style.fontWeight="bold",this.element.style.visibility="visible"):this.element.style.visibility="hidden"):"material"===t&&(this.element.style.visibility="visible",this.resultsSel.style.display=e.searchResults?"inline":"none",this.overviewSel.style.display="inline",void 0===s?(this.detailsSel.style.display="none",i.style.fontWeight="bold"):(this.detailsSel.style.display="inline",this.detailsDropDown.value=s))}},_=!1;function E(e){S&&d.removeChild(S),S=e,d.appendChild(S)}i.subscribe("show-material",(e=>{w.setState("material",e.view),void 0===x&&(b=new a,x=b.element),E(x),b.setMaterialView(e),r.show(!1),p.authenticated&&(g.style.visibility="visible")})),i.subscribe("show-search",(e=>{g.style.visibility="hidden",h.innerHTML="NOMAD Encyclopedia - Search",w.setState("search",e),E(f.element),_=!0})),i.subscribe("keycloak",(e=>{_&&f.sendQuery()})),n.add("search",(e=>i.publish("show-search",e))),n.add("material",((e,t)=>i.publish("show-material",{material_id:e,view:t}))),document.querySelector("#text-logo").onclick=()=>{e.setBrowserHashPath("search")},f=new l,""===document.location.hash&&(document.location+="#/search"),n.route(),document.querySelector("#user-name");let L=function(e){let t=("; "+document.cookie).split("; user_info=");if(2===t.length)return t.pop().split(";").shift()}();if(void 0!==L){let e=JSON.parse((C=L).substring(1,C.length-1).replace(/\\054/g,",").replace(/\\/g,""));setAppAuthenticated(e)}var C})()})();
\ No newline at end of file
diff --git a/client/src/material-mod/MaterialMod.js b/client/src/material-mod/MaterialMod.js
index f1ae71ab..30b1028a 100644
--- a/client/src/material-mod/MaterialMod.js
+++ b/client/src/material-mod/MaterialMod.js
@@ -367,31 +367,11 @@ class StructureViewerWrapper {
     // Determine the periodic indices
     let nPeriodic = 0;
     let periodicIndices = [];
-    let p1 = periodicity[0];
-    let p2 = periodicity[1];
-    let p3 = periodicity[2];
-
-    if (p1 && p2 && p3) {
-        nPeriodic = 3;
-    } else if (!p1 && !p2 && !p3) {
-        nPeriodic = 0;
-    } else {
-        for (let dim = 0; dim < 3; ++dim) {
-            let p1 = periodicity[dim];
-            let p2 = periodicity[(dim+1) % 3];
-            let p3 = periodicity[(dim+2) % 3];
-            if (p1 && !p2 && !p3) {
-                nPeriodic = 1;
-                periodicIndices.push(dim)
-                break;
-            }
-            else if (p1 && p2 && !p3) {
-                nPeriodic = 2;
-                periodicIndices.push(dim);
-                periodicIndices.push((dim+1) % 3);
-                break;
-            }
-        }
+    for (let i = 0; i < 3; ++i) {
+      if (periodicity[i]) {
+        periodicIndices.push(i)
+        ++nPeriodic
+      }
     }
 
     /**
@@ -407,7 +387,6 @@ class StructureViewerWrapper {
         return multiplier
     }
 
-
     // 2D:
     if (nPeriodic == 2) {
       let dim1 = periodicIndices[0]
-- 
GitLab