!function(){"use strict";window.addEventListener("elementor/init",()=>{const e=elementor.modules.controls.Select2.extend({isLoaded:!1,addControlSpinner(){this.ui.select.prop("disabled",!0),this.$el.find(".elementor-control-title").after('<span class="elementor-control-spinner">&nbsp;<i class="eicon-spinner eicon-animation-spin"></i>&nbsp;</span>')},getControlValueByName(e){const t=(this.model.get("group_prefix")??"")+e;return this.container.settings.get(t)??""},getInitialValues(){let e=this.getControlValue();elementorCommon.ajax.loadObjects({action:"glsr_elementor_ajax_query_selected",before:()=>this.addControlSpinner(),data:this.getQueryData(),ids:_.isArray(e)?e:[e],success:e=>{this.isLoaded=!0,this.model.set("options",e),setTimeout(()=>this.render(),1)}})},getQueryData(){const e={include:this.getControlValueByName(this.model.get("include")),option:this.model.get("name"),shortcode:this.container.settings.get("widgetType"),unique_id:this.cid+this.model.get("name")},t=this.model.get("depends_on");return t&&(e[t]=this.getControlValueByName(t)),e},getSelect2DefaultOptions(){return jQuery.extend(elementor.modules.controls.Select2.prototype.getSelect2DefaultOptions.apply(this,arguments),{ajax:{transport:(e,t,n)=>elementorCommon.ajax.addRequest("glsr_elementor_ajax_query",{data:{search:e.data.q,...this.getQueryData()},error:n,success:t}),cache:!0},minimumInputLength:1})},onReady(){this.isLoaded||this.getInitialValues()}});elementor.addControlView("select2_ajax",e),jQuery(document).on("change",".elementor-control-type-multi_switcher .elementor-switch-input",function(){const e=jQuery(this),t=e.closest(".elementor-control-type-multi_switcher").find("input[data-setting]"),n=e.val(),o=t.val()?t.val().split(","):[],i=e.is(":checked")?[...new Set([...o,n])]:o.filter(e=>e!==n);t.val(i.join(",")).trigger("input")})}),window.addEventListener("elementor/panel/init",()=>{elementor.hooks.addFilter("editor/style/styleText",(e,t)=>{var n,o;const i=null==t?void 0:t.$el,s=(null==t||null===(n=t.container)||void 0===n||null===(n=n.settings)||void 0===n?void 0:n.attributes)||{},l=(null==s?void 0:s.widgetType)||"";if(!i||null!=s&&s.theme||!l.startsWith("site_review"))return e;const r=(null==s?void 0:s.style_rating_color)||(null==s||null===(o=s.__globals__)||void 0===o?void 0:o.style_rating_color);return i.find(".glsr").parent()[r?"addClass":"removeClass"]("has-custom-color"),e})})}();
