system-backend.min.js 93 KB
!function(e,t){function i(t){this.loadDefaults(),this.$=e(this),window.nextend[this.type+"Manager"]=this,this.modals=this.initModals(),this.lightbox=e("#n2-lightbox-"+this.type),this.notificationStack=new NextendNotificationCenterStack(this.lightbox.find(".n2-top-bar")),this.visualListContainer=this.lightbox.find(".n2-lightbox-sidebar-list"),this.parameters=t,this.visuals={},this.controller=this.initController(),this.controller&&(this.renderer=this.controller.renderer),this.firstLoadVisuals(t.visuals),e(".n2-"+this.type+"-save-as-new").on("click",e.proxy(this.saveAsNew,this)),this.cancelButton=e("#n2-"+this.type+"-editor-cancel").on("click",e.proxy(this.hide,this)),this.saveButton=e("#n2-"+this.type+"-editor-save").off("click").on("click",e.proxy(this.setVisual,this))}function n(){i.prototype.constructor.apply(this,arguments)}function o(){n.prototype.constructor.apply(this,arguments)}function r(){o.prototype.constructor.apply(this,arguments),this.linkedButton=e("#n2-"+this.type+"-editor-set-as-linked"),this.setMode(0)}function a(t){window.nextend[this.type+"Manager"]=this,this._lateInit=e.proxy(function(e){n.prototype.constructor.call(this,e)},this,t)}function s(e,t){this.id=e.id,this.visualManager=t,this.setValue(e.value,!1),this.visual=e,this.visualManager.visuals[this.id]=this}function l(e,t,i){this.set=t,s.prototype.constructor.call(this,e,i)}function d(){l.prototype.constructor.apply(this,arguments)}function h(e,t,i){this.checked=!1,e.system=1,e.editable=0,d.prototype.constructor.apply(this,arguments)}i.prototype.setTitle=function(e){this.lightbox.find(".n2-logo").html(e)},i.prototype.loadDefaults=function(){this.mode="linked",this.labels={visual:n2_("visual"),visuals:n2_("visuals")},this.visualLoadDeferreds={},this.showParameters=!1},i.prototype.initModals=function(){return new NextendVisualManagerModals(this)},i.prototype.firstLoadVisuals=function(e){for(var t in e)this.sets[t].loadVisuals(e[t])},i.prototype.initController=function(){},i.prototype.getVisual=function(t){if(parseInt(t)>0){if("undefined"!=typeof this.visuals[t])return this.visuals[t];if("undefined"!=typeof this.visualLoadDeferreds[t])return this.visualLoadDeferreds[t];var i=e.Deferred();return this.visualLoadDeferreds[t]=i,this._loadVisualFromServer(t).done(e.proxy(function(){i.resolve(this.visuals[t]),delete this.visualLoadDeferreds[t]},this)).fail(e.proxy(function(){i.resolve({id:-1,name:n2_("Empty")}),delete this.visualLoadDeferreds[t]},this)),i}try{var n=t;return"{"!=n[0]&&(n=Base64.decode(n)),JSON.parse(n),{id:0,name:n2_("Static")}}catch(o){return{id:-1,name:n2_("Empty")}}},i.prototype._loadVisualFromServer=function(t){return NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.parameters.ajaxUrl,{nextendaction:"loadVisual"}),data:{visualId:t},dataType:"json"}).done(e.proxy(function(e){},this))},i.prototype.show=function(t,i,n){NextendEsc.add(e.proxy(function(){return this.hide(),!0},this)),this.notificationStack.enableStack(),this.showParameters=e.extend({previewMode:!1,previewHTML:!1},n),e("body").css("overflow","hidden"),this.lightbox.css("display","block"),e(window).on("resize."+this.type+"Manager",e.proxy(this.resize,this)),this.resize(),this.loadDataToController(t),this.controller.show(),this.$.on("save",i),this._show()},i.prototype._show=function(){e(":focus").blur(),e(window).on({"keydown.visual":e.proxy(function(e){"TEXTAREA"!=e.target.tagName&&"INPUT"!=e.target.tagName&&13==e.keyCode&&this.saveButton.trigger("click")},this)})},i.prototype.setAndClose=function(e){this.$.trigger("save",[e])},i.prototype.hide=function(t){this.controller.pause(),this.notificationStack.popStack(),"undefined"!=typeof t&&(t.preventDefault(),NextendEsc.pop()),this.controller.close(),this.$.off("save"),e(window).off("resize."+this.type+"Manager"),e("body").css("overflow",""),this.lightbox.css("display","none"),e(window).off("keydown.visual")},i.prototype.resize=function(){var e=this.lightbox.height(),t=this.lightbox.find(".n2-sidebar");t.find(".n2-lightbox-sidebar-list").height(e-1-t.find(".n2-logo").outerHeight()-t.find(".n2-sidebar-row").outerHeight()-t.find(".n2-save-as-new-container").parent().height());var i=this.lightbox.find(".n2-content-area");i.height(e-1-i.siblings(".n2-top-bar, .n2-table").outerHeight())},i.prototype.getDataFromController=function(t,i,n){return this.showParameters=e.extend({previewMode:!1,previewHTML:!1},i),this.loadDataToController(t,n)},i.prototype.loadDataToController=function(t){this.isVisualData(t)?e.when(this.getVisual(t)).done(e.proxy(function(e){e.id>0?e.activate():console.error(t+" visual is not found linked")},this)):console.error(t+" visual not found")},i.prototype.isVisualData=function(e){return parseInt(e)>0},i.prototype.setVisual=function(e){switch(e.preventDefault(),this.mode){case 0:break;case"static":this.modals.getLinkedOverwriteOrSaveAs().show("saveAsNew");break;case"linked":default:this.activeVisual?this.activeVisual.compare(this.controller.get("set"))?(this.setAndClose(this.activeVisual.id),this.hide(e)):this.activeVisual&&!this.activeVisual.isEditable()?this.modals.getLinkedOverwriteOrSaveAs().show("saveAsNew"):this.modals.getLinkedOverwriteOrSaveAs().show():this.modals.getLinkedOverwriteOrSaveAs().show("saveAsNew")}},i.prototype.saveAsNew=function(e){e.preventDefault(),this.modals.getSaveAs().show()},i.prototype._saveAsNew=function(t){return NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.parameters.ajaxUrl,{nextendaction:"addVisual"}),data:{setId:this.setsSelector.val(),value:Base64.encode(JSON.stringify({name:t,data:this.controller.get("saveAsNew")}))},dataType:"json"}).done(e.proxy(function(e){var t=e.data.visual;this.changeActiveVisual(this.sets[t.referencekey].addVisual(t))},this))},i.prototype.saveActiveVisual=function(t){return NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.parameters.ajaxUrl,{nextendaction:"changeVisual"}),data:{visualId:this.activeVisual.id,value:this.getBase64(t)},dataType:"json"}).done(e.proxy(function(e){this.activeVisual.setValue(e.data.visual.value,!0)},this))},i.prototype.changeActiveVisual=function(e){this.activeVisual&&(this.activeVisual.notActive(),this.activeVisual=!1),e&&("static"==this.mode&&this.setMode("linked"),e.active(),this.activeVisual=e)},i.prototype.getBase64=function(e){return Base64.encode(JSON.stringify({name:e,data:this.controller.get("set")}))},i.prototype.removeRules=function(e,t){this.renderer.deleteRules(e,this.parameters.renderer.pre,"."+this.getClass(t.id,e))},t.NextendVisualManagerCore=i,n.prototype=Object.create(i.prototype),n.prototype.constructor=n,n.prototype.firstLoadVisuals=function(t){this.sets={},this.setsByReference={},this.setsSelector=e("#"+this.parameters.setsIdentifier+"sets_select");for(var i=0;i<this.parameters.sets.length;i++)this.newVisualSet(this.parameters.sets[i]);this.initSetsManager();for(var n in t)this.sets[n].loadVisuals(t[n]);this.activeSet=this.sets[this.setsSelector.val()],this.activeSet.active(),this.setsSelector.on("change",e.proxy(function(){this.activeSet.notActive(),this.activeSet=this.sets[this.setsSelector.val()],this.activeSet.active()},this))},n.prototype.initSetsManager=function(){new NextendVisualSetsManager(this)},n.prototype._loadVisualFromServer=function(t){return NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.parameters.ajaxUrl,{nextendaction:"loadSetByVisualId"}),data:{visualId:t},dataType:"json"}).done(e.proxy(function(e){this.sets[e.data.set.setId].loadVisuals(e.data.set.visuals)},this))},n.prototype.changeSet=function(e){this.setsSelector.val()!=e&&this.setsSelector.val(e).trigger("change")},n.prototype.changeSetById=function(e){"undefined"!=typeof this.sets[e]&&this.changeSet(e)},n.prototype.newVisualSet=function(e){return new NextendVisualSet(e,this)},t.NextendVisualManagerVisibleSets=n,o.prototype=Object.create(n.prototype),o.prototype.constructor=o,o.prototype.initSetsManager=function(){new NextendVisualSetsManagerEditable(this)},t.NextendVisualManagerEditableSets=o,r.prototype=Object.create(o.prototype),r.prototype.constructor=r,r.prototype.setMode=function(t){if("static"==t&&this.changeActiveVisual(null),this.mode!=t){switch(t){case 0:this.cancelButton.css("display","none"),this.saveButton.off("click");break;case"static":default:this.cancelButton.css("display","inline-block"),this.saveButton.off("click").on("click",e.proxy(this.setVisualAsStatic,this)),this.linkedButton.off("click").on("click",e.proxy(this.setVisualAsLinked,this))}this.mode=t}},r.prototype.loadDataToController=function(t,i){if(parseInt(t)>0)e.when(this.getVisual(t)).done(e.proxy(function(e){e.id>0?(this.setMode("linked"),e.activate(!1,i)):(this.setMode("static"),"function"==typeof i?this.controller.asyncVisualData("",this.showParameters,i):this.controller.load("",!1,this.showParameters))},this));else{var n="";this.setMode("static");try{n=this.getStaticData(t)}catch(o){}"function"==typeof i?this.controller.asyncVisualData(n,this.showParameters,i):this.controller.load(n,!1,this.showParameters)}},r.prototype.getStaticData=function(e){var t=e;"{"!=t[0]&&(t=Base64.decode(t));var i=JSON.parse(t).data;return"undefined"==typeof i?"":i},r.prototype.setVisualAsLinked=function(e){this.setVisual(e)},r.prototype.setVisualAsStatic=function(e){e.preventDefault(),this.setAndClose(this.getBase64(n2_("Static"))),this.hide(e)},t.NextendVisualManagerSetsAndMore=r,a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.prototype.lateInit=function(){this.inited||(this.inited=!0,this._lateInit())},a.prototype.show=function(t,i,n){this.lateInit(),this.notificationStack.enableStack(),NextendEsc.add(e.proxy(function(){return this.hide(),!0},this)),e("body").css("overflow","hidden"),this.lightbox.css("display","block"),e(window).on("resize."+this.type+"Manager",e.proxy(this.resize,this)),this.resize();var o=0;if(""!=t)for(var r=t.split("||"),a=!1;o<r.length;o++)e.when(this.getVisual(r[o])).done(function(e){e&&e.check&&(e.check(),a||(a=!0,e.activate()))});this.$.on("save",i),this.controller.start(n),0==o&&e.when(this.activeSet._loadVisuals()).done(e.proxy(function(){for(var e in this.activeSet.visuals){this.activeSet.visuals[e].activate();break}},this)),this._show()},a.prototype.setVisual=function(e){e.preventDefault(),this.setAndClose(this.getAsString()),this.hide(e)},a.prototype.getAsString=function(){var e=[];for(var t in this.sets){var i=this.sets[t];for(var n in i.visuals)i.visuals[n].checked&&e.push(i.visuals[n].id)}return 0==e.length&&this.activeVisual&&e.push(this.activeVisual.id),e.join("||")},a.prototype.hide=function(e){n.prototype.hide.apply(this,arguments);for(var t in this.sets){var i=this.sets[t];for(var o in i.visuals)i.visuals[o].unCheck()}},t.NextendVisualManagerMultipleSelection=a,s.prototype.compare=function(e){for(var t=Math.max(this.value.length,e.length),i=0;t>i;i++)if(!this._compareTab("undefined"==typeof this.value[i]?{}:this.value[i],"undefined"==typeof e[i]?{}:e[i]))return!1;return!0},s.prototype._compareTab=function(e,t){var i=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(0===e.length&&0===n.length)return!0;if(i.length!=n.length)return!1;for(var o=0;o<i.length;o++){var r=i[o];if(e[r]!==t[r])return!1}return!0},s.prototype.setValue=function(e,t){var i=null;if("string"==typeof e){var n=e;"{"!=n[0]?(this.base64=n,n=Base64.decode(n)):this.base64=Base64.encode(n),i=JSON.parse(n)}else i=e;this.name=i.name,this.value=i.data,t&&this.render()},s.prototype.isSystem=function(){return 1==this.visual.system},s.prototype.isEditable=function(){return 1==this.visual.editable},s.prototype.activate=function(e,t){e&&e.preventDefault(),this.visualManager.changeActiveVisual(this),"function"==typeof t?this.visualManager.controller.asyncVisualData(this.value,this.visualManager.showParameters,t):this.visualManager.controller.load(this.value,!1,this.visualManager.showParameters)},s.prototype.active=function(){},s.prototype.notActive=function(){},s.prototype["delete"]=function(t){t&&t.preventDefault(),NextendDeleteModal("n2-visual",this.name,e.proxy(function(){this._delete()},this))},s.prototype._delete=function(){return NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.visualManager.parameters.ajaxUrl,{nextendaction:"deleteVisual"}),data:{visualId:this.id},dataType:"json"}).done(e.proxy(function(e){e.data.visual;this.visualManager.activeVisual&&this.id==this.visualManager.activeVisual.id&&this.visualManager.changeActiveVisual(null),this.removeRules(),delete this.visualManager.visuals[this.id],delete this.set.visuals[this.id],this.row.remove(),this.visualManager.$.trigger("visualDelete",[this.id])},this))},s.prototype.removeRules=function(){},s.prototype.render=function(){},s.prototype.isUsed=function(){return!1},t.NextendVisualCore=s,l.prototype=Object.create(s.prototype),l.prototype.constructor=l,l.prototype.active=function(){var e=this.set.set.id;this.visualManager.changeSet(e),s.prototype.active.call(this)},t.NextendVisualWithSet=l,d.prototype=Object.create(l.prototype),d.prototype.constructor=d,d.prototype.createRow=function(){return this.row=e("<li></li>").append(e('<a href="#">'+this.name+"</a>").on("click",e.proxy(this.activate,this))),this.isSystem()||this.row.append(e('<span class="n2-actions"></span>').append(e('<div class="n2-button n2-button-icon n2-button-s" href="#"><i class="n2-i n2-i-delete n2-i-grey-opacity"></i></div>').on("click",e.proxy(this["delete"],this)))),this.row},d.prototype.setValue=function(e,t){l.prototype.setValue.call(this,e,t),this.row&&this.row.find("> a").html(this.name)},d.prototype.active=function(){this.row.addClass("n2-active"),l.prototype.active.call(this)},d.prototype.notActive=function(){this.row.removeClass("n2-active"),l.prototype.notActive.call(this)},t.NextendVisualWithSetRow=d,h.prototype=Object.create(d.prototype),h.prototype.constructor=h,h.prototype.createRow=function(){var t=d.prototype.createRow.call(this);return this.checkbox=e('<div class="n2-list-checkbox"><i class="n2-i n2-i-tick"></i></div>').on("click",e.proxy(this.checkOrUnCheck,this)).prependTo(t.find("a")),t},h.prototype.setValue=function(e,t){this.name=e.name,this.value=e.data,this.row&&this.row.find("> a").html(this.name),t&&this.render()},h.prototype.activate=function(e,t){e&&e.preventDefault(),this.visualManager.changeActiveVisual(this),this.visualManager.controller.setAnimationProperties(this.value)},h.prototype.checkOrUnCheck=function(e){e.preventDefault(),e.stopPropagation(),this.checked?this.unCheck():this.check()},h.prototype.check=function(){this.checked=!0,this.checkbox.addClass("n2-active"),this.activate()},h.prototype.unCheck=function(){this.checked=!1,this.checkbox.removeClass("n2-active"),this.activate()},t.NextendVisualWithSetRowMultipleSelection=h}(n2,window),function(e,t){function i(e){this.visualManager=e,this.linkedOverwriteOrSaveAs=null,this.saveAs=null}i.prototype.getLinkedOverwriteOrSaveAs=function(){if(null==this.linkedOverwriteOrSaveAs){var t=this;this.linkedOverwriteOrSaveAs=new NextendModal({zero:{size:[500,140],title:"",back:!1,close:!0,content:"",controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-grey n2-uc n2-h4">'+n2_("Save as new")+"</a>",'<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green n2-uc n2-h4">'+n2_("Overwrite current")+"</a>"],fn:{show:function(){this.title.html(n2_printf(n2_("%s changed - %s"),t.visualManager.labels.visual,t.visualManager.activeVisual.name)),t.visualManager.activeVisual&&!t.visualManager.activeVisual.isEditable()?this.loadPane("saveAsNew"):(this.controls.find(".n2-button-green").on("click",e.proxy(function(i){i.preventDefault(),t.visualManager.saveActiveVisual(t.visualManager.activeVisual.name).done(e.proxy(function(){this.hide(i),t.visualManager.setAndClose(t.visualManager.activeVisual.id),t.visualManager.hide()},this))},this)),this.controls.find(".n2-button-grey").on("click",e.proxy(function(e){e.preventDefault(),this.loadPane("saveAsNew")},this)))}}},saveAsNew:{size:[500,220],title:n2_("Save as"),back:"zero",close:!0,content:'<form class="n2-form"></form>',controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green n2-uc n2-h4">'+n2_("Save as new")+"</a>"],fn:{show:function(){var i=this.controls.find(".n2-button"),n=(this.content.find(".n2-form").on("submit",function(e){e.preventDefault(),i.trigger("click")}).append(this.createInput(n2_("Name"),"n2-visual-name","width: 446px;")),this.content.find("#n2-visual-name").focus());t.visualManager.activeVisual&&n.val(t.visualManager.activeVisual.name),i.on("click",e.proxy(function(i){i.preventDefault();var o=n.val();""==o?nextend.notificationCenter.error(n2_("Please fill the name field!")):t.visualManager._saveAsNew(o).done(e.proxy(function(){this.hide(i),t.visualManager.setAndClose(t.visualManager.activeVisual.id),t.visualManager.hide()},this))},this))}}}},!1)}return this.linkedOverwriteOrSaveAs},i.prototype.getSaveAs=function(){if(null===this.saveAs){var t=this;this.saveAs=new NextendModal({zero:{size:[500,220],title:n2_("Save as"),back:!1,close:!0,content:'<form class="n2-form"></form>',controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green n2-uc n2-h4">'+n2_("Save as new")+"</a>"],fn:{show:function(){var i=this.controls.find(".n2-button"),n=(this.content.find(".n2-form").on("submit",function(e){e.preventDefault(),i.trigger("click")}).append(this.createInput(n2_("Name"),"n2-visual-name","width: 446px;")),this.content.find("#n2-visual-name").focus());t.visualManager.activeVisual&&n.val(t.visualManager.activeVisual.name),i.on("click",e.proxy(function(i){i.preventDefault();var o=n.val();""==o?nextend.notificationCenter.error(n2_("Please fill the name field!")):t.visualManager._saveAsNew(o).done(e.proxy(this.hide,this,i))},this))}}}},!1)}return this.saveAs},t.NextendVisualManagerModals=i}(n2,window),function(e,t){function i(t){this.visualManager=t,this.$=e(this)}function n(t){this.modal=null,i.prototype.constructor.apply(this,arguments),this.$.on({setAdded:function(e,i){new o(i,t)},setChanged:function(e,i){t.sets[i.id].rename(i.value)},setDeleted:function(e,i){t.sets[i.id]["delete"](),t.setsSelector.trigger("change")}}),this.manageButton=e("#"+t.parameters.setsIdentifier+"-manage").on("click",e.proxy(this.showManageSets,this))}function o(t,i){this.set=t,this.visualManager=i,this.visualList=e('<ul class="n2-list n2-h4"></ul>'),this.visualManager.sets[t.id]=this,""!=t.referencekey&&(this.visualManager.setsByReference[t.referencekey]=t),this.option=e('<option value="'+t.id+'">'+t.value+"</option>").appendTo(this.visualManager.setsSelector)}t.NextendVisualSetsManager=i,n.prototype=Object.create(i.prototype),n.prototype.constructor=n,n.prototype.isSetAllowedToEdit=function(e){return-1!=e&&"undefined"!=typeof this.visualManager.sets[e]&&0!=this.visualManager.sets[e].set.editable},n.prototype.createVisualSet=function(t){return NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.visualManager.parameters.ajaxUrl,{nextendaction:"createSet"}),data:{name:t},dataType:"json"}).done(e.proxy(function(e){this.$.trigger("setAdded",e.data.set)},this))},n.prototype.renameVisualSet=function(t,i){return NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.visualManager.parameters.ajaxUrl,{nextendaction:"renameSet"}),data:{setId:t,name:i},dataType:"json"}).done(e.proxy(function(e){this.$.trigger("setChanged",e.data.set),nextend.notificationCenter.success(n2_("Set renamed"))},this))},n.prototype.deleteVisualSet=function(t){var i=e.Deferred(),n=this.visualManager.sets[t],o=[];return e.when(n._loadVisuals()).done(e.proxy(function(){for(var r in n.visuals)o.push(n.visuals[r]._delete());e.when.apply(e,o).then(e.proxy(function(){NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.visualManager.parameters.ajaxUrl,{nextendaction:"deleteSet"}),data:{setId:t},dataType:"json"}).done(e.proxy(function(e){i.resolve(),this.$.trigger("setDeleted",e.data.set)},this))},this))},this)).fail(function(){i.reject()}),i.fail(function(){nextend.notificationCenter.error(n2_("Unable to delete the set"))})},n.prototype.showManageSets=function(){var t=this.visualManager,i=this;null===this.modal&&(this.modal=new NextendModal({zero:{size:[500,390],title:n2_("Sets"),back:!1,close:!0,content:"",controls:['<a href="#" class="n2-add-new n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green n2-uc n2-h4">'+n2_("Add new")+"</a>"],fn:{show:function(){this.title.html(n2_printf(n2_("%s sets"),t.labels.visual)),this.createHeading(n2_("Sets")).appendTo(this.content);var n=[];for(var o in t.sets){var r=t.sets[o].set.id;i.isSetAllowedToEdit(r)?n.push([t.sets[o].set.value,e('<div class="n2-button n2-button-normal n2-button-xs n2-radius-s n2-button-grey n2-uc n2-h5">'+n2_("Rename")+"</div>").on("click",{id:r},e.proxy(function(e){this.loadPane("rename",!1,!1,[e.data.id])},this)),e('<div class="n2-button n2-button-normal n2-button-xs n2-radius-s n2-button-red n2-uc n2-h5">'+n2_("Delete")+"</div>").on("click",{id:r},e.proxy(function(e){this.loadPane("delete",!1,!1,[e.data.id])},this))]):n.push([t.sets[o].set.value,"",""])}this.createTable(n,["width:100%;","",""]).appendTo(this.createTableWrap().appendTo(this.content)),this.controls.find(".n2-add-new").on("click",e.proxy(function(e){e.preventDefault(),this.loadPane("addNew")},this))}}},addNew:{title:n2_("Create set"),size:[500,220],back:"zero",close:!0,content:'<form class="n2-form"></form>',controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green n2-uc n2-h4">'+n2_("Add")+"</a>"],fn:{show:function(){var n=this.controls.find(".n2-button"),o=(this.content.find(".n2-form").on("submit",function(e){e.preventDefault(),n.trigger("click")}).append(this.createInput(n2_("Name"),"n2-visual-name","width: 446px;")),this.content.find("#n2-visual-name").focus());n.on("click",e.proxy(function(n){var r=o.val();""==r?nextend.notificationCenter.error(n2_("Please fill the name field!")):i.createVisualSet(r).done(e.proxy(function(e){this.hide(n),nextend.notificationCenter.success(n2_("Set added")),t.setsSelector.val(e.data.set.id).trigger("change")},this))},this))}}},rename:{title:n2_("Rename set"),size:[500,220],back:"zero",close:!0,content:'<form class="n2-form"></form>',controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-green n2-uc n2-h4">'+n2_("Rename")+"</a>"],fn:{show:function(n){var o=this.controls.find(".n2-button"),r=(this.content.find(".n2-form").on("submit",function(e){e.preventDefault(),o.trigger("click")}).append(this.createInput(n2_("Name"),"n2-visual-name","width: 446px;")),this.content.find("#n2-visual-name").val(t.sets[n].set.value).focus());o.on("click",e.proxy(function(){var t=r.val();""==t?nextend.notificationCenter.error(n2_("Please fill the name field!")):i.renameVisualSet(n,t).done(e.proxy(this.goBack,this))},this))}}},"delete":{title:n2_("Delete set"),size:[500,190],back:"zero",close:!0,content:"",controls:['<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-grey n2-uc n2-h4">'+n2_("Cancel")+"</a>",'<a href="#" class="n2-button n2-button-normal n2-button-l n2-radius-s n2-button-red n2-uc n2-h4">'+n2_("Yes")+"</a>"],fn:{show:function(n){this.createCenteredSubHeading(n2_printf(n2_("Do you really want to delete the set and all associated %s?"),t.labels.visuals)).appendTo(this.content),this.controls.find(".n2-button-grey").on("click",e.proxy(function(e){e.preventDefault(),this.goBack()},this)),this.controls.find(".n2-button-red").html('Yes, delete "'+t.sets[n].set.value+'"').on("click",e.proxy(function(t){t.preventDefault(),i.deleteVisualSet(n).done(e.proxy(this.goBack,this))},this))}}}},!1)),this.modal.show(!1,[this.visualManager.setsSelector.val()])},t.NextendVisualSetsManagerEditable=n,o.prototype.active=function(){e.when(this._loadVisuals()).done(e.proxy(function(){this.visualList.appendTo(this.visualManager.visualListContainer)},this))},o.prototype.notActive=function(){this.visualList.detach()},o.prototype.loadVisuals=function(e){if("undefined"==typeof this.visuals){this.visuals={};for(var t=0;t<e.length;t++)this.addVisual(e[t])}},o.prototype._loadVisuals=function(){return null==this.visuals?NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.visualManager.parameters.ajaxUrl,{nextendaction:"loadVisualsForSet"}),data:{setId:this.set.id},dataType:"json"}).done(e.proxy(function(e){this.loadVisuals(e.data.visuals)},this)):!0},o.prototype.addVisual=function(e){return"undefined"==typeof this.visuals[e.id]&&(this.visuals[e.id]=this.visualManager.createVisual(e,this),this.visualList.append(this.visuals[e.id].createRow())),this.visuals[e.id]},o.prototype.rename=function(e){this.set.value=e,this.option.html(e)},o.prototype["delete"]=function(){this.option.remove(),delete this.visualManager.sets[this.set.id]},t.NextendVisualSet=o}(n2,window),function(e,t){"use strict";function i(){this.loadDefaults(),this.lightbox=e("#n2-lightbox-"+this.type)}function n(){i.prototype.constructor.apply(this,arguments),this.editor=this.initEditor(),this.editor.$.on("change",e.proxy(this.propertyChanged,this))}function o(t){n.prototype.constructor.apply(this,arguments),this.previewModesList=t,this.initPreviewModes(),t&&(this.renderer=this.initRenderer(),this.clearTabButton=this.lightbox.find(".n2-editor-clear-tab").on("click",e.proxy(this.clearCurrentTab,this)),this.tabField=new N2Classes.FormElementRadio("n2-"+this.type+"-editor-tabs",["0"]),this.tabField.element.on("nextendChange.n2-editor",e.proxy(this.tabChanged,this)),this.previewModeField=new N2Classes.FormElementRadio("n2-"+this.type+"-editor-preview-mode",["0"]),this.previewModeField.element.on("nextendChange.n2-editor",e.proxy(this.previewModeChanged,this)),this.previewModeField.options.eq(0).html(this.previewModesList[0].label))}function r(){this.fields={},this.$=e(this)}function a(e){this.editorController=e}i.prototype.loadDefaults=function(){this.type="",this._style=!1,this.isChanged=!1,this.visible=!1},i.prototype.init=function(){this.lightbox=e("#n2-lightbox-"+this.type)},i.prototype.pause=function(){},i.prototype.getEmptyVisual=function(){return[]},i.prototype.get=function(){return this.currentVisual},i.prototype.load=function(e,t,i){this.isChanged=!1,this.lightbox.addClass("n2-editor-loaded"),""==e&&(e=this.getEmptyVisual()),this._load(e,t,i)},i.prototype._load=function(t,i,n){this.currentVisual=e.extend(!0,{},t)},i.prototype.addStyle=function(t){this._style&&this._style.remove(),this._style=e("<style>"+t+"</style>").appendTo("head")},i.prototype.show=function(){this.visible=!0,nextend.context.addWindow("visual")},i.prototype.close=function(){this.visible=!1,nextend.context.removeWindow()},t.NextendVisualEditorControllerBase=i,n.prototype=Object.create(i.prototype),n.prototype.constructor=n,n.prototype.initEditor=function(){return new r},n.prototype.propertyChanged=function(e,t,i){this.isChanged=!0,this.currentVisual[t]=i},n.prototype._load=function(e,t,n){i.prototype._load.apply(this,arguments),this.loadToEditor()},n.prototype.loadToEditor=function(){this.editor.load(this.currentVisual)},t.NextendVisualEditorControllerWithEditor=n,o.prototype=Object.create(n.prototype),o.prototype.constructor=o,o.prototype.loadDefaults=function(){n.prototype.loadDefaults.call(this),this.currentPreviewMode="0",this.currentTabIndex=0,this._renderTimeout=0,this._delayStart=0},o.prototype.initPreviewModes=function(){},o.prototype.initRenderer=function(){},o.prototype._load=function(t,i,n){this.currentVisual=[];for(var o=0;o<t.length;o++)this.currentVisual[o]=e.extend(!0,this.getCleanVisual(),t[o]);if(this.localModePreview={},n.previewMode===!1)this.availablePreviewMode=!1;else{this.availablePreviewMode=n.previewMode,i===!1&&(i=this.getTabs());for(var o=this.currentVisual.length;o<i.length;o++)this.currentVisual[o]=this.getCleanVisual();n.previewHTML!==!1&&""!=n.previewHTML&&(this.localModePreview[n.previewMode]=n.previewHTML)}if(this.currentTabs=i,i===!1){i=[];for(var o=0;o<this.currentVisual.length;o++)i.push("#"+o)}this.setTabs(i)},o.prototype.asyncVisualData=function(t,i,n){""==t&&(t=this.getEmptyVisual());for(var o=this.previewModesList[i.previewMode].tabs,r=[],a=0;a<t.length;a++)r[a]=e.extend(!0,this.getCleanVisual(),t[a]);for(var a=r.length;a<o.length;a++)r[a]=this.getCleanVisual();n(r,o)},o.prototype.getCleanVisual=function(){return{}},o.prototype.getTabs=function(){return this.previewModesList[this.availablePreviewMode].tabs},o.prototype.setTabs=function(e){this.tabField.insideChange("0");for(var t=this.tabField.values.length-1;t>0;t--)this.tabField.removeTabOption(this.tabField.values[t]);this.tabField.options.eq(0).html(e[0]);for(var t=1;t<e.length;t++)this.tabField.addTabOption(t+"",e[t]);this.makePreviewModes()},o.prototype.tabChanged=function(){document.activeElement&&document.activeElement.blur();var t=this.tabField.element.val();this.currentTabIndex=t,"undefined"==typeof this.currentVisual[t]&&(this.currentVisual[t]={});var i=e.extend({},this.currentVisual[0]);0!=t?(e.extend(i,this.currentVisual[t]),this.clearTabButton.css("display","")):this.clearTabButton.css("display","none"),this.editor.load(i),this._tabChanged()},o.prototype._tabChanged=function(){this._renderPreview()},o.prototype.clearCurrentTab=function(e){e&&e.preventDefault(),this.currentVisual[this.currentTabIndex]={},this.tabChanged(),this._renderPreview()},o.prototype.makePreviewModes=function(){var e=[];if(this.availablePreviewMode===!1){var t=this.tabField.options.length;"undefined"!=typeof this.previewModes[t]&&(e=this.previewModes[t]),this.setPreviewModes(e)}else e=[this.previewModesList[this.availablePreviewMode]],this.setPreviewModes(e,this.availablePreviewMode)},o.prototype.setPreviewModes=function(e,t){for(var i=this.previewModeField.values.length-1;i>0;i--)this.previewModeField.removeTabOption(this.previewModeField.values[i]);for(var i=0;i<e.length;i++)this.previewModeField.addTabOption(e[i].id,e[i].label);"undefined"==typeof t&&(t="0"),this.previewModeField.insideChange(t)},o.prototype.previewModeChanged=function(){var e=this.previewModeField.element.val();if(this.currentTabs===!1)if(0==e)for(var t=0;t<this.currentVisual.length;t++)this.tabField.options.eq(t).html("#"+t);else{var i=this.previewModesList[e].tabs;if(i)for(var t=0;t<this.currentVisual.length;t++)this.tabField.options.eq(t).html(i[t])}this.currentPreviewMode=e,this._renderPreview(),this.setPreview(e)},o.prototype.setPreview=function(e){},o.prototype.propertyChanged=function(e,t,i){this.isChanged=!0,this.currentVisual[this.currentTabIndex][t]=i,this.renderPreview()},o.prototype.renderPreview=function(){var t=e.now();this._renderTimeout?(clearTimeout(this._renderTimeout),t-this._delayStart>100&&(this._renderPreview(),this._delayStart=t)):this._delayStart=t,this._renderTimeout=setTimeout(e.proxy(this._renderPreview,this),33)},o.prototype._renderPreview=function(){this._renderTimeout=!1},t.NextendVisualEditorController=o,r.prototype.load=function(e){this._off(),this._on()},r.prototype._on=function(){for(var e in this.fields)this.fields[e].element.on(this.fields[e].events)},r.prototype._off=function(){for(var e in this.fields)this.fields[e].element.off(".n2-editor")},r.prototype.trigger=function(e,t){this.$.trigger("change",[e,t])},t.NextendVisualEditor=r,a.prototype.deleteRules=function(e,t,i){var n=this.editorController.previewModesList[e],o=new RegExp("@pre","g"),r=new RegExp("@selector","g");for(var a in n.selectors){var s=a.replace(o,t).replace(r,i);nextend.css.deleteRule(s)}},a.prototype.getCSS=function(t,i,n,o,r){var a="",s=this.editorController.previewModesList[t],l=new RegExp("@pre","g"),d=new RegExp("@selector","g");for(var h in s.selectors){var p=h.replace(l,i).replace(d,n);a+=p+"{\n"+s.selectors[h]+"}\n","undefined"!=typeof r.deleteRule&&nextend.css.deleteRule(p)}if(0==t){var u=o[r.activeTab];0!=r.activeTab&&(u=e.extend({},o[0],u)),a=a.replace(new RegExp("@tab[0-9]*","g"),this.render(u));
}else if(s.renderOptions.combined)for(var c=0;c<o.length;c++)a=a.replace(new RegExp("@tab"+c,"g"),this.render(o[c]));else for(var c=0;c<o.length;c++)o[c]=e.extend({},o[c]),a=a.replace(new RegExp("@tab"+c,"g"),this.render(o[c]));return a},a.prototype.render=function(e){var t=this.makeVisualData(e),i="",n="";"undefined"!=typeof t.raw&&(n=t.raw,delete t.raw);for(var o in t)i+=this.deCase(o)+": "+t[o]+";\n";return i+=n},a.prototype.makeVisualData=function(e){var t={};for(var i in e)e.hasOwnProperty(i)&&"function"!=typeof e[i]&&this["makeStyle"+i](e[i],t);return t},a.prototype.deCase=function(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})},t.NextendVisualRenderer=a}(n2,window),function(e,t){function i(){NextendVisualManagerSetsAndMore.prototype.constructor.apply(this,arguments)}function n(){NextendVisualWithSetRow.prototype.constructor.apply(this,arguments)}i.prototype=Object.create(NextendVisualManagerSetsAndMore.prototype),i.prototype.constructor=i,i.prototype.loadDefaults=function(){NextendVisualManagerSetsAndMore.prototype.loadDefaults.apply(this,arguments),this.type="animation",this.labels={visual:n2_("animation"),visuals:n2_("animations")},this.availableFeatures={repeatable:0,specialZero:0,repeat:0,playEvent:0,pauseEvent:0,stopEvent:0,instantOut:0,repeatSelfOnly:0}},i.prototype.initController=function(){return new NextendAnimationEditorController(this.parameters.renderer.modes)},i.prototype.show=function(t,i,n,o){this.currentFeatures=e.extend({},this.availableFeatures,t),NextendVisualManagerSetsAndMore.prototype.show.call(this,i.animations,n,o),this.controller.loadTransformOrigin(i.transformOrigin),this.currentFeatures.repeatable?(this.controller.featureRepeatable(1),i.repeatable||(i.repeatable=0),this.controller.loadRepeatable(i.repeatable)):this.controller.featureRepeatable(0),this.currentFeatures.specialZero?(this.controller.featureSpecialZero(1),i.specialZero||(i.specialZero=0),this.controller.loadSpecialZero(i.specialZero)):this.controller.featureSpecialZero(0),this.currentFeatures.instantOut?(this.controller.featureInstantOut(1),i.instantOut||(i.instantOut=0),this.controller.loadInstantOut(i.instantOut)):this.controller.featureInstantOut(0),this.currentFeatures.repeat?(this.controller.featureRepeat(1),i.repeatCount||(i.repeatCount=0),this.controller.loadRepeatCount(i.repeatCount),i.repeatStartDelay||(i.repeatStartDelay=0),this.controller.loadRepeatStartDelay(i.repeatStartDelay)):this.controller.featureRepeat(0),this.currentFeatures.playEvent?(this.controller.featurePlayEvent(1),i.playEvent||(i.playEvent=""),this.controller.loadPlayEvent(i.playEvent)):this.controller.featurePlayEvent(0),this.currentFeatures.pauseEvent?(this.controller.featurePauseEvent(1),i.pauseEvent||(i.pauseEvent=""),this.controller.loadPauseEvent(i.pauseEvent)):this.controller.featurePauseEvent(0),this.currentFeatures.repeatSelfOnly?(this.controller.featureRepeatSelfOnly(1),i.repeatSelfOnly||(i.repeatSelfOnly=0),this.controller.loadRepeatSelfOnly(i.repeatSelfOnly)):this.controller.featureRepeatSelfOnly(0),this.currentFeatures.stopEvent?(this.controller.featureStopEvent(1),i.stopEvent||(i.stopEvent=""),this.controller.loadStopEvent(i.stopEvent)):this.controller.featureStopEvent(0),0==i.animations.length&&e.when(this.activeSet._loadVisuals()).done(e.proxy(function(){for(var e in this.activeSet.visuals){this.activeSet.visuals[e].activate();break}},this))},i.prototype.setAndClose=function(e){1==e.length&&this.isEquivalent(e[0],this.controller.getEmptyAnimation())&&(e=[]);var t={transformOrigin:this.controller.transformOrigin,animations:e};this.currentFeatures.repeatable&&(t.repeatable=this.controller.repeatable),this.currentFeatures.repeatSelfOnly&&(t.repeatSelfOnly=this.controller.repeatSelfOnly),this.currentFeatures.specialZero&&(t.specialZero=this.controller.specialZero),this.currentFeatures.instantOut&&(t.instantOut=this.controller.instantOut),this.currentFeatures.repeat&&(t.repeatCount=this.controller.repeatCount,t.repeatStartDelay=this.controller.repeatStartDelay),this.currentFeatures.playEvent&&(t.playEvent=this.controller.playEvent),this.currentFeatures.pauseEvent&&(t.pauseEvent=this.controller.pauseEvent),this.currentFeatures.stopEvent&&(t.stopEvent=this.controller.stopEvent),this.$.trigger("save",t)},i.prototype.createVisual=function(e,t){return new n(e,t,this)},i.prototype.setVisualAsStatic=function(e){e.preventDefault(),this.setAndClose(this.controller.get("save")),this.hide(e)},i.prototype.setMode=function(e){NextendVisualManagerSetsAndMore.prototype.setMode.call(this,"static")},i.prototype.getStaticData=function(e){return e},i.prototype.isEquivalent=function(e,t){var i=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(i.length!=n.length)return!1;for(var o=0;o<i.length;o++){var r=i[o];if(e[r]!==t[r])return!1}return!0},t.NextendAnimationManager=i,n.prototype=Object.create(NextendVisualWithSetRow.prototype),n.prototype.constructor=n,n.prototype.activate=function(e){"undefined"!=typeof e&&e.preventDefault(),this.visualManager.changeActiveVisual(this),"undefined"!=typeof this.value.specialZero&&this.visualManager.controller.loadSpecialZero(this.value.specialZero),"undefined"!=typeof this.value.transformOrigin&&this.visualManager.controller.loadTransformOrigin(this.value.transformOrigin),this.visualManager.controller.load(this.value.animations,!1,this.visualManager.showParameters)},t.NextendAnimation=n}(n2,window),function(e,t){function i(){this.timeline=new NextendTimeline,this.initTabOrdering(),NextendVisualEditorController.prototype.constructor.apply(this,arguments),e("#n2-animation-editor-tab-add").on("click",e.proxy(this.addTab,this)),e("#n2-animation-editor-tab-delete").on("click",e.proxy(this.deleteCurrentTab,this)),this.preview=e('<div class="n2-animation-preview-box" style="background-image: url('+nextend.imageHelper.getRepeatedPlaceholder()+')"></div>').appendTo(e("#n2-animation-editor-preview")),this.setPreviewSize(400,100),this.initBackgroundColor()}function n(){NextendVisualEditor.prototype.constructor.apply(this,arguments),this.fields={name:{element:e("#n2-animation-editorname"),events:{"outsideChange.n2-editor":e.proxy(this.changeName,this)}},duration:{element:e("#n2-animation-editorduration"),events:{"outsideChange.n2-editor":e.proxy(this.changeDuration,this)}},delay:{element:e("#n2-animation-editordelay"),events:{"outsideChange.n2-editor":e.proxy(this.changeDelay,this)}},easing:{element:e("#n2-animation-editoreasing"),events:{"outsideChange.n2-editor":e.proxy(this.changeEasing,this)}},opacity:{element:e("#n2-animation-editoropacity"),events:{"outsideChange.n2-editor":e.proxy(this.changeOpacity,this)}},offset:{element:e("#n2-animation-editoroffset"),events:{"outsideChange.n2-editor":e.proxy(this.changeOffset,this)}},rotate:{element:e("#n2-animation-editorrotate"),events:{"outsideChange.n2-editor":e.proxy(this.changeRotate,this)}},scale:{element:e("#n2-animation-editorscale"),events:{"outsideChange.n2-editor":e.proxy(this.changeScale,this)}},skew:{element:e("#n2-animation-editorskew"),events:{"outsideChange.n2-editor":e.proxy(this.changeSkew,this)}},n2blur:{element:e("#n2-animation-editorn2blur"),events:{"outsideChange.n2-editor":e.proxy(this.changeN2blur,this)}},specialZero:{element:e("#n2-animation-editorspecial-zero"),events:{"outsideChange.n2-editor":e.proxy(this.changeSpecialZero,this)}},repeatCount:{element:e("#n2-animation-editorrepeat-count"),events:{"outsideChange.n2-editor":e.proxy(this.changeRepeatCount,this)}},repeatStartDelay:{element:e("#n2-animation-editorrepeat-start-delay"),events:{"outsideChange.n2-editor":e.proxy(this.changeRepeatStartDelay,this)}},transformOrigin:{element:e("#n2-animation-editortransformorigin"),events:{"outsideChange.n2-editor":e.proxy(this.changeTransformOrigin,this)}},playEvent:{element:e("#n2-animation-editorplay"),events:{"outsideChange.n2-editor":e.proxy(this.changePlayEvent,this)}},pauseEvent:{element:e("#n2-animation-editorpause"),events:{"outsideChange.n2-editor":e.proxy(this.changePauseEvent,this)}},stopEvent:{element:e("#n2-animation-editorstop"),events:{"outsideChange.n2-editor":e.proxy(this.changeStopEvent,this)}},repeatable:{element:e("#n2-animation-editorrepeatable"),events:{"outsideChange.n2-editor":e.proxy(this.changeRepeatable,this)}},repeatSelfOnly:{element:e("#n2-animation-editorrepeat-self-only"),events:{"outsideChange.n2-editor":e.proxy(this.changeRepeatSelfOnly,this)}},instantOut:{element:e("#n2-animation-editorinstant-out"),events:{"outsideChange.n2-editor":e.proxy(this.changeInstantOut,this)}}}}var o={opacity:1,x:0,y:0,z:0,rotationX:0,rotationY:0,rotationZ:0,scaleX:1,scaleY:1,scaleZ:1,skewX:0,n2blur:0};i.prototype=Object.create(NextendVisualEditorController.prototype),i.prototype.constructor=i,i.prototype.loadDefaults=function(){NextendVisualEditorController.prototype.loadDefaults.call(this),this.type="animation",this.group="in",this.mode=0,this.playing=!1,this.specialZero=0,this.transformOrigin="0|*|0|*|0",this.playEvent="",this.pauseEvent="",this.stopEvent="",this.repeatable=0,this.instantOut=0},i.prototype.setPreviewSize=function(e,t){return this.preview.css({width:e,height:t,marginLeft:-e/2,marginTop:-t/2}),this},i.prototype.setGroup=function(e){return this.group=e,this},i.prototype.initPreviewModes=function(){this.previewModes=[this.previewModesList.solo]},i.prototype.makePreviewModes=function(){this.tabField.options.length>0?this.setPreviewModes(this.previewModes):this.setPreviewModes([])},i.prototype.initRenderer=function(){return new NextendVisualRenderer(this)},i.prototype.initEditor=function(){var t=new n;return t.$.on("nameChanged",e.proxy(this.animationNameChanged,this)),t},i.prototype.pause=function(){this.clearTimeline()},i.prototype.get=function(e){return"saveAsNew"==e?{specialZero:this.specialZero,transformOrigin:this.transformOrigin,animations:this.currentVisual}:this.currentVisual},i.prototype.getEmptyAnimation=function(){return{name:"Animation",duration:.8,delay:0,ease:"easeOutCubic",opacity:1,x:0,y:0,z:0,rotationX:0,rotationY:0,rotationZ:0,scaleX:1,scaleY:1,scaleZ:1,skewX:0,n2blur:0}},i.prototype.getEmptyVisual=function(){return[this.getEmptyAnimation()]},i.prototype.initBackgroundColor=function(){new N2Classes.FormElementText("n2-animation-editor-background-color"),new N2Classes.FormElementColor("n2-animation-editor-background-color",0);var t=this.lightbox.find(".n2-editor-preview-box");e("#n2-animation-editor-background-color").on("nextendChange",function(){t.css("background","#"+e(this).val())})},i.prototype._renderPreview=function(){NextendVisualEditorController.prototype._renderPreview.call(this),this.visible&&this.refreshTimeline()},i.prototype.setPreview=function(e){this.visible&&this.refreshTimeline()},i.prototype.getPreviewCssClass=function(){return"n2-"+this.type+"-editor-preview"},i.prototype._load=function(t,i,n){n.previewMode=!0;for(var o=0;o<t.length;o++)t[o]=e.extend({},this.getEmptyAnimation(),t[o]);NextendVisualEditorController.prototype._load.call(this,t,i,n)},i.prototype.initTabOrdering=function(){var t=-1,i=e("#n2-animation-editor-tabs").parent();i.sortable({items:".n2-radio-option",start:e.proxy(function(e,i){t=this.tabField.options.index(i.item)},this),update:e.proxy(function(e,n){var o=n.item.index();i.sortable("cancel");var r=this.currentVisual[t];this.currentVisual.splice(t,1),this.currentVisual.splice(o,0,r);for(var a=0;a<this.currentVisual.length;a++)this.tabField.options.eq(a).html(this.currentVisual[a].name);this.tabField.options.eq(o).trigger("click"),t=-1,"solo"!=this.currentPreviewMode?this.refreshTimeline():this._tabChanged()},this)})},i.prototype.getTabs=function(){for(var e=[],t=0;t<this.currentVisual.length;t++)e.push(this.currentVisual[t].name);return e},i.prototype._tabChanged=function(){"solo"==this.currentPreviewMode&&this.refreshTimeline()},i.prototype.clearCurrentTab=function(e){e&&e.preventDefault()},i.prototype.addTab=function(e,t){e&&e.preventDefault();var i=this.tabField.values.length;this.currentVisual[i]=this.getEmptyAnimation(),this.tabField.addTabOption(i+"",this.currentVisual[i].name),this.tabField.options.eq(i).trigger("click"),"solo"!=this.currentPreviewMode&&this.refreshTimeline()},i.prototype.deleteCurrentTab=function(e){e&&e.preventDefault(),this.deleteTab(this.currentTabIndex),this.currentTabIndex=Math.min(this.currentTabIndex,this.currentVisual.length-1),this.tabField.options.eq(this.currentTabIndex).trigger("click")},i.prototype.deleteTab=function(e){if(this.currentVisual.length>1){this.tabField.removeTabOption(this.tabField.values[e]),this.tabField.values=[];for(var t=0;t<this.tabField.options.length;t++)this.tabField.values.push(t+"");this.currentVisual.splice(e,1)}else this.addTab(null,!0),this.deleteTab(0);"solo"!=this.currentPreviewMode&&this.refreshTimeline()},i.prototype.animationNameChanged=function(e,t){this.tabField.options.eq(this.currentTabIndex).html(t)},i.prototype.show=function(){NextendVisualEditorController.prototype.show.call(this),this.refreshTimeline()},i.prototype.hide=function(){this.clearTimeline(),NextendVisualEditorController.prototype.hide.call(this)},i.prototype.createTimeline=function(){this.timeline&&this.timeline.pause(0),this.timeline=new NextendTimeline({paused:1}),this.timeline.eventCallback("onComplete",e.proxy(function(){this.timeline.play(0,!1)},this)),this.timeline.set(this.preview.get(0),{transformOrigin:this.transformOrigin.split("|*|").join("% ")+"px"},0);var t=[];switch(this.currentPreviewMode){case"solo":t.push(e.extend({},this.currentVisual[this.currentTabIndex]));break;default:e.extend(!0,t,this.currentVisual)}for(var i=0;i<t.length;i++)t[i].delay>.5&&(t[i].delay=.5);switch(this.group){case"in":this.buildTimelineIn(this.timeline,this.preview.get(0),t,1);break;case"loop":"solo"==this.currentPreviewMode?this.buildTimelineOut(this.timeline,this.preview.get(0),t,1):this.buildTimelineLoop(this.timeline,this.preview.get(0),t,1);break;case"out":this.buildTimelineOut(this.timeline,this.preview.get(0),t,1);break;default:console.log(this.group+" animation is not supported!")}this.timeline.totalDuration()>0&&this.timeline.play()},i.prototype.refreshTimeline=NextendDeBounce(function(){this.clearTimeline(),this.createTimeline()},50),i.prototype.clearTimeline=function(){this.timeline&&(this.timeline.pause(),this.repeatTimeout&&clearTimeout(this.repeatTimeout),this.timeline.progress(1,!0))},i.prototype.setCurrentZero=function(t){NextendTween.set(t,e.extend({},this.currentZero))},i.prototype.buildTimelineIn=function(e,t,i,n){this.currentZero=o,"in"==this.group&&("solo"!=this.currentPreviewMode||this.currentTabIndex==this.currentVisual.length-1)&&this.specialZero&&i.length>0&&(this.currentZero=i.pop(),delete this.currentZero.name,this.currentZero.x=this.currentZero.x*n,this.currentZero.y=this.currentZero.y*n,this.currentZero.z=this.currentZero.z*n,this.currentZero.rotationX=-this.currentZero.rotationX,this.currentZero.rotationY=-this.currentZero.rotationY,this.currentZero.rotationZ=-this.currentZero.rotationZ,this.setCurrentZero(t));var r=0,a=this._buildAnimationChainIn(i,n,this.currentZero),s=0;if(a.length>0)for(e.fromTo(t,a[s].duration,a[s].from,a[s].to,r),r+=a[s].duration+a[s].to.delay,s++;s<a.length;s++)e.to(t,a[s].duration,a[s].to,r),r+=a[s].duration+a[s].to.delay},i.prototype._buildAnimationChainIn=function(t,i,n){for(var o=[{from:n}],r=t.length-1;r>=0;r--){var a=t[r],s=a.delay,l=a.duration,d=a.ease;delete a.delay,delete a.duration,delete a.ease,delete a.name;var h=o[0].from;a.x=-a.x*i,a.y=-a.y*i,a.z=-a.z*i,a.rotationX=-a.rotationX,a.rotationY=-a.rotationY,a.rotationZ=-a.rotationZ,o.unshift({duration:l,from:a,to:e.extend({},h,{ease:d,delay:s})})}return o.pop(),o},i.prototype.buildTimelineLoop=function(e,t,i,n){var o=this._buildAnimationChainLoop(i,n),r=0;if(o.length>0)for(e.fromTo(t,o[r].duration,o[r].from,o[r].to),r++;r<o.length;r++)e.to(t,o[r].duration,o[r].to)},i.prototype._buildAnimationChainLoop=function(t,i){if(delete t[0].name,1==t.length){var n=t[0],r=e.extend({},o);if(r.duration=n.duration,r.ease=n.ease,(360==n.rotationX||360==n.rotationY||360==n.rotationZ)&&1==n.opacity&&0==n.x&&0==n.y&&0==n.z&&1==n.scaleX&&1==n.scaleY&&1==n.scaleZ&&0==n.skewX&&0==n.n2blur)return[{duration:t[0].duration,from:e.extend({},o),to:t[0]}];t.unshift(r)}var a=0,s=[{duration:t[a].duration,to:t[a]}];for(a++;a<t.length;a++){var r=t[a],l=r.duration;delete r.duration,delete r.name;var d=e.extend({},s[s.length-1].to);delete d.delay,delete d.ease,r.x=r.x*i,r.y=r.y*i,r.z=r.z*i,s.push({duration:l,from:d,to:r})}return s.push({duration:s[0].duration,from:e.extend({},s[s.length-1].to),to:e.extend({},s[0].to)}),s.shift(),s},i.prototype.buildTimelineOut=function(e,t,i,n){var o=0,r=this._buildAnimationChainOut(i,n),a=0;if(r.length>0)for(e.fromTo(t,r[a].duration,r[a].from,r[a].to,o),o+=r[a].duration+r[a].to.delay,a++;a<r.length;a++)e.to(t,r[a].duration,r[a].to,o),o+=r[a].duration+r[a].to.delay},i.prototype._buildAnimationChainOut=function(t,i){for(var n=[{to:o}],r=0;r<t.length;r++){var a=t[r],s=a.duration;delete a.duration,delete a.name;var l=e.extend({},n[n.length-1].to);delete l.delay,delete l.ease,a.x=a.x*i,a.y=a.y*i,a.z=a.z*i,n.push({duration:s,from:l,to:a})}return n.shift(),n},i.prototype.loadSpecialZero=function(e){this.editor.fields.specialZero.element.data("field").insideChange(e),this.refreshSpecialZero(e)},i.prototype.refreshSpecialZero=function(e){this.specialZero=parseInt(e)?1:0,this.refreshTimeline()},i.prototype.loadRepeatCount=function(e){this.editor.fields.repeatCount.element.data("field").insideChange(e),this.refreshRepeatCount(e)},i.prototype.refreshRepeatCount=function(e){this.repeatCount=Math.max(0,parseInt(e))},i.prototype.loadRepeatStartDelay=function(e){this.editor.fields.repeatStartDelay.element.data("field").insideChange(1e3*e),this.refreshRepeatStartDelay(e)},i.prototype.refreshRepeatStartDelay=function(e){this.repeatStartDelay=Math.max(0,parseFloat(e))},i.prototype.loadTransformOrigin=function(e){this.editor.fields.transformOrigin.element.data("field").insideChange(e),this.refreshTransformOrigin(e)},i.prototype.refreshTransformOrigin=function(e){this.transformOrigin=e,NextendTween.set(this.preview.parent().get(0),{perspective:"1000px"}),this.refreshTimeline()},i.prototype.loadPlayEvent=function(e){this.editor.fields.playEvent.element.data("field").insideChange(e),this.refreshPlayEvent(e)},i.prototype.refreshPlayEvent=function(e){this.playEvent=e},i.prototype.loadPauseEvent=function(e){this.editor.fields.pauseEvent.element.data("field").insideChange(e),this.refreshPauseEvent(e)},i.prototype.refreshPauseEvent=function(e){this.pauseEvent=e},i.prototype.loadStopEvent=function(e){this.editor.fields.stopEvent.element.data("field").insideChange(e),this.refreshStopEvent(e)},i.prototype.refreshStopEvent=function(e){this.stopEvent=e},i.prototype.loadRepeatable=function(e){this.editor.fields.repeatable.element.data("field").insideChange(e),this.refreshRepeatable(e)},i.prototype.refreshRepeatable=function(e){this.repeatable=e},i.prototype.loadRepeatSelfOnly=function(e){this.editor.fields.repeatSelfOnly.element.data("field").insideChange(e),this.refreshRepeatSelfOnly(e)},i.prototype.refreshRepeatSelfOnly=function(e){this.repeatSelfOnly=e},i.prototype.loadInstantOut=function(e){this.editor.fields.instantOut.element.data("field").insideChange(e),this.refreshInstantOut(e)},i.prototype.refreshInstantOut=function(e){this.instantOut=e},i.prototype.featureSpecialZero=function(e){var t=this.editor.fields.specialZero.element.closest("tr");e?t.removeClass("n2-hidden"):t.addClass("n2-hidden")},i.prototype.featureRepeat=function(e){var t=this.editor.fields.repeatCount.element.closest("tr").add(this.editor.fields.repeatStartDelay.element.closest("tr"));e?t.removeClass("n2-hidden"):t.addClass("n2-hidden")},i.prototype.featurePlayEvent=function(e){var t=this.editor.fields.playEvent.element.closest(".n2-mixed-group");e?t.removeClass("n2-hidden"):t.addClass("n2-hidden")},i.prototype.featurePauseEvent=function(e){var t=this.editor.fields.pauseEvent.element.closest(".n2-mixed-group");e?t.removeClass("n2-hidden"):t.addClass("n2-hidden")},i.prototype.featureStopEvent=function(e){var t=this.editor.fields.stopEvent.element.closest(".n2-mixed-group");e?t.removeClass("n2-hidden"):t.addClass("n2-hidden")},i.prototype.featureRepeatable=function(e){var t=this.editor.fields.repeatable.element.closest(".n2-mixed-group");e?t.removeClass("n2-hidden"):t.addClass("n2-hidden")},i.prototype.featureRepeatSelfOnly=function(e){var t=this.editor.fields.repeatSelfOnly.element.closest(".n2-mixed-group");e?t.removeClass("n2-hidden"):t.addClass("n2-hidden")},i.prototype.featureInstantOut=function(e){var t=this.editor.fields.instantOut.element.closest(".n2-mixed-group");e?t.removeClass("n2-hidden"):t.addClass("n2-hidden")},t.NextendAnimationEditorController=i,n.prototype=Object.create(NextendVisualEditor.prototype),n.prototype.constructor=n,n.prototype.load=function(e){this._off(),this.fields.name.element.data("field").insideChange(e.name),this.fields.duration.element.data("field").insideChange(1e3*e.duration),this.fields.delay.element.data("field").insideChange(1e3*e.delay),this.fields.easing.element.data("field").insideChange(e.ease),this.fields.opacity.element.data("field").insideChange(100*e.opacity),this.fields.offset.element.data("field").insideChange(e.x+"|*|"+e.y+"|*|"+e.z),this.fields.rotate.element.data("field").insideChange(e.rotationX+"|*|"+e.rotationY+"|*|"+e.rotationZ),this.fields.scale.element.data("field").insideChange(100*e.scaleX+"|*|"+100*e.scaleY+"|*|"+100*e.scaleZ),this.fields.skew.element.data("field").insideChange(e.skewX),this.fields.n2blur.element.data("field").insideChange(e.n2blur),this.fields.specialZero.element.data("field").insideChange(nextend.animationManager.controller.specialZero),this.fields.repeatCount.element.data("field").insideChange(nextend.animationManager.controller.repeatCount),this.fields.repeatStartDelay.element.data("field").insideChange(1e3*nextend.animationManager.controller.repeatStartDelay),this.fields.transformOrigin.element.data("field").insideChange(nextend.animationManager.controller.transformOrigin),this.fields.playEvent.element.data("field").insideChange(nextend.animationManager.controller.playEvent),this.fields.pauseEvent.element.data("field").insideChange(nextend.animationManager.controller.pauseEvent),this.fields.stopEvent.element.data("field").insideChange(nextend.animationManager.controller.stopEvent),this.fields.repeatable.element.data("field").insideChange(nextend.animationManager.controller.repeatable),this.fields.repeatSelfOnly.element.data("field").insideChange(nextend.animationManager.controller.repeatSelfOnly),this.fields.instantOut.element.data("field").insideChange(nextend.animationManager.controller.instantOut),this._on()},n.prototype.changeName=function(){this.trigger("name",this.fields.name.element.val()),this.$.trigger("nameChanged",this.fields.name.element.val())},n.prototype.changeDuration=function(){this.trigger("duration",this.fields.duration.element.val()/1e3)},n.prototype.changeDelay=function(){this.trigger("delay",this.fields.delay.element.val()/1e3)},n.prototype.changeEasing=function(){this.trigger("ease",this.fields.easing.element.val())},n.prototype.changeOpacity=function(){this.trigger("opacity",this.fields.opacity.element.val()/100)},n.prototype.changeOffset=function(){var e=this.fields.offset.element.val().split("|*|");this.trigger("x",e[0]),this.trigger("y",e[1]),this.trigger("z",e[2])},n.prototype.changeRotate=function(){var e=this.fields.rotate.element.val().split("|*|");this.trigger("rotationX",e[0]),this.trigger("rotationY",e[1]),this.trigger("rotationZ",e[2])},n.prototype.changeScale=function(){var e=this.fields.scale.element.val().split("|*|");this.trigger("scaleX",e[0]/100),this.trigger("scaleY",e[1]/100),this.trigger("scaleZ",e[2]/100)},n.prototype.changeSkew=function(){this.trigger("skewX",this.fields.skew.element.val())},n.prototype.changeN2blur=function(){this.trigger("n2blur",this.fields.n2blur.element.val())},n.prototype.changeTransformOrigin=function(){nextend.animationManager.controller.refreshTransformOrigin(this.fields.transformOrigin.element.val())},n.prototype.changeSpecialZero=function(){nextend.animationManager.controller.refreshSpecialZero(this.fields.specialZero.element.val())},n.prototype.changeRepeatCount=function(){nextend.animationManager.controller.refreshRepeatCount(this.fields.repeatCount.element.val())},n.prototype.changeRepeatStartDelay=function(){nextend.animationManager.controller.refreshRepeatStartDelay(this.fields.repeatStartDelay.element.val()/1e3)},n.prototype.changePlayEvent=function(){nextend.animationManager.controller.refreshPlayEvent(this.fields.playEvent.element.val())},n.prototype.changePauseEvent=function(){nextend.animationManager.controller.refreshPauseEvent(this.fields.pauseEvent.element.val())},n.prototype.changeStopEvent=function(){nextend.animationManager.controller.refreshStopEvent(this.fields.stopEvent.element.val())},n.prototype.changeRepeatable=function(){nextend.animationManager.controller.refreshRepeatable(this.fields.repeatable.element.val())},n.prototype.changeRepeatSelfOnly=function(){nextend.animationManager.controller.refreshRepeatSelfOnly(this.fields.repeatSelfOnly.element.val())},n.prototype.changeInstantOut=function(){nextend.animationManager.controller.refreshInstantOut(this.fields.instantOut.element.val())},t.NextendAnimationEditor=n}(n2,window),function(e,t,i){function n(t,i){this.url=t,this.uploadAllowed=parseInt(i),this.currentPath=e.jStorage.get("browsePath","");var n=null;this.node=e('<div class="n2-browse-container"/>').on("dragover",function(t){null!==n?(clearTimeout(n),n=null):e(t.currentTarget).addClass("n2-drag-over"),n=setTimeout(function(){e(t.currentTarget).removeClass("n2-drag-over"),n=null},400)}),nextend.browse=this}var o={};n.prototype.clear=function(){this.uploadAllowed&&this.node.find("#n2-browse-upload").fileupload("destroy"),this.node.empty()},n.prototype.getNode=function(t,i){return this.clear(),this.mode=t,"multiple"==t&&(this.selected=[]),this.callback=i,this._loadPath(this.getCurrentFolder(),e.proxy(this._renderBoxes,this)),this.node},n.prototype._renderBoxes=function(t){this.clear(),this.uploadAllowed&&(this.node.append(e('<div class="n2-browse-box n2-browse-upload"><div class="n2-h4">'+n2_("Drop files anywhere to upload or")+' <br> <a class="n2-button n2-button-normal n2-button-m n2-radius-s n2-button-grey n2-uc n2-h4" href="#">'+n2_("Select files")+'</a></div><input id="n2-browse-upload" type="file" name="image" multiple></div>')),this.node.find("#n2-browse-upload").fileupload({url:NextendAjaxHelper.makeAjaxUrl(this.url,{nextendaction:"upload"}),sequentialUploads:!0,dropZone:this.node,pasteZone:!1,dataType:"json",paramName:"image",add:e.proxy(function(t,i){var n=e('<div class="n2-browse-box n2-browse-image"><div class="n2-button n2-button-icon n2-button-s n2-button-blue n2-radius-s"><i class="n2-i n2-it n2-i-tick"></i></div><div class="n2-browse-title">0%</div></div>'),o=this.node.find(".n2-browse-image");o.length>0?n.insertBefore(o.eq(0)):n.appendTo(this.node),i.box=n,i.formData={path:this.currentPath},i.submit()},this),progress:function(e,t){var i=parseInt(t.loaded/t.total*100,10);t.box.find(".n2-browse-title").html(i+"%")},done:e.proxy(function(t,i){var n=i.result;if(n.data&&n.data.name){o[n.data.path].data.files[n.data.name]=n.data.url,i.box.on("click",e.proxy(this.clickImage,this,n.data.url)).find(".n2-browse-title").html(n.data.name);var r=n.data.url.split(".").pop();"mp4"!=r&&"mp3"!=r&&i.box.css("background-image","url("+encodeURI(nextend.imageHelper.fixed(n.data.url))+")"),"multiple"==this.mode&&(this.selected.push(n.data.url),i.box.addClass("n2-active"))}else i.box.destroy();NextendAjaxHelper.notification(n)},this),fail:e.proxy(function(e,t){t.box.remove(),NextendAjaxHelper.notification(t.jqXHR.responseJSON)},this)}),e.jStorage.set("browsePath",this.getCurrentFolder())),""!=t.path&&this.node.append(e('<div class="n2-browse-box n2-browse-directory"><i class="n2-i n2-it n2-i-up"></i></div>').on("click",e.proxy(function(t){this._loadPath(t,e.proxy(this._renderBoxes,this))},this,t.path+"/..")));for(var i in t.directories)t.directories.hasOwnProperty(i)&&this.node.append(e('<div class="n2-browse-box n2-browse-directory"><i class="n2-i n2-it n2-i-folder"></i><div class="n2-browse-title">'+i+"</div></div>").on("click",e.proxy(function(t){this._loadPath(t,e.proxy(this._renderBoxes,this))},this,t.directories[i])));for(var i in t.files)if(t.files.hasOwnProperty(i)){var n=e('<div class="n2-browse-box n2-browse-image"><div class="n2-button n2-button-icon n2-button-s n2-button-blue n2-radius-s"><i class="n2-i n2-it n2-i-tick"></i></div><div class="n2-browse-title">'+i+"</div></div>").on("click",e.proxy(this.clickImage,this,t.files[i])),r=t.files[i].split(".").pop();"mp4"!=r&&"mp3"!=r&&n.css("background-image","url("+encodeURI(nextend.imageHelper.fixed(t.files[i]))+")"),this.node.append(n),"multiple"==this.mode&&-1!=e.inArray(t.files[i],this.selected)&&n.addClass("n2-active")}},n.prototype._loadPath=function(t,i){"undefined"==typeof o[t]&&(o[t]=NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.url),data:{path:t},dataType:"json"})),e.when(o[t]).done(e.proxy(function(e){this.currentPath=e.data.path,o[e.data.path]=e,o[t]=e,i(e.data)},this))},n.prototype.clickImage=function(t,i){if("single"==this.mode)this.callback(t);else if("multiple"==this.mode){var n=e.inArray(t,this.selected);-1==n?(e(i.currentTarget).addClass("n2-active"),this.selected.push(t)):(e(i.currentTarget).removeClass("n2-active"),this.selected.splice(n,1))}},n.prototype.getSelected=function(){return this.selected},n.prototype.getCurrentFolder=function(){return this.currentPath},t.NextendBrowse=n}(n2,window),function(e,t){function i(){NextendVisualManagerSetsAndMore.prototype.constructor.apply(this,arguments)}function n(){NextendVisualWithSetRow.prototype.constructor.apply(this,arguments)}i.prototype=Object.create(NextendVisualManagerSetsAndMore.prototype),i.prototype.constructor=i,i.prototype.loadDefaults=function(){NextendVisualManagerSetsAndMore.prototype.loadDefaults.apply(this,arguments),this.type="font",this.labels={visual:n2_("font"),visuals:n2_("fonts")},this.styleClassName="",this.styleClassName2=""},i.prototype.initController=function(){return new NextendFontEditorController(this.parameters.renderer.modes,this.parameters.defaultFamily)},i.prototype.addVisualUsage=function(e,t,i){if(parseInt(t)>0)return this._addLinkedFont(e,t,i);try{return this._renderStaticFont(e,t,i),!0}catch(n){return!1}},i.prototype._addLinkedFont=function(t,i,n){var o=this.parameters.renderer.usedFonts,r=e.Deferred();return e.when(this.getVisual(i)).done(e.proxy(function(i){i.id>0?("undefined"==typeof n?"undefined"==typeof o[i.id]?(o[i.id]=[t],this.renderLinkedFont(t,i,n)):-1==e.inArray(t,o[i.id])&&(o[i.id].push(t),this.renderLinkedFont(t,i,n)):this.renderLinkedFont(t,i,n),r.resolve(!0)):r.resolve(!1)},this)).fail(function(){r.resolve(!1)}),r},i.prototype.renderLinkedFont=function(e,t,i){"undefined"==typeof i&&(i=this.parameters.renderer.pre),nextend.css.add(this.renderer.getCSS(e,i,"."+this.getClass(t.id,e),t.value,{deleteRule:!0}))},i.prototype._renderStaticFont=function(e,t,i){"undefined"==typeof i&&(i=this.parameters.renderer.pre);var n=t;"{"!=n[0]&&(n=Base64.decode(n)),nextend.css.add(this.renderer.getCSS(e,i,"."+this.getClass(t,e),JSON.parse(n).data,{}))},i.prototype.removeUsedFont=function(t,i){var n=this.parameters.renderer.usedFonts;if("undefined"!=typeof n[i]){var o=e.inArray(t,n[i]);o>-1&&n[i].splice(o,1)}},i.prototype.getClass=function(e,t){return parseInt(e)>0?"n2-font-"+e+"-"+t:""==e?"":("{"==e&&(e=Base64.encode(e)),"n2-font-"+md5(e)+"-"+t)},i.prototype.createVisual=function(e,t){return new n(e,t,this)},i.prototype.setConnectedStyle=function(t){this.styleClassName=e("#"+t).data("field").renderStyle()},i.prototype.setConnectedStyle2=function(t){this.styleClassName2=e("#"+t).data("field").renderStyle();
},t.NextendFontManager=i,n.prototype=Object.create(NextendVisualWithSetRow.prototype),n.prototype.constructor=n,n.prototype.removeRules=function(){var e=this.isUsed();if(e)for(var t=0;t<e.length;t++)this.visualManager.removeRules(e[t],this)},n.prototype.render=function(){var e=this.isUsed();if(e)for(var t=0;t<e.length;t++)this.visualManager.renderLinkedFont(e[t],this)},n.prototype.isUsed=function(){return"undefined"!=typeof this.visualManager.parameters.renderer.usedFonts[this.id]?this.visualManager.parameters.renderer.usedFonts[this.id]:!1},t.NextendFont=n}(n2,window),function($,scope){function NextendFontEditorController(e,t){this.defaultFamily=t,NextendVisualEditorController.prototype.constructor.apply(this,arguments),this.fontSize=16,this.preview=$("#n2-font-editor-preview").css("fontSize","16px"),this.initBackgroundColor()}function NextendFontEditor(){NextendVisualEditor.prototype.constructor.apply(this,arguments),this.fields={family:{element:$("#n2-font-editorfamily"),events:{"nextendChange.n2-editor":$.proxy(this.changeFamily,this)}},color:{element:$("#n2-font-editorcolor"),events:{"outsideChange.n2-editor":$.proxy(this.changeColor,this)}},size:{element:$("#n2-font-editorsize"),events:{"outsideChange.n2-editor":$.proxy(this.changeSize,this)}},lineHeight:{element:$("#n2-font-editorlineheight"),events:{"outsideChange.n2-editor":$.proxy(this.changeLineHeight,this)}},weight:{element:$("#n2-font-editorweight"),events:{"outsideChange.n2-editor":$.proxy(this.changeWeight,this)}},decoration:{element:$("#n2-font-editordecoration"),events:{"outsideChange.n2-editor":$.proxy(this.changeDecoration,this)}},align:{element:$("#n2-font-editortextalign"),events:{"outsideChange.n2-editor":$.proxy(this.changeAlign,this)}},shadow:{element:$("#n2-font-editortshadow"),events:{"outsideChange.n2-editor":$.proxy(this.changeShadow,this)}},letterSpacing:{element:$("#n2-font-editorletterspacing"),events:{"outsideChange.n2-editor":$.proxy(this.changeLetterSpacing,this)}},wordSpacing:{element:$("#n2-font-editorwordspacing"),events:{"outsideChange.n2-editor":$.proxy(this.changeWordSpacing,this)}},textTransform:{element:$("#n2-font-editortexttransform"),events:{"outsideChange.n2-editor":$.proxy(this.changeTextTransform,this)}},css:{element:$("#n2-font-editorextracss"),events:{"outsideChange.n2-editor":$.proxy(this.changeCSS,this)}}}}function NextendFontRenderer(){NextendVisualRenderer.prototype.constructor.apply(this,arguments)}NextendFontEditorController.prototype=Object.create(NextendVisualEditorController.prototype),NextendFontEditorController.prototype.constructor=NextendFontEditorController,NextendFontEditorController.prototype.loadDefaults=function(){NextendVisualEditorController.prototype.loadDefaults.call(this),this.type="font",this.preview=null,this.fontSize=14},NextendFontEditorController.prototype.initPreviewModes=function(){this.previewModes={1:[this.previewModesList.simple],2:[this.previewModesList.link,this.previewModesList.hover,this.previewModesList.accordionslidetitle],3:[this.previewModesList.paragraph,this.previewModesList.list]}},NextendFontEditorController.prototype.initRenderer=function(){return new NextendFontRenderer(this)},NextendFontEditorController.prototype.initEditor=function(){return new NextendFontEditor},NextendFontEditorController.prototype._load=function(e,t,i){e.length&&(e[0]=$.extend({},this.getEmptyFont(),e[0])),NextendVisualEditorController.prototype._load.call(this,e,t,i)},NextendFontEditorController.prototype.asyncVisualData=function(e,t,i){e.length&&(e[0]=$.extend({},this.getEmptyFont(),e[0])),NextendVisualEditorController.prototype.asyncVisualData.call(this,e,t,i)},NextendFontEditorController.prototype.getEmptyFont=function(){return{color:"000000ff",size:"14||px",tshadow:"0|*|0|*|0|*|000000ff",afont:this.defaultFamily,lineheight:"1.5",bold:0,italic:0,underline:0,align:"left",letterspacing:"normal",wordspacing:"normal",texttransform:"none",extra:""}},NextendFontEditorController.prototype.getCleanVisual=function(){return{extra:""}},NextendFontEditorController.prototype.getEmptyVisual=function(){return[this.getEmptyFont()]},NextendFontEditorController.prototype.initBackgroundColor=function(){new N2Classes.FormElementText("n2-font-editor-background-color"),new N2Classes.FormElementColor("n2-font-editor-background-color",0);var e=this.lightbox.find(".n2-editor-preview-box");$("#n2-font-editor-background-color").on("nextendChange",function(){e.css("background","#"+$(this).val())})},NextendFontEditorController.prototype._renderPreview=function(){NextendVisualEditorController.prototype._renderPreview.call(this),this.addStyle(this.renderer.getCSS(this.currentPreviewMode,"","."+this.getPreviewCssClass(),this.currentVisual,{activeTab:this.currentTabIndex}))},NextendFontEditorController.prototype.setPreview=function(mode){var html="";html="undefined"!=typeof this.localModePreview[mode]?this.localModePreview[mode]:this.previewModesList[mode].preview;var fontClassName=this.getPreviewCssClass(),styleClassName=nextend.fontManager.styleClassName,styleClassName2=nextend.fontManager.styleClassName2;html=html.replace(/\{([^]*?)\}/g,function(match,script){return eval(script)}),this.preview.html(html)},NextendFontEditorController.prototype.getPreviewCssClass=function(){return"n2-"+this.type+"-editor-preview"},scope.NextendFontEditorController=NextendFontEditorController,NextendFontEditor.prototype=Object.create(NextendVisualEditor.prototype),NextendFontEditor.prototype.constructor=NextendFontEditor,NextendFontEditor.prototype.load=function(e){this._off();var t=e.afont.split("||");this.fields.family.element.data("field").insideChange(t[0]),this.fields.color.element.data("field").insideChange(e.color),this.fields.size.element.data("field").insideChange(e.size.split("||").join("|*|")),this.fields.lineHeight.element.data("field").insideChange(e.lineheight),this.fields.weight.element.data("field").insideChange(e.bold),this.fields.decoration.element.data("field").insideChange([1==e.italic?"italic":"",1==e.underline?"underline":""].join("||")),this.fields.align.element.data("field").insideChange(e.align),this.fields.shadow.element.data("field").insideChange(e.tshadow.replace(/\|\|px/g,"")),this.fields.letterSpacing.element.data("field").insideChange(e.letterspacing),this.fields.wordSpacing.element.data("field").insideChange(e.wordspacing),this.fields.textTransform.element.data("field").insideChange(e.texttransform),this.fields.css.element.data("field").insideChange(e.extra),this._on()},NextendFontEditor.prototype.changeFamily=function(){this.trigger("afont",this.fields.family.element.val())},NextendFontEditor.prototype.changeColor=function(){this.trigger("color",this.fields.color.element.val())},NextendFontEditor.prototype.changeSize=function(){this.trigger("size",this.fields.size.element.val().replace("|*|","||"))},NextendFontEditor.prototype.changeLineHeight=function(){this.trigger("lineheight",this.fields.lineHeight.element.val())},NextendFontEditor.prototype.changeWeight=function(){this.trigger("weight",this.fields.weight.element.val())},NextendFontEditor.prototype.changeDecoration=function(){var e=this.fields.decoration.element.val(),t=0;-1!=e.indexOf("italic")&&(t=1),this.trigger("italic",t);var i=0;-1!=e.indexOf("underline")&&(i=1),this.trigger("underline",i)},NextendFontEditor.prototype.changeAlign=function(){this.trigger("align",this.fields.align.element.val())},NextendFontEditor.prototype.changeShadow=function(){this.trigger("tshadow",this.fields.shadow.element.val())},NextendFontEditor.prototype.changeLetterSpacing=function(){this.trigger("letterspacing",this.fields.letterSpacing.element.val())},NextendFontEditor.prototype.changeWordSpacing=function(){this.trigger("wordspacing",this.fields.wordSpacing.element.val())},NextendFontEditor.prototype.changeTextTransform=function(){this.trigger("texttransform",this.fields.textTransform.element.val())},NextendFontEditor.prototype.changeCSS=function(){this.trigger("extra",this.fields.css.element.val())},scope.NextendFontEditor=NextendFontEditor,NextendFontRenderer.prototype=Object.create(NextendVisualRenderer.prototype),NextendFontRenderer.prototype.constructor=NextendFontRenderer,NextendFontRenderer.prototype.getCSS=function(e,t,i,n,o){if(n=$.extend([],n),n[0]=$.extend(this.editorController.getEmptyFont(),n[0]),this.editorController.previewModesList[e].renderOptions.combined)for(var r=1;r<n.length;r++)n[r]=$.extend({},n[r-1],n[r]),n[r].size==n[0].size&&(n[r].size="100||%");return NextendVisualRenderer.prototype.getCSS.call(this,e,t,i,n,o)},NextendFontRenderer.prototype.makeStylecolor=function(e,t){t.color="#"+e.substr(0,6)+";\ncolor: "+N2Color.hex2rgbaCSS(e)},NextendFontRenderer.prototype.makeStylesize=function(e,t){var i=e.split("||");"px"==i[1]?t.fontSize=i[0]/this.editorController.fontSize*100+"%":t.fontSize=e.replace("||","")},NextendFontRenderer.prototype.makeStyletshadow=function(e,t){var i=e.split("|*|");"0"==i[0]&&"0"==i[1]&&"0"==i[2]?t.textShadow="none":t.textShadow=i[0]+"px "+i[1]+"px "+i[2]+"px "+N2Color.hex2rgbaCSS(i[3])},NextendFontRenderer.prototype.makeStyleafont=function(e,t){for(var i=e.split(","),n=0;n<i.length;n++)i[n]=this.getFamily(i[n].replace(/^\s+|\s+$/gm,"").replace(/"|'/gm,""));t.fontFamily=i.join(",")},NextendFontRenderer.prototype.getFamily=function(e){var t=$(window).triggerHandler("n2Family",[e]);return void 0===t&&(t=e),"'"+t+"'"},NextendFontRenderer.prototype.makeStylelineheight=function(e,t){t.lineHeight=e},NextendFontRenderer.prototype.makeStyleweight=NextendFontRenderer.prototype.makeStylebold=function(e,t){1==e?t.fontWeight="bold":e>1?t.fontWeight=e:t.fontWeight="normal"},NextendFontRenderer.prototype.makeStyleitalic=function(e,t){1==e?t.fontStyle="italic":t.fontStyle="normal"},NextendFontRenderer.prototype.makeStyleunderline=function(e,t){1==e?t.textDecoration="underline":t.textDecoration="none"},NextendFontRenderer.prototype.makeStylealign=function(e,t){t.textAlign=e},NextendFontRenderer.prototype.makeStyleletterspacing=function(e,t){t.letterSpacing=e},NextendFontRenderer.prototype.makeStylewordspacing=function(e,t){t.wordSpacing=e},NextendFontRenderer.prototype.makeStyletexttransform=function(e,t){t.textTransform=e},NextendFontRenderer.prototype.makeStyleextra=function(e,t){t.raw=e},scope.NextendFontRenderer=NextendFontRenderer}(n2,window),N2Require("Icons",[],[],function(e,t,i){function n(e){t.Icons=this,this.data=e,this.keys={};for(var i in this.data)this.keys[this.data[i].id]=this.data[i]}n.prototype.render=function(t){var n=t.split(":");if(2!=n.length)return!1;var o=n[0],r=n[1];if(this.keys[o]==i)return!1;var a=this.keys[o];return a.data[r]==i?!1:(a.isLoaded==i&&(e("head").append("<link rel='stylesheet' href='"+a.css+"' type='text/css' media='screen'>"),a.isLoaded=!0),a.isLigature?{"class":a["class"],ligature:r}:{"class":a["class"]+" "+a.prefix+r,ligature:""})},n.prototype._render=function(e,t){return e.isLigature?'<i class="n2i '+e["class"]+'">'+t+"</i>":'<i class="n2i '+e["class"]+" "+e.prefix+t+'"></i>'};var o=!1;return n.prototype.showModal=function(t){if(o=t,this.modal==i){var n=e("<div></div>"),r=e('<input class="n2-h5" placeholder="'+n2_("Search")+'" type="text" name="search-icon" value="" style="width:280px;"/>').appendTo(e('<div class="n2-form-element-text n2-border-radius" style="margin: 10px 0 0 20px;"/>').appendTo(n));for(var a in this.data){var s=this.data[a];s.isLoaded==i&&(e("head").append("<link rel='stylesheet' href='"+s.css+"' type='text/css' media='screen'>"),s.isLoaded=!0);var l=e('<div class="n2-form-tab "></div>').appendTo(n);l.append('<div class="n2-h2 n2-content-box-title-bg">'+s.label+"</div>");var d=e('<div class="n2-description"></div>').appendTo(l);for(var h in s.data)e('<div class="n2-icon" data-identifier="'+s.id+":"+h+'" data-kw="'+s.data[h].kw.toLowerCase()+'">'+this._render(s,h)+"</div>").on("click",e.proxy(function(t){o(e(t.currentTarget).data("identifier")),this.modal.hide(t)},this)).appendTo(d)}var p=n.find(".n2-icon");r.on("keyup",e.proxy(function(t){var i=e(t.target).val();if(i.length<=1)p.css("display","");else{var n=p.filter("[data-kw*='"+i+"']");p.not(n).css("display","none"),n.css("display","")}},this)),this.modal=new NextendModal({zero:{size:[1200,600],fit:!0,title:"Icons",back:!1,close:!0,content:n}},!1),this.modal.setCustomClass("n2-icons-modal")}this.modal.show()},n}),function(e,t){function i(){this.referenceKeys={},NextendVisualManagerCore.prototype.constructor.apply(this,arguments)}function n(){NextendVisualCore.prototype.constructor.apply(this,arguments)}i.prototype=Object.create(NextendVisualManagerCore.prototype),i.prototype.constructor=i,i.prototype.loadDefaults=function(){NextendVisualManagerCore.prototype.loadDefaults.apply(this,arguments),this.type="image",this.labels={visual:n2_("image"),visuals:n2_("images")},this.fontClassName=""},i.prototype.initController=function(){return new NextendImageEditorController},i.prototype.createVisual=function(e){return new n(e,this)},i.prototype.firstLoadVisuals=function(e){for(var t=0;t<e.length;t++)this.referenceKeys[e[t].hash]=this.visuals[e[t].id]=this.createVisual(e[t])},i.prototype.getVisual=function(t){if(""!=t){var i=md5(t);if("undefined"!=typeof this.referenceKeys[i])return this.referenceKeys[i];if("undefined"!=typeof this.visualLoadDeferreds[i])return this.visualLoadDeferreds[i];var n=e.Deferred();return this.visualLoadDeferreds[i]=n,this._loadVisualFromServer(t).done(e.proxy(function(){n.resolve(this.referenceKeys[i]),delete this.visualLoadDeferreds[i]},this)).fail(e.proxy(function(){n.resolve({id:-1,name:n2_("Empty")}),delete this.visualLoadDeferreds[i]},this)),n}nextend.notificationCenter.error("The image is empty",{timeout:3})},i.prototype._loadVisualFromServer=function(t){return NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(this.parameters.ajaxUrl,{nextendaction:"loadVisualForImage"}),data:{image:t},dataType:"json"}).done(e.proxy(function(e){var t=e.data.visual;this.referenceKeys[t.hash]=this.visuals[t.id]=this.createVisual(t)},this))},i.prototype.isVisualData=function(e){return""!=e},i.prototype.setVisual=function(t){t.preventDefault(),this.controller.isChanged?this.saveActiveVisual(this.activeVisual.name).done(e.proxy(function(i){e(window).trigger(i.data.visual.hash,this.activeVisual.value),this.hide(t)},this)):this.hide(t)},i.prototype.getBase64=function(){return Base64.encode(JSON.stringify(this.controller.get("set")))},i.prototype.loadDataToController=function(t){this.isVisualData(t)?e.when(this.getVisual(t)).done(e.proxy(function(e){e.id>0?e.activate():console.error(t+" visual is not found linked")},this)):(this.hide(),nextend.notificationCenter.error("Image field can not be empty!"))},t.NextendImageManager=i,n.prototype=Object.create(NextendVisualCore.prototype),n.prototype.constructor=n,n.prototype.setValue=function(e,t){this.base64=e,this.value=JSON.parse(Base64.decode(e))},n.prototype.activate=function(e){"undefined"!=typeof e&&e.preventDefault(),this.visualManager.changeActiveVisual(this),this.visualManager.controller.load(this,!1,this.visualManager.showParameters)},t.NextendImage=n}(n2,window),function(e,t){function i(){NextendVisualEditorControllerWithEditor.prototype.constructor.apply(this,arguments)}function n(){this.previews=null,this.desktopImage="",NextendVisualEditor.prototype.constructor.apply(this,arguments),this.fields={"desktop-size":{element:e("#n2-image-editordesktop-size"),events:{"nextendChange.n2-editor":e.proxy(this.changeSize,this,"desktop")}},"desktop-retina-image":{element:e("#n2-image-editordesktop-retina-image"),events:{"nextendChange.n2-editor":e.proxy(this.changeImage,this,"desktop-retina")}},"desktop-retina-size":{element:e("#n2-image-editordesktop-retina-size"),events:{"nextendChange.n2-editor":e.proxy(this.changeSize,this,"desktop-retina")}},"tablet-image":{element:e("#n2-image-editortablet-image"),events:{"nextendChange.n2-editor":e.proxy(this.changeImage,this,"tablet")}},"tablet-size":{element:e("#n2-image-editortablet-size"),events:{"nextendChange.n2-editor":e.proxy(this.changeSize,this,"tablet")}},"tablet-retina-image":{element:e("#n2-image-editortablet-retina-image"),events:{"nextendChange.n2-editor":e.proxy(this.changeImage,this,"tablet-retina")}},"tablet-retina-size":{element:e("#n2-image-editortablet-retina-size"),events:{"nextendChange.n2-editor":e.proxy(this.changeSize,this,"tablet-retina")}},"mobile-image":{element:e("#n2-image-editormobile-image"),events:{"nextendChange.n2-editor":e.proxy(this.changeImage,this,"mobile")}},"mobile-size":{element:e("#n2-image-editormobile-size"),events:{"nextendChange.n2-editor":e.proxy(this.changeSize,this,"mobile")}},"mobile-retina-image":{element:e("#n2-image-editormobile-retina-image"),events:{"nextendChange.n2-editor":e.proxy(this.changeImage,this,"mobile-retina")}},"mobile-retina-size":{element:e("#n2-image-editormobile-retina-size"),events:{"nextendChange.n2-editor":e.proxy(this.changeSize,this,"mobile-retina")}}},this.previews={desktop:e("#n2-image-editordesktop-preview"),"desktop-retina":e("#n2-image-editordesktop-retina-preview"),tablet:e("#n2-image-editortablet-preview"),"tablet-retina":e("#n2-image-editortablet-retina-preview"),mobile:e("#n2-image-editormobile-preview"),"mobile-retina":e("#n2-image-editormobile-retina-preview")};e(this.buttonGenerate()).on("click",e.proxy(this.generateImage,this,"tablet")).insertAfter(this.fields["tablet-image"].element.parent()),e(this.buttonGenerate()).on("click",e.proxy(this.generateImage,this,"mobile")).insertAfter(this.fields["mobile-image"].element.parent())}i.prototype=Object.create(NextendVisualEditorControllerWithEditor.prototype),i.prototype.constructor=i,i.prototype.loadDefaults=function(){NextendVisualEditorControllerWithEditor.prototype.loadDefaults.call(this),this.type="image",this.currentImage=""},i.prototype.get=function(e){return this.currentVisual},i.prototype.getEmptyVisual=function(){return{desktop:{size:"0|*|0"},"desktop-retina":{image:"",size:"0|*|0"},tablet:{image:"",size:"0|*|0"},"tablet-retina":{image:"",size:"0|*|0"},mobile:{image:"",size:"0|*|0"},"mobile-retina":{image:"",size:"0|*|0"}}},i.prototype.initEditor=function(){return new n},i.prototype._load=function(e,t,i){this.currentImage=e.visual.image,NextendVisualEditorControllerWithEditor.prototype._load.call(this,e.value,t,i)},i.prototype.loadToEditor=function(){this.currentVisual=e.extend({},this.getEmptyVisual(),this.currentVisual),this.editor.load(this.currentImage,this.currentVisual)},i.prototype.propertyChanged=function(e,t,i,n){this.isChanged=!0,this.currentVisual[t][i]=n},t.NextendImageEditorController=i,n.prototype=Object.create(NextendVisualEditor.prototype),n.prototype.constructor=n,n.prototype.load=function(t,i){this._off();for(var n in this.fields){var o=[n.substring(0,n.lastIndexOf("-")),n.substring(n.lastIndexOf("-")+1)];this.fields[n].element.data("field").insideChange(i[o[0]][o[1]])}this.desktopImage=t,this.makePreview("desktop",t),"0|*|0"==i.desktop.size&&this.getImageSize(t).done(e.proxy(function(e,t){this.fields["desktop-size"].element.data("field").insideChange(e+"|*|"+t)},this));for(var n in i)"undefined"!=typeof i[n].image&&this.makePreview(n,i[n].image);this._on()},n.prototype.changeImage=function(t,i,n){var o=n.element.val();this.makePreview(t,o)?this.getImageSize(o).done(e.proxy(function(e,i){this.fields[t+"-size"].element.data("field").insideChange(e+"|*|"+i)},this)):this.fields[t+"-size"].element.data("field").insideChange("0|*|0"),this.trigger(t,"image",o)},n.prototype.changeSize=function(e,t,i){this.trigger(e,"size",i.element.val())},n.prototype.makePreview=function(e,t){return t?(this.previews[e].html('<img style="max-width:100%; max-height: 300px;" src="'+nextend.imageHelper.fixed(t)+'" />'),!0):(this.previews[e].html(""),!1)},n.prototype.getImageSize=function(t){var i=e.Deferred(),n=new Image;return n.onload=function(){i.resolve(n.width,n.height)},n.src=nextend.imageHelper.fixed(t),(n.complete||4===n.readyState)&&n.onload(),i},n.prototype.buttonGenerate=function(){return'<a href="#" class="n2-button n2-button-normal n2-button-m n2-radius-s n2-button-grey n2-h5 n2-uc">'+n2_("Generate")+"</a>"},n.prototype.generateImage=function(t){var i=this.desktopImage;return""==i?(nextend.notificationCenter.error(n2_("Desktop image is empty!"),{timeout:3}),!1):NextendAjaxHelper.ajax({type:"POST",url:NextendAjaxHelper.makeAjaxUrl(nextend.imageManager.parameters.ajaxUrl,{nextendaction:"generateImage"}),data:{device:t,image:i},dataType:"json"}).done(e.proxy(function(e){var i=e.data.image;this.fields[t+"-image"].element.data("field").insideChange(nextend.imageHelper.make(i))},this))},n.prototype.trigger=function(e,t,i){this.$.trigger("change",[e,t,i])},t.NextendImageEditor=n}(n2,window),function(e,t){function i(){NextendVisualManagerSetsAndMore.prototype.constructor.apply(this,arguments)}function n(){NextendVisualWithSetRow.prototype.constructor.apply(this,arguments)}i.prototype=Object.create(NextendVisualManagerSetsAndMore.prototype),i.prototype.constructor=i,i.prototype.loadDefaults=function(){NextendVisualManagerSetsAndMore.prototype.loadDefaults.apply(this,arguments),this.type="style",this.labels={visual:n2_("style"),visuals:n2_("styles")},this.styleClassName2="",this.fontClassName="",this.fontClassName2=""},i.prototype.initController=function(){return new NextendStyleEditorController(this.parameters.renderer.modes)},i.prototype.addVisualUsage=function(e,t,i){if(parseInt(t)>0)return this._addLinkedStyle(e,t,i);try{return this._renderStaticStyle(e,t,i),!0}catch(n){return!1}},i.prototype._addLinkedStyle=function(t,i,n){var o=this.parameters.renderer.usedStyles,r=e.Deferred();return e.when(this.getVisual(i)).done(e.proxy(function(i){i.id>0?("undefined"==typeof n?"undefined"==typeof o[i.id]?(o[i.id]=[t],this.renderLinkedStyle(t,i,n)):-1==e.inArray(t,o[i.id])&&(o[i.id].push(t),this.renderLinkedStyle(t,i,n)):this.renderLinkedStyle(t,i,n),r.resolve(!0)):r.resolve(!1)},this)).fail(function(){r.resolve(!1)}),r},i.prototype.renderLinkedStyle=function(e,t,i){"undefined"==typeof i&&(i=this.parameters.renderer.pre),nextend.css.add(this.renderer.getCSS(e,i,"."+this.getClass(t.id,e),t.value,{deleteRule:!0}))},i.prototype._renderStaticStyle=function(e,t,i){"undefined"==typeof i&&(i=this.parameters.renderer.pre);var n=t;"{"!=n[0]&&(n=Base64.decode(n)),nextend.css.add(this.renderer.getCSS(e,i,"."+this.getClass(t,e),JSON.parse(n).data,{}))},i.prototype.removeUsedStyle=function(t,i){var n=this.parameters.renderer.usedStyles;if("undefined"!=typeof n[i]){var o=e.inArray(t,n[i]);o>-1&&n[i].splice(o,1)}},i.prototype.getClass=function(e,t){return parseInt(e)>0?"n2-style-"+e+"-"+t:""==e?"":"n2-style-"+md5(e)+"-"+t},i.prototype.createVisual=function(e,t){return new n(e,t,this)},i.prototype.setConnectedStyle=function(t){this.styleClassName2=e("#"+t).data("field").renderStyle()},i.prototype.setConnectedFont=function(t){this.fontClassName=e("#"+t).data("field").renderFont()},i.prototype.setConnectedFont2=function(t){this.fontClassName2=e("#"+t).data("field").renderFont()},t.NextendStyleManager=i,n.prototype=Object.create(NextendVisualWithSetRow.prototype),n.prototype.constructor=n,n.prototype.removeRules=function(){var e=this.isUsed();if(e)for(var t=0;t<e.length;t++)this.visualManager.removeRules(e[t],this)},n.prototype.render=function(){var e=this.isUsed();if(e)for(var t=0;t<e.length;t++)this.visualManager.renderLinkedStyle(e[t],this)},n.prototype.isUsed=function(){return"undefined"!=typeof this.visualManager.parameters.renderer.usedStyles[this.id]?this.visualManager.parameters.renderer.usedStyles[this.id]:!1},t.NextendStyle=n}(n2,window),function($,scope){function NextendStyleEditorController(){NextendVisualEditorController.prototype.constructor.apply(this,arguments),this.preview=$("#n2-style-editor-preview").css("fontSize","16px"),this.initBackgroundColor()}function NextendStyleEditor(){NextendVisualEditor.prototype.constructor.apply(this,arguments),this.fields={backgroundColor:{element:$("#n2-style-editorbackgroundcolor"),events:{"nextendChange.n2-editor":$.proxy(this.changeBackgroundColor,this)}},opacity:{element:$("#n2-style-editoropacity"),events:{"outsideChange.n2-editor":$.proxy(this.changeOpacity,this)}},padding:{element:$("#n2-style-editorpadding"),events:{"outsideChange.n2-editor":$.proxy(this.changePadding,this)}},boxShadow:{element:$("#n2-style-editorboxshadow"),events:{"outsideChange.n2-editor":$.proxy(this.changeBoxShadow,this)}},border:{element:$("#n2-style-editorborder"),events:{"outsideChange.n2-editor":$.proxy(this.changeBorder,this)}},borderRadius:{element:$("#n2-style-editorborderradius"),events:{"outsideChange.n2-editor":$.proxy(this.changeBorderRadius,this)}},extracss:{element:$("#n2-style-editorextracss"),events:{"outsideChange.n2-editor":$.proxy(this.changeExtraCSS,this)}}}}function NextendStyleRenderer(){NextendVisualRenderer.prototype.constructor.apply(this,arguments)}NextendStyleEditorController.prototype=Object.create(NextendVisualEditorController.prototype),NextendStyleEditorController.prototype.constructor=NextendStyleEditorController,NextendStyleEditorController.prototype.loadDefaults=function(){NextendVisualEditorController.prototype.loadDefaults.call(this),this.type="style",this.preview=null},NextendStyleEditorController.prototype.initPreviewModes=function(){this.previewModes={2:[this.previewModesList.button,this.previewModesList.box],3:[this.previewModesList.paragraph]}},NextendStyleEditorController.prototype.initRenderer=function(){return new NextendStyleRenderer(this)},NextendStyleEditorController.prototype.initEditor=function(){return new NextendStyleEditor},NextendStyleEditorController.prototype._load=function(e,t,i){e.length&&(e[0]=$.extend({},this.getEmptyStyle(),e[0])),NextendVisualEditorController.prototype._load.call(this,e,t,i)},NextendStyleEditorController.prototype.asyncVisualData=function(e,t,i){e.length&&(e[0]=$.extend({},this.getEmptyStyle(),e[0])),NextendVisualEditorController.prototype.asyncVisualData.call(this,e,t,i)},NextendStyleEditorController.prototype.getEmptyStyle=function(){return{backgroundcolor:"ffffff00",opacity:100,padding:"0|*|0|*|0|*|0|*|px",boxshadow:"0|*|0|*|0|*|0|*|000000ff",border:"0|*|solid|*|000000ff",borderradius:"0",extra:""}},NextendStyleEditorController.prototype.getCleanVisual=function(){return{extra:""}},NextendStyleEditorController.prototype.getEmptyVisual=function(){return[this.getEmptyStyle()]},NextendStyleEditorController.prototype.initBackgroundColor=function(){new N2Classes.FormElementText("n2-style-editor-background-color"),new N2Classes.FormElementColor("n2-style-editor-background-color",0);var e=this.lightbox.find(".n2-editor-preview-box");$("#n2-style-editor-background-color").on("nextendChange",function(){e.css("background","#"+$(this).val())})},NextendStyleEditorController.prototype._renderPreview=function(){NextendVisualEditorController.prototype._renderPreview.call(this),this.addStyle(this.renderer.getCSS(this.currentPreviewMode,"","."+this.getPreviewCssClass(),this.currentVisual,{activeTab:this.currentTabIndex}))},NextendStyleEditorController.prototype.setPreview=function(mode){var html="";html="undefined"!=typeof this.localModePreview[mode]&&""!=this.localModePreview[mode]?this.localModePreview[mode]:this.previewModesList[mode].preview;var styleClassName=this.getPreviewCssClass(),fontClassName=nextend.styleManager.fontClassName,fontClassName2=nextend.styleManager.fontClassName2,styleClassName2=nextend.styleManager.styleClassName2;html=html.replace(/\{([^]*?)\}/g,function(match,script){return eval(script)}),this.preview.html(html)},NextendStyleEditorController.prototype.getPreviewCssClass=function(){return"n2-"+this.type+"-editor-preview"},scope.NextendStyleEditorController=NextendStyleEditorController,NextendStyleEditor.prototype=Object.create(NextendVisualEditor.prototype),NextendStyleEditor.prototype.constructor=NextendStyleEditor,NextendStyleEditor.prototype.load=function(e){this._off(),this.fields.backgroundColor.element.data("field").insideChange(e.backgroundcolor),this.fields.opacity.element.data("field").insideChange(e.opacity),this.fields.padding.element.data("field").insideChange(e.padding),this.fields.boxShadow.element.data("field").insideChange(e.boxshadow),this.fields.border.element.data("field").insideChange(e.border),this.fields.borderRadius.element.data("field").insideChange(e.borderradius),this.fields.extracss.element.data("field").insideChange(e.extra),this._on()},NextendStyleEditor.prototype.changeBackgroundColor=function(){this.trigger("backgroundcolor",this.fields.backgroundColor.element.val())},NextendStyleEditor.prototype.changeOpacity=function(){this.trigger("opacity",this.fields.opacity.element.val())},NextendStyleEditor.prototype.changePadding=function(){this.trigger("padding",this.fields.padding.element.val())},NextendStyleEditor.prototype.changeBoxShadow=function(){this.trigger("boxshadow",this.fields.boxShadow.element.val())},NextendStyleEditor.prototype.changeBorder=function(){this.trigger("border",this.fields.border.element.val())},NextendStyleEditor.prototype.changeBorderRadius=function(){this.trigger("borderradius",this.fields.borderRadius.element.val())},NextendStyleEditor.prototype.changeExtraCSS=function(){this.trigger("extra",this.fields.extracss.element.val())},scope.NextendStyleEditor=NextendStyleEditor,NextendStyleRenderer.prototype=Object.create(NextendVisualRenderer.prototype),NextendStyleRenderer.prototype.constructor=NextendStyleRenderer,NextendStyleRenderer.prototype.getCSS=function(e,t,i,n,o){return n[0]=$.extend(this.editorController.getEmptyStyle(),n[0]),NextendVisualRenderer.prototype.getCSS.call(this,e,t,i,n,o)},NextendStyleRenderer.prototype.makeStylebackgroundcolor=function(e,t){t.background="#"+e.substr(0,6)+";\n	background: "+N2Color.hex2rgbaCSS(e)},NextendStyleRenderer.prototype.makeStyleopacity=function(e,t){t.opacity=parseInt(e)/100},NextendStyleRenderer.prototype.makeStylepadding=function(e,t){for(var i=e.split("|*|"),n=i.pop(),o=0;o<i.length;o++)i[o]+=n;t.padding=i.join(" ")},NextendStyleRenderer.prototype.makeStyleboxshadow=function(e,t){var i=e.split("|*|");"0"==i[0]&&"0"==i[1]&&"0"==i[2]&&"0"==i[3]?t.boxShadow="none":t.boxShadow=i[0]+"px "+i[1]+"px "+i[2]+"px "+i[3]+"px "+N2Color.hex2rgbaCSS(i[4])},NextendStyleRenderer.prototype.makeStyleborder=function(e,t){var i=e.split("|*|");t.borderWidth=i[0]+"px",t.borderStyle=i[1],t.borderColor="#"+i[2].substr(0,6)+";\n	border-color:"+N2Color.hex2rgbaCSS(i[2])},NextendStyleRenderer.prototype.makeStyleborderradius=function(e,t){var i=e.split("|*|");i.push(""),t.borderRadius=e+"px"},NextendStyleRenderer.prototype.makeStyleextra=function(e,t){t.raw=e}}(n2,window),function(e,t){function i(t,i,n){this.style=t,this.subset=i,this.fonts=n,e(window).on("n2Family",e.proxy(this.loadFamily,this))}i.prototype.loadFamily=function(t,i){var n=i.toLowerCase();return"undefined"!=typeof this.fonts[n]?(e("<link />").attr({rel:"stylesheet",type:"text/css",href:"//fonts.googleapis.com/css?family="+encodeURIComponent(this.fonts[n]+":"+this.style)+"&subset="+encodeURIComponent(this.subset)}).appendTo(e("head")),this.fonts[n]):i},t.NextendFontServiceGoogle=i}(n2,window);