jQuery(window).on("elementor/frontend/init",(function(){window.elementorFrontend.config.environmentMode.edit&&elementor.channels.editor.on("ekit:editor:create",(function(e){if(e.$el.hasClass("open"))return!1;var t=e.$el.parents("#elementor-controls"),a=t.find("[data-setting='meeting_cache']"),n=t.find("[data-setting='user_id']").val(),r=t.find("[data-setting='start_time']").val(),o=t.find("[data-setting='timezone']").val(),s=t.find("[data-setting='duration']").val(),i=t.find("[data-setting='password']").val(),d=[];if(n||d.push("user_id"),r||d.push("start_time"),o||d.push("timezone"),i.length>10&&d.push("password"),d.length>0)return jQuery.each([{key:"user_id",value:"Please select meeting hosts."},{key:"start_time",value:"Please select start time."},{key:"password",value:"Password length can't be more than 10."},{key:"timezone",value:"Please select timezone."}],(function(t,a){-1!=jQuery.inArray(a.key,d)&&e.$el.find(".elementor-control-input-wrapper").append('<div class="alert alert-danger" role="alert">'+a.value+"</div>"),setTimeout((function(){e.$el.find(".alert").fadeOut().remove()}),2e3)})),!1;var l={user_id:n,start_time:r,timezone:o,duration:s,password:i};jQuery.ajax({data:l,type:"post",url:window.zoom_js.rest_url+"elementskit/v1/zoom-meeting/create/",beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",zoom_js.nonce),e.$el.addClass("open")},success:function(t){t.success?(a.val(t.fetched),a.trigger("input"),e.$el.find(".elementor-control-input-wrapper").append('<div class="alert alert-success" role="alert">'+t.message+"</div>")):e.$el.find(".elementor-control-input-wrapper").append('<div class="alert alert-danger" role="alert">'+t.message+"</div>"),e.$el.removeClass("open"),setTimeout((function(){e.$el.find(".alert").fadeOut().remove()}),2e3)}})}))})),jQuery(document).ready((function(e){jQuery(document).on("submit",".ekit-zoom-protected-form",(function(t){t.preventDefault();var a=e(this),n=a.serializeArray(),r=a.find(".ekit-zoom-password-field"),o="",s="",i="";if(n.forEach((function(e){"zoom-password"==e.name?i=e.value:"zoom-post-id"==e.name?o=e.value:"zoom-widget-id"==e.name&&(s=e.value)})),e(".error").remove(),!i.trim())return r.after('<p class="error">Password field can not be empty.</p>'),!1;n={post_id:o,widget_id:s,password:i};jQuery.ajax({data:n,type:"post",url:window.zoom_js.rest_url+"elementskit/v1/zoom-meeting/password_verify/",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",zoom_js.nonce)},success:function(e){e.success?(a.append('<div class="attr-alert attr-alert-success" role="alert">'+e.message+"</div>"),a.parents(".ekit-zoom-protected").next().fadeIn().end().hide()):a.append('<div class="attr-alert attr-alert-danger" role="alert">'+e.message+"</div>"),r.val(""),setTimeout((function(){a.find(".attr-alert").remove()}),2e3)}})}))}));