PageSourceSearch

https://ndscsalumni.com/app/themes/ndscs/assets/build/financial-calculator.block-CJTH0JwQ.js

js ndscsalumni.com collected 2026-10-08 06:42:26 UTC 6,773 bytes, 1 lines download raw bytes

1function y(t){const e=String(t??"").trim().replace(/,/g,"").replace(/[^0-9.-]/g,""),n=parseFloat(e);return isNaN(n)||n<0?0:n}function u(t){return d(t).toLocaleString("en-US",{style:"currency",currency:"USD"})}function G(t){const e=d(t);return e>0?`-${u(e)}`:u(e)}function d(t){return Math.round((Number(t)+Number.EPSILON)*100)/100}function U(t,e){return t.querySelector(`input[name="${e}"]:checked`)}function w(t,e){const n=t.querySelector(`select[name="${e}"]`);if(!n)return"—";const c=n.options[n.selectedIndex];return!c||!c.value?"—":c.value.trim()}function b(t,e){var r;const n=t.querySelector(`select[name="${e}"]`);if(!n)return 0;const c=n.options[n.selectedIndex];return y((r=c==null?void 0:c.dataset)==null?void 0:r.cost)}function j(t){if(!t||t.tagName!=="INPUT")return!1;const e=(t.getAttribute("type")||"text").toLowerCase();return["text","number","email","search","tel","url"].includes(e)}function z(t,e){const n=Array.from(t.querySelectorAll('input:not([type="hidden"]):not([disabled]), button:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(r=>r.hidden||r.closest("[hidden]")||r.closest("ul.hidden")||r.matches(".plus-list, .minus-list")?!1:r.getClientRects().length>0),c=n.indexOf(e);return c===-1?null:n[c+1]||null}function $(t,e){const n=t.querySelector("#fc-form"),c=new FormData(n),r=c.get("tuition")||"",s=y(c.get("credits"));if(!r)throw new Error("Please select your residency status.");if(s<=0)throw new Error("Please enter your semester credit hours.");const o=e.tuition[r]??0,a=e.ndRate,i=U(t,"housing"),l=U(t,"dining"),f=y((i==null?void 0:i.dataset.cost)??c.get("housing")),g=y((l==null?void 0:l.dataset.cost)??c.get("dining")),K=(l==null?void 0:l.dataset.qualifiesForWaiver)==="1",F=o>a&&f>0&&K?(o-a)*s:0,A=d(o*s),P=d(A-F);let h=0;Object.entries(e.campusFees).forEach(([q,p])=>{const m=y(c.get(q)),x=p.max>0?Math.min(m,p.max):m;h+=x*p.rate}),h=d(h);let v=0,S=!1;t.querySelectorAll(".fc-instructional-row").forEach(q=>{var R;const p=q.querySelector('select[name="credit-prefix"]'),m=p==null?void 0:p.options[p.selectedIndex],x=y((m==null?void 0:m.dataset.rate)??""),k=y((R=q.querySelector('input[name="instructional-fee"]'))==null?void 0:R.value);(m==null?void 0:m.dataset.isUnknown)==="1"&&(S=!0),v+=x*k}),v=d(v);const L=S?0:v,W=S?"TBD":u(L),B="",N=y(c.get("textbook-cost")),C=b(t,"tools-equipments"),T=b(t,"laptop"),D=b(t,"others"),_=d(P+h+L+f+g+N),I=d(C+T+D),M=d(_+I),V=d(_*2+I);return{tuitionGross:A,waiverAmount:d(F),perCreditFees:h,instructionalFees:L,instructionalFeesDisplay:W,instructionalFeesStatus:B,instructionalFeesNote:S?"Unknown instructional fees are not included in the total.":"",housing:f,dining:g,books:N,tools:C,toolsLabel:w(t,"tools-equipments"),laptop:T,laptopLabel:w(t,"laptop"),others:D,othersLabel:w(t,"others"),semesterTotal:M,yearTotal:V}}function O(t,e){const n=(r,s)=>{const o=t.querySelector(`#${r}`);o&&(o.textContent=s)},c=(r,s)=>{const o=t.querySelector(`#${r}`);o&&(o.textContent=s||"",o.hidden=!s)};n("fc-tuition",u(e.tuitionGross)),n("fc-tuition-waiver",G(e.waiverAmount)),n("fc-per-credit-fees",u(e.perCreditFees)),n("fc-instructional-fees",e.instructionalFeesDisplay),c("fc-instructional-fees-status",e.instructionalFeesStatus),c("fc-instructional-fees-note",e.instructionalFeesNote),n("fc-tools",u(e.tools)),n("fc-tools-label",e.toolsLabel),n("fc-laptop",u(e.laptop)),n("fc-laptop-label",e.laptopLabel),n("fc-additional-program",u(e.others)),n("fc-additional-program-label",e.othersLabel),n("fc-housing",u(e.housing)),n("fc-dining",u(e.dining)),n("fc-books",u(e.books)),n("fc-semester-total",u(e.semesterTotal)),n("fc-year-total",u(e.yearTotal))}function H(t,e){t.querySelectorAll(".section-calculator__grouped-select").forEach(n=>{if(n.closest(".section-calculator__instructional-fee-rows"))return;const c=n.querySelector("select.custom-calculator-select"),r=n.querySelector("div.custom-calculator-select");if(!c||!r)return;const s=r.querySelector("button"),o=r.querySelector("ul"),a=s==null?void 0:s.querySelector("span");s==null||s.addEventListener("click",i=>{i.preventDefault(),o==null||o.classList.toggle("hidden")}),o==null||o.addEventListener("click",i=>{const l=i.target.closest("a[data-value]");if(!l)return;i.preventDefault();const f=l.dataset.value,g=l.textContent.trim();
1c.value=f,a&&(a.textContent=g),o.classList.add("hidden"),e()})}),document.addEventListener("click",n=>{t.querySelectorAll("div.custom-calculator-select ul:not(.hidden)").forEach(c=>{c.closest("div.custom-calculator-select").contains(n.target)||c.classList.add("hidden")})})}function J(t,e){const n=t.querySelector(".section-calculator__instructional-fee-rows");if(!n)return;const c=n.querySelector(".fc-instructional-row");c&&(n.addEventListener("click",r=>{if(r.target.closest(".plus-list")){r.preventDefault();const s=c.cloneNode(!0);s.querySelectorAll("select").forEach(o=>{o.value=""}),s.querySelectorAll("input").forEach(o=>{o.value=""}),s.querySelectorAll("div.custom-calculator-select button span").forEach(o=>{o.textContent=o.dataset.title||""}),n.appendChild(s),e();return}r.target.closest(".minus-list")&&(r.preventDefault(),n.querySelectorAll(".fc-instructional-row").length>1&&(r.target.closest(".fc-instructional-row").remove(),e()))}),n.addEventListener("click",r=>{var a;const s=r.target.closest("div.custom-calculator-select button");if(!s)return;r.preventDefault();const o=(a=s.closest("div.custom-calculator-select"))==null?void 0:a.querySelector("ul");o==null||o.classList.toggle("hidden")}),n.addEventListener("click",r=>{const s=r.target.closest(".section-calculator__instructional-fee-rows a[data-value]");if(!s)return;r.preventDefault();const o=s.closest(".fc-instructional-row"),a=o==null?void 0:o.querySelector('select[name="credit-prefix"]'),i=o==null?void 0:o.querySelector("div.custom-calculator-select"),l=i==null?void 0:i.querySelector("button span"),f=i==null?void 0:i.querySelector("ul");a&&(a.value=s.dataset.value),l&&(l.textContent=s.textContent.trim()),f==null||f.classList.add("hidden"),e()}))}function Q(t){const e=t.querySelector("#fc-form"),n=t.querySelector("#fc-results");if(!e||!n)return;const c=JSON.parse(t.dataset.calculatorRates||"{}");let r=!1;function s(){if(r)try{const a=$(t,c);O(t,a)}catch{}}function o(a){a.preventDefault();try{const i=$(t,c);O(t,i),r||(n.style.display="block",r=!0),setTimeout(()=>{n.scrollIntoView({behavior:"smooth",block:"start"})},100)}catch(i){alert(i.message)}}e.addEventListener("submit",o),e.addEventListener("input",s),e.addEventListener("change",s),e.addEventListener("keydown",a=>{if(a.key!=="Enter"||a.shiftKey||a.ctrlKey||a.altKey||a.metaKey||!j(a.target))return;const i=z(e,a.target);i&&(a.preventDefault(),i.focus())}),H(t,s),J(t,s)}function Y(t){Q(t)}export{Y as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.