Current Path : /home/church/www/ntktesting.com/wp-content/plugins/ninja-forms/assets/js/min/ |
Current File : /home/church/www/ntktesting.com/wp-content/plugins/ninja-forms/assets/js/min/dashboard.min.js.map |
{"version":3,"names":[],"mappings":"","sources":["views/widgets/forms/newFormTemplate.js"],"sourcesContent":["!function(){var e,t,n;!function(i){function o(e,t){return y.call(e,t)}function s(e,t){var n,i,o,s,a,r,l,d,c,u,h,m=t&&t.split(\"/\"),p=v.map,f=p&&p[\"*\"]||{};if(e&&\".\"===e.charAt(0))if(t){for(e=e.split(\"/\"),a=e.length-1,v.nodeIdCompat&&j.test(e[a])&&(e[a]=e[a].replace(j,\"\")),e=m.slice(0,m.length-1).concat(e),c=0;c<e.length;c+=1)if(\".\"===(h=e[c]))e.splice(c,1),c-=1;else if(\"..\"===h){if(1===c&&(\"..\"===e[2]||\"..\"===e[0]))break;c>0&&(e.splice(c-1,2),c-=2)}e=e.join(\"/\")}else 0===e.indexOf(\"./\")&&(e=e.substring(2));if((m||f)&&p){for(n=e.split(\"/\"),c=n.length;c>0;c-=1){if(i=n.slice(0,c).join(\"/\"),m)for(u=m.length;u>0;u-=1)if((o=p[m.slice(0,u).join(\"/\")])&&(o=o[i])){s=o,r=c;break}if(s)break;!l&&f&&f[i]&&(l=f[i],d=c)}!s&&l&&(s=l,r=d),s&&(n.splice(0,r,s),e=n.join(\"/\"))}return e}function a(e,t){return function(){var n=C.call(arguments,0);return\"string\"!=typeof n[0]&&1===n.length&&n.push(null),m.apply(i,n.concat([e,t]))}}function r(e){return function(t){return s(t,e)}}function l(e){return function(t){w[e]=t}}function d(e){if(o(g,e)){var t=g[e];delete g[e],b[e]=!0,h.apply(i,t)}if(!o(w,e)&&!o(b,e))throw new Error(\"No \"+e);return w[e]}function c(e){var t,n=e?e.indexOf(\"!\"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function u(e){return function(){return v&&v.config&&v.config[e]||{}}}var h,m,p,f,w={},g={},v={},b={},y=Object.prototype.hasOwnProperty,C=[].slice,j=/\\.js$/;p=function(e,t){var n,i=c(e),o=i[0];return e=i[1],o&&(o=s(o,t),n=d(o)),o?e=n&&n.normalize?n.normalize(e,r(t)):s(e,t):(e=s(e,t),i=c(e),o=i[0],e=i[1],o&&(n=d(o))),{f:o?o+\"!\"+e:e,n:e,pr:o,p:n}},f={require:function(e){return a(e)},exports:function(e){var t=w[e];return void 0!==t?t:w[e]={}},module:function(e){return{id:e,uri:\"\",exports:w[e],config:u(e)}}},h=function(e,t,n,s){var r,c,u,h,m,v,y=[],C=typeof n;if(s=s||e,\"undefined\"===C||\"function\"===C){for(t=!t.length&&n.length?[\"require\",\"exports\",\"module\"]:t,m=0;m<t.length;m+=1)if(h=p(t[m],s),\"require\"===(c=h.f))y[m]=f.require(e);else if(\"exports\"===c)y[m]=f.exports(e),v=!0;else if(\"module\"===c)r=y[m]=f.module(e);else if(o(w,c)||o(g,c)||o(b,c))y[m]=d(c);else{if(!h.p)throw new Error(e+\" missing \"+c);h.p.load(h.n,a(s,!0),l(c),{}),y[m]=w[c]}u=n?n.apply(w[e],y):void 0,e&&(r&&r.exports!==i&&r.exports!==w[e]?w[e]=r.exports:u===i&&v||(w[e]=u))}else e&&(w[e]=n)},e=t=m=function(e,t,n,o,s){if(\"string\"==typeof e)return f[e]?f[e](t):d(p(e,t).f);if(!e.splice){if(v=e,v.deps&&m(v.deps,v.callback),!t)return;t.splice?(e=t,t=n,n=null):e=i}return t=t||function(){},\"function\"==typeof n&&(n=o,o=s),o?h(i,e,t,n):setTimeout(function(){h(i,e,t,n)},4),m},m.config=function(e){return m(e)},e._defined=w,n=function(e,t,n){if(\"string\"!=typeof e)throw new Error(\"See almond README: incorrect module build, no module name\");t.splice||(n=t,t=[]),o(w,e)||o(g,e)||(g[e]=[e,t,n])},n.amd={jQuery:!0}}(),n(\"../../assets/js/lib/almond\",function(){}),n(\"models/formModel\",[],function(){return Backbone.Model.extend({defaults:{objectType:\"form\",id:0,title:\"unknown\",created_at:\"unknown\"},url:function(){return ajaxurl+\"?action=nf_forms&form_id=\"+this.get(\"id\")},initialize:function(){this.set(\"id\",Number(this.get(\"id\"))),this.get(\"id\")&&this.initShortcode(this.get(\"id\")),this.get(\"title\")&&this.set(\"title\",this.get(\"title\").replace(/<\\/?[^>]+(>|$)/g,\"\"))},initShortcode:function(e){var t=\"[ninja_form id=\"+e+\"]\";this.set(\"shortcode\",t)},destroy:function(){var e=this;jQuery.ajax({type:\"POST\",url:ajaxurl+\"?action=nf_forms&method_override=delete&form_id=\"+this.get(\"id\")+\"&security=\"+nfAdmin.ajaxNonce,success:function(t){var t=JSON.parse(t);e.collection.remove(e)}})}})}),n(\"models/formCollection\",[\"models/formModel\"],function(e){return Backbone.Collection.extend({model:e,comparator:\"title\",tmpNum:1,url:function(){return ajaxurl+\"?action=nf_forms&security=\"+nfAdmin.ajaxNonce},initialize:function(){this.newIDs=[],this.baseUrl=window.location.href.split(\"?\")[0],this.listenTo(i.channel(\"dashboard\"),\"forms:delete\",this.modalConfirm),this.listenTo(i.channel(\"dashboard\"),\"forms:duplicate\",this.duplicate),this.modal=new jBox(\"Modal\",{width:400,addClass:\"dashboard-modal\",overlay:!0,closeOnClick:\"body\"})},parse:function(e,t){return e.data.hasOwnProperty(\"error\")?(alert(e.data.error),null):e.data},modalConfirm:function(e){var t,n,i,o,s,a,r,l=e.model.get(\"id\"),d=e.model.get(\"title\");n=document.createElement(\"div\"),n.style.paddingRight=\"20px\",n.style.paddingLeft=\"20px\",n.style.paddingBottom=\"20px\",i=document.createElement(\"p\"),o=document.createElement(\"em\"),s=document.createElement(\"div\"),a=document.createElement(\"button\"),r=document.createElement(\"div\"),n.classList.add(\"message\"),o.innerHTML=d,i.innerHTML+=nfi18n.deleteWarningA+\" (<strong>\"+d+\"</strong>). \"+nfi18n.deleteWarningB,i.appendChild(document.createElement(\"br\")),i.appendChild(document.createElement(\"br\"));var c=document.createElement(\"a\");c.href=this.baseUrl+\"?page=nf-import-export&exportFormId=\"+l,c.innerHTML='<i class=\"fa fa-download\" style=\"padding:5px;\"></i>'+nfi18n.deleteXForm,c.target=\"_blank\",i.appendChild(c),i.appendChild(document.createElement(\"br\"));var u=document.createElement(\"a\");u.href=this.baseUrl+\"?page=nf-processing&action=download_all_subs&form_id=\"+l+\"&redirect=\"+encodeURIComponent(this.baseUrl.replace(\"admin.php\",\"edit.php\")+\"?post_status=all&post_type=nf_sub&form_id=\"+l),u.target=\"_blank\",u.innerHTML='<i class=\"fa fa-download\" style=\"padding:5px;\"></i>'+nfi18n.deleteXSubs,i.appendChild(u),i.appendChild(document.createElement(\"br\")),n.appendChild(i);var h=document.createElement(\"label\");h.for=\"confirmDeleteFormInput\",h.innerHTML=nfi18n.deleteConfirmA+' <span style=\"color:red;\">DELETE</span> '+nfi18n.deleteConfirmB;var m=document.createElement(\"input\");m.type=\"text\",m.id=\"confirmDeleteFormInput\",m.style.marginTop=\"10px\",m.style.width=\"100%\",m.style.height=\"2.5em\",m.style.fontSize=\"1em\",n.appendChild(h),n.appendChild(document.createElement(\"br\")),n.appendChild(m),n.appendChild(document.createElement(\"br\")),n.appendChild(document.createElement(\"br\")),a.innerHTML=nfi18n.delete,a.classList.add(\"confirm\",\"nf-button\",\"primary\",\"pull-right\"),r.innerHTML=nfi18n.cancel,r.classList.add(\"cancel\",\"nf-button\",\"secondary\"),s.appendChild(r),s.appendChild(a),s.classList.add(\"buttons\"),n.appendChild(s),t=document.createElement(\"div\"),t.appendChild(n),this.modal.setContent(t.innerHTML),this.modal.setTitle(nfi18n.deleteTitle),this.modal.open();var p=this;this.modal.container[0].getElementsByClassName(\"cancel\")[0].addEventListener(\"click\",function(){p.modalClose()}),this.modal.container[0].getElementsByClassName(\"confirm\")[0].addEventListener(\"click\",function(t){t.preventDefault(),\"DELETE\"===document.getElementById(\"confirmDeleteFormInput\").value?p.confirmDelete(e):p.modalClose()})},modalClose:function(){this.modal.close()},confirmDelete:function(e){jQuery(e.el).removeClass(\"show-actions\"),jQuery(e.el).addClass(\"deleting\"),jQuery(e.el).animate({opacity:0,\"line-height\":0,display:\"none\"},500),console.log(e),e.model.destroy(),this.modalClose()},duplicate:function(e){var t='<div class=\"message\">Duplicating <em>'+e.model.get(\"title\")+'</em>...<div class=\"nf-loading-spinner\"></div></div>';this.modal.setContent(t),this.modal.setTitle(\"Please Wait\"),this.modal.open();var n=this;jQuery.ajax({type:\"POST\",url:ajaxurl+\"?action=nf_forms&clone_id=\"+e.model.get(\"id\")+\"&security=\"+nfAdmin.ajaxNonce,success:function(t){var t=JSON.parse(t);if(t.data.hasOwnProperty(\"error\"))alert(t.data.error);else{var i=t.data.new_form_id,o=e.model.clone();o.set({id:i,title:o.get(\"title\")+\" - copy\",created_at:new Date}),o.initShortcode(i),e.model.collection.add(o)}n.modalClose()}})}})}),n(\"controllers/formsController\",[\"models/formModel\",\"models/formCollection\"],function(e,t){return Marionette.Object.extend({initialize:function(){this.forms=new t,i.channel(\"dashboard\").reply(\"get:forms\",this.getForms,this),this.forms.fetch({success:function(e){i.channel(\"dashboard\").trigger(\"fetch:forms\",e)}})},getForms:function(){return this.forms}})}),n(\"models/oauthModel\",[],function(){return Backbone.Model.extend({defaults:{connected:null,connect_url:\"\"},url:function(){return ajaxurl+\"?action=nf_oauth\"},initialize:function(){},parse:function(e,t){return e.data}})}),n(\"controllers/oauthController\",[\"models/oauthModel\"],function(e){return Marionette.Object.extend({initialize:function(){this.oauth=new e,i.channel(\"dashboard\").reply(\"get:oauth\",this.getOAuth,this),i.channel(\"dashboard\").reply(\"disconnect:oauth\",this.disconnect,this),i.channel(\"dashboard\").reply(\"oauth:learn-more\",this.learnMoreModal,this),this.initOAuth()},getOAuth:function(){return this.oauth},initOAuth:function(){this.oauth.fetch({success:function(e){i.channel(\"dashboard\").trigger(\"fetch:oauth\")}})},disconnect:function(){var e=this;new jBox(\"Confirm\",{width:750,content:nfi18n.oauthDisconnectContent,confirmButton:nfi18n.oauthDisconnectConfirm,cancelButton:nfi18n.oauthDisconnectCancel,closeOnConfirm:!0,confirm:function(){jQuery.ajax({type:\"POST\",url:ajaxurl+\"?action=nf_oauth_disconnect&nonce=\"+nfAdmin.disconnectNonce,success:function(t){e.initOAuth()}})}}).open()},learnMoreModal:function(){new jBox(\"Modal\",{width:500,content:nfi18n.oauthLearnMoreContent}).open()}})}),n(\"models/serviceModel\",[],function(){return Backbone.Model.extend({defaults:{objectType:\"service\",name:\"\",slug:\"\",installPath:\"\",description:\"\",enabled:null,infoLink:null,serviceLink:null,is_installing:!1,classes:\"\"},url:function(){return ajaxurl+\"?action=nf_service_\"+this.get(\"slug\")},initialize:function(){this.get(\"slug\")==serviceSuccess&&this.get(\"successMessage\")&&new jBox(\"Modal\",{width:300,addClass:\"dashboard-modal\",overlay:!0,closeOnClick:!0,content:this.get(\"successMessage\"),title:this.get(\"successMessageTitle\"),closeButton:\"box\"}).open();var e=this;i.channel(\"dashboard\").reply(\"install:service:\"+this.get(\"slug\"),function(){if(e.get(\"serviceLink\")&&e.get(\"serviceLink\").href){var t=e.get(\"serviceLink\").href;new jBox(\"Modal\",{width:300,addClass:\"dashboard-modal\",overlay:!0,closeOnClick:\"body\",content:nfi18n.serviceRedirect}).open();var n=i.channel(\"dashboard\").request(\"get:oauth\");if(n.get(\"connected\"))window.location=t;else{if(e.get(\"connect_url\"))return window.location=e.get(\"connect_url\")+\"&redirect=\"+t;window.location=n.get(\"connect_url\")+\"&redirect=\"+t}}})},save:function(){var e=this;jQuery.ajax({type:\"POST\",url:this.url(),data:this.toJSON()}).done(function(t){var n=JSON.parse(t);void 0!==n.error&&(alert(nfi18n.serviceUpdateError+\" \"+n.error),e.set(\"enabled\",!e.get(\"enabled\"))),i.channel(\"dashboard\").trigger(\"save:service-\"+e.get(\"slug\"))})}})}),n(\"models/serviceCollection\",[\"models/serviceModel\"],function(e){return Backbone.Collection.extend({model:e,comparator:\"name\",url:function(){return ajaxurl+\"?action=nf_services\"},initialize:function(){},parse:function(e,t){return e.data}})}),n(\"controllers/servicesController\",[\"models/serviceCollection\"],function(e){return Marionette.Object.extend({initialize:function(){this.services=new e,i.channel(\"dashboard\").reply(\"install:service\",this.installService,this),i.channel(\"dashboard\").reply(\"get:services\",this.getServices,this),this.fetchServices()},getServices:function(){return this.services},fetchServices:function(e){this.services.fetch({success:function(t){e&&e(t),i.channel(\"dashboard\").trigger(\"fetch:services\")}})},installService:function(e){var t=this;if(!(e instanceof Backbone.Model))var e=this.services.find(function(t){return e==t.get(\"slug\")});e.set(\"is_installing\",!0);var n=e.get(\"slug\"),o=e.get(\"installPath\");jQuery.post(ajaxurl,{action:\"nf_services_install\",security:nfAdmin.ajaxNonce,plugin:n,install_path:o},function(e){if(\"sendwp\"!==n&&\"ninja-forms-addon-manager\"!==n)return!1;t.fetchServices(function(){if(\"sendwp\"===n)return ninja_forms_sendwp_remote_install();i.channel(\"dashboard\").request(\"install:service:\"+n)})})}})}),n(\"models/formTemplateModel\",[],function(){return Backbone.Model.extend({defaults:{objectType:\"template\",id:\"none\",title:\"unknown\",type:\"\"},initialize:function(){this.set(\"desc\",this.get(\"template-desc\")),this.set(\"modal-content\",this.get(\"modal-content\")),this.set(\"modal-title\",this.get(\"modal-title\"))}})}),n(\"models/formTemplateCollection\",[\"models/formTemplateModel\"],function(e){return Backbone.Collection.extend({model:e,tmpNum:1,url:function(){return ajaxurl+\"?action=nf_new_form_templates&security=\"+nfAdmin.ajaxNonce},parse:function(e,t){return e.data.hasOwnProperty(\"error\")?(alert(e.data.error),null):e.data},initialize:function(){this.fetch({success:function(e){},error:function(e){}})}})}),n(\"controllers/templatesController\",[\"models/formTemplateModel\",\"models/formTemplateCollection\"],function(e,t){return Marionette.Object.extend({initialize:function(){this.templates=new t,this.installed=new Backbone.Collection,this.available=new Backbone.Collection,i.channel(\"dashboard\").reply(\"get:formTemplates\",this.getTemplates,this),i.channel(\"dashboard\").reply(\"get:installedFormTemplates\",this.getInstalledTemplates,this),i.channel(\"dashboard\").reply(\"get:availableFormTemplates\",this.getAvailableTemplates,this),this.listenTo(i.channel(\"dashboard\"),\"fetch:formTemplates\",this.sortTemplates,this),this.templates.fetch({success:function(e){i.channel(\"dashboard\").trigger(\"fetch:formTemplates\",e)}})},getTemplates:function(){return this.templates},getInstalledTemplates:function(){return this.installed},getAvailableTemplates:function(){return this.available},sortTemplates:function(e){var t=this;e.each(function(e){void 0!==e.get(\"type\")&&(\"ad\"==e.get(\"type\")?t.available.add(new Backbone.Model(e.toJSON())):t.installed.add(new Backbone.Model(e.toJSON())))}),i.channel(\"dashboard\").trigger(\"sort:installedFormTemplates\",t.installed),i.channel(\"dashboard\").trigger(\"sort:availableFormTemplates\",t.available)}})}),n(\"views/widgets/forms/formsFilter\",[],function(){return Marionette.View.extend({template:\"#tmpl-nf-widget-forms-filter\",ui:{input:\"input\"},events:{\"keyup @ui.input\":\"updateFilter\"},initialize:function(){this.listenTo(i.channel(\"widget-forms\"),\"change:content\",this.clearFilter)},updateFilter:function(){var e=this.getUI(\"input\").val();i.channel(\"widget-forms\").trigger(\"update:filter\",e)},clearFilter:function(){this.getUI(\"input\").val(\"\")},updatePlaceholder:function(e){this.getUI(\"input\").attr(\"placeholder\",e)}})}),n(\"views/widgets/forms/formsTableRow\",[],function(){return Marionette.View.extend({template:\"#tmpl-nf-widget-forms-table-row\",tagName:\"tr\",replaceElement:!0,ui:{delete:\".delete\",duplicate:\".duplicate\",edit:\".nf-item-edit\"},events:{\"click @ui.delete\":function(){i.channel(\"dashboard\").trigger(\"forms:delete\",this)},\"click @ui.duplicate\":function(){i.channel(\"dashboard\").trigger(\"forms:duplicate\",this)},\"click @ui.edit\":function(e){this.$el.toggleClass(\"show-actions\").siblings().removeClass(\"show-actions\")}},templateContext:function(){var e=this.model;return{created_at:moment(e.get(\"created_at\")).format(\"MM/DD/YY h:mm A\")}}})}),n(\"views/widgets/forms/formsTableEmpty\",[],function(){return Marionette.View.extend({template:\"#tmpl-nf-widget-forms-table-empty\",tagName:\"tr\"})}),n(\"views/widgets/forms/formsTableBody\",[\"views/widgets/forms/formsTableRow\",\"views/widgets/forms/formsTableEmpty\"],function(e,t){return Marionette.CollectionView.extend({childView:e,emptyView:t,className:\"forms-collection\",tagName:\"tbody\",initialize:function(){this.listenTo(i.channel(\"widget-forms\"),\"update:filter\",this.updateFilter)},updateFilter:function(e){this.setFilter(function(t,n,i){return 0<=t.get(\"title\").toLowerCase().indexOf(e.toLowerCase())})}})}),n(\"views/widgets/forms/formsTableLoading\",[],function(){return Marionette.View.extend({template:\"#tmpl-nf-widget-forms-table-loading\",tagName:\"tr\"})}),n(\"views/widgets/forms/formsTable\",[\"views/widgets/forms/formsTableBody\",\"views/widgets/forms/formsTableLoading\",\"models/formCollection\"],function(e,t,n){return Marionette.View.extend({template:\"#tmpl-nf-widget-forms-table\",className:\"nf-table-display\",tagName:\"table\",initialize:function(){var t=this;this.listenTo(i.channel(\"dashboard\"),\"fetch:forms\",function(n){t.showChildView(\"body\",new e({collection:n}))})},regions:{body:{el:\"tbody\",replaceElement:!0}},ui:{sortable:\".sortable\",body:\"tbody\",action2:\".action2\",more:\".more\",less:\".less\"},onRender:function(){this.getUI(\"less\").hide();var n=i.channel(\"dashboard\").request(\"get:forms\");void 0===n?this.showChildView(\"body\",new t):this.showChildView(\"body\",new e({collection:n})),this.maybeHideMoreButton()},events:{\"click @ui.sortable\":\"sortFormsTable\",\"click @ui.more\":\"showMore\",\"click @ui.less\":\"showLess\"},sortFormsTable:function(e){this.getUI(\"sortable\").removeClass(\"sorted-asc\"),this.getUI(\"sortable\").removeClass(\"sorted-desc\");var t=jQuery(e.target).data(\"sort\"),n=jQuery(e.target).data(\"reverse\")||0;n?(jQuery(e.target).addClass(\"sorted-desc\"),jQuery(e.target).removeClass(\"sorted-asc\")):(jQuery(e.target).addClass(\"sorted-asc\"),jQuery(e.target).removeClass(\"sorted-desc\"));var i=this.getChildView(\"body\").collection;i.comparator=function(e,i){return name1=e.get(t).toLowerCase(),name2=i.get(t).toLowerCase(),name1<name2?ret=-1:name1>name2?ret=1:ret=0,n&&(ret=-ret),ret},i.sort(),n?(i.models.reverse(),jQuery(e.target).data(\"reverse\",0)):jQuery(e.target).data(\"reverse\",1)},showMore:function(){this.getUI(\"more\").hide(),this.getUI(\"less\").show(),this.getUI(\"body\").addClass(\"more\")},showLess:function(){this.getUI(\"less\").hide(),this.getUI(\"more\").show(),this.getUI(\"body\").removeClass(\"more\")},maybeHideMoreButton:function(){void 0!==this.collection&&10<this.collection.length||this.getUI(\"action2\").hide()}})}),n(\"views/widgets/forms/newFormTemplate\",[],function(){return Marionette.View.extend({template:\"#tmpl-nf-widget-forms-template\",events:{click:\"maybeOpenModal\"},maybeOpenModal:function(e){if(e.preventDefault(),\"ad\"===this.model.get(\"type\")||\"autogenerate\"===this.model.get(\"type\")){new jBox(\"Modal\",{width:450,title:this.model.get(\"modal-title\"),content:this.model.get(\"modal-content\"),closeButton:\"box\",blockScroll:!0}).open()}else{var t={batch_type:\"import_form_template\",loadingText:\"Importing...\",extraData:{template:this.model.get(\"id\")},onCompleteCallback:function(e){if(void 0===e.form_id)return!1;window.location.href=nfAdmin.builderURL+e.form_id}};new NinjaBatchProcessor(t)}}})}),n(\"views/widgets/forms/newFormSection\",[\"models/formTemplateCollection\",\"views/widgets/forms/newFormTemplate\"],function(e,t){return Marionette.CollectionView.extend({tagName:\"div\",className:\"template-list\",childView:t,initialize:function(){this.listenTo(i.channel(\"widget-forms\"),\"update:filter\",this.updateFilter)},updateFilter:function(e){nfi18n.noResult===this.el.innerHTML&&(this.el.innerHTML=\"\"),this.setFilter(function(t,n,i){return 0<=t.get(\"title\").toLowerCase().indexOf(e.toLowerCase())}),0==this.children.length&&(this.el.innerHTML=nfi18n.noResult)}})}),n(\"views/widgets/forms/newFormGrid\",[\"views/widgets/forms/newFormSection\"],function(e){return Marionette.View.extend({template:\"#tmpl-nf-widget-templates-grid\",className:\"nf-template-grid\",tagName:\"div\",initialize:function(){var t=this;this.listenTo(i.channel(\"dashboard\"),\"sort:installedFormTemplates\",function(n){t.showChildView(\"installed\",new e({collection:n}))}),this.listenTo(i.channel(\"dashboard\"),\"sort:availableFormTemplates\",function(n){t.showChildView(\"available\",new e({collection:n}))})},regions:{installed:{el:\".installed\",replaceElement:!0},available:{el:\".available\",replaceElement:!0}},onRender:function(){void 0!==i.channel(\"dashboard\").request(\"get:formTemplates\")&&(this.showChildView(\"installed\",new e({collection:i.channel(\"dashboard\").request(\"get:installedFormTemplates\")})),this.showChildView(\"available\",new e({collection:i.channel(\"dashboard\").request(\"get:availableFormTemplates\")})))}})}),n(\"views/widgets/forms/forms\",[\"views/widgets/forms/formsFilter\",\"views/widgets/forms/formsTable\",\"views/widgets/forms/newFormGrid\"],function(e,t,n){return Marionette.View.extend({template:\"#tmpl-nf-widget-forms\",regions:{filter:\".filter\",content:\".content\"},ui:{add:\".add\",cancel:\".cancel\"},initialize:function(){},onRender:function(){this.getUI(\"cancel\").hide(),this.showChildView(\"filter\",new e),\"#new-form\"==window.location.hash?(this.getUI(\"add\").hide(),this.getUI(\"cancel\").show(),this.showChildView(\"content\",new n)):this.showChildView(\"content\",new t)},events:{\"click @ui.add\":\"showNewFormGrid\",\"click @ui.cancel\":\"showFormsTable\"},showNewFormGrid:function(){window.location.hash=\"new-form\",this.showChildView(\"content\",new n),i.channel(\"widget-forms\").trigger(\"change:content\"),this.getUI(\"add\").hide(),this.getUI(\"cancel\").show(),this.getChildView(\"filter\").updatePlaceholder(\"Search Templates\")},showFormsTable:function(){window.location.hash=\"forms\",this.showChildView(\"content\",new t),i.channel(\"widget-forms\").trigger(\"change:content\"),this.getUI(\"cancel\").hide(),this.getUI(\"add\").show(),this.getChildView(\"filter\").updatePlaceholder(\"Search Forms\")}})}),n(\"views/sections/widgets.js\",[\"views/widgets/forms/forms\"],function(e){return Marionette.View.extend({template:\"#tmpl-nf-widgets\",regions:{forms:\".widget-forms\"},onRender:function(){this.showChildView(\"forms\",new e)}})}),n(\"views/services/service\",[],function(){return Marionette.View.extend({template:\"#tmpl-nf-service\",className:function(){return\"nf-extend nf-box \"+this.model.get(\"classes\")},ui:{install:\".js--install\",learnMore:\".js--learn-more\",enabled:\".nf-toggle.setting\",toggleEnable:\".nf-toggle + label\"},events:{\"click @ui.install\":function(){i.channel(\"dashboard\").request(\"install:service\",this.model)},\"click @ui.learnMore\":function(){this.showLearnMore()},\"click @ui.toggleEnable\":function(){if(null==this.model.get(\"enabled\")&&this.model.get(\"link\"))return window.location=this.model.get(\"link\"),this.render();this.model.set(\"enabled\",!this.model.get(\"enabled\")),this.model.save(\"enabled\"),this.render()}},initialize:function(e){this.updateOAuth(),this.listenTo(this.model,\"change\",this.render),i.channel(\"dashboard\").reply(\"more:service:\"+this.model.get(\"slug\"),this.showLearnMore,this),this.listenTo(i.channel(\"dashboard\"),\"fetch:oauth\",this.updateOAuth),this.listenTo(i.channel(\"dashboard\"),\"save:service-\"+this.model.get(\"slug\"),this.render)},showLearnMore:function(){var e=new jBox(\"Modal\",{width:750,title:this.model.get(\"learnMoreTitle\")||this.model.get(\"name\"),content:this.model.get(\"learnMore\"),closeButton:\"box\",blockScroll:!0});e.open(),i.channel(\"dashboard\").reply(\"service:\"+this.model.get(\"slug\")+\":modal\",function(){return e})},updateOAuth:function(){var e=i.channel(\"dashboard\").request(\"get:oauth\");this.connected=e.get(\"connected\"),this.render()},templateContext:function(){return{is_connected:this.connected}}})}),n(\"views/services/services\",[\"views/services/service\",\"models/serviceCollection\"],function(e,t){return Marionette.CollectionView.extend({collection:new t,className:\"wrap apps-container\",childView:e,initialize:function(){this.updateCollection(),this.listenTo(i.channel(\"dashboard\"),\"fetch:services\",this.updateCollection)},updateCollection:function(){this.collection=i.channel(\"dashboard\").request(\"get:services\"),this.render()}})}),n(\"views/sections/services.js\",[\"views/services/services\"],function(e){return Marionette.View.extend({template:\"#tmpl-nf-services\",regions:{services:\".services\"},onRender:function(){this.showChildView(\"services\",new e)}})}),n(\"views/sections/apps.js\",[],function(){return Marionette.View.extend({template:\"#tmpl-nf-apps\"})}),n(\"views/oauth.js\",[\"models/oauthModel\"],function(e){return Marionette.View.extend({model:new e,template:\"#tmpl-nf-notices-oauth\",className:\"nf-notices--oauth\",ui:{disconnect:\".js--disconnect\"},initialize:function(e){this.listenTo(i.channel(\"dashboard\"),\"fetch:oauth\",this.updateModel)},updateModel:function(){this.model=i.channel(\"dashboard\").request(\"get:oauth\"),this.render()},events:{\"click @ui.disconnect\":function(){i.channel(\"dashboard\").request(\"disconnect:oauth\")}}})}),n(\"models/promotionModel\",[],function(){return Backbone.Model.extend({defaults:{id:\"\",content:\"\"},initialize:function(){}})}),n(\"views/promotion.js\",[\"models/promotionModel\"],function(e){return Marionette.View.extend({model:null,template:\"#tmpl-nf-promotion\",className:\"nf-promotion\",initialize:function(){if(\"undefined\"!=typeof nfPromotions){var t=nfPromotions[Math.floor(Math.random()*nfPromotions.length)];this.model=new e(t)}}})}),n(\"views/sections/requiredUpdates.js\",[],function(){return Marionette.View.extend({template:\"#tmpl-nf-requiredUpdates\",updates:[],currentUpdate:0,totalUpdates:-1,updatesRemaining:-1,ui:{requiredUpdates:\".nf-required-update\"},onRender:function(){this.getRequiredUpdates()},setButtonClickEvent:function(){var e=this;jQuery(\"#nf-required-updates-btn\").off(\"click\").on(\"click\",function(t){t.preventDefault(),e.doRequiredUpdates(),jQuery(this).hide()})},getRequiredUpdates:function(){var e=this;jQuery.get(ajaxurl,{action:\"nf_required_update\"}).then(function(t){var n=JSON.parse(t);0===n.errors.length&&(e.totalUpdates=n.data.updates.length,e.updates=n.data.updates,0<e.updates.length?(e.requiredUpdates=e.updates.length,e.constructUpdateTable(),e.setButtonClickEvent()):window.location=window.location.origin+window.location.pathname+window.location.search)})},constructUpdateTable:function(){var e=this,t=document.getElementById(\"nf-upgrades-table\"),n=t.getElementsByTagName(\"thead\")[0],i=document.createElement(\"tr\"),o=document.createElement(\"th\");o.innerHTML=\"Update\",o.classList.add(\"nf-update-name-cell\");var s=document.createElement(\"th\");s.innerHTML=\"Progress\",s.classList.add(\"nf-update-progress-cell\"),i.appendChild(o),i.appendChild(s),n.appendChild(i);var a=t.getElementsByTagName(\"tbody\")[0];jQuery.each(this.updates,function(t,n){var i=document.createElement(\"tr\"),o=document.createElement(\"td\");o.innerHTML=n.nicename;var s=document.createElement(\"td\"),r=document.createElement(\"div\");r.id=\"update-progress-\"+t;var l=e.createNewProgressBar(t);r.appendChild(l),s.appendChild(r),i.appendChild(o),i.appendChild(s),a.appendChild(i)}),document.getElementById(\"nf-required-updates-btn\").style.display=\"block\"},doRequiredUpdates:function(){window.location.hash=\"#requiredUpdates\";var e=this;jQuery(\"#nf-required-updates-btn\").addClass(\"disabled\").prop(\"disabled\",\"disabled\"),jQuery.post(ajaxurl,{action:\"nf_required_update\",security:nfAdmin.updateNonce}).then(function(t){var n=JSON.parse(t);n.updatesRemaining>0?(e.updatesRemaining!==n.updatesRemaining&&n.currentStep===n.stepsTotal?(e.finishUpdate(e.currentUpdate),e.updatesRemaining=n.updatesRemaining):(e.showProgressBars(n),e.updatesRemaining=n.updatesRemaining),e.doRequiredUpdates()):(e.finishUpdate(e.currentUpdate),nfAdmin.requiredUpdates=0,jQuery(\"#nf-required-updates-btn\").removeClass(\"disabled\").prop(\"disabled\",\"\").val(\"Go To Dashboard\").off(\"click\").on(\"click\",function(e){e.preventDefault(),window.location=window.location.origin+window.location.pathname+window.location.search}).show(),console.log(\"UPDATES DONE\"))})},showProgressBars:function(e){var t=this.totalUpdates-e.updatesRemaining,n=e.currentStep,i=e.stepsTotal,o=document.getElementById(\"nf_progressBar_\"+t);null==o&&(this.currentUpdate+=1,1===this.currentUpdate&&-1===this.totalUpdates&&(this.totalUpdates=t),o=this.createNewProgressBar(t)),this.incrementProgress(t,n,i)},createNewProgressBar:function(e){var t=document.createElement(\"div\");t.id=\"nf_progressBar_\"+e,t.classList.add(\"jBox-content\"),t.style.display=\"none\";var n=document.createElement(\"div\");n.classList.add(\"nf-progress-bar\");var i=document.createElement(\"div\");return i.id=\"nf-progress-bar-slider-\"+e,i.classList.add(\"nf-progress-bar-slider\"),n.appendChild(i),t.appendChild(n),t},incrementProgress:function(e,t,n){document.getElementById(\"nf_progressBar_\"+e).style.display=\"block\";var i=document.getElementById(\"nf-progress-bar-slider-\"+e),o=Number(t)/Number(n)*100;o>i.offsetWidth/i.parentElement.offsetWidth*100&&this.setProgress(e,o)},setProgress:function(e,t){document.getElementById(\"nf-progress-bar-slider-\"+e).style.width=t+\"%\",100<=t&&this.finishUpdate(e)},finishUpdate:function(e){var t=document.getElementById(\"nf_progressBar_\"+e),n=t.parentNode;n.removeChild(t);var i=document.createElement(\"span\");i.classList.add(\"dashicons\"),i.classList.add(\"dashicons-yes\"),n.appendChild(i),this.currentUpdate=this.currentUpdate+1}})}),n(\"views/dashboardView\",[\"views/sections/widgets.js\",\"views/sections/services.js\",\"views/sections/apps.js\",\"views/oauth.js\",\"views/promotion.js\",\"views/sections/requiredUpdates.js\"],function(e,t,n,o,s,a){return Marionette.View.extend({template:\"#tmpl-nf-dashboard\",currentView:\"widgets\",regions:{notices:\".notices\",promotions:\".promotions\",content:\".content\"},events:{\"click .widgets a\":function(t){\"1\"!=nfAdmin.requiredUpdates&&(this.showChildView(\"content\",new e),jQuery(\".\"+this.currentView).find(\"a\").removeClass(\"active\"),t.target.classList.add(\"active\"),this.currentView=\"widgets\")},\"click .services a\":function(e){\"1\"!=nfAdmin.requiredUpdates&&(this.showChildView(\"content\",new t),jQuery(\".\"+this.currentView).find(\"a\").removeClass(\"active\"),e.target.classList.add(\"active\"),this.currentView=\"services\")},\"click .apps a\":function(e){\"1\"!=nfAdmin.requiredUpdates&&(this.showChildView(\"content\",new n),jQuery(\".\"+this.currentView).find(\"a\").removeClass(\"active\"),e.target.classList.add(\"active\"),this.currentView=\"apps\")}},initialize:function(){switch(\"1\"===nfAdmin.requiredUpdates?window.location.hash=\"#requiredUpdates\":\"#requiredUpdates\"===window.location.hash&&(window.location.hash=\"\"),window.location.hash){case\"#apps\":this.currentView=\"apps\";break;case\"#services\":this.currentView=\"services\";break;case\"#requiredUpdates\":this.currentView=\"requiredUpdates\";break;case\"#widgets\":default:this.currentView=\"widgets\"}i.channel(\"dashboard\").reply(\"show:widgets\",function(){\"1\"!=nfAdmin.requiredUpdates&&(this.showChildView(\"content\",new e),jQuery(\"nav.sections a.active\").removeClass(\"active\"),jQuery(\"nav.sections .widgets a\").addClass(\"active\"),this.currentView=\"widgets\")},this),i.channel(\"dashboard\").reply(\"show:services\",function(){\"1\"!=nfAdmin.requiredUpdates&&(this.showChildView(\"content\",new t),jQuery(\"nav.sections a.active\").removeClass(\"active\"),jQuery(\"nav.sections .services a\").addClass(\"active\"),this.currentView=\"services\")},this),i.channel(\"dashboard\").reply(\"show:apps\",function(){\"1\"!=nfAdmin.requiredUpdates&&(this.showChildView(\"content\",new n),jQuery(\"nav.sections a.active\").removeClass(\"active\"),jQuery(\"nav.sections .apps a\").addClass(\"active\"),this.currentView=\"apps\")},this)},onRender:function(){switch(useServices&&this.showChildView(\"notices\",new o),useServices&&\"1\"!==nfAdmin.requiredUpdates&&this.showChildView(\"promotions\",new s),\"0\"===nfAdmin.requiredUpdates&&\"#requiredUpdates\"===window.location.hash&&(window.location.hash=\"\"),window.location.hash){case\"#apps\":var i=new n;break;case\"#services\":var i=new t;break;case\"#requiredUpdates\":var i=new a;break;case\"#widgets\":default:var i=new e}if(this.showChildView(\"content\",i),\"1\"==nfAdmin.showOptin){var r=new jBox(\"Modal\",{closeOnEsc:!1,closeOnClick:!1,width:400}),l=document.createElement(\"div\");l.id=\"optin-modal-title\";var d=document.createElement(\"h2\");d.innerHTML=\"Help make Ninja Forms better!\",l.appendChild(d);var c=document.createElement(\"div\");c.classList.add(\"message\"),c.style.padding=\"0px 20px 20px 20px\",c.innerHTML=nfi18n.optinContent;var u=document.createElement(\"p\");u.style.paddingBottom=\"10px\";var h=document.createElement(\"input\");h.id=\"optin-send-email\",h.setAttribute(\"type\",\"checkbox\"),h.style.margin=\"7px\";var m=document.createElement(\"label\");m.setAttribute(\"for\",\"optin-send-email\"),m.innerHTML=nfi18n.optinYesplease,u.appendChild(h),u.appendChild(m),c.appendChild(u),u=document.createElement(\"p\"),u.id=\"optin-block\",u.style.padding=\"0px 5px 20px 5px\",u.style.display=\"none\";var p=document.createElement(\"input\");p.id=\"optin-email-address\",p.setAttribute(\"type\",\"text\"),p.setAttribute(\"value\",nfAdmin.currentUserEmail),p.style.width=\"100%\",p.style.fontSize=\"16px\",u.appendChild(p),c.appendChild(u);var f=document.createElement(\"span\");f.id=\"optin-spinner\",\nf.classList.add(\"spinner\"),f.style.display=\"none\",c.appendChild(f);var w=document.createElement(\"div\");w.id=\"optin-buttons\",w.classList.add(\"buttons\");var g=document.createElement(\"div\");g.id=\"optout\",g.classList.add(\"nf-button\",\"secondary\"),g.innerHTML=nfi18n.optinSecondary,w.appendChild(g);var v=document.createElement(\"div\");v.id=\"optin\",v.classList.add(\"nf-button\",\"primary\",\"pull-right\"),v.innerHTML=nfi18n.optinPrimary,w.appendChild(v),c.appendChild(w);var b=document.createElement(\"h2\");b.innerHTML=nfi18n.optinAwesome;var y=document.createElement(\"div\");y.id=\"optin-thankyou\",y.classList.add(\"message\"),y.style.padding=\"20px\",y.innerHTML=nfi18n.optinThanks,r.setContent(document.createElement(\"div\").appendChild(c).innerHTML),r.setTitle(document.createElement(\"div\").appendChild(l).innerHTML),r.open(),jQuery(\"#optin-send-email\").click(function(e){jQuery(this).is(\":checked\")?jQuery(\"#optin-block\").show():jQuery(\"#optin-block\").hide()}),jQuery(\"#optin\").click(function(e){var t;jQuery(\"#optin-send-email\").attr(\"checked\")?(t=1,userEmail=jQuery(\"#optin-email-address\").val()):(t=0,userEmail=\"\"),jQuery(\"#optin\").unbind(\"click\"),jQuery(\"#optout\").unbind(\"click\");var n=jQuery(\"#optin\").width();jQuery(\"#optin\").html('<span class=\"dashicons dashicons-update dashicons-update-spin\"></span>'),jQuery(\"#optin\").width(n),jQuery.post(ajaxurl,{action:\"nf_optin\",ninja_forms_opt_in:1,send_email:t,user_email:userEmail},function(e){r.setTitle(document.createElement(\"div\").appendChild(b).innerHTML),r.setContent(document.createElement(\"div\").appendChild(y).innerHTML),setTimeout(function(){r.close()},2e3)})}),jQuery(\"#optout\").click(function(e){jQuery(\"#optin\").unbind(\"click\"),jQuery(\"#optout\").unbind(\"click\");var t=jQuery(\"#optout\").width();jQuery(\"#optout\").html('<span class=\"dashicons dashicons-update dashicons-update-spin\"></span>'),jQuery(\"#optout\").width(t),jQuery.post(ajaxurl,{action:\"nf_optin\",ninja_forms_opt_in:0},function(e){r.close()})})}if(void 0!==nfAdmin.formTelemetry&&1==nfAdmin.formTelemetry){var C={action:\"nf_form_telemetry\",security:nfAdmin.ajaxNonce};jQuery.post(ajaxurl,C)}},templateContext:function(){var e=this;return{renderNav:function(){var t=document.createElement(\"div\");return _.each(nfDashItems,function(n){var i=document.createElement(\"li\"),o=document.createElement(\"a\");o.href=\"#\"+n.slug,e.currentView==n.slug&&o.classList.add(\"active\"),o.innerHTML=n.niceName,i.classList.add(n.slug),i.appendChild(o),t.appendChild(i)}),t.innerHTML}}}})});var i=Backbone.Radio;useServices||(nfDashItems=nfDashItems.filter(function(e){return\"services\"!==e.slug})),jQuery(document).ready(function(e){t([\"controllers/formsController\",\"controllers/oauthController\",\"controllers/servicesController\",\"controllers/templatesController\",\"views/dashboardView\"],function(t,n,i,o,s){(new(Marionette.Application.extend({region:\"#ninja-forms-dashboard\",controllers:{},initialize:function(e){var t=this;Marionette.Renderer.render=function(e,n){var e=t.template(e);return e(n)}},onStart:function(){this.showView(new s),this.controllers.forms=new t,this.controllers.templates=new o,useServices&&(this.controllers.oauth=new n),useServices&&(this.controllers.services=new i)},template:function(t){return _.template(e(t).html(),{evaluate:/<#([\\s\\S]+?)#>/g,interpolate:/\\{\\{\\{([\\s\\S]+?)\\}\\}\\}/g,escape:/\\{\\{([^\\}]+?)\\}\\}(?!\\})/g,variable:\"data\"})}}))).start()})}),jQuery('a[href=\"admin.php?page=ninja-forms#new-form\"]').on(\"click\",function(e){e.preventDefault(),\"1\"!==nfAdmin.requiredUpdates&&(window.location.hash=\"new-form\",i.channel(\"dashboard\").request(\"show:widgets\"),i.channel(\"widget-forms\").request(\"show:newFormsGrid\"))}),jQuery('a[href=\"admin.php?page=ninja-forms#apps\"]').on(\"click\",function(e){e.preventDefault(),\"1\"!==nfAdmin.requiredUpdates&&(window.location.hash=\"apps\",i.channel(\"dashboard\").request(\"show:apps\"))}),jQuery('a[href=\"admin.php?page=ninja-forms\"]').on(\"click\",function(e){e.preventDefault(),\"1\"!==nfAdmin.requiredUpdates&&(window.location.hash=\"forms\",i.channel(\"dashboard\").request(\"show:widgets\"),i.channel(\"widget-forms\").request(\"show:formsTable\"))}),jQuery(window).on(\"hashchange\",function(){var e=window.location.hash.substr(1);i.channel(\"dashboard\").request(\"show:\"+e)}),n(\"main\",function(){})}();"],"file":"dashboard.min.js"}