diff --git a/extensions/tags/js/dist/admin.js b/extensions/tags/js/dist/admin.js index ef8441cc6..d66868b53 100644 --- a/extensions/tags/js/dist/admin.js +++ b/extensions/tags/js/dist/admin.js @@ -1,2 +1,2 @@ -module.exports=function(t){var e={};function n(a){if(e[a])return e[a].exports;var r=e[a]={i:a,l:!1,exports:{}};return t[a].call(r.exports,r,r.exports,n),r.l=!0,r.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 r in t)n.d(a,r,function(e){return t[e]}.bind(null,r));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=49)}([function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat.extend},function(t,e,n){"use strict";function a(t){return t.slice(0).sort((function(t,e){var n=t.position(),a=e.position();if(null===n&&null===a)return e.discussionCount()-t.discussionCount();if(null===a)return-1;if(null===n)return 1;var r=t.parent(),o=e.parent();return r===o?n-a:r&&o?r.position()-o.position():r?r===e?1:r.position()-a:o?o===t?-1:n-o.position():0}))}n.d(e,"a",(function(){return a}))},function(t,e,n){"use strict";function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}n.d(e,"a",(function(){return a}))},function(t,e,n){"use strict";function a(t,e,n){void 0===e&&(e={}),void 0===n&&(n={});var a=t&&t.icon(),r=n.useColor,o=void 0===r||r;return e.className="icon TagIcon "+(e.className||"")+" "+(a?t.icon():"default"),t?(e.style=e.style||{},a?e.style.color=o?t.color():"":e.style.backgroundColor=t.color()):e.className+=" untagged",a?m("i",e):m("span",e)}n.d(e,"a",(function(){return a}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var a=n(11),r=n.n(a),o=n(4);function i(t,e){void 0===e&&(e={}),e.style=e.style||{},e.className="TagLabel "+(e.className||"");var n=r()(e,"link"),a=t?t.name():app.translator.trans("flarum-tags.lib.deleted_tag_text");if(t){var i=t.color();i&&(e.style.backgroundColor=e.style.color=i,e.className+=" colored"),n&&(e.title=t.description()||"",e.href=app.route("tag",{tags:t.slug()}),e.config=m.route)}else e.className+=" untagged";return m(n?"a":"span",e,m("span",{className:"TagLabel-text"},t&&t.icon()&&Object(o.a)(t,{},{useColor:!1})," ",a))}},,function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var a=n(11),r=n.n(a),o=n(5),i=n(2);function s(t,e){void 0===e&&(e={});var n=[],a=r()(e,"link");return e.className="TagsLabel "+(e.className||""),t?Object(i.a)(t).forEach((function(e){(e||1===t.length)&&n.push(Object(o.a)(e,{link:a}))})):n.push(Object(o.a)()),m("span",e,n)}},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e,n){"use strict";function a(){return(a=Object.assign||function(t){for(var e=1;e':e=document.createElement("div")),"string"==typeof n&&(a=e.classList).add.apply(a,n.split(" ")),e},U=function(t){if(!(t instanceof HTMLElement))throw new Error("You must provide a valid dom element");var e=window.getComputedStyle(t);return["height","padding-top","padding-bottom"].map((function(t){var n=parseInt(e.getPropertyValue(t),10);return isNaN(n)?0:n})).reduce((function(t,e){return t+e}))},W=function(t,e){if(!(t instanceof Array))throw new Error("You must provide a Array of HTMLElements to be filtered.");return"string"!=typeof e?t:t.filter((function(t){return t.querySelector(e)instanceof HTMLElement||t.shadowRoot&&t.shadowRoot.querySelector(e)instanceof HTMLElement})).map((function(t){return t.querySelector(e)||t.shadowRoot&&t.shadowRoot.querySelector(e)}))},z=function(t){return t.composedPath&&t.composedPath()[0]||t.target},X=function(t,e,n){return{element:t,posX:n.pageX-e.left,posY:n.pageY-e.top}},G=function(t,e,n){if(!(t instanceof Event))throw new Error("setDragImage requires a DragEvent as the first argument.");if(!(e instanceof HTMLElement))throw new Error("setDragImage requires the dragged element as the second argument.");if(n||(n=X),t.dataTransfer&&t.dataTransfer.setDragImage){var a=n(e,A(e),t);if(!(a.element instanceof HTMLElement)||"number"!=typeof a.posX||"number"!=typeof a.posY)throw new Error("The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].");t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",z(t).id),t.dataTransfer.setDragImage(a.element,a.posX,a.posY)}},V=function(t,e){if(!0===t.isSortable){var n=M(t).getConfig("acceptFrom");if(null!==n&&!1!==n&&"string"!=typeof n)throw new Error('HTML5Sortable: Wrong argument, "acceptFrom" must be "null", "false", or a valid selector string.');if(null!==n)return!1!==n&&n.split(",").filter((function(t){return t.length>0&&e.matches(t)})).length>0;if(t===e)return!0;if(void 0!==M(t).getConfig("connectWith")&&null!==M(t).getConfig("connectWith"))return M(t).getConfig("connectWith")===M(e).getConfig("connectWith")}return!1},J={items:null,connectWith:null,disableIEFix:null,acceptFrom:null,copy:!1,placeholder:null,placeholderClass:"sortable-placeholder",draggingClass:"sortable-dragging",hoverClass:!1,debounce:0,throttleTime:100,maxItems:0,itemSerializer:void 0,containerSerializer:void 0,customDragImage:null};var K,Q,Z,tt,et,nt,at,rt,ot=function(t,e){if("string"==typeof M(t).getConfig("hoverClass")){var n=M(t).getConfig("hoverClass").split(" ");!0===e?(D(t,"mousemove",function(t,e){var n=this;if(void 0===e&&(e=250),"function"!=typeof t)throw new Error("You must provide a function as the first argument for throttle.");if("number"!=typeof e)throw new Error("You must provide a number as the second argument for throttle.");var a=null;return function(){for(var r=[],o=0;o=e)&&(a=i,t.apply(n,r))}}((function(e){0===e.buttons&&N(t.children,M(t).getConfig("items")).forEach((function(t){var a,r;t!==e.target?(a=t.classList).remove.apply(a,n):(r=t.classList).add.apply(r,n)}))}),M(t).getConfig("throttleTime"))),D(t,"mouseleave",(function(){N(t.children,M(t).getConfig("items")).forEach((function(t){var e;(e=t.classList).remove.apply(e,n)}))}))):(j(t,"mousemove"),j(t,"mouseleave"))}},it=function(t){j(t,"dragstart"),j(t,"dragend"),j(t,"dragover"),j(t,"dragenter"),j(t,"drop"),j(t,"mouseenter"),j(t,"mouseleave")},st=function(t,e){var n=t;return!0===M(e).getConfig("copy")&&(I(n=t.cloneNode(!0),"aria-copied","true"),t.parentElement.appendChild(n),n.style.display="none",n.oldDisplay=t.style.display),n},lt=function(t){var e;(e=t).h5s&&delete e.h5s.data,S(t,"aria-dropeffect")},ct=function(t){S(t,"aria-grabbed"),S(t,"aria-copied"),S(t,"draggable"),S(t,"role")};function ut(t,e){if(e.composedPath)return e.composedPath().find((function(t){return t.isSortable}));for(;!0!==t.isSortable;)t=t.parentElement;return t}function dt(t,e){var n=C(t,"opts"),a=N(t.children,n.items).filter((function(t){return t.contains(e)||t.shadowRoot&&t.shadowRoot.contains(e)}));return a.length>0?a[0]:e}var pt=function(t){var e=C(t,"opts"),n=N(t.children,e.items),a=W(n,e.handle);(I(t,"aria-dropeffect","move"),C(t,"_disabled","false"),I(a,"draggable","true"),!1===e.disableIEFix)&&("function"==typeof(document||window.document).createElement("span").dragDrop&&D(a,"mousedown",(function(){if(-1!==n.indexOf(this))this.dragDrop();else{for(var t=this.parentElement;-1===n.indexOf(t);)t=t.parentElement;t.dragDrop()}})))},mt=function(t){var e=C(t,"opts"),n=N(t.children,e.items),a=W(n,e.handle);C(t,"_disabled","false"),it(n),j(a,"mousedown"),j(t,"dragover"),j(t,"dragenter"),j(t,"drop")};function ft(t,e){var n=String(e);return e=e||{},"string"==typeof t&&(t=document.querySelectorAll(t)),t instanceof HTMLElement&&(t=[t]),t=Array.prototype.slice.call(t),/serialize/.test(n)?t.map((function(t){var e=C(t,"opts");return R(t,e.itemSerializer,e.containerSerializer)})):(t.forEach((function(t){if(/enable|disable|destroy/.test(n))return ft[n](t);["connectWith","disableIEFix"].forEach((function(t){e.hasOwnProperty(t)&&null!==e[t]&&console.warn('HTML5Sortable: You are using the deprecated configuration "'+t+'". This will be removed in an upcoming version, make sure to migrate to the new options when updating.')})),e=Object.assign({},J,M(t).config,e),M(t).config=e,C(t,"opts",e),t.isSortable=!0,mt(t);var a,r=N(t.children,e.items);if(null!==e.placeholder&&void 0!==e.placeholder){var o=document.createElement(t.tagName);e.placeholder instanceof HTMLElement?o.appendChild(e.placeholder):o.innerHTML=e.placeholder,a=o.children[0]}M(t).placeholder=q(t,a,e.placeholderClass),C(t,"items",e.items),e.acceptFrom?C(t,"acceptFrom",e.acceptFrom):e.connectWith&&C(t,"connectWith",e.connectWith),pt(t),I(r,"role","option"),I(r,"aria-grabbed","false"),ot(t,!0),D(t,"dragstart",(function(t){var n=z(t);if(!0!==n.isSortable&&(t.stopImmediatePropagation(),(!e.handle||n.matches(e.handle))&&"false"!==n.getAttribute("draggable"))){var a=ut(n,t),r=dt(a,n);nt=N(a.children,e.items),tt=nt.indexOf(r),et=H(r,a.children),Z=a,G(t,r,e.customDragImage),Q=U(r),r.classList.add(e.draggingClass),I(K=st(r,a),"aria-grabbed","true"),a.dispatchEvent(new CustomEvent("sortstart",{detail:{origin:{elementIndex:et,index:tt,container:Z},item:K,originalTarget:n}}))}})),D(t,"dragenter",(function(e){var n=z(e),a=ut(n,e);a&&a!==at&&(rt=N(a.children,C(a,"items")).filter((function(e){return e!==M(t).placeholder})),a.dispatchEvent(new CustomEvent("sortenter",{detail:{origin:{elementIndex:et,index:tt,container:Z},destination:{container:a,itemsBeforeUpdate:rt},item:K,originalTarget:n}}))),at=a})),D(t,"dragend",(function(n){if(K){K.classList.remove(e.draggingClass),I(K,"aria-grabbed","false"),"true"===K.getAttribute("aria-copied")&&"true"!==C(K,"dropped")&&K.remove(),K.style.display=K.oldDisplay,delete K.oldDisplay;var a=Array.from(L.values()).map((function(t){return t.placeholder})).filter((function(t){return t instanceof HTMLElement})).filter(F)[0];a&&a.remove(),t.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:et,index:tt,container:Z},item:K}})),at=null,K=null,Q=null}})),D(t,"drop",(function(n){if(V(t,K.parentElement)){n.preventDefault(),n.stopPropagation(),C(K,"dropped","true");var a=Array.from(L.values()).map((function(t){return t.placeholder})).filter((function(t){return t instanceof HTMLElement})).filter(F)[0];Y(a,K),a.remove(),t.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:et,index:tt,container:Z},item:K}}));var r=M(t).placeholder,o=N(Z.children,e.items).filter((function(t){return t!==r})),i=!0===this.isSortable?this:this.parentElement,s=N(i.children,C(i,"items")).filter((function(t){return t!==r})),l=H(K,Array.from(K.parentElement.children).filter((function(t){return t!==r}))),c=H(K,s);et===l&&Z===i||t.dispatchEvent(new CustomEvent("sortupdate",{detail:{origin:{elementIndex:et,index:tt,container:Z,itemsBeforeUpdate:nt,items:o},destination:{index:c,elementIndex:l,container:i,itemsBeforeUpdate:rt,items:s},item:K}}))}}));var i=P((function(t,n,a){if(K)if(e.forcePlaceholderSize&&(M(t).placeholder.style.height=Q+"px"),Array.from(t.children).indexOf(n)>-1){var r=U(n),o=H(M(t).placeholder,n.parentElement.children),i=H(n,n.parentElement.children);if(r>Q){var s=r-Q,l=A(n).top;if(oi&&a>l+r-s)return}void 0===K.oldDisplay&&(K.oldDisplay=K.style.display),"none"!==K.style.display&&(K.style.display="none");var c=!1;try{c=a>=A(n).top+n.offsetHeight/2}catch(t){c=o=parseInt(a.maxItems)&&K.parentElement!==n||(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=!0===M(n).getConfig("copy")?"copy":"move",i(n,e,t.pageY))}};D(r.concat(t),"dragover",s),D(r.concat(t),"dragenter",s)})),t)}ft.destroy=function(t){!function(t){var e=C(t,"opts")||{},n=N(t.children,e.items),a=W(n,e.handle);j(t,"dragover"),j(t,"dragenter"),j(t,"drop"),lt(t),j(a,"mousedown"),it(n),ct(n)}(t)},ft.enable=function(t){pt(t)},ft.disable=function(t){!function(t){var e=C(t,"opts"),n=N(t.children,e.items),a=W(n,e.handle);I(t,"aria-dropeffect","none"),C(t,"_disabled","true"),I(a,"draggable","false"),j(a,"mousedown")}(t)},ft.__testing={_data:C,_removeItemEvents:it,_removeItemData:ct,_removeSortableData:lt};var gt=ft,ht=n(17),vt=n.n(ht),bt=n(18),yt=n.n(bt),_t=n(43),wt=n.n(_t),Et=n(44),Tt=function(t){function e(){return t.apply(this,arguments)||this}Object(x.a)(e,t);var n=e.prototype;return n.init=function(){t.prototype.init.call(this),this.tag=this.props.tag||app.store.createRecord("tags"),this.name=m.prop(this.tag.name()||""),this.slug=m.prop(this.tag.slug()||""),this.description=m.prop(this.tag.description()||""),this.color=m.prop(this.tag.color()||""),this.icon=m.prop(this.tag.icon()||""),this.isHidden=m.prop(this.tag.isHidden()||!1)},n.className=function(){return"EditTagModal Modal--small"},n.title=function(){return this.name()?Object(g.a)({name:this.name,color:this.color,icon:this.icon}):app.translator.trans("flarum-tags.admin.edit_tag.title")},n.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray()))},n.fields=function(){var t=this,e=new wt.a;return e.add("name",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.edit_tag.name_label")),m("input",{className:"FormControl",placeholder:app.translator.trans("flarum-tags.admin.edit_tag.name_placeholder"),value:this.name(),oninput:function(e){t.name(e.target.value),t.slug(Object(Et.slug)(e.target.value))}})),50),e.add("slug",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.edit_tag.slug_label")),m("input",{className:"FormControl",value:this.slug(),oninput:m.withAttr("value",this.slug)})),40),e.add("description",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.edit_tag.description_label")),m("textarea",{className:"FormControl",value:this.description(),oninput:m.withAttr("value",this.description)})),30),e.add("color",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.edit_tag.color_label")),m("input",{className:"FormControl",placeholder:"#aaaaaa",value:this.color(),oninput:m.withAttr("value",this.color)})),20),e.add("icon",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.edit_tag.icon_label")),m("div",{className:"helpText"},app.translator.trans("flarum-tags.admin.edit_tag.icon_text",{a:m("a",{href:"https://fontawesome.com/icons?m=free",tabindex:"-1"})})),m("input",{className:"FormControl",placeholder:"fas fa-bolt",value:this.icon(),oninput:m.withAttr("value",this.icon)})),10),e.add("hidden",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",value:"1",checked:this.isHidden(),onchange:m.withAttr("checked",this.isHidden)}),app.translator.trans("flarum-tags.admin.edit_tag.hide_label")))),10),e.add("submit",m("div",{className:"Form-group"},f.a.component({type:"submit",className:"Button Button--primary EditTagModal-save",loading:this.loading,children:app.translator.trans("flarum-tags.admin.edit_tag.submit_button")}),this.tag.exists?m("button",{type:"button",className:"Button EditTagModal-delete",onclick:this.delete.bind(this)},app.translator.trans("flarum-tags.admin.edit_tag.delete_tag_button")):""),-10),e},n.submitData=function(){return{name:this.name(),slug:this.slug(),description:this.description(),color:this.color(),icon:this.icon(),isHidden:this.isHidden()}},n.onsubmit=function(t){var e=this;t.preventDefault(),this.loading=!0,this.tag.save(this.submitData()).then((function(){return e.hide()}),(function(t){e.loading=!1,e.handleErrors(t)}))},n.delete=function(){var t=this;if(confirm(app.translator.trans("flarum-tags.admin.edit_tag.delete_tag_confirmation"))){var e=app.store.all("tags").filter((function(e){return e.parent()===t.tag}));this.tag.delete().then((function(){e.forEach((function(t){return t.pushData({attributes:{isChild:!1},relationships:{parent:null}})})),m.redraw()})),this.hide()}},e}(yt.a),xt=n(45),Ct=function(t){function e(){return t.apply(this,arguments)||this}Object(x.a)(e,t);var n=e.prototype;return n.setMinTags=function(t,e,n){t(n),e(Math.max(n,e()))},n.className=function(){return"TagSettingsModal Modal--small"},n.title=function(){return app.translator.trans("flarum-tags.admin.tag_settings.title")},n.form=function(){var t=this.setting("flarum-tags.min_primary_tags",0),e=this.setting("flarum-tags.max_primary_tags",0),n=this.setting("flarum-tags.min_secondary_tags",0),a=this.setting("flarum-tags.max_secondary_tags",0);return[m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.tag_settings.required_primary_heading")),m("div",{className:"helpText"},app.translator.trans("flarum-tags.admin.tag_settings.required_primary_text")),m("div",{className:"TagSettingsModal-rangeInput"},m("input",{className:"FormControl",type:"number",min:"0",value:t(),oninput:m.withAttr("value",this.setMinTags.bind(this,t,e))}),app.translator.trans("flarum-tags.admin.tag_settings.range_separator_text"),m("input",{className:"FormControl",type:"number",min:t(),bidi:e}))),m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.tag_settings.required_secondary_heading")),m("div",{className:"helpText"},app.translator.trans("flarum-tags.admin.tag_settings.required_secondary_text")),m("div",{className:"TagSettingsModal-rangeInput"},m("input",{className:"FormControl",type:"number",min:"0",value:n(),oninput:m.withAttr("value",this.setMinTags.bind(this,n,a))}),app.translator.trans("flarum-tags.admin.tag_settings.range_separator_text"),m("input",{className:"FormControl",type:"number",min:n(),bidi:a})))]},e}(n.n(xt).a);function Nt(t){return m("li",{"data-id":t.id(),style:{color:t.color()}},m("div",{className:"TagListItem-info"},Object(h.a)(t),m("span",{className:"TagListItem-name"},t.name()),f.a.component({className:"Button Button--link",icon:"fas fa-pencil-alt",onclick:function(){return app.modal.show(new Tt({tag:t}))}})),t.isChild()||null===t.position()?"":m("ol",{className:"TagListItem-children"},Object(v.a)(app.store.all("tags")).filter((function(e){return e.parent()===t})).map(Nt)))}var Lt=function(t){function e(){return t.apply(this,arguments)||this}Object(x.a)(e,t);var n=e.prototype;return n.view=function(){return m("div",{className:"TagsPage"},m("div",{className:"TagsPage-header"},m("div",{className:"container"},m("p",null,app.translator.trans("flarum-tags.admin.tags.about_tags_text")),f.a.component({className:"Button Button--primary",icon:"fas fa-plus",children:app.translator.trans("flarum-tags.admin.tags.create_tag_button"),onclick:function(){return app.modal.show(new Tt)}}),f.a.component({className:"Button",children:app.translator.trans("flarum-tags.admin.tags.settings_button"),onclick:function(){return app.modal.show(new Ct)}}))),m("div",{className:"TagsPage-list"},m("div",{className:"container"},m("div",{className:"TagGroup"},m("label",null,app.translator.trans("flarum-tags.admin.tags.primary_heading")),m("ol",{className:"TagList TagList--primary"},Object(v.a)(app.store.all("tags")).filter((function(t){return null!==t.position()&&!t.isChild()})).map(Nt))),m("div",{className:"TagGroup"},m("label",null,app.translator.trans("flarum-tags.admin.tags.secondary_heading")),m("ul",{className:"TagList"},app.store.all("tags").filter((function(t){return null===t.position()})).sort((function(t,e){return t.name().localeCompare(e.name())})).map(Nt))))))},n.config=function(){gt(this.$("ol, ul"),{acceptFrom:"ol,ul"}).forEach(this.onSortUpdate.bind(this))},n.onSortUpdate=function(t){var e=this;t.addEventListener("sortupdate",(function(t){t.detail.origin.container instanceof HTMLOListElement&&t.detail.destination.container instanceof HTMLUListElement&&app.store.getById("tags",t.detail.item.getAttribute("data-id")).pushData({attributes:{position:null,isChild:!1},relationships:{parent:null}});var n=e.$(".TagList--primary > li").map((function(){return{id:$(this).data("id"),children:$(this).find("li").map((function(){return $(this).data("id")})).get()}})).get();n.forEach((function(t,e){var n=app.store.getById("tags",t.id);n.pushData({attributes:{position:e,isChild:!1},relationships:{parent:null}}),t.children.forEach((function(t,e){app.store.getById("tags",t).pushData({attributes:{position:e,isChild:!0},relationships:{parent:n}})}))})),app.request({url:app.forum.attribute("apiUrl")+"/tags/order",method:"POST",data:{order:n}}),m.redraw.strategy("all"),m.redraw()}))},e}(vt.a),Ot=function(){app.routes.tags={path:"/tags",component:Lt.component()},app.extensionSettings["flarum-tags"]=function(){return m.route(app.route("tags"))},Object(o.extend)(w.a.prototype,"items",(function(t){t.add("tags",T.a.component({href:app.route("tags"),icon:"fas fa-tags",children:app.translator.trans("flarum-tags.admin.nav.tags_button"),description:app.translator.trans("flarum-tags.admin.nav.tags_text")}))}))},Mt=n(46),Dt=n.n(Mt),jt=function(){Object(o.extend)(Dt.a.prototype,"homePageItems",(function(t){t.add("tags",{path:"/tags",label:app.translator.trans("flarum-tags.admin.basics.tags_label")})}))},It=n(47),St=n.n(It),At=function(){Object(o.extend)(s.a.prototype,"startItems",(function(t){t.add("allowTagChange",{icon:"fas fa-tag",label:app.translator.trans("flarum-tags.admin.permissions.allow_edit_tags_label"),setting:function(){var t=parseInt(app.data.settings.allow_tag_change,10);return St.a.component({defaultLabel:t?app.translator.transChoice("core.admin.permissions_controls.allow_some_minutes_button",t,{count:t}):app.translator.trans("core.admin.permissions_controls.allow_indefinitely_button"),key:"allow_tag_change",options:[{value:"-1",label:app.translator.trans("core.admin.permissions_controls.allow_indefinitely_button")},{value:"10",label:app.translator.trans("core.admin.permissions_controls.allow_ten_minutes_button")},{value:"reply",label:app.translator.trans("core.admin.permissions_controls.allow_until_reply_button")}]})}},90)}))},Pt=n(19),Ht=Object(a.a)(Pt.a,{"tags/addTagsHomePageOption":jt,"tags/addTagChangePermission":At,"tags/addTagsPane":Ot,"tags/components/TagSettingsModal":Ct,"tags/components/TagsPage":Lt,"tags/components/EditTagModal":Tt,"tags/addTagPermission":y,"tags/addTagsPermissionScope":b}),Ft=n(20);app.initializers.add("flarum-tags",(function(t){t.store.models.tags=r.a,b(),y(),Ot(),jt(),At()})),Object(a.a)(Ft.compat,Ht)},,,,,,,,,,,,,function(t,e){t.exports=flarum.core.compat["components/PermissionDropdown"]},function(t,e){t.exports=flarum.core.compat["components/Dropdown"]},function(t,e){t.exports=flarum.core.compat["components/AdminNav"]},function(t,e){t.exports=flarum.core.compat["components/AdminLinkButton"]},function(t,e){t.exports=flarum.core.compat["utils/ItemList"]},function(t,e){t.exports=flarum.core.compat["utils/string"]},function(t,e){t.exports=flarum.core.compat["components/SettingsModal"]},function(t,e){t.exports=flarum.core.compat["components/BasicsPage"]},function(t,e){t.exports=flarum.core.compat["components/SettingDropdown"]},,function(t,e,n){"use strict";n.r(e);var a=n(14);for(var r in a)"default"!==r&&function(t){n.d(e,t,(function(){return a[t]}))}(r);n(26)}]); +module.exports=function(t){var e={};function n(a){if(e[a])return e[a].exports;var r=e[a]={i:a,l:!1,exports:{}};return t[a].call(r.exports,r,r.exports,n),r.l=!0,r.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 r in t)n.d(a,r,function(e){return t[e]}.bind(null,r));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=49)}([function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat.extend},function(t,e,n){"use strict";function a(t){return t.slice(0).sort((function(t,e){var n=t.position(),a=e.position();if(null===n&&null===a)return e.discussionCount()-t.discussionCount();if(null===a)return-1;if(null===n)return 1;var r=t.parent(),o=e.parent();return r===o?n-a:r&&o?r.position()-o.position():r?r===e?1:r.position()-a:o?o===t?-1:n-o.position():0}))}n.d(e,"a",(function(){return a}))},function(t,e,n){"use strict";function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}n.d(e,"a",(function(){return a}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var a=n(12),r=n.n(a);function o(t,e,n){void 0===e&&(e={}),void 0===n&&(n={});var a=t&&t.icon(),o=n.useColor,i=void 0===o||o;return e.className=r()([e.className,"icon",a?t.icon():"TagIcon"]),t?(e.style=e.style||{},a?e.style.color=i?t.color():"":e.style.backgroundColor=t.color()):e.className+=" untagged",a?m("i",e):m("span",e)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var a=n(11),r=n.n(a),o=n(4);function i(t,e){void 0===e&&(e={}),e.style=e.style||{},e.className="TagLabel "+(e.className||"");var n=r()(e,"link"),a=t?t.name():app.translator.trans("flarum-tags.lib.deleted_tag_text");if(t){var i=t.color();i&&(e.style.backgroundColor=e.style.color=i,e.className+=" colored"),n&&(e.title=t.description()||"",e.href=app.route("tag",{tags:t.slug()}),e.config=m.route)}else e.className+=" untagged";return m(n?"a":"span",e,m("span",{className:"TagLabel-text"},t&&t.icon()&&Object(o.a)(t,{},{useColor:!1})," ",a))}},,function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var a=n(11),r=n.n(a),o=n(5),i=n(2);function s(t,e){void 0===e&&(e={});var n=[],a=r()(e,"link");return e.className="TagsLabel "+(e.className||""),t?Object(i.a)(t).forEach((function(e){(e||1===t.length)&&n.push(Object(o.a)(e,{link:a}))})):n.push(Object(o.a)()),m("span",e,n)}},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e,n){"use strict";function a(){return(a=Object.assign||function(t){for(var e=1;e':e=document.createElement("div")),"string"==typeof n&&(a=e.classList).add.apply(a,n.split(" ")),e},U=function(t){if(!(t instanceof HTMLElement))throw new Error("You must provide a valid dom element");var e=window.getComputedStyle(t);return["height","padding-top","padding-bottom"].map((function(t){var n=parseInt(e.getPropertyValue(t),10);return isNaN(n)?0:n})).reduce((function(t,e){return t+e}))},W=function(t,e){if(!(t instanceof Array))throw new Error("You must provide a Array of HTMLElements to be filtered.");return"string"!=typeof e?t:t.filter((function(t){return t.querySelector(e)instanceof HTMLElement||t.shadowRoot&&t.shadowRoot.querySelector(e)instanceof HTMLElement})).map((function(t){return t.querySelector(e)||t.shadowRoot&&t.shadowRoot.querySelector(e)}))},z=function(t){return t.composedPath&&t.composedPath()[0]||t.target},X=function(t,e,n){return{element:t,posX:n.pageX-e.left,posY:n.pageY-e.top}},G=function(t,e,n){if(!(t instanceof Event))throw new Error("setDragImage requires a DragEvent as the first argument.");if(!(e instanceof HTMLElement))throw new Error("setDragImage requires the dragged element as the second argument.");if(n||(n=X),t.dataTransfer&&t.dataTransfer.setDragImage){var a=n(e,A(e),t);if(!(a.element instanceof HTMLElement)||"number"!=typeof a.posX||"number"!=typeof a.posY)throw new Error("The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].");t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",z(t).id),t.dataTransfer.setDragImage(a.element,a.posX,a.posY)}},V=function(t,e){if(!0===t.isSortable){var n=M(t).getConfig("acceptFrom");if(null!==n&&!1!==n&&"string"!=typeof n)throw new Error('HTML5Sortable: Wrong argument, "acceptFrom" must be "null", "false", or a valid selector string.');if(null!==n)return!1!==n&&n.split(",").filter((function(t){return t.length>0&&e.matches(t)})).length>0;if(t===e)return!0;if(void 0!==M(t).getConfig("connectWith")&&null!==M(t).getConfig("connectWith"))return M(t).getConfig("connectWith")===M(e).getConfig("connectWith")}return!1},J={items:null,connectWith:null,disableIEFix:null,acceptFrom:null,copy:!1,placeholder:null,placeholderClass:"sortable-placeholder",draggingClass:"sortable-dragging",hoverClass:!1,debounce:0,throttleTime:100,maxItems:0,itemSerializer:void 0,containerSerializer:void 0,customDragImage:null};var K,Q,Z,tt,et,nt,at,rt,ot=function(t,e){if("string"==typeof M(t).getConfig("hoverClass")){var n=M(t).getConfig("hoverClass").split(" ");!0===e?(D(t,"mousemove",function(t,e){var n=this;if(void 0===e&&(e=250),"function"!=typeof t)throw new Error("You must provide a function as the first argument for throttle.");if("number"!=typeof e)throw new Error("You must provide a number as the second argument for throttle.");var a=null;return function(){for(var r=[],o=0;o=e)&&(a=i,t.apply(n,r))}}((function(e){0===e.buttons&&N(t.children,M(t).getConfig("items")).forEach((function(t){var a,r;t!==e.target?(a=t.classList).remove.apply(a,n):(r=t.classList).add.apply(r,n)}))}),M(t).getConfig("throttleTime"))),D(t,"mouseleave",(function(){N(t.children,M(t).getConfig("items")).forEach((function(t){var e;(e=t.classList).remove.apply(e,n)}))}))):(j(t,"mousemove"),j(t,"mouseleave"))}},it=function(t){j(t,"dragstart"),j(t,"dragend"),j(t,"dragover"),j(t,"dragenter"),j(t,"drop"),j(t,"mouseenter"),j(t,"mouseleave")},st=function(t,e){var n=t;return!0===M(e).getConfig("copy")&&(I(n=t.cloneNode(!0),"aria-copied","true"),t.parentElement.appendChild(n),n.style.display="none",n.oldDisplay=t.style.display),n},lt=function(t){var e;(e=t).h5s&&delete e.h5s.data,S(t,"aria-dropeffect")},ct=function(t){S(t,"aria-grabbed"),S(t,"aria-copied"),S(t,"draggable"),S(t,"role")};function ut(t,e){if(e.composedPath)return e.composedPath().find((function(t){return t.isSortable}));for(;!0!==t.isSortable;)t=t.parentElement;return t}function dt(t,e){var n=C(t,"opts"),a=N(t.children,n.items).filter((function(t){return t.contains(e)||t.shadowRoot&&t.shadowRoot.contains(e)}));return a.length>0?a[0]:e}var pt=function(t){var e=C(t,"opts"),n=N(t.children,e.items),a=W(n,e.handle);(I(t,"aria-dropeffect","move"),C(t,"_disabled","false"),I(a,"draggable","true"),!1===e.disableIEFix)&&("function"==typeof(document||window.document).createElement("span").dragDrop&&D(a,"mousedown",(function(){if(-1!==n.indexOf(this))this.dragDrop();else{for(var t=this.parentElement;-1===n.indexOf(t);)t=t.parentElement;t.dragDrop()}})))},mt=function(t){var e=C(t,"opts"),n=N(t.children,e.items),a=W(n,e.handle);C(t,"_disabled","false"),it(n),j(a,"mousedown"),j(t,"dragover"),j(t,"dragenter"),j(t,"drop")};function ft(t,e){var n=String(e);return e=e||{},"string"==typeof t&&(t=document.querySelectorAll(t)),t instanceof HTMLElement&&(t=[t]),t=Array.prototype.slice.call(t),/serialize/.test(n)?t.map((function(t){var e=C(t,"opts");return R(t,e.itemSerializer,e.containerSerializer)})):(t.forEach((function(t){if(/enable|disable|destroy/.test(n))return ft[n](t);["connectWith","disableIEFix"].forEach((function(t){e.hasOwnProperty(t)&&null!==e[t]&&console.warn('HTML5Sortable: You are using the deprecated configuration "'+t+'". This will be removed in an upcoming version, make sure to migrate to the new options when updating.')})),e=Object.assign({},J,M(t).config,e),M(t).config=e,C(t,"opts",e),t.isSortable=!0,mt(t);var a,r=N(t.children,e.items);if(null!==e.placeholder&&void 0!==e.placeholder){var o=document.createElement(t.tagName);e.placeholder instanceof HTMLElement?o.appendChild(e.placeholder):o.innerHTML=e.placeholder,a=o.children[0]}M(t).placeholder=q(t,a,e.placeholderClass),C(t,"items",e.items),e.acceptFrom?C(t,"acceptFrom",e.acceptFrom):e.connectWith&&C(t,"connectWith",e.connectWith),pt(t),I(r,"role","option"),I(r,"aria-grabbed","false"),ot(t,!0),D(t,"dragstart",(function(t){var n=z(t);if(!0!==n.isSortable&&(t.stopImmediatePropagation(),(!e.handle||n.matches(e.handle))&&"false"!==n.getAttribute("draggable"))){var a=ut(n,t),r=dt(a,n);nt=N(a.children,e.items),tt=nt.indexOf(r),et=H(r,a.children),Z=a,G(t,r,e.customDragImage),Q=U(r),r.classList.add(e.draggingClass),I(K=st(r,a),"aria-grabbed","true"),a.dispatchEvent(new CustomEvent("sortstart",{detail:{origin:{elementIndex:et,index:tt,container:Z},item:K,originalTarget:n}}))}})),D(t,"dragenter",(function(e){var n=z(e),a=ut(n,e);a&&a!==at&&(rt=N(a.children,C(a,"items")).filter((function(e){return e!==M(t).placeholder})),a.dispatchEvent(new CustomEvent("sortenter",{detail:{origin:{elementIndex:et,index:tt,container:Z},destination:{container:a,itemsBeforeUpdate:rt},item:K,originalTarget:n}}))),at=a})),D(t,"dragend",(function(n){if(K){K.classList.remove(e.draggingClass),I(K,"aria-grabbed","false"),"true"===K.getAttribute("aria-copied")&&"true"!==C(K,"dropped")&&K.remove(),K.style.display=K.oldDisplay,delete K.oldDisplay;var a=Array.from(L.values()).map((function(t){return t.placeholder})).filter((function(t){return t instanceof HTMLElement})).filter(F)[0];a&&a.remove(),t.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:et,index:tt,container:Z},item:K}})),at=null,K=null,Q=null}})),D(t,"drop",(function(n){if(V(t,K.parentElement)){n.preventDefault(),n.stopPropagation(),C(K,"dropped","true");var a=Array.from(L.values()).map((function(t){return t.placeholder})).filter((function(t){return t instanceof HTMLElement})).filter(F)[0];Y(a,K),a.remove(),t.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:et,index:tt,container:Z},item:K}}));var r=M(t).placeholder,o=N(Z.children,e.items).filter((function(t){return t!==r})),i=!0===this.isSortable?this:this.parentElement,s=N(i.children,C(i,"items")).filter((function(t){return t!==r})),l=H(K,Array.from(K.parentElement.children).filter((function(t){return t!==r}))),c=H(K,s);et===l&&Z===i||t.dispatchEvent(new CustomEvent("sortupdate",{detail:{origin:{elementIndex:et,index:tt,container:Z,itemsBeforeUpdate:nt,items:o},destination:{index:c,elementIndex:l,container:i,itemsBeforeUpdate:rt,items:s},item:K}}))}}));var i=P((function(t,n,a){if(K)if(e.forcePlaceholderSize&&(M(t).placeholder.style.height=Q+"px"),Array.from(t.children).indexOf(n)>-1){var r=U(n),o=H(M(t).placeholder,n.parentElement.children),i=H(n,n.parentElement.children);if(r>Q){var s=r-Q,l=A(n).top;if(oi&&a>l+r-s)return}void 0===K.oldDisplay&&(K.oldDisplay=K.style.display),"none"!==K.style.display&&(K.style.display="none");var c=!1;try{c=a>=A(n).top+n.offsetHeight/2}catch(t){c=o=parseInt(a.maxItems)&&K.parentElement!==n||(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=!0===M(n).getConfig("copy")?"copy":"move",i(n,e,t.pageY))}};D(r.concat(t),"dragover",s),D(r.concat(t),"dragenter",s)})),t)}ft.destroy=function(t){!function(t){var e=C(t,"opts")||{},n=N(t.children,e.items),a=W(n,e.handle);j(t,"dragover"),j(t,"dragenter"),j(t,"drop"),lt(t),j(a,"mousedown"),it(n),ct(n)}(t)},ft.enable=function(t){pt(t)},ft.disable=function(t){!function(t){var e=C(t,"opts"),n=N(t.children,e.items),a=W(n,e.handle);I(t,"aria-dropeffect","none"),C(t,"_disabled","true"),I(a,"draggable","false"),j(a,"mousedown")}(t)},ft.__testing={_data:C,_removeItemEvents:it,_removeItemData:ct,_removeSortableData:lt};var gt=ft,ht=n(18),vt=n.n(ht),bt=n(19),yt=n.n(bt),_t=n(43),wt=n.n(_t),Et=n(44),Tt=function(t){function e(){return t.apply(this,arguments)||this}Object(x.a)(e,t);var n=e.prototype;return n.init=function(){t.prototype.init.call(this),this.tag=this.props.tag||app.store.createRecord("tags"),this.name=m.prop(this.tag.name()||""),this.slug=m.prop(this.tag.slug()||""),this.description=m.prop(this.tag.description()||""),this.color=m.prop(this.tag.color()||""),this.icon=m.prop(this.tag.icon()||""),this.isHidden=m.prop(this.tag.isHidden()||!1)},n.className=function(){return"EditTagModal Modal--small"},n.title=function(){return this.name()?Object(g.a)({name:this.name,color:this.color,icon:this.icon}):app.translator.trans("flarum-tags.admin.edit_tag.title")},n.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray()))},n.fields=function(){var t=this,e=new wt.a;return e.add("name",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.edit_tag.name_label")),m("input",{className:"FormControl",placeholder:app.translator.trans("flarum-tags.admin.edit_tag.name_placeholder"),value:this.name(),oninput:function(e){t.name(e.target.value),t.slug(Object(Et.slug)(e.target.value))}})),50),e.add("slug",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.edit_tag.slug_label")),m("input",{className:"FormControl",value:this.slug(),oninput:m.withAttr("value",this.slug)})),40),e.add("description",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.edit_tag.description_label")),m("textarea",{className:"FormControl",value:this.description(),oninput:m.withAttr("value",this.description)})),30),e.add("color",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.edit_tag.color_label")),m("input",{className:"FormControl",placeholder:"#aaaaaa",value:this.color(),oninput:m.withAttr("value",this.color)})),20),e.add("icon",m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.edit_tag.icon_label")),m("div",{className:"helpText"},app.translator.trans("flarum-tags.admin.edit_tag.icon_text",{a:m("a",{href:"https://fontawesome.com/icons?m=free",tabindex:"-1"})})),m("input",{className:"FormControl",placeholder:"fas fa-bolt",value:this.icon(),oninput:m.withAttr("value",this.icon)})),10),e.add("hidden",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",value:"1",checked:this.isHidden(),onchange:m.withAttr("checked",this.isHidden)}),app.translator.trans("flarum-tags.admin.edit_tag.hide_label")))),10),e.add("submit",m("div",{className:"Form-group"},f.a.component({type:"submit",className:"Button Button--primary EditTagModal-save",loading:this.loading,children:app.translator.trans("flarum-tags.admin.edit_tag.submit_button")}),this.tag.exists?m("button",{type:"button",className:"Button EditTagModal-delete",onclick:this.delete.bind(this)},app.translator.trans("flarum-tags.admin.edit_tag.delete_tag_button")):""),-10),e},n.submitData=function(){return{name:this.name(),slug:this.slug(),description:this.description(),color:this.color(),icon:this.icon(),isHidden:this.isHidden()}},n.onsubmit=function(t){var e=this;t.preventDefault(),this.loading=!0,this.tag.save(this.submitData()).then((function(){return e.hide()}),(function(t){e.loading=!1,e.handleErrors(t)}))},n.delete=function(){var t=this;if(confirm(app.translator.trans("flarum-tags.admin.edit_tag.delete_tag_confirmation"))){var e=app.store.all("tags").filter((function(e){return e.parent()===t.tag}));this.tag.delete().then((function(){e.forEach((function(t){return t.pushData({attributes:{isChild:!1},relationships:{parent:null}})})),m.redraw()})),this.hide()}},e}(yt.a),xt=n(45),Ct=function(t){function e(){return t.apply(this,arguments)||this}Object(x.a)(e,t);var n=e.prototype;return n.setMinTags=function(t,e,n){t(n),e(Math.max(n,e()))},n.className=function(){return"TagSettingsModal Modal--small"},n.title=function(){return app.translator.trans("flarum-tags.admin.tag_settings.title")},n.form=function(){var t=this.setting("flarum-tags.min_primary_tags",0),e=this.setting("flarum-tags.max_primary_tags",0),n=this.setting("flarum-tags.min_secondary_tags",0),a=this.setting("flarum-tags.max_secondary_tags",0);return[m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.tag_settings.required_primary_heading")),m("div",{className:"helpText"},app.translator.trans("flarum-tags.admin.tag_settings.required_primary_text")),m("div",{className:"TagSettingsModal-rangeInput"},m("input",{className:"FormControl",type:"number",min:"0",value:t(),oninput:m.withAttr("value",this.setMinTags.bind(this,t,e))}),app.translator.trans("flarum-tags.admin.tag_settings.range_separator_text"),m("input",{className:"FormControl",type:"number",min:t(),bidi:e}))),m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-tags.admin.tag_settings.required_secondary_heading")),m("div",{className:"helpText"},app.translator.trans("flarum-tags.admin.tag_settings.required_secondary_text")),m("div",{className:"TagSettingsModal-rangeInput"},m("input",{className:"FormControl",type:"number",min:"0",value:n(),oninput:m.withAttr("value",this.setMinTags.bind(this,n,a))}),app.translator.trans("flarum-tags.admin.tag_settings.range_separator_text"),m("input",{className:"FormControl",type:"number",min:n(),bidi:a})))]},e}(n.n(xt).a);function Nt(t){return m("li",{"data-id":t.id(),style:{color:t.color()}},m("div",{className:"TagListItem-info"},Object(h.a)(t),m("span",{className:"TagListItem-name"},t.name()),f.a.component({className:"Button Button--link",icon:"fas fa-pencil-alt",onclick:function(){return app.modal.show(new Tt({tag:t}))}})),t.isChild()||null===t.position()?"":m("ol",{className:"TagListItem-children"},Object(v.a)(app.store.all("tags")).filter((function(e){return e.parent()===t})).map(Nt)))}var Lt=function(t){function e(){return t.apply(this,arguments)||this}Object(x.a)(e,t);var n=e.prototype;return n.view=function(){return m("div",{className:"TagsPage"},m("div",{className:"TagsPage-header"},m("div",{className:"container"},m("p",null,app.translator.trans("flarum-tags.admin.tags.about_tags_text")),f.a.component({className:"Button Button--primary",icon:"fas fa-plus",children:app.translator.trans("flarum-tags.admin.tags.create_tag_button"),onclick:function(){return app.modal.show(new Tt)}}),f.a.component({className:"Button",children:app.translator.trans("flarum-tags.admin.tags.settings_button"),onclick:function(){return app.modal.show(new Ct)}}))),m("div",{className:"TagsPage-list"},m("div",{className:"container"},m("div",{className:"TagGroup"},m("label",null,app.translator.trans("flarum-tags.admin.tags.primary_heading")),m("ol",{className:"TagList TagList--primary"},Object(v.a)(app.store.all("tags")).filter((function(t){return null!==t.position()&&!t.isChild()})).map(Nt))),m("div",{className:"TagGroup"},m("label",null,app.translator.trans("flarum-tags.admin.tags.secondary_heading")),m("ul",{className:"TagList"},app.store.all("tags").filter((function(t){return null===t.position()})).sort((function(t,e){return t.name().localeCompare(e.name())})).map(Nt))))))},n.config=function(){gt(this.$("ol, ul"),{acceptFrom:"ol,ul"}).forEach(this.onSortUpdate.bind(this))},n.onSortUpdate=function(t){var e=this;t.addEventListener("sortupdate",(function(t){t.detail.origin.container instanceof HTMLOListElement&&t.detail.destination.container instanceof HTMLUListElement&&app.store.getById("tags",t.detail.item.getAttribute("data-id")).pushData({attributes:{position:null,isChild:!1},relationships:{parent:null}});var n=e.$(".TagList--primary > li").map((function(){return{id:$(this).data("id"),children:$(this).find("li").map((function(){return $(this).data("id")})).get()}})).get();n.forEach((function(t,e){var n=app.store.getById("tags",t.id);n.pushData({attributes:{position:e,isChild:!1},relationships:{parent:null}}),t.children.forEach((function(t,e){app.store.getById("tags",t).pushData({attributes:{position:e,isChild:!0},relationships:{parent:n}})}))})),app.request({url:app.forum.attribute("apiUrl")+"/tags/order",method:"POST",data:{order:n}}),m.redraw.strategy("all"),m.redraw()}))},e}(vt.a),Ot=function(){app.routes.tags={path:"/tags",component:Lt.component()},app.extensionSettings["flarum-tags"]=function(){return m.route(app.route("tags"))},Object(o.extend)(w.a.prototype,"items",(function(t){t.add("tags",T.a.component({href:app.route("tags"),icon:"fas fa-tags",children:app.translator.trans("flarum-tags.admin.nav.tags_button"),description:app.translator.trans("flarum-tags.admin.nav.tags_text")}))}))},Mt=n(46),Dt=n.n(Mt),jt=function(){Object(o.extend)(Dt.a.prototype,"homePageItems",(function(t){t.add("tags",{path:"/tags",label:app.translator.trans("flarum-tags.admin.basics.tags_label")})}))},It=n(47),St=n.n(It),At=function(){Object(o.extend)(s.a.prototype,"startItems",(function(t){t.add("allowTagChange",{icon:"fas fa-tag",label:app.translator.trans("flarum-tags.admin.permissions.allow_edit_tags_label"),setting:function(){var t=parseInt(app.data.settings.allow_tag_change,10);return St.a.component({defaultLabel:t?app.translator.transChoice("core.admin.permissions_controls.allow_some_minutes_button",t,{count:t}):app.translator.trans("core.admin.permissions_controls.allow_indefinitely_button"),key:"allow_tag_change",options:[{value:"-1",label:app.translator.trans("core.admin.permissions_controls.allow_indefinitely_button")},{value:"10",label:app.translator.trans("core.admin.permissions_controls.allow_ten_minutes_button")},{value:"reply",label:app.translator.trans("core.admin.permissions_controls.allow_until_reply_button")}]})}},90)}))},Pt=n(20),Ht=Object(a.a)(Pt.a,{"tags/addTagsHomePageOption":jt,"tags/addTagChangePermission":At,"tags/addTagsPane":Ot,"tags/components/TagSettingsModal":Ct,"tags/components/TagsPage":Lt,"tags/components/EditTagModal":Tt,"tags/addTagPermission":y,"tags/addTagsPermissionScope":b}),Ft=n(21);app.initializers.add("flarum-tags",(function(t){t.store.models.tags=r.a,b(),y(),Ot(),jt(),At()})),Object(a.a)(Ft.compat,Ht)},,,,,,,,,,,,function(t,e){t.exports=flarum.core.compat["components/PermissionDropdown"]},function(t,e){t.exports=flarum.core.compat["components/Dropdown"]},function(t,e){t.exports=flarum.core.compat["components/AdminNav"]},function(t,e){t.exports=flarum.core.compat["components/AdminLinkButton"]},function(t,e){t.exports=flarum.core.compat["utils/ItemList"]},function(t,e){t.exports=flarum.core.compat["utils/string"]},function(t,e){t.exports=flarum.core.compat["components/SettingsModal"]},function(t,e){t.exports=flarum.core.compat["components/BasicsPage"]},function(t,e){t.exports=flarum.core.compat["components/SettingDropdown"]},,function(t,e,n){"use strict";n.r(e);var a=n(15);for(var r in a)"default"!==r&&function(t){n.d(e,t,(function(){return a[t]}))}(r);n(27)}]); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/extensions/tags/js/dist/admin.js.map b/extensions/tags/js/dist/admin.js.map index 90bc73ffa..f722e057e 100644 --- a/extensions/tags/js/dist/admin.js.map +++ b/extensions/tags/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://@flarum/tags/webpack/bootstrap","webpack://@flarum/tags/external \"flarum.core.compat['Model']\"","webpack://@flarum/tags/external \"flarum.core.compat['extend']\"","webpack://@flarum/tags/./src/common/utils/sortTags.js","webpack://@flarum/tags/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@flarum/tags/./src/common/helpers/tagIcon.js","webpack://@flarum/tags/./src/common/helpers/tagLabel.js","webpack://@flarum/tags/./src/common/helpers/tagsLabel.js","webpack://@flarum/tags/external \"flarum.core.compat['components/Button']\"","webpack://@flarum/tags/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://@flarum/tags/./src/common/models/Tag.js","webpack://@flarum/tags/external \"flarum.core.compat['utils/extract']\"","webpack://@flarum/tags/external \"flarum.core.compat['components/PermissionGrid']\"","webpack://@flarum/tags/external \"flarum.core.compat['utils/mixin']\"","webpack://@flarum/tags/external \"flarum.core.compat['utils/computed']\"","webpack://@flarum/tags/external \"flarum.core.compat['components/Page']\"","webpack://@flarum/tags/external \"flarum.core.compat['components/Modal']\"","webpack://@flarum/tags/./src/common/compat.js","webpack://@flarum/tags/external \"flarum.core\"","webpack://@flarum/tags/./src/admin/addTagsPermissionScope.js","webpack://@flarum/tags/./src/admin/addTagPermission.js","webpack://@flarum/tags/./node_modules/html5sortable/dist/html5sortable.es.js","webpack://@flarum/tags/./src/admin/components/EditTagModal.js","webpack://@flarum/tags/./src/admin/components/TagSettingsModal.js","webpack://@flarum/tags/./src/admin/components/TagsPage.js","webpack://@flarum/tags/./src/admin/addTagsPane.js","webpack://@flarum/tags/./src/admin/addTagsHomePageOption.js","webpack://@flarum/tags/./src/admin/addTagChangePermission.js","webpack://@flarum/tags/./src/admin/compat.js","webpack://@flarum/tags/./src/admin/index.js","webpack://@flarum/tags/external \"flarum.core.compat['components/PermissionDropdown']\"","webpack://@flarum/tags/external \"flarum.core.compat['components/Dropdown']\"","webpack://@flarum/tags/external \"flarum.core.compat['components/AdminNav']\"","webpack://@flarum/tags/external \"flarum.core.compat['components/AdminLinkButton']\"","webpack://@flarum/tags/external \"flarum.core.compat['utils/ItemList']\"","webpack://@flarum/tags/external \"flarum.core.compat['utils/string']\"","webpack://@flarum/tags/external \"flarum.core.compat['components/SettingsModal']\"","webpack://@flarum/tags/external \"flarum.core.compat['components/BasicsPage']\"","webpack://@flarum/tags/external \"flarum.core.compat['components/SettingDropdown']\"","webpack://@flarum/tags/./admin.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","sortTags","tags","slice","sort","a","b","aPos","position","bPos","discussionCount","aParent","parent","bParent","_inheritsLoose","subClass","superClass","constructor","__proto__","tagIcon","tag","attrs","settings","hasIcon","icon","useColor","className","style","color","backgroundColor","tagLabel","link","extract","tagText","app","translator","trans","title","description","href","route","slug","config","tagsLabel","children","forEach","length","push","_extends","assign","target","arguments","source","apply","this","Tag","mixin","Model","attribute","backgroundUrl","backgroundMode","hasOne","defaultSort","isChild","isHidden","lastPostedAt","transformDate","lastPostedDiscussion","isRestricted","canStartDiscussion","canAddToDiscussion","isPrimary","computed","override","original","permission","tagPrefix","match","substr","map","required","extend","PermissionGrid","items","store","all","filter","add","id","label","onremove","save","render","item","indexOf","PermissionDropdown","component","allowGuest","Dropdown","buttonClassName","caretIcon","Button","onclick","addData","element","undefined","h5s","data","_filter","nodes","selector","NodeList","HTMLCollection","Array","Error","from","nodeType","matches","stores","Map","Store","_config","_placeholder","_data","set","mergedConfig","entries","configurable","setConfig","has","getConfig","placeholder","HTMLElement","setData","getData","deleteData","delete","sortableElement","addEventListener","eventName","callback","removeEventListener","addAttribute","setAttribute","removeAttribute","_offset","parentElement","getClientRects","rect","left","window","pageXOffset","right","top","pageYOffset","bottom","_debounce","func","wait","timeout","args","_i","clearTimeout","setTimeout","_index","elementList","isInDom","parentNode","insertNode","referenceNode","newElement","insertBefore","nextElementSibling","insertAfter","_serialize","sortableContainer","customItemSerializer","customContainerSerializer","serializedItem","serializedContainer","isSortable","serializedItems","node","html","outerHTML","index","container","itemCount","_makePlaceholder","placeholderClass","_a","includes","tagName","document","createElement","innerHTML","classList","split","_getElementHeight","getComputedStyle","int","parseInt","getPropertyValue","isNaN","reduce","sum","_getHandles","querySelector","shadowRoot","getEventTarget","event","composedPath","defaultDragImage","draggedElement","elementOffset","posX","pageX","posY","pageY","setDragImage","customDragImage","Event","dataTransfer","dragImage","effectAllowed","_listsConnected","destination","origin","acceptFrom","sel","defaultConfiguration","connectWith","disableIEFix","copy","draggingClass","hoverClass","debounce","throttleTime","maxItems","itemSerializer","containerSerializer","dragging","draggingHeight","originContainer","originIndex","originElementIndex","originItemsBeforeUpdate","previousContainer","destinationItemsBeforeUpdate","enableHoverClass","enable","hoverClasses_1","fn","threshold","_this","lastEventTimestamp","now","Date","_throttle","buttons","_b","remove","_removeItemEvents","_getDragging","draggedItem","sortable","ditem","cloneNode","appendChild","display","oldDisplay","_removeSortableData","_removeItemData","findSortable","find","el","findDragElement","options","itemlist","ele","contains","_enableSortable","opts","handles","handle","dragDrop","_reloadSortable","sortableElements","method","String","querySelectorAll","test","configKey","console","warn","customPlaceholder","listItems","tempContainer","e","stopImmediatePropagation","getAttribute","dragItem","dispatchEvent","CustomEvent","detail","elementIndex","originalTarget","itemsBeforeUpdate","visiblePlaceholder","values","preventDefault","stopPropagation","originItems","destinationContainer","destinationItems","destinationElementIndex","destinationIndex","debouncedDragOverEnter","forcePlaceholderSize","height","thisHeight","placeholderIndex","thisIndex","deadZone","offsetTop","placeAfter","offsetHeight","placeholders","onDragOverEnter","dropEffect","concat","destroy","_destroySortable","disable","_disableSortable","__testing","EditTagModal","init","props","createRecord","prop","content","fields","toArray","ItemList","oninput","withAttr","tabindex","type","checked","onchange","loading","exists","submitData","onsubmit","then","hide","response","handleErrors","confirm","pushData","attributes","relationships","redraw","Modal","TagSettingsModal","setMinTags","minTags","maxTags","Math","max","form","minPrimaryTags","setting","maxPrimaryTags","minSecondaryTags","maxSecondaryTags","min","bidi","SettingsModal","tagItem","data-id","modal","show","child","TagsPage","view","localeCompare","$","onSortUpdate","HTMLOListElement","HTMLUListElement","getById","order","j","request","url","forum","strategy","Page","routes","path","extensionSettings","AdminNav","AdminLinkButton","BasicsPage","minutes","allow_tag_change","SettingDropdown","defaultLabel","transChoice","count","addTagsHomePageOption","addTagChangePermission","addTagsPane","addTagPermission","addTagsPermissionScope","initializers","models","tagsCompat"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO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AAOvD,IAAIC,WAAWC,MAAM,kEAIlD,Q,SCbQ,GAAA5D,OAAA,KAAcwB,KAAQ,CACnC,6BAA8B4Z,GAC9B,8BAA+BC,GAC/B,mBAAoBC,GACpB,mCAAoCjD,GACpC,2BAA4BoB,GAC5B,+BAAgCjD,GAChC,wBAAyB+E,EACzB,8BAA+BC,I,SCZjC9X,IAAI+X,aAAa1U,IAAI,eAAe,SAAArD,GAClCA,EAAIkD,MAAM8U,OAAOha,KAAOqD,IAExByW,IACAD,IACAD,KACAF,KACAC,QAQFrb,OAAA,IAAAA,CAAcwB,UAAQma,K,0BCtBtBtc,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,kC,cCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,wB,cCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,wB,cCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,+B,cCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,mB,cCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,iB,cCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,6B,cCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,0B,cCApCnC,EAAOD,QAAUkC,OAAOC,KAAKC,OAAO,+B,8BCApC","file":"admin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 49);\n","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['extend'];","export default function sortTags(tags) {\n return tags.slice(0).sort((a, b) => {\n const aPos = a.position();\n const bPos = b.position();\n\n // If they're both secondary tags, sort them by their discussions count,\n // descending.\n if (aPos === null && bPos === null)\n return b.discussionCount() - a.discussionCount();\n\n // If just one is a secondary tag, then the primary tag should\n // come first.\n if (bPos === null) return -1;\n if (aPos === null) return 1;\n\n // If we've made it this far, we know they're both primary tags. So we'll\n // need to see if they have parents.\n const aParent = a.parent();\n const bParent = b.parent();\n\n // If they both have the same parent, then their positions are local,\n // so we can compare them directly.\n if (aParent === bParent) return aPos - bPos;\n\n // If they are both child tags, then we will compare the positions of their\n // parents.\n else if (aParent && bParent)\n return aParent.position() - bParent.position();\n\n // If we are comparing a child tag with its parent, then we let the parent\n // come first. If we are comparing an unrelated parent/child, then we\n // compare both of the parents.\n else if (aParent)\n return aParent === b ? 1 : aParent.position() - bPos;\n\n else if (bParent)\n return bParent === a ? -1 : aPos - bParent.position();\n\n return 0;\n });\n}\n","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","export default function tagIcon(tag, attrs = {}, settings = {}) {\n const hasIcon = tag && tag.icon();\n const { useColor = true } = settings;\n\n attrs.className = 'icon TagIcon '+ (attrs.className || '') + ' ' + (hasIcon ? tag.icon() : 'default');\n\n if (tag) {\n attrs.style = attrs.style || {};\n\n if (hasIcon) {\n attrs.style.color = useColor ? tag.color() : '';\n } else {\n attrs.style.backgroundColor = tag.color();\n }\n\n } else {\n attrs.className += ' untagged';\n }\n\n return hasIcon ? : ;\n}\n","import extract from 'flarum/utils/extract';\nimport tagIcon from './tagIcon';\n\nexport default function tagLabel(tag, attrs = {}) {\n attrs.style = attrs.style || {};\n attrs.className = 'TagLabel ' + (attrs.className || '');\n\n const link = extract(attrs, 'link');\n const tagText = tag ? tag.name() : app.translator.trans('flarum-tags.lib.deleted_tag_text');\n\n if (tag) {\n const color = tag.color();\n if (color) {\n attrs.style.backgroundColor = attrs.style.color = color;\n attrs.className += ' colored';\n }\n\n if (link) {\n attrs.title = tag.description() || '';\n attrs.href = app.route('tag', {tags: tag.slug()});\n attrs.config = m.route;\n }\n } else {\n attrs.className += ' untagged';\n }\n\n return (\n m((link ? 'a' : 'span'), attrs,\n \n {tag && tag.icon() && tagIcon(tag, {}, {useColor: false})} {tagText}\n \n )\n );\n}\n","import extract from 'flarum/utils/extract';\nimport tagLabel from './tagLabel';\nimport sortTags from '../utils/sortTags';\n\nexport default function tagsLabel(tags, attrs = {}) {\n const children = [];\n const link = extract(attrs, 'link');\n\n attrs.className = 'TagsLabel ' + (attrs.className || '');\n\n if (tags) {\n sortTags(tags).forEach(tag => {\n if (tag || tags.length === 1) {\n children.push(tagLabel(tag, {link}));\n }\n });\n } else {\n children.push(tagLabel());\n }\n\n return {children};\n}\n","module.exports = flarum.core.compat['components/Button'];","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport computed from 'flarum/utils/computed';\n\nexport default class Tag extends mixin(Model, {\n name: Model.attribute('name'),\n slug: Model.attribute('slug'),\n description: Model.attribute('description'),\n\n color: Model.attribute('color'),\n backgroundUrl: Model.attribute('backgroundUrl'),\n backgroundMode: Model.attribute('backgroundMode'),\n icon: Model.attribute('icon'),\n\n position: Model.attribute('position'),\n parent: Model.hasOne('parent'),\n defaultSort: Model.attribute('defaultSort'),\n isChild: Model.attribute('isChild'),\n isHidden: Model.attribute('isHidden'),\n\n discussionCount: Model.attribute('discussionCount'),\n lastPostedAt: Model.attribute('lastPostedAt', Model.transformDate),\n lastPostedDiscussion: Model.hasOne('lastPostedDiscussion'),\n\n isRestricted: Model.attribute('isRestricted'),\n canStartDiscussion: Model.attribute('canStartDiscussion'),\n canAddToDiscussion: Model.attribute('canAddToDiscussion'),\n\n isPrimary: computed('position', 'parent', (position, parent) => position !== null && parent === false)\n}) {}\n","module.exports = flarum.core.compat['utils/extract'];","module.exports = flarum.core.compat['components/PermissionGrid'];","module.exports = flarum.core.compat['utils/mixin'];","module.exports = flarum.core.compat['utils/computed'];","module.exports = flarum.core.compat['components/Page'];","module.exports = flarum.core.compat['components/Modal'];","import sortTags from './utils/sortTags';\nimport Tag from './models/Tag';\nimport tagsLabel from './helpers/tagsLabel';\nimport tagIcon from './helpers/tagIcon';\nimport tagLabel from './helpers/tagLabel';\n\nexport default {\n 'tags/utils/sortTags': sortTags,\n 'tags/models/Tag': Tag,\n 'tags/helpers/tagsLabel': tagsLabel,\n 'tags/helpers/tagIcon': tagIcon,\n 'tags/helpers/tagLabel': tagLabel\n};\n","module.exports = flarum.core;","import { extend, override } from 'flarum/extend';\nimport PermissionGrid from 'flarum/components/PermissionGrid';\nimport PermissionDropdown from 'flarum/components/PermissionDropdown';\nimport Dropdown from 'flarum/components/Dropdown';\nimport Button from 'flarum/components/Button';\n\nimport tagLabel from '../common/helpers/tagLabel';\nimport tagIcon from '../common/helpers/tagIcon';\nimport sortTags from '../common/utils/sortTags';\n\nexport default function() {\n override(app, 'getRequiredPermissions', (original, permission) => {\n const tagPrefix = permission.match(/^tag\\d+\\./);\n\n if (tagPrefix) {\n const globalPermission = permission.substr(tagPrefix[0].length);\n\n const required = original(globalPermission);\n\n return required.map(required => tagPrefix[0] + required);\n }\n\n return original(permission);\n });\n\n extend(PermissionGrid.prototype, 'scopeItems', items => {\n sortTags(app.store.all('tags'))\n .filter(tag => tag.isRestricted())\n .forEach(tag => items.add('tag' + tag.id(), {\n label: tagLabel(tag),\n onremove: () => tag.save({isRestricted: false}),\n render: item => {\n if (item.permission === 'viewDiscussions'\n || item.permission === 'startDiscussion'\n || (item.permission && item.permission.indexOf('discussion.') === 0)) {\n return PermissionDropdown.component({\n permission: 'tag' + tag.id() + '.' + item.permission,\n allowGuest: item.allowGuest\n });\n }\n\n return '';\n }\n }));\n });\n\n extend(PermissionGrid.prototype, 'scopeControlItems', items => {\n const tags = sortTags(app.store.all('tags').filter(tag => !tag.isRestricted()));\n\n if (tags.length) {\n items.add('tag', Dropdown.component({\n className: 'Dropdown--restrictByTag',\n buttonClassName: 'Button Button--text',\n label: app.translator.trans('flarum-tags.admin.permissions.restrict_by_tag_heading'),\n icon: 'fas fa-plus',\n caretIcon: null,\n children: tags.map(tag => Button.component({\n icon: true,\n children: [tagIcon(tag, {className: 'Button-icon'}), ' ', tag.name()],\n onclick: () => tag.save({isRestricted: true})\n }))\n }));\n }\n });\n}\n","import { extend } from 'flarum/extend';\nimport PermissionGrid from 'flarum/components/PermissionGrid';\n\nexport default function() {\n extend(PermissionGrid.prototype, 'moderateItems', items => {\n items.add('tag', {\n icon: 'fas fa-tag',\n label: app.translator.trans('flarum-tags.admin.permissions.tag_discussions_label'),\n permission: 'discussion.tag'\n }, 95);\n });\n}\n","/*\n * HTML5Sortable package\n * https://github.com/lukasoppermann/html5sortable\n *\n * Maintained by Lukas Oppermann \n *\n * Released under the MIT license.\n */\n/**\n * Get or set data on element\n * @param {HTMLElement} element\n * @param {string} key\n * @param {any} value\n * @return {*}\n */\nfunction addData(element, key, value) {\n if (value === undefined) {\n return element && element.h5s && element.h5s.data && element.h5s.data[key];\n }\n else {\n element.h5s = element.h5s || {};\n element.h5s.data = element.h5s.data || {};\n element.h5s.data[key] = value;\n }\n}\n/**\n * Remove data from element\n * @param {HTMLElement} element\n */\nfunction removeData(element) {\n if (element.h5s) {\n delete element.h5s.data;\n }\n}\n\n/* eslint-env browser */\n/**\n * Filter only wanted nodes\n * @param {NodeList|HTMLCollection|Array} nodes\n * @param {String} selector\n * @returns {Array}\n */\nvar _filter = (function (nodes, selector) {\n if (!(nodes instanceof NodeList || nodes instanceof HTMLCollection || nodes instanceof Array)) {\n throw new Error('You must provide a nodeList/HTMLCollection/Array of elements to be filtered.');\n }\n if (typeof selector !== 'string') {\n return Array.from(nodes);\n }\n return Array.from(nodes).filter(function (item) { return item.nodeType === 1 && item.matches(selector); });\n});\n\n/* eslint-env browser */\nvar stores = new Map();\n/**\n * Stores data & configurations per Sortable\n * @param {Object} config\n */\nvar Store = /** @class */ (function () {\n function Store() {\n this._config = new Map(); // eslint-disable-line no-undef\n this._placeholder = undefined; // eslint-disable-line no-undef\n this._data = new Map(); // eslint-disable-line no-undef\n }\n Object.defineProperty(Store.prototype, \"config\", {\n /**\n * get the configuration map of a class instance\n * @method config\n * @return {object}\n */\n get: function () {\n // transform Map to object\n var config = {};\n this._config.forEach(function (value, key) {\n config[key] = value;\n });\n // return object\n return config;\n },\n /**\n * set the configuration of a class instance\n * @method config\n * @param {object} config object of configurations\n */\n set: function (config) {\n if (typeof config !== 'object') {\n throw new Error('You must provide a valid configuration object to the config setter.');\n }\n // combine config with default\n var mergedConfig = Object.assign({}, config);\n // add config to map\n this._config = new Map(Object.entries(mergedConfig));\n },\n enumerable: true,\n configurable: true\n });\n /**\n * set individual configuration of a class instance\n * @method setConfig\n * @param key valid configuration key\n * @param value any value\n * @return void\n */\n Store.prototype.setConfig = function (key, value) {\n if (!this._config.has(key)) {\n throw new Error(\"Trying to set invalid configuration item: \" + key);\n }\n // set config\n this._config.set(key, value);\n };\n /**\n * get an individual configuration of a class instance\n * @method getConfig\n * @param key valid configuration key\n * @return any configuration value\n */\n Store.prototype.getConfig = function (key) {\n if (!this._config.has(key)) {\n throw new Error(\"Invalid configuration item requested: \" + key);\n }\n return this._config.get(key);\n };\n Object.defineProperty(Store.prototype, \"placeholder\", {\n /**\n * get the placeholder for a class instance\n * @method placeholder\n * @return {HTMLElement|null}\n */\n get: function () {\n return this._placeholder;\n },\n /**\n * set the placeholder for a class instance\n * @method placeholder\n * @param {HTMLElement} placeholder\n * @return {void}\n */\n set: function (placeholder) {\n if (!(placeholder instanceof HTMLElement) && placeholder !== null) {\n throw new Error('A placeholder must be an html element or null.');\n }\n this._placeholder = placeholder;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * set an data entry\n * @method setData\n * @param {string} key\n * @param {any} value\n * @return {void}\n */\n Store.prototype.setData = function (key, value) {\n if (typeof key !== 'string') {\n throw new Error(\"The key must be a string.\");\n }\n this._data.set(key, value);\n };\n /**\n * get an data entry\n * @method getData\n * @param {string} key an existing key\n * @return {any}\n */\n Store.prototype.getData = function (key) {\n if (typeof key !== 'string') {\n throw new Error(\"The key must be a string.\");\n }\n return this._data.get(key);\n };\n /**\n * delete an data entry\n * @method deleteData\n * @param {string} key an existing key\n * @return {boolean}\n */\n Store.prototype.deleteData = function (key) {\n if (typeof key !== 'string') {\n throw new Error(\"The key must be a string.\");\n }\n return this._data.delete(key);\n };\n return Store;\n}());\n/**\n * @param {HTMLElement} sortableElement\n * @returns {Class: Store}\n */\nvar store = (function (sortableElement) {\n // if sortableElement is wrong type\n if (!(sortableElement instanceof HTMLElement)) {\n throw new Error('Please provide a sortable to the store function.');\n }\n // create new instance if not avilable\n if (!stores.has(sortableElement)) {\n stores.set(sortableElement, new Store());\n }\n // return instance\n return stores.get(sortableElement);\n});\n\n/**\n * @param {Array|HTMLElement} element\n * @param {Function} callback\n * @param {string} event\n */\nfunction addEventListener(element, eventName, callback) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n addEventListener(element[i], eventName, callback);\n }\n return;\n }\n element.addEventListener(eventName, callback);\n store(element).setData(\"event\" + eventName, callback);\n}\n/**\n * @param {Array|HTMLElement} element\n * @param {string} eventName\n */\nfunction removeEventListener(element, eventName) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n removeEventListener(element[i], eventName);\n }\n return;\n }\n element.removeEventListener(eventName, store(element).getData(\"event\" + eventName));\n store(element).deleteData(\"event\" + eventName);\n}\n\n/**\n * @param {Array|HTMLElement} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction addAttribute(element, attribute, value) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n addAttribute(element[i], attribute, value);\n }\n return;\n }\n element.setAttribute(attribute, value);\n}\n/**\n * @param {Array|HTMLElement} element\n * @param {string} attribute\n */\nfunction removeAttribute(element, attribute) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n removeAttribute(element[i], attribute);\n }\n return;\n }\n element.removeAttribute(attribute);\n}\n\n/**\n * @param {HTMLElement} element\n * @returns {Object}\n */\nvar _offset = (function (element) {\n if (!element.parentElement || element.getClientRects().length === 0) {\n throw new Error('target element must be part of the dom');\n }\n var rect = element.getClientRects()[0];\n return {\n left: rect.left + window.pageXOffset,\n right: rect.right + window.pageXOffset,\n top: rect.top + window.pageYOffset,\n bottom: rect.bottom + window.pageYOffset\n };\n});\n\n/**\n * Creates and returns a new debounced version of the passed function which will postpone its execution until after wait milliseconds have elapsed\n * @param {Function} func to debounce\n * @param {number} time to wait before calling function with latest arguments, 0 - no debounce\n * @returns {function} - debounced function\n */\nvar _debounce = (function (func, wait) {\n if (wait === void 0) { wait = 0; }\n var timeout;\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n func.apply(void 0, args);\n }, wait);\n };\n});\n\n/* eslint-env browser */\n/**\n * Get position of the element relatively to its sibling elements\n * @param {HTMLElement} element\n * @returns {number}\n */\nvar _index = (function (element, elementList) {\n if (!(element instanceof HTMLElement) || !(elementList instanceof NodeList || elementList instanceof HTMLCollection || elementList instanceof Array)) {\n throw new Error('You must provide an element and a list of elements.');\n }\n return Array.from(elementList).indexOf(element);\n});\n\n/* eslint-env browser */\n/**\n * Test whether element is in DOM\n * @param {HTMLElement} element\n * @returns {boolean}\n */\nvar isInDom = (function (element) {\n if (!(element instanceof HTMLElement)) {\n throw new Error('Element is not a node element.');\n }\n return element.parentNode !== null;\n});\n\n/* eslint-env browser */\n/**\n * Insert node before or after target\n * @param {HTMLElement} referenceNode - reference element\n * @param {HTMLElement} newElement - element to be inserted\n * @param {String} position - insert before or after reference element\n */\nvar insertNode = function (referenceNode, newElement, position) {\n if (!(referenceNode instanceof HTMLElement) || !(referenceNode.parentElement instanceof HTMLElement)) {\n throw new Error('target and element must be a node');\n }\n referenceNode.parentElement.insertBefore(newElement, (position === 'before' ? referenceNode : referenceNode.nextElementSibling));\n};\n/**\n * Insert before target\n * @param {HTMLElement} target\n * @param {HTMLElement} element\n */\nvar insertBefore = function (target, element) { return insertNode(target, element, 'before'); };\n/**\n * Insert after target\n * @param {HTMLElement} target\n * @param {HTMLElement} element\n */\nvar insertAfter = function (target, element) { return insertNode(target, element, 'after'); };\n\n/* eslint-env browser */\n/**\n * Filter only wanted nodes\n * @param {HTMLElement} sortableContainer\n * @param {Function} customSerializer\n * @returns {Array}\n */\nvar _serialize = (function (sortableContainer, customItemSerializer, customContainerSerializer) {\n if (customItemSerializer === void 0) { customItemSerializer = function (serializedItem, sortableContainer) { return serializedItem; }; }\n if (customContainerSerializer === void 0) { customContainerSerializer = function (serializedContainer) { return serializedContainer; }; }\n // check for valid sortableContainer\n if (!(sortableContainer instanceof HTMLElement) || !sortableContainer.isSortable === true) {\n throw new Error('You need to provide a sortableContainer to be serialized.');\n }\n // check for valid serializers\n if (typeof customItemSerializer !== 'function' || typeof customContainerSerializer !== 'function') {\n throw new Error('You need to provide a valid serializer for items and the container.');\n }\n // get options\n var options = addData(sortableContainer, 'opts');\n var item = options.items;\n // serialize container\n var items = _filter(sortableContainer.children, item);\n var serializedItems = items.map(function (item) {\n return {\n parent: sortableContainer,\n node: item,\n html: item.outerHTML,\n index: _index(item, items)\n };\n });\n // serialize container\n var container = {\n node: sortableContainer,\n itemCount: serializedItems.length\n };\n return {\n container: customContainerSerializer(container),\n items: serializedItems.map(function (item) { return customItemSerializer(item, sortableContainer); })\n };\n});\n\n/* eslint-env browser */\n/**\n * create a placeholder element\n * @param {HTMLElement} sortableElement a single sortable\n * @param {string|undefined} placeholder a string representing an html element\n * @param {string} placeholderClasses a string representing the classes that should be added to the placeholder\n */\nvar _makePlaceholder = (function (sortableElement, placeholder, placeholderClass) {\n var _a;\n if (placeholderClass === void 0) { placeholderClass = 'sortable-placeholder'; }\n if (!(sortableElement instanceof HTMLElement)) {\n throw new Error('You must provide a valid element as a sortable.');\n }\n // if placeholder is not an element\n if (!(placeholder instanceof HTMLElement) && placeholder !== undefined) {\n throw new Error('You must provide a valid element as a placeholder or set ot to undefined.');\n }\n // if no placeholder element is given\n if (placeholder === undefined) {\n if (['UL', 'OL'].includes(sortableElement.tagName)) {\n placeholder = document.createElement('li');\n }\n else if (['TABLE', 'TBODY'].includes(sortableElement.tagName)) {\n placeholder = document.createElement('tr');\n // set colspan to always all rows, otherwise the item can only be dropped in first column\n placeholder.innerHTML = '';\n }\n else {\n placeholder = document.createElement('div');\n }\n }\n // add classes to placeholder\n if (typeof placeholderClass === 'string') {\n (_a = placeholder.classList).add.apply(_a, placeholderClass.split(' '));\n }\n return placeholder;\n});\n\n/* eslint-env browser */\n/**\n * Get height of an element including padding\n * @param {HTMLElement} element an dom element\n */\nvar _getElementHeight = (function (element) {\n if (!(element instanceof HTMLElement)) {\n throw new Error('You must provide a valid dom element');\n }\n // get calculated style of element\n var style = window.getComputedStyle(element);\n // pick applicable properties, convert to int and reduce by adding\n return ['height', 'padding-top', 'padding-bottom']\n .map(function (key) {\n var int = parseInt(style.getPropertyValue(key), 10);\n return isNaN(int) ? 0 : int;\n })\n .reduce(function (sum, value) { return sum + value; });\n});\n\n/* eslint-env browser */\n/**\n * get handle or return item\n * @param {Array} items\n * @param {string} selector\n */\nvar _getHandles = (function (items, selector) {\n if (!(items instanceof Array)) {\n throw new Error('You must provide a Array of HTMLElements to be filtered.');\n }\n if (typeof selector !== 'string') {\n return items;\n }\n return items\n // remove items without handle from array\n .filter(function (item) {\n return item.querySelector(selector) instanceof HTMLElement ||\n (item.shadowRoot && item.shadowRoot.querySelector(selector) instanceof HTMLElement);\n })\n // replace item with handle in array\n .map(function (item) {\n return item.querySelector(selector) || (item.shadowRoot && item.shadowRoot.querySelector(selector));\n });\n});\n\n/**\n * @param {Event} event\n * @returns {HTMLElement}\n */\nvar getEventTarget = (function (event) {\n return (event.composedPath && event.composedPath()[0]) || event.target;\n});\n\n/* eslint-env browser */\n/**\n * defaultDragImage returns the current item as dragged image\n * @param {HTMLElement} draggedElement - the item that the user drags\n * @param {object} elementOffset - an object with the offsets top, left, right & bottom\n * @param {Event} event - the original drag event object\n * @return {object} with element, posX and posY properties\n */\nvar defaultDragImage = function (draggedElement, elementOffset, event) {\n return {\n element: draggedElement,\n posX: event.pageX - elementOffset.left,\n posY: event.pageY - elementOffset.top\n };\n};\n/**\n * attaches an element as the drag image to an event\n * @param {Event} event - the original drag event object\n * @param {HTMLElement} draggedElement - the item that the user drags\n * @param {Function} customDragImage - function to create a custom dragImage\n * @return void\n */\nvar setDragImage = (function (event, draggedElement, customDragImage) {\n // check if event is provided\n if (!(event instanceof Event)) {\n throw new Error('setDragImage requires a DragEvent as the first argument.');\n }\n // check if draggedElement is provided\n if (!(draggedElement instanceof HTMLElement)) {\n throw new Error('setDragImage requires the dragged element as the second argument.');\n }\n // set default function of none provided\n if (!customDragImage) {\n customDragImage = defaultDragImage;\n }\n // check if setDragImage method is available\n if (event.dataTransfer && event.dataTransfer.setDragImage) {\n // get the elements offset\n var elementOffset = _offset(draggedElement);\n // get the dragImage\n var dragImage = customDragImage(draggedElement, elementOffset, event);\n // check if custom function returns correct values\n if (!(dragImage.element instanceof HTMLElement) || typeof dragImage.posX !== 'number' || typeof dragImage.posY !== 'number') {\n throw new Error('The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].');\n }\n // needs to be set for HTML5 drag & drop to work\n event.dataTransfer.effectAllowed = 'copyMove';\n // Firefox requires it to use the event target's id for the data\n event.dataTransfer.setData('text/plain', getEventTarget(event).id);\n // set the drag image on the event\n event.dataTransfer.setDragImage(dragImage.element, dragImage.posX, dragImage.posY);\n }\n});\n\n/**\n * Check if curList accepts items from destList\n * @param {sortable} destination the container an item is move to\n * @param {sortable} origin the container an item comes from\n */\nvar _listsConnected = (function (destination, origin) {\n // check if valid sortable\n if (destination.isSortable === true) {\n var acceptFrom = store(destination).getConfig('acceptFrom');\n // check if acceptFrom is valid\n if (acceptFrom !== null && acceptFrom !== false && typeof acceptFrom !== 'string') {\n throw new Error('HTML5Sortable: Wrong argument, \"acceptFrom\" must be \"null\", \"false\", or a valid selector string.');\n }\n if (acceptFrom !== null) {\n return acceptFrom !== false && acceptFrom.split(',').filter(function (sel) {\n return sel.length > 0 && origin.matches(sel);\n }).length > 0;\n }\n // drop in same list\n if (destination === origin) {\n return true;\n }\n // check if lists are connected with connectWith\n if (store(destination).getConfig('connectWith') !== undefined && store(destination).getConfig('connectWith') !== null) {\n return store(destination).getConfig('connectWith') === store(origin).getConfig('connectWith');\n }\n }\n return false;\n});\n\n/**\n * default configurations\n */\nvar defaultConfiguration = {\n items: null,\n // deprecated\n connectWith: null,\n // deprecated\n disableIEFix: null,\n acceptFrom: null,\n copy: false,\n placeholder: null,\n placeholderClass: 'sortable-placeholder',\n draggingClass: 'sortable-dragging',\n hoverClass: false,\n debounce: 0,\n throttleTime: 100,\n maxItems: 0,\n itemSerializer: undefined,\n containerSerializer: undefined,\n customDragImage: null\n};\n\n/**\n * make sure a function is only called once within the given amount of time\n * @param {Function} fn the function to throttle\n * @param {number} threshold time limit for throttling\n */\n// must use function to keep this context\nfunction _throttle (fn, threshold) {\n var _this = this;\n if (threshold === void 0) { threshold = 250; }\n // check function\n if (typeof fn !== 'function') {\n throw new Error('You must provide a function as the first argument for throttle.');\n }\n // check threshold\n if (typeof threshold !== 'number') {\n throw new Error('You must provide a number as the second argument for throttle.');\n }\n var lastEventTimestamp = null;\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var now = Date.now();\n if (lastEventTimestamp === null || now - lastEventTimestamp >= threshold) {\n lastEventTimestamp = now;\n fn.apply(_this, args);\n }\n };\n}\n\n/* eslint-env browser */\n/**\n * enable or disable hoverClass on mouseenter/leave if container Items\n * @param {sortable} sortableContainer a valid sortableContainer\n * @param {boolean} enable enable or disable event\n */\n// export default (sortableContainer: sortable, enable: boolean) => {\nvar enableHoverClass = (function (sortableContainer, enable) {\n if (typeof store(sortableContainer).getConfig('hoverClass') === 'string') {\n var hoverClasses_1 = store(sortableContainer).getConfig('hoverClass').split(' ');\n // add class on hover\n if (enable === true) {\n addEventListener(sortableContainer, 'mousemove', _throttle(function (event) {\n // check of no mouse button was pressed when mousemove started == no drag\n if (event.buttons === 0) {\n _filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(function (item) {\n var _a, _b;\n if (item !== event.target) {\n (_a = item.classList).remove.apply(_a, hoverClasses_1);\n }\n else {\n (_b = item.classList).add.apply(_b, hoverClasses_1);\n }\n });\n }\n }, store(sortableContainer).getConfig('throttleTime')));\n // remove class on leave\n addEventListener(sortableContainer, 'mouseleave', function () {\n _filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(function (item) {\n var _a;\n (_a = item.classList).remove.apply(_a, hoverClasses_1);\n });\n });\n // remove events\n }\n else {\n removeEventListener(sortableContainer, 'mousemove');\n removeEventListener(sortableContainer, 'mouseleave');\n }\n }\n});\n\n/* eslint-env browser */\n/*\n * variables global to the plugin\n */\nvar dragging;\nvar draggingHeight;\n/*\n * Keeps track of the initialy selected list, where 'dragstart' event was triggered\n * It allows us to move the data in between individual Sortable List instances\n */\n// Origin List - data from before any item was changed\nvar originContainer;\nvar originIndex;\nvar originElementIndex;\nvar originItemsBeforeUpdate;\n// Previous Sortable Container - we dispatch as sortenter event when a\n// dragged item enters a sortableContainer for the first time\nvar previousContainer;\n// Destination List - data from before any item was changed\nvar destinationItemsBeforeUpdate;\n/**\n * remove event handlers from items\n * @param {Array|NodeList} items\n */\nvar _removeItemEvents = function (items) {\n removeEventListener(items, 'dragstart');\n removeEventListener(items, 'dragend');\n removeEventListener(items, 'dragover');\n removeEventListener(items, 'dragenter');\n removeEventListener(items, 'drop');\n removeEventListener(items, 'mouseenter');\n removeEventListener(items, 'mouseleave');\n};\n/**\n * _getDragging returns the current element to drag or\n * a copy of the element.\n * Is Copy Active for sortable\n * @param {HTMLElement} draggedItem - the item that the user drags\n * @param {HTMLElement} sortable a single sortable\n */\nvar _getDragging = function (draggedItem, sortable) {\n var ditem = draggedItem;\n if (store(sortable).getConfig('copy') === true) {\n ditem = draggedItem.cloneNode(true);\n addAttribute(ditem, 'aria-copied', 'true');\n draggedItem.parentElement.appendChild(ditem);\n ditem.style.display = 'none';\n ditem.oldDisplay = draggedItem.style.display;\n }\n return ditem;\n};\n/**\n * Remove data from sortable\n * @param {HTMLElement} sortable a single sortable\n */\nvar _removeSortableData = function (sortable) {\n removeData(sortable);\n removeAttribute(sortable, 'aria-dropeffect');\n};\n/**\n * Remove data from items\n * @param {Array|HTMLElement} items\n */\nvar _removeItemData = function (items) {\n removeAttribute(items, 'aria-grabbed');\n removeAttribute(items, 'aria-copied');\n removeAttribute(items, 'draggable');\n removeAttribute(items, 'role');\n};\n/**\n * find sortable from element. travels up parent element until found or null.\n * @param {HTMLElement} element a single sortable\n * @param {Event} event - the current event. We need to pass it to be able to\n * find Sortable whith shadowRoot (document fragment has no parent)\n */\nfunction findSortable(element, event) {\n if (event.composedPath) {\n return event.composedPath().find(function (el) { return el.isSortable; });\n }\n while (element.isSortable !== true) {\n element = element.parentElement;\n }\n return element;\n}\n/**\n * Dragging event is on the sortable element. finds the top child that\n * contains the element.\n * @param {HTMLElement} sortableElement a single sortable\n * @param {HTMLElement} element is that being dragged\n */\nfunction findDragElement(sortableElement, element) {\n var options = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, options.items);\n var itemlist = items.filter(function (ele) {\n return ele.contains(element) || (ele.shadowRoot && ele.shadowRoot.contains(element));\n });\n return itemlist.length > 0 ? itemlist[0] : element;\n}\n/**\n * Destroy the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nvar _destroySortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts') || {};\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n // remove event handlers & data from sortable\n removeEventListener(sortableElement, 'dragover');\n removeEventListener(sortableElement, 'dragenter');\n removeEventListener(sortableElement, 'drop');\n // remove event data from sortable\n _removeSortableData(sortableElement);\n // remove event handlers & data from items\n removeEventListener(handles, 'mousedown');\n _removeItemEvents(items);\n _removeItemData(items);\n};\n/**\n * Enable the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nvar _enableSortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n addAttribute(sortableElement, 'aria-dropeffect', 'move');\n addData(sortableElement, '_disabled', 'false');\n addAttribute(handles, 'draggable', 'true');\n // @todo: remove this fix\n // IE FIX for ghost\n // can be disabled as it has the side effect that other events\n // (e.g. click) will be ignored\n if (opts.disableIEFix === false) {\n var spanEl = (document || window.document).createElement('span');\n if (typeof spanEl.dragDrop === 'function') {\n addEventListener(handles, 'mousedown', function () {\n if (items.indexOf(this) !== -1) {\n this.dragDrop();\n }\n else {\n var parent = this.parentElement;\n while (items.indexOf(parent) === -1) {\n parent = parent.parentElement;\n }\n parent.dragDrop();\n }\n });\n }\n }\n};\n/**\n * Disable the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nvar _disableSortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n addAttribute(sortableElement, 'aria-dropeffect', 'none');\n addData(sortableElement, '_disabled', 'true');\n addAttribute(handles, 'draggable', 'false');\n removeEventListener(handles, 'mousedown');\n};\n/**\n * Reload the sortable\n * @param {HTMLElement} sortableElement a single sortable\n * @description events need to be removed to not be double bound\n */\nvar _reloadSortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n addData(sortableElement, '_disabled', 'false');\n // remove event handlers from items\n _removeItemEvents(items);\n removeEventListener(handles, 'mousedown');\n // remove event handlers from sortable\n removeEventListener(sortableElement, 'dragover');\n removeEventListener(sortableElement, 'dragenter');\n removeEventListener(sortableElement, 'drop');\n};\n/**\n * Public sortable object\n * @param {Array|NodeList} sortableElements\n * @param {object|string} options|method\n */\nfunction sortable(sortableElements, options) {\n // get method string to see if a method is called\n var method = String(options);\n options = options || {};\n // check if the user provided a selector instead of an element\n if (typeof sortableElements === 'string') {\n sortableElements = document.querySelectorAll(sortableElements);\n }\n // if the user provided an element, return it in an array to keep the return value consistant\n if (sortableElements instanceof HTMLElement) {\n sortableElements = [sortableElements];\n }\n sortableElements = Array.prototype.slice.call(sortableElements);\n if (/serialize/.test(method)) {\n return sortableElements.map(function (sortableContainer) {\n var opts = addData(sortableContainer, 'opts');\n return _serialize(sortableContainer, opts.itemSerializer, opts.containerSerializer);\n });\n }\n sortableElements.forEach(function (sortableElement) {\n if (/enable|disable|destroy/.test(method)) {\n return sortable[method](sortableElement);\n }\n // log deprecation\n ['connectWith', 'disableIEFix'].forEach(function (configKey) {\n if (options.hasOwnProperty(configKey) && options[configKey] !== null) {\n console.warn(\"HTML5Sortable: You are using the deprecated configuration \\\"\" + configKey + \"\\\". This will be removed in an upcoming version, make sure to migrate to the new options when updating.\");\n }\n });\n // merge options with default options\n options = Object.assign({}, defaultConfiguration, store(sortableElement).config, options);\n // init data store for sortable\n store(sortableElement).config = options;\n // set options on sortable\n addData(sortableElement, 'opts', options);\n // property to define as sortable\n sortableElement.isSortable = true;\n // reset sortable\n _reloadSortable(sortableElement);\n // initialize\n var listItems = _filter(sortableElement.children, options.items);\n // create element if user defined a placeholder element as a string\n var customPlaceholder;\n if (options.placeholder !== null && options.placeholder !== undefined) {\n var tempContainer = document.createElement(sortableElement.tagName);\n if (options.placeholder instanceof HTMLElement) {\n tempContainer.appendChild(options.placeholder);\n }\n else {\n tempContainer.innerHTML = options.placeholder;\n }\n customPlaceholder = tempContainer.children[0];\n }\n // add placeholder\n store(sortableElement).placeholder = _makePlaceholder(sortableElement, customPlaceholder, options.placeholderClass);\n addData(sortableElement, 'items', options.items);\n if (options.acceptFrom) {\n addData(sortableElement, 'acceptFrom', options.acceptFrom);\n }\n else if (options.connectWith) {\n addData(sortableElement, 'connectWith', options.connectWith);\n }\n _enableSortable(sortableElement);\n addAttribute(listItems, 'role', 'option');\n addAttribute(listItems, 'aria-grabbed', 'false');\n // enable hover class\n enableHoverClass(sortableElement, true);\n /*\n Handle drag events on draggable items\n Handle is set at the sortableElement level as it will bubble up\n from the item\n */\n addEventListener(sortableElement, 'dragstart', function (e) {\n // ignore dragstart events\n var target = getEventTarget(e);\n if (target.isSortable === true) {\n return;\n }\n e.stopImmediatePropagation();\n if ((options.handle && !target.matches(options.handle)) || target.getAttribute('draggable') === 'false') {\n return;\n }\n var sortableContainer = findSortable(target, e);\n var dragItem = findDragElement(sortableContainer, target);\n // grab values\n originItemsBeforeUpdate = _filter(sortableContainer.children, options.items);\n originIndex = originItemsBeforeUpdate.indexOf(dragItem);\n originElementIndex = _index(dragItem, sortableContainer.children);\n originContainer = sortableContainer;\n // add transparent clone or other ghost to cursor\n setDragImage(e, dragItem, options.customDragImage);\n // cache selsection & add attr for dragging\n draggingHeight = _getElementHeight(dragItem);\n dragItem.classList.add(options.draggingClass);\n dragging = _getDragging(dragItem, sortableContainer);\n addAttribute(dragging, 'aria-grabbed', 'true');\n // dispatch sortstart event on each element in group\n sortableContainer.dispatchEvent(new CustomEvent('sortstart', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging,\n originalTarget: target\n }\n }));\n });\n /*\n We are capturing targetSortable before modifications with 'dragenter' event\n */\n addEventListener(sortableElement, 'dragenter', function (e) {\n var target = getEventTarget(e);\n var sortableContainer = findSortable(target, e);\n if (sortableContainer && sortableContainer !== previousContainer) {\n destinationItemsBeforeUpdate = _filter(sortableContainer.children, addData(sortableContainer, 'items'))\n .filter(function (item) { return item !== store(sortableElement).placeholder; });\n sortableContainer.dispatchEvent(new CustomEvent('sortenter', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n destination: {\n container: sortableContainer,\n itemsBeforeUpdate: destinationItemsBeforeUpdate\n },\n item: dragging,\n originalTarget: target\n }\n }));\n }\n previousContainer = sortableContainer;\n });\n /*\n * Dragend Event - https://developer.mozilla.org/en-US/docs/Web/Events/dragend\n * Fires each time dragEvent end, or ESC pressed\n * We are using it to clean up any draggable elements and placeholders\n */\n addEventListener(sortableElement, 'dragend', function (e) {\n if (!dragging) {\n return;\n }\n dragging.classList.remove(options.draggingClass);\n addAttribute(dragging, 'aria-grabbed', 'false');\n if (dragging.getAttribute('aria-copied') === 'true' && addData(dragging, 'dropped') !== 'true') {\n dragging.remove();\n }\n dragging.style.display = dragging.oldDisplay;\n delete dragging.oldDisplay;\n var visiblePlaceholder = Array.from(stores.values()).map(function (data) { return data.placeholder; })\n .filter(function (placeholder) { return placeholder instanceof HTMLElement; })\n .filter(isInDom)[0];\n if (visiblePlaceholder) {\n visiblePlaceholder.remove();\n }\n // dispatch sortstart event on each element in group\n sortableElement.dispatchEvent(new CustomEvent('sortstop', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }));\n previousContainer = null;\n dragging = null;\n draggingHeight = null;\n });\n /*\n * Drop Event - https://developer.mozilla.org/en-US/docs/Web/Events/drop\n * Fires when valid drop target area is hit\n */\n addEventListener(sortableElement, 'drop', function (e) {\n if (!_listsConnected(sortableElement, dragging.parentElement)) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n addData(dragging, 'dropped', 'true');\n // get the one placeholder that is currently visible\n var visiblePlaceholder = Array.from(stores.values()).map(function (data) {\n return data.placeholder;\n })\n // filter only HTMLElements\n .filter(function (placeholder) { return placeholder instanceof HTMLElement; })\n // filter only elements in DOM\n .filter(isInDom)[0];\n // attach element after placeholder\n insertAfter(visiblePlaceholder, dragging);\n // remove placeholder from dom\n visiblePlaceholder.remove();\n /*\n * Fires Custom Event - 'sortstop'\n */\n sortableElement.dispatchEvent(new CustomEvent('sortstop', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }));\n var placeholder = store(sortableElement).placeholder;\n var originItems = _filter(originContainer.children, options.items)\n .filter(function (item) { return item !== placeholder; });\n var destinationContainer = this.isSortable === true ? this : this.parentElement;\n var destinationItems = _filter(destinationContainer.children, addData(destinationContainer, 'items'))\n .filter(function (item) { return item !== placeholder; });\n var destinationElementIndex = _index(dragging, Array.from(dragging.parentElement.children)\n .filter(function (item) { return item !== placeholder; }));\n var destinationIndex = _index(dragging, destinationItems);\n /*\n * When a list item changed container lists or index within a list\n * Fires Custom Event - 'sortupdate'\n */\n if (originElementIndex !== destinationElementIndex || originContainer !== destinationContainer) {\n sortableElement.dispatchEvent(new CustomEvent('sortupdate', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer,\n itemsBeforeUpdate: originItemsBeforeUpdate,\n items: originItems\n },\n destination: {\n index: destinationIndex,\n elementIndex: destinationElementIndex,\n container: destinationContainer,\n itemsBeforeUpdate: destinationItemsBeforeUpdate,\n items: destinationItems\n },\n item: dragging\n }\n }));\n }\n });\n var debouncedDragOverEnter = _debounce(function (sortableElement, element, pageY) {\n if (!dragging) {\n return;\n }\n // set placeholder height if forcePlaceholderSize option is set\n if (options.forcePlaceholderSize) {\n store(sortableElement).placeholder.style.height = draggingHeight + 'px';\n }\n // if element the draggedItem is dragged onto is within the array of all elements in list\n // (not only items, but also disabled, etc.)\n if (Array.from(sortableElement.children).indexOf(element) > -1) {\n var thisHeight = _getElementHeight(element);\n var placeholderIndex = _index(store(sortableElement).placeholder, element.parentElement.children);\n var thisIndex = _index(element, element.parentElement.children);\n // Check if `element` is bigger than the draggable. If it is, we have to define a dead zone to prevent flickering\n if (thisHeight > draggingHeight) {\n // Dead zone?\n var deadZone = thisHeight - draggingHeight;\n var offsetTop = _offset(element).top;\n if (placeholderIndex < thisIndex && pageY < offsetTop) {\n return;\n }\n if (placeholderIndex > thisIndex &&\n pageY > offsetTop + thisHeight - deadZone) {\n return;\n }\n }\n if (dragging.oldDisplay === undefined) {\n dragging.oldDisplay = dragging.style.display;\n }\n if (dragging.style.display !== 'none') {\n dragging.style.display = 'none';\n }\n // To avoid flicker, determine where to position the placeholder\n // based on where the mouse pointer is relative to the elements\n // vertical center.\n var placeAfter = false;\n try {\n var elementMiddle = _offset(element).top + element.offsetHeight / 2;\n placeAfter = pageY >= elementMiddle;\n }\n catch (e) {\n placeAfter = placeholderIndex < thisIndex;\n }\n if (placeAfter) {\n insertAfter(element, store(sortableElement).placeholder);\n }\n else {\n insertBefore(element, store(sortableElement).placeholder);\n }\n // get placeholders from all stores & remove all but current one\n Array.from(stores.values())\n // remove empty values\n .filter(function (data) { return data.placeholder !== undefined; })\n // foreach placeholder in array if outside of current sorableContainer -> remove from DOM\n .forEach(function (data) {\n if (data.placeholder !== store(sortableElement).placeholder) {\n data.placeholder.remove();\n }\n });\n }\n else {\n // get all placeholders from store\n var placeholders = Array.from(stores.values())\n .filter(function (data) { return data.placeholder !== undefined; })\n .map(function (data) {\n return data.placeholder;\n });\n // check if element is not in placeholders\n if (placeholders.indexOf(element) === -1 && sortableElement === element && !_filter(element.children, options.items).length) {\n placeholders.forEach(function (element) { return element.remove(); });\n element.appendChild(store(sortableElement).placeholder);\n }\n }\n }, options.debounce);\n // Handle dragover and dragenter events on draggable items\n var onDragOverEnter = function (e) {\n var element = e.target;\n var sortableElement = element.isSortable === true ? element : findSortable(element, e);\n element = findDragElement(sortableElement, element);\n if (!dragging || !_listsConnected(sortableElement, dragging.parentElement) || addData(sortableElement, '_disabled') === 'true') {\n return;\n }\n var options = addData(sortableElement, 'opts');\n if (parseInt(options.maxItems) && _filter(sortableElement.children, addData(sortableElement, 'items')).length >= parseInt(options.maxItems) && dragging.parentElement !== sortableElement) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n e.dataTransfer.dropEffect = store(sortableElement).getConfig('copy') === true ? 'copy' : 'move';\n debouncedDragOverEnter(sortableElement, element, e.pageY);\n };\n addEventListener(listItems.concat(sortableElement), 'dragover', onDragOverEnter);\n addEventListener(listItems.concat(sortableElement), 'dragenter', onDragOverEnter);\n });\n return sortableElements;\n}\nsortable.destroy = function (sortableElement) {\n _destroySortable(sortableElement);\n};\nsortable.enable = function (sortableElement) {\n _enableSortable(sortableElement);\n};\nsortable.disable = function (sortableElement) {\n _disableSortable(sortableElement);\n};\n/* START.TESTS_ONLY */\nsortable.__testing = {\n // add internal methods here for testing purposes\n _data: addData,\n _removeItemEvents: _removeItemEvents,\n _removeItemData: _removeItemData,\n _removeSortableData: _removeSortableData\n};\n\nexport default sortable;\n","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport ItemList from 'flarum/utils/ItemList';\nimport { slug } from 'flarum/utils/string';\n\nimport tagLabel from '../../common/helpers/tagLabel';\n\n/**\n * The `EditTagModal` component shows a modal dialog which allows the user\n * to create or edit a tag.\n */\nexport default class EditTagModal extends Modal {\n init() {\n super.init();\n\n this.tag = this.props.tag || app.store.createRecord('tags');\n\n this.name = m.prop(this.tag.name() || '');\n this.slug = m.prop(this.tag.slug() || '');\n this.description = m.prop(this.tag.description() || '');\n this.color = m.prop(this.tag.color() || '');\n this.icon = m.prop(this.tag.icon() || '');\n this.isHidden = m.prop(this.tag.isHidden() || false);\n }\n\n className() {\n return 'EditTagModal Modal--small';\n }\n\n title() {\n return this.name()\n ? tagLabel({\n name: this.name,\n color: this.color,\n icon: this.icon,\n })\n : app.translator.trans('flarum-tags.admin.edit_tag.title');\n }\n\n content() {\n return (\n
\n
\n {this.fields().toArray()}\n
\n
\n );\n }\n\n fields() {\n const items = new ItemList();\n\n items.add('name',
\n \n {\n this.name(e.target.value);\n this.slug(slug(e.target.value));\n }}/>\n
, 50);\n\n items.add('slug',
\n \n \n
, 40);\n\n items.add('description',
\n \n