From 041d651c5e55844bd65b8c9ad911b9483fc247be Mon Sep 17 00:00:00 2001 From: Mihai Listov Date: Thu, 4 Apr 2024 11:06:12 -0700 Subject: [PATCH] TASK 3702: Add demographic info text, release 1.1.1 --- assets/application/js/application.js | 2 +- powerpod/package.json | 2 +- powerpod/releases/powerpod-1.1.1.min.js | 479 ++++++++++++++++++ powerpod/rollup.config.js | 2 +- .../js/application/steps/demographicInfo.js | 22 +- powerpod/src/js/powerpod.js | 2 +- 6 files changed, 497 insertions(+), 12 deletions(-) create mode 100644 powerpod/releases/powerpod-1.1.1.min.js diff --git a/assets/application/js/application.js b/assets/application/js/application.js index 5df97aee..672b540d 100644 --- a/assets/application/js/application.js +++ b/assets/application/js/application.js @@ -1,6 +1,6 @@ (function () { const src = - 'https://cdn.jsdelivr.net/gh/bcgov/nr-af-pods@dev/powerpod/releases/powerpod-1.1.0.min.js'; + 'https://cdn.jsdelivr.net/gh/bcgov/nr-af-pods@dev/powerpod/releases/powerpod-1.1.1.min.js'; const script = document.createElement('script'); script.setAttribute('async', ''); script.src = src; diff --git a/powerpod/package.json b/powerpod/package.json index a891ce3f..8f58c947 100644 --- a/powerpod/package.json +++ b/powerpod/package.json @@ -1,7 +1,7 @@ { "name": "powerpod", "type": "module", - "version": "1.1.0", + "version": "1.1.1", "description": "Powerpod is a jQuery plugin that enhances functionality of Power Pages components.", "main": "dist/powerpod", "scripts": { diff --git a/powerpod/releases/powerpod-1.1.1.min.js b/powerpod/releases/powerpod-1.1.1.min.js new file mode 100644 index 00000000..e42f5802 --- /dev/null +++ b/powerpod/releases/powerpod-1.1.1.min.js @@ -0,0 +1,479 @@ +/*! +* powerpod 1.1.0 +* https://github.com/bcgov/nr-af-pods/powerpod +* +* @license GPLv3 for open source use only +* +* Copyright (C) 2024 https://github.com/bcgov/nr-af-pods/powerpod - A project by Mihai Listov +*/ +!function(i,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):(i="undefined"!=typeof globalThis?globalThis:i||self).powerpod=a()}(this,(function(){"use strict";function ownKeys(i,a){var d=Object.keys(i);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(i);a&&(p=p.filter((function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable}))),d.push.apply(d,p)}return d}function _objectSpread2(i){for(var a=1;a=0;--u){var h=this.tryEntries[u],g=h.completion;if("root"===h.tryLoc)return handle("end");if(h.tryLoc<=this.prev){var f=p.call(h,"catchLoc"),m=p.call(h,"finallyLoc");if(f&&m){if(this.prev=0;--d){var u=this.tryEntries[d];if(u.tryLoc<=this.prev&&p.call(u,"finallyLoc")&&this.prev=0;--a){var d=this.tryEntries[a];if(d.finallyLoc===i)return this.complete(d.completion,d.afterLoc),resetTryEntry(d),q}},catch:function(i){for(var a=this.tryEntries.length-1;a>=0;--a){var d=this.tryEntries[a];if(d.tryLoc===i){var p=d.completion;if("throw"===p.type){var u=p.arg;resetTryEntry(d)}return u}}throw new Error("illegal catch attempt")},delegateYield:function(a,d,p){return this.delegate={iterator:values(a),resultName:d,nextLoc:p},"next"===this.method&&(this.arg=i),q}},a}function _typeof(i){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},_typeof(i)}function asyncGeneratorStep(i,a,d,p,u,h,g){try{var f=i[h](g),m=f.value}catch(i){return void d(i)}f.done?a(m):Promise.resolve(m).then(p,u)}function _asyncToGenerator(i){return function(){var a=this,d=arguments;return new Promise((function(p,u){var h=i.apply(a,d);function _next(i){asyncGeneratorStep(h,p,u,_next,_throw,"next",i)}function _throw(i){asyncGeneratorStep(h,p,u,_next,_throw,"throw",i)}_next(void 0)}))}}function _defineProperty(i,a,d){return(a=function _toPropertyKey(i){var a=function _toPrimitive(i,a){if("object"!=typeof i||!i)return i;var d=i[Symbol.toPrimitive];if(void 0!==d){var p=d.call(i,a||"default");if("object"!=typeof p)return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===a?String:Number)(i)}(i,"string");return"symbol"==typeof a?a:String(a)}(a))in i?Object.defineProperty(i,a,{value:d,enumerable:!0,configurable:!0,writable:!0}):i[a]=d,i}function _extends(){return _extends=Object.assign?Object.assign.bind():function(i){for(var a=1;a=0||(u[d]=i[d]);return u}(i,a);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(i);for(p=0;p=0||Object.prototype.propertyIsEnumerable.call(i,d)&&(u[d]=i[d])}return u}function _slicedToArray(i,a){return function _arrayWithHoles(i){if(Array.isArray(i))return i}(i)||function _iterableToArrayLimit(i,a){var d=null==i?null:"undefined"!=typeof Symbol&&i[Symbol.iterator]||i["@@iterator"];if(null!=d){var p,u,h,g,f=[],m=!0,v=!1;try{if(h=(d=d.call(i)).next,0===a){if(Object(d)!==d)return;m=!1}else for(;!(m=(p=h.call(d)).done)&&(f.push(p.value),f.length!==a);m=!0);}catch(i){v=!0,u=i}finally{try{if(!m&&null!=d.return&&(g=d.return(),Object(g)!==g))return}finally{if(v)throw u}}return f}}(i,a)||_unsupportedIterableToArray(i,a)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toConsumableArray(i){return function _arrayWithoutHoles(i){if(Array.isArray(i))return _arrayLikeToArray(i)}(i)||function _iterableToArray(i){if("undefined"!=typeof Symbol&&null!=i[Symbol.iterator]||null!=i["@@iterator"])return Array.from(i)}(i)||_unsupportedIterableToArray(i)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(i,a){if(i){if("string"==typeof i)return _arrayLikeToArray(i,a);var d=Object.prototype.toString.call(i).slice(8,-1);return"Object"===d&&i.constructor&&(d=i.constructor.name),"Map"===d||"Set"===d?Array.from(i):"Arguments"===d||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?_arrayLikeToArray(i,a):void 0}}function _arrayLikeToArray(i,a){(null==a||a>i.length)&&(a=i.length);for(var d=0,p=new Array(a);d0&&void 0!==arguments[0]?arguments[0]:null;return{info:function info(a){var d=a.fn,p=void 0===d?null:d,u=a.message,h=a.data;return log({namespace:i,fn:p,level:E,message:u,data:void 0===h?null:h})},error:function error(a){var d=a.fn,p=void 0===d?null:d,u=a.message,h=a.data;return log({namespace:i,fn:p,level:D,message:u,data:void 0===h?null:h})},warn:function warn(a){var d=a.fn,p=void 0===d?null:d,u=a.message,h=a.data;return log({namespace:i,fn:p,level:F,message:u,data:void 0===h?null:h})}}}function validateDemographicInfoRequiredFields(){var i=validateStepFields("DemographicInfoStep",!0),a=function validateDemographicPercentages(){var i=0,a=0,d=0,p=document.querySelector("#quartech_firstnationssharepercentage"),u=$(p).val(),h=parseFloat(u);i+=!!h&&h;var g=document.querySelector("#quartech_inukinuitsharepercentage"),f=$(g).val(),m=parseFloat(f);i+=!!m&&m;var v=document.querySelector("#quartech_mtissharepercentage"),y=$(v).val(),w=parseFloat(y);i+=!!w&&w;var _=document.querySelector("#quartech_indigenoussharepercentage"),q=$(_).val(),A=parseFloat(q);i+=!!A&&A;var T=document.querySelector("#quartech_womensharepercentage"),O=$(T).val(),E=parseFloat(O);a+=!!E&&E;var F=document.querySelector("#quartech_youth40orundersharepercentage"),D=$(F).val(),j=parseFloat(D);d+=!!j&&j;var z=document.querySelector("#quartech_nonindiginousnonwomennonyouthshare"),B=$(z).val(),U=parseFloat(B);i+=!!U&&U,a+=!!U&&U,d+=!!U&&U;var G=document.querySelector("#quartech_unabletoansweridentifysharepercentage"),Q=$(G).val(),W=parseFloat(Q);a+=!!W&&W,d+=!!W&&W;var J="",K="Please check your answers. The total of shares held by",Y="should NOT add up to more than 100%";return(i+=!!W&&W)>100&&(J+="
".concat(K,' Indigenous owners + Not-Indigenous/Not-Women/Not-Youth + Unable to answer ').concat(Y,"
")),a>100&&(J+="
".concat(K,' Women owners + Not-Indigenous/Not-Women/Not-Youth + Unable to answer ').concat(Y,"
")),d>100&&(J+="
".concat(K,' Youth owners + Not-Indigenous/Not-Women/Not-Youth owners + Unable to answer ').concat(Y,"
")),J}();displayValidationErrors(i=i.concat(a))}_defineProperty(_defineProperty(_defineProperty({},E,10),F,20),D,90);var j=["programId","beforeSend","onSuccess"],z=["programId","beforeSend","onSuccess"],B=["onSuccess"],U=["searchStr","onSuccess"],G=["topicSourceId"],Q=["topicId"],W=Logger("common/fetch");O.fetch={getEnvVarsData:getEnvVarsData,getApplicationFormData:getApplicationFormData,getClaimFormData:getClaimFormData,getMunicipalData:getMunicipalData,getExpenseTypeData:getExpenseTypeData,getOrgbookAutocompleteData:getOrgbookAutocompleteData,getOrgbookTopicData:function getOrgbookTopicData(i){return _getOrgbookTopicData.apply(this,arguments)},getOrgbookCredentialsData:function getOrgbookCredentialsData(i){return _getOrgbookCredentialsData.apply(this,arguments)}};var J={get_env_vars_data:"/_api/environmentvariabledefinitions?$filter=contains(schemaname,'quartech_')&$select=schemaname,environmentvariabledefinitionid&$expand=environmentvariabledefinition_environmentvariablevalue($select=value)",get_application_form_data:function get_application_form_data(i){return"/_api/msgov_programs(".concat(i,")?$select=msgov_programid, quartech_disabledchefsdemographicinfo, msgov_programname, quartech_applicantportalprogramname, quartech_applicantportalprogramstreamjsonconfig, quartech_portalapplicationpagetitle, quartech_portalapplicationpagesubtitle, quartech_portalapplicationpagedescription, quartech_programabbreviation, quartech_programemailaddress, quartech_portalappactivityinfohiddenfields, quartech_portalappprojectdeschiddenfields, quartech_portalappfieldsdisplaynamesmapping, quartech_typesofbusinesstodisplay, quartech_applicantportalapplicationformconfigjson, quartech_activitiestypestodisplay&$expand=quartech_ApplicantPortalConfig($select=quartech_name,quartech_configdata)")},get_claim_form_data:function get_claim_form_data(i){return"/_api/msgov_programs(".concat(i,")?$select=msgov_programid, msgov_programname, quartech_applicantportalprogramname, quartech_claimformheaderhtmlcontent, quartech_applicantportalclaimformjson, quartech_applicantportalprogramstreamjsonconfig, quartech_portalapplicationpagetitle, quartech_portalapplicationpagesubtitle, quartech_portalapplicationpagedescription, quartech_programabbreviation, quartech_programemailaddress, quartech_portalappactivityinfohiddenfields, quartech_portalappprojectdeschiddenfields, quartech_portalappfieldsdisplaynamesmapping, quartech_typesofbusinesstodisplay, quartech_applicantportalapplicationformconfigjson, quartech_activitiestypestodisplay&$expand=quartech_ApplicantPortalConfig($select=quartech_name,quartech_configdata)")},get_municipal_data:"/_api/quartech_municipals?$select=quartech_name,quartech_municipalid&$expand=quartech_RegionalDistrict($select=quartech_name,quartech_regionaldistrictid,_quartech_censusofagricultureregion_value)",get_expense_type_data:"/_api/quartech_expensetypes?$select=quartech_expensetypeid,quartech_expensetype",get_orgbook_autocomplete_data:"https://orgbook.gov.bc.ca/api/v3/search/autocomplete",get_orgbook_topic_data:"https://orgbook.gov.bc.ca/api/v4/search/topic",get_orgbook_credentials_data:function get_orgbook_credentials_data(i){return"https://orgbook.gov.bc.ca/api/v4/topic/".concat(i,"/credential-set")}},K={json:"application/json; charset=utf-8"},Y={json:"json"},Z=function setODataHeaders(i){i.setRequestHeader("Accept","application/json"),i.setRequestHeader("OData-MaxVersion","4.0"),i.setRequestHeader("OData-Version","4.0"),i.setRequestHeader("Prefer",'odata.include-annotations="*"')},X={};function fetch(i){return _fetch.apply(this,arguments)}function _fetch(){return(_fetch=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(i){var a,d,p,u,h,g,f,m,v,y,w,_,q,A,T,O,E,F,D,j,z,B,U;return _regeneratorRuntime().wrap((function _callee$(G){for(;;)switch(G.prev=G.next){case 0:if(a=i.method,d=void 0===a?"GET":a,p=i.url,u=i.beforeSend,h=i.onSuccess,g=i.onError,f=i.async,m=void 0===f||f,v=i.data,y=void 0===v?{}:v,w=i.datatype,_=i.contentType,q=i.includeODataHeaders,A=void 0!==q&&q,T=i.skipCache,O=void 0!==T&&T,E=i.returnData,F=void 0!==E&&E,D=JSON.stringify(i),O||!X[D]){G.next=8;break}if(j=X[D],z=j.data,B=j.textStatus,U=j.xhr,W.info({fn:fetch,message:"returning cached data for url: ".concat(p),data:{data:z,params:i}}),!F){G.next=7;break}return G.abrupt("return",Promise.resolve(z));case 7:return G.abrupt("return",Promise.resolve(h(z,B,U)));case 8:return G.abrupt("return",$.ajax({method:d,url:p,contentType:_,datatype:w,data:y,async:m,beforeSend:function beforeSend(i){A&&Z(i),u&&"function"==typeof u&&u()},success:function success(a,d,u){O||(X[D]={data:a,textStatus:d,xhr:u}),F?W.info({fn:fetch,message:"skipping onSuccess handler call: ".concat(p),data:{data:a,params:i}}):h&&"function"==typeof h&&h(a,d,u)},error:function error(i,a,d){W.error({fn:fetch,message:null==i?void 0:i.responseText,data:{xhr:i,textStatus:a,errorThrown:d}}),g&&"function"==typeof g&&g(i,a,d)}}).then((function(a){if(F&&a)return W.info({fn:fetch,message:"returning data for url: ".concat(p),data:{data:a,params:i}}),Promise.resolve(a)})));case 9:case"end":return G.stop()}}),_callee)})))).apply(this,arguments)}function getEnvVarsData(){return _getEnvVarsData.apply(this,arguments)}function _getEnvVarsData(){return _getEnvVarsData=_asyncToGenerator(_regeneratorRuntime().mark((function _callee2(){var i,a,d=arguments;return _regeneratorRuntime().wrap((function _callee2$(p){for(;;)switch(p.prev=p.next){case 0:return a=_extends({},(_objectDestructuringEmpty(i=d.length>0&&void 0!==d[0]?d[0]:{}),i)),p.abrupt("return",fetch(_objectSpread2({url:J.get_env_vars_data,contentType:K.json,datatype:Y.json,includeODataHeaders:!0,async:!1,returnData:!0},a)));case 2:case"end":return p.stop()}}),_callee2)}))),_getEnvVarsData.apply(this,arguments)}function getApplicationFormData(i){return _getApplicationFormData.apply(this,arguments)}function _getApplicationFormData(){return(_getApplicationFormData=_asyncToGenerator(_regeneratorRuntime().mark((function _callee3(i){var a,d,p,u;return _regeneratorRuntime().wrap((function _callee3$(h){for(;;)switch(h.prev=h.next){case 0:return a=i.programId,d=i.beforeSend,p=i.onSuccess,u=_objectWithoutProperties(i,j),h.abrupt("return",fetch(_objectSpread2({url:J.get_application_form_data(a),contentType:K.json,datatype:Y.json,includeODataHeaders:!0,async:!1,beforeSend:d,onSuccess:p},u)));case 2:case"end":return h.stop()}}),_callee3)})))).apply(this,arguments)}function getClaimFormData(i){return _getClaimFormData.apply(this,arguments)}function _getClaimFormData(){return(_getClaimFormData=_asyncToGenerator(_regeneratorRuntime().mark((function _callee4(i){var a,d,p,u;return _regeneratorRuntime().wrap((function _callee4$(h){for(;;)switch(h.prev=h.next){case 0:if(a=i.programId,d=i.beforeSend,p=i.onSuccess,u=_objectWithoutProperties(i,z),a){h.next=4;break}return W.error({fn:getClaimFormData,message:"Missing required params",data:{programId:a}}),h.abrupt("return");case 4:return h.abrupt("return",fetch(_objectSpread2({url:J.get_claim_form_data(a),contentType:K.json,datatype:Y.json,includeODataHeaders:!0,async:!1,beforeSend:d,onSuccess:p},u)));case 5:case"end":return h.stop()}}),_callee4)})))).apply(this,arguments)}function getMunicipalData(i){return _getMunicipalData.apply(this,arguments)}function _getMunicipalData(){return(_getMunicipalData=_asyncToGenerator(_regeneratorRuntime().mark((function _callee5(i){var a,d,p;return _regeneratorRuntime().wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:return a=i.onSuccess,d=void 0===a?null:a,p=_objectWithoutProperties(i,B),u.abrupt("return",fetch(_objectSpread2({url:J.get_municipal_data,contentType:K.json,datatype:Y.json,includeODataHeaders:!0,async:!1,onSuccess:d},p)));case 2:case"end":return u.stop()}}),_callee5)})))).apply(this,arguments)}function getExpenseTypeData(){return _getExpenseTypeData.apply(this,arguments)}function _getExpenseTypeData(){return _getExpenseTypeData=_asyncToGenerator(_regeneratorRuntime().mark((function _callee6(){var i,a,d=arguments;return _regeneratorRuntime().wrap((function _callee6$(p){for(;;)switch(p.prev=p.next){case 0:return a=_extends({},(_objectDestructuringEmpty(i=d.length>0&&void 0!==d[0]?d[0]:{}),i)),p.abrupt("return",fetch(_objectSpread2({url:J.get_expense_type_data,contentType:K.json,datatype:Y.json,includeODataHeaders:!0,async:!1,returnData:!0},a)));case 2:case"end":return p.stop()}}),_callee6)}))),_getExpenseTypeData.apply(this,arguments)}function getOrgbookAutocompleteData(i){return _getOrgbookAutocompleteData.apply(this,arguments)}function _getOrgbookAutocompleteData(){return(_getOrgbookAutocompleteData=_asyncToGenerator(_regeneratorRuntime().mark((function _callee7(i){var a,d,p;return _regeneratorRuntime().wrap((function _callee7$(u){for(;;)switch(u.prev=u.next){case 0:return a=i.searchStr,d=i.onSuccess,p=_objectWithoutProperties(i,U),u.abrupt("return",fetch(_objectSpread2({url:J.get_orgbook_autocomplete_data,data:{q:a,inactive:"false",revoked:"false",latest:"true"},onSuccess:d},p)));case 2:case"end":return u.stop()}}),_callee7)})))).apply(this,arguments)}function _getOrgbookTopicData(){return(_getOrgbookTopicData=_asyncToGenerator(_regeneratorRuntime().mark((function _callee8(i){var a,d;return _regeneratorRuntime().wrap((function _callee8$(p){for(;;)switch(p.prev=p.next){case 0:return a=i.topicSourceId,d=_objectWithoutProperties(i,G),p.abrupt("return",fetch(_objectSpread2({url:J.get_orgbook_topic_data,data:{q:a}},d)));case 2:case"end":return p.stop()}}),_callee8)})))).apply(this,arguments)}function _getOrgbookCredentialsData(){return(_getOrgbookCredentialsData=_asyncToGenerator(_regeneratorRuntime().mark((function _callee9(i){var a,d;return _regeneratorRuntime().wrap((function _callee9$(p){for(;;)switch(p.prev=p.next){case 0:return a=i.topicId,d=_objectWithoutProperties(i,Q),p.abrupt("return",fetch(_objectSpread2({url:J.get_orgbook_credentials_data(a)},d)));case 2:case"end":return p.stop()}}),_callee9)})))).apply(this,arguments)}const ee=Logger("common/env");function getEnv(){const{host:a}=i.location,d=Object.keys(p).find((i=>p[i]===a));if(d)return ee.info({fn:getEnv,message:`successfully determined current env: ${d}`}),d;ee.error({fn:getEnv,message:"Unable to determine current env",data:{host:a,Hosts:p}})}async function getEnvVars(){const i=await getEnvVarsData();if(i){const a=function processEnvVarsData(i){const a=null==i?void 0:i.value;if(null==a?void 0:a.length){return a.reduce(((i,a)=>{var d,p;return{...i,[a.schemaname]:null===(p=null===(d=a.environmentvariabledefinition_environmentvariablevalue)||void 0===d?void 0:d[0])||void 0===p?void 0:p.value}}),{})}}(i);return ee.info({fn:getEnvVars,message:"successfully extracted env vars:",data:a}),Promise.resolve(a)}let a="failed to extract env vars from data";return ee.warn({fn:getEnvVars,message:a,data:i}),Promise.reject(new Error(a))}O.env={getEnvVars:getEnvVars,getEnv:getEnv};var ne=Logger("common/config");function getGlobalConfigData(){var i,a=localStorage.getItem("programData"),d=null===(i=JSON.parse(a))||void 0===i||null===(i=i.quartech_ApplicantPortalConfig)||void 0===i?void 0:i.quartech_configdata,p=JSON.parse(d);return ne.info({fn:getApplicationConfigData,message:"successfully fetched global config data from storage",data:p}),p}function getClaimConfigData(){var i,a=localStorage.getItem("programData"),d=null===(i=JSON.parse(a))||void 0===i?void 0:i.quartech_applicantportalclaimformjson;if(d){var p=JSON.parse(d);return ne.info({fn:getApplicationConfigData,message:"successfully fetched claim config data from storage",data:p}),p}ne.error({fn:getClaimConfigData,message:"Failed to get Claim config data, check quartech_applicantportalclaimformjson for the program in MS Dynamics.",data:{programData:a,configDataJSON:d}})}function getApplicationConfigData(i){var a,d=localStorage.getItem("programData"),p=null===(a=JSON.parse(d))||void 0===a?void 0:a.quartech_applicantportalapplicationformconfigjson,u=JSON.parse(p);return ne.info({fn:getApplicationConfigData,message:"successfully fetched application config data from storage",data:u}),u}O.config={getGlobalConfigData:getGlobalConfigData,getClaimConfigData:getClaimConfigData,getApplicationConfigData:getApplicationConfigData};const te=new Logger("common/program");function getProgramId(){var i,d;if(null===(i=O.programId)||void 0===i?void 0:i.programId){const i=null===(d=O.programId)||void 0===d?void 0:d.programId;return te.info({fn:getProgramId,message:`Cached programId found, returning ${i}`}),i}te.info({fn:getProgramId,message:"attempting to get program id from URL path",data:{readyState:a.readyState}});const p=new URLSearchParams(a.location.search).get("programid");p&&te.info({fn:getProgramId,message:`Success! Found program id in URL path ${p}`,data:{readyState:a.readyState,programIdParam:p}});const u=$("#quartech_program"),h=null==u?void 0:u.val();if(h?te.info({fn:getProgramId,message:`Success! Found program id in hidden #quartech_program element ${h}`,data:{readyState:a.readyState,hiddenProgramElement:u,programId:h}}):te.warn({fn:getProgramId,message:`Could not find program id in hidden #quartech_program element ${h}`,data:{readyState:a.readyState,hiddenProgramElement:u,programId:h}}),h&&p&&h!=p){te.warn({fn:getProgramId,message:"Program id in URL path differs from program id found in element, fixing url path",data:{readyState:a.readyState,programIdParam:p,programIdHiddenValue:h}});let i=a.location.href.replace(p,h);location.replace(i)}const g=h||p;return g||te.error({fn:getProgramId,message:"Could not find program id in either coding section or url params. Check that HTML content is present in Portal Management."}),O.program.programId=g,g}function getProgramAbbreviation(){var i;const a=localStorage.getItem("programData");return null===(i=JSON.parse(a))||void 0===i?void 0:i.quartech_programabbreviation}function getCurrentStep(){var i;let a=m.Unknown;const d=function htmlDecode(i){var a;return null===(a=(new DOMParser).parseFromString(i,"text/html").documentElement.textContent)||void 0===a?void 0:a.replace(/[^\x00-\x7F]/g,"")}($("div > ol > li.list-group-item.active").html());return d&&0!==d.length?(a=null!==(i=Object.keys(v).find((i=>{const a=v[i];return te.info({fn:getCurrentStep,message:`Trying to find formStep for activeTabName: ${d}`,data:{TabDisplayNames:v,formStep:i,tabDisplayName:a}}),a===d||a.includes(d)})))&&void 0!==i?i:a,te.info({fn:getCurrentStep,message:`Validating current step ${a}`,data:{activeTabName:d,TabDisplayNames:v}}),a&&a!==m.Unknown&&Object.values(m).includes(a)?(te.info({fn:getCurrentStep,message:`Successfully found current step ${a}`}),a):(a&&a!==m.Unknown||te.error({fn:getCurrentStep,message:"Unable to determine current step",data:{activeStep:a,activeTabName:d,TabDisplayNames:v,FormStep:m}}),m.Unknown)):(te.error({fn:getCurrentStep,message:"Failed to get activeTabName",data:{activeTabName:d}}),a)}function getProgramData(){const i=localStorage.getItem("programData");return JSON.parse(i)}O.program={programId:null,getProgramId:getProgramId,getProgramAbbreviation:getProgramAbbreviation,getCurrentStep:getCurrentStep};var oe=new Logger("common/tabs");function hideTabs(i){i&&i.length||oe.warn({fn:hideTabs,message:"Hide tabs called with empty data"});var a=[];i&&(a=i.split(",")),oe.info({fn:hideTabs,message:"Attempting to hide tabs...",data:{hiddenTabsNames:i,tabsToHide:a}}),a.forEach((function(i){if(i){var a=getTabElement({name:i});a&&a.style&&(a.style.display="none",oe.info({fn:hideTabs,message:"Successfully hid tab for given tabName: ".concat(i)}))}}))}function getTabElement(i){var a=i.displayName,d=i.name;if(a||d){if(!a&&d){var p=Object.values(y).findIndex((function(i){return i.includes(d)}));if(!p)return void oe.error({fn:getTabElement,message:"Could not find form step index for name: ".concat(d)});var u=Object.keys(y)[p];a=v[u]}if(a){var h=$("ol.progress li").filter((function(){return $(this).text().includes(a)}));if(h&&h.length){if(1===h.length)return h[0];oe.error({fn:setTabName,message:"Matched multiple elements for one given tab",data:{displayName:a,name:d}})}else oe.warn({fn:getTabElement,message:"Could not find tab element",data:{name:a}})}else oe.error({fn:getTabElement,message:"Unable to find display name for tab name: ".concat(d)})}else oe.error({fn:getTabElement,message:"Need at least one param displayName or name to find tab element"})}function setTabName(i,a){if(i&&a)if(Object.values(m).includes(i)){var d=v[i];if(d){var p=getTabElement({displayName:d});p&&(p.innerHTML=a,oe.info({fn:setTabName,message:"Successfully updated tab name from ".concat(i," to ").concat(a)}))}else oe.warn({fn:setTabName,message:"Could not find original tab display name"})}else oe.warn({fn:setTabName,message:"Invalid section name passed, name: ".concat(i,", displayName: ").concat(a)});else oe.warn({fn:setTabName,message:"Missing required params of name or displayName"})}function setHeadings(i,a){i&&a&&null!=a&&a.length?a.forEach((function(i){var a=i.name,d=i.displayName;a&&d?setHeadingName(a,d):oe.error({fn:setHeadings,message:"Failed to set heading, missing params",data:{name:a,displayName:d}})})):oe.error({fn:setHeadings,message:"Missing required sectionName or headings",data:{sectionName:i,headings:a}})}function setHeadingName(i,a){var d=$("fieldset legend h3").filter((function(){return $(this).text().includes(i)}));d&&d.length?d.length>1?oe.error({fn:setHeadingName,message:"Matched more than one heading, could not update header",data:{name:i,displayName:a,headerElements:d}}):(d[0].innerHTML=a,oe.info({fn:setTabName,message:"Successfully updated header from ".concat(i," to ").concat(a)})):oe.warn({fn:setTabName,message:"Could not find header element to rename",data:{name:i,displayName:a}})}var re=new Logger("common/sections");function configureSections(i){i&&i.length||re.warn({fn:configureSections,message:"Configure sections called with empty data"}),i.forEach((function(i){var a=i.name,d=i.displayName,p=i.headings;a?(d&&setTabName(a,d),p&&p.length&&setHeadings(a,p),re.info({fn:configureSections,message:"Successfully configured section for name: ".concat(a),data:{section:i}})):re.error({fn:configureSections,message:"Could not find section name"})}))}O.fields={getFieldsBySectionApplication:getFieldsBySectionApplication,getFieldsBySectionClaim:getFieldsBySectionClaim};var ie=Logger("common/fields");function getFieldsBySectionApplication(i){var a,d,p,u,h=arguments.length>1&&void 0!==arguments[1]&&arguments[1],g=getProgramAbbreviation();if(!h){var f=localStorage.getItem("fieldsData-".concat(g,"-").concat(i));if(f)return JSON.parse(f)}var v=function getGlobalFieldsConfig(){var i;return ie.info({fn:getGlobalConfigData,data:getGlobalConfigData()}),null===(i=getGlobalConfigData())||void 0===i||null===(i=i.FieldsConfig)||void 0===i||null===(i=i.programs)||void 0===i?void 0:i.find((function(i){return"ALL"===i.name}))}();ie.info({fn:getFieldsBySectionApplication,message:"globalConfigData:",data:v});var y=getApplicationConfigData();ie.info({fn:getFieldsBySectionApplication,message:"applicationConfigData:",data:y});var w=null==v?void 0:v.sections,_=null==y?void 0:y.sections;configureSections(_);var q=y.hiddenSteps;q&&hideTabs(q);var A=null==_?void 0:_.find((function(a){return a.name===i})),T=w.find((function(a){return a.name===i})),$=[];if(A||T){if(A&&null!==(a=A.fields)&&void 0!==a&&a.length){if(null!==(d=A.fields)&&void 0!==d&&d.length){var O;(O=$).push.apply(O,_toConsumableArray(A.fields))}}else ie.warn({fn:getFieldsBySectionApplication,message:"no applicationSection section found by sectionName: ".concat(i),data:{sectionName:i,forceRefresh:h,globalSections:w,applicationSections:_}});return T&&null!==(p=T.fields)&&void 0!==p&&p.length?null!==(u=T.fields)&&void 0!==u&&u.length&&($=function mergeFieldArrays(i,a,d){for(var p={},u=0,h=[].concat(_toConsumableArray(a),_toConsumableArray(i));u1&&void 0!==arguments[1]&&arguments[1],p=getProgramAbbreviation();if(!d){var u=localStorage.getItem("fieldsData-".concat(p,"-").concat(i));if(u)return JSON.parse(u)}var h=getClaimConfigData();ie.info({fn:getFieldsBySectionClaim,message:"claimConfigData:",data:h});var g=null==h?void 0:h.sections,f=null==g?void 0:g.find((function(a){return a.name===i}));if(f&&null!=f&&null!==(a=f.fields)&&void 0!==a&&a.length){var m=f.fields;return m.forEach((function(i){ie.info({fn:getFieldsBySectionClaim,message:"showing field name: ".concat(i.name)}),showFieldRow(i.name)})),localStorage.setItem("fieldsData-".concat(p,"-").concat(i),JSON.stringify(m)),ie.info({fn:getFieldsBySectionClaim,message:"fieldsData:",data:m}),m}ie.warn({fn:getFieldsBySectionClaim,message:"no configuration section found by sectionName: ".concat(i),data:{sectionName:i,forceRefresh:d,claimSections:g}})}var ae=Logger("common/validation");function validateRequiredFields(){var i=getCurrentStep();i!==m.DemographicInfo?validateStepFields(i):validateDemographicInfoRequiredFields()}function validateStepFields(i,a){i||(i=getCurrentStep());var d,p="";if(!(d=getOptions$1().form===g.Application?getFieldsBySectionApplication(i):getFieldsBySectionClaim(i)))return"";ae.info({fn:validateStepFields,message:"loop through fields to get validation errors",data:{validationErrorHtml:p}});for(var u=function _loop(){var i=d[h],a=i.name,u=i.required,g=i.elementType,f=i.validation;if(u){var m;(m=g?validateRequiredField(a,g):validateRequiredField(a))&&m.length&&(p=p.concat(m))}if("numeric"===(null==f?void 0:f.type)){var v=f.value,y=f.comparison,w=function validateNumericFieldValue(i,a,d,p){var u=document.querySelector("#".concat(i));if(u){if(""===u.value&&!p)return"";var h=parseFloat(u.value.replace(/,/g,"").replace("$","")),g=$("#".concat(i,"_label")).text(),f='
"'.concat(g,'" Please enter a valid number');switch(d){case"greaterThan":return h>a&&""!==h?"":"".concat(f,". The value must be greater than ").concat(a,".
");case"lessThan":return h");case"equalTo":return h!==a||""===h?"".concat(f,". The value must be equal to ").concat(a,"."):"";case"greaterThanOrEqualTo":return h>=a&&""!==h?"":"".concat(f,". The value must be greater than or equal to ").concat(a,".");case"lessThanOrEqualTo":return h<=a&&""!==h?"":"".concat(f,". The value must be less than or equal to ").concat(a,".");default:return"Invalid operator"}}}(a,v,y);w&&w.length&&(p=p.concat(w))}if("length"===(null==f?void 0:f.type)){var _=f.value,q=f.comparison,A=f.forceRequired,T=f.postfix,O=f.overrideDisplayValue,E=function validateFieldLength(i,a,d){var p=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,h=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0;if(!$("#".concat(i,"_label")).is(":visible"))return"";var g=document.querySelector("#".concat(i));if(g){if(""===g.value&&!p)return"";var f=g.value.length,m=' Please enter a valid length';switch(d){case"greaterThan":return f>a&&""!==f?"":"".concat(m,". The length must be greater than ").concat(null!=h?h:a).concat(u?" ".concat(u):"",".");case"lessThan":return f");case"equalTo":return f!==a||""===f?"".concat(m,". The length must be equal to ").concat(null!=h?h:a).concat(u?" ".concat(u):"","."):"";case"greaterThanOrEqualTo":return f>=a&&""!==f?"":"".concat(m,". The length must be greater than or equal to ").concat(null!=h?h:a).concat(u?" ".concat(u):"",".");case"lessThanOrEqualTo":return f<=a&&""!==f?"":"".concat(m,". The length must be less than or equal to ").concat(null!=h?h:a).concat(u?" ".concat(u):"",".");default:return"Invalid operator"}}}(a,_,q,A,T,O);if(ae.info({fn:validateStepFields,message:"Generate length validation error html...",data:{validationErrorHtml:p}}),E&&E.length>0){$("#".concat(a,"_error_message")).html(E),$("#".concat(a)).on("focusout",(function(){$("#".concat(a,"_error_message")).css({display:""}),$("#".concat(a)).css({border:"1px solid #e5636c"})}));var F=$("#".concat(a,"_label")).text(),D='"'.concat(F,'"');p=p.concat("
".concat(D).concat(E,"
")),ae.info({fn:validateStepFields,message:"Done generating length validation error html...",data:{validationErrorHtml:p}})}else ae.info({fn:validateStepFields,message:"Nothing to display for length validation error html...",data:{validationErrorHtml:p}}),$("#".concat(a)).off("focusout"),$("#".concat(a,"_error_message")).css({display:"none"}),$("#".concat(a)).css({border:""})}},h=0;hYou must select YES to either "Is the consultant registered with the BC Institute of Agrologists (BCIA)?" OR "If the consultant is NOT registered with the BC Institute of Agrologists (BCIA), is the consultant a Chartered Professional Accountant (CPA)?" The consultant must be registered with BCIA or CPA.':"":""}();p=p.concat(m)}}if(a)return ae.info({fn:validateStepFields,message:"returning string",data:p}),p;ae.info({fn:validateStepFields,message:"Done! Displaying validation error html",data:{validationErrorHtml:p}}),displayValidationErrors(p)}function validateRequiredField(i){var a,d,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f.Input,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"IS REQUIRED";if(ae.info({fn:validateRequiredField,message:"Start validating required fieldName: ".concat(i," of elemType: ").concat(p)}),!$("#".concat(i,"_label")).is(":visible"))return ae.warn({fn:validateRequiredField,message:"Validate called on not visible fieldName: ".concat(i," of elemType: ").concat(p)}),"";var h="",g=!0;switch(p){case f.FileInput:g=0===(null===(a=$("#".concat(i,"_AttachFile")))||void 0===a?void 0:a.val().length)&&0===(null===(d=$("#".concat(i)))||void 0===d?void 0:d.val().length);break;case f.MultiOptionSet:g=0==$("li[id*='".concat(i,"-selected-item-']")).length;break;case f.DropdownSelect:g=0==document.querySelector("#".concat(i)).value.length;break;case f.SingleOptionSet:case f.DatePicker:default:g=""==$("#".concat(i)).val()}if(ae.info({fn:validateRequiredField,message:"Required field fieldName: ".concat(i,", isEmptyField: ").concat(g)}),g){ae.info({fn:validateRequiredField,message:"Required field fieldName: ".concat(i," is empty! Set validation error message")});var m=$("#".concat(i,"_label")).text();h='
"'.concat(m,'" ').concat(u,"
")}return h}function validateEmailAddressField(i){var a=document.querySelector("#".concat(i)),d=document.querySelector("#".concat(i,"_error_message"));if(a){if(!d){var p=document.createElement("div");if(p.id="".concat(i,"_error_message"),p.className="error_message",p.style="display:none;",$("#".concat(i)).parent().append(p),!(d=document.querySelector("#".concat(i,"_error_message"))))return}var u=/^\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/i;$(a).on("keyup keydown",(function(){var i=a.value;i&&u.test(i)?($(a).css({border:""}),$(d).css({display:"none"})):($(a).css({border:"1px solid #e5636c"}),$(d).html("Email: must be a valid email."),$(d).css({display:""}))}))}}function displayValidationErrors(i){var a=$("#error_messages_div");if(ae.info({fn:displayValidationErrors,message:"displaying validation errors",data:{validationErrorHtml:i}}),0==a.length){(a=document.createElement("div")).id="error_messages_div";var d=$("#NextButton").parent().parent();d.prepend(a),d.attr("id","actions_div")}else a=a[0];""==i?(a.innerHTML="",a.style="display:none;",$("#NextButton").prop("disabled",!1)):(a.innerHTML=i+"
",a.style="display:block;",$("#NextButton").prop("disabled",!0))}function addValidationCheck(i,a){var p;null!=a&&a.intervalBased&&getEnv()===d.PROD?setInterval((function(){return validateStepFields()}),100):$("input[id*='".concat(i,"']")).on(null!==(p=null==a?void 0:a.event)&&void 0!==p?p:"onchange",(function(){validateStepFields()}))}function setInputMaxLength(i,a){$("#".concat(i)).attr("maxlength",a)}function setFieldReadOnly(i){$("#".concat(i)).attr("readonly",!0),$("#".concat(i)).on("mousedown",(function(i){i.preventDefault(),this.blur(),window.focus()})),$("#".concat(i)).attr("style","background-color: #eee !important")}var le=new Logger("common/html");function getControlType(i){var a=i.querySelector("div.control"),d=null==a?void 0:a.querySelector("input[id*=quartech_], textarea[id*=quartech_], select[id*=quartech_]");if(d){var p=d.tagName.toLowerCase(),u=d.getAttribute("class");return d.getAttribute("type"),"input"===p&&null!=u&&u.includes("money")?f.CurrencyInput:"input"===p&&null!=u&&u.includes("text")?f.Input:"input"===p&&null!=u&&u.includes("datetime")?f.DatePicker:"textarea"===p&&null!=u&&u.includes("textarea")?f.TextArea:"select"===p&&null!=u&&u.includes("picklist")?f.DropdownSelect:"input"===p&&"checkbox"===d.type?f.Checkbox:(le.error({fn:getControlType,message:"Could not determine control type",data:{tr:i,control:d,tag:p,classes:u}}),f.Unknown)}le.error({fn:getControlType,message:"Could not find form control element",data:{tr:i,control:d}})}function getControlValue(i){var a=i.tr,d=i.rawValue,p=void 0!==d&&d,u=getControlType(a);le.info({fn:getControlValue,message:"Attempting to get control value for type: ".concat(u,", rawValue: ").concat(p)});var h,g,m,v=a.querySelector(".control");if(u===f.CurrencyInput){var y,w=null==v||null===(y=v.querySelector("input"))||void 0===y?void 0:y.value;return p?w:"$".concat(w)}if(u===f.Input)return null==v||null===(h=v.querySelector("input"))||void 0===h?void 0:h.value;if(u===f.DatePicker)return null==v||null===(g=v.querySelector("div > .datetimepicker > input"))||void 0===g?void 0:g.value;if(u===f.TextArea)return null==v||null===(m=v.querySelector("textarea").value)||void 0===m?void 0:m.replace(/\n/g," ");if(u===f.DropdownSelect){var _=null==v?void 0:v.querySelector("select");if(p)return _.value;var q=null==_?void 0:_.selectedIndex,A=_.options[q];return A.textContent||A.innerText}if(u===f.Checkbox){var T,$=null==v||null===(T=v.querySelector("input"))||void 0===T?void 0:T.checked;return p?$:$?"Yes":"No"}return null}function onDocumentReadyState(i){le.info({fn:onDocumentReadyState,message:"checking document readyState: ".concat(a.readyState)}),"complete"===a.readyState?i():a.addEventListener("readystatechange",(function(){"complete"===a.readyState&&(le.info({fn:onDocumentReadyState,message:"document ready!"}),i())}))}function showFieldRow(i){var a,d,p=document.querySelector("#".concat(i,"_label"));if(p){var u=p.closest("tr");if(u){null===(a=$(u))||void 0===a||a.css({display:""});var h=u.closest("fieldset");null===(d=$(h))||void 0===d||d.css({display:""})}}}function addHtmlToSection(i,d){var p=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",u=a.querySelector("table[data-name='".concat(i,"'] > tbody"));if(u){var h=a.createElement("tr"),g=document.createElement("td");g.setAttribute("colspan","2"),g.setAttribute("quartechHtml","true"),g.innerHTML=d,h.appendChild(g),"top"===p?u.prepend(h):"bottom"===p&&u.append(h)}else le.error({fn:addHtmlToSection,message:"Unable to add to section of tableDataName: ".concat(i,", could not find section")})}function addTextAboveField(i,a){addHtmlToField(i,a,"top")}function addTextBelowField(i,a){addHtmlToField(i,a,"bottom")}function addHtmlToField(i,a){var d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",p=$("#".concat(i)).closest("tr");if(p){var u=crypto.randomUUID();"top"===d?$("")).insertBefore(p):"bottom"===d&&$("")).insertAfter(p);var h=$('tr[data-uuid="'.concat(u,'"]'));h&&null!=h&&h.length||le.error({fn:addHtmlToField,message:"Failed to create new row"});var g=document.createElement("td");g.setAttribute("colspan","2"),g.setAttribute("quartechHtml","true"),g.innerHTML=a,h.append(g)}}function observeChanges(i,a){if(le.info({fn:observeChanges,message:"observing changes...",data:{element:i}}),i){a?a():validateRequiredFields();var d=new MutationObserver((function(i,d){a?a():validateRequiredFields()}));i&&i.nodeType===Node.ELEMENT_NODE&&d.observe(i,{attributes:!0,childList:!0,characterData:!0})}else le.error({fn:observeChanges,message:"failed to observe changes, null element",data:{element:i}})}function observeIframeChanges(i,a,d){le.info({fn:observeIframeChanges,message:"observing iframe changes...",data:{fieldNameToPass:a,fieldNameToObserve:d}});var p=document.querySelector('fieldset[aria-label="Coding Section (DO NOT REMOVE)"] iframe');null!=p&&p.nodeType&&observeChanges($(p)[0],(function(){i(a);var p=document.querySelector('fieldset[aria-label="Coding Section (DO NOT REMOVE)"] iframe'),u=null!=p&&p.contentDocument?null==p?void 0:p.contentDocument:null==p?void 0:p.contentWindow.document;null!=u&&u.nodeType&&observeChanges(u,(function(){var p=document.querySelector('fieldset[aria-label="Coding Section (DO NOT REMOVE)"] iframe'),u=p.contentDocument?p.contentDocument:p.contentWindow.document;i(a);var h=null==u?void 0:u.getElementById(d);null!=h&&h.nodeType&&observeChanges(h,(function(){i(a)}))}))}))}function hideFieldByFieldName(i,a){var d=arguments.length>2&&void 0!==arguments[2]&&arguments[2],p=document.querySelector("#".concat(i,"_label"));if(p){var u=p.closest("tr"),h=document.querySelector("#".concat(i));u&&h&&($(u).css({display:"none"}),$("#".concat(i,"_label")).parent().removeClass("required"),localStorage.removeItem("shouldRequire_".concat(i)),a&&a(),$(h).off("change"),d||$(h).val(""))}}function hideQuestion(i){$("#".concat(i)).css("display","none"),$("#".concat(i)).val("");var a=document.querySelector("#".concat(i,"_label")).closest("tr");$(a).css({display:"none"}),validateRequiredFields()}function showOrHideAndReturnValue(i,a){var d=$("#".concat(i)),p=$("#".concat(a)),u=parseFloat(d.val().replace(/,/g,""));return isNaN(u)&&(u=0),0==u?(p.val(""),p.closest("td").css("display","none"),d.closest("td").attr("colspan","2")):(p.closest("td").css("display","block"),p.closest("td").attr("colspan","1"),d.closest("td").attr("colspan","1")),u}function setFieldValue(i,a){var d=document.querySelector("#".concat(i));if(d){d.value=a;var p=new Event("change");d.dispatchEvent(p)}}function combineElementsIntoOneRowNew(i){var a,d=$("#".concat(i)),p=$("#".concat(i,"_label")),u=d.closest("td"),h=p.closest("td");if(u.is(h)){null===(a=d.closest("table.section").find("colgroup"))||void 0===a||a.remove();var g=d.closest("div.control"),f=d.closest("tr"),m=u.clone();m.attr("colspan","1"),f.append(m),g.remove(),m.find("div.info").remove()}else le.warn({fn:combineElementsIntoOneRowNew,message:"Skipping... elements must've already been combined, since label and input are in different cells",data:{name:i,inputElement:d,labelElement:p,inputTd:u,labelTd:h}})}function combineElementsIntoOneRow(i,a){var d=$("#".concat(a)).closest("td"),p=d.clone();p.attr("colspan","1"),d.remove();var u=$("#".concat(i));u.closest("td").attr("colspan","1"),u.closest("tr").append(p)}function hideFieldsAndSections(){var i=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];i?le.info({fn:hideFieldsAndSections,message:"Hiding fields and sections"}):le.info({fn:hideFieldsAndSections,message:"Unhiding fields and sections"}),function hideFields(){var i=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];document.querySelectorAll('tr:has([id$="_label"])').forEach((function(a){a.style&&(a.style.display=i?"none":"")}))}(i),function hideFieldSets(){var i=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];document.querySelectorAll("fieldset[aria-label]").forEach((function(a){a.style&&(a.style.display=i?"none":"")}))}(i)}function deepExtend(i){i=i||{};for(var a=1,d=arguments.length;a1&&void 0!==arguments[1]?arguments[1]:null,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(i&&null!==(d=fe.sourcemap)&&void 0!==d&&d[i]){var h=fe.sourcemap[i];if(function isScriptAdded(i){var d;if(i&&null!==(d=fe.sourcemap)&&void 0!==d&&d[i]){var p=fe.sourcemap[i];return Boolean(a.querySelector('script[src="'+p+'"]'))}}(i)){if(function isScriptFullyLoaded(i){return i in fe.loadmap&&fe.loadmap[i]}(i))return he.warn({fn:useScript,message:"Script already loaded. Skipping: ".concat(i)}),void(p&&(he.warn({fn:useScript,message:"Script already loaded. Calling onload for: ".concat(i)}),p()));var g,f;p?(he.warn({fn:useScript,message:"Script still loading, adding to call stack: ".concat(i),data:fe}),fe.callstack=_objectSpread2(_objectSpread2({},fe.callstack?fe.callstack:{}),{},_defineProperty({},i,[].concat(_toConsumableArray(null!==(g=fe.callstack)&&void 0!==g&&g[i]?null===(f=fe.callstack)||void 0===f?void 0:f[i]:[]),[p])))):he.warn({fn:useScript,message:"Script still loading: ".concat(i)})}else{var m=a.createElement("script");m.setAttribute("async",""),m.src=h,a.head.appendChild(m),p&&"function"==typeof p&&(fe.callstack=_objectSpread2(_defineProperty({},i,[p]),fe.callstack)),m.onload=function(){var a,d;he.info({fn:useScript,message:"script onload successfully called ".concat(i),data:fe}),function markScriptFullyLoaded(i){fe.loadmap[i]=!0}(i),null!==(a=fe.callstack)&&void 0!==a&&a[i]&&(null===(d=fe.callstack)||void 0===d||d[i].forEach((function(i){return i()})),fe.callstack=_objectSpread2(_objectSpread2({},fe.callstack?fe.callstack:{}),{},_defineProperty({},i,[])))},m.onerror=function(){he.error({fn:useScript,message:"Failed to load: ".concat(i)}),u&&"function"==typeof u&&u()}}}}var be=new Logger("common/form");function addFormDataOnClickHandler(){var i=document.getElementById("NextButton");null==i||i.addEventListener("click",formDataOnClickHandler)}function formDataOnClickHandler(i){var a,d=Date.now();null==i||i.stopImmediatePropagation(),null==i||i.preventDefault(),generateFormJson()?null==i||null===(a=i.target)||void 0===a||a.onclick():be.error({fn:formDataOnClickHandler,message:"Failed to generate form json data!"});var p=Date.now()-d;be.info({fn:formDataOnClickHandler,message:"Generating form data json took ".concat(p," ms")})}function generateFormJson(){var i=document.querySelector("#EntityFormView"),a=i.querySelectorAll('textarea[id*="quartech_wordtemplatedata"]');if(!a||!a.length)return be.info({fn:generateFormJson,message:"No need to generate form json if no word template field exists"}),!0;var d=null==i?void 0:i.querySelectorAll("fieldset"),p=null==i?void 0:i.querySelector(".tab");if(!(i&&d&&null!=d&&d.length&&p))return be.error({fn:generateFormJson,message:"Unable to generate form JSON, could not find required elements"}),!1;var u=p.getAttribute("data-name");if(!u)return be.error({fn:generateFormJson,message:"Failed to get tab data-name",data:{tabDivElement:p}}),!1;be.info({fn:generateFormJson,message:"Processing fieldSet array for tabDataName: ".concat(u)});var h={};return d.forEach((function(i){var a,d,p=null===(a=i.querySelector("h3"))||void 0===a?void 0:a.textContent,g=i.querySelector("table"),f=null==g?void 0:g.getAttribute("data-name");if(f&&f.toLowerCase().includes("codingsection"))be.info({fn:generateFormJson,message:"Skipping coding section..."});else if("none"!==(null===(d=i.style)||void 0===d?void 0:d.display)){var m=null==g?void 0:g.querySelectorAll("tbody > tr");f&&p&&m&&m.length||be.error({fn:generateFormJson,message:"Unable to generate form JSON, could not find required section elements",data:{tabDataName:u}}),be.info({fn:generateFormJson,message:"Processing tr array for sectionId: ".concat(f,", displayName: ").concat(p)});var v="".concat(f,"QuestionAnswerList");h[f]=_defineProperty({displayName:p},v,[]),m.forEach((function(i){if(function isHiddenRow(i){var a;return"none"===(null==i||null===(a=i.style)||void 0===a?void 0:a.display)}(i))be.info({fn:generateFormJson,message:"Skipping hidden row",data:{tr:i}});else if(function isEmptyRow(i){var a,d=i.querySelector("td");return!(d&&"true"!==(null==d?void 0:d.getAttribute("quartechHtml"))&&(null==d||!d.getAttribute("class").includes("zero-cell"))&&0!==(null===(a=d.children)||void 0===a?void 0:a.length))}(i))be.info({fn:generateFormJson,message:"Skipping empty row",data:{tr:i}});else{var a=getControlType(i),d=function getInfoValue(i){var a,d=i.querySelector(".info");return null==d||null===(a=d.querySelector("label"))||void 0===a?void 0:a.textContent}(i);be.info({fn:generateFormJson,message:"For controlType: ".concat(a,"; found questionText: ").concat(d,", try finding answerText next..."),data:{tr:i}});var p=getControlValue({tr:i});if(be.info({fn:generateFormJson,message:"Converting form row to JSON...",data:{tr:i,questionText:d,answerText:p}}),d){var u="".concat(f,"Question"),g="".concat(f,"Answer");h[f][v].push(_defineProperty(_defineProperty({},u,d),g,p))}else be.error({fn:generateFormJson,message:"Could not find question text",data:{tr:i}})}}))}else be.info({fn:generateFormJson,message:"Skipping hidden section...",data:{fieldset:i}})})),be.info({fn:generateFormJson,message:"Setting word template field data",data:{formJsonObj:h,wordTemplateDataElement:a[0]}}),a[0].value=JSON.stringify(h),!0}O.form={generateFormJson:generateFormJson,getFormId:function getFormId(){var i;if(null!==(i=O.form)&&void 0!==i&&i.id){var d,p=null===(d=O.form)||void 0===d?void 0:d.id;return be.info({fn:getFormId,message:"Cached form submission id found, returning ".concat(p)}),p}var u,h=new URLSearchParams(a.location.search),g=h.get("id");if(!g){if(be.info({fn:getFormId,message:"Could not find current form submission id from url params, try finding liquid form element..."}),!(u=document.querySelector("form#liquid_form")))return void be.error({fn:getFormId,message:"Unable to find liquid form element, unable to retrieve app/claim submission id!"});var f=u.getAttribute("action");if(!f)return void be.error({fn:getCurrentSubmissionId,message:"Unable to retrieve action attribute from liquid form element",data:{formElement:u}});var m=/id=([a-f\d-]+)/i.exec(f);g=m?m[1]:null}if(g)return be.info({fn:getFormId,message:"Successfully retrieved form submission id from url params: ".concat(g)}),O.form.id=g,g;be.error({fn:getFormId,message:"Unable to retrieve form submission id from either url or form element",data:{params:h,formElement:u}})},id:null};var me=Logger("common/loading");function hideLoadingAnimation(){me.info({fn:hideLoadingAnimation,message:"attempting to hide loading animation..."});var i,d=a.getElementById("loader");d?(me.info({fn:hideLoadingAnimation,message:"loader found & finished loading, removing element"}),null===(i=d.parentNode)||void 0===i||i.removeChild(d)):me.warn({fn:hideLoadingAnimation,message:"loader not found!"});var p,u=a.getElementById("loader-style");u?(me.info({fn:hideLoadingAnimation,message:"loaderStyle found & finished loading, removing element"}),null===(p=u.parentNode)||void 0===p||p.removeChild(u)):me.warn({fn:hideLoadingAnimation,message:"loaderStyle not found!"})}var ve=new Logger("application/steps/deliverablesBudget");function setOnKeypressBudgetInput(i){$("#".concat(i)).on("change keyup blur",(function(){calculateEstimatedActivityBudget()}))}function getCurrencyFieldValue(i){var a=$("#".concat(i));if(a){var d=String(a.val()),p=parseFloat(d.replace(/,/g,""));return isNaN(p)&&(p=0),p}ve.error({fn:getCurrencyFieldValue,message:"Unable to find element for valueElementId: ".concat(i)})}function setOnKeypressTotalProjectInput(i){$("#".concat(i)).on("change keyup blur",(function(){!function calculateTotalProjectCost(){var i,a,d,p,u=(null!==(i=getCurrencyFieldValue("quartech_totalfundingrequiredfromtheprogram"))&&void 0!==i?i:0)+(null!==(a=getCurrencyFieldValue("quartech_inkindcontribution"))&&void 0!==a?a:0)+(null!==(d=getCurrencyFieldValue("quartech_cashcontribution"))&&void 0!==d?d:0)+(null!==(p=getCurrencyFieldValue("quartech_totalgstfromquotes"))&&void 0!==p?p:0),h=xe.format(u);$("#quartech_totalprojectcost").val(h.replace("CA$",""))}()}))}function setOnKeypressTotalAddedIncomeAndReducedCosts(i){$("#".concat(i)).on("change keyup blur",(function(){!function calculateTotalAddedIncomeAndReducedCosts(){var i,a,d=(null!==(i=getCurrencyFieldValue("quartech_totaladdedincome"))&&void 0!==i?i:0)+(null!==(a=getCurrencyFieldValue("quartech_totalreducedcost"))&&void 0!==a?a:0),p=xe.format(d);$("#quartech_totaladdedincomeandreducedcosts").val(p.replace("CA$","")),calculateNetChangeInProfit()}()}))}function setOnKeypressTotalAddedCostsAndReducedIncome(i){$("#".concat(i)).on("change keyup blur",(function(){!function calculateTotalAddedCostsAndReducedIncome(){var i,a,d=(null!==(i=getCurrencyFieldValue("quartech_totaladdedcost"))&&void 0!==i?i:0)+(null!==(a=getCurrencyFieldValue("quartech_totalreducedincome"))&&void 0!==a?a:0),p=xe.format(d);$("#quartech_totaladdedcostsandreducedincome").val(p.replace("CA$","")),calculateNetChangeInProfit()}()}))}function calculateNetChangeInProfit(){var i,a,d=(null!==(i=getCurrencyFieldValue("quartech_totaladdedincomeandreducedcosts"))&&void 0!==i?i:0)-(null!==(a=getCurrencyFieldValue("quartech_totaladdedcostsandreducedincome"))&&void 0!==a?a:0),p=xe.format(d);$("#quartech_netchangeinprofit").val(p.replace("CA$",""))}function calculateEstimatedActivityBudget(){var i=parseFloat($("#quartech_smefee").val().replace(/,/g,""));isNaN(i)&&(i=0);var a=i+showOrHideAndReturnValue("quartech_smetravelairfareparkingetc","quartech_pleasedescribemodeoftravelifapplicable")+showOrHideAndReturnValue("quartech_smeaccommodation","quartech_pleasedescribeaccommodationwherewillthesme")+showOrHideAndReturnValue("quartech_facilityequipmenttechnologyrental","quartech_pleasedescribeequipmentrequiredifapplicable")+showOrHideAndReturnValue("quartech_advertisingcommunications","quartech_pleasedescribewhatformsofadvertisingcommunic")+showOrHideAndReturnValue("quartech_administrationcosts","quartech_pleasedescribetheadministrativecoststobeinc")+showOrHideAndReturnValue("quartech_othercost","quartech_pleaseexplainotherifapplicable"),d=a-showOrHideAndReturnValue("quartech_costsharecontributioncashorinkinddonation","quartech_pleaseexplainwhotheotherpartnersareandwha"),p=xe.format(a);$("#quartech_estimatedbudgettotalactivitycost").val(p.replace("CA$",""));var u=xe.format(d);$("#quartech_totalfundingrequiredfromtheprogram").val(u.replace("CA$",""))}var ye=Logger("common/currency"),xe=new Intl.NumberFormat("en-US",{style:"currency",currency:"CAD",maximumFractionDigits:2});function customizeCurrencyInput(i){var a=i.inputId,d=i.skipCalculatingBudget,p=void 0!==d&&d,u=i.maxDigits,h=void 0===u?10:u,g=i.limitInputValue,f=void 0===g?void 0:g,m=i.hideDollarSign,v=void 0!==m&&m;i.emptyInitialValue;var y=i.allowNegatives,w=void 0!==y&&y,_=$("#".concat(a));if(!document.querySelector("#".concat(a,"_span_currency_label"))&&!_.val()&&!v){_.parent().addClass("input-group");var q=document.createElement("span");q.id="".concat(a,"_span_currency_label"),q.innerText="$",q.className="input-group-addon",_.parent().prepend(q)}_.on("keydown",(function(i){var a,d=_.val(),p=i.which;if(ye.info({fn:customizeCurrencyInput,message:"KEYDOWN ACTION: Detected pressedKeyCode: ".concat(p)}),p<=40&&p>=37)ye.info({fn:customizeCurrencyInput,message:"KEYDOWN ACTION: Arrow keys pressed, allowing default event behaviour"});else{var u,h=null===(a=document.getElementById(_[0].id))||void 0===a?void 0:a.selectionStart;if(190===p&&"."===d.charAt(h))return null===(u=document.getElementById(_[0].id))||void 0===u||u.setSelectionRange(h+1,h+1),void i.preventDefault();if(46===p){var g,f,m=d.charAt(h);if("0"===m&&0===h)return null===(g=document.getElementById(_[0].id))||void 0===g||g.setSelectionRange(h+1,h+1),void i.preventDefault();if("."===m||","===m)return null===(f=document.getElementById(_[0].id))||void 0===f||f.setSelectionRange(h+1,h+1),void i.preventDefault();var v=!1;if(ye.info({fn:customizeCurrencyInput,message:"DELETE ACTION: Attempting to detect if decimal place",data:{currentInputCursor:h,inputValueLength:null==d?void 0:d.length}}),h>=d.length-2&&(v=!0),v&&h!==d.length){var y;ye.info({fn:customizeCurrencyInput,message:"DELETE ACTION: Decimal place input detected",data:{inputValue:d}});var w=d.substring(0,h)+"0"+d.substring(h+1);return _.val(w),null===(y=document.getElementById(_[0].id))||void 0===y||y.setSelectionRange(h+1,h+1),i.preventDefault(),void ye.info({fn:customizeCurrencyInput,message:"DELETE ACTION: Decimal place value updated",data:{inputValue:d,newValue:w}})}}if(8===p){var q,A=d.charAt(h-1);if("."===A||","===A)return null===(q=document.getElementById(_[0].id))||void 0===q||q.setSelectionRange(h-1,h-1),void i.preventDefault();if(h>=d.length-2){var T,$=d.substring(0,h-1)+"0"+d.substring(h);return _.val($),null===(T=document.getElementById(_[0].id))||void 0===T||T.setSelectionRange(h-1,h-1),void i.preventDefault()}}}})),_.on("focusin",(function(i){$(this).data("val",$(this).val())})),_.on("input",(function(i){handleNewValueEntered($(this),p)})),_.on("keypress",(function(i){var a=i.which;if(a>=48&&a<=57||45===a&&w){var d,u=_.val(),g=u.includes("-"),m=null===(d=document.getElementById(_[0].id))||void 0===d?void 0:d.selectionStart;if(a>=49&&a<=57&&"0.00"===u&&0===m){var v,y=u.split("");return y[0]=String.fromCharCode(a),y=y.join(""),_.val(y),null===(v=document.getElementById(_[0].id))||void 0===v||v.setSelectionRange(m+1,m+1),void i.preventDefault()}if((u.length>0&&!g||u.length>1&&g)&&u.length===m)return void i.preventDefault();if(45===a&&w){if(0!==m||u.includes("-"))return void i.preventDefault();if(0===m){var q=parseFloat(u.replace(/,/g,""));q&&0!=q?(_.val("-".concat(q.toFixed(2))),document.getElementById(_[0].id).setSelectionRange(0,0),handleNewValueEntered(_,p),i.preventDefault()):""!=u&&"0.00"!==u||_.val("-")}return void i.preventDefault()}if(f){var A=parseFloat(u.replace(/,/g,"")),T=parseFloat(f.replace(/,/g,""));isNaN(A)&&(A=0),A>T&&_.val(f)}var $=h;if(u.length,g&&($+=1),m>0&&u.length-2>0&&m>=u.length-2){var O;ye.info({fn:customizeCurrencyInput,message:"KEYDOWN ACTION: Decimal input detected",data:{inputValue:u}});var E=u.split("");return E[m]=String.fromCharCode(a),E=E.join(""),_.val(E),null===(O=document.getElementById(_[0].id))||void 0===O||O.setSelectionRange(m+1,m+1),i.preventDefault(),i.stopImmediatePropagation(),void ye.info({fn:customizeCurrencyInput,message:"KEYDOWN ACTION: Decimal input detected... set new value",data:{newVal:E}})}if(u.length<=$)return}i.preventDefault()}))}function handleNewValueEntered(i){var a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],d=i.val(),p=d.includes("-"),u=d.replace(/,/g,"").replace("$","").replaceAll("-","");isNaN(u)&&(u=0);var h=xe.format(u);if(h){ye.info({fn:handleNewValueEntered,message:"newAmountWithCurrencyFormat: ".concat(h)});var g=document.getElementById(i[0].id).selectionStart,f=h.replace("CA$","");i.val("".concat(p?"-":"").concat(f)),a||calculateEstimatedActivityBudget();var m=!1;d.length>i.data("val").length&&(m=!0);var v=(i.data("val").match(/,/g)||[]).length;(i.val().match(/,/g)||[]).length!==v&&(m?g++:g-1>=0?g--:g=0),document.getElementById(i[0].id).setSelectionRange(g,g)}i.data("val",i.val())}var we=Logger("common/masking"),_e={CRA:"CRA",PostalCode:"PostalCode",PhoneNumber:"PhoneNumber",Number:"Number",Email:"Email"},Se={CRA:"000000000",PostalCode:"S0S 0S0",PhoneNumber:"(000) 000-0000"};function maskInput(i,a){we.info({fn:maskInput,message:"applying mask input to fieldName: ".concat(i," of type: ").concat(a)}),Object.keys(_e).includes(a)?useScript(ge.jquerymask,(function(){var d,p,u;switch(a){case _e.CRA:case _e.PostalCode:case _e.PhoneNumber:null===(d=$("#".concat(i)))||void 0===d||d.mask(Se[a]);break;case _e.Email:null===(p=$("#".concat(i)))||void 0===p||p.mask("A",{translation:{A:{pattern:/[\w@\-.+]/,recursive:!0}}});break;case _e.Number:null===(u=$("#".concat(i)))||void 0===u||u.mask("Z#",{translation:{Z:{pattern:/[1-9]/}}});break;default:return void we.error({fn:maskInput,message:"did NOT apply masking to fieldName: ".concat(i," of type: ").concat(a)})}we.info({fn:maskInput,message:"successfully applied mask input to fieldName: ".concat(i," of type: ").concat(a)})})):we.error({fn:maskInput,message:"unsupported mask, cannot mask input for fieldName: ".concat(i," and type: ").concat(a)})}function setupTooltip(i){var a=i.name,d=i.tooltipText,p=i.tooltipTargetElementId;if(d){var u=$("#".concat(null!=p?p:a));u.attr("data-content",d),u.attr("data-placement","bottom"),u.attr("data-html","true"),u.attr("data-trigger","hover"),u.attr("data-original-title",""),u.popover({trigger:"manual",html:!0,animation:!1}).on("mouseenter",(function(){var i=this;$(this).popover("show"),$(".popover").on("mouseleave",(function(){$(i).popover("hide")}))})).on("mouseleave",(function(){var i=this;setTimeout((function(){$(".popover:hover").length||$(i).popover("hide")}),300)}))}}var qe=Logger("common/fieldConfiguration");function configureFields(){var i,a=getCurrentStep();if(qe.info({fn:configureFields,message:"configuring fields for step: ".concat(a,"...")}),i=getOptions$1().form===g.Application?getFieldsBySectionApplication(a):getFieldsBySectionClaim(a)){qe.info({fn:configureFields,message:"configuring fields...",data:{stepName:a,fields:i}});for(var d=0;d"))}var ne,te;if(E&&$("#".concat(u,"_label")).css("font-weight","bold"),U&&(null===(ne=$("#".concat(u,"_label")))||void 0===ne||ne.css("display","none")),m&&(h?setRequiredField(u,h):setRequiredField(u)),v&&addValidationCheck(u,v),y&&hideFieldByFieldName(u,validateStepFields(a),W),T&&setInputMaxLength(u,T),G&&setFieldReadOnly(u),"email"===w?(maskInput(u,_e.Email),validateEmailAddressField(u)):"currency"===w?customizeCurrencyInput(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({inputId:u},void 0!==B?{skipCalculatingBudget:B}:{skipCalculatingBudget:!0}),q?{maxDigits:q}:{maxDigits:13}),A&&{emptyInitialValue:A}),_&&{allowNegatives:_})):"percentage"===w?customizeCurrencyInput({inputId:u,skipCalculatingBudget:!0,maxDigits:5,limitInputValue:"100.00",hideDollarSign:!0}):"number"===w?($("#".concat(u)).attr("type","number"),_||($("#".concat(u)).attr("min","0"),$("#".concat(u)).attr("oninput","this.value = !!this.value && Math.abs(this.value) >= 0 ? Math.abs(this.value) : null"))):"cra"===w?maskInput(u,_e.CRA):"phoneNumber"===w?maskInput(u,_e.PhoneNumber):"postalCode"===w&&maskInput(u,_e.PostalCode),h===f.FileInput)null===(te=$("#".concat(u,"_AttachFile")))||void 0===te||te.attr("accept",null!=J?J:".csv,.doc,.docx,.odt,.pdf,.xls,.xlsx,.ods,.gif,.jpeg,.jpg,.png,.svg,.tif");K&&initializeVisibleIf(u,m,K)}}var oe;setDynamicallyRequiredFields(a)}}function setRequiredField(i){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f.Input,d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Required field";qe.info({fn:setRequiredField,message:"Start configuring required fieldName: ".concat(i,", elemType: ").concat(a)}),$("#".concat(i,"_label")).parent().addClass("required"),$("#".concat(i)).attr("required",!0);var p=document.createElement("div");switch(p.id="".concat(i,"_error_message"),p.className="error_message",p.style="display:none;",p.innerHTML="".concat(d,""),$("#".concat(i)).parent().append(p),a){case f.FileInput:var u=$("input[id=".concat(i,"_AttachFile]"))[0];qe.info({fn:setRequiredField,message:"observe changes on file input element",data:{fileInputElement:u}}),observeChanges(u),$("#".concat(i,"_AttachFile")).on("blur input",(function(){validateRequiredFields()}));break;case f.DatePicker:qe.info({fn:setRequiredField,message:"Configuring required datepicker element for fieldName: ".concat(i)});var h=$("input[id=".concat(i,"_datepicker_description]")).parent()[0];qe.info({fn:setRequiredField,message:"observe changes on datepicker element",data:{datePickerElement:h}}),observeChanges(h),$("#".concat(i,"_datepicker_description")).on("blur input",(function(){validateRequiredFields()}));break;case f.SingleOptionSet:case f.MultiOptionSet:$("input[id*='".concat(i,"']")).on("change",(function(){validateRequiredFields(),qe.info({fn:setRequiredField,message:"Q3 updated... validateRequiredFields..."})}));break;case f.DropdownSelect:$("select[id*='".concat(i,"']")).on("change",(function(){validateRequiredFields()}));break;default:$("#".concat(i)).on("change keyup",(function(i){validateRequiredFields()}))}}function setDynamicallyRequiredFields(i){var a;(a=getOptions$1().form===g.Application?getFieldsBySectionApplication(i):getFieldsBySectionClaim(i))&&Object.keys(localStorage).filter((function(i){return i.startsWith("shouldRequire_")})).forEach((function(i){var d=i.replace("shouldRequire_",""),p=a.find((function(i){return i.name===d}));p&&p.elementType?setRequiredField(d,p.elementType):setRequiredField(d)}))}var ke=new Logger("common/fieldConditionalLogic");function initializeVisibleIf(i,a,d){var p=d.fieldName,u=d.selectedValue;p&&void 0!==u?(ke.info({fn:initializeVisibleIf,message:"Starting to configure dynamic field using visibleIf",data:{name:i,dependentSelectedValue:u,dependentFieldName:p,disableRequiredProp:!a}}),showFieldRow(i),initOnChange_DependentRequiredField({requiredFieldTag:i,dependentOnElementTag:p,dependentOnValue:u,disableRequiredProp:!a}),ke.info({fn:initializeVisibleIf,message:"Successfully initialized dynamic field with name: ".concat(i),data:{dependentSelectedValue:u,dependentFieldName:p,required:a}})):ke.error({fn:initializeVisibleIf,message:"Dynamically configured visibleIf field missing fieldName or selectedValue",data:{name:i,dependentFieldName:p,dependentSelectedValue:u}})}function initOnChange_DependentRequiredField(i){var a=i.dependentOnValue,d=i.dependentOnValueArray,p=i.dependentOnElementTag,u=i.requiredFieldTag,h=i.overrideTruthyClause,g=void 0===h?void 0:h,f=i.validationFunc,m=i.setRequiredFieldsFunc,v=i.disableRequiredProp,y=void 0!==v&&v,w=i.customFunc,_=document.querySelector("#".concat(p));_?(setupDependentRequiredField({dependentOnValue:a,dependentOnValueArray:d,dependentOnElementTag:p,requiredFieldTag:u,overrideTruthyClause:g,validationFunc:f,setRequiredFieldsFunc:m,disableRequiredProp:y,customFunc:w}),$(_).on("change",(function(){setupDependentRequiredField({dependentOnValue:a,dependentOnValueArray:d,dependentOnElementTag:p,requiredFieldTag:u,overrideTruthyClause:g,validationFunc:f,setRequiredFieldsFunc:m,disableRequiredProp:y,customFunc:w})}))):ke.error({fn:initOnChange_DependentRequiredField,message:"Could not find field for dependentOnElementTag: ".concat(p)})}function setupDependentRequiredField(i){var a=i.dependentOnValue,d=i.dependentOnValueArray,p=void 0===d?[]:d,u=i.dependentOnElementTag,h=i.requiredFieldTag,g=i.overrideTruthyClause,f=void 0===g?void 0:g,m=i.validationFunc,v=i.setRequiredFieldsFunc,y=i.disableRequiredProp,w=void 0!==y&&y,_=i.customFunc,q=document.querySelector("#".concat(u));if(q){var A=getControlValue({tr:q.closest("tr"),rawValue:!0});ke.info({fn:setupDependentRequiredField,message:"Setting up dependent field dependentOnElementTag: ".concat(u," with value: ").concat(A)}),null!=f?(ke.info({fn:setupDependentRequiredField,message:"Overriding truthy clause overrideTruthyClause: ".concat(f),data:{dependentOnElementTag:u,input:A}}),shouldRequireDependentField(!0===f?{shouldBeRequired:!0,requiredFieldTag:h,validationFunc:m,setRequiredFieldsFunc:v,disableRequiredProp:w,customFunc:_}:{shouldBeRequired:!1,requiredFieldTag:h,validationFunc:m,setRequiredFieldsFunc:v,disableRequiredProp:w,customFunc:_})):A===a||A==="".concat(a)||p.includes(A)?(ke.info({fn:setupDependentRequiredField,message:"Value matches visibleIf condition",data:{dependentOnElementTag:u,input:A,dependentOnValue:a,dependentOnValueArray:p,requiredFieldTag:h}}),shouldRequireDependentField({shouldBeRequired:!0,requiredFieldTag:h,validationFunc:m,setRequiredFieldsFunc:v,disableRequiredProp:w,customFunc:_})):(ke.info({fn:setupDependentRequiredField,message:"Value DOES NOT match visibleIf condition",data:{dependentOnElementTag:u,input:A,dependentOnValue:a,dependentOnValueArray:p,requiredFieldTag:h}}),shouldRequireDependentField({shouldBeRequired:!1,requiredFieldTag:h,validationFunc:m,setRequiredFieldsFunc:v,disableRequiredProp:w,customFunc:_}))}else ke.error({fn:setupDependentRequiredField,message:"Could not find field for dependentOnElementTag: ".concat(u)})}function shouldRequireDependentField(i){var a,d=i.shouldBeRequired,p=i.requiredFieldTag,u=i.validationFunc,h=void 0===u?validateStepFields:u,g=i.setRequiredFieldsFunc,f=void 0===g?setDynamicallyRequiredFields:g,m=i.disableRequiredProp,v=i.customFunc,y=document.querySelector("#".concat(p,"_label")),w=null==y?void 0:y.closest("tr"),_=document.querySelector("#".concat(p));y&&w&&_?(d?(ke.info({fn:shouldRequireDependentField,message:"Setting dynamic field to visible requiredFieldTag: ".concat(p)}),$(w).css({display:""}),m||(localStorage.setItem("shouldRequire_".concat(p),!0),f&&f(getCurrentStep()),h&&(h(getCurrentStep()),$(_).change((function(){h(getCurrentStep())}))))):(ke.info({fn:shouldRequireDependentField,message:"Setting dynamic field to hidden requiredFieldTag: ".concat(p)}),$(w).css({display:"none"}),m||($("#".concat(p,"_label")).parent().removeClass("required"),localStorage.removeItem("shouldRequire_".concat(p)),f&&f(getCurrentStep()),h&&h(getCurrentStep()),$(_).off("change")),null===(a=$("#".concat(p,"_name")))||void 0===a||a.val(""),$(_).val("")),v&&v()):ke.error({fn:shouldRequireDependentField,message:"Failed to find required elements",data:{requiredFieldTag:p,requiredFieldLabelElement:y,requiredFieldRow:w,requiredFieldInputElement:_}})}var Ce=Logger("application/steps/applicantInfo");function initOnChange_PreviouslyReceivedKttpFunding(){var i=$("#quartech_hasthisorganizationreceivedkttpfundingin");hideShow_for_PreviouslyReceivedKttpFunding(i.val()),Ce.info({fn:initOnChange_PreviouslyReceivedKttpFunding,message:"initOnChange_PreviouslyReceivedKttpFunding called."}),i.on("change",(function(){var i=$(this).val();Ce.info({fn:initOnChange_PreviouslyReceivedKttpFunding,message:"Selected Value: ".concat(i)}),hideShow_for_PreviouslyReceivedKttpFunding(i)}))}function hideShow_for_PreviouslyReceivedKttpFunding(i){var a="none";i===w&&(a="table-row"),$("#quartech_ifyespleaseexplainwhenandforwhichactivity").parent().parent().parent().css("display",a)}function initOnChange_OrganizationReceivedFundingFromBC(){var i=$("#quartech_hasthisorganizationreceivedfundingfrmother");hideShow_for_OrganizationReceivedFundingFromBC(i.val()),Ce.info({fn:initOnChange_OrganizationReceivedFundingFromBC,message:"initOnChange_OrganizationReceivedFundingFromBC called."}),i.on("change",(function(){var i=$(this).val();Ce.info({fn:initOnChange_OrganizationReceivedFundingFromBC,message:"Selected Value: ".concat(i)}),hideShow_for_OrganizationReceivedFundingFromBC(i)}))}function hideShow_for_OrganizationReceivedFundingFromBC(i){var a="none";i===w&&(a="table-row"),$("#quartech_ifyespleaseexplainwhenandfromwhichprogram").parent().parent().parent().css("display",a)}function initOnChange_IsCollaboratingWithOtherOrganizationQuestion(){var i=$("#quartech_areyoucollaboratingwithanyotherorg");hideShow_for_CollaboratingWithOtherOrgsControl(i.val()),Ce.info({fn:initOnChange_IsCollaboratingWithOtherOrganizationQuestion,message:"initOnChange_IsCollaboratingWithOtherOrganizationQuestion called."}),i.on("change",(function(){var i=$(this).val();Ce.info({fn:initOnChange_IsCollaboratingWithOtherOrganizationQuestion,message:"Selected Value: ".concat(i)}),hideShow_for_CollaboratingWithOtherOrgsControl(i)}))}function hideShow_for_CollaboratingWithOtherOrgsControl(i){var a="none";i===w&&(a="table-row"),$("#quartech_ifyespleaseprovidelegalbusinessorganization").parent().parent().parent().css("display",a),$("#quartech_ifyespleaseprovideacontactname").parent().parent().parent().css("display",a),$("#quartech_ifyespleaseprovideabriefbackgroundoutlinin").parent().parent().parent().css("display",a)}function initOnChange_ActivityOverMultipleDays(){var i=$("#quartech_doestheactivitytakeplaceovermultipleday");hideShow_for_ActivityOverMultipleDays(i.val()),Ce.info({fn:initOnChange_ActivityOverMultipleDays,message:"initOnChange_ActivityOverMultipleDays called."}),i.on("change",(function(){var i=$(this).val();Ce.info({fn:initOnChange_ActivityOverMultipleDays,message:"Selected Value: ".concat(i)}),hideShow_for_ActivityOverMultipleDays(i)}))}function hideShow_for_ActivityOverMultipleDays(i){var a="none";i===w?a="table-row":$("#quartech_ifyespleaseprovidetheadditionaldates").val(""),$("#quartech_ifyespleaseprovidetheadditionaldates").parent().parent().parent().css("display",a)}function initOnChange_AdaptedEventForAdultLearning(){var i=$("#quartech_theprocessoflearningandprocessingknowledge");hideShow_for_AdaptedEventForAdultLearning(i.val()),Ce.info({fn:initOnChange_AdaptedEventForAdultLearning,message:"initOnChange_AdaptedEventForAdultLearning called."}),i.on("change",(function(){var i=$(this).val();Ce.info({fn:initOnChange_AdaptedEventForAdultLearning,message:"Selected Value: ".concat(i)}),hideShow_for_AdaptedEventForAdultLearning(i)}))}function hideShow_for_AdaptedEventForAdultLearning(i){var a="none";i===w?a="table-row":$("#quartech_ifyespleasedescribehowtheproposedactivitie").val(""),$("#quartech_ifyespleasedescribehowtheproposedactivitie").parent().parent().parent().css("display",a)}function getTopic(i){$.ajax({url:"https://orgbook.gov.bc.ca/api/v4/search/topic",data:{q:i.topic_source_id}}).done((function(a){getTopicCredentials(a.total&&a.results.find((function(a){return a.source_id===i.topic_source_id}))||null)})).fail((function(i){Ce.error({fn:getTopic,message:"Unable to get topic",data:i})}))}function getTopicCredentials(i){i&&i.id&&$.ajax({url:"https://orgbook.gov.bc.ca/api/v4/topic/"+i.id+"/credential-set"}).done((function(i){!function updateBusinessNumberField(i,a){var d=a.find((function(i){return"business_number.registries.ca"===i.credential_type.description})),p=document.querySelector("#quartech_businessregistrationnumber");if(p&&d){var u=d.attributes.find((function(i){return"business_number"===i.type}));p.value=u&&u.value||"",$(p).trigger("change")}}(0,i&&i.length&&i.reduce((function(i,a){return i.concat(a.credentials.filter((function(i){return i.id===a.latest_credential_id})))}),[]).filter((function(i){return!i.revoked})))})).fail((function(i){Ce.error({fn:getTopicCredentials,message:"Unable to get topic credentials",data:i})}))}function setShowOrHideTipNotice(){showOrHideTipNotice(),$("#quartech_tipreportenrolled").on("change",(function(){showOrHideTipNotice()})),$("#quartech_agriprogramsubscriber").on("change",(function(){showOrHideTipNotice()}))}function showOrHideTipNotice(){var i,a,d=null===(i=document.querySelector("#quartech_agriprogramsubscriber"))||void 0===i?void 0:i.value,p=null===(a=document.querySelector("#quartech_tipreportenrolled"))||void 0===a?void 0:a.value,u=document.querySelector("#tipReportNotice");u&&("255550001"!==d||"255550002"!==p&&"255550000"!==p?$(u).css({display:"none"}):$(u).css({display:""}))}function processLocationData(i){return(null==i?void 0:i.value).reduce(((i,a)=>{const{quartech_name:d,quartech_RegionalDistrict:p}=a,{quartech_name:u}=null!=p?p:{quartech_name:"Other"};return i[u]?i[u].push(d):i[u]=[d],i}),{})}O.locations={processLocationData:processLocationData};var Ae=Logger("application/steps/project");function initOnChange_ActiviyOpenToPublic(){var i=$("#quartech_willthisactivitybeopentotheentirepublic");hideShow_WhyActiviyNotOpenToPublic(i.val()),Ae.info({fn:initOnChange_ActiviyOpenToPublic,message:"initOnChange_ActiviyOpenToPublic called."}),i.on("change",(function(){var i=$(this).val();Ae.info({fn:initOnChange_ActiviyOpenToPublic,message:"Selected Value: ".concat(i)}),hideShow_WhyActiviyNotOpenToPublic(i)}))}function hideShow_WhyActiviyNotOpenToPublic(i){i===w?($("#quartech_allactivitiesmustbeopentothepublicplease").parent().parent().css("display","none"),$("#quartech_allactivitiesmustbeopentothepublicplease").val("")):$("#quartech_allactivitiesmustbeopentothepublicplease").parent().parent().css("display","grid")}function setProjectStepRequiredFields(){configureFields();var i=getProgramAbbreviation();if(i&&i.includes("KTTP")){var a;initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_hasthisorganizationreceivedkttpfundingin",requiredFieldTag:"quartech_ifyespleaseexplainwhenandforwhichactivity"}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_hasthisorganizationreceivedfundingfrmother",requiredFieldTag:"quartech_ifyespleaseexplainwhenandfromwhichprogram"}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_areyoucollaboratingwithanyotherorg",requiredFieldTag:"quartech_ifyespleaseprovidelegalbusinessorganization",shouldBeRequired:!1}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_areyoucollaboratingwithanyotherorg",requiredFieldTag:"quartech_ifyespleaseprovideacontactname",shouldBeRequired:!1}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_areyoucollaboratingwithanyotherorg",requiredFieldTag:"quartech_ifyespleaseprovideabriefbackgroundoutlinin",shouldBeRequired:!1}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_areyouapplyingforatraceabilityknowledget",requiredFieldTag:"quartech_ifyespleaseexplainthetraceabilityactivityt"}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_doestheactivitytakeplaceovermultipleday",requiredFieldTag:"quartech_ifyespleaseprovidetheadditionaldates"}),initOnChange_DependentRequiredField({dependentOnValue:_,dependentOnElementTag:"quartech_willthisactivitybeopentotheentirepublic",requiredFieldTag:"quartech_allactivitiesmustbeopentothepublicplease"}),initOnChange_DependentRequiredField({dependentOnValue:q,dependentOnElementTag:"quartech_pleaseselectthemostapplicableactivitytype",requiredFieldTag:"quartech_ifotherpleasedescribeyouractivitytype"});var d=document.querySelector("#quartech_prioritytopics_i");initOnChange_DependentRequiredField((null===(a=document.querySelector("#quartech_prioritytopics_i"))||void 0===a?void 0:a.querySelector('li[aria-label="Other for Priority Topic(s)"]'))?{dependentOnElementTag:"quartech_prioritytopics_i",requiredFieldTag:"quartech_otherprioritytopic",overrideTruthyClause:!0}:{dependentOnElementTag:"quartech_prioritytopics_i",requiredFieldTag:"quartech_otherprioritytopic",overrideTruthyClause:!1});var p=new MutationObserver((function(i){var a;null!==(a=document.querySelector("#quartech_prioritytopics_i"))&&void 0!==a&&a.querySelector('li[aria-label="Other for Priority Topic(s)"]')?$("#quartech_otherprioritytopic_label").is(":visible")||initOnChange_DependentRequiredField({dependentOnElementTag:"quartech_prioritytopics_i",requiredFieldTag:"quartech_otherprioritytopic",overrideTruthyClause:!0}):initOnChange_DependentRequiredField({dependentOnElementTag:"quartech_prioritytopics_i",requiredFieldTag:"quartech_otherprioritytopic",overrideTruthyClause:!1})}));d&&d.nodeType===Node.ELEMENT_NODE&&p.observe(d,{attributes:!0,childList:!0,characterData:!0}),initOnChange_DependentRequiredField({dependentOnValue:q,dependentOnElementTag:"quartech_activitypurpose",requiredFieldTag:"quartech_ifotherpleasedescribetheactivitypurpose"}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_theprocessoflearningandprocessingknowledge",requiredFieldTag:"quartech_adulteducationandknowlegetransferdescript"})}if(i&&"NEFBA"===i){document.querySelector("#quartech_businessgoals_note")||addTextAboveField("quartech_businessgoals","
Note: Reimbursement for program costs will not be distributed unless you submit a complete new or updated business plan by March 1, 2024.

"),initOnChange_DependentRequiredField({dependentOnValue:"255550000",dependentOnElementTag:"quartech_completingcategory",requiredFieldTag:"quartech_stepstocompletethebusinessplan"}),initOnChange_DependentRequiredField({dependentOnValue:"255550001",dependentOnElementTag:"quartech_completingcategory",requiredFieldTag:"quartech_businessconsultantinformation"}),document.querySelector("#quartech_bciaregisteredconsultant_note")||addTextAboveField("quartech_bciaregisteredconsultant","
Note: The consultant must be registered with BCIA or as a CPA. Please select another consultant if they are not registered with either. See the Program Guide for more information.

"),document.querySelector("#quartech_nefba_project_step_note")||$("#EntityFormView > div.tab.clearfix > div > div").append('\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
');var u=document.querySelector("#quartech_completingcategory").value,h="255550001";u===h?(shouldRequireDependentField({shouldBeRequired:!0,requiredFieldTag:"quartech_bciaregisteredconsultant"}),setBciaOnChange()):(shouldRequireDependentField({shouldBeRequired:!1,requiredFieldTag:"quartech_bciaregisteredconsultant"}),shouldRequireDependentField({shouldBeRequired:!1,requiredFieldTag:"quartech_cpaconsultant"}),$("#quartech_bciaregisteredconsultant").off("change")),$("#quartech_completingcategory").on("change",(function(){document.querySelector("#quartech_completingcategory").value===h?(shouldRequireDependentField({shouldBeRequired:!0,requiredFieldTag:"quartech_bciaregisteredconsultant"}),setBciaOnChange()):(shouldRequireDependentField({shouldBeRequired:!1,requiredFieldTag:"quartech_bciaregisteredconsultant"}),shouldRequireDependentField({shouldBeRequired:!1,requiredFieldTag:"quartech_cpaconsultant"}),$("#quartech_bciaregisteredconsultant").off("change"))}))}if(i.includes("ABPP")||"NEFBA"===i){var g=$('fieldset[aria-label="Organization Information"]');g&&g.css("display","none");var f=$('fieldset[aria-label="Collaborating Organization Information"]');f&&f.css("display","none");var m=$('fieldset[aria-label="Activity Information"]');m&&m.css("display","none")}if(i&&i.includes("ABPP")){var v="ABPP1"===i?"event/training":"project";document.querySelector("#activityStartDateNotice")||addTextBelowField("quartech_whenistheprojectstartdate",'
\n Your '.concat(v," may have a delayed start date. However, all ").concat(v,"s must be submitted 90 days after the start date, unless an extension of the ").concat(v," has been granted by the Program Manager. Applications to extend any ").concat(v," will be considered on a case-by-case basis.\n
")),"ABPP2"===i&&(document.querySelector("#activityEndDateNotice")||addTextBelowField("quartech_activityenddate",'
\n Consultants must submit the '.concat(v," report to the Applicant for review and feedback at least two weeks prior to the ").concat(v," end date. Revisions requested by the Applicant must be completed by the Consultant and approved by the Applicant prior to the final submission to the program.\n
")))}"ABBP1"===getProgramAbbreviation()&&($('fieldset[aria-label="Program Category"]').css("display","none"),$('fieldset[aria-label="Consultant Information"]').css("display","none")),"ABPP2"===getProgramAbbreviation()&&(document.querySelector("#consultantNotice")||addTextAboveField("quartech_consultantcompanyname",'
\n **Please note that the Ministry reserves the right to refuse projects submitted with consultants who are not considered to be in good standing with the Ministry. Applications with unacceptable consultants listed will be held or waitlisted and the applicants will be given an opportunity to find an acceptable consultant. \n
'),document.querySelector("#moreThan10PercentNotice")||addTextBelowField("quartech_consultantcompletingoverlimit",'
\n **Please note that supporting consultants may not complete more than 40% of the proposed project. \n
'))}function setBciaOnChange(){$("#quartech_bciaregisteredconsultant").on("change",(function(){"255550002"===document.querySelector("#quartech_bciaregisteredconsultant").value?shouldRequireDependentField({shouldBeRequired:!0,requiredFieldTag:"quartech_cpaconsultant",setRequiredFieldsFunc:setProjectStepRequiredFields}):(shouldRequireDependentField({shouldBeRequired:!1,requiredFieldTag:"quartech_cpaconsultant",setRequiredFieldsFunc:setProjectStepRequiredFields}),$("#quartech_cpaconsultant").off("change"))}))}function setSingleOrGroupApplicant(){if(document.querySelector("#quartech_singleorgroupapplication").value===A){shouldRequireDependentField({shouldBeRequired:!0,requiredFieldTag:"quartech_coapplicatntsnames",setRequiredFieldsFunc:setProjectStepRequiredFields,disableRequiredProp:!0});var i=document.querySelector("#groupApplicationNotice");i?$(i).css({display:""}):addTextAboveField("quartech_coapplicatntsnames",'
\n If applying for a group project, please ensure all participants submit their own applications and indicate co-applicants as part of the application process.\n
')}else{shouldRequireDependentField({shouldBeRequired:!1,requiredFieldTag:"quartech_coapplicatntsnames",setRequiredFieldsFunc:setProjectStepRequiredFields,disableRequiredProp:!0});var a=document.querySelector("#groupApplicationNotice");a&&$(a).css({display:"none"})}}function setupChosen(){Ae.info({fn:setupChosen,message:"setting up chosen..."}),$(".chosen-select").chosen(),$(".chosen-select-deselect").chosen({allow_single_deselect:!0});var i=$("#quartech_venuelocationcitytownetcoronlinesoftwar").val();if(i){var a=i.split(", ");$(".chosen-select").val(a),$(".chosen-select").trigger("chosen:updated")}var d=document.getElementById("quartech_venuelocationcitytownetcoronlinesoftwar").closest("tr"),p=new MutationObserver((function(i){var a;"none"===(null==d||null===(a=d.style)||void 0===a?void 0:a.display)&&($(".chosen-select").val([]),$(".chosen-select").trigger("chosen:updated"))}));d&&d.nodeType===Node.ELEMENT_NODE&&p.observe(d,{attributes:!0,attributeFilter:["style"]}),$(".chosen-select").on("change",(function(){setFieldValue("quartech_venuelocationcitytownetcoronlinesoftwar",$(".chosen-select").val().join(", "))})),setupTooltip({name:"quartech_venuelocationcitytownetcoronlinesoftwar",tooltipText:"Project locations in addition to what you have provided in the question above",tooltipTargetElementId:"additionalLocationControl_chosen"}),Ae.info({fn:setupChosen,message:"successfully setup chosen..."})}function setShowOrHideEnvFarmPlanNotice(){showOrHideEnvFarmPlanNotice(),$("#quartech_tipreportenrolled").on("change",(function(){showOrHideEnvFarmPlanNotice()}))}function showOrHideEnvFarmPlanNotice(){var i,a=null===(i=document.querySelector("#quartech_statementofcompletionfromefpp"))||void 0===i?void 0:i.value,d=document.querySelector("#envFarmPlanNotice");d&&("255550001"===a?$(d).css({display:""}):$(d).css({display:"none"}))}var Te=Logger("application/steps/demographicInfo");function customizeDemographicInfoStep(i){Te.info({fn:customizeDemographicInfoStep,message:"Start customizing demographic info step, quartech_disabledchefsdemographicinfo: ".concat(null==i?void 0:i.quartech_disabledchefsdemographicinfo)}),configureFields(),null!=i&&i.quartech_disabledchefsdemographicinfo?(function addDemographicDataDescriptionOldVersionForABPP(){var i=document.createElement("div"),a=function getProgramEmailAddress(){var i;const a=localStorage.getItem("programData");return null===(i=JSON.parse(a))||void 0===i?void 0:i.quartech_programemailaddress}();i.innerHTML="

The Province of British Columbia supports inclusive and increased representation of underrepresented groups. By providing the information below, you are helping to improve the delivery of programming. At this time, the questions focus on three identity groups, and do not cover all potential groups who are underrepresented in the agriculture sector. We plan to expand the focus to other underrepresented groups in future.

"+'

Your personal information is collected under section 26(c) and 26(e) of the Freedom of Information and Protection of Privacy Act for the purposes of evaluating applications and for the planning and evaluating of the S-CAP Ministry Program. The demographic information you provide is voluntary and will not be used to assess your eligibility for this program. Each individual understands the purposes of the collection, use, and disclosure of their demographic personal information. The information you provide will be shared with the federal government to fulfill the provincial obligations under the Sustainable Canadian Agricultural Partnership (S-CAP) bilateral agreement. It may be combined with other survey or administrative data sources and used for statistical, research and evaluation purposes. If any information is published, your responses will be combined with the responses of others so that you cannot be identified. If you have any questions about the collection of your information, please contact the program manager at ').concat(a,".

")+'

Required Field *

',$("[data-name='DemographicData_Tab1']").parent().prepend(i)}(),function addViewExampleTo_Q1a(){var i=document.createElement("div");i.innerHTML='\n
\n
\n \n
\n
\n As an example, a company has 4 owners:\n
✍ 1 owner identifies as First Nation and a woman and owns 10% of the business.\n
✍ 1 owner identifies as a youth (40 or younger) and as Indigenous but the applicant is not aware of which specific Indigenous group this owner identifies with. This owner owns 50% of the business.\n
✍ 2 identify as non-Indigenous men over 40 and each owns 10% of the business.\n
✍ In this case, you would enter 10% for \'First Nations\', 10% for \'women\', 50% for \'youth\', 50% for \'Indigenous - not specified\', and 20% for \'none of the above groups\'. The numbers could add up to more than 100% - that\'s fine!\n
\n
\n
\n
\n
\n ',$("[data-name='Q1a_Section']").parent().prepend(i)}(),initOnChange_Question1_SoleProprietorshipOrGeneralPartnership(),initOnChange_Question2_Re_GoverningBoard(),initOnChange_Question2b_Re_OrganizationType(),function initOnChange_Question4_DoesYourOrganizationTargetAnyGroups(){var i,a="#quartech_doesyourorganizationtargetanyofthegroups_Container",d=$(a).find(".msos-option"),p=$(a).find("li>>input.msos-checkbox"),u=null===(i=d.filter((function(i){return d[i].innerText.includes("None")})))||void 0===i?void 0:i[0];$(u).on("click",(function(){var i=p.filter((function(i){return p[i].checked&&!p[i].ariaLabel.includes("None")}));i.length>0&&i.trigger("change",!1)}));var h=d.filter((function(i){return!d[i].innerText.includes("None")}));$(h).on("click",(function(){var i=p.filter((function(i){return p[i].checked&&p[i].ariaLabel.includes("None")}));i.length>0&&i.trigger("change",!1)}))}(),function addDemographicInfoPercentageColumnTitle(){$("#EntityFormView > div.tab.clearfix > div > div > fieldset:nth-child(3) > table > tbody").prepend('
Percentage of business shares owned
')}()):function showChefsIntegration(){(function addDemographicDataDescription(){var i=document.createElement("div");i.innerHTML="

Demographic Data Collection

\n

The Province of British Columbia supports inclusive and increased representation of underrepresented groups. By participating in the survey below, you are helping to improve the delivery of programming. At this time, the questions focus on three identity groups (Indigenous, women and youth), and do not cover all potential groups who are underrepresented in the agriculture sector. We plan to expand the focus to other underrepresented groups in future.

\n

The survey is conducted independently of the funding program to which you are applying, and your survey responses will not be included in your funding application. If you wish to save a copy of your survey responses, you will have the option of emailing it to yourself upon completion. Please see the top of the survey form for instructions on how to receive a copy by email.

",$("[data-name='DemographicData_Tab1']").parent().prepend(i)})(),function hideAllStepSections(){$("fieldset > table").parent().css("display","none")}(),$("[data-name='DemographicInfoChefsSubmissionSection']").parent().css("display","block"),addDemographicInfoChefsIframe()}()}function initOnChange_Question1_SoleProprietorshipOrGeneralPartnership(){var i=$("#quartech_question1reownerproprietorshiporparnership");hideShow_for_Question1_SoleProprietorshipOrGeneralPartnership(i.val()),Te.info({fn:initOnChange_Question1_SoleProprietorshipOrGeneralPartnership,message:"initOnChangeQuestion1 called."}),i.on("change",(function(){var i=$(this).val();Te.info({fn:initOnChange_Question1_SoleProprietorshipOrGeneralPartnership,message:"Selected Value: ".concat(i)}),hideShow_for_Question1_SoleProprietorshipOrGeneralPartnership(i)}))}function hideShow_for_Question1_SoleProprietorshipOrGeneralPartnership(i){var a="none",d="none",p="none";i===w?(a="block",d="none",p="none",$("#quartech_question2regoverningboard").prop("selectedIndex",0),$("#quartech_question2breorganizationtype").prop("selectedIndex",0),$("#quartech_numberofmembersofthegoverningbody").val(""),$("#quartech_numberofmembersofthegoverningbody").parent().parent().parent().css("display","none"),$("[data-name='Q2c_Section']").parent().css("display","none"),clearQuestion2dAnswers(),$(".msos-selecteditems-container ul li").remove()):i===_?(a="none",d="block",p="block",clearQuestion1abcAnswers()):(clearQuestion1abcAnswers(),$("#quartech_question2regoverningboard").prop("selectedIndex",0),$("#quartech_question2breorganizationtype").prop("selectedIndex",0),$("#quartech_numberofmembersofthegoverningbody").val(""),clearQuestion2dAnswers(),$("#quartech_numberofmembersofthegoverningbody").parent().parent().parent().css("display","none"),$("[data-name='Q2c_Section']").parent().css("display","none"),$(".msos-selecteditems-container ul li").remove()),$("[data-name='Q1a_Section']").parent().css("display",a),$("[data-name='Q1b_Q1c_Section']").parent().css("display",a),$("#quartech_question2breorganizationtype").parent().parent().parent().css("display","none"),$("#quartech_numberofmembersofthegoverningbody").parent().parent().parent().css("display","none"),$("[data-name='Q2_Section']").parent().css("display",d),$("[data-name='Q3_section']").parent().css("display",p),validateDemographicInfoRequiredFields()}function clearQuestion1abcAnswers(){$("#quartech_firstnationssharepercentage").val(""),$("#quartech_inukinuitsharepercentage").val(""),$("#quartech_mtissharepercentage").val(""),$("#quartech_indigenoussharepercentage").val(""),$("#quartech_womensharepercentage").val(""),$("#quartech_youth40orundersharepercentage").val(""),$("#quartech_nonindiginousnonwomennonyouthshare").val(""),$("#quartech_unabletoansweridentifysharepercentage").val(""),$("#quartech_newagricultureentrantssharepercentage").val(""),$("#quartech_declinetoidentifypercentageshares").prop("checked",!1),$("#quartech_percentagesharesownedbynewentrants").val(""),$("#quartech_commentsondemographicsofbusinessowners").val("")}function clearQuestion2dAnswers(){$("#quartech_firstnationsgoverningbodymembers").val(""),$("#quartech_inukinuitgoverningbodymembers").val(""),$("#quartech_mtisgoverningbodymembers").val(""),$("#quartech_indigenousnotspecifiedgoverningbodymember").val(""),$("#quartech_womengoverningbodymembers").val(""),$("#quartech_youthgoverningbodymembers").val(""),$("#quartech_nonindiginousnonwomennonyouthgovbodymbrs").val(""),$("#quartech_question2dgoverningbodymembersunabletoanswer").val(""),$("#quartech_declinetoidentifygoverningbodymember").prop("checked",!1)}function initOnChange_Question2_Re_GoverningBoard(){var i=$("#quartech_question2regoverningboard");hideShow_for_Question2_Re_GoverningBoard(i.val()),Te.info({fn:initOnChange_Question2_Re_GoverningBoard,message:"initOnChange_Question2_Re_GoverningBoard called."}),i.on("change",(function(){var i=$(this).val();Te.info({fn:initOnChange_Question2_Re_GoverningBoard,message:"Selected Value: ".concat(i)}),hideShow_for_Question2_Re_GoverningBoard(i)}))}function hideShow_for_Question2_Re_GoverningBoard(i){var a="none";i===w?a="table-row":($("#quartech_question2breorganizationtype").prop("selectedIndex",0),$("#quartech_numberofmembersofthegoverningbody").val(""),clearQuestion2dAnswers()),$("#quartech_question2breorganizationtype").parent().parent().parent().css("display",a),$("#quartech_numberofmembersofthegoverningbody").parent().parent().parent().css("display","none"),$("[data-name='Q2c_Section']").parent().css("display","none"),validateDemographicInfoRequiredFields()}function initOnChange_Question2b_Re_OrganizationType(){var i=$("#quartech_question2breorganizationtype");hideShow_for_Question2b_Re_OrganizationType(i.val()),Te.info({fn:initOnChange_Question2b_Re_OrganizationType,message:"initOnChange_Question2b_Re_OrganizationType called."}),i.on("change",(function(){var i=$(this).val();Te.info({fn:initOnChange_Question2b_Re_OrganizationType,message:"Selected Value: ".concat(i)}),hideShow_for_Question2b_Re_OrganizationType(i)}))}function hideShow_for_Question2b_Re_OrganizationType(i){var a="none",d="none";i===_?(d="block",a="table-row"):clearQuestion2dAnswers(),$("#quartech_numberofmembersofthegoverningbody").parent().parent().parent().css("display",a),$("[data-name='Q2c_Section']").parent().css("display",d),validateDemographicInfoRequiredFields()}function addDemographicInfoChefsIframe(){return _addDemographicInfoChefsIframe.apply(this,arguments)}function _addDemographicInfoChefsIframe(){return(_addDemographicInfoChefsIframe=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var i,a,d,p,u,h,g;return _regeneratorRuntime().wrap((function _callee$(f){for(;;)switch(f.prev=f.next){case 0:if(null===(i=$("#quartech_chefssubmissionid"))||void 0===i||null===(i=i.closest("tr"))||void 0===i||i.css({display:"none"}),setFieldReadOnly("quartech_chefsconfirmationid"),d=null===(a=$("#quartech_chefssubmissionid"))||void 0===a?void 0:a.val(),p="",!d){f.next=8;break}p="https://submit.digital.gov.bc.ca/app/form/success?s=".concat(d),f.next=15;break;case 8:return f.next=10,getEnvVars();case 10:u=f.sent,(h=u.quartech_ChefsDemographicDataFormId)||alert("Bad config: Applicant Portal Config should contain the ChefsDemographicDataFormId element"),p="https://submit.digital.gov.bc.ca/app/form/submit?f=".concat(h),window.addEventListener("message",(function(i){if("https://submit.digital.gov.bc.ca"==i.origin&&i.data.indexOf("submissionId")>-1){var a=JSON.parse(i.data);Te.info({fn:addDemographicInfoChefsIframe,message:"received submissionId: "+a.submissionId}),$("#quartech_chefssubmissionid").val(a.submissionId),setFieldValue("quartech_chefsconfirmationid",a.submissionId.substring(0,8).toUpperCase())}}));case 15:(g=document.createElement("div")).innerHTML="
'),$("#quartech_chefsconfirmationid_label").parent().parent().prepend(g);case 19:case"end":return f.stop()}}),_callee)})))).apply(this,arguments)}var $e=new Logger("steps/documents");function customizeDocumentsStep$1(){$e.info({fn:customizeDocumentsStep$1,message:"Start customizing documents step"}),configureFields();var i=getProgramAbbreviation();if($e.info({fn:customizeDocumentsStep$1,message:"Configuring documents label for programAbbreviation: ".concat(i)}),i&&i.includes("ABPP")){var a="";"ABPP1"===i&&(a="\n
\n

\n
    \n
  • Event/training budget (if not outlined in Deliverables & Budget tab)
  • \n
  • \n Verification of the last year of farming income (T2042, T1273, or Schedule 125 - \n Farm Revenue) detailing sales by commodity revenue code) or business income \n if applying as a food processor\n
  • \n
  • Direct Deposit Application (template available on program webpage)
  • \n
\n
\n "),"ABPP2"===i&&(a='\n
\n

\n
    \n
  • Project budget
  • \n
  • \n Consultant resume\n
  • \n
  • Supporting consultant resume (if applicable)
  • \n
  • Verification of the last year of farming income
  • \n
  • Direct Deposit Application (template available on program webpage)
  • \n
\n
\n ');var d=document.querySelector("#quartech_relatedquotesandplans_label");$e.info({fn:customizeDocumentsStep$1,message:"Setting documents label html for fileUploadLabel: ".concat(d)}),$(d).after(a)}}function addNewAppSystemNotice(){var i,a=document.createElement("div");a.id="new_app_system_notice_div",a.style="float: left;";var d=null===(i=getGlobalConfigData())||void 0===i?void 0:i.SystemNotice;a.innerHTML=d,$("#NextButton").parent().parent().parent().append(a)}var Oe=Logger("application/application");function updatePageForSelectedProgram$1(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(i||(i=getProgramId()),!i&&"complete"!==a.readyState)return Oe.info({fn:updatePageForSelectedProgram$1,message:"Could not find programid, retry when DOM readyState is comlete",data:{readyState:a.readyState}}),void onDocumentReadyState((function(){updatePageForSelectedProgram$1()}));var d=getCurrentStep();if(!i||"UnknownStep"===d)return hideLoadingAnimation(),void Oe.error({fn:updatePageForSelectedProgram$1,message:"Missing programid, or unknown current step",data:{programid:i,currentStep:d}});Oe.info({fn:updatePageForSelectedProgram$1,message:"Retrieving Program data for the selected programid querystring: ".concat(i)}),getApplicationFormData({programId:i,beforeSend:function beforeSend(){Oe.info({fn:updatePageForSelectedProgram$1,message:"clear any cached data from previous page loads"}),localStorage.clear()},onSuccess:function onSuccess(i,a,d){i&&(Oe.info({fn:updatePageForSelectedProgram$1,message:"Retrieved Program data:",data:i}),localStorage.setItem("programData",JSON.stringify(i)),Oe.info({fn:updatePageForSelectedProgram$1,message:"Update application page with the program data."}),updateFormStepForSelectedProgram(i),hideLoadingAnimation(),validateRequiredFields(),addFormDataOnClickHandler())}})}function updateFormStepForSelectedProgram(i){Oe.info({fn:updateFormStepForSelectedProgram,message:"Begin updating form step for program"}),function populateContentForSelectedProgramStream$1(i){$("#page-title").text(i.quartech_portalapplicationpagetitle),$("#page-subtitle").text(i.quartech_portalapplicationpagesubtitle),$("#page-description").html(i.quartech_portalapplicationpagedescription),$("#quartech_program").val()||function populateProgramLookup(i,a){$("#quartech_program").val(i),$("#quartech_program_name").val(a),$("#quartech_program_entityname").val("msgov_program")}(i.msgov_programid,i.msgov_programname)}(i);var a=getProgramAbbreviation();switch(a&&"NEFBA"===a?($("div[id*='ProgressIndicator'] li:contains('Deliverables & Budget')").css("display","none"),$("div[id*='ProgressIndicator'] li:contains('Documents')").css("display","none")):a&&a.includes("KTTP")&&($("div[id*='ProgressIndicator'] li:contains('Documents')").css("display","none"),$("div[id*='ProgressIndicator'] li:contains('Eligibility')").css("display","none")),getCurrentStep()){case m.ApplicantInfo:!function customizeApplicantInfoStep$1(){!function setupApplicantInfoStepFields(){configureFields();var i=getProgramAbbreviation();i&&"NEFBA"===i&&(initOnChange_DependentRequiredField({dependentOnValue:"255550001",dependentOnElementTag:"quartech_fillingfarmingincomeontaxreturn",requiredFieldTag:"quartech_firstyearclaimedfarmingincome"}),initOnChange_DependentRequiredField({dependentOnValue:"255550000",dependentOnElementTag:"quartech_fillingfarmingincomeontaxreturn",requiredFieldTag:"quartech_firstyearfarmoperationgeneratingrevenue"})),i&&i.includes("ABPP")&&(document.querySelector("#tipReportNotice")||addTextBelowField("quartech_tipreportenrolled",'
\n The TIP report is a free, simplified cash-basis farm financial analysis, which provides you with a cost of production (COP) report to compare your own farm’s current year (income and expenses) to your previous 5-year average and to benchmarks with other farms of similar type and income range: Towards Increased Profits (TIP) report - Province of British Columbia (gov.bc.ca)​.\n
'),initOnChange_DependentRequiredField({dependentOnValue:"255550001",dependentOnElementTag:"quartech_agriprogramsubscriber",requiredFieldTag:"quartech_tipreportenrolled",customFunc:setShowOrHideTipNotice}),setShowOrHideTipNotice()),i&&(i.includes("ABPP")||"NEFBA"===i||"NEFBA2"===i)&&(addTextAboveField("quartech_indigenousapplicant","
The Province is committed to supporting the success of Indigenous businesses in the agriculture and food sector. We understand that Indigenous businesses may have distinct characteristics reflecting regulatory, operational, cultural, and other factors. We aim for flexibility in our program delivery to reduce barriers and ensure the accessibility of our programs. If you are interested in applying to the Program but have questions about the application process or eligibility criteria, please contact Program staff at Agribusiness@gov.bc.ca

"),initOnChange_DependentRequiredField({dependentOnValue:"255550001",dependentOnElementTag:"quartech_recipienttype",requiredFieldTag:"quartech_commodity"}),initOnChange_DependentRequiredField({dependentOnValue:"255550001",dependentOnElementTag:"quartech_recipienttype",requiredFieldTag:"quartech_othercommoditiesproducedharvested",disableRequiredProp:!0}),initOnChange_DependentRequiredField({dependentOnValue:"255550002",dependentOnElementTag:"quartech_recipienttype",requiredFieldTag:"quartech_primarilyprocess"}),initOnChange_DependentRequiredField({dependentOnValue:"255550002",dependentOnElementTag:"quartech_recipienttype",requiredFieldTag:"quartech_otherproductsprocessed",disableRequiredProp:!0})),$("#quartech_recipienttype").on("change",(function(){$("#quartech_commodity_name").val(""),$("#quartech_primarilyprocess_name").val(""),$("#quartech_othercommoditiesproducedharvested_i .msos-selecteditems-container ul li").remove(),$("#quartech_otherproductsprocessed_i .msos-selecteditems-container ul li").remove()}))}(),initOnChange_PreviouslyReceivedKttpFunding(),initOnChange_OrganizationReceivedFundingFromBC(),initOnChange_IsCollaboratingWithOtherOrganizationQuestion(),initOnChange_ActivityOverMultipleDays(),initOnChange_AdaptedEventForAdultLearning(),function initOrgNameAutocomplete(){var i=document.querySelector("#quartech_legalbusinessororganizationname");i&&useScript("jqueryui",(function(){$(i).autocomplete({source:function source(i,a){getOrgbookAutocompleteData({searchStr:i.term,onSuccess:function onSuccess(i){var d=i.total?i.results:[];a(d)}})},minLength:2,select:function select(i,a){$("#quartech_nocragstnumber").prop("checked")||getTopic(a.item)}})}))}(),function customizeTypesOfBusinessOrganization(){(function hideTypesOfBusinessOrganization(){var i,a=null===(i=getProgramData())||void 0===i?void 0:i.quartech_typesofbusinesstodisplay;if(a){var d=JSON.parse(a);d&&$("#quartech_recipienttype option").each((function(){var i=this.value;""!=i&&null==d[i]&&(this.hidden=!0)}))}})(),function addTooltipsToTypesOfBusinessOrganization(){var i,a=null===(i=getGlobalConfigData())||void 0===i?void 0:i.TypeOfBusiness_ToolTips;a&&$("#quartech_recipienttype option").each((function(){var i=this.value,d=a[i];d&&(this.title=d.Tooltip)}))}()}(),getProgramAbbreviation().includes("ABPP")&&function customizeApplicantInfoStepForABPP(){addTextAboveField("quartech_businessdescription",'
\n
Please provide a brief description of your business e.g.,
\n
    \n
  • For Primary Producer - farm size in production in units such as acres, metres squared, and number and type of animals, marketing channels (farm gate, wholesale, retail/use of social media)
  • \n
  • OR For Processor - size of processing area in units such as square feet or metres, number and type of B.C. products used and/or produced, marketing channels (direct, wholesale, retail/use of social media)
  • \n
\n
')}(),"NEFBA"===getProgramAbbreviation()&&function customizeApplicantInfoStepForNEFBA(){var i=$('fieldset[aria-label="Business Overview"]');i&&i.css("display","none")}()}();break;case m.Eligibility:!function customizeEligibilityStep(){!function setupEligibilityStepFields(){configureFields();var i=getProgramAbbreviation();i&&"NEFBA2"===i&&(addHtmlToSection("eligibilitySection",'See program guide for the Phase 2 eligibility requirements: program guide

',"top"),document.querySelector("#envFarmPlanNotice")||addHtmlToSection("eligibilitySection",'\n
\n

Environmental Farm Plan Program

\n \n Participation in the EFP program is free and confidential. Applicants are encouraged to start the EFP process as soon as possible.\n \n
\n ',"bottom"),initOnChange_DependentRequiredField({dependentOnValue:"255550001",dependentOnElementTag:"quartech_statementofcompletionfromefpp",requiredFieldTag:"quartech_commitmenttoefp",customFunc:setShowOrHideEnvFarmPlanNotice}),setShowOrHideEnvFarmPlanNotice()),i&&(i.includes("ABPP")||"NEFBA"===i)&&addHtmlToSection("eligibilitySection","Please answer the following questions to confirm your eligibility for the program.
Note that applicants may be audited and must be able to demonstrate the validity of information provided in this application form.

","top"),i&&i.includes("ABPP")&&(initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_abppsupportoverlimit",requiredFieldTag:"quartech_abppsupportoverlimitdetail"}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_supportreceivedduringscap",requiredFieldTag:"quartech_supportduringscapdetails"})),i&&"NEFBA"===i&&initOnChange_DependentRequiredField({dependentOnValue:"255550001",dependentOnElementTag:"quartech_bcregisteredbusinessentity",requiredFieldTag:"quartech_committedbizregistrationbeforecompletion"})}()}();break;case m.Project:!function customizeProjectStep(i){setProjectStepRequiredFields(),function setProjectStepDependentRequiredFields(){var i,a=getProgramAbbreviation();a.includes("KTTP")&&(initOnChange_DependentRequiredField({dependentOnValue:T,dependentOnElementTag:"quartech_naicsindustry",requiredFieldTag:"quartech_ifotherpleasedescribecommodity"}),initOnChange_DependentRequiredField({dependentOnValueArray:["255550001","255550002"],dependentOnElementTag:"quartech_eventtype",requiredFieldTag:"quartech_projectlocation"}),initOnChange_DependentRequiredField({dependentOnValue:"255550001",dependentOnElementTag:"quartech_projecttakesplaceinotherplaces",requiredFieldTag:"quartech_venuelocationcitytownetcoronlinesoftwar"})),"ABPP2"===a&&(initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_useofsupportingconsultant",requiredFieldTag:"quartech_consultantcompletingoverlimit"}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_useofsupportingconsultant",requiredFieldTag:"quartech_supportingconsultantcompanyname"}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_useofsupportingconsultant",requiredFieldTag:"quartech_supportingconsultantfullname"}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_useofsupportingconsultant",requiredFieldTag:"quartech_supportingconsultantpositiontitle"}),initOnChange_DependentRequiredField({dependentOnValue:w,dependentOnElementTag:"quartech_useofsupportingconsultant",requiredFieldTag:"quartech_supportingconsultantrationale"}),setSingleOrGroupApplicant(),document.querySelector("#quartech_singleorgroupapplication")&&function setSingleOrGroupApplicantOnChange(){$("#quartech_singleorgroupapplication").on("change",(function(){setSingleOrGroupApplicant()}))}());var d=document.querySelector("#quartech_inordertocontinuouslyimprovecommunications_i");(null===(i=document.querySelector("#quartech_inordertocontinuouslyimprovecommunications_i"))||void 0===i?void 0:i.querySelector('li[aria-label="Other for In order to continuously improve communications"]'))?initOnChange_DependentRequiredField({dependentOnElementTag:"quartech_inordertocontinuouslyimprovecommunications_i",overrideTruthyClause:!0,requiredFieldTag:"quartech_ifotherpleasedescribe"}):initOnChange_DependentRequiredField({dependentOnElementTag:"quartech_inordertocontinuouslyimprovecommunications_i",overrideTruthyClause:!1,requiredFieldTag:"quartech_ifotherpleasedescribe"});var p=new MutationObserver((function(i){var a;null!==(a=document.querySelector("#quartech_inordertocontinuouslyimprovecommunications_i"))&&void 0!==a&&a.querySelector('li[aria-label="Other for In order to continuously improve communications"]')?$("#quartech_ifotherpleasedescribe_label").is(":visible")||initOnChange_DependentRequiredField({dependentOnElementTag:"quartech_inordertocontinuouslyimprovecommunications_i",overrideTruthyClause:!0,requiredFieldTag:"quartech_ifotherpleasedescribe"}):initOnChange_DependentRequiredField({dependentOnElementTag:"quartech_inordertocontinuouslyimprovecommunications_i",overrideTruthyClause:!1,requiredFieldTag:"quartech_ifotherpleasedescribe"})}));d&&d.nodeType===Node.ELEMENT_NODE&&p.observe(d,{attributes:!0,childList:!0,characterData:!0})}(),function displayLabelsForProjectStep(i){var a=JSON.parse(i.quartech_portalappfieldsdisplaynamesmapping);if(a)for(var d=0,p=Object.entries(a);d\n \n \n '),$("#".concat(d)).css({display:"none"}),Object.keys(p).forEach((function(i){var a=$('');p[i].forEach((function(i){$('