D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
everqlsh
/
www
/
wp-admin
/
user
/
577040
/
Filename :
front.tar
back
Copy
front.multi.min.js 0000644 00000756703 15162272024 0010170 0 ustar 00 !function n(i,o,a){function s(e,t){if(!o[e]){if(!i[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(l)return l(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}r=o[e]={exports:{}},i[e][0].call(r.exports,function(t){return s(i[e][1][t]||t)},r,r.exports,n,i,o,a)}return o[e].exports}for(var l="function"==typeof require&&require,t=0;t<a.length;t++)s(a[t]);return s}({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=n(t("./parser/front.calculator.parser.tokenizer")),o=n(t("./symbol/front.calculator.symbol.loader")),a=n(t("./parser/front.calculator.parser")),s=n(t("./symbol/front.calculator.symbol.number")),l=n(t("./symbol/abstract/front.calculator.symbol.constant.abstract")),f=n(t("./parser/node/front.calculator.parser.node.symbol")),u=n(t("./symbol/abstract/front.calculator.symbol.operator.abstract")),c=n(t("./symbol/front.calculator.symbol.separator")),m=n(t("./parser/node/front.calculator.parser.node.function")),d=n(t("./parser/node/front.calculator.parser.node.container"));function n(t){return t&&t.__esModule?t:{default:t}}function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==h(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===h(t)?t:String(t)}(n.key),n)}}var b=r.default=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.term=t,this.tokenizer=new i.default(this.term),this.symbolLoader=new o.default,this.parser=new a.default(this.symbolLoader)}var t,r,n;return t=e,(r=[{key:"parse",value:function(){this.tokenizer.input=this.term,this.tokenizer.reset();var t=this.tokenizer.tokenize();if(0===t.length)throw"Error: Empty token of calculator term.";t=this.parser.parse(t);if(t.isEmpty())throw"Error: Empty nodes of calculator tokens.";return t}},{key:"calculate",value:function(){var t=this.parse();return!1===t?0:this.calculateNode(t)}},{key:"calculateNode",value:function(t){if(t instanceof f.default)return this.calculateSymbolNode(t);if(t instanceof m.default)return this.calculateFunctionNode(t);if(t instanceof d.default)return this.calculateContainerNode(t);throw'Error: Cannot calculate node of unknown type "'+t.constructor.name+'"'}},{key:"calculateContainerNode",value:function(t){if(t instanceof m.default)throw"Error: Expected container node but got a function node";for(var e=0,r=t.childNodes,n=this.detectCalculationOrder(r),i=0;i<n.length;i++){for(var o=n[i].node,a=n[i].index,s=null,l=null,f=0;f!==a;)void 0===r[f]||(s=r[f],l=f),f++;for(f++;void 0===r[f];)f++;var u=r[f],c=f,u=isNaN(u)?this.calculateNode(u):u,d=o.symbol;o.isUnaryOperator?(e=d.operate(null,u),delete r[c],r[a]=e):null!==l&&null!==s&&(o=isNaN(s)?this.calculateNode(s):s,e=d.operate(o,u),delete r[l],delete r[c],r[a]=e)}if(0===(r=r.filter(function(t){return void 0!==t})).length)throw"Error: Missing calculable subterm. Are there empty brackets?";if(1<r.length)throw"Error: Missing operators between parts of the term.";return e=r.pop(),isNaN(e)?this.calculateNode(e):e}},{key:"calculateFunctionNode",value:function(t){for(var e=t.childNodes,r=[],n=[],i=null,o=0;o<e.length;o++){var a=e[o];a instanceof f.default&&a.symbol instanceof c.default?(i=new d.default(n),r.push(this.calculateNode(i)),n=[]):n.push(a)}return 0<n.length&&(i=new d.default(n),r.push(this.calculateNode(i))),t.symbolNode.symbol.execute(r)}},{key:"calculateSymbolNode",value:function(t){var e=t.symbol,r=0;if(e instanceof s.default)r=t.token.value,r=Number(r);else{if(!(e instanceof l.default))throw'Error: Found symbol of unexpected type "'+e.constructor.name+'", expected number or constant';r=e.value}return r}},{key:"detectCalculationOrder",value:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];n instanceof f.default&&n.symbol instanceof u.default&&e.push({index:r,node:n})}return e.sort(function(t,e){var t=t.node,e=e.node,r=t.symbol,n=2,i=(t.isUnaryOperator&&(n=3),e.symbol),o=2;return n===(o=e.isUnaryOperator?3:o)&&(n=r.precedence,o=i.precedence),n===o?t.token.position<e.token.position?-1:1:n<o?1:-1}),e}}])&&p(t.prototype,r),n&&p(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();void 0===window.forminatorCalculator&&(window.forminatorCalculator=function(t){return new b(t)})},{"./parser/front.calculator.parser":2,"./parser/front.calculator.parser.tokenizer":4,"./parser/node/front.calculator.parser.node.container":6,"./parser/node/front.calculator.parser.node.function":7,"./parser/node/front.calculator.parser.node.symbol":8,"./symbol/abstract/front.calculator.symbol.constant.abstract":10,"./symbol/abstract/front.calculator.symbol.operator.abstract":12,"./symbol/front.calculator.symbol.loader":16,"./symbol/front.calculator.symbol.number":17,"./symbol/front.calculator.symbol.separator":18}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var f=n(t("./front.calculator.parser.token")),u=n(t("../symbol/front.calculator.symbol.number")),c=n(t("../symbol/brackets/front.calculator.symbol.opening.bracket")),d=n(t("../symbol/brackets/front.calculator.symbol.closing.bracket")),m=n(t("../symbol/abstract/front.calculator.symbol.function.abstract")),a=n(t("../symbol/abstract/front.calculator.symbol.operator.abstract")),s=n(t("../symbol/front.calculator.symbol.separator")),h=n(t("./node/front.calculator.parser.node.symbol")),l=n(t("./node/front.calculator.parser.node.container")),p=n(t("./node/front.calculator.parser.node.function"));function n(t){return t&&t.__esModule?t:{default:t}}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}r.default=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.symbolLoader=t}var t,r,n;return t=e,(r=[{key:"parse",value:function(t){t=this.detectSymbols(t),t=this.createTreeByBrackets(t),t=this.transformTreeByFunctions(t);return this.checkGrammar(t),new l.default(t)}},{key:"detectSymbols",value:function(t){for(var e=[],r=null,n=null,i=!1,o=0,a=0;a<t.length;a++){var s=t[a],l=s.type;if(f.default.TYPE_WORD===l){if(n=s.value,null===(r=this.symbolLoader.find(n)))throw"Error: Detected unknown or invalid string identifier: "+n+"."}else if(l===f.default.TYPE_NUMBER){l=this.symbolLoader.findSubTypes(u.default);if(l.length<1||!(l instanceof Array))throw"Error: Unavailable number symbol processor.";r=l[0]}else{if(n=s.value,null===(r=this.symbolLoader.find(n)))throw"Error: Detected unknown or invalid string identifier: "+n+".";if(r instanceof c.default&&o++,r instanceof d.default&&--o<0)throw"Error: Found closing bracket that does not have an opening bracket."}if(i){if(!(r instanceof c.default))throw"Error: Expected opening bracket (after a function) but got something else.";i=!1}else r instanceof m.default&&(i=!0);l=new h.default(s,r);e.push(l)}if(i)throw"Error: Expected opening bracket (after a function) but reached the end of the term";if(0<o)throw"Error: There is at least one opening bracket that does not have a closing bracket";return e}},{key:"createTreeByBrackets",value:function(t){for(var e=[],r=[],n=0,i=0;i<t.length;i++){var o,a=t[i];if(!(a instanceof h.default))throw'Error: Expected symbol node, but got "'+a.constructor.name+'"';a.symbol instanceof c.default?1<++n&&r.push(a):a.symbol instanceof d.default?0===--n?(o=this.createTreeByBrackets(r),e.push(new l.default(o)),r=[]):r.push(a):(0===n?e:r).push(a)}return e}},{key:"transformTreeByFunctions",value:function(t){for(var e=[],r=null,n=0;n<t.length;n++){var i=t[n];if(i instanceof l.default){var o,a=this.transformTreeByFunctions(i.childNodes);null!==r?(o=new p.default(a,r),e.push(o),r=null):(i.childNodes=a,e.push(i))}else{if(!(i instanceof h.default))throw'Error: Expected array node or symbol node, got "'+i.constructor.name+'"';i.symbol instanceof m.default?r=i:e.push(i)}}return e}},{key:"checkGrammar",value:function(t){for(var e=0;e<t.length;e++){var r=t[e];if(r instanceof h.default){var n=r.symbol;if(n instanceof a.default){if(e+1>=t.length)throw"Error: Found operator that does not stand before an operand.";var i=e-1,o=null;if(null===(o=0<=i&&(o=t[i])instanceof h.default&&(o.symbol instanceof a.default||o.symbol instanceof s.default)?null:o)){if(!n.operatesUnary)throw"Error: Found operator in unary notation that is not unary.";r.setIsUnaryOperator(!0)}else if(!n.operatesBinary)throw console.log(n),"Error: Found operator in binary notation that is not binary."}}else this.checkGrammar(r.childNodes)}}}])&&o(t.prototype,r),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{"../symbol/abstract/front.calculator.symbol.function.abstract":11,"../symbol/abstract/front.calculator.symbol.operator.abstract":12,"../symbol/brackets/front.calculator.symbol.closing.bracket":13,"../symbol/brackets/front.calculator.symbol.opening.bracket":14,"../symbol/front.calculator.symbol.number":17,"../symbol/front.calculator.symbol.separator":18,"./front.calculator.parser.token":3,"./node/front.calculator.parser.node.container":6,"./node/front.calculator.parser.node.function":7,"./node/front.calculator.parser.node.symbol":8}],3:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function n(t,e,r){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.type=t,this.value=e,this.position=r}var t,e,r;return t=n,r=[{key:"TYPE_WORD",get:function(){return 1}},{key:"TYPE_CHAR",get:function(){return 2}},{key:"TYPE_NUMBER",get:function(){return 3}}],(e=null)&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),n}()},{}],4:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=(t=t("./front.calculator.parser.token"))&&t.__esModule?t:{default:t};function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}r.default=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.input=t,this.currentPosition=0}var t,r,n;return t=e,(r=[{key:"tokenize",value:function(){this.reset();for(var t=[],e=this.readToken();e;)t.push(e),e=this.readToken();return t}},{key:"readToken",value:function(){this.stepOverWhitespace();var t,e,r=this.readCurrent();return null===r?null:(e=t=null,e=this.isLetter(r)?(t=this.readWord(),i.default.TYPE_WORD):this.isDigit(r)||this.isPeriod(r)?(t=this.readNumber(),i.default.TYPE_NUMBER):(t=this.readChar(),i.default.TYPE_CHAR),new i.default(e,t,this.currentPosition))}},{key:"isLetter",value:function(t){return null!==t&&(65<=(t=t.charCodeAt(0))&&t<=90||97<=t&&t<=122)}},{key:"isDigit",value:function(t){return null!==t&&48<=(t=t.charCodeAt(0))&&t<=57}},{key:"isPeriod",value:function(t){return"."===t}},{key:"isWhitespace",value:function(t){return 0<=[" ","\t","\n"].indexOf(t)}},{key:"stepOverWhitespace",value:function(){for(;this.isWhitespace(this.readCurrent());)this.readNext()}},{key:"readWord",value:function(){for(var t="",e=this.readCurrent();null!==e&&this.isLetter(e);)t+=e,e=this.readNext();return t}},{key:"readNumber",value:function(){for(var t="",e=!1,r=this.readCurrent();null!==r&&(this.isPeriod(r)||this.isDigit(r));){if(this.isPeriod(r)){if(e)throw"Error: A number cannot have more than one period";e=!0}t+=r,r=this.readNext()}return t}},{key:"readChar",value:function(){var t=this.readCurrent();return this.readNext(),t}},{key:"readCurrent",value:function(){var t=null;return t=this.hasCurrent()?this.input[this.currentPosition]:t}},{key:"readNext",value:function(){return this.currentPosition++,this.readCurrent()}},{key:"hasCurrent",value:function(){return this.currentPosition<this.input.length}},{key:"reset",value:function(){this.currentPosition=0}}])&&a(t.prototype,r),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{"./front.calculator.parser.token":3}],5:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function o(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=o(function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")})},{}],6:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=(t=t("./front.calculator.parser.node.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=f(r),e=(t=n?(t=f(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n=l(i);function i(t){var e;if(this instanceof i)return(e=n.call(this)).childNodes=null,e.setChildNodes(t),e;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"setChildNodes",value:function(t){t.forEach(function(t){if(!(t instanceof o.default))throw"Expected AbstractNode, but got "+t.constructor.name}),this.childNodes=t}},{key:"size",value:function(){try{return this.childNodes.length}catch(t){return 0}}},{key:"isEmpty",value:function(){return!this.size()}}])&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(o.default)},{"./front.calculator.parser.node.abstract":5}],7:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./front.calculator.parser.node.container"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=o(r),e=(t=n?(t=o(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,i=l(o);function o(t,e){if(this instanceof o)return(t=i.call(this,t)).symbolNode=e,t;throw new TypeError("Cannot call a class as a function")}return e=o,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"./front.calculator.parser.node.container":6}],8:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=n(t("../../symbol/abstract/front.calculator.symbol.operator.abstract")),t=n(t("./front.calculator.parser.node.abstract"));function n(t){return t&&t.__esModule?t:{default:t}}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=f(r),e=(t=n?(t=f(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n=l(i);function i(t,e){var r;if(this instanceof i)return(r=n.call(this)).token=t,r.symbol=e,r.isUnaryOperator=!1,r;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"setIsUnaryOperator",value:function(t){if(!(this.symbol instanceof o.default))throw"Error: Cannot mark node as unary operator, because symbol is not an operator but of type "+this.symbol.constructor.name;this.isUnaryOperator=t}}])&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../../symbol/abstract/front.calculator.symbol.operator.abstract":12,"./front.calculator.parser.node.abstract":5}],9:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.identifiers=[]}var e,r,n;return e=t,(r=[{key:"getIdentifiers",value:function(){var e=[];return this.identifiers.forEach(function(t){e.push(t.toLowerCase())}),e}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},{}],10:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=o(r),e=(t=n?(t=o(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,i=l(o);function o(){var t;if(this instanceof o)return(t=i.call(this)).value=0,t;throw new TypeError("Cannot call a class as a function")}return e=o,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"./front.calculator.symbol.abstract":9}],11:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){if(this instanceof i)return n.call(this);throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"execute",value:function(t){return 0}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"./front.calculator.symbol.abstract":9}],12:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).precedence=0,t.operatesUnary=!1,t.operatesBinary=!0,t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"operate",value:function(t,e){return 0}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"./front.calculator.symbol.abstract":9}],13:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=o(r),e=(t=n?(t=o(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,i=l(o);function o(){var t;if(this instanceof o)return(t=i.call(this)).identifiers=[")"],t;throw new TypeError("Cannot call a class as a function")}return e=o,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"../abstract/front.calculator.symbol.abstract":9}],14:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=o(r),e=(t=n?(t=o(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,i=l(o);function o(){var t;if(this instanceof o)return(t=i.call(this)).identifiers=["("],t;throw new TypeError("Cannot call a class as a function")}return e=o,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"../abstract/front.calculator.symbol.abstract":9}],15:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.constant.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=o(r),e=(t=n?(t=o(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,i=l(o);function o(){var t;if(this instanceof o)return(t=i.call(this)).identifiers=["pi"],t.value=Math.PI,t;throw new TypeError("Cannot call a class as a function")}return e=o,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"../abstract/front.calculator.symbol.constant.abstract":10}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=n(t("./front.calculator.symbol.number")),o=n(t("./front.calculator.symbol.separator")),a=n(t("./brackets/front.calculator.symbol.opening.bracket")),s=n(t("./brackets/front.calculator.symbol.closing.bracket")),l=n(t("./constants/front.calculator.symbol.constant.pi")),f=n(t("./operators/front.calculator.symbol.operator.addition")),u=n(t("./operators/front.calculator.symbol.operator.division")),c=n(t("./operators/front.calculator.symbol.operator.exponentiation")),d=n(t("./operators/front.calculator.symbol.operator.modulo")),m=n(t("./operators/front.calculator.symbol.operator.multiplication")),h=n(t("./operators/front.calculator.symbol.operator.subtraction")),p=n(t("./functions/front.calculator.symbol.function.abs")),b=n(t("./functions/front.calculator.symbol.function.avg")),y=n(t("./functions/front.calculator.symbol.function.ceil")),g=n(t("./functions/front.calculator.symbol.function.floor")),_=n(t("./functions/front.calculator.symbol.function.max")),v=n(t("./functions/front.calculator.symbol.function.min")),w=n(t("./functions/front.calculator.symbol.function.round"));function n(t){return t&&t.__esModule?t:{default:t}}function C(t){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function O(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==C(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==C(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===C(t)?t:String(t)}(n.key),n)}}r.default=function(){function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.symbols={FrontCalculatorSymbolNumber:new i.default,FrontCalculatorSymbolSeparator:new o.default,FrontCalculatorSymbolOpeningBracket:new a.default,FrontCalculatorSymbolClosingBracket:new s.default,FrontCalculatorSymbolConstantPi:new l.default,FrontCalculatorSymbolOperatorAddition:new f.default,FrontCalculatorSymbolOperatorDivision:new u.default,FrontCalculatorSymbolOperatorExponentiation:new c.default,FrontCalculatorSymbolOperatorModulo:new d.default,FrontCalculatorSymbolOperatorMultiplication:new m.default,FrontCalculatorSymbolOperatorSubtraction:new h.default,FrontCalculatorSymbolFunctionAbs:new p.default,FrontCalculatorSymbolFunctionAvg:new b.default,FrontCalculatorSymbolFunctionCeil:new y.default,FrontCalculatorSymbolFunctionFloor:new g.default,FrontCalculatorSymbolFunctionMax:new _.default,FrontCalculatorSymbolFunctionMin:new v.default,FrontCalculatorSymbolFunctionRound:new w.default}}var e,r,n;return e=t,(r=[{key:"find",value:function(t){for(var e in t=t.toLowerCase(),this.symbols)if(this.symbols.hasOwnProperty(e)){e=this.symbols[e];if(0<=e.getIdentifiers().indexOf(t))return e}return null}},{key:"findSubTypes",value:function(t){var e,r,n=[];for(e in this.symbols)this.symbols.hasOwnProperty(e)&&(r=this.symbols[e])instanceof t&&n.push(r);return n}}])&&O(e.prototype,r),n&&O(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},{"./brackets/front.calculator.symbol.closing.bracket":13,"./brackets/front.calculator.symbol.opening.bracket":14,"./constants/front.calculator.symbol.constant.pi":15,"./front.calculator.symbol.number":17,"./front.calculator.symbol.separator":18,"./functions/front.calculator.symbol.function.abs":19,"./functions/front.calculator.symbol.function.avg":20,"./functions/front.calculator.symbol.function.ceil":21,"./functions/front.calculator.symbol.function.floor":22,"./functions/front.calculator.symbol.function.max":23,"./functions/front.calculator.symbol.function.min":24,"./functions/front.calculator.symbol.function.round":25,"./operators/front.calculator.symbol.operator.addition":26,"./operators/front.calculator.symbol.operator.division":27,"./operators/front.calculator.symbol.operator.exponentiation":28,"./operators/front.calculator.symbol.operator.modulo":29,"./operators/front.calculator.symbol.operator.multiplication":30,"./operators/front.calculator.symbol.operator.subtraction":31}],17:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./abstract/front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=o(r),e=(t=n?(t=o(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,i=l(o);function o(){if(this instanceof o)return i.call(this);throw new TypeError("Cannot call a class as a function")}return e=o,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"./abstract/front.calculator.symbol.abstract":9}],18:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./abstract/front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=o(r),e=(t=n?(t=o(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,i=l(o);function o(){var t;if(this instanceof o)return(t=i.call(this)).identifiers=[","],t;throw new TypeError("Cannot call a class as a function")}return e=o,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"./abstract/front.calculator.symbol.abstract":9}],19:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["abs"],t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"execute",value:function(t){if(1!==t.length)throw"Error: Expected one argument, got "+t.length;t=t[0];return Math.abs(t)}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],20:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["avg"],t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"execute",value:function(t){if(t.length<1)throw"Error: Expected at least one argument, got "+t.length;for(var e=0,r=0;r<t.length;r++)e+=t[r];return e/t.length}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],21:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["ceil"],t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"execute",value:function(t){if(1!==t.length)throw"Error: Expected one argument, got "+t.length;return Math.ceil(t[0])}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],22:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["floor"],t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"execute",value:function(t){if(1!==t.length)throw"Error: Expected one argument, got "+t.length;return Math.floor(t[0])}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],23:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function o(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var r;if(t)return"string"==typeof t?n(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}(t)||function(){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 n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=f(r),e=(t=n?(t=f(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n=l(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["max"],t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"execute",value:function(t){if(t.length<1)throw"Error: Expected at least one argument, got "+t.length;return Math.max.apply(Math,o(t))}}])&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],24:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function o(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var r;if(t)return"string"==typeof t?n(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}(t)||function(){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 n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=f(r),e=(t=n?(t=f(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n=l(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["min"],t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"execute",value:function(t){if(t.length<1)throw"Error: Expected at least one argument, got "+t.length;return Math.min.apply(Math,o(t))}}])&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],25:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["round"],t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"execute",value:function(t){if(1!==t.length)throw"Error: Expected one argument, got "+t.length;return Math.round(t[0])}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],26:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["+"],t.precedence=100,t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"operate",value:function(t,e){return t+e}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}],27:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["/"],t.precedence=200,t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"operate",value:function(t,e){return t/e}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}],28:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["^"],t.precedence=300,t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"operate",value:function(t,e){return Math.pow(t,e)}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}],29:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["%"],t.precedence=200,t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"operate",value:function(t,e){return t%e}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}],30:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["*"],t.precedence=200,t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"operate",value:function(t,e){return t*e}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}],31:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(i);function i(){var t;if(this instanceof i)return(t=n.call(this)).identifiers=["-"],t.precedence=100,t.operatesUnary=!0,t;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"operate",value:function(t,e){return t-e}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),i}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}]},{},[1]),[].includes||(Array.prototype.includes=function(t,e){"use strict";var r=Object(this),n=parseInt(r.length)||0;if(0!==n){var i,e=parseInt(e)||0;for(0<=e?i=e:(i=n+e)<0&&(i=0);i<n;){var o=r[i];if(t===o||t!=t&&o!=o)return!0;i++}}return!1});class forminatorFrontUtils{constructor(){}field_is_checkbox(t){var e=!1;return t.each(function(){if("checkbox"===jQuery(this).attr("type"))return!(e=!0)}),e}field_is_radio(t){var e=!1;return t.each(function(){if("radio"===jQuery(this).attr("type"))return!(e=!0)}),e}field_is_select(t){return t.is("select")}field_has_inputMask(t){var e=!1;return t.each(function(){if(void 0!==jQuery(this).attr("data-inputmask"))return!(e=!0)}),e}get_field_value(t){var e=0,r=0,n=null;return this.field_is_radio(t)?(n=t.filter(":checked")).length&&void 0!==(r=n.data("calculation"))&&(e=Number(r)):this.field_is_checkbox(t)?t.each(function(){jQuery(this).is(":checked")&&void 0!==(r=jQuery(this).data("calculation"))&&(e+=Number(r))}):this.field_is_select(t)?(n=t.find("option").filter(":selected")).length&&void 0!==(r=n.data("calculation"))&&(e=Number(r)):this.field_has_inputMask(t)?e=parseFloat(t.inputmask("unmaskedvalue").replace(",",".")):t.length&&(n=t.val(),e=parseFloat(n.replace(",","."))),isNaN(e)?0:e}}void 0===window.forminatorUtils&&(window.forminatorUtils=function(){return new forminatorFrontUtils}),function(l,f,a){"use strict";var r="forminatorLoader",n={action:"",type:"",id:"",render_id:"",is_preview:"",preview_data:[],nonce:!1,last_submit_data:{},extra:{}};function e(t,e){this.element=t,this.$el=l(this.element),this.settings=l.extend({},n,e),this._defaults=n,this._name=r,this.frontInitCalled=!1,this.scriptsQue=[],this.frontOptions=null,this.leadFrontOptions=null,this.init()}l.extend(e.prototype,{init:function(){var t=decodeURI(a.location.search).replace(/(^\?)/,"").split("&").map(function(t){return this[(t=t.split("="))[0]]=t[1],this}.bind({}))[0];t.action=this.settings.action,t.type=this.settings.type,t.id=this.settings.id,t.render_id=this.settings.render_id,t.is_preview=this.settings.is_preview,t.preview_data=JSON.stringify(this.settings.preview_data),t.last_submit_data=this.settings.last_submit_data,t.extra=this.settings.extra,t.nonce=this.settings.nonce,void 0!==this.settings.has_lead&&(t.has_lead=this.settings.has_lead,t.leads_id=this.settings.leads_id),this.load_ajax(t),this.handleDiviPopup()},load_ajax:function(i){var o=this;l.ajax({type:"POST",url:f.ForminatorFront.ajaxUrl,data:i,cache:!1,beforeSend:function(){l(a).trigger("before.load.forminator",i.id)},success:function(t){if(t.success){var e=t.data;if(l(a).trigger("response.success.load.forminator",i.id,t),!e.is_ajax_load)return!1;var r,n=[];(n=void 0===e.pagination_config&&void 0!==e.options.pagination_config?e.options.pagination_config:n)&&(f.Forminator_Cform_Paginations=f.Forminator_Cform_Paginations||[],f.Forminator_Cform_Paginations[i.id]=n),o.frontOptions=e.options||null,void 0===f.Forminator_Cform_Paginations&&o.frontOptions.pagination_config&&(f.Forminator_Cform_Paginations=f.Forminator_Cform_Paginations||[],f.Forminator_Cform_Paginations[i.id]=o.frontOptions.pagination_config),void 0!==e.lead_options&&(o.leadFrontOptions=e.lead_options||null,void 0===f.Forminator_Cform_Paginations)&&o.leadFrontOptions.pagination_config&&(f.Forminator_Cform_Paginations=f.Forminator_Cform_Paginations||[],f.Forminator_Cform_Paginations[i.leads_id]=o.leadFrontOptions.pagination_config),e.html&&(n=e.style||null,r=e.script||null,o.render_html(e.html,n,r)),e.styles&&o.maybe_append_styles(e.styles),e.scripts&&o.maybe_append_scripts(e.scripts),!e.scripts&&o.frontOptions&&o.init_front()}else l(a).trigger("response.error.load.forminator",i.id,t)},error:function(){l(a).trigger("request.error.load.forminator",i.id)}}).always(function(){l(a).trigger("after.load.forminator",i.id)})},render_html:function(t,e,r){var n=this.settings.id,i=this.settings.render_id,o="",a=null;(a=l(t).find(".forminator-response-message")).length&&(o=a.get(0).outerHTML),(a=this.$el.find(".forminator-poll-response-message")).length&&(o=a.get(0).outerHTML),this.$el.parent().hasClass("forminator-guttenberg")?this.$el.parent().html(t):this.$el.replaceWith(t),l("#forminator-module-"+n+"[data-forminator-render="+i+"]").hide(),o&&(l("#forminator-module-"+n+"[data-forminator-render="+i+"] .forminator-response-message").replaceWith(o),l("#forminator-module-"+n+"[data-forminator-render="+i+"] .forminator-poll-response-message").replaceWith(o)),e&&(l("style#forminator-module-"+n).length&&l("style#forminator-module-"+n).remove(),l("body").append(e)),r&&l("body").append(r)},maybe_append_styles:function(t){for(var e in t){var r;t.hasOwnProperty(e)&&!l("link#"+e).length&&((r=l("<link>")).attr("rel","stylesheet"),r.attr("id",e),r.attr("type","text/css"),r.attr("media","all"),r.attr("href",t[e].src),l("head").append(r))}},maybe_append_scripts:function(t){var e,r=[],n=l("body").find(".hustle-ui").length,i=l("body").find("script[src^='https://www.paypal.com/sdk/js']").attr("src");for(e in t)if(t.hasOwnProperty(e)){var o=t[e].on,a=t[e].load;if("window"===o){if(f[a]&&"forminator-google-recaptcha"!==e&&0===n)continue}else if("$"===o&&l.fn[a])continue;o={};o.src=t[e].src,o.async=t[e].async??!0,o.src!==i&&(r.push(o),this.scriptsQue.push(e))}if(this.scriptsQue.length)for(var s in r)r.hasOwnProperty(s)&&this.load_script(r[s]);else this.init_front()},load_script:function(t){var e,r=this,n=a.createElement("script"),i=a.getElementsByTagName("body")[0];n.type="text/javascript",n.src=t.src,n.async=t.async,n.defer=!0,n.onload=function(){r.script_on_load()},0===l('script[src="'+n.src+'"]').length?f.parent!==f&&t.src.includes("paypal.com")?((e=f.parent.document.createElement("script")).type="text/javascript",e.src=t.src,e.async=t.async,e.defer=!0,e.onload=function(){r.script_on_load()},0===l(f.parent.document).find('script[src="'+e.src+'"]').length?f.parent.document.body.appendChild(e):r.script_on_load()):i.appendChild(n):r.script_on_load()},script_on_load:function(){this.scriptsQue.pop(),this.scriptsQue.length||this.init_front()},init_front:function(){var t,e,r,n;this.frontInitCalled||(this.frontInitCalled=!0,n=this.settings.id,t=this.settings.render_id,e=this.frontOptions||null,r=this.leadFrontOptions||null,e&&l("#forminator-module-"+n+'[data-forminator-render="'+t+'"]').forminatorFront(e),void 0!==this.settings.has_lead&&r&&(n=this.settings.leads_id,l("#forminator-module-"+n+'[data-forminator-render="'+t+'"]').forminatorFront(r)),this.init_window_vars())},init_window_vars:function(){var t;"undefined"!=typeof ForminatorValidationErrors&&void 0!==(t=jQuery(ForminatorValidationErrors.selector).data("forminatorFrontSubmit"))&&t.show_messages(ForminatorValidationErrors.errors),"undefined"!=typeof ForminatorFormHider&&void 0!==(t=jQuery(ForminatorFormHider.selector).data("forminatorFront"))&&t.hide()},handleDiviPopup:function(){var e=this;"undefined"!=typeof DiviArea&&DiviArea.addAction("show_area",function(t){0!==t.find("#"+e.element.id).length&&(e.frontInitCalled=!1,e.init_front(),forminator_render_hcaptcha())})}}),l.fn[r]=function(t){return this.each(function(){l.data(this,r)||l.data(this,r,new e(this,t))})}}(jQuery,window,document),function(s,l){"use strict";var r="forminatorFrontStripe",n={type:"stripe",paymentEl:null,paymentRequireSsl:!1,generalMessages:{}};function e(t,e){this.element=t,this.$el=s(this.element),this.settings=s.extend({},n,e),this._defaults=n,this._name=r,this._stripeData=null,this._stripe=null,this._elements=null,this._paymentElement=null,this._beforeSubmitCallback=null,this._form=null,this.intent=!0,this.billingDetails={},this.init()}s.extend(e.prototype,{init:function(){var n,t;this.settings.paymentEl&&void 0!==this.settings.paymentEl.data()&&((n=this)._stripeData=this.settings.paymentEl.data(),this._form=this.$el,0<this.settings.stripe_depends.length&&(t=this.settings.stripe_depends.map(function(t){return'[name="'+t+'"]'}).join(", "),this.$el.find(t).each(function(){s(this).on("change",function(t,e){"forminator_emulate_trigger"!==e&&(n.intent=!0,n.updateAmount(t))})})),this.updateAmount(),s(this.element).on("payment.before.submit.forminator",async(t,e,r)=>{n.intent=!1,n._beforeSubmitCallback=r;r=(await this._elements.submit()).error;r?void 0!==r.message&&n.show_error(r.message):n._stripe.createPaymentMethod({elements:n._elements,params:{billing_details:this.billingDetails}}).then(function(t){var e;t.error?(e=t.error.message||l.ForminatorFront.cform.payment_failed,n.show_error(e)):(e=n.getObjectValue(t,"paymentMethod"),n._stripeData.paymentMethod=n.getObjectValue(e,"id"),n._stripeData.paymentMethodType=n.getObjectValue(e,"type"),n.$el.find("#forminator-stripe-paymentmethod").val(""),n.$el.find("#forminator-stripe-subscriptionid").val(""),n.updateAmount())})}),this.$el.on("forminator:form:submit:stripe:3dsecurity",function(t,e,r){n.validate3d(t,e,r)}),this.$el.on("forminator:form:submit:stripe:redirect",this.paymentMethodRedirect.bind(this)),this.$el.find("input.forminator-input, select.forminator-select2").each(function(){s(this).on("change",function(t,e){if("forminator_emulate_trigger"===e)return!0;n.updateBillingDetails(t)})}))},paymentMethodRedirect:function(t,e,r,n){var i=this;i.$el.find("#forminator-stripe-subscriptionid").val(n);const o=l.open(e,"PaymentMethodPopup","width=800,height=600,scrollbars=yes"),a=setInterval(async()=>{var{error:t,paymentIntent:e}=await i._stripe.retrievePaymentIntent(r);if(t)clearInterval(a);else if("requires_capture"===e.status||"succeeded"===e.status)clearInterval(a),o.close(),i._beforeSubmitCallback&&i._beforeSubmitCallback.call();else if("requires_payment_method"===e.status||"canceled"===e.status){let t="";t="canceled"===e.status?l.ForminatorFront.cform.payment_cancelled:l.ForminatorFront.cform.payment_failed,clearInterval(a),o.close(),i.$el.find("#forminator-stripe-paymentmethod").val(""),i.show_error(t)}},3e3)},validate3d:function(t,e,r){var n=this;r?this._stripe.confirmPayment({clientSecret:e,elements:n._elements,redirect:"if_required",confirmParams:{return_url:this.getStripeData("returnUrl")}}).then(function(t){n.$el.find("#forminator-stripe-subscriptionid").val(r),n._beforeSubmitCallback&&n._beforeSubmitCallback.call()}):this._stripe.retrievePaymentIntent(e).then(function(t){"requires_action"!==t.paymentIntent.status&&"requires_confirmation"!==t.paymentIntent.status&&"requires_source_action"!==t.paymentIntent.status||n._stripe.confirmPayment({clientSecret:e,elements:n._elements,redirect:"if_required"}).then(function(t){t.error?n.show_error(t.error.message):n._beforeSubmitCallback&&n._beforeSubmitCallback.call()})})},getForm:function(t){t=s(t.target);return t=t.hasClass("forminator-custom-form")?t:t.closest("form.forminator-custom-form")},updateAmount:function(t){t&&t.preventDefault();var t=new FormData(this.$el[0]),n=this,e=(t.append("action","forminator_update_payment_amount"),t.append("paymentPlan",this.getStripeData("paymentPlan")),t.append("payment_method",this.getStripeData("paymentMethod")),t.append("payment_method_type",this.getStripeData("paymentMethodType")),t.append("paymentid",""),this.intent&&(t.append("stripe-intent",!0),t.append("stripe_first_payment_intent",this._paymentElement?0:1)),this.getStripeData("receipt")),r=this.getStripeData("receiptEmail"),i=(e&&r&&(e=this.get_field_value(r)||"",t.append("receipt_email",e)),this._form.find(".forminator-response-message"));s.ajax({type:"POST",url:l.ForminatorFront.ajaxUrl,data:t,cache:!1,contentType:!1,processData:!1,beforeSend:function(){void 0!==n.settings.has_loader&&n.settings.has_loader&&!n.intent&&(i.html("<p>"+n.settings.loader_label+"</p>"),n.focus_to_element(i),i.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-success forminator-error").addClass("forminator-loading forminator-show")),n._form.find("button").attr("disabled",!0)},success:function(t){var e,r;!0===t.success?void 0!==t.data?(e=void 0!==t.data.paymentid,r=void 0!==t.data.paymentPlan,e&&(n.$el.find("#forminator-stripe-paymentid").val(t.data.paymentid),n.$el.find("#forminator-stripe-paymentmethod").val(n._stripeData.paymentMethod),n._stripeData.paymentid=t.data.paymentid,n._stripeData.secret=t.data.paymentsecret,n.intent)&&n.mountStripeField(t.data.paymentsecret),t.data.paymentmethod_failed&&n.$el.find("#forminator-stripe-paymentmethod").val(""),r&&(n._stripeData.paymentPlan=t.data.paymentPlan),n.intent?n.unfrozeForm(i):n.handlePayment()):n.show_error("Invalid Payment Intent ID"):n.intent?(void 0!==t.data.paymentPlan&&(n._stripeData.paymentPlan=t.data.paymentPlan),n.unfrozeForm(i)):(n.show_error(t.data.message),t.data.errors.length&&n.show_messages(t.data.errors),(e=n._form.find(".forminator-g-recaptcha")).length&&(r=(e=s(e.get(0))).data("forminator-recapchta-widget"),"invisible"===e.data("size"))&&l.grecaptcha.reset(r))},error:function(t){t=400===t.status?l.ForminatorFront.cform.upload_error:l.ForminatorFront.cform.error;n.show_error(t)}}).always(function(){n.intent||n.$el.find("#forminator-stripe-paymentmethod").val(""),n._paymentElement||n.mountStripeField()})},show_error:function(t){var e=this._form.find(".forminator-response-message");e.html("<p>"+t+"</p>"),this.unfrozeForm(e)},unfrozeForm:function(t){this._form.find("button").removeAttr("disabled"),this.intent||(t.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-loading forminator-accessible").addClass("forminator-error forminator-show"),this.focus_to_element(t)),this.enable_form()},enable_form:function(){var t;void 0!==this.settings.has_loader&&this.settings.has_loader&&(t=this._form.find(".forminator-response-message"),this._form.removeClass("forminator-fields-disabled"),t.removeClass("forminator-loading"))},focus_to_element:function(t){t.show(),s("html,body").animate({scrollTop:t.offset().top-(s(l).height()-t.outerHeight(!0))/2},500,function(){t.attr("tabindex")||t.attr("tabindex",-1),t.focus()})},show_messages:function(t){var i,o=this,a=o.$el.data("forminatorFrontCondition");return void 0!==a&&(this.$el.find(".forminator-error-message").remove(),i=0,t.forEach(function(t){var e,r,n=Object.keys(t),t=Object.values(t),n=a.get_form_field(n);n.length&&(0===i&&(o.$el.trigger("forminator.front.pagination.focus.input",[n]),o.focus_to_element(n)),s(n).hasClass("forminator-input-time")&&(0===(r=(e=s(n).closest(".forminator-field:not(.forminator-field--inner)")).children(".forminator-error-message")).length&&(e.append('<span class="forminator-error-message" aria-hidden="true"></span>'),r=e.children(".forminator-error-message")),r.html(t)),0===(r=(e=0===(e=s(n).closest(".forminator-field--inner")).length&&0===(e=s(n).closest(".forminator-field")).length&&1<(e=s(n).find(".forminator-field")).length?e.first():e).find(".forminator-error-message")).length&&(e.append('<span class="forminator-error-message" aria-hidden="true"></span>'),r=e.find(".forminator-error-message")),s(n).attr("aria-invalid","true"),r.html(t),e.addClass("forminator-has_error"),i++)})),this},isRelevantField:function(t,e,r,n,i){return!t||(t=s(t.target).attr("name"),!!e&&(r&&t===r||n&&t===n||e&&(t===e||t.startsWith(e+"-"))||i&&(t===i||t.startsWith(i+"-"))))},updateBillingDetails:function(t){if(!this.getStripeData("billing")||!this._paymentElement)return!0;var e=this.getStripeData("billingName"),r=this.getStripeData("billingEmail"),n=this.getStripeData("billingPhone"),i=this.getStripeData("billingAddress"),o={};if(!this.isRelevantField(t,e,r,n,i))return!0;t=this.get_field_value(e)," "!==(t=t||(this.get_field_value(e+"-first-name")||"")+" "+(this.get_field_value(e+"-last-name")||""))&&(o.name=t),e=this.get_field_value(r)||"",e&&(o.email=e),t=this.get_field_value(n)||"",t&&(o.phone=t),r={},e=this.get_field_value(i+"-street_address")||"",e&&(r.line1=e),n=this.get_field_value(i+"-address_line")||"",n&&(r.line2=n),t=this.get_field_value(i+"-city")||"",t&&(r.city=t),e=this.get_field_value(i+"-state")||"";e&&(r.state=e);n=this.get_form_field(i+"-country").find(":selected").data("country-code"),n&&(r.country=n),t=this.get_field_value(i+"-zip")||"";t&&(r.postal_code=t),Object.keys(r).length&&(o.address=r),Object.keys(o).length&&(this.billingDetails=o,this._paymentElement.update({defaultValues:{billingDetails:o}}))},handlePayment:function(){var t=s(".forminator-number--field, .forminator-currency, .forminator-calculation");t.inputmask&&t.inputmask("remove"),this._beforeSubmitCallback&&this._beforeSubmitCallback.call()},mountStripeField:function(t=null){"subscription"===t&&(t=null),this._paymentElement&&this._paymentElement.unmount();var e=this.getStripeData("fieldId"),r=this.getStripeData("key"),n={...this.getStripeData("paymentOptions")};if(null===r)return!1;this._stripe=Stripe(r);var r={...this.getStripeData("elementsOptions")},i=(t?(delete r.paymentMethodTypes,r.clientSecret=t):(r.mode="setup",r.currency=this.getStripeData("currency")||"usd"),this._elements=this._stripe.elements(r),this._paymentElement=this._elements.create("payment",n),this._paymentElement.mount("#payment-element-"+e),this);this._paymentElement.on("ready",function(t){i.updateBillingDetails()})},hideCardError:function(){var t=this.$el.find(".forminator-card-message"),e=t.find(".forminator-error-message");0===e.length&&(t.append('<span class="forminator-error-message" aria-hidden="true"></span>'),e=t.find(".forminator-error-message")),t.closest(".forminator-field").removeClass("forminator-has_error"),e.html("")},showCardError:function(t,e){var r=this.$el.find(".forminator-card-message"),n=r.find(".forminator-error-message");0===n.length&&(r.append('<span class="forminator-error-message" aria-hidden="true"></span>'),n=r.find(".forminator-error-message")),r.closest(".forminator-field").addClass("forminator-has_error"),r.closest(".forminator-field").addClass("forminator-is_filled"),n.html(t),e&&this.focus_to_element(r.closest(".forminator-field"))},getStripeData:function(t){return void 0!==this._stripeData&&void 0!==this._stripeData[t]?this._stripeData[t]:null},getObjectValue:function(t,e){return void 0!==t[e]?t[e]:null},get_form_field:function(t){var e=this.$el.find("#"+t+"-field");return e=0===e.length&&t&&0===(e=this.$el.find("input[name="+t+"]")).length&&0===(e=this.$el.find("textarea[name="+t+"]")).length&&0===(e=this.$el.find('input[name="'+t+'[]"]')).length&&0===(e=this.$el.find('select[name="'+t+'"]')).length&&0===(e=this.$el.find('select[name="'+t+'[]"]')).length?this.$el.find("#"+t):e},get_field_value:function(t){var t=this.get_form_field(t),e="",r=null;return this.field_is_radio(t)?(r=t.filter(":checked")).length&&(e=r.val()):this.field_is_checkbox(t)?t.each(function(){s(this).is(":checked")&&(e=s(this).val())}):e=!this.field_is_select(t)&&this.field_has_inputMask(t)?parseFloat(t.inputmask("unmaskedvalue")):t.val(),e},field_has_inputMask:function(t){var e=!1;return t.each(function(){if(void 0!==s(this).attr("data-inputmask"))return!(e=!0)}),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===s(this).attr("type"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===s(this).attr("type"))return!(e=!0)}),e},field_is_select:function(t){return t.is("select")}}),s.fn[r]=function(t){return this.each(function(){s.data(this,r)||s.data(this,r,new e(this,t))})}}(jQuery,window,document),function(l,s,f){"use strict";var r="forminatorFront",n={form_type:"custom-form",rules:{},messages:{},conditions:{},inline_validation:!1,print_value:!1,chart_design:"bar",chart_options:{},forminator_fields:[],general_messages:{calculation_error:"Failed to calculate field.",payment_require_ssl_error:"SSL required to submit this form, please check your URL.",payment_require_amount_error:"PayPal amount must be greater than 0.",form_has_error:"Please correct the errors before submission."},payment_require_ssl:!1};function e(t,e){this.element=t,this.$el=l(this.element),this.forminator_selector="#"+l(this.element).attr("id")+'[data-forminator-render="'+l(this.element).data("forminator-render")+'"]',this.forminator_loader_selector='div[data-forminator-render="'+l(this.element).data("forminator-render")+'"][data-form="'+l(this.element).attr("id")+'"]',this.settings=l.extend({},n,e),void 0!==this.settings.messages&&(this.settings.messages=this.maybeParseStringToJson(this.settings.messages,"object")),void 0!==this.settings.rules&&(this.settings.rules=this.maybeParseStringToJson(this.settings.rules,"object")),void 0!==this.settings.calendar&&(this.settings.calendar=this.maybeParseStringToJson(this.settings.calendar,"array")),this._defaults=n,this._name=r,this.form_id=0,this.template_type="",this.init(),this.handleDiviPopup()}function t(){l(".forminator-custom-form").find(".forminator-label").on("click",function(t){t.preventDefault();t=l(this);t.next("#"+t.attr("for")).focus()})}l.extend(e.prototype,{init:function(){var e=this;switch(0<this.$el.find('input[name="form_id"]').length&&(this.form_id=this.$el.find('input[name="form_id"]').val()),0<this.$el.find('input[name="form_type"]').length&&(this.template_type=this.$el.find('input[name="form_type"]').val()),l(this.forminator_loader_selector).remove(),0===this.$el.closest(".wph-modal").length&&this.$el.show(),l(f).on("hustle:module:displayed",function(t,e){l(".wph-modal-active").find("form").css("display","")}),e.reint_intlTelInput(),setTimeout(function(){l(".wph-modal-active").find("form").css("display","")},10),this.settings.form_type){case"custom-form":l(this.element).each(function(){e.init_custom_form(this)}),this.$el.on("forminator-clone-group",function(t){e.init_custom_form(t.target)});break;case"poll":this.init_poll_form();break;case"quiz":this.init_quiz_form()}var t={form_type:e.settings.form_type,forminator_selector:e.forminator_selector,chart_design:e.settings.chart_design,chart_options:e.settings.chart_options,has_quiz_loader:e.settings.has_quiz_loader,has_loader:e.settings.has_loader,loader_label:e.settings.loader_label,resetEnabled:e.settings.is_reset_enabled,inline_validation:e.settings.inline_validation};"leads"!==this.template_type&&"quiz"!==this.settings.form_type||(t.form_placement=e.settings.form_placement,t.hasLeads=e.settings.hasLeads,t.leads_id=e.settings.leads_id,t.quiz_id=e.settings.quiz_id,t.skip_form=e.settings.skip_form),l(this.element).forminatorFrontSubmit(t),this.activate_field(),this.small_form(),l(f).trigger("forminator:form:added")},init_custom_form:function(t){var e,r,n=this,i=this.$el.find(".forminator-save-draft-link"),o=0!==i.length,a=(this.init_intlTelInput_validation(t),this.settings.inline_validation&&l(t).forminatorFrontValidate({rules:n.settings.rules,messages:n.settings.messages}),l(t).forminatorFrontCalculate({forminatorFields:n.settings.forminator_fields,generalMessages:n.settings.general_messages,memoizeTime:n.settings.calcs_memoize_time||300}),l(t).forminatorFrontMergeTags({forminatorFields:n.settings.forminator_fields,print_value:n.settings.print_value}),this.init_pagination(t),n.settings.has_stripe&&((r=l(this.element).find('.forminator-stripe-element[data-type="stripe-ocs"]').first()).length<1&&(r=l(this.element).find(".forminator-stripe-element").first()),l(n.element).is(":visible")&&this.renderStripe(n,r),l(f).on("forminator:form:added",function(){n.renderStripe(n,r)})),!n.settings.has_paypal||l(n.element).closest(".et_pb_section").length&&!l(n.element).is(":visible")||l(this.element).forminatorFrontPayPal({type:"paypal",paymentEl:this.settings.paypal_config,paymentRequireSsl:n.settings.payment_require_ssl,generalMessages:n.settings.general_messages,has_loader:n.settings.has_loader,loader_label:n.settings.loader_label}),l(t).forminatorFrontCondition(this.settings.conditions,this.settings.calendar),this.init_fui(t),l(t).find(".forminator-datepicker").forminatorFrontDatePicker(this.settings.calendar),this.responsive_captcha(t),this.field_counter(t),this.field_number(t),this.field_time(),l(t).find(".forminator-multi-upload").forminatorFrontMultiFile(this.$el),this.upload_field(t),this.init_login_2FA(),n.maybeRemoveDuplicateFields(t),n.checkComplianzBlocker(),l(s).on("resize",function(){n.responsive_captcha(t)}),l(s).on("load",function(){n.maybeRemoveDuplicateFields(t)}),o?this.$el.serializeArray():"");this.$el.find(".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea, .forminator-field-signature").on("change input",function(t){o&&i.hasClass("disabled")&&(clearTimeout(e),e=setTimeout(function(){n.maybe_enable_save_draft(i,a)},500))}),void 0!==n.settings.hasLeads&&("beginning"===n.settings.form_placement&&l("#forminator-module-"+this.settings.quiz_id).css({height:0,opacity:0,overflow:"hidden",visibility:"hidden","pointer-events":"none",margin:0,padding:0,border:0}),"end"===n.settings.form_placement)&&l(t).css({height:0,opacity:0,overflow:"hidden",visibility:"hidden","pointer-events":"none",margin:0,padding:0,border:0})},init_poll_form:function(){var i=this,o=this.$el.find("fieldset"),t=this.$el.find(".forminator-radio input"),a=this.$el.find(".forminator-input"),s=a.closest(".forminator-field");FUI.inputStates(a),t.on("click",function(){s.addClass("forminator-hidden"),s.attr("aria-hidden","true"),a.removeAttr("tabindex"),a.attr("name","");var t,e=this.checked,r=l(this).attr("id"),n=l(this).attr("name");return o.removeClass("forminator-has_error"),i.$el.find(".forminator-input#"+r+"-extra").length&&(t=(r=i.$el.find(".forminator-input#"+r+"-extra")).closest(".forminator-field"),e?(r.attr("name",n+"-extra"),t.removeClass("forminator-hidden"),t.removeAttr("aria-hidden"),r.attr("tabindex","-1"),r.focus()):(t.addClass("forminator-hidden"),t.attr("aria-hidden","true"),r.removeAttr("tabindex"))),!0}),this.$el.hasClass("forminator-poll-disabled")&&this.$el.find(".forminator-radio").each(function(){l(this).addClass("forminator-disabled"),l(this).find("input").attr("disabled",!0)})},init_quiz_form:function(){var a=this,t=void 0!==a.settings.form_placement?a.settings.form_placement:"",e=void 0!==a.settings.quiz_id?a.settings.quiz_id:0;this.$el.find(".forminator-button:not(.forminator-quiz-start)").each(function(){l(this).prop("disabled",!0)}),this.$el.find(".forminator-answer input").each(function(){l(this).attr("checked",!1)}),this.$el.find(".forminator-result--info button").on("click",function(){location.reload()}),l("#forminator-quiz-leads-"+e+" .forminator-quiz-intro .forminator-quiz-start").on("click",function(t){t.preventDefault(),l(this).closest(".forminator-quiz-intro").hide(),a.$el.prepend('<button class="forminator-button forminator-quiz-start forminator-hidden"></button>').find(".forminator-quiz-start").trigger("click").remove()}),this.$el.on("click",".forminator-quiz-start",function(t){t.preventDefault(),a.$el.find(".forminator-quiz-intro").hide(),a.$el.find(".forminator-pagination").removeClass("forminator-hidden");t={totalSteps:a.$el.find(".forminator-pagination").length-1,step:0,quiz:!0};a.settings.text_next&&(t.next_button=a.settings.text_next),a.settings.text_prev&&(t.prev_button=a.settings.text_prev),a.settings.submit_class&&(t.submitButtonClass=a.settings.submit_class),l(a.element).forminatorFrontPagination(t)}),"end"!==t&&this.$el.find(".forminator-submit-rightaway").on("click",function(){a.$el.submit(),l(this).closest(".forminator-question").find(".forminator-submit-rightaway").addClass("forminator-has-been-disabled").attr("disabled","disabled")}),a.settings.hasLeads&&("beginning"===t&&a.$el.css({height:0,opacity:0,overflow:"hidden",visibility:"hidden","pointer-events":"none",margin:0,padding:0,border:0}),"end"===t)&&(a.$el.closest("div").find("#forminator-module-"+a.settings.leads_id).css({height:0,opacity:0,overflow:"hidden",visibility:"hidden","pointer-events":"none",margin:0,padding:0,border:0}),l("#forminator-quiz-leads-"+e+" .forminator-lead-form-skip").hide()),this.$el.on("click",".forminator-social--icon a",function(t){t.preventDefault();var t=l(this).data("social"),e=l(this).closest(".forminator-social--icons").data("url"),r=l(this).closest(".forminator-social--icons").data("message"),e={facebook:"https://www.facebook.com/sharer/sharer.php?u="+e+""e="+(r=encodeURIComponent(r)),twitter:"https://twitter.com/intent/tweet?&url="+e+"&text="+r,google:"https://plus.google.com/share?url="+e,linkedin:"https://www.linkedin.com/shareArticle?mini=true&url="+e+"&title="+r};if(void 0!==e[t])return r=s.open(e[t],t,"height="+l(s).height()+",width="+l(s).width()),s.focus&&r.focus(),!1}),this.$el.on("change",".forminator-answer input",function(t){var e=!!l(this).closest(".forminator-pagination").length,r=e?l(this).closest(".forminator-pagination"):a.$el,n=r.find(".forminator-answer input:checked").length,i=r.find(".forminator-question").length,r=l(this).closest(".forminator-question"),o=r.data("multichoice");a.$el.find(".forminator-button:not(.forminator-button-back)").each(function(){var t=n<i;l(this).prop("disabled",t),e&&(t?l(this).addClass("forminator-disabled"):l(this).removeClass("forminator-disabled"))}),this.checked&&!1===o&&r.find(".forminator-answer").not(l(this).parent(".forminator-answer")).each(function(t,e){l(e).find("> input").prop("checked",!1)})})},small_form:function(){var t,e=l(this.element),r=e.width();783<Math.max(f.documentElement.clientWidth,s.innerWidth||0)&&(e.hasClass("forminator-size--small")?480<r&&e.removeClass("forminator-size--small"):(t=e.closest(".hustle-content"),e.is(":visible")&&r<=480&&!t.length&&e.addClass("forminator-size--small")))},init_intlTelInput_validation:function(t){var o=l(t),a=o.is(".forminator-design--material"),t=o.find(".forminator-field--phone");o.is("form")||(a=o.closest("form").is(".forminator-design--material")),t.each(function(){var t=this,e=l(this).data("national_mode"),r=l(this).data("country"),n=l(this).data("validation"),i=s.intlTelInput.getInstance(t);void 0!==e&&(a&&l(this).unwrap(".forminator-input--wrap"),i&&i.destroy(),e={nationalMode:"enabled"===e,initialCountry:void 0!==r?r:"us",validationNumberTypes:null,loadUtils:()=>import(s.ForminatorFront.cform.intlTelInput_utils_script),strictMode:!0},void 0!==n&&"standard"===n&&(e.allowDropdown=!1),void 0!==n&&"international"===n&&(e.autoHideDialCode=!1,e.separateDialCode=!0),i=s.intlTelInput(t,e),void 0!==n&&"standard"===n&&l(this).on("blur",function(){""===l(t).val()&&(i.setCountry(r),o.validate().element(l(t)))}),a?(l(this).closest(".forminator-field").find("div.iti").addClass("forminator-input-with-phone"),l(this).closest(".forminator-field").find("div.iti").hasClass("iti--allow-dropdown")&&l(this).closest(".forminator-field").find(".forminator-label").addClass("iti--allow-dropdown")):l(this).closest(".forminator-field").find("div.iti").addClass("forminator-phone"),a)&&!l(this).parent().hasClass("forminator-input--wrap")&&l(this).wrap('<div class="forminator-input--wrap"></div>')})},reint_intlTelInput:function(){var r=this;r.$el.on("after:forminator:form:submit",function(t,e){r.init_intlTelInput_validation(r.forminator_selector)})},init_fui:function(t){var t=l(t),e=t.find(".forminator-input"),r=t.find(".forminator-textarea"),n=t.find(".forminator-select2"),i=t.find(".forminator-multiselect"),o=t.find(".forminator-stripe-element"),a=(t.find(".forminator-slider"),t.find(".forminator-rating"));t.attr("data-design"),t.attr("data-design"),t.attr("data-design"),t.attr("data-design");e.length&&e.each(function(){FUI.inputStates(this)}),r.length&&r.each(function(){FUI.textareaStates(this)}),"function"==typeof FUI.select2&&FUI.select2(n.length),"function"==typeof FUI.slider&&FUI.slider(),i.length&&FUI.multiSelectStates(i),a.length&&"function"==typeof FUI.rating&&FUI.rating(a),t.hasClass("forminator-design--material")&&(e.length&&e.each(function(){FUI.inputMaterial(this)}),r.length&&r.each(function(){FUI.textareaMaterial(this)}),o.length)&&o.each(function(){var t,e;l(this).hasClass("forminator-stripe-payment-element")||(e=(t=l(this).closest(".forminator-field")).find(".forminator-label")).length&&(t.addClass("forminator-stripe-floating"),e.addClass("forminator-floating--input"))})},responsive_captcha:function(t){l(t).find(".forminator-g-recaptcha").each(function(){var t=l(this).data("badge");l(this).is(":visible")&&"inline"===t&&(t=(t=l(this).parent().width())<302?t/302:1,l(this).css("transform","scale("+t+")"),l(this).css("-webkit-transform","scale("+t+")"),l(this).css("transform-origin","0 0"),l(this).css("-webkit-transform-origin","0 0"))})},init_pagination:function(t){var t=l(t).find(".forminator-pagination").length,e=s.location.hash,r=!1,n=0;0<t&&(void 0!==e&&0<=e.indexOf("step-")&&(r=!0,n=e.substr(6,8)),l(this.element).forminatorFrontPagination({totalSteps:t,hashStep:r,step:n,inline_validation:this.settings.inline_validation,submitButtonClass:this.settings.submit_button_class}))},activate_field:function(){var t=l(this.element),e=t.find(".forminator-input"),r=t.find(".forminator-textarea");function n(t){var r=l(t),n=r.val().trim(),i=r.closest(".forminator-field"),o=r.attr("data-field"),a=r.closest(".forminator-timepicker").parent(),s=i.find(".forminator-error-message");r.on("load change keyup keydown",function(t){var e;void 0!==o&&!1!==o?("hours"===r.data("field")&&(e=a.find('.forminator-error-message[data-error-field="hours"]'),""!==n)&&0!==e.length&&e.remove(),"minutes"===r.data("field")&&(e=a.find('.forminator-error-message[data-error-field="minutes"]'),""!==n)&&0!==e.length&&e.remove()):""!==n&&s.text()&&(s.remove(),i.removeClass("forminator-has_error")),t.stopPropagation()})}function i(){t.find(".select2-container").hasClass("select2-container--open")?setTimeout(i,300):t.find(".select2-container").closest(".forminator-field").removeClass("forminator-is_active")}e.length&&e.each(function(){n(this)}),r.length&&r.each(function(){n(this)}),t.find("select.forminator-select2 + .forminator-select").each(function(){var e=l(this);e.on("mouseover",function(t){t.stopPropagation(),l(this).closest(".forminator-field").addClass("forminator-is_hover")}).on("mouseout",function(t){t.stopPropagation(),l(this).closest(".forminator-field").removeClass("forminator-is_hover")}),e.on("click",function(t){t.stopPropagation(),i(),e.hasClass("select2-container--open")?l(this).closest(".forminator-field").addClass("forminator-is_active"):l(this).closest(".forminator-field").removeClass("forminator-is_active")})})},field_counter:function(t){var t=l(t),e=t.find(".forminator-button-submit");t.find(".forminator-input, .forminator-input input, .forminator-textarea").each(function(){var t=l(this),o=0;t.on("keydown",function(t){if(!l(this).hasClass("forminator-textarea")&&13===t.keyCode)return t.preventDefault(),e.is(":visible")&&e.trigger("click"),!1}),t.on("change keyup keydown",function(t){t.stopPropagation();var e,r,n,i=l(this).closest(".forminator-col").find(".forminator-description span");i.length&&(e=parseInt(i.data("limit")))&&("words"!==i.data("type")?1===i.data("editor")?(n=l(this).val().replace(/<[^>]*>/g,""),n=l("<textarea/>").html(n).text(),o=n.length,n=t.ctrlKey||t.metaKey,r=-1!==[37,38,39,40,8,46].indexOf(t.keyCode),e<=o&&!n&&!r&&t.preventDefault()):o=l(this).val().length:(r=("string"!=typeof(n=l(this).val())?n:String(n).replace(/<\/?[^>]+(>|$)/g,"").trim()).replace(/<[^>]*>/g,""),o=r.trim().split(/\s+/).length,e<=r.trim().split(/\s+/).length&&32===t.which&&t.preventDefault()),i.text(o+" / "+e))})})},field_number:function(t){t=l(t);t.find("input[type=number]").each(function(){l(this).keypress(function(t){for(var e=[44,45,46],r=t.which,n=48;n<58;n++)e.push(n);0<=e.indexOf(r)||t.preventDefault()})}),t.find(".forminator-number--field, .forminator-currency, .forminator-calculation").each(function(){var e;"number"===l(this).attr("type")&&(e=l(this).data("decimals"),l(this).change(function(t){this.value=parseFloat(this.value).toFixed(e)}),l(this).trigger("change")),l(this).inputmask({alias:"decimal",rightAlign:!1,digitsOptional:!1,showMaskOnHover:!1,autoUnmask:!0,removeMaskOnSubmit:!0})})},field_time:function(){var s=this;l(".forminator-input-time").on("input",function(t){var e=l(this),r=e.val();r&&2<=r.length&&e.val(r.substr(0,2))}),this.$el.find(".forminator-timepicker").each(function(t,e){var r,n,i=l(e),o=i.data("start-limit"),a=i.data("end-limit");void 0!==o&&void 0!==a&&(r=i.find(".time-hours"),n=r.html(),s.resetTimePicker(i,o,a),i.find(".time-ampm").on("change",function(){r.val(""),r.html(n),s.resetTimePicker(i,o,a),setTimeout(function(){i.find(".forminator-field").removeClass("forminator-has_error")},10)}))})},resetTimePicker:function(t,e,r){var n=t.find(".time-ampm"),[e,i]=e.split(" "),[o,,]=e.split(":"),o=parseInt(o),[e,a]=r.split(" "),[s,,]=e.split(":"),s=parseInt(s);i===a&&n.find('option[value!="'+a+'"]').remove(),t.find(".time-hours").children().each(function(t,e){var r=parseInt(e.value);""!==r&&(r<o||0!==o&&12===r)&&n.val()===i&&e.remove(),""!==r&&s<r&&12!==r&&n.val()===a&&e.remove()})},init_login_2FA:function(){var e=this;this.two_factor_providers("totp"),l("body").on("click",".forminator-2fa-link",function(){e.$el.find("#login_error").remove(),e.$el.find(".notification").empty();var t=l(this).data("slug");e.two_factor_providers(t),"fallback-email"===t&&e.resend_code()}),this.$el.find(".wpdef-2fa-email-resend input").on("click",function(){e.resend_code()})},two_factor_providers:function(t){var e=this;e.$el.find(".forminator-authentication-box").hide(),e.$el.find(".forminator-authentication-box input").attr("disabled",!0),e.$el.find("#forminator-2fa-"+t).show(),e.$el.find("#forminator-2fa-"+t+" input").attr("disabled",!1),0<e.$el.find(".forminator-2fa-link").length&&(e.$el.find(".forminator-2fa-link").hide(),e.$el.find(".forminator-2fa-link:not(#forminator-2fa-link-"+t+")").each(function(){e.$el.find(".forminator-auth-method").val(t),l(this).find("input").attr("disabled",!1),l(this).show()}))},resend_code:function(){var e=l('input[name="button_resend_code"]'),t=l(".forminator-auth-token"),t={action:"forminator_2fa_fallback_email",data:JSON.stringify({token:t})};l.ajax({type:"POST",url:s.ForminatorFront.ajaxUrl,data:t,beforeSend:function(){e.attr("disabled","disabled"),l(".def-ajaxloader").show()},success:function(t){e.removeAttr("disabled"),l(".def-ajaxloader").hide(),l(".notification").text(t.data.message)}})},material_field:function(){},toggle_file_input:function(){l(this.element).find(".forminator-file-upload").each(function(){var t=l(this),e=t.find("input"),t=t.find(".forminator-button-delete");""!==e.val()?t.show():t.hide()})},upload_field:function(t){var r=this,e=l(t);this.toggle_file_input(),e.find(".forminator-button-delete").on("click",function(t){t.preventDefault();var t=l(this),e=t.siblings("input"),r=t.closest(".forminator-file-upload").find("> span");e.val(""),r.html(r.data("empty-text")),t.hide(),e.trigger("forminator.change","forminator_emulate_trigger")}),e.find(".forminator-input-file, .forminator-input-file-required").on("change",function(){var t=l(this).closest(".forminator-file-upload").find("> span"),e=l(this).val(),e=e.length?e.split("\\").pop():"";t.text(e),r.toggle_file_input()}),e.find(".forminator-button-upload").off(),e.find(".forminator-button-upload").on("click",function(t){t.preventDefault();t=l(this).attr("data-id");e.find("input#"+t).trigger("click")}),e.find(".forminator-input-file, .forminator-input-file-required").on("change",function(t){t.preventDefault();var t=l(this)[0].files.length,e=l(this).find(".forminator-button-delete");0===t?e.hide():e.show()})},maybeRemoveDuplicateFields:function(t){var e,r,t=l(t);l(f).find("link[id='neira-lite-style-css']").length&&(e=t.find(".forminator-select-container").next(".chosen-container"),r=t.find("select.forminator-select2 + .forminator-select").next(".chosen-container"),t=t.find(".forminator-select").next(".chosen-container"),0!==e.length&&e.remove(),0!==r.length&&r.remove(),0!==t.length)&&t.remove()},renderCaptcha:function(t){var e,r,n=this;void 0===l(t).data("forminator-recapchta-widget")&&(r=l(t).data("size"),e={sitekey:l(t).data("sitekey"),theme:l(t).data("theme"),size:r},"invisible"===r?(e.badge=l(t).data("badge"),e.callback=function(t){l(n.element).trigger("submit.frontSubmit")}):e.callback=function(){l(t).parent(".forminator-col").removeClass("forminator-has_error").remove(".forminator-error-message")},""!==e.sitekey)&&(r=s.grecaptcha.render(t,e),l(t).data("forminator-recapchta-widget",r),this.addCaptchaAria(t),this.responsive_captcha())},renderHcaptcha:function(t){var e,r,n=this;void 0===l(t).data("forminator-hcaptcha-widget")&&(r=l(t).data("size"),(e={sitekey:l(t).data("sitekey"),theme:l(t).data("theme"),size:r}).callback="invisible"===r?function(t){l(n.element).trigger("submit.frontSubmit")}:function(){l(t).parent(".forminator-col").removeClass("forminator-has_error").remove(".forminator-error-message")},""!==e.sitekey)&&(r=hcaptcha.render(t,e),l(t).data("forminator-hcaptcha-widget",r))},renderTurnstileCaptcha:function(n){var t;void 0===l(n).data("forminator-turnstile-widget")&&""!==l(n).data("sitekey")&&(t=turnstile.render(n,{"response-field-name":"forminator-turnstile-response",callback:function(t,e,r){l(n).parent(".forminator-col").removeClass("forminator-has_error").remove(".forminator-error-message")}}),l(n).data("forminator-turnstile-widget",t))},addCaptchaAria:function(t){var e=l(t).find(".g-recaptcha-response"),t=l(t).find(">div");0!==e.length&&(e.attr("aria-hidden","true"),e.attr("aria-label","do not use"),e.attr("aria-readonly","true")),0!==t.length&&t.css("z-index",99)},hide:function(){this.$el.hide()},maybeParseStringToJson:function(t,e){var r={};if("object"==typeof t)return t;if("object"===e)t="{"+t.trim()+"}";else{if("array"!==e)return{};t="["+t.trim()+"]"}try{t=t.replace(/\,(?!\s*?[\{\[\"\'\w])/g,""),r=JSON.parse(t)}catch(t){console.error(t.message),"object"===e?r={}:"array"===e&&(r=[])}return r},renderStripe:function(e,r,n=0){var i=this;setTimeout(function(){var t;n++,"undefined"!=typeof Stripe?(t={type:"stripe",paymentEl:r,paymentRequireSsl:e.settings.payment_require_ssl,generalMessages:e.settings.general_messages,has_loader:e.settings.has_loader,loader_label:e.settings.loader_label,stripe_depends:e.settings.stripe_depends},r.data("is-ocs")?l(e.element).forminatorFrontStripe(t):l(e.element).forminatorFrontPayment(t)):n<300?i.renderStripe(e,r,n):console.error("Failed to load Stripe.")},100)},maybe_enable_save_draft:function(t,e){var r=this.$el.serializeArray(),n=!1,i=!!this.$el.find(".forminator-field-signature").length,r=r.filter(function(t){return-1===t.name.indexOf("ctlSignature")});(e=JSON.stringify(e))!==(r=JSON.stringify(r))&&(n=!0),i&&!1===n&&this.$el.find(".forminator-field-signature").each(function(t){var e=l(this).find(".signature-prefix").val();if(0!==l(this).find("#ctlSignature"+e+"_data").length&&""!==l(this).find("#ctlSignature"+e+"_data").val())return!(n=!0)}),n?t.removeClass("disabled"):t.addClass("disabled")},handleDiviPopup:function(){var e=this;"undefined"!=typeof DiviArea&&DiviArea.addAction("show_area",function(t){setTimeout(function(){e.init(),forminatorSignInit(),forminatorSignatureResize()},100)})},disableFields:function(){this.$el.addClass("forminator-fields-disabled")},checkComplianzBlocker:function(){var t=this.$el.find(".cmplz-blocked-content-container");0<t.length&&(t=t.closest(".forminator-row"),this.disableFields(),t.insertBefore(this.$el.find(".forminator-row").first()),t.css({"pointer-events":"all",opacity:"1"}),t.find("*").css("pointer-events","all"),0<t.closest(".forminator-pagination--content").length&&(t.closest(".forminator-pagination--content").css({"pointer-events":"all",opacity:"1"}),t.nextAll(".forminator-row").css({opacity:"0.5"})),l("body").on("click",".cmplz-blocked-content-notice, .cmplz-accept",function(){setTimeout(function(){s.location.reload()},50)}))}}),l.fn[r]=function(t){return this.each(function(){l.data(this,r)||l.data(this,r,new e(this,t))})},l(f).on("tinymce-editor-init",function(t,a){var e=a.id,r=l("#"+e).closest(".forminator-col");l(f).on("click",".wp-switch-editor",function(){setTimeout(function(){r.find("#"+e).trigger("change")},100)});a.on("change",function(){-1!==e.indexOf("forminator-field-textarea-")&&(a.save(),r.find("#"+e).trigger("change")),-1!==e.indexOf("forminator-field-post-content-")&&(a.save(),r.find("#"+e).trigger("change"))}),a.on("blur",function(){-1===e.indexOf("forminator-field-textarea-")&&-1===e.indexOf("forminator-field-post-content-")||r.find("#"+e).valid()}),a.on("keydown",function(t){var e,r,n,i=a.id,i=l("#"+i).closest(".forminator-col").find(".forminator-description span"),o=a.getContent().replace(/<[^>]*>/g,"");i.length&&(e=parseInt(i.data("limit")))&&(o=l("<div/>").html(o).text(),r=t.ctrlKey||t.metaKey,n=-1!==[37,38,39,40,8,46].indexOf(t.keyCode),"words"!==i.data("type")?o.length>=e&&!r&&!n&&13!==t.keyCode&&t.preventDefault():e<=o.trim().split(/\s+/).length&&32===t.which&&t.preventDefault())}),l("#"+a.id+"_ifr").is(":visible")&&l("#"+a.id+"_ifr").height(l("#"+a.id).height()),-1!==e.indexOf("forminator")&&l("#"+e).closest(".wp-editor-wrap").attr("aria-describedby",e+"-description")}),l(f).on("click",".forminator-copy-btn",function(t){var e=l(this).prev(".forminator-draft-link").val();if(navigator.clipboard)navigator.clipboard.writeText(e).then(function(){},function(t){});else{var r=f.createElement("textarea");r.value=e,r.style.top="0",r.style.left="0",r.style.position="fixed",f.body.appendChild(r),r.focus(),r.select();try{f.execCommand("copy")}catch(t){}f.body.removeChild(r)}l(this).hasClass("copied")||(l(this).addClass("copied"),l(this).prepend("✓ "))}),t(),l(f).on("after.load.forminator",t),l(f).on("after.load.forminator",()=>{forminator_render_captcha(),forminator_render_hcaptcha(),forminator_render_turnstile()}),jQuery(f).on("elementor/popup/show",()=>{forminator_render_captcha(),forminator_render_hcaptcha(),forminator_render_turnstile()})}(jQuery,window,document);var forminator_render_turnstile=function(){jQuery(".forminator-turnstile").each(function(){var e=jQuery(this),r=e.closest("form");0<r.length&&""===e.html()&&window.setTimeout(function(){var t=r.data("forminatorFront");void 0!==t&&t.renderTurnstileCaptcha(e[0])},100)})},forminator_render_captcha=function(){jQuery(".forminator-g-recaptcha").each(function(){var e=jQuery(this),r=e.closest("form");0<r.length&&""===e.html()&&window.setTimeout(function(){var t=r.data("forminatorFront");void 0!==t&&t.renderCaptcha(e[0])},100)})},forminator_render_hcaptcha=function(){jQuery(".forminator-hcaptcha").each(function(){var e=jQuery(this),r=e.closest("form");0<r.length&&""===e.html()&&window.setTimeout(function(){var t=r.data("forminatorFront");void 0!==t&&t.renderHcaptcha(e[0])},100)})},forminatorDateUtil={month_number:function(t){var e,r;return t.constructor===Number?t:(r=NaN,t.constructor===String&&(t=t.toLowerCase(),r=-1===(e=-1===(e=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"].indexOf(t))?["january","february","march","april","may","june","july","august","september","october","november","december"].indexOf(t):e)?NaN:e),r)},convert:function(t){return t.constructor===Date?t:t.constructor===Array?new Date(t[0],this.month_number(t[1]),t[2]):jQuery.isNumeric(t)?new Date(+t):t.constructor===Number||t.constructor===String?new Date(t):"object"==typeof t?new Date(t.year,this.month_number(t.month),t.date):NaN},compare:function(t,e){return isFinite(t=this.convert(t).valueOf())&&isFinite(e=this.convert(e).valueOf())?(e<t)-(t<e):NaN},inRange:function(t,e,r){return isFinite(t=this.convert(t).valueOf())&&isFinite(e=this.convert(e).valueOf())&&isFinite(r=this.convert(r).valueOf())?e<=t&&t<=r:NaN},diffInDays:function(t,e){return t=this.convert(t),e=this.convert(e),"function"!=typeof t.getMonth||"function"!=typeof e.getMonth?NaN:(e=e.getTime(),t=t.getTime(),parseFloat((e-t)/864e5))},diffInWeeks:function(t,e){return t=this.convert(t),e=this.convert(e),"function"!=typeof t.getMonth||"function"!=typeof e.getMonth?NaN:(e=e.getTime(),t=t.getTime(),parseInt((e-t)/6048e5))},diffInMonths:function(t,e){var r,n;return t=this.convert(t),e=this.convert(e),"function"!=typeof t.getMonth||"function"!=typeof e.getMonth?NaN:(r=t.getFullYear(),n=e.getFullYear(),t=t.getMonth(),e.getMonth()+12*n-(t+12*r))},diffInYears:function(t,e){return t=this.convert(t),e=this.convert(e),"function"!=typeof t.getMonth||"function"!=typeof e.getMonth?NaN:e.getFullYear()-t.getFullYear()}};!function(s,i,u){"use strict";var r="forminatorFrontCalculate",n={forminatorFields:[],generalMessages:{}};function e(t,e){this.element=t,this.$el=s(this.element),this.settings=s.extend({},n,e),this._defaults=n,this._name=r,this.calculationFields=[],this.triggerInputs=[],this.isError=!1,this.init()}s.extend(e.prototype,{init:function(){var e=this,t=this.$el.find("input.forminator-calculation");0<t.length&&(t.each(function(){var t;e.calculationFields.push({$input:s(this),formula:s(this).data("formula"),name:s(this).attr("name"),isHidden:s(this).data("isHidden"),precision:s(this).data("precision")}),s(this).data("isHidden")&&(s(this).closest(".forminator-col").addClass("forminator-hidden forminator-hidden-option"),(t=s(this).closest(".forminator-row")).addClass("forminator-hidden-option"),0===t.find("> .forminator-col:not(.forminator-hidden)").length)&&t.addClass("forminator-hidden")}),t=this.settings.memoizeTime||300,this.debouncedReCalculateAll=this.debounce(this.recalculateAll,1e3),this.memoizeDebounceRender=this.memoize(this.recalculate,t),this.$el.on("forminator:field:condition:toggled",function(t){e.debouncedReCalculateAll()}),this.parseCalcFieldsFormula(),this.attachEventToTriggeringFields(),this.debouncedReCalculateAll()),this.$el.off("forminator:recalculate").on("forminator:recalculate",function(){e.recalculateAll()})},memoize:function(e,r){var n,i={},o=Array.prototype.slice;return function(){var t=o.call(arguments);return clearTimeout(n),n=setTimeout(function(){n=null,i={}},r),t[0].name in i?i[t[0].name]:i[t[0].name]=e.apply(this,t)}},debounce:function(n,i,o){var a;return function(){var t=this,e=arguments,r=o&&!a;clearTimeout(a),a=setTimeout(function(){a=null,o||n.apply(t,e)},i),r&&n.apply(t,e)}},parseCalcFieldsFormula:function(){for(var t=0;t<this.calculationFields.length;t++){var e=this.calculationFields[t],r=e.formula;e.formula=r,this.calculationFields[t]=e}},findTriggerInputs:function(t){for(var e=t.formula,r=this.settings.forminatorFields.join("|"),n=new RegExp("\\{("+("("+r+")-\\d+")+"(?:-min|-max)?)(\\-[A-Za-z-_]+)?(\\-[A-Za-z0-9-_]+)?\\}","g"),e=this.maybeReplaceCalculationGroups(e);a=n.exec(e);){var i=a[0],o=a[4]||"",o=a[1]+o,a=a[2];if(i!==u&&o!==u&&a!==u){i=this.get_form_field(o);if(i.length){for(var s=i.data("calcFields"),l=(s===u&&(s=[]),!1),f=0;f<s.length;f++)if(s[f].name===t.name){l=!0;break}l||s.push(t),i.data("calcFields",s),this.triggerInputs.push(i)}}}},get_form_field:function(t){let e=this.$el;var r=(e=e.hasClass("forminator-grouped-fields")?e.closest("form.forminator-ui"):e).data("form-id"),n=e.data("uid"),r=e.find("#forminator-form-"+r+"__field--"+t+"_"+n);return r=0===r.length&&0===(r=e.find("#"+t+"-field")).length&&0===(r=e.find("input[name="+t+"]")).length&&0===(r=e.find("textarea[name="+t+"]")).length&&0===(r=e.find('input[name="'+t+'[]"]')).length&&0===(r=this.$el.find('select[name="'+t+'"]')).length&&0===(r=this.$el.find('select[name="'+t+'[]"]')).length?e.find("#"+t):r},attachEventToTriggeringFields:function(){for(var n=this,t=0;t<this.calculationFields.length;t++){var e=this.calculationFields[t];this.findTriggerInputs(e)}if(0<this.triggerInputs.length)for(var r=[],i=0;i<this.triggerInputs.length;i++){var o=this.triggerInputs[i],a=o.attr("id");r.indexOf(a)<0&&(o.on("change.forminatorFrontCalculate",function(){var t=s(this).data("calcFields");if(t!==u&&0<t.length)for(var e=0;e<t.length;e++){var r=t[e];n.field_is_checkbox(s(this))||n.field_is_radio(s(this))?n.recalculate(r):n.memoizeDebounceRender(r)}}),r.push(a))}},recalculateAll:function(){for(var t=0;t<this.calculationFields.length;t++)this.recalculate(this.calculationFields[t])},recalculate:function(t){var e=t.$input,r=(this.hideErrorMessage(e),this.maybeReplaceFieldOnFormula(t.formula)),n=0,r=new i.forminatorCalculator(r);try{if(n=r.calculate(),!isFinite(n))throw"Infinity calculation result."}catch(t){this.isError=!0,console.log(t),this.displayErrorMessage(e,this.settings.generalMessages.calculation_error),n="0"}n=(+(Math.round(n+("e+"+t.precision))+("e-"+t.precision))).toFixed(t.precision),r=e.val(),t=e.data("decimal-point");r!==(n=String(n).replace(".",t))&&e.val(n).trigger("change")},maybeReplaceCalculationGroups:function(t){for(var e=new RegExp("\\{((?:calculation|number|slider|currency|radio|select|checkbox)-\\d+(?:-min|-max)?)-\\*\\}","g");n=e.exec(t);){var r=n[0],n=n[1],n=this.$el.find("[name='"+n+"'], [name='"+n+"[]'], [name^='"+n+"-']").map(function(){return"{"+this.name.replace("[]","")+"}"}).get();n="("+(n=s.unique(n.sort())).join("+")+")",t=t.replace(r,n)}return t},maybeReplaceFieldOnFormula:function(t){t=this.maybeReplaceCalculationGroups(t);for(var e=this.settings.forminatorFields.join("|"),r=new RegExp("\\{("+("("+e+")-\\d+")+"(?:-min|-max)?)(\\-[A-Za-z-_]+)?(\\-[A-Za-z0-9-_]+)?\\}","g"),n=t;s=r.exec(t);){var i,o=s[0],a=s[4]||"",a=s[1]+a,s=s[2],l=o;o!==u&&a!==u&&s!==u&&(this.is_hidden(a)?(l=0,"zero"!==this.get_form_field(a).data("hidden-behavior")&&(i=o.replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g,"\\$1"),!(i=new RegExp("([\\+\\-\\*\\/]?)[^\\+\\-\\*\\/\\(]*"+i+"[^\\)\\+\\-\\*\\/]*([\\+\\-\\*\\/]?)").exec(n))||"*"!==i[1]&&"/"!==i[1]&&"*"!==i[2]&&"/"!==i[2]||(l=1))):("calculation"===s&&(i=this.get_calculation_field(a))&&this.memoizeDebounceRender(i),l=this.get_field_value(a)),n=n.replace(o,l="("+l+")"))}return n},get_calculation_field:function(t){for(var e=0;e<this.calculationFields.length;e++)if(this.calculationFields[e].name===t)return this.calculationFields[e];return!1},is_hidden:function(t){var t=this.get_form_field(t).closest(".forminator-col"),e=t.closest(".forminator-row");return!(e.hasClass("forminator-hidden-option")||t.hasClass("forminator-hidden-option")||!e.hasClass("forminator-hidden")&&!t.hasClass("forminator-hidden"))},get_field_value:function(t){var t=this.get_form_field(t),e=0,r=0,n=null;return this.field_is_radio(t)?(n=t.filter(":checked")).length&&(r=n.data("calculation"))!==u&&(e=Number(r)):this.field_is_checkbox(t)?t.each(function(){s(this).is(":checked")&&(r=s(this).data("calculation"))!==u&&(e+=Number(r))}):this.field_is_select(t)?(n=t.find("option").filter(":selected")).length&&n.each(function(){(r=s(this).data("calculation"))!==u&&(e+=Number(r))}):this.field_has_inputMask(t)?e=parseFloat(t.inputmask("unmaskedvalue").replace(",",".")):t.length&&(n=t.val(),e=parseFloat(n.replace(",","."))),isNaN(e)?0:e},field_has_inputMask:function(t){var e=!1;return t.each(function(){if(u!==s(this).attr("data-inputmask"))return!(e=!0)}),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===s(this).attr("type"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===s(this).attr("type"))return!(e=!0)}),e},field_is_select:function(t){return t.is("select")},displayErrorMessage:function(t,e){var r=t.closest(".forminator-field--inner"),n=(r=0===r.length?t.closest(".forminator-field"):r).find(".forminator-error-message"),i=t.attr("id")+"-error",o=t.attr("aria-describedby");o?((o=o.split(" ")).includes(i)||o.push(i),o=o.join(" "),t.attr("aria-describedby",o)):t.attr("aria-describedby",i),0===n.length&&(r.append('<span class="forminator-error-message" id="'+i+'"></span>'),n=r.find(".forminator-error-message")),t.attr("aria-invalid","true"),n.html(e),r.addClass("forminator-has_error")},hideErrorMessage:function(t){var e=t.closest(".forminator-field--inner"),r=(e=0===e.length?t.closest(".forminator-field"):e).find(".forminator-error-message"),n=t.attr("id")+"-error",i=t.attr("aria-describedby");i?(i=i.split(" ").filter(function(t){return t!==n}).join(" "),t.attr("aria-describedby",i)):t.removeAttr("aria-describedby"),t.removeAttr("aria-invalid"),r.remove(),e.removeClass("forminator-has_error")}}),s.fn[r]=function(t){return this.each(function(){s.data(this,r)||s.data(this,r,new e(this,t))})}}(jQuery,window,void document),function(a,s){"use strict";var r="forminatorFrontMergeTags",n={print_value:!1,forminatorFields:[]};function e(t,e){this.element=t,this.$el=a(this.element),this.settings=a.extend({},n,e),this._defaults=n,this._name=r,ForminatorFront.MergeTags=ForminatorFront.MergeTags||[],this.init()}a.extend(e.prototype,{init:function(){var r=this,t=this.$el.find(".forminator-merge-tags");const o=this.getFormId();ForminatorFront.MergeTags[o]=ForminatorFront.MergeTags[o]||[],0<t.length&&t.each(function(){let n=a(this).html(),t=a(this).data("field");if(r.$el.hasClass("forminator-grouped-fields")){const i=r.$el.data("suffix");var e;ForminatorFront.MergeTags[o][t]&&(n=ForminatorFront.MergeTags[o][t].value,e=r.$el.find("[name]").map(function(){return this.name}).get(),a.each(e,function(t,e){var r=e.replace("-"+i,"");r!==e&&(r=new RegExp(`{${r}}`,"g"),n=n.replace(r,"{"+e+"}"))})),t+="-"+i}ForminatorFront.MergeTags[o][t]={$input:a(this),value:n}}),setTimeout(function(){r.replaceAll(),r.attachEvents()},100)},getFormId:function(){let t="";return t=(this.$el.hasClass("forminator-grouped-fields")?this.$el.closest("form.forminator-ui"):this.$el).data("form-id")},attachEvents:function(){var t=this;this.$el.find(".forminator-textarea, input.forminator-input, .forminator-input input, .forminator-checkbox, .forminator-radio, .forminator-input-file, select.forminator-select2, .forminator-multiselect input, input.forminator-slider-hidden, input.forminator-slider-hidden-min, input.forminator-slider-hidden-max, select.forminator-rating").each(function(){a(this).on("change",function(){setTimeout(function(){t.replaceAll()},300)})})},replaceAll:function(){var t=this.getFormId(),e=ForminatorFront.MergeTags[t];for(const n in e){var r=e[n];this.replace(r)}},replace:function(t){var e=t.$input,t=this.maybeReplaceValue(t.value);e.html(t)},maybeReplaceValue:function(t){for(var e=this.settings.forminatorFields.join("|"),r=new RegExp("\\{("+("("+e+")-\\d+")+")(\\-[0-9A-Za-z-_]+)?\\}","g"),n=t;a=r.exec(t);){var i=a[0],o=i.replace("{","").replace("}",""),a=a[2];i!==s&&o!==s&&a!==s&&(a=this.get_field_value(o),n=n.replace(i,a))}return n},get_form_field:function(t){let e=this.$el;var r=(e=e.hasClass("forminator-grouped-fields")?e.closest("form.forminator-ui"):e).find("#"+t+"-field");return r=0===r.length&&0===(r=e.find("[name="+t+"]")).length&&0===(r=e.find('input[name="'+t+'[]"]')).length&&0===(r=e.find('select[name="'+t+'[]"]')).length?e.find("#"+t):r},is_calculation:function(t){return!!this.get_form_field(t).hasClass("forminator-calculation")},get_field_value:function(t){var e=this.get_form_field(t),r=this,n="",i=null;if(this.is_hidden(t)&&!this.is_calculation(t))return"";if(0===e.length)return"";if(this.is_calculation(t)&&(!this.get_form_field(t).closest(".forminator-col").closest(".forminator-row").hasClass("forminator-hidden-option")&&this.is_hidden(t)))return"";return this.field_is_radio(e)?(i=e.filter(":checked")).length&&(n=this.settings.print_value?i.val():(0===i.siblings(".forminator-radio-label").length?i.siblings(".forminator-screen-reader-only"):i.siblings(".forminator-radio-label")).text()):this.field_is_checkbox(e)?e.each(function(){var t;a(this).is(":checked")&&(""!==n&&(n+=", "),s!==a(this).attr("id")&&-1<a(this).attr("id").indexOf("forminator-field-consent")&&(n+=a(this).val()),t=!!a(this).closest(".forminator-multiselect").length,r.settings.print_value?n+=a(this).val():n+=(t?a(this).closest("label"):0===a(this).siblings(".forminator-checkbox-label").length?a(this).siblings(".forminator-screen-reader-only"):a(this).siblings(".forminator-checkbox-label")).text())}):this.field_is_select(e)?(i=e.find("option").filter(":selected")).length&&i.each(function(){""!==n&&(n+=", "),r.settings.print_value?n+=a(this).val():n+=a(this).text()}):this.field_is_upload(e)?n=e.val().split("\\").pop():this.field_has_inputMask(e)?(e.inputmask({autoUnmask:!1}),n=e.val(),e.inputmask({autoUnmask:!0})):n=e.val(),this.sanitize_text_field(n)},field_has_inputMask:function(t){var e=!1;return t.each(function(){if(s!==a(this).attr("data-inputmask"))return!(e=!0)}),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===a(this).attr("type"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===a(this).attr("type"))return!(e=!0)}),e},field_is_upload:function(t){return"file"===t.attr("type")},field_is_select:function(t){return t.is("select")},is_hidden:function(t){var t=this.get_form_field(t).closest(".forminator-col"),e=t.closest(".forminator-row");return!(!e.hasClass("forminator-hidden-option")&&!e.hasClass("forminator-hidden")&&!t.hasClass("forminator-hidden"))},sanitize_text_field:function(t){return"string"==typeof t?t.replace(/<\/?[^>]+(>|$)/g,"").trim():t}}),a.fn[r]=function(t){return this.each(function(){a.data(this,r)||a.data(this,r,new e(this,t))})}}(jQuery,(window,void document)),function(s,a,u){"use strict";Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t,e){if(t===u||null===t)throw new TypeError("Cannot convert first argument to object");for(var r=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==u&&null!==i)for(var o=Object.keys(Object(i)),a=0,s=o.length;a<s;a++){var l=o[a],f=Object.getOwnPropertyDescriptor(i,l);f!==u&&f.enumerable&&(r[l]=i[l])}}return r}});var r="forminatorFrontPayment",n={type:"stripe",paymentEl:null,paymentRequireSsl:!1,generalMessages:{}};function e(t,e){this.element=t,this.$el=s(this.element),this.settings=s.extend({},n,e),this._defaults=n,this._name=r,this._stripeData=null,this._stripe=null,this._cardElement=null,this._stripeToken=null,this._beforeSubmitCallback=null,this._form=null,this._paymentIntent=null,this.init()}s.extend(e.prototype,{init:function(){var n;this.settings.paymentEl&&void 0!==this.settings.paymentEl.data()&&((n=this)._stripeData=this.settings.paymentEl.data(),!1!==this.mountCardField())&&(s(this.element).on("payment.before.submit.forminator",function(t,e,r){n._form=n.getForm(t),n._beforeSubmitCallback=r,n.validateStripe(t,e)}),this.$el.on("forminator:form:submit:stripe:3dsecurity",function(t,e,r){n.validate3d(t,e,r)}),this.$el.find("input.forminator-input, .forminator-input input, .forminator-field-textarea textarea, .forminator-checkbox input, .forminator-radio input, select.forminator-select2").each(function(){s(this).on("change",function(t,e){"forminator_emulate_trigger"!==e&&n.mapZip(t)})}).trigger("change"))},validate3d:function(t,e,r){var n=this;r?this._stripe.confirmCardPayment(e,{payment_method:{card:n._cardElement,...n.getBillingData()}}).then(function(t){n.$el.find("#forminator-stripe-subscriptionid").val(r),n._beforeSubmitCallback&&n._beforeSubmitCallback.call()}):this._stripe.retrievePaymentIntent(e).then(function(t){"requires_action"!==t.paymentIntent.status&&"requires_source_action"!==t.paymentIntent.status||n._stripe.confirmCardPayment(e,{payment_method:{card:n._cardElement,...n.getBillingData()}}).then(function(t){n._beforeSubmitCallback&&n._beforeSubmitCallback.call()})})},validateStripe:function(r,n){var i=this;this._stripe.createToken(this._cardElement).then(function(t){t.error?(i.showCardError(t.error.message,!0),i.$el.find("button").removeAttr("disabled")):(i.hideCardError(),i._stripe.createPaymentMethod("card",i._cardElement,i.getBillingData()).then(function(t){var e=i.getObjectValue(t,"paymentMethod");i._stripeData.paymentMethod=i.getObjectValue(e,"id"),i.updateAmount(r,n,t)}))})},isValid:function(e){var r=this;this._stripe.createToken(this._cardElement).then(function(t){t.error?r.showCardError(t.error.message,e):r.hideCardError()})},getForm:function(t){t=s(t.target);return t=t.hasClass("forminator-custom-form")?t:t.closest("form.forminator-custom-form")},updateAmount:function(r,n,t){r.preventDefault();var i=this,e=n,t=this.getObjectValue(t,"paymentMethod"),t=(e.append("action","forminator_update_payment_amount"),e.append("paymentid",this.getStripeData("paymentid")),e.append("payment_method",this.getObjectValue(t,"id")),this.getStripeData("receipt")),o=this.getStripeData("receiptEmail");t&&o&&(t=this.get_field_value(o)||"",e.append("receipt_email",t)),s.ajax({type:"POST",url:a.ForminatorFront.ajaxUrl,data:e,cache:!1,contentType:!1,processData:!1,beforeSend:function(){var t;void 0!==i.settings.has_loader&&i.settings.has_loader&&(i._form.addClass("forminator-fields-disabled"),(t=i._form.find(".forminator-response-message")).html("<p>"+i.settings.loader_label+"</p>"),i.focus_to_element(t),t.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-success forminator-error").addClass("forminator-loading forminator-show")),i._form.find("button").attr("disabled",!0)},success:function(t){var e;!0===t.success?void 0!==t.data&&void 0!==t.data.paymentid?(i.$el.find("#forminator-stripe-paymentid").val(t.data.paymentid),i.$el.find("#forminator-stripe-paymentmethod").val(i._stripeData.paymentMethod),i._stripeData.paymentid=t.data.paymentid,i._stripeData.secret=t.data.paymentsecret,i.handleCardPayment(t,r,n)):i.show_error("Invalid Payment Intent ID"):(i.show_error(t.data.message),t.data.errors.length&&i.show_messages(t.data.errors),(t=i._form.find(".forminator-g-recaptcha")).length&&(e=(t=s(t.get(0))).data("forminator-recapchta-widget"),"invisible"===t.data("size"))&&a.grecaptcha.reset(e))},error:function(t){t=400===t.status?a.ForminatorFront.cform.upload_error:a.ForminatorFront.cform.error;i.show_error(t)}})},show_error:function(t){var e=this._form.find(".forminator-response-message");this._form.find("button").removeAttr("disabled"),e.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-loading").addClass("forminator-error forminator-show"),e.html("<p>"+t+"</p>"),this.focus_to_element(e),this.enable_form()},enable_form:function(){var t;void 0!==this.settings.has_loader&&this.settings.has_loader&&(t=this._form.find(".forminator-response-message"),this._form.removeClass("forminator-fields-disabled"),t.removeClass("forminator-loading"))},mapZip:function(t){var e=this.getStripeData("veifyZip"),r=this.getStripeData("zipField"),n=s(t.currentTarget).attr("name");"checkbox"===s(t.currentTarget).attr("type")&&(n=n.replace("[]","")),e&&""!==r&&n===r&&(t=this.get_field_value(r).toString(),this._cardElement.update({value:{postalCode:t}}))},focus_to_element:function(t){t.show(),s("html,body").animate({scrollTop:t.offset().top-(s(a).height()-t.outerHeight(!0))/2},500,function(){t.attr("tabindex")||t.attr("tabindex",-1),t.focus()})},show_messages:function(t){var i,o=this,a=o.$el.data("forminatorFrontCondition");return void 0!==a&&(this.$el.find(".forminator-error-message").remove(),i=0,t.forEach(function(t){var e,r,n=Object.keys(t),t=Object.values(t),n=a.get_form_field(n);n.length&&(0===i&&(o.$el.trigger("forminator.front.pagination.focus.input",[n]),o.focus_to_element(n)),s(n).hasClass("forminator-input-time")&&(0===(r=(e=s(n).closest(".forminator-field:not(.forminator-field--inner)")).children(".forminator-error-message")).length&&(e.append('<span class="forminator-error-message" aria-hidden="true"></span>'),r=e.children(".forminator-error-message")),r.html(t)),0===(r=(e=0===(e=s(n).closest(".forminator-field--inner")).length&&0===(e=s(n).closest(".forminator-field")).length&&1<(e=s(n).find(".forminator-field")).length?e.first():e).find(".forminator-error-message")).length&&(e.append('<span class="forminator-error-message" aria-hidden="true"></span>'),r=e.find(".forminator-error-message")),s(n).attr("aria-invalid","true"),r.html(t),e.addClass("forminator-has_error"),i++)})),this},getBillingData:function(t){if(!this.getStripeData("billing"))return{};var e=this.getStripeData("billingName"),r=this.getStripeData("billingEmail"),n=this.getStripeData("billingAddress"),i={address:{}},o=(e&&(o=(o=this.get_field_value(e))||(this.get_field_value(e+"-first-name")||"")+" "+(this.get_field_value(e+"-last-name")||""))&&(i.name=o),r&&(e=this.get_field_value(r)||"")&&(i.email=e),this.get_field_value(n+"-street_address")||""),r=(o&&(i.address.line1=o),this.get_field_value(n+"-address_line")||""),e=(r&&(i.address.line2=r),this.get_field_value(n+"-city")||""),o=(e&&(i.address.city=e),this.get_field_value(n+"-state")||"");o&&(i.address.state=o);r=this.get_form_field(n+"-country").find(":selected").data("country-code"),r&&(i.address.country=r),e=this.get_field_value(n+"-zip")||"";return e&&(i.address.postal_code=e),{billing_details:i}},handleCardPayment:function(t,e,r){t.data.paymentsecret;t=s(".forminator-number--field, .forminator-currency, .forminator-calculation");t.inputmask&&t.inputmask("remove"),this._beforeSubmitCallback&&this._beforeSubmitCallback.call()},mountCardField:function(){var t=this.getStripeData("key"),e=this.getStripeData("cardIcon"),r=this.getStripeData("veifyZip"),n=(this.getStripeData("zipField"),this.getStripeData("fieldId"));if(null===t)return!1;this._stripe=Stripe(t,{locale:this.getStripeData("language")});var t={},r=(r?t.value={postalCode:""}:t.hidePostalCode=!0,{}),i=this.getStripeData("fontFamily"),o=this.getStripeData("customFonts"),o=(i&&o&&(r.fonts=[{cssSrc:"https://fonts.bunny.net/css?family="+i}]),this._stripe.elements(r));this._cardElement=o.create("card",Object.assign({classes:{base:this.getStripeData("baseClass"),complete:this.getStripeData("completeClass"),empty:this.getStripeData("emptyClass"),focus:this.getStripeData("focusedClass"),invalid:this.getStripeData("invalidClass"),webkitAutofill:this.getStripeData("autofilledClass")},style:{base:{iconColor:this.getStripeData("iconColor"),color:this.getStripeData("fontColor"),lineHeight:this.getStripeData("lineHeight"),fontWeight:this.getStripeData("fontWeight"),fontFamily:this.getStripeData("fontFamily"),fontSmoothing:"antialiased",fontSize:this.getStripeData("fontSize"),"::placeholder":{color:this.getStripeData("placeholder")},":hover":{iconColor:this.getStripeData("iconColorHover")},":focus":{iconColor:this.getStripeData("iconColorFocus")}},invalid:{iconColor:this.getStripeData("iconColorError"),color:this.getStripeData("fontColorError")}},iconStyle:"solid",hideIcon:!e},t)),this._cardElement.mount("#card-element-"+n),this.validateCard()},validateCard:function(){var e=this;this._cardElement.on("change",function(t){e.$el.find(".forminator-stripe-element").hasClass("StripeElement--empty")?e.$el.find(".forminator-stripe-element").closest(".forminator-field").removeClass("forminator-is_filled"):e.$el.find(".forminator-stripe-element").closest(".forminator-field").addClass("forminator-is_filled"),e.$el.find(".forminator-stripe-element").hasClass("StripeElement--invalid")&&e.$el.find(".forminator-stripe-element").closest(".forminator-field").addClass("forminator-has_error")}),this._cardElement.on("focus",function(t){e.$el.find(".forminator-stripe-element").closest(".forminator-field").addClass("forminator-is_active")}),this._cardElement.on("blur",function(t){e.$el.find(".forminator-stripe-element").closest(".forminator-field").removeClass("forminator-is_active"),e.isValid(!1)})},hideCardError:function(){var t=this.$el.find(".forminator-card-message"),e=t.find(".forminator-error-message");0===e.length&&(t.append('<span class="forminator-error-message" aria-hidden="true"></span>'),e=t.find(".forminator-error-message")),t.closest(".forminator-field").removeClass("forminator-has_error"),e.html("")},showCardError:function(t,e){var r=this.$el.find(".forminator-card-message"),n=r.find(".forminator-error-message");0===n.length&&(r.append('<span class="forminator-error-message" aria-hidden="true"></span>'),n=r.find(".forminator-error-message")),r.closest(".forminator-field").addClass("forminator-has_error"),r.closest(".forminator-field").addClass("forminator-is_filled"),n.html(t),e&&this.focus_to_element(r.closest(".forminator-field"))},getStripeData:function(t){return void 0!==this._stripeData&&void 0!==this._stripeData[t]?this._stripeData[t]:null},getObjectValue:function(t,e){return void 0!==t[e]?t[e]:null},get_form_field:function(t){var e=this.$el.find("#"+t+"-field");return e=0===e.length&&0===(e=this.$el.find("input[name="+t+"]")).length&&0===(e=this.$el.find("textarea[name="+t+"]")).length&&0===(e=this.$el.find('input[name="'+t+'[]"]')).length&&0===(e=this.$el.find('select[name="'+t+'"]')).length&&0===(e=this.$el.find('select[name="'+t+'[]"]')).length?this.$el.find("#"+t):e},get_field_value:function(t){var t=this.get_form_field(t),e="",r=null;return this.field_is_radio(t)?(r=t.filter(":checked")).length&&(e=r.val()):this.field_is_checkbox(t)?t.each(function(){s(this).is(":checked")&&(e=s(this).val())}):e=!this.field_is_select(t)&&this.field_has_inputMask(t)?parseFloat(t.inputmask("unmaskedvalue")):t.val(),e},get_field_calculation:function(t){var t=this.get_form_field(t),e=0,r=0,n=null;return this.field_is_radio(t)?(n=t.filter(":checked")).length&&(r=n.data("calculation"))!==u&&(e=Number(r)):this.field_is_checkbox(t)?t.each(function(){s(this).is(":checked")&&(r=s(this).data("calculation"))!==u&&(e+=Number(r))}):this.field_is_select(t)?(n=t.find("option").filter(":selected")).length&&(r=n.data("calculation"))!==u&&(e=Number(r)):e=Number(t.val()),isNaN(e)?0:e},field_has_inputMask:function(t){var e=!1;return t.each(function(){if(u!==s(this).attr("data-inputmask"))return!(e=!0)}),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===s(this).attr("type"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===s(this).attr("type"))return!(e=!0)}),e},field_is_select:function(t){return t.is("select")}}),s.fn[r]=function(t){return this.each(function(){s.data(this,r)||s.data(this,r,new e(this,t))})}}(jQuery,window,void document),function(f,l,r){"use strict";var n="forminatorFrontPagination",i={totalSteps:0,step:0,hashStep:0,inline_validation:!1};function e(t,e){this.element=f(t),this.$el=this.element,this.totalSteps=0,this.step=0,this.finished=!1,this.hashStep=!1,this.next_button_txt="",this.prev_button_txt="",this.custom_label=[],this.form_id=0,this.element="",this.settings=f.extend({},i,e),this._defaults=i,this._name=n,this.init()}f.extend(e.prototype,{init:function(){var e=this,t=this.$el.data("draft-page")?this.$el.data("draft-page"):0;this.next_button=this.settings.next_button||l.ForminatorFront.cform.pagination_next,this.prev_button=this.settings.prev_button||l.ForminatorFront.cform.pagination_prev,0<this.$el.find("input[name=form_id]").length&&(this.form_id=this.$el.find("input[name=form_id]").val()),this.totalSteps=this.settings.totalSteps,this.step=this.settings.step,this.quiz=this.settings.quiz,this.element=this.$el.find("[data-step="+this.step+"]").data("name"),this.form_id&&"object"==typeof l.Forminator_Cform_Paginations&&"object"==typeof l.Forminator_Cform_Paginations[this.form_id]&&(this.custom_label=l.Forminator_Cform_Paginations[this.form_id]),0<t?this.go_to(t,!0):this.settings.hashStep&&0<this.step?this.go_to(this.step,!0):this.quiz?this.go_to(0,!0):this.go_to(0,!1),this.render_navigation(),this.render_bar_navigation(),this.render_footer_navigation(this.form_id),this.init_events(),this.update_navigation(),this.$el.find(".forminator-button.forminator-button-back, .forminator-button.forminator-button-next, .forminator-button.forminator-button-submit").on("click",function(t){t.preventDefault(),f(this).trigger("forminator.front.pagination.move"),e.resetRichTextEditorHeight()}),this.$el.on("click",".forminator-result--view-answers",function(t){t.preventDefault(),f(this).trigger("forminator.front.pagination.move")}),this.update_buttons()},init_events:function(){var i=this;this.$el.find(".forminator-button-back").on("forminator.front.pagination.move",function(t){i.handle_click("prev")}),this.$el.on("forminator.front.pagination.move",".forminator-result--view-answers",function(t){i.handle_click("prev")}),this.$el.find(".forminator-button-next").on("forminator.front.pagination.move",function(t){i.handle_click("next")}),this.$el.find(".forminator-step").on("click",function(t){t.preventDefault();t=f(this).data("nav");i.handle_step(t)}),this.$el.on("reset",function(t){i.on_form_reset(t)}),this.$el.on("forminator:quiz:submit:success",function(t,e,r,n){n&&i.move_to_results(t)}),this.$el.on("forminator.front.pagination.focus.input",function(t,e){i.on_focus_input(t,e)})},move_to_results:function(t){this.finished=!0,this.$el.find(".forminator-submit-rightaway").length?this.$el.find("#forminator-submit").removeClass("forminator-hidden"):this.handle_click("next")},on_form_reset:function(t){this.go_to(0,!0),this.update_buttons()},on_focus_input:function(t,e){e=this.get_page_of_input(e);this.go_to(e,!0),this.update_buttons()},render_footer_navigation:function(t){var e="",r=!0===this.custom_label["has-paypal"]?' style="align-items: flex-start;"':"",n=this.$el.find(".forminator-save-draft-link").length?this.$el.find(".forminator-save-draft-link"):"";this.custom_label[this.element]&&"custom"===this.custom_label["pagination-labels"]?(this.prev_button_txt=""!==this.custom_label[this.element]["prev-text"]?this.custom_label[this.element]["prev-text"]:this.prev_button,this.next_button_txt=""!==this.custom_label[this.element]["next-text"]?this.custom_label[this.element]["next-text"]:this.next_button):(this.prev_button_txt=this.prev_button,this.next_button_txt=this.next_button),e=this.$el.hasClass("forminator-design--material")?'<div class="forminator-pagination-footer"'+r+'><button class="forminator-button forminator-button-back"><span class="forminator-button--mask" aria-label="hidden"></span><span class="forminator-button--text">'+this.prev_button_txt+'</span></button><button class="forminator-button forminator-button-next"><span class="forminator-button--mask" aria-label="hidden"></span><span class="forminator-button--text">'+this.next_button_txt+"</span></button>":'<div class="forminator-pagination-footer"'+r+'><button class="forminator-button forminator-button-back">'+this.prev_button_txt+'</button><button class="forminator-button forminator-button-next">'+this.next_button_txt+"</button>",!0===this.custom_label["has-paypal"]&&(e+='<div class="forminator-payment forminator-button-paypal forminator-hidden '+(this.custom_label["paypal-id"]||"")+'-payment" id="paypal-button-container-'+t+'">'),this.$el.append(e+="</div>"),""!==n&&n.insertBefore(this.$el.find(".forminator-button-next"))},render_bar_navigation:function(){var t=this.$el.find(".forminator-pagination-progress");t.length&&(t.html('<div class="forminator-progress-label">0%</div><div class="forminator-progress-bar"><span style="width: 0%"></span></div>'),this.calculate_bar_percentage())},calculate_bar_percentage:function(){var t=this.totalSteps,e=this.step+1,r=this.$el;r.length&&(e=Math.round(e/t*100),r.find(".forminator-progress-label").html(e+"%"),r.find(".forminator-progress-bar span").css("width",e+"%"))},encodeHTMLEntities(t){var e=r.createElement("textarea");return e.innerText=t,e.innerHTML},render_navigation:function(){var i=this.$el.find(".forminator-pagination-steps"),t=this.$el.find(".forminator-pagination-start");if(i.length){const l=f(this.$el).data("forminator-render")||"";var o=this.$el.find(".forminator-pagination").not(".forminator-pagination-start"),a=this.$el.hasClass("forminator-design--basic"),s=(i.append('<div class="forminator-break"></div>'),this);o.each(function(){var t=f(this),e=s.encodeHTMLEntities(t.data("label")),t=t.data("step")-1,r="forminator-custom-form-"+s.form_id+"-"+l+"--page-"+t,n="forminator-step forminator-step-"+t;a&&(n+=" has-text-color");i.append('<button role="tab" id="'+(r+"-label")+'" class="'+n+'" aria-selected="false" aria-controls="'+r+'" data-nav="'+t+'"><span class="forminator-step-label">'+e+'</span><span class="forminator-step-dot" aria-hidden="true"></span></button>'+'<div class="forminator-break" aria-hidden="true"></div>')}),t.each(function(){var t=f(this),t=s.encodeHTMLEntities(t.data("label")),e=o.length,r="forminator-custom-form-"+s.form_id+"--page-"+e,n="forminator-step forminator-step-"+e;a&&(n+=" has-text-color");i.append('<button role="tab" id="'+(r+"-label")+'" class="'+n+'" data-nav="'+e+'" aria-selected="false" aria-controls="'+r+'"><span class="forminator-step-label">'+t+'</span><span class="forminator-step-dot" aria-hidden="true"></span></button>'+'<div class="forminator-break" aria-hidden="true"></div>')})}},handle_step:function(t){if(this.settings.inline_validation)for(var e=0;e<t;e++)if(this.step<=e&&!this.is_step_inputs_valid(e))return void this.go_to(e,!0);this.go_to(t,!0),this.update_buttons()},handle_click:function(t){var e,r=this;if("prev"===t&&0!==this.step)this.go_to(this.step-1,!0),this.update_buttons();else if("next"===t){if(this.settings.inline_validation&&!this.is_step_inputs_valid(this.step))return;void 0!==this.$el.data().forminatorFrontPayment&&(e=this.$el.data().forminatorFrontPayment,0<this.$el.find("[data-step="+this.step+"]").find(".forminator-stripe-element").not(".forminator-hidden .forminator-stripe-element").length)?e._stripe.createToken(e._cardElement).then(function(t){t.error?e.showCardError(t.error.message,!0):(e.hideCardError(),r.go_to(r.step+1,!0),r.update_buttons())}):(this.go_to(this.step+1,!0),this.update_buttons())}var t=f(this.$el),n=t.find(".forminator-textarea");t.hasClass("forminator-design--material")&&n.length&&n.each(function(){FUI.textareaMaterial(this)})},is_step_inputs_valid:function(t){var r=0,n=this.$el.data("validator"),t=this.$el.find("[data-step="+t+"]");return void 0===n||(t.find("input, select, textarea").not(":submit, :reset, :image, :disabled").not('[gramm="true"]').each(function(t,e){f(e).is(':hidden:not(.forminator-wp-editor-required, .forminator-input-file-required, input[name$="_data"])')&&!f(e).closest(".forminator-pagination").length||n.element(e)||(0===r&&e.focus(),r++)}),0===r)},get_page_of_input:function(t){var e=this.step,t=f(t).closest(".forminator-pagination");return e=0<t.length&&void 0!==(t=f(t).data("step"))?+t:e},update_buttons:function(){var t,e,r,n,i,o=this.$el.hasClass("draft-enabled"),a=this,s=(0===this.step?(o||this.$el.find(".forminator-button-back").closest(".forminator-pagination-footer").css({"justify-content":"flex-end"}),this.$el.find(".forminator-button-back").addClass("forminator-hidden"),this.$el.find(".forminator-button-next").removeClass("forminator-hidden")):1<this.totalSteps&&(o||this.$el.find(".forminator-button-back").closest(".forminator-pagination-footer").css({"justify-content":"space-between"}),this.$el.find(".forminator-button-back, .forminator-button-next").removeClass("forminator-hidden")),this.step!==this.totalSteps||this.finished||(this.step--,this.$el.trigger("submit")),this.settings.submitButtonClass);this.step!==this.totalSteps-1||this.finished?(this.element=this.$el.find(".forminator-pagination[data-step="+this.step+"]").data("name"),this.custom_label[this.element]&&"custom"===this.custom_label["pagination-labels"]?(this.prev_button_txt=""!==this.custom_label[this.element]["prev-text"]?this.custom_label[this.element]["prev-text"]:this.prev_button,this.next_button_txt=""!==this.custom_label[this.element]["next-text"]?this.custom_label[this.element]["next-text"]:this.next_button):(this.prev_button_txt=this.prev_button,this.next_button_txt=this.next_button),this.step===this.totalSteps-1&&this.finished&&(this.next_button_txt=l.ForminatorFront.quiz.view_results),(this.$el.hasClass("forminator-design--material")?(this.$el.find("#forminator-submit").removeAttr("id").removeClass("forminator-button-submit forminator-hidden "+s).addClass("forminator-button-next"),!0===this.custom_label["has-paypal"]&&(this.$el.find("#forminator-paypal-submit").removeAttr("id").addClass("forminator-hidden"),this.$el.find(".forminator-button-next").removeClass("forminator-button-submit forminator-hidden "+s)),this.$el.find(".forminator-button-back .forminator-button--text").html(this.prev_button_txt),this.$el.find(".forminator-button-next .forminator-button--text")):(this.$el.find("#forminator-submit").removeAttr("id").removeClass("forminator-button-submit forminator-hidden").addClass("forminator-button-next"),!0===this.custom_label["has-paypal"]&&(this.$el.find("#forminator-paypal-submit").removeAttr("id").addClass("forminator-hidden"),this.$el.find(".forminator-button-next").removeClass("forminator-button-submit forminator-hidden")),this.$el.find(".forminator-button-back").html(this.prev_button_txt),this.$el.find(".forminator-button-next"))).html(this.next_button_txt),this.step===this.totalSteps&&this.finished&&this.$el.find(".forminator-button-next, .forminator-button-back").addClass("forminator-hidden"),this.$el.trigger("forminator.front.pagination.buttons.updated")):(t=this.$el.find(".forminator-pagination-submit").html(),e=this.$el.find(".forminator-pagination-submit").data("loading"),o="custom"===this.custom_label["pagination-labels"]&&""!==this.custom_label["last-previous"]?this.custom_label["last-previous"]:this.prev_button,r=a.$el.find(".forminator-payment"),n=this.$el.find(".forminator-button-next"),i=this.$el.find(".forminator-button-submit"),this.$el.hasClass("forminator-design--material")?(this.$el.find(".forminator-button-back .forminator-button--text").html(o),n.removeClass("forminator-button-next").attr("id","forminator-submit"),setTimeout(function(){n.addClass("forminator-button-submit "+s).find(".forminator-button--text").html("").html(t).data("loading",e),a.$el.trigger("forminator.front.pagination.buttons.updated")},20)):(this.$el.find(".forminator-button-back").html(o),n.removeClass("forminator-button-next").attr("id","forminator-submit"),setTimeout(function(){n.addClass("forminator-button-submit "+s).html(t).data("loading",e),a.$el.trigger("forminator.front.pagination.buttons.updated")},20)),setTimeout(function(){i=a.$el.find(".forminator-button-submit")},30),this.$el.hasClass("forminator-quiz")&&!t&&(i.addClass("forminator-hidden"),this.$el.find(".forminator-submit-rightaway").length)&&i.html(l.ForminatorFront.quiz.view_results),!0===this.custom_label["has-paypal"]&&(r.attr("id","forminator-paypal-submit"),setTimeout(function(){l.paypalHasCondition.includes(a.$el.data("form-id"))||(i.addClass("forminator-hidden"),r.removeClass("forminator-hidden"))},40)),0<r.find("iframe").length&&r.find("iframe").width("100%")),this.$el.trigger("forminator.front.condition.restart")},go_to:function(t,e){if((this.step=t)===this.totalSteps&&!this.finished)return!1;this.$el.find(".forminator-pagination").css({height:"0",opacity:"0",visibility:"hidden"}).attr("aria-hidden","true").attr("hidden",!0),this.$el.find(".forminator-pagination .forminator-pagination--content").hide(),this.$el.find("[data-step="+t+"]").css({height:"auto",opacity:"1",visibility:"visible"}).removeAttr("aria-hidden").removeAttr("hidden"),this.$el.find("[data-step="+t+"] .forminator-pagination--content").show();t=this.$el.data("forminatorFront");void 0!==t&&t.responsive_captcha(),this.update_navigation(),e&&this.scroll_to_top_form()},update_navigation:function(){this.$el.find(".forminator-current").attr("aria-selected","false"),this.$el.find(".forminator-current").removeClass("forminator-current"),this.$el.find(".forminator-step-"+this.step).attr("aria-selected","true"),this.$el.find(".forminator-step-"+this.step).addClass("forminator-current"),this.$el.find(".forminator-pagination:not(:hidden)").find(".forminator-answer input").first().trigger("change"),this.calculate_bar_percentage()},scroll_to_top_form:function(){var e=this.$el,r=this.$el.find(".forminator-row").not(":hidden").first();if((e=r.length?r:e).length){var r="html,body",n=(0<this.$el.closest(".sui-dialog").length&&(r=".sui-dialog"),0<this.$el.closest(".wph-modal").length&&(r=".wph-modal"),e.focus(),f(l).height()/2);let t=e.offset().top-Math.max(n,f(l).height()-e.outerHeight(!0))/2;this.quiz&&(t=e.offset().top,f("#wpadminbar").length)&&(t-=35),f(r).animate({scrollTop:t},500,function(){e.attr("tabindex")||e.attr("tabindex",-1)})}},resetRichTextEditorHeight:function(){var e;"undefined"!=typeof tinyMCE&&(e=this.$el).find(".forminator-textarea").each(function(){var t=f(this).attr("id");0!==e.find("#"+t+"_ifr").length&&e.find("#"+t+"_ifr").is(":visible")&&e.find("#"+t+"_ifr").height(f(this).height())})}}),f.fn[n]=function(t){return this.each(function(){f.data(this,n)||f.data(this,n,new e(this,t))})}}(jQuery,window,document),function(l,f,i){"use strict";var r="forminatorFrontPayPal",n={type:"paypal",paymentEl:null,paymentRequireSsl:!1,generalMessages:{}};function e(t,e){this.element=t,this.$el=l(this.element),this.forminator_selector="#"+this.$el.attr("id")+'[data-forminator-render="'+this.$el.data("forminator-render")+'"]',this.settings=l.extend({},n,e),this._defaults=n,this._name=r,this.paypalData=null,this.paypalButton=null,this.init()}l.extend(e.prototype,{init:function(){this.settings.paymentEl&&(this.paypalData=this.settings.paymentEl,this.render_paypal_button(this.element),this.replaceScriptCurrency())},is_data_valid:function(){var t=this.configurePayPal(),e=this.settings.paymentRequireSsl;return!(t.amount<=0||e&&"https:"!==location.protocol)},is_form_valid:function(){var t=this.$el.validate(),e=t.checkForm();return t.submitted={},e},render_paypal_button:function(t){var o=l(t),a=this,r=this.configurePayPal(),n=o.find(".forminator-response-message"),s=ForminatorFront.cform.gateway.error,e=this.settings.paymentRequireSsl,i=this.settings.generalMessages,t={shape:r.shape,color:r.color,label:r.label,layout:r.layout,height:parseInt(r.height)};"vertical"!==r.layout&&(t.tagline=r.tagline),f.parent!==f&&f.parent.paypal&&(f.paypal=f.parent.paypal),this.paypalButton=paypal.Buttons({onInit:function(t,e){e.disable(),"variable"===r.amount_type&&""!==r.variable&&(r.amount=a.get_field_calculation(r.variable)),o.find("input, select, textarea, .forminator-field-signature").on("change",function(){a.is_data_valid()&&a.is_form_valid()?(e.enable(),n.hasClass("forminator-error")&&(n.html("").attr("aria-hidden","true"),n.removeClass("forminator-show"))):e.disable()}),o.on("validation:error",function(){e.disable()}),o.on("forminator:uploads:valid",function(){a.is_data_valid()&&a.is_form_valid()&&e.enable()}),a.is_data_valid()&&a.is_form_valid()&&e.enable()},env:r.mode,style:t,onClick:function(){if(!o.valid()&&r.amount<=0)n.removeClass("forminator-accessible").addClass("forminator-error").html("").removeAttr("aria-hidden"),n.html('<label class="forminator-label--error"><span>'+i.payment_require_amount_error+"</span></label>"),a.focus_to_element(n);else if(e&&"https:"!==location.protocol)n.removeClass("forminator-accessible").addClass("forminator-error").html("").removeAttr("aria-hidden"),n.html('<label class="forminator-label--error"><span>'+i.payment_require_ssl_error+"</span></label>"),a.focus_to_element(n);else if(o.valid()){if(o.trigger("forminator:preSubmit:paypal",[n]),n.find(".forminator-invalid-captcha").html())return a.focus_to_element(n),!1}else n.removeClass("forminator-accessible").addClass("forminator-error").html("").removeAttr("aria-hidden"),n.html('<label class="forminator-label--error"><span>'+i.form_has_error+"</span></label>"),a.focus_to_element(n);"variable"===r.amount_type&&""!==r.variable&&(r.amount=a.get_field_calculation(r.variable))},createOrder:function(t,e){o.addClass("forminator-partial-disabled");var r=o.find('input[name="forminator_nonce"]').val(),n=a.getPayPalData("form_id"),i=a.paypal_request_data();return fetch(ForminatorFront.ajaxUrl+"?action=forminator_pp_create_order",{method:"POST",mode:"same-origin",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({nonce:r,form_id:n,mode:a.getPayPalData("mode"),form_data:i,form_fields:o.serialize()})}).then(function(t){return t.json()}).then(function(t){return!0!==t.success?(s=t.data,!1):(t=t.data.order_id,o.find(".forminator-paypal-input").val(t),t)})},onApprove:function(t,e){void 0!==a.settings.has_loader&&a.settings.has_loader&&(o.addClass("forminator-fields-disabled"),n.html("<p>"+a.settings.loader_label+"</p>"),n.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-success forminator-error").addClass("forminator-loading forminator-show"),a.focus_to_element(n)),o.trigger("submit.frontSubmit","forminator:submit:paypal")},onCancel:function(t,e){return void 0!==a.settings.has_loader&&a.settings.has_loader&&(o.removeClass("forminator-fields-disabled forminator-partial-disabled"),n.removeClass("forminator-loading")),e.redirect()},onError:function(){void 0!==a.settings.has_loader&&a.settings.has_loader&&(o.removeClass("forminator-fields-disabled forminator-partial-disabled"),n.removeClass("forminator-loading")),n.removeClass("forminator-accessible").addClass("forminator-error").html("").removeAttr("aria-hidden"),n.html('<label class="forminator-label--error"><span>'+s+"</span></label>"),a.focus_to_element(n)}}),this.paypalButton.render(o.find(".forminator-button-paypal")[0])},configurePayPal:function(){var t={form_id:this.getPayPalData("form_id"),sandbox_id:this.getPayPalData("sandbox_id"),currency:this.getPayPalData("currency"),live_id:this.getPayPalData("live_id"),amount:0},e=(t.color=this.getPayPalData("color")?this.getPayPalData("color"):"gold",t.shape=this.getPayPalData("shape")?this.getPayPalData("shape"):"rect",t.label=this.getPayPalData("label")?this.getPayPalData("label"):"checkout",t.layout=this.getPayPalData("layout")?this.getPayPalData("layout"):"vertical",t.tagline=this.getPayPalData("tagline")?this.getPayPalData("tagline"):"true",t.redirect_url=this.getPayPalData("redirect_url")?this.getPayPalData("redirect_url"):"",t.mode=this.getPayPalData("mode"),t.locale=this.getPayPalData("locale")?this.getPayPalData("locale"):"en_US",t.debug_mode=this.getPayPalData("debug_mode")?this.getPayPalData("debug_mode"):"disable",t.amount_type=this.getPayPalData("amount_type")?this.getPayPalData("amount_type"):"fixed",t.variable=this.getPayPalData("variable")?this.getPayPalData("variable"):"",t.height=this.getPayPalData("height")?this.getPayPalData("height"):55,t.shipping_address=this.getPayPalData("shipping_address")?this.getPayPalData("shipping_address"):"disable",this.getPayPalData("amount_type"));return"fixed"===e?t.amount=this.getPayPalData("amount"):"variable"===e&&""!==t.variable&&(t.amount=this.get_field_calculation(t.variable)),t},getPayPalData:function(t){return void 0!==this.paypalData[t]?this.paypalData[t]:null},get_form_field:function(t){var e=this.$el.find("#"+t+"-field");return e=0===e.length&&0===(e=this.$el.find("input[name="+t+"]")).length&&0===(e=this.$el.find("textarea[name="+t+"]")).length&&0===(e=this.$el.find('input[name="'+t+'[]"]')).length&&0===(e=this.$el.find('select[name="'+t+'"]')).length&&0===(e=this.$el.find('select[name="'+t+'[]"]')).length&&0===(e=this.$el.find("#"+t)).length?this.$el.find("select[name="+t+"]"):e},get_field_calculation:function(t){var t=this.get_form_field(t),e=0,r=0,n=null;return this.field_is_radio(t)?(n=t.filter(":checked")).length&&(r=n.data("calculation"))!==i&&(e=Number(r)):this.field_is_checkbox(t)?t.each(function(){l(this).is(":checked")&&(r=l(this).data("calculation"))!==i&&(e+=Number(r))}):this.field_is_select(t)?(n=t.find("option").filter(":selected")).length&&(r=n.data("calculation"))!==i&&(e=Number(r)):e=t.inputmask?t.inputmask("unmaskedvalue").replace(/,/g,"."):Number(t.val()),isNaN(e)?0:e},focus_to_element:function(t){t.show(),l("html,body").animate({scrollTop:t.offset().top-(l(f).height()-t.outerHeight(!0))/2},500,function(){t.attr("tabindex")||t.attr("tabindex",-1),t.focus()})},paypal_request_data:function(){var t=this.configurePayPal(),e=this.getPayPalData("shipping_address"),r=this.getPayPalData("billing-details"),n=this.getBillingData(),i={};return i.purchase_units=[{amount:{currency_code:this.getPayPalData("currency"),value:t.amount}}],"enable"!==e&&(i.application_context={shipping_preference:"NO_SHIPPING"}),r&&(i.payer=n),i},getBillingData:function(){var t,e,r,n,i,o=this.getPayPalData("billing-name"),a=this.getPayPalData("billing-email"),s=this.getPayPalData("billing-address"),l={};return o&&(l.name={},(n=this.get_field_value(o))||(t=this.get_field_value(o+"-prefix")||"",e=this.get_field_value(o+"-first-name")||"",r=this.get_field_value(o+"-middle-name")||"",i=this.get_field_value(o+"-last-name")||"",n=(n=t?t+" ":"")+e+(r?" "+r:"")),n)&&(l.name.given_name=n,l.name.surname=i),a&&(o=this.get_field_value(a)||"")&&(l.email_address=o),s&&(l.address={},(t=this.get_field_value(s+"-street_address")||"")&&(l.address.address_line_1=t),(e=this.get_field_value(s+"-address_line")||"")&&(l.address.address_line_2=e),(r=this.get_field_value(s+"-city")||"")&&(l.address.admin_area_2=r),(n=this.get_field_value(s+"-state")||"")&&(l.address.admin_area_1=n),(i=this.get_form_field(s+"-country")||"")&&(l.address.country_code=i.find(":selected").data("country-code")),a=this.get_field_value(s+"-zip")||"")&&(l.address.postal_code=a),l},get_field_value:function(t){var t=this.get_form_field(t),e="",r=null;return this.field_is_radio(t)?(r=t.filter(":checked")).length&&(e=r.val()):this.field_is_checkbox(t)?t.each(function(){l(this).is(":checked")&&(e=l(this).val())}):e=(this.field_is_select(t),t.val()),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===l(this).attr("type"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===l(this).attr("type"))return!(e=!0)}),e},field_is_select:function(t){return t.is("select")},replaceScriptCurrency:function(){var i=this,o=this.paypalData.currency;i.$el.on("click",function(t){var e=l("script[src^='https://www.paypal.com/sdk/js']"),r=e.attr("src"),n=/currency=([^&]+)/.exec(r)[1];o!==n&&(e.attr("src",r.replace("currency="+n,"currency="+o)),i.paypalButton.updateProps())})}}),l.fn[r]=function(t){return this.each(function(){l.data(this,r)||l.data(this,r,new e(this,t))})}}(jQuery,window,void document),function(_){"use strict";var r="forminatorFrontDatePicker",n={};function e(t,e){this.element=t,this.$el=_(this.element),this.settings=_.extend({},n,e),this._defaults=n,this._name=r,this.init()}_.extend(e.prototype,{init:function(){var o=this,t=this.$el.data("format"),e=(this.$el.data("restrict-type"),this.$el.data("restrict")),r=this.$el.data("restrict"),n=this.$el.data("start-year"),i=this.$el.data("end-year"),a=this.$el.data("past-dates"),s=this.$el.val(),l=this.$el.data("start-of-week"),f=this.$el.data("start-date"),u=this.$el.data("end-date"),c=this.$el.data("start-field"),d=this.$el.data("end-field"),m=this.$el.data("start-offset"),h=this.$el.data("end-offset"),p=this.$el.data("disable-date"),b=this.$el.data("disable-range"),r=!isNaN(parseFloat(r))&&isFinite(r)?[r.toString()]:e.split(","),p=p.split(","),b=b.split(","),n=n||"c-95",i=i||"c+95",y=this.$el.closest(".forminator-custom-form"),g="forminator-calendar";y.hasClass("forminator-design--default")?g="forminator-calendar--default":y.hasClass("forminator-design--material")?g="forminator-calendar--material":y.hasClass("forminator-design--flat")?g="forminator-calendar--flat":y.hasClass("forminator-design--bold")?g="forminator-calendar--bold":y.hasClass("forminator-design--basic")&&(g="forminator-calendar--basic"),this.$el.datepicker({beforeShow:function(t,e){var r,n,i=_(this).closest(".elementor-popup-modal");e.dpDiv.removeClass(function(t,e){return(e.match(/\bhustle-\S+/g)||[]).join(" ")}),e.dpDiv.removeClass(function(t,e){return(e.match(/\bforminator-\S+/g)||[]).join(" ")}),e.dpDiv.addClass("forminator-custom-form-"+y.data("form-id")+" "+g),"disable"===a?_(this).datepicker("option","minDate",s):_(this).datepicker("option","minDate",null),f&&(r=new Date(f.replace(/-/g,"/").replace(/T.+/,"")),_(this).datepicker("option","minDate",r)),u&&(r=new Date(u.replace(/-/g,"/").replace(/T.+/,"")),_(this).datepicker("option","maxDate",r)),c&&void 0!==(r=o.getLimitDate(c,m))&&_(this).datepicker("option","minDate",r),d&&void 0!==(r=o.getLimitDate(d,h))&&_(this).datepicker("option","maxDate",r),i.length?(i.append(_("#ui-datepicker-div")),n=t.getBoundingClientRect(),setTimeout(function(){e.dpDiv.css({top:n.top+n.height,left:n.left})},0)):_("body").append(_("#ui-datepicker-div"))},beforeShowDay:function(t){return o.restrict_date(r,p,b,t)},monthNames:datepickerLang.monthNames,monthNamesShort:datepickerLang.monthNamesShort,dayNames:datepickerLang.dayNames,dayNamesShort:datepickerLang.dayNamesShort,dayNamesMin:datepickerLang.dayNamesMin,changeMonth:!0,changeYear:!0,dateFormat:t,yearRange:n+":"+i,minDate:new Date(n,0,1),maxDate:new Date(i,11,31),firstDay:l,onClose:function(){_(this).valid()}}),_(".ui-datepicker").addClass("notranslate")},getLimitDate:function(t,e){var r=_('input[name ="'+t+'"]').val();if(void 0!==r)return t=_('input[name ="'+t+'"]').data("format").replace(/y/g,"yy"),e=e.split("_"),r=moment(r,t.toUpperCase()),r="-"===e[0]?r.subtract(e[1],e[2]):r.add(e[1],e[2]),t=moment(r).format("YYYY-MM-DD"),new Date(t)},restrict_date:function(t,e,r,n){var i=!0,o=n.getDay(),a=jQuery.datepicker.formatDate("mm/dd/yy",n);if(0!==r[0].length)for(var s=0;s<r.length;s++){var l=r[s].split("-"),f=new Date(l[0].trim()),l=new Date(l[1].trim());if(f<=n&&n<=l){i=!1;break}}return-1!==t.indexOf(o.toString())||-1!==e.indexOf(a)||!1===i?[!1,"disabledDate"]:[!0,"enabledDate"]}}),_.fn[r]=function(t){return this.each(function(){_.data(this,r)||_.data(this,r,new e(this,t))})}}(jQuery,(window,document)),function(m,t){"use strict";var r="forminatorFrontValidate",n={},i={rules:{},messages:{}};function e(t,e){this.element=t,this.$el=m(this.element),this.settings=m.extend({},i,e),this._defaults=i,this._name=r,this.init()}function o(t,e){return t=m(e).hasClass("wp-editor-area")&&m(e).hasClass("forminator-textarea")?m("<div/>").html(t).text():t}function a(t){t=String(t).trim();var e=parseFloat(t);return String(e)===t?s(e,2):1===(e=t.split(/[^\dE-]+/)).length?s(parseFloat(t),2):(t=e.pop(),s(parseFloat(e.join("")+"."+t),2))}function s(t,e){return(Math.floor(100*t)/100).toFixed(e)}function l(t){var[t,e]=t.split(" "),[t,r]=t.split(":");return(t=60*(t=void 0!==e&&(12===parseInt(t,10)&&(t=0),"pm"===e.toLowerCase())?parseInt(t,10)+12:t)*60)+(r*=60)}m.extend(e.prototype,{init:function(){m(".forminator-select2").on("change",this.element,function(t,e){"forminator_emulate_trigger"!==e&&m(this).trigger("focusout")});var r=!1,i=this.$el,o=this.settings.rules,a=this.settings.messages;if(i.hasClass("forminator-grouped-fields")){let n=i.data("suffix");m.each(o,function(t,e){var r=t.replace(/(.+?)(\[\])?$/g,"$1-"+n+"$2");(i.find('[name="'+r+'"]').length||i.find("#"+r.replace("[]","")).length)&&(o[r]=e,a[r]=a[t])}),i=i.closest("form.forminator-ui")}i.data("validator",null).unbind("validate").validate({ignore(t,e){return m("#forminator-field-disable_validations").is(":checked")||m(e).is(":hidden:not(.do-validate)")&&!m(e).closest(".forminator-pagination").length||m(e).closest(".forminator-hidden").length},errorPlacement:function(t,e){i.trigger("validation:error")},showErrors:function(t,e){r&&0<e.length&&(i.find(".forminator-response-message").html("<ul></ul>"),jQuery.each(e,function(t,e){i.find(".forminator-response-message ul").append("<li>"+e.message+"</li>")}),i.find(".forminator-response-message").removeAttr("aria-hidden").prop("tabindex","-1").addClass("forminator-accessible")),r=!1,this.defaultShowErrors(),i.trigger("validation:showError",e)},invalidHandler:function(t,e){r=!0,i.trigger("validation:invalid")},onfocusout:function(t){var e;!1===m(t).hasClass("hasDatepicker")&&m(t).valid(),m(t).hasClass("forminator-email--field")&&(e=m(t).attr("name"),(e=m('input[name="confirm_'+e+'"]')).length)&&e.val()&&e.valid(),m(t).trigger("validation:focusout")},highlight:function(t,e,r){var n=m(t),i=n.closest(".forminator-field"),o=n.closest(".forminator-date-input"),a=n.closest(".forminator-timepicker"),s=!1,l=!1,f=!1,t=this.errorMap[t.name],u=n.attr("id")+"-error",c=n.attr("aria-describedby"),d='<span class="forminator-error-message" id="'+u+'"></span>';(0<o.length?(l=(s=o.parent()).find('.forminator-error-message[data-error-field="'+n.data("field")+'"]'),f=s.find(".forminator-description"),d='<span class="forminator-error-message" data-error-field="'+n.data("field")+'" id="'+u+'"></span>',0===l.length&&("day"===n.data("field")&&(s.find('.forminator-error-message[data-error-field="year"]').length?m(d).insertBefore(s.find('.forminator-error-message[data-error-field="year"]')):0===f.length?s.append(d):m(d).insertBefore(f),0===i.find(".forminator-error-message").length)&&i.append('<span class="forminator-error-message" id="'+u+'"></span>'),"month"===n.data("field")&&(s.find('.forminator-error-message[data-error-field="day"]').length?m(d).insertBefore(s.find('.forminator-error-message[data-error-field="day"]')):0===f.length?s.append(d):m(d).insertBefore(f),0===i.find(".forminator-error-message").length)&&i.append('<span class="forminator-error-message" id="'+u+'"></span>'),"year"===n.data("field"))&&(0===f.length?s.append(d):m(d).insertBefore(f),0===i.find(".forminator-error-message").length)&&i.append('<span class="forminator-error-message" id="'+u+'"></span>'),s.find('.forminator-error-message[data-error-field="'+n.data("field")+'"]').html(t),i.find(".forminator-error-message")):0<a.length?(l=(s=a.parent()).find('.forminator-error-message[data-error-field="'+n.data("field")+'"]'),f=s.find(".forminator-description"),d='<span class="forminator-error-message" data-error-field="'+n.data("field")+'" id="'+u+'"></span>',0===l.length&&("hours"===n.data("field")&&(s.find('.forminator-error-message[data-error-field="minutes"]').length?m(d).insertBefore(s.find('.forminator-error-message[data-error-field="minutes"]')):0===f.length?s.append(d):m(d).insertBefore(f),0===i.find(".forminator-error-message").length)&&i.append('<span class="forminator-error-message" id="'+u+'"></span>'),"minutes"===n.data("field"))&&(0===f.length?s.append(d):m(d).insertBefore(f),0===i.find(".forminator-error-message").length)&&i.append('<span class="forminator-error-message" id="'+u+'"></span>'),s.find('.forminator-error-message[data-error-field="'+n.data("field")+'"]').html(t),i.find(".forminator-error-message")):(l=i.find(".forminator-error-message"),f=i.find(".forminator-description"),0===l.length&&(0===f.length?i.append(d):m(d).insertBefore(f)),i.find(".forminator-error-message"))).html(t),c?((o=c.split(" ")).includes(u)||o.push(u),a=o.join(" "),n.attr("aria-describedby",a)):n.attr("aria-describedby",u),n.attr("aria-invalid","true"),i.addClass("forminator-has_error"),n.trigger("validation:highlight")},unhighlight:function(t,e,r){var t=m(t),n=t.closest(".forminator-field"),i=t.closest(".forminator-timepicker"),o=t.closest(".forminator-date-input"),a="",s=t.attr("id")+"-error",l=t.attr("aria-describedby"),a=0<o.length?o.parent().find('.forminator-error-message[data-error-field="'+t.data("field")+'"]'):0<i.length?i.parent().find('.forminator-error-message[data-error-field="'+t.data("field")+'"]'):n.find(".forminator-error-message");l?(o=l.split(" ").filter(function(t){return t!==s}).join(" "),t.attr("aria-describedby",o)):t.removeAttr("aria-describedby"),t.removeAttr("aria-invalid"),a.remove(),n.removeClass("forminator-has_error"),t.trigger("validation:unhighlight")},rules:o,messages:a}),i.off("forminator.validate.signature").on("forminator.validate.signature",function(){m(this).validate().element(m(this).find("input[id$='_data']"))}),i.find(".forminator-input-file, .forminator-input-file-required").on("change",function(){m(this).trigger("focusout")}),m(".time-minutes.has-time-limiter, .time-ampm.has-time-limiter").on("change",function(){m(this).closest(".forminator-col").siblings(".forminator-col").first().find(".time-hours").trigger("focusout")}),m('.forminator-field.required input[type="checkbox"]').on("input",function(){m(this).not(":checked").trigger("focusout")}),m(t).on("change","#forminator-field-disable_validations",function(){var t=m(this).is(":checked");const e=i.data("validator");t&&e&&(e.resetForm(),i.find(":input").each(function(){e.settings.unhighlight(this)}))})}}),m.fn[r]=function(t){return m.each(n,function(t,e){void 0===m.validator.methods[t]?m.validator.addMethod(t,e):"number"===t&&(m.validator.methods.number=n.number)}),this.each(function(){m.data(this,r)||m.data(this,r,new e(this,t))})},m.validator.addMethod("validurl",function(t,e){var r=m.validator.methods.url.bind(this);return r(t,e)||r("http://"+t,e)}),m.validator.addMethod("forminatorPhoneNational",function(t,e){var r=intlTelInput.getInstance(e),n=m(e);return!n.data("required")&&t==="+"+r.getSelectedCountryData().dialCode||(void 0===n.data("country")||n.data("country").toLowerCase()===r.getSelectedCountryData().iso2)&&(this.optional(e)||r.isValidNumberPrecise())}),m.validator.addMethod("forminatorPhoneInternational",function(t,e){var r=intlTelInput.getInstance(e);return!m(e).data("required")&&t==="+"+r.getSelectedCountryData().dialCode||this.optional(e)||r.isValidNumberPrecise()}),m.validator.addMethod("dateformat",function(t,e,r){var n,i,o,a,s=!1,l="yy-mm-dd"===r||"yy/mm/dd"===r||"yy.mm.dd"===r?/^\d{4}-\d{1,2}-\d{1,2}$/:/^\d{1,2}-\d{1,2}-\d{4}$/;return t=t.replace(/[ /.]/g,"-"),s=!!l.test(t)&&("dd/mm/yy"===r||"dd-mm-yy"===r||"dd.mm.yy"===r?(n=t.split("-"),i=parseInt(n[0],10),o=parseInt(n[1],10),a=parseInt(n[2],10)):"mm/dd/yy"===r||"mm.dd.yy"===r||"mm-dd-yy"===r?(n=t.split("-"),o=parseInt(n[0],10),i=parseInt(n[1],10),a=parseInt(n[2],10)):(n=t.split("-"),a=parseInt(n[0],10),o=parseInt(n[1],10),i=parseInt(n[2],10)),(l=new Date(Date.UTC(a,o-1,i,12,0,0,0))).getUTCFullYear()===a)&&l.getUTCMonth()===o-1&&l.getUTCDate()===i,this.optional(e)||s}),m.validator.addMethod("maxwords",function(t,e,r){return t=o(t,e),this.optional(e)||t.trim().split(/\s+/).length<=r}),m.validator.methods.maxlength=function(t,e,r){return!((t=o(t=t.replace(/<[^>]*>/g,""),e)).length>r)},m.validator.addMethod("trim",function(t,e,r){return!0===this.optional(e)||0!==t.trim().length}),m.validator.addMethod("equalToClosestEmail",function(t,e,r){e=m(e).closest(".forminator-row-with-confirmation-email").find('input[type="email"]').first();return e.length&&t===e.val()}),m.validator.addMethod("emailFilter",function(t,e,r){if(!t)return!0;var n,i=r.email_list.split("|"),o="deny"===r.filter_type;for(n of i)if(n=(n=(n=n.replace(/[\s\n\r\t]/g,"")).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).replace(/\\\*/g,".*"),new RegExp(n+"$").test(t))return!o;return o}),m.validator.addMethod("emailWP",function(t,e,r){if(!this.optional(e)){if(t.trim().length<6)return!1;if(t.indexOf("@",1)<0)return!1;e=t.split("@",2);if(!e[0].match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~\.-]+$/))return!1;if(e[1].match(/\.{2,}/))return!1;var n=e[1].split(".");if(n.length<2)return!1;for(var i=n.length,o=0;o<i;o++)if(!n[o].match(/^[a-z0-9-]+$/i))return!1}return!0}),m.validator.addMethod("forminatorPasswordStrength",function(t,e,r){var n,t=t.trim();return 0==t.length||!(!t||t.length<8)&&(n=0,t.match(/[0-9]/)&&(n+=10),t.match(/[a-z]/)&&(n+=20),t.match(/[A-Z]/)&&(n+=20),t.match(/[^a-zA-Z0-9]/)&&(n+=30),t.match(/[=!\-@.,_*#&?^`%$+\/{\[\]|}^?~]/)&&(n+=30),54<=Math.log(Math.pow(n,t.length))/Math.LN2)}),m.validator.addMethod("extension",function(t,e,r){var n,i=!1;return""!==t.trim()&&(n=(n=t.replace(/^.*\./,""))==t?"notExt":n.toLowerCase(),-1!=r.indexOf(n))&&(i=!0),this.optional(e)||i}),m.validator.methods.number=function(t,e,r){return this.optional(e)||/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/.test(t)},m.validator.addMethod("minNumber",function(t,e,r){return 0===t.length||r<=a(t)}),m.validator.addMethod("maxNumber",function(t,e,r){return 0===t.length||a(t)<=r}),m.validator.addMethod("timeLimit",function(t,e,r){var t=function(t,e){var r,n,i,o="";t.name.includes("hours")&&(t=m(t).closest(".forminator-col"),r=e,e=t.next(),n=("select"===(n=e.find(".time-minutes")).prop("tagName").toLowerCase()?e.find(".time-minutes option:selected"):e.find(".time-minutes")).val(),i=e.next().find('select[name$="ampm"] option:selected').val());{if(void 0===r||""===r||void 0===n||""===n)return!0;o=r+":"+n}""!==o&&void 0!==i&&(o+=" "+i);return o=l(o)}(e,t),n=l(r.start_limit),r=l(r.end_limit),n=n<=t&&t<=r,i=m(e).closest(".forminator-col").next().find(".forminator-field");return n||!0===t?i.removeClass("forminator-has_error"):setTimeout(function(){i.addClass("forminator-has_error")},10),!0===t||n}),n=m.validator.methods}(jQuery,(window,document)),function(o,u,e,a){"use strict";u.paypalHasCondition=[];var n="forminatorFrontCondition",i={fields:{},relations:{}};function r(t,e,r){this.element=t,this.$el=o(this.element),this.settings=o.extend({},i,e),this._defaults=i,this._name=n,this.calendar=r[0],this.init()}o.extend(r.prototype,{init:function(){var n=this,i=this.$el,t=this.$el.find(".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea, .forminator-field-signature, .forminator-rating");if(i.hasClass("forminator-grouped-fields")){let r=i.data("suffix");o.each(this.settings.fields,function(t,e){t=t+"-"+r;(i.find('[name="'+t+'"]').length||i.find("#"+t).length)&&(e=n.updateConditions(e,r,i),n.settings.fields[t]=e)})}this.add_missing_relations(),t.on("change input forminator.change",function(t){var e=o(this),r=e.closest(".forminator-col").attr("id");if(!e.is('input[type="radio"]')||"input"!==t.type)return r=(r=void 0!==(r=e.is('input[type="email"]')&&r===a&&e.attr("id").startsWith("forminator-field-email-")?e.closest(".forminator-row-with-confirmation-email").parent(".forminator-col").attr("id"):r)&&0!==r.indexOf("slider-")?r:"1"===e.attr("data-multi")||"hidden"===e.attr("type")?e.attr("name"):e.attr("id")).trim(),!(!n.has_relations(r)&&!n.has_siblings(r))&&(n.has_siblings(r)&&n.trigger_fake_parent_date_field(r),!n.has_relations(r)&&n.has_siblings(r)?(n.trigger_siblings(r),!1):(n.process_relations(r,e,t),n.paypal_button_condition(),void n.maybe_clear_upload_container()))}),o(e).on("tinymce-editor-init",function(t,e){e.on("change",function(t){i.find("#"+o(this).attr("id")).change()})}),"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor&&tinyMCE.activeEditor.on("change",function(t){i.find("#"+o(this).attr("id")).change()}),this.$el.find(".forminator-button.forminator-button-back, .forminator-button.forminator-button-next").on("click",function(){i.find('.forminator-field input:not([type="file"]), .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea').trigger("forminator.change","forminator_emulate_trigger")}),this.$el.find(".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea").trigger("forminator.change","forminator_emulate_trigger"),this.init_events()},updateConditions:function(t,e,r){t=JSON.parse(JSON.stringify(t));if(t.conditions&&Array.isArray(t.conditions)){const n=r.closest(".forminator-col").prop("id");t.conditions.forEach(function(t){t.field&&t.group&&t.group===n&&(t.field=t.field+"-"+e)})}return t},process_relations:function(t,s,l){var f=this;f.get_relations(t).forEach(function(t){var e,r=f.get_field_logic(t),n=r.action,i=r.rule,o=r.conditions,a=0;0!==t.indexOf("paypal")||0===r.length||u.paypalHasCondition.includes(f.$el.data("form-id"))||u.paypalHasCondition.push(f.$el.data("form-id")),o.forEach(function(t){f.is_applicable_rule(t,n)&&a++}),"all"===i&&a===o.length||"any"===i&&0<a?(s instanceof jQuery&&(e=s.closest(".forminator-pagination")),"submit"===t&&void 0!==e&&f.toggle_field(t,"show","valid"),f.toggle_field(t,n,"valid"),f.has_relations(t)&&("hide"===n?f.hide_element(t,l):f.show_element(t,l))):(f.toggle_field(t,n,"invalid"),f.has_relations(t)&&("show"===n?f.hide_element(t,l):f.show_element(t,l)))})},init_events:function(){var e=this;this.$el.on("forminator.front.condition.restart",function(t){e.on_restart(t)})},on_restart:function(t){this.$el.find(".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea").trigger("forminator.change","forminator_emulate_trigger")},add_missing_relations:function(){var t,n=this,i={};void 0!==this.settings.fields&&(t=this.settings.fields,Object.keys(t).forEach(function(r){t[r].conditions.forEach(function(t){var e,t=t.field;n.has_relations(t)?(e=n.get_relations(t),-1===o.inArray(r,e)&&n.settings.relations[t].push(r)):(void 0===i[t]&&(i[t]=[]),i[t].push(r))})})),Object.keys(i).forEach(function(t){n.settings.relations[t]=i[t]})},get_field_logic:function(t){return void 0===this.settings.fields[t]?[]:this.settings.fields[t]},has_relations:function(t){return void 0!==this.settings.relations[t]},get_relations:function(t){return this.has_relations(t)?o.unique(this.settings.relations[t]):[]},get_field_value:function(t){if(""===t)return"";var e=this.get_form_field(t),r=e.val();if(this.field_is_radio(e))r=e.filter(":checked").val();else if(this.field_is_signature(e))r=e.find("input[id$='_data']").val();else if(this.field_is_checkbox(e))r=[],e.each(function(){o(this).is(":checked")&&r.push(o(this).val().toLowerCase())}),0===r.length&&(r=null);else if(this.field_is_select(e)&&e.attr("multiple")){var r=[],n=e.find("option").filter(":selected");0<n.length?n.each(function(){r.push(o(this).val().toLowerCase())}):r=null}else if(this.field_is_textarea_wpeditor(e))"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor&&(r=tinyMCE.activeEditor.getContent());else if(this.field_has_inputMask(e)){if(r=parseFloat(e.inputmask("unmaskedvalue").replace(",",".")),0<=t.indexOf("calculation-"))return r}else if(this.field_is_rating(e))return r="string"==typeof r&&r.split("/")[0]||0;return r||""},get_date_field_value:function(t){if(""===t)return"";var e=this.get_form_field(t),r=!0,n="";if(!(r=e instanceof jQuery&&(r=!1,e.hasClass("forminator-col"))?!0:r)&&this.field_is_datepicker(e)){switch(n=e.val(),e.data("format")){case"dd/mm/yy":n=e.val().split("/").reverse().join("-");break;case"dd.mm.yy":n=e.val().split(".").reverse().join("-");break;case"dd-mm-yy":n=e.val().split("-").reverse().join("-")}""!==n&&(n={year:(i=new Date(n)).getFullYear(),month:i.getMonth(),date:i.getDate(),day:i.getDay()})}else{var i,r=!0===r?t:e.data("parent"),t=this.get_form_field_value(r+"-year"),o=this.get_form_field_value(r+"-month"),r=this.get_form_field_value(r+"-day");""!==t&&""!==o&&""!==r&&(n={year:(i=new Date(t+"-"+o+"-"+r)).getFullYear(),month:i.getMonth(),date:i.getDate(),day:i.getDay()})}return n||""},field_has_inputMask:function(t){var e=!1;return t.each(function(){if(a!==o(this).attr("data-inputmask"))return!(e=!0)}),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===o(this).attr("type"))return!(e=!0)}),e},field_is_signature:function(t){var e=!1;return t.each(function(){if(0<o(this).find(".forminator-field-signature").length)return!(e=!0)}),e},field_is_datepicker:function(t){var e=!1;return t.each(function(){if(o(this).hasClass("forminator-datepicker"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===o(this).attr("type"))return!(e=!0)}),e},field_is_select:function(t){return t.is("select")},field_is_textarea_wpeditor:function(t){var e=!1;return t.each(function(){if(o(this).parent(".wp-editor-container").parent("div").hasClass("tmce-active"))return!(e=!0)}),e},field_is_upload:function(t){var e=!1;return e=-1!==t.indexOf("upload")?!0:e},field_is_rating:function(t){var e=!1;return t.each(function(){if(o(this).hasClass("forminator-rating"))return!(e=!0)}),e},get_form_field:function(t){let e=this.$el;var r=(e=e.hasClass("forminator-grouped-fields")?e.closest("form.forminator-ui"):e).find("#"+t+"-field");return r=0===r.length&&0===(r=e.find("."+t+"-payment")).length&&0===(r=e.find('input[name="'+t+'"]')).length&&0===(r=e.find('textarea[name="'+t+'"]')).length&&0===(r=e.find('input[name="'+t+'[]"]')).length&&0===(r=e.find('select[name="'+t+'"]')).length&&0===(r=e.find('select[name="'+t+'[]"]')).length?e.find("#"+t):r},get_form_field_value:function(t){var e=this.$el.data("form-id"),r=this.$el.data("uid"),e=this.$el.find("#forminator-form-"+e+"__field--"+t+"_"+r);return(e=0===e.length&&0===(e=this.$el.find("#"+t+"-field")).length&&0===(e=this.$el.find('input[name="'+t+'"]')).length&&0===(e=this.$el.find('textarea[name="'+t+'"]')).length&&0===(e=this.$el.find('input[name="'+t+'[]"]')).length&&0===(e=this.$el.find('select[name="'+t+'"]')).length&&0===(e=this.$el.find('select[name="'+t+'[]"]')).length?this.$el.find("#"+t):e).val()},is_numeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},is_date_rule:function(t){return["day_is","day_is_not","month_is","month_is_not","is_before","is_after","is_before_n_or_more_days","is_before_less_than_n_days","is_after_n_or_more_days","is_after_less_than_n_days"].includes(t)},has_siblings:function(t){return""!==t&&!!(t=this.get_form_field(t)).data("parent")},trigger_fake_parent_date_field:function(t){t=this.get_form_field(t).data("parent");this.process_relations(t,{},{})},trigger_siblings:function(r){var n=this,t=n.get_form_field(r).data("parent");o.each([t+"-year",t+"-month",t+"-day"],function(t,e){r!==e&&n.has_relations(e)&&n.get_form_field(e).trigger("change")})},is_applicable_rule:function(t,e){var r,n,i;return void 0!==t&&(r=this.is_date_rule(t.operator)?this.get_date_field_value(t.field):this.get_field_value(t.field),n=t.value,i=t.operator,"show"===e?this.is_matching(r,n,i)&&this.is_hidden(t.field):this.is_matching(r,n,i))},is_hidden:function(t){t=this.get_form_field(t).closest(".forminator-col").closest(".forminator-row");return!!t.hasClass("forminator-hidden-option")||!t.hasClass("forminator-hidden")},is_matching:function(t,e,r){var n,i=Array.isArray(t);switch("string"==typeof t&&(t=t.toLowerCase()),"string"==typeof e&&(e=e.toLowerCase(),"month_is"!==r&&"month_is_not"!==r||o.inArray(e,n={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11})&&(e=n[e]),"day_is"!==r&&"day_is_not"!==r||o.inArray(e,n={su:0,mo:1,tu:2,we:3,th:4,fr:5,sa:6})&&(e=n[e])),r){case"is":return i?-1<o.inArray(e,t):this.is_numeric(t)&&this.is_numeric(e)?Number(t)===Number(e):t===e;case"is_not":return i?-1===o.inArray(e,t):this.is_numeric(t)&&this.is_numeric(e)?Number(t)!==Number(e):t!==e;case"is_great":return e=+e,!(!this.is_numeric(t=+t)||!this.is_numeric(e))&&e<t;case"is_less":return e=+e,!(!this.is_numeric(t=+t)||!this.is_numeric(e))&&t<e;case"contains":return this.contains(t,e);case"does_not_contain":return!this.contains(t,e);case"starts":return t.startsWith(e);case"ends":return t.endsWith(e);case"month_is":return t.month===e;case"month_is_not":return t.month!==e;case"day_is":return t.day===e;case"day_is_not":return t.day!==e;case"is_before":return this.date_is_smaller(t,e);case"is_after":return this.date_is_grater(t,e);case"is_before_n_or_more_days":return this.date_is_n_days_before_current_date(t,e);case"is_before_less_than_n_days":return this.date_is_less_than_n_days_before_current_date(t,e);case"is_after_n_or_more_days":return this.date_is_n_days_after_current_date(t,e);case"is_after_less_than_n_days":return this.date_is_less_than_n_days_after_current_date(t,e)}return!1},contains:function(t,e){return 0<=t.toLowerCase().indexOf(e)},date_is_grater:function(t,e){return t=this.set_date_as_utc_time(t),1===forminatorDateUtil.compare(t,e)},set_date_as_utc_time(t){return t=a!==t.month&&a!==t.date&&a!==t.year?new Date(`${t.month+1}/${t.date}/${t.year} UTC`).getTime():t},date_is_smaller:function(t,e){return t=this.set_date_as_utc_time(t),-1===forminatorDateUtil.compare(t,e)},date_is_equal:function(t,e){return 0===forminatorDateUtil.compare(t,e)},date_is_n_days_before_current_date:function(t,e){e=parseInt(e);var r=this.get_current_date(),t=forminatorDateUtil.diffInDays(t,r);return!isNaN(t)&&(0===e?t===e:e<=t)},date_is_less_than_n_days_before_current_date:function(t,e){e=parseInt(e);var r=this.get_current_date(),t=forminatorDateUtil.diffInDays(t,r);return!isNaN(t)&&t<e&&0<t},date_is_n_days_after_current_date:function(t,e){e=parseInt(e);var r=this.get_current_date(),r=forminatorDateUtil.diffInDays(r,t);return!isNaN(r)&&(0===e?r===e:e<=r)},date_is_less_than_n_days_after_current_date:function(t,e){e=parseInt(e);var r=this.get_current_date(),r=forminatorDateUtil.diffInDays(r,t);return!isNaN(r)&&r<e&&0<r},get_current_date:function(){return new Date},toggle_field:function(t,e,r){var n=this,i=this.get_form_field(t).closest(".forminator-col"),o=i.find(".forminator-input-file-required"),a=i.find("[id ^=ctlSignature][id $=_data]"),s=i.find(".forminator-wp-editor-required"),l=i.closest(".forminator-row"),f=i.closest(".forminator-row-inside"),u=f.add(f.parent()),c=this.$el.find(".forminator-pagination-footer").find(".forminator-button-next"),d="submit"===t?".forminator-button-submit":"#forminator-paypal-submit",m=this.$el.find(d);"show"===e&&("valid"===r?(l.removeClass("forminator-hidden"),u.removeClass("forminator-hidden"),i.removeClass("forminator-hidden"),c.removeClass("forminator-hidden"),0<o.length&&o.addClass("do-validate"),0<s.length&&s.addClass("do-validate"),0<a.length&&a.addClass("do-validate"),setTimeout(function(){m=n.$el.find(d),"submit"===t&&m.removeClass("forminator-hidden"),0===t.indexOf("paypal")&&(n.$el.find(".forminator-button-submit").addClass("forminator-hidden"),m.removeClass("forminator-hidden"))},100)):(i.addClass("forminator-hidden"),setTimeout(function(){m=n.$el.find(d),"submit"===t&&m.addClass("forminator-hidden"),0===t.indexOf("paypal")&&(n.$el.find(".forminator-button-submit").removeClass("forminator-hidden"),m.addClass("forminator-hidden"))},100),0<o.length&&o.removeClass("do-validate"),0<s.length&&s.removeClass("do-validate"),0<a.length&&a.removeClass("do-validate"),0===f.find("> .forminator-col:not(.forminator-hidden)").length&&u.addClass("forminator-hidden"),0===l.find("> .forminator-col:not(.forminator-hidden)").length&&l.addClass("forminator-hidden"))),"hide"===e&&("valid"===r?(i.addClass("forminator-hidden"),m.addClass("forminator-hidden"),0<o.length&&o.removeClass("do-validate"),0<s.length&&s.removeClass("do-validate"),0<a.length&&a.removeClass("do-validate"),0===l.find("> .forminator-col:not(.forminator-hidden)").length&&l.addClass("forminator-hidden"),0===f.find("> .forminator-col:not(.forminator-hidden)").length&&u.addClass("forminator-hidden"),setTimeout(function(){m=n.$el.find(d),"submit"===t&&m.addClass("forminator-hidden"),0===t.indexOf("paypal")&&(n.$el.find(".forminator-button-submit").removeClass("forminator-hidden"),m.addClass("forminator-hidden"))},100)):(l.removeClass("forminator-hidden"),u.removeClass("forminator-hidden"),i.removeClass("forminator-hidden"),m.removeClass("forminator-hidden"),0<o.length&&o.addClass("do-validate"),0<s.length&&s.addClass("do-validate"),0<a.length&&a.addClass("do-validate"),setTimeout(function(){m=n.$el.find(d),"submit"===t&&m.removeClass("forminator-hidden"),0===t.indexOf("paypal")&&(n.$el.find(".forminator-button-submit").addClass("forminator-hidden"),m.removeClass("forminator-hidden"))},100))),this.$el.trigger("forminator:field:condition:toggled"),this.toggle_confirm_field(t,e,r)},clear_value:function(t,e){var r=this.get_form_field(t),n=this.get_field_value(t);r.hasClass("forminator-cleared-value")||(r.addClass("forminator-cleared-value"),e.originalEvent!==a&&(this.field_is_radio(r)?(r.attr("data-previous-value",n),r.removeAttr("checked")):this.field_is_checkbox(r)?r.each(function(){o(this).attr("data-previous-value",n),o(this).prop("checked",!1)}):(r.attr("data-previous-value",n),r.val(""))))},restore_value:function(t,e){var r=this.get_form_field(t),n=r.attr("data-previous-value");r.hasClass("forminator-cleared-value")&&e.originalEvent!==a&&(r.removeClass("forminator-cleared-value"),!this.field_is_upload(t))&&n&&(this.field_is_radio(r)?r.val([n]):this.field_is_checkbox(r)?r.each(function(){var t=o(this).attr("data-previous-value");t&&0<=t.indexOf(o(this).val().toLowerCase())&&o(this).prop("checked",!0)}):r.val(n))},hide_element:function(t,r){var n=this,e=n.get_relations(t);n.clear_value(t,r),e.forEach(function(t){var e="hide"===n.get_field_logic(t).action?"show":"hide";n.toggle_field(t,e,"valid"),n.has_relations(t)&&("hide"==e?n.hide_element(t,r):n.show_element(t,r))})},show_element:function(t,o){var a=this,s=a.get_relations(t);this.restore_value(t,o),this.textareaFix(this.$el,t,o),s.forEach(function(t){var e=a.get_field_logic(t),r=e.action,n=e.rule,e=e.conditions,i=0;e.forEach(function(t){a.is_applicable_rule(t,r)&&i++}),"all"===n&&i===e.length||"any"===n&&0<i?a.toggle_field(t,r,"valid"):a.toggle_field(t,r,"invalid"),a.has_relations(t)&&(s=a.show_element(t,o))})},paypal_button_condition:function(){var t=this.$el.find(".forminator-paypal-row"),e=this.$el.find(".forminator-pagination-footer").find(".forminator-button-paypal");0<t.length&&(this.$el.find(".forminator-button-submit").closest(".forminator-row").removeClass("forminator-hidden"),t.hasClass("forminator-hidden")||this.$el.find(".forminator-button-submit").closest(".forminator-row").addClass("forminator-hidden")),0<e.length&&(e.hasClass("forminator-hidden")?this.$el.find(".forminator-button-submit").removeClass("forminator-hidden"):this.$el.find(".forminator-button-submit").addClass("forminator-hidden"))},maybe_clear_upload_container:function(){this.$el.find('.forminator-row.forminator-hidden input[type="file"]').each(function(){""===o(this).val()&&(o(this).parent().hasClass("forminator-multi-upload")?o(this).parent().siblings(".forminator-uploaded-files").empty():(o(this).siblings("span").text(o(this).siblings("span").data("empty-text")),o(this).siblings(".forminator-button-delete").hide()))})},textareaFix:function(t,e,r){var n=o("#"+e+" .forminator-label");e.includes("textarea")&&t.hasClass("forminator-design--material")&&0<n.length&&(t=o("#"+e+" .forminator-textarea"),e=n.height()+9,n.css({"padding-top":e+"px"}),t.css({"padding-top":e+"px"}))},toggle_confirm_field:function(t,e,r){t="confirm_"+t;this.get_form_field(t).length&&this.toggle_field(t,e,r)}}),o.fn[n]=function(t,e){return this.each(function(){o.data(this,n)||o.data(this,n,new r(this,t,e))})}}(jQuery,window,document),function(b,y,g){"use strict";var r="forminatorFrontSubmit",n={form_type:"custom-form",forminatorFront:!1,forminator_selector:"",chart_design:"bar",chart_options:{}};function e(t,e){this.element=t,this.$el=b(this.element),this.forminatorFront=null,this.settings=b.extend({},n,e),this._defaults=n,this._name=r,this.init()}b.extend(e.prototype,{init:function(){switch(this.forminatorFront=this.$el.data("forminatorFront"),this.settings.form_type){case"custom-form":this.settings.forminator_selector&&b(this.settings.forminator_selector).length||(this.settings.forminator_selector=".forminator-custom-form"),this.handle_submit_custom_form();break;case"quiz":this.settings.forminator_selector&&b(this.settings.forminator_selector).length||(this.settings.forminator_selector=".forminator-quiz"),this.handle_submit_quiz();break;case"poll":this.settings.forminator_selector&&b(this.settings.forminator_selector).length||(this.settings.forminator_selector=".forminator-poll"),this.handle_submit_poll()}},decodeHtmlEntity:function(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(e)})},addCountryCode:function(t){t.find(".forminator-field--phone").each(function(){var t=b(this),e="enabled"===t.data("national_mode"),r=intlTelInput.getInstance(this);!e&&r&&(e="+"+r.getSelectedCountryData().dialCode,""===(r=t.val())||r.trim().startsWith("+")||(t.closest(".iti").find(".iti__selected-dial-code").hide(),t.css("padding-inline-start","45px"),t.val(e+" "+r)))})},handle_submit_custom_form:function(){var c=this,d=c.$el.find(".forminator-save-draft-link"),r=(c.$el.find(".forminator-response-message").find(".forminator-label--success").not(":hidden").length&&c.focus_to_element(c.$el.find(".forminator-response-message")),b(".def-ajaxloader").hide(),!1);b("body").on("click","#lostPhone",function(t){t.preventDefault();var e=b(this);!1===r&&(r=!0,b.ajax({type:"GET",url:e.attr("href"),beforeSend:function(){e.attr("disabled","disabled"),b(".def-ajaxloader").show()},success:function(t){e.removeAttr("disabled"),b(".def-ajaxloader").hide(),b(".notification").text(t.data.message),r=!1}}))}),b("body").on("click",".auth-back",function(t){t.preventDefault();t=c.$el.attr("id");b("#"+(t+"-authentication")+"-input").attr("disabled","disabled"),FUI.closeAuthentication()}),0!==d.length&&this.handle_submit_form_draft(),b("body").on("click",'.forminator-authentication-box button[type="submit"]',function(t){t.preventDefault(),b(this).closest("form").trigger("submit.frontSubmit","onSubmitAuthenticationBox")}),b("body").off("forminator:preSubmit:paypal",this.settings.forminator_selector).on("forminator:preSubmit:paypal",this.settings.forminator_selector,function(t,e){return c.processCaptcha(c,t,e,"")}),b("body").off("submit.frontSubmit",this.settings.forminator_selector),b("body").on("submit.frontSubmit",this.settings.forminator_selector,function(r,n){if(!c.$el.find(".forminator-button-submit").prop("disabled"))if(c.disable_form_submit(c,!0),0!==c.$el.find('input[type="hidden"][value="forminator_submit_preview_form_custom-forms"]').length)c.disable_form_submit(c,!1);else{var t,l=b(this),e=this,i=r,f=new FormData(this),u=l.find(".forminator-response-message"),o="true"===c.$el.find('input[name="save_draft"]').val(),a=b("body").find("#ui-datepicker-div.forminator-custom-form-"+c.$el.data("form-id"));if(c.addCountryCode(l),c.settings.inline_validation&&0<c.$el.find(".forminator-uploaded-files").length&&!o)if(0<c.$el.find(".forminator-uploaded-files li.forminator-has_error").length)return c.disable_form_submit(c,!1),!1;if(i.originalEvent!==g){var s=b(this).find(".forminator-button-submit").first();if(0===s.length||b(s).closest(".forminator-col").hasClass("forminator-hidden"))return c.disable_form_submit(c,!1),!1}0!==a.length&&c.$el.datepicker("widget").is(":visible")?c.disable_form_submit(c,!1):!c.$el.data("forminatorFrontPayment")&&!c.$el.data("forminatorFrontStripe")||o||(l.find(".forminator-button-submit").attr("disabled",!0),!1!==c.processCaptcha(c,r,u,n))?(c.multi_upload_disable(l,!0),t=function(){var s,t=c.$el.find(".forminator-pagination:visible"),e=!!t.length,t=t.index(".forminator-pagination");if(f=new FormData(this),o&&e&&f.append("draft_page",t),!c.$el.data("forminatorFrontPayment")&&!c.$el.data("forminatorFrontStripe")&&!o&&!1===c.processCaptcha(c,r,u,n))return c.disable_form_submit(c,!1),!1;c.$el.hasClass("forminator_ajax")||o?(u.html(""),c.$el.find(".forminator-button-submit").addClass("forminator-button-onload"),c.$el.find("input[type=file]").each(function(){""===b(this).val()&&"function"==typeof y.FormData.prototype.delete&&f.delete(b(this).attr("name"))}),void 0!==c.settings.has_loader&&c.settings.has_loader&&("login"!==c.$el.find('input[name="form_type"]').val()&&c.$el.addClass("forminator-fields-disabled"),u.html("<p>"+c.settings.loader_label+"</p>"),c.focus_to_element(u),u.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-success forminator-error forminator-accessible").addClass("forminator-loading forminator-show")),s=!1,r.preventDefault(),b.ajax({type:"POST",url:y.ForminatorFront.ajaxUrl,data:f,cache:!1,contentType:!1,processData:!1,beforeSend:function(){l.find("button").attr("disabled",!0),l.trigger("before:forminator:form:submit",f)},success:function(t){var e,r,n,i,o,a;return!t&&void 0!==t||"object"!=typeof t.data?(l.find("button").removeAttr("disabled"),u.addClass("forminator-error").html("<p>"+y.ForminatorFront.cform.error+"<br>("+t.data+")</p>"),c.focus_to_element(u),t.data&&l.trigger("forminator:form:submit:failed",[f,t.data]),!1):t.success&&g!==t.data.type&&"save_draft"===t.data.type?(c.showDraftLink(t.data),!1):(l.find(".forminator-error-message").not(".forminator-uploaded-files .forminator-error-message").remove(),l.find(".forminator-field").removeClass("forminator-has_error"),l.find("input, select, textarea").removeAttr("aria-invalid"),l.find("button").removeAttr("disabled"),u.html("").removeClass("forminator-accessible forminator-error forminator-success"),c.settings.hasLeads&&void 0!==t.data.entry_id?(c.showQuiz(c.$el),b("#forminator-module-"+c.settings.quiz_id+" input[name=entry_id]").val(t.data.entry_id),"end"===c.settings.form_placement&&b("#forminator-module-"+c.settings.quiz_id).submit(),!1):void 0===t||void 0===t.data||void 0===t.data.authentication||"show"!==t.data.authentication&&"invalid"!==t.data.authentication?(i=t.success?"forminator-success":"forminator-error",void 0!==t.message?(u.removeAttr("aria-hidden").prop("tabindex","-1").addClass(i+" forminator-show"),c.focus_to_element(u,!1,t.fadeout,t.fadeout_time),u.html(t.message),!t.data.success&&t.data.errors.length&&(n='<ul class="forminator-screen-reader-only">',b.each(t.data.errors,function(t,e){for(var r in e)e.hasOwnProperty(r)&&(n+="<li>"+e[r]+"</li>")}),n+="</ul>",u.append(n))):void 0!==t.data&&(o=!0,(o=void 0!==t.data.url&&void 0!==t.data.newtab&&"newtab_thankyou"!==t.data.newtab?!1:o)&&(u.removeAttr("aria-hidden").prop("tabindex","-1").addClass(i+" forminator-show"),c.focus_to_element(u,!1,t.data.fadeout,t.data.fadeout_time),u.html(t.data.message)),!t.data.success&&void 0!==t.data.errors&&t.data.errors.length&&(n='<ul class="forminator-screen-reader-only">',b.each(t.data.errors,function(t,e){for(var r in e)e.hasOwnProperty(r)&&(n+="<li>"+e[r]+"</li>")}),n+="</ul>",u.append(n)),void 0!==t.data.stripe3d?void 0!==t.data.subscription?l.trigger("forminator:form:submit:stripe:3dsecurity",[t.data.secret,t.data.subscription]):l.trigger("forminator:form:submit:stripe:3dsecurity",[t.data.secret,!1]):void 0!==t.data.redirect_to_url&&l.trigger("forminator:form:submit:stripe:redirect",[t.data.redirect_to_url,t.data.secret,t.data.subscription||""])),t.data.secret?!(s=!0):(t.data.success||(o=void 0!==t.data.errors&&t.data.errors.length?t.data.errors:"",l.trigger("forminator:form:submit:failed",[f,o]),c.multi_upload_disable(l,!1),o&&c.show_messages(o)),void(!0===t.success&&(i=void 0!==t.data.behav&&"behaviour-hide"===t.data.behav,o=void 0!==t.data.url&&void 0!==t.data.newtab&&"sametab"===t.data.newtab,a=c.settings.resetEnabled,l[0]&&a&&!i&&!o&&(l[0].reset(),c.$el.trigger("forminator:field:condition:toggled"),l.find(".forminator-field-signature img").trigger("click"),void 0!==t.data.select_field&&b.each(t.data.select_field,function(r,t){0<t.length&&b.each(t,function(t,e){e.value&&("multiselect"===e.type?l.find("#"+r+" input[value="+e.value+"]").closest(".forminator-option"):l.find("#"+r+" option[value="+e.value+"]")).remove().trigger("change")})}),l.find(".forminator-button-delete").hide(),l.find(".forminator-file-upload input").val(""),l.find(".forminator-file-upload > span").html(y.ForminatorFront.cform.no_file_chosen),l.find("ul.forminator-uploaded-files").html(""),c.$el.find("ul.forminator-uploaded-files").html(""),c.$el.find(".forminator-multifile-hidden").val(""),0<l.find(".forminator-select").length&&l.find(".forminator-select").each(function(t,e){var r=b(e).data("default-value");""===r&&(r=b(e).val()),b(e).val(r).trigger("fui:change")}),l.find(".multiselect-default-values").each(function(){var t=""!==b(this).val()?b.parseJSON(b(this).val()):[],r=Object.values(t);b(this).closest(".forminator-multiselect").find('input[type="checkbox"]').each(function(t,e){-1!==b.inArray(b(e).val(),r)?(b(e).prop("checked",!0),b(e).closest("label").addClass("forminator-is_checked")):(b(e).prop("checked",!1),b(e).closest("label").removeClass("forminator-is_checked"))})}),l.find(".forminator-slider").each(function(){var t=b(this).find(".forminator-slide"),e=t.slider("option"),r=parseInt(t.data("min"))||0,n=parseInt(t.data("max"))||100,r=parseInt(t.data("value"))||r,n=parseInt(t.data("value-max"))||n;e.create(),!0===e.range?t.slider("values",[r,n]):t.slider("value",r)}),c.multi_upload_disable(l,!1),l.trigger("forminator.front.condition.restart")),l.trigger("forminator:form:submit:success",f),void 0!==t.data.url&&(void 0!==t.data.newtab&&"sametab"!==t.data.newtab?("newtab_hide"===t.data.newtab&&c.$el.hide(),y.open(c.decodeHtmlEntity(t.data.url),"_blank")):y.location.href=c.decodeHtmlEntity(t.data.url)),i)&&(c.$el.find(".forminator-row").hide(),c.$el.find(".forminator-pagination-steps").hide(),c.$el.find(".forminator-pagination-footer").hide(),c.$el.find(".forminator-pagination-steps, .forminator-pagination-progress").hide())))):(a=c.$el.attr("id"),i=b("#"+(o=a+"-authentication")),e=b("#"+o+"-input"),r=b("#"+o+"-token"),i.find(".forminator-authentication-notice").removeClass("error"),i.find(".lost-device-url").attr("href",t.data.lost_url),"show"===t.data.authentication&&(c.$el.find(".forminator-authentication-nav").html("").append(t.data.auth_nav),c.$el.find(".forminator-authentication-box").hide(),"fallback-email"===t.data.auth_method&&(c.$el.find(".wpdef-2fa-email-resend input").click(),c.$el.find(".notification").hide()),c.$el.find("#forminator-2fa-"+t.data.auth_method).show(),c.$el.find(".forminator-authentication-box input").attr("disabled",!0),c.$el.find("#forminator-2fa-"+t.data.auth_method+" input").attr("disabled",!1),c.$el.find(".forminator-2fa-link").show(),c.$el.find("#forminator-2fa-link-"+t.data.auth_method).hide(),e.removeAttr("disabled").val(t.data.auth_method),r.val(t.data.auth_token),FUI.openAuthentication(o,a,o+"-input")),"invalid"===t.data.authentication&&(i.find(".forminator-authentication-notice").addClass("error"),i.find(".forminator-authentication-notice").html("<p>"+t.data.message+"</p>"),l.trigger("forminator:form:submit:failed",[f,t.data.message])),!1))},error:function(t){0!==d.length&&(c.$el.find('input[name="save_draft"]').val("false"),d.addClass("disabled")),l.find("button").removeAttr("disabled"),u.html("");t=400===t.status?y.ForminatorFront.cform.upload_error:y.ForminatorFront.cform.error;u.html('<label class="forminator-label--notice"><span>'+t+"</span></label>"),c.focus_to_element(u),l.trigger("forminator:form:submit:failed",[f,t]),c.multi_upload_disable(l,!1)},complete:function(t,e){if(s)return!1;c.$el.find(".forminator-button-submit").removeClass("forminator-button-onload"),l.trigger("forminator:form:submit:complete",f),c.showLeadsLoader(c)}}).always(function(){if(s)return!1;void 0!==c.settings.has_loader&&c.settings.has_loader&&(c.$el.removeClass("forminator-fields-disabled forminator-partial-disabled"),u.removeClass("forminator-loading")),0!==d.length&&(c.$el.find('input[name="save_draft"]').val("false"),d.addClass("disabled")),c.disable_form_submit(c,!1),l.trigger("after:forminator:form:submit",f)})):(void 0!==c.settings.has_loader&&c.settings.has_loader&&(c.$el.addClass("forminator-fields-disabled"),u.html("<p>"+c.settings.loader_label+"</p>"),u.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-success forminator-error forminator-accessible").addClass("forminator-loading forminator-show")),i.currentTarget.submit(),c.showLeadsLoader(c))},s=c.$el.find('div[data-is-payment="true"]').closest(".forminator-row, .forminator-col").hasClass("forminator-hidden"),!c.$el.data("forminatorFrontPayment")&&!c.$el.data("forminatorFrontStripe")||s||o?t.apply(e):setTimeout(function(){c.$el.trigger("payment.before.submit.forminator",[f,function(){t.apply(e)}])},200)):(l.find(".forminator-button-submit").attr("disabled",!1),c.disable_form_submit(c,!1))}return!1})},handle_submit_form_draft:function(){b("body").on("click",".forminator-save-draft-link",function(t){t.preventDefault(),t.stopPropagation();var t=b(this).closest("form"),e=t.find('input[name="save_draft"]');t.closest("#forminator-modal").hasClass("preview")||"true"===e.val()||b(this).hasClass("disabled")||(e.val("true"),t.trigger("submit.frontSubmit","draft_submit"))})},showDraftLink:function(t){var e=this.$el;e.trigger("forminator:form:draft:success",t),e.find(".forminator-response-message").html(""),e.hide(),b(t.message).insertBefore(e),this.sendDraftLink(t)},sendDraftLink:function(t){var l=this,t="#send-draft-link-form-"+t.draft_id;b("body").on("submit",t,function(t){var r=b(this),e=new FormData(this),n=r.find("#email-1"),i=n.find(".forminator-field"),o=r.find(".forminator-button-submit"),a=r.find(".forminator-response-message"),s=r.prev(".forminator-draft-email-response");if(b(this).hasClass("submitting")||b(this).hasClass("forminator-has_error")&&""===n.find('input[name="email-1"]').val())return!1;r.addClass("submitting"),o.attr("disabled",!0),r.removeClass("forminator-has_error"),i.removeClass("forminator-has_error"),i.find(".forminator-error-message").remove(),t.preventDefault(),b.ajax({type:"POST",url:y.ForminatorFront.ajaxUrl,data:e,cache:!1,contentType:!1,processData:!1,beforeSend:function(){r.trigger("before:forminator:draft:email:submit",e)},success:function(t){var e=t.data;if(!t&&void 0!==t||"object"!=typeof e)return o.removeAttr("disabled"),a.addClass("forminator-error").html("<p>"+y.ForminatorFront.cform.error+"<br>("+e+")</p>"),l.focus_to_element(a),!1;t.success||g===e.field||"email-1"!==e.field||i.hasClass("forminator-has_error")||(r.addClass("forminator-has_error"),i.addClass("forminator-has_error"),i.append('<span class="forminator-error-message" aria-hidden="true">'+e.message+"</span>")),t.success&&(e.draft_mail_sent?s.removeClass("draft-error").addClass("draft-success"):s.removeClass("draft-success").addClass("draft-error"),s.html(e.draft_mail_message),s.show(),r.hide())},error:function(t){r.removeClass("submitting"),o.removeAttr("disabled")}}).always(function(){r.removeClass("submitting"),o.removeAttr("disabled")}),s.on("click",".draft-resend-mail",function(t){t.preventDefault(),s.slideUp(50),r.show()})})},processCaptcha:function(t,e,r,n){if((i=t.$el.find(".forminator-g-recaptcha, .forminator-hcaptcha, .forminator-turnstile")).length){var i,o=(i=b(i.get(0))).data("size"),a=i.parent(".forminator-col");if(i.hasClass("forminator-g-recaptcha")){var s=i.data("forminator-recapchta-widget");if(("normal"===o||"compact"===o)&&"onSubmitAuthenticationBox"===n)return;if(0!==i.children().length){var l=y.grecaptcha.getResponse(s);if("invisible"===o&&"forminator:preSubmit:paypal"===e.type)return;if("invisible"===o&&0===l.length)return y.grecaptcha.execute(s),!1;if("forminator:submit:paypal"===n)return y.grecaptcha.reset(s),!0;t.$el.hasClass("forminator_ajax")&&"forminator:preSubmit:paypal"!==e.type&&y.grecaptcha.reset(s)}}else if(i.hasClass("forminator-hcaptcha")){s=i.data("forminator-hcaptcha-widget"),l=hcaptcha.getResponse(s);if("invisible"===o&&0===l.length)return hcaptcha.execute(s),!1;if("forminator:submit:paypal"===n)return hcaptcha.reset(s),!0;t.$el.hasClass("forminator_ajax")&&"forminator:preSubmit:paypal"!==e.type&&hcaptcha.reset(s)}else if(i.hasClass("forminator-turnstile")){s=i.data("forminator-turnstile-widget"),l=i.find('input[name="forminator-turnstile-response"]').val();if("forminator:submit:paypal"===n)return turnstile.reset(s),!0;t.$el.hasClass("forminator_ajax")&&"forminator:preSubmit:paypal"!==e.type&&turnstile.reset(s)}if(r.html(""),i.hasClass("error")&&i.removeClass("error"),!l||0===l.length)return i.hasClass("error")||i.addClass("error"),r.removeAttr("aria-hidden").html('<label class="forminator-label--error forminator-invalid-captcha"><span>'+y.ForminatorFront.cform.captcha_error+"</span></label>"),t.settings.inline_validation?a.hasClass("forminator-has_error")||"invisible"===i.data("size")||(a.addClass("forminator-has_error").append('<span class="forminator-error-message forminator-invalid-captcha" aria-hidden="true">'+y.ForminatorFront.cform.captcha_error+"</span>"),t.focus_to_element(a)):t.focus_to_element(r),!1}},hideForm:function(t){t.css({height:0,opacity:0,overflow:"hidden",visibility:"hidden","pointer-events":"none",margin:0,padding:0,border:0,display:"none"})},showForm:function(t){t.css({height:"",opacity:"",overflow:"",visibility:"","pointer-events":"",margin:"",padding:"",border:"",display:"block"})},showQuiz:function(t){var e=b("#forminator-module-"+this.settings.quiz_id),r=b("#forminator-quiz-leads-"+this.settings.quiz_id);this.hideForm(t),r.find(".forminator-lead-form-skip").hide(),void 0!==this.settings.form_placement&&"beginning"===this.settings.form_placement&&(this.showForm(e),e.find(".forminator-pagination").length)&&(r.find(".forminator-quiz-intro").hide(),e.prepend('<button class="forminator-button forminator-quiz-start forminator-hidden"></button>').find(".forminator-quiz-start").trigger("click").remove())},handle_submit_quiz:function(t){var m=this,u=void 0!==m.settings.hasLeads&&m.settings.hasLeads,h=void 0!==m.settings.leads_id?m.settings.leads_id:0,p=void 0!==m.settings.quiz_id?m.settings.quiz_id:0;b("body").on("submit.frontSubmit",this.settings.forminator_selector,function(t){if(0===m.$el.find('input[type="hidden"][value="forminator_submit_preview_form_quizzes"]').length){var e,r=b(this),n=new FormData(this),i=r.find(".forminator-answer"),o=m.$el.find(".forminator-button").last(),a=m.$el.find(".forminator-quiz--result"),s=o.data("loading"),l=void 0!==m.settings.form_placement?m.settings.form_placement:"",f=void 0!==m.settings.skip_form?m.settings.skip_form:"",c=m.$el.find(".forminator-response-message");if(t.preventDefault(),t.stopPropagation(),m.$el.find(".forminator-has-been-disabled").removeAttr("disabled"),e=r.serialize(),m.$el.find(".forminator-has-been-disabled").attr("disabled","disabled"),u){t="";if(0<m.$el.find("input[name=entry_id]").length&&(t=m.$el.find("input[name=entry_id]").val()),"end"===l&&""===t)return m.showForm(b("#forminator-module-"+h)),a.addClass("forminator-hidden"),b("#forminator-quiz-leads-"+p+" .forminator-lead-form-skip").show(),!1;if(!f&&""===t)return!1}""!==s&&o.text(s),m.settings.has_quiz_loader&&i.each(function(){var t=b(this),e=t.find("input"),t=t.find(".forminator-answer--status");e.is(":checked")&&0===t.html().length&&t.html('<i class="forminator-icon-loader forminator-loading"></i>')});var d=!!m.$el.find(".forminator-pagination");b.ajax({type:"POST",url:y.ForminatorFront.ajaxUrl,data:e,beforeSend:function(){d||m.$el.find("button").attr("disabled","disabled"),r.trigger("before:forminator:quiz:submit",[e,n])},success:function(u){var t;u.success?(t="",a.removeClass("forminator-hidden"),y.history.pushState("forminator","Forminator",u.data.result_url),"nowrong"===u.data.type?(t=u.data.result,a.html(t),d||m.$el.find(".forminator-answer input").attr("disabled","disabled")):"knowledge"===u.data.type&&(t=u.data.finalText,0<a.length&&a.html(t),Object.keys(u.data.result).forEach(function(t){var e,r=m.$el.find("#"+t),n=r.find(".forminator-question--result"),i=r.find(".forminator-submit-rightaway"),o=r.find(".forminator-answer input"),a=u.data.result[t].isCorrect?(e="forminator-is_correct",'<i class="forminator-icon-check"></i>'):(e="forminator-is_incorrect",'<i class="forminator-icon-cancel"></i>');if(n.text(u.data.result[t].message),n.addClass("forminator-show"),i.attr("disabled",!0),i.attr("aria-disabled",!0),o.attr("disabled",!0),o.attr("aria-disabled",!0),g===u.data.result[t].answer)for(var s,l=u.data.result[t].answers,f=0;f<l.length;f++)(s=r.find('[id|="'+l[f].id+'"]').closest(".forminator-answer")).addClass(e),(0===s.find(".forminator-answer--status").html().length||0!==s.find(".forminator-answer--status .forminator-icon-loader").length)&&s.find(".forminator-answer--status").html(a);else(s=r.find('[id|="'+u.data.result[t].answer+'"]').closest(".forminator-answer")).addClass(e),0!==s.find(".forminator-answer--status").html().length&&0===s.find(".forminator-answer--status .forminator-icon-loader").length||s.find(".forminator-answer--status").html(a)})),r.trigger("forminator:quiz:submit:success",[e,n,t]),0===a.find(".forminator-quiz--summary").length||a.parent().hasClass("forminator-pagination--content")||m.focus_to_element(a.find(".forminator-quiz--summary"))):(m.$el.find("button").removeAttr("disabled"),c.removeClass("forminator-hidden"),c.html(u.data.error),m.focus_to_element(c),r.trigger("forminator:quiz:submit:failed",[e,n]))}}).always(function(){r.trigger("after:forminator:quiz:submit",[e,n]),r.nextAll(".leads-quiz-loader").remove()})}return!1}),b("body").on("click","#forminator-quiz-leads-"+p+" .forminator-lead-form-skip",function(t){m.showQuiz(b("#forminator-module-"+h)),void 0!==m.settings.form_placement&&"end"===m.settings.form_placement&&(m.settings.form_placement="skip",m.$el.submit())}),b("body").on("click",".forminator-result--retake",function(t){var e={action:"forminator_reload_quiz",pageId:m.$el.find('input[name="page_id"]').val(),moduleId:m.$el.find('input[name="form_id"]').val(),nonce:m.$el.find('input[name="forminator_nonce"]').val()};t.preventDefault(),b.post(y.ForminatorFront.ajaxUrl,e,function(t){1==t.success&&t.html&&y.location.replace(t.html)})})},handle_submit_poll:function(){var u=this,c=u.$el.html();u.$el.find(".forminator-response-message").not(":hidden").length&&u.focus_to_element(u.$el.find(".forminator-response-message"),!0),b("body").on("submit.frontSubmit",this.settings.forminator_selector,function(t){var r,n,i,o,a,s;return 0===u.$el.find('input[type="hidden"][value="forminator_submit_preview_form_poll"]').length&&(r=b(this),n=new FormData(this),i=r.serialize(),o=u.$el.find(".forminator-response-message"),a=u.$el.find("fieldset"),s=u.$el.find(".forminator-button"),!u.$el.hasClass("forminator_ajax")||(l(),b.ajax({type:"POST",url:y.ForminatorFront.ajaxUrl,data:i,beforeSend:function(){s.addClass("forminator-onload"),r.trigger("before:forminator:poll:submit",[i,n])},success:function(t){var e=t.success?"success":"error";s.removeClass("forminator-onload"),!1===t.success?(f(t.data.message,e),r.trigger("forminator:poll:submit:failed",[i,n])):void 0!==t.data&&(e=t.data.success?"success":"error",f(t.data.message,e),setTimeout(function(){l()},2500)),!0===t.success&&(void 0!==t.data.url?y.location.href=t.data.url:void 0!==t.data.chart_data&&1<t.data.chart_data.length&&("link_on"===t.data.results_behav&&r.find(".forminator-note").length&&(r.find(".forminator-note").remove(),r.find(".forminator-poll-footer").append(t.data.results_link)),"show_after"===t.data.results_behav)&&u.render_poll_chart(t.data.chart_data,t.data.back_button,u,c,[t.data.votes_text,t.data.votes_count,[t.data.grids_color,t.data.labels_color,t.data.onchart_label],[t.data.tooltips_bg,t.data.tooltips_color]]),r.trigger("forminator:poll:submit:success",[i,n]))},error:function(){l(),s.removeClass(".forminator-onload"),r.trigger("forminator:poll:submit:failed",[i,n])}}).always(function(){r.trigger("after:forminator:poll:submit",[i,n])}),!1));function l(){o.html(""),o.removeClass("forminator-show"),o.removeClass("forminator-error"),o.removeClass("forminator-success"),o.removeAttr("tabindex"),o.attr("aria-hidden",!0),a.removeClass("forminator-has_error")}function f(t,e){o.html("<p>"+t+"</p>"),o.addClass("forminator-"+e),o.addClass("forminator-show"),o.removeAttr("aria-hidden"),o.attr("tabindex","-1"),o.focus(),"error"!==e||a.find('input[type="radio"]').is(":checked")||a.addClass("forminator-has_error")}})},render_poll_chart:function(t,e,r,n,i){var o,a,s="forminator-chart-poll-"+(r.$el.attr("id")+"-"+r.$el.data("forminatorRender")),l=r.$el.find(".forminator-poll-body"),f=r.$el.find(".forminator-poll-footer");a=r.$el.find(".forminator-chart-wrapper"),o=r.$el.find(".forminator-chart"),a.remove(),o.remove(),a=b('<canvas id="'+s+'" class="forminator-chart" role="img" aria-hidden="true"></canvas>'),l.append(a),FUI.pollChart("#"+s,t,r.settings.chart_design,i),(o=l.find(".forminator-field")).hide(),o.attr("aria-hidden","true"),a=r.$el.find(".forminator-chart"),((s=r.$el.find(".forminator-chart-wrapper")).length?(a.addClass("forminator-show"),s.addClass("forminator-show"),s.removeAttr("aria-hidden"),s.attr("tabindex","-1"),s):(a.html("<p>Fallback text...</p>"),a.addClass("forminator-show"),a.removeAttr("aria-hidden"),a.attr("tabindex","-1"),a)).focus(),t=b(e),f.empty(),f.append(t),r.$el.find(".forminator-button").click(function(t){r.$el.hasClass("forminator_ajax")?r.$el.html(n):location.reload(),t.preventDefault()})},focus_to_element:function(t,e,r,n){r=r||!1,n=n||0,e=e||!1;var i="html,body";function o(t){!t.attr("tabindex")&&t.is("div")&&t.attr("tabindex",-1),t.hasClass("forminator-select2")||t.focus(),r&&t.show().delay(n).fadeOut("slow")}0<t.closest(".sui-dialog").length&&(i=".sui-dialog"),0<t.closest(".wph-modal").length&&(i=".wph-modal"),t.hasClass("forminator-textarea")||t.parent(".wp-editor-container").length?t.hasClass("forminator-textarea")&&t.parent(".wp-editor-container").length&&(t=t.parent(".wp-editor-container")):t.show(),e?o(t):b(i).animate({scrollTop:t.offset().top-(b(y).height()-t.outerHeight(!0))/2},500,function(){o(t)})},show_messages:function(t){var d,m=this,h=m.$el.data("forminatorFrontCondition");return void 0!==h&&(this.$el.find(".forminator-error-message").remove(),d=0,t.forEach(function(t){var e=Object.keys(t),e=h.get_form_field(e),r=b(e),n=r.closest(".forminator-field"),i=r.closest(".forminator-date-input"),o=r.closest(".forminator-timepicker"),a=!1,s=!1,l=!1,f=r.attr("id")+"-error",u=r.attr("aria-describedby"),t=Object.values(t),c='<span class="forminator-error-message" id="'+f+'"></span>';e.length&&(0===d&&(m.$el.trigger("forminator.front.pagination.focus.input",[e]),m.focus_to_element(e)),(0<i.length?(s=(a=i.parent()).find('.forminator-error-message[data-error-field="'+r.data("field")+'"]'),l=a.find(".forminator-description"),c='<span class="forminator-error-message" data-error-field="'+r.data("field")+'" id="'+f+'"></span>',0===s.length&&("day"===r.data("field")&&(a.find('.forminator-error-message[data-error-field="year"]').length?b(c).insertBefore(a.find('.forminator-error-message[data-error-field="year"]')):0===l.length?a.append(c):b(c).insertBefore(l),0===n.find(".forminator-error-message").length)&&n.append('<span class="forminator-error-message" id="'+f+'"></span>'),"month"===r.data("field")&&(a.find('.forminator-error-message[data-error-field="day"]').length?b(c).insertBefore(a.find('.forminator-error-message[data-error-field="day"]')):0===l.length?a.append(c):b(c).insertBefore(l),0===n.find(".forminator-error-message").length)&&n.append('<span class="forminator-error-message" id="'+f+'"></span>'),"year"===r.data("field"))&&(0===l.length?a.append(c):b(c).insertBefore(l),0===n.find(".forminator-error-message").length)&&n.append('<span class="forminator-error-message" id="'+f+'"></span>'),a.find('.forminator-error-message[data-error-field="'+r.data("field")+'"]').html(t),n.find(".forminator-error-message")):0<o.length&&0<t[0].length?(s=(a=o.parent()).find('.forminator-error-message[data-error-field="'+r.data("field")+'"]'),l=a.find(".forminator-description"),c='<span class="forminator-error-message" data-error-field="'+r.data("field")+'" id="'+f+'"></span>',0===s.length&&("hours"===r.data("field")&&(a.find('.forminator-error-message[data-error-field="minutes"]').length?b(c).insertBefore(a.find('.forminator-error-message[data-error-field="minutes"]')):0===l.length?a.append(c):b(c).insertBefore(l),0===n.find(".forminator-error-message").length)&&n.append('<span class="forminator-error-message" id="'+f+'"></span>'),"minutes"===r.data("field"))&&(0===l.length?a.append(c):b(c).insertBefore(l),0===n.find(".forminator-error-message").length)&&n.append('<span class="forminator-error-message" id="'+f+'"></span>'),a.find('.forminator-error-message[data-error-field="'+r.data("field")+'"]').html(t),n.find(".forminator-error-message")):(s=n.find(".forminator-error-message"),l=n.find(".forminator-description"),0===s.length&&(0===l.length?n.append(c):b(c).insertBefore(l)),n.find(".forminator-error-message"))).html(t),u?((e=u.split(" ")).includes(f)||e.push(f),i=e.join(" "),r.attr("aria-describedby",i)):r.attr("aria-describedby",f),r.attr("aria-invalid","true"),n.addClass("forminator-has_error"),d++)})),this},multi_upload_disable:function(t,e){t.find(".forminator-multi-upload input").each(function(){"ajax"===b(this).data("method")&&b(this).attr("disabled",e)})},disable_form_submit:function(t,e){t.$el.find(".forminator-button-submit").prop("disabled",e)},showLeadsLoader:function(t){t.settings.hasLeads&&"end"===t.settings.form_placement&&b("#forminator-quiz-leads-"+t.settings.quiz_id).append('<div class="leads-quiz-loader forminator-response-message"><i class="forminator-icon-loader forminator-loading" aria-hidden="true"></i><style>.leads-quiz-loader{padding:20px;text-align:center;}.leads-quiz-loader .forminator-loading:before{display:block;}</style></div>')}}),b.fn[r]=function(t){return this.each(function(){b.data(this,r)||b.data(this,r,new e(this,t))})}}(jQuery,window,void document),function(m,h,i){"use strict";var r="forminatorFrontMultiFile",n={},p=[],b=[];function e(t,e){this.element=t,this.$el=m(this.element),this.form=m.extend({},n,e),this._defaults=n,this._name=r,this.form_id=0,this.uploader=this.$el,this.element=this.uploader.data("element"),this.init()}m.extend(e.prototype,{init:function(){var o=this,a=[],s=[];0<this.form.find("input[name=form_id]").length&&(this.form_id=this.form.find("input[name=form_id]").val()),p[this.form_id]=p[this.form_id]||0,b[this.form_id]=b[this.form_id]||0,this.uploader.on("drag dragstart dragend dragover dragenter dragleave drop",function(t){t.preventDefault(),t.stopPropagation()}),this.uploader.on("dragover dragenter",function(t){m(this).addClass("forminator-dragover")}),this.uploader.on("dragleave dragend drop",function(t){m(this).removeClass("forminator-dragover")}),this.uploader.find(".forminator-upload-file--forminator-field-"+this.element).on("click",function(t){o.form.find(".forminator-field-"+o.element+"-"+o.form_id).click()}),this.uploader.on("drop",function(t){i.querySelector(".forminator-field-"+o.element+"-"+o.form_id).files=t.originalEvent.dataTransfer.files,o.form.find(".forminator-field-"+o.element+"-"+o.form_id).change()}),this.uploader.on("click",function(t){t.target===t.currentTarget&&o.form.find(".forminator-field-"+o.element+"-"+o.form_id).click()}),this.uploader.find(".forminator-multi-upload-message, .forminator-multi-upload-message p, .forminator-multi-upload-message .forminator-icon-upload").on("click",function(t){t.target===t.currentTarget&&o.form.find(".forminator-field-"+o.element+"-"+o.form_id).click()}),this.form.on("forminator:form:submit:success",function(t){a=[]}),this.form.on("forminator.front.pagination.buttons.updated",function(t){0<o.form.find(".forminator-button-submit").length&&p[o.form_id]!==b[o.form_id]?o.form.find(".forminator-button-submit").attr("disabled",!0).attr("data-uploading",!0):0<o.form.find(".forminator-button-next").length&&"true"===o.form.find(".forminator-button-next").attr("data-uploading")&&o.form.find(".forminator-button-next").attr("disabled",!1).removeAttr("data-uploading")}),this.form.find(".forminator-field-"+o.element+"-"+o.form_id).on("change",function(t){var r,n,i;o.uploadingFile||(o.uploadingFile=1,r=m(this),n=this.files,i=[],m.when().then(function(){r.closest(".forminator-field").removeClass("forminator-has_error");for(var t=0;t<n.length;t++)i.push(n[t]),a.push(n[t]);s=o.handleChangeCallback(i,r,s);var e=Array.prototype.slice.call(a);0<e.length&&(n=o.FileObjectItem(e),"submission"===r.data("method"))&&r.prop("files",n)}).done(function(){o.uploadingFile=null}))}),this.delete_files(a,s)},handleChangeCallback:function(t,s,l){var f=this,u=new FormData,e=this.form.find('input[name="forminator_nonce"]').val(),c=s.data("method"),d=(d=f.element).split("_")[0];return u.append("action","forminator_multiple_file_upload"),u.append("form_id",this.form_id),u.append("element_id",d),u.append("nonce",e),m.each(t,function(t,n){var e,i=f.progress_bar(n,c),r=f.form.find(".upload-container-"+f.element+" li").length,o=void 0!==s.data("filetype")?s.data("filetype"):"",o=new RegExp("(.*?).("+o+")$"),a=n.name.toLowerCase();void 0!==s.data("size")&&s.data("size")<=n.size?(e=s.data("size-message"),f.upload_fail_response(i,e)):o.test(a)?"ajax"===c?(u.delete(f.element),u.delete("totalFiles"),u.append("totalFiles",r),u.append(d,n),l.push(m.ajax({xhr:function(){var t=new h.XMLHttpRequest;return t.upload.addEventListener("progress",function(t){t.lengthComputable&&(t=t.loaded/t.total*100)<90&&f.form.find("#"+i+" .progress-percentage").html(Math.round(t)+"% of ")},!1),t},type:"POST",url:h.ForminatorFront.ajaxUrl,data:u,cache:!1,contentType:!1,processData:!1,beforeSend:function(){f.form.find(".forminator-button-submit").attr("disabled",!0).attr("data-uploading",!0),f.$el.trigger("before:forminator:multiple:upload",u),p[f.form_id]++},success:function(t){var e=f.element,r={success:t.success,message:"undefined"!==t.data.message?t.data.message:"",file_id:i,file_name:void 0!==t.data.file_url?t.data.file_url.replace(/^.*[\\\/]/,""):n.name,mime_type:n.type};f.add_upload_file(e,r),!0===t.success&&!0===t.data.success&&void 0!==t.data?(f.upload_success_response(i),f.$el.trigger("success:forminator:multiple:upload",u)):(f.upload_fail_response(i,t.data.message),void 0!==t.data.error_type&&"limit"===t.data.error_type&&f.form.find("#"+i).addClass("forminator-upload-limit_error"),f.$el.trigger("fail:forminator:multiple:upload",u))},complete:function(t,e){b[f.form_id]++,p[f.form_id]===b[f.form_id]&&f.form.find(".forminator-button-submit").attr("disabled",!1).removeAttr("data-uploading"),f.$el.trigger("complete:forminator:multiple:upload",u)},error:function(t){f.upload_fail_response(i,h.ForminatorFront.cform.process_error)}}))):(o=!0,e=h.ForminatorFront.cform.process_error,void 0!==s.data("limit")&&s.data("limit")<r&&(o=!1,f.form.find("#"+i).addClass("forminator-upload-limit_error"),e=s.data("limit-message")),o?f.upload_success_response(i):f.upload_fail_response(i,e)):(e="."+a.split(".").pop()+" "+s.data("filetype-message"),f.upload_fail_response(i,e))}),l},upload_fail_response:function(t,e){this.form.trigger("validation:error"),this.form.find("#"+t).addClass("forminator-has_error"),this.form.find("#"+t).find('.forminator-uploaded-file--size [class*="forminator-icon-"]').addClass("forminator-icon-warning").removeClass("forminator-icon-loader").removeClass("forminator-loading"),this.form.find("#"+t+" .progress-percentage").html("0% of "),this.form.find("#"+t+" .forminator-uploaded-file--content").after('<div class="forminator-error-message">'+e+"</div>")},upload_success_response:function(t){this.form.find("#"+t+" .progress-percentage").html("100% of "),this.form.find("#"+t+' .forminator-uploaded-file--size [class*="forminator-icon-"]').remove(),this.form.find("#"+t+" .progress-percentage").remove()},progress_bar:function(t,e){var r="upload-process-"+Math.random().toString(36).substr(2,7),n=t.name,i=this.bytes_to_size(t.size,2),o=this.uploader.closest(".forminator-field").find(".forminator-uploaded-files"),a="";this.progress_image_preview(t,r);t='<div class="forminator-uploaded-file--preview" aria-hidden="true"><span class="forminator-icon-file" aria-hidden="true"></span></div>',function(t){switch((t=(t=t).split("."))[t.length-1].toLowerCase()){case"jpg":case"jpe":case"jpeg":case"png":case"gif":case"ico":return 1}}(n)&&(t='<div class="forminator-uploaded-file--image" aria-hidden="true"><div class="forminator-img-preview" role="image"></div></div>'),n='<p class="forminator-uploaded-file--title">'+n.replace(/[<>:"/\\|?*]+/g,"_")+"</p>",a=(a=(a=(a='<li id="'+r+'" class="forminator-uploaded-file"><div class="forminator-uploaded-file--content">')+t+'<div class="forminator-uploaded-file--text">')+n+'<p class="forminator-uploaded-file--size"><span class="forminator-icon-loader forminator-loading" aria-hidden="true"></span><span class="progress-percentage">29% of </span>'+i+"</p>")+'</div><button type="button" class="forminator-uploaded-file--delete forminator-button-delete" data-method="'+e+'" data-element="'+this.element+'" data-value="'+r+'"><span class="forminator-icon-close" aria-hidden="true"></span><span class="forminator-screen-reader-only">Delete uploaded file</span></button></div></li>';return o.hasClass(".forminator-has-files")||o.addClass("forminator-has-files"),o.append(a),r},bytes_to_size:function(t,e){var r;return 0===t?"0 Bytes":(e=e<0?0:e,r=Math.floor(Math.log(t)/Math.log(1024)),parseFloat((t/Math.pow(1024,r)).toFixed(e))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r])},progress_image_preview:function(t,e){var r;t&&((r=new FileReader).onload=function(t){m("#"+e+" .forminator-img-preview").css("background-image","url("+t.target.result+")")},r.readAsDataURL(t))},get_uplaoded_files:function(){var t=this.form.find(".forminator-multifile-hidden").val();return void 0===t||""===t?{}:m.parseJSON(t)},get_uplaoded_file:function(t){var e=this.get_uplaoded_files();return void 0===e[t]&&(e[t]=[]),e[t]},add_upload_file:function(t,e){var r=this.get_uplaoded_file(t);r.unshift(e),this.set_upload_file(t,r)},set_upload_file:function(t,e){var r=this.get_uplaoded_files(),n=this.form.find(".forminator-multifile-hidden");r[t]=e,n.val(JSON.stringify(r))},get_uploaded_file_id:function(t,r){var n=null,t=this.get_uplaoded_file(t);return m.each(t,function(t,e){r===e.file_id&&(n=t)}),n},delete_files:function(l,f){var u=this;m(i).on("click",".forminator-uploaded-file--delete",function(t){t.preventDefault();var e,r,n,t=m(this),i=t.data("value"),o=t.data("method"),a=t.data("element"),s=(void 0!==i&&void 0!==a&&void 0!==o&&(e=u.form.find("#"+i).index(),t=m(t).closest("li#"+i),r=u.get_uplaoded_files(),n=u.form.find(".forminator-multifile-hidden"),r&&"ajax"===o&&(void 0!==f[e]&&(f[e].abort(),f.splice(e,1)),void 0!==n)&&(""!==(i=u.get_uploaded_file_id(a,i))&&null!==i&&r[a].splice(i,1),n.val(JSON.stringify(r))),void 0!==o&&"submission"===o&&u.remove_object(e,l,a),m(t).remove()),u.form.find(".forminator-field-"+a+"-"+u.form_id)),i=u.form.find(".upload-container-"+a+" li");void 0!==s.data("limit")&&(m.each(i,function(t){s.data("limit")>t&&m(this).hasClass("forminator-upload-limit_error")&&(t=m(this).attr("id"),t=u.get_uploaded_file_id(a,t),m(this).removeClass("forminator-has_error"),m(this).find(".forminator-error-message, .forminator-icon-warning, .progress-percentage").remove(),""!==t)&&null!==t&&void 0!==r[a][t]&&(r[a][t].success=!0)}),n.val(JSON.stringify(r))),0===i.length&&s.val(""),0===u.form.find(".forminator-uploaded-file.forminator-has_error").length&&(u.form.trigger("forminator:uploads:valid"),u.form.find(".forminator-button-submit").attr("disabled",!1))})},remove_object:function(t,e,r){var n,r=i.querySelector(".forminator-field-"+r+"-"+this.form_id);void 0!==r&&0<(n=r.files).length&&(n=Array.prototype.slice.call(n),e.splice(t,1),n.splice(t,1),r.files=this.FileObjectItem(n))},FileObjectItem:function(t){for(var e,r=e=(t=(t=[].slice.call(Array.isArray(t)?t:arguments)).reverse()).length,n=!0;r--&&n;)n=t[r]instanceof File;if(!n)throw new TypeError("expected argument to FileList is File or array of File objects");for(r=new ClipboardEvent("").clipboardData||new DataTransfer;e--;)r.items.add(t[e]);return r.files}}),m.fn[r]=function(t){return this.each(function(){m.data(this,r)||m.data(this,r,new e(this,t))})}}(jQuery,window,document); front.calculator.js 0000644 00000545504 15162272025 0010401 0 ustar 00 (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorParser = _interopRequireDefault(require("./parser/front.calculator.parser.tokenizer")); var _frontCalculatorSymbol = _interopRequireDefault(require("./symbol/front.calculator.symbol.loader")); var _frontCalculator = _interopRequireDefault(require("./parser/front.calculator.parser")); var _frontCalculatorSymbol2 = _interopRequireDefault(require("./symbol/front.calculator.symbol.number")); var _frontCalculatorSymbolConstant = _interopRequireDefault(require("./symbol/abstract/front.calculator.symbol.constant.abstract")); var _frontCalculatorParserNode = _interopRequireDefault(require("./parser/node/front.calculator.parser.node.symbol")); var _frontCalculatorSymbolOperator = _interopRequireDefault(require("./symbol/abstract/front.calculator.symbol.operator.abstract")); var _frontCalculatorSymbol3 = _interopRequireDefault(require("./symbol/front.calculator.symbol.separator")); var _frontCalculatorParserNode2 = _interopRequireDefault(require("./parser/node/front.calculator.parser.node.function")); var _frontCalculatorParserNode3 = _interopRequireDefault(require("./parser/node/front.calculator.parser.node.container")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /********** * Attempt to rewrite Forminator_Calculator backend * * @see Forminator_Calculator * ***********/ var FrontCalculator = exports.default = /*#__PURE__*/function () { /** * * @param {string} term */ function FrontCalculator(term) { _classCallCheck(this, FrontCalculator); /** * * @type {string} */ this.term = term; /** * * @type {FrontCalculatorParserTokenizer} */ this.tokenizer = new _frontCalculatorParser.default(this.term); /** * * @type {FrontCalculatorSymbolLoader} */ this.symbolLoader = new _frontCalculatorSymbol.default(); /** * * @type {FrontCalculatorParser} */ this.parser = new _frontCalculator.default(this.symbolLoader); } /** * * @returns {FrontCalculatorParserNodeContainer} */ _createClass(FrontCalculator, [{ key: "parse", value: function parse() { // reset this.tokenizer.input = this.term; this.tokenizer.reset(); var tokens = this.tokenizer.tokenize(); if (tokens.length === 0) { throw 'Error: Empty token of calculator term.'; } var rootNode = this.parser.parse(tokens); if (rootNode.isEmpty()) { throw 'Error: Empty nodes of calculator tokens.'; } return rootNode; } /** * * @returns {number} */ }, { key: "calculate", value: function calculate() { var result = 0; var rootNode = this.parse(); if (false === rootNode) { return result; } return this.calculateNode(rootNode); } /** *Calculates the numeric value / result of a node of * any known and calculable type. (For example symbol * nodes with a symbol of type separator are not * calculable.) * * @param {FrontCalculatorParserNodeAbstract} node * * @returns {number} */ }, { key: "calculateNode", value: function calculateNode(node) { if (node instanceof _frontCalculatorParserNode.default) { return this.calculateSymbolNode(node); } else if (node instanceof _frontCalculatorParserNode2.default) { return this.calculateFunctionNode(node); } else if (node instanceof _frontCalculatorParserNode3.default) { return this.calculateContainerNode(node); } else { throw 'Error: Cannot calculate node of unknown type "' + node.constructor.name + '"'; } } /** * This method actually calculates the results of every sub-terms * in the syntax tree (which consists of nodes). * It can call itself recursively. * Attention: $node must not be of type FunctionNode! * * @param {FrontCalculatorParserNodeContainer} containerNode * * @returns {number} */ }, { key: "calculateContainerNode", value: function calculateContainerNode(containerNode) { if (containerNode instanceof _frontCalculatorParserNode2.default) { throw 'Error: Expected container node but got a function node'; } var result = 0; var nodes = containerNode.childNodes; var orderedOperatorNodes = this.detectCalculationOrder(nodes); // Actually calculate the term. Iterates over the ordered operators and // calculates them, then replaces the parts of the operation by the result. for (var i = 0; i < orderedOperatorNodes.length; i++) { var operatorNode = orderedOperatorNodes[i].node; var index = orderedOperatorNodes[i].index; var leftOperand = null; var leftOperandIndex = null; var nodeIndex = 0; while (nodeIndex !== index) { if (nodes[nodeIndex] === undefined) { nodeIndex++; continue; } leftOperand = nodes[nodeIndex]; leftOperandIndex = nodeIndex; nodeIndex++; } nodeIndex++; while (nodes[nodeIndex] === undefined) { nodeIndex++; } var rightOperand = nodes[nodeIndex]; var rightOperandIndex = nodeIndex; var rightNumber = !isNaN(rightOperand) ? rightOperand : this.calculateNode(rightOperand); /** * @type {FrontCalculatorSymbolOperatorAbstract} */ var symbol = operatorNode.symbol; if (operatorNode.isUnaryOperator) { result = symbol.operate(null, rightNumber); // Replace the participating symbols of the operation by the result delete nodes[rightOperandIndex]; // `delete` operation only set the value to empty, not `actually` remove it nodes[index] = result; } else { if (leftOperandIndex !== null && leftOperand !== null) { var leftNumber = !isNaN(leftOperand) ? leftOperand : this.calculateNode(leftOperand); result = symbol.operate(leftNumber, rightNumber); // Replace the participating symbols of the operation by the result delete nodes[leftOperandIndex]; delete nodes[rightOperandIndex]; nodes[index] = result; } } } //cleanup empty nodes nodes = nodes.filter(function (node) { return node !== undefined; }); if (nodes.length === 0) { throw 'Error: Missing calculable subterm. Are there empty brackets?'; } if (nodes.length > 1) { throw 'Error: Missing operators between parts of the term.'; } // The only remaining element of the $nodes array contains the overall result result = nodes.pop(); // If the $nodes array did not contain any operator (but only one node) than // the result of this node has to be calculated now if (isNaN(result)) { return this.calculateNode(result); } return result; } /** * Returns the numeric value of a function node. * @param {FrontCalculatorParserNodeFunction} functionNode * * @returns {number} */ }, { key: "calculateFunctionNode", value: function calculateFunctionNode(functionNode) { var nodes = functionNode.childNodes; var functionArguments = []; // ex : func(1+2,3,4) : 1+2 need to be calculated first var argumentChildNodes = []; var containerNode = null; for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; if (node instanceof _frontCalculatorParserNode.default) { if (node.symbol instanceof _frontCalculatorSymbol3.default) { containerNode = new _frontCalculatorParserNode3.default(argumentChildNodes); functionArguments.push(this.calculateNode(containerNode)); argumentChildNodes = []; } else { argumentChildNodes.push(node); } } else { argumentChildNodes.push(node); } } if (argumentChildNodes.length > 0) { containerNode = new _frontCalculatorParserNode3.default(argumentChildNodes); functionArguments.push(this.calculateNode(containerNode)); } /** * * @type {FrontCalculatorSymbolFunctionAbstract} */ var symbol = functionNode.symbolNode.symbol; return symbol.execute(functionArguments); } /** * Returns the numeric value of a symbol node. * Attention: node.symbol must not be of type AbstractOperator! * * @param {FrontCalculatorParserNodeSymbol} symbolNode * * @returns {Number} */ }, { key: "calculateSymbolNode", value: function calculateSymbolNode(symbolNode) { var symbol = symbolNode.symbol; var number = 0; if (symbol instanceof _frontCalculatorSymbol2.default) { number = symbolNode.token.value; // Convert string to int or float (depending on the type of the number) // If the number has a longer fractional part, it will be cut. number = Number(number); } else if (symbol instanceof _frontCalculatorSymbolConstant.default) { number = symbol.value; } else { throw 'Error: Found symbol of unexpected type "' + symbol.constructor.name + '", expected number or constant'; } return number; } /** * Detect the calculation order of a given array of nodes. * Does only care for the precedence of operators. * Does not care for child nodes of container nodes. * Returns a new array with ordered symbol nodes * * @param {FrontCalculatorParserNodeAbstract[]} nodes * * @return {Array} */ }, { key: "detectCalculationOrder", value: function detectCalculationOrder(nodes) { var operatorNodes = []; // Store all symbol nodes that have a symbol of type abstract operator in an array for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; if (node instanceof _frontCalculatorParserNode.default) { if (node.symbol instanceof _frontCalculatorSymbolOperator.default) { var operatorNode = { index: i, node: node }; operatorNodes.push(operatorNode); } } } operatorNodes.sort( /** * Returning 1 means $nodeTwo before $nodeOne, returning -1 means $nodeOne before $nodeTwo. * @param {Object} operatorNodeOne * @param {Object} operatorNodeTwo */ function (operatorNodeOne, operatorNodeTwo) { var nodeOne = operatorNodeOne.node; var nodeTwo = operatorNodeTwo.node; // First-level precedence of node one /** * * @type {FrontCalculatorSymbolOperatorAbstract} */ var symbolOne = nodeOne.symbol; var precedenceOne = 2; if (nodeOne.isUnaryOperator) { precedenceOne = 3; } // First-level precedence of node two /** * * @type {FrontCalculatorSymbolOperatorAbstract} */ var symbolTwo = nodeTwo.symbol; var precedenceTwo = 2; if (nodeTwo.isUnaryOperator) { precedenceTwo = 3; } // If the first-level precedence is the same, compare the second-level precedence if (precedenceOne === precedenceTwo) { precedenceOne = symbolOne.precedence; precedenceTwo = symbolTwo.precedence; } // If the second-level precedence is the same, we have to ensure that the sorting algorithm does // insert the node / token that is left in the term before the node / token that is right. // Therefore we cannot return 0 but compare the positions and return 1 / -1. if (precedenceOne === precedenceTwo) { return nodeOne.token.position < nodeTwo.token.position ? -1 : 1; } return precedenceOne < precedenceTwo ? 1 : -1; }); return operatorNodes; } }]); return FrontCalculator; }(); if (window['forminatorCalculator'] === undefined) { window.forminatorCalculator = function (term) { return new FrontCalculator(term); }; } },{"./parser/front.calculator.parser":2,"./parser/front.calculator.parser.tokenizer":4,"./parser/node/front.calculator.parser.node.container":6,"./parser/node/front.calculator.parser.node.function":7,"./parser/node/front.calculator.parser.node.symbol":8,"./symbol/abstract/front.calculator.symbol.constant.abstract":10,"./symbol/abstract/front.calculator.symbol.operator.abstract":12,"./symbol/front.calculator.symbol.loader":16,"./symbol/front.calculator.symbol.number":17,"./symbol/front.calculator.symbol.separator":18}],2:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorParser = _interopRequireDefault(require("./front.calculator.parser.token")); var _frontCalculatorSymbol = _interopRequireDefault(require("../symbol/front.calculator.symbol.number")); var _frontCalculatorSymbolOpening = _interopRequireDefault(require("../symbol/brackets/front.calculator.symbol.opening.bracket")); var _frontCalculatorSymbolClosing = _interopRequireDefault(require("../symbol/brackets/front.calculator.symbol.closing.bracket")); var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../symbol/abstract/front.calculator.symbol.function.abstract")); var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../symbol/abstract/front.calculator.symbol.operator.abstract")); var _frontCalculatorSymbol2 = _interopRequireDefault(require("../symbol/front.calculator.symbol.separator")); var _frontCalculatorParserNode = _interopRequireDefault(require("./node/front.calculator.parser.node.symbol")); var _frontCalculatorParserNode2 = _interopRequireDefault(require("./node/front.calculator.parser.node.container")); var _frontCalculatorParserNode3 = _interopRequireDefault(require("./node/front.calculator.parser.node.function")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /** * The parsers has one important method: parse() * It takes an array of tokens as input and * returns an array of nodes as output. * These nodes are the syntax tree of the term. * */ var FrontCalculatorParser = exports.default = /*#__PURE__*/function () { /** * * @param {FrontCalculatorSymbolLoader} symbolLoader */ function FrontCalculatorParser(symbolLoader) { _classCallCheck(this, FrontCalculatorParser); /** * * @type {FrontCalculatorSymbolLoader} */ this.symbolLoader = symbolLoader; } /** * Parses an array with tokens. Returns an array of nodes. * These nodes define a syntax tree. * * @param {FrontCalculatorParserToken[]} tokens * * @returns FrontCalculatorParserNodeContainer */ _createClass(FrontCalculatorParser, [{ key: "parse", value: function parse(tokens) { var symbolNodes = this.detectSymbols(tokens); var nodes = this.createTreeByBrackets(symbolNodes); nodes = this.transformTreeByFunctions(nodes); this.checkGrammar(nodes); // Wrap the nodes in an array node. return new _frontCalculatorParserNode2.default(nodes); } /** * Creates a flat array of symbol nodes from tokens. * * @param {FrontCalculatorParserToken[]} tokens * @returns {FrontCalculatorParserNodeSymbol[]} */ }, { key: "detectSymbols", value: function detectSymbols(tokens) { var symbolNodes = []; var symbol = null; var identifier = null; var expectingOpeningBracket = false; // True if we expect an opening bracket (after a function name) var openBracketCounter = 0; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; var type = token.type; if (_frontCalculatorParser.default.TYPE_WORD === type) { identifier = token.value; symbol = this.symbolLoader.find(identifier); if (null === symbol) { throw 'Error: Detected unknown or invalid string identifier: ' + identifier + '.'; } } else if (type === _frontCalculatorParser.default.TYPE_NUMBER) { // Notice: Numbers do not have an identifier var symbolNumbers = this.symbolLoader.findSubTypes(_frontCalculatorSymbol.default); if (symbolNumbers.length < 1 || !(symbolNumbers instanceof Array)) { throw 'Error: Unavailable number symbol processor.'; } symbol = symbolNumbers[0]; } else { // Type Token::TYPE_CHARACTER: identifier = token.value; symbol = this.symbolLoader.find(identifier); if (null === symbol) { throw 'Error: Detected unknown or invalid string identifier: ' + identifier + '.'; } if (symbol instanceof _frontCalculatorSymbolOpening.default) { openBracketCounter++; } if (symbol instanceof _frontCalculatorSymbolClosing.default) { openBracketCounter--; // Make sure there are not too many closing brackets if (openBracketCounter < 0) { throw 'Error: Found closing bracket that does not have an opening bracket.'; } } } if (expectingOpeningBracket) { if (!(symbol instanceof _frontCalculatorSymbolOpening.default)) { throw 'Error: Expected opening bracket (after a function) but got something else.'; } expectingOpeningBracket = false; } else { if (symbol instanceof _frontCalculatorSymbolFunction.default) { expectingOpeningBracket = true; } } var symbolNode = new _frontCalculatorParserNode.default(token, symbol); symbolNodes.push(symbolNode); } // Make sure the term does not end with the name of a function but without an opening bracket if (expectingOpeningBracket) { throw 'Error: Expected opening bracket (after a function) but reached the end of the term'; } // Make sure there are not too many opening brackets if (openBracketCounter > 0) { throw 'Error: There is at least one opening bracket that does not have a closing bracket'; } return symbolNodes; } /** * Expects a flat array of symbol nodes and (if possible) transforms * it to a tree of nodes. Cares for brackets. * Attention: Expects valid brackets! * Check the brackets before you call this method. * * @param {FrontCalculatorParserNodeSymbol[]} symbolNodes * @returns {FrontCalculatorParserNodeAbstract[]} */ }, { key: "createTreeByBrackets", value: function createTreeByBrackets(symbolNodes) { var tree = []; var nodesInBracket = []; // AbstractSymbol nodes inside level-0-brackets var openBracketCounter = 0; for (var i = 0; i < symbolNodes.length; i++) { var symbolNode = symbolNodes[i]; if (!(symbolNode instanceof _frontCalculatorParserNode.default)) { throw 'Error: Expected symbol node, but got "' + symbolNode.constructor.name + '"'; } if (symbolNode.symbol instanceof _frontCalculatorSymbolOpening.default) { openBracketCounter++; if (openBracketCounter > 1) { nodesInBracket.push(symbolNode); } } else if (symbolNode.symbol instanceof _frontCalculatorSymbolClosing.default) { openBracketCounter--; // Found a closing bracket on level 0 if (0 === openBracketCounter) { var subTree = this.createTreeByBrackets(nodesInBracket); // Subtree can be empty for example if the term looks like this: "()" or "functioname()" // But this is okay, we need to allow this so we can call functions without a parameter tree.push(new _frontCalculatorParserNode2.default(subTree)); nodesInBracket = []; } else { nodesInBracket.push(symbolNode); } } else { if (0 === openBracketCounter) { tree.push(symbolNode); } else { nodesInBracket.push(symbolNode); } } } return tree; } /** * Replaces [a SymbolNode that has a symbol of type AbstractFunction, * followed by a node of type ContainerNode] by a FunctionNode. * Expects the $nodes not including any function nodes (yet). * * @param {FrontCalculatorParserNodeAbstract[]} nodes * * @returns {FrontCalculatorParserNodeAbstract[]} */ }, { key: "transformTreeByFunctions", value: function transformTreeByFunctions(nodes) { var transformedNodes = []; var functionSymbolNode = null; for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; if (node instanceof _frontCalculatorParserNode2.default) { var transformedChildNodes = this.transformTreeByFunctions(node.childNodes); if (null !== functionSymbolNode) { var functionNode = new _frontCalculatorParserNode3.default(transformedChildNodes, functionSymbolNode); transformedNodes.push(functionNode); functionSymbolNode = null; } else { // not a function node.childNodes = transformedChildNodes; transformedNodes.push(node); } } else if (node instanceof _frontCalculatorParserNode.default) { var symbol = node.symbol; if (symbol instanceof _frontCalculatorSymbolFunction.default) { functionSymbolNode = node; } else { transformedNodes.push(node); } } else { throw 'Error: Expected array node or symbol node, got "' + node.constructor.name + '"'; } } return transformedNodes; } /** * Ensures the tree follows the grammar rules for terms * * @param {FrontCalculatorParserNodeAbstract[]} nodes */ }, { key: "checkGrammar", value: function checkGrammar(nodes) { // TODO Make sure that separators are only in the child nodes of the array node of a function node // (If this happens the calculator will throw an exception) for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; if (node instanceof _frontCalculatorParserNode.default) { var symbol = node.symbol; if (symbol instanceof _frontCalculatorSymbolOperator.default) { var posOfRightOperand = i + 1; // Make sure the operator is positioned left of a (potential) operand (=prefix notation). // Example term: "-1" if (posOfRightOperand >= nodes.length) { throw 'Error: Found operator that does not stand before an operand.'; } var posOfLeftOperand = i - 1; var leftOperand = null; // Operator is unary if positioned at the beginning of a term if (posOfLeftOperand >= 0) { leftOperand = nodes[posOfLeftOperand]; if (leftOperand instanceof _frontCalculatorParserNode.default) { if (leftOperand.symbol instanceof _frontCalculatorSymbolOperator.default // example 1`+-`5 : + = operator, - = unary || leftOperand.symbol instanceof _frontCalculatorSymbol2.default // example func(1`,-`5) ,= separator, - = unary ) { // Operator is unary if positioned right to another operator leftOperand = null; } } } // If null, the operator is unary if (null === leftOperand) { if (!symbol.operatesUnary) { throw 'Error: Found operator in unary notation that is not unary.'; } // Remember that this node represents a unary operator node.setIsUnaryOperator(true); } else { if (!symbol.operatesBinary) { console.log(symbol); throw 'Error: Found operator in binary notation that is not binary.'; } } } } else { this.checkGrammar(node.childNodes); } } } }]); return FrontCalculatorParser; }(); },{"../symbol/abstract/front.calculator.symbol.function.abstract":11,"../symbol/abstract/front.calculator.symbol.operator.abstract":12,"../symbol/brackets/front.calculator.symbol.closing.bracket":13,"../symbol/brackets/front.calculator.symbol.opening.bracket":14,"../symbol/front.calculator.symbol.number":17,"../symbol/front.calculator.symbol.separator":18,"./front.calculator.parser.token":3,"./node/front.calculator.parser.node.container":6,"./node/front.calculator.parser.node.function":7,"./node/front.calculator.parser.node.symbol":8}],3:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } var FrontCalculatorParserToken = exports.default = /*#__PURE__*/function () { function FrontCalculatorParserToken(type, value, position) { _classCallCheck(this, FrontCalculatorParserToken); /** * * @type {Number} */ this.type = type; /** * * @type {String|Number} */ this.value = value; /** * * @type {Number} */ this.position = position; } _createClass(FrontCalculatorParserToken, null, [{ key: "TYPE_WORD", get: function get() { return 1; } }, { key: "TYPE_CHAR", get: function get() { return 2; } }, { key: "TYPE_NUMBER", get: function get() { return 3; } }]); return FrontCalculatorParserToken; }(); },{}],4:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorParser = _interopRequireDefault(require("./front.calculator.parser.token")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } var FrontCalculatorParserTokenizer = exports.default = /*#__PURE__*/function () { function FrontCalculatorParserTokenizer(input) { _classCallCheck(this, FrontCalculatorParserTokenizer); /** * * @type {String} */ this.input = input; /** * @type {number} */ this.currentPosition = 0; } /** * * @returns {FrontCalculatorParserToken[]} */ _createClass(FrontCalculatorParserTokenizer, [{ key: "tokenize", value: function tokenize() { this.reset(); var tokens = []; var token = this.readToken(); while (token) { tokens.push(token); token = this.readToken(); } return tokens; } /** * * @returns {FrontCalculatorParserToken} */ }, { key: "readToken", value: function readToken() { this.stepOverWhitespace(); var char = this.readCurrent(); if (null === char) { return null; } var value = null; var type = null; if (this.isLetter(char)) { value = this.readWord(); type = _frontCalculatorParser.default.TYPE_WORD; } else if (this.isDigit(char) || this.isPeriod(char)) { value = this.readNumber(); type = _frontCalculatorParser.default.TYPE_NUMBER; } else { value = this.readChar(); type = _frontCalculatorParser.default.TYPE_CHAR; } return new _frontCalculatorParser.default(type, value, this.currentPosition); } /** * Returns true, if a given character is a letter (a-z and A-Z). * * @param char * @returns {boolean} */ }, { key: "isLetter", value: function isLetter(char) { if (null === char) { return false; } var ascii = char.charCodeAt(0); /** * ASCII codes: 65 = 'A', 90 = 'Z', 97 = 'a', 122 = 'z'-- **/ return ascii >= 65 && ascii <= 90 || ascii >= 97 && ascii <= 122; } /** * Returns true, if a given character is a digit (0-9). * * @param char * @returns {boolean} */ }, { key: "isDigit", value: function isDigit(char) { if (null === char) { return false; } var ascii = char.charCodeAt(0); /** * ASCII codes: 48 = '0', 57 = '9' */ return ascii >= 48 && ascii <= 57; } /** * Returns true, if a given character is a period ('.'). * * @param char * @returns {boolean} */ }, { key: "isPeriod", value: function isPeriod(char) { return '.' === char; } /** * Returns true, if a given character is whitespace. * Notice: A null char is not seen as whitespace. * * @param char * @returns {boolean} */ }, { key: "isWhitespace", value: function isWhitespace(char) { return [" ", "\t", "\n"].indexOf(char) >= 0; } }, { key: "stepOverWhitespace", value: function stepOverWhitespace() { while (this.isWhitespace(this.readCurrent())) { this.readNext(); } } /** * Reads a word. Assumes that the cursor of the input stream * currently is positioned at the beginning of a word. * * @returns {string} */ }, { key: "readWord", value: function readWord() { var word = ''; var char = this.readCurrent(); // Try to read the word while (null !== char) { if (this.isLetter(char)) { word += char; } else { break; } // Just move the cursor to the next position char = this.readNext(); } return word; } /** * Reads a number (as a string). Assumes that the cursor * of the input stream currently is positioned at the * beginning of a number. * * @returns {string} */ }, { key: "readNumber", value: function readNumber() { var number = ''; var foundPeriod = false; // Try to read the number. // Notice: It does not matter if the number only consists of a single period // or if it ends with a period. var char = this.readCurrent(); while (null !== char) { if (this.isPeriod(char) || this.isDigit(char)) { if (this.isPeriod(char)) { if (foundPeriod) { throw 'Error: A number cannot have more than one period'; } foundPeriod = true; } number += char; } else { break; } // read next char = this.readNext(); } return number; } /** * Reads a single char. Assumes that the cursor of the input stream * currently is positioned at a char (not on null). * * @returns {String} */ }, { key: "readChar", value: function readChar() { var char = this.readCurrent(); // Just move the cursor to the next position this.readNext(); return char; } /** * * @returns {String|null} */ }, { key: "readCurrent", value: function readCurrent() { var char = null; if (this.hasCurrent()) { char = this.input[this.currentPosition]; } return char; } /** * Move the the cursor to the next position. * Will always move the cursor, even if the end of the string has been passed. * * @returns {String} */ }, { key: "readNext", value: function readNext() { this.currentPosition++; return this.readCurrent(); } /** * Returns true if there is a character at the current position * * @returns {boolean} */ }, { key: "hasCurrent", value: function hasCurrent() { return this.currentPosition < this.input.length; } }, { key: "reset", value: function reset() { this.currentPosition = 0; } }]); return FrontCalculatorParserTokenizer; }(); },{"./front.calculator.parser.token":3}],5:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var FrontCalculatorParserNodeAbstract = exports.default = /*#__PURE__*/_createClass(function FrontCalculatorParserNodeAbstract() { _classCallCheck(this, FrontCalculatorParserNodeAbstract); }); },{}],6:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorParserNode = _interopRequireDefault(require("./front.calculator.parser.node.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * A parent node is a container for a (sorted) array of nodes. * */ var FrontCalculatorParserNodeContainer = exports.default = /*#__PURE__*/function (_FrontCalculatorParse) { _inherits(FrontCalculatorParserNodeContainer, _FrontCalculatorParse); var _super = _createSuper(FrontCalculatorParserNodeContainer); function FrontCalculatorParserNodeContainer(childNodes) { var _this; _classCallCheck(this, FrontCalculatorParserNodeContainer); _this = _super.call(this); /** * * @type {FrontCalculatorParserNodeAbstract[]} */ _this.childNodes = null; _this.setChildNodes(childNodes); return _this; } /** * Setter for the child nodes. * Notice: The number of child nodes can be 0. * @param childNodes */ _createClass(FrontCalculatorParserNodeContainer, [{ key: "setChildNodes", value: function setChildNodes(childNodes) { childNodes.forEach(function (childNode) { if (!(childNode instanceof _frontCalculatorParserNode.default)) { throw 'Expected AbstractNode, but got ' + childNode.constructor.name; } }); this.childNodes = childNodes; } /** * Returns the number of child nodes in this array node. * Does not count the child nodes of the child nodes. * * @returns {number} */ }, { key: "size", value: function size() { try { return this.childNodes.length; } catch (e) { return 0; } } /** * Returns true if the array node does not have any * child nodes. This might sound strange but is possible. * * @returns {boolean} */ }, { key: "isEmpty", value: function isEmpty() { return !this.size(); } }]); return FrontCalculatorParserNodeContainer; }(_frontCalculatorParserNode.default); },{"./front.calculator.parser.node.abstract":5}],7:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorParserNode = _interopRequireDefault(require("./front.calculator.parser.node.container")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * A function in a term consists of the name of the function * (the symbol of the function) and the brackets that follow * the name and everything that is in this brackets (the * arguments). A function node combines these two things. * It stores its symbol in the $symbolNode property and its * arguments in the $childNodes property which is inherited * from the ContainerNode class. * */ var FrontCalculatorParserNodeFunction = exports.default = /*#__PURE__*/function (_FrontCalculatorParse) { _inherits(FrontCalculatorParserNodeFunction, _FrontCalculatorParse); var _super = _createSuper(FrontCalculatorParserNodeFunction); /** * ContainerNode constructor. * Attention: The constructor is differs from the constructor * of the parent class! * * @param childNodes * @param symbolNode */ function FrontCalculatorParserNodeFunction(childNodes, symbolNode) { var _this; _classCallCheck(this, FrontCalculatorParserNodeFunction); _this = _super.call(this, childNodes); /** * * @type {FrontCalculatorParserNodeSymbol} */ _this.symbolNode = symbolNode; return _this; } return _createClass(FrontCalculatorParserNodeFunction); }(_frontCalculatorParserNode.default); },{"./front.calculator.parser.node.container":6}],8:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../../symbol/abstract/front.calculator.symbol.operator.abstract")); var _frontCalculatorParserNode = _interopRequireDefault(require("./front.calculator.parser.node.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * A symbol node is a node in the syntax tree. * Leaf nodes do not have any child nodes * (parent nodes can have child nodes). A * symbol node represents a mathematical symbol. * Nodes are created by the parser. * */ var FrontCalculatorParserNodeSymbol = exports.default = /*#__PURE__*/function (_FrontCalculatorParse) { _inherits(FrontCalculatorParserNodeSymbol, _FrontCalculatorParse); var _super = _createSuper(FrontCalculatorParserNodeSymbol); function FrontCalculatorParserNodeSymbol(token, symbol) { var _this; _classCallCheck(this, FrontCalculatorParserNodeSymbol); _this = _super.call(this); /** * The token of the node. It contains the value. * * @type {FrontCalculatorParserToken} */ _this.token = token; /** * The symbol of the node. It defines the type of the node. * * @type {FrontCalculatorSymbolAbstract} */ _this.symbol = symbol; /** * Unary operators need to be treated specially. * Therefore a node has to know if it (or to be * more precise the symbol of the node) * represents a unary operator. * Example : -1, -4 * * @type {boolean} */ _this.isUnaryOperator = false; return _this; } _createClass(FrontCalculatorParserNodeSymbol, [{ key: "setIsUnaryOperator", value: function setIsUnaryOperator(isUnaryOperator) { if (!(this.symbol instanceof _frontCalculatorSymbolOperator.default)) { throw 'Error: Cannot mark node as unary operator, because symbol is not an operator but of type ' + this.symbol.constructor.name; } this.isUnaryOperator = isUnaryOperator; } }]); return FrontCalculatorParserNodeSymbol; }(_frontCalculatorParserNode.default); },{"../../symbol/abstract/front.calculator.symbol.operator.abstract":12,"./front.calculator.parser.node.abstract":5}],9:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } var FrontCalculatorSymbolAbstract = exports.default = /*#__PURE__*/function () { function FrontCalculatorSymbolAbstract() { _classCallCheck(this, FrontCalculatorSymbolAbstract); /** * Array with the 1-n (exception: the Numbers class may have 0) * unique identifiers (the textual representation of a symbol) * of the symbol. Example: ['/', ':'] * Attention: The identifiers are case-sensitive, however, * valid identifiers in a term are always written in lower-case. * Therefore identifiers always have to be written in lower-case! * * @type {String[]} */ this.identifiers = []; } /** * Getter for the identifiers of the symbol. * Attention: The identifiers will be lower-cased! * @returns {String[]} */ _createClass(FrontCalculatorSymbolAbstract, [{ key: "getIdentifiers", value: function getIdentifiers() { var lowerIdentifiers = []; this.identifiers.forEach(function (identifier) { lowerIdentifiers.push(identifier.toLowerCase()); }); return lowerIdentifiers; } }]); return FrontCalculatorSymbolAbstract; }(); },{}],10:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbol = _interopRequireDefault(require("./front.calculator.symbol.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * This class is the base class for all symbols that are of the type "constant". * We recommend to use names as textual representations for this type of symbol. * Please take note of the fact that the precision of PHP float constants * (for example M_PI) is based on the "precision" directive in php.ini, * which defaults to 14. */ var FrontCalculatorSymbolConstantAbstract = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolConstantAbstract, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolConstantAbstract); function FrontCalculatorSymbolConstantAbstract() { var _this; _classCallCheck(this, FrontCalculatorSymbolConstantAbstract); _this = _super.call(this); /** * This is the value of the constant. We use 0 as an example here, * but you are supposed to overwrite this in the concrete constant class. * Usually mathematical constants are not integers, however, * you are allowed to use an integer in this context. * * @type {number} */ _this.value = 0; return _this; } return _createClass(FrontCalculatorSymbolConstantAbstract); }(_frontCalculatorSymbol.default); },{"./front.calculator.symbol.abstract":9}],11:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbol = _interopRequireDefault(require("./front.calculator.symbol.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * This class is the base class for all symbols that are of the type "function". * Typically the textual representation of a function consists of two or more letters. */ var FrontCalculatorSymbolFunctionAbstract = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolFunctionAbstract, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolFunctionAbstract); function FrontCalculatorSymbolFunctionAbstract() { _classCallCheck(this, FrontCalculatorSymbolFunctionAbstract); return _super.call(this); } /** * This method is called when the function is executed. A function can have 0-n parameters. * The implementation of this method is responsible to validate the number of arguments. * The $arguments array contains these arguments. If the number of arguments is improper, * the method has to throw a Exceptions\NumberOfArgumentsException exception. * The items of the $arguments array will always be of type int or float. They will never be null. * They keys will be integers starting at 0 and representing the positions of the arguments * in ascending order. * Overwrite this method in the concrete operator class. * If this class does NOT return a value of type int or float, * an exception will be thrown. * * @param {int[]|float[]} params * @returns {number} */ _createClass(FrontCalculatorSymbolFunctionAbstract, [{ key: "execute", value: function execute(params) { return 0.0; } }]); return FrontCalculatorSymbolFunctionAbstract; }(_frontCalculatorSymbol.default); },{"./front.calculator.symbol.abstract":9}],12:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbol = _interopRequireDefault(require("./front.calculator.symbol.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * This class is the base class for all symbols that are of the type "(binary) operator". * The textual representation of an operator consists of a single char that is not a letter. * It is worth noting that a operator has the same power as a function with two parameters. * Operators are always binary. To mimic a unary operator you might want to create a function * that accepts one parameter. */ var FrontCalculatorSymbolOperatorAbstract = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolOperatorAbstract, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolOperatorAbstract); function FrontCalculatorSymbolOperatorAbstract() { var _this; _classCallCheck(this, FrontCalculatorSymbolOperatorAbstract); _this = _super.call(this); /** * The operator precedence determines which operators to perform first * in order to evaluate a given term. * You are supposed to overwrite this constant in the concrete constant class. * Take a look at other operator classes to see the precedences of the predefined operators. * 0: default, > 0: higher, < 0: lower * * @type {number} */ _this.precedence = 0; /** * Usually operators are binary, they operate on two operands (numbers). * But some can operate on one operand (number). The operand of a unary * operator is always positioned after the operator (=prefix notation). * Good example: "-1" Bad Example: "1-" * If you want to create a unary operator that operates on the left * operand, you should use a function instead. Functions with one * parameter execute unary operations in functional notation. * Notice: Operators can be unary AND binary (but this is a rare case) * * @type {boolean} */ _this.operatesUnary = false; /** * Usually operators are binary, they operate on two operands (numbers). * Notice: Operators can be unary AND binary (but this is a rare case) * * @type {boolean} */ _this.operatesBinary = true; return _this; } _createClass(FrontCalculatorSymbolOperatorAbstract, [{ key: "operate", value: function operate(leftNumber, rightNumber) { return 0.0; } }]); return FrontCalculatorSymbolOperatorAbstract; }(_frontCalculatorSymbol.default); },{"./front.calculator.symbol.abstract":9}],13:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbol = _interopRequireDefault(require("../abstract/front.calculator.symbol.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var FrontCalculatorSymbolClosingBracket = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolClosingBracket, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolClosingBracket); function FrontCalculatorSymbolClosingBracket() { var _this; _classCallCheck(this, FrontCalculatorSymbolClosingBracket); _this = _super.call(this); _this.identifiers = [')']; return _this; } return _createClass(FrontCalculatorSymbolClosingBracket); }(_frontCalculatorSymbol.default); },{"../abstract/front.calculator.symbol.abstract":9}],14:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbol = _interopRequireDefault(require("../abstract/front.calculator.symbol.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var FrontCalculatorSymbolOpeningBracket = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolOpeningBracket, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolOpeningBracket); function FrontCalculatorSymbolOpeningBracket() { var _this; _classCallCheck(this, FrontCalculatorSymbolOpeningBracket); _this = _super.call(this); _this.identifiers = ['(']; return _this; } return _createClass(FrontCalculatorSymbolOpeningBracket); }(_frontCalculatorSymbol.default); },{"../abstract/front.calculator.symbol.abstract":9}],15:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolConstant = _interopRequireDefault(require("../abstract/front.calculator.symbol.constant.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Math.PI * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/PI */ var FrontCalculatorSymbolConstantPi = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolConstantPi, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolConstantPi); function FrontCalculatorSymbolConstantPi() { var _this; _classCallCheck(this, FrontCalculatorSymbolConstantPi); _this = _super.call(this); _this.identifiers = ['pi']; _this.value = Math.PI; return _this; } return _createClass(FrontCalculatorSymbolConstantPi); }(_frontCalculatorSymbolConstant.default); },{"../abstract/front.calculator.symbol.constant.abstract":10}],16:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbol = _interopRequireDefault(require("./front.calculator.symbol.number")); var _frontCalculatorSymbol2 = _interopRequireDefault(require("./front.calculator.symbol.separator")); var _frontCalculatorSymbolOpening = _interopRequireDefault(require("./brackets/front.calculator.symbol.opening.bracket")); var _frontCalculatorSymbolClosing = _interopRequireDefault(require("./brackets/front.calculator.symbol.closing.bracket")); var _frontCalculatorSymbolConstant = _interopRequireDefault(require("./constants/front.calculator.symbol.constant.pi")); var _frontCalculatorSymbolOperator = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.addition")); var _frontCalculatorSymbolOperator2 = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.division")); var _frontCalculatorSymbolOperator3 = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.exponentiation")); var _frontCalculatorSymbolOperator4 = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.modulo")); var _frontCalculatorSymbolOperator5 = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.multiplication")); var _frontCalculatorSymbolOperator6 = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.subtraction")); var _frontCalculatorSymbolFunction = _interopRequireDefault(require("./functions/front.calculator.symbol.function.abs")); var _frontCalculatorSymbolFunction2 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.avg")); var _frontCalculatorSymbolFunction3 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.ceil")); var _frontCalculatorSymbolFunction4 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.floor")); var _frontCalculatorSymbolFunction5 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.max")); var _frontCalculatorSymbolFunction6 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.min")); var _frontCalculatorSymbolFunction7 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.round")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } var FrontCalculatorSymbolLoader = exports.default = /*#__PURE__*/function () { function FrontCalculatorSymbolLoader() { _classCallCheck(this, FrontCalculatorSymbolLoader); /** * * @type {{FrontCalculatorSymbolOperatorModulo: FrontCalculatorSymbolOperatorModulo, FrontCalculatorSymbolOperatorSubtraction: FrontCalculatorSymbolOperatorSubtraction, FrontCalculatorSymbolOperatorExponentiation: FrontCalculatorSymbolOperatorExponentiation, FrontCalculatorSymbolOperatorAddition: FrontCalculatorSymbolOperatorAddition, FrontCalculatorSymbolClosingBracket: FrontCalculatorSymbolClosingBracket, FrontCalculatorSymbolFunctionMax: FrontCalculatorSymbolFunctionMax, FrontCalculatorSymbolFunctionCeil: FrontCalculatorSymbolFunctionCeil, FrontCalculatorSymbolSeparator: FrontCalculatorSymbolSeparator, FrontCalculatorSymbolOperatorMultiplication: FrontCalculatorSymbolOperatorMultiplication, FrontCalculatorSymbolFunctionAbs: FrontCalculatorSymbolFunctionAbs, FrontCalculatorSymbolFunctionAvg: FrontCalculatorSymbolFunctionAvg, FrontCalculatorSymbolFunctionFloor: FrontCalculatorSymbolFunctionFloor, FrontCalculatorSymbolFunctionMin: FrontCalculatorSymbolFunctionMin, FrontCalculatorSymbolOperatorDivision: FrontCalculatorSymbolOperatorDivision, FrontCalculatorSymbolNumber: FrontCalculatorSymbolNumber, FrontCalculatorSymbolOpeningBracket: FrontCalculatorSymbolOpeningBracket, FrontCalculatorSymbolConstantPi: FrontCalculatorSymbolConstantPi, FrontCalculatorSymbolFunctionRound: FrontCalculatorSymbolFunctionRound}} */ this.symbols = { FrontCalculatorSymbolNumber: new _frontCalculatorSymbol.default(), FrontCalculatorSymbolSeparator: new _frontCalculatorSymbol2.default(), FrontCalculatorSymbolOpeningBracket: new _frontCalculatorSymbolOpening.default(), FrontCalculatorSymbolClosingBracket: new _frontCalculatorSymbolClosing.default(), FrontCalculatorSymbolConstantPi: new _frontCalculatorSymbolConstant.default(), FrontCalculatorSymbolOperatorAddition: new _frontCalculatorSymbolOperator.default(), FrontCalculatorSymbolOperatorDivision: new _frontCalculatorSymbolOperator2.default(), FrontCalculatorSymbolOperatorExponentiation: new _frontCalculatorSymbolOperator3.default(), FrontCalculatorSymbolOperatorModulo: new _frontCalculatorSymbolOperator4.default(), FrontCalculatorSymbolOperatorMultiplication: new _frontCalculatorSymbolOperator5.default(), FrontCalculatorSymbolOperatorSubtraction: new _frontCalculatorSymbolOperator6.default(), FrontCalculatorSymbolFunctionAbs: new _frontCalculatorSymbolFunction.default(), FrontCalculatorSymbolFunctionAvg: new _frontCalculatorSymbolFunction2.default(), FrontCalculatorSymbolFunctionCeil: new _frontCalculatorSymbolFunction3.default(), FrontCalculatorSymbolFunctionFloor: new _frontCalculatorSymbolFunction4.default(), FrontCalculatorSymbolFunctionMax: new _frontCalculatorSymbolFunction5.default(), FrontCalculatorSymbolFunctionMin: new _frontCalculatorSymbolFunction6.default(), FrontCalculatorSymbolFunctionRound: new _frontCalculatorSymbolFunction7.default() }; } /** * Returns the symbol that has the given identifier. * Returns null if none is found. * * @param identifier * @returns {FrontCalculatorSymbolAbstract|null} */ _createClass(FrontCalculatorSymbolLoader, [{ key: "find", value: function find(identifier) { identifier = identifier.toLowerCase(); for (var key in this.symbols) { if (this.symbols.hasOwnProperty(key)) { var symbol = this.symbols[key]; if (symbol.getIdentifiers().indexOf(identifier) >= 0) { return symbol; } } } return null; } /** * Returns all symbols that inherit from a given abstract * parent type (class): The parent type has to be an * AbstractSymbol. * Notice: The parent type name will not be validated! * * @param parentTypeName * @returns {FrontCalculatorSymbolAbstract[]} */ }, { key: "findSubTypes", value: function findSubTypes(parentTypeName) { var symbols = []; for (var key in this.symbols) { if (this.symbols.hasOwnProperty(key)) { var symbol = this.symbols[key]; if (symbol instanceof parentTypeName) { symbols.push(symbol); } } } return symbols; } }]); return FrontCalculatorSymbolLoader; }(); },{"./brackets/front.calculator.symbol.closing.bracket":13,"./brackets/front.calculator.symbol.opening.bracket":14,"./constants/front.calculator.symbol.constant.pi":15,"./front.calculator.symbol.number":17,"./front.calculator.symbol.separator":18,"./functions/front.calculator.symbol.function.abs":19,"./functions/front.calculator.symbol.function.avg":20,"./functions/front.calculator.symbol.function.ceil":21,"./functions/front.calculator.symbol.function.floor":22,"./functions/front.calculator.symbol.function.max":23,"./functions/front.calculator.symbol.function.min":24,"./functions/front.calculator.symbol.function.round":25,"./operators/front.calculator.symbol.operator.addition":26,"./operators/front.calculator.symbol.operator.division":27,"./operators/front.calculator.symbol.operator.exponentiation":28,"./operators/front.calculator.symbol.operator.modulo":29,"./operators/front.calculator.symbol.operator.multiplication":30,"./operators/front.calculator.symbol.operator.subtraction":31}],17:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbol = _interopRequireDefault(require("./abstract/front.calculator.symbol.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * This class is the class that represents symbols of type "number". * Numbers are completely handled by the tokenizer/parser so there is no need to * create more than this concrete, empty number class that does not specify * a textual representation of numbers (numbers always consist of digits * and may include a single dot). */ var FrontCalculatorSymbolNumber = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolNumber, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolNumber); function FrontCalculatorSymbolNumber() { _classCallCheck(this, FrontCalculatorSymbolNumber); return _super.call(this); } return _createClass(FrontCalculatorSymbolNumber); }(_frontCalculatorSymbol.default); },{"./abstract/front.calculator.symbol.abstract":9}],18:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbol = _interopRequireDefault(require("./abstract/front.calculator.symbol.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * This class is a class that represents symbols of type "separator". * A separator separates the arguments of a (mathematical) function. * Most likely we will only need one concrete "separator" class. */ var FrontCalculatorSymbolSeparator = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolSeparator, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolSeparator); function FrontCalculatorSymbolSeparator() { var _this; _classCallCheck(this, FrontCalculatorSymbolSeparator); _this = _super.call(this); _this.identifiers = [',']; return _this; } return _createClass(FrontCalculatorSymbolSeparator); }(_frontCalculatorSymbol.default); },{"./abstract/front.calculator.symbol.abstract":9}],19:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Math.abs() function. Expects one parameter. * Example: "abs(2)" => 2, "abs(-2)" => 2, "abs(0)" => 0 * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs */ var FrontCalculatorSymbolFunctionAbs = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolFunctionAbs, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolFunctionAbs); function FrontCalculatorSymbolFunctionAbs() { var _this; _classCallCheck(this, FrontCalculatorSymbolFunctionAbs); _this = _super.call(this); _this.identifiers = ['abs']; return _this; } _createClass(FrontCalculatorSymbolFunctionAbs, [{ key: "execute", value: function execute(params) { if (params.length !== 1) { throw 'Error: Expected one argument, got ' + params.length; } var number = params[0]; return Math.abs(number); } }]); return FrontCalculatorSymbolFunctionAbs; }(_frontCalculatorSymbolFunction.default); },{"../abstract/front.calculator.symbol.function.abstract":11}],20:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Math.abs() function. Expects one parameter. * Example: "abs(2)" => 2, "abs(-2)" => 2, "abs(0)" => 0 * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs */ var FrontCalculatorSymbolFunctionAvg = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolFunctionAvg, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolFunctionAvg); function FrontCalculatorSymbolFunctionAvg() { var _this; _classCallCheck(this, FrontCalculatorSymbolFunctionAvg); _this = _super.call(this); _this.identifiers = ['avg']; return _this; } _createClass(FrontCalculatorSymbolFunctionAvg, [{ key: "execute", value: function execute(params) { if (params.length < 1) { throw 'Error: Expected at least one argument, got ' + params.length; } var sum = 0.0; for (var i = 0; i < params.length; i++) { sum += params[i]; } return sum / params.length; } }]); return FrontCalculatorSymbolFunctionAvg; }(_frontCalculatorSymbolFunction.default); },{"../abstract/front.calculator.symbol.function.abstract":11}],21:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Math.ceil() function aka round fractions up. * Expects one parameter. * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil */ var FrontCalculatorSymbolFunctionCeil = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolFunctionCeil, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolFunctionCeil); function FrontCalculatorSymbolFunctionCeil() { var _this; _classCallCheck(this, FrontCalculatorSymbolFunctionCeil); _this = _super.call(this); _this.identifiers = ['ceil']; return _this; } _createClass(FrontCalculatorSymbolFunctionCeil, [{ key: "execute", value: function execute(params) { if (params.length !== 1) { throw 'Error: Expected one argument, got ' + params.length; } return Math.ceil(params[0]); } }]); return FrontCalculatorSymbolFunctionCeil; }(_frontCalculatorSymbolFunction.default); },{"../abstract/front.calculator.symbol.function.abstract":11}],22:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Math.floor() function aka round fractions down. * Expects one parameter. * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor */ var FrontCalculatorSymbolFunctionFloor = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolFunctionFloor, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolFunctionFloor); function FrontCalculatorSymbolFunctionFloor() { var _this; _classCallCheck(this, FrontCalculatorSymbolFunctionFloor); _this = _super.call(this); _this.identifiers = ['floor']; return _this; } _createClass(FrontCalculatorSymbolFunctionFloor, [{ key: "execute", value: function execute(params) { if (params.length !== 1) { throw 'Error: Expected one argument, got ' + params.length; } return Math.floor(params[0]); } }]); return FrontCalculatorSymbolFunctionFloor; }(_frontCalculatorSymbolFunction.default); },{"../abstract/front.calculator.symbol.function.abstract":11}],23:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 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(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Math.max() function. Expects at least one parameter. * Example: "max(1,2,3)" => 3, "max(1,-1)" => 1, "max(0,0)" => 0, "max(2)" => 2 * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max */ var FrontCalculatorSymbolFunctionMax = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolFunctionMax, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolFunctionMax); function FrontCalculatorSymbolFunctionMax() { var _this; _classCallCheck(this, FrontCalculatorSymbolFunctionMax); _this = _super.call(this); _this.identifiers = ['max']; return _this; } _createClass(FrontCalculatorSymbolFunctionMax, [{ key: "execute", value: function execute(params) { if (params.length < 1) { throw 'Error: Expected at least one argument, got ' + params.length; } return Math.max.apply(Math, _toConsumableArray(params)); } }]); return FrontCalculatorSymbolFunctionMax; }(_frontCalculatorSymbolFunction.default); },{"../abstract/front.calculator.symbol.function.abstract":11}],24:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 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(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Math.min() function. Expects at least one parameter. * Example: "min(1,2,3)" => 1, "min(1,-1)" => -1, "min(0,0)" => 0, "min(2)" => 2 * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min */ var FrontCalculatorSymbolFunctionMin = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolFunctionMin, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolFunctionMin); function FrontCalculatorSymbolFunctionMin() { var _this; _classCallCheck(this, FrontCalculatorSymbolFunctionMin); _this = _super.call(this); _this.identifiers = ['min']; return _this; } _createClass(FrontCalculatorSymbolFunctionMin, [{ key: "execute", value: function execute(params) { if (params.length < 1) { throw 'Error: Expected at least one argument, got ' + params.length; } return Math.min.apply(Math, _toConsumableArray(params)); } }]); return FrontCalculatorSymbolFunctionMin; }(_frontCalculatorSymbolFunction.default); },{"../abstract/front.calculator.symbol.function.abstract":11}],25:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Math.round() function aka rounds a float. * Expects one parameter. * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round */ var FrontCalculatorSymbolFunctionRound = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolFunctionRound, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolFunctionRound); function FrontCalculatorSymbolFunctionRound() { var _this; _classCallCheck(this, FrontCalculatorSymbolFunctionRound); _this = _super.call(this); _this.identifiers = ['round']; return _this; } _createClass(FrontCalculatorSymbolFunctionRound, [{ key: "execute", value: function execute(params) { if (params.length !== 1) { throw 'Error: Expected one argument, got ' + params.length; } return Math.round(params[0]); } }]); return FrontCalculatorSymbolFunctionRound; }(_frontCalculatorSymbolFunction.default); },{"../abstract/front.calculator.symbol.function.abstract":11}],26:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Operator for mathematical addition. * Example: "1+2" => 3 * * @see https://en.wikipedia.org/wiki/Addition * */ var FrontCalculatorSymbolOperatorAddition = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolOperatorAddition, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolOperatorAddition); function FrontCalculatorSymbolOperatorAddition() { var _this; _classCallCheck(this, FrontCalculatorSymbolOperatorAddition); _this = _super.call(this); _this.identifiers = ['+']; _this.precedence = 100; return _this; } _createClass(FrontCalculatorSymbolOperatorAddition, [{ key: "operate", value: function operate(leftNumber, rightNumber) { return leftNumber + rightNumber; } }]); return FrontCalculatorSymbolOperatorAddition; }(_frontCalculatorSymbolOperator.default); },{"../abstract/front.calculator.symbol.operator.abstract":12}],27:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Operator for mathematical division. * Example: "6/2" => 3, "6/0" => PHP warning * * @see https://en.wikipedia.org/wiki/Division_(mathematics) * */ var FrontCalculatorSymbolOperatorDivision = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolOperatorDivision, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolOperatorDivision); function FrontCalculatorSymbolOperatorDivision() { var _this; _classCallCheck(this, FrontCalculatorSymbolOperatorDivision); _this = _super.call(this); _this.identifiers = ['/']; _this.precedence = 200; return _this; } _createClass(FrontCalculatorSymbolOperatorDivision, [{ key: "operate", value: function operate(leftNumber, rightNumber) { var result = leftNumber / rightNumber; // // force to 0 // if (!isFinite(result)) { // return 0; // } return result; } }]); return FrontCalculatorSymbolOperatorDivision; }(_frontCalculatorSymbolOperator.default); },{"../abstract/front.calculator.symbol.operator.abstract":12}],28:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Operator for mathematical exponentiation. * Example: "3^2" => 9, "-3^2" => -9, "3^-2" equals "3^(-2)" * * @see https://en.wikipedia.org/wiki/Exponentiation * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow * */ var FrontCalculatorSymbolOperatorExponentiation = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolOperatorExponentiation, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolOperatorExponentiation); function FrontCalculatorSymbolOperatorExponentiation() { var _this; _classCallCheck(this, FrontCalculatorSymbolOperatorExponentiation); _this = _super.call(this); _this.identifiers = ['^']; _this.precedence = 300; return _this; } _createClass(FrontCalculatorSymbolOperatorExponentiation, [{ key: "operate", value: function operate(leftNumber, rightNumber) { return Math.pow(leftNumber, rightNumber); } }]); return FrontCalculatorSymbolOperatorExponentiation; }(_frontCalculatorSymbolOperator.default); },{"../abstract/front.calculator.symbol.operator.abstract":12}],29:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Operator for mathematical modulo operation. * Example: "5%3" => 2 * * @see https://en.wikipedia.org/wiki/Modulo_operation * */ var FrontCalculatorSymbolOperatorModulo = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolOperatorModulo, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolOperatorModulo); function FrontCalculatorSymbolOperatorModulo() { var _this; _classCallCheck(this, FrontCalculatorSymbolOperatorModulo); _this = _super.call(this); _this.identifiers = ['%']; _this.precedence = 200; return _this; } _createClass(FrontCalculatorSymbolOperatorModulo, [{ key: "operate", value: function operate(leftNumber, rightNumber) { return leftNumber % rightNumber; } }]); return FrontCalculatorSymbolOperatorModulo; }(_frontCalculatorSymbolOperator.default); },{"../abstract/front.calculator.symbol.operator.abstract":12}],30:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Operator for mathematical multiplication. * Example: "2*3" => 6 * * @see https://en.wikipedia.org/wiki/Multiplication * */ var FrontCalculatorSymbolOperatorMultiplication = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolOperatorMultiplication, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolOperatorMultiplication); function FrontCalculatorSymbolOperatorMultiplication() { var _this; _classCallCheck(this, FrontCalculatorSymbolOperatorMultiplication); _this = _super.call(this); _this.identifiers = ['*']; _this.precedence = 200; return _this; } _createClass(FrontCalculatorSymbolOperatorMultiplication, [{ key: "operate", value: function operate(leftNumber, rightNumber) { return leftNumber * rightNumber; } }]); return FrontCalculatorSymbolOperatorMultiplication; }(_frontCalculatorSymbolOperator.default); },{"../abstract/front.calculator.symbol.operator.abstract":12}],31:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** * Operator for mathematical subtraction. * Example: "2-1" => 1 * * @see https://en.wikipedia.org/wiki/Subtraction * */ var FrontCalculatorSymbolOperatorSubtraction = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) { _inherits(FrontCalculatorSymbolOperatorSubtraction, _FrontCalculatorSymbo); var _super = _createSuper(FrontCalculatorSymbolOperatorSubtraction); function FrontCalculatorSymbolOperatorSubtraction() { var _this; _classCallCheck(this, FrontCalculatorSymbolOperatorSubtraction); _this = _super.call(this); _this.identifiers = ['-']; _this.precedence = 100; /** * Notice: The subtraction operator is unary AND binary! * * @type {boolean} */ _this.operatesUnary = true; return _this; } _createClass(FrontCalculatorSymbolOperatorSubtraction, [{ key: "operate", value: function operate(leftNumber, rightNumber) { return leftNumber - rightNumber; } }]); return FrontCalculatorSymbolOperatorSubtraction; }(_frontCalculatorSymbolOperator.default); },{"../abstract/front.calculator.symbol.operator.abstract":12}]},{},[1]); chartjs-plugin-datalabels.min.js 0000644 00000030477 15162321603 0012722 0 ustar 00 /*! * chartjs-plugin-datalabels v0.6.0 * https://chartjs-plugin-datalabels.netlify.com * (c) 2019 Chart.js Contributors * Released under the MIT license */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("chart.js")):"function"==typeof define&&define.amd?define(["chart.js"],e):(t=t||self).ChartDataLabels=e(t.Chart)}(this,function(t){"use strict";var e=(t=t&&t.hasOwnProperty("default")?t.default:t).helpers,r=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)return window.devicePixelRatio;var t=window.screen;if(t)return(t.deviceXDPI||1)/(t.logicalXDPI||1)}return 1}(),n={toTextLines:function(t){var r,n=[];for(t=[].concat(t);t.length;)"string"==typeof(r=t.pop())?n.unshift.apply(n,r.split("\n")):Array.isArray(r)?t.push.apply(t,r):e.isNullOrUndef(t)||n.unshift(""+r);return n},toFontString:function(t){return!t||e.isNullOrUndef(t.size)||e.isNullOrUndef(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family},textSize:function(t,e,r){var n,i=[].concat(e),a=i.length,o=t.font,l=0;for(t.font=r.string,n=0;n<a;++n)l=Math.max(t.measureText(i[n]).width,l);return t.font=o,{height:a*r.lineHeight,width:l}},parseFont:function(r){var i=t.defaults.global,a=e.valueOrDefault(r.size,i.defaultFontSize),o={family:e.valueOrDefault(r.family,i.defaultFontFamily),lineHeight:e.options.toLineHeight(r.lineHeight,a),size:a,style:e.valueOrDefault(r.style,i.defaultFontStyle),weight:e.valueOrDefault(r.weight,null),string:""};return o.string=n.toFontString(o),o},bound:function(t,e,r){return Math.max(t,Math.min(e,r))},arrayDiff:function(t,e){var r,n,i,a,o=t.slice(),l=[];for(r=0,i=e.length;r<i;++r)a=e[r],-1===(n=o.indexOf(a))?l.push([a,1]):o.splice(n,1);for(r=0,i=o.length;r<i;++r)l.push([o[r],-1]);return l},rasterize:function(t){return Math.round(t*r)/r}};function i(t,e){var r=e.x,n=e.y;if(null===r)return{x:0,y:-1};if(null===n)return{x:1,y:0};var i=t.x-r,a=t.y-n,o=Math.sqrt(i*i+a*a);return{x:o?i/o:0,y:o?a/o:-1}}var a=0,o=1,l=2,s=4,u=8;function d(t,e,r){var n=a;return t<r.left?n|=o:t>r.right&&(n|=l),e<r.top?n|=u:e>r.bottom&&(n|=s),n}function f(t,e){var r,n,i=e.anchor,a=t;return e.clamp&&(a=function(t,e){for(var r,n,i,a=t.x0,f=t.y0,c=t.x1,h=t.y1,x=d(a,f,e),y=d(c,h,e);x|y&&!(x&y);)(r=x||y)&u?(n=a+(c-a)*(e.top-f)/(h-f),i=e.top):r&s?(n=a+(c-a)*(e.bottom-f)/(h-f),i=e.bottom):r&l?(i=f+(h-f)*(e.right-a)/(c-a),n=e.right):r&o&&(i=f+(h-f)*(e.left-a)/(c-a),n=e.left),r===x?x=d(a=n,f=i,e):y=d(c=n,h=i,e);return{x0:a,x1:c,y0:f,y1:h}}(a,e.area)),"start"===i?(r=a.x0,n=a.y0):"end"===i?(r=a.x1,n=a.y1):(r=(a.x0+a.x1)/2,n=(a.y0+a.y1)/2),function(t,e,r,n,i){switch(i){case"center":r=n=0;break;case"bottom":r=0,n=1;break;case"right":r=1,n=0;break;case"left":r=-1,n=0;break;case"top":r=0,n=-1;break;case"start":r=-r,n=-n;break;case"end":break;default:i*=Math.PI/180,r=Math.cos(i),n=Math.sin(i)}return{x:t,y:e,vx:r,vy:n}}(r,n,t.vx,t.vy,e.align)}var c={arc:function(t,e){var r=(t.startAngle+t.endAngle)/2,n=Math.cos(r),i=Math.sin(r),a=t.innerRadius,o=t.outerRadius;return f({x0:t.x+n*a,y0:t.y+i*a,x1:t.x+n*o,y1:t.y+i*o,vx:n,vy:i},e)},point:function(t,e){var r=i(t,e.origin),n=r.x*t.radius,a=r.y*t.radius;return f({x0:t.x-n,y0:t.y-a,x1:t.x+n,y1:t.y+a,vx:r.x,vy:r.y},e)},rect:function(t,e){var r=i(t,e.origin),n=t.x,a=t.y,o=0,l=0;return t.horizontal?(n=Math.min(t.x,t.base),o=Math.abs(t.base-t.x)):(a=Math.min(t.y,t.base),l=Math.abs(t.base-t.y)),f({x0:n,y0:a+l,x1:n+o,y1:a,vx:r.x,vy:r.y},e)},fallback:function(t,e){var r=i(t,e.origin);return f({x0:t.x,y0:t.y,x1:t.x,y1:t.y,vx:r.x,vy:r.y},e)}},h=t.helpers,x=n.rasterize;function y(t){var e=t._model.horizontal,r=t._scale||e&&t._xScale||t._yScale;if(!r)return null;if(void 0!==r.xCenter&&void 0!==r.yCenter)return{x:r.xCenter,y:r.yCenter};var n=r.getBasePixel();return e?{x:n,y:null}:{x:null,y:n}}function v(t,e,r){var n=t.shadowBlur,i=r.stroked,a=x(r.x),o=x(r.y),l=x(r.w);i&&t.strokeText(e,a,o,l),r.filled&&(n&&i&&(t.shadowBlur=0),t.fillText(e,a,o,l),n&&i&&(t.shadowBlur=n))}var _=function(t,e,r,n){var i=this;i._config=t,i._index=n,i._model=null,i._rects=null,i._ctx=e,i._el=r};h.extend(_.prototype,{_modelize:function(e,r,i,a){var o,l=this._index,s=h.options.resolve,u=n.parseFont(s([i.font,{}],a,l)),d=s([i.color,t.defaults.global.defaultFontColor],a,l);return{align:s([i.align,"center"],a,l),anchor:s([i.anchor,"center"],a,l),area:a.chart.chartArea,backgroundColor:s([i.backgroundColor,null],a,l),borderColor:s([i.borderColor,null],a,l),borderRadius:s([i.borderRadius,0],a,l),borderWidth:s([i.borderWidth,0],a,l),clamp:s([i.clamp,!1],a,l),clip:s([i.clip,!1],a,l),color:d,display:e,font:u,lines:r,offset:s([i.offset,0],a,l),opacity:s([i.opacity,1],a,l),origin:y(this._el),padding:h.options.toPadding(s([i.padding,0],a,l)),positioner:(o=this._el,o instanceof t.elements.Arc?c.arc:o instanceof t.elements.Point?c.point:o instanceof t.elements.Rectangle?c.rect:c.fallback),rotation:s([i.rotation,0],a,l)*(Math.PI/180),size:n.textSize(this._ctx,r,u),textAlign:s([i.textAlign,"start"],a,l),textShadowBlur:s([i.textShadowBlur,0],a,l),textShadowColor:s([i.textShadowColor,d],a,l),textStrokeColor:s([i.textStrokeColor,d],a,l),textStrokeWidth:s([i.textStrokeWidth,0],a,l)}},update:function(t){var e,r,i,a=this,o=null,l=null,s=a._index,u=a._config,d=h.options.resolve([u.display,!0],t,s);d&&(e=t.dataset.data[s],r=h.valueOrDefault(h.callback(u.formatter,[e,t]),e),(i=h.isNullOrUndef(r)?[]:n.toTextLines(r)).length&&(l=function(t){var e=t.borderWidth||0,r=t.padding,n=t.size.height,i=t.size.width,a=-i/2,o=-n/2;return{frame:{x:a-r.left-e,y:o-r.top-e,w:i+r.width+2*e,h:n+r.height+2*e},text:{x:a,y:o,w:i,h:n}}}(o=a._modelize(d,i,u,t)))),a._model=o,a._rects=l},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(t,e){var r,i=t.ctx,a=this._model,o=this._rects;this.visible()&&(i.save(),a.clip&&(r=a.area,i.beginPath(),i.rect(r.left,r.top,r.right-r.left,r.bottom-r.top),i.clip()),i.globalAlpha=n.bound(0,a.opacity,1),i.translate(x(e.x),x(e.y)),i.rotate(a.rotation),function(t,e,r){var n=r.backgroundColor,i=r.borderColor,a=r.borderWidth;(n||i&&a)&&(t.beginPath(),h.canvas.roundedRect(t,x(e.x)+a/2,x(e.y)+a/2,x(e.w)-a,x(e.h)-a,r.borderRadius),t.closePath(),n&&(t.fillStyle=n,t.fill()),i&&a&&(t.strokeStyle=i,t.lineWidth=a,t.lineJoin="miter",t.stroke()))}(i,o.frame,a),function(t,e,r,n){var i,a=n.textAlign,o=n.color,l=!!o,s=n.font,u=e.length,d=n.textStrokeColor,f=n.textStrokeWidth,c=d&&f;if(u&&(l||c))for(r=function(t,e,r){var n=r.lineHeight,i=t.w,a=t.x;return"center"===e?a+=i/2:"end"!==e&&"right"!==e||(a+=i),{h:n,w:i,x:a,y:t.y+n/2}}(r,a,s),t.font=s.string,t.textAlign=a,t.textBaseline="middle",t.shadowBlur=n.textShadowBlur,t.shadowColor=n.textShadowColor,l&&(t.fillStyle=o),c&&(t.lineJoin="round",t.lineWidth=f,t.strokeStyle=d),i=0,u=e.length;i<u;++i)v(t,e[i],{stroked:c,filled:l,w:r.w,x:r.x,y:r.y+r.h*i})}(i,a.lines,o.text,a),i.restore())}});var b=t.helpers,p=Number.MIN_SAFE_INTEGER||-9007199254740991,g=Number.MAX_SAFE_INTEGER||9007199254740991;function m(t,e,r){var n=Math.cos(r),i=Math.sin(r),a=e.x,o=e.y;return{x:a+n*(t.x-a)-i*(t.y-o),y:o+i*(t.x-a)+n*(t.y-o)}}function w(t,e){var r,n,i,a,o,l=g,s=p,u=e.origin;for(r=0;r<t.length;++r)i=(n=t[r]).x-u.x,a=n.y-u.y,o=e.vx*i+e.vy*a,l=Math.min(l,o),s=Math.max(s,o);return{min:l,max:s}}function k(t,e){var r=e.x-t.x,n=e.y-t.y,i=Math.sqrt(r*r+n*n);return{vx:(e.x-t.x)/i,vy:(e.y-t.y)/i,origin:t,ln:i}}var M=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};function S(t,e,r){var n=e.positioner(t,e),i=n.vx,a=n.vy;if(!i&&!a)return{x:n.x,y:n.y};var o=r.w,l=r.h,s=e.rotation,u=Math.abs(o/2*Math.cos(s))+Math.abs(l/2*Math.sin(s)),d=Math.abs(o/2*Math.sin(s))+Math.abs(l/2*Math.cos(s)),f=1/Math.max(Math.abs(i),Math.abs(a));return u*=i*f,d*=a*f,u+=e.offset*i,d+=e.offset*a,{x:n.x+u,y:n.y+d}}b.extend(M.prototype,{center:function(){var t=this._rect;return{x:t.x+t.w/2,y:t.y+t.h/2}},update:function(t,e,r){this._rotation=r,this._rect={x:e.x+t.x,y:e.y+t.y,w:e.w,h:e.h}},contains:function(t){var e=this._rect;return!((t=m(t,this.center(),-this._rotation)).x<e.x-1||t.y<e.y-1||t.x>e.x+e.w+2||t.y>e.y+e.h+2)},intersects:function(t){var e,r,n,i=this._points(),a=t._points(),o=[k(i[0],i[1]),k(i[0],i[3])];for(this._rotation!==t._rotation&&o.push(k(a[0],a[1]),k(a[0],a[3])),e=0;e<o.length;++e)if(r=w(i,o[e]),n=w(a,o[e]),r.max<n.min||n.max<r.min)return!1;return!0},_points:function(){var t=this._rect,e=this._rotation,r=this.center();return[m({x:t.x,y:t.y},r,e),m({x:t.x+t.w,y:t.y},r,e),m({x:t.x+t.w,y:t.y+t.h},r,e),m({x:t.x,y:t.y+t.h},r,e)]}});var C={prepare:function(t){var e,r,n,i,a,o=[];for(e=0,n=t.length;e<n;++e)for(r=0,i=t[e].length;r<i;++r)a=t[e][r],o.push(a),a.$layout={_box:new M,_hidable:!1,_visible:!0,_set:e,_idx:r};return o.sort(function(t,e){var r=t.$layout,n=e.$layout;return r._idx===n._idx?r._set-n._set:n._idx-r._idx}),this.update(o),o},update:function(t){var e,r,n,i,a,o=!1;for(e=0,r=t.length;e<r;++e)i=(n=t[e]).model(),(a=n.$layout)._hidable=i&&"auto"===i.display,a._visible=n.visible(),o|=a._hidable;o&&function(t){var e,r,n,i,a,o;for(e=0,r=t.length;e<r;++e)(i=(n=t[e]).$layout)._visible&&(a=n.geometry(),o=S(n._el._model,n.model(),a),i._box.update(o,a,n.rotation()));(function(t,e){var r,n,i,a;for(r=t.length-1;r>=0;--r)for(i=t[r].$layout,n=r-1;n>=0&&i._visible;--n)(a=t[n].$layout)._visible&&i._box.intersects(a._box)&&e(i,a)})(t,function(t,e){var r=t._hidable,n=e._hidable;r&&n||n?e._visible=!1:r&&(t._visible=!1)})}(t)},lookup:function(t,e){var r,n;for(r=t.length-1;r>=0;--r)if((n=t[r].$layout)&&n._visible&&n._box.contains(e))return{dataset:n._set,label:t[r]};return null},draw:function(t,e){var r,n,i,a,o,l;for(r=0,n=e.length;r<n;++r)(a=(i=e[r]).$layout)._visible&&(o=i.geometry(),l=S(i._el._view,i.model(),o),a._box.update(l,o,i.rotation()),i.draw(t,l))}},z=t.helpers,A={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:function(t){if(z.isNullOrUndef(t))return null;var e,r,n,i=t;if(z.isObject(t))if(z.isNullOrUndef(t.label))if(z.isNullOrUndef(t.r))for(i="",n=0,r=(e=Object.keys(t)).length;n<r;++n)i+=(0!==n?", ":"")+e[n]+": "+t[e[n]];else i=t.r;else i=t.label;return""+i},listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},O=t.helpers,D="$datalabels";function $(t,e,r){var n=e&&e[r.dataset];if(n){var i=r.label,a=i.$context;!0===O.callback(n,[a])&&(t[D]._dirty=!0,i.update(a))}}function P(t,e){var r,n,i=t[D],a=i._listeners;if(a.enter||a.leave){if("mousemove"===e.type)n=C.lookup(i._labels,e);else if("mouseout"!==e.type)return;r=i._hovered,i._hovered=n,function(t,e,r,n){var i,a;(r||n)&&(r?n?r.label!==n.label&&(a=i=!0):a=!0:i=!0,a&&$(t,e.leave,r),i&&$(t,e.enter,n))}(t,a,r,n)}}t.defaults.global.plugins.datalabels=A;var N={id:"datalabels",beforeInit:function(t){t[D]={_actives:[]}},beforeUpdate:function(t){var e=t[D];e._listened=!1,e._listeners={},e._datasets=[],e._labels=[]},afterDatasetUpdate:function(t,e,r){var n,i,a,o=e.index,l=t[D],s=l._datasets[o]=[],u=t.isDatasetVisible(o),d=t.data.datasets[o],f=function(t,e){var r=t.datalabels;return!1===r?null:(!0===r&&(r={}),O.merge({},[e,r]))}(d,r),c=e.meta.data||[],h=c.length,x=t.ctx;for(x.save(),n=0;n<h;++n)i=c[n],u&&i&&!i.hidden&&!i._model.skip?(s.push(a=new _(f,x,i,n)),a.update(a.$context={active:!1,chart:t,dataIndex:n,dataset:d,datasetIndex:o})):a=null,i[D]=a;x.restore(),O.merge(l._listeners,f.listeners||{},{merger:function(t,r,n){r[t]=r[t]||{},r[t][e.index]=n[t],l._listened=!0}})},afterUpdate:function(t,e){t[D]._labels=C.prepare(t[D]._datasets,e)},afterDatasetsDraw:function(t){C.draw(t,t[D]._labels)},beforeEvent:function(t,e){if(t[D]._listened)switch(e.type){case"mousemove":case"mouseout":P(t,e);break;case"click":!function(t,e){var r=t[D],n=r._listeners.click,i=n&&C.lookup(r._labels,e);i&&$(t,n,i)}(t,e)}},afterEvent:function(e){var r,i,a,o,l=e[D],s=l._actives,u=l._actives=e.lastActive||[],d=n.arrayDiff(s,u);for(r=0,i=d.length;r<i;++r)(a=d[r])[1]&&(o=a[0][D])&&(o.$context.active=1===a[1],o.update(o.$context));(l._dirty||d.length)&&(C.update(l._labels),function(e){if(!e.animating){for(var r=t.animationService.animations,n=0,i=r.length;n<i;++n)if(r[n].chart===e)return;e.render({duration:1,lazy:!0})}}(e)),delete l._dirty}};return t.plugins.register(N),N}); front.pagination.js 0000644 00000060023 15162321604 0010363 0 ustar 00 // the semi-colon before function invocation is a safety net against concatenated // scripts and/or other plugins which may not be closed properly. ;// noinspection JSUnusedLocalSymbols (function ($, window, document, undefined) { "use strict"; // undefined is used here as the undefined global variable in ECMAScript 3 is // mutable (ie. it can be changed by someone else). undefined isn't really being // passed in so we can ensure the value of it is truly undefined. In ES5, undefined // can no longer be modified. // window and document are passed through as local variables rather than global // as this (slightly) quickens the resolution process and can be more efficiently // minified (especially when both are regularly referenced in your plugin). // Create the defaults once var pluginName = "forminatorFrontPagination", defaults = { totalSteps: 0, step: 0, hashStep: 0, inline_validation: false }; // The actual plugin constructor function ForminatorFrontPagination(element, options) { this.element = $(element); this.$el = this.element; this.totalSteps = 0; this.step = 0; this.finished = false; this.hashStep = false; this.next_button_txt = ''; this.prev_button_txt = ''; this.custom_label = []; this.form_id = 0; this.element = ''; // jQuery has an extend method which merges the contents of two or // more objects, storing the result in the first object. The first object // is generally empty as we don't want to alter the default options for // future instances of the plugin this.settings = $.extend({}, defaults, options); this._defaults = defaults; this._name = pluginName; this.init(); } // Avoid Plugin.prototype conflicts $.extend(ForminatorFrontPagination.prototype, { init: function () { var self = this; var draftPage = !! this.$el.data( 'draft-page' ) ? this.$el.data( 'draft-page' ) : 0; this.next_button = this.settings.next_button ? this.settings.next_button : window.ForminatorFront.cform.pagination_next; this.prev_button = this.settings.prev_button ? this.settings.prev_button : window.ForminatorFront.cform.pagination_prev; if (this.$el.find('input[name=form_id]').length > 0) { this.form_id = this.$el.find('input[name=form_id]').val(); } this.totalSteps = this.settings.totalSteps; this.step = this.settings.step; this.quiz = this.settings.quiz; this.element = this.$el.find('[data-step=' + this.step + ']').data('name'); if (this.form_id && typeof window.Forminator_Cform_Paginations === 'object' && typeof window.Forminator_Cform_Paginations[this.form_id] === 'object') { this.custom_label = window.Forminator_Cform_Paginations[this.form_id]; } if ( draftPage > 0 ) { this.go_to( draftPage, true ); } else if (this.settings.hashStep && this.step > 0) { this.go_to(this.step, true); } else if ( this.quiz ) { this.go_to(0, true); } else { this.go_to(0, false); } this.render_navigation(); this.render_bar_navigation(); this.render_footer_navigation( this.form_id ); this.init_events(); this.update_navigation(); this.$el.find('.forminator-button.forminator-button-back, .forminator-button.forminator-button-next, .forminator-button.forminator-button-submit').on("click", function (e) { e.preventDefault(); $(this).trigger('forminator.front.pagination.move'); self.resetRichTextEditorHeight(); }); this.$el.on('click', '.forminator-result--view-answers', function(e){ e.preventDefault(); $(this).trigger('forminator.front.pagination.move'); }); this.update_buttons(); }, init_events: function () { var self = this; this.$el.find('.forminator-button-back').on('forminator.front.pagination.move',function (e) { self.handle_click('prev'); }); this.$el.on('forminator.front.pagination.move', '.forminator-result--view-answers', function (e) { self.handle_click('prev'); }); this.$el.find('.forminator-button-next').on('forminator.front.pagination.move', function (e) { self.handle_click('next'); }); this.$el.find('.forminator-step').on("click", function (e) { e.preventDefault(); var step = $(this).data('nav'); self.handle_step(step); }); this.$el.on('reset', function (e) { self.on_form_reset(e); }); this.$el.on('forminator:quiz:submit:success', function (e, ajaxData, formData, resultText) { if ( resultText ) { self.move_to_results(e); } }); this.$el.on('forminator.front.pagination.focus.input', function (e, input) { self.on_focus_input(e, input); }); }, /** * Move quiz to rezult page */ move_to_results: function (e) { this.finished = true; if ( this.$el.find('.forminator-submit-rightaway').length ) { this.$el.find('#forminator-submit').removeClass('forminator-hidden'); } else { this.handle_click('next'); } }, /** * On reset event of Form * * @since 1.0.3 * * @param e */ on_form_reset: function (e) { // Trigger pagination to first page this.go_to(0, true); this.update_buttons(); }, /** * On Input focused * * @param e * @param input */ on_focus_input: function (e, input) { //Go to page where element exist var step = this.get_page_of_input(input); this.go_to(step, true); this.update_buttons(); }, render_footer_navigation: function( form_id ) { var footer_html = '', paypal_field = '', footer_align = ( this.custom_label['has-paypal'] === true ) ? ' style="align-items: flex-start;"' : '', save_draft_btn = this.$el.find( '.forminator-save-draft-link' ).length ? this.$el.find( '.forminator-save-draft-link' ) : '' ; if ( this.custom_label[ this.element ] && this.custom_label[ 'pagination-labels' ] === 'custom' ){ this.prev_button_txt = this.custom_label[ this.element ][ 'prev-text' ] !== '' ? this.custom_label[ this.element ][ 'prev-text' ] : this.prev_button; this.next_button_txt = this.custom_label[ this.element ][ 'next-text' ] !== '' ? this.custom_label[ this.element ][ 'next-text' ] : this.next_button; } else { this.prev_button_txt = this.prev_button; this.next_button_txt = this.next_button; } if ( this.$el.hasClass('forminator-design--material') ) { footer_html = '<div class="forminator-pagination-footer"' + footer_align + '>' + '<button class="forminator-button forminator-button-back"><span class="forminator-button--mask" aria-label="hidden"></span><span class="forminator-button--text">' + this.prev_button_txt + '</span></button>' + '<button class="forminator-button forminator-button-next"><span class="forminator-button--mask" aria-label="hidden"></span><span class="forminator-button--text">' + this.next_button_txt + '</span></button>'; if( this.custom_label[ 'has-paypal' ] === true ) { paypal_field = ( this.custom_label['paypal-id'] ) ? this.custom_label['paypal-id'] : ''; footer_html += '<div class="forminator-payment forminator-button-paypal forminator-hidden ' + paypal_field + '-payment" id="paypal-button-container-' + form_id + '">'; } footer_html += '</div>'; this.$el.append( footer_html ); } else { footer_html = '<div class="forminator-pagination-footer"' + footer_align + '>' + '<button class="forminator-button forminator-button-back">' + this.prev_button_txt + '</button>' + '<button class="forminator-button forminator-button-next">' + this.next_button_txt + '</button>'; if( this.custom_label['has-paypal'] === true ) { paypal_field = ( this.custom_label['paypal-id'] ) ? this.custom_label['paypal-id'] : ''; footer_html += '<div class="forminator-payment forminator-button-paypal forminator-hidden ' + paypal_field + '-payment" id="paypal-button-container-' + form_id + '">'; } footer_html += '</div>'; this.$el.append( footer_html ); } if ( '' !== save_draft_btn ) { save_draft_btn.insertBefore( this.$el.find( '.forminator-button-next' ) ); } }, render_bar_navigation: function () { var $navigation = this.$el.find( '.forminator-pagination-progress' ); var $progressLabel = '<div class="forminator-progress-label">0%</div>', $progressBar = '<div class="forminator-progress-bar"><span style="width: 0%"></span></div>' ; if ( ! $navigation.length ) return; $navigation.html( $progressLabel + $progressBar ); this.calculate_bar_percentage(); }, calculate_bar_percentage: function () { var total = this.totalSteps, current = this.step + 1, $progress = this.$el ; if ( ! $progress.length ) return; var percentage = Math.round( (current / total) * 100 ); $progress.find( '.forminator-progress-label' ).html( percentage + '%' ); $progress.find( '.forminator-progress-bar span' ).css( 'width', percentage + '%' ); }, encodeHTMLEntities( value ) { const textArea = document.createElement( 'textarea' ); textArea.innerText = value; return textArea.innerHTML; }, render_navigation: function () { var $navigation = this.$el.find('.forminator-pagination-steps'); var finalSteps = this.$el.find('.forminator-pagination-start'); if ( ! $navigation.length ) return; const render = $( this.$el ).data( 'forminator-render' ) || ''; var steps = this.$el.find( '.forminator-pagination' ).not( '.forminator-pagination-start' ); var basicDesign = this.$el.hasClass('forminator-design--basic'); $navigation.append( '<div class="forminator-break"></div>' ); var self = this; steps.each( function() { var $step = $( this ), $stepLabel = self.encodeHTMLEntities( $step.data( 'label' ) ), $stepNumb = $step.data('step') - 1, $stepControl = 'forminator-custom-form-' + self.form_id + '-' + render + '--page-' + $stepNumb, $stepId = $stepControl + '-label' ; var $stepClass = 'forminator-step forminator-step-' + $stepNumb; if ( basicDesign ) { $stepClass += ' has-text-color'; } var $stepMarkup = '<button role="tab" id="' + $stepId + '" class="' + $stepClass + '" aria-selected="false" aria-controls="' + $stepControl + '" data-nav="' + $stepNumb + '">' + '<span class="forminator-step-label">' + $stepLabel + '</span>' + '<span class="forminator-step-dot" aria-hidden="true"></span>' + '</button>'; var $stepBreak = '<div class="forminator-break" aria-hidden="true"></div>'; $navigation.append( $stepMarkup + $stepBreak ); }); finalSteps.each(function () { var $step = $(this), label = self.encodeHTMLEntities( $step.data( 'label' ) ), numb = steps.length, control = 'forminator-custom-form-' + self.form_id + '--page-' + numb, stepid = control + '-label' ; var $stepClass = 'forminator-step forminator-step-' + numb if ( basicDesign ) { $stepClass += ' has-text-color'; } var $stepMarkup = '<button role="tab" id="' + stepid + '" class="' + $stepClass + '" data-nav="' + numb + '" aria-selected="false" aria-controls="' + control + '">' + '<span class="forminator-step-label">' + label + '</span>' + '<span class="forminator-step-dot" aria-hidden="true"></span>' + '</button>'; var $stepBreak = '<div class="forminator-break" aria-hidden="true"></div>'; $navigation.append( $stepMarkup + $stepBreak ); }); }, /** * Handle step click * * @param step */ handle_step: function( step ) { if ( this.settings.inline_validation ) { for ( var i = 0; i < step; i++ ) { if ( this.step <= i ) { if ( ! this.is_step_inputs_valid( i ) ) { this.go_to( i, true ); return; } } } } this.go_to( step, true ); this.update_buttons(); }, handle_click: function (type) { var self = this; if (type === "prev" && this.step !== 0) { this.go_to(this.step - 1, true); this.update_buttons(); } else if (type === "next") { //do validation before next if inline validation enabled if (this.settings.inline_validation) { if ( ! this.is_step_inputs_valid( this.step ) ) { return; } } if(typeof this.$el.data().forminatorFrontPayment !== "undefined") { var payment = this.$el.data().forminatorFrontPayment, page = this.$el.find('[data-step=' + this.step + ']'), hasStripe = page.find(".forminator-stripe-element").not(".forminator-hidden .forminator-stripe-element") ; // Check if Stripe exists on current step if (hasStripe.length > 0) { payment._stripe.createToken(payment._cardElement).then(function (result) { if (result.error) { payment.showCardError(result.error.message, true); } else { payment.hideCardError(); self.go_to(self.step + 1, true); self.update_buttons(); } }); } else { this.go_to(this.step + 1, true); this.update_buttons(); } } else { this.go_to(this.step + 1, true); this.update_buttons(); } } // re-init textarea floating labels. var form = $( this.$el ); var textarea = form.find( '.forminator-textarea' ); var isMaterial = form.hasClass( 'forminator-design--material' ); if ( isMaterial ) { if ( textarea.length ) { textarea.each( function() { FUI.textareaMaterial( this ); }); } } }, /** * Check current inputs on step is in valid state */ is_step_inputs_valid: function ( step ) { var valid = true, errors = 0, validator = this.$el.data('validator'), page = this.$el.find('[data-step=' + step + ']'); //inline validation disabled if (typeof validator === 'undefined') { return true; } //get fields on current page page.find("input, select, textarea") .not(":submit, :reset, :image, :disabled") .not('[gramm="true"]') .each(function (key, element) { if ( $( element ).is( ':hidden:not(.forminator-wp-editor-required, .forminator-input-file-required, input[name$="_data"])' ) && ! $( element ).closest( '.forminator-pagination' ) .length ) { return; } valid = validator.element(element); if (!valid) { if (errors === 0) { // focus on first error element.focus(); } errors++; } }); return errors === 0; }, /** * Get page on the input * * @since 1.0.3 * * @param input * @returns {number|*} */ get_page_of_input: function(input) { var step_page = this.step; var page = $(input).closest('.forminator-pagination'); if (page.length > 0) { var step = $(page).data('step'); if (typeof step !== 'undefined') { step_page = +step; } } return step_page; }, update_buttons: function () { var hasDraft = this.$el.hasClass( 'draft-enabled' ), self = this; if (this.step === 0) { if ( ! hasDraft ) { this.$el.find('.forminator-button-back').closest( '.forminator-pagination-footer' ).css({ 'justify-content': 'flex-end' }); } this.$el.find('.forminator-button-back').addClass( 'forminator-hidden' ); this.$el.find('.forminator-button-next').removeClass('forminator-hidden'); } else { if ( this.totalSteps > 1 ) { if ( ! hasDraft ) { this.$el.find('.forminator-button-back').closest( '.forminator-pagination-footer' ).css({ 'justify-content': 'space-between' }); } this.$el.find('.forminator-button-back, .forminator-button-next').removeClass('forminator-hidden'); } } if (this.step === this.totalSteps && ! this.finished ) { //keep pagination content on last step before submit this.step--; this.$el.trigger( 'submit' ); } var submitButtonClass = this.settings.submitButtonClass; if ( this.step === ( this.totalSteps - 1 ) && ! this.finished ) { var submit_button_text = this.$el.find('.forminator-pagination-submit').html(), loadingText = this.$el.find('.forminator-pagination-submit').data('loading'), last_button_txt = ( this.custom_label[ 'pagination-labels' ] === 'custom' && this.custom_label['last-previous'] !== '' ) ? this.custom_label['last-previous'] : this.prev_button, forminatorPayment = self.$el.find('.forminator-payment'), nextBtn = this.$el.find('.forminator-button-next'), submitButton = this.$el.find( '.forminator-button-submit' ); if ( this.$el.hasClass('forminator-design--material') ) { this.$el.find('.forminator-button-back .forminator-button--text').html( last_button_txt ); nextBtn.removeClass('forminator-button-next').attr('id', 'forminator-submit'); setTimeout( function() { nextBtn .addClass('forminator-button-submit ' + submitButtonClass ) .find('.forminator-button--text') .html('') .html(submit_button_text).data('loading', loadingText); self.$el.trigger( 'forminator.front.pagination.buttons.updated' ); }, 20 ); } else { this.$el.find('.forminator-button-back').html( last_button_txt ); nextBtn.removeClass( 'forminator-button-next' ).attr( 'id', 'forminator-submit' ); setTimeout( function() { nextBtn .addClass( 'forminator-button-submit ' + submitButtonClass ) .html( submit_button_text ).data('loading', loadingText); self.$el.trigger( 'forminator.front.pagination.buttons.updated' ); }, 20 ); } // Redeclare submit button. setTimeout( function() { submitButton = self.$el.find( '.forminator-button-submit' ); }, 30 ); if ( this.$el.hasClass('forminator-quiz') && ! submit_button_text ) { submitButton.addClass('forminator-hidden'); if ( this.$el.find( '.forminator-submit-rightaway').length ) { submitButton.html( window.ForminatorFront.quiz.view_results ); } } if( this.custom_label['has-paypal'] === true ) { forminatorPayment.attr('id', 'forminator-paypal-submit'); setTimeout( function() { if ( ! window.paypalHasCondition.includes( self.$el.data( 'form-id' ) ) ) { submitButton.addClass('forminator-hidden'); forminatorPayment.removeClass( 'forminator-hidden' ); } }, 40 ); } if ( forminatorPayment.find('iframe').length > 0 ) { forminatorPayment.find('iframe').width('100%'); } } else { this.element = this.$el.find('.forminator-pagination[data-step=' + this.step + ']').data('name'); if ( this.custom_label[this.element] && this.custom_label['pagination-labels'] === 'custom'){ this.prev_button_txt = this.custom_label[this.element]['prev-text'] !== '' ? this.custom_label[this.element]['prev-text'] : this.prev_button; this.next_button_txt = this.custom_label[this.element]['next-text'] !== '' ? this.custom_label[this.element]['next-text'] : this.next_button; }else{ this.prev_button_txt = this.prev_button; this.next_button_txt = this.next_button; } if ( this.step === ( this.totalSteps - 1 ) && this.finished ) { this.next_button_txt = window.ForminatorFront.quiz.view_results; } if ( this.$el.hasClass('forminator-design--material') ) { this.$el.find( '#forminator-submit' ) .removeAttr( 'id' ) .removeClass( 'forminator-button-submit forminator-hidden ' + submitButtonClass ) .addClass( 'forminator-button-next' ); if( this.custom_label['has-paypal'] === true ) { this.$el.find( '#forminator-paypal-submit' ).removeAttr( 'id' ).addClass('forminator-hidden'); this.$el.find( '.forminator-button-next' ).removeClass( 'forminator-button-submit forminator-hidden ' + submitButtonClass ); } this.$el.find( '.forminator-button-back .forminator-button--text' ).html( this.prev_button_txt ); this.$el.find( '.forminator-button-next .forminator-button--text' ).html( this.next_button_txt ); } else { this.$el.find( '#forminator-submit' ) .removeAttr( 'id' ) .removeClass( 'forminator-button-submit forminator-hidden' ) .addClass( 'forminator-button-next' ); if( this.custom_label['has-paypal'] === true ) { this.$el.find( '#forminator-paypal-submit' ).removeAttr( 'id' ).addClass('forminator-hidden'); this.$el.find('.forminator-button-next').removeClass( 'forminator-button-submit forminator-hidden' ); } this.$el.find( '.forminator-button-back' ).html( this.prev_button_txt ); this.$el.find( '.forminator-button-next' ).html( this.next_button_txt ); } if ( this.step === this.totalSteps && this.finished ) { this.$el.find('.forminator-button-next, .forminator-button-back').addClass( 'forminator-hidden' ); } this.$el.trigger( 'forminator.front.pagination.buttons.updated' ); } // Reset the conditions to check if submit/paypal buttons should be visible this.$el.trigger( 'forminator.front.condition.restart' ); }, go_to: function (step, scrollToTop) { this.step = step; if (step === this.totalSteps && ! this.finished ) return false; // Hide all parts this.$el.find('.forminator-pagination').css({ 'height': '0', 'opacity': '0', 'visibility': 'hidden' }).attr( 'aria-hidden', 'true' ).attr( 'hidden', true ); this.$el.find('.forminator-pagination .forminator-pagination--content').hide(); // Show desired page this.$el.find('[data-step=' + step + ']').css({ 'height': 'auto', 'opacity': '1', 'visibility': 'visible' }).removeAttr( 'aria-hidden' ).removeAttr( 'hidden' ); this.$el.find('[data-step=' + step + '] .forminator-pagination--content').show(); //exec responsive captcha var forminatorFront = this.$el.data('forminatorFront'); if (typeof forminatorFront !== 'undefined') { forminatorFront.responsive_captcha(); } this.update_navigation(); if (scrollToTop) { this.scroll_to_top_form(); } }, update_navigation: function () { // Update navigation this.$el.find( '.forminator-current' ).attr( 'aria-selected', 'false' ); this.$el.find( '.forminator-current' ).removeClass('forminator-current' ); this.$el.find( '.forminator-step-' + this.step ).attr( 'aria-selected', 'true' ); this.$el.find( '.forminator-step-' + this.step ).addClass( 'forminator-current' ); this.$el.find( '.forminator-pagination:not(:hidden)' ).find( '.forminator-answer input' ).first().trigger( 'change' ); this.calculate_bar_percentage(); }, /** * Reset vertical screen position between sections * https://app.asana.com/0/385581670491499/784073712068017/f * Support Hustle Modal */ scroll_to_top_form: function () { var self = this; var $element = this.$el; // find first input row var first_input_row = this.$el.find('.forminator-row').not(':hidden').first(); if (first_input_row.length) { $element = first_input_row; } if ($element.length) { var parent_selector = 'html,body'; // check inside sui modal if (this.$el.closest('.sui-dialog').length > 0) { parent_selector = '.sui-dialog'; } // check inside hustle modal (prioritize) if (this.$el.closest('.wph-modal').length > 0) { parent_selector = '.wph-modal'; } $element.focus(); const minScrollHeight = $( window ).height() / 2; let scrollTop = $element.offset().top - Math.max( minScrollHeight, $( window ).height() - $element.outerHeight( true ) ) / 2; if ( this.quiz ) { scrollTop = $element.offset().top; if ( $( '#wpadminbar' ).length ) { scrollTop -= 35; } } $(parent_selector).animate({scrollTop: scrollTop}, 500, function () { if (!$element.attr("tabindex")) { $element.attr("tabindex", -1); } }); } }, resetRichTextEditorHeight: function () { if ( typeof tinyMCE !== 'undefined' ) { var form = this.$el, textarea = form.find( '.forminator-textarea' ); textarea.each( function() { var tmceId = $( this ).attr( 'id' ); if ( 0 !== form.find( '#'+ tmceId + '_ifr' ).length && form.find( '#'+ tmceId + '_ifr' ).is( ':visible' ) ) { form.find( '#' + tmceId + '_ifr' ).height( $( this ).height() ); } }); } }, }); // A really lightweight plugin wrapper around the constructor, // preventing against multiple instantiations $.fn[pluginName] = function (options) { return this.each(function () { if (!$.data(this, pluginName)) { $.data(this, pluginName, new ForminatorFrontPagination(this, options)); } }); }; })(jQuery, window, document); front.validate.js 0000644 00000060625 15162321604 0010033 0 ustar 00 // the semi-colon before function invocation is a safety net against concatenated // scripts and/or other plugins which may not be closed properly. ;// noinspection JSUnusedLocalSymbols (function ($, window, document, undefined) { "use strict"; // undefined is used here as the undefined global variable in ECMAScript 3 is // mutable (ie. it can be changed by someone else). undefined isn't really being // passed in so we can ensure the value of it is truly undefined. In ES5, undefined // can no longer be modified. // window and document are passed through as local variables rather than global // as this (slightly) quickens the resolution process and can be more efficiently // minified (especially when both are regularly referenced in your plugin). // Create the defaults once var pluginName = "forminatorFrontValidate", ownMethods = {}, defaults = { rules: {}, messages: {} }; // The actual plugin constructor function ForminatorFrontValidate(element, options) { this.element = element; this.$el = $(this.element); // jQuery has an extend method which merges the contents of two or // more objects, storing the result in the first object. The first object // is generally empty as we don't want to alter the default options for // future instances of the plugin this.settings = $.extend({}, defaults, options); this._defaults = defaults; this._name = pluginName; this.init(); } // Avoid Plugin.prototype conflicts $.extend( ForminatorFrontValidate.prototype, { init: function () { $( '.forminator-select2' ).on('change', this.element, function (e, param1) { if ( 'forminator_emulate_trigger' !== param1 ) { $( this ).trigger('focusout'); } }); var self = this; var submitted = false; var $form = this.$el; var rules = self.settings.rules; var messages = self.settings.messages; // Duplicate rules for new repeated Group fields. if ( $form.hasClass( 'forminator-grouped-fields' ) ) { let suffix = $form.data( 'suffix' ); $.each( rules, function ( key, val ) { // Separate keys with [] at the end. const newKey = key.replace( /(.+?)(\[\])?$/g, '$1' + '-' + suffix + '$2' ); if ( ! $form.find( '[name="' + newKey + '"]' ).length && ! $form.find( '#' + newKey.replace( '[]', '' ) ).length ) { return; } rules[ newKey ] = val; messages[ newKey ] = messages[ key ]; } ); $form = $form.closest( 'form.forminator-ui' ); } $form.data('validator', null).unbind('validate').validate({ ignore( index, element ) { const validationDisabled = $( '#forminator-field-disable_validations' ).is(':checked'); // Add support for hidden required fields (uploads, wp_editor) and for skipping pagination when required. return ( validationDisabled || ( $( element ).is( ':hidden:not(.do-validate)' ) && ! $( element ).closest( '.forminator-pagination' ).length ) || $( element ).closest( '.forminator-hidden' ).length ); }, errorPlacement: function (error, element) { $form.trigger('validation:error'); }, showErrors: function(errorMap, errorList) { if( submitted && errorList.length > 0 ) { $form.find( '.forminator-response-message' ).html( '<ul></ul>' ); jQuery.each( errorList, function( key, error ) { $form.find( '.forminator-response-message ul' ).append( '<li>' + error.message + '</li>' ); }); $form.find( '.forminator-response-message' ) .removeAttr( 'aria-hidden' ) .prop( 'tabindex', '-1' ) .addClass( 'forminator-accessible' ) ; } submitted = false; this.defaultShowErrors(); $form.trigger('validation:showError', errorList); }, invalidHandler: function(form, validator){ submitted = true; $form.trigger('validation:invalid'); }, onfocusout: function ( element ) { //datepicker will be validated when its closed if ( $( element ).hasClass('hasDatepicker') === false ) { $( element ).valid(); } //validate Confirm email. if ( $( element ).hasClass( 'forminator-email--field' ) ) { let name = $( element ).attr( 'name' ), confirmEmail = $( 'input[name="confirm_' + name + '"]' ); if ( confirmEmail.length && confirmEmail.val() ) { confirmEmail.valid(); } } $( element ).trigger('validation:focusout'); }, highlight: function (element, errorClass, message) { var holder = $( element ); var holderField = holder.closest( '.forminator-field' ); var holderDate = holder.closest( '.forminator-date-input' ); var holderTime = holder.closest( '.forminator-timepicker' ); var holderError = ''; var getColumn = false; var getError = false; var getDesc = false; var errorMessage = this.errorMap[element.name]; var errorId = holder.attr('id') + '-error'; var ariaDescribedby = holder.attr('aria-describedby'); var errorMarkup = '<span class="forminator-error-message" id="'+ errorId +'"></span>'; if ( holderDate.length > 0 ) { getColumn = holderDate.parent(); getError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' ); getDesc = getColumn.find( '.forminator-description' ); errorMarkup = '<span class="forminator-error-message" data-error-field="' + holder.data( 'field' ) + '" id="'+ errorId +'"></span>'; if ( 0 === getError.length ) { if ( 'day' === holder.data( 'field' ) ) { if ( getColumn.find( '.forminator-error-message[data-error-field="year"]' ).length ) { $( errorMarkup ).insertBefore( getColumn.find( '.forminator-error-message[data-error-field="year"]' ) ); } else { if ( 0 === getDesc.length ) { getColumn.append( errorMarkup ); } else { $( errorMarkup ).insertBefore( getDesc ); } } if ( 0 === holderField.find( '.forminator-error-message' ).length ) { holderField.append( '<span class="forminator-error-message" id="'+ errorId +'"></span>' ); } } if ( 'month' === holder.data( 'field' ) ) { if ( getColumn.find( '.forminator-error-message[data-error-field="day"]' ).length ) { $( errorMarkup ).insertBefore( getColumn.find( '.forminator-error-message[data-error-field="day"]' ) ); } else { if ( 0 === getDesc.length ) { getColumn.append( errorMarkup ); } else { $( errorMarkup ).insertBefore( getDesc ); } } if ( 0 === holderField.find( '.forminator-error-message' ).length ) { holderField.append( '<span class="forminator-error-message" id="'+ errorId +'"></span>' ); } } if ( 'year' === holder.data( 'field' ) ) { if ( 0 === getDesc.length ) { getColumn.append( errorMarkup ); } else { $( errorMarkup ).insertBefore( getDesc ); } if ( 0 === holderField.find( '.forminator-error-message' ).length ) { holderField.append( '<span class="forminator-error-message" id="'+ errorId +'"></span>' ); } } } holderError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' ); // Insert error message holderError.html( errorMessage ); holderField.find( '.forminator-error-message' ).html( errorMessage ); } else if ( holderTime.length > 0 ) { getColumn = holderTime.parent(); getError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' ); getDesc = getColumn.find( '.forminator-description' ); errorMarkup = '<span class="forminator-error-message" data-error-field="' + holder.data( 'field' ) + '" id="'+ errorId +'"></span>'; if ( 0 === getError.length ) { if ( 'hours' === holder.data( 'field' ) ) { if ( getColumn.find( '.forminator-error-message[data-error-field="minutes"]' ).length ) { $( errorMarkup ).insertBefore( getColumn.find( '.forminator-error-message[data-error-field="minutes"]' ) ); } else { if ( 0 === getDesc.length ) { getColumn.append( errorMarkup ); } else { $( errorMarkup ).insertBefore( getDesc ); } } if ( 0 === holderField.find( '.forminator-error-message' ).length ) { holderField.append( '<span class="forminator-error-message" id="'+ errorId +'"></span>' ); } } if ( 'minutes' === holder.data( 'field' ) ) { if ( 0 === getDesc.length ) { getColumn.append( errorMarkup ); } else { $( errorMarkup ).insertBefore( getDesc ); } if ( 0 === holderField.find( '.forminator-error-message' ).length ) { holderField.append( '<span class="forminator-error-message" id="'+ errorId +'"></span>' ); } } } holderError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' ); // Insert error message holderError.html( errorMessage ); holderField.find( '.forminator-error-message' ).html( errorMessage ); } else { var getError = holderField.find( '.forminator-error-message' ); var getDesc = holderField.find( '.forminator-description' ); if ( 0 === getError.length ) { if ( 0 === getDesc.length ) { holderField.append( errorMarkup ); } else { $( errorMarkup ).insertBefore( getDesc ); } } holderError = holderField.find( '.forminator-error-message' ); // Insert error message holderError.html( errorMessage ); } // Field aria describedby for screen readers if (ariaDescribedby) { var ids = ariaDescribedby.split(' '); var errorIdExists = ids.includes(errorId); if (!errorIdExists) { ids.push(errorId); } var updatedAriaDescribedby = ids.join(' '); holder.attr('aria-describedby', updatedAriaDescribedby); } else { holder.attr('aria-describedby', errorId); } // Field invalid status for screen readers holder.attr( 'aria-invalid', 'true' ); // Field error status holderField.addClass( 'forminator-has_error' ); holder.trigger('validation:highlight'); }, unhighlight: function (element, errorClass, validClass) { var holder = $( element ); var holderField = holder.closest( '.forminator-field' ); var holderTime = holder.closest( '.forminator-timepicker' ); var holderDate = holder.closest( '.forminator-date-input' ); var holderError = ''; var errorId = holder.attr('id') + '-error'; var ariaDescribedby = holder.attr('aria-describedby'); if ( holderDate.length > 0 ) { holderError = holderDate.parent().find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' ); } else if ( holderTime.length > 0 ) { holderError = holderTime.parent().find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' ); } else { holderError = holderField.find( '.forminator-error-message' ); } // Remove or Update describedby attribute for screen readers if (ariaDescribedby) { var ids = ariaDescribedby.split(' '); ids = ids.filter(function (id) { return id !== errorId; }); var updatedAriaDescribedby = ids.join(' '); holder.attr('aria-describedby', updatedAriaDescribedby); } else { holder.removeAttr('aria-describedby'); } // Remove invalid attribute for screen readers holder.removeAttr( 'aria-invalid' ); // Remove error message holderError.remove(); // Remove error class holderField.removeClass( 'forminator-has_error' ); holder.trigger('validation:unhighlight'); }, rules: rules, messages: messages }); $form.off('forminator.validate.signature').on('forminator.validate.signature', function () { var validator = $( this ).validate(); validator.element( $( this ).find( "input[id$='_data']" ) ); }); // Inline validation for upload field. $form.find( '.forminator-input-file, .forminator-input-file-required' ).on( 'change', function () { $( this ).trigger( 'focusout' ); }) // Trigger change for the hour field. $( '.time-minutes.has-time-limiter, .time-ampm.has-time-limiter' ).on( 'change', function () { var hourContainer = $( this ).closest( '.forminator-col' ).siblings( '.forminator-col' ).first(); hourContainer.find( '.time-hours' ).trigger( 'focusout' ); }); // Trigger change for the required checkbox field. $( '.forminator-field.required input[type="checkbox"]' ).on( 'input', function () { $( this ).not( ':checked' ).trigger( 'focusout' ); }); // Remove error messages after disabling validation. $(document).on('change', '#forminator-field-disable_validations', function () { const validationDisabled = $(this).is(':checked'); const validator = $form.data('validator'); if (validationDisabled && validator) { validator.resetForm(); // Manually call unhighlight to remove error messages. $form.find(':input').each(function () { validator.settings.unhighlight(this); }); } }); } }); // A really lightweight plugin wrapper around the constructor, // preventing against multiple instantiations $.fn[pluginName] = function (options) { // We need to restore our custom validation methods in case they were // lost or overwritten by another instantiation of the jquery.Validate plugin. $.each( ownMethods, function( key, method ) { if ( undefined === $.validator.methods[ key ] ) { $.validator.addMethod( key, method ); } else if ( key === 'number' ) { $.validator.methods.number = ownMethods.number; } }); return this.each(function () { if (!$.data(this, pluginName)) { $.data(this, pluginName, new ForminatorFrontValidate(this, options)); } }); }; $.validator.addMethod("validurl", function (value, element) { var url = $.validator.methods.url.bind(this); return url(value, element) || url('http://' + value, element); }); $.validator.addMethod("forminatorPhoneNational", function ( value, element ) { var iti = intlTelInput.getInstance( element ); var elem = $( element ); if ( !elem.data('required') && value === '+' +iti.getSelectedCountryData().dialCode ) { return true; } if ( 'undefined' !== typeof elem.data( 'country' ) && elem.data( 'country' ).toLowerCase() !== iti.getSelectedCountryData().iso2 ) { return false; } // Uses intlTelInput to check if the number is valid. return this.optional( element ) || iti.isValidNumberPrecise(); }); $.validator.addMethod("forminatorPhoneInternational", function (value, element) { const iti = intlTelInput.getInstance( element ); // check whether phone field is international and optional if ( !$(element).data('required') && value === '+' +iti.getSelectedCountryData().dialCode ) { return true; } // Uses intlTelInput to check if the number is valid. return this.optional(element) || iti.isValidNumberPrecise(); }); $.validator.addMethod("dateformat", function (value, element, param) { // dateITA method from jQuery Validator additional. Date method is deprecated and doesn't work for all formats var check = false, re = 'yy-mm-dd' === param || 'yy/mm/dd' === param || 'yy.mm.dd' === param ? /^\d{4}-\d{1,2}-\d{1,2}$/ : /^\d{1,2}-\d{1,2}-\d{4}$/, adata, gg, mm, aaaa, xdata; value = value.replace(/[ /.]/g, '-'); if (re.test(value)) { if ('dd/mm/yy' === param || 'dd-mm-yy' === param || 'dd.mm.yy' === param) { adata = value.split("-"); gg = parseInt(adata[0], 10); mm = parseInt(adata[1], 10); aaaa = parseInt(adata[2], 10); } else if ('mm/dd/yy' === param || 'mm.dd.yy' === param || 'mm-dd-yy' === param) { adata = value.split("-"); mm = parseInt(adata[0], 10); gg = parseInt(adata[1], 10); aaaa = parseInt(adata[2], 10); } else { adata = value.split("-"); aaaa = parseInt(adata[0], 10); mm = parseInt(adata[1], 10); gg = parseInt(adata[2], 10); } xdata = new Date(Date.UTC(aaaa, mm - 1, gg, 12, 0, 0, 0)); if ((xdata.getUTCFullYear() === aaaa) && (xdata.getUTCMonth() === mm - 1) && (xdata.getUTCDate() === gg)) { check = true; } else { check = false; } } else { check = false; } return this.optional(element) || check; }); function forminatorRetrieveEditorText( value, element ) { // Retrieve the text if it is an editor. if ( $( element ).hasClass( 'wp-editor-area' ) && $( element ).hasClass( 'forminator-textarea' ) ) { value = $( '<div/>' ).html( value ).text(); } return value; } $.validator.addMethod("maxwords", function (value, element, param) { value = forminatorRetrieveEditorText( value, element ); return this.optional(element) || value.trim().split(/\s+/).length <= param; }); // override core jquertvalidation maxlength. Ignore tags. $.validator.methods.maxlength = function ( value, element, length ) { value = value.replace( /<[^>]*>/g, '' ); value = forminatorRetrieveEditorText( value, element ); if ( value.length > length ) { return false; } return true; }; $.validator.addMethod("trim", function( value, element, param ) { return true === this.optional( element ) || 0 !== value.trim().length; }); $.validator.addMethod("equalToClosestEmail", function (value, element, param) { let target = $(element).closest('.forminator-row-with-confirmation-email').find('input[type="email"]').first(); return target.length && value === target.val(); } ); $.validator.addMethod("emailFilter", function (email, element, param) { if ( ! email ) { return true; } const emailList = param.email_list.split('|'), isDeny = 'deny' === param.filter_type; for (let item of emailList) { // Remove spaces in email addresses. item = item.replace(/[\s\n\r\t]/g, ''); // Escape special characters. item = item.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // Support * as wildcard. item = item.replace(/\\\*/g, '.*'); // Add end delimiter. const regex = new RegExp(item + '$'); if (regex.test(email)) { return ! isDeny; } } return isDeny; } ); $.validator.addMethod("emailWP", function (value, element, param) { if (this.optional(element)) { return true; } // Test for the minimum length the email can be if (value.trim().length < 6) { return false; } // Test for an @ character after the first position if (value.indexOf('@', 1) < 0) { return false; } // Split out the local and domain parts var parts = value.split('@', 2); // LOCAL PART // Test for invalid characters if (!parts[0].match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~\.-]+$/)) { return false; } // DOMAIN PART // Test for sequences of periods if (parts[1].match(/\.{2,}/)) { return false; } var domain = parts[1]; // Split the domain into subs var subs = domain.split('.'); if (subs.length < 2) { return false; } var subsLen = subs.length; for (var i = 0; i < subsLen; i++) { // Test for invalid characters if (!subs[i].match(/^[a-z0-9-]+$/i)) { return false; } } return true; }); $.validator.addMethod("forminatorPasswordStrength", function (value, element, param) { var passwordStrength = value.trim(); // Password is optional and is empty so don't check strength. if ( passwordStrength.length == 0 ) { return true; } //at least 8 characters if ( ! passwordStrength || passwordStrength.length < 8) { return false; } var symbolSize = 0, natLog, score; //at least one number if ( passwordStrength.match(/[0-9]/) ) { symbolSize += 10; } //at least one lowercase letter if ( passwordStrength.match(/[a-z]/) ) { symbolSize += 20; } //at least one uppercase letter if ( passwordStrength.match(/[A-Z]/) ) { symbolSize += 20; } if ( passwordStrength.match(/[^a-zA-Z0-9]/) ) { symbolSize += 30; } //at least one special character if ( passwordStrength.match(/[=!\-@.,_*#&?^`%$+\/{\[\]|}^?~]/) ) { symbolSize += 30; } natLog = Math.log( Math.pow(symbolSize, passwordStrength.length) ); score = natLog / Math.LN2; return score >= 54; }); $.validator.addMethod("extension", function (value, element, param) { var check = false; if (value.trim() !== '') { var extension = value.replace(/^.*\./, ''); if (extension == value) { extension = 'notExt'; } else { extension = extension.toLowerCase(); } if (param.indexOf(extension) != -1) { check = true; } } return this.optional(element) || check; }); // $.validator.methods.required = function(value, element, param) { // console.log("required", element); // // return someCondition && value != null; // } // override core jquertvalidation number, to use HTML5 spec $.validator.methods.number = function (value, element, param) { return this.optional(element) || /^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/.test(value); }; $.validator.addMethod('minNumber', function (value, el, param) { if ( 0 === value.length ) { return true; } var minVal = parseFloatFromString( value ); return minVal >= param; }); $.validator.addMethod('maxNumber', function (value, el, param) { if ( 0 === value.length ) { return true; } var maxVal = parseFloatFromString( value ); return maxVal <= param; }); $.validator.addMethod( 'timeLimit', function ( value, el, limit ) { var chosenTime = forminatorGetTime( el, value ), startLimit = forminatorConvertToSeconds( limit.start_limit ), endLimit = forminatorConvertToSeconds( limit.end_limit ), comparison = chosenTime >= startLimit && chosenTime <= endLimit, hoursDiv = $( el ).closest( '.forminator-col' ), minutesField = hoursDiv.next().find( '.forminator-field' ) ; // Lets add error class to minutes field if hours has error. if ( ! comparison && true !== chosenTime ) { setTimeout( function() { minutesField.addClass( 'forminator-has_error' ); }, 10 ); } else { minutesField.removeClass( 'forminator-has_error' ); } // Check if chosenTime is not true, then compare if chosenTime in seconds is >= to the limit in seconds. return true !== chosenTime ? comparison: true; }); function parseFloatFromString( value ) { value = String( value ).trim(); var parsed = parseFloat( value ); if ( String( parsed ) === value ) { return fixDecimals( parsed, 2 ); } var split = value.split( /[^\dE-]+/ ); if ( 1 === split.length ) { return fixDecimals(parseFloat(value), 2); } var decimal = split.pop(); // reconstruct the number using dot as decimal separator return fixDecimals( parseFloat( split.join('') + '.' + decimal ), 2 ); } function fixDecimals( num, precision ) { return ( Math.floor( num * 100 ) / 100 ).toFixed( precision ); } function forminatorGetTime ( el, value ) { var hoursDiv, minutesDiv, hours, minutes, meridiem, final = ''; // Get the values minutes and meridiem. if ( el.name.includes( 'hours' ) ) { hoursDiv = $( el ).closest( '.forminator-col' ); hours = value; minutesDiv = hoursDiv.next(); minutes = minutesDiv.find( '.time-minutes' ); if ( 'select' === minutes.prop( 'tagName' ).toLowerCase() ) { minutes = minutesDiv.find( '.time-minutes option:selected' ).val(); } else { minutes = minutesDiv.find( '.time-minutes' ).val(); } meridiem = minutesDiv.next().find( 'select[name$="ampm"] option:selected' ).val(); } if ( 'undefined' !== typeof hours && '' !== hours && 'undefined' !== typeof minutes && '' !== minutes ) { final = hours + ':' + minutes; } else { return true; } if ( '' !== final && 'undefined' !== typeof meridiem ) { final += ' ' + meridiem; } final = forminatorConvertToSeconds( final ); return final; } function forminatorConvertToSeconds ( chosenTime ) { var [ time, modifier ] = chosenTime.split(' '); var [ hours, minutes ] = time.split(':'); if ( 'undefined' !== typeof modifier ) { if ( 12 === parseInt( hours, 10 ) ) { hours = 0; } if ( 'pm' === modifier.toLowerCase() ) { hours = parseInt( hours, 10 ) + 12; } } hours = hours * 60 * 60; minutes = minutes * 60; return hours + minutes; } // Backup the recently added custom validation methods (they will be // checked in the plugin wrapper later) ownMethods = $.validator.methods; })(jQuery, window, document); front.multi.js 0000644 00000170573 15162321604 0007400 0 ustar 00 // the semi-colon before function invocation is a safety net against concatenated // scripts and/or other plugins which may not be closed properly. ;// noinspection JSUnusedLocalSymbols (function ($, window, document, undefined) { "use strict"; // undefined is used here as the undefined global variable in ECMAScript 3 is // mutable (ie. it can be changed by someone else). undefined isn't really being // passed in so we can ensure the value of it is truly undefined. In ES5, undefined // can no longer be modified. // window and document are passed through as local variables rather than global // as this (slightly) quickens the resolution process and can be more efficiently // minified (especially when both are regularly referenced in your plugin). // Create the defaults once var pluginName = "forminatorFront", defaults = { form_type: 'custom-form', rules: {}, messages: {}, conditions: {}, inline_validation: false, print_value: false, chart_design: 'bar', chart_options: {}, forminator_fields: [], general_messages: { calculation_error: 'Failed to calculate field.', payment_require_ssl_error: 'SSL required to submit this form, please check your URL.', payment_require_amount_error: 'PayPal amount must be greater than 0.', form_has_error: 'Please correct the errors before submission.' }, payment_require_ssl : false, }; // The actual plugin constructor function ForminatorFront(element, options) { this.element = element; this.$el = $(this.element); this.forminator_selector = '#' + $(this.element).attr('id') + '[data-forminator-render="' + $(this.element).data('forminator-render') + '"]'; this.forminator_loader_selector = 'div[data-forminator-render="' + $(this.element).data('forminator-render') + '"]' + '[data-form="' + $(this.element).attr('id') + '"]'; // jQuery has an extend method which merges the contents of two or // more objects, storing the result in the first object. The first object // is generally empty as we don't want to alter the default options for // future instances of the plugin this.settings = $.extend({}, defaults, options); // special treatment for rules, messages, and conditions if (typeof this.settings.messages !== 'undefined') { this.settings.messages = this.maybeParseStringToJson(this.settings.messages, 'object'); } if (typeof this.settings.rules !== 'undefined') { this.settings.rules = this.maybeParseStringToJson(this.settings.rules, 'object'); } if (typeof this.settings.calendar !== 'undefined') { this.settings.calendar = this.maybeParseStringToJson(this.settings.calendar, 'array'); } this._defaults = defaults; this._name = pluginName; this.form_id = 0; this.template_type = ''; this.init(); this.handleDiviPopup(); } // Avoid Plugin.prototype conflicts $.extend(ForminatorFront.prototype, { init: function () { var self = this; if (this.$el.find('input[name="form_id"]').length > 0) { this.form_id = this.$el.find('input[name="form_id"]').val(); } if (this.$el.find('input[name="form_type"]').length > 0) { this.template_type = this.$el.find('input[name="form_type"]').val(); } $(this.forminator_loader_selector).remove(); // If form from hustle popup, do not show if (this.$el.closest('.wph-modal').length === 0) { this.$el.show(); } // Show form when popup trigger with click $(document).on("hustle:module:displayed", function (e, data) { var $modal = $('.wph-modal-active'); $modal.find('form').css('display', ''); }); self.reint_intlTelInput(); // Show form when popup trigger setTimeout(function () { var $modal = $('.wph-modal-active'); $modal.find('form').css('display', ''); }, 10); //selective activation based on type of form switch (this.settings.form_type) { case 'custom-form': $( this.element ).each( function() { self.init_custom_form( this ); }); this.$el.on( 'forminator-clone-group', function ( event ) { self.init_custom_form( event.target ); } ); break; case 'poll': this.init_poll_form(); break; case 'quiz': this.init_quiz_form(); break; } //init submit var submitOptions = { form_type: self.settings.form_type, forminator_selector: self.forminator_selector, chart_design: self.settings.chart_design, chart_options: self.settings.chart_options, has_quiz_loader: self.settings.has_quiz_loader, has_loader: self.settings.has_loader, loader_label: self.settings.loader_label, resetEnabled: self.settings.is_reset_enabled, inline_validation: self.settings.inline_validation, }; if( 'leads' === this.template_type || 'quiz' === this.settings.form_type ) { submitOptions.form_placement = self.settings.form_placement; submitOptions.hasLeads = self.settings.hasLeads; submitOptions.leads_id = self.settings.leads_id; submitOptions.quiz_id = self.settings.quiz_id; submitOptions.skip_form = self.settings.skip_form; } $(this.element).forminatorFrontSubmit( submitOptions ); // TODO: confirm usage on form type // Handle field activation classes this.activate_field(); // Handle special classes for material design // this.material_field(); // Init small form for all type of form this.small_form(); // trigger form added in the DOM $(document).trigger('forminator:form:added') }, init_custom_form: function ( form_selector ) { var self = this, $saveDraft = this.$el.find( '.forminator-save-draft-link' ), saveDraftExists = 0 !== $saveDraft.length ? true : false, draftTimer ; //initiate validator this.init_intlTelInput_validation( form_selector ); if (this.settings.inline_validation) { $( form_selector ).forminatorFrontValidate({ rules: self.settings.rules, messages: self.settings.messages }); } // initiate calculator $( form_selector ).forminatorFrontCalculate({ forminatorFields: self.settings.forminator_fields, generalMessages: self.settings.general_messages, memoizeTime: self.settings.calcs_memoize_time || 300, }); // initiate merge tags $( form_selector ).forminatorFrontMergeTags({ forminatorFields: self.settings.forminator_fields, print_value: self.settings.print_value, }); //initiate pagination this.init_pagination( form_selector ); if( self.settings.has_stripe ) { var stripe_payment = $(this.element).find('.forminator-stripe-element[data-type="stripe-ocs"]').first(); if ( 1 > stripe_payment.length ) { stripe_payment = $(this.element).find('.forminator-stripe-element').first(); } if ( $( self.element ).is( ':visible' ) ) { this.renderStripe( self, stripe_payment ); } // Show Stripe on modal display. $( document ).on( "forminator:form:added", function () { self.renderStripe( self, stripe_payment ); }); } if( self.settings.has_paypal // Fix for Divi popup. && ( ! $( self.element ).closest( '.et_pb_section' ).length || $( self.element ).is( ':visible' ) ) ) { $(this.element).forminatorFrontPayPal({ type: 'paypal', paymentEl: this.settings.paypal_config, paymentRequireSsl: self.settings.payment_require_ssl, generalMessages: self.settings.general_messages, has_loader: self.settings.has_loader, loader_label: self.settings.loader_label, }); } //initiate condition $( form_selector ).forminatorFrontCondition(this.settings.conditions, this.settings.calendar); //initiate forminator ui scripts this.init_fui( form_selector ); //initiate datepicker $( form_selector ).find('.forminator-datepicker').forminatorFrontDatePicker(this.settings.calendar); // Handle responsive captcha this.responsive_captcha( form_selector ); // Handle field counter this.field_counter( form_selector ); // Handle number input this.field_number( form_selector ); // Handle time fields this.field_time(); // Handle upload field change $( form_selector ).find('.forminator-multi-upload').forminatorFrontMultiFile( this.$el ); this.upload_field( form_selector ); this.init_login_2FA(); self.maybeRemoveDuplicateFields( form_selector ); self.checkComplianzBlocker(); // Handle function on resize $(window).on('resize', function () { self.responsive_captcha( form_selector ); }); // Handle function on load $( window ).on( 'load', function () { // Repeat the function here, just in case our scripts gets loaded late self.maybeRemoveDuplicateFields( form_selector ); }); // We have to declare initialData here, after everything has been set initially, to prevent triggering change event. var initialData = saveDraftExists ? this.$el.serializeArray() : ''; this.$el.find( ".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea, .forminator-field-signature").on( 'change input', function (e) { if ( saveDraftExists && $saveDraft.hasClass( 'disabled' ) ) { clearTimeout( draftTimer ); draftTimer = setTimeout( function() { self.maybe_enable_save_draft( $saveDraft, initialData ); }, 500 ); } }); if( 'undefined' !== typeof self.settings.hasLeads ) { if( 'beginning' === self.settings.form_placement ) { $('#forminator-module-' + this.settings.quiz_id ).css({ 'height': 0, 'opacity': 0, 'overflow': 'hidden', 'visibility': 'hidden', 'pointer-events': 'none', 'margin': 0, 'padding': 0, 'border': 0 }); } if( 'end' === self.settings.form_placement ) { $( form_selector ).css({ 'height': 0, 'opacity': 0, 'overflow': 'hidden', 'visibility': 'hidden', 'pointer-events': 'none', 'margin': 0, 'padding': 0, 'border': 0 }); } } }, init_poll_form: function() { var self = this, $fieldset = this.$el.find( 'fieldset' ), $selection = this.$el.find( '.forminator-radio input' ), $input = this.$el.find( '.forminator-input' ), $field = $input.closest( '.forminator-field' ) ; // Load input states FUI.inputStates( $input ); // Show input when option has been selected $selection.on( 'click', function() { // Reset $field.addClass( 'forminator-hidden' ); $field.attr( 'aria-hidden', 'true' ); $input.removeAttr( 'tabindex' ); $input.attr( 'name', '' ); var checked = this.checked, $id = $( this ).attr( 'id' ), $name = $( this ).attr( 'name' ) ; // Once an option has been chosen, remove error class. $fieldset.removeClass( 'forminator-has_error' ); if ( self.$el.find( '.forminator-input#' + $id + '-extra' ).length ) { var $extra = self.$el.find( '.forminator-input#' + $id + '-extra' ), $extraField = $extra.closest( '.forminator-field' ) ; if ( checked ) { $extra.attr( 'name', $name + '-extra' ); $extraField.removeClass( 'forminator-hidden' ); $extraField.removeAttr( 'aria-hidden' ); $extra.attr( 'tabindex', '-1' ); $extra.focus(); } else { $extraField.addClass( 'forminator-hidden' ); $extraField.attr( 'aria-hidden', 'true' ); $extra.removeAttr( 'tabindex' ); } } return true; }); // Disable options if ( this.$el.hasClass( 'forminator-poll-disabled' ) ) { this.$el.find( '.forminator-radio' ).each( function() { $( this ).addClass( 'forminator-disabled' ); $( this ).find( 'input' ).attr( 'disabled', true ); }); } }, init_quiz_form: function () { var self = this, lead_placement = 'undefined' !== typeof self.settings.form_placement ? self.settings.form_placement : '', quiz_id = 'undefined' !== typeof self.settings.quiz_id ? self.settings.quiz_id : 0; this.$el.find('.forminator-button:not(.forminator-quiz-start)').each(function () { $(this).prop("disabled", true); }); this.$el.find('.forminator-answer input').each(function () { $(this).attr('checked', false); }); this.$el.find('.forminator-result--info button').on('click', function () { location.reload(); }); $('#forminator-quiz-leads-' + quiz_id + ' .forminator-quiz-intro .forminator-quiz-start').on('click', function(e){ e.preventDefault(); $(this).closest( '.forminator-quiz-intro').hide(); self.$el.prepend('<button class="forminator-button forminator-quiz-start forminator-hidden"></button>') .find('.forminator-quiz-start').trigger('click').remove(); }); this.$el.on('click', '.forminator-quiz-start', function (e) { e.preventDefault(); self.$el.find('.forminator-quiz-intro').hide(); self.$el.find('.forminator-pagination').removeClass('forminator-hidden'); //initiate pagination var args = { totalSteps: self.$el.find('.forminator-pagination').length - 1, //subtract the last step with result step: 0, quiz: true }; if ( self.settings.text_next ) { args.next_button = self.settings.text_next; } if ( self.settings.text_prev ) { args.prev_button = self.settings.text_prev; } if ( self.settings.submit_class ) { args.submitButtonClass = self.settings.submit_class; } $(self.element).forminatorFrontPagination(args); }); if( 'end' !== lead_placement ) { this.$el.find('.forminator-submit-rightaway').on("click", function () { self.$el.submit(); $(this).closest('.forminator-question').find('.forminator-submit-rightaway').addClass('forminator-has-been-disabled').attr('disabled', 'disabled'); }); } if( self.settings.hasLeads ) { if( 'beginning' === lead_placement ) { self.$el.css({ 'height': 0, 'opacity': 0, 'overflow': 'hidden', 'visibility': 'hidden', 'pointer-events': 'none', 'margin': 0, 'padding': 0, 'border': 0 }); } if( 'end' === lead_placement ) { self.$el.closest('div').find('#forminator-module-' + self.settings.leads_id ).css({ 'height': 0, 'opacity': 0, 'overflow': 'hidden', 'visibility': 'hidden', 'pointer-events': 'none', 'margin': 0, 'padding': 0, 'border': 0 }); $('#forminator-quiz-leads-' + quiz_id + ' .forminator-lead-form-skip' ).hide(); } } this.$el.on('click', '.forminator-social--icon a', function (e) { e.preventDefault(); var social = $(this).data('social'), url = $(this).closest('.forminator-social--icons').data('url'), message = $(this).closest('.forminator-social--icons').data('message'), message = encodeURIComponent(message), social_shares = { 'facebook': 'https://www.facebook.com/sharer/sharer.php?u=' + url + '"e=' + message, 'twitter': 'https://twitter.com/intent/tweet?&url=' + url + '&text=' + message, 'google': 'https://plus.google.com/share?url=' + url, 'linkedin': 'https://www.linkedin.com/shareArticle?mini=true&url=' + url + '&title=' + message }; if (social_shares[social] !== undefined) { var newwindow = window.open(social_shares[social], social, 'height=' + $(window).height() + ',width=' + $(window).width()); if (window.focus) { newwindow.focus(); } return false; } }); this.$el.on('change', '.forminator-answer input', function (e) { var paginated = !!$( this ).closest('.forminator-pagination').length, parent = paginated ? $( this ).closest('.forminator-pagination') : self.$el, count = parent.find('.forminator-answer input:checked').length, amount_answers = parent.find('.forminator-question').length, parentQuestion = $( this ).closest( '.forminator-question' ), isMultiChoice = parentQuestion.data( 'multichoice' ) ; self.$el.find('.forminator-button:not(.forminator-button-back)').each(function () { var disabled = count < amount_answers; $( this ).prop('disabled', disabled); if ( paginated ) { if ( disabled ) { $( this ).addClass('forminator-disabled'); } else { $( this ).removeClass('forminator-disabled'); } } }); // If multichoice is false, uncheck other options if( this.checked && false === isMultiChoice ) { parentQuestion .find( '.forminator-answer' ) .not( $( this ).parent( '.forminator-answer' ) ) .each( function( i, el ){ $( el ).find( '> input' ).prop( 'checked', false ); }); } }); }, small_form: function () { var form = $( this.element ), formWidth = form.width() ; if ( 783 < Math.max( document.documentElement.clientWidth, window.innerWidth || 0 ) ) { if ( form.hasClass( 'forminator-size--small' ) ) { if ( 480 < formWidth ) { form.removeClass( 'forminator-size--small' ); } } else { var hasHustle = form.closest('.hustle-content'); if ( form.is(":visible") && 480 >= formWidth && ! hasHustle.length ) { form.addClass( 'forminator-size--small' ); } } } }, init_intlTelInput_validation: function ( form_selector ) { var form = $( form_selector ), is_material = form.is('.forminator-design--material'), fields = form.find('.forminator-field--phone'); if ( ! form.is('form') ) { // For cloning phone fields inside group fields. is_material = form.closest('form').is('.forminator-design--material'); } fields.each(function () { // Initialize intlTelInput plugin on each field with "format check" enabled and // set to check either "international" or "standard" phones. var self = this, is_national_phone = $(this).data('national_mode'), country = $(this).data('country'), validation = $(this).data('validation'), iti = window.intlTelInput.getInstance(self); if ('undefined' !== typeof (is_national_phone)) { if (is_material) { $(this).unwrap('.forminator-input--wrap'); } // If it's already intialised then first destroy it and then reinit. if ( iti ) { iti.destroy(); } var args = { nationalMode: ('enabled' === is_national_phone) ? true : false, initialCountry: 'undefined' !== typeof ( country ) ? country : 'us', validationNumberTypes: null, loadUtils: () => import(window.ForminatorFront.cform.intlTelInput_utils_script), strictMode: true, }; if ( 'undefined' !== typeof ( validation ) && 'standard' === validation ) { args.allowDropdown = false; } // stop from removing country code. if ( 'undefined' !== typeof ( validation ) && 'international' === validation ) { args.autoHideDialCode = false; args.separateDialCode = true; } var iti = window.intlTelInput(self, args); if ( 'undefined' !== typeof ( validation ) && 'standard' === validation ) { // Reset country to default if changed and invalid previously. $( this ).on( 'blur', function() { if ( '' === $( self ).val() ) { iti.setCountry( country ); form.validate().element( $( self ) ); } }); } if ( ! is_material ) { $(this).closest( '.forminator-field' ).find( 'div.iti' ).addClass( 'forminator-phone' ); } else { $(this).closest( '.forminator-field' ).find( 'div.iti' ).addClass( 'forminator-input-with-phone' ); if ( $(this).closest( '.forminator-field' ).find( 'div.iti' ).hasClass( 'iti--allow-dropdown' ) ) { $(this).closest( '.forminator-field' ).find( '.forminator-label' ).addClass( 'iti--allow-dropdown' ); } } // intlTelInput plugin adds a markup that's not compatible with 'material' theme when 'allowDropdown' is true (default). // If we're going to allow users to disable the dropdown, this should be adjusted accordingly. if (is_material) { //$(this).closest('.intl-tel-input.allow-dropdown').addClass('forminator-phone-intl').removeClass('intl-tel-input'); //$(this).wrap('<div class="forminator-input--wrap"></div>'); // Wrap Element if (!$(this).parent().hasClass('forminator-input--wrap')) { $(this).wrap('<div class="forminator-input--wrap"></div>'); } } } }); }, reint_intlTelInput: function () { var self = this; self.$el.on( 'after:forminator:form:submit', function (e, data) { self.init_intlTelInput_validation( self.forminator_selector ); } ); }, init_fui: function ( form_selector ) { var form = $( form_selector ), input = form.find( '.forminator-input' ), textarea = form.find( '.forminator-textarea' ), select2 = form.find( '.forminator-select2' ), multiselect = form.find( '.forminator-multiselect' ), stripe = form.find( '.forminator-stripe-element' ), slider = form.find( '.forminator-slider' ), rating = form.find( '.forminator-rating' ) ; var isDefault = ( form.attr( 'data-design' ) === 'default' ), isBold = ( form.attr( 'data-design' ) === 'bold' ), isFlat = ( form.attr( 'data-design' ) === 'flat' ), isMaterial = ( form.attr( 'data-design' ) === 'material' ) ; if ( input.length ) { input.each( function() { FUI.inputStates( this ); }); } if ( textarea.length ) { textarea.each( function() { FUI.textareaStates( this ); }); } if ( 'function' === typeof FUI.select2 ) { FUI.select2( select2.length ); } if ( 'function' === typeof FUI.slider ) { FUI.slider(); } if ( multiselect.length ) { FUI.multiSelectStates( multiselect ); } if ( rating.length && 'function' === typeof FUI.rating ) { FUI.rating( rating ); } if ( form.hasClass( 'forminator-design--material' ) ) { if ( input.length ) { input.each( function() { FUI.inputMaterial( this ); }); } if ( textarea.length ) { textarea.each( function() { FUI.textareaMaterial( this ); }); } if ( stripe.length ) { stripe.each( function() { if ($(this).hasClass('forminator-stripe-payment-element')) { return; // Skip to the next iteration } var field = $(this).closest('.forminator-field'); var label = field.find('.forminator-label'); if (label.length) { field.addClass('forminator-stripe-floating'); // Add floating class label.addClass('forminator-floating--input'); } }); } } }, responsive_captcha: function ( form_selector ) { $( form_selector ).find('.forminator-g-recaptcha').each(function () { var badge = $(this).data('badge'); // eslint-disable-line if ($(this).is(':visible') && 'inline' === badge ) { var width = $(this).parent().width(), scale = 1; if (width < 302) { scale = width / 302; } $(this).css('transform', 'scale(' + scale + ')'); $(this).css('-webkit-transform', 'scale(' + scale + ')'); $(this).css('transform-origin', '0 0'); $(this).css('-webkit-transform-origin', '0 0'); } }); }, init_pagination: function ( form_selector ) { var self = this, num_pages = $( form_selector ).find(".forminator-pagination").length, hash = window.location.hash, hashStep = false, step = 0; if (num_pages > 0) { //find from hash if (typeof hash !== "undefined" && hash.indexOf('step-') >= 0) { hashStep = true; step = hash.substr(6, 8); } $(this.element).forminatorFrontPagination({ totalSteps: num_pages, hashStep: hashStep, step: step, inline_validation: self.settings.inline_validation, submitButtonClass: self.settings.submit_button_class }); } }, activate_field: function () { var form = $( this.element ); var input = form.find( '.forminator-input' ); var textarea = form.find( '.forminator-textarea' ); function classFilled( el ) { var element = $( el ); var elementValue = element.val().trim(); var elementField = element.closest( '.forminator-field' ); var elementAnswer = element.closest( '.forminator-poll--answer' ); var filledClass = 'forminator-is_filled'; if ( '' !== elementValue ) { elementField.addClass( filledClass ); elementAnswer.addClass( filledClass ); } else { elementField.removeClass( filledClass ); elementAnswer.removeClass( filledClass ); } element.change( function( e ) { if ( '' !== elementValue ) { elementField.addClass( filledClass ); elementAnswer.addClass( filledClass ); } else { elementField.removeClass( filledClass ); elementAnswer.removeClass( filledClass ); } e.stopPropagation(); }); } function classHover( el ) { var element = $( el ); var elementField = element.closest( '.forminator-field' ); var elementAnswer = element.closest( '.forminator-poll--answer' ); var hoverClass = 'forminator-is_hover'; element.on( 'mouseover', function( e ) { elementField.addClass( hoverClass ); elementAnswer.addClass( hoverClass ); e.stopPropagation(); }).on( 'mouseout', function( e ) { elementField.removeClass( hoverClass ); elementAnswer.removeClass( hoverClass ); e.stopPropagation(); }); } function classActive( el ) { var element = $( el ); var elementField = element.closest( '.forminator-field' ); var elementAnswer = element.closest( '.forminator-poll--answer' ); var activeClass = 'forminator-is_active'; element.focus( function( e ) { elementField.addClass( activeClass ); elementAnswer.addClass( activeClass ); e.stopPropagation(); }).blur( function( e ) { elementField.removeClass( activeClass ); elementAnswer.removeClass( activeClass ); e.stopPropagation(); }); } function classError( el ) { var element = $( el ); var elementValue = element.val().trim(); var elementField = element.closest( '.forminator-field' ); var elementTime = element.attr( 'data-field' ); var timePicker = element.closest( '.forminator-timepicker' ); var timeColumn = timePicker.parent(); var errorField = elementField.find( '.forminator-error-message' ); var errorClass = 'forminator-has_error'; element.on( 'load change keyup keydown', function( e ) { if ( 'undefined' !== typeof elementTime && false !== elementTime ) { if ( 'hours' === element.data( 'field' ) ) { var hoursError = timeColumn.find( '.forminator-error-message[data-error-field="hours"]' ); if ( '' !== elementValue && 0 !== hoursError.length ) { hoursError.remove(); } } if ( 'minutes' === element.data( 'field' ) ) { var minutesError = timeColumn.find( '.forminator-error-message[data-error-field="minutes"]' ); if ( '' !== elementValue && 0 !== minutesError.length ) { minutesError.remove(); } } } else { if ( '' !== elementValue && errorField.text() ) { errorField.remove(); elementField.removeClass( errorClass ); } } e.stopPropagation(); }); } if ( input.length ) { input.each( function() { //classFilled( this ); //classHover( this ); //classActive( this ); classError( this ); }); } if ( textarea.length ) { textarea.each( function() { //classFilled( this ); //classHover( this ); //classActive( this ); classError( this ); }); } form.find('select.forminator-select2 + .forminator-select').each(function () { var $select = $(this); // Set field active class on hover $select.on('mouseover', function (e) { e.stopPropagation(); $(this).closest('.forminator-field').addClass('forminator-is_hover'); }).on('mouseout', function (e) { e.stopPropagation(); $(this).closest('.forminator-field').removeClass('forminator-is_hover'); }); // Set field active class on focus $select.on('click', function (e) { e.stopPropagation(); checkSelectActive(); if ($select.hasClass('select2-container--open')) { $(this).closest('.forminator-field').addClass('forminator-is_active'); } else { $(this).closest('.forminator-field').removeClass('forminator-is_active'); } }); }); function checkSelectActive() { if (form.find('.select2-container').hasClass('select2-container--open')) { setTimeout(checkSelectActive, 300); } else { form.find('.select2-container').closest('.forminator-field').removeClass('forminator-is_active'); } } }, field_counter: function ( form_selector ) { var form = $( form_selector ), submit_button = form.find('.forminator-button-submit'); form.find('.forminator-input, .forminator-input input, .forminator-textarea').each(function () { var $input = $(this), numwords = 0, count = 0; $input.on('keydown', function (e) { if ( ! $(this).hasClass('forminator-textarea') && e.keyCode === 13 ) { e.preventDefault(); if ( submit_button.is(":visible") ) { submit_button.trigger('click'); } return false; } }); $input.on('change keyup keydown', function (e) { e.stopPropagation(); var $field = $(this).closest('.forminator-col'), $limit = $field.find('.forminator-description span') ; if ($limit.length) { var textLimit = parseInt( $limit.data('limit') ); if (textLimit) { if ($limit.data('type') !== "words") { if ( $limit.data( 'editor' ) === 1 ) { const content = $( this ) .val() .replace( /<[^>]*>/g, '' ), content_text = $( '<textarea/>' ) .html( content ) .text(); count = content_text.length; const isCtrlPressed = e.ctrlKey || e.metaKey; // Handle macOS Command key (metaKey). const isSpecialKey = [ 37, 38, 39, 40, 8, 46 ].indexOf( e.keyCode ) !== -1; // Allow to delete and backspace when limit is reached. if ( count >= textLimit && ! isCtrlPressed && ! isSpecialKey ) { e.preventDefault(); } } else { count = $(this).val().length; } } else { var fieldVal = sanitize_text_field( $(this).val() ), field_value = fieldVal.replace( /<[^>]*>/g, '' ); count = field_value.trim().split(/\s+/).length; // Prevent additional words from being added when limit is reached. numwords = field_value.trim().split(/\s+/).length; if ( numwords >= textLimit ) { // Allow to delete and backspace when limit is reached. if( e.which === 32 ) { e.preventDefault(); } } } $limit.text(count + ' / ' + textLimit); } } }); }); }, field_number: function ( form_selector ) { // var form = $(this.element); // form.find('input[type=number]').on('change keyup', function () { // if( ! $(this).val().match(/^\d+$/) ){ // var sanitized = $(this).val().replace(/[^0-9]/g, ''); // $(this).val(sanitized); // } // }); var form = $( form_selector ); form.find('input[type=number]').each(function () { $(this).keypress(function (e) { var i; var allowed = [44, 45, 46]; var key = e.which; for (i = 48; i < 58; i++) { allowed.push(i); } if (!(allowed.indexOf(key) >= 0)) { e.preventDefault(); } }); }); form.find('.forminator-number--field, .forminator-currency, .forminator-calculation').each(function () { var inputType = $( this ).attr( 'type' ); if ( 'number' === inputType ) { var decimals = $( this ).data( 'decimals' ); $( this ).change( function ( e ) { this.value = parseFloat( this.value ).toFixed( decimals ); }); $( this ).trigger( 'change' ); } /* * If you need to retrieve the formatted (masked) value, you can use something like this: * $element.inputmask({'autoUnmask' : false}); * var value = $element.val(); * $element.inputmask({'autoUnmask' : true}); */ $( this ).inputmask({ 'alias': 'decimal', 'rightAlign': false, 'digitsOptional': false, 'showMaskOnHover': false, 'autoUnmask' : true, // Automatically unmask the value when retrieved - this prevents the "Maximum call stack size exceeded" console error that happens in some forms that contain number/calculation fields with localized masks. 'removeMaskOnSubmit': true, }); }); }, field_time: function () { var self = this; $('.forminator-input-time').on('input', function (e) { var $this = $(this), value = $this.val() ; // Allow only 2 digits for time fields if (value && value.length >= 2) { $this.val(value.substr(0, 2)); } }); // Apply time limits. this.$el.find( '.forminator-timepicker' ).each( function( i, el ) { var $tp = $( el ), start = $tp.data( 'start-limit' ), end = $tp.data( 'end-limit' ) ; if ( 'undefined' !== typeof start && 'undefined' !== typeof end ) { var hourSelect = $tp.find( '.time-hours' ), initHours = hourSelect.html() ; // Reset right away. self.resetTimePicker( $tp, start, end ); // Reset onchange. $tp.find( '.time-ampm' ).on( 'change', function() { hourSelect.val(''); hourSelect.html( initHours ); self.resetTimePicker( $tp, start, end ); setTimeout( function() { $tp.find( '.forminator-field' ).removeClass( 'forminator-has_error' ); }, 10 ); }); } }); }, // Remove hour options that are outside the limits. resetTimePicker: function ( timePicker, start, end ) { var meridiem = timePicker.find( '.time-ampm' ), [ startTime, startModifier ] = start.split(' '), [ startHour, startMinute ] = startTime.split(':'), startHour = parseInt( startHour ), [ endTime, endModifier ] = end.split(' '), [ endHour, endMinute ] = endTime.split(':'), endHour = parseInt( endHour ) ; if ( startModifier === endModifier ) { meridiem.find( 'option[value!="' + endModifier + '"]' ).remove(); } timePicker.find( '.time-hours' ).children().each( function( optionIndex, optionEl ) { var optionValue = parseInt( optionEl.value ); if ( '' !== optionValue && ( optionValue < startHour || ( 0 !== startHour && 12 === optionValue ) ) && meridiem.val() === startModifier ) { optionEl.remove(); } if ( '' !== optionValue && optionValue > endHour && 12 !== optionValue && meridiem.val() === endModifier ) { optionEl.remove(); } }); }, init_login_2FA: function () { var self = this; this.two_factor_providers( 'totp' ); $('body').on('click', '.forminator-2fa-link', function () { self.$el.find('#login_error').remove(); self.$el.find('.notification').empty(); var slug = $(this).data('slug'); self.two_factor_providers( slug ); if ('fallback-email' === slug) { self.resend_code(); } }); this.$el.find('.wpdef-2fa-email-resend input').on('click', function () { self.resend_code(); }); }, two_factor_providers: function ( slug ) { var self = this; self.$el.find('.forminator-authentication-box').hide(); self.$el.find('.forminator-authentication-box input').attr( 'disabled', true ); self.$el.find( '#forminator-2fa-' + slug ).show(); self.$el.find( '#forminator-2fa-' + slug + ' input' ).attr( 'disabled', false ); if ( self.$el.find('.forminator-2fa-link').length > 0 ) { self.$el.find('.forminator-2fa-link').hide(); self.$el.find('.forminator-2fa-link:not(#forminator-2fa-link-'+ slug +')').each(function() { self.$el.find('.forminator-auth-method').val( slug ); $( this ).find('input').attr( 'disabled', false ); $( this ).show(); }); } }, // Logic for FallbackEmail method. resend_code: function () { // Work with the button 'Resen Code'. var self = this; var that = $('input[name="button_resend_code"]'); var token = $('.forminator-auth-token'); let data = { action: 'forminator_2fa_fallback_email', data: JSON.stringify({ 'token': token }) }; $.ajax({ type: 'POST', url: window.ForminatorFront.ajaxUrl, data: data, beforeSend: function () { that.attr('disabled', 'disabled'); $('.def-ajaxloader').show(); }, success: function (data) { that.removeAttr('disabled'); $('.def-ajaxloader').hide(); $('.notification').text(data.data.message); } }) }, material_field: function () { /* var form = $(this.element); if (form.is('.forminator-design--material')) { var $input = form.find('.forminator-input--wrap'), $textarea = form.find('.forminator-textarea--wrap'), $date = form.find('.forminator-date'), $product = form.find('.forminator-product'); var $navigation = form.find('.forminator-pagination--nav'), $navitem = $navigation.find('li'); $('<span class="forminator-nav-border"></span>').insertAfter($navitem); $input.prev('.forminator-field--label').addClass('forminator-floating--input'); $input.closest('.forminator-phone-intl').prev('.forminator-field--label').addClass('forminator-floating--input'); $textarea.prev('.forminator-field--label').addClass('forminator-floating--textarea'); if ($date.hasClass('forminator-has_icon')) { $date.prev('.forminator-field--label').addClass('forminator-floating--date'); } else { $date.prev('.forminator-field--label').addClass('forminator-floating--input'); } } */ }, toggle_file_input: function() { var $form = $( this.element ); $form.find( '.forminator-file-upload' ).each( function() { var $field = $( this ); var $input = $field.find( 'input' ); var $remove = $field.find( '.forminator-button-delete' ); // Toggle remove button depend on input value if ( '' !== $input.val() ) { $remove.show(); // Show remove button } else { $remove.hide(); // Hide remove button } }); }, upload_field: function ( form_selector ) { var self = this, form = $( form_selector ) ; // Toggle file remove button this.toggle_file_input(); // Handle remove file button click form.find( '.forminator-button-delete' ).on('click', function (e) { e.preventDefault(); var $self = $( this ), $input = $self.siblings('input'), $label = $self.closest( '.forminator-file-upload' ).find('> span') ; // Cleanup $input.val(''); $label.html( $label.data( 'empty-text' ) ); $self.hide(); // Reset related conditional fields. $input.trigger( 'forminator.change', 'forminator_emulate_trigger' ); }); form.find( '.forminator-input-file, .forminator-input-file-required' ).on('change', function () { var $nameLabel = $(this).closest( '.forminator-file-upload' ).find( '> span' ), vals = $(this).val(), val = vals.length ? vals.split('\\').pop() : '' ; $nameLabel.text(val); self.toggle_file_input(); }); form.find( '.forminator-button-upload' ).off(); form.find( '.forminator-button-upload' ).on( 'click', function (e) { e.preventDefault(); var $id = $(this).attr('data-id'), $target = form.find('input#' + $id) ; $target.trigger('click'); }); form.find( '.forminator-input-file, .forminator-input-file-required' ).on('change', function (e) { e.preventDefault(); var $file = $(this)[0].files.length, $remove = $(this).find('.forminator-button-delete'); if ($file === 0) { $remove.hide(); } else { $remove.show(); } }); }, // Remove duplicate fields created by other plugins/themes maybeRemoveDuplicateFields: function ( form_selector ) { var form = $( form_selector ); // Check for Neira Lite theme if ( $( document ).find( "link[id='neira-lite-style-css']" ).length ) { var duplicateSelect = form.find( '.forminator-select-container' ).next( '.chosen-container' ), duplicateSelect2 = form.find( 'select.forminator-select2 + .forminator-select' ).next( '.chosen-container' ), duplicateAddress = form.find( '.forminator-select' ).next( '.chosen-container' ) ; if ( 0 !== duplicateSelect.length ) { duplicateSelect.remove(); } if ( 0 !== duplicateSelect2.length ) { duplicateSelect2.remove(); } if ( 0 !== duplicateAddress.length ) { duplicateAddress.remove(); } } }, renderCaptcha: function (captcha_field) { var self = this; //render captcha only if not rendered if (typeof $(captcha_field).data('forminator-recapchta-widget') === 'undefined') { var size = $(captcha_field).data('size'), data = { sitekey: $(captcha_field).data('sitekey'), theme: $(captcha_field).data('theme'), size: size }; if (size === 'invisible') { data.badge = $(captcha_field).data('badge'); data.callback = function (token) { $(self.element).trigger('submit.frontSubmit'); }; } else { data.callback = function () { $(captcha_field).parent( '.forminator-col' ) .removeClass( 'forminator-has_error' ) .remove( '.forminator-error-message' ); }; } if (data.sitekey !== "") { // noinspection Annotator var widget = window.grecaptcha.render(captcha_field, data); // mark as rendered $(captcha_field).data('forminator-recapchta-widget', widget); this.addCaptchaAria( captcha_field ); this.responsive_captcha(); } } }, renderHcaptcha: function ( captcha_field ) { var self = this; //render hcaptcha only if not rendered if (typeof $( captcha_field ).data( 'forminator-hcaptcha-widget' ) === 'undefined') { var size = $( captcha_field ).data( 'size' ), data = { sitekey: $( captcha_field ).data( 'sitekey' ), theme: $( captcha_field ).data( 'theme' ), size: size }; if ( size === 'invisible' ) { data.callback = function ( token ) { $( self.element ).trigger( 'submit.frontSubmit' ); }; } else { data.callback = function () { $( captcha_field ).parent( '.forminator-col' ) .removeClass( 'forminator-has_error' ) .remove( '.forminator-error-message' ); }; } if ( data.sitekey !== "" ) { // noinspection Annotator var widgetId = hcaptcha.render( captcha_field, data ); // mark as rendered $( captcha_field ).data( 'forminator-hcaptcha-widget', widgetId ); // this.addCaptchaAria( captcha_field ); // this.responsive_captcha(); } } }, renderTurnstileCaptcha: function ( captcha_field ) { var self = this; //render captcha only if not rendered if (typeof $( captcha_field ).data( 'forminator-turnstile-widget' ) === 'undefined') { var sitekey = $( captcha_field ).data( 'sitekey' ), data = { 'response-field-name': 'forminator-turnstile-response', callback: function (token, data, test) { $( captcha_field ).parent( '.forminator-col' ) .removeClass( 'forminator-has_error' ) .remove( '.forminator-error-message' ); } }; if ( sitekey !== "" ) { // noinspection Annotator var widgetId = turnstile.render( captcha_field, data ); // mark as rendered $( captcha_field ).data( 'forminator-turnstile-widget', widgetId ); } } }, addCaptchaAria: function ( captcha_field ) { var gRecaptchaResponse = $( captcha_field ).find( '.g-recaptcha-response' ), gRecaptcha = $( captcha_field ).find( '>div' ); if ( 0 !== gRecaptchaResponse.length ) { gRecaptchaResponse.attr( "aria-hidden", "true" ); gRecaptchaResponse.attr( "aria-label", "do not use" ); gRecaptchaResponse.attr( "aria-readonly", "true" ); } if ( 0 !== gRecaptcha.length ) { gRecaptcha.css( 'z-index', 99 ); } }, hide: function () { this.$el.hide(); }, /** * Return JSON object if possible * * We tried our best here * if there is an error/exception, it will return empty object/array * * @param string * @param type ('array'/'object') */ maybeParseStringToJson: function (string, type) { var object = {}; // already object if (typeof string === 'object') { return string; } if (type === 'object') { string = '{' + string.trim() + '}'; } else if (type === 'array') { string = '[' + string.trim() + ']'; } else { return {}; } try { // remove trailing comma, duh /** * find `,`, after which there is no any new attribute, object or array. * New attribute could start either with quotes (" or ') or with any word-character (\w). * New object could start only with character {. * New array could start only with character [. * New attribute, object or array could be placed after a bunch of space-like symbols (\s). * * Feel free to hack this regex if you got better idea * @type {RegExp} */ var trailingCommaRegex = /\,(?!\s*?[\{\[\"\'\w])/g; string = string.replace(trailingCommaRegex, ''); object = JSON.parse(string); } catch (e) { console.error(e.message); if (type === 'object') { object = {}; } else if (type === 'array') { object = []; } } return object; }, /** * Render Stripe once it's available * * @param string * @param type ('array'/'object') */ renderStripe: function( form, stripe_payment, stripeLoadCounter = 0 ) { var self = this; setTimeout( function() { stripeLoadCounter++; if ( 'undefined' !== typeof Stripe ) { let options= { type: 'stripe', paymentEl: stripe_payment, paymentRequireSsl: form.settings.payment_require_ssl, generalMessages: form.settings.general_messages, has_loader: form.settings.has_loader, loader_label: form.settings.loader_label, stripe_depends: form.settings.stripe_depends, }; if ( stripe_payment.data('is-ocs') ) { $( form.element ).forminatorFrontStripe( options ); } else { $( form.element ).forminatorFrontPayment( options ); } // Retry checking for 30 seconds } else if ( stripeLoadCounter < 300 ) { self.renderStripe( form, stripe_payment, stripeLoadCounter ); } else { console.error( 'Failed to load Stripe.' ); } }, 100 ); }, // Enable save draft button once a change is made maybe_enable_save_draft: function ( $saveDraft, initialData ) { var changedData = this.$el.serializeArray(), hasChanged = false, hasSig = this.$el.find( '.forminator-field-signature' ).length ? true : false ; // Remove signature field from changedData, will process later changedData = changedData.filter( function( val ) { return val.name.indexOf( 'ctlSignature' ) === -1 ; }); initialData = JSON.stringify( initialData ); changedData = JSON.stringify( changedData ); // Check for field changes if ( initialData !== changedData ) { hasChanged = true; } // Check for signature change if ( hasSig && false === hasChanged ) { this.$el.find( '.forminator-field-signature' ).each( function(e) { var sigPrefix = $( this ).find( '.signature-prefix' ).val(); if ( 0 !== $( this ).find( '#ctlSignature' + sigPrefix + '_data' ).length && '' !== $( this ).find( '#ctlSignature' + sigPrefix + '_data' ).val() ) { hasChanged = true; return false; } }); } if ( hasChanged ) { $saveDraft.removeClass( 'disabled' ); } else { $saveDraft.addClass( 'disabled' ); } }, handleDiviPopup: function () { var self = this; if ( 'undefined' !== typeof DiviArea ) { DiviArea.addAction( 'show_area', function( area ) { setTimeout( function() { self.init(); forminatorSignInit(); forminatorSignatureResize(); }, 100 ); }); } }, disableFields: function () { this.$el.addClass( 'forminator-fields-disabled' ); }, // Check if Complianz has added a blocker for reCaptcha. checkComplianzBlocker: function () { var complianzBlocker = this.$el.find( '.cmplz-blocked-content-container' ); if ( complianzBlocker.length > 0 ) { var row = complianzBlocker.closest( '.forminator-row' ); this.disableFields(); row.insertBefore( this.$el.find( '.forminator-row' ).first() ); row.css({ 'pointer-events': 'all', 'opacity': '1' }); row.find( '*' ).css( 'pointer-events', 'all' ); // For paginated. if ( row.closest( '.forminator-pagination--content' ).length > 0 ) { row.closest( '.forminator-pagination--content' ).css({ 'pointer-events': 'all', 'opacity': '1' }); row.nextAll( '.forminator-row' ).css({ 'opacity': '0.5' }); } // Reload window if accepted. $( 'body' ).on( 'click', '.cmplz-blocked-content-notice, .cmplz-accept', function() { setTimeout( function() { window.location.reload(); }, 50 ); }); } }, }); // A really lightweight plugin wrapper around the constructor, // preventing against multiple instantiations $.fn[pluginName] = function (options) { return this.each(function () { if (!$.data(this, pluginName)) { $.data(this, pluginName, new ForminatorFront(this, options)); } }); }; // hook from wp_editor tinymce $(document).on('tinymce-editor-init', function (event, editor) { var editor_id = editor.id, $field = $('#' + editor_id ).closest('.forminator-col') ; // Event listener to handle switching between Visual and Text tabs $( document ).on( 'click', '.wp-switch-editor', function () { setTimeout( function () { $field.find( '#' + editor_id ).trigger( 'change' ); }, 100 ); // Small timeout to ensure editor is ready when switching } ); // trigger editor change to save value to textarea, // default wp tinymce textarea update only triggered when submit var count = 0; editor.on('change', function () { // only forminator if ( -1 !== editor_id.indexOf( 'forminator-field-textarea-' ) ) { editor.save(); $field.find( '#' + editor_id ).trigger( 'change' ); } if ( -1 !== editor_id.indexOf( 'forminator-field-post-content-' ) ) { editor.save(); $field.find( '#' + editor_id ).trigger( 'change' ); } }); // Trigger onblur. editor.on( 'blur', function () { // only forminator if ( -1 !== editor_id.indexOf( 'forminator-field-textarea-' ) || -1 !== editor_id.indexOf( 'forminator-field-post-content-' ) ) { $field.find( '#' + editor_id ).valid(); } }); // Prevent typing when maximum characters/words is reached. editor.on( 'keydown', function ( e ) { let editor_id = editor.id, field = $( '#' + editor_id ).closest( '.forminator-col' ), limit = field.find( '.forminator-description span' ), content = editor.getContent().replace( /<[^>]*>/g, '' ); if ( limit.length ) { const maxLength = parseInt( limit.data( 'limit' ) ); if ( maxLength ) { content = $( '<div/>' ).html( content ).text(); const isCtrlPressed = e.ctrlKey || e.metaKey; // Handle macOS Command key (metaKey). const isSpecialKey = [ 37, 38, 39, 40, 8, 46 ].indexOf( e.keyCode ) !== -1; if ( limit.data( 'type' ) !== 'words' ) { if ( content.length >= maxLength && ! isCtrlPressed && ! isSpecialKey && e.keyCode !== 13 ) { e.preventDefault(); // Prevent any further typing. } } else { const numberOfWords = content .trim() .split( /\s+/ ).length; if ( numberOfWords >= maxLength && e.which === 32 ) { e.preventDefault(); // Prevent any further typing. } } } } } ); // Make the visual editor and html editor the same height if ( $( '#' + editor.id + '_ifr' ).is( ':visible' ) ) { $( '#' + editor.id + '_ifr' ).height( $( '#' + editor.id ).height() ); } // Add aria-describedby. if ( -1 !== editor_id.indexOf( 'forminator' ) ) { $( '#' + editor_id ).closest( '.wp-editor-wrap' ).attr( 'aria-describedby', editor_id + '-description' ); } }); $( document ).on( 'click', '.forminator-copy-btn', function( e ) { forminatorCopyTextToClipboard( $( this ).prev( '.forminator-draft-link' ).val() ); if ( ! $( this ).hasClass( 'copied' ) ) { $( this ).addClass( 'copied' ) $( this ).prepend( '✓ ' ); } } ); // Copy: Async + Fallback // https://stackoverflow.com/a/30810322 function forminatorFallbackCopyTextToClipboard( text ) { var textArea = document.createElement("textarea"); textArea.value = text; // Avoid scrolling to bottom textArea.style.top = "0"; textArea.style.left = "0"; textArea.style.position = "fixed"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { var successful = document.execCommand('copy'); var msg = successful ? 'successful' : 'unsuccessful'; // console.log('Fallback: Copying text command was ' + msg); } catch (err) { // console.error('Fallback: Oops, unable to copy', err); } document.body.removeChild(textArea); } function forminatorCopyTextToClipboard (text ) { if (!navigator.clipboard) { forminatorFallbackCopyTextToClipboard(text); return; } navigator.clipboard.writeText(text).then(function() { // console.log('Async: Copying to clipboard was successful!'); }, function(err) { // console.error('Async: Could not copy text: ', err); }); } // Focus to nearest input when label is clicked function focus_to_nearest_input() { $( '.forminator-custom-form' ).find( '.forminator-label' ).on( 'click', function ( e ) { e.preventDefault(); var fieldLabel = $( this ); fieldLabel.next( '#' + fieldLabel.attr( 'for' ) ).focus(); }); } focus_to_nearest_input(); $( document ).on( 'after.load.forminator', focus_to_nearest_input ); $( document ).on( 'after.load.forminator', () => { forminator_render_captcha(); forminator_render_hcaptcha(); forminator_render_turnstile(); } ); // Elementor Popup show event jQuery( document ).on( 'elementor/popup/show', () => { forminator_render_captcha(); forminator_render_hcaptcha(); forminator_render_turnstile(); } ); /** * Sanitize the user input string. * * @param {string} string */ function sanitize_text_field( string ) { if ( typeof string === 'string') { var str = String(string).replace(/<\/?[^>]+(>|$)/g, ''); return str.trim(); } return string; } })(jQuery, window, document); // noinspection JSUnusedGlobalSymbols var forminator_render_turnstile = function () { jQuery('.forminator-turnstile').each(function () { // find closest form. var thisCaptcha = jQuery(this), form = thisCaptcha.closest('form'); if ( form.length > 0 && '' === thisCaptcha.html() ) { window.setTimeout( function() { var forminatorFront = form.data( 'forminatorFront' ); if ( typeof forminatorFront !== 'undefined' ) { forminatorFront.renderTurnstileCaptcha( thisCaptcha[0] ); } }, 100 ); } }); }; // noinspection JSUnusedGlobalSymbols var forminator_render_captcha = function () { // TODO: avoid conflict with another plugins that provide recaptcha // notify forminator front that grecaptcha has loaded and can be used jQuery('.forminator-g-recaptcha').each(function () { // find closest form var thisCaptcha = jQuery(this), form = thisCaptcha.closest('form'); if ( form.length > 0 && '' === thisCaptcha.html() ) { window.setTimeout( function() { var forminatorFront = form.data( 'forminatorFront' ); if ( typeof forminatorFront !== 'undefined' ) { forminatorFront.renderCaptcha( thisCaptcha[0] ); } }, 100 ); } }); }; // noinspection JSUnusedGlobalSymbols var forminator_render_hcaptcha = function () { // TODO: avoid conflict with another plugins that provide hcaptcha // notify forminator front that hcaptcha has loaded and can be used jQuery('.forminator-hcaptcha').each(function () { // find closest form var thisCaptcha = jQuery(this), form = thisCaptcha.closest('form'); if ( form.length > 0 && '' === thisCaptcha.html() ) { window.setTimeout( function() { var forminatorFront = form.data( 'forminatorFront' ); if ( typeof forminatorFront !== 'undefined' ) { forminatorFront.renderHcaptcha( thisCaptcha[0] ); } }, 100 ); } }); }; // Source: http://stackoverflow.com/questions/497790 var forminatorDateUtil = { month_number: function( v ) { var months_short = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']; var months_full = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; if( v.constructor === Number ) { return v; } var n = NaN; if( v.constructor === String ) { v = v.toLowerCase(); var index = months_short.indexOf( v ); if( index === -1 ) { index = months_full.indexOf( v ); } n = ( index === -1 ) ? NaN : index; } return n; }, convert: function( d ) { // Converts the date in d to a date-object. The input can be: // a date object: returned without modification // an array : Interpreted as [year,month,day]. NOTE: month is 0-11. // a number : Interpreted as number of milliseconds // since 1 Jan 1970 (a timestamp) // a string : Any format supported by the javascript engine, like // "YYYY/MM/DD", "MM/DD/YYYY", "Jan 31 2009" etc. // an object : Interpreted as an object with year, month and date // attributes. **NOTE** month is 0-11. return ( d.constructor === Date ? d : d.constructor === Array ? new Date( d[0], this.month_number( d[1] ), d[2] ) : jQuery.isNumeric( d ) ? new Date( 1 * d ) : d.constructor === Number ? new Date( d ) : d.constructor === String ? new Date( d ) : typeof d === "object" ? new Date( d.year, this.month_number( d.month ), d.date ) : NaN ); }, compare: function( a, b ) { // Compare two dates (could be of any type supported by the convert // function above) and returns: // -1 : if a < b // 0 : if a = b // 1 : if a > b // NaN : if a or b is an illegal date // NOTE: The code inside isFinite does an assignment (=). return ( isFinite( a = this.convert( a ).valueOf() ) && isFinite( b = this.convert( b ).valueOf() ) ? ( a > b ) - ( a < b ) : NaN ); }, inRange: function( d, start, end ) { // Checks if date in d is between dates in start and end. // Returns a boolean or NaN: // true : if d is between start and end (inclusive) // false : if d is before start or after end // NaN : if one or more of the dates is illegal. // NOTE: The code inside isFinite does an assignment (=). return ( isFinite( d = this.convert( d ).valueOf() ) && isFinite( start = this.convert( start ).valueOf() ) && isFinite( end = this.convert( end ).valueOf() ) ? start <= d && d <= end : NaN ); }, diffInDays: function( d1, d2 ) { d1 = this.convert( d1 ); d2 = this.convert( d2 ); if( typeof d1.getMonth !== 'function' || typeof d2.getMonth !== 'function' ) { return NaN; } var t2 = d2.getTime(); var t1 = d1.getTime(); return parseFloat((t2-t1)/(24*3600*1000)); }, diffInWeeks: function( d1, d2 ) { d1 = this.convert( d1 ); d2 = this.convert( d2 ); if( typeof d1.getMonth !== 'function' || typeof d2.getMonth !== 'function' ) { return NaN; } var t2 = d2.getTime(); var t1 = d1.getTime(); return parseInt((t2-t1)/(24*3600*1000*7)); }, diffInMonths: function( d1, d2 ) { d1 = this.convert( d1 ); d2 = this.convert( d2 ); if( typeof d1.getMonth !== 'function' || typeof d2.getMonth !== 'function' ) { return NaN; } var d1Y = d1.getFullYear(); var d2Y = d2.getFullYear(); var d1M = d1.getMonth(); var d2M = d2.getMonth(); return (d2M+12*d2Y)-(d1M+12*d1Y); }, diffInYears: function( d1, d2 ) { d1 = this.convert( d1 ); d2 = this.convert( d2 ); if( typeof d1.getMonth !== 'function' || typeof d2.getMonth !== 'function' ) { return NaN; } return d2.getFullYear()-d1.getFullYear(); }, }; front.condition.js 0000644 00000112167 15162321604 0010227 0 ustar 00 // the semi-colon before function invocation is a safety net against concatenated // scripts and/or other plugins which may not be closed properly. ;// noinspection JSUnusedLocalSymbols (function ($, window, document, undefined) { "use strict"; // undefined is used here as the undefined global variable in ECMAScript 3 is // mutable (ie. it can be changed by someone else). undefined isn't really being // passed in so we can ensure the value of it is truly undefined. In ES5, undefined // can no longer be modified. // window and document are passed through as local variables rather than global // as this (slightly) quickens the resolution process and can be more efficiently // minified (especially when both are regularly referenced in your plugin). window.paypalHasCondition = []; // Create the defaults once var pluginName = "forminatorFrontCondition", defaults = { fields: {}, relations: {} }; // The actual plugin constructor function ForminatorFrontCondition(element, options, calendar) { this.element = element; this.$el = $(this.element); // jQuery has an extend method which merges the contents of two or // more objects, storing the result in the first object. The first object // is generally empty as we don't want to alter the default options for // future instances of the plugin this.settings = $.extend({}, defaults, options); this._defaults = defaults; this._name = pluginName; this.calendar = calendar[0]; this.init(); } // Avoid Plugin.prototype conflicts $.extend(ForminatorFrontCondition.prototype, { init: function () { var self = this, form = this.$el, $forminatorFields = this.$el.find( ".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea, .forminator-field-signature, .forminator-rating") ; // Duplicate rules for new repeated Group fields. if ( form.hasClass( 'forminator-grouped-fields' ) ) { let suffix = form.data( 'suffix' ); $.each( this.settings.fields, function ( key, val ) { let newKey = key + '-' + suffix; if ( ! form.find( '[name="' + newKey + '"]' ).length && ! form.find( '#' + newKey ).length ) { return; } let newVal = self.updateConditions( val, suffix, form ); self.settings['fields'][ newKey ] = newVal; } ); } this.add_missing_relations(); $forminatorFields.on( 'change input forminator.change', function (e) { var $element = $(this), element_id = $element.closest('.forminator-col').attr('id') ; if ( $element.is( 'input[type="radio"]' ) && 'input' === e.type ) { // Skip input events for radio buttons, handle only change events for them. return; } // Handle the email field when email confirmation is enabled. if ( $element.is( 'input[type="email"]' ) && element_id === undefined && $element.attr( 'id' ).startsWith( 'forminator-field-email-' ) ) { element_id = $element.closest( '.forminator-row-with-confirmation-email' ).parent( '.forminator-col' ).attr( 'id' ); } if (typeof element_id === 'undefined' || 0 === element_id.indexOf( 'slider-' ) ) { /* * data-multi attribute was added to Name field - multiple * We had to use name attribute for Name multi-field because we cannot change * the IDs of elements. Some functions rely on the ID text pattern already. */ if ( $element.attr( 'data-multi' ) === '1' || 'hidden' === $element.attr( 'type' ) ) { element_id = $element.attr( 'name' ); } else { element_id = $element.attr( 'id' ); } } element_id = element_id.trim(); //lookup condition of fields if (!self.has_relations(element_id) && !self.has_siblings(element_id)) return false; if( self.has_siblings(element_id) ) { self.trigger_fake_parent_date_field(element_id); } if(!self.has_relations(element_id) && self.has_siblings(element_id)){ self.trigger_siblings(element_id); return false; } self.process_relations( element_id, $element, e ); self.paypal_button_condition(); self.maybe_clear_upload_container(); }); // Trigger change event to textarea that has tinyMCE editor // For non-ajax form load $( document ).on( 'tinymce-editor-init', function ( event, editor ) { editor.on( 'change', function( e ) { form.find( '#' + $(this).attr( 'id' ) ).change(); }); }); // For ajax form load if ( typeof tinyMCE !== 'undefined' && tinyMCE.activeEditor ) { tinyMCE.activeEditor.on( 'change', function( e ) { form.find( '#' + $(this).attr( 'id' ) ).change(); }); } this.$el.find('.forminator-button.forminator-button-back, .forminator-button.forminator-button-next').on("click", function () { form.find('.forminator-field input:not([type="file"]), .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea').trigger( 'forminator.change', 'forminator_emulate_trigger' ); }); // Simulate change this.$el.find('.forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea').trigger( 'forminator.change', 'forminator_emulate_trigger' ); this.init_events(); }, updateConditions: function( data, suffix, form ) { // Clone data. var newData = JSON.parse(JSON.stringify(data)); if ( ! newData.conditions || ! Array.isArray( newData.conditions ) ) { return newData; } const currentGroup = form.closest('.forminator-col').prop( 'id' ); newData.conditions.forEach( function ( condition ) { if ( ! condition.field || ! condition.group ) { return; } // Update dependency field from if it's in the same group. if ( condition.group === currentGroup ) { condition.field = condition.field + '-' + suffix; } } ); return newData; }, process_relations: function( element_id, $element, e ) { var self = this; // Check if the field has any relations var relations = self.get_relations( element_id ); // Loop all relations the field have relations.forEach(function (relation) { var logic = self.get_field_logic(relation), action = logic.action, rule = logic.rule, conditions = logic.conditions, // Conditions rules matches = 0 // Number of matches ; // If paypal has logic, add form id to paypalHasCondition. if ( 0 === relation.indexOf( 'paypal' ) ) { if ( 0 !== logic.length && ! window.paypalHasCondition.includes( self.$el.data( 'form-id' ) ) ) { window.paypalHasCondition.push( self.$el.data( 'form-id' ) ); } } conditions.forEach(function (condition) { // If rule is applicable save in matches if (self.is_applicable_rule(condition, action)) { matches++; } }); if ((rule === "all" && matches === conditions.length) || (rule === "any" && matches > 0)) { //check if the given $element is an jQuery object if( $element instanceof jQuery ) { var pagination = $element.closest('.forminator-pagination'); } if (relation === 'submit' && typeof pagination !== 'undefined') { self.toggle_field(relation, 'show', "valid"); } self.toggle_field(relation, action, "valid"); if (self.has_relations(relation)){ if(action === 'hide'){ self.hide_element(relation, e); }else{ self.show_element(relation, e); } } } else { self.toggle_field(relation, action, "invalid"); if (self.has_relations(relation)){ if(action === 'show'){ self.hide_element(relation, e); }else{ self.show_element(relation, e); } } } }); }, /** * Register related events * * @since 1.0.3 */ init_events: function () { var self = this; this.$el.on('forminator.front.condition.restart', function (e) { self.on_restart(e); }); }, /** * Restart conditions * * @since 1.0.3 * * @param e */ on_restart: function (e) { // restart condition this.$el.find('.forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea').trigger( 'forminator.change', 'forminator_emulate_trigger' ); }, /** * Add missing relations based on fields.conditions */ add_missing_relations: function () { var self = this; var missedRelations = {}; if (typeof this.settings.fields !== "undefined") { var conditionsFields = this.settings.fields; Object.keys(conditionsFields).forEach(function (key) { var conditions = conditionsFields[key]['conditions']; conditions.forEach(function (condition) { var relatedField = condition.field; if (!self.has_relations(relatedField)) { if (typeof missedRelations[relatedField] === 'undefined') { missedRelations[relatedField] = []; } missedRelations[relatedField].push(key); } else { let relations = self.get_relations(relatedField); if ( -1 !== $.inArray( key, relations ) ) { return; } self.settings.relations[relatedField].push( key ); } }); }); } Object.keys(missedRelations).forEach(function (relatedField) { self.settings.relations[relatedField] = missedRelations[relatedField]; }); }, get_field_logic: function (element_id) { if (typeof this.settings.fields[element_id] === "undefined") return []; return this.settings.fields[element_id]; }, has_relations: function (element_id) { return typeof this.settings.relations[element_id] !== "undefined"; }, get_relations: function (element_id) { if (!this.has_relations(element_id)) return []; return $.unique( this.settings.relations[element_id] ); }, get_field_value: function (element_id) { if ( '' === element_id ) { return ''; } var $element = this.get_form_field(element_id), value = $element.val(); //check the type of input if (this.field_is_radio($element)) { value = $element.filter(":checked").val(); } else if (this.field_is_signature($element)) { value = $element.find( "input[id$='_data']" ).val(); } else if (this.field_is_checkbox($element)) { value = []; $element.each(function () { if ($(this).is(':checked')) { value.push($(this).val().toLowerCase()); } }); // if value is empty, return it as null if ( 0 === value.length ) { value = null; } // Check if the element is a multi-select. } else if (this.field_is_select($element) && $element.attr( "multiple" ) ) { value = []; var selected = $element.find("option").filter(':selected'); if (selected.length > 0) { selected.each(function () { value.push($(this).val().toLowerCase()); }); } else { value = null; } } else if ( this.field_is_textarea_wpeditor( $element ) ) { if ( typeof tinyMCE !== 'undefined' && tinyMCE.activeEditor ) { value = tinyMCE.activeEditor.getContent(); } } else if ( this.field_has_inputMask( $element ) ) { value = parseFloat( $element.inputmask('unmaskedvalue').replace(',','.') ); if ( 0 <= element_id.indexOf( 'calculation-' ) ) { return value; } } else if ( this.field_is_rating( $element ) ) { value = (typeof value === 'string' && value.split("/")[0]) || 0; return value; } if (!value) return ""; return value; }, get_date_field_value: function(element_id){ if ( '' === element_id ) { return ''; } var $element = this.get_form_field(element_id); //element may not be a real jQuery element for fake virtual parent date field var fake_field = true; if( $element instanceof jQuery ) { fake_field = false; //element may just be the wrapper div of child fields if( $element.hasClass('forminator-col') ) { fake_field = true; } } var value = ""; if ( !fake_field && this.field_is_datepicker($element) ){ value = $element.val(); //check if formats are accepted switch ( $element.data('format') ) { case 'dd/mm/yy': value = $element.val().split("/").reverse().join("-"); break; case 'dd.mm.yy': value = $element.val().split(".").reverse().join("-"); break; case 'dd-mm-yy': value = $element.val().split("-").reverse().join("-"); break; } if ( '' !== value ) { var formattedDate = new Date(value); value = {'year':formattedDate.getFullYear(), 'month':formattedDate.getMonth(), 'date':formattedDate.getDate(), 'day':formattedDate.getDay()}; } } else { var parent = ( fake_field === true )? element_id : $element.data('parent'); var year = this.get_form_field_value(parent+'-year'), mnth = this.get_form_field_value(parent+'-month'), day = this.get_form_field_value(parent+'-day'); if( year !== "" && mnth !== "" && day !== "" ){ var formattedDate = new Date( year + '-' + mnth + '-' + day ); value = {'year':formattedDate.getFullYear(), 'month':formattedDate.getMonth(), 'date':formattedDate.getDate(), 'day':formattedDate.getDay() }; } } if (!value) return ""; return value; }, field_has_inputMask: function ( $element ) { var hasMask = false; $element.each(function () { if ( undefined !== $( this ).attr( 'data-inputmask' ) ) { hasMask = true; //break return false; } }); return hasMask; }, field_is_radio: function ($element) { var is_radio = false; $element.each(function () { if ($(this).attr('type') === 'radio') { is_radio = true; //break return false; } }); return is_radio; }, field_is_signature: function($element) { var is_signature = false; $element.each(function () { if ($(this).find('.forminator-field-signature').length > 0) { is_signature = true; //break return false; } }); return is_signature; }, field_is_datepicker: function ($element) { var is_date = false; $element.each(function () { if ($(this).hasClass('forminator-datepicker')) { is_date = true; //break return false; } }); return is_date; }, field_is_checkbox: function ($element) { var is_checkbox = false; $element.each(function () { if ($(this).attr('type') === 'checkbox') { is_checkbox = true; //break return false; } }); return is_checkbox; }, /* field_is_consent: function ( $element ) { var is_consent = false; $( 'input[name="' + $element + '"]' ).each(function () { if ( $element.indexOf( 'consent' ) >= 0 ) { is_consent = true; //break return false; } }); return is_consent; }, */ field_is_select: function ($element) { return $element.is('select'); }, field_is_textarea_wpeditor: function ($element) { var is_textarea_wpeditor = false; $element.each(function () { if ( $(this).parent( '.wp-editor-container' ).parent( 'div' ).hasClass( 'tmce-active' ) ) { is_textarea_wpeditor = true; //break return false; } }); return is_textarea_wpeditor; }, field_is_upload: function ($element) { var is_upload = false; if ( -1 !== $element.indexOf( 'upload' ) ) { is_upload = true; } return is_upload; }, field_is_rating: function ($element) { var is_rating = false; $element.each(function () { if ( $(this).hasClass('forminator-rating') ) { is_rating = true; //break return false; } }); return is_rating; }, // used in forminatorFrontCalculate get_form_field: function (element_id) { let $form = this.$el; if ( $form.hasClass( 'forminator-grouped-fields' ) ) { $form = $form.closest( 'form.forminator-ui' ); } //find element by suffix -field on id input (default behavior) var $element = $form.find('#' + element_id + '-field'); if ($element.length === 0) { $element = $form.find('.' + element_id + '-payment'); if ($element.length === 0) { //find element by its on name (for radio on singlevalue) $element = $form.find('input[name="' + element_id + '"]'); if ($element.length === 0) { // for text area that have uniqid, so we check its name instead $element = $form.find('textarea[name="' + element_id + '"]'); if ($element.length === 0) { //find element by its on name[] (for checkbox on multivalue) $element = $form.find('input[name="' + element_id + '[]"]'); if ($element.length === 0) { //find element by select name $element = $form.find('select[name="' + element_id + '"]'); if ($element.length === 0) { $element = $form.find('select[name="' + element_id + '[]"]'); if ($element.length === 0) { //find element by direct id (for name field mostly) //will work for all field with element_id-[somestring] $element = $form.find('#' + element_id); } } } } } } } return $element; }, // Extension of get_form_field to get value get_form_field_value: function (element_id) { //find element by suffix -field on id input (default behavior) var $form_id = this.$el.data( 'form-id' ), $uid = this.$el.data( 'uid' ), $element = this.$el.find('#forminator-form-' + $form_id + '__field--' + element_id + '_' + $uid ); if ($element.length === 0) { var $element = this.$el.find('#' + element_id + '-field' ); if ($element.length === 0) { //find element by its on name (for radio on singlevalue) $element = this.$el.find('input[name="' + element_id + '"]'); if ($element.length === 0) { // for text area that have uniqid, so we check its name instead $element = this.$el.find('textarea[name="' + element_id + '"]'); if ($element.length === 0) { //find element by its on name[] (for checkbox on multivalue) $element = this.$el.find('input[name="' + element_id + '[]"]'); if ($element.length === 0) { //find element by select name $element = this.$el.find('select[name="' + element_id + '"]'); if ($element.length === 0) { $element = this.$el.find('select[name="' + element_id + '[]"]'); if ($element.length === 0) { //find element by direct id (for name field mostly) //will work for all field with element_id-[somestring] $element = this.$el.find('#' + element_id); } } } } } } } return $element.val(); }, is_numeric: function (number) { return !isNaN(parseFloat(number)) && isFinite(number); }, is_date_rule: function(operator){ var dateRules = ['day_is', 'day_is_not', 'month_is', 'month_is_not', 'is_before', 'is_after', 'is_before_n_or_more_days', 'is_before_less_than_n_days', 'is_after_n_or_more_days', 'is_after_less_than_n_days']; return dateRules.includes( operator ); }, has_siblings: function(element){ if ( '' === element ) { return false; } element = this.get_form_field(element); if( element.data('parent') ) return true; return false; }, trigger_fake_parent_date_field: function(element_id){ var element = this.get_form_field(element_id), parent = element.data('parent'); this.process_relations( parent, {}, {}); }, trigger_siblings: function(element_id){ var self = this, element = self.get_form_field(element_id), parent = element.data('parent'), siblings = []; siblings = [parent+'-year', parent+'-month', parent+'-day']; $.each(siblings, function( index, sibling ) { if( element_id !== sibling && self.has_relations(sibling) ){ self.get_form_field(sibling).trigger('change'); } }); }, is_applicable_rule: function (condition, action) { if (typeof condition === "undefined") return false; if( this.is_date_rule( condition.operator ) ){ var value1 = this.get_date_field_value(condition.field); }else{ var value1 = this.get_field_value(condition.field); } var value2 = condition.value, operator = condition.operator ; if (action === "show") { return this.is_matching(value1, value2, operator) && this.is_hidden(condition.field); } else { return this.is_matching(value1, value2, operator); } }, is_hidden: function (element_id) { var $element_id = this.get_form_field(element_id), $column_field = $element_id.closest('.forminator-col'), $row_field = $column_field.closest('.forminator-row') ; if ( $row_field.hasClass("forminator-hidden-option") ) { return true; } if( $row_field.hasClass("forminator-hidden") ) { return false; } return true; }, is_matching: function (value1, value2, operator) { // Match values case var isArrayValue = Array.isArray(value1); // Match values case if (typeof value1 === 'string') { value1 = value1.toLowerCase(); } if(typeof value2 === 'string'){ value2 = value2.toLowerCase(); if(operator === 'month_is' || operator === 'month_is_not'){ var months = { 'jan':0, 'feb':1, 'mar':2, 'apr':3, 'may':4, 'jun':5, 'jul':6, 'aug':7, 'sep':8, 'oct':9, 'nov':10, 'dec':11 }; if($.inArray(value2, months)){ value2 = months[ value2 ]; } } if(operator === 'day_is' || operator === 'day_is_not'){ var days = { 'su':0, 'mo':1, 'tu':2, 'we':3, 'th':4, 'fr':5, 'sa':6 }; if($.inArray(value2, days)){ value2 = days[ value2 ]; } } } switch (operator) { case "is": if (!isArrayValue) { if ( this.is_numeric( value1 ) && this.is_numeric( value2 ) ) { return Number( value1 ) === Number( value2 ); } return value1 === value2; } else { return $.inArray(value2, value1) > -1; } case "is_not": if (!isArrayValue) { if ( this.is_numeric( value1 ) && this.is_numeric( value2 ) ) { return Number( value1 ) !== Number( value2 ); } return value1 !== value2; } else { return $.inArray(value2, value1) === -1; } case "is_great": // typecasting to integer, with return `NaN` when its literal chars, so `is_numeric` will fail value1 = +value1; value2 = +value2; return this.is_numeric(value1) && this.is_numeric(value2) ? value1 > value2 : false; case "is_less": value1 = +value1; value2 = +value2; return this.is_numeric(value1) && this.is_numeric(value2) ? value1 < value2 : false; case "contains": return this.contains(value1, value2); case "does_not_contain": return !this.contains(value1, value2); case "starts": return value1.startsWith(value2); case "ends": return value1.endsWith(value2); case "month_is": return value1.month === value2; case "month_is_not": return value1.month !== value2; case "day_is": return value1.day === value2; case "day_is_not": return value1.day !== value2; case "is_before": return this.date_is_smaller( value1, value2 ); case "is_after": return this.date_is_grater( value1, value2 ); case "is_before_n_or_more_days": return this.date_is_n_days_before_current_date( value1, value2 ); case "is_before_less_than_n_days": return this.date_is_less_than_n_days_before_current_date( value1, value2 ); case "is_after_n_or_more_days": return this.date_is_n_days_after_current_date( value1, value2 ); case "is_after_less_than_n_days": return this.date_is_less_than_n_days_after_current_date( value1, value2 ); } // Return false if above are not valid return false; }, contains: function (field_value, value) { return field_value.toLowerCase().indexOf(value) >= 0; }, date_is_grater: function( date1, date2 ) { date1 = this.set_date_as_utc_time( date1 ); return forminatorDateUtil.compare( date1, date2 ) === 1; }, set_date_as_utc_time( date ) { if ( undefined !== date.month && undefined !== date.date && undefined !== date.year ) { const utcDate = new Date( `${ date.month + 1 }/${ date.date }/${ date.year } UTC` ); date = utcDate.getTime(); } return date; }, date_is_smaller: function( date1, date2 ) { date1 = this.set_date_as_utc_time( date1 ); return forminatorDateUtil.compare( date1, date2 ) === -1; }, date_is_equal: function( date1, date2 ) { return forminatorDateUtil.compare( date1, date2 ) === 0; }, date_is_n_days_before_current_date: function( date1, n ) { n = parseInt( n ); var current_date = this.get_current_date(); var diff = forminatorDateUtil.diffInDays( date1, current_date ); if( isNaN( diff ) ) { return false; } if( n === 0 ) { return ( diff === n ); } else { return ( diff >= n ); } }, date_is_less_than_n_days_before_current_date: function( date1, n ) { n = parseInt( n ); var current_date = this.get_current_date(); var diff = forminatorDateUtil.diffInDays( date1, current_date ); if( isNaN( diff ) ) { return false; } return ( diff < n && diff > 0 ); }, date_is_n_days_after_current_date: function( date1, n ) { n = parseInt( n ); var current_date = this.get_current_date(); var diff = forminatorDateUtil.diffInDays( current_date, date1 ); if( isNaN( diff ) ) { return false; } if( n === 0 ) { return ( diff === n ); } else { return ( diff >= n ); } }, date_is_less_than_n_days_after_current_date: function( date1, n ) { n = parseInt( n ); var current_date = this.get_current_date(); var diff = forminatorDateUtil.diffInDays( current_date, date1 ); if( isNaN( diff ) ) { return false; } return ( diff < n && diff > 0 ); }, get_current_date: function() { return new Date(); }, toggle_field: function (element_id, action, type) { var self = this, $element_id = this.get_form_field(element_id), $column_field = $element_id.closest('.forminator-col'), $hidden_upload = $column_field.find('.forminator-input-file-required'), $hidden_signature = $column_field.find('[id ^=ctlSignature][id $=_data]'), $hidden_wp_editor = $column_field.find('.forminator-wp-editor-required'), $row_field = $column_field.closest('.forminator-row'), $sub_row_field = $column_field.closest('.forminator-row-inside'), // Used for Email Confirmation. $sub_row_fields = $sub_row_field.add($sub_row_field.parent()), // Include Email Confirmation parent column. $pagination_next_field = this.$el.find('.forminator-pagination-footer').find('.forminator-button-next'), submit_selector = 'submit' === element_id ? '.forminator-button-submit' : '#forminator-paypal-submit', $pagination_field = this.$el.find( submit_selector ) ; // Handle show action if (action === "show") { if (type === "valid") { $row_field.removeClass('forminator-hidden'); $sub_row_fields.removeClass('forminator-hidden'); $column_field.removeClass('forminator-hidden'); $pagination_next_field.removeClass('forminator-hidden'); if ($hidden_upload.length > 0) { $hidden_upload.addClass('do-validate'); } if ($hidden_wp_editor.length > 0) { $hidden_wp_editor.addClass('do-validate'); } if ($hidden_signature.length > 0) { $hidden_signature.addClass('do-validate'); } setTimeout( function() { $pagination_field = self.$el.find( submit_selector ); if ( 'submit' === element_id ) { $pagination_field.removeClass('forminator-hidden'); } if ( 0 === element_id.indexOf( 'paypal' ) ) { self.$el.find( '.forminator-button-submit' ).addClass( 'forminator-hidden' ); $pagination_field.removeClass( 'forminator-hidden' ); } }, 100 ); } else { $column_field.addClass('forminator-hidden'); setTimeout( function() { $pagination_field = self.$el.find( submit_selector ); if ( 'submit' === element_id ) { $pagination_field.addClass('forminator-hidden'); } if ( 0 === element_id.indexOf( 'paypal' ) ) { self.$el.find( '.forminator-button-submit' ).removeClass( 'forminator-hidden' ); $pagination_field.addClass('forminator-hidden'); } }, 100 ); if ($hidden_upload.length > 0) { $hidden_upload.removeClass('do-validate'); } if ($hidden_wp_editor.length > 0) { $hidden_wp_editor.removeClass('do-validate'); } if ($hidden_signature.length > 0) { $hidden_signature.removeClass('do-validate'); } if ($sub_row_field.find('> .forminator-col:not(.forminator-hidden)').length === 0) { $sub_row_fields.addClass('forminator-hidden'); } if ($row_field.find('> .forminator-col:not(.forminator-hidden)').length === 0) { $row_field.addClass('forminator-hidden'); } } } // Handle hide action if (action === "hide") { if (type === "valid") { $column_field.addClass('forminator-hidden'); $pagination_field.addClass('forminator-hidden'); if ($hidden_upload.length > 0) { $hidden_upload.removeClass('do-validate'); } if ($hidden_wp_editor.length > 0) { $hidden_wp_editor.removeClass('do-validate'); } if ($hidden_signature.length > 0) { $hidden_signature.removeClass('do-validate'); } if ($row_field.find('> .forminator-col:not(.forminator-hidden)').length === 0) { $row_field.addClass('forminator-hidden'); } if ($sub_row_field.find('> .forminator-col:not(.forminator-hidden)').length === 0) { $sub_row_fields.addClass('forminator-hidden'); } setTimeout( function() { $pagination_field = self.$el.find( submit_selector ); if ( 'submit' === element_id ) { $pagination_field.addClass('forminator-hidden'); } if ( 0 === element_id.indexOf( 'paypal' ) ) { self.$el.find( '.forminator-button-submit' ).removeClass( 'forminator-hidden' ); $pagination_field.addClass( 'forminator-hidden' ); } }, 100 ); } else { $row_field.removeClass('forminator-hidden'); $sub_row_fields.removeClass('forminator-hidden'); $column_field.removeClass('forminator-hidden'); $pagination_field.removeClass('forminator-hidden'); if ($hidden_upload.length > 0) { $hidden_upload.addClass('do-validate'); } if ($hidden_wp_editor.length > 0) { $hidden_wp_editor.addClass('do-validate'); } if ($hidden_signature.length > 0) { $hidden_signature.addClass('do-validate'); } setTimeout( function() { $pagination_field = self.$el.find( submit_selector ); if ( 'submit' === element_id ) { $pagination_field.removeClass('forminator-hidden'); } if ( 0 === element_id.indexOf( 'paypal' ) ) { self.$el.find( '.forminator-button-submit' ).addClass( 'forminator-hidden' ); $pagination_field.removeClass( 'forminator-hidden' ); } }, 100 ); } } this.$el.trigger('forminator:field:condition:toggled'); this.toggle_confirm_field( element_id, action, type ); }, clear_value: function(element_id, e) { var $element = this.get_form_field(element_id), value = this.get_field_value(element_id) ; if ( $element.hasClass('forminator-cleared-value') ) { return; } $element.addClass('forminator-cleared-value'); // Execute only on human action if (e.originalEvent !== undefined) { if (this.field_is_radio($element)) { $element.attr('data-previous-value', value); $element.removeAttr('checked'); } else if (this.field_is_checkbox($element)) { $element.each(function () { $(this).attr('data-previous-value', value); $(this).prop('checked', false); }); } else { $element.attr('data-previous-value', value); $element.val(''); } } }, restore_value: function(element_id, e) { var $element = this.get_form_field(element_id), value = $element.attr('data-previous-value') ; if ( ! $element.hasClass('forminator-cleared-value') ) { return; } // Execute only on human action if (e.originalEvent === undefined) { return; } $element.removeClass('forminator-cleared-value'); // Return after class is removed if field is upload if ( this.field_is_upload( element_id ) ) { return; } if(!value) return; if (this.field_is_radio($element)) { $element.val([value]); } else if (this.field_is_checkbox($element)) { $element.each(function () { var value = $(this).attr('data-previous-value'); if (!value) return; if (value.indexOf($(this).val().toLowerCase()) >= 0) { $(this).prop( "checked", true ); } }); } else { $element.val(value); } }, hide_element: function (relation, e){ var self = this, sub_relations = self.get_relations(relation); self.clear_value(relation, e); sub_relations.forEach(function (sub_relation) { // Do opposite action because condition is definitely not met because dependent field is hidden. let logic = self.get_field_logic(sub_relation), action = 'hide' === logic.action ? 'show' : 'hide'; self.toggle_field(sub_relation, action, "valid"); if (self.has_relations(sub_relation)) { if ( 'hide' === action ) { self.hide_element(sub_relation, e); } else { self.show_element(sub_relation, e); } } }); }, show_element: function (relation, e){ var self = this, sub_relations = self.get_relations(relation) ; this.restore_value(relation, e); this.textareaFix(this.$el, relation, e); sub_relations.forEach(function (sub_relation) { var logic = self.get_field_logic(sub_relation), action = logic.action, rule = logic.rule, conditions = logic.conditions, // Conditions rules matches = 0 // Number of matches ; conditions.forEach(function (condition) { // If rule is applicable save in matches if (self.is_applicable_rule(condition, action)) { matches++; } }); if ((rule === "all" && matches === conditions.length) || (rule === "any" && matches > 0)) { self.toggle_field(sub_relation, action, "valid"); }else{ self.toggle_field(sub_relation, action, "invalid"); } if (self.has_relations(sub_relation)) { sub_relations = self.show_element(sub_relation, e); } }); }, paypal_button_condition: function() { var paymentElement = this.$el.find('.forminator-paypal-row'), paymentPageElement = this.$el.find('.forminator-pagination-footer').find('.forminator-button-paypal'); if( paymentElement.length > 0 ) { this.$el.find('.forminator-button-submit').closest('.forminator-row').removeClass('forminator-hidden'); if( ! paymentElement.hasClass('forminator-hidden') ) { this.$el.find('.forminator-button-submit').closest('.forminator-row').addClass('forminator-hidden'); } } if ( paymentPageElement.length > 0 ) { if( paymentPageElement.hasClass('forminator-hidden') ) { this.$el.find('.forminator-button-submit').removeClass('forminator-hidden'); } else{ this.$el.find('.forminator-button-submit').addClass('forminator-hidden'); } } }, maybe_clear_upload_container: function() { this.$el.find( '.forminator-row.forminator-hidden input[type="file"]' ).each( function () { if ( '' === $(this).val() ) { if ( $(this).parent().hasClass( 'forminator-multi-upload' ) ) { $(this).parent().siblings( '.forminator-uploaded-files' ).empty(); } else { $(this).siblings( 'span' ).text( $(this).siblings( 'span' ).data( 'empty-text' ) ); $(this).siblings( '.forminator-button-delete' ).hide(); } } }); }, // Fixes textarea bug with labels when using Material design style textareaFix: function (form ,relation, e){ var label = $( '#' + relation + ' .forminator-label' ) ; if ( relation.includes( 'textarea' ) && form.hasClass( 'forminator-design--material' ) && 0 < label.length ) { var materialTextarea = $( '#' + relation + ' .forminator-textarea'), labelPaddingTop = label.height() + 9 // Based on forminator-form.js ; label.css({ 'padding-top': labelPaddingTop + 'px' }); materialTextarea.css({ 'padding-top': labelPaddingTop + 'px' }); } }, // Maybe toggle confirm field if necessary. toggle_confirm_field: function ( element_id, action, type ) { const confirmFieldId = 'confirm_' + element_id, $confirmField = this.get_form_field( confirmFieldId ); if ( $confirmField.length ) { this.toggle_field(confirmFieldId, action, type); } }, }); // A really lightweight plugin wrapper around the constructor, // preventing against multiple instantiations $.fn[pluginName] = function (options, calendar) { return this.each(function () { if (!$.data(this, pluginName)) { $.data(this, pluginName, new ForminatorFrontCondition(this, options, calendar)); } }); }; })(jQuery, window, document); front.payment.js 0000644 00000060620 15162321604 0007712 0 ustar 00 // the semi-colon before function invocation is a safety net against concatenated // scripts and/or other plugins which may not be closed properly. ;// noinspection JSUnusedLocalSymbols (function ($, window, document, undefined) { "use strict"; // Polyfill if (!Object.assign) { Object.defineProperty(Object, 'assign', { enumerable: false, configurable: true, writable: true, value: function(target, firstSource) { 'use strict'; if (target === undefined || target === null) { throw new TypeError('Cannot convert first argument to object'); } var to = Object(target); for (var i = 1; i < arguments.length; i++) { var nextSource = arguments[i]; if (nextSource === undefined || nextSource === null) { continue; } var keysArray = Object.keys(Object(nextSource)); for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { var nextKey = keysArray[nextIndex]; var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); if (desc !== undefined && desc.enumerable) { to[nextKey] = nextSource[nextKey]; } } } return to; } }); } // undefined is used here as the undefined global variable in ECMAScript 3 is // mutable (ie. it can be changed by someone else). undefined isn't really being // passed in so we can ensure the value of it is truly undefined. In ES5, undefined // can no longer be modified. // window and document are passed through as local variables rather than global // as this (slightly) quickens the resolution process and can be more efficiently // minified (especially when both are regularly referenced in your plugin). // Create the defaults once var pluginName = "forminatorFrontPayment", defaults = { type: 'stripe', paymentEl: null, paymentRequireSsl: false, generalMessages: {}, }; // The actual plugin constructor function ForminatorFrontPayment(element, options) { this.element = element; this.$el = $(this.element); // jQuery has an extend method which merges the contents of two or // more objects, storing the result in the first object. The first object // is generally empty as we don't want to alter the default options for // future instances of the plugin this.settings = $.extend({}, defaults, options); this._defaults = defaults; this._name = pluginName; this._stripeData = null; this._stripe = null; this._cardElement = null; this._stripeToken = null; this._beforeSubmitCallback = null; this._form = null; this._paymentIntent = null; this.init(); } // Avoid Plugin.prototype conflicts $.extend(ForminatorFrontPayment.prototype, { init: function () { if (!this.settings.paymentEl || typeof this.settings.paymentEl.data() === 'undefined') { return; } var self = this; this._stripeData = this.settings.paymentEl.data(); if ( false === this.mountCardField() ) { return; } $(this.element).on('payment.before.submit.forminator', function (e, formData, callback) { self._form = self.getForm(e); self._beforeSubmitCallback = callback; self.validateStripe(e, formData); }); this.$el.on("forminator:form:submit:stripe:3dsecurity", function(e, secret, subscription) { self.validate3d(e, secret, subscription); }); // Listen for fields change to update ZIP mapping this.$el.find( 'input.forminator-input, .forminator-input input, .forminator-field-textarea textarea, .forminator-checkbox input, .forminator-radio input, select.forminator-select2' ).each(function () { $( this ).on( 'change', function ( e, param1 ) { if ( param1 !== 'forminator_emulate_trigger' ) { self.mapZip( e ); } } ); }).trigger( 'change' ); }, validate3d: function( e, secret, subscription ) { var self = this; if ( subscription ) { this._stripe.confirmCardPayment(secret, { payment_method: { card: self._cardElement, ...self.getBillingData(), }, }) .then(function(result) { self.$el.find('#forminator-stripe-subscriptionid').val( subscription ); if (self._beforeSubmitCallback) { self._beforeSubmitCallback.call(); } }); } else { this._stripe.retrievePaymentIntent( secret ).then(function(result) { if ( result.paymentIntent.status === 'requires_action' || result.paymentIntent.status === 'requires_source_action' ) { self._stripe .confirmCardPayment( secret, { payment_method: { card: self._cardElement, ...self.getBillingData(), }, } ) .then( function ( result ) { if ( self._beforeSubmitCallback ) { self._beforeSubmitCallback.call(); } } ); } }); } }, validateStripe: function(e, formData) { var self = this; this._stripe.createToken(this._cardElement).then(function (result) { if (result.error) { self.showCardError(result.error.message, true); self.$el.find( 'button' ).removeAttr( 'disabled' ); } else { self.hideCardError(); self._stripe.createPaymentMethod('card', self._cardElement, self.getBillingData()).then(function (result) { var paymentMethod = self.getObjectValue(result, 'paymentMethod'); self._stripeData['paymentMethod'] = self.getObjectValue(paymentMethod, 'id'); self.updateAmount(e, formData, result); }); } }); }, isValid: function(focus) { var self = this; this._stripe.createToken(this._cardElement).then(function (result) { if (result.error) { self.showCardError(result.error.message, focus); } else { self.hideCardError(); } }); }, getForm: function(e) { var $form = $( e.target ); if(!$form.hasClass('forminator-custom-form')) { $form = $form.closest('form.forminator-custom-form'); } return $form; }, updateAmount: function(e, formData, result) { e.preventDefault(); var self = this; var updateFormData = formData; var paymentMethod = this.getObjectValue(result, 'paymentMethod'); //Method set() doesn't work in IE11 updateFormData.append( 'action', 'forminator_update_payment_amount' ); updateFormData.append( 'paymentid', this.getStripeData('paymentid') ); updateFormData.append( 'payment_method', this.getObjectValue(paymentMethod, 'id') ); var receipt = this.getStripeData('receipt'); var receiptEmail = this.getStripeData('receiptEmail'); var receiptObject = {}; if( receipt && receiptEmail ) { var emailValue = this.get_field_value(receiptEmail) || ''; updateFormData.append( 'receipt_email', emailValue ); } $.ajax({ type: 'POST', url: window.ForminatorFront.ajaxUrl, data: updateFormData, cache: false, contentType: false, processData: false, beforeSend: function () { if( typeof self.settings.has_loader !== "undefined" && self.settings.has_loader ) { // Disable form fields self._form.addClass('forminator-fields-disabled'); var $target_message = self._form.find('.forminator-response-message'); $target_message.html('<p>' + self.settings.loader_label + '</p>'); self.focus_to_element($target_message); $target_message.removeAttr("aria-hidden") .prop("tabindex", "-1") .removeClass('forminator-success forminator-error') .addClass('forminator-loading forminator-show'); } self._form.find('button').attr('disabled', true); }, success: function (data) { if (data.success === true) { // Store payment id if (typeof data.data !== 'undefined' && typeof data.data.paymentid !== 'undefined') { self.$el.find('#forminator-stripe-paymentid').val(data.data.paymentid); self.$el.find('#forminator-stripe-paymentmethod').val(self._stripeData['paymentMethod']); self._stripeData['paymentid'] = data.data.paymentid; self._stripeData['secret'] = data.data.paymentsecret; self.handleCardPayment(data, e, formData); } else { self.show_error('Invalid Payment Intent ID'); } } else { self.show_error(data.data.message); if(data.data.errors.length) { self.show_messages(data.data.errors); } var $captcha_field = self._form.find('.forminator-g-recaptcha'); if ($captcha_field.length) { $captcha_field = $($captcha_field.get(0)); var recaptcha_widget = $captcha_field.data('forminator-recapchta-widget'), recaptcha_size = $captcha_field.data('size'); if (recaptcha_size === 'invisible') { window.grecaptcha.reset(recaptcha_widget); } } } }, error: function (err) { var $message = err.status === 400 ? window.ForminatorFront.cform.upload_error : window.ForminatorFront.cform.error; self.show_error($message); } }) }, show_error: function(message) { var $target_message = this._form.find('.forminator-response-message'); this._form.find('button').removeAttr('disabled'); $target_message.removeAttr("aria-hidden") .prop("tabindex", "-1") .removeClass('forminator-loading') .addClass('forminator-error forminator-show'); $target_message.html('<p>' + message + '</p>'); this.focus_to_element($target_message); this.enable_form(); }, enable_form: function() { if( typeof this.settings.has_loader !== "undefined" && this.settings.has_loader ) { var $target_message = this._form.find('.forminator-response-message'); // Enable form fields this._form.removeClass('forminator-fields-disabled'); $target_message.removeClass('forminator-loading'); } }, mapZip: function (e) { var verifyZip = this.getStripeData('veifyZip'); var zipField = this.getStripeData('zipField'); var changedField = $(e.currentTarget).attr('name'); const fieldType = $( e.currentTarget ).attr( 'type' ); // To handle the checkbox name[] if ( 'checkbox' === fieldType ) { changedField = changedField.replace( '[]', '' ); } // Verify ZIP is enabled, mapped field is not empty and changed field is the mapped field, proceed if (verifyZip && zipField !== "" && changedField === zipField) { // Get field var value = this.get_field_value(zipField).toString(); // Update card element this._cardElement.update({ value: { postalCode: value } }); } }, focus_to_element: function ($element) { // force show in case its hidden of fadeOut $element.show(); $('html,body').animate({scrollTop: ($element.offset().top - ($(window).height() - $element.outerHeight(true)) / 2)}, 500, function () { if (!$element.attr("tabindex")) { $element.attr("tabindex", -1); } $element.focus(); }); }, show_messages: function (errors) { var self = this, forminatorFrontCondition = self.$el.data('forminatorFrontCondition'); if (typeof forminatorFrontCondition !== 'undefined') { // clear all validation message before show new one this.$el.find('.forminator-error-message').remove(); var i = 0; errors.forEach(function (value) { var element_id = Object.keys(value), message = Object.values(value), element = forminatorFrontCondition.get_form_field(element_id); if (element.length) { if (i === 0) { // focus on first error self.$el.trigger('forminator.front.pagination.focus.input',[element]); self.focus_to_element(element); } if ($(element).hasClass('forminator-input-time')) { var $time_field_holder = $(element).closest('.forminator-field:not(.forminator-field--inner)'), $time_error_holder = $time_field_holder.children('.forminator-error-message'); if ($time_error_holder.length === 0) { $time_field_holder.append('<span class="forminator-error-message" aria-hidden="true"></span>'); $time_error_holder = $time_field_holder.children('.forminator-error-message'); } $time_error_holder.html(message); } var $field_holder = $(element).closest('.forminator-field--inner'); if ($field_holder.length === 0) { $field_holder = $(element).closest('.forminator-field'); if ($field_holder.length === 0) { // handling postdata field $field_holder = $(element).find('.forminator-field'); if ($field_holder.length > 1) { $field_holder = $field_holder.first(); } } } var $error_holder = $field_holder.find('.forminator-error-message'); if ($error_holder.length === 0) { $field_holder.append('<span class="forminator-error-message" aria-hidden="true"></span>'); $error_holder = $field_holder.find('.forminator-error-message'); } $(element).attr('aria-invalid', 'true'); $error_holder.html(message); $field_holder.addClass('forminator-has_error'); i++; } }); } return this; }, getBillingData: function (formData) { var billing = this.getStripeData('billing'); // If billing is disabled, return if (!billing) { return {} }; // Get billing fields var billingName = this.getStripeData('billingName'); var billingEmail = this.getStripeData('billingEmail'); var billingAddress = this.getStripeData('billingAddress'); // Create billing object var billingObject = { address: {} } if( billingName ) { var nameField = this.get_field_value(billingName); // Check if Name field is multiple if (!nameField) { var fName = this.get_field_value(billingName + '-first-name') || ''; var lName = this.get_field_value(billingName + '-last-name') || ''; nameField = fName + ' ' + lName; } // Check if Name field is empty in the end, if not assign to the object if (nameField) { billingObject.name = nameField; } } // Map email field if(billingEmail) { var billingEmailValue = this.get_field_value(billingEmail) || ''; if (billingEmailValue) { billingObject.email = billingEmailValue; } } // Map address line 1 field var addressLine1 = this.get_field_value(billingAddress + '-street_address') || ''; if (addressLine1) { billingObject.address.line1 = addressLine1; } // Map address line 2 field var addressLine2 = this.get_field_value(billingAddress + '-address_line') || ''; if (addressLine2) { billingObject.address.line2 = addressLine2; } // Map address city field var addressCity = this.get_field_value(billingAddress + '-city') || ''; if (addressCity) { billingObject.address.city = addressCity; } // Map address state field var addressState = this.get_field_value(billingAddress + '-state') || ''; if (addressState) { billingObject.address.state = addressState; } // Map address country field var countryField = this.get_form_field(billingAddress + '-country'); var addressCountry = countryField.find(':selected').data('country-code'); if (addressCountry) { billingObject.address.country = addressCountry; } // Map address country field var addressZip = this.get_field_value(billingAddress + '-zip') || ''; if (addressZip) { billingObject.address.postal_code = addressZip; } return { billing_details: billingObject } }, handleCardPayment: function (data, e, formData) { var self = this, secret = data.data.paymentsecret || false, input = $( '.forminator-number--field, .forminator-currency, .forminator-calculation' ); if ( input.inputmask ) { input.inputmask('remove'); } if (self._beforeSubmitCallback) { self._beforeSubmitCallback.call(); } }, mountCardField: function () { var key = this.getStripeData('key'); var cardIcon = this.getStripeData('cardIcon'); var verifyZip = this.getStripeData('veifyZip'); var zipField = this.getStripeData('zipField'); var fieldId = this.getStripeData('fieldId'); if ( null === key ) { return false; } // Init Stripe this._stripe = Stripe( key, { locale: this.getStripeData('language') } ); // Create empty ZIP object var zipObject = {} if (!verifyZip) { // If verify ZIP is disabled, disable ZIP zipObject.hidePostalCode = true; } else { // Set empty post code, later will be updated when field is changed zipObject.value = { postalCode: '', }; } var stripeObject = {}; var fontFamily = this.getStripeData('fontFamily'); var customFonts = this.getStripeData('customFonts'); if (fontFamily && customFonts) { stripeObject.fonts = [ { cssSrc: 'https://fonts.bunny.net/css?family=' + fontFamily, } ]; } var elements = this._stripe.elements(stripeObject); this._cardElement = elements.create('card', Object.assign( { classes: { base: this.getStripeData('baseClass'), complete: this.getStripeData('completeClass'), empty: this.getStripeData('emptyClass'), focus: this.getStripeData('focusedClass'), invalid: this.getStripeData('invalidClass'), webkitAutofill: this.getStripeData('autofilledClass'), }, style: { base: { iconColor: this.getStripeData( 'iconColor' ), color: this.getStripeData( 'fontColor' ), lineHeight: this.getStripeData( 'lineHeight' ), fontWeight: this.getStripeData( 'fontWeight' ), fontFamily: this.getStripeData( 'fontFamily' ), fontSmoothing: 'antialiased', fontSize: this.getStripeData( 'fontSize' ), '::placeholder': { color: this.getStripeData( 'placeholder' ), }, ':hover': { iconColor: this.getStripeData( 'iconColorHover' ), }, ':focus': { iconColor: this.getStripeData( 'iconColorFocus' ), } }, invalid: { iconColor: this.getStripeData( 'iconColorError' ), color: this.getStripeData( 'fontColorError' ), }, }, iconStyle: 'solid', hideIcon: !cardIcon, }, zipObject )); this._cardElement.mount('#card-element-' + fieldId); this.validateCard(); }, validateCard: function () { var self = this; this._cardElement.on( 'change', function( event ) { if ( self.$el.find( '.forminator-stripe-element' ).hasClass( 'StripeElement--empty' ) ) { self.$el.find( '.forminator-stripe-element' ).closest( '.forminator-field' ).removeClass( 'forminator-is_filled' ); } else { self.$el.find( '.forminator-stripe-element' ).closest( '.forminator-field' ).addClass( 'forminator-is_filled' ); } if ( self.$el.find( '.forminator-stripe-element' ).hasClass( 'StripeElement--invalid' ) ) { self.$el.find( '.forminator-stripe-element' ).closest( '.forminator-field' ).addClass( 'forminator-has_error' ); } }); this._cardElement.on('focus', function(event) { self.$el.find('.forminator-stripe-element').closest('.forminator-field').addClass('forminator-is_active'); }); this._cardElement.on('blur', function(event) { self.$el.find('.forminator-stripe-element').closest('.forminator-field').removeClass('forminator-is_active'); self.isValid(false); }); }, hideCardError: function () { var $field_holder = this.$el.find('.forminator-card-message'); var $error_holder = $field_holder.find('.forminator-error-message'); if ($error_holder.length === 0) { $field_holder.append('<span class="forminator-error-message" aria-hidden="true"></span>'); $error_holder = $field_holder.find('.forminator-error-message'); } $field_holder.closest('.forminator-field').removeClass('forminator-has_error'); $error_holder.html(''); }, showCardError: function (message, focus) { var $field_holder = this.$el.find('.forminator-card-message'); var $error_holder = $field_holder.find('.forminator-error-message'); if ($error_holder.length === 0) { $field_holder.append('<span class="forminator-error-message" aria-hidden="true"></span>'); $error_holder = $field_holder.find('.forminator-error-message'); } $field_holder.closest('.forminator-field').addClass('forminator-has_error'); $field_holder.closest('.forminator-field').addClass( 'forminator-is_filled' ); $error_holder.html(message); if(focus) { this.focus_to_element($field_holder.closest('.forminator-field')); } }, getStripeData: function (key) { if ( (typeof this._stripeData !== 'undefined') && (typeof this._stripeData[key] !== 'undefined') ) { return this._stripeData[key]; } return null; }, getObjectValue: function(object, key) { if (typeof object[key] !== 'undefined') { return object[key]; } return null; }, // taken from forminatorFrontCondition get_form_field: function (element_id) { //find element by suffix -field on id input (default behavior) var $element = this.$el.find('#' + element_id + '-field'); if ($element.length === 0) { //find element by its on name (for radio on singlevalue) $element = this.$el.find('input[name=' + element_id + ']'); if ($element.length === 0) { // for text area that have uniqid, so we check its name instead $element = this.$el.find('textarea[name=' + element_id + ']'); if ($element.length === 0) { //find element by its on name[] (for checkbox on multivalue) $element = this.$el.find('input[name="' + element_id + '[]"]'); if ($element.length === 0) { //find element by select name $element = this.$el.find('select[name="' + element_id + '"]'); if ($element.length === 0) { $element = this.$el.find('select[name="' + element_id + '[]"]'); if ($element.length === 0) { //find element by direct id (for name field mostly) //will work for all field with element_id-[somestring] $element = this.$el.find('#' + element_id); } } } } } } return $element; }, get_field_value: function (element_id) { var $element = this.get_form_field(element_id); var value = ''; var checked = null; if (this.field_is_radio($element)) { checked = $element.filter(":checked"); if (checked.length) { value = checked.val(); } } else if (this.field_is_checkbox($element)) { $element.each(function () { if ($(this).is(':checked')) { value = $(this).val(); } }); } else if (this.field_is_select($element)) { value = $element.val(); } else if ( this.field_has_inputMask( $element ) ) { value = parseFloat( $element.inputmask( 'unmaskedvalue' ) ); } else { value = $element.val() } return value; }, get_field_calculation: function (element_id) { var $element = this.get_form_field(element_id); var value = 0; var calculation = 0; var checked = null; if (this.field_is_radio($element)) { checked = $element.filter(":checked"); if (checked.length) { calculation = checked.data('calculation'); if (calculation !== undefined) { value = Number(calculation); } } } else if (this.field_is_checkbox($element)) { $element.each(function () { if ($(this).is(':checked')) { calculation = $(this).data('calculation'); if (calculation !== undefined) { value += Number(calculation); } } }); } else if (this.field_is_select($element)) { checked = $element.find("option").filter(':selected'); if (checked.length) { calculation = checked.data('calculation'); if (calculation !== undefined) { value = Number(calculation); } } } else { value = Number($element.val()); } return isNaN(value) ? 0 : value; }, field_has_inputMask: function ( $element ) { var hasMask = false; $element.each(function () { if ( undefined !== $( this ).attr( 'data-inputmask' ) ) { hasMask = true; //break return false; } }); return hasMask; }, field_is_radio: function ($element) { var is_radio = false; $element.each(function () { if ($(this).attr('type') === 'radio') { is_radio = true; //break return false; } }); return is_radio; }, field_is_checkbox: function ($element) { var is_checkbox = false; $element.each(function () { if ($(this).attr('type') === 'checkbox') { is_checkbox = true; //break return false; } }); return is_checkbox; }, field_is_select: function ($element) { return $element.is('select'); }, }); // A really lightweight plugin wrapper around the constructor, // preventing against multiple instantiations $.fn[pluginName] = function (options) { return this.each(function () { if (!$.data(this, pluginName)) { $.data(this, pluginName, new ForminatorFrontPayment(this, options)); } }); }; })(jQuery, window, document); templates/quiz/knowledge/grid.html 0000644 00000001060 15162321604 0013321 0 ustar 00 <?php if ( forminator_array_value_exists( $properties, 'quiz-spacing' ) && ! empty( $properties['quiz-custom-spacing'] ) ) { ?> <?php if ( forminator_array_value_exists( $properties, 'visual_style' ) ) { ?> <?php if ( 'grid' == $properties['visual_style'] && ! empty( $properties['visual_style'] ) ) { ?> <?php include('global/spacing/layout-grid.html') ?> <?php } else if ( 'grid' != $properties['visual_style'] && ! empty( $properties['visual_style'] ) ) { ?> <?php include('global/spacing/layout-list.html') ?> <?php } ?> <?php } ?> <?php } ?>