"use strict";'serviceWorker'innavigator&&(console.log("Registering service worker"),navigator.serviceWorker.register('/sw.js'));classCsvxmlValidator{fieldList;toValidate;errors;constructor(c,d){this.errors={parsing:[],mandatoryTags:[],duplicateInvNos:[],dependentColumns:[],controlledLists:[],mainImageResource:[]},this.fieldList=Object.freeze(c);consta=Papa.parse(d.trim(),{delimiter:";",escapeChar:'"',skipEmptyLines:!0,header:!0});if(a.errors.length!==0){console.log("Errors encountered: "),console.error(a.errors);letb='';for(letcofa.errors)b+=c.type+': '+c.message+"\n";window.alert(b)}letb=a.data;this.toValidate=b,b.length===0&&alert("Error: No lines of content identified"),this.validate()}validate(){this.validateMandatoryTagsPresent(),this.validateInvalidTagsPresent(),this.checkDuplicateInvNos(),this.checkDependentColumns(),this.checkControlledLists()}validateMandatoryTagsPresent(){leta=[];for(letbinthis.fieldList)this.fieldList[b].required===!0&&a.push(b);console.log(this.toValidate);letb=1;for(letcofthis.toValidate){for(letdofa)(c[d]===void0||c[d]===null||c[d]==='')&&this.errors.mandatoryTags.push("Missing or empty mandatory tag "+d+" on line "+b);b++}}validateInvalidTagsPresent(){consta=Object.keys(this.toValidate[0]);for(letbofa)this.fieldList[b]===void0&&this.errors.parsing.push('Invalid column "'+b+'" detected! Please remove this column or use the appropriate name!')}checkDuplicateInvNos(){leta=[],b=1;for(letcofthis.toValidate)a.includes(c.inventory_number)&&this.errors.duplicateInvNos.push("Duplicate inventory number "+c.inventory_number+" on line "+b),a.push(c.inventory_number),b++}checkDependentColumns(){consta=Object.keys(this.toValidate[0]);for(letbofa){if(this.fieldList[b]===void0||this.fieldList[b].dependsOn===void0||this.fieldList[b].dependsOn===null)continue;letc=this.fieldList[b].dependsOn;for(letdofc)a.includes(d)===!1&&(console.error("Dependency issue at column "+b+": Corresponding column "+d+" is missing"),console.log(a),this.errors.dependentColumns.push("Dependency issue at column "+b+": Corresponding column "+d+" is missing"))}letb=1;for(letaofthis.toValidate){for(letcina){if(a[c]==='')continue;if(this.fieldList[c]===void0)continue;constd=this.fieldList[c].dependsOn;if(d===void0)continue;for(leteofd)a[e]===''&&(console.error("Dependency issue at column "+c+": Corresponding column "+e+" is missing [on line "+b+"]"),console.log(a),this.errors.dependentColumns.push("Dependency issue at column "+c+" (current value: "+a[c]+"): Corresponding column "+e+" is empty [on line "+b+"]"))}b++}}checkControlledLists(){leta=1;for(letbofthis.toValidate){for(letcinb){if(this.fieldList[c]===void0){console.log("Undefined but requested field "+c);continue}constd=this.fieldList[c].allowedValues;if(d===void0||d===null)continue;if(Object.values(d).length===0||Object.values(d).includes(b[c]))continue;if(b[c]==='')continue;this.errors.controlledLists.push("Disallowed value used for column "+c+" at line "+a+" (Allowed values are: "+Object.values(d).join(", ")+"; current value is "+b[c]+")")}a++}}checkMainImageResource(){}isValid(){for(letainthis.errors)if(this.errors[a].length!==0)return!1;return!0}generateXml(){leta=[],b=document.implementation.createDocument(null,"record");for(letcofthis.toValidate){letd=b.createElement("record");for(letainc){conste=b.createElement(a);e.textContent=c[a],d.appendChild(e)}a.push(d)}returna}}classCsvxmlTooltip{staticgetDirection(b,a){window.innerHeight<b.clientY+a.clientHeight?(a.style.top="",a.style.bottom=window.innerHeight-b.clientY+"px"):(a.style.bottom="",a.style.top=b.clientY+4+"px"),window.innerWidth<b.clientX+a.clientWidth?(a.style.left="",a.style.right=window.innerWidth-b.clientX+"px"):(a.style.right="",a.style.left=b.clientX+3+"px")}staticpositionMobile(a){window.matchMedia&&window.matchMedia('(max-width:75em)').matches&&(a.style.left="",a.style.right="",a.style.top="",a.style.bottom="",a.classList.contains("atBottom")===!1&&a.classList.add("atBottom"))}statictriggerMouseMove(b){consta=document.getElement