// This file was generated by modules-webmake (modules for web) project.
// See: https://github.com/medikoo/modules-webmake

(function (modules) {
	'use strict';

	var resolve, getRequire, wmRequire, notFoundError, findFile
	  , extensions = {".js":[],".json":[],".css":[],".html":[]}
	  , envRequire = typeof require === 'function' ? require : null;

	notFoundError = function (path) {
		var error = new Error("Could not find module '" + path + "'");
		error.code = 'MODULE_NOT_FOUND';
		return error;
	};
	findFile = function (scope, name, extName) {
		var i, ext;
		if (typeof scope[name + extName] === 'function') return name + extName;
		for (i = 0; (ext = extensions[extName][i]); ++i) {
			if (typeof scope[name + ext] === 'function') return name + ext;
		}
		return null;
	};
	resolve = function (scope, tree, path, fullPath, state, id) {
		var name, dir, exports, module, fn, found, ext;
		path = path.split('/');
		name = path.pop();
		if ((name === '.') || (name === '..')) {
			path.push(name);
			name = '';
		}
		while ((dir = path.shift()) != null) {
			if (!dir || (dir === '.')) continue;
			if (dir === '..') {
				scope = tree.pop();
				id = id.slice(0, id.lastIndexOf('/'));
			} else {
				tree.push(scope);
				scope = scope[dir];
				id += '/' + dir;
			}
			if (!scope) throw notFoundError(fullPath);
		}
		if (name && (typeof scope[name] !== 'function')) {
			found = findFile(scope, name, '.js');
			if (!found) found = findFile(scope, name, '.json');
			if (!found) found = findFile(scope, name, '.css');
			if (!found) found = findFile(scope, name, '.html');
			if (found) {
				name = found;
			} else if ((state !== 2) && (typeof scope[name] === 'object')) {
				tree.push(scope);
				scope = scope[name];
				id += '/' + name;
				name = '';
			}
		}
		if (!name) {
			if ((state !== 1) && scope[':mainpath:']) {
				return resolve(scope, tree, scope[':mainpath:'], fullPath, 1, id);
			}
			return resolve(scope, tree, 'index', fullPath, 2, id);
		}
		fn = scope[name];
		if (!fn) throw notFoundError(fullPath);
		if (fn.hasOwnProperty('module')) return fn.module.exports;
		exports = {};
		fn.module = module = { exports: exports, id: id + '/' + name };
		fn.call(exports, exports, module, getRequire(scope, tree, id));
		return module.exports;
	};
	wmRequire = function (scope, tree, fullPath, id) {
		var name, path = fullPath, t = fullPath.charAt(0), state = 0;
		if (t === '/') {
			path = path.slice(1);
			scope = modules['/'];
			if (!scope) {
				if (envRequire) return envRequire(fullPath);
				throw notFoundError(fullPath);
			}
			id = '/';
			tree = [];
		} else if (t !== '.') {
			name = path.split('/', 1)[0];
			scope = modules[name];
			if (!scope) {
				if (envRequire) return envRequire(fullPath);
				throw notFoundError(fullPath);
			}
			id = name;
			tree = [];
			path = path.slice(name.length + 1);
			if (!path) {
				path = scope[':mainpath:'];
				if (path) {
					state = 1;
				} else {
					path = 'index';
					state = 2;
				}
			}
		}
		return resolve(scope, tree, path, fullPath, state, id);
	};
	getRequire = function (scope, tree, id) {
		return function (path) {
			return wmRequire(scope, [].concat(tree), path, id);
		};
	};
	return getRequire(modules, [], '');
})({
	"thrive-dashboard": {
		"inc": {
			"smart-site": {
				"assets": {
					"admin": {
						"js": {
							"_utils.js": function (exports, module, require) {
								eval("( function ( $ ) {\n\n\tvar utils = {};\n\n\tutils.get_field_type_name = function ( id ) {\n\t\treturn SmartSite.data.fieldTypes[ id ] ? SmartSite.data.fieldTypes[ id ].name : '';\n\t};\n\n\tmodule.exports = utils;\n\n} )( jQuery );\n//# sourceURL=thrive-dashboard/inc/smart-site/assets/admin/js/_utils.js");
							},
							"modals.js": function (exports, module, require) {
								eval("( function ( $ ) {\n\n\tvar modals = {};\n\n\t/**\n\t * Add/Edit Field Modal\n\t */\n\tmodals.EditFieldModal = TVE_Dash.views.Modal.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/modals/field' ),\n\t\tclassName: 'tvd-modal tss-modal',\n\t\tevents: {\n\t\t\t'click .tvd-global-field-group-list': 'selectGroup',\n\t\t\t'click #tvd-tss-group-name': 'showDropdown',\n\t\t\t'click .tvd-add-new-group': 'addNewGroup',\n\t\t\t'click #tvd-save-new-group': 'saveNewGroup',\n\t\t\t'keypress #tvd-add-group': 'inputGroupName',\n\t\t\t'click .tvd-field-type-option': 'selectType',\n\t\t\t'click #tvd-tss-field-type': 'showTypeDropdown',\n\t\t\t'input .input-change': 'setInputData',\n\t\t\t'click .tvd-tss-save-field': 'save'\n\t\t},\n\n\t\tafterRender: function () {\n\t\t\tthis.renderGroupList();\n\t\t\tthis.renderFieldTypeList();\n\t\t\tif ( this.model.get( 'type' ) ) {\n\t\t\t\tthis.renderByType();\n\t\t\t}\n\n\t\t\tvar self = this;\n\t\t\tsetTimeout( function () {\n\t\t\t\tself.$( '#tvd-tss-save-field' ).focus();\n\t\t\t} );\n\t\t\t$( 'body' ).on( 'click', function ( e ) {\n\t\t\t\tvar $dropdowns = self.$( '.tvd-complex-dropdown-content' );\n\n\t\t\t\t$dropdowns.each( function () {\n\t\t\t\t\tvar $dropdown = $( this ),\n\t\t\t\t\t\t$trigger = $( this ).siblings( '.tvd-input-field' ).find( '.tvd-complex-dropdown-trigger' );\n\n\t\t\t\t\tif ( $trigger.length === 0 ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! $dropdown.is( e.target ) && $dropdown.has( e.target ).length === 0 && ! $trigger.is( e.target ) ) {\n\t\t\t\t\t\t$dropdown.addClass( 'tvd-hide' );\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t} );\n\t\t},\n\t\t/**\n\t\t * Render field type dropdown\n\t\t */\n\t\trenderFieldTypeList: function () {\n\t\t\tSmartSite.data.fieldTypes.forEach( this.renderFieldType, this );\n\t\t},\n\t\trenderFieldType: function ( type ) {\n\t\t\tvar view = new SmartSite.views.FieldTypeItem( {\n\t\t\t\tmodel: new SmartSite.models.FieldType( type )\n\t\t\t} );\n\n\t\t\tthis.$( '.tvd-global-field-type-list' ).append( view.render().$el );\n\t\t},\n\t\t/**\n\t\t * Render group dropdown\n\t\t */\n\t\trenderGroupList: function () {\n\t\t\tSmartSite.groups.each( this.renderGroup, this );\n\t\t},\n\t\trenderGroup: function ( group ) {\n\t\t\tvar view = new SmartSite.views.GroupItem( {\n\t\t\t\t\tmodel: group,\n\t\t\t\t\tcollection: SmartSite.groups\n\t\t\t\t} ),\n\t\t\t\t$element = view.render().$el;\n\n\t\t\tthis.$( '.tvd-global-field-group-list' ).append( $element );\n\t\t\treturn $element;\n\t\t},\n\n\t\t/**\n\t\t * Select field type action\n\t\t */\n\t\tselectType: function ( e ) {\n\t\t\tthis.model.set( {data: {}} );\n\t\t\tthis.model.set( {type: e.currentTarget.dataset.id} );\n\t\t\tthis.$( '#tvd-tss-field-type' ).html( e.currentTarget.innerHTML ).removeClass( 'tvd-invalid' ).addClass( 'tvd-value-selected' );\n\t\t\tthis.hideTypeDropdown();\n\t\t\tthis.renderByType();\n\t\t},\n\t\trenderByType: function () {\n\t\t\tvar type = SmartSite.utils.get_field_type_name( parseInt( this.model.get( 'type' ) ) );\n\n\t\t\tif ( ! SmartSite.views[ 'Field' + TVE_Dash.upperFirst( type ) + 'Options' ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar view = new SmartSite.views[ 'Field' + TVE_Dash.upperFirst( type ) + 'Options' ]( {\n\t\t\t\tmodel: this.model,\n\t\t\t\tel: this.$( '.tvd-tss-field-data-wrapper' )[ 0 ]\n\n\t\t\t} );\n\n\t\t\tview.render();\n\t\t\tTVE_Dash.materialize( this.$el );\n\t\t},\n\t\tshowTypeDropdown: function () {\n\t\t\tthis.$( '.tvd-select-type-dropdown' ).toggleClass( 'tvd-hide' );\n\t\t},\n\t\thideTypeDropdown: function () {\n\t\t\tthis.$( '.tvd-select-type-dropdown' ).addClass( 'tvd-hide' );\n\t\t},\n\t\t/**\n\t\t * Set data to the model when inputs are changed\n\t\t *\n\t\t * @param e\n\t\t */\n\t\tsetInputData: function ( e ) {\n\t\t\tthis.tvd_clear_errors();\n\t\t\tvar field = $( e.currentTarget ).attr( 'data-field' ),\n\t\t\t\tprops = field.split( '_' );\n\n\t\t\tif ( ! this.model.get( 'data' ) ) {\n\t\t\t\tthis.model.set( {data: {}} );\n\t\t\t}\n\n\t\t\tif ( props.length === 1 ) {\n\t\t\t\tthis.model.set( props[ 0 ], e.currentTarget.value );\n\t\t\t} else if ( props.length > 1 ) {\n\t\t\t\tthis.model.get( props[ 0 ] )[ props[ 1 ] ] = e.currentTarget.value;\n\t\t\t}\n\n\t\t},\n\t\tinputGroupName: function ( e ) {\n\t\t\tif ( e.keyCode === 13 ) {\n\t\t\t\tthis.saveNewGroup();\n\t\t\t}\n\t\t\tthis.tvd_clear_errors();\n\t\t},\n\n\t\t/**\n\t\t * New group inside dropdown actions\n\t\t */\n\t\tsaveNewGroup: function () {\n\t\t\tif ( this.saving_group ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar newGroupName = this.$( '#tvd-add-group' ).val(),\n\t\t\t\tnewGroup = new SmartSite.models.Group( {name: newGroupName} ),\n\t\t\t\txhr,\n\t\t\t\tself = this;\n\n\t\t\tif ( ! newGroup.isValid() ) {\n\t\t\t\treturn this.tvd_show_errors( newGroup );\n\t\t\t}\n\t\t\tthis.saving_group = true;\n\t\t\tTVE_Dash.showLoader();\n\t\t\txhr = newGroup.save();\n\n\t\t\tif ( xhr ) {\n\t\t\t\txhr.done( function ( response, status, options ) {\n\t\t\t\t\tnewGroup.set( 'fields', new SmartSite.models.collections.Fields() );\n\t\t\t\t\tself.collection.add( newGroup );\n\n\t\t\t\t\tTVE_Dash.success( SmartSite.t.GroupSaved );\n\n\t\t\t\t\tself.renderGroup( newGroup ).find( '.tvd-group-option' ).click();\n\t\t\t\t\tself.hideAddGroup();\n\t\t\t\t} );\n\t\t\t\txhr.error( function ( errorObj ) {\n\t\t\t\t\tvar error = JSON.parse( errorObj.responseText );\n\t\t\t\t\tTVE_Dash.err( error.message );\n\t\t\t\t} );\n\t\t\t\txhr.always( function () {\n\t\t\t\t\tself.saving_group = false;\n\t\t\t\t\tTVE_Dash.hideLoader();\n\t\t\t\t} );\n\t\t\t}\n\n\t\t},\n\t\taddNewGroup: function () {\n\t\t\tthis.showAddGroup();\n\t\t},\n\t\tshowAddGroup: function () {\n\t\t\tthis.$( '#tvd-input-new-group' ).removeClass( 'tvd-hide' );\n\t\t\tthis.$( '#tvd-add-new-group' ).addClass( 'tvd-hide' );\n\t\t\tthis.$( '#tvd-add-group' ).focus();\n\t\t},\n\t\thideAddGroup: function () {\n\t\t\tthis.$( '#tvd-input-new-group' ).addClass( 'tvd-hide' );\n\t\t\tthis.$( '#tvd-add-new-group' ).removeClass( 'tvd-hide' );\n\t\t\tthis.$( '.tvd-select-group-dropdown' ).addClass( 'tvd-hide' );\n\t\t\tthis.$( '#tvd-add-group' ).val( '' );\n\t\t},\n\t\tshowDropdown: function () {\n\t\t\tthis.$( '.tvd-select-group-dropdown' ).toggleClass( 'tvd-hide' );\n\t\t},\n\t\thideDropdown: function () {\n\t\t\tthis.$( '.tvd-select-group-dropdown' ).addClass( 'tvd-hide' );\n\t\t},\n\t\tselectGroup: function ( e ) {\n\t\t\tvar $element = $( e.target );\n\t\t\tif ( ! $element.hasClass( 'tvd-group-option' ) ) {\n\t\t\t\t$element = $element.closest( '.tvd-group-option' );\n\t\t\t}\n\n\t\t\tvar group = this.collection.findWhere( {id: $element.attr( 'data-id' )} );\n\n\t\t\tif ( group ) {\n\t\t\t\tthis.$( '#tvd-tss-group-name' ).html( group.get( 'name' ) ).removeClass( 'tvd-invalid' ).addClass( 'tvd-value-selected' );\n\t\t\t\tif ( this.model.get( 'group_id' ) != group.get( 'id' ) ) {\n\t\t\t\t\tthis.groupChange = true;\n\t\t\t\t}\n\t\t\t\tthis.model.set( {group_id: group.get( 'id' )} );\n\t\t\t\tthis.hideDropdown();\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Save the field data\n\t\t *\n\t\t * @returns {Backbone.View}\n\t\t */\n\t\tsave: function () {\n\t\t\tif ( this.$( '#tvd-add-group' ).is( \":visible\" ) || this.saving ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tthis.tvd_clear_errors();\n\n\t\t\tif ( ! this.model.isValid() ) {\n\t\t\t\treturn this.tvd_show_errors( this.model );\n\t\t\t}\n\n\t\t\tthis.saving = true;\n\t\t\tvar self = this,\n\t\t\t\txhr = this.model.save();\n\n\t\t\tthis.close();\n\t\t\tif ( xhr ) {\n\t\t\t\tTVE_Dash.showLoader( true );\n\t\t\t\txhr.done( function ( response, status, options ) {\n\t\t\t\t\tvar group = self.collection.findWhere( {id: self.model.get( 'group_id' )} );\n\t\t\t\t\tif ( group ) {\n\t\t\t\t\t\tgroup.get( 'fields' ).add( self.model );\n\t\t\t\t\t}\n\t\t\t\t\tif ( self.groupChange && self.view ) {\n\t\t\t\t\t\tself.view.$el.remove();\n\t\t\t\t\t}\n\t\t\t\t\tself.model.set( 'just_added', true );\n\t\t\t\t\tself.model.trigger( 'render_field' );\n\t\t\t\t\tTVE_Dash.success( SmartSite.t.FieldSaved );\n\t\t\t\t} );\n\t\t\t\txhr.error( function ( errorObj ) {\n\t\t\t\t\tvar error = JSON.parse( errorObj.responseText );\n\t\t\t\t\tTVE_Dash.err( error.message );\n\t\t\t\t} );\n\t\t\t\txhr.always( function () {\n\t\t\t\t\tTVE_Dash.hideLoader();\n\t\t\t\t\tself.saving = false;\n\t\t\t\t} );\n\n\t\t\t}\n\t\t}\n\t} );\n\n\t/**\n\t * Modal for editing the group\n\t */\n\tmodals.EditGroupModal = TVE_Dash.views.Modal.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/modals/edit-group' ),\n\t\tclassName: 'tvd-modal tss-modal tss-edit-modal',\n\t\tevents: {\n\t\t\t'input #tvd-tss-group-name': 'setName',\n\t\t\t'click .tvd-modal-submit': 'save',\n\t\t\t'click .tvd-modal-close': 'cancelChanges'\n\t\t},\n\t\tafterInitialize: function () {\n\t\t\tthis.old_name = this.model.get( 'name' );\n\t\t},\n\t\tcancelChanges: function () {\n\t\t\tthis.model.set( 'name', this.old_name );\n\t\t},\n\t\t/**\n\t\t * Set the group name\n\t\t *\n\t\t * @param e\n\t\t */\n\t\tsetName: function ( e ) {\n\t\t\tthis.model.set( {name: e.currentTarget.value} );\n\t\t},\n\t\t/**\n\t\t * Save the group\n\t\t */\n\t\tsave: function () {\n\n\t\t\tthis.tvd_clear_errors();\n\n\t\t\tif ( ! this.model.isValid() ) {\n\t\t\t\treturn this.tvd_show_errors( this.model );\n\t\t\t}\n\t\t\tthis.saving = true;\n\t\t\tTVE_Dash.showLoader();\n\n\t\t\tvar id = this.model.get( 'id' ),\n\t\t\t\txhr = this.model.save(),\n\t\t\t\tself = this;\n\n\n\t\t\tif ( xhr ) {\n\t\t\t\txhr.done( function ( response, status, options ) {\n\n\t\t\t\t\tself.model.set( {fields: new SmartSite.models.collections.Fields( self.model.get( 'fields' ) )} );\n\t\t\t\t\tif ( id ) {\n\t\t\t\t\t\tself.model.trigger( 'render_groups' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.collection.add( self.model );\n\t\t\t\t\t}\n\n\t\t\t\t\tself.close();\n\t\t\t\t\tTVE_Dash.success( SmartSite.t.GroupSaved );\n\t\t\t\t} );\n\t\t\t\txhr.error( function ( errorObj ) {\n\t\t\t\t\tvar error = JSON.parse( errorObj.responseText );\n\t\t\t\t\tTVE_Dash.err( error.message );\n\t\t\t\t} );\n\t\t\t\txhr.always( function () {\n\t\t\t\t\tTVE_Dash.hideLoader();\n\t\t\t\t\tself.saving = false;\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t} );\n\n\t/**\n\t * Delete a group or field\n\t */\n\tmodals.DeleteModal = TVE_Dash.views.Modal.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/modals/delete' ),\n\t\tclassName: 'tvd-modal tss-modal',\n\t\tevents: {\n\t\t\t'click .tvd-delete-item': 'deleteItem'\n\t\t},\n\t\tafterInitialize: function ( args ) {\n\t\t\tthis.$el.addClass( 'tvd-red' );\n\t\t\tvar _this = this;\n\t\t\t_.defer( function () {\n\t\t\t\t_this.$( '.tvd-delete-item' ).focus();\n\t\t\t} );\n\t\t},\n\t\t/**\n\t\t * Destroy the model\n\t\t * @param e\n\t\t */\n\t\tdeleteItem: function ( e ) {\n\t\t\tvar self = this;\n\t\t\tif ( this.saving ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tthis.saving = true;\n\t\t\tTVE_Dash.showLoader();\n\t\t\tvar xhr = this.model.destroy();\n\t\t\tif ( xhr ) {\n\t\t\t\txhr.done( function ( response, status, options ) {\n\t\t\t\t\tTVE_Dash.success( self.model.get( 'name' ) + ' ' + SmartSite.t.ItemDeleted );\n\t\t\t\t} );\n\t\t\t\txhr.error( function ( errorObj ) {\n\t\t\t\t\tvar error = JSON.parse( errorObj.responseText );\n\t\t\t\t\tTVE_Dash.err( error.message );\n\t\t\t\t} );\n\t\t\t\txhr.always( function () {\n\t\t\t\t\tTVE_Dash.hideLoader();\n\t\t\t\t\tself.close();\n\t\t\t\t\tself.saving = false;\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t} );\n\n\n\tmodule.exports = modals;\n\n} )( jQuery );\n//# sourceURL=thrive-dashboard/inc/smart-site/assets/admin/js/modals.js");
							},
							"models.js": function (exports, module, require) {
								eval("( function ( $ ) {\n\n\tvar models = {};\n\tmodels.collections = {};\n\t/**\n\t * Base Model\n\t */\n\tmodels.Base = Backbone.Model.extend( {\n\t\tidAttribute: 'ID',\n\t\t/**\n\t\t * deep-json implementation for backbone models - flattens any abject, collection etc from the model\n\t\t *\n\t\t * @returns {Object}\n\t\t */\n\t\ttoDeepJSON: function () {\n\t\t\tvar obj = $.extend( true, {}, this.attributes );\n\t\t\t_.each( _.keys( obj ), function ( key ) {\n\t\t\t\tif ( ! _.isUndefined( obj[ key ] ) && ! _.isNull( obj[ key ] ) && _.isFunction( obj[ key ].toJSON ) ) {\n\t\t\t\t\tobj[ key ] = obj[ key ].toJSON();\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn obj;\n\t\t},\n\t\t/**\n\t\t * deep clone a backbone model\n\t\t * this will duplicate all included collections, models etc located in the attributes field\n\t\t *\n\t\t * @returns {models.Base}\n\t\t */\n\t\tdeepClone: function () {\n\t\t\treturn new this.constructor( this.toDeepJSON() );\n\t\t},\n\t\t/**\n\t\t * ensures the same instance of a collection is used in a Backbone model\n\t\t *\n\t\t * @param {object} data\n\t\t * @param {object} collection_map map with object keys and collection constructors\n\t\t */\n\t\tensureCollectionData: function ( data, collection_map ) {\n\t\t\t_.each( collection_map, _.bind( function ( constructor, key ) {\n\t\t\t\tif ( ! data[ key ] ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tvar instanceOf = this.get( key ) instanceof constructor;\n\t\t\t\tif ( ! instanceOf ) {\n\t\t\t\t\tdata[ key ] = new constructor( data[ key ] );\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tthis.get( key ).reset( data[ key ] );\n\t\t\t\tdata[ key ] = this.get( key );\n\t\t\t}, this ) );\n\t\t},\n\t\tvalidation_error: function ( field, message ) {\n\t\t\treturn {\n\t\t\t\tfield: field,\n\t\t\t\tmessage: message\n\t\t\t};\n\t\t},\n\t\t/**\n\t\t * Set nonce header before every Backbone sync.\n\t\t *\n\t\t * @param {string} method.\n\t\t * @param {Backbone.Model} model.\n\t\t * @param {{beforeSend}, *} options.\n\t\t * @returns {*}.\n\t\t */\n\t\tsync: function ( method, model, options ) {\n\t\t\tvar beforeSend;\n\n\t\t\toptions = options || {};\n\n\t\t\toptions.cache = false;\n\n\t\t\tif ( ! _.isUndefined( SmartSite.nonce ) && ! _.isNull( SmartSite.nonce ) ) {\n\t\t\t\tbeforeSend = options.beforeSend;\n\n\t\t\t\toptions.beforeSend = function ( xhr ) {\n\t\t\t\t\txhr.setRequestHeader( 'X-WP-Nonce', SmartSite.nonce );\n\n\t\t\t\t\tif ( beforeSend ) {\n\t\t\t\t\t\treturn beforeSend.apply( this, arguments );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn Backbone.sync( method, model, options );\n\t\t}\n\t} );\n\n\t/**\n\t * Base Collection\n\t */\n\tmodels.collections.Base = Backbone.Collection.extend( {\n\t\t/**\n\t\t * helper function to get the last item of a collection\n\t\t *\n\t\t * @return Backbone.Model\n\t\t */\n\t\tlast: function () {\n\t\t\treturn this.at( this.size() - 1 );\n\t\t},\n\t\tsync: function ( method, model, options ) {\n\t\t\tvar beforeSend;\n\n\t\t\toptions = options || {};\n\n\t\t\toptions.cache = false;\n\n\t\t\tif ( ! _.isUndefined( SmartSite.nonce ) && ! _.isNull( SmartSite.nonce ) ) {\n\t\t\t\tbeforeSend = options.beforeSend;\n\n\t\t\t\toptions.beforeSend = function ( xhr ) {\n\t\t\t\t\txhr.setRequestHeader( 'X-WP-Nonce', SmartSite.nonce );\n\n\t\t\t\t\tif ( beforeSend ) {\n\t\t\t\t\t\treturn beforeSend.apply( this, arguments );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn Backbone.sync( method, model, options );\n\t\t}\n\t} );\n\n\t/**\n\t * Breadcrumb Link\n\t */\n\tmodels.BreadcrumbLink = models.Base.extend( {\n\t\tdefaults: {\n\t\t\tID: '',\n\t\t\thash: '',\n\t\t\tlabel: '',\n\t\t\tfull_link: false\n\t\t},\n\t\t/**\n\t\t * we pass only hash and label, and build the ID based on the label\n\t\t *\n\t\t * @param {object} att\n\t\t */\n\t\tinitialize: function ( att ) {\n\t\t\tif ( ! this.get( 'ID' ) ) {\n\t\t\t\tif ( att.label ) {\n\t\t\t\t\tthis.set( 'ID', att.label.split( ' ' ).join( '' ).toLowerCase() );\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.set( 'full_link', att.hash.match( /^http/ ) );\n\t\t},\n\t\t/**\n\t\t *\n\t\t * @returns {String}\n\t\t */\n\t\tget_url: function () {\n\t\t\treturn this.get( 'full_link' ) ? this.get( 'hash' ) : ( '#' + this.get( 'hash' ) );\n\t\t}\n\t} );\n\n\t/**\n\t * Breadcrumbs Collection\n\t */\n\tmodels.collections.Breadcrumbs = models.collections.Base.extend( {\n\t\tmodel: models.Base.extend( {\n\t\t\tdefaults: {\n\t\t\t\thash: '',\n\t\t\t\tlabel: ''\n\t\t\t}\n\t\t} ),\n\t\t/**\n\t\t * helper function allows adding items to the collection easier\n\t\t *\n\t\t * @param {string} route\n\t\t * @param {string} label\n\t\t */\n\t\tadd_page: function ( route, label ) {\n\t\t\tvar _model = new models.BreadcrumbLink( {\n\t\t\t\thash: route,\n\t\t\t\tlabel: label\n\t\t\t} );\n\t\t\treturn this.add( _model );\n\t\t}\n\t} );\n\n\t/**\n\t * Field model\n\t */\n\tmodels.Field = models.Base.extend( {\n\t\tidAttribute: 'id',\n\t\tdefaults: {\n\t\t\tgroup_id: null,\n\t\t\tname: '',\n\t\t\ttype: null,\n\t\t\tdata: {},\n\t\t\ticon: '',\n\t\t\tformated_data: '',\n\t\t\tis_default: 0,\n\t\t\topened: false,\n\t\t\tcreated_at: '',\n\t\t\tupdated_at: ''\n\t\t},\n\t\tinitialize: function () {\n\t\t\tif ( this.get( 'data' ) === null ) {\n\t\t\t\tthis.set( {data: {}} );\n\t\t\t}\n\t\t},\n\t\turl: function () {\n\t\t\tvar url = SmartSite.routes.fields;\n\n\t\t\tif ( this.get( 'id' ) || this.get( 'id' ) === 0 ) {\n\t\t\t\turl += '/' + this.get( 'id' );\n\t\t\t}\n\n\t\t\treturn url;\n\t\t},\n\t\t/**\n\t\t * Overwrite Backbone validation\n\t\t * Return something to invalidate the model\n\t\t *\n\t\t * @param {Object} attrs\n\t\t * @param {Object} options\n\t\t */\n\t\tvalidate: function ( attrs, options ) {\n\t\t\tthis.errors = [];\n\n\t\t\tif ( ! attrs.name ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'name', SmartSite.t.InvalidName ) );\n\t\t\t}\n\t\t\tthis.validateGoupId( attrs );\n\t\t\tthis.validateType( attrs );\n\n\t\t\tvar type = TVE_Dash.upperFirst( SmartSite.utils.get_field_type_name( parseInt( attrs.type ) ) ),\n\t\t\t\tfn = 'validate' + type + 'Field';\n\n\t\t\tif ( typeof this[ fn ] === 'function' ) {\n\t\t\t\tthis[ fn ].call( this, attrs.data );\n\t\t\t}\n\n\t\t\tif ( this.errors.length ) {\n\t\t\t\treturn this.errors;\n\t\t\t}\n\t\t},\n\t\tvalidateGoupId: function ( data ) {\n\n\t\t\tif ( data.group_id === null ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'group_id', SmartSite.t.InvalidInput ) );\n\t\t\t}\n\t\t},\n\t\tvalidateType: function ( data ) {\n\t\t\tif ( data.type === null ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'type', SmartSite.t.InvalidInput ) );\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Validate text field data\n\t\t */\n\t\tvalidateTextField: function ( data ) {\n\n\t\t\tif ( ! data.text ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'data_text', SmartSite.t.InvalidText ) );\n\t\t\t}\n\t\t},\n\t\tvalidateAddressField: function ( data ) {\n\t\t\tif ( ! data.address1 ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'data_address1', SmartSite.t.InvalidAddress ) );\n\t\t\t}\n\n\t\t},\n\t\tvalidatePhoneField: function ( data ) {\n\t\t\tif ( ! data.phone ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'data_phone', SmartSite.t.InvalidPhone ) );\n\t\t\t}\n\t\t},\n\t\tvalidateEmailField: function ( data ) {\n\t\t\tif ( ! data.email ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'data_email', SmartSite.t.NoEmail ) );\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! ( /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,})+$/.test( data.email ) ) ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'data_email', SmartSite.t.InvalidEmail ) );\n\t\t\t}\n\t\t},\n\t\tvalidateLinkField: function ( data ) {\n\t\t\tif ( ! data.text ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'data_text', SmartSite.t.InvalidText ) );\n\t\t\t}\n\n\t\t\tif ( ! data.url ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'data_url', SmartSite.t.NoURL ) );\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif ( ! /^(f|ht)tps?:\\/\\//i.test( data.url ) ) {\n\t\t\t\tdata.url = \"https://\" + data.url;\n\t\t\t}\n\n\n\t\t\tvar pattern = new RegExp( '^((ft|htt)ps?:\\\\/\\\\/)?' + // protocol\n\t\t\t                          '((([a-z\\\\d]([a-z\\\\d-]*[a-z\\\\d])*)\\\\.)+[a-z]{2,}|' + // domain name and extension\n\t\t\t                          '((\\\\d{1,3}\\\\.){3}\\\\d{1,3}))' + // OR ip (v4) address\n\t\t\t                          '(\\\\:\\\\d+)?' + // port\n\t\t\t                          '(\\\\/[-a-z\\\\d%@_.~+&:]*)*' + // path\n\t\t\t                          '(\\\\?[;&a-z\\\\d%@_.,~+&:=-]*)?' + // query string\n\t\t\t                          '(\\\\#[-a-z\\\\d_]*)?$', 'i' ); // fragment locator\n\t\t\tif ( ! pattern.test( data.url ) ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'data_url', SmartSite.t.InvalidURL ) );\n\t\t\t}\n\t\t},\n\t\tvalidateLocationField: function ( data ) {\n\t\t\tif ( ! data.location ) {\n\t\t\t\tthis.errors.push( this.validation_error( 'data_location', SmartSite.t.InvalidLocation ) );\n\t\t\t}\n\t\t}\n\t} );\n\t/**\n\t * Fields collection\n\t */\n\tmodels.collections.Fields = models.collections.Base.extend( {\n\t\tmodel: models.Field\n\t} );\n\n\t/**\n\t * Field type model\n\t */\n\tmodels.FieldType = models.Base.extend( {} );\n\t/**\n\t * Group model\n\t */\n\tmodels.Group = models.Base.extend( {\n\t\tidAttribute: 'id',\n\t\tdefaults: {\n\t\t\tname: '',\n\t\t\tis_default: 0,\n\t\t\tcreated_at: '',\n\t\t\tupdated_at: ''\n\t\t},\n\t\tinitialize: function () {\n\t\t\tthis.set( {fields: new models.collections.Fields( this.get( 'fields' ) )} )\n\t\t},\n\t\turl: function () {\n\t\t\tvar url = SmartSite.routes.groups;\n\n\t\t\tif ( this.get( 'id' ) || this.get( 'id' ) === 0 ) {\n\t\t\t\turl += '/' + this.get( 'id' );\n\t\t\t}\n\n\t\t\treturn url;\n\t\t},\n\t\t/**\n\t\t * Overwrite Backbone validation\n\t\t * Return something to invalidate the model\n\t\t *\n\t\t * @param {Object} attrs\n\t\t * @param {Object} options\n\t\t */\n\t\tvalidate: function ( attrs, options ) {\n\t\t\tvar errors = [];\n\n\t\t\tif ( ! attrs.name ) {\n\t\t\t\terrors.push( this.validation_error( 'name', SmartSite.t.InvalidName ) );\n\t\t\t}\n\n\t\t\tif ( errors.length ) {\n\t\t\t\treturn errors;\n\t\t\t}\n\t\t}\n\t} );\n\t/**\n\t * Groups collection\n\t */\n\tmodels.collections.Groups = models.collections.Base.extend( {\n\t\tmodel: models.Group\n\t} );\n\n\tmodule.exports = models;\n\n} )( jQuery );\n//# sourceURL=thrive-dashboard/inc/smart-site/assets/admin/js/models.js");
							},
							"routes.js": function (exports, module, require) {
								eval("( function ( $ ) {\n\t_.templateSettings = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /<#=([\\s\\S]+?)#>/g,\n\t\tescape: /<#-([\\s\\S]+?)#>/g\n\t};\n\t$( function () {\n\t\t$.extend( SmartSite, {\n\t\t\tss_router: Backbone.Router.extend( {\n\t\t\t\t$el: $( '#tvd-tss-wrapper' ),\n\t\t\t\troutes: {\n\t\t\t\t\t'dashboard': 'dashboard',\n\t\t\t\t\t'global_fields': 'global_fields',\n\n\t\t\t\t},\n\t\t\t\theader: null,\n\t\t\t\tdashboard_view: null,\n\t\t\t\tmenu_view: null,\n\t\t\t\tsidemenu_view: null,\n\t\t\t\tbreadcrumbs: {\n\t\t\t\t\tcol: null,\n\t\t\t\t\tview: null\n\t\t\t\t},\n\t\t\t\t/**\n\t\t\t\t * set the current page - adds the structure to breadcrumbs and sets the new document title\n\t\t\t\t *\n\t\t\t\t * @param {string} section page hierarchy\n\t\t\t\t * @param {string} label current page label\n\t\t\t\t *\n\t\t\t\t * @param {Array} [structure] optional the structure of the links that lead to the current page\n\t\t\t\t */\n\t\t\t\tset_page: function ( section, label, structure ) {\n\t\t\t\t\tthis.breadcrumbs.col.reset();\n\t\t\t\t\tstructure = structure || {};\n\n\t\t\t\t\t/* Thrive Admin Dashboard is always the first element */\n\t\t\t\t\tthis.breadcrumbs.col.add_page( SmartSite.dash_url, SmartSite.t.Thrive_Dashboard, true );\n\n\t\t\t\t\t_.each( structure, _.bind( function ( item ) {\n\t\t\t\t\t\tthis.breadcrumbs.col.add_page( item.route, item.label );\n\t\t\t\t\t}, this ) );\n\n\t\t\t\t\t/**\n\t\t\t\t\t * last link - no need for route\n\t\t\t\t\t */\n\t\t\t\t\tthis.breadcrumbs.col.add_page( '', label );\n\n\t\t\t\t\t/* update the page title */\n\t\t\t\t\tvar $title = $( 'head > title' );\n\t\t\t\t\tif ( ! this.original_title ) {\n\t\t\t\t\t\tthis.original_title = $title.html();\n\t\t\t\t\t}\n\n\t\t\t\t\t$title.html( label + ' &lsaquo; ' + this.original_title )\n\t\t\t\t},\n\t\t\t\t/**\n\t\t\t\t * Creates a view for the header\n\t\t\t\t */\n\t\t\t\trenderHeader: function () {\n\t\t\t\t\tif ( ! this.header ) {\n\t\t\t\t\t\tthis.header = new SmartSite.views.Header( {\n\t\t\t\t\t\t\tel: '#tvd-tss-header'\n\t\t\t\t\t\t} );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.header.setElement( $( '#tvd-tss-header' ) );\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.header.render();\n\n\t\t\t\t},\n\t\t\t\t/**\n\t\t\t\t * Initialize breadcrumbs\n\t\t\t\t */\n\t\t\t\tinit_breadcrumbs: function () {\n\t\t\t\t\tthis.breadcrumbs.col = new SmartSite.models.collections.Breadcrumbs();\n\t\t\t\t\tthis.breadcrumbs.view = new SmartSite.views.Breadcrumbs( {\n\t\t\t\t\t\tcollection: this.breadcrumbs.col\n\t\t\t\t\t} )\n\t\t\t\t},\n\t\t\t\t/**\n\t\t\t\t * Render the menu\n\t\t\t\t */\n\t\t\t\trenderMenu: function () {\n\t\t\t\t\tthis.menu_view = new SmartSite.views.Menu( {} );\n\n\t\t\t\t\tthis.$el.find( '.tvd-tss-menu' ).html( this.menu_view.render().$el );\n\t\t\t\t},\n\t\t\t\t/**\n\t\t\t\t * Dashboard view\n\t\t\t\t */\n\t\t\t\tdashboard: function () {\n\t\t\t\t\tthis.set_page( '', 'Smart Site', [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\troute: 'dashboard',\n\t\t\t\t\t\t\tlabel: SmartSite.t.Thrive_Dashboard\n\t\t\t\t\t\t}\n\t\t\t\t\t] );\n\n\t\t\t\t\tthis.renderHeader();\n\t\t\t\t\tthis.renderMenu();\n\n\t\t\t\t\tif ( this.dashboard_view ) {\n\t\t\t\t\t\tthis.dashboard_view.remove();\n\t\t\t\t\t}\n\t\t\t\t\t/**\n\t\t\t\t\t * Start the dashboard\n\t\t\t\t\t */\n\t\t\t\t\tthis.dashboard_view = new SmartSite.views.Dashboard( {\n\t\t\t\t\t\tcollection: SmartSite.groups\n\t\t\t\t\t} );\n\n\t\t\t\t\tthis.$el.find( '.tvd-tss-content' ).html( this.dashboard_view.render().$el );\n\n\t\t\t\t\tTVE_Dash.materialize( this.$el );\n\t\t\t\t},\n\t\t\t\t/**\n\t\t\t\t * Go to the global fields route\n\t\t\t\t */\n\t\t\t\tglobal_fields: function () {\n\t\t\t\t\tthis.set_page( '', 'Global Fields', [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\troute: 'global_fields',\n\t\t\t\t\t\t\tlabel: SmartSite.t.SmartSite\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\troute: 'dashboard',\n\t\t\t\t\t\t\tlabel: SmartSite.t.Thrive_Dashboard\n\t\t\t\t\t\t}\n\n\t\t\t\t\t] );\n\n\t\t\t\t\tthis.renderHeader();\n\t\t\t\t\tthis.renderMenu();\n\n\t\t\t\t\tif ( this.dashboard_view ) {\n\t\t\t\t\t\tthis.dashboard_view.remove();\n\t\t\t\t\t}\n\t\t\t\t\t/**\n\t\t\t\t\t * Start the dashboard\n\t\t\t\t\t */\n\t\t\t\t\tthis.dashboard_view = new SmartSite.views.GlobalFields( {\n\t\t\t\t\t\tcollection: SmartSite.groups\n\t\t\t\t\t} );\n\t\t\t\t\tthis.$el.find( '.tvd-tss-content' ).html( this.dashboard_view.render().$el );\n\n\t\t\t\t\tTVE_Dash.materialize( this.$el );\n\t\t\t\t}\n\n\t\t\t} ),\n\n\t\t\tutils: require( './_utils' ),\n\t\t\tmodels: require( './models' ),\n\t\t\tviews: require( './views' ),\n\t\t\tmodals: require( './modals' )\n\t\t} );\n\n\n\t\t/**\n\t\t * Global Data\n\t\t */\n\t\tSmartSite.groups = new SmartSite.models.collections.Groups( SmartSite.data.groups );\n\t\t/**\n\t\t * Start the app\n\t\t */\n\t\tSmartSite.router = new SmartSite.ss_router();\n\t\tSmartSite.router.init_breadcrumbs();\n\t\tBackbone.history.start( {hashchange: true} );\n\n\t\t/**\n\t\t * Start app\n\t\t */\n\t\tif ( ! Backbone.history.fragment ) {\n\t\t\tSmartSite.router.navigate( '#global_fields', {trigger: true} );\n\t\t}\n\n\t} );\n\n\n} )( jQuery );\n//# sourceURL=thrive-dashboard/inc/smart-site/assets/admin/js/routes.js");
							},
							"views.js": function (exports, module, require) {
								eval("( function ( $ ) {\n\n\tvar views = {};\n\t/**\n\t * remove tvd-invalid class for all inputs in the view's root element\n\t *\n\t * @returns {Backbone.View}\n\t */\n\tBackbone.View.prototype.tvd_clear_errors = function () {\n\t\tthis.$( '.tvd-invalid' ).removeClass( 'tvd-invalid' );\n\t\tthis.$( 'select' ).trigger( 'tvdclear' );\n\t\treturn this;\n\t};\n\n\t/**\n\t *\n\t * @param {Backbone.Model|object} [model] backbone model or error object with 'field' and 'message' properties\n\t *\n\t * @returns {Backbone.View|undefined}\n\t */\n\tBackbone.View.prototype.tvd_show_errors = function ( model ) {\n\t\tmodel = model || this.model;\n\n\t\tif ( ! model ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar err = model instanceof Backbone.Model ? model.validationError : model,\n\t\t\tself = this,\n\t\t\t$all = $();\n\n\t\tfunction show_error( error_item ) {\n\t\t\tif ( typeof error_item === 'string' ) {\n\t\t\t\treturn TVE_Dash.err( error_item );\n\t\t\t}\n\n\t\t\t$all = $all.add( self.$( '[data-field=' + error_item.field + ']' ).addClass( 'tvd-invalid' ).each( function () {\n\t\t\t\tvar $this = $( this );\n\t\t\t\tif ( $this.is( 'select' ) ) {\n\t\t\t\t\t$this.trigger( 'tvderror', error_item.message );\n\t\t\t\t} else {\n\t\t\t\t\t$this.next( 'label' ).attr( 'data-error', error_item.message )\n\t\t\t\t}\n\t\t\t} ) );\n\t\t}\n\n\t\tif ( $.isArray( err ) ) {\n\t\t\t_.each( err, function ( item ) {\n\t\t\t\tshow_error( item );\n\t\t\t} );\n\t\t} else {\n\t\t\tshow_error( err );\n\t\t}\n//\t\t\t$all.not( '.tvd-no-focus' ).first().focus();\n\t\t/* if the first error message is not visible, scroll the contents to include it in the viewport. At the moment, this is only implemented for modals */\n\t\tthis.scroll_first_error( $all.first() );\n\n\t\treturn this;\n\t};\n\n\t/**\n\t * scroll the contents so that the first errored input is visible\n\t * currently this is only implemented for modals\n\t *\n\t * @param {Object} $input first input element that has the error\n\t *\n\t * @returns {Backbone.View}\n\t */\n\tBackbone.View.prototype.scroll_first_error = function ( $input ) {\n\t\tif ( ! ( this instanceof TVE_Dash.views.Modal ) || ! $input.length ) {\n\t\t\treturn this;\n\t\t}\n\t\tvar input_top = $input.offset().top,\n\t\t\tcontent_top = this.$_content.offset().top,\n\t\t\tscroll_top = this.$_content.scrollTop(),\n\t\t\tcontent_height = this.$_content.outerHeight();\n\t\tif ( input_top >= content_top && input_top < content_height + content_top - 50 ) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis.$_content.animate( {\n\t\t\t'scrollTop': scroll_top + input_top - content_top - 40 // 40px difference\n\t\t}, 200, 'swing' );\n\t};\n\n\n\t/**\n\t * Base View\n\t */\n\tviews.Base = Backbone.View.extend( {\n\t\t/**\n\t\t * Always try to return this !!!\n\t\t *\n\t\t * @returns {views.Base}\n\t\t */\n\t\trender: function () {\n\t\t\treturn this;\n\t\t},\n\t\t/**\n\t\t *\n\t\t * Instantiate and open a new modal which has the view constructor assigned and send params further along\n\t\t *\n\t\t * @param ViewConstructor View constructor\n\t\t * @param params\n\t\t */\n\t\tmodal: function ( ViewConstructor, params ) {\n\t\t\treturn TVE_Dash.modal( ViewConstructor, params );\n\t\t},\n\t\tbind_zclip: function () {\n\t\t\t/**\n\t\t\t * Keep the old ZClip working\n\t\t\t */\n\t\t\tTVE_Dash.bindZClip( this.$( 'a.tvd-copy-to-clipboard' ) );\n\n\t\t\tvar $element = this.$( '.tva-sendowl-search' );\n\n\t\t\tfunction bind_it() {\n\t\t\t\t$element.each( function () {\n\t\t\t\t\tvar $elem = $( this ),\n\t\t\t\t\t\t$input = $elem.prev().on( 'click', function ( e ) {\n\t\t\t\t\t\t\tthis.select();\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\t_default_btn_color_class = $elem.attr( 'data-tvd-btn-color-class' ) || 'tva-copied';\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\t$elem.zclip( {\n\t\t\t\t\t\t\tpath: TVE_Dash_Const.dash_url + '/js/util/jquery.zclip.1.1.1/ZeroClipboard.swf',\n\t\t\t\t\t\t\tcopy: function () {\n\t\t\t\t\t\t\t\treturn jQuery( this ).prev().val();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tafterCopy: function () {\n\t\t\t\t\t\t\t\tvar $link = jQuery( this );\n\t\t\t\t\t\t\t\t$input.select();\n\t\t\t\t\t\t\t\t$link.removeClass( _default_btn_color_class ).addClass( 'tva-copied' );\n\t\t\t\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t\t\t\t$link.removeClass( 'tva-copied' );\n\t\t\t\t\t\t\t\t}, 2000 );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\tconsole.error && console.error( 'Error embedding zclip - most likely another plugin is messing this up' ) && console.error( e );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tsetTimeout( bind_it, 200 );\n\t\t}\n\t} );\n\n\t/**\n\t * Header View\n\t */\n\tviews.Header = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'header' ),\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {} ) );\n\t\t\treturn this;\n\t\t}\n\t} );\n\n\tviews.Menu = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'menu' ),\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {page: Backbone.history.getFragment()} ) );\n\n\t\t\treturn this;\n\t\t}\n\t} );\n\t/**\n\t * breadcrumbs view - renders breadcrumb links\n\t */\n\tviews.Breadcrumbs = views.Base.extend( {\n\t\tel: $( '#tvd-tss-breadcrumbs-wrapper' )[ 0 ],\n\t\ttemplate: TVE_Dash.tpl( 'breadcrumbs' ),\n\t\t/**\n\t\t * setup collection listeners\n\t\t */\n\t\tinitialize: function () {\n\t\t\tthis.$title = $( 'head > title' );\n\t\t\tthis.original_title = this.$title.html();\n\t\t\tthis.listenTo( this.collection, 'change', this.render );\n\t\t\tthis.listenTo( this.collection, 'add', this.render );\n\t\t},\n\t\t/**\n\t\t * render the html\n\t\t */\n\t\trender: function () {\n\t\t\tthis.$el.empty().html( this.template( {links: this.collection} ) );\n\t\t\treturn this;\n\t\t}\n\t} );\n\n\n\t/**\n\t * Dashboard view (Global Fields for now)\n\t */\n\tviews.Dashboard = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'dashboard' ),\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {} ) );\n\n\t\t\treturn this;\n\t\t}\n\t} );\n\n\tviews.GlobalFields = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global_fields' ),\n\t\tevents: {\n\t\t\t'click .tvd-tss-add-new-field': 'addField',\n\t\t},\n\t\tinitialize: function () {\n\t\t\tthis.listenTo( this.collection, 'add', this.render );\n\t\t\tthis.listenTo( this.collection, 'remove', this.render );\n\t\t},\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {} ) );\n\n\t\t\tthis.renderGroups();\n\n\t\t\treturn this;\n\t\t},\n\t\trenderGroups: function () {\n\t\t\tthis.collection.each( this.renderGroup, this );\n\t\t\tTVE_Dash.materialize( this.$el );\n\t\t},\n\t\trenderGroup: function ( group ) {\n\t\t\tvar view = new views.Group( {\n\t\t\t\tmodel: group,\n\t\t\t\tcollection: this.collection\n\t\t\t} ), $groupElement = view.render().$el;\n\n\t\t\tthis.$( '.tvd-tss-groups-wrapper' ).append( $groupElement );\n\t\t},\n\t\taddField: function () {\n\t\t\tthis.modal( SmartSite.modals.EditFieldModal, {\n\t\t\t\tcollection: this.collection,\n\t\t\t\tgroup: new SmartSite.models.Group(),\n\t\t\t\tmodel: new SmartSite.models.Field(),\n\t\t\t\t'max-width': '60%',\n\t\t\t\twidth: '800px'\n\t\t\t} );\n\t\t}\n\t} );\n\n\t/**\n\t * View for the side menu\n\t */\n\tviews.SideMenu = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'side-menu' ),\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {page: Backbone.history.getFragment()} ) );\n\n\t\t\treturn this;\n\t\t}\n\t} );\n\t/**\n\t * Group view\n\t */\n\tviews.Group = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/group' ),\n\t\ttagName: 'li',\n\t\tclassName: 'tvd-tss-group-item tvd-active',\n\t\tevents: {\n\t\t\t'click .tvd-tss-add-field': 'addField',\n\t\t\t'click .tvd-tss-delete-group': 'deleteGroup',\n\t\t\t'click .tvd-tss-edit-group': 'editGroup'\n\t\t},\n\n\t\tinitialize: function () {\n\t\t\tif ( Number( this.model.get( 'is_default' ) ) ) {\n\t\t\t\tthis.$el.addClass( 'tvd-tss-group-item-default ' );\n\t\t\t}\n\t\t\tthis.listenTo( this.model.get( 'fields' ), 'add', this.render );\n\t\t\tthis.listenTo( this.model.get( 'fields' ), 'remove', this.render );\n\t\t\tthis.model.on( 'render_groups', this.render, this );\n\t\t},\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {model: this.model} ) );\n\n\t\t\tthis.renderFields();\n\n\t\t\treturn this;\n\t\t},\n\t\t/**\n\t\t * Render each group fields\n\t\t */\n\t\trenderFields: function () {\n\t\t\tif ( this.model.get( 'fields' ).length === 0 ) {\n\t\t\t\tthis.$( 'ul.tvd-tss-fields-wrapper' ).html( '<p class=\"tvd-tss-placeholder\">' + SmartSite.t.NoFields + '</p>' );\n\t\t\t} else {\n\t\t\t\tthis.model.get( 'fields' ).each( this.renderField, this );\n\t\t\t}\n\n\t\t},\n\t\t/**\n\t\t * Render one field\n\t\t *\n\t\t * @param field\n\t\t */\n\t\trenderField: function ( field ) {\n\t\t\tvar view = new views.Field( {\n\t\t\t\tmodel: field,\n\t\t\t\tcollection: this.model.get( 'fields' ),\n\t\t\t\tgroup: this.model\n\t\t\t} );\n\n\t\t\tthis.$( 'ul.tvd-tss-fields-wrapper' ).append( view.render().$el )\n\t\t},\n\t\t/**\n\t\t * Open modal for adding a field\n\t\t */\n\t\taddField: function () {\n\t\t\tvar model = new SmartSite.models.Field( {group_id: this.model.get( 'id' )} );\n\n\t\t\tthis.modal( SmartSite.modals.EditFieldModal, {\n\t\t\t\tmodel: model,\n\t\t\t\tcollection: this.collection,\n\t\t\t\tgroup: this.model,\n\t\t\t\t'max-width': '60%',\n\t\t\t\twidth: '800px'\n\t\t\t} );\n\t\t},\n\t\t/**\n\t\t * Open delete group modal\n\t\t */\n\t\tdeleteGroup: function () {\n\t\t\tthis.modal( SmartSite.modals.DeleteModal, {\n\t\t\t\tmodel: this.model,\n\t\t\t\tcollection: this.collection,\n\t\t\t\t'max-width': '60%',\n\t\t\t\twidth: '800px'\n\t\t\t} );\n\t\t},\n\t\t/**\n\t\t * Open edit group modal\n\t\t */\n\t\teditGroup: function () {\n\t\t\tthis.modal( SmartSite.modals.EditGroupModal, {\n\t\t\t\tmodel: this.model,\n\t\t\t\tcollection: this.collection,\n\t\t\t\t'max-width': '60%',\n\t\t\t\twidth: '800px'\n\t\t\t} );\n\t\t}\n\t} );\n\n\t/**\n\t * Start adding fields in group view\n\t */\n\tviews.AddGroupField = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/add-group-field' ),\n\t\tclassName: 'tvd-row',\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {} ) );\n\t\t\treturn this;\n\t\t}\n\t} );\n\n\t/**\n\t * Add more button view\n\t */\n\tviews.AddMore = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/add-more' ),\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {} ) );\n\t\t\treturn this;\n\t\t}\n\t} );\n\n\t/**\n\t * Field View\n\t */\n\tviews.Field = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/field' ),\n\t\ttagName: 'li',\n\t\tevents: {\n\t\t\t'click .tvd-tss-delete-field': 'deleteField',\n\t\t\t'click .tvd-tss-edit-field': 'editField'\n\t\t},\n\t\tinitialize: function ( options ) {\n\t\t\tthis.group = options.group;\n\t\t\tthis.model.on( 'render_field', this.render, this );\n\t\t},\n\t\trender: function () {\n\t\t\tthis.$el.closest('.tvd-tss-fields-content').find('.tve-tss-just-added').removeClass('tve-tss-just-added');\n\t\t\tthis.$el.html( this.template( {model: this.model} ) );\n\n\t\t\treturn this;\n\t\t},\n\t\tdeleteField: function () {\n\t\t\tthis.modal( SmartSite.modals.DeleteModal, {\n\t\t\t\tmodel: this.model,\n\t\t\t\tcollection: this.collection,\n\t\t\t\t'max-width': '60%',\n\t\t\t\twidth: '800px'\n\t\t\t} );\n\t\t},\n\t\teditField: function () {\n\t\t\tthis.modal( SmartSite.modals.EditFieldModal, {\n\t\t\t\tmodel: this.model,\n\t\t\t\tcollection: SmartSite.groups,\n\t\t\t\tgroup: this.group,\n\t\t\t\tview: this,\n\t\t\t\t'max-width': '60%',\n\t\t\t\twidth: '800px',\n\t\t\t\tedit: true\n\t\t\t} );\n\t\t}\n\t} );\n\n\t/**\n\t * Text Field options\n\t */\n\tviews.FieldTextOptions = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/text-options' ),\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {model: this.model} ) );\n\t\t\tif ( ! this.model.get( 'name' ) ) {\n\t\t\t\tthis.$( 'input' ).val( '' );\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t} );\n\n\t/**\n\t * Address Field options\n\t */\n\tviews.FieldAddressOptions = views.FieldTextOptions.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/address-options' )\n\t} );\n\n\t/**\n\t * Phone Field options\n\t */\n\tviews.FieldPhoneOptions = views.FieldTextOptions.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/phone-options' )\n\t} );\n\n\t/**\n\t * Email Field options\n\t */\n\tviews.FieldEmailOptions = views.FieldTextOptions.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/email-options' )\n\t} );\n\n\t/**\n\t * Link Field options\n\t */\n\tviews.FieldLinkOptions = views.FieldTextOptions.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/link-options' )\n\t} );\n\n\n\t/**\n\t * Group item in modal dropdown\n\t */\n\tviews.GroupItem = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/modal-group-item' ),\n\t\tclassName: 'tvd-global-fields-group',\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {model: this.model} ) );\n\n\t\t\treturn this;\n\t\t}\n\t} );\n\n\t/**\n\t * Field type item in modal dropdown\n\t */\n\tviews.FieldTypeItem = views.Base.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/modal-type-item' ),\n\t\tclassName: 'tvd-global-fields-type',\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {model: this.model} ) );\n\n\t\t\treturn this;\n\t\t}\n\t} );\n\n\n\t/**\n\t * Location Field options\n\t */\n\tviews.FieldLocationOptions = views.FieldTextOptions.extend( {\n\t\ttemplate: TVE_Dash.tpl( 'global-fields/location-options' ),\n\t\tevents: {\n\t\t\t'change .input-change': 'setInputData'\n\t\t},\n\t\trender: function () {\n\t\t\tthis.$el.html( this.template( {model: this.model} ) );\n\t\t\tthis.setInputData();\n\t\t\treturn this;\n\t\t},\n\t\tsetInputData: function () {\n\t\t\tvar url = 'https://maps.google.com/maps?q=' + encodeURI( this.model.get( 'data' ).location ? this.model.get( 'data' ).location : 'New York' ) + '&t=m&z=10&output=embed&iwloc=near';\n\t\t\tthis.$( '#tvd-tss-google-map' ).html( '<iframe frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"' + url + '\"></iframe>' );\n\t\t}\n\t} );\n\n\tmodule.exports = views;\n\n} )( jQuery );\n//# sourceURL=thrive-dashboard/inc/smart-site/assets/admin/js/views.js");
							}
						}
					}
				}
			}
		}
	}
})("thrive-dashboard/inc/smart-site/assets/admin/js/routes");
