(()=>{function n(n,e){for(var a=0;a<e.length;a++){var t=e[a];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(n,t.key,t)}}function e(e,a,t){return a&&n(e.prototype,a),t&&n(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var a=e((function n(){!function(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n);var e,a=$(document).find(".slug-field-wrapper");$(document).on("blur",".js-base-form input[name=".concat(a.data("field-name"),"]"),(function(n){if(!(a=$(document).find(".slug-field-wrapper")).find('input[name="slug"]').is("[readonly]")){var e=$(n.currentTarget).val();null===e||""===e||a.find('input[name="slug"]').val()||i(e,0)}})),$(document).on("keyup",'input[name="slug"]',(function(n){clearTimeout(e),e=setTimeout((function(){var e=$(n.currentTarget);if(0!==(a=$(document).find(".slug-field-wrapper")).has(".slug-data").length){var t=e.val();null!==t&&""!==t?i(t,a.find(".slug-data").data("id")||0):e.addClass("is-invalid")}}),700)})),$(document).on("click",'[data-bb-toggle="generate-slug"]',(function(n){n.preventDefault();var e=$(n.currentTarget).closest(".js-base-form").find("input[name=".concat(a.data("field-name"),"]"));null!==e.val()&&""!==e.val()&&i(e.val(),a.find(".slug-data").data("id")||0)}));var t=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=a.find(".slug-actions a"),t=$('<div class="spinner-border spinner-border-sm" role="status"></div>');n?(e.removeClass("d-none"),a.find(".spinner-border").remove()):(e.addClass("d-none"),e.after(t))},i=function(n,e){var i=(a=$(document).find(".slug-field-wrapper")).closest("form"),r=a.find(".slug-data");a.length&&r.length&&i.length&&(t(),$httpClient.make().post(r.data("url"),{value:n,slug_id:e.toString(),model:i.find('input[name="model"]').val(),_token:i.find('input[name="_token"]').val()}).then((function(n){var e=n.data;t(!0);var l="".concat(r.data("view")).concat(e.toString().replace("/",""));a.find('input[name="slug"]').val(e),i.find(".page-url-seo p").text(l),a.find(".slug-current").val(e)})))}}));$((function(){new a}))})();