!function(e){"use strict";e(document).on("click",'.js-rey-button[data-action="pdp_benefits_create_gs"]',(function(t){t.preventDefault();var i=e(this);i.addClass("--loading disabled"),rey.ajax.request("pdp_benefits_create_gs",{cb:function(t){if(t&&t.success){if(i.removeClass("--loading"),!t.data)return i.text("Failed!");if(!t.data.id&&!t.data.title)return i.text("Failed!");if(!wp.customize)return i.text("Failed!");var n=wp.customize.control("pdp_benefits_gs"),a=new Option(t.data.title,t.data.id,!0,!0);e('select[data-id="'+n.id+'"]',n.container).append(a).trigger("change"),wp.customize.control("pdp_benefits_gs_is_created").setting.set(t.data.id)}}})})),e(document).on("reycore/customizer/section_expanded",(function(e,t){var i=t.controls().filter((function(e){return"pdp_benefits_gs_is_created"===e.id}));i.length&&i[0].setting.get()&&rey.ajax.request("pdp_benefits_check_gs",{cb:function(e){e&&e.success&&(e.data||i[0].setting.set(""))}})}))}(jQuery);