(e=>{"function"==typeof define&&define.amd?define("elementor",e):e()})(function(){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}elementor.addControlView("mylisting-posts-dropdown",elementor.modules.controls.BaseData.extend({onReady:function(){function e(){var t=[];n.forEach(function(e){window[a][l][e]&&t.push({value:e,label:window[a][l][e]})}),i.html(t.map(function(e){return'<option value="'.concat(e.value,'" selected>').concat(e.label,"</option>")}).join("")),i.attr("data-mylisting-ajax-params",JSON.stringify({post_type:s,item_key:l})),new MyListing.CustomSelect(i),i.on("select:change",function(e){e=o.prepareValue(e.detail.value);e.forEach(function(e){window[a][l][e]=i.find('option[value="'.concat(e,'"]')).text().trim()}),o.setValue(e)}),i.parent().removeClass("hide"),o.$el.find(".loading-selection").remove()}var o=this,n=this.prepareValue(this.getControlValue()),i=this.$el.find("select"),l="slug"===this.model.get("post_key")?"post_name":"ID",s=this.model.get("post_type"),a="_mylisting_post_details",t=(window[a]=window[a]||{},window[a][l]=window[a][l]||{},[]);n.forEach(function(e){window[a][l][e]||t.push(e)});t.length?jQuery.get(CASE27.mylisting_ajax_url,{item_key:l,post_type:s,posts:t,action:"post_details",security:CASE27.ajax_nonce},function(t){t&&"object"===r(t.results)&&Object.keys(t.results).forEach(function(e){window[a][l][e]=t.results[e]}),e()}):e()},prepareValue:function(e){return e?"string"==typeof e?[e]:Array.isArray(e)?e.filter(Boolean):[]:[]},onBeforeDestroy:function(){this.$el.find("select").data("select2").destroy()}}))});
