(()=>{function e(e,a){for(var t=0;t<a.length;t++){var l=a[t];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}var a=function(){function a(){!function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,a)}var t,l,n;return t=a,(l=[{key:"init",value:function(){var e=$("#edit-slug-box");$(document).on("click","#change_slug",(function(e){$(".default-slug").unwrap();var a=$("#editable-post-name");a.html('<input type="text" id="new-post-slug" class="form-control" value="'+a.text()+'" autocomplete="off">'),$("#edit-slug-box .cancel").show(),$("#edit-slug-box .save").show(),$(e.currentTarget).hide()})),$(document).on("click","#edit-slug-box .cancel",(function(){var e=$("#current-slug").val(),a=$("#sample-permalink");a.html('<a class="permalink" href="'+$("#slug_id").data("view")+e.replace("/","")+'">'+a.html()+"</a>"),$("#editable-post-name").text(e),$("#edit-slug-box .cancel").hide(),$("#edit-slug-box .save").hide(),$("#change_slug").show()}));var a=function(a,t,l){$.ajax({url:$("#slug_id").data("url"),type:"POST",data:{value:a,slug_id:t,model:$("input[name=model]").val()},success:function(a){var t=$("#sample-permalink"),n=$("#slug_id");l?t.find(".permalink").prop("href",n.data("view")+a.replace("/","")):t.html('<a class="permalink" target="_blank" href="'+n.data("view")+a.replace("/","")+'">'+t.html()+"</a>"),$(".page-url-seo p").text(n.data("view")+a.replace("/","")),$("#editable-post-name").text(a),$("#current-slug").val(a),$("#edit-slug-box .cancel").hide(),$("#edit-slug-box .save").hide(),$("#change_slug").show(),e.removeClass("hidden")},error:function(e){Botble.handleError(e)}})};$(document).on("click","#edit-slug-box .save",(function(){var e=$("#new-post-slug"),t=e.val(),l=$("#slug_id").data("id");null==l&&(l=0),null!=t&&""!==t?a(t,l,!1):e.closest(".form-group").addClass("has-error")})),$(document).on("blur","#"+e.data("field-name"),(function(t){if(e.hasClass("hidden")){var l=$(t.currentTarget).val();null!==l&&""!==l&&a(l,0,!0)}}))}}])&&e(t.prototype,l),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),a}();$((function(){(new a).init()}))})();