"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=document.querySelector("#container--lotTypes");let l=exports.lotTypes;delete exports.lotTypes;const o=new Set;function s(e){const t=e.currentTarget,l=t.closest(".container--lotType"),s=Number.parseInt(l.dataset.lotTypeId,10);o.has(s)?o.delete(s):o.add(s),t.innerHTML=o.has(s)?'':'';const i=l.querySelectorAll(".panel-block");for(const e of i)e.classList.toggle("is-hidden")}function i(e){e.success?(l=e.lotTypes,T()):bulmaJS.alert({title:`Error Updating ${exports.aliases.lot} Type`,message:e.errorMessage||"",contextualColorName:"danger"})}function a(t){const l=Number.parseInt(t.currentTarget.closest(".container--lotType").dataset.lotTypeId,10);bulmaJS.confirm({title:`Delete ${exports.aliases.lot} Type`,message:`Are you sure you want to delete this ${exports.aliases.lot.toLowerCase()} type?`,contextualColorName:"warning",okButton:{text:`Yes, Delete ${exports.aliases.lot} Type`,callbackFunction:function(){cityssm.postJSON(e.urlPrefix+"/admin/doDeleteLotType",{lotTypeId:l},i)}}})}function d(t){const o=Number.parseInt(t.currentTarget.closest(".container--lotType").dataset.lotTypeId,10),s=l.find(e=>o===e.lotTypeId);let a;const d=t=>{t.preventDefault(),cityssm.postJSON(e.urlPrefix+"/admin/doUpdateLotType",t.currentTarget,e=>{i(e),e.success&&a()})};cityssm.openHtmlModal("adminLotTypes-editLotType",{onshow(t){e.populateAliases(t),t.querySelector("#lotTypeEdit--lotTypeId").value=o.toString(),t.querySelector("#lotTypeEdit--lotType").value=s.lotType},onshown(e,t){a=t,e.querySelector("#lotTypeEdit--lotType").focus(),e.querySelector("form").addEventListener("submit",d),bulmaJS.toggleHtmlClipped()},onremoved(){bulmaJS.toggleHtmlClipped()}})}function n(t){const l=Number.parseInt(t.currentTarget.closest(".container--lotType").dataset.lotTypeId,10);let s;const a=t=>{t.preventDefault(),cityssm.postJSON(e.urlPrefix+"/admin/doAddLotTypeField",t.currentTarget,e=>{o.add(l),i(e),e.success&&(s(),c(l,e.lotTypeFieldId))})};cityssm.openHtmlModal("adminLotTypes-addLotTypeField",{onshow(t){e.populateAliases(t),l&&(t.querySelector("#lotTypeFieldAdd--lotTypeId").value=l.toString())},onshown(e,t){s=t,e.querySelector("#lotTypeFieldAdd--lotTypeField").focus(),e.querySelector("form").addEventListener("submit",a),bulmaJS.toggleHtmlClipped()},onremoved(){bulmaJS.toggleHtmlClipped()}})}function r(t){const l=t.currentTarget,o=l.closest(".container--lotType").dataset.lotTypeId;cityssm.postJSON(e.urlPrefix+"/admin/"+("up"===l.dataset.direction?"doMoveLotTypeUp":"doMoveLotTypeDown"),{lotTypeId:o,moveToEnd:t.shiftKey?"1":"0"},i)}function c(t,o){const s=l.find(e=>e.lotTypeId===t).lotTypeFields.find(e=>e.lotTypeFieldId===o);let a,d,n,r,c;function p(){d.min=a.value}function u(){""===r.value?(a.disabled=!1,d.disabled=!1,n.disabled=!1):(a.disabled=!0,d.disabled=!0,n.disabled=!0)}function y(t){t.preventDefault(),cityssm.postJSON(e.urlPrefix+"/admin/doUpdateLotTypeField",t.currentTarget,e=>{i(e),e.success&&c()})}function T(){cityssm.postJSON(e.urlPrefix+"/admin/doDeleteLotTypeField",{lotTypeFieldId:o},e=>{i(e),e.success&&c()})}function m(){bulmaJS.confirm({title:"Delete Field",message:"Are you sure you want to delete this field? Note that historical records that make use of this field will not be affected.",contextualColorName:"warning",okButton:{text:"Yes, Delete Field",callbackFunction:T}})}cityssm.openHtmlModal("adminLotTypes-editLotTypeField",{onshow(t){e.populateAliases(t),t.querySelector("#lotTypeFieldEdit--lotTypeFieldId").value=s.lotTypeFieldId.toString(),t.querySelector("#lotTypeFieldEdit--lotTypeField").value=s.lotTypeField,t.querySelector("#lotTypeFieldEdit--isRequired").value=s.isRequired?"1":"0",(a=t.querySelector("#lotTypeFieldEdit--minimumLength")).value=s.minimumLength.toString(),(d=t.querySelector("#lotTypeFieldEdit--maximumLength")).value=s.maximumLength.toString(),(n=t.querySelector("#lotTypeFieldEdit--pattern")).value=s.pattern,(r=t.querySelector("#lotTypeFieldEdit--lotTypeFieldValues")).value=s.lotTypeFieldValues,u()},onshown(e,t){c=t,bulmaJS.init(e),bulmaJS.toggleHtmlClipped(),cityssm.enableNavBlocker(),e.querySelector("form").addEventListener("submit",y),a.addEventListener("keyup",p),p(),r.addEventListener("keyup",u),e.querySelector("#button--deleteLotTypeField").addEventListener("click",m)},onremoved(){bulmaJS.toggleHtmlClipped(),cityssm.disableNavBlocker()}})}function p(e){e.preventDefault();const t=Number.parseInt(e.currentTarget.closest(".container--lotTypeField").dataset.lotTypeFieldId,10);c(Number.parseInt(e.currentTarget.closest(".container--lotType").dataset.lotTypeId,10),t)}function u(t){const l=t.currentTarget,o=l.closest(".container--lotTypeField").dataset.lotTypeFieldId;cityssm.postJSON(e.urlPrefix+"/admin/"+("up"===l.dataset.direction?"doMoveLotTypeFieldUp":"doMoveLotTypeFieldDown"),{lotTypeFieldId:o,moveToEnd:t.shiftKey?"1":"0"},i)}function y(t,l,s){if(0===s.length)t.insertAdjacentHTML("beforeend",'