"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();!function(e){(function(){function e(){var t=this;_classCallCheck(this,e),elementor.hooks.addAction("panel/open_editor/widget/opal-template",function(e){t.onPanelShow(e)})}return _createClass(e,null,[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),_createClass(e,[{key:"onPanelShow",value:function(e){var t=e.content.currentView.collection.findWhere({name:"cf_id"});if(t&&"cf_id"===t.get("name")){var n=e.content.currentView.children.findByModelCid(t.cid),o=n.$el.find("option"),a=n.$el.find("select"),i=o.eq(0),r=e.content.currentView.model.get("settings").get("cf_id");delete o[0],o.sort(function(e,t){var n=e.text.toLowerCase(),o=t.text.toLowerCase();return n>o?1:n<o?-1:0}),a.empty().append(i).append(o),a.val(r),n.on("input:change",this.onTemplateIdChange).trigger("input:change")}}},{key:"onTemplateIdChange",value:function(){var e=this.options.elementSettingsModel.attributes.template_id,t=this.options.model.attributes.types[e],n=this.$el.find(".elementor-edit-");if("0"===e||!e||"widget"===t)return void(n.length&&n.remove());var o=ElementorConfig.home_url+"?page=wpcf7&post="+e;n.length?n.prop("href",o):(n=jQuery("<a />",{target:"_blank",class:"elementor-button elementor-button-default elementor-edit-form",href:o,html:'<i class="fa fa-pencil" /> Edit Form'}),this.$el.find(".elementor-control-input-wrapper").after(n))}}]),e})().getInstance(),function(){function e(){var t=this;_classCallCheck(this,e),elementor.hooks.addAction("panel/open_editor/widget/opal-template",function(e){t.onPanelShow(e)})}return _createClass(e,null,[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),_createClass(e,[{key:"onPanelShow",value:function(e){var t=e.content.currentView.collection.findWhere({name:"template_id"});if(t&&"template_id"===t.get("name")){var n=e.content.currentView.children.findByModelCid(t.cid),o=n.$el.find("option"),a=n.$el.find("select"),i=o.eq(0),r=e.content.currentView.model.get("settings").get("template_id");delete o[0],o.sort(function(e,t){var n=e.text.toLowerCase(),o=t.text.toLowerCase();return n>o?1:n<o?-1:0}),a.empty().append(i).append(o),a.val(r),n.on("input:change",this.onTemplateIdChange).trigger("input:change")}}},{key:"onTemplateIdChange",value:function(){var e=this.options.elementSettingsModel.attributes.template_id,t=this.options.model.attributes.types[e],n=this.$el.find(".elementor-edit-template");if("0"===e||!e||"widget"===t)return void(n.length&&n.remove());var o=ElementorConfig.home_url+"?p="+e+"&elementor";n.length?n.prop("href",o):(n=jQuery("<a />",{target:"_blank",class:"elementor-button elementor-button-default elementor-edit-template",href:o,html:'<i class="fa fa-pencil" /> Edit Template'}),this.$el.find(".elementor-control-input-wrapper").after(n))}}]),e}().getInstance()}(jQuery);
//# sourceMappingURL=admin-editor.js.map
