text: module.exports=function(t){var e={};function n(a){if(e[a])return e[a].exports;var o=e[a]={i:a,l:!1,exports:{}};return t[a].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,a){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(a,o,function(e){return t[e]}.bind(null,o));return a},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=10)}([function(t,e){t.exports=flarum.core.compat["common/components/Button"]},function(t,e){t.exports=flarum.core.compat["common/Model"]},function(t,e){t.exports=flarum.core.compat["common/Component"]},function(t,e){t.exports=flarum.core.compat["common/app"]},function(t,e){t.exports=flarum.core.compat["common/utils/Stream"]},function(t,e){t.exports=flarum.core.compat["admin/components/ExtensionPage"]},function(t,e){t.exports=flarum.core.compat["common/components/LoadingIndicator"]},function(t,e){t.exports=flarum.core.compat["common/components/Placeholder"]},function(t,e){t.exports=flarum.core.compat["common/components/Switch"]},function(t,e){t.exports=flarum.core.compat["common/components/Modal"]},function(t,e,n){"use strict";n.r(e);var a=n(3),o=n.n(a);function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var i=n(5),l=n.n(i),s=n(2),c=n.n(s),u=n(6),d=n.n(u),p=n(7),h=n.n(p),f=n(0),b=n.n(f),v=n(8),y=n.n(v),g=n(9),x=n.n(g),_=n(4),N=n.n(_),w=function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.item=this.attrs.item||app.store.createRecord("html-headers"),this.description=N()(this.item.description()||""),this.header=N()(this.item.header()||""),this.loading=!1},n.className=function(){return"Modal--medium"},n.title=function(){return this.item.exists?app.translator.trans("ianm-html-head.admin.modal.edit_title"):app.translator.trans("ianm-html-head.admin.modal.create_title")},n.content=function(){return m("div",{className:"Modal-body"},m("p",null,app.translator.trans("ianm-html-head.admin.modal.text")),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("ianm-html-head.admin.modal.description_label")),m("input",{type:"text",className:"FormControl",bidi:this.description,required:!0})),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("ianm-html-head.admin.modal.header_label")),m("input",{type:"text",className:"FormControl",bidi:this.header,required:!0,placeholder:'<link rel="example" href="example">'})),m("div",{className:"Form-group"},m(b.a,{className:"Button Button--primary",type:"submit",loading:this.loading},app.translator.trans("ianm-html-head.admin.modal.save_button"))))},n.onsubmit=function(t){if(t.preventDefault(),this.header()){this.loading=!0;var e={description:this.description(),header:this.header()};this.item.save(e).then(this.hide.bind(this),this.onerror.bind(this),this.loaded.bind(this))}},e}(x.a),P=function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.item=this.attrs.headItem},n.view=function(){var t=this;return m("tr",null,m("td",null,this.item.description()),m("td",null,m("code",null,this.item.header())),m("td",null,y.a.component({state:this.item.data.attributes.active,onchange:function(e){t.activeLoading=!0,app.request({method:"PATCH",url:app.forum.attribute("apiUrl")+"/html-headers/"+t.item.id(),body:{active:e}}).then((function(e){t.item.data=e.data,t.activeLoading=!1,m.redraw()}))},loading:this.activeLoading})),m("td",null,m("div",{className:"Button--group"},b.a.component({className:"Button Button--secondary",onclick:function(){return app.modal.show(w,{item:t.item})}},app.translator.trans("ianm-html-head.admin.table.edit_button")),b.a.component({className:"Button Button--danger",onclick:function(){t.deleting=!0,t.item.delete().then((function(){t.deleting=!1,m.redraw()}))},loading:this.deleting},app.translator.trans("ianm-html-head.admin.table.delete_button")))))},e}(c.a),B=function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.loading=!0},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.refresh()},n.view=function(){return m("div",null,m("div",{className:"HtmlHeadSettingsPage--controls"},b.a.component({className:"Button Button--primary",icon:"fas fa-plus",onclick:function(){return app.modal.show(w)}},app.translator.trans("ianm-html-head.admin.create_button"))),m("br",null),m("div",{className:"HtmlHeadSettingsPage-table"},this.loading?d.a.component():app.store.all("html-headers").length?m("table",{style:{width:"100%",textAlign:"left"},className:"table"},m("thead",null,m("tr",null,m("th",null,app.translator.trans("ianm-html-head.admin.table.description_label")),m("th",null,app.translator.trans("ianm-html-head.admin.table.header_label")),m("th",null,app.translator.trans("ianm-html-head.admin.table.active_label")),m("th",null))),m("tbody",null,app.store.all("html-headers").map((function(t){return P.component({headItem:t})})))):m("div",null,h.a.component({text:app.translator.trans("ianm-html-head.admin.table.empty_text")}))))},n.refresh=function(){return this.loadResults().then(this.parseResults.bind(this))},n.loadResults=function(){return app.store.find("html-headers")},n.parseResults=function(t){this.loading=!1,m.redraw()},e}(c.a),S=function(t){function e(){return t.apply(this,arguments)||this}r(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e)},n.content=function(){return[m("div",{className:"container"},m("div",{className:"HtmlHeadSettingsPage"},B.component()))]},e}(l.a);function j(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function O(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var M=n(1),H=n.n(M),R=function(t){function e(){for(var e,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return O(j(e=t.call.apply(t,[this].concat(a))||this),"id",H.a.attribute("id")),O(j(e),"description",H.a.attribute("description")),O(j(e),"header",H.a.attribute("header")),O(j(e),"active",H.a.attribute("active")),e}return r(e,t),e}(H.a);o.a.initializers.add("ianm-html-head",(function(){o.a.store.models["html-headers"]=R,o.a.extensionData.for("ianm-html-head").registerPage(S)}))}]);
  //# sourceMappingURL=admin.js.map