{"version":3,"sources":["../../../config-wrap-start-default.js","../lib/almond.js","models/whenModel.js","models/whenCollection.js","models/conditionModel.js","models/conditionCollection.js","controllers/initCollection.js","controllers/showHide.js","controllers/changeRequired.js","controllers/showHideOption.js","controllers/changeValue.js","controllers/selectDeselect.js","controllers/actions.js","main.js","../../../config-wrap-end-default.js"],"names":[],"mappings":"AAAA;AACA,ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACjbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC5PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,AC9BA","file":"front-end.js","sourcesContent":["(function () {\n","/**\n * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/almond for details\n */\n//Going sloppy to avoid 'use strict' string cost, but strict practices should\n//be followed.\n/*jslint sloppy: true */\n/*global setTimeout: false */\n\nvar requirejs, require, define;\n(function (undef) {\n    var main, req, makeMap, handlers,\n        defined = {},\n        waiting = {},\n        config = {},\n        defining = {},\n        hasOwn = Object.prototype.hasOwnProperty,\n        aps = [].slice,\n        jsSuffixRegExp = /\\.js$/;\n\n    function hasProp(obj, prop) {\n        return hasOwn.call(obj, prop);\n    }\n\n    /**\n     * Given a relative module name, like ./something, normalize it to\n     * a real name that can be mapped to a path.\n     * @param {String} name the relative name\n     * @param {String} baseName a real name that the name arg is relative\n     * to.\n     * @returns {String} normalized name\n     */\n    function normalize(name, baseName) {\n        var nameParts, nameSegment, mapValue, foundMap, lastIndex,\n            foundI, foundStarMap, starI, i, j, part,\n            baseParts = baseName && baseName.split(\"/\"),\n            map = config.map,\n            starMap = (map && map['*']) || {};\n\n        //Adjust any relative paths.\n        if (name && name.charAt(0) === \".\") {\n            //If have a base name, try to normalize against it,\n            //otherwise, assume it is a top-level require that will\n            //be relative to baseUrl in the end.\n            if (baseName) {\n                name = name.split('/');\n                lastIndex = name.length - 1;\n\n                // Node .js allowance:\n                if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {\n                    name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');\n                }\n\n                //Lop off the last part of baseParts, so that . matches the\n                //\"directory\" and not name of the baseName's module. For instance,\n                //baseName of \"one/two/three\", maps to \"one/two/three.js\", but we\n                //want the directory, \"one/two\" for this normalization.\n                name = baseParts.slice(0, baseParts.length - 1).concat(name);\n\n                //start trimDots\n                for (i = 0; i < name.length; i += 1) {\n                    part = name[i];\n                    if (part === \".\") {\n                        name.splice(i, 1);\n                        i -= 1;\n                    } else if (part === \"..\") {\n                        if (i === 1 && (name[2] === '..' || name[0] === '..')) {\n                            //End of the line. Keep at least one non-dot\n                            //path segment at the front so it can be mapped\n                            //correctly to disk. Otherwise, there is likely\n                            //no path mapping for a path starting with '..'.\n                            //This can still fail, but catches the most reasonable\n                            //uses of ..\n                            break;\n                        } else if (i > 0) {\n                            name.splice(i - 1, 2);\n                            i -= 2;\n                        }\n                    }\n                }\n                //end trimDots\n\n                name = name.join(\"/\");\n            } else if (name.indexOf('./') === 0) {\n                // No baseName, so this is ID is resolved relative\n                // to baseUrl, pull off the leading dot.\n                name = name.substring(2);\n            }\n        }\n\n        //Apply map config if available.\n        if ((baseParts || starMap) && map) {\n            nameParts = name.split('/');\n\n            for (i = nameParts.length; i > 0; i -= 1) {\n                nameSegment = nameParts.slice(0, i).join(\"/\");\n\n                if (baseParts) {\n                    //Find the longest baseName segment match in the config.\n                    //So, do joins on the biggest to smallest lengths of baseParts.\n                    for (j = baseParts.length; j > 0; j -= 1) {\n                        mapValue = map[baseParts.slice(0, j).join('/')];\n\n                        //baseName segment has  config, find if it has one for\n                        //this name.\n                        if (mapValue) {\n                            mapValue = mapValue[nameSegment];\n                            if (mapValue) {\n                                //Match, update name to the new value.\n                                foundMap = mapValue;\n                                foundI = i;\n                                break;\n                            }\n                        }\n                    }\n                }\n\n                if (foundMap) {\n                    break;\n                }\n\n                //Check for a star map match, but just hold on to it,\n                //if there is a shorter segment match later in a matching\n                //config, then favor over this star map.\n                if (!foundStarMap && starMap && starMap[nameSegment]) {\n                    foundStarMap = starMap[nameSegment];\n                    starI = i;\n                }\n            }\n\n            if (!foundMap && foundStarMap) {\n                foundMap = foundStarMap;\n                foundI = starI;\n            }\n\n            if (foundMap) {\n                nameParts.splice(0, foundI, foundMap);\n                name = nameParts.join('/');\n            }\n        }\n\n        return name;\n    }\n\n    function makeRequire(relName, forceSync) {\n        return function () {\n            //A version of a require function that passes a moduleName\n            //value for items that may need to\n            //look up paths relative to the moduleName\n            var args = aps.call(arguments, 0);\n\n            //If first arg is not require('string'), and there is only\n            //one arg, it is the array form without a callback. Insert\n            //a null so that the following concat is correct.\n            if (typeof args[0] !== 'string' && args.length === 1) {\n                args.push(null);\n            }\n            return req.apply(undef, args.concat([relName, forceSync]));\n        };\n    }\n\n    function makeNormalize(relName) {\n        return function (name) {\n            return normalize(name, relName);\n        };\n    }\n\n    function makeLoad(depName) {\n        return function (value) {\n            defined[depName] = value;\n        };\n    }\n\n    function callDep(name) {\n        if (hasProp(waiting, name)) {\n            var args = waiting[name];\n            delete waiting[name];\n            defining[name] = true;\n            main.apply(undef, args);\n        }\n\n        if (!hasProp(defined, name) && !hasProp(defining, name)) {\n            throw new Error('No ' + name);\n        }\n        return defined[name];\n    }\n\n    //Turns a plugin!resource to [plugin, resource]\n    //with the plugin being undefined if the name\n    //did not have a plugin prefix.\n    function splitPrefix(name) {\n        var prefix,\n            index = name ? name.indexOf('!') : -1;\n        if (index > -1) {\n            prefix = name.substring(0, index);\n            name = name.substring(index + 1, name.length);\n        }\n        return [prefix, name];\n    }\n\n    /**\n     * Makes a name map, normalizing the name, and using a plugin\n     * for normalization if necessary. Grabs a ref to plugin\n     * too, as an optimization.\n     */\n    makeMap = function (name, relName) {\n        var plugin,\n            parts = splitPrefix(name),\n            prefix = parts[0];\n\n        name = parts[1];\n\n        if (prefix) {\n            prefix = normalize(prefix, relName);\n            plugin = callDep(prefix);\n        }\n\n        //Normalize according\n        if (prefix) {\n            if (plugin && plugin.normalize) {\n                name = plugin.normalize(name, makeNormalize(relName));\n            } else {\n                name = normalize(name, relName);\n            }\n        } else {\n            name = normalize(name, relName);\n            parts = splitPrefix(name);\n            prefix = parts[0];\n            name = parts[1];\n            if (prefix) {\n                plugin = callDep(prefix);\n            }\n        }\n\n        //Using ridiculous property names for space reasons\n        return {\n            f: prefix ? prefix + '!' + name : name, //fullName\n            n: name,\n            pr: prefix,\n            p: plugin\n        };\n    };\n\n    function makeConfig(name) {\n        return function () {\n            return (config && config.config && config.config[name]) || {};\n        };\n    }\n\n    handlers = {\n        require: function (name) {\n            return makeRequire(name);\n        },\n        exports: function (name) {\n            var e = defined[name];\n            if (typeof e !== 'undefined') {\n                return e;\n            } else {\n                return (defined[name] = {});\n            }\n        },\n        module: function (name) {\n            return {\n                id: name,\n                uri: '',\n                exports: defined[name],\n                config: makeConfig(name)\n            };\n        }\n    };\n\n    main = function (name, deps, callback, relName) {\n        var cjsModule, depName, ret, map, i,\n            args = [],\n            callbackType = typeof callback,\n            usingExports;\n\n        //Use name if no relName\n        relName = relName || name;\n\n        //Call the callback to define the module, if necessary.\n        if (callbackType === 'undefined' || callbackType === 'function') {\n            //Pull out the defined dependencies and pass the ordered\n            //values to the callback.\n            //Default to [require, exports, module] if no deps\n            deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;\n            for (i = 0; i < deps.length; i += 1) {\n                map = makeMap(deps[i], relName);\n                depName = map.f;\n\n                //Fast path CommonJS standard dependencies.\n                if (depName === \"require\") {\n                    args[i] = handlers.require(name);\n                } else if (depName === \"exports\") {\n                    //CommonJS module spec 1.1\n                    args[i] = handlers.exports(name);\n                    usingExports = true;\n                } else if (depName === \"module\") {\n                    //CommonJS module spec 1.1\n                    cjsModule = args[i] = handlers.module(name);\n                } else if (hasProp(defined, depName) ||\n                           hasProp(waiting, depName) ||\n                           hasProp(defining, depName)) {\n                    args[i] = callDep(depName);\n                } else if (map.p) {\n                    map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});\n                    args[i] = defined[depName];\n                } else {\n                    throw new Error(name + ' missing ' + depName);\n                }\n            }\n\n            ret = callback ? callback.apply(defined[name], args) : undefined;\n\n            if (name) {\n                //If setting exports via \"module\" is in play,\n                //favor that over return value and exports. After that,\n                //favor a non-undefined return value over exports use.\n                if (cjsModule && cjsModule.exports !== undef &&\n                        cjsModule.exports !== defined[name]) {\n                    defined[name] = cjsModule.exports;\n                } else if (ret !== undef || !usingExports) {\n                    //Use the return value from the function.\n                    defined[name] = ret;\n                }\n            }\n        } else if (name) {\n            //May just be an object definition for the module. Only\n            //worry about defining if have a module name.\n            defined[name] = callback;\n        }\n    };\n\n    requirejs = require = req = function (deps, callback, relName, forceSync, alt) {\n        if (typeof deps === \"string\") {\n            if (handlers[deps]) {\n                //callback in this case is really relName\n                return handlers[deps](callback);\n            }\n            //Just return the module wanted. In this scenario, the\n            //deps arg is the module name, and second arg (if passed)\n            //is just the relName.\n            //Normalize module name, if it contains . or ..\n            return callDep(makeMap(deps, callback).f);\n        } else if (!deps.splice) {\n            //deps is a config object, not an array.\n            config = deps;\n            if (config.deps) {\n                req(config.deps, config.callback);\n            }\n            if (!callback) {\n                return;\n            }\n\n            if (callback.splice) {\n                //callback is an array, which means it is a dependency list.\n                //Adjust args if there are dependencies\n                deps = callback;\n                callback = relName;\n                relName = null;\n            } else {\n                deps = undef;\n            }\n        }\n\n        //Support require(['a'])\n        callback = callback || function () {};\n\n        //If relName is a function, it is an errback handler,\n        //so remove it.\n        if (typeof relName === 'function') {\n            relName = forceSync;\n            forceSync = alt;\n        }\n\n        //Simulate async callback;\n        if (forceSync) {\n            main(undef, deps, callback, relName);\n        } else {\n            //Using a non-zero value because of concern for what old browsers\n            //do, and latest browsers \"upgrade\" to 4 if lower value is used:\n            //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:\n            //If want a value immediately, use require('id') instead -- something\n            //that works in almond on the global level, but not guaranteed and\n            //unlikely to work in other AMD implementations.\n            setTimeout(function () {\n                main(undef, deps, callback, relName);\n            }, 4);\n        }\n\n        return req;\n    };\n\n    /**\n     * Just drops the config on the floor, but returns req in case\n     * the config return value is used.\n     */\n    req.config = function (cfg) {\n        return req(cfg);\n    };\n\n    /**\n     * Expose module registry for debugging and tooling\n     */\n    requirejs._defined = defined;\n\n    define = function (name, deps, callback) {\n        if (typeof name !== 'string') {\n            throw new Error('See almond README: incorrect module build, no module name');\n        }\n\n        //This module may not have dependencies\n        if (!deps.splice) {\n            //deps is not an array, so probably means\n            //an object literal or factory function for\n            //the value. Adjust args.\n            callback = deps;\n            deps = [];\n        }\n\n        if (!hasProp(defined, name) && !hasProp(waiting, name)) {\n            waiting[name] = [name, deps, callback];\n        }\n    };\n\n    define.amd = {\n        jQuery: true\n    };\n}());\n\ndefine(\"../lib/almond\", function(){});\n\n","define( 'models/whenModel',[], function() {\n\tvar model = Backbone.Model.extend( {\n\t\tinitialize: function( models, options ) {\n\t\t\t/*\n\t\t\t * If our key or comparator is empty, don't do anything else.\n\t\t\t */\n\t\t\tif ( ! this.get( 'key' ) || ! this.get( 'comparator' ) ) return;\n\n\t\t\t/*\n\t\t\t * Our key could be a field or a calc.\n\t\t\t * We need to setup a listener on either the field or calc model for changes.\n\t\t\t */\n\t\t\tif ( 'calc' == this.get( 'type' ) ) { // We have a calculation key\n\t\t\t\t/*\n\t\t\t\t * Get our calc model\n\t\t\t\t */\n\t\t\t\tvar calcModel = nfRadio.channel( 'form-' + this.collection.options.condition.collection.formModel.get( 'id' ) ).request( 'get:calc', this.get( 'key' ) );\n\t\t\t\t/*\n\t\t\t\t * When we update our calculation, update our compare\n\t\t\t\t */\n\t\t\t\tthis.listenTo( calcModel, 'change:value', this.updateCalcCompare );\n\t\t\t\t/*\n\t\t\t\t * Update our compare status.\n\t\t\t\t */\n\t\t\t\tthis.updateCalcCompare( calcModel );\n\t\t\t} else { // We have a field key\n\t\t\t\t// Get our field model\n\t\t\t\tvar fieldModel = nfRadio.channel( 'form-' + options.condition.collection.formModel.get( 'id' ) ).request( 'get:fieldByKey', this.get( 'key' ) );\n\n\t\t\t\tif( 'undefined' == typeof fieldModel ) return;\n\n\t\t\t\t// When we change the value of our field, update our compare status.\n\t\t\t\tfieldModel.on( 'change:value', this.updateFieldCompare, this );\n\t\t\t\t// When we keyup in our field, maybe update our compare status.\n\t\t\t\tthis.listenTo( nfRadio.channel( 'field-' + fieldModel.get( 'id' ) ), 'keyup:field', this.maybeupdateFieldCompare );\n\t\t\t\t// Update our compare status.\n\t\t\t\tthis.updateFieldCompare( fieldModel );\n\n\t\t\t\t/*\n\t\t\t\t * TODO: This should be moved to the show_field/hide_field file because it is specific to showing and hiding.\n\t\t\t\t * Create a radio message here so that the specific JS file can hook into whenModel init.\n\t\t\t\t */\n\t\t\t\tfieldModel.on( 'change:visible', this.updateFieldCompare, this );\n\t\t\t}\n\t\t},\n\n\t\tupdateCalcCompare: function( calcModel ) {\n\t\t\tthis.updateCompare( calcModel.get( 'value' ) );\n\t\t},\n\n\t\tmaybeupdateFieldCompare: function( el, fieldModel, keyCode ) {\n\t\t\tif( 'checkbox' == fieldModel.get( 'type' ) ){\n                var fieldValue = ( 'checked' == jQuery( el ).attr( 'checked' ) ) ? 1 : 0;\n            } else if( 'listcheckbox' == fieldModel.get( 'type' ) ) {\n\t\t\t\t// This field isn't a single element, so we need to reference the fieldModel, instead of the DOM.\n                var fieldValue = fieldModel.get( 'value' ).join();\n            } else if ( 'date' == fieldModel.get ('type' ) ) {\n\t\t\t\tvar fieldValue = fieldModel.get( 'value' );\n\n\t\t\t\tif ( _.isEmpty( fieldValue ) ) {\n\t\t\t\t\tfieldValue = '1970/01/01';\n\t\t\t\t}\n\n\t\t\t\tlet date_mode = fieldModel.get( 'date_mode' );\n\t\t\t\tif ( 'undefined' == typeof date_mode ) { // If 'date_mode' is undefined, then we assume it's date_only.\n\t\t\t\t\tdate_mode = 'date_only';\n\t\t\t\t}\n\t\t\t\tlet date = 0;\n\t\t\t\t// If we're in time_only mode, then we need to use 1970-01-01 as our date.\n\t\t\t\tif ( 'time_only' == fieldModel.get( 'date_mode' ) ) {\n\t\t\t\t\tdate = '1970/01/01';\n\t\t\t\t} else {\n\t\t\t\t\tdate = fieldValue;\n\t\t\t\t}\n\n\t\t\t\t// Convert field value into a timestamp\n\t\t\t\tlet hour = fieldModel.get( 'selected_hour' );\n\t\t\t\tif ( 'undefined' == typeof hour ) {\n\t\t\t\t\thour = '00';\n\t\t\t\t}\n\n\t\t\t\tlet minute = fieldModel.get( 'selected_minute' );\n\t\t\t\tif ( 'undefined' == typeof minute ) {\n\t\t\t\t\tminute = '00';\n\t\t\t\t}\n\n\t\t\t\t// If we have a date_and_time field, but we haven't selected a date yet, we don't need to compare.\n\t\t\t\tif ( 'date_and_time' == date_mode && '1970/01/01' == date ) {\n\t\t\t\t\tfieldValue = false;\n\t\t\t\t} else {\n\t\t\t\t\tfieldValue = date + ' ' + hour + ':' + minute + ' UT';\n\n\t\t\t\t\tlet dateObject = new Date( fieldValue );\n\t\t\t\t\tfieldValue = Math.floor( dateObject.getTime() / 1000 );\t\t\t\t\t\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar fieldValue = jQuery( el ).val();\n\t\t\t}\n\n\t\t\tthis.updateFieldCompare( fieldModel, null, fieldValue );\n\t\t},\n\n\t\tupdateCompare: function( value ) {\n\t\t\tvar this_val = this.get( 'value' );\n\n\t\t\t// if this is a calcModel then let's convert to number for comparison\n\t\t\tif ( 'calc' === this.get( 'type' ) ) {\n\t\t\t\tthis_val = Number( this_val );\n\t\t\t\tvalue = Number( value );\n\t\t\t}\n\t\t\t// Check to see if the value of the field model value COMPARATOR the value of our when condition is true.\n\t\t\tvar status = this.compareValues[ this.get( 'comparator' ) ]( value, this_val );\n\t\t\tthis.set( 'status', status );\n\t\t},\n\n\t\tupdateFieldCompare: function( fieldModel, val, fieldValue ) {\n\t\t\tif ( _.isEmpty( fieldValue ) ) {\n\t\t\t\tfieldValue = fieldModel.get( 'value' );\n\t\t\t}\n\n\t\t\t// Change the value of checkboxes to match the new convention.\n\t\t\tif( 'checkbox' == fieldModel.get( 'type' ) ) {\n\t\t\t\tif( 0 == fieldValue ) {\n\t\t\t\t\tfieldValue = 'unchecked';\n\t\t\t\t} else {\n\t\t\t\t\tfieldValue = 'checked';\n\t\t\t\t}\n\t\t\t} else if ( 'date' == fieldModel.get( 'type' ) ) {\n\t\t\t\tif ( _.isEmpty( fieldValue ) ) {\n\t\t\t\t\tfieldValue = '1970/01/01';\n\t\t\t\t}\n\n\t\t\t\tlet date_mode = fieldModel.get( 'date_mode' );\n\t\t\t\tif ( 'undefined' == typeof date_mode ) { // If 'date_mode' is undefined, then we assume it's date_only.\n\t\t\t\t\tdate_mode = 'date_only';\n\t\t\t\t}\n\t\t\t\tlet date = 0;\n\t\t\t\t// If we're in time_only mode, then we need to use 1970-01-01 as our date.\n\t\t\t\tif ( 'time_only' == fieldModel.get( 'date_mode' ) ) {\n\t\t\t\t\tdate = '1970/01/01';\n\t\t\t\t} else {\n\t\t\t\t\tdate = fieldValue;\n\t\t\t\t}\n\n\t\t\t\t// Convert field value into a timestamp\n\t\t\t\tlet hour = fieldModel.get( 'selected_hour' );\n\t\t\t\tif ( 'undefined' == typeof hour ) {\n\t\t\t\t\thour = '00';\n\t\t\t\t}\n\n\t\t\t\tlet ampm = fieldModel.get( 'selected_ampm' );\n\t\t\t\tif ( 'undefined' != typeof ampm ) {\n\t\t\t\t\t// Convert our hour into 24 hr format.\n\t\t\t\t\tif ( 'pm' == ampm && '12' != hour ) {\n\t\t\t\t\t\thour = parseInt( hour ) + 12;\n\t\t\t\t\t} else if ( 'am' == ampm && '12' == hour ) {\n\t\t\t\t\t\thour = '00';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet minute = fieldModel.get( 'selected_minute' );\n\t\t\t\tif ( 'undefined' == typeof minute ) {\n\t\t\t\t\tminute = '00';\n\t\t\t\t}\n\n\t\t\t\t// If we have a date_and_time field, but we haven't selected a date yet, we don't need to compare.\n\t\t\t\tif ( 'date_and_time' == date_mode && '1970/01/01' == date ) {\n\t\t\t\t\tfieldValue = false;\n\t\t\t\t} else {\n\t\t\t\t\tfieldValue = date + ' ' + hour + ':' + minute + ' UT';\n\n\t\t\t\t\tlet dateObject = new Date( fieldValue );\n\t\t\t\t\tfieldValue = Math.floor( dateObject.getTime() / 1000 );\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.updateCompare( fieldValue );\n\n\t\t\t/*\n\t\t\t * TODO: This should be moved to the show_field/hide_field file because it is specific to showing and hiding.\n\t\t\t */\n\t\t\tif ( ! fieldModel.get( 'visible' ) ) {\n\t\t\t\tthis.set( 'status', false );\n\t\t\t}\t\t\t\n\t\t},\n\n\t\tcompareValues: {\n\t\t\t'equal': function( a, b ) {\n\t\t\t\treturn a == b;\n\t\t\t},\n\t\t\t'notequal': function( a, b ) {\n\t\t\t\treturn a != b;\n\t\t\t},\n\t\t\t'contains': function( a, b ) {\n\t\t\t\tif ( jQuery.isArray( a ) ) {\n\t\t\t\t\t/*\n\t\t\t\t\t * If a is an array, then we're searching for an index.\n\t\t\t\t\t */\n\t\t\t\t\treturn a.indexOf( b ) >= 0;\n\t\t\t\t} else {\n\t\t\t\t\t/*\n\t\t\t\t\t * If a is a string, then we're searching for a string position.\n\t\t\t\t\t *\n\t\t\t\t\t * If our b value has quotes in it, we want to find that exact word or phrase.\n\t\t\t\t\t */\n\t\t\t\t\tif ( b.indexOf( '\"' ) >= 0 ) {\n\t\t\t\t\t\tb = b.replace( /['\"]+/g, '' );\n\t\t\t\t\t\treturn new RegExp(\"\\\\b\" + b + \"\\\\b\").test( a );\n\t\t\t\t\t}\n\t\t\t\t\treturn a.toLowerCase().indexOf( b.toLowerCase() ) >= 0; \t\t\t\t\n\t\t\t\t}\n\t\t\t},\n\t\t\t'notcontains': function( a, b ) {\n\t\t\t\treturn ! this.contains( a, b );\n\t\t\t},\n\t\t\t'greater': function( a, b ) {\n\t\t\t\t/*\n\t\t\t\t * In 2.9.x, you could use the greater and less like string count.\n\t\t\t\t * i.e. if textbox > (empty string) do something.\n\t\t\t\t * This recreates that ability.\n\t\t\t\t */\n\t\t\t\tif ( jQuery.isNumeric( b ) ) {\n\t\t\t\t\treturn parseFloat( a ) > parseFloat( b );\n\t\t\t\t} else if ( 'string' == typeof a ) {\n\t\t\t\t\treturn 0 < a.length;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t},\n\t\t\t'less': function( a, b ) {\n\t\t\t\t/*\n\t\t\t\t * In 2.9.x, you could use the greater and less like string count.\n\t\t\t\t * i.e. if textbox > (empty string) do something.\n\t\t\t\t * This recreates that ability.\n\t\t\t\t */\n\t\t\t\tif ( jQuery.isNumeric( b ) ) {\n\t\t\t\t\treturn parseFloat( a ) < parseFloat( b );\n\t\t\t\t} else if ( 'string' == typeof a ) {\n\t\t\t\t\treturn 0 >= a.length;\n\t\t\t\t}\n\t\t\n\t\t\t},\n\t\t\t'greaterequal': function( a, b ) {\n\t\t\t\treturn parseFloat( a ) > parseFloat( b ) || parseFloat( a ) == parseFloat( b );\n\t\t\t},\n\t\t\t'lessequal': function( a, b ) {\n\t\t\t\treturn parseFloat( a ) < parseFloat( b ) || parseFloat( a ) == parseFloat( b );\n\t\t\t}\n\t\t} \n\t} );\n\t\n\treturn model;\n} );\n","define( 'models/whenCollection',['models/whenModel'], function( WhenModel ) {\n\tvar collection = Backbone.Collection.extend( {\n\t\tmodel: WhenModel,\n\n\t\tinitialize: function( models, options ) {\n\t\t\tthis.options = options;\n\t\t}\n\t} );\n\treturn collection;\n} );\n","define( 'models/conditionModel',[ 'models/whenCollection' ], function( WhenCollection ) {\n\tvar model = Backbone.Model.extend( {\n\t\tinitialize: function( options ) {\n\t\t\t/*\n\t\t\t * Our \"when\" statement will be like:\n\t\t\t * When field1 == value\n\t\t\t * AND field2 == value\n\t\t\t *\n\t\t\t * We need to create a collection out of this when statement, with each row as a model.\n\t\t\t */\n\t\t\tthis.set( 'when', new WhenCollection( this.get( 'when' ), { condition: this } ) );\n\t\t\t/*\n\t\t\t * When we update any of our \"when\" models' status, check to see if we should send a message.\n\t\t\t */\n\t\t\tthis.get( 'when' ).on( 'change:status', this.checkWhen, this );\n\t\t\t/*\n\t\t\t * Check our initial status;\n\t\t\t */\n\t\t\tthis.checkWhen();\n\t\t},\n\n\t\tcheckWhen: function() {\n\t\t\t/*\n\t\t\t * If we have any OR connectors, then any status being true should trigger pass.\n\t\t\t * Otherwise, we need every status to be true.\n\t\t\t */\n\t\t\tvar statusResults = this.get( 'when' ).pluck( 'status' );\n\n\t\t\tvar connectors = this.get( 'when' ).pluck( 'connector' );\n\t\t\tvar allAND = _.every( _.values( connectors ), function( v ) { return v == 'AND' }, this );\n\t\t\tif ( allAND ) {\n\t\t\t\tvar status = _.every( _.values( statusResults ), function(v) { return v; }, this );\n\t\t\t} else {\n\t\t\t\tvar status = _.some( _.values( statusResults ), function(v) { return v; }, this );\n\t\t\t}\n\n\t\t\tif ( status ) {\n\t\t\t   \t/*\n\t\t\t \t * Send out a request for each of our \"then\" statements.\n\t\t\t \t */\n\t\t\t\t_.each( this.get( 'then' ), function( then, index ) {\n\t\t\t\t\tnfRadio.channel( 'condition:trigger' ).request( then.trigger, this, then );\n\t\t\t\t}, this );\t\t\t \n\t\t\t} else {\n\t\t\t\t/*\n\t\t\t\t * Send out a request for each of our \"else\" statements.\n\t\t\t\t */\n\t\t\t\t_.each( this.get( 'else' ), function( elseData, index ) {\n\t\t\t\t\tnfRadio.channel( 'condition:trigger' ).request( elseData.trigger, this, elseData );\n\t\t\t\t}, this );\n\t\t\t}\n\t\t}\n\t} );\n\t\n\treturn model;\n} );\n","define( 'models/conditionCollection',['models/conditionModel'], function( ConditionModel ) {\n\tvar collection = Backbone.Collection.extend( {\n\t\tmodel: ConditionModel,\n\n\t\tinitialize: function( models, options ) {\n\t\t\tthis.formModel = options.formModel;\n\t\t}\n\t} );\n\treturn collection;\n} );\n","/**\n * Initialise condition collection\n * \n * @package Ninja Forms Conditional Logic\n * @copyright (c) 2016 WP Ninjas\n * @since 3.0\n */\ndefine( 'controllers/initCollection',[ 'models/conditionCollection' ], function( ConditionCollection ) {\n\tvar controller = Marionette.Object.extend( {\n\t\tinitialize: function( formModel ) {\n\t\t\tthis.collection = new ConditionCollection( formModel.get( 'conditions' ), { formModel: formModel } );\n            this.listenTo(nfRadio.channel('fields'), 'reset:collection', this.resetCollection);\n\t\t},\n        resetCollection: function( fieldsCollection ) {\n            var formModel = fieldsCollection.options.formModel;\n            this.collection = new ConditionCollection( formModel.get( 'conditions' ), { formModel: formModel } );\n        }\n\t});\n\n\treturn controller;\n} );\n","/**\n * Handle showing/hiding fields\n * \n * @package Ninja Forms Conditional Logic\n * @copyright (c) 2016 WP Ninjas\n * @since 3.0\n */\ndefine( 'controllers/showHide',[], function() {\n\tvar controller = Marionette.Object.extend( {\n\t\tinitialize: function() {\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'hide_field', this.hideField, this );\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'show_field', this.showField, this );\n\t\t},\n\n\t\thideField: function( conditionModel, then ) {\n\t\t\tvar targetFieldModel = nfRadio.channel( 'form-' + conditionModel.collection.formModel.get( 'id' ) ).request( 'get:fieldByKey', then.key );\n\n\t\t\tif( 'undefined' == typeof targetFieldModel ) return;\n\t\t\ttargetFieldModel.set( 'visible', false );\n            if ( ! targetFieldModel.get( 'clean' ) ) {\n\t\t\t\ttargetFieldModel.trigger( 'change:value', targetFieldModel );\n\t\t\t}\n\t\t\t\n\t\t\tnfRadio.channel( 'fields' ).request( 'remove:error', targetFieldModel.get( 'id' ), 'required-error' );\n\t\t},\n\n\t\tshowField: function( conditionModel, then ) {\n\t\t\tvar targetFieldModel = nfRadio.channel( 'form-' + conditionModel.collection.formModel.get( 'id' ) ).request( 'get:fieldByKey', then.key );\n\t\t\t//TODO: Add an error to let the user know the show/hide field is empty.\n\t\t\tif( 'undefined' == typeof targetFieldModel ) return;\n\t\t\ttargetFieldModel.set( 'visible', true );\n            if ( ! targetFieldModel.get( 'clean' ) ) {\n                targetFieldModel.trigger( 'change:value', targetFieldModel );\n\t\t\t}\n\t\t\tif ( 'recaptcha' === targetFieldModel.get( 'type' ) ) {\n\t\t\t\tthis.renderRecaptcha();\n\t\t\t}\n\t\t\tvar viewEl = { el: nfRadio.channel( 'form-' + conditionModel.collection.formModel.get( 'id' ) ).request( 'get:el' ) };\n            nfRadio.channel( 'form' ).request( 'init:help', viewEl );\n\t\t},\n\n\t\trenderRecaptcha: function() {\n\t\t\tjQuery( '.g-recaptcha' ).each( function() {\n                var callback = jQuery( this ).data( 'callback' );\n                var fieldID = jQuery( this ).data( 'fieldid' );\n                if ( typeof window[ callback ] !== 'function' ){\n                    window[ callback ] = function( response ) {\n                        nfRadio.channel( 'recaptcha' ).request( 'update:response', response, fieldID );\n                    };\n                }\n\t\t\t\tvar opts = {\n\t\t\t\t\ttheme: jQuery( this ).data( 'theme' ),\n\t\t\t\t\tsitekey: jQuery( this ).data( 'sitekey' ),\n\t\t\t\t\tcallback: callback\n\t\t\t\t};\n\t\t\t\t\n\t\t\t\tgrecaptcha.render( jQuery( this )[0], opts );\n\t\t\t} );\n\t\t}\n\t});\n\n\treturn controller;\n} );\n","/**\n * Setting/unsetting required.\n * \n * @package Ninja Forms Conditional Logic\n * @copyright (c) 2019 WP Ninjas\n * @since 3.0\n */\ndefine( 'controllers/changeRequired',[], function() {\n\tvar controller = Marionette.Object.extend( {\n\t\tinitialize: function() {\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'set_required', this.setRequired, this );\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'unset_required', this.unsetRequired, this );\n\t\t},\n\n\t\tsetRequired: function( conditionModel, then ) {\n\t\t\tvar targetFieldModel = nfRadio.channel( 'form-' + conditionModel.collection.formModel.get( 'id' ) ).request( 'get:fieldByKey', then.key );\n\n\t\t\tif( 'undefined' == typeof targetFieldModel ) return;\n            targetFieldModel.set( 'required', 1 );\n\t\t\ttargetFieldModel.trigger( 'reRender', targetFieldModel );\n\t\t},\n\n\t\tunsetRequired: function( conditionModel, then ) {\n\t\t\tvar targetFieldModel = nfRadio.channel( 'form-' + conditionModel.collection.formModel.get( 'id' ) ).request( 'get:fieldByKey', then.key );\n\n\t\t\tif( 'undefined' == typeof targetFieldModel ) return;\n            targetFieldModel.set( 'required', 0 );\n            targetFieldModel.trigger( 'reRender', targetFieldModel );\n            // Ensure we resolve any errors when the field is no longer required.\n\t\t\tnfRadio.channel( 'fields' ).request( 'remove:error', targetFieldModel.get( 'id' ), 'required-error' );\n        }\n        \n\t});\n\n\treturn controller;\n} );\n","/**\n * Handle adding or removing an option from our list\n * \n * @package Ninja Forms Conditional Logic\n * @copyright (c) 2016 WP Ninjas\n * @since 3.0\n */\ndefine( 'controllers/showHideOption',[], function() {\n\tvar controller = Marionette.Object.extend( {\n\t\tinitialize: function() {\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'show_option', this.showOption, this );\n\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'hide_option', this.hideOption, this );\n\t\t},\n\n\t\tshowOption: function( conditionModel, then ) {\n\t\t\tvar option = this.getOption( conditionModel, then );\n\t\t\toption.visible = true;\n\t\t\tthis.updateFieldModel( conditionModel, then );\n\t\t},\n\n\t\thideOption: function( conditionModel, then ) {\n\t\t\tvar option = this.getOption( conditionModel, then );\n\t\t\toption.visible = false;\n\t\t\tthis.updateFieldModel( conditionModel, then );\n\t\t},\n\n\t\tgetFieldModel: function( conditionModel, then ) {\n\t\t\treturn nfRadio.channel( 'form-' + conditionModel.collection.formModel.get( 'id' ) ).request( 'get:fieldByKey', then.key );\n\t\t},\n\n\t\tgetOption: function( conditionModel, then ) {\n\t\t\tvar targetFieldModel = this.getFieldModel( conditionModel, then );\n\t\t\tvar options = targetFieldModel.get( 'options' );\n\t\t\treturn _.find( options, function( option ) { return option.value == then.value } );\n\t\t},\n\n\t\tupdateFieldModel: function( conditionModel, then ) {\n\t\t\tvar targetFieldModel = this.getFieldModel( conditionModel, then );\n\t\t\tvar options = targetFieldModel.get( 'options' );\n\t\t\ttargetFieldModel.set( 'options', options );\n\t\t\ttargetFieldModel.trigger( 'reRender' );\n\t\t}\n\t});\n\n\treturn controller;\n} );\n","/**\n * Handle changing a field's value\n * \n * @package Ninja Forms Conditional Logic\n * @copyright (c) 2016 WP Ninjas\n * @since 3.0\n */\ndefine( 'controllers/changeValue',[], function() {\n\tvar controller = Marionette.Object.extend( {\n\t\tinitialize: function() {\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'change_value', this.changeValue, this );\n\t\t},\n\n\t\tchangeValue: function( conditionModel, then ) {\n\t\t\tvar targetFieldModel = nfRadio.channel( 'form-' + conditionModel.collection.formModel.get( 'id' ) ).request( 'get:fieldByKey', then.key );\n\t\t\t/*\n\t\t\t * If we have a checkbox then we need to change the value that is set\n\t\t\t * of the then variable to a 1 or 0 to re-render on the front end when\n\t\t\t * the condition is met.\n\t\t\t */\n\t\t\tif( 'checkbox' == targetFieldModel.get( 'type' ) ) {\n\t\t\t\t// We also need to do the opposite of the value that is in the changed model.\n\t\t\t\tif( 'unchecked' == targetFieldModel.changed.value ) {\n\t\t\t\t\tthen.value = 1;\n                } else if( 'checked' == targetFieldModel ) {\n\t\t\t\t\tthen.value = 0;\n\t\t\t\t}\n\t\t\t}\n            /*\n             * Change the value of our field model, and then trigger a re-render of its view.\n             */\n\t\t\ttargetFieldModel.set( 'value', then.value );\n\t\t\ttargetFieldModel.trigger( 'reRender', targetFieldModel );\n\t\t},\n\n\t});\n\treturn controller;\n} );\n","/**\n * Handle selecting/deselecting list options\n * \n * @package Ninja Forms Conditional Logic\n * @copyright (c) 2016 WP Ninjas\n * @since 3.0\n */\ndefine( 'controllers/selectDeselect',[], function() {\n\tvar controller = Marionette.Object.extend( {\n\t\tinitialize: function() {\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'select_option', this.selectOption, this );\n\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'deselect_option', this.deselectOption, this );\n\t\t},\n\n\t\tselectOption: function( conditionModel, then ) {\n\t\t\t/*\n\t\t\t * Get our field model and set this option's \"selected\" property to 1\n\t\t\t */\n\t\t\tvar targetFieldModel = nfRadio.channel( 'form-' + conditionModel.collection.formModel.get( 'id' ) ).request( 'get:fieldByKey', then.key );\n\n\n\t\t\tif( _.contains( [ 'listselect', 'listcountry', 'liststate' ], targetFieldModel.get( 'type' ) ) ) { // TODO: Make this more dynamic.\n\t\t\t\ttargetFieldModel.set('clean', false); // Allows for changes to default values.\n\t\t\t}\n\n\t\t\tvar options = targetFieldModel.get( 'options' );\n\n\t\t\tvar option = _.find( options, { value: then.value } );\n\t\t\toption.selected = 1;\n\n\t\t\ttargetFieldModel.set( 'options', options );\n\n\t\t\tif( _.contains( [ 'listselect', 'listcountry', 'liststate' ], targetFieldModel.get( 'type' ) ) ) { // TODO: Make this more dynamic.\n\t\t\t\ttargetFieldModel.set( 'value', option.value ); // Propagate the selected option to the model's value.\n\t\t\t} else {\n\t\t\t\tvar value = targetFieldModel.get( 'value' );\n\t\t\t\tif ( _.isArray( value ) ) {\n                    if ( 0 > value.indexOf( option.value ) ) {\n                        value.push( option.value );\n                        // Set the value to nothing so it knows that something has changed.\n                        targetFieldModel.set( 'value', '' );\n                    }\n\t\t\t\t} else {\n\t\t\t\t\tvalue = option.value;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttargetFieldModel.set( 'value', value ); // Propagate the selected option to the model's value.\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Re render our field\n\t\t\t */\n\t\t\ttargetFieldModel.trigger( 'reRender', targetFieldModel );\n\t\t},\n\n\t\tdeselectOption: function( conditionModel, then ) {\n\t\t\t/*\n\t\t\t * When we are trying to deselect our option, we need to change it's \"selected\" property to 0 AND change its value.\n\t\t\t */\n\t\t\tvar targetFieldModel = nfRadio.channel( 'form-' + conditionModel.collection.formModel.get( 'id' ) ).request( 'get:fieldByKey', then.key );\n\n\t\t\t/*\n\t\t\t * Set \"selected\" to 0.\n\t\t\t */\n\t\t\tvar options = targetFieldModel.get( 'options' );\n\t\t\tvar option = _.find( options, { value: then.value } );\n\t\t\toption.selected = 0;\n\t\t\ttargetFieldModel.set( 'options', options );\n\n\t\t\t/*\n\t\t\t * Update our value\n\t\t\t */\n\t\t\tvar currentValue = targetFieldModel.get( 'value' );\n\t\t\tif ( _.isArray( currentValue ) ) {\n\t\t\t\tcurrentValue = _.without( currentValue, then.value );\n\t\t\t} else {\n\t\t\t\tcurrentValue = '';\n\t\t\t}\n\t\t\ttargetFieldModel.set( 'value', currentValue );\n\n\t\t\t/*\n\t\t\t * Re render our field\n\t\t\t */\n\t\t\ttargetFieldModel.trigger( 'reRender', targetFieldModel );\n\t\t},\n\n\t});\n\n\treturn controller;\n} );\n","/**\n * Keep an internal record for which actions are active and deactive.\n * \n * @package Ninja Forms Conditional Logic\n * @copyright (c) 2016 WP Ninjas\n * @since 3.0\n */\ndefine( 'controllers/actions',[], function() {\n\tvar controller = Marionette.Object.extend( {\n\t\tactions: {},\n\t\t\n\t\tinitialize: function() {\n\t\t\t/*\n\t\t\t * Listen for activate/deactivate action messages.\n\t\t\t */\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'activate_action', this.activateAction, this );\n\t\t\tnfRadio.channel( 'condition:trigger' ).reply( 'deactivate_action', this.deactivateAction, this );\n\t\t\n\t\t\t/*\n\t\t\t * Reply to requests for action status.\n\t\t\t */\n\t\t\tnfRadio.channel( 'actions' ).reply( 'get:status', this.getStatus, this );\n\t\t},\n\n\t\tactivateAction: function( conditionModel, thenObject ) {\n\t\t\tthis.actions[ thenObject.key ] = true;\n\t\t\tconsole.log( 'activate action' );\n\t\t},\n\n\t\tdeactivateAction: function( conditionModel, thenObject ) {\n\t\t\tconsole.log( 'deactivate action' );\n\t\t\tthis.actions[ thenObject.key ] = false;\n\t\t},\n\n\t\tgetStatus: function( $id ) {\n\t\t\treturn this.actions[ $id ];\n\t\t}\n\t});\n\n\treturn controller;\n} );\n","var nfRadio = Backbone.Radio;\n\nrequire( [ 'controllers/initCollection', 'controllers/showHide', 'controllers/changeRequired', 'controllers/showHideOption', 'controllers/changeValue', 'controllers/selectDeselect', 'controllers/actions' ], function( InitCollection, ShowHide, ChangeRequired, ShowHideOption, ChangeValue, SelectDeselect, Actions ) {\n\n\tvar NFConditionalLogic = Marionette.Application.extend( {\n\n\t\tinitialize: function( options ) {\n\t\t\tthis.listenTo( nfRadio.channel( 'form' ), 'after:loaded', this.loadControllers );\n\t\t},\n\n\t\tloadControllers: function( formModel ) {\n\t\t\tnew ShowHide();\n\t\t\tnew ChangeRequired();\n\t\t\tnew ShowHideOption();\n\t\t\tnew ChangeValue();\n\t\t\tnew SelectDeselect();\n\t\t\tnew Actions();\n\t\t\tnew InitCollection( formModel );\n\t\t},\n\n\t\tonStart: function() {\n\t\t\t\n\t\t}\n\t} );\n\n\tvar nfConditionalLogic = new NFConditionalLogic();\n\tnfConditionalLogic.start();\n} );\ndefine(\"main\", function(){});\n\n","}());"]}