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