function getStyle(a,b){var c,d=(a.ownerDocument||document).defaultView;return d&&d.getComputedStyle?(b=b.replace(/([A-Z])/g,"-$1").toLowerCase(),d.getComputedStyle(a,null).getPropertyValue(b)):a.currentStyle?(b=b.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),c=a.currentStyle[b],/^\d+(em|pt|%|ex)?$/i.test(c)?function(b){var c=a.style.left,d=a.runtimeStyle.left;return a.runtimeStyle.left=a.currentStyle.left,a.style.left=b||0,b=a.style.pixelLeft+"px",a.style.left=c,a.runtimeStyle.left=d,b}(c):c):void 0}function getIframeWindow(a){var b;return a.contentWindow?a.contentWindow:a.window?a.window:(!b&&a.contentDocument&&(b=a.contentDocument),!b&&a.document&&(b=a.document),b&&b.defaultView?b.defaultView:b&&b.parentWindow?b.parentWindow:void 0)}function widgetAutoFill(){function a(a){$H(a).each(function(a){var b=a.key,d=a.value;try{switch(d.type){case"control_scale":case"control_radio":if(void 0==d.name)var f=$$("#id_"+b+' input[type="radio"]');else var f=document.getElementsByName("q"+b+"_"+("control_radio"==d.type||"control_scale"==d.type?d.name:b));$A(f).each(function(a){a.value==d.value?(a.checked=!0,a.writeAttribute("checked","checked"),c(a),a.checked=!0):null!=d.items.other&&($("other_"+b).checked=!0,$("other_"+b).writeAttribute("checked","checked"),$("input_"+b).value=d.items.other,c($("input_"+b)),$("input_"+b).checked=!0)});break;case"control_checkbox":var g=$$("#id_"+b+' input[type="checkbox"]');$A(g).each(function(a){a.checked=!1,a.removeAttribute("checked"),"[object Array]"===Object.prototype.toString.call(d.items)?d.items.include(a.value)&&(a.checked=!0,a.writeAttribute("checked","checked"),c(a),a.checked=!0):Object.values(d.items).include(a.value)?(a.checked=!0,a.writeAttribute("checked","checked"),c(a),a.checked=!0):null!=d.items.other&&($("other_"+b).checked=!0,$("other_"+b).writeAttribute("checked","checked"),$("input_"+b).disabled=!1,$("input_"+b).value=d.items.other,c(a),$("input_"+b).checked=!0)});break;case"control_yesno":var h=$$("#id_"+b+' input[type="radio"]');$A(h).each(function(a){a.value===d.value&&(a.checked=!0,a.writeAttribute("checked","checked"),c(a),a.checked=!0)});break;case"control_dropdown":var i=$("input_"+b);if(i){if(e){var j=i.up().querySelector("div.jfInput-dropdown").classList.contains("isMultiple");if(j){var k=d.items[0].split(",");k.forEach(function(a){i.querySelector('option[value="'+a+'"]').selected=!0})}else i.putValue(d.value)}else if(i.hasAttribute("multiple")){var l=$$("#id_"+b+" option");$A(l).each(function(a){d.items.include(a.value)&&(a.selected=!0)})}else i.putValue(d.value);i.triggerEvent("change")}break;case"control_rating":if(e){var m=document.getElementById("input_"+b+"_"+d.value);m.checked=!0,c(m)}else $("input_"+b)&&$("input_"+b).setRating(d.value);break;case"control_datetime":case"control_fullname":if($H(d.items).each(function(a){$(a.key+"_"+b)&&($(a.key+"_"+b).value=a.value||"",$(a.key+"_"+b).triggerEvent("change"))}),$("lite_mode_"+b)){var n=d.items;"year"in n&&"month"in n&&"day"in n&&""!==n.year&&""!==n.month&&""!==n.day&&JotForm.formatDate({date:new Date(n.year,n.month-1,n.day),dateField:$("id_"+b)})}break;case"control_emojislider":for(var o,p=document.getElementById("cid_"+b),h=p.querySelectorAll("input[type=radio]"),q=0,r=0;o=h[r];r++)o.value===d.value&&(o.checked=!0,q=r);var s=p.querySelector(".js-emojiSlider");s.addClassName("isFilled");var t=s.querySelectorAll(".js-emojiScaleSep"),u=t[q].getAttribute("data-scale"),v=s.querySelector(".js-emojiSlider-faceList");v.style.width=u+"%";var w=v.querySelectorAll(".js-emojiFaces");w.forEach(function(a){a.removeClassName("isVisible")}),w[q].addClassName("isVisible");break;case"control_phone":case"control_birthdate":case"control_address":case"control_time":if($H(d.items).each(function(a){$("input_"+b+"_"+a.key)&&$("input_"+b+"_"+a.key).putValue(a.value)}),"control_time"===d.type&&$("input_"+b+"_hourSelect")&&$("input_"+b+"_hourSelect").triggerEvent){if($("input_"+b+"_timeInput")){var x=$("input_"+b+"_hourSelect").value;10>x&&(x="0"+x,$("input_"+b+"_hourSelect").putValue(x));var y=$("input_"+b+"_minuteSelect").value;10>y&&(y="0"+y),$("input_"+b+"_timeInput").putValue(x+":"+y)}$("input_"+b+"_hourSelect").triggerEvent("change")}break;case"control_email":var z=$("input_"+b);if(z){z.putValue(d.value),z.triggerEvent("change");var A=$("input_"+b+"_confirm");A&&(A.putValue(d.value),A.triggerEvent("change"))}break;case"control_textarea":if(d.value.length>0){var B=$("input_"+b);B.up("div").down(".nicEdit-main")&&nicEditors&&nicEditors.findEditor("input_"+b)&&nicEditors.findEditor("input_"+b).setContent(d.value),B.putValue(d.value),c(B),e&&Array.prototype.forEach.call(CardForm.cards,function(a){a.question.id===b&&a.markdownEditor&&a.markdownEditor.setHtmlFromMarkdown&&a.markdownEditor.setHtmlFromMarkdown()}),B.hasClassName("form-custom-hint")&&(B.removeClassName("form-custom-hint").removeAttribute("spellcheck"),B.hasContent=!0,B.run("focus"))}else B.hasClassName("form-custom-hint")&&B.run("blur");break;default:$("input_"+b)&&($("input_"+b).putValue(d.value),$("input_"+b).triggerEvent("change"))}}catch(C){}})}function b(a){a.forEach(function(a){var b=a.qid,d=$("input_"+b),f=a.type;switch(f){case"control_scale":case"control_radio":var g=$$("#id_"+b+' input[type="radio"]');$A(g).each(function(a){a.checked=!1,a.removeAttribute("checked"),c(a)});break;case"control_checkbox":var h=$$("#id_"+b+' input[type="checkbox"]');$A(h).each(function(a){a.checked=!1,a.removeAttribute("checked"),c(a)});break;case"control_yesno":break;case"control_rating":if(e){var g=$$("#id_"+b+' input[type="radio"]');$A(g).each(function(a){a.checked&&(a.checked=!1,a.click())}),$$("#id_"+b+" li").invoke("removeClassName","checked"),$$("#id_"+b+' input[type="hidden"]').last().putValue("")}else $("input_"+b).setRating("");break;case"control_datetime":case"control_fullname":$$("input[id*=_"+b+"]").each(function(a){a.putValue("")});break;case"control_emojislider":break;case"control_phone":case"control_birthdate":case"control_address":case"control_time":$$("[id*=input_"+b+"]").each(function(a){a.putValue("")}),"control_time"===f&&$("input_"+b+"_hourSelect")&&$("input_"+b+"_hourSelect").triggerEvent&&$("input_"+b+"_hourSelect").triggerEvent("change");break;case"control_email":case"control_textarea":case"control_dropdown":default:if(d&&(d.putValue(""),d.triggerEvent("change"),"control_email"===f)){var i=$("input_"+b+"_confirm");i&&(i.putValue(""),i.triggerEvent("change"))}}})}function c(a){if(a.type&&a.type.match(/checkbox|radio/)){var b=window.scrollX,c=window.scrollY;return["click","change"].forEach(function(b){a.triggerEvent(b)}),c!==window.scrollY&&window.scrollTo(b,c),void 0}a.triggerEvent("change")}function d(a,b){var c={};switch(b+="",a){case"control_fullname":var d=b.replace(/^\s+|\s+$/g,"");d=d.split(/\s+/g),c={first:d[0],last:d[1]},3==d.length&&(c.middle=d[1],c.last=d[2]);break;case"control_checkbox":case"control_dropdown":c=b.split(/\r\n|\r|\n|\,|\
/g);break;case"control_phone":var e=b.split(/\s+/g);c={area:e[0],phone:e[1],full:b};break;case"control_time":if(/^([0]?\d|[1][0-2]):([0-5]\d)\s?(?:AM|PM)$/.test(b)){var f=b.split(" ");if(f.length>0){var g=f[0].split(":");c={ampm:f[1],hourSelect:g[0],minuteSelect:g[1]}}}}return c}var e=!!window.CardForm;return{parse:a,clear:b,generateCtrlItems:d}}function widgetFrameLoaded(a){function b(){var a=navigator.userAgent.match(/(?:MSIE |Trident\/.*; rv:)(\d+)/);return a?parseInt(a[1]):void 0}function c(){return JotForm.validateAll()&&0===$$(".form-line-error").length}function d(a){try{JSON.parse(a)}catch(b){return!1}return!0}function e(a){if(null==a)return!0;if(a.constructor===Array||a.constructor===String)return 0===a.length;for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}function f(a){return 8===b()?a.replace(/^\s+|\s+$/g,""):a.trim()}function g(a){var b=!1,c=document.getElementById("customFieldFrame_"+a);if(c.hasAttribute("data-type")){var d=c.readAttribute("data-type");"oembed"===d&&(b=!0)}return b}function h(a,c,d){var e=A;void 0!==d&&(e=d);var f=document.getElementById("customFieldFrame_"+c);null!==f&&(-1!=navigator.userAgent.indexOf("Firefox")?XD.postMessage(a,e,getIframeWindow(f)):void 0!==b()?XD.postMessage(a,e,f):XD.postMessage(a,e,getIframeWindow(f)))}function i(){var b={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight};h(JSON.stringify({type:"frame:resize",frameSizes:b}),a)}function j(){var b=document.getElementById("widget_settings_"+a);return b?b.value:null}function k(a,b){var c=null;return function(){var d=this,e=arguments;clearTimeout(c),c=setTimeout(function(){a.apply(d,e)},b)}}function l(a){var b=document.getElementById("input_"+a);return b&&b.hasClassName("widget-static")?!0:!1}function m(a){var b=document.getElementById("id_"+a).className;return b.indexOf("jf-required")>-1}function n(a){var b=document.getElementById("label_"+a);return b?b.className.indexOf("form-label")>-1:!1}function o(a){var b=document.getElementById("customFieldFrame_"+a);return b.hasClassName("frame-ready")||b.retrieve("frame-ready")?!0:!1}function p(a){function b(a,b){$(document.getElementById("customFieldFrame_"+a)).addClassName("frame-ready").store("frame-ready",!0),h(JSON.stringify(b),a)}var c=document.querySelector(".form-all"),d=window.getComputedStyle?window.getComputedStyle(c,null).getPropertyValue("background-color"):getStyle(c,"background"),e=window.getComputedStyle?window.getComputedStyle(c,null).getPropertyValue("font-family"):getStyle(c,"font-family"),f="cardform"==window.FORM_MODE||"card"===window.buildermode,g=window&&window.newDefaultTheme||"",i=window&&window.JotForm.extendsNewTheme||"",k={type:"ready",qid:a+"",formID:document.getElementsByName("formID")[0].value,required:m(a),"static":l(a),isWidgetLabelEnabled:n(a),jotformNext:window.location.href.indexOf("jotformNext=1")>-1||1==window.isComingFromJotFormNext,cardform:f,background:d,fontFamily:e,origin:window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),enterprise:JotForm.enterprise,themeVersion:g,isExtendedTheme:i},o=j();o&&"[]"!==decodeURIComponent(o)&&(k.settings=o);var p=document.getElementById("customFieldFrame_"+a);if(f&&p&&"function"==typeof p.up){var q=p.up(".jfField")||!1,r=q&&"function"==typeof q.getAttribute?q.getAttribute("data-widget-id"):!1;r&&(k.widgetID=r)}var s=p.readAttribute("data-width")||p.parentNode.clientWidth,t=p.readAttribute("data-height")||p.parentNode.clientHeight;k.width=parseInt(s),k.height=parseInt(t),k.viewWidth=p.parentNode.clientWidth,k.viewHeight=p.parentNode.clientHeight;var u=JotForm.isEditMode()||!!~window.location.href.indexOf("/edit/")||!!~window.location.href.indexOf("inlineEdit");if(v&&console.log("ready message inline",k),u)var w=50,x=5e3,y=0,z=setInterval(function(){(p.hasAttribute("data-value")||y>=x)&&(clearInterval(z),k.value=p.getAttribute("data-value"),v&&console.log("Ready message sent in",y,k),b(a,k)),y+=w},w);else{if(p.hasAttribute("data-value"))k.value=p.getAttribute("data-value");else{var A=p.parentNode.select("#input_"+a);A.first().getValue()&&(k.state="oldvalue",k.value=A.first().getValue())}v&&console.log("Sending normal ready message",k),b(a,k)}}function q(a){var b=document.createElement("textarea");return b.textContent=a,b.innerHTML}var r=document.getElementById("customFieldFrame_"+a),s=document.documentElement.clientHeight,t=document.documentElement.clientWidth,u=window&&window.newDefaultTheme||"",v=!1,w=void 0==JotForm.forms[0]||"undefined"==typeof JotForm.forms[0]?$($$(".jotform-form")[0].id):JotForm.forms[0];if(~["70261670492960","62754049811963","62261204289958","62702584435962","62802961818967","72134468218962"].indexOf(w.id)&&(v=!0),!r.hasClassName("custom-field-frame-rendered"))return v&&console.log("Not rendered yet for",a),void 0;if(!g(a)){JCFServerCommon.frames[a]={},JCFServerCommon.frames[a].obj=r;var x=r.src;JCFServerCommon.frames[a].src=x,JCFServerCommon.submitFrames=[];var y=!0,z=!1,A=x;window.sendMessage2Widget=h,window.onresize=i,window.JCFServerCommon.frames[a].sendReadyMessage=p,XD.receiveMessage(function(g){if(d(g.data)){var i=JSON.parse(g.data);if(v&&console.log("Data from widget",i.qid,i),parseInt(a)===parseInt(i.qid))if("submit"===i.type){if(v&&console.log("widget submit",document.getElementById("input_"+i.qid)),document.getElementById("input_"+i.qid)){"number"==typeof i.value&&(i.value=i.value+"");var j=$(document.getElementById("input_"+i.qid)).hasClassName("widget-required")||$(document.getElementById("input_"+i.qid)).hasClassName("validate[required]"),l=document.getElementById("input_"+i.qid),m=l.up(".form-line"),n=function(a){return a.match(/^data:image\/png;base64/gi)||!!~a.indexOf("widget_metadata")||d(a)},p=JotForm.isVisible(m),w=m.hasClassName("form-field-hidden")||l.hasClassName("always-hidden")||!p?!1:!0;if(j)if(v&&console.log(i.qid,"isVisible",w),w&&"valid"in i&&(i.valid===!1||i.valid===!0&&!i.value)){if(o(i.qid)?(l.setValue(""),v&&console.log("LogA: Setting empty input value for",i.qid,i)):v&&console.log("LogA: Setting nothing because isn't ready",i.qid,i),!l.getValue()){var x=JotForm.texts.required||"This field is required";"undefined"!=typeof i.error&&i.error!==!1&&(x=i.error.hasOwnProperty("msg")?i.error.msg:x),v&&console.log("Errored required element",l,i),JotForm.errored(l,x)}}else if(w&&!JotForm.isCollapsed(l)&&(v&&console.log("Correcting required element",l,i),JotForm.corrected(l)),w||i.valid!==!0||(v&&console.log("Correcting not visible element but valid",l,i),JotForm.corrected(l)),o(i.qid))if(void 0!==i.value){var z=i.value;JotForm.isEncrypted&&i.value&&!n(i.value)&&(z=JotEncrypted.encrypt(i.value)),l.setValue(q(z)),v&&console.log("LogB: Setting input value for",i.qid,i)}else l.setValue(""),v&&console.log("LogC: Setting input value for",i.qid,i);else v&&console.log("LogA: Widget frame not ready, no value set",i.qid,i);else if("undefined"!=typeof i)if("value"in i)if(o(i.qid)){var z=i.value;JotForm.isEncrypted&&i.value&&!n(i.value)&&(z=JotEncrypted.encrypt(i.value)),l.setValue(q(z))}else v&&console.log("LogB: Widget frame not ready, no value set",i.qid,i);else l.hasClassName("widget-static")&&(l.setValue(""),l.removeAttribute("name"));l&&m&&m.hasClassName("form-field-hidden")&&"disable"===JotForm.clearFieldOnHide&&l.setValue(""),JCFServerCommon.submitFrames.indexOf(parseInt(i.qid))<0&&(w&&j&&!i.valid?v&&console.log("Waiting for frame submission, required but not valid",i.qid):JCFServerCommon.submitFrames.push(parseInt(i.qid)))}for(var A=$$(".widget-required, .widget-errored"),B=!0,C=0;C-1&&JotForm.isPaymentSelected()&&(JotForm.paymentTotal>0||"stripe"==JotForm.payment&&"subscription"==window.paymentType)&&!E||JotForm.isEncrypted||JotForm.disableSubmitButton||($$('.custom-field-frame[data-type="iframe"]').length===JCFServerCommon.submitFrames.length?(v&&console.log("All frames submitted",JCFServerCommon.submitFrames),_submitLast.submit(D,50)):v&&console.log("Not all frames submitted",JCFServerCommon.submitFrames))}else JotForm.enableButtons(),JotForm.showButtonMessage(),JCFServerCommon.submitFrames=[]}else if("data"===i.type){try{var G=document.getElementById("input_"+i.qid);G&&(G.value=i.value,G.triggerEvent("change"),i.value&&u&&"v2"===u&&JotForm.corrected(G))}catch(H){console.log(H)}JotForm.triggerWidgetCondition(i.qid),JotForm.triggerWidgetCalculation(i.qid)}else if("errors"===i.type){var I=document.getElementById("input_"+i.qid);"show"===i.action?JotForm.isVisible(I)&&(JotForm.corrected(I),I.value="",I.addClassName("widget-errored"),JotForm.errored(I,i.msg),"resetForm"in i&&i.resetForm===!0&&JotForm.enableButtons()):"hide"===i.action&&(I.removeClassName("widget-errored"),JotForm.corrected(I))}else if("required"===i.type){var I=document.getElementById("input_"+i.qid);"set"!==i.action||I.hasClassName("widget-required")?"unset"===i.action&&(I.removeClassName("widget-required"),JotForm.corrected(I)):I.addClassName("widget-required")}else if("form:trackerID"===i.type)h(JSON.stringify({eventID:i.eventID,type:"event:receiver",data:$$('[name="event_id"]')[0]?$$('[name="event_id"]')[0].value:""}),i.qid);else if("size"===i.type){var J=i.width,K=i.height;void 0!==J&&null!==J&&(0===Number(J)&&(J="auto"),"number"==typeof J&&(J+="px"),document.getElementById("customFieldFrame_"+i.qid).style.width=J),void 0!==K&&null!==K&&(Number(0===K)&&(K="auto"),"number"==typeof K&&(K+="px"),document.getElementById("customFieldFrame_"+i.qid).style.height=K,void 0!==b()&&(document.getElementById("cid_"+i.qid).style.height=K)),JotForm.iframeHeightCaller()}else if("styles"===i.type)"styles"in i&&!e(i.styles)&&$("customFieldFrame_"+i.qid).setStyle(i.styles);else if("replace"===i.type)try{var L=i.inputType,M=i.isMobile,N=i.required,O=$("customFieldFrame_"+i.qid).up(),P=$("input_"+i.qid).readAttribute("name");$("customFieldFrame_"+i.qid).remove(),$("input_"+i.qid).up().remove();var Q="",R=N?"validate[required] widget-required widget-replaced":"";switch(L){case"control_fileupload":var D=void 0==JotForm.forms[0]||"undefined"==typeof JotForm.forms[0]?$($$(".jotform-form")[0].id):JotForm.forms[0];D.setAttribute("enctype","multipart/form-data"),M||(R=""===R?"validate[upload]":R,Q=''),O.insert(Q);break;case"control_textbox":Q='',O.insert(Q);break;case"control_textarea":Q='',O.insert(Q)}}catch(H){console.log(H)}else if("event:listener"===i.type){var S=document.getElementById(i.field);if(S&&["keyup","change"].indexOf(i.event)>-1){v&&console.log("Event registered from ",i.qid);var T=function(a){var b=a.target.value;b="undefined"!=typeof b?b:"",v&&console.log("Handler for ",i.qid,"triggered",b,a.target.id),a.target.id===i.field&&(v&&console.log("event:receiver: Sending message to ",i.qid,"with value",b),h(JSON.stringify({eventID:i.eventID,type:"event:receiver",value:b}),i.qid))};Event.observe(S,i.event,"keyup"===i.event?k(T,100):T)}}else if("event:store"===i.type){var S=document.getElementById(i.field);if(S){var U=$(i.field).up(".form-line").id.split("_")[1],V={eventID:i.eventID,type:"event:receiver",value:i.value};"widget"===JotForm.getInputType(U)||"isWidget"in i&&i.isWidget?(window.console&&"warn"in console&&console.warn("Sending value to destination(widget) from a source(widget) is not recommended."),delete V.eventID,V.field=i.field,V.isWidget=!0,V.targetQID=U,v&&console.log("Sending data to widget field",U,V),h(JSON.stringify(V),U)):(S.setValue(i.value),"hasCallback"in i&&i.hasCallback&&(v&&console.log("Sending data to native field",i),h(JSON.stringify(V),i.qid)))}}else if("field:hide"===i.type)$("input_"+i.qid).up(".form-line").hide(),window.FORM_MODE&&"cardform"==window.FORM_MODE&&window.CardForm.setCardVisibility(window.CardForm.cards.filter(function(a){return a.question.id==i.qid})[0],!1);else if("field:show"===i.type)$("input_"+i.qid).up(".form-line").show();else if("fields:capture"===i.type){var W=["control_textbox","control_textarea","control_dropdown","control_datetime","control_phone","control_fullname","control_hidden","control_email"],X=[];i.fields.forEach(function(a){var b,c,d="";if(a.match(/\[\w+\]/)){var e=$$('[name$="_'+a+'"]')[0]||!1;e&&(d="SELECT"===e.tagName?e.getSelected().value:e.value,b=e.up("li.form-line"),c=e.up("li.form-line").getAttribute("data-type"))}else{if("name"===i.identifier?$$(".form-textbox, .form-dropdown, .form-textarea, .form-hidden").some(function(c){return c.name.match(new RegExp("("+a+"$)|("+a+"\\[)"))?b=c.up("li"):void 0}):b=$("id_"+a),c=b?b.getAttribute("data-type"):"",!b||-1===W.indexOf(c))return X.push({selector:a,value:""}),void 0;d=$$("#"+b.id+" input, #"+b.id+" select").map(function(a){return a.id=="lite_mode_"+b.id?"":"SELECT"===a.tagName?a.getSelected().value:a.value}).filter(function(a){return!!a}),"control_datetime"===c&&b.down("[id*=lite_mode_]")&&(d=b.down("[id*=lite_mode_]").value),d=d.length<=1?d[0]||"":d}if("object"==typeof d){var f=" ";switch(c){case"control_datetime":f=b.down(".date-separate")?b.down(".date-separate").innerHTML.replace(/\s|\ /g,""):"/";break;case"control_phone":f="-"}d=d.join(f)}X.push({selector:a,value:d,type:c||""})}),h(JSON.stringify({eventID:i.eventID,type:"event:receiver",data:X}),i.qid)}else if("fields:fill"===i.type){var Y={};$$(".form-line").filter(function(a){return["control_textbox","control_scale","control_radio","control_checkbox","control_dropdown","control_rating","control_datetime","control_fullname","control_phone","control_birthdate","control_address","control_time","control_email","control_textarea","control_emojislider","control_yesno","control_number"].include(a.readAttribute("data-type"))}).each(function(a){var b,c=a.id.split("_")[1],d=a.readAttribute("data-type");b=window.FORM_MODE&&"cardform"==window.FORM_MODE?a.select(".jfQuestion-label").first():a.select(".form-label").first();var g=b.clone(!0),h=g.select(".form-required").first()||g.select(".jfRequiredStar").first();h&&h.remove();for(var j=g?g.innerText||g.textContent||"":"",k={name:"",value:"",items:"",text:f(j.toLowerCase()),type:d},l=0;l-1){var e=a.id.match(/_(\d+)$/)[1]||"",f=a.up(".form-line").getAttribute("data-type")||"";e&&f&&Z.push({qid:e,type:f})}});try{widgetAutoFill().clear(Z)}catch(H){console.error(H)}}else if("submit:frame:remove"===i.type){if(JCFServerCommon.submitFrames.length>0){var _=JCFServerCommon.submitFrames.indexOf(parseInt(i.qid));_>=0&&JCFServerCommon.submitFrames.splice(_,1)}}else if("frame:move"===i.type){var ab=document.body.getBoundingClientRect().top,bb=r.getBoundingClientRect().top-ab,cb=r.up("ul.form-section.page-section");if(cb){var db=cb.getHeight(),eb=new MutationObserver(function(){if(JotForm.isVisible(r)&&cb.getHeight()!==db){var a=r.getBoundingClientRect().top-ab;Math.abs(bb-a)>5&&(db=cb.getHeight(),bb=a,h(JSON.stringify({eventID:i.eventID,type:"event:receiver",data:{position:bb}}),i.qid))}});eb.observe(cb,{subtree:!0,attributes:!0,attributeFilter:["class","style"]})}}else if("frame:getdata"===i.type){var fb=0,gb=0,hb=0;("cardform"==window.FORM_MODE||"card"===window.buildermode)&&(fb=document.getElementById("label_"+a).clientHeight,gb=document.getElementsByClassName("jfCard-actions")[0].clientHeight,hb=document.querySelectorAll(".jfProgress, .no-animate")[0].clientHeight);var ib={width:t,height:s,labelHeight:fb,actionHeight:gb,jfProgressHeight:hb};h(JSON.stringify({type:"event:receiver",eventID:i.eventID,frameData:ib}),i.qid)}}},r.src.replace(/([^:]+:\/\/[^\/]+).*/,"$1")),r.addClassName("frame-xd-ready").store("frame-xd-ready",!0),v&&console.log("sending settings",j(),(new Date).getTime()),h(JSON.stringify({type:"settings",settings:j()}),a),v&&console.log("sending form strings",JotForm.texts,(new Date).getTime()),h(JSON.stringify({type:"formstrings",formTexts:JotForm.texts}),a);var B=JotForm.getSection(r);if(r&&JotForm.isVisible(B)&&JotForm.isVisible(r)&&"undefined"==typeof r.up(".form-section-closed"))v&&console.log("Frame widget object is visible",JotForm.isVisible(B),JotForm.isVisible(r),"undefined"==typeof r.up(".form-section-closed")),p(a);else if(document.get.jumpToPage){var C=parseInt(document.get.jumpToPage);if(!isNaN(C)&&B===$$(".form-section:not([id^=section_])")[C-1])var D=setInterval(function(){JotForm.isVisible(r)&&(v&&console.log("Form jump to widget page ("+C+"); sending ready message..."),p(a),clearInterval(D))},200)}window.onresize=function(){var b={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight};h(JSON.stringify({type:"frameresize",frameSizes:b}),a)},w.observe("submit",function(b){if(null!==document.getElementById("customFieldFrame_"+a)&&$$(".form-submit-button")&&$$(".form-submit-button").length>0){var c=!1;$$(".form-submit-button").each(function(a){return JotForm.isVisible(a.parentNode)?(c=!0,void 0):void 0}),b.stop(),c?(y=!1,v&&console.log("Form stopped from widget server event, submitting form from widge submit event"),h(JSON.stringify({type:"submit",qid:a+""}),a+"")):JotForm.enableButtons()}}),$$(".form-pagebreak-back").each(function(b){$(b).observe("click",function(){JotForm.currentSection.down("#customFieldFrame_"+a)&&!o(a)&&(v&&console.log("Sending ready message to unready widget"),p(a))})}),$$(".form-pagebreak-next").each(function(b){v&&console.log("Going to next page"),$(b).observe("click",function(b){z=this.up(".form-section"),y=!0,z.select("#customFieldFrame_"+a).length>0&&(v&&console.log("Sending submit message for iframe id",a,"from section",this.up(".form-section"),"and iframe",r),h(JSON.stringify({type:"submit",method:"next",qid:a+""}),a+""),Event.stop(b));var c=setInterval(function(){r=document.getElementById("customFieldFrame_"+a),r?(z=$(r).up(".form-section"),JotForm.isVisible(z)&&JotForm.isVisible(r)?(clearInterval(c),v&&console.log("Sending ready message for iframe id",a,"from section",z),p(a)):(v&&console.log("Section and frameObj not visible",z,r),clearInterval(c))):clearInterval(c)},100)})}),$("input_"+a)&&["widget:clear","widget:populate","widget:shift"].forEach(function(b){$("input_"+a).observe(b,function(a){var c=a.memo.qid,d={type:b.replace(":",""),qid:c};"widget:populate"==b&&(d.value=a.memo.value||""),h(JSON.stringify(d),c)})})}}if("object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(a){return 10>a?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g,h=gap,i=b[a];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(a)),"function"==typeof rep&&(i=rep.call(b,a,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,g=[],"[object Array]"===Object.prototype.toString.apply(i)){for(f=i.length,c=0;f>c;c+=1)g[c]=str(c,i)||"null";return e=0===g.length?"[]":gap?"[\n"+gap+g.join(",\n"+gap)+"\n"+h+"]":"["+g.join(",")+"]",gap=h,e}if(rep&&"object"==typeof rep)for(f=rep.length,c=0;f>c;c+=1)"string"==typeof rep[c]&&(d=rep[c],e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));return e=0===g.length?"{}":gap?"{\n"+gap+g.join(",\n"+gap)+"\n"+h+"}":"{"+g.join(",")+"}",gap=h,e}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(a,b,c){var d;if(gap="",indent="","number"==typeof c)for(d=0;c>d;d+=1)indent+=" ";else"string"==typeof c&&(indent=c);if(rep=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return str("",{"":a})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e)for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),window.console||(console={log:function(){}}),void 0===window.getStyle,void 0===window.getIframeWindow,"undefined"==typeof XD)var XD=function(){var a,b,c,d=1,e=this;return{postMessage:function(a,b,c){if(b)if(c=c||parent,e.postMessage){var f=b.replace(/([^:]+:\/\/[^\/]+).*/,"$1");if("postMessage"in c||(c=getIframeWindow(c)),!c)return;0===f.indexOf("file://")&&(f="*"),c.postMessage(a,f)}else b&&(c.location=b.replace(/#.*$/,"")+"#"+ +new Date+d++ +"&"+a)},receiveMessage:function(d,f){e.postMessage?(d&&(c=function(a){var b=e.location.search.split("?").join(""),c=b.indexOf("offline_forms=true")>-1||b.indexOf("offline_forms=si")>-1;return!c&&("string"==typeof f&&a.origin!==f||"[object Function]"===Object.prototype.toString.call(f)&&f(a.origin)===!1)?!1:(d(a),void 0)}),e.addEventListener?e[d?"addEventListener":"removeEventListener"]("message",c,!1):e[d?"attachEvent":"detachEvent"]("onmessage",c)):(a&&clearInterval(a),a=null,d&&(a=setInterval(function(){var a=document.location.hash,c=/^#?\d+&/;a!==b&&c.test(a)&&(b=a,d({data:a.replace(c,"")}))},100)))}}}();void 0===window.JCFServerCommon&&(window.JCFServerCommon={frames:{},func:{}});var _submitLast={t:null,submitted:!1,submit:function(a,b){this.submitted!==!0&&(null!==this.t&&clearTimeout(this.t),this.t=setTimeout(function(){this.submitted=!0,a.submit(),JotForm.disableButtons()},b))}};