{"size": 16165, "ext": "js", "max_stars_repo_path": "vendor/barrelstrength/sprout-forms/src/web/assets/formtemplates/dist/js/rules.js", "max_stars_repo_name": "Marionweb/city-of-marion", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "vendor/barrelstrength/sprout-forms/src/web/assets/formtemplates/dist/js/rules.js", "max_issues_repo_name": "Marionweb/city-of-marion", "max_issues_repo_issues_event_min_datetime": "2021-02-12T22:25:31.000Z", "max_issues_repo_issues_event_max_datetime": "2021-02-12T22:25:31.000Z", "max_forks_repo_path": "vendor/barrelstrength/sprout-forms/src/web/assets/formtemplates/dist/js/rules.js", "max_forks_repo_name": "Marionweb/city-of-marion", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 8082.5, "max_line_length": 16102, "alphanum_fraction": 0.6592019796}
/*! For license information please see rules.js.LICENSE.txt */
!function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="/",e(e.s=166)}([function(t,n,e){(function(n){var e=function(t){return t&&t.Math==Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof n&&n)||Function("return this")()}).call(this,e(37))},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n,e){var r=e(0),o=e(27),i=e(2),u=e(28),c=e(29),a=e(47),f=o("wks"),s=r.Symbol,l=a?s:s&&s.withoutSetter||u;t.exports=function(t){return i(f,t)||(c&&i(s,t)?f[t]=s[t]:f[t]=l("Symbol."+t)),f[t]}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,e){var r=e(1);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,n,e){var r=e(5),o=e(8),i=e(13);t.exports=r?function(t,n,e){return o.f(t,n,i(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n,e){var r=e(4);t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},function(t,n,e){var r=e(5),o=e(35),i=e(7),u=e(19),c=Object.defineProperty;n.f=r?c:function(t,n,e){if(i(t),n=u(n,!0),i(e),o)try{return c(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported");return"value"in e&&(t[n]=e.value),t}},function(t,n,e){var r=e(0),o=e(23).f,i=e(6),u=e(12),c=e(20),a=e(44),f=e(57);t.exports=function(t,n){var e,s,l,p,d,v=t.target,h=t.global,y=t.stat;if(e=h?r:y?r[v]||c(v,{}):(r[v]||{}).prototype)for(s in n){if(p=n[s],l=t.noTargetGet?(d=o(e,s))&&d.value:e[s],!f(h?s:v+(y?".":"#")+s,t.forced)&&void 0!==l){if(typeof p==typeof l)continue;a(p,l)}(t.sham||l&&l.sham)&&i(p,"sham",!0),u(e,s,p,t)}}},function(t,n,e){var r=e(26),o=e(16);t.exports=function(t){return r(o(t))}},function(t,n,e){var r=e(25),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,n,e){var r=e(0),o=e(6),i=e(2),u=e(20),c=e(32),a=e(21),f=a.get,s=a.enforce,l=String(String).split("String");(t.exports=function(t,n,e,c){var a=!!c&&!!c.unsafe,f=!!c&&!!c.enumerable,p=!!c&&!!c.noTargetGet;"function"==typeof e&&("string"!=typeof n||i(e,"name")||o(e,"name",n),s(e).source=l.join("string"==typeof n?n:"")),t!==r?(a?!p&&t[n]&&(f=!0):delete t[n],f?t[n]=e:o(t,n,e)):f?t[n]=e:u(n,e)})(Function.prototype,"toString",(function(){return"function"==typeof this&&f(this).source||c(this)}))},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n,e){var r=e(16);t.exports=function(t){return Object(r(t))}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,n){t.exports={}},function(t,n,e){var r=e(45),o=e(0),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,n){return arguments.length<2?i(r[t])||i(o[t]):r[t]&&r[t][n]||o[t]&&o[t][n]}},function(t,n,e){var r=e(4);t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n,e){var r=e(0),o=e(6);t.exports=function(t,n){try{o(r,t,n)}catch(e){r[t]=n}return n}},function(t,n,e){var r,o,i,u=e(59),c=e(0),a=e(4),f=e(6),s=e(2),l=e(24),p=e(17),d=c.WeakMap;if(u){var v=new d,h=v.get,y=v.has,m=v.set;r=function(t,n){return m.call(v,t,n),n},o=function(t){return h.call(v,t)||{}},i=function(t){return y.call(v,t)}}else{var g=l("state");p[g]=!0,r=function(t,n){return f(t,g,n),n},o=function(t){return s(t,g)?t[g]:{}},i=function(t){return s(t,g)}}t.exports={set:r,get:o,has:i,enforce:function(t){return i(t)?o(t):r(t,{})},getterFor:function(t){return function(n){var e;if(!a(n)||(e=o(n)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return e}}}},function(t,n){t.exports=!1},function(t,n,e){var r=e(5),o=e(39),i=e(13),u=e(10),c=e(19),a=e(2),f=e(35),s=Object.getOwnPropertyDescriptor;n.f=r?s:function(t,n){if(t=u(t),n=c(n,!0),f)try{return s(t,n)}catch(t){}if(a(t,n))return i(!o.f.call(t,n),t[n])}},function(t,n,e){var r=e(27),o=e(28),i=r("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},function(t,n,e){var r=e(1),o=e(14),i="".split;t.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},function(t,n,e){var r=e(22),o=e(36);(t.exports=function(t,n){return o[t]||(o[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.6.4",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++e+r).toString(36)}},function(t,n,e){var r=e(1);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},function(t,n){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,n,e){var r=e(14);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,n,e){var r=e(36),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(t){return o.call(t)}),t.exports=r.inspectSource},function(t,n,e){var r=e(38),o=e(30).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},,function(t,n,e){var r=e(5),o=e(1),i=e(40);t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(t,n,e){var r=e(0),o=e(20),i=r["__core-js_shared__"]||o("__core-js_shared__",{});t.exports=i},function(t,n){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,n,e){var r=e(2),o=e(10),i=e(53).indexOf,u=e(17);t.exports=function(t,n){var e,c=o(t),a=0,f=[];for(e in c)!r(u,e)&&r(c,e)&&f.push(e);for(;n.length>a;)r(c,e=n[a++])&&(~i(f,e)||f.push(e));return f}},function(t,n,e){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);n.f=i?function(t){var n=o(this,t);return!!n&&n.enumerable}:r},function(t,n,e){var r=e(0),o=e(4),i=r.document,u=o(i)&&o(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},function(t,n,e){var r=e(42),o=e(26),i=e(15),u=e(11),c=e(55),a=[].push,f=function(t){var n=1==t,e=2==t,f=3==t,s=4==t,l=6==t,p=5==t||l;return function(d,v,h,y){for(var m,g,b=i(d),x=o(b),S=r(v,h,3),w=u(x.length),O=0,E=y||c,j=n?E(d,w):e?E(d,0):void 0;w>O;O++)if((p||O in x)&&(g=S(m=x[O],O,b),t))if(n)j[O]=g;else if(g)switch(t){case 3:return!0;case 5:return m;case 6:return O;case 2:a.call(j,m)}else if(s)return!1;return l?-1:f||s?s:j}};t.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6)}},function(t,n,e){var r=e(49);t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 0:return function(){return t.call(n)};case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}}},function(t,n,e){var r=e(5),o=e(1),i=e(2),u=Object.defineProperty,c={},a=function(t){throw t};t.exports=function(t,n){if(i(c,t))return c[t];n||(n={});var e=[][t],f=!!i(n,"ACCESSORS")&&n.ACCESSORS,s=i(n,0)?n[0]:a,l=i(n,1)?n[1]:void 0;return c[t]=!!e&&!o((function(){if(f&&!r)return!0;var t={length:-1};f?u(t,1,{enumerable:!0,get:a}):t[1]=1,e.call(t,s,l)}))}},function(t,n,e){var r=e(2),o=e(60),i=e(23),u=e(8);t.exports=function(t,n){for(var e=o(n),c=u.f,a=i.f,f=0;f<e.length;f++){var s=e[f];r(t,s)||c(t,s,a(n,s))}}},function(t,n,e){var r=e(0);t.exports=r},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,e){var r=e(29);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,n,e){var r=e(38),o=e(30);t.exports=Object.keys||function(t){return r(t,o)}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},,function(t,n,e){var r=e(25),o=Math.max,i=Math.min;t.exports=function(t,n){var e=r(t);return e<0?o(e+n,0):i(e,n)}},,function(t,n,e){var r=e(10),o=e(11),i=e(51),u=function(t){return function(n,e,u){var c,a=r(n),f=o(a.length),s=i(u,f);if(t&&e!=e){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===e)return t||s||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},,function(t,n,e){var r=e(4),o=e(31),i=e(3)("species");t.exports=function(t,n){var e;return o(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!o(e.prototype)?r(e)&&null===(e=e[i])&&(e=void 0):e=void 0),new(void 0===e?Array:e)(0===n?0:n)}},,function(t,n,e){var r=e(1),o=/#|\.prototype\./,i=function(t,n){var e=c[u(t)];return e==f||e!=a&&("function"==typeof n?r(n):!!n)},u=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},c=i.data={},a=i.NATIVE="N",f=i.POLYFILL="P";t.exports=i},,function(t,n,e){var r=e(0),o=e(32),i=r.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},function(t,n,e){var r=e(18),o=e(33),i=e(46),u=e(7);t.exports=r("Reflect","ownKeys")||function(t){var n=o.f(u(t)),e=i.f;return e?n.concat(e(t)):n}},,,,,,function(t,n,e){var r=e(1),o=e(3),i=e(69),u=o("species");t.exports=function(t){return i>=51||!r((function(){var n=[];return(n.constructor={})[u]=function(){return{foo:1}},1!==n[t](Boolean).foo}))}},function(t,n,e){"use strict";var r=e(1);t.exports=function(t,n){var e=[][t];return!!e&&r((function(){e.call(null,n||function(){throw 1},1)}))}},function(t,n){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,n,e){var r,o,i=e(0),u=e(77),c=i.process,a=c&&c.versions,f=a&&a.v8;f?o=(r=f.split("."))[0]+r[1]:u&&(!(r=u.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=u.match(/Chrome\/(\d+)/))&&(o=r[1]),t.exports=o&&+o},,,,,,,,function(t,n,e){var r=e(18);t.exports=r("navigator","userAgent")||""},,,,,,function(t,n,e){"use strict";var r=e(41).forEach,o=e(67),i=e(43),u=o("forEach"),c=i("forEach");t.exports=u&&c?[].forEach:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}},,,,,,,,,,function(t,n,e){"use strict";var r=e(9),o=e(26),i=e(10),u=e(67),c=[].join,a=o!=Object,f=u("join",",");r({target:"Array",proto:!0,forced:a||!f},{join:function(t){return c.call(i(this),void 0===t?",":t)}})},function(t,n,e){var r=e(9),o=e(15),i=e(48);r({target:"Object",stat:!0,forced:e(1)((function(){i(1)}))},{keys:function(t){return i(o(t))}})},,,,,,,,,,,,,,function(t,n,e){"use strict";var r=e(9),o=e(83);r({target:"Array",proto:!0,forced:[].forEach!=o},{forEach:o})},function(t,n,e){var r=e(0),o=e(68),i=e(83),u=e(6);for(var c in o){var a=r[c],f=a&&a.prototype;if(f&&f.forEach!==i)try{u(f,"forEach",i)}catch(t){f.forEach=i}}},function(t,n,e){"use strict";var r=e(9),o=e(41).map,i=e(66),u=e(43),c=i("map"),a=u("map");r({target:"Array",proto:!0,forced:!c||!a},{map:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,n,e){t.exports=e(167)},function(t,n,e){"use strict";e.r(n);e(108),e(93),e(110),e(94),e(109);function r(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(n){if(function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.formId=n,this.form=document.getElementById(this.formId),this.allRules={},this.fieldsToListen={},this.form.dataset.rules){this.rulesJson=JSON.parse(this.form.dataset.rules);for(var e=this,r=0;r<this.rulesJson.length;r++){var o=this.rulesJson[r],i=o.behaviorTarget,u=(document.getElementById("fields-"+i+"-field"),{}),c=o.conditions;for(var a in c){var f=c[a],s=[];for(var l in f){var p=f[l];this.fieldsToListen[p[0]]=1,s.push({fieldHandle:p[0],condition:p[1],value:p[2]})}u[a]=s}var d="fields-"+i+"-field",v=document.getElementById(d);"show"===o.behaviorAction&&this.hideAndDisableField(v),this.allRules[i]={rules:u,action:o.behaviorAction}}for(var h in this.fieldsToListen){var y=this.getFieldId(h),m=document.getElementById(y);m.addEventListener("change",(function(t){e.runConditionsForInput(t)}),!1),("TEXTAREA"===m.tagName||"INPUT"===m.tagName&&"text"===m.type||"INPUT"===m.tagName&&"number"===m.type)&&m.addEventListener("keyup",(function(t){e.runConditionsForInput(t)}),!1),e.runConditionsForInput(m)}}}var n,e,o;return n=t,(e=[{key:"runConditionsForInput",value:function(t){var n={};for(var e in this.allRules){var r=this.allRules[e],o=0,i={};for(var u in r.rules){var c=r.rules[u],a=[];for(var f in c){var s=c[f],l=this.getFieldId(s.fieldHandle),p=document.getElementById(l),d=void 0===p.value?"":p.value;if("paste"===t.type&&(d=(t.clipboardData||window.clipboardData).getData("Text")),"checkbox"===p.type&&(d=p.checked),void 0===p.type){var v=p.querySelectorAll('input[type="radio"]');if(v.length>=1)for(var h=0;h<v.length;h++){var y=v[h];if(y.checked){d=y.value;break}}}a.push({condition:s.condition,inputValue:d,ruleValue:void 0===s.value?"":s.value})}i[o]=a,o++}n[e]=i}var m=JSON.stringify({data:n});this.validateConditions(m)}},{key:"validateConditions",value:function(t){var n=this,e={},r=new XMLHttpRequest;r.open("POST","/"),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.onload=function(){var t=JSON.parse(this.response);if(200===this.status&&!0===t.success)for(var e in t.result){var r="fields-"+e+"-field",o=document.getElementById(r),i=n.allRules[e];!0===t.result[e]?"hide"===i.action?n.hideAndDisableField(o):n.showAndEnableField(o):"hide"===i.action?n.showAndEnableField(o):n.hideAndDisableField(o)}else console.error("Invalid request while validating conditions")},e[window.csrfTokenName]=this.form.querySelector('[name="'+window.csrfTokenName+'"]').value,e.action="sprout-forms/rules/validate-condition",e.rules=t;var o=Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&");r.send(o)}},{key:"getFieldId",value:function(t){return"fields-"+t}},{key:"hideAndDisableField",value:function(t){t.querySelectorAll("input, select, option, textarea, button, datalist, output").forEach((function(t){t.disabled=!0})),t.classList.add("sprout-hidden")}},{key:"showAndEnableField",value:function(t){t.querySelectorAll("input, select, option, textarea, button, datalist, output").forEach((function(t){t.disabled=!1})),t.classList.remove("sprout-hidden")}}])&&r(n.prototype,e),o&&r(n,o),t}();window.SproutFormsRules=o}]);