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