(()=>{var t={554(){const{CalculatedFormula:t}=JetFormBuilderAbstract,{addAction:e}=JetPlugins.hooks,r="__JFB_OPTION_FIELD_DEFAULT_VALUE_OBSERVER__";function n(t){if("string"!=typeof t||t.length<2)return t;const e=t.charAt(0),r=t.charAt(t.length-1);return"'"===e&&"'"===r||'"'===e&&'"'===r?t.slice(1,-1):t}function i(t){return Array.isArray(t)?t.some(i):"string"==typeof t&&t.includes("%")}function s(t){return!(""===t||null===t||Array.isArray(t)&&!t.length)}function o(e,r){const o=Array.isArray(r)?r:[r],a=[],u=new Array(o.length);o.forEach((c,l)=>{const f=new t(e);f.observe(function(t){if("string"!=typeof t)return t;const e=t.trim();return!i(e)||function(t){if("string"!=typeof t||t.length<2)return!1;const e=t.charAt(0),r=t.charAt(t.length-1);return"'"===e&&"'"===r||'"'===e&&'"'===r}(e)?e:`'${e.replace(/'/g,"\\'")}'`}(c)),f.setResult=()=>{const t=f.calculate();s(t)&&(u[l]=t,Object.keys(u).length===o.length&&u.every(s)&&(function(t,e){if(Array.isArray(e))return void t.value.setIfEmpty(e.map(t=>n(""+t)));const r=n(""+e);if(!t.isArray())return function(t){if(t.isArray()||"select"!==t.inputType)return!1;const[e]=t.nodes;if(!e||"select-one"!==e.type||e.multiple||!e.options?.length)return!1;const r=Array.from(e.options),[n]=r;return!!n&&!r.some(t=>""===t.value)&&!r.some(t=>t.defaultSelected)&&0===e.selectedIndex&&e.value===n.value}(t)?void(t.value.current=r):void t.value.setIfEmpty(r);const i=function(t){if("string"!=typeof t)return t;const e=t.trim();try{const r=JSON.parse(e);return Array.isArray(r)?r:t}catch(r){if(e.startsWith("[")&&e.endsWith("]")&&e.includes("'"))try{const r=e.replace(/'((?:\\'|[^'])*)'/g,(t,e)=>`"${e.replace(/"/g,'\\"')}"`),n=JSON.parse(r);return Array.isArray(n)?n:t}catch(e){return t}return t}}(r);t.value.setIfEmpty(Array.isArray(i)?i.map(t=>n(""+t)):[r])}(e,Array.isArray(r)?u:u[0]),a.forEach(t=>t.clearWatchers())))},f.setResult(),a.push(f)})}function a(t){var e,r,n;const[s]=t.nodes,a=null!==(e=t.wrapper)&&void 0!==e?e:s,u=null!==(r=null!==(n=a?.dataset?.defaultVal)&&void 0!==n?n:s?.dataset?.defaultVal)&&void 0!==r?r:"",c=function(t){if("string"!=typeof t)return t;const e=t.trim();try{const t=JSON.parse(e);return Array.isArray(t)?t:e}catch(t){if(e.startsWith("[")&&e.endsWith("]")&&e.includes("'"))try{const t=e.replace(/'((?:\\'|[^'])*)'/g,(t,e)=>`"${e.replace(/"/g,'\\"')}"`),r=JSON.parse(t);return Array.isArray(r)?r:e}catch(t){return e}return e}}(u);(function(t,e){if(Array.isArray(e))return e.length>0;if("string"!=typeof t)return i(e);const r=t.trim();return i(e)||r.startsWith("[")&&r.endsWith("]")})(u,c)&&o(t,c)}window[r]||(window[r]=!0,e("jet.fb.observe.after","jet-form-builder/option-field-default-value",function(t){for(const e of t.getInputs()){const[t]=e.nodes;t&&["select","radio","checkbox"].includes(e.inputType)&&a(e)}}))}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,r),s.exports}(()=>{"use strict";const{InputData:t,ReactiveHook:e}=JetFormBuilderAbstract;function n(){function r(t){return Array.isArray(t)?(1===t.length&&t[0]&&t[0].includes(",")&&(t=t[0].split(",")),t):[t].filter(Boolean)}t.call(this),this.isSupported=function(t){return"select-multiple"===t?.type},this.addListeners=function(){this.sanitize(t=>Array.isArray(t)?t:[t]),this.sanitize(r);const[t]=this.nodes;t.addEventListener("change",()=>this.setValue()),t.addEventListener("blur",()=>this.reportOnBlur()),this.enterKey=new e,t.addEventListener("keydown",this.handleEnterKey.bind(this))},this.setValue=function(){this.value.current=this.getActiveValue()},this.getActiveValue=function(){const[t]=this.nodes;return Array.from(t.options).filter(t=>t.selected).map(t=>t.value)},this.onClear=function(){this.silenceSet([])}}n.prototype=Object.create(t.prototype);const i=n,{BaseSignal:s}=JetFormBuilderAbstract;function o(){s.call(this),this.isSupported=function(t,e){return["select-multiple","select-one"].includes(t?.type)},this.runSignal=function(){const[t]=this.input.nodes,e="select-one"!==t?.type,{value:r}=this.input;this.input.calcValue=0;for(const i of t.options){var n;i.selected=e?r.current?.includes(i.value):i.value===r.current,i.selected&&(this.input.calcValue+=parseFloat(null!==(n=i.dataset?.calculate)&&void 0!==n?n:i.value))}this.triggerJQuery(t)}}o.prototype=Object.create(s.prototype);const a=o;r(554);const{addFilter:u}=JetPlugins.hooks;window.JetFormBuilderAbstract={...window.JetFormBuilderAbstract,MultiSelectData:i,SignalSelect:a},u("jet.fb.inputs","jet-form-builder/select-field",function(t){return[i,...t]}),u("jet.fb.signals","jet-form-builder/select-field",function(t){return[a,...t]})})()})();