!function(t){"function"==typeof define&&define.amd?define("wpEditorLimit",t):t()}(function(){"use strict";jQuery(function(c){function t(){var r=this;c(document).on("tinymce-editor-init",function(t,e){var n,o,i=c(e.editorContainer).closest(".c27-submit-listing-form .form-group, .c27-submit-listing-form .form-field-wrapper"),a=i.find(".wp-editor-container[data-maxlength], .wp-editor-container[data-minlength]"),d=i.find(".field-char-counter");d.length&&a.length&&(n=parseInt(a.data("minlength"),10)||0,o=parseInt(a.data("maxlength"),10)||0,n||o)&&(r.updateCount(e,d,n,o),e.on("keyup",function(){r.updateCount(e,d,n,o)}))})}t.prototype.updateCount=function(t,e,n,o){var i=t.getContent().trim(),t=t.getContent({format:"text"}),a=t.length,i=(["","<p></p>","<p>&nbsp;</p>","<p><br></p>",'<p><br data-mce-bogus="1"></p>'].includes(i)&&"\n"===t&&(a=0),e.find(".counter-label")),t=e.find(".counter-numbers");e.removeClass("min-exceeded max-exceeded"),i.text(""),0<n&&0<a&&a<n?(i.text(CASE27.l10n.input_too_short.replace("%d",n)),e.addClass("min-exceeded")):0<o&&o<a&&(i.text(CASE27.l10n.input_too_long.replace("%d",o)),e.addClass("max-exceeded")),0<o?t.text("".concat(a," / ").concat(o)):t.text("")},new t})});
