@per-diem-calculator/vanilla 1.0.26 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6217,7 +6217,7 @@ class pa extends HTMLElement {
6217
6217
  ae(this, "rowToggle", async (t = null) => {
6218
6218
  if (!(!c(this, Pe) || c(this, tt, St).classList.contains("toggling"))) {
6219
6219
  if (!t) {
6220
- const n = window.screen.width >= le || c(this, tt, St).offsetHeight === ze ? "open" : "close";
6220
+ const n = window.innerWidth >= le || c(this, tt, St).offsetHeight === ze ? "open" : "close";
6221
6221
  this.rowToggle(n);
6222
6222
  return;
6223
6223
  }
@@ -6228,7 +6228,7 @@ class pa extends HTMLElement {
6228
6228
  M(this, tt, _a).call(this, t === "open"), c(this, tt, ee).summary.style.opacity = t === "open" ? "0" : "100", c(this, tt, ee).summary.style.transform = t === "open" ? "translateY(-200%)" : "translateY(0%)", c(this, tt, ee).details.style.opacity = t === "open" ? "100" : "0", c(this, tt, ee).details.style.transform = t === "open" ? "translateX(100%)" : "translateX(0%)";
6229
6229
  });
6230
6230
  ae(this, "resizeRow", () => {
6231
- window.screen.width < le && c(this, tt, St).offsetHeight === ze || (c(this, tt, St).style.height = c(this, tt, ee).details.offsetHeight + "px", c(this, tt, ee).contents.style.height = c(this, tt, ee).details.offsetHeight + "px", this.styleRow(), window.screen.width >= le && this.rowToggle("open"));
6231
+ window.innerWidth < le && c(this, tt, St).offsetHeight === ze || (c(this, tt, St).style.height = c(this, tt, ee).details.offsetHeight + "px", c(this, tt, ee).contents.style.height = c(this, tt, ee).details.offsetHeight + "px", this.styleRow(), window.innerWidth >= le && this.rowToggle("open"));
6232
6232
  });
6233
6233
  ae(this, "styleRow", () => {
6234
6234
  if (!this.parentNode)
@@ -6238,7 +6238,7 @@ class pa extends HTMLElement {
6238
6238
  ).indexOf(this), n = t % 2 === 0 ? "neutral-50" : "white", i = n === "neutral-50" ? "white" : "neutral-50";
6239
6239
  c(this, tt, St).classList.remove("bg-neutral-50", "bg-white"), c(this, tt, St).classList.add(`bg-${n}`), Object.values(c(this, tt, ya)).forEach((a, s) => {
6240
6240
  var o, d, h, v;
6241
- a.classList.remove("bg-white", "bg-neutral-50"), window.screen.width < le ? (a.classList.add(
6241
+ a.classList.remove("bg-white", "bg-neutral-50"), window.innerWidth < le ? (a.classList.add(
6242
6242
  s % 2 === 0 ? `bg-${n}` : `bg-${i}`
6243
6243
  ), (o = a.querySelector("#lodging-amount")) == null || o.classList.remove("bg-white", "bg-neutral-50"), (d = a.querySelector("#lodging-amount")) == null || d.classList.add(`bg-${n}`)) : (a.classList.add(`bg-${n}`), (h = a.querySelector("#lodging-amount")) == null || h.classList.remove("bg-white", "bg-neutral-50"), (v = a.querySelector("#lodging-amount")) == null || v.classList.add(`bg-${i}`));
6244
6244
  }), this.style.position = "relative", this.style.overflow = "hidden", this.style.zIndex = t.toString();
@@ -6248,7 +6248,7 @@ class pa extends HTMLElement {
6248
6248
  ht(this, De, s.maxLodging), ht(this, qn, a.FirstLastDay ? s.maxMieFirstLast : s.maxMie), ht(this, $e, o), ht(this, Ke, d), this.render(n);
6249
6249
  }
6250
6250
  render(t) {
6251
- c(this, tt, Dt).innerHTML = "", t ? (i0.innerHTML = Ti, dn(c(this, tt, Dt))) : i0.innerHTML = Ye(Ti), c(this, tt, Dt).appendChild(i0.content.cloneNode(!0)), M(this, tt, ma).call(this), M(this, tt, ga).call(this), this.setAttribute("date", c(this, $t).date), M(this, tt, _0).call(this, c(this, $e).toString()), this.updateMieAmount(c(this, Ke)), M(this, tt, pr).call(this), M(this, tt, ba).call(this), c(this, tt, ee).contents.style.height = (window.screen.width >= le ? c(this, tt, ee).details.offsetHeight : ze) + "px", M(this, tt, va).call(this);
6251
+ c(this, tt, Dt).innerHTML = "", t ? (i0.innerHTML = Ti, dn(c(this, tt, Dt))) : i0.innerHTML = Ye(Ti), c(this, tt, Dt).appendChild(i0.content.cloneNode(!0)), M(this, tt, ma).call(this), M(this, tt, ga).call(this), this.setAttribute("date", c(this, $t).date), M(this, tt, _0).call(this, c(this, $e).toString()), this.updateMieAmount(c(this, Ke)), M(this, tt, pr).call(this), M(this, tt, ba).call(this), c(this, tt, ee).contents.style.height = (window.innerWidth >= le ? c(this, tt, ee).details.offsetHeight : ze) + "px", M(this, tt, va).call(this);
6252
6252
  }
6253
6253
  updateMieAmount(t) {
6254
6254
  const n = c(this, tt, Dt).querySelector(
@@ -10117,7 +10117,7 @@ class Ya extends HTMLElement {
10117
10117
  c(this, Be),
10118
10118
  n
10119
10119
  );
10120
- c(this, rt, P0).appendChild(s), s.styleRow(), window.screen.width >= le && s.rowToggle("open");
10120
+ c(this, rt, P0).appendChild(s), s.styleRow(), window.innerWidth >= le && s.rowToggle("open");
10121
10121
  });
10122
10122
  const i = this.getBoundingClientRect().top + window.pageYOffset;
10123
10123
  window.scrollTo({ top: i, behavior: "smooth" }), await M(this, rt, Wa).call(this), M(this, rt, B0).call(this), M(this, rt, Ga).call(this), M(this, rt, Xa).call(this);
@@ -10668,13 +10668,13 @@ class ts extends HTMLElement {
10668
10668
  });
10669
10669
  ot(this, Fr, () => {
10670
10670
  [...c(this, H, be)].forEach((t) => {
10671
- window.screen.width < le && t.offsetHeight === ze || (c(this, Dn).call(this, t), t.style.height = M(this, H, ve).call(this, t).details.scrollHeight + "px", M(this, H, ve).call(this, t).contents.style.height = M(this, H, ve).call(this, t).details.scrollHeight + "px", window.screen.width >= le && M(this, H, Ie).call(this, t, "open"));
10671
+ window.innerWidth < le && t.offsetHeight === ze || (c(this, Dn).call(this, t), t.style.height = M(this, H, ve).call(this, t).details.scrollHeight + "px", M(this, H, ve).call(this, t).contents.style.height = M(this, H, ve).call(this, t).details.scrollHeight + "px", window.innerWidth >= le && M(this, H, Ie).call(this, t, "open"));
10672
10672
  });
10673
10673
  });
10674
10674
  ot(this, Dn, (t) => {
10675
10675
  const n = M(this, H, Sr).call(this, t), i = n % 2 === 0 ? "neutral-50" : "white", a = i === "neutral-50" ? "white" : "neutral-50";
10676
10676
  t.classList.remove("bg-white", "bg-neutral-50"), t.classList.add(`bg-${i}`), t.style.zIndex = n.toString(), Object.values(M(this, H, ne).call(this, t)).forEach((s, o) => {
10677
- window.screen.width < le ? s.setAttribute("bg", o % 2 === 0 ? i : a) : s.setAttribute("bg", i);
10677
+ window.innerWidth < le ? s.setAttribute("bg", o % 2 === 0 ? i : a) : s.setAttribute("bg", i);
10678
10678
  });
10679
10679
  });
10680
10680
  /* VALIDATION
@@ -10729,7 +10729,7 @@ class ts extends HTMLElement {
10729
10729
  });
10730
10730
  ot(this, Mr, () => {
10731
10731
  var i, a;
10732
- this.removeAttribute("validate"), window.screen.width < le && c(this, H, be).forEach((s) => M(this, H, Ie).call(this, s, "close"));
10732
+ this.removeAttribute("validate"), window.innerWidth < le && c(this, H, be).forEach((s) => M(this, H, Ie).call(this, s, "close"));
10733
10733
  const t = (a = (i = this.shadowRoot) == null ? void 0 : i.querySelector(
10734
10734
  'input[name="expenses-category"]:checked'
10735
10735
  )) == null ? void 0 : a.value, n = t === "mie" || t === "lodging" ? t : "both";
@@ -10755,7 +10755,7 @@ class ts extends HTMLElement {
10755
10755
  const i = M(this, H, Er).call(this, t);
10756
10756
  switch (n) {
10757
10757
  case "city":
10758
- window.screen.width < le && (await fr(ea), M(this, H, Ie).call(this, i, "close"));
10758
+ window.innerWidth < le && (await fr(ea), M(this, H, Ie).call(this, i, "close"));
10759
10759
  return;
10760
10760
  case "country":
10761
10761
  M(this, H, ne).call(this, i).city.enable(!0);
@@ -10955,7 +10955,7 @@ ss = function() {
10955
10955
  var a;
10956
10956
  if (!(!t || !c(this, rn) || t.classList.contains("toggling"))) {
10957
10957
  if (!n) {
10958
- const s = window.screen.width >= le || t.offsetHeight === ze ? "open" : "close";
10958
+ const s = window.innerWidth >= le || t.offsetHeight === ze ? "open" : "close";
10959
10959
  M(this, H, Ie).call(this, t, s);
10960
10960
  return;
10961
10961
  }
@@ -10963,7 +10963,7 @@ ss = function() {
10963
10963
  "pdc-row-open",
10964
10964
  "pdc-row-close",
10965
10965
  "pdc-row-initial"
10966
- ), t.classList.add("toggling", `pdc-row-${n}`), (n === "initial" || n === "add") && (c(this, Dn).call(this, t), c(this, an).call(this, t)), await fr(0), M(this, H, as).call(this), (n === "open" || n === "initial" || n === "add") && (t.style.height = M(this, H, ve).call(this, t).details.offsetHeight + "px", M(this, H, ve).call(this, t).contents.style.height = M(this, H, ve).call(this, t).details.offsetHeight + "px", await M(this, H, j0).call(this, t, "open")), n === "close" && (await M(this, H, j0).call(this, t, "close"), t.style.height = ze + "px", M(this, H, ve).call(this, t).contents.style.height = ze + "px"), n === "delete" && (t.style.height = "0px", await M(this, H, os).call(this, t, i)), n !== "delete" && (t.classList.remove("ring-transparent"), t.classList.add("ring-neutral-200")), window.screen.width >= le ? c(this, H, be).forEach((s) => {
10966
+ ), t.classList.add("toggling", `pdc-row-${n}`), (n === "initial" || n === "add") && (c(this, Dn).call(this, t), c(this, an).call(this, t)), await fr(0), M(this, H, as).call(this), (n === "open" || n === "initial" || n === "add") && (t.style.height = M(this, H, ve).call(this, t).details.offsetHeight + "px", M(this, H, ve).call(this, t).contents.style.height = M(this, H, ve).call(this, t).details.offsetHeight + "px", await M(this, H, j0).call(this, t, "open")), n === "close" && (await M(this, H, j0).call(this, t, "close"), t.style.height = ze + "px", M(this, H, ve).call(this, t).contents.style.height = ze + "px"), n === "delete" && (t.style.height = "0px", await M(this, H, os).call(this, t, i)), n !== "delete" && (t.classList.remove("ring-transparent"), t.classList.add("ring-neutral-200")), window.innerWidth >= le ? c(this, H, be).forEach((s) => {
10967
10967
  var o, d;
10968
10968
  (d = (o = s.querySelector('[data-pdc="location-row-sidebar"]')) == null ? void 0 : o.querySelector('[data-pdc="delete-row"]')) == null || d.setAttribute("tabindex", "0");
10969
10969
  }) : c(this, H, be).forEach((s) => {
@@ -492,7 +492,7 @@
492
492
  </div>
493
493
  </div>
494
494
  </div>
495
- `,h0=document.createElement("template");class Ii extends HTMLElement{constructor(t,n,r){super();ot(this,tt);ot(this,Ut);ot(this,wn);ot(this,Be);ot(this,Ee);ot(this,Wn);ot(this,Ue);ot(this,Qe);he(this,"rowToggle",async(t=null)=>{if(!(!c(this,Be)||c(this,tt,At).classList.contains("toggling"))){if(!t){const n=window.screen.width>=se||c(this,tt,At).offsetHeight===ze?"open":"close";this.rowToggle(n);return}c(this,tt,At).classList.remove("pdc-row-open","pdc-row-close"),c(this,tt,At).classList.add("toggling",`pdc-row-${t}`),t==="open"?(c(this,tt,At).style.height=c(this,tt,ie).details.offsetHeight+"px",c(this,tt,ie).contents.style.height=c(this,tt,ie).details.offsetHeight+"px",await c(this,Gn).call(this,"open")):(c(this,tt,At).style.height=ze+"px",c(this,tt,ie).contents.style.height=ze+"px",await c(this,Gn).call(this,"close")),c(this,tt,At).classList.remove("toggling")}});ot(this,Gn,async t=>{M(this,tt,Ma).call(this,t==="open"),c(this,tt,ie).summary.style.opacity=t==="open"?"0":"100",c(this,tt,ie).summary.style.transform=t==="open"?"translateY(-200%)":"translateY(0%)",c(this,tt,ie).details.style.opacity=t==="open"?"100":"0",c(this,tt,ie).details.style.transform=t==="open"?"translateX(100%)":"translateX(0%)"});he(this,"resizeRow",()=>{window.screen.width<se&&c(this,tt,At).offsetHeight===ze||(c(this,tt,At).style.height=c(this,tt,ie).details.offsetHeight+"px",c(this,tt,ie).contents.style.height=c(this,tt,ie).details.offsetHeight+"px",this.styleRow(),window.screen.width>=se&&this.rowToggle("open"))});he(this,"styleRow",()=>{if(!this.parentNode)throw new Error("Failed to get row index in Expense view.");const t=Array.from(this.parentNode.querySelectorAll("pdc-expense-row")).indexOf(this),n=t%2===0?"neutral-50":"white",r=n==="neutral-50"?"white":"neutral-50";c(this,tt,At).classList.remove("bg-neutral-50","bg-white"),c(this,tt,At).classList.add(`bg-${n}`),Object.values(c(this,tt,Ra)).forEach((a,s)=>{var o,d,h,v;a.classList.remove("bg-white","bg-neutral-50"),window.screen.width<se?(a.classList.add(s%2===0?`bg-${n}`:`bg-${r}`),(o=a.querySelector("#lodging-amount"))==null||o.classList.remove("bg-white","bg-neutral-50"),(d=a.querySelector("#lodging-amount"))==null||d.classList.add(`bg-${n}`)):(a.classList.add(`bg-${n}`),(h=a.querySelector("#lodging-amount"))==null||h.classList.remove("bg-white","bg-neutral-50"),(v=a.querySelector("#lodging-amount"))==null||v.classList.add(`bg-${r}`))}),this.style.position="relative",this.style.overflow="hidden",this.style.zIndex=t.toString()});this.attachShadow({mode:"open"}),ht(this,Ut,t),ht(this,Be,n),ht(this,wn,r);const{deductions:a,rates:s,lodgingAmount:o,mieAmount:d}=c(this,Ut);ht(this,Ee,s.maxLodging),ht(this,Wn,a.FirstLastDay?s.maxMieFirstLast:s.maxMie),ht(this,Ue,o),ht(this,Qe,d),this.render(n)}render(t){c(this,tt,Ot).innerHTML="",t?(h0.innerHTML=Fi,Ze(c(this,tt,Ot))):h0.innerHTML=$e(Fi),c(this,tt,Ot).appendChild(h0.content.cloneNode(!0)),M(this,tt,Oa).call(this),M(this,tt,Ca).call(this),this.setAttribute("date",c(this,Ut).date),M(this,tt,I0).call(this,c(this,Ue).toString()),this.updateMieAmount(c(this,Qe)),M(this,tt,$r).call(this),M(this,tt,Fa).call(this),c(this,tt,ie).contents.style.height=(window.screen.width>=se?c(this,tt,ie).details.offsetHeight:ze)+"px",M(this,tt,Ia).call(this)}updateMieAmount(t){const n=c(this,tt,Ot).querySelector("#mie-total-amount"),r=c(this,tt,Ot).querySelector("#summary-mie-amount");if(!(n&&r))throw new Error("Failed to render row's M&IE elements.");const a=n.value,s=t.toFixed(2).toString();a!==s&&(n.value=s,r.textContent=Xt.format(t),ht(this,Qe,t),c(this,Be)&&u0(n),M(this,tt,$r).call(this))}get rateSource(){return c(this,Ut).source}get rateString(){const{effDate:t,...n}=c(this,Ut).rates,{country:r,city:a}=c(this,Ut);return JSON.stringify({city:a,country:r,rates:n})}get rateStringForTable(){const{date:t,country:n,city:r,rates:a}=c(this,Ut),s=`${Re(t)}/${oe(t)}`;return JSON.stringify({monthYear:s,country:n,city:r,rates:a})}get amount(){const{mieAmount:t,lodgingAmount:n}=c(this,Ut);return{mie:t,lodging:n}}}Ut=new WeakMap,wn=new WeakMap,Be=new WeakMap,Ee=new WeakMap,Wn=new WeakMap,Ue=new WeakMap,Qe=new WeakMap,tt=new WeakSet,Oa=function(){const t=c(this,tt,Ot).querySelector("#month"),n=c(this,tt,Ot).querySelector("#day"),r=c(this,tt,Ot).querySelector("#year"),a=new Date(c(this,Ut).date);if(!(t&&n&&r))throw new Error("Failed to render row's date elements.");t.textContent=Si(a.toUTCString()),n.textContent=Yn(c(this,Ut).date),r.textContent=oe(c(this,Ut).date)},Ca=function(){const t=c(this,tt,Ot).querySelector("#location"),n=c(this,tt,Ot).querySelector("#lodging-rate"),r=c(this,tt,Ot).querySelector("#mie-rate");if(!(t&&n&&r))throw new Error("Failed to render row's rate elements.");t.textContent=`${c(this,Ut).city} (${c(this,Ut).country})`,n.innerHTML=`<span class="font-semibold block">Lodging</span>
495
+ `,h0=document.createElement("template");class Ii extends HTMLElement{constructor(t,n,r){super();ot(this,tt);ot(this,Ut);ot(this,wn);ot(this,Be);ot(this,Ee);ot(this,Wn);ot(this,Ue);ot(this,Qe);he(this,"rowToggle",async(t=null)=>{if(!(!c(this,Be)||c(this,tt,At).classList.contains("toggling"))){if(!t){const n=window.innerWidth>=se||c(this,tt,At).offsetHeight===ze?"open":"close";this.rowToggle(n);return}c(this,tt,At).classList.remove("pdc-row-open","pdc-row-close"),c(this,tt,At).classList.add("toggling",`pdc-row-${t}`),t==="open"?(c(this,tt,At).style.height=c(this,tt,ie).details.offsetHeight+"px",c(this,tt,ie).contents.style.height=c(this,tt,ie).details.offsetHeight+"px",await c(this,Gn).call(this,"open")):(c(this,tt,At).style.height=ze+"px",c(this,tt,ie).contents.style.height=ze+"px",await c(this,Gn).call(this,"close")),c(this,tt,At).classList.remove("toggling")}});ot(this,Gn,async t=>{M(this,tt,Ma).call(this,t==="open"),c(this,tt,ie).summary.style.opacity=t==="open"?"0":"100",c(this,tt,ie).summary.style.transform=t==="open"?"translateY(-200%)":"translateY(0%)",c(this,tt,ie).details.style.opacity=t==="open"?"100":"0",c(this,tt,ie).details.style.transform=t==="open"?"translateX(100%)":"translateX(0%)"});he(this,"resizeRow",()=>{window.innerWidth<se&&c(this,tt,At).offsetHeight===ze||(c(this,tt,At).style.height=c(this,tt,ie).details.offsetHeight+"px",c(this,tt,ie).contents.style.height=c(this,tt,ie).details.offsetHeight+"px",this.styleRow(),window.innerWidth>=se&&this.rowToggle("open"))});he(this,"styleRow",()=>{if(!this.parentNode)throw new Error("Failed to get row index in Expense view.");const t=Array.from(this.parentNode.querySelectorAll("pdc-expense-row")).indexOf(this),n=t%2===0?"neutral-50":"white",r=n==="neutral-50"?"white":"neutral-50";c(this,tt,At).classList.remove("bg-neutral-50","bg-white"),c(this,tt,At).classList.add(`bg-${n}`),Object.values(c(this,tt,Ra)).forEach((a,s)=>{var o,d,h,v;a.classList.remove("bg-white","bg-neutral-50"),window.innerWidth<se?(a.classList.add(s%2===0?`bg-${n}`:`bg-${r}`),(o=a.querySelector("#lodging-amount"))==null||o.classList.remove("bg-white","bg-neutral-50"),(d=a.querySelector("#lodging-amount"))==null||d.classList.add(`bg-${n}`)):(a.classList.add(`bg-${n}`),(h=a.querySelector("#lodging-amount"))==null||h.classList.remove("bg-white","bg-neutral-50"),(v=a.querySelector("#lodging-amount"))==null||v.classList.add(`bg-${r}`))}),this.style.position="relative",this.style.overflow="hidden",this.style.zIndex=t.toString()});this.attachShadow({mode:"open"}),ht(this,Ut,t),ht(this,Be,n),ht(this,wn,r);const{deductions:a,rates:s,lodgingAmount:o,mieAmount:d}=c(this,Ut);ht(this,Ee,s.maxLodging),ht(this,Wn,a.FirstLastDay?s.maxMieFirstLast:s.maxMie),ht(this,Ue,o),ht(this,Qe,d),this.render(n)}render(t){c(this,tt,Ot).innerHTML="",t?(h0.innerHTML=Fi,Ze(c(this,tt,Ot))):h0.innerHTML=$e(Fi),c(this,tt,Ot).appendChild(h0.content.cloneNode(!0)),M(this,tt,Oa).call(this),M(this,tt,Ca).call(this),this.setAttribute("date",c(this,Ut).date),M(this,tt,I0).call(this,c(this,Ue).toString()),this.updateMieAmount(c(this,Qe)),M(this,tt,$r).call(this),M(this,tt,Fa).call(this),c(this,tt,ie).contents.style.height=(window.innerWidth>=se?c(this,tt,ie).details.offsetHeight:ze)+"px",M(this,tt,Ia).call(this)}updateMieAmount(t){const n=c(this,tt,Ot).querySelector("#mie-total-amount"),r=c(this,tt,Ot).querySelector("#summary-mie-amount");if(!(n&&r))throw new Error("Failed to render row's M&IE elements.");const a=n.value,s=t.toFixed(2).toString();a!==s&&(n.value=s,r.textContent=Xt.format(t),ht(this,Qe,t),c(this,Be)&&u0(n),M(this,tt,$r).call(this))}get rateSource(){return c(this,Ut).source}get rateString(){const{effDate:t,...n}=c(this,Ut).rates,{country:r,city:a}=c(this,Ut);return JSON.stringify({city:a,country:r,rates:n})}get rateStringForTable(){const{date:t,country:n,city:r,rates:a}=c(this,Ut),s=`${Re(t)}/${oe(t)}`;return JSON.stringify({monthYear:s,country:n,city:r,rates:a})}get amount(){const{mieAmount:t,lodgingAmount:n}=c(this,Ut);return{mie:t,lodging:n}}}Ut=new WeakMap,wn=new WeakMap,Be=new WeakMap,Ee=new WeakMap,Wn=new WeakMap,Ue=new WeakMap,Qe=new WeakMap,tt=new WeakSet,Oa=function(){const t=c(this,tt,Ot).querySelector("#month"),n=c(this,tt,Ot).querySelector("#day"),r=c(this,tt,Ot).querySelector("#year"),a=new Date(c(this,Ut).date);if(!(t&&n&&r))throw new Error("Failed to render row's date elements.");t.textContent=Si(a.toUTCString()),n.textContent=Yn(c(this,Ut).date),r.textContent=oe(c(this,Ut).date)},Ca=function(){const t=c(this,tt,Ot).querySelector("#location"),n=c(this,tt,Ot).querySelector("#lodging-rate"),r=c(this,tt,Ot).querySelector("#mie-rate");if(!(t&&n&&r))throw new Error("Failed to render row's rate elements.");t.textContent=`${c(this,Ut).city} (${c(this,Ut).country})`,n.innerHTML=`<span class="font-semibold block">Lodging</span>
496
496
  <span class="text-sm normal-case font-normal">Max ${Xt.format(c(this,Ee))}</span>`,r.innerHTML=`<span class="font-semibold block">M&IE</span>
497
497
  <span class="text-sm normal-case font-normal">Max ${Xt.format(c(this,Wn))}</span></span>`},Fa=function(){var a,s;const t=c(this,tt,Ot).querySelector("#mie"),n=c(this,tt,Ot).querySelector("#lodging"),r=c(this,tt,Ot).querySelector("#deductions");c(this,wn)==="mie"&&(n==null||n.classList.add("disabled"),(a=c(this,tt,Ot).querySelector("#lodging-amount"))==null||a.setAttribute("disabled","")),c(this,wn)==="lodging"&&(r==null||r.classList.add("disabled"),t==null||t.classList.add("disabled"),(s=t==null?void 0:t.querySelector("input"))==null||s.setAttribute("disabled",""),r==null||r.querySelectorAll("input").forEach(o=>o.setAttribute("disabled","")))},Ia=function(){c(this,tt,At).addEventListener("change",r=>{M(this,tt,za).call(this,r)});let t=0,n=0;c(this,tt,At).addEventListener("pointerdown",r=>{if(!(r instanceof PointerEvent))return;const a=Bn(r);t=a.pointerStartX,n=a.pointerStartY}),c(this,tt,At).addEventListener("pointerup",r=>{if(r instanceof PointerEvent){const a=Un(r,M(this,tt,F0).bind(this),t,n);t=a.pointerStartX,n=a.pointerStartY}}),c(this,tt,At).addEventListener("keydown",r=>{(r.key==="Enter"||r.key===" ")&&M(this,tt,F0).call(this,r)})},za=function(t){const n=t.target;if(!(n instanceof HTMLInputElement))return;if(n.getAttribute("id")==="lodging-amount"){M(this,tt,I0).call(this,n.value);return}const r=n.getAttribute("name");(r==="breakfast"||r==="lunch"||r==="dinner")&&this.setAttribute(`${r}provided`,n.checked?"yes":"no")},F0=function(t){const n=t.target;(n instanceof SVGElement||n instanceof HTMLElement)&&(n.closest('[data-pdc="expense-row-toggle"]')&&this.rowToggle(),n.closest("#deductions")&&t instanceof KeyboardEvent&&n instanceof HTMLLabelElement&&n.click())},At=function(){const t=c(this,tt,Ot).querySelector("#expense-row");if(!t)throw new Error("Failed to render row elements.");return t},Ra=function(){const t=c(this,tt,At).querySelector("#location"),n=c(this,tt,At).querySelector("#deductions"),r=c(this,tt,At).querySelector("#mie"),a=c(this,tt,At).querySelector("#lodging"),s=c(this,tt,At).querySelector("#total");if(!(t&&n&&r&&a&&s))throw new Error("Failed to render row expense elements.");return{location:t,deductions:n,mie:r,lodging:a,total:s}},ie=function(){const t=c(this,tt,At).querySelector('[data-pdc="expense-row-summary"]'),n=c(this,tt,At).querySelector('[data-pdc="expense-row-contents"]'),r=c(this,tt,At).querySelector('[data-pdc="expense-row-details"]');if(!(t&&n&&r))throw new Error("Failed to render row summary elements.");return{summary:t,contents:n,details:r}},Ot=function(){if(!this.shadowRoot)throw new Error("Failed to create ShadowRoot for expense row custom element");return this.shadowRoot},Gn=new WeakMap,Ma=function(t){var n;(n=c(this,tt,Ot).querySelector('[data-pdc="expense-row-details"]'))==null||n.querySelectorAll("[tabindex]").forEach(r=>{r.setAttribute("tabindex",t?"0":"-1")})},I0=function(t){const n=c(this,tt,Ot).querySelector("#lodging-amount"),r=c(this,tt,Ot).querySelector("#summary-lodging-amount");if(!(n&&r))throw new Error("Failed to render input element for lodging in Expense row.");(s=>!isNaN(parseFloat(s))&&+s>=0&&+s<=c(this,Ee))(t)?(this.setAttribute("lodging",t),n.value=(+t).toFixed(2).toString(),ht(this,Ue,+t),r.textContent=Xt.format(+t)):(this.setAttribute("lodging",c(this,Ee).toString()),n.value=c(this,Ee).toFixed(2).toString(),ht(this,Ue,c(this,Ee)),r.textContent=Xt.format(c(this,Ee))),c(this,Be)&&u0(n),M(this,tt,$r).call(this)},$r=function(){const t=c(this,Ue)+c(this,Qe),n=c(this,tt,Ot).querySelectorAll('[data-pdc="expense-total"]');n==null||n.forEach(r=>{r instanceof HTMLInputElement&&(r.value=t.toFixed(2).toString(),c(this,Be)&&u0(r)),r instanceof HTMLParagraphElement&&(r.textContent=`${Xt.format(t)}`)})};const zi=`<fieldset
498
498
  inert
@@ -1174,7 +1174,7 @@
1174
1174
  group-active:[transition:transform_0.25s]"
1175
1175
  ></span>
1176
1176
  </button>
1177
- `,E0=document.createElement("template");class N1 extends HTMLElement{constructor(){var a;super();ot(this,rn);ot(this,Jn,!1);if(this.attachShadow({mode:"open"}),ht(this,Jn,this.getAttribute("styled")==="true"),!this.shadowRoot)throw new Error("Failed to create shadowRoot for button custom element.");c(this,Jn)?(E0.innerHTML=ua,Ze(this.shadowRoot)):E0.innerHTML=$e(ua),(a=this.shadowRoot)==null||a.appendChild(E0.content.cloneNode(!0));const t=c(this,rn,ir).querySelector('[data-pdc="text"]'),n=this.getAttribute("text"),r=this.getAttribute("title");if(!(t&&n&&r))throw new Error("Failed to render button.");c(this,rn,ir).setAttribute("title",r),c(this,rn,ir).setAttribute("aria-label",`Click to ${r}`),t.textContent=n}enableTabIndex(t){c(this,rn,ir).setAttribute("tabindex",t?"0":"-1")}}Jn=new WeakMap,rn=new WeakSet,ir=function(){var n;const t=(n=this.shadowRoot)==null?void 0:n.querySelector("button");if(!t)throw new Error("Failed to render button.");return t},customElements.define("pdc-expense-row",Ii);const L0=document.createElement("template");class ha extends HTMLElement{constructor(){super();ot(this,nt);ot(this,je,!1);ot(this,an,null);ot(this,Ye,0);ot(this,Ve,0);ot(this,Er,t=>{const n=c(this,nt,Ct).querySelector("#heading"),r=c(this,nt,Ct).querySelector("#heading-print"),a=c(this,nt,Ct).querySelector("#body"),s=c(this,nt,Ct).querySelector("#body-print");n&&t.heading?(n.innerHTML="",n.insertAdjacentHTML("beforeend",t.heading)):n==null||n.remove(),r&&t.headingPrint?(r.innerHTML="",r.insertAdjacentHTML("beforeend",t.headingPrint)):r==null||r.remove(),a&&t.body?(a.innerHTML="",a.insertAdjacentHTML("beforeend",t.body)):a==null||a.remove(),s&&t.bodyPrint?(s.innerHTML="",s.insertAdjacentHTML("beforeend",t.bodyPrint)):s==null||s.remove()});this.attachShadow({mode:"open"})}render(t,n){var r;c(this,nt,Ct).innerHTML="",window.removeEventListener("resize",M(this,nt,W0).call(this)),ht(this,je,t),c(this,je)?(L0.innerHTML=Ci,Ze(c(this,nt,Ct))):L0.innerHTML=$e(Ci),c(this,nt,Ct).appendChild(L0.content.cloneNode(!0)),c(this,Er).call(this,n),(r=c(this,nt,Ct).querySelector("pdc-button"))==null||r.enableTabIndex(!0),M(this,nt,Xa).call(this)}renderLoadingSpinner(t){if(!c(this,je))return;const n=c(this,nt,Ct).querySelector('[data-pdc="loading-spinner"]');t?n==null||n.classList.add("active"):n==null||n.classList.remove("active")}renderEmtpy(){c(this,nt,Ct).innerHTML=""}updateRowMie(t,n,r,a){var s;(s=c(this,nt,Ct).querySelector(`[date="${t}"]`))==null||s.updateMieAmount(n),ht(this,Ye,r),ht(this,Ve,a),M(this,nt,K0).call(this)}async addRows(t,n){c(this,nt,X0).innerHTML="",t.forEach(a=>{const s=new Ii(a,c(this,je),n);c(this,nt,X0).appendChild(s),s.styleRow(),window.screen.width>=se&&s.rowToggle("open")});const r=this.getBoundingClientRect().top+window.pageYOffset;window.scrollTo({top:r,behavior:"smooth"}),await M(this,nt,Ka).call(this),M(this,nt,K0).call(this),M(this,nt,Ja).call(this),M(this,nt,Qa).call(this)}async createExpenseTable(t){let n=0,r=0,a=0,s="";t.forEach((o,d,h)=>{n+=o.mieAmount,r+=o.lodgingAmount,a+=o.totalAmount;const v=`<span class="font-semibold">${o.city}, ${o.country}</span>`+M(this,nt,es).call(this,o,d,h.length);s+=M(this,nt,ns).call(this,o,v)}),s+=`
1177
+ `,E0=document.createElement("template");class N1 extends HTMLElement{constructor(){var a;super();ot(this,rn);ot(this,Jn,!1);if(this.attachShadow({mode:"open"}),ht(this,Jn,this.getAttribute("styled")==="true"),!this.shadowRoot)throw new Error("Failed to create shadowRoot for button custom element.");c(this,Jn)?(E0.innerHTML=ua,Ze(this.shadowRoot)):E0.innerHTML=$e(ua),(a=this.shadowRoot)==null||a.appendChild(E0.content.cloneNode(!0));const t=c(this,rn,ir).querySelector('[data-pdc="text"]'),n=this.getAttribute("text"),r=this.getAttribute("title");if(!(t&&n&&r))throw new Error("Failed to render button.");c(this,rn,ir).setAttribute("title",r),c(this,rn,ir).setAttribute("aria-label",`Click to ${r}`),t.textContent=n}enableTabIndex(t){c(this,rn,ir).setAttribute("tabindex",t?"0":"-1")}}Jn=new WeakMap,rn=new WeakSet,ir=function(){var n;const t=(n=this.shadowRoot)==null?void 0:n.querySelector("button");if(!t)throw new Error("Failed to render button.");return t},customElements.define("pdc-expense-row",Ii);const L0=document.createElement("template");class ha extends HTMLElement{constructor(){super();ot(this,nt);ot(this,je,!1);ot(this,an,null);ot(this,Ye,0);ot(this,Ve,0);ot(this,Er,t=>{const n=c(this,nt,Ct).querySelector("#heading"),r=c(this,nt,Ct).querySelector("#heading-print"),a=c(this,nt,Ct).querySelector("#body"),s=c(this,nt,Ct).querySelector("#body-print");n&&t.heading?(n.innerHTML="",n.insertAdjacentHTML("beforeend",t.heading)):n==null||n.remove(),r&&t.headingPrint?(r.innerHTML="",r.insertAdjacentHTML("beforeend",t.headingPrint)):r==null||r.remove(),a&&t.body?(a.innerHTML="",a.insertAdjacentHTML("beforeend",t.body)):a==null||a.remove(),s&&t.bodyPrint?(s.innerHTML="",s.insertAdjacentHTML("beforeend",t.bodyPrint)):s==null||s.remove()});this.attachShadow({mode:"open"})}render(t,n){var r;c(this,nt,Ct).innerHTML="",window.removeEventListener("resize",M(this,nt,W0).call(this)),ht(this,je,t),c(this,je)?(L0.innerHTML=Ci,Ze(c(this,nt,Ct))):L0.innerHTML=$e(Ci),c(this,nt,Ct).appendChild(L0.content.cloneNode(!0)),c(this,Er).call(this,n),(r=c(this,nt,Ct).querySelector("pdc-button"))==null||r.enableTabIndex(!0),M(this,nt,Xa).call(this)}renderLoadingSpinner(t){if(!c(this,je))return;const n=c(this,nt,Ct).querySelector('[data-pdc="loading-spinner"]');t?n==null||n.classList.add("active"):n==null||n.classList.remove("active")}renderEmtpy(){c(this,nt,Ct).innerHTML=""}updateRowMie(t,n,r,a){var s;(s=c(this,nt,Ct).querySelector(`[date="${t}"]`))==null||s.updateMieAmount(n),ht(this,Ye,r),ht(this,Ve,a),M(this,nt,K0).call(this)}async addRows(t,n){c(this,nt,X0).innerHTML="",t.forEach(a=>{const s=new Ii(a,c(this,je),n);c(this,nt,X0).appendChild(s),s.styleRow(),window.innerWidth>=se&&s.rowToggle("open")});const r=this.getBoundingClientRect().top+window.pageYOffset;window.scrollTo({top:r,behavior:"smooth"}),await M(this,nt,Ka).call(this),M(this,nt,K0).call(this),M(this,nt,Ja).call(this),M(this,nt,Qa).call(this)}async createExpenseTable(t){let n=0,r=0,a=0,s="";t.forEach((o,d,h)=>{n+=o.mieAmount,r+=o.lodgingAmount,a+=o.totalAmount;const v=`<span class="font-semibold">${o.city}, ${o.country}</span>`+M(this,nt,es).call(this,o,d,h.length);s+=M(this,nt,ns).call(this,o,v)}),s+=`
1178
1178
  <tr class="border-t-3 *:text-lg *:font-semibold">
1179
1179
  <td colspan="2" class="text-left">Total</td>
1180
1180
  <td class="text-right">${Xt.format(n)}</td>
@@ -1508,4 +1508,4 @@
1508
1508
  </div>
1509
1509
  </div>
1510
1510
  </li>
1511
- `;customElements.define("pdc-location-date",da),customElements.define("pdc-location-category",Ri),customElements.define("pdc-location-select",la),customElements.define("pdc-button",N1);const A0=document.createElement("template"),ma=document.createElement("template");class ga extends HTMLElement{constructor(t,n){super();ot(this,H);ot(this,sn);ot(this,Ae,!1);ot(this,Lr,t=>{var a,s;const n=(a=this.shadowRoot)==null?void 0:a.querySelector("#heading"),r=(s=this.shadowRoot)==null?void 0:s.querySelector("#body");n&&t.heading?(n.innerHTML="",n.insertAdjacentHTML("beforeend",t.heading)):n==null||n.remove(),r&&t.body?(r.innerHTML="",r.insertAdjacentHTML("beforeend",t.body)):r==null||r.remove()});ot(this,Ar,()=>{[...c(this,H,xe)].forEach(t=>{window.screen.width<se&&t.offsetHeight===ze||(c(this,_n).call(this,t),t.style.height=M(this,H,ke).call(this,t).details.scrollHeight+"px",M(this,H,ke).call(this,t).contents.style.height=M(this,H,ke).call(this,t).details.scrollHeight+"px",window.screen.width>=se&&M(this,H,Pe).call(this,t,"open"))})});ot(this,_n,t=>{const n=M(this,H,Xr).call(this,t),r=n%2===0?"neutral-50":"white",a=r==="neutral-50"?"white":"neutral-50";t.classList.remove("bg-white","bg-neutral-50"),t.classList.add(`bg-${r}`),t.style.zIndex=n.toString(),Object.values(M(this,H,ae).call(this,t)).forEach((s,o)=>{window.screen.width<se?s.setAttribute("bg",o%2===0?r:a):s.setAttribute("bg",r)})});ot(this,Dr,()=>{const t=c(this,H,Ie).querySelectorAll("pdc-location-date"),n=c(this,H,Ie).querySelectorAll("pdc-location-category"),r=c(this,H,Ie).querySelectorAll("pdc-location-select");return[...t,...n,...r]});ot(this,Tr,t=>{if(!t.validate()){const n=t.closest('[data-pdc="location-row"]');n!=null&&n.classList.contains("pdc-row-close")&&M(this,H,Pe).call(this,n,"open")}return t.validate()});ot(this,Qn,(t=null)=>{const n=c(this,Dr).call(this);if(ht(this,Ae,n.every(r=>c(this,Tr).call(this,r))),c(this,Ae)&&t){if(!M(this,H,us).call(this))return c(this,H,zn).textContent="Trip length must be < 6 months",c(this,H,zn).classList.add("active"),ht(this,Ae,!1),c(this,Ae);c(this,H,Ie).setAttribute("validate",`${c(this,Ae)}`)}return c(this,Ae)});ot(this,on,t=>{const n=t.closest('[data-pdc="location-row"]');if(!n)throw new Error("Failed to get row.");const r=_=>{var p;return(p=n.querySelector(`[pdc="${_}"]`))==null?void 0:p.pdcValue},a=M(this,H,Xr).call(this,n),s=r("start"),o=r("end"),d=r("category"),h=r("country"),v=r("city"),b={index:a,...s&&le(s)&&{start:s},...o&&le(o)&&{end:o},...(d==="domestic"||d==="intl")&&{category:d},...h&&{country:h},...v&&{city:v}};return M(this,H,ss).call(this,b),b});ot(this,Or,()=>{const t=[...c(this,H,xe)].map(n=>c(this,on).call(this,n));return this.removeAttribute("update-state"),t});ot(this,Cr,()=>{var r,a;this.removeAttribute("validate"),window.screen.width<se&&c(this,H,xe).forEach(s=>M(this,H,Pe).call(this,s,"close"));const t=(a=(r=this.shadowRoot)==null?void 0:r.querySelector('input[name="expenses-category"]:checked'))==null?void 0:a.value,n=t==="mie"||t==="lodging"?t:"both";return{valid:c(this,Ae),expensesCategory:n}});this.attachShadow({mode:"open"}),ht(this,sn,t),c(this,sn)?(A0.innerHTML=fa,Ze(c(this,H,Rn))):A0.innerHTML=$e(fa),c(this,H,Rn).appendChild(A0.content.cloneNode(!0)),c(this,Lr).call(this,n),M(this,H,is).call(this),M(this,H,Q0).call(this,"initial")}createOptions(t,n,r){const s=M(this,H,Gr).call(this,t).querySelector(`[pdc="${r}"]`);s==null||s.setOptions(n)}controllerHandler(t,n,r){M(this,H,hs).call(this,t,n,r,c(this,on),c(this,Or),c(this,Cr))}async restrictRow(t,n){const r=M(this,H,Gr).call(this,t);switch(n){case"city":window.screen.width<se&&(await hr(Ft),M(this,H,Pe).call(this,r,"close"));return;case"country":M(this,H,ae).call(this,r).city.enable(!0);return;case"category":M(this,H,ms).call(this,r);return;case"end":M(this,H,ps).call(this,r);return;case"start":M(this,H,fs).call(this,r);return}}}sn=new WeakMap,Ae=new WeakMap,Lr=new WeakMap,H=new WeakSet,is=function(){var s;const t=(s=this.shadowRoot)==null?void 0:s.querySelector("#view-container");let n=0,r=0;t==null||t.addEventListener("pointerdown",o=>{if(!(o instanceof PointerEvent))return;const d=Bn(o);n=d.pointerStartX,r=d.pointerStartY}),t==null||t.addEventListener("pointerup",o=>{if(o instanceof PointerEvent){const d=Un(o,M(this,H,J0).bind(this),n,r);n=d.pointerStartX,r=d.pointerStartY}}),t==null||t.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&M(this,H,J0).call(this,o)});const a=ur(c(this,Ar).bind(this));window.addEventListener("resize",a)},J0=function(t){var o;const n=t.target;if(!(n instanceof SVGElement||n instanceof HTMLElement))return;const r=n.closest("button"),a=n.closest("pdc-button"),s=n.closest('[data-pdc="location-row"]');switch(!0){case(r==null?void 0:r.getAttribute("id"))==="add-row":M(this,H,Q0).call(this);return;case(r==null?void 0:r.dataset.pdc)==="delete-row":M(this,H,as).call(this,s);return;case(a==null?void 0:a.getAttribute("id"))==="calculate-expenses":c(this,Qn).call(this,"calculate");return;case!!n.closest('[data-pdc="location-row-toggle"]'):M(this,H,Pe).call(this,s);return;case(!!n.closest("#expense-category")&&t instanceof KeyboardEvent&&n instanceof HTMLLabelElement):n.click();return;case!!n.closest("#error"):(o=n.closest("#error"))==null||o.classList.remove("active");return;default:return}},Ie=function(){const t=c(this,H,Rn).querySelector("#rows");if(!t)throw new Error("Failed to render rows container for location View.");return t},xe=function(){const t=c(this,H,Rn).querySelectorAll('[data-pdc="location-row"]');if(!t)throw new Error("Failed to render row elements for location View.");return t},Gr=function(t){const n=c(this,H,Ie).children[t];if(!(n instanceof HTMLElement))throw new Error(`Failed to get row using row index of ${t} in Location view.`);return n},ae=function(t){const n=t.querySelector('[pdc="start"]'),r=t.querySelector('[pdc="end"]'),a=t.querySelector('[pdc="category"]'),s=t.querySelector('[pdc="country"]'),o=t.querySelector('[pdc="city"]');if(!(n&&r&&a&&s&&o))throw new Error("Failed to render row custom elements.");return{start:n,end:r,category:a,country:s,city:o}},ke=function(t){var o;const n=t.querySelector('[data-pdc="location-row-summary"]'),r=(o=n==null?void 0:n.parentElement)==null?void 0:o.querySelector('button[data-pdc="delete-row"]'),a=t.querySelector('[data-pdc="location-row-contents"]'),s=t.querySelector('[data-pdc="location-row-details"]');if(!(r&&n&&a&&s))throw new Error("Failed to render row summary elements.");return{deleteBtn:r,summary:n,contents:a,details:s}},fn=function(){var a,s,o,d,h;const t=(s=(a=this.shadowRoot)==null?void 0:a.querySelector("#add-row"))==null?void 0:s.closest("div"),n=(o=this.shadowRoot)==null?void 0:o.querySelector("#expense-category"),r=(h=(d=this.shadowRoot)==null?void 0:d.querySelector("#calculate-expenses"))==null?void 0:h.closest("div");if(!(t&&n&&r))throw new Error("Failed to render buttons for location View.");return{addRow:t,expenseCategory:n,calculateExpenses:r}},zn=function(){const t=c(this,H,Rn).querySelector("#error");if(!t)throw new Error("Failed to render row summary elements.");return t},Rn=function(){if(!this.shadowRoot)throw new Error("Failed to render ShadowRoot for location View.");return this.shadowRoot},Xr=function(t){if(!t.parentNode)throw new Error("Failed to get row index in Location View.");return Array.from(t.parentNode.querySelectorAll('[data-pdc="location-row"]')).indexOf(t)},Q0=function(t=null){if(!c(this,Qn).call(this))return;ma.innerHTML=c(this,sn)?pa:$e(pa),c(this,H,Ie).appendChild(ma.content.cloneNode(!0));const n=c(this,H,Ie).lastElementChild;if(!(n instanceof HTMLElement))throw new Error("Failed to render new row");M(this,H,Pe).call(this,n,t||"add")},as=async function(t){if(!t)return;if(c(this,H,Ie).childElementCount===1){c(this,H,zn).classList.add("active"),c(this,H,zn).textContent="1 row required.";return}const n=t.previousElementSibling,r=t.nextElementSibling;await M(this,H,Pe).call(this,t,"delete",r),n&&(M(this,H,ae).call(this,n).start.restrictStartInput(),M(this,H,ae).call(this,n).end.restrictStartInput()),r&&(M(this,H,ae).call(this,r).start.restrictStartInput(),M(this,H,ae).call(this,r).end.restrictStartInput()),c(this,H,Ie).setAttribute("update-state","true")},ss=function(t){const{index:n,start:r,end:a,country:s,city:o}=t,d=M(this,H,Gr).call(this,n),h=d.querySelector('[data-pdc="location-row-number"]'),v=d.querySelector('[data-pdc="location-row-summary-dates"]'),b=d.querySelector('[data-pdc="location-row-summary-countrycity"]');if(!(h&&v&&b))throw new Error("Failed to render row summary elements.");const _=(n+1).toString().padStart(2,"0"),p=r?`${Re(r)}/${Yn(r)}/${bn(r)}`:" ",m=a?` to ${Re(a)}/${Yn(a)}/${bn(a)}`:" ",f=o&&s?`${o} (${s})`:" ";h.textContent=_,v.textContent=p+m,b.textContent=f},os=function(t,n){Object.values(M(this,H,ae).call(this,t)).forEach(r=>r.isEnabled&&r.enableTabIndex(n))},ls=function(){var t;c(this,H,xe).forEach(n=>{Object.values(M(this,H,ae).call(this,n)).forEach(r=>r.isEnabled&&r.enableTabIndex(!1),M(this,H,ke).call(this,n).deleteBtn.setAttribute("tabindex","-1"))}),(t=c(this,H,fn).calculateExpenses.querySelector("pdc-button"))==null||t.enableTabIndex(!1),[c(this,H,fn).addRow.querySelector("button"),...c(this,H,fn).expenseCategory.querySelectorAll("label")].forEach(n=>n&&n.setAttribute("tabindex","-1"))},cs=function(){c(this,H,zn).classList.remove("active")},Pe=async function(t,n=null,r=null){var a;if(!(!t||!c(this,sn)||t.classList.contains("toggling"))){if(!n){const s=window.screen.width>=se||t.offsetHeight===ze?"open":"close";M(this,H,Pe).call(this,t,s);return}M(this,H,cs).call(this),t.classList.remove("pdc-row-open","pdc-row-close","pdc-row-initial"),t.classList.add("toggling",`pdc-row-${n}`),(n==="initial"||n==="add")&&(c(this,_n).call(this,t),c(this,on).call(this,t)),await hr(0),M(this,H,ls).call(this),(n==="open"||n==="initial"||n==="add")&&(t.style.height=M(this,H,ke).call(this,t).details.offsetHeight+"px",M(this,H,ke).call(this,t).contents.style.height=M(this,H,ke).call(this,t).details.offsetHeight+"px",await M(this,H,ti).call(this,t,"open")),n==="close"&&(await M(this,H,ti).call(this,t,"close"),t.style.height=ze+"px",M(this,H,ke).call(this,t).contents.style.height=ze+"px"),n==="delete"&&(t.style.height="0px",await M(this,H,ds).call(this,t,r)),n!=="delete"&&(t.classList.remove("ring-transparent"),t.classList.add("ring-neutral-200")),window.screen.width>=se?c(this,H,xe).forEach(s=>{var o,d;(d=(o=s.querySelector('[data-pdc="location-row-sidebar"]'))==null?void 0:o.querySelector('[data-pdc="delete-row"]'))==null||d.setAttribute("tabindex","0")}):c(this,H,xe).forEach(s=>{var o,d;(d=(o=s.querySelector('[data-pdc="location-row-sidebar"]'))==null?void 0:o.querySelector('[data-pdc="delete-row"]'))==null||d.setAttribute("tabindex","-1")}),t.classList.remove("toggling"),(a=c(this,H,fn).calculateExpenses.querySelector("pdc-button"))==null||a.enableTabIndex(!0),[M(this,H,ke).call(this,t).deleteBtn,c(this,H,fn).addRow.querySelector("button"),...c(this,H,fn).expenseCategory.querySelectorAll("label")].forEach(s=>s&&s.setAttribute("tabindex","0"))}},ti=async function(t,n){const{details:r,summary:a,deleteBtn:s}=M(this,H,ke).call(this,t);M(this,H,os).call(this,t,n==="open"),n==="open"?r.removeAttribute("inert"):r.setAttribute("inert",""),[a,s].forEach(o=>o.style.opacity=n==="open"?"0":"100"),r.style.opacity=n==="open"?"100":"0",r.style.transform=n==="open"?"translateX(100%)":"translateX(0%)",a.style.transform=n==="open"?"translateY(-200%)":"translateY(0%)",s.style.transform=n==="open"?"translateX(200%)":"translateX(0%)"},ds=async function(t,n=null){if(t.classList.remove("ring-neutral-300"),t.classList.add("ring-transparent"),await hr(ni),t.remove(),n){const r=M(this,H,Xr).call(this,n);[...c(this,H,xe)].filter((a,s)=>s>=r).map(a=>{c(this,on).call(this,a),c(this,_n).call(this,a)})}},Ar=new WeakMap,_n=new WeakMap,Dr=new WeakMap,Tr=new WeakMap,Qn=new WeakMap,us=function(){const t=M(this,H,ae).call(this,c(this,H,xe)[0]).start.pdcValue,n=M(this,H,ae).call(this,c(this,H,xe)[c(this,H,xe).length-1]).end.pdcValue;if(t&&n){const r=new Date(t),a=new Date(n),s=Math.abs(a.getTime()-r.getTime());return!(Math.ceil(s/vs)>ws)}return!1},hs=function(t,n,r,a,s,o){const h=ur(b=>{b.forEach(_=>{const p=_.attributeName;if(!(p&&_.target instanceof Element))return;const m=_.target,f=m.getAttribute(p);if(p==="validate"&&f){const w=o();r(w);return}if(p==="update-state"&&f){const w=s();n(w);return}if(mn(Ti,p)){const w=a(m);t(w,p,f);return}})}),v=new MutationObserver(h);this.shadowRoot&&v.observe(this.shadowRoot,{subtree:!0,attributeFilter:["update-state","validate",...Ti]})},on=new WeakMap,Or=new WeakMap,Cr=new WeakMap,fs=function(t){const{start:n,end:r,category:a,country:s,city:o}=M(this,H,ae).call(this,t);n.restrictStartInput(),r.restrictEndInput(),r.pdcValue||(a.enable(!1),s.enable(!1),o.enable(!1))},ps=function(t){const{start:n,end:r,category:a,country:s,city:o}=M(this,H,ae).call(this,t);s.enable(!1),o.enable(!1),n.restrictStartInput(),r.restrictEndInput(),a.enable(!0)},ms=function(t){const{country:n,city:r}=M(this,H,ae).call(this,t);r.enable(!1),n.enable(!0)},customElements.define("pdc-expense-view",ha),customElements.define("pdc-location-view",ga);class P1{constructor(e,t=null){ot(this,dn);ot(this,xn);ot(this,ln);ot(this,Pt);ot(this,Yt);ot(this,kn);ot(this,cn);ot(this,Fr,async e=>{c(this,Yt).renderEmtpy(),Yo(e);const t=e[e.length-1],{index:n,start:r,end:a,category:s,country:o,city:d}=t;!d&&o&&(c(this,Pt).restrictRow(n,"country"),await c(this,qe).call(this,t)),!o&&s&&(c(this,Pt).restrictRow(n,"category"),await c(this,qe).call(this,t)),!a&&r&&c(this,Pt).restrictRow(n,"end"),r&&!a&&c(this,Pt).restrictRow(n,"start")});ot(this,Ir,async(e,t,n)=>{const{index:r,start:a,end:s,category:o,country:d,city:h}=e;c(this,Yt).renderEmtpy(),Vo(e);let v,b;switch(!0){case(!n&&!!d&&!!o&&!!s&&!!a):c(this,Pt).restrictRow(r,"country"),await c(this,qe).call(this,e);return;case(!n&&!!o&&!!s&&!!a):c(this,Pt).restrictRow(r,"category"),await c(this,qe).call(this,e);return;case(!n&&!!s&&!!a):c(this,Pt).restrictRow(r,"end");return;case!n:c(this,Pt).restrictRow(r,"start");return;case((t==="start"||t==="end")&&!!a&&!!s&&!!o&&!!d&&!!h):if(v=new Date(a),b=new Date(s),v<=b)return;c(this,Pt).restrictRow(r,t);return;default:c(this,Pt).restrictRow(r,t),(t==="category"||t==="country")&&await c(this,qe).call(this,e);return}});ot(this,qe,async e=>{const{index:t}=e,n=e.country?"city":"country",r=await qo(e);c(this,Pt).createOptions(t,r,n)});ot(this,zr,e=>{c(this,Yt).renderEmtpy(),e.valid&&Wo()&&M(this,dn,gs).call(this,e)});ot(this,Rr,e=>{const{date:t,newRowMieTotal:n,totalMie:r,totalLodging:a}=Xo(e);c(this,Yt).updateRowMie(t,n,r,a),c(this,Yt).emptyExpenseTable(),M(this,dn,ei).call(this)});ot(this,Mr,()=>{c(this,Yt).createExpenseTable(Oi())});ht(this,xn,e),ht(this,ln,Bs(t)),ht(this,kn,c(this,ln).styled),ht(this,Pt,new ga(c(this,kn),c(this,ln).location)),ht(this,Yt,new ha),c(this,Pt).controllerHandler(c(this,Ir),c(this,Fr),c(this,zr)),ht(this,cn,new EventTarget),c(this,xn).insertAdjacentElement("afterbegin",c(this,Pt)),c(this,xn).insertAdjacentElement("beforeend",c(this,Yt))}addEventListener(e,t){c(this,cn).addEventListener(e,t)}removeEventListener(e,t){c(this,cn).removeEventListener(e,t)}}xn=new WeakMap,ln=new WeakMap,Pt=new WeakMap,Yt=new WeakMap,kn=new WeakMap,cn=new WeakMap,dn=new WeakSet,ei=function(){const e=new CustomEvent("expenseUpdate",{detail:{data:Oi()}});c(this,cn).dispatchEvent(e)},Fr=new WeakMap,Ir=new WeakMap,qe=new WeakMap,zr=new WeakMap,gs=async function(e){try{c(this,Yt).render(c(this,kn),c(this,ln).expense),c(this,Yt).renderLoadingSpinner(!0),c(this,Yt).controllerHandler(c(this,Rr),c(this,Mr));const t=await Go(e);await c(this,Yt).addRows(t,e.expensesCategory),c(this,Yt).renderLoadingSpinner(!1),M(this,dn,ei).call(this)}catch(t){console.error(t)}},Rr=new WeakMap,Mr=new WeakMap,wt.Pdc=P1,Object.defineProperty(wt,Symbol.toStringTag,{value:"Module"})});
1511
+ `;customElements.define("pdc-location-date",da),customElements.define("pdc-location-category",Ri),customElements.define("pdc-location-select",la),customElements.define("pdc-button",N1);const A0=document.createElement("template"),ma=document.createElement("template");class ga extends HTMLElement{constructor(t,n){super();ot(this,H);ot(this,sn);ot(this,Ae,!1);ot(this,Lr,t=>{var a,s;const n=(a=this.shadowRoot)==null?void 0:a.querySelector("#heading"),r=(s=this.shadowRoot)==null?void 0:s.querySelector("#body");n&&t.heading?(n.innerHTML="",n.insertAdjacentHTML("beforeend",t.heading)):n==null||n.remove(),r&&t.body?(r.innerHTML="",r.insertAdjacentHTML("beforeend",t.body)):r==null||r.remove()});ot(this,Ar,()=>{[...c(this,H,xe)].forEach(t=>{window.innerWidth<se&&t.offsetHeight===ze||(c(this,_n).call(this,t),t.style.height=M(this,H,ke).call(this,t).details.scrollHeight+"px",M(this,H,ke).call(this,t).contents.style.height=M(this,H,ke).call(this,t).details.scrollHeight+"px",window.innerWidth>=se&&M(this,H,Pe).call(this,t,"open"))})});ot(this,_n,t=>{const n=M(this,H,Xr).call(this,t),r=n%2===0?"neutral-50":"white",a=r==="neutral-50"?"white":"neutral-50";t.classList.remove("bg-white","bg-neutral-50"),t.classList.add(`bg-${r}`),t.style.zIndex=n.toString(),Object.values(M(this,H,ae).call(this,t)).forEach((s,o)=>{window.innerWidth<se?s.setAttribute("bg",o%2===0?r:a):s.setAttribute("bg",r)})});ot(this,Dr,()=>{const t=c(this,H,Ie).querySelectorAll("pdc-location-date"),n=c(this,H,Ie).querySelectorAll("pdc-location-category"),r=c(this,H,Ie).querySelectorAll("pdc-location-select");return[...t,...n,...r]});ot(this,Tr,t=>{if(!t.validate()){const n=t.closest('[data-pdc="location-row"]');n!=null&&n.classList.contains("pdc-row-close")&&M(this,H,Pe).call(this,n,"open")}return t.validate()});ot(this,Qn,(t=null)=>{const n=c(this,Dr).call(this);if(ht(this,Ae,n.every(r=>c(this,Tr).call(this,r))),c(this,Ae)&&t){if(!M(this,H,us).call(this))return c(this,H,zn).textContent="Trip length must be < 6 months",c(this,H,zn).classList.add("active"),ht(this,Ae,!1),c(this,Ae);c(this,H,Ie).setAttribute("validate",`${c(this,Ae)}`)}return c(this,Ae)});ot(this,on,t=>{const n=t.closest('[data-pdc="location-row"]');if(!n)throw new Error("Failed to get row.");const r=_=>{var p;return(p=n.querySelector(`[pdc="${_}"]`))==null?void 0:p.pdcValue},a=M(this,H,Xr).call(this,n),s=r("start"),o=r("end"),d=r("category"),h=r("country"),v=r("city"),b={index:a,...s&&le(s)&&{start:s},...o&&le(o)&&{end:o},...(d==="domestic"||d==="intl")&&{category:d},...h&&{country:h},...v&&{city:v}};return M(this,H,ss).call(this,b),b});ot(this,Or,()=>{const t=[...c(this,H,xe)].map(n=>c(this,on).call(this,n));return this.removeAttribute("update-state"),t});ot(this,Cr,()=>{var r,a;this.removeAttribute("validate"),window.innerWidth<se&&c(this,H,xe).forEach(s=>M(this,H,Pe).call(this,s,"close"));const t=(a=(r=this.shadowRoot)==null?void 0:r.querySelector('input[name="expenses-category"]:checked'))==null?void 0:a.value,n=t==="mie"||t==="lodging"?t:"both";return{valid:c(this,Ae),expensesCategory:n}});this.attachShadow({mode:"open"}),ht(this,sn,t),c(this,sn)?(A0.innerHTML=fa,Ze(c(this,H,Rn))):A0.innerHTML=$e(fa),c(this,H,Rn).appendChild(A0.content.cloneNode(!0)),c(this,Lr).call(this,n),M(this,H,is).call(this),M(this,H,Q0).call(this,"initial")}createOptions(t,n,r){const s=M(this,H,Gr).call(this,t).querySelector(`[pdc="${r}"]`);s==null||s.setOptions(n)}controllerHandler(t,n,r){M(this,H,hs).call(this,t,n,r,c(this,on),c(this,Or),c(this,Cr))}async restrictRow(t,n){const r=M(this,H,Gr).call(this,t);switch(n){case"city":window.innerWidth<se&&(await hr(Ft),M(this,H,Pe).call(this,r,"close"));return;case"country":M(this,H,ae).call(this,r).city.enable(!0);return;case"category":M(this,H,ms).call(this,r);return;case"end":M(this,H,ps).call(this,r);return;case"start":M(this,H,fs).call(this,r);return}}}sn=new WeakMap,Ae=new WeakMap,Lr=new WeakMap,H=new WeakSet,is=function(){var s;const t=(s=this.shadowRoot)==null?void 0:s.querySelector("#view-container");let n=0,r=0;t==null||t.addEventListener("pointerdown",o=>{if(!(o instanceof PointerEvent))return;const d=Bn(o);n=d.pointerStartX,r=d.pointerStartY}),t==null||t.addEventListener("pointerup",o=>{if(o instanceof PointerEvent){const d=Un(o,M(this,H,J0).bind(this),n,r);n=d.pointerStartX,r=d.pointerStartY}}),t==null||t.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&M(this,H,J0).call(this,o)});const a=ur(c(this,Ar).bind(this));window.addEventListener("resize",a)},J0=function(t){var o;const n=t.target;if(!(n instanceof SVGElement||n instanceof HTMLElement))return;const r=n.closest("button"),a=n.closest("pdc-button"),s=n.closest('[data-pdc="location-row"]');switch(!0){case(r==null?void 0:r.getAttribute("id"))==="add-row":M(this,H,Q0).call(this);return;case(r==null?void 0:r.dataset.pdc)==="delete-row":M(this,H,as).call(this,s);return;case(a==null?void 0:a.getAttribute("id"))==="calculate-expenses":c(this,Qn).call(this,"calculate");return;case!!n.closest('[data-pdc="location-row-toggle"]'):M(this,H,Pe).call(this,s);return;case(!!n.closest("#expense-category")&&t instanceof KeyboardEvent&&n instanceof HTMLLabelElement):n.click();return;case!!n.closest("#error"):(o=n.closest("#error"))==null||o.classList.remove("active");return;default:return}},Ie=function(){const t=c(this,H,Rn).querySelector("#rows");if(!t)throw new Error("Failed to render rows container for location View.");return t},xe=function(){const t=c(this,H,Rn).querySelectorAll('[data-pdc="location-row"]');if(!t)throw new Error("Failed to render row elements for location View.");return t},Gr=function(t){const n=c(this,H,Ie).children[t];if(!(n instanceof HTMLElement))throw new Error(`Failed to get row using row index of ${t} in Location view.`);return n},ae=function(t){const n=t.querySelector('[pdc="start"]'),r=t.querySelector('[pdc="end"]'),a=t.querySelector('[pdc="category"]'),s=t.querySelector('[pdc="country"]'),o=t.querySelector('[pdc="city"]');if(!(n&&r&&a&&s&&o))throw new Error("Failed to render row custom elements.");return{start:n,end:r,category:a,country:s,city:o}},ke=function(t){var o;const n=t.querySelector('[data-pdc="location-row-summary"]'),r=(o=n==null?void 0:n.parentElement)==null?void 0:o.querySelector('button[data-pdc="delete-row"]'),a=t.querySelector('[data-pdc="location-row-contents"]'),s=t.querySelector('[data-pdc="location-row-details"]');if(!(r&&n&&a&&s))throw new Error("Failed to render row summary elements.");return{deleteBtn:r,summary:n,contents:a,details:s}},fn=function(){var a,s,o,d,h;const t=(s=(a=this.shadowRoot)==null?void 0:a.querySelector("#add-row"))==null?void 0:s.closest("div"),n=(o=this.shadowRoot)==null?void 0:o.querySelector("#expense-category"),r=(h=(d=this.shadowRoot)==null?void 0:d.querySelector("#calculate-expenses"))==null?void 0:h.closest("div");if(!(t&&n&&r))throw new Error("Failed to render buttons for location View.");return{addRow:t,expenseCategory:n,calculateExpenses:r}},zn=function(){const t=c(this,H,Rn).querySelector("#error");if(!t)throw new Error("Failed to render row summary elements.");return t},Rn=function(){if(!this.shadowRoot)throw new Error("Failed to render ShadowRoot for location View.");return this.shadowRoot},Xr=function(t){if(!t.parentNode)throw new Error("Failed to get row index in Location View.");return Array.from(t.parentNode.querySelectorAll('[data-pdc="location-row"]')).indexOf(t)},Q0=function(t=null){if(!c(this,Qn).call(this))return;ma.innerHTML=c(this,sn)?pa:$e(pa),c(this,H,Ie).appendChild(ma.content.cloneNode(!0));const n=c(this,H,Ie).lastElementChild;if(!(n instanceof HTMLElement))throw new Error("Failed to render new row");M(this,H,Pe).call(this,n,t||"add")},as=async function(t){if(!t)return;if(c(this,H,Ie).childElementCount===1){c(this,H,zn).classList.add("active"),c(this,H,zn).textContent="1 row required.";return}const n=t.previousElementSibling,r=t.nextElementSibling;await M(this,H,Pe).call(this,t,"delete",r),n&&(M(this,H,ae).call(this,n).start.restrictStartInput(),M(this,H,ae).call(this,n).end.restrictStartInput()),r&&(M(this,H,ae).call(this,r).start.restrictStartInput(),M(this,H,ae).call(this,r).end.restrictStartInput()),c(this,H,Ie).setAttribute("update-state","true")},ss=function(t){const{index:n,start:r,end:a,country:s,city:o}=t,d=M(this,H,Gr).call(this,n),h=d.querySelector('[data-pdc="location-row-number"]'),v=d.querySelector('[data-pdc="location-row-summary-dates"]'),b=d.querySelector('[data-pdc="location-row-summary-countrycity"]');if(!(h&&v&&b))throw new Error("Failed to render row summary elements.");const _=(n+1).toString().padStart(2,"0"),p=r?`${Re(r)}/${Yn(r)}/${bn(r)}`:" ",m=a?` to ${Re(a)}/${Yn(a)}/${bn(a)}`:" ",f=o&&s?`${o} (${s})`:" ";h.textContent=_,v.textContent=p+m,b.textContent=f},os=function(t,n){Object.values(M(this,H,ae).call(this,t)).forEach(r=>r.isEnabled&&r.enableTabIndex(n))},ls=function(){var t;c(this,H,xe).forEach(n=>{Object.values(M(this,H,ae).call(this,n)).forEach(r=>r.isEnabled&&r.enableTabIndex(!1),M(this,H,ke).call(this,n).deleteBtn.setAttribute("tabindex","-1"))}),(t=c(this,H,fn).calculateExpenses.querySelector("pdc-button"))==null||t.enableTabIndex(!1),[c(this,H,fn).addRow.querySelector("button"),...c(this,H,fn).expenseCategory.querySelectorAll("label")].forEach(n=>n&&n.setAttribute("tabindex","-1"))},cs=function(){c(this,H,zn).classList.remove("active")},Pe=async function(t,n=null,r=null){var a;if(!(!t||!c(this,sn)||t.classList.contains("toggling"))){if(!n){const s=window.innerWidth>=se||t.offsetHeight===ze?"open":"close";M(this,H,Pe).call(this,t,s);return}M(this,H,cs).call(this),t.classList.remove("pdc-row-open","pdc-row-close","pdc-row-initial"),t.classList.add("toggling",`pdc-row-${n}`),(n==="initial"||n==="add")&&(c(this,_n).call(this,t),c(this,on).call(this,t)),await hr(0),M(this,H,ls).call(this),(n==="open"||n==="initial"||n==="add")&&(t.style.height=M(this,H,ke).call(this,t).details.offsetHeight+"px",M(this,H,ke).call(this,t).contents.style.height=M(this,H,ke).call(this,t).details.offsetHeight+"px",await M(this,H,ti).call(this,t,"open")),n==="close"&&(await M(this,H,ti).call(this,t,"close"),t.style.height=ze+"px",M(this,H,ke).call(this,t).contents.style.height=ze+"px"),n==="delete"&&(t.style.height="0px",await M(this,H,ds).call(this,t,r)),n!=="delete"&&(t.classList.remove("ring-transparent"),t.classList.add("ring-neutral-200")),window.innerWidth>=se?c(this,H,xe).forEach(s=>{var o,d;(d=(o=s.querySelector('[data-pdc="location-row-sidebar"]'))==null?void 0:o.querySelector('[data-pdc="delete-row"]'))==null||d.setAttribute("tabindex","0")}):c(this,H,xe).forEach(s=>{var o,d;(d=(o=s.querySelector('[data-pdc="location-row-sidebar"]'))==null?void 0:o.querySelector('[data-pdc="delete-row"]'))==null||d.setAttribute("tabindex","-1")}),t.classList.remove("toggling"),(a=c(this,H,fn).calculateExpenses.querySelector("pdc-button"))==null||a.enableTabIndex(!0),[M(this,H,ke).call(this,t).deleteBtn,c(this,H,fn).addRow.querySelector("button"),...c(this,H,fn).expenseCategory.querySelectorAll("label")].forEach(s=>s&&s.setAttribute("tabindex","0"))}},ti=async function(t,n){const{details:r,summary:a,deleteBtn:s}=M(this,H,ke).call(this,t);M(this,H,os).call(this,t,n==="open"),n==="open"?r.removeAttribute("inert"):r.setAttribute("inert",""),[a,s].forEach(o=>o.style.opacity=n==="open"?"0":"100"),r.style.opacity=n==="open"?"100":"0",r.style.transform=n==="open"?"translateX(100%)":"translateX(0%)",a.style.transform=n==="open"?"translateY(-200%)":"translateY(0%)",s.style.transform=n==="open"?"translateX(200%)":"translateX(0%)"},ds=async function(t,n=null){if(t.classList.remove("ring-neutral-300"),t.classList.add("ring-transparent"),await hr(ni),t.remove(),n){const r=M(this,H,Xr).call(this,n);[...c(this,H,xe)].filter((a,s)=>s>=r).map(a=>{c(this,on).call(this,a),c(this,_n).call(this,a)})}},Ar=new WeakMap,_n=new WeakMap,Dr=new WeakMap,Tr=new WeakMap,Qn=new WeakMap,us=function(){const t=M(this,H,ae).call(this,c(this,H,xe)[0]).start.pdcValue,n=M(this,H,ae).call(this,c(this,H,xe)[c(this,H,xe).length-1]).end.pdcValue;if(t&&n){const r=new Date(t),a=new Date(n),s=Math.abs(a.getTime()-r.getTime());return!(Math.ceil(s/vs)>ws)}return!1},hs=function(t,n,r,a,s,o){const h=ur(b=>{b.forEach(_=>{const p=_.attributeName;if(!(p&&_.target instanceof Element))return;const m=_.target,f=m.getAttribute(p);if(p==="validate"&&f){const w=o();r(w);return}if(p==="update-state"&&f){const w=s();n(w);return}if(mn(Ti,p)){const w=a(m);t(w,p,f);return}})}),v=new MutationObserver(h);this.shadowRoot&&v.observe(this.shadowRoot,{subtree:!0,attributeFilter:["update-state","validate",...Ti]})},on=new WeakMap,Or=new WeakMap,Cr=new WeakMap,fs=function(t){const{start:n,end:r,category:a,country:s,city:o}=M(this,H,ae).call(this,t);n.restrictStartInput(),r.restrictEndInput(),r.pdcValue||(a.enable(!1),s.enable(!1),o.enable(!1))},ps=function(t){const{start:n,end:r,category:a,country:s,city:o}=M(this,H,ae).call(this,t);s.enable(!1),o.enable(!1),n.restrictStartInput(),r.restrictEndInput(),a.enable(!0)},ms=function(t){const{country:n,city:r}=M(this,H,ae).call(this,t);r.enable(!1),n.enable(!0)},customElements.define("pdc-expense-view",ha),customElements.define("pdc-location-view",ga);class P1{constructor(e,t=null){ot(this,dn);ot(this,xn);ot(this,ln);ot(this,Pt);ot(this,Yt);ot(this,kn);ot(this,cn);ot(this,Fr,async e=>{c(this,Yt).renderEmtpy(),Yo(e);const t=e[e.length-1],{index:n,start:r,end:a,category:s,country:o,city:d}=t;!d&&o&&(c(this,Pt).restrictRow(n,"country"),await c(this,qe).call(this,t)),!o&&s&&(c(this,Pt).restrictRow(n,"category"),await c(this,qe).call(this,t)),!a&&r&&c(this,Pt).restrictRow(n,"end"),r&&!a&&c(this,Pt).restrictRow(n,"start")});ot(this,Ir,async(e,t,n)=>{const{index:r,start:a,end:s,category:o,country:d,city:h}=e;c(this,Yt).renderEmtpy(),Vo(e);let v,b;switch(!0){case(!n&&!!d&&!!o&&!!s&&!!a):c(this,Pt).restrictRow(r,"country"),await c(this,qe).call(this,e);return;case(!n&&!!o&&!!s&&!!a):c(this,Pt).restrictRow(r,"category"),await c(this,qe).call(this,e);return;case(!n&&!!s&&!!a):c(this,Pt).restrictRow(r,"end");return;case!n:c(this,Pt).restrictRow(r,"start");return;case((t==="start"||t==="end")&&!!a&&!!s&&!!o&&!!d&&!!h):if(v=new Date(a),b=new Date(s),v<=b)return;c(this,Pt).restrictRow(r,t);return;default:c(this,Pt).restrictRow(r,t),(t==="category"||t==="country")&&await c(this,qe).call(this,e);return}});ot(this,qe,async e=>{const{index:t}=e,n=e.country?"city":"country",r=await qo(e);c(this,Pt).createOptions(t,r,n)});ot(this,zr,e=>{c(this,Yt).renderEmtpy(),e.valid&&Wo()&&M(this,dn,gs).call(this,e)});ot(this,Rr,e=>{const{date:t,newRowMieTotal:n,totalMie:r,totalLodging:a}=Xo(e);c(this,Yt).updateRowMie(t,n,r,a),c(this,Yt).emptyExpenseTable(),M(this,dn,ei).call(this)});ot(this,Mr,()=>{c(this,Yt).createExpenseTable(Oi())});ht(this,xn,e),ht(this,ln,Bs(t)),ht(this,kn,c(this,ln).styled),ht(this,Pt,new ga(c(this,kn),c(this,ln).location)),ht(this,Yt,new ha),c(this,Pt).controllerHandler(c(this,Ir),c(this,Fr),c(this,zr)),ht(this,cn,new EventTarget),c(this,xn).insertAdjacentElement("afterbegin",c(this,Pt)),c(this,xn).insertAdjacentElement("beforeend",c(this,Yt))}addEventListener(e,t){c(this,cn).addEventListener(e,t)}removeEventListener(e,t){c(this,cn).removeEventListener(e,t)}}xn=new WeakMap,ln=new WeakMap,Pt=new WeakMap,Yt=new WeakMap,kn=new WeakMap,cn=new WeakMap,dn=new WeakSet,ei=function(){const e=new CustomEvent("expenseUpdate",{detail:{data:Oi()}});c(this,cn).dispatchEvent(e)},Fr=new WeakMap,Ir=new WeakMap,qe=new WeakMap,zr=new WeakMap,gs=async function(e){try{c(this,Yt).render(c(this,kn),c(this,ln).expense),c(this,Yt).renderLoadingSpinner(!0),c(this,Yt).controllerHandler(c(this,Rr),c(this,Mr));const t=await Go(e);await c(this,Yt).addRows(t,e.expensesCategory),c(this,Yt).renderLoadingSpinner(!1),M(this,dn,ei).call(this)}catch(t){console.error(t)}},Rr=new WeakMap,Mr=new WeakMap,wt.Pdc=P1,Object.defineProperty(wt,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@per-diem-calculator/vanilla",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "author": "Ahmad Dowla <ahmad.dowla@gmail.com>",
5
5
  "description": "Open source per diem calculator for both domestic and international trips. Built in TypeScript with Tailwind. Rates sourced from GSA, State Dept., and DOD.",
6
6
  "license": "MIT",