define("discourse/plugins/discourse-spoiler-alert/initializers/spoiler-alert",["exports","discourse/lib/plugin-api","discourse/lib/to-markdown","discourse/controllers/composer","discourse/plugins/discourse-spoiler-alert/lib/apply-spoiler"],(function(e,t,r,i,o){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){if(r=e,!(null!=(i=t)&&"undefined"!=typeof Symbol&&i[Symbol.hasInstance]?i[Symbol.hasInstance](r):r instanceof i))throw new TypeError("Cannot call a class as a function");var r,i}function l(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=p(e);if(t){var o=p(this).constructor;r=Reflect.construct(i,arguments,o)}else r=i.apply(this,arguments);return c(this,r)}}function c(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e){e.querySelectorAll(".spoiler").forEach((function(e){e.classList.remove("spoiler"),e.classList.add("spoiled"),(0,o.default)(e)}))}function d(e){e.decorateCookedElement(f,{id:"spoiler-alert"}),e.addToolbarPopupMenuOptionsCallback((function(){return{action:"insertSpoiler",icon:"magic",label:"spoiler.title"}})),i.default.reopen({actions:{insertSpoiler:function(){this.get("toolbarEvent").applySurround("[spoiler]","[/spoiler]","spoiler_text",{multiline:!1,useBlockMode:!0})}}}),r.Tag&&(r.Tag.prototype.decorate=function(e){return"spoiled"===this.element.attributes.class&&(this.prefix="[spoiler]",this.suffix="[/spoiler]"),(this.prefix||this.suffix)&&(e=[this.prefix,e,this.suffix].join("")),this.inline&&(e=" "+e+" "),e},r.Tag.block=function(e,t,i){return function(r){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(f,r);var o,n,c,p=u(f);function f(){var r;return s(this,f),(r=p.call(this,e,t,i)).gap="\n\n",r}return o=f,(n=[{key:"decorate",value:function(e){var t=this.element.attributes,r=this.element.parent;return"p"===this.name&&r&&"li"===r.name&&(this.gap=""),"div"===this.name&&"spoiled"===t.class&&(this.prefix="[spoiler]",this.suffix="[/spoiler]",e=e.trim()),"".concat(this.gap).concat(this.prefix).concat(e).concat(this.suffix).concat(this.gap)}}])&&l(o.prototype,n),c&&l(o,c),f}(r.Tag)})}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var b={name:"apply-spoilers",initialize:function(e){e.lookup("site-settings:main").spoiler_enabled&&(0,t.withPluginApi)("0.5",d)}};e.default=b})),define("discourse/plugins/discourse-spoiler-alert/lib/apply-spoiler",["exports"],(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){e.setAttribute("data-spoiler-state","blurred"),e.classList.add("spoiler-blurred"),e.addEventListener("click",(function(r){"blurred"===e.getAttribute("data-spoiler-state")?(e.setAttribute("data-spoiler-state","revealed"),e.classList.remove("spoiler-blurred"),r.preventDefault()):function(e){return e.defaultPrevented||e.target.closest(t)}(r)||(e.setAttribute("data-spoiler-state","blurred"),e.classList.add("spoiler-blurred"))}))};var t=["a","area","audio","button","details","embed","iframe","img.animated","input","map","object","option","portal","select","textarea","track","video",".lightbox"].join(", ")})),define("discourse/plugins/discourse-spoiler-alert/lib/discourse-markdown/spoiler-alert",["exports","pretty-text/pretty-text"],(function(e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setup=function(e){e.allowList(["span.spoiler","div.spoiler"]),e.markdownIt?function(e){e.registerOptions((function(e,t){e.features["spoiler-alert"]=!!t.spoiler_enabled})),e.registerPlugin((function(e){e.inline.bbcode.ruler.push("spoiler",{tag:"spoiler",wrap:"span.spoiler"}),e.block.bbcode.ruler.push("spoiler",{tag:"spoiler",wrap:"div.spoiler"})}))}(e):e.addPreProcessor(o)},(0,t.registerOption)((function(e,t){t.features["spoiler-alert"]=!!e.spoiler_enabled}));var r=/\n|<img|!\[[^\]]*\][(\[]/;function i(e,t){var i=r.test(t)?"div":"span";return"<".concat(i," class='spoiler'>").concat(t,"</").concat(i,">")}function o(e){for(e=e||"";e!==(e=e.replace(/\[spoiler\]((?:(?!\[spoiler\]|\[\/spoiler\])[\S\s])*)\[\/spoiler\]/gi,i)););return e}}));
//# sourceMappingURL=https://doy2mn9upadnk.cloudfront.net/assets/plugins/discourse-spoiler-alert-acf6e7cfe0c2032e73507e60b6015e04535b24fa5dbc1835274b53a43e4ae64e.js.map