!function(){"use strict";function t(){t=function(){return r};var e,r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(e){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof g?e:g,a=Object.create(o.prototype),c=new S(n||[]);return i(a,"_invoke",{value:_(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=f;var p="suspendedStart",d="suspendedYield",y="executing",v="completed",m={};function g(){}function b(){}function w(){}var O={};l(O,c,(function(){return this}));var x=Object.getPrototypeOf,L=x&&x(x(N([])));L&&L!==n&&o.call(L,c)&&(O=L);var E=w.prototype=g.prototype=Object.create(O);function k(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(n,i,a,c){var u=h(t[n],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,n){r(t,o,e,n)}))}return n=n?n.then(i,i):i()}})}function _(t,r,n){var o=p;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=M(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(t,r,n);if("normal"===s.type){if(o=n.done?v:d,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function M(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,M(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(o.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=w,i(E,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(E),t},r.awrap=function(t){return{__await:t}},k(j.prototype),l(j.prototype,u,(function(){return this})),r.AsyncIterator=j,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new j(f(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(E),l(E,s,"Generator"),l(E,c,(function(){return this})),l(E,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=N,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},r}function e(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(o=n.key,i=void 0,"symbol"==typeof(i=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(o,"string"))?i:String(i)),n)}var o,i}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t,e,r){return i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&o(i,r.prototype),i},i.apply(null,arguments)}function a(t){var e="function"==typeof Map?new Map:void 0;return a=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,a)}function a(){return i(t,arguments,n(this).constructor)}return a.prototype=Object.create(t.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),o(a,t)},a(t)}var c=function(n){var i,a;function c(){var t;return(t=n.call(this)||this).instance="",t.host=window.location.origin,t.element=t.querySelector("textarea"),t.refresh=t.refresh.bind(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)),t.intersectionObserver=new IntersectionObserver((function(e){e[0].isIntersecting&&t.instance&&t.instance.refresh()}),{threshold:0}),t}a=n,(i=c).prototype=Object.create(a.prototype),i.prototype.constructor=i,o(i,a);var u,s,l,f=c.prototype;return f.attributeChangedCallback=function(t,e,r){if("options"===t)e&&r!==e&&this.refresh(this.element)},f.connectedCallback=function(){var r,n=(r=t().mark((function e(){var r,n,o,i=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.getAttribute("editor"),n=this.getAttribute("addons"),t.next=4,import(this.host+"/"+r);case 4:if(!this.options.keyMapUrl){t.next=7;break}return t.next=7,import(this.host+"/"+this.options.keyMapUrl);case 7:return t.next=9,import(this.host+"/"+n);case 9:o=this,window.CodeMirror.modeURL=this.getAttribute("mod-path"),window.CodeMirror.defineInitHook((function(t){var e,r=window.CodeMirror.findModeByName(t.options.mode||"")||window.CodeMirror.findModeByExtension(t.options.mode||"");window.CodeMirror.autoLoadMode(t,"object"==typeof r?r.mode:t.options.mode),r&&r.mime&&(["text/x-php","application/x-httpd-php","application/x-httpd-php-open"].includes(r.mime)?t.setOption("mode","php"):"text/html"===r.mime?t.setOption("mode",r.mode):t.setOption("mode",r.mime));var n=function(){o.instance.setOption("fullScreen",!o.instance.getOption("fullScreen"));var t=document.getElementById("subhead");t&&(document.getElementById("header").classList.toggle("hidden"),t.classList.toggle("hidden"),o.instance.display.wrapper.style.top=t.getBoundingClientRect().height+"px")},i=((e={"Ctrl-Q":n})[o.getAttribute("fs-combo")]=n,e.Esc=function(){if(o.instance.getOption("fullScreen"),o.instance.setOption("fullScreen",!1),!o.instance.getOption("fullScreen")){var t=document.getElementById("subhead");if(t){var e=document.getElementById("header");t.classList.toggle("hidden"),e.classList.toggle("hidden"),o.instance.display.wrapper.style.top=t.getBoundingClientRect().height+"px"}}},e);t.addKeyMap(i),t.on("gutterClick",(function(t,e,r){if("CodeMirror-markergutter"===r){var n,o=t.lineInfo(e),i=!!o.gutterMarkers&&!!o.gutterMarkers["CodeMirror-markergutter"];t.setGutterMarker(e,"CodeMirror-markergutter",i?null:((n=document.createElement("div")).className="CodeMirror-markergutter-mark",n))}})),"fieldset"===o.parentNode.tagName.toLowerCase()&&(o.parentNode.style.minWidth=0)})),this.instance=window.CodeMirror.fromTextArea(this.element,this.options),this.instance.disable=function(t){return i.setOption("readOnly",!!t&&"nocursor")},Joomla.editors.instances[this.element.id]=this.instance,this.intersectionObserver.observe(this);case 16:case"end":return t.stop()}}),e,this)})),function(){var t=this,n=arguments;return new Promise((function(o,i){var a=r.apply(t,n);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))});return function(){return n.apply(this,arguments)}}(),f.disconnectedCallback=function(){delete Joomla.editors.instances[this.element.id],this.intersectionObserver.unobserve(this)},f.refresh=function(t){this.instance.fromTextArea(t,this.options)},u=c,l=[{key:"observedAttributes",get:function(){return["options"]}}],(s=[{key:"options",get:function(){return JSON.parse(this.getAttribute("options"))},set:function(t){this.setAttribute("options",t)}}])&&r(u.prototype,s),l&&r(u,l),Object.defineProperty(u,"prototype",{writable:!1}),c}(a(HTMLElement));customElements.define("joomla-editor-codemirror",c)}();