From 07fd62978dd8df4d0d1417d53c3a4088fae863a1 Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Wed, 2 Oct 2024 07:10:53 +0000 Subject: [PATCH] Bundled output for commit 449ba48ba3d78b22a3122361e38a9d03b64b080e Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci] --- js/dist-typings/admin/compat.d.ts | 2 ++ js/dist-typings/forum/compat.d.ts | 2 ++ js/dist/admin.js | 2 +- js/dist/admin.js.map | 2 +- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/js/dist-typings/admin/compat.d.ts b/js/dist-typings/admin/compat.d.ts index 3be0e8a0..98e18163 100644 --- a/js/dist-typings/admin/compat.d.ts +++ b/js/dist-typings/admin/compat.d.ts @@ -11,6 +11,7 @@ declare const _default: { 'tags/addTagChangePermission': typeof addTagChangePermission; 'tags/components/TagsPage': typeof TagsPage; 'tags/components/EditTagModal': typeof EditTagModal; + 'tags/components/SelectTagsSettingComponent': typeof SelectTagsSettingComponent; 'tags/addTagPermission': typeof addTagPermission; 'tags/addTagsPermissionScope': typeof addTagsPermissionScope; }; @@ -19,5 +20,6 @@ import addTagsHomePageOption from "./addTagsHomePageOption"; import addTagChangePermission from "./addTagChangePermission"; import TagsPage from "./components/TagsPage"; import EditTagModal from "./components/EditTagModal"; +import SelectTagsSettingComponent from "./components/SelectTagsSettingComponent"; import addTagPermission from "./addTagPermission"; import addTagsPermissionScope from "./addTagsPermissionScope"; diff --git a/js/dist-typings/forum/compat.d.ts b/js/dist-typings/forum/compat.d.ts index 2a71e08c..fdb6cb69 100644 --- a/js/dist-typings/forum/compat.d.ts +++ b/js/dist-typings/forum/compat.d.ts @@ -12,6 +12,7 @@ declare const _default: { 'tags/components/TagHero': typeof TagHero; 'tags/components/TagDiscussionModal': typeof TagDiscussionModal; 'tags/components/TagsPage': typeof TagsPage; + 'tags/components/ToggleButton': typeof ToggleButton; 'tags/components/DiscussionTaggedPost': typeof DiscussionTaggedPost; 'tags/components/TagLinkButton': typeof TagLinkButton; 'tags/addTagList': typeof addTagList; @@ -25,6 +26,7 @@ import addTagControl from "./addTagControl"; import TagHero from "./components/TagHero"; import TagDiscussionModal from "./components/TagDiscussionModal"; import TagsPage from "./components/TagsPage"; +import ToggleButton from "./components/ToggleButton"; import DiscussionTaggedPost from "./components/DiscussionTaggedPost"; import TagLinkButton from "./components/TagLinkButton"; import addTagList from "./addTagList"; diff --git a/js/dist/admin.js b/js/dist/admin.js index 7df07c5f..33d4a805 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,3 +1,3 @@ /*! For license information please see admin.js.LICENSE.txt */ -(()=>{var t={946:(t,e,n)=>{"use strict";n.d(e,{l:()=>Rn});const o=flarum.core.compat["admin/app"];var r=n.n(o);const a=flarum.core.compat["common/extend"],i=flarum.core.compat["admin/components/PermissionGrid"];var s=n.n(i);const l=flarum.core.compat["admin/components/PermissionDropdown"];var c=n.n(l);const u=flarum.core.compat["common/components/Dropdown"];var d=n.n(u);const h=flarum.core.compat["common/components/Button"];var f=n.n(h);const p=flarum.core.compat["common/components/LoadingIndicator"];var g=n.n(p);const v=flarum.core.compat["common/utils/extract"];var b=n.n(v);const y=flarum.core.compat["common/components/Link"];var w=n.n(y);const _=flarum.core.compat["common/utils/classList"];var T=n.n(_);const x=flarum.core.compat["common/helpers/textContrastClass"];var S=n.n(x);function E(t,e,n){void 0===e&&(e={}),void 0===n&&(n={});var o=t&&t.icon(),r=n.useColor,a=void 0===r||r;return e.className=T()([e.className,"icon",o?t.icon():"TagIcon"]),t&&a?(e.style=e.style||{},e.style["--color"]=t.color(),o&&(e.style.color=t.color())):t||(e.className+=" untagged"),o?m("i",e):m("span",e)}function N(t,e){void 0===e&&(e={}),e.style=e.style||{},e.className="TagLabel "+(e.className||"");var n=b()(e,"link"),o=t?t.name():app.translator.trans("flarum-tags.lib.deleted_tag_text");if(t){var r=t.color();r&&(e.style["--tag-bg"]=r,e.className=T()(e.className,"colored",S()(r))),n&&(e.title=t.description()||"",e.href=app.route("tag",{tags:t.slug()})),t.isChild()&&(e.className+=" TagLabel--child")}else e.className+=" untagged";return m(n?w():"span",e,m("span",{className:"TagLabel-text"},t&&t.icon()&&E(t,{className:"TagLabel-icon"},{useColor:!1}),m("span",{className:"TagLabel-name"},o)))}function C(t){return t.slice(0).sort((function(t,e){var n=t.position(),o=e.position();if(null===n&&null===o)return e.discussionCount()-t.discussionCount();if(null===o)return-1;if(null===n)return 1;var r=t.parent(),a=e.parent();return r===a?n-o:r&&a?r.position()-a.position():r?r===e?1:r.position()-o:a?a===t?-1:n-a.position():0}))}function D(){(0,a.extend)(s().prototype,"oninit",(function(){this.loading=!0})),(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;r().tagList.load().then((function(){t.loading=!1,m.redraw()}))})),(0,a.override)(s().prototype,"view",(function(t,e){return this.loading?m(g(),null):t(e)})),(0,a.override)(r(),"getRequiredPermissions",(function(t,e){var n=e.match(/^tag\d+\./);return n?t(e.substr(n[0].length)).map((function(t){return n[0]+t})):t(e)})),(0,a.extend)(s().prototype,"scopeItems",(function(t){C(r().store.all("tags")).filter((function(t){return t.isRestricted()})).forEach((function(e){return t.add("tag"+e.id(),{label:N(e),onremove:function(){return e.save({isRestricted:!1})},render:function(t){return"setting"in t?null:"viewForum"===t.permission||"startDiscussion"===t.permission||t.permission.startsWith("discussion.")&&!1!==t.tagScoped||t.tagScoped?m(c(),{permission:"tag"+e.id()+"."+t.permission,allowGuest:t.allowGuest}):null}})}))})),(0,a.extend)(s().prototype,"scopeControlItems",(function(t){var e=C(r().store.all("tags").filter((function(t){return!t.isRestricted()})));e.length&&t.add("tag",m(d(),{className:"Dropdown--restrictByTag",buttonClassName:"Button Button--text",label:r().translator.trans("flarum-tags.admin.permissions.restrict_by_tag_heading"),icon:"fas fa-plus",caretIcon:null},e.map((function(t){return m(f(),{icon:!0,onclick:function(){return t.save({isRestricted:!0})}},[E(t,{className:"Button-icon"})," ",t.name()])}))))}))}function O(){app.extensionData.for("flarum-tags").registerPermission({icon:"fas fa-tag",label:app.translator.trans("flarum-tags.admin.permissions.tag_discussions_label"),permission:"discussion.tag"},"moderate",95).registerPermission({icon:"fas fa-tags",label:app.translator.trans("flarum-tags.admin.permissions.bypass_tag_counts_label"),permission:"bypassTagCounts"},"start",89)}const I=flarum.core.compat["admin/components/BasicsPage"];var P=n.n(I);function M(){(0,a.extend)(P().prototype,"homePageItems",(function(t){t.add("tags",{path:"/tags",label:app.translator.trans("flarum-tags.admin.basics.tags_label")})}))}const L=flarum.core.compat["admin/components/SettingDropdown"];var k=n.n(L);function A(){(0,a.extend)(s().prototype,"startItems",(function(t){t.add("allowTagChange",{icon:"fas fa-tag",label:r().translator.trans("flarum-tags.admin.permissions.allow_edit_tags_label"),setting:function(){var t=parseInt(r().data.settings.allow_tag_change,10);return m(k(),{defaultLabel:t?r().translator.trans("core.admin.permissions_controls.allow_some_minutes_button",{count:t}):r().translator.trans("core.admin.permissions_controls.allow_indefinitely_button"),key:"allow_tag_change",options:[{value:"-1",label:r().translator.trans("core.admin.permissions_controls.allow_indefinitely_button")},{value:"10",label:r().translator.trans("core.admin.permissions_controls.allow_ten_minutes_button")},{value:"reply",label:r().translator.trans("core.admin.permissions_controls.allow_until_reply_button")}]})}},90)}))}const R=flarum.core.compat["admin/components/AdminPage"];var F=n.n(R);function B(){return B=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0||(r[n]=t[n]);return r}var ot=["className","isToggled"],rt=function(t){function e(){return t.apply(this,arguments)||this}return X(e,t),e.prototype.view=function(t){var e=this.attrs,n=e.className,o=e.isToggled,r=nt(e,ot),a=o?"far fa-check-circle":"far fa-circle";return m(f(),Object.assign({},r,{icon:a,className:T()([n,o&&"Button--toggled"])}),t.children)},e}(H()),at=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),r=0;rt.max.primary)throw new Error("The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.");if(t.min.secondary>t.max.secondary)throw new Error("The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.");if(t.min.total>t.max.primary+t.max.secondary)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.");if(t.max.totalt.max.total)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of tags allowed.")}(e.limits)};var n=e.prototype;return n.oninit=function(e){var n=this;t.prototype.oninit.call(this,e),this.navigator.onUp((function(){return n.setIndex(n.getCurrentNumericIndex()-1,!0)})).onDown((function(){return n.setIndex(n.getCurrentNumericIndex()+1,!0)})).onSelect(this.select.bind(this)).onRemove((function(){return n.selected.splice(n.selected.length-1,1)})),G().tagList.load(["parent"]).then((function(t){n.loading=!1,n.attrs.selectableTags&&(t=n.attrs.selectableTags(t)),n.tags=C(t),n.attrs.selectedTags&&n.attrs.selectedTags.map(n.addTag.bind(n)),n.indexTag=t[0],m.redraw()}))},n.className=function(){return T()("TagSelectionModal",this.attrs.className)},n.title=function(){return this.attrs.title},n.content=function(){var t=this;if(this.loading||!this.tags)return m(g(),null);var e=this.filter().toLowerCase(),n=this.primaryCount(),o=this.secondaryCount(),r=this.getFilteredTags(),a=Math.max(z()(this.getInstruction(n,o)).length,this.filter().length);return[m("div",{className:"Modal-body"},m("div",{className:"TagSelectionModal-form"},m("div",{className:"TagSelectionModal-form-input"},m("div",{className:"TagsInput FormControl "+(this.focused?"focus":""),onclick:function(){return t.$(".TagsInput input").focus()}},m("span",{className:"TagsInput-selected"},this.selected.map((function(e){return m("span",{className:"TagsInput-tag",onclick:function(){t.removeTag(e),t.onready()}},N(e))}))),m("input",{className:"FormControl",placeholder:z()(this.getInstruction(n,o)),bidi:this.filter,style:{width:a+"ch"},onkeydown:this.navigator.navigate.bind(this.navigator),onfocus:function(){return t.focused=!0},onblur:function(){return t.focused=!1}}))),m("div",{className:"TagSelectionModal-form-submit App-primaryControl"},m(f(),{type:"submit",className:"Button Button--primary",disabled:!this.meetsRequirements(n,o),icon:"fas fa-check"},G().translator.trans("flarum-tags.lib.tag_selection_modal.submit_button"))))),m("div",{className:"Modal-footer"},m("ul",{className:"TagSelectionModal-list SelectTagList"},r.map((function(n){return m("li",{"data-index":n.id(),className:T()({pinned:null!==n.position(),child:!!n.parent(),colored:!!n.color(),selected:t.selected.includes(n),active:t.indexTag===n}),style:{color:n.color()},onmouseover:function(){return t.indexTag=n},onclick:t.toggleTag.bind(t,n)},E(n),m("span",{className:"SelectTagListItem-name"},K()(n.name(),e)),n.description()?m("span",{className:"SelectTagListItem-description"},n.description()):"")}))),this.attrs.limits.allowBypassing&&m("div",{className:"TagSelectionModal-controls"},m(rt,{className:"Button",onclick:function(){return t.bypassReqs=!t.bypassReqs},isToggled:this.bypassReqs},G().translator.trans("flarum-tags.lib.tag_selection_modal.bypass_requirements"))))]},n.getFilteredTags=function(){var t=this,e=this.filter().toLowerCase(),n=this.primaryCount(),o=this.secondaryCount(),r=this.tags;return this.attrs.requireParentTag&&(r=r.filter((function(e){var n=e.parent();return null!==n&&(!1===n||t.selected.includes(n))}))),this.bypassReqs||(this.selected.length>=this.attrs.limits.max.total?r=r.filter((function(e){return t.selected.includes(e)})):(n>=this.attrs.limits.max.primary&&(r=r.filter((function(e){return!e.isPrimary()||t.selected.includes(e)}))),o>=this.attrs.limits.max.secondary&&(r=r.filter((function(e){return e.isPrimary()||t.selected.includes(e)}))))),e&&(r=r.filter((function(t){return t.name().toLowerCase().includes(e)}))),this.indexTag&&r.includes(this.indexTag)||(this.indexTag=r[0]),r},n.primaryCount=function(){return this.selected.filter((function(t){return t.isPrimary()})).length},n.secondaryCount=function(){return this.selected.filter((function(t){return!t.isPrimary()})).length},n.meetsRequirements=function(t,e){return!!(this.bypassReqs||this.attrs.allowResetting&&0===this.selected.length)||!(this.selected.length=this.attrs.limits.min.primary&&e>=this.attrs.limits.min.secondary},n.addTag=function(t){if(t&&this.attrs.canSelect(t)){if(this.attrs.onSelect&&this.attrs.onSelect(t,this.selected),this.attrs.requireParentTag){var e=t.parent();e&&!this.selected.includes(e)&&this.selected.push(e)}this.selected.includes(t)||this.selected.push(t)}},n.removeTag=function(t){var e=this.selected.indexOf(t);-1!==e&&(this.selected.splice(e,1),this.attrs.requireParentTag&&this.selected.filter((function(e){return e.parent()===t})).forEach(this.removeTag.bind(this)),this.attrs.onDeselect&&this.attrs.onDeselect(t,this.selected))},n.toggleTag=function(t){this.tags&&(this.selected.includes(t)?this.removeTag(t):this.addTag(t),this.filter()&&(this.filter(""),this.indexTag=this.tags[0]),this.onready())},n.getInstruction=function(t,e){if(this.bypassReqs)return"";if(t li")},n.getCurrentNumericIndex=function(){return this.indexTag?this.selectableItems().index(this.getItem(this.indexTag)):-1},n.getItem=function(t){return this.selectableItems().filter('[data-index="'+t.id()+'"]')},n.setIndex=function(t,e){var n=this.selectableItems(),o=n.parent();t<0?t=n.length-1:t>=n.length&&(t=0);var r=n.eq(t);if(this.indexTag=G().store.getById("tags",r.attr("data-index")),m.redraw(),e&&this.indexTag){var a,i=o.scrollTop(),s=o.offset().top,l=s+o.outerHeight(),c=r.offset().top,u=c+r.outerHeight();cl&&(a=i-l+u+parseInt(o.css("padding-bottom"),10)),void 0!==a&&o.stop(!0).animate({scrollTop:a},100)}},e}(Q()),it=["link"];function st(t,e){void 0===e&&(e={});var n=[],o=e,r=o.link,a=nt(o,it);return a.className=T()("TagsLabel",a.className),t?C(t).forEach((function(e){(e||1===t.length)&&n.push(N(e,{link:r}))})):n.push(N()),m("span",a,n)}var lt=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),r=0;r=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function pt(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var gt=pt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),vt=pt(/Edge/i),bt=pt(/firefox/i),yt=pt(/safari/i)&&!pt(/chrome/i)&&!pt(/android/i),wt=pt(/iP(ad|od|hone)/i),_t=pt(/chrome/i)&&pt(/android/i),Tt={capture:!1,passive:!1};function xt(t,e,n){t.addEventListener(e,n,!gt&&Tt)}function St(t,e,n){t.removeEventListener(e,n,!gt&&Tt)}function Et(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function Nt(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Ct(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Et(t,e):Et(t,e))||o&&t===n)return t;if(t===n)break}while(t=Nt(t))}return null}var Dt,Ot=/\s+/g;function It(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Ot," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Ot," ")}}function Pt(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function Mt(t,e){var n="";if("string"==typeof t)n=t;else do{var o=Pt(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function Lt(t,e,n){if(t){var o=t.getElementsByTagName(e),r=0,a=o.length;if(n)for(;r=a:r<=a))return o;if(o===kt())break;o=Yt(o,!1)}return!1}function Ft(t,e,n,o){for(var r=0,a=0,i=t.children;a2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,r=ft(n,Vt);Kt.pluginEvent.bind(qe)(t,e,ut({dragEl:Qt,parentEl:te,ghostEl:ee,rootEl:ne,nextEl:oe,lastDownEl:re,cloneEl:ae,cloneHidden:ie,dragStarted:ye,putSortable:me,activeSortable:qe.active,originalEvent:o,oldIndex:se,oldDraggableIndex:ce,newIndex:le,newDraggableIndex:ue,hideGhostForTarget:je,unhideGhostForTarget:Xe,cloneNowHidden:function(){ie=!0},cloneNowShown:function(){ie=!1},dispatchSortableEvent:function(t){Zt({sortable:e,name:t,originalEvent:o})}},r))};function Zt(t){!function(t){var e=t.sortable,n=t.rootEl,o=t.name,r=t.targetEl,a=t.cloneEl,i=t.toEl,s=t.fromEl,l=t.oldIndex,c=t.newIndex,u=t.oldDraggableIndex,d=t.newDraggableIndex,m=t.originalEvent,h=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[zt]){var p,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||gt||vt?(p=document.createEvent("Event")).initEvent(o,!0,!0):p=new CustomEvent(o,{bubbles:!0,cancelable:!0}),p.to=i||n,p.from=s||n,p.item=r||n,p.clone=a,p.oldIndex=l,p.newIndex=c,p.oldDraggableIndex=u,p.newDraggableIndex=d,p.originalEvent=m,p.pullMode=h?h.lastPutMode:void 0;var b=ut(ut({},f),Kt.getEventProperties(o,e));for(var y in b)p[y]=b[y];n&&n.dispatchEvent(p),g[v]&&g[v].call(e,p)}}(ut({putSortable:me,cloneEl:ae,targetEl:Qt,rootEl:ne,oldIndex:se,oldDraggableIndex:ce,newIndex:le,newDraggableIndex:ue},t))}var Qt,te,ee,ne,oe,re,ae,ie,se,le,ce,ue,de,me,he,fe,pe,ge,ve,be,ye,we,_e,Te,xe,Se=!1,Ee=!1,Ne=[],Ce=!1,De=!1,Oe=[],Ie=!1,Pe=[],Me="undefined"!=typeof document,Le=wt,ke=vt||gt?"cssFloat":"float",Ae=Me&&!_t&&!wt&&"draggable"in document.createElement("div"),Re=function(){if(Me){if(gt)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Fe=function(t,e){var n=Pt(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=Ft(t,0,e),a=Ft(t,1,e),i=r&&Pt(r),s=a&&Pt(a),l=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+At(r).width,c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+At(a).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&i.float&&"none"!==i.float){var u="left"===i.float?"left":"right";return!a||"both"!==s.clear&&s.clear!==u?"horizontal":"vertical"}return r&&("block"===i.display||"flex"===i.display||"table"===i.display||"grid"===i.display||l>=o&&"none"===n[ke]||a&&"none"===n[ke]&&l+c>o)?"vertical":"horizontal"},Be=function(t){function e(t,n){return function(o,r,a,i){var s=o.options.group.name&&r.options.group.name&&o.options.group.name===r.options.group.name;if(null==t&&(n||s))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"==typeof t)return e(t(o,r,a,i),n)(o,r,a,i);var l=(n?o:r).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var n={},o=t.group;o&&"object"==dt(o)||(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n},je=function(){!Re&&ee&&Pt(ee,"display","none")},Xe=function(){!Re&&ee&&Pt(ee,"display","")};Me&&!_t&&document.addEventListener("click",(function(t){if(Ee)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Ee=!1,!1}),!0);var Ye=function(t){if(Qt){t=t.touches?t.touches[0]:t;var e=(r=t.clientX,a=t.clientY,Ne.some((function(t){var e=t[zt].options.emptyInsertThreshold;if(e&&!Bt(t)){var n=At(t),o=r>=n.left-e&&r<=n.right+e,s=a>=n.top-e&&a<=n.bottom+e;return o&&s?i=t:void 0}})),i);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[zt]._onDragOver(n)}}var r,a,i},He=function(t){Qt&&Qt.parentNode[zt]._isOutsideThisEl(t.target)};function qe(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=ht({},e),t[zt]=this;var n,o,r={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Fe(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==qe.supportPointer&&"PointerEvent"in window&&!yt,emptyInsertThreshold:5};for(var a in Kt.initializePlugins(this,t,r),r)!(a in e)&&(e[a]=r[a]);for(var i in Be(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Ae,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?xt(t,"pointerdown",this._onTapStart):(xt(t,"mousedown",this._onTapStart),xt(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(xt(t,"dragover",this),xt(t,"dragenter",this)),Ne.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ht(this,(o=[],{captureAnimationState:function(){o=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(t){if("none"!==Pt(t,"display")&&t!==qe.ghost){o.push({target:t,rect:At(t)});var e=ut({},o[o.length-1].rect);if(t.thisAnimationDuration){var n=Mt(t,!0);n&&(e.top-=n.f,e.left-=n.e)}t.fromRect=e}}))},addAnimationState:function(t){o.push(t)},removeAnimationState:function(t){o.splice(function(t,e){for(var n in t)if(t.hasOwnProperty(n))for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n);return-1}(o,{target:t}),1)},animateAll:function(t){var e=this;if(!this.options.animation)return clearTimeout(n),void("function"==typeof t&&t());var r=!1,a=0;o.forEach((function(t){var n=0,o=t.target,i=o.fromRect,s=At(o),l=o.prevFromRect,c=o.prevToRect,u=t.rect,d=Mt(o,!0);d&&(s.top-=d.f,s.left-=d.e),o.toRect=s,o.thisAnimationDuration&&Ht(l,s)&&!Ht(i,s)&&(u.top-s.top)/(u.left-s.left)==(i.top-s.top)/(i.left-s.left)&&(n=function(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}(u,l,c,e.options)),Ht(s,i)||(o.prevFromRect=i,o.prevToRect=s,n||(n=e.options.animation),e.animate(o,u,s,n)),n&&(r=!0,a=Math.max(a,n),clearTimeout(o.animationResetTimer),o.animationResetTimer=setTimeout((function(){o.animationTime=0,o.prevFromRect=null,o.fromRect=null,o.prevToRect=null,o.thisAnimationDuration=null}),n),o.thisAnimationDuration=n)})),clearTimeout(n),r?n=setTimeout((function(){"function"==typeof t&&t()}),a):"function"==typeof t&&t(),o=[]},animate:function(t,e,n,o){if(o){Pt(t,"transition",""),Pt(t,"transform","");var r=Mt(this.el),a=r&&r.a,i=r&&r.d,s=(e.left-n.left)/(a||1),l=(e.top-n.top)/(i||1);t.animatingX=!!s,t.animatingY=!!l,Pt(t,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),Pt(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),Pt(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){Pt(t,"transition",""),Pt(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}))}function Ge(t,e,n,o,r,a,i,s){var l,c,u=t[zt],d=u.options.onMove;return!window.CustomEvent||gt||vt?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=n,l.draggedRect=o,l.related=r||e,l.relatedRect=a||At(e),l.willInsertAfter=s,l.originalEvent=i,t.dispatchEvent(l),d&&(c=d.call(u,l,i)),c}function We(t){t.draggable=!1}function ze(){Ie=!1}function Ue(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function $e(t){return setTimeout(t,0)}function Ke(t){return clearTimeout(t)}qe.prototype={constructor:qe,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(we=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Qt):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,r=o.preventOnFilter,a=t.type,i=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,s=(i||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,c=o.filter;if(function(t){Pe.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var o=e[n];o.checked&&Pe.push(o)}}(n),!Qt&&!(/mousedown|pointerdown/.test(a)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!yt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Ct(s,o.draggable,n,!1))&&s.animated||re===s)){if(se=jt(s),ce=jt(s,o.draggable),"function"==typeof c){if(c.call(this,t,s,this))return Zt({sortable:e,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Jt("filter",e,{evt:t}),void(r&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=Ct(l,o.trim(),n,!1))return Zt({sortable:e,rootEl:o,name:"filter",targetEl:s,fromEl:n,toEl:n}),Jt("filter",e,{evt:t}),!0}))))return void(r&&t.cancelable&&t.preventDefault());o.handle&&!Ct(l,o.handle,n,!1)||this._prepareDragStart(t,i,s)}}},_prepareDragStart:function(t,e,n){var o,r=this,a=r.el,i=r.options,s=a.ownerDocument;if(n&&!Qt&&n.parentNode===a){var l=At(n);if(ne=a,te=(Qt=n).parentNode,oe=Qt.nextSibling,re=n,de=i.group,qe.dragged=Qt,he={target:Qt,clientX:(e||t).clientX,clientY:(e||t).clientY},ve=he.clientX-l.left,be=he.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Qt.style["will-change"]="all",o=function(){Jt("delayEnded",r,{evt:t}),qe.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!bt&&r.nativeDraggable&&(Qt.draggable=!0),r._triggerDragStart(t,e),Zt({sortable:r,name:"choose",originalEvent:t}),It(Qt,i.chosenClass,!0))},i.ignore.split(",").forEach((function(t){Lt(Qt,t.trim(),We)})),xt(s,"dragover",Ye),xt(s,"mousemove",Ye),xt(s,"touchmove",Ye),xt(s,"mouseup",r._onDrop),xt(s,"touchend",r._onDrop),xt(s,"touchcancel",r._onDrop),bt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Qt.draggable=!0),Jt("delayStart",this,{evt:t}),!i.delay||i.delayOnTouchOnly&&!e||this.nativeDraggable&&(vt||gt))o();else{if(qe.eventCanceled)return void this._onDrop();xt(s,"mouseup",r._disableDelayedDrag),xt(s,"touchend",r._disableDelayedDrag),xt(s,"touchcancel",r._disableDelayedDrag),xt(s,"mousemove",r._delayedDragTouchMoveHandler),xt(s,"touchmove",r._delayedDragTouchMoveHandler),i.supportPointer&&xt(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(o,i.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Qt&&We(Qt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;St(t,"mouseup",this._disableDelayedDrag),St(t,"touchend",this._disableDelayedDrag),St(t,"touchcancel",this._disableDelayedDrag),St(t,"mousemove",this._delayedDragTouchMoveHandler),St(t,"touchmove",this._delayedDragTouchMoveHandler),St(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?xt(document,"pointermove",this._onTouchMove):xt(document,e?"touchmove":"mousemove",this._onTouchMove):(xt(Qt,"dragend",this),xt(ne,"dragstart",this._onDragStart));try{document.selection?$e((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(Se=!1,ne&&Qt){Jt("dragStarted",this,{evt:e}),this.nativeDraggable&&xt(document,"dragover",He);var n=this.options;!t&&It(Qt,n.dragClass,!1),It(Qt,n.ghostClass,!0),qe.active=this,t&&this._appendGhost(),Zt({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(fe){this._lastX=fe.clientX,this._lastY=fe.clientY,je();for(var t=document.elementFromPoint(fe.clientX,fe.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(fe.clientX,fe.clientY))!==e;)e=t;if(Qt.parentNode[zt]._isOutsideThisEl(t),e)do{if(e[zt]&&e[zt]._onDragOver({clientX:fe.clientX,clientY:fe.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break;t=e}while(e=e.parentNode);Xe()}},_onTouchMove:function(t){if(he){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,r=t.touches?t.touches[0]:t,a=ee&&Mt(ee,!0),i=ee&&a&&a.a,s=ee&&a&&a.d,l=Le&&xe&&Xt(xe),c=(r.clientX-he.clientX+o.x)/(i||1)+(l?l[0]-Oe[0]:0)/(i||1),u=(r.clientY-he.clientY+o.y)/(s||1)+(l?l[1]-Oe[1]:0)/(s||1);if(!qe.active&&!Se){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))o.right+10||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+10}(t,r,this)&&!p.animated){if(p===Qt)return P(!1);if(p&&a===t.target&&(i=p),i&&(n=At(i)),!1!==Ge(ne,a,Qt,e,i,n,t,!!i))return I(),p&&p.nextSibling?a.insertBefore(Qt,p.nextSibling):a.appendChild(Qt),te=a,M(),P(!0)}else if(p&&function(t,e,n){var o=At(Ft(n.el,0,n.options,!0));return e?t.clientXu+c*a/2:ld-Te)return-_e}else if(l>u+c*(1-r)/2&&ld-c*a/2)?l>u+c/2?1:-1:0}(t,i,n,r,_?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,De,we===i),0!==v){var E=jt(Qt);do{E-=v,y=te.children[E]}while(y&&("none"===Pt(y,"display")||y===ee))}if(0===v||y===i)return P(!1);we=i,_e=v;var N=i.nextElementSibling,C=!1,D=Ge(ne,a,Qt,e,i,n,t,C=1===v);if(!1!==D)return 1!==D&&-1!==D||(C=1===D),Ie=!0,setTimeout(ze,30),I(),C&&!N?a.appendChild(Qt):i.parentNode.insertBefore(Qt,C?N:i),x&&Gt(x,0,S-x.scrollTop),te=Qt.parentNode,void 0===b||De||(Te=Math.abs(b-At(i)[T])),M(),P(!0)}if(a.contains(Qt))return P(!1)}return!1}function O(s,l){Jt(s,h,ut({evt:t,isOwner:u,axis:r?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:d,fromSortable:m,target:i,completed:P,onMove:function(n,o){return Ge(ne,a,Qt,e,n,At(n),t,o)},changed:M},l))}function I(){O("dragOverAnimationCapture"),h.captureAnimationState(),h!==m&&m.captureAnimationState()}function P(e){return O("dragOverCompleted",{insertion:e}),e&&(u?c._hideClone():c._showClone(h),h!==m&&(It(Qt,me?me.options.ghostClass:c.options.ghostClass,!1),It(Qt,s.ghostClass,!0)),me!==h&&h!==qe.active?me=h:h===qe.active&&me&&(me=null),m===h&&(h._ignoreWhileAnimating=i),h.animateAll((function(){O("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(i===Qt&&!Qt.animated||i===a&&!i.animated)&&(we=null),s.dragoverBubble||t.rootEl||i===document||(Qt.parentNode[zt]._isOutsideThisEl(t.target),!e&&Ye(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function M(){le=jt(Qt),ue=jt(Qt,s.draggable),Zt({sortable:h,name:"change",toEl:a,newIndex:le,newDraggableIndex:ue,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){St(document,"mousemove",this._onTouchMove),St(document,"touchmove",this._onTouchMove),St(document,"pointermove",this._onTouchMove),St(document,"dragover",Ye),St(document,"mousemove",Ye),St(document,"touchmove",Ye)},_offUpEvents:function(){var t=this.el.ownerDocument;St(t,"mouseup",this._onDrop),St(t,"touchend",this._onDrop),St(t,"pointerup",this._onDrop),St(t,"touchcancel",this._onDrop),St(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;le=jt(Qt),ue=jt(Qt,n.draggable),Jt("drop",this,{evt:t}),te=Qt&&Qt.parentNode,le=jt(Qt),ue=jt(Qt,n.draggable),qe.eventCanceled||(Se=!1,De=!1,Ce=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ke(this.cloneId),Ke(this._dragStartId),this.nativeDraggable&&(St(document,"drop",this),St(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),yt&&Pt(document.body,"user-select",""),Pt(Qt,"transform",""),t&&(ye&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),ee&&ee.parentNode&&ee.parentNode.removeChild(ee),(ne===te||me&&"clone"!==me.lastPutMode)&&ae&&ae.parentNode&&ae.parentNode.removeChild(ae),Qt&&(this.nativeDraggable&&St(Qt,"dragend",this),We(Qt),Qt.style["will-change"]="",ye&&!Se&&It(Qt,me?me.options.ghostClass:this.options.ghostClass,!1),It(Qt,this.options.chosenClass,!1),Zt({sortable:this,name:"unchoose",toEl:te,newIndex:null,newDraggableIndex:null,originalEvent:t}),ne!==te?(le>=0&&(Zt({rootEl:te,name:"add",toEl:te,fromEl:ne,originalEvent:t}),Zt({sortable:this,name:"remove",toEl:te,originalEvent:t}),Zt({rootEl:te,name:"sort",toEl:te,fromEl:ne,originalEvent:t}),Zt({sortable:this,name:"sort",toEl:te,originalEvent:t})),me&&me.save()):le!==se&&le>=0&&(Zt({sortable:this,name:"update",toEl:te,originalEvent:t}),Zt({sortable:this,name:"sort",toEl:te,originalEvent:t})),qe.active&&(null!=le&&-1!==le||(le=se,ue=ce),Zt({sortable:this,name:"end",toEl:te,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){Jt("nulling",this),ne=Qt=te=ee=oe=ae=re=ie=he=fe=ye=le=ue=se=ce=we=_e=me=de=qe.dragged=qe.ghost=qe.clone=qe.active=null,Pe.forEach((function(t){t.checked=!0})),Pe.length=pe=ge=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Qt&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,r=n.length,a=this.options;o li").map((function(){return{id:$(this).data("id"),children:$(this).find("li").map((function(){return $(this).data("id")})).get()}})).get();e.forEach((function(t,e){var n=r().store.getById("tags",t.id);n.pushData({attributes:{position:e,isChild:!1},relationships:{parent:null}}),t.children.forEach((function(t,e){r().store.getById("tags",t).pushData({attributes:{position:e,isChild:!0},relationships:{parent:n}})}))})),r().request({url:r().forum.attribute("apiUrl")+"/tags/order",method:"POST",body:{order:e}}),this.forcedRefreshKey++,m.redraw()},e}(hn());function Sn(t,e,n,o,r,a,i){try{var s=t[a](i),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(o,r)}function En(t){return function(){var e=this,n=arguments;return new Promise((function(o,r){var a=t.apply(e,n);function i(t){Sn(a,o,r,i,s,"next",t)}function s(t){Sn(a,o,r,i,s,"throw",t)}i(void 0)}))}}var Nn=n(507),Cn=n.n(Nn),Dn=function(){function t(){this.loadedIncludes=void 0}var e=t.prototype;return e.load=function(){var t=En(Cn().mark((function t(e){var n,o=this;return Cn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===e&&(e=[]),this.loadedIncludes){t.next=3;break}return t.abrupt("return",this.query(e));case 3:if(0!==(n=e.filter((function(t){return!o.loadedIncludes.has(t)}))).length){t.next=6;break}return t.abrupt("return",Promise.resolve(G().store.all("tags")));case 6:return t.abrupt("return",this.query(n));case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.query=function(){var t=En(Cn().mark((function t(e){var n=this;return Cn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=[]),null!=this.loadedIncludes||(this.loadedIncludes=new Set),t.abrupt("return",G().store.find("tags",{include:e.join(",")}).then((function(t){return e.forEach((function(t){return n.loadedIncludes.add(t)})),t})));case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}();const On=flarum.core.compat["common/extenders"];var In=n.n(On);const Pn=flarum.core.compat["common/utils/computed"];var Mn=n.n(Pn);const Ln=flarum.core.compat["common/Model"];var kn=n.n(Ln),An=function(t){function e(){return t.apply(this,arguments)||this}X(e,t);var n=e.prototype;return n.name=function(){return kn().attribute("name").call(this)},n.slug=function(){return kn().attribute("slug").call(this)},n.description=function(){return kn().attribute("description").call(this)},n.color=function(){return kn().attribute("color").call(this)},n.backgroundUrl=function(){return kn().attribute("backgroundUrl").call(this)},n.backgroundMode=function(){return kn().attribute("backgroundMode").call(this)},n.icon=function(){return kn().attribute("icon").call(this)},n.position=function(){return kn().attribute("position").call(this)},n.parent=function(){return kn().hasOne("parent").call(this)},n.children=function(){return kn().hasMany("children").call(this)},n.defaultSort=function(){return kn().attribute("defaultSort").call(this)},n.isChild=function(){return kn().attribute("isChild").call(this)},n.isHidden=function(){return kn().attribute("isHidden").call(this)},n.discussionCount=function(){return kn().attribute("discussionCount").call(this)},n.lastPostedAt=function(){return kn().attribute("lastPostedAt",kn().transformDate).call(this)},n.lastPostedDiscussion=function(){return kn().hasOne("lastPostedDiscussion").call(this)},n.isRestricted=function(){return kn().attribute("isRestricted").call(this)},n.canStartDiscussion=function(){return kn().attribute("canStartDiscussion").call(this)},n.canAddToDiscussion=function(){return kn().attribute("canAddToDiscussion").call(this)},n.isPrimary=function(){return Mn()("position","parent",(function(t,e){return null!==t&&!1===e})).call(this)},e}(kn());const Rn=[(new(In().Store)).add("tags",An)],Fn={"tags/utils/sortTags":C,"tags/models/Tag":An,"tags/helpers/tagsLabel":st,"tags/helpers/tagIcon":E,"tags/helpers/tagLabel":N,"tags/components/TagSelectionModal":at,"tags/states/TagListState":Dn},Bn=Object.assign(Fn,{"tags/addTagsHomePageOption":M,"tags/addTagChangePermission":A,"tags/components/TagsPage":xn,"tags/components/EditTagModal":_n,"tags/addTagPermission":O,"tags/addTagsPermissionScope":D}),jn=flarum.core;r().initializers.add("flarum-tags",(function(t){t.tagList=new Dn,t.extensionData.for("flarum-tags").registerPage(xn),D(),O(),M(),A(),(0,a.extend)(F().prototype,"customSettingComponents",(function(t){var e=this;t.add("flarum-tags.select-tags",(function(t){return m(lt,Object.assign({},t,{settingValue:e.settings[t.setting]}))}))}))})),Object.assign(jn.compat,Bn)},810:()=>{},440:(t,e,n)=>{var o=n(75).default;function r(){"use strict";t.exports=r=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},n=Object.prototype,a=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(t){d=function(t,e,n){return t[e]=n}}function m(t,e,n,o){var r=e&&e.prototype instanceof p?e:p,a=Object.create(r.prototype),s=new D(o||[]);return i(a,"_invoke",{value:S(t,n,s)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=m;var f={};function p(){}function g(){}function v(){}var b={};d(b,l,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(O([])));w&&w!==n&&a.call(w,l)&&(b=w);var _=v.prototype=p.prototype=Object.create(b);function T(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(r,i,s,l){var c=h(t[r],t,i);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==o(d)&&a.call(d,"__await")?e.resolve(d.__await).then((function(t){n("next",t,s,l)}),(function(t){n("throw",t,s,l)})):e.resolve(d).then((function(t){u.value=t,s(u)}),(function(t){return n("throw",t,s,l)}))}l(c.arg)}var r;i(this,"_invoke",{value:function(t,o){function a(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(a,a):a()}})}function S(t,e,n){var o="suspendedStart";return function(r,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===r)throw a;return{value:void 0,done:!0}}for(n.method=r,n.arg=a;;){var i=n.delegate;if(i){var s=E(i,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var l=h(t,e,n);if("normal"===l.type){if(o=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o="completed",n.method="throw",n.arg=l.arg)}}}function E(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var r=o.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function O(t){if(t){var e=t[l];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var r=this.tryEntries[o],i=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var s=a.call(r,"catchLoc"),l=a.call(r,"finallyLoc");if(s&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var o=n.completion;if("throw"===o.type){var r=o.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:O(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},75:t=>{function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},507:(t,e,n)=>{var o=n(440)();t.exports=o;try{regeneratorRuntime=o}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var a=e[o]={exports:{}};return t[o](a,a.exports,n),a.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};(()=>{"use strict";n.r(o),n.d(o,{extend:()=>r.l});var t=n(810),e={};for(const n in t)"default"!==n&&(e[n]=()=>t[n]);n.d(o,e);var r=n(946)})(),module.exports=o})(); +(()=>{var t={946:(t,e,n)=>{"use strict";n.d(e,{l:()=>Rn});const o=flarum.core.compat["admin/app"];var r=n.n(o);const a=flarum.core.compat["common/extend"],i=flarum.core.compat["admin/components/PermissionGrid"];var s=n.n(i);const l=flarum.core.compat["admin/components/PermissionDropdown"];var c=n.n(l);const u=flarum.core.compat["common/components/Dropdown"];var d=n.n(u);const h=flarum.core.compat["common/components/Button"];var f=n.n(h);const p=flarum.core.compat["common/components/LoadingIndicator"];var g=n.n(p);const v=flarum.core.compat["common/utils/extract"];var b=n.n(v);const y=flarum.core.compat["common/components/Link"];var w=n.n(y);const _=flarum.core.compat["common/utils/classList"];var T=n.n(_);const x=flarum.core.compat["common/helpers/textContrastClass"];var S=n.n(x);function E(t,e,n){void 0===e&&(e={}),void 0===n&&(n={});var o=t&&t.icon(),r=n.useColor,a=void 0===r||r;return e.className=T()([e.className,"icon",o?t.icon():"TagIcon"]),t&&a?(e.style=e.style||{},e.style["--color"]=t.color(),o&&(e.style.color=t.color())):t||(e.className+=" untagged"),o?m("i",e):m("span",e)}function N(t,e){void 0===e&&(e={}),e.style=e.style||{},e.className="TagLabel "+(e.className||"");var n=b()(e,"link"),o=t?t.name():app.translator.trans("flarum-tags.lib.deleted_tag_text");if(t){var r=t.color();r&&(e.style["--tag-bg"]=r,e.className=T()(e.className,"colored",S()(r))),n&&(e.title=t.description()||"",e.href=app.route("tag",{tags:t.slug()})),t.isChild()&&(e.className+=" TagLabel--child")}else e.className+=" untagged";return m(n?w():"span",e,m("span",{className:"TagLabel-text"},t&&t.icon()&&E(t,{className:"TagLabel-icon"},{useColor:!1}),m("span",{className:"TagLabel-name"},o)))}function C(t){return t.slice(0).sort((function(t,e){var n=t.position(),o=e.position();if(null===n&&null===o)return e.discussionCount()-t.discussionCount();if(null===o)return-1;if(null===n)return 1;var r=t.parent(),a=e.parent();return r===a?n-o:r&&a?r.position()-a.position():r?r===e?1:r.position()-o:a?a===t?-1:n-a.position():0}))}function D(){(0,a.extend)(s().prototype,"oninit",(function(){this.loading=!0})),(0,a.extend)(s().prototype,"oncreate",(function(){var t=this;r().tagList.load().then((function(){t.loading=!1,m.redraw()}))})),(0,a.override)(s().prototype,"view",(function(t,e){return this.loading?m(g(),null):t(e)})),(0,a.override)(r(),"getRequiredPermissions",(function(t,e){var n=e.match(/^tag\d+\./);return n?t(e.substr(n[0].length)).map((function(t){return n[0]+t})):t(e)})),(0,a.extend)(s().prototype,"scopeItems",(function(t){C(r().store.all("tags")).filter((function(t){return t.isRestricted()})).forEach((function(e){return t.add("tag"+e.id(),{label:N(e),onremove:function(){return e.save({isRestricted:!1})},render:function(t){return"setting"in t?null:"viewForum"===t.permission||"startDiscussion"===t.permission||t.permission.startsWith("discussion.")&&!1!==t.tagScoped||t.tagScoped?m(c(),{permission:"tag"+e.id()+"."+t.permission,allowGuest:t.allowGuest}):null}})}))})),(0,a.extend)(s().prototype,"scopeControlItems",(function(t){var e=C(r().store.all("tags").filter((function(t){return!t.isRestricted()})));e.length&&t.add("tag",m(d(),{className:"Dropdown--restrictByTag",buttonClassName:"Button Button--text",label:r().translator.trans("flarum-tags.admin.permissions.restrict_by_tag_heading"),icon:"fas fa-plus",caretIcon:null},e.map((function(t){return m(f(),{icon:!0,onclick:function(){return t.save({isRestricted:!0})}},[E(t,{className:"Button-icon"})," ",t.name()])}))))}))}function O(){app.extensionData.for("flarum-tags").registerPermission({icon:"fas fa-tag",label:app.translator.trans("flarum-tags.admin.permissions.tag_discussions_label"),permission:"discussion.tag"},"moderate",95).registerPermission({icon:"fas fa-tags",label:app.translator.trans("flarum-tags.admin.permissions.bypass_tag_counts_label"),permission:"bypassTagCounts"},"start",89)}const I=flarum.core.compat["admin/components/BasicsPage"];var P=n.n(I);function M(){(0,a.extend)(P().prototype,"homePageItems",(function(t){t.add("tags",{path:"/tags",label:app.translator.trans("flarum-tags.admin.basics.tags_label")})}))}const L=flarum.core.compat["admin/components/SettingDropdown"];var k=n.n(L);function A(){(0,a.extend)(s().prototype,"startItems",(function(t){t.add("allowTagChange",{icon:"fas fa-tag",label:r().translator.trans("flarum-tags.admin.permissions.allow_edit_tags_label"),setting:function(){var t=parseInt(r().data.settings.allow_tag_change,10);return m(k(),{defaultLabel:t?r().translator.trans("core.admin.permissions_controls.allow_some_minutes_button",{count:t}):r().translator.trans("core.admin.permissions_controls.allow_indefinitely_button"),key:"allow_tag_change",options:[{value:"-1",label:r().translator.trans("core.admin.permissions_controls.allow_indefinitely_button")},{value:"10",label:r().translator.trans("core.admin.permissions_controls.allow_ten_minutes_button")},{value:"reply",label:r().translator.trans("core.admin.permissions_controls.allow_until_reply_button")}]})}},90)}))}const R=flarum.core.compat["admin/components/AdminPage"];var F=n.n(R);function B(){return B=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0||(r[n]=t[n]);return r}var ot=["className","isToggled"],rt=function(t){function e(){return t.apply(this,arguments)||this}return X(e,t),e.prototype.view=function(t){var e=this.attrs,n=e.className,o=e.isToggled,r=nt(e,ot),a=o?"far fa-check-circle":"far fa-circle";return m(f(),Object.assign({},r,{icon:a,className:T()([n,o&&"Button--toggled"])}),t.children)},e}(H()),at=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),r=0;rt.max.primary)throw new Error("The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.");if(t.min.secondary>t.max.secondary)throw new Error("The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.");if(t.min.total>t.max.primary+t.max.secondary)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.");if(t.max.totalt.max.total)throw new Error("The minimum number of tags allowed cannot be more than the maximum number of tags allowed.")}(e.limits)};var n=e.prototype;return n.oninit=function(e){var n=this;t.prototype.oninit.call(this,e),this.navigator.onUp((function(){return n.setIndex(n.getCurrentNumericIndex()-1,!0)})).onDown((function(){return n.setIndex(n.getCurrentNumericIndex()+1,!0)})).onSelect(this.select.bind(this)).onRemove((function(){return n.selected.splice(n.selected.length-1,1)})),G().tagList.load(["parent"]).then((function(t){n.loading=!1,n.attrs.selectableTags&&(t=n.attrs.selectableTags(t)),n.tags=C(t),n.attrs.selectedTags&&n.attrs.selectedTags.map(n.addTag.bind(n)),n.indexTag=t[0],m.redraw()}))},n.className=function(){return T()("TagSelectionModal",this.attrs.className)},n.title=function(){return this.attrs.title},n.content=function(){var t=this;if(this.loading||!this.tags)return m(g(),null);var e=this.filter().toLowerCase(),n=this.primaryCount(),o=this.secondaryCount(),r=this.getFilteredTags(),a=Math.max(z()(this.getInstruction(n,o)).length,this.filter().length);return[m("div",{className:"Modal-body"},m("div",{className:"TagSelectionModal-form"},m("div",{className:"TagSelectionModal-form-input"},m("div",{className:"TagsInput FormControl "+(this.focused?"focus":""),onclick:function(){return t.$(".TagsInput input").focus()}},m("span",{className:"TagsInput-selected"},this.selected.map((function(e){return m("span",{className:"TagsInput-tag",onclick:function(){t.removeTag(e),t.onready()}},N(e))}))),m("input",{className:"FormControl",placeholder:z()(this.getInstruction(n,o)),bidi:this.filter,style:{width:a+"ch"},onkeydown:this.navigator.navigate.bind(this.navigator),onfocus:function(){return t.focused=!0},onblur:function(){return t.focused=!1}}))),m("div",{className:"TagSelectionModal-form-submit App-primaryControl"},m(f(),{type:"submit",className:"Button Button--primary",disabled:!this.meetsRequirements(n,o),icon:"fas fa-check"},G().translator.trans("flarum-tags.lib.tag_selection_modal.submit_button"))))),m("div",{className:"Modal-footer"},m("ul",{className:"TagSelectionModal-list SelectTagList"},r.map((function(n){return m("li",{"data-index":n.id(),className:T()({pinned:null!==n.position(),child:!!n.parent(),colored:!!n.color(),selected:t.selected.includes(n),active:t.indexTag===n}),style:{color:n.color()},onmouseover:function(){return t.indexTag=n},onclick:t.toggleTag.bind(t,n)},E(n),m("span",{className:"SelectTagListItem-name"},K()(n.name(),e)),n.description()?m("span",{className:"SelectTagListItem-description"},n.description()):"")}))),this.attrs.limits.allowBypassing&&m("div",{className:"TagSelectionModal-controls"},m(rt,{className:"Button",onclick:function(){return t.bypassReqs=!t.bypassReqs},isToggled:this.bypassReqs},G().translator.trans("flarum-tags.lib.tag_selection_modal.bypass_requirements"))))]},n.getFilteredTags=function(){var t=this,e=this.filter().toLowerCase(),n=this.primaryCount(),o=this.secondaryCount(),r=this.tags;return this.attrs.requireParentTag&&(r=r.filter((function(e){var n=e.parent();return null!==n&&(!1===n||t.selected.includes(n))}))),this.bypassReqs||(this.selected.length>=this.attrs.limits.max.total?r=r.filter((function(e){return t.selected.includes(e)})):(n>=this.attrs.limits.max.primary&&(r=r.filter((function(e){return!e.isPrimary()||t.selected.includes(e)}))),o>=this.attrs.limits.max.secondary&&(r=r.filter((function(e){return e.isPrimary()||t.selected.includes(e)}))))),e&&(r=r.filter((function(t){return t.name().toLowerCase().includes(e)}))),this.indexTag&&r.includes(this.indexTag)||(this.indexTag=r[0]),r},n.primaryCount=function(){return this.selected.filter((function(t){return t.isPrimary()})).length},n.secondaryCount=function(){return this.selected.filter((function(t){return!t.isPrimary()})).length},n.meetsRequirements=function(t,e){return!!(this.bypassReqs||this.attrs.allowResetting&&0===this.selected.length)||!(this.selected.length=this.attrs.limits.min.primary&&e>=this.attrs.limits.min.secondary},n.addTag=function(t){if(t&&this.attrs.canSelect(t)){if(this.attrs.onSelect&&this.attrs.onSelect(t,this.selected),this.attrs.requireParentTag){var e=t.parent();e&&!this.selected.includes(e)&&this.selected.push(e)}this.selected.includes(t)||this.selected.push(t)}},n.removeTag=function(t){var e=this.selected.indexOf(t);-1!==e&&(this.selected.splice(e,1),this.attrs.requireParentTag&&this.selected.filter((function(e){return e.parent()===t})).forEach(this.removeTag.bind(this)),this.attrs.onDeselect&&this.attrs.onDeselect(t,this.selected))},n.toggleTag=function(t){this.tags&&(this.selected.includes(t)?this.removeTag(t):this.addTag(t),this.filter()&&(this.filter(""),this.indexTag=this.tags[0]),this.onready())},n.getInstruction=function(t,e){if(this.bypassReqs)return"";if(t li")},n.getCurrentNumericIndex=function(){return this.indexTag?this.selectableItems().index(this.getItem(this.indexTag)):-1},n.getItem=function(t){return this.selectableItems().filter('[data-index="'+t.id()+'"]')},n.setIndex=function(t,e){var n=this.selectableItems(),o=n.parent();t<0?t=n.length-1:t>=n.length&&(t=0);var r=n.eq(t);if(this.indexTag=G().store.getById("tags",r.attr("data-index")),m.redraw(),e&&this.indexTag){var a,i=o.scrollTop(),s=o.offset().top,l=s+o.outerHeight(),c=r.offset().top,u=c+r.outerHeight();cl&&(a=i-l+u+parseInt(o.css("padding-bottom"),10)),void 0!==a&&o.stop(!0).animate({scrollTop:a},100)}},e}(Q()),it=["link"];function st(t,e){void 0===e&&(e={});var n=[],o=e,r=o.link,a=nt(o,it);return a.className=T()("TagsLabel",a.className),t?C(t).forEach((function(e){(e||1===t.length)&&n.push(N(e,{link:r}))})):n.push(N()),m("span",a,n)}var lt=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),r=0;r=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function pt(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var gt=pt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),vt=pt(/Edge/i),bt=pt(/firefox/i),yt=pt(/safari/i)&&!pt(/chrome/i)&&!pt(/android/i),wt=pt(/iP(ad|od|hone)/i),_t=pt(/chrome/i)&&pt(/android/i),Tt={capture:!1,passive:!1};function xt(t,e,n){t.addEventListener(e,n,!gt&&Tt)}function St(t,e,n){t.removeEventListener(e,n,!gt&&Tt)}function Et(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function Nt(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Ct(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&Et(t,e):Et(t,e))||o&&t===n)return t;if(t===n)break}while(t=Nt(t))}return null}var Dt,Ot=/\s+/g;function It(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Ot," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Ot," ")}}function Pt(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function Mt(t,e){var n="";if("string"==typeof t)n=t;else do{var o=Pt(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function Lt(t,e,n){if(t){var o=t.getElementsByTagName(e),r=0,a=o.length;if(n)for(;r=a:r<=a))return o;if(o===kt())break;o=Yt(o,!1)}return!1}function Ft(t,e,n,o){for(var r=0,a=0,i=t.children;a2&&void 0!==arguments[2]?arguments[2]:{},o=n.evt,r=ft(n,Vt);Kt.pluginEvent.bind(qe)(t,e,ut({dragEl:Qt,parentEl:te,ghostEl:ee,rootEl:ne,nextEl:oe,lastDownEl:re,cloneEl:ae,cloneHidden:ie,dragStarted:ye,putSortable:me,activeSortable:qe.active,originalEvent:o,oldIndex:se,oldDraggableIndex:ce,newIndex:le,newDraggableIndex:ue,hideGhostForTarget:je,unhideGhostForTarget:Xe,cloneNowHidden:function(){ie=!0},cloneNowShown:function(){ie=!1},dispatchSortableEvent:function(t){Zt({sortable:e,name:t,originalEvent:o})}},r))};function Zt(t){!function(t){var e=t.sortable,n=t.rootEl,o=t.name,r=t.targetEl,a=t.cloneEl,i=t.toEl,s=t.fromEl,l=t.oldIndex,c=t.newIndex,u=t.oldDraggableIndex,d=t.newDraggableIndex,m=t.originalEvent,h=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[zt]){var p,g=e.options,v="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||gt||vt?(p=document.createEvent("Event")).initEvent(o,!0,!0):p=new CustomEvent(o,{bubbles:!0,cancelable:!0}),p.to=i||n,p.from=s||n,p.item=r||n,p.clone=a,p.oldIndex=l,p.newIndex=c,p.oldDraggableIndex=u,p.newDraggableIndex=d,p.originalEvent=m,p.pullMode=h?h.lastPutMode:void 0;var b=ut(ut({},f),Kt.getEventProperties(o,e));for(var y in b)p[y]=b[y];n&&n.dispatchEvent(p),g[v]&&g[v].call(e,p)}}(ut({putSortable:me,cloneEl:ae,targetEl:Qt,rootEl:ne,oldIndex:se,oldDraggableIndex:ce,newIndex:le,newDraggableIndex:ue},t))}var Qt,te,ee,ne,oe,re,ae,ie,se,le,ce,ue,de,me,he,fe,pe,ge,ve,be,ye,we,_e,Te,xe,Se=!1,Ee=!1,Ne=[],Ce=!1,De=!1,Oe=[],Ie=!1,Pe=[],Me="undefined"!=typeof document,Le=wt,ke=vt||gt?"cssFloat":"float",Ae=Me&&!_t&&!wt&&"draggable"in document.createElement("div"),Re=function(){if(Me){if(gt)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Fe=function(t,e){var n=Pt(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=Ft(t,0,e),a=Ft(t,1,e),i=r&&Pt(r),s=a&&Pt(a),l=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+At(r).width,c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+At(a).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&i.float&&"none"!==i.float){var u="left"===i.float?"left":"right";return!a||"both"!==s.clear&&s.clear!==u?"horizontal":"vertical"}return r&&("block"===i.display||"flex"===i.display||"table"===i.display||"grid"===i.display||l>=o&&"none"===n[ke]||a&&"none"===n[ke]&&l+c>o)?"vertical":"horizontal"},Be=function(t){function e(t,n){return function(o,r,a,i){var s=o.options.group.name&&r.options.group.name&&o.options.group.name===r.options.group.name;if(null==t&&(n||s))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"==typeof t)return e(t(o,r,a,i),n)(o,r,a,i);var l=(n?o:r).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var n={},o=t.group;o&&"object"==dt(o)||(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n},je=function(){!Re&&ee&&Pt(ee,"display","none")},Xe=function(){!Re&&ee&&Pt(ee,"display","")};Me&&!_t&&document.addEventListener("click",(function(t){if(Ee)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Ee=!1,!1}),!0);var Ye=function(t){if(Qt){t=t.touches?t.touches[0]:t;var e=(r=t.clientX,a=t.clientY,Ne.some((function(t){var e=t[zt].options.emptyInsertThreshold;if(e&&!Bt(t)){var n=At(t),o=r>=n.left-e&&r<=n.right+e,s=a>=n.top-e&&a<=n.bottom+e;return o&&s?i=t:void 0}})),i);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[zt]._onDragOver(n)}}var r,a,i},He=function(t){Qt&&Qt.parentNode[zt]._isOutsideThisEl(t.target)};function qe(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=ht({},e),t[zt]=this;var n,o,r={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Fe(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==qe.supportPointer&&"PointerEvent"in window&&!yt,emptyInsertThreshold:5};for(var a in Kt.initializePlugins(this,t,r),r)!(a in e)&&(e[a]=r[a]);for(var i in Be(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&Ae,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?xt(t,"pointerdown",this._onTapStart):(xt(t,"mousedown",this._onTapStart),xt(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(xt(t,"dragover",this),xt(t,"dragenter",this)),Ne.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ht(this,(o=[],{captureAnimationState:function(){o=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(t){if("none"!==Pt(t,"display")&&t!==qe.ghost){o.push({target:t,rect:At(t)});var e=ut({},o[o.length-1].rect);if(t.thisAnimationDuration){var n=Mt(t,!0);n&&(e.top-=n.f,e.left-=n.e)}t.fromRect=e}}))},addAnimationState:function(t){o.push(t)},removeAnimationState:function(t){o.splice(function(t,e){for(var n in t)if(t.hasOwnProperty(n))for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n);return-1}(o,{target:t}),1)},animateAll:function(t){var e=this;if(!this.options.animation)return clearTimeout(n),void("function"==typeof t&&t());var r=!1,a=0;o.forEach((function(t){var n=0,o=t.target,i=o.fromRect,s=At(o),l=o.prevFromRect,c=o.prevToRect,u=t.rect,d=Mt(o,!0);d&&(s.top-=d.f,s.left-=d.e),o.toRect=s,o.thisAnimationDuration&&Ht(l,s)&&!Ht(i,s)&&(u.top-s.top)/(u.left-s.left)==(i.top-s.top)/(i.left-s.left)&&(n=function(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}(u,l,c,e.options)),Ht(s,i)||(o.prevFromRect=i,o.prevToRect=s,n||(n=e.options.animation),e.animate(o,u,s,n)),n&&(r=!0,a=Math.max(a,n),clearTimeout(o.animationResetTimer),o.animationResetTimer=setTimeout((function(){o.animationTime=0,o.prevFromRect=null,o.fromRect=null,o.prevToRect=null,o.thisAnimationDuration=null}),n),o.thisAnimationDuration=n)})),clearTimeout(n),r?n=setTimeout((function(){"function"==typeof t&&t()}),a):"function"==typeof t&&t(),o=[]},animate:function(t,e,n,o){if(o){Pt(t,"transition",""),Pt(t,"transform","");var r=Mt(this.el),a=r&&r.a,i=r&&r.d,s=(e.left-n.left)/(a||1),l=(e.top-n.top)/(i||1);t.animatingX=!!s,t.animatingY=!!l,Pt(t,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),Pt(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),Pt(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){Pt(t,"transition",""),Pt(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),o)}}}))}function Ge(t,e,n,o,r,a,i,s){var l,c,u=t[zt],d=u.options.onMove;return!window.CustomEvent||gt||vt?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=n,l.draggedRect=o,l.related=r||e,l.relatedRect=a||At(e),l.willInsertAfter=s,l.originalEvent=i,t.dispatchEvent(l),d&&(c=d.call(u,l,i)),c}function We(t){t.draggable=!1}function ze(){Ie=!1}function Ue(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function $e(t){return setTimeout(t,0)}function Ke(t){return clearTimeout(t)}qe.prototype={constructor:qe,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(we=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Qt):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,r=o.preventOnFilter,a=t.type,i=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,s=(i||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,c=o.filter;if(function(t){Pe.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var o=e[n];o.checked&&Pe.push(o)}}(n),!Qt&&!(/mousedown|pointerdown/.test(a)&&0!==t.button||o.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!yt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Ct(s,o.draggable,n,!1))&&s.animated||re===s)){if(se=jt(s),ce=jt(s,o.draggable),"function"==typeof c){if(c.call(this,t,s,this))return Zt({sortable:e,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Jt("filter",e,{evt:t}),void(r&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(o){if(o=Ct(l,o.trim(),n,!1))return Zt({sortable:e,rootEl:o,name:"filter",targetEl:s,fromEl:n,toEl:n}),Jt("filter",e,{evt:t}),!0}))))return void(r&&t.cancelable&&t.preventDefault());o.handle&&!Ct(l,o.handle,n,!1)||this._prepareDragStart(t,i,s)}}},_prepareDragStart:function(t,e,n){var o,r=this,a=r.el,i=r.options,s=a.ownerDocument;if(n&&!Qt&&n.parentNode===a){var l=At(n);if(ne=a,te=(Qt=n).parentNode,oe=Qt.nextSibling,re=n,de=i.group,qe.dragged=Qt,he={target:Qt,clientX:(e||t).clientX,clientY:(e||t).clientY},ve=he.clientX-l.left,be=he.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Qt.style["will-change"]="all",o=function(){Jt("delayEnded",r,{evt:t}),qe.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!bt&&r.nativeDraggable&&(Qt.draggable=!0),r._triggerDragStart(t,e),Zt({sortable:r,name:"choose",originalEvent:t}),It(Qt,i.chosenClass,!0))},i.ignore.split(",").forEach((function(t){Lt(Qt,t.trim(),We)})),xt(s,"dragover",Ye),xt(s,"mousemove",Ye),xt(s,"touchmove",Ye),xt(s,"mouseup",r._onDrop),xt(s,"touchend",r._onDrop),xt(s,"touchcancel",r._onDrop),bt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Qt.draggable=!0),Jt("delayStart",this,{evt:t}),!i.delay||i.delayOnTouchOnly&&!e||this.nativeDraggable&&(vt||gt))o();else{if(qe.eventCanceled)return void this._onDrop();xt(s,"mouseup",r._disableDelayedDrag),xt(s,"touchend",r._disableDelayedDrag),xt(s,"touchcancel",r._disableDelayedDrag),xt(s,"mousemove",r._delayedDragTouchMoveHandler),xt(s,"touchmove",r._delayedDragTouchMoveHandler),i.supportPointer&&xt(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(o,i.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Qt&&We(Qt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;St(t,"mouseup",this._disableDelayedDrag),St(t,"touchend",this._disableDelayedDrag),St(t,"touchcancel",this._disableDelayedDrag),St(t,"mousemove",this._delayedDragTouchMoveHandler),St(t,"touchmove",this._delayedDragTouchMoveHandler),St(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?xt(document,"pointermove",this._onTouchMove):xt(document,e?"touchmove":"mousemove",this._onTouchMove):(xt(Qt,"dragend",this),xt(ne,"dragstart",this._onDragStart));try{document.selection?$e((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(Se=!1,ne&&Qt){Jt("dragStarted",this,{evt:e}),this.nativeDraggable&&xt(document,"dragover",He);var n=this.options;!t&&It(Qt,n.dragClass,!1),It(Qt,n.ghostClass,!0),qe.active=this,t&&this._appendGhost(),Zt({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(fe){this._lastX=fe.clientX,this._lastY=fe.clientY,je();for(var t=document.elementFromPoint(fe.clientX,fe.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(fe.clientX,fe.clientY))!==e;)e=t;if(Qt.parentNode[zt]._isOutsideThisEl(t),e)do{if(e[zt]&&e[zt]._onDragOver({clientX:fe.clientX,clientY:fe.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break;t=e}while(e=e.parentNode);Xe()}},_onTouchMove:function(t){if(he){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,r=t.touches?t.touches[0]:t,a=ee&&Mt(ee,!0),i=ee&&a&&a.a,s=ee&&a&&a.d,l=Le&&xe&&Xt(xe),c=(r.clientX-he.clientX+o.x)/(i||1)+(l?l[0]-Oe[0]:0)/(i||1),u=(r.clientY-he.clientY+o.y)/(s||1)+(l?l[1]-Oe[1]:0)/(s||1);if(!qe.active&&!Se){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))o.right+10||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+10}(t,r,this)&&!p.animated){if(p===Qt)return P(!1);if(p&&a===t.target&&(i=p),i&&(n=At(i)),!1!==Ge(ne,a,Qt,e,i,n,t,!!i))return I(),p&&p.nextSibling?a.insertBefore(Qt,p.nextSibling):a.appendChild(Qt),te=a,M(),P(!0)}else if(p&&function(t,e,n){var o=At(Ft(n.el,0,n.options,!0));return e?t.clientXu+c*a/2:ld-Te)return-_e}else if(l>u+c*(1-r)/2&&ld-c*a/2)?l>u+c/2?1:-1:0}(t,i,n,r,_?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,De,we===i),0!==v){var E=jt(Qt);do{E-=v,y=te.children[E]}while(y&&("none"===Pt(y,"display")||y===ee))}if(0===v||y===i)return P(!1);we=i,_e=v;var N=i.nextElementSibling,C=!1,D=Ge(ne,a,Qt,e,i,n,t,C=1===v);if(!1!==D)return 1!==D&&-1!==D||(C=1===D),Ie=!0,setTimeout(ze,30),I(),C&&!N?a.appendChild(Qt):i.parentNode.insertBefore(Qt,C?N:i),x&&Gt(x,0,S-x.scrollTop),te=Qt.parentNode,void 0===b||De||(Te=Math.abs(b-At(i)[T])),M(),P(!0)}if(a.contains(Qt))return P(!1)}return!1}function O(s,l){Jt(s,h,ut({evt:t,isOwner:u,axis:r?"vertical":"horizontal",revert:o,dragRect:e,targetRect:n,canSort:d,fromSortable:m,target:i,completed:P,onMove:function(n,o){return Ge(ne,a,Qt,e,n,At(n),t,o)},changed:M},l))}function I(){O("dragOverAnimationCapture"),h.captureAnimationState(),h!==m&&m.captureAnimationState()}function P(e){return O("dragOverCompleted",{insertion:e}),e&&(u?c._hideClone():c._showClone(h),h!==m&&(It(Qt,me?me.options.ghostClass:c.options.ghostClass,!1),It(Qt,s.ghostClass,!0)),me!==h&&h!==qe.active?me=h:h===qe.active&&me&&(me=null),m===h&&(h._ignoreWhileAnimating=i),h.animateAll((function(){O("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(i===Qt&&!Qt.animated||i===a&&!i.animated)&&(we=null),s.dragoverBubble||t.rootEl||i===document||(Qt.parentNode[zt]._isOutsideThisEl(t.target),!e&&Ye(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function M(){le=jt(Qt),ue=jt(Qt,s.draggable),Zt({sortable:h,name:"change",toEl:a,newIndex:le,newDraggableIndex:ue,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){St(document,"mousemove",this._onTouchMove),St(document,"touchmove",this._onTouchMove),St(document,"pointermove",this._onTouchMove),St(document,"dragover",Ye),St(document,"mousemove",Ye),St(document,"touchmove",Ye)},_offUpEvents:function(){var t=this.el.ownerDocument;St(t,"mouseup",this._onDrop),St(t,"touchend",this._onDrop),St(t,"pointerup",this._onDrop),St(t,"touchcancel",this._onDrop),St(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;le=jt(Qt),ue=jt(Qt,n.draggable),Jt("drop",this,{evt:t}),te=Qt&&Qt.parentNode,le=jt(Qt),ue=jt(Qt,n.draggable),qe.eventCanceled||(Se=!1,De=!1,Ce=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ke(this.cloneId),Ke(this._dragStartId),this.nativeDraggable&&(St(document,"drop",this),St(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),yt&&Pt(document.body,"user-select",""),Pt(Qt,"transform",""),t&&(ye&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),ee&&ee.parentNode&&ee.parentNode.removeChild(ee),(ne===te||me&&"clone"!==me.lastPutMode)&&ae&&ae.parentNode&&ae.parentNode.removeChild(ae),Qt&&(this.nativeDraggable&&St(Qt,"dragend",this),We(Qt),Qt.style["will-change"]="",ye&&!Se&&It(Qt,me?me.options.ghostClass:this.options.ghostClass,!1),It(Qt,this.options.chosenClass,!1),Zt({sortable:this,name:"unchoose",toEl:te,newIndex:null,newDraggableIndex:null,originalEvent:t}),ne!==te?(le>=0&&(Zt({rootEl:te,name:"add",toEl:te,fromEl:ne,originalEvent:t}),Zt({sortable:this,name:"remove",toEl:te,originalEvent:t}),Zt({rootEl:te,name:"sort",toEl:te,fromEl:ne,originalEvent:t}),Zt({sortable:this,name:"sort",toEl:te,originalEvent:t})),me&&me.save()):le!==se&&le>=0&&(Zt({sortable:this,name:"update",toEl:te,originalEvent:t}),Zt({sortable:this,name:"sort",toEl:te,originalEvent:t})),qe.active&&(null!=le&&-1!==le||(le=se,ue=ce),Zt({sortable:this,name:"end",toEl:te,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){Jt("nulling",this),ne=Qt=te=ee=oe=ae=re=ie=he=fe=ye=le=ue=se=ce=we=_e=me=de=qe.dragged=qe.ghost=qe.clone=qe.active=null,Pe.forEach((function(t){t.checked=!0})),Pe.length=pe=ge=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Qt&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,r=n.length,a=this.options;o li").map((function(){return{id:$(this).data("id"),children:$(this).find("li").map((function(){return $(this).data("id")})).get()}})).get();e.forEach((function(t,e){var n=r().store.getById("tags",t.id);n.pushData({attributes:{position:e,isChild:!1},relationships:{parent:null}}),t.children.forEach((function(t,e){r().store.getById("tags",t).pushData({attributes:{position:e,isChild:!0},relationships:{parent:n}})}))})),r().request({url:r().forum.attribute("apiUrl")+"/tags/order",method:"POST",body:{order:e}}),this.forcedRefreshKey++,m.redraw()},e}(hn());function Sn(t,e,n,o,r,a,i){try{var s=t[a](i),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(o,r)}function En(t){return function(){var e=this,n=arguments;return new Promise((function(o,r){var a=t.apply(e,n);function i(t){Sn(a,o,r,i,s,"next",t)}function s(t){Sn(a,o,r,i,s,"throw",t)}i(void 0)}))}}var Nn=n(507),Cn=n.n(Nn),Dn=function(){function t(){this.loadedIncludes=void 0}var e=t.prototype;return e.load=function(){var t=En(Cn().mark((function t(e){var n,o=this;return Cn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===e&&(e=[]),this.loadedIncludes){t.next=3;break}return t.abrupt("return",this.query(e));case 3:if(0!==(n=e.filter((function(t){return!o.loadedIncludes.has(t)}))).length){t.next=6;break}return t.abrupt("return",Promise.resolve(G().store.all("tags")));case 6:return t.abrupt("return",this.query(n));case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.query=function(){var t=En(Cn().mark((function t(e){var n=this;return Cn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=[]),null!=this.loadedIncludes||(this.loadedIncludes=new Set),t.abrupt("return",G().store.find("tags",{include:e.join(",")}).then((function(t){return e.forEach((function(t){return n.loadedIncludes.add(t)})),t})));case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}();const On=flarum.core.compat["common/extenders"];var In=n.n(On);const Pn=flarum.core.compat["common/utils/computed"];var Mn=n.n(Pn);const Ln=flarum.core.compat["common/Model"];var kn=n.n(Ln),An=function(t){function e(){return t.apply(this,arguments)||this}X(e,t);var n=e.prototype;return n.name=function(){return kn().attribute("name").call(this)},n.slug=function(){return kn().attribute("slug").call(this)},n.description=function(){return kn().attribute("description").call(this)},n.color=function(){return kn().attribute("color").call(this)},n.backgroundUrl=function(){return kn().attribute("backgroundUrl").call(this)},n.backgroundMode=function(){return kn().attribute("backgroundMode").call(this)},n.icon=function(){return kn().attribute("icon").call(this)},n.position=function(){return kn().attribute("position").call(this)},n.parent=function(){return kn().hasOne("parent").call(this)},n.children=function(){return kn().hasMany("children").call(this)},n.defaultSort=function(){return kn().attribute("defaultSort").call(this)},n.isChild=function(){return kn().attribute("isChild").call(this)},n.isHidden=function(){return kn().attribute("isHidden").call(this)},n.discussionCount=function(){return kn().attribute("discussionCount").call(this)},n.lastPostedAt=function(){return kn().attribute("lastPostedAt",kn().transformDate).call(this)},n.lastPostedDiscussion=function(){return kn().hasOne("lastPostedDiscussion").call(this)},n.isRestricted=function(){return kn().attribute("isRestricted").call(this)},n.canStartDiscussion=function(){return kn().attribute("canStartDiscussion").call(this)},n.canAddToDiscussion=function(){return kn().attribute("canAddToDiscussion").call(this)},n.isPrimary=function(){return Mn()("position","parent",(function(t,e){return null!==t&&!1===e})).call(this)},e}(kn());const Rn=[(new(In().Store)).add("tags",An)],Fn={"tags/utils/sortTags":C,"tags/models/Tag":An,"tags/helpers/tagsLabel":st,"tags/helpers/tagIcon":E,"tags/helpers/tagLabel":N,"tags/components/TagSelectionModal":at,"tags/states/TagListState":Dn},Bn=Object.assign(Fn,{"tags/addTagsHomePageOption":M,"tags/addTagChangePermission":A,"tags/components/TagsPage":xn,"tags/components/EditTagModal":_n,"tags/components/SelectTagsSettingComponent":lt,"tags/addTagPermission":O,"tags/addTagsPermissionScope":D}),jn=flarum.core;r().initializers.add("flarum-tags",(function(t){t.tagList=new Dn,t.extensionData.for("flarum-tags").registerPage(xn),D(),O(),M(),A(),(0,a.extend)(F().prototype,"customSettingComponents",(function(t){var e=this;t.add("flarum-tags.select-tags",(function(t){return m(lt,Object.assign({},t,{settingValue:e.settings[t.setting]}))}))}))})),Object.assign(jn.compat,Bn)},810:()=>{},440:(t,e,n)=>{var o=n(75).default;function r(){"use strict";t.exports=r=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},n=Object.prototype,a=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(t){d=function(t,e,n){return t[e]=n}}function m(t,e,n,o){var r=e&&e.prototype instanceof p?e:p,a=Object.create(r.prototype),s=new D(o||[]);return i(a,"_invoke",{value:S(t,n,s)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=m;var f={};function p(){}function g(){}function v(){}var b={};d(b,l,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(O([])));w&&w!==n&&a.call(w,l)&&(b=w);var _=v.prototype=p.prototype=Object.create(b);function T(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(r,i,s,l){var c=h(t[r],t,i);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==o(d)&&a.call(d,"__await")?e.resolve(d.__await).then((function(t){n("next",t,s,l)}),(function(t){n("throw",t,s,l)})):e.resolve(d).then((function(t){u.value=t,s(u)}),(function(t){return n("throw",t,s,l)}))}l(c.arg)}var r;i(this,"_invoke",{value:function(t,o){function a(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(a,a):a()}})}function S(t,e,n){var o="suspendedStart";return function(r,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===r)throw a;return{value:void 0,done:!0}}for(n.method=r,n.arg=a;;){var i=n.delegate;if(i){var s=E(i,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var l=h(t,e,n);if("normal"===l.type){if(o=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o="completed",n.method="throw",n.arg=l.arg)}}}function E(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var r=o.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function O(t){if(t){var e=t[l];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var r=this.tryEntries[o],i=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var s=a.call(r,"catchLoc"),l=a.call(r,"finallyLoc");if(s&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var o=n.completion;if("throw"===o.type){var r=o.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:O(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},75:t=>{function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},507:(t,e,n)=>{var o=n(440)();t.exports=o;try{regeneratorRuntime=o}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var a=e[o]={exports:{}};return t[o](a,a.exports,n),a.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};(()=>{"use strict";n.r(o),n.d(o,{extend:()=>r.l});var t=n(810),e={};for(const n in t)"default"!==n&&(e[n]=()=>t[n]);n.d(o,e);var r=n(946)})(),module.exports=o})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index 56c2958b..fde517e5 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":";0DAAA,MAAM,EAA+BA,OAAOC,KAAKC,OAAO,0BCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,gDCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,oDCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,2CCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,yCCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,mDCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,qCCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,uCCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,uCCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iDCEzC,SAASC,EAAQC,EAAKC,EAAYC,QAAP,IAALD,IAAAA,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,EAAUhG,EAAQ,IAARA,GACdE,EAAOC,QAAU6F,EAGjB,IACEC,mBAAqBD,CAOvB,CANE,MAAOE,GACmB,iBAAfC,WACTA,WAAWF,mBAAqBD,EAEhCI,SAAS,IAAK,yBAAdA,CAAwCJ,EAE5C,ICbIK,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBzjB,IAAjB0jB,EACH,OAAOA,EAAarG,QAGrB,IAAID,EAASmG,EAAyBE,GAAY,CAGjDpG,QAAS,CAAC,GAOX,OAHAsG,EAAoBF,GAAUrG,EAAQA,EAAOC,QAASmG,GAG/CpG,EAAOC,OACf,CCrBAmG,EAAoBlqB,EAAK8jB,IACxB,IAAIwG,EAASxG,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAoG,EAAoB7oB,EAAEipB,EAAQ,CAAE37B,EAAG27B,IAC5BA,CAAM,ECLdJ,EAAoB7oB,EAAI,CAAC0iB,EAASwG,KACjC,IAAI,IAAIz4B,KAAOy4B,EACXL,EAAoBp3B,EAAEy3B,EAAYz4B,KAASo4B,EAAoBp3B,EAAEixB,EAASjyB,IAC5EI,OAAO4J,eAAeioB,EAASjyB,EAAK,CAAE2J,YAAY,EAAM8U,IAAKga,EAAWz4B,IAE1E,ECNDo4B,EAAoBp3B,EAAI,CAACkJ,EAAK8C,IAAU5M,OAAOO,UAAUC,eAAeC,KAAKqJ,EAAK8C,GCClForB,EAAoBM,EAAKzG,IACH,oBAAX9nB,QAA0BA,OAAOwoB,aAC1CvyB,OAAO4J,eAAeioB,EAAS9nB,OAAOwoB,YAAa,CAAEzyB,MAAO,WAE7DE,OAAO4J,eAAeioB,EAAS,aAAc,CAAE/xB,OAAO,GAAO","sources":["webpack://@flarum/tags/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/tags/external root \"flarum.core.compat['admin/components/PermissionGrid']\"","webpack://@flarum/tags/external root \"flarum.core.compat['admin/components/PermissionDropdown']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/components/Dropdown']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/components/Button']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/utils/extract']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/components/Link']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/utils/classList']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/helpers/textContrastClass']\"","webpack://@flarum/tags/./src/common/helpers/tagIcon.js","webpack://@flarum/tags/./src/common/helpers/tagLabel.js","webpack://@flarum/tags/./src/common/utils/sortTags.tsx","webpack://@flarum/tags/./src/admin/addTagsPermissionScope.tsx","webpack://@flarum/tags/./src/admin/addTagPermission.js","webpack://@flarum/tags/external root \"flarum.core.compat['admin/components/BasicsPage']\"","webpack://@flarum/tags/./src/admin/addTagsHomePageOption.js","webpack://@flarum/tags/external root \"flarum.core.compat['admin/components/SettingDropdown']\"","webpack://@flarum/tags/./src/admin/addTagChangePermission.js","webpack://@flarum/tags/external root \"flarum.core.compat['admin/components/AdminPage']\"","webpack://@flarum/tags/../../../node_modules/@babel/runtime/helpers/esm/extends.js","webpack://@flarum/tags/../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@flarum/tags/../../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@flarum/tags/external root \"flarum.core.compat['common/Component']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/app']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/helpers/highlight']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/utils/KeyboardNavigatable']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@flarum/tags/../../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","webpack://@flarum/tags/./src/forum/components/ToggleButton.js","webpack://@flarum/tags/./src/common/components/TagSelectionModal.tsx","webpack://@flarum/tags/./src/common/helpers/tagsLabel.js","webpack://@flarum/tags/./src/admin/components/SelectTagsSettingComponent.tsx","webpack://@flarum/tags/../../../node_modules/sortablejs/modular/sortable.esm.js","webpack://@flarum/tags/external root \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/utils/withAttr']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/components/ColorPreviewInput']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/utils/string']\"","webpack://@flarum/tags/./src/admin/components/EditTagModal.tsx","webpack://@flarum/tags/./src/admin/components/TagsPage.js","webpack://@flarum/tags/../../../node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://@flarum/tags/./src/common/states/TagListState.ts","webpack://@flarum/tags/external root \"flarum.core.compat['common/extenders']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/utils/computed']\"","webpack://@flarum/tags/external root \"flarum.core.compat['common/Model']\"","webpack://@flarum/tags/./src/common/models/Tag.ts","webpack://@flarum/tags/./src/common/extend.ts","webpack://@flarum/tags/./src/common/compat.js","webpack://@flarum/tags/./src/admin/compat.js","webpack://@flarum/tags/external assign \"flarum.core\"","webpack://@flarum/tags/./src/admin/index.ts","webpack://@flarum/tags/./src/admin/addTagSelectionSettingComponent.tsx","webpack://@flarum/tags/../../../node_modules/@babel/runtime/helpers/regeneratorRuntime.js","webpack://@flarum/tags/../../../node_modules/@babel/runtime/helpers/typeof.js","webpack://@flarum/tags/../../../node_modules/@babel/runtime/regenerator/index.js","webpack://@flarum/tags/webpack/bootstrap","webpack://@flarum/tags/webpack/runtime/compat get default export","webpack://@flarum/tags/webpack/runtime/define property getters","webpack://@flarum/tags/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/tags/webpack/runtime/make namespace object"],"sourcesContent":["const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/PermissionGrid'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/PermissionDropdown'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Dropdown'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extract'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/classList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/textContrastClass'];","import classList from 'flarum/common/utils/classList';\n\nexport default function tagIcon(tag, attrs = {}, settings = {}) {\n const hasIcon = tag && tag.icon();\n const { useColor = true } = settings;\n\n attrs.className = classList([attrs.className, 'icon', hasIcon ? tag.icon() : 'TagIcon']);\n\n if (tag && useColor) {\n attrs.style = attrs.style || {};\n attrs.style['--color'] = tag.color();\n\n if (hasIcon) {\n attrs.style.color = tag.color();\n }\n } else if (!tag) {\n attrs.className += ' untagged';\n }\n\n return hasIcon ? : ;\n}\n","import extract from 'flarum/common/utils/extract';\nimport Link from 'flarum/common/components/Link';\nimport classList from 'flarum/common/utils/classList';\nimport textContrastClass from 'flarum/common/helpers/textContrastClass';\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['--tag-bg'] = color;\n attrs.className = classList(attrs.className, 'colored', textContrastClass(color));\n }\n\n if (link) {\n attrs.title = tag.description() || '';\n attrs.href = app.route('tag', { tags: tag.slug() });\n }\n\n if (tag.isChild()) {\n attrs.className += ' TagLabel--child';\n }\n } else {\n attrs.className += ' untagged';\n }\n\n return m(\n link ? Link : 'span',\n attrs,\n \n {tag && tag.icon() && tagIcon(tag, { className: 'TagLabel-icon' }, { useColor: false })}\n {tagText}\n \n );\n}\n","import Tag from '../models/Tag';\n\nexport default function sortTags(tags: Tag[]) {\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) 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 // If they are both child tags, then we will compare the positions of their\n // parents.\n else if (aParent && bParent) return aParent.position()! - bParent.position()!;\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) return aParent === b ? 1 : aParent.position()! - bPos;\n else if (bParent) return bParent === a ? -1 : aPos - bParent.position()!;\n\n return 0;\n });\n}\n","import app from 'flarum/admin/app';\nimport { extend, override } from 'flarum/common/extend';\nimport PermissionGrid from 'flarum/admin/components/PermissionGrid';\nimport PermissionDropdown from 'flarum/admin/components/PermissionDropdown';\nimport Dropdown from 'flarum/common/components/Dropdown';\nimport Button from 'flarum/common/components/Button';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nimport tagLabel from '../common/helpers/tagLabel';\nimport tagIcon from '../common/helpers/tagIcon';\nimport sortTags from '../common/utils/sortTags';\nimport Tag from '../common/models/Tag';\n\nexport default function () {\n extend(PermissionGrid.prototype, 'oninit', function () {\n this.loading = true;\n });\n\n extend(PermissionGrid.prototype, 'oncreate', function () {\n app.tagList.load().then(() => {\n this.loading = false;\n m.redraw();\n });\n });\n\n override(PermissionGrid.prototype, 'view', function (original, vnode) {\n if (this.loading) {\n return ;\n }\n\n return original(vnode);\n });\n\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) =>\n items.add('tag' + tag.id(), {\n label: tagLabel(tag),\n onremove: () => tag.save({ isRestricted: false }),\n render: (item) => {\n if ('setting' in item) return null;\n\n if (\n item.permission === 'viewForum' ||\n item.permission === 'startDiscussion' ||\n (item.permission.startsWith('discussion.') && item.tagScoped !== false) ||\n item.tagScoped\n ) {\n return ;\n }\n\n return null;\n },\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(\n 'tag',\n \n {tags.map((tag) => (\n \n ))}\n \n );\n }\n });\n}\n","export default function () {\n app.extensionData\n .for('flarum-tags')\n .registerPermission(\n {\n icon: 'fas fa-tag',\n label: app.translator.trans('flarum-tags.admin.permissions.tag_discussions_label'),\n permission: 'discussion.tag',\n },\n 'moderate',\n 95\n )\n .registerPermission(\n {\n icon: 'fas fa-tags',\n label: app.translator.trans('flarum-tags.admin.permissions.bypass_tag_counts_label'),\n permission: 'bypassTagCounts',\n },\n 'start',\n 89\n );\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/BasicsPage'];","import { extend } from 'flarum/common/extend';\nimport BasicsPage from 'flarum/admin/components/BasicsPage';\n\nexport default function () {\n extend(BasicsPage.prototype, 'homePageItems', (items) => {\n items.add('tags', {\n path: '/tags',\n label: app.translator.trans('flarum-tags.admin.basics.tags_label'),\n });\n });\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/SettingDropdown'];","import app from 'flarum/admin/app';\nimport { extend } from 'flarum/common/extend';\nimport PermissionGrid from 'flarum/admin/components/PermissionGrid';\nimport SettingDropdown from 'flarum/admin/components/SettingDropdown';\n\nexport default function () {\n extend(PermissionGrid.prototype, 'startItems', (items) => {\n items.add(\n 'allowTagChange',\n {\n icon: 'fas fa-tag',\n label: app.translator.trans('flarum-tags.admin.permissions.allow_edit_tags_label'),\n setting: () => {\n const minutes = parseInt(app.data.settings.allow_tag_change, 10);\n\n return (\n \n );\n },\n },\n 90\n );\n });\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/AdminPage'];","export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/highlight'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/KeyboardNavigatable'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}","import Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport classList from 'flarum/common/utils/classList';\n\n/**\n * @TODO move to core\n */\nexport default class ToggleButton extends Component {\n view(vnode) {\n const { className, isToggled, ...attrs } = this.attrs;\n const icon = isToggled ? 'far fa-check-circle' : 'far fa-circle';\n\n return (\n \n );\n }\n}\n","import app from 'flarum/common/app';\nimport Button from 'flarum/common/components/Button';\nimport classList from 'flarum/common/utils/classList';\nimport extractText from 'flarum/common/utils/extractText';\nimport highlight from 'flarum/common/helpers/highlight';\nimport KeyboardNavigatable from 'flarum/common/utils/KeyboardNavigatable';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport Modal from 'flarum/common/components/Modal';\nimport Stream from 'flarum/common/utils/Stream';\n\nimport sortTags from '../utils/sortTags';\nimport tagLabel from '../helpers/tagLabel';\nimport tagIcon from '../helpers/tagIcon';\nimport ToggleButton from '../../forum/components/ToggleButton';\n\nimport type Tag from '../models/Tag';\nimport type { IInternalModalAttrs } from 'flarum/common/components/Modal';\nimport type Mithril from 'mithril';\n\nexport interface ITagSelectionModalLimits {\n /** Whether to allow bypassing the limits set here. This will show a toggle button to bypass limits. */\n allowBypassing?: boolean;\n /** Maximum number of primary/secondary tags allowed. */\n max?: {\n total?: number;\n primary?: number;\n secondary?: number;\n };\n /** Minimum number of primary/secondary tags to be selected. */\n min?: {\n total?: number;\n primary?: number;\n secondary?: number;\n };\n}\n\nexport interface ITagSelectionModalAttrs extends IInternalModalAttrs {\n /** Custom modal className to use. */\n className?: string;\n /** Modal title, defaults to 'Choose Tags'. */\n title?: string;\n /** Initial tag selection value. */\n selectedTags?: Tag[];\n /** Limits set based on minimum and maximum number of primary/secondary tags that can be selected. */\n limits?: ITagSelectionModalLimits;\n /** Whether to allow resetting the value. Defaults to true. */\n allowResetting?: boolean;\n /** Whether to require the parent tag of a selected tag to be selected as well. */\n requireParentTag?: boolean;\n /** Filter tags that can be selected. */\n selectableTags?: (tags: Tag[]) => Tag[];\n /** Whether a tag can be selected. */\n canSelect: (tag: Tag) => boolean;\n /** Callback for when a tag is selected. */\n onSelect?: (tag: Tag, selected: Tag[]) => void;\n /** Callback for when a tag is deselected. */\n onDeselect?: (tag: Tag, selected: Tag[]) => void;\n /** Callback for when the selection is submitted. */\n onsubmit?: (selected: Tag[]) => void;\n}\n\nexport type ITagSelectionModalState = undefined;\n\nexport default class TagSelectionModal<\n CustomAttrs extends ITagSelectionModalAttrs = ITagSelectionModalAttrs,\n CustomState extends ITagSelectionModalState = ITagSelectionModalState\n> extends Modal {\n protected loading = true;\n protected tags!: Tag[];\n protected selected: Tag[] = [];\n protected bypassReqs: boolean = false;\n\n protected filter = Stream('');\n protected focused = false;\n protected navigator = new KeyboardNavigatable();\n protected indexTag?: Tag;\n\n static initAttrs(attrs: ITagSelectionModalAttrs) {\n super.initAttrs(attrs);\n\n // Default values for optional attributes.\n attrs.title ||= extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.title'));\n attrs.canSelect ||= () => true;\n attrs.allowResetting ??= true;\n attrs.limits = {\n min: {\n total: attrs.limits?.min?.total ?? -Infinity,\n primary: attrs.limits?.min?.primary ?? -Infinity,\n secondary: attrs.limits?.min?.secondary ?? -Infinity,\n },\n max: {\n total: attrs.limits?.max?.total ?? Infinity,\n primary: attrs.limits?.max?.primary ?? Infinity,\n secondary: attrs.limits?.max?.secondary ?? Infinity,\n },\n };\n\n // Prevent illogical limits from being provided.\n catchInvalidLimits(attrs.limits);\n }\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n this.navigator\n .onUp(() => this.setIndex(this.getCurrentNumericIndex() - 1, true))\n .onDown(() => this.setIndex(this.getCurrentNumericIndex() + 1, true))\n .onSelect(this.select.bind(this))\n .onRemove(() => this.selected.splice(this.selected.length - 1, 1));\n\n app.tagList.load(['parent']).then((tags) => {\n this.loading = false;\n\n if (this.attrs.selectableTags) {\n tags = this.attrs.selectableTags(tags);\n }\n\n this.tags = sortTags(tags);\n\n if (this.attrs.selectedTags) {\n this.attrs.selectedTags.map(this.addTag.bind(this));\n }\n\n this.indexTag = tags[0];\n\n m.redraw();\n });\n }\n\n className() {\n return classList('TagSelectionModal', this.attrs.className);\n }\n\n title() {\n return this.attrs.title;\n }\n\n content() {\n if (this.loading || !this.tags) {\n return ;\n }\n\n const filter = this.filter().toLowerCase();\n const primaryCount = this.primaryCount();\n const secondaryCount = this.secondaryCount();\n const tags = this.getFilteredTags();\n\n const inputWidth = Math.max(extractText(this.getInstruction(primaryCount, secondaryCount)).length, this.filter().length);\n\n return [\n
\n
\n
\n
this.$('.TagsInput input').focus()}>\n \n {this.selected.map((tag) => (\n {\n this.removeTag(tag);\n this.onready();\n }}\n >\n {tagLabel(tag)}\n \n ))}\n \n (this.focused = true)}\n onblur={() => (this.focused = false)}\n />\n
\n
\n
\n \n {app.translator.trans('flarum-tags.lib.tag_selection_modal.submit_button')}\n \n
\n
\n
,\n\n
\n
    \n {tags.map((tag) => (\n (this.indexTag = tag)}\n onclick={this.toggleTag.bind(this, tag)}\n >\n {tagIcon(tag)}\n {highlight(tag.name(), filter)}\n {tag.description() ? {tag.description()} : ''}\n \n ))}\n
\n {this.attrs.limits!.allowBypassing && (\n
\n (this.bypassReqs = !this.bypassReqs)} isToggled={this.bypassReqs}>\n {app.translator.trans('flarum-tags.lib.tag_selection_modal.bypass_requirements')}\n \n
\n )}\n
,\n ];\n }\n\n /**\n * Filters the available tags on every state change.\n */\n private getFilteredTags(): Tag[] {\n const filter = this.filter().toLowerCase();\n const primaryCount = this.primaryCount();\n const secondaryCount = this.secondaryCount();\n let tags = this.tags;\n\n if (this.attrs.requireParentTag) {\n // Filter out all child tags whose parents have not been selected. This\n // makes it impossible to select a child if its parent hasn't been selected.\n tags = tags.filter((tag) => {\n const parent = tag.parent();\n return parent !== null && (parent === false || this.selected.includes(parent));\n });\n }\n\n if (!this.bypassReqs) {\n // If we reached the total maximum number of tags, we can't select anymore.\n if (this.selected.length >= this.attrs.limits!.max!.total!) {\n tags = tags.filter((tag) => this.selected.includes(tag));\n }\n // If the number of selected primary/secondary tags is at the maximum, then\n // we'll filter out all other tags of that type.\n else {\n if (primaryCount >= this.attrs.limits!.max!.primary!) {\n tags = tags.filter((tag) => !tag.isPrimary() || this.selected.includes(tag));\n }\n if (secondaryCount >= this.attrs.limits!.max!.secondary!) {\n tags = tags.filter((tag) => tag.isPrimary() || this.selected.includes(tag));\n }\n }\n }\n\n // If the user has entered text in the filter input, then filter by tags\n // whose name matches what they've entered.\n if (filter) {\n tags = tags.filter((tag) => tag.name().toLowerCase().includes(filter));\n }\n\n if (!this.indexTag || !tags.includes(this.indexTag)) this.indexTag = tags[0];\n\n return tags;\n }\n\n /**\n * Counts the number of selected primary tags.\n */\n protected primaryCount(): number {\n return this.selected.filter((tag) => tag.isPrimary()).length;\n }\n\n /**\n * Counts the number of selected secondary tags.\n */\n protected secondaryCount(): number {\n return this.selected.filter((tag) => !tag.isPrimary()).length;\n }\n\n /**\n * Validates the number of selected primary/secondary tags against the set min max limits.\n */\n protected meetsRequirements(primaryCount: number, secondaryCount: number) {\n if (this.bypassReqs || (this.attrs.allowResetting && this.selected.length === 0)) {\n return true;\n }\n\n if (this.selected.length < this.attrs.limits!.min!.total!) {\n return false;\n }\n\n return primaryCount >= this.attrs.limits!.min!.primary! && secondaryCount >= this.attrs.limits!.min!.secondary!;\n }\n\n /**\n * Add the given tag to the list of selected tags.\n */\n protected addTag(tag: Tag | undefined) {\n if (!tag || !this.attrs.canSelect(tag)) return;\n\n if (this.attrs.onSelect) {\n this.attrs.onSelect(tag, this.selected);\n }\n\n // If this tag has a parent, we'll also need to add the parent tag to the\n // selected list if it's not already in there.\n if (this.attrs.requireParentTag) {\n const parent = tag.parent();\n if (parent && !this.selected.includes(parent)) {\n this.selected.push(parent);\n }\n }\n\n if (!this.selected.includes(tag)) {\n this.selected.push(tag);\n }\n }\n\n /**\n * Remove the given tag from the list of selected tags.\n */\n protected removeTag(tag: Tag) {\n const index = this.selected.indexOf(tag);\n\n if (index !== -1) {\n this.selected.splice(index, 1);\n\n // Look through the list of selected tags for any tags which have the tag\n // we just removed as their parent. We'll need to remove them too.\n if (this.attrs.requireParentTag) {\n this.selected.filter((t) => t.parent() === tag).forEach(this.removeTag.bind(this));\n }\n\n if (this.attrs.onDeselect) {\n this.attrs.onDeselect(tag, this.selected);\n }\n }\n }\n\n protected toggleTag(tag: Tag) {\n // Won't happen, needed for type safety.\n if (!this.tags) return;\n\n if (this.selected.includes(tag)) {\n this.removeTag(tag);\n } else {\n this.addTag(tag);\n }\n\n if (this.filter()) {\n this.filter('');\n this.indexTag = this.tags[0];\n }\n\n this.onready();\n }\n\n /**\n * Gives human text instructions based on the current number of selected tags and set limits.\n */\n protected getInstruction(primaryCount: number, secondaryCount: number) {\n if (this.bypassReqs) {\n return '';\n }\n\n if (primaryCount < this.attrs.limits!.min!.primary!) {\n const remaining = this.attrs.limits!.min!.primary! - primaryCount;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_primary_placeholder', { count: remaining }));\n } else if (secondaryCount < this.attrs.limits!.min!.secondary!) {\n const remaining = this.attrs.limits!.min!.secondary! - secondaryCount;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_secondary_placeholder', { count: remaining }));\n } else if (this.selected.length < this.attrs.limits!.min!.total!) {\n const remaining = this.attrs.limits!.min!.total! - this.selected.length;\n return extractText(app.translator.trans('flarum-tags.lib.tag_selection_modal.choose_tags_placeholder', { count: remaining }));\n }\n\n return '';\n }\n\n /**\n * Submit tag selection.\n */\n onsubmit(e: SubmitEvent) {\n e.preventDefault();\n\n if (this.attrs.onsubmit) this.attrs.onsubmit(this.selected);\n\n this.hide();\n }\n\n protected select(e: KeyboardEvent) {\n // Ctrl + Enter submits the selection, just Enter completes the current entry\n if (e.metaKey || e.ctrlKey || (this.indexTag && this.selected.includes(this.indexTag))) {\n if (this.selected.length) {\n // The DOM submit method doesn't emit a `submit event, so we\n // simulate a manual submission so our `onsubmit` logic is run.\n this.$('button[type=\"submit\"]').click();\n }\n } else if (this.indexTag) {\n this.getItem(this.indexTag)[0].dispatchEvent(new Event('click'));\n }\n }\n\n protected selectableItems() {\n return this.$('.TagSelectionModal-list > li');\n }\n\n protected getCurrentNumericIndex() {\n if (!this.indexTag) return -1;\n\n return this.selectableItems().index(this.getItem(this.indexTag));\n }\n\n protected getItem(selectedTag: Tag) {\n return this.selectableItems().filter(`[data-index=\"${selectedTag.id()}\"]`);\n }\n\n protected setIndex(index: number, scrollToItem: boolean) {\n const $items = this.selectableItems();\n const $dropdown = $items.parent();\n\n if (index < 0) {\n index = $items.length - 1;\n } else if (index >= $items.length) {\n index = 0;\n }\n\n const $item = $items.eq(index);\n\n this.indexTag = app.store.getById('tags', $item.attr('data-index')!);\n\n m.redraw();\n\n if (scrollToItem && this.indexTag) {\n const dropdownScroll = $dropdown.scrollTop()!;\n const dropdownTop = $dropdown.offset()!.top;\n const dropdownBottom = dropdownTop + $dropdown.outerHeight()!;\n const itemTop = $item.offset()!.top;\n const itemBottom = itemTop + $item.outerHeight()!;\n\n let scrollTop;\n if (itemTop < dropdownTop) {\n scrollTop = dropdownScroll - dropdownTop + itemTop - parseInt($dropdown.css('padding-top'), 10);\n } else if (itemBottom > dropdownBottom) {\n scrollTop = dropdownScroll - dropdownBottom + itemBottom + parseInt($dropdown.css('padding-bottom'), 10);\n }\n\n if (typeof scrollTop !== 'undefined') {\n $dropdown.stop(true).animate({ scrollTop }, 100);\n }\n }\n }\n}\n\n/**\n * Catch invalid limits provided to the tag selection modal.\n */\nfunction catchInvalidLimits(limits: ITagSelectionModalLimits) {\n if (limits.min!.primary! > limits.max!.primary!) {\n throw new Error('The minimum number of primary tags allowed cannot be more than the maximum number of primary tags allowed.');\n }\n\n if (limits.min!.secondary! > limits.max!.secondary!) {\n throw new Error('The minimum number of secondary tags allowed cannot be more than the maximum number of secondary tags allowed.');\n }\n\n if (limits.min!.total! > limits.max!.primary! + limits.max!.secondary!) {\n throw new Error('The minimum number of tags allowed cannot be more than the maximum number of primary and secondary tags allowed together.');\n }\n\n if (limits.max!.total! < limits.min!.primary! + limits.min!.secondary!) {\n throw new Error('The maximum number of tags allowed cannot be less than the minimum number of primary and secondary tags allowed together.');\n }\n\n if (limits.min!.total! > limits.max!.total!) {\n throw new Error('The minimum number of tags allowed cannot be more than the maximum number of tags allowed.');\n }\n}\n","import extract from 'flarum/common/utils/extract';\nimport tagLabel from './tagLabel';\nimport sortTags from '../utils/sortTags';\nimport classList from 'flarum/common/utils/classList';\n\nexport default function tagsLabel(tags, attrs = {}) {\n const children = [];\n const { link, ...otherAttrs } = attrs;\n\n otherAttrs.className = classList('TagsLabel', otherAttrs.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","import app from 'flarum/admin/app';\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport TagSelectionModal from '../../common/components/TagSelectionModal';\nimport tagsLabel from '../../common/helpers/tagsLabel';\n\nimport type { CommonSettingsItemOptions } from 'flarum/admin/components/AdminPage';\nimport type Stream from 'flarum/common/utils/Stream';\nimport type { ITagSelectionModalAttrs } from '../../common/components/TagSelectionModal';\nimport type Tag from '../../common/models/Tag';\n\nexport interface SelectTagsSettingComponentOptions extends CommonSettingsItemOptions {\n type: 'flarum-tags.select-tags';\n options?: ITagSelectionModalAttrs;\n}\n\nexport interface SelectTagsSettingComponentAttrs extends SelectTagsSettingComponentOptions {\n settingValue: Stream;\n}\n\nexport default class SelectTagsSettingComponent<\n CustomAttrs extends SelectTagsSettingComponentAttrs = SelectTagsSettingComponentAttrs\n> extends Component {\n protected tags: Tag[] = [];\n protected loaded = false;\n\n view() {\n const value = JSON.parse(this.attrs.settingValue() || '[]');\n\n if (!this.loaded) {\n app.tagList.load(['parent']).then((tags) => {\n this.tags = tags.filter((tag) => value.includes(tag.id()));\n this.loaded = true;\n m.redraw();\n });\n }\n\n return (\n
\n \n {this.attrs.help &&

{this.attrs.help}

}\n {!this.loaded ? (\n \n ) : (\n \n app.modal.show(TagSelectionModal, {\n selectedTags: this.tags,\n onsubmit: (tags: Tag[]) => {\n this.tags = tags;\n this.attrs.settingValue(JSON.stringify(tags.map((tag) => tag.id())));\n },\n ...this.attrs.options,\n })\n }\n >\n {!!this.tags.length ? (\n tagsLabel(this.tags)\n ) : (\n {app.translator.trans('flarum-tags.admin.settings.button_text')}\n )}\n \n )}\n
\n );\n }\n}\n","/**!\n * Sortable 1.15.0\n * @author\tRubaXa \n * @author\towenm \n * @license MIT\n */\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _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}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nvar version = \"1.15.0\";\n\nfunction userAgent(pattern) {\n if (typeof window !== 'undefined' && window.navigator) {\n return !! /*@__PURE__*/navigator.userAgent.match(pattern);\n }\n}\n\nvar IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\\.|msie|iemobile|Windows Phone)/i);\nvar Edge = userAgent(/Edge/i);\nvar FireFox = userAgent(/firefox/i);\nvar Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);\nvar IOS = userAgent(/iP(ad|od|hone)/i);\nvar ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);\n\nvar captureMode = {\n capture: false,\n passive: false\n};\n\nfunction on(el, event, fn) {\n el.addEventListener(event, fn, !IE11OrLess && captureMode);\n}\n\nfunction off(el, event, fn) {\n el.removeEventListener(event, fn, !IE11OrLess && captureMode);\n}\n\nfunction matches(\n/**HTMLElement*/\nel,\n/**String*/\nselector) {\n if (!selector) return;\n selector[0] === '>' && (selector = selector.substring(1));\n\n if (el) {\n try {\n if (el.matches) {\n return el.matches(selector);\n } else if (el.msMatchesSelector) {\n return el.msMatchesSelector(selector);\n } else if (el.webkitMatchesSelector) {\n return el.webkitMatchesSelector(selector);\n }\n } catch (_) {\n return false;\n }\n }\n\n return false;\n}\n\nfunction getParentOrHost(el) {\n return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;\n}\n\nfunction closest(\n/**HTMLElement*/\nel,\n/**String*/\nselector,\n/**HTMLElement*/\nctx, includeCTX) {\n if (el) {\n ctx = ctx || document;\n\n do {\n if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {\n return el;\n }\n\n if (el === ctx) break;\n /* jshint boss:true */\n } while (el = getParentOrHost(el));\n }\n\n return null;\n}\n\nvar R_SPACE = /\\s+/g;\n\nfunction toggleClass(el, name, state) {\n if (el && name) {\n if (el.classList) {\n el.classList[state ? 'add' : 'remove'](name);\n } else {\n var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');\n el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');\n }\n }\n}\n\nfunction css(el, prop, val) {\n var style = el && el.style;\n\n if (style) {\n if (val === void 0) {\n if (document.defaultView && document.defaultView.getComputedStyle) {\n val = document.defaultView.getComputedStyle(el, '');\n } else if (el.currentStyle) {\n val = el.currentStyle;\n }\n\n return prop === void 0 ? val : val[prop];\n } else {\n if (!(prop in style) && prop.indexOf('webkit') === -1) {\n prop = '-webkit-' + prop;\n }\n\n style[prop] = val + (typeof val === 'string' ? '' : 'px');\n }\n }\n}\n\nfunction matrix(el, selfOnly) {\n var appliedTransforms = '';\n\n if (typeof el === 'string') {\n appliedTransforms = el;\n } else {\n do {\n var transform = css(el, 'transform');\n\n if (transform && transform !== 'none') {\n appliedTransforms = transform + ' ' + appliedTransforms;\n }\n /* jshint boss:true */\n\n } while (!selfOnly && (el = el.parentNode));\n }\n\n var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;\n /*jshint -W056 */\n\n return matrixFn && new matrixFn(appliedTransforms);\n}\n\nfunction find(ctx, tagName, iterator) {\n if (ctx) {\n var list = ctx.getElementsByTagName(tagName),\n i = 0,\n n = list.length;\n\n if (iterator) {\n for (; i < n; i++) {\n iterator(list[i], i);\n }\n }\n\n return list;\n }\n\n return [];\n}\n\nfunction getWindowScrollingElement() {\n var scrollingElement = document.scrollingElement;\n\n if (scrollingElement) {\n return scrollingElement;\n } else {\n return document.documentElement;\n }\n}\n/**\n * Returns the \"bounding client rect\" of given element\n * @param {HTMLElement} el The element whose boundingClientRect is wanted\n * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container\n * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr\n * @param {[Boolean]} undoScale Whether the container's scale() should be undone\n * @param {[HTMLElement]} container The parent the element will be placed in\n * @return {Object} The boundingClientRect of el, with specified adjustments\n */\n\n\nfunction getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {\n if (!el.getBoundingClientRect && el !== window) return;\n var elRect, top, left, bottom, right, height, width;\n\n if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {\n elRect = el.getBoundingClientRect();\n top = elRect.top;\n left = elRect.left;\n bottom = elRect.bottom;\n right = elRect.right;\n height = elRect.height;\n width = elRect.width;\n } else {\n top = 0;\n left = 0;\n bottom = window.innerHeight;\n right = window.innerWidth;\n height = window.innerHeight;\n width = window.innerWidth;\n }\n\n if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {\n // Adjust for translate()\n container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)\n // Not needed on <= IE11\n\n if (!IE11OrLess) {\n do {\n if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {\n var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container\n\n top -= containerRect.top + parseInt(css(container, 'border-top-width'));\n left -= containerRect.left + parseInt(css(container, 'border-left-width'));\n bottom = top + elRect.height;\n right = left + elRect.width;\n break;\n }\n /* jshint boss:true */\n\n } while (container = container.parentNode);\n }\n }\n\n if (undoScale && el !== window) {\n // Adjust for scale()\n var elMatrix = matrix(container || el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d;\n\n if (elMatrix) {\n top /= scaleY;\n left /= scaleX;\n width /= scaleX;\n height /= scaleY;\n bottom = top + height;\n right = left + width;\n }\n }\n\n return {\n top: top,\n left: left,\n bottom: bottom,\n right: right,\n width: width,\n height: height\n };\n}\n/**\n * Checks if a side of an element is scrolled past a side of its parents\n * @param {HTMLElement} el The element who's side being scrolled out of view is in question\n * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')\n * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')\n * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element\n */\n\n\nfunction isScrolledPast(el, elSide, parentSide) {\n var parent = getParentAutoScrollElement(el, true),\n elSideVal = getRect(el)[elSide];\n /* jshint boss:true */\n\n while (parent) {\n var parentSideVal = getRect(parent)[parentSide],\n visible = void 0;\n\n if (parentSide === 'top' || parentSide === 'left') {\n visible = elSideVal >= parentSideVal;\n } else {\n visible = elSideVal <= parentSideVal;\n }\n\n if (!visible) return parent;\n if (parent === getWindowScrollingElement()) break;\n parent = getParentAutoScrollElement(parent, false);\n }\n\n return false;\n}\n/**\n * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)\n * and non-draggable elements\n * @param {HTMLElement} el The parent element\n * @param {Number} childNum The index of the child\n * @param {Object} options Parent Sortable's options\n * @return {HTMLElement} The child at index childNum, or null if not found\n */\n\n\nfunction getChild(el, childNum, options, includeDragEl) {\n var currentChild = 0,\n i = 0,\n children = el.children;\n\n while (i < children.length) {\n if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {\n if (currentChild === childNum) {\n return children[i];\n }\n\n currentChild++;\n }\n\n i++;\n }\n\n return null;\n}\n/**\n * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)\n * @param {HTMLElement} el Parent element\n * @param {selector} selector Any other elements that should be ignored\n * @return {HTMLElement} The last child, ignoring ghostEl\n */\n\n\nfunction lastChild(el, selector) {\n var last = el.lastElementChild;\n\n while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {\n last = last.previousElementSibling;\n }\n\n return last || null;\n}\n/**\n * Returns the index of an element within its parent for a selected set of\n * elements\n * @param {HTMLElement} el\n * @param {selector} selector\n * @return {number}\n */\n\n\nfunction index(el, selector) {\n var index = 0;\n\n if (!el || !el.parentNode) {\n return -1;\n }\n /* jshint boss:true */\n\n\n while (el = el.previousElementSibling) {\n if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {\n index++;\n }\n }\n\n return index;\n}\n/**\n * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.\n * The value is returned in real pixels.\n * @param {HTMLElement} el\n * @return {Array} Offsets in the format of [left, top]\n */\n\n\nfunction getRelativeScrollOffset(el) {\n var offsetLeft = 0,\n offsetTop = 0,\n winScroller = getWindowScrollingElement();\n\n if (el) {\n do {\n var elMatrix = matrix(el),\n scaleX = elMatrix.a,\n scaleY = elMatrix.d;\n offsetLeft += el.scrollLeft * scaleX;\n offsetTop += el.scrollTop * scaleY;\n } while (el !== winScroller && (el = el.parentNode));\n }\n\n return [offsetLeft, offsetTop];\n}\n/**\n * Returns the index of the object within the given array\n * @param {Array} arr Array that may or may not hold the object\n * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find\n * @return {Number} The index of the object in the array, or -1\n */\n\n\nfunction indexOfObject(arr, obj) {\n for (var i in arr) {\n if (!arr.hasOwnProperty(i)) continue;\n\n for (var key in obj) {\n if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);\n }\n }\n\n return -1;\n}\n\nfunction getParentAutoScrollElement(el, includeSelf) {\n // skip to window\n if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();\n var elem = el;\n var gotSelf = false;\n\n do {\n // we don't need to get elem css if it isn't even overflowing in the first place (performance)\n if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {\n var elemCSS = css(elem);\n\n if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {\n if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();\n if (gotSelf || includeSelf) return elem;\n gotSelf = true;\n }\n }\n /* jshint boss:true */\n\n } while (elem = elem.parentNode);\n\n return getWindowScrollingElement();\n}\n\nfunction extend(dst, src) {\n if (dst && src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dst[key] = src[key];\n }\n }\n }\n\n return dst;\n}\n\nfunction isRectEqual(rect1, rect2) {\n return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);\n}\n\nvar _throttleTimeout;\n\nfunction throttle(callback, ms) {\n return function () {\n if (!_throttleTimeout) {\n var args = arguments,\n _this = this;\n\n if (args.length === 1) {\n callback.call(_this, args[0]);\n } else {\n callback.apply(_this, args);\n }\n\n _throttleTimeout = setTimeout(function () {\n _throttleTimeout = void 0;\n }, ms);\n }\n };\n}\n\nfunction cancelThrottle() {\n clearTimeout(_throttleTimeout);\n _throttleTimeout = void 0;\n}\n\nfunction scrollBy(el, x, y) {\n el.scrollLeft += x;\n el.scrollTop += y;\n}\n\nfunction clone(el) {\n var Polymer = window.Polymer;\n var $ = window.jQuery || window.Zepto;\n\n if (Polymer && Polymer.dom) {\n return Polymer.dom(el).cloneNode(true);\n } else if ($) {\n return $(el).clone(true)[0];\n } else {\n return el.cloneNode(true);\n }\n}\n\nfunction setRect(el, rect) {\n css(el, 'position', 'absolute');\n css(el, 'top', rect.top);\n css(el, 'left', rect.left);\n css(el, 'width', rect.width);\n css(el, 'height', rect.height);\n}\n\nfunction unsetRect(el) {\n css(el, 'position', '');\n css(el, 'top', '');\n css(el, 'left', '');\n css(el, 'width', '');\n css(el, 'height', '');\n}\n\nvar expando = 'Sortable' + new Date().getTime();\n\nfunction AnimationStateManager() {\n var animationStates = [],\n animationCallbackId;\n return {\n captureAnimationState: function captureAnimationState() {\n animationStates = [];\n if (!this.options.animation) return;\n var children = [].slice.call(this.el.children);\n children.forEach(function (child) {\n if (css(child, 'display') === 'none' || child === Sortable.ghost) return;\n animationStates.push({\n target: child,\n rect: getRect(child)\n });\n\n var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation\n\n\n if (child.thisAnimationDuration) {\n var childMatrix = matrix(child, true);\n\n if (childMatrix) {\n fromRect.top -= childMatrix.f;\n fromRect.left -= childMatrix.e;\n }\n }\n\n child.fromRect = fromRect;\n });\n },\n addAnimationState: function addAnimationState(state) {\n animationStates.push(state);\n },\n removeAnimationState: function removeAnimationState(target) {\n animationStates.splice(indexOfObject(animationStates, {\n target: target\n }), 1);\n },\n animateAll: function animateAll(callback) {\n var _this = this;\n\n if (!this.options.animation) {\n clearTimeout(animationCallbackId);\n if (typeof callback === 'function') callback();\n return;\n }\n\n var animating = false,\n animationTime = 0;\n animationStates.forEach(function (state) {\n var time = 0,\n target = state.target,\n fromRect = target.fromRect,\n toRect = getRect(target),\n prevFromRect = target.prevFromRect,\n prevToRect = target.prevToRect,\n animatingRect = state.rect,\n targetMatrix = matrix(target, true);\n\n if (targetMatrix) {\n // Compensate for current animation\n toRect.top -= targetMatrix.f;\n toRect.left -= targetMatrix.e;\n }\n\n target.toRect = toRect;\n\n if (target.thisAnimationDuration) {\n // Could also check if animatingRect is between fromRect and toRect\n if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect\n (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {\n // If returning to same place as started from animation and on same axis\n time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);\n }\n } // if fromRect != toRect: animate\n\n\n if (!isRectEqual(toRect, fromRect)) {\n target.prevFromRect = fromRect;\n target.prevToRect = toRect;\n\n if (!time) {\n time = _this.options.animation;\n }\n\n _this.animate(target, animatingRect, toRect, time);\n }\n\n if (time) {\n animating = true;\n animationTime = Math.max(animationTime, time);\n clearTimeout(target.animationResetTimer);\n target.animationResetTimer = setTimeout(function () {\n target.animationTime = 0;\n target.prevFromRect = null;\n target.fromRect = null;\n target.prevToRect = null;\n target.thisAnimationDuration = null;\n }, time);\n target.thisAnimationDuration = time;\n }\n });\n clearTimeout(animationCallbackId);\n\n if (!animating) {\n if (typeof callback === 'function') callback();\n } else {\n animationCallbackId = setTimeout(function () {\n if (typeof callback === 'function') callback();\n }, animationTime);\n }\n\n animationStates = [];\n },\n animate: function animate(target, currentRect, toRect, duration) {\n if (duration) {\n css(target, 'transition', '');\n css(target, 'transform', '');\n var elMatrix = matrix(this.el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d,\n translateX = (currentRect.left - toRect.left) / (scaleX || 1),\n translateY = (currentRect.top - toRect.top) / (scaleY || 1);\n target.animatingX = !!translateX;\n target.animatingY = !!translateY;\n css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');\n this.forRepaintDummy = repaint(target); // repaint\n\n css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));\n css(target, 'transform', 'translate3d(0,0,0)');\n typeof target.animated === 'number' && clearTimeout(target.animated);\n target.animated = setTimeout(function () {\n css(target, 'transition', '');\n css(target, 'transform', '');\n target.animated = false;\n target.animatingX = false;\n target.animatingY = false;\n }, duration);\n }\n }\n };\n}\n\nfunction repaint(target) {\n return target.offsetWidth;\n}\n\nfunction calculateRealTime(animatingRect, fromRect, toRect, options) {\n return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;\n}\n\nvar plugins = [];\nvar defaults = {\n initializeByDefault: true\n};\nvar PluginManager = {\n mount: function mount(plugin) {\n // Set default static properties\n for (var option in defaults) {\n if (defaults.hasOwnProperty(option) && !(option in plugin)) {\n plugin[option] = defaults[option];\n }\n }\n\n plugins.forEach(function (p) {\n if (p.pluginName === plugin.pluginName) {\n throw \"Sortable: Cannot mount plugin \".concat(plugin.pluginName, \" more than once\");\n }\n });\n plugins.push(plugin);\n },\n pluginEvent: function pluginEvent(eventName, sortable, evt) {\n var _this = this;\n\n this.eventCanceled = false;\n\n evt.cancel = function () {\n _this.eventCanceled = true;\n };\n\n var eventNameGlobal = eventName + 'Global';\n plugins.forEach(function (plugin) {\n if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable\n\n if (sortable[plugin.pluginName][eventNameGlobal]) {\n sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({\n sortable: sortable\n }, evt));\n } // Only fire plugin event if plugin is enabled in this sortable,\n // and plugin has event defined\n\n\n if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {\n sortable[plugin.pluginName][eventName](_objectSpread2({\n sortable: sortable\n }, evt));\n }\n });\n },\n initializePlugins: function initializePlugins(sortable, el, defaults, options) {\n plugins.forEach(function (plugin) {\n var pluginName = plugin.pluginName;\n if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;\n var initialized = new plugin(sortable, el, sortable.options);\n initialized.sortable = sortable;\n initialized.options = sortable.options;\n sortable[pluginName] = initialized; // Add default options from plugin\n\n _extends(defaults, initialized.defaults);\n });\n\n for (var option in sortable.options) {\n if (!sortable.options.hasOwnProperty(option)) continue;\n var modified = this.modifyOption(sortable, option, sortable.options[option]);\n\n if (typeof modified !== 'undefined') {\n sortable.options[option] = modified;\n }\n }\n },\n getEventProperties: function getEventProperties(name, sortable) {\n var eventProperties = {};\n plugins.forEach(function (plugin) {\n if (typeof plugin.eventProperties !== 'function') return;\n\n _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));\n });\n return eventProperties;\n },\n modifyOption: function modifyOption(sortable, name, value) {\n var modifiedValue;\n plugins.forEach(function (plugin) {\n // Plugin must exist on the Sortable\n if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin\n\n if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {\n modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);\n }\n });\n return modifiedValue;\n }\n};\n\nfunction dispatchEvent(_ref) {\n var sortable = _ref.sortable,\n rootEl = _ref.rootEl,\n name = _ref.name,\n targetEl = _ref.targetEl,\n cloneEl = _ref.cloneEl,\n toEl = _ref.toEl,\n fromEl = _ref.fromEl,\n oldIndex = _ref.oldIndex,\n newIndex = _ref.newIndex,\n oldDraggableIndex = _ref.oldDraggableIndex,\n newDraggableIndex = _ref.newDraggableIndex,\n originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n extraEventProperties = _ref.extraEventProperties;\n sortable = sortable || rootEl && rootEl[expando];\n if (!sortable) return;\n var evt,\n options = sortable.options,\n onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature\n\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent(name, {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent(name, true, true);\n }\n\n evt.to = toEl || rootEl;\n evt.from = fromEl || rootEl;\n evt.item = targetEl || rootEl;\n evt.clone = cloneEl;\n evt.oldIndex = oldIndex;\n evt.newIndex = newIndex;\n evt.oldDraggableIndex = oldDraggableIndex;\n evt.newDraggableIndex = newDraggableIndex;\n evt.originalEvent = originalEvent;\n evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;\n\n var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));\n\n for (var option in allEventProperties) {\n evt[option] = allEventProperties[option];\n }\n\n if (rootEl) {\n rootEl.dispatchEvent(evt);\n }\n\n if (options[onName]) {\n options[onName].call(sortable, evt);\n }\n}\n\nvar _excluded = [\"evt\"];\n\nvar pluginEvent = function pluginEvent(eventName, sortable) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n originalEvent = _ref.evt,\n data = _objectWithoutProperties(_ref, _excluded);\n\n PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({\n dragEl: dragEl,\n parentEl: parentEl,\n ghostEl: ghostEl,\n rootEl: rootEl,\n nextEl: nextEl,\n lastDownEl: lastDownEl,\n cloneEl: cloneEl,\n cloneHidden: cloneHidden,\n dragStarted: moved,\n putSortable: putSortable,\n activeSortable: Sortable.active,\n originalEvent: originalEvent,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n hideGhostForTarget: _hideGhostForTarget,\n unhideGhostForTarget: _unhideGhostForTarget,\n cloneNowHidden: function cloneNowHidden() {\n cloneHidden = true;\n },\n cloneNowShown: function cloneNowShown() {\n cloneHidden = false;\n },\n dispatchSortableEvent: function dispatchSortableEvent(name) {\n _dispatchEvent({\n sortable: sortable,\n name: name,\n originalEvent: originalEvent\n });\n }\n }, data));\n};\n\nfunction _dispatchEvent(info) {\n dispatchEvent(_objectSpread2({\n putSortable: putSortable,\n cloneEl: cloneEl,\n targetEl: dragEl,\n rootEl: rootEl,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex\n }, info));\n}\n\nvar dragEl,\n parentEl,\n ghostEl,\n rootEl,\n nextEl,\n lastDownEl,\n cloneEl,\n cloneHidden,\n oldIndex,\n newIndex,\n oldDraggableIndex,\n newDraggableIndex,\n activeGroup,\n putSortable,\n awaitingDragStarted = false,\n ignoreNextClick = false,\n sortables = [],\n tapEvt,\n touchEvt,\n lastDx,\n lastDy,\n tapDistanceLeft,\n tapDistanceTop,\n moved,\n lastTarget,\n lastDirection,\n pastFirstInvertThresh = false,\n isCircumstantialInvert = false,\n targetMoveDistance,\n // For positioning ghost absolutely\nghostRelativeParent,\n ghostRelativeParentInitialScroll = [],\n // (left, top)\n_silent = false,\n savedInputChecked = [];\n/** @const */\n\nvar documentExists = typeof document !== 'undefined',\n PositionGhostAbsolutely = IOS,\n CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',\n // This will not pass for IE9, because IE9 DnD only works on anchors\nsupportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),\n supportCssPointerEvents = function () {\n if (!documentExists) return; // false when <= IE11\n\n if (IE11OrLess) {\n return false;\n }\n\n var el = document.createElement('x');\n el.style.cssText = 'pointer-events:auto';\n return el.style.pointerEvents === 'auto';\n}(),\n _detectDirection = function _detectDirection(el, options) {\n var elCSS = css(el),\n elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),\n child1 = getChild(el, 0, options),\n child2 = getChild(el, 1, options),\n firstChildCSS = child1 && css(child1),\n secondChildCSS = child2 && css(child2),\n firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,\n secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;\n\n if (elCSS.display === 'flex') {\n return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';\n }\n\n if (elCSS.display === 'grid') {\n return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';\n }\n\n if (child1 && firstChildCSS[\"float\"] && firstChildCSS[\"float\"] !== 'none') {\n var touchingSideChild2 = firstChildCSS[\"float\"] === 'left' ? 'left' : 'right';\n return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';\n }\n\n return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';\n},\n _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {\n var dragElS1Opp = vertical ? dragRect.left : dragRect.top,\n dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,\n dragElOppLength = vertical ? dragRect.width : dragRect.height,\n targetS1Opp = vertical ? targetRect.left : targetRect.top,\n targetS2Opp = vertical ? targetRect.right : targetRect.bottom,\n targetOppLength = vertical ? targetRect.width : targetRect.height;\n return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;\n},\n\n/**\r\n * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\r\n * @param {Number} x X position\r\n * @param {Number} y Y position\r\n * @return {HTMLElement} Element of the first found nearest Sortable\r\n */\n_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {\n var ret;\n sortables.some(function (sortable) {\n var threshold = sortable[expando].options.emptyInsertThreshold;\n if (!threshold || lastChild(sortable)) return;\n var rect = getRect(sortable),\n insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,\n insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;\n\n if (insideHorizontally && insideVertically) {\n return ret = sortable;\n }\n });\n return ret;\n},\n _prepareGroup = function _prepareGroup(options) {\n function toFn(value, pull) {\n return function (to, from, dragEl, evt) {\n var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;\n\n if (value == null && (pull || sameGroup)) {\n // Default pull value\n // Default pull and put value if same group\n return true;\n } else if (value == null || value === false) {\n return false;\n } else if (pull && value === 'clone') {\n return value;\n } else if (typeof value === 'function') {\n return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);\n } else {\n var otherGroup = (pull ? to : from).options.group.name;\n return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;\n }\n };\n }\n\n var group = {};\n var originalGroup = options.group;\n\n if (!originalGroup || _typeof(originalGroup) != 'object') {\n originalGroup = {\n name: originalGroup\n };\n }\n\n group.name = originalGroup.name;\n group.checkPull = toFn(originalGroup.pull, true);\n group.checkPut = toFn(originalGroup.put);\n group.revertClone = originalGroup.revertClone;\n options.group = group;\n},\n _hideGhostForTarget = function _hideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', 'none');\n }\n},\n _unhideGhostForTarget = function _unhideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', '');\n }\n}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position\n\n\nif (documentExists && !ChromeForAndroid) {\n document.addEventListener('click', function (evt) {\n if (ignoreNextClick) {\n evt.preventDefault();\n evt.stopPropagation && evt.stopPropagation();\n evt.stopImmediatePropagation && evt.stopImmediatePropagation();\n ignoreNextClick = false;\n return false;\n }\n }, true);\n}\n\nvar nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {\n if (dragEl) {\n evt = evt.touches ? evt.touches[0] : evt;\n\n var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);\n\n if (nearest) {\n // Create imitation event\n var event = {};\n\n for (var i in evt) {\n if (evt.hasOwnProperty(i)) {\n event[i] = evt[i];\n }\n }\n\n event.target = event.rootEl = nearest;\n event.preventDefault = void 0;\n event.stopPropagation = void 0;\n\n nearest[expando]._onDragOver(event);\n }\n }\n};\n\nvar _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {\n if (dragEl) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n }\n};\n/**\r\n * @class Sortable\r\n * @param {HTMLElement} el\r\n * @param {Object} [options]\r\n */\n\n\nfunction Sortable(el, options) {\n if (!(el && el.nodeType && el.nodeType === 1)) {\n throw \"Sortable: `el` must be an HTMLElement, not \".concat({}.toString.call(el));\n }\n\n this.el = el; // root element\n\n this.options = options = _extends({}, options); // Export instance\n\n el[expando] = this;\n var defaults = {\n group: null,\n sort: true,\n disabled: false,\n store: null,\n handle: null,\n draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',\n swapThreshold: 1,\n // percentage; 0 <= x <= 1\n invertSwap: false,\n // invert always\n invertedSwapThreshold: null,\n // will be set to same as swapThreshold if default\n removeCloneOnHide: true,\n direction: function direction() {\n return _detectDirection(el, this.options);\n },\n ghostClass: 'sortable-ghost',\n chosenClass: 'sortable-chosen',\n dragClass: 'sortable-drag',\n ignore: 'a, img',\n filter: null,\n preventOnFilter: true,\n animation: 0,\n easing: null,\n setData: function setData(dataTransfer, dragEl) {\n dataTransfer.setData('Text', dragEl.textContent);\n },\n dropBubble: false,\n dragoverBubble: false,\n dataIdAttr: 'data-id',\n delay: 0,\n delayOnTouchOnly: false,\n touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,\n forceFallback: false,\n fallbackClass: 'sortable-fallback',\n fallbackOnBody: false,\n fallbackTolerance: 0,\n fallbackOffset: {\n x: 0,\n y: 0\n },\n supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,\n emptyInsertThreshold: 5\n };\n PluginManager.initializePlugins(this, el, defaults); // Set default options\n\n for (var name in defaults) {\n !(name in options) && (options[name] = defaults[name]);\n }\n\n _prepareGroup(options); // Bind all private methods\n\n\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n } // Setup drag mode\n\n\n this.nativeDraggable = options.forceFallback ? false : supportDraggable;\n\n if (this.nativeDraggable) {\n // Touch start threshold cannot be greater than the native dragstart threshold\n this.options.touchStartThreshold = 1;\n } // Bind events\n\n\n if (options.supportPointer) {\n on(el, 'pointerdown', this._onTapStart);\n } else {\n on(el, 'mousedown', this._onTapStart);\n on(el, 'touchstart', this._onTapStart);\n }\n\n if (this.nativeDraggable) {\n on(el, 'dragover', this);\n on(el, 'dragenter', this);\n }\n\n sortables.push(this.el); // Restore sorting\n\n options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager\n\n _extends(this, AnimationStateManager());\n}\n\nSortable.prototype =\n/** @lends Sortable.prototype */\n{\n constructor: Sortable,\n _isOutsideThisEl: function _isOutsideThisEl(target) {\n if (!this.el.contains(target) && target !== this.el) {\n lastTarget = null;\n }\n },\n _getDirection: function _getDirection(evt, target) {\n return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;\n },\n _onTapStart: function _onTapStart(\n /** Event|TouchEvent */\n evt) {\n if (!evt.cancelable) return;\n\n var _this = this,\n el = this.el,\n options = this.options,\n preventOnFilter = options.preventOnFilter,\n type = evt.type,\n touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,\n target = (touch || evt).target,\n originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,\n filter = options.filter;\n\n _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.\n\n\n if (dragEl) {\n return;\n }\n\n if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {\n return; // only left button and enabled\n } // cancel dnd if original target is content editable\n\n\n if (originalTarget.isContentEditable) {\n return;\n } // Safari ignores further event handling after mousedown\n\n\n if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {\n return;\n }\n\n target = closest(target, options.draggable, el, false);\n\n if (target && target.animated) {\n return;\n }\n\n if (lastDownEl === target) {\n // Ignoring duplicate `down`\n return;\n } // Get the index of the dragged element within its parent\n\n\n oldIndex = index(target);\n oldDraggableIndex = index(target, options.draggable); // Check filter\n\n if (typeof filter === 'function') {\n if (filter.call(this, evt, target, this)) {\n _dispatchEvent({\n sortable: _this,\n rootEl: originalTarget,\n name: 'filter',\n targetEl: target,\n toEl: el,\n fromEl: el\n });\n\n pluginEvent('filter', _this, {\n evt: evt\n });\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n } else if (filter) {\n filter = filter.split(',').some(function (criteria) {\n criteria = closest(originalTarget, criteria.trim(), el, false);\n\n if (criteria) {\n _dispatchEvent({\n sortable: _this,\n rootEl: criteria,\n name: 'filter',\n targetEl: target,\n fromEl: el,\n toEl: el\n });\n\n pluginEvent('filter', _this, {\n evt: evt\n });\n return true;\n }\n });\n\n if (filter) {\n preventOnFilter && evt.cancelable && evt.preventDefault();\n return; // cancel dnd\n }\n }\n\n if (options.handle && !closest(originalTarget, options.handle, el, false)) {\n return;\n } // Prepare `dragstart`\n\n\n this._prepareDragStart(evt, touch, target);\n },\n _prepareDragStart: function _prepareDragStart(\n /** Event */\n evt,\n /** Touch */\n touch,\n /** HTMLElement */\n target) {\n var _this = this,\n el = _this.el,\n options = _this.options,\n ownerDocument = el.ownerDocument,\n dragStartFn;\n\n if (target && !dragEl && target.parentNode === el) {\n var dragRect = getRect(target);\n rootEl = el;\n dragEl = target;\n parentEl = dragEl.parentNode;\n nextEl = dragEl.nextSibling;\n lastDownEl = target;\n activeGroup = options.group;\n Sortable.dragged = dragEl;\n tapEvt = {\n target: dragEl,\n clientX: (touch || evt).clientX,\n clientY: (touch || evt).clientY\n };\n tapDistanceLeft = tapEvt.clientX - dragRect.left;\n tapDistanceTop = tapEvt.clientY - dragRect.top;\n this._lastX = (touch || evt).clientX;\n this._lastY = (touch || evt).clientY;\n dragEl.style['will-change'] = 'all';\n\n dragStartFn = function dragStartFn() {\n pluginEvent('delayEnded', _this, {\n evt: evt\n });\n\n if (Sortable.eventCanceled) {\n _this._onDrop();\n\n return;\n } // Delayed drag has been triggered\n // we can re-enable the events: touchmove/mousemove\n\n\n _this._disableDelayedDragEvents();\n\n if (!FireFox && _this.nativeDraggable) {\n dragEl.draggable = true;\n } // Bind the events: dragstart/dragend\n\n\n _this._triggerDragStart(evt, touch); // Drag start event\n\n\n _dispatchEvent({\n sortable: _this,\n name: 'choose',\n originalEvent: evt\n }); // Chosen item\n\n\n toggleClass(dragEl, options.chosenClass, true);\n }; // Disable \"draggable\"\n\n\n options.ignore.split(',').forEach(function (criteria) {\n find(dragEl, criteria.trim(), _disableDraggable);\n });\n on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mouseup', _this._onDrop);\n on(ownerDocument, 'touchend', _this._onDrop);\n on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)\n\n if (FireFox && this.nativeDraggable) {\n this.options.touchStartThreshold = 4;\n dragEl.draggable = true;\n }\n\n pluginEvent('delayStart', this, {\n evt: evt\n }); // Delay is impossible for native DnD in Edge or IE\n\n if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {\n if (Sortable.eventCanceled) {\n this._onDrop();\n\n return;\n } // If the user moves the pointer or let go the click or touch\n // before the delay has been reached:\n // disable the delayed drag\n\n\n on(ownerDocument, 'mouseup', _this._disableDelayedDrag);\n on(ownerDocument, 'touchend', _this._disableDelayedDrag);\n on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);\n on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);\n on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);\n options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);\n _this._dragStartTimer = setTimeout(dragStartFn, options.delay);\n } else {\n dragStartFn();\n }\n }\n },\n _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(\n /** TouchEvent|PointerEvent **/\n e) {\n var touch = e.touches ? e.touches[0] : e;\n\n if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {\n this._disableDelayedDrag();\n }\n },\n _disableDelayedDrag: function _disableDelayedDrag() {\n dragEl && _disableDraggable(dragEl);\n clearTimeout(this._dragStartTimer);\n\n this._disableDelayedDragEvents();\n },\n _disableDelayedDragEvents: function _disableDelayedDragEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._disableDelayedDrag);\n off(ownerDocument, 'touchend', this._disableDelayedDrag);\n off(ownerDocument, 'touchcancel', this._disableDelayedDrag);\n off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);\n },\n _triggerDragStart: function _triggerDragStart(\n /** Event */\n evt,\n /** Touch */\n touch) {\n touch = touch || evt.pointerType == 'touch' && evt;\n\n if (!this.nativeDraggable || touch) {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._onTouchMove);\n } else if (touch) {\n on(document, 'touchmove', this._onTouchMove);\n } else {\n on(document, 'mousemove', this._onTouchMove);\n }\n } else {\n on(dragEl, 'dragend', this);\n on(rootEl, 'dragstart', this._onDragStart);\n }\n\n try {\n if (document.selection) {\n // Timeout neccessary for IE9\n _nextTick(function () {\n document.selection.empty();\n });\n } else {\n window.getSelection().removeAllRanges();\n }\n } catch (err) {}\n },\n _dragStarted: function _dragStarted(fallback, evt) {\n\n awaitingDragStarted = false;\n\n if (rootEl && dragEl) {\n pluginEvent('dragStarted', this, {\n evt: evt\n });\n\n if (this.nativeDraggable) {\n on(document, 'dragover', _checkOutsideTargetEl);\n }\n\n var options = this.options; // Apply effect\n\n !fallback && toggleClass(dragEl, options.dragClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n Sortable.active = this;\n fallback && this._appendGhost(); // Drag start event\n\n _dispatchEvent({\n sortable: this,\n name: 'start',\n originalEvent: evt\n });\n } else {\n this._nulling();\n }\n },\n _emulateDragOver: function _emulateDragOver() {\n if (touchEvt) {\n this._lastX = touchEvt.clientX;\n this._lastY = touchEvt.clientY;\n\n _hideGhostForTarget();\n\n var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n var parent = target;\n\n while (target && target.shadowRoot) {\n target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n if (target === parent) break;\n parent = target;\n }\n\n dragEl.parentNode[expando]._isOutsideThisEl(target);\n\n if (parent) {\n do {\n if (parent[expando]) {\n var inserted = void 0;\n inserted = parent[expando]._onDragOver({\n clientX: touchEvt.clientX,\n clientY: touchEvt.clientY,\n target: target,\n rootEl: parent\n });\n\n if (inserted && !this.options.dragoverBubble) {\n break;\n }\n }\n\n target = parent; // store last element\n }\n /* jshint boss:true */\n while (parent = parent.parentNode);\n }\n\n _unhideGhostForTarget();\n }\n },\n _onTouchMove: function _onTouchMove(\n /**TouchEvent*/\n evt) {\n if (tapEvt) {\n var options = this.options,\n fallbackTolerance = options.fallbackTolerance,\n fallbackOffset = options.fallbackOffset,\n touch = evt.touches ? evt.touches[0] : evt,\n ghostMatrix = ghostEl && matrix(ghostEl, true),\n scaleX = ghostEl && ghostMatrix && ghostMatrix.a,\n scaleY = ghostEl && ghostMatrix && ghostMatrix.d,\n relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),\n dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),\n dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging\n\n if (!Sortable.active && !awaitingDragStarted) {\n if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {\n return;\n }\n\n this._onDragStart(evt, true);\n }\n\n if (ghostEl) {\n if (ghostMatrix) {\n ghostMatrix.e += dx - (lastDx || 0);\n ghostMatrix.f += dy - (lastDy || 0);\n } else {\n ghostMatrix = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: dx,\n f: dy\n };\n }\n\n var cssMatrix = \"matrix(\".concat(ghostMatrix.a, \",\").concat(ghostMatrix.b, \",\").concat(ghostMatrix.c, \",\").concat(ghostMatrix.d, \",\").concat(ghostMatrix.e, \",\").concat(ghostMatrix.f, \")\");\n css(ghostEl, 'webkitTransform', cssMatrix);\n css(ghostEl, 'mozTransform', cssMatrix);\n css(ghostEl, 'msTransform', cssMatrix);\n css(ghostEl, 'transform', cssMatrix);\n lastDx = dx;\n lastDy = dy;\n touchEvt = touch;\n }\n\n evt.cancelable && evt.preventDefault();\n }\n },\n _appendGhost: function _appendGhost() {\n // Bug if using scale(): https://stackoverflow.com/questions/2637058\n // Not being adjusted for\n if (!ghostEl) {\n var container = this.options.fallbackOnBody ? document.body : rootEl,\n rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),\n options = this.options; // Position absolutely\n\n if (PositionGhostAbsolutely) {\n // Get relatively positioned parent\n ghostRelativeParent = container;\n\n while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {\n ghostRelativeParent = ghostRelativeParent.parentNode;\n }\n\n if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {\n if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();\n rect.top += ghostRelativeParent.scrollTop;\n rect.left += ghostRelativeParent.scrollLeft;\n } else {\n ghostRelativeParent = getWindowScrollingElement();\n }\n\n ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);\n }\n\n ghostEl = dragEl.cloneNode(true);\n toggleClass(ghostEl, options.ghostClass, false);\n toggleClass(ghostEl, options.fallbackClass, true);\n toggleClass(ghostEl, options.dragClass, true);\n css(ghostEl, 'transition', '');\n css(ghostEl, 'transform', '');\n css(ghostEl, 'box-sizing', 'border-box');\n css(ghostEl, 'margin', 0);\n css(ghostEl, 'top', rect.top);\n css(ghostEl, 'left', rect.left);\n css(ghostEl, 'width', rect.width);\n css(ghostEl, 'height', rect.height);\n css(ghostEl, 'opacity', '0.8');\n css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');\n css(ghostEl, 'zIndex', '100000');\n css(ghostEl, 'pointerEvents', 'none');\n Sortable.ghost = ghostEl;\n container.appendChild(ghostEl); // Set transform-origin\n\n css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');\n }\n },\n _onDragStart: function _onDragStart(\n /**Event*/\n evt,\n /**boolean*/\n fallback) {\n var _this = this;\n\n var dataTransfer = evt.dataTransfer;\n var options = _this.options;\n pluginEvent('dragStart', this, {\n evt: evt\n });\n\n if (Sortable.eventCanceled) {\n this._onDrop();\n\n return;\n }\n\n pluginEvent('setupClone', this);\n\n if (!Sortable.eventCanceled) {\n cloneEl = clone(dragEl);\n cloneEl.removeAttribute(\"id\");\n cloneEl.draggable = false;\n cloneEl.style['will-change'] = '';\n\n this._hideClone();\n\n toggleClass(cloneEl, this.options.chosenClass, false);\n Sortable.clone = cloneEl;\n } // #1143: IFrame support workaround\n\n\n _this.cloneId = _nextTick(function () {\n pluginEvent('clone', _this);\n if (Sortable.eventCanceled) return;\n\n if (!_this.options.removeCloneOnHide) {\n rootEl.insertBefore(cloneEl, dragEl);\n }\n\n _this._hideClone();\n\n _dispatchEvent({\n sortable: _this,\n name: 'clone'\n });\n });\n !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events\n\n if (fallback) {\n ignoreNextClick = true;\n _this._loopId = setInterval(_this._emulateDragOver, 50);\n } else {\n // Undo what was set in _prepareDragStart before drag started\n off(document, 'mouseup', _this._onDrop);\n off(document, 'touchend', _this._onDrop);\n off(document, 'touchcancel', _this._onDrop);\n\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move';\n options.setData && options.setData.call(_this, dataTransfer, dragEl);\n }\n\n on(document, 'drop', _this); // #1276 fix:\n\n css(dragEl, 'transform', 'translateZ(0)');\n }\n\n awaitingDragStarted = true;\n _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));\n on(document, 'selectstart', _this);\n moved = true;\n\n if (Safari) {\n css(document.body, 'user-select', 'none');\n }\n },\n // Returns true - if no further action is needed (either inserted or another condition)\n _onDragOver: function _onDragOver(\n /**Event*/\n evt) {\n var el = this.el,\n target = evt.target,\n dragRect,\n targetRect,\n revert,\n options = this.options,\n group = options.group,\n activeSortable = Sortable.active,\n isOwner = activeGroup === group,\n canSort = options.sort,\n fromSortable = putSortable || activeSortable,\n vertical,\n _this = this,\n completedFired = false;\n\n if (_silent) return;\n\n function dragOverEvent(name, extra) {\n pluginEvent(name, _this, _objectSpread2({\n evt: evt,\n isOwner: isOwner,\n axis: vertical ? 'vertical' : 'horizontal',\n revert: revert,\n dragRect: dragRect,\n targetRect: targetRect,\n canSort: canSort,\n fromSortable: fromSortable,\n target: target,\n completed: completed,\n onMove: function onMove(target, after) {\n return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);\n },\n changed: changed\n }, extra));\n } // Capture animation state\n\n\n function capture() {\n dragOverEvent('dragOverAnimationCapture');\n\n _this.captureAnimationState();\n\n if (_this !== fromSortable) {\n fromSortable.captureAnimationState();\n }\n } // Return invocation when dragEl is inserted (or completed)\n\n\n function completed(insertion) {\n dragOverEvent('dragOverCompleted', {\n insertion: insertion\n });\n\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n } else {\n activeSortable._showClone(_this);\n }\n\n if (_this !== fromSortable) {\n // Set ghost class to new sortable's ghost class\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n }\n\n if (putSortable !== _this && _this !== Sortable.active) {\n putSortable = _this;\n } else if (_this === Sortable.active && putSortable) {\n putSortable = null;\n } // Animation\n\n\n if (fromSortable === _this) {\n _this._ignoreWhileAnimating = target;\n }\n\n _this.animateAll(function () {\n dragOverEvent('dragOverAnimationComplete');\n _this._ignoreWhileAnimating = null;\n });\n\n if (_this !== fromSortable) {\n fromSortable.animateAll();\n fromSortable._ignoreWhileAnimating = null;\n }\n } // Null lastTarget if it is not inside a previously swapped element\n\n\n if (target === dragEl && !dragEl.animated || target === el && !target.animated) {\n lastTarget = null;\n } // no bubbling and not fallback\n\n\n if (!options.dragoverBubble && !evt.rootEl && target !== document) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted\n\n\n !insertion && nearestEmptyInsertDetectEvent(evt);\n }\n\n !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();\n return completedFired = true;\n } // Call when dragEl has been inserted\n\n\n function changed() {\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n\n _dispatchEvent({\n sortable: _this,\n name: 'change',\n toEl: el,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n originalEvent: evt\n });\n }\n\n if (evt.preventDefault !== void 0) {\n evt.cancelable && evt.preventDefault();\n }\n\n target = closest(target, options.draggable, el, true);\n dragOverEvent('dragOver');\n if (Sortable.eventCanceled) return completedFired;\n\n if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {\n return completed(false);\n }\n\n ignoreNextClick = false;\n\n if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list\n : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {\n vertical = this._getDirection(evt, target) === 'vertical';\n dragRect = getRect(dragEl);\n dragOverEvent('dragOverValid');\n if (Sortable.eventCanceled) return completedFired;\n\n if (revert) {\n parentEl = rootEl; // actualization\n\n capture();\n\n this._hideClone();\n\n dragOverEvent('revert');\n\n if (!Sortable.eventCanceled) {\n if (nextEl) {\n rootEl.insertBefore(dragEl, nextEl);\n } else {\n rootEl.appendChild(dragEl);\n }\n }\n\n return completed(true);\n }\n\n var elLastChild = lastChild(el, options.draggable);\n\n if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {\n // Insert to end of list\n // If already at end of list: Do not insert\n if (elLastChild === dragEl) {\n return completed(false);\n } // if there is a last element, it is the target\n\n\n if (elLastChild && el === evt.target) {\n target = elLastChild;\n }\n\n if (target) {\n targetRect = getRect(target);\n }\n\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {\n capture();\n\n if (elLastChild && elLastChild.nextSibling) {\n // the last draggable element is not the last node\n el.insertBefore(dragEl, elLastChild.nextSibling);\n } else {\n el.appendChild(dragEl);\n }\n\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {\n // Insert to start of list\n var firstChild = getChild(el, 0, options, true);\n\n if (firstChild === dragEl) {\n return completed(false);\n }\n\n target = firstChild;\n targetRect = getRect(target);\n\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {\n capture();\n el.insertBefore(dragEl, firstChild);\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (target.parentNode === el) {\n targetRect = getRect(target);\n var direction = 0,\n targetBeforeFirstSwap,\n differentLevel = dragEl.parentNode !== el,\n differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),\n side1 = vertical ? 'top' : 'left',\n scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),\n scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;\n\n if (lastTarget !== target) {\n targetBeforeFirstSwap = targetRect[side1];\n pastFirstInvertThresh = false;\n isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;\n }\n\n direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);\n var sibling;\n\n if (direction !== 0) {\n // Check if target is beside dragEl in respective direction (ignoring hidden elements)\n var dragIndex = index(dragEl);\n\n do {\n dragIndex -= direction;\n sibling = parentEl.children[dragIndex];\n } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));\n } // If dragEl is already beside target: Do not insert\n\n\n if (direction === 0 || sibling === target) {\n return completed(false);\n }\n\n lastTarget = target;\n lastDirection = direction;\n var nextSibling = target.nextElementSibling,\n after = false;\n after = direction === 1;\n\n var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);\n\n if (moveVector !== false) {\n if (moveVector === 1 || moveVector === -1) {\n after = moveVector === 1;\n }\n\n _silent = true;\n setTimeout(_unsilent, 30);\n capture();\n\n if (after && !nextSibling) {\n el.appendChild(dragEl);\n } else {\n target.parentNode.insertBefore(dragEl, after ? nextSibling : target);\n } // Undo chrome's scroll adjustment (has no effect on other browsers)\n\n\n if (scrolledPastTop) {\n scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);\n }\n\n parentEl = dragEl.parentNode; // actualization\n // must be done before animation\n\n if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {\n targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);\n }\n\n changed();\n return completed(true);\n }\n }\n\n if (el.contains(dragEl)) {\n return completed(false);\n }\n }\n\n return false;\n },\n _ignoreWhileAnimating: null,\n _offMoveEvents: function _offMoveEvents() {\n off(document, 'mousemove', this._onTouchMove);\n off(document, 'touchmove', this._onTouchMove);\n off(document, 'pointermove', this._onTouchMove);\n off(document, 'dragover', nearestEmptyInsertDetectEvent);\n off(document, 'mousemove', nearestEmptyInsertDetectEvent);\n off(document, 'touchmove', nearestEmptyInsertDetectEvent);\n },\n _offUpEvents: function _offUpEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._onDrop);\n off(ownerDocument, 'touchend', this._onDrop);\n off(ownerDocument, 'pointerup', this._onDrop);\n off(ownerDocument, 'touchcancel', this._onDrop);\n off(document, 'selectstart', this);\n },\n _onDrop: function _onDrop(\n /**Event*/\n evt) {\n var el = this.el,\n options = this.options; // Get the index of the dragged element within its parent\n\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n pluginEvent('drop', this, {\n evt: evt\n });\n parentEl = dragEl && dragEl.parentNode; // Get again after plugin event\n\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n\n if (Sortable.eventCanceled) {\n this._nulling();\n\n return;\n }\n\n awaitingDragStarted = false;\n isCircumstantialInvert = false;\n pastFirstInvertThresh = false;\n clearInterval(this._loopId);\n clearTimeout(this._dragStartTimer);\n\n _cancelNextTick(this.cloneId);\n\n _cancelNextTick(this._dragStartId); // Unbind events\n\n\n if (this.nativeDraggable) {\n off(document, 'drop', this);\n off(el, 'dragstart', this._onDragStart);\n }\n\n this._offMoveEvents();\n\n this._offUpEvents();\n\n if (Safari) {\n css(document.body, 'user-select', '');\n }\n\n css(dragEl, 'transform', '');\n\n if (evt) {\n if (moved) {\n evt.cancelable && evt.preventDefault();\n !options.dropBubble && evt.stopPropagation();\n }\n\n ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);\n\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n // Remove clone(s)\n cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);\n }\n\n if (dragEl) {\n if (this.nativeDraggable) {\n off(dragEl, 'dragend', this);\n }\n\n _disableDraggable(dragEl);\n\n dragEl.style['will-change'] = ''; // Remove classes\n // ghostClass is added in dragStarted\n\n if (moved && !awaitingDragStarted) {\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);\n }\n\n toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event\n\n _dispatchEvent({\n sortable: this,\n name: 'unchoose',\n toEl: parentEl,\n newIndex: null,\n newDraggableIndex: null,\n originalEvent: evt\n });\n\n if (rootEl !== parentEl) {\n if (newIndex >= 0) {\n // Add event\n _dispatchEvent({\n rootEl: parentEl,\n name: 'add',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n }); // Remove event\n\n\n _dispatchEvent({\n sortable: this,\n name: 'remove',\n toEl: parentEl,\n originalEvent: evt\n }); // drag from one list and drop into another\n\n\n _dispatchEvent({\n rootEl: parentEl,\n name: 'sort',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n\n putSortable && putSortable.save();\n } else {\n if (newIndex !== oldIndex) {\n if (newIndex >= 0) {\n // drag & drop within the same list\n _dispatchEvent({\n sortable: this,\n name: 'update',\n toEl: parentEl,\n originalEvent: evt\n });\n\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n }\n }\n\n if (Sortable.active) {\n /* jshint eqnull:true */\n if (newIndex == null || newIndex === -1) {\n newIndex = oldIndex;\n newDraggableIndex = oldDraggableIndex;\n }\n\n _dispatchEvent({\n sortable: this,\n name: 'end',\n toEl: parentEl,\n originalEvent: evt\n }); // Save sorting\n\n\n this.save();\n }\n }\n }\n\n this._nulling();\n },\n _nulling: function _nulling() {\n pluginEvent('nulling', this);\n rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;\n savedInputChecked.forEach(function (el) {\n el.checked = true;\n });\n savedInputChecked.length = lastDx = lastDy = 0;\n },\n handleEvent: function handleEvent(\n /**Event*/\n evt) {\n switch (evt.type) {\n case 'drop':\n case 'dragend':\n this._onDrop(evt);\n\n break;\n\n case 'dragenter':\n case 'dragover':\n if (dragEl) {\n this._onDragOver(evt);\n\n _globalDragOver(evt);\n }\n\n break;\n\n case 'selectstart':\n evt.preventDefault();\n break;\n }\n },\n\n /**\r\n * Serializes the item into an array of string.\r\n * @returns {String[]}\r\n */\n toArray: function toArray() {\n var order = [],\n el,\n children = this.el.children,\n i = 0,\n n = children.length,\n options = this.options;\n\n for (; i < n; i++) {\n el = children[i];\n\n if (closest(el, options.draggable, this.el, false)) {\n order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));\n }\n }\n\n return order;\n },\n\n /**\r\n * Sorts the elements according to the array.\r\n * @param {String[]} order order of the items\r\n */\n sort: function sort(order, useAnimation) {\n var items = {},\n rootEl = this.el;\n this.toArray().forEach(function (id, i) {\n var el = rootEl.children[i];\n\n if (closest(el, this.options.draggable, rootEl, false)) {\n items[id] = el;\n }\n }, this);\n useAnimation && this.captureAnimationState();\n order.forEach(function (id) {\n if (items[id]) {\n rootEl.removeChild(items[id]);\n rootEl.appendChild(items[id]);\n }\n });\n useAnimation && this.animateAll();\n },\n\n /**\r\n * Save the current sorting\r\n */\n save: function save() {\n var store = this.options.store;\n store && store.set && store.set(this);\n },\n\n /**\r\n * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.\r\n * @param {HTMLElement} el\r\n * @param {String} [selector] default: `options.draggable`\r\n * @returns {HTMLElement|null}\r\n */\n closest: function closest$1(el, selector) {\n return closest(el, selector || this.options.draggable, this.el, false);\n },\n\n /**\r\n * Set/get option\r\n * @param {string} name\r\n * @param {*} [value]\r\n * @returns {*}\r\n */\n option: function option(name, value) {\n var options = this.options;\n\n if (value === void 0) {\n return options[name];\n } else {\n var modifiedValue = PluginManager.modifyOption(this, name, value);\n\n if (typeof modifiedValue !== 'undefined') {\n options[name] = modifiedValue;\n } else {\n options[name] = value;\n }\n\n if (name === 'group') {\n _prepareGroup(options);\n }\n }\n },\n\n /**\r\n * Destroy\r\n */\n destroy: function destroy() {\n pluginEvent('destroy', this);\n var el = this.el;\n el[expando] = null;\n off(el, 'mousedown', this._onTapStart);\n off(el, 'touchstart', this._onTapStart);\n off(el, 'pointerdown', this._onTapStart);\n\n if (this.nativeDraggable) {\n off(el, 'dragover', this);\n off(el, 'dragenter', this);\n } // Remove draggable attributes\n\n\n Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {\n el.removeAttribute('draggable');\n });\n\n this._onDrop();\n\n this._disableDelayedDragEvents();\n\n sortables.splice(sortables.indexOf(this.el), 1);\n this.el = el = null;\n },\n _hideClone: function _hideClone() {\n if (!cloneHidden) {\n pluginEvent('hideClone', this);\n if (Sortable.eventCanceled) return;\n css(cloneEl, 'display', 'none');\n\n if (this.options.removeCloneOnHide && cloneEl.parentNode) {\n cloneEl.parentNode.removeChild(cloneEl);\n }\n\n cloneHidden = true;\n }\n },\n _showClone: function _showClone(putSortable) {\n if (putSortable.lastPutMode !== 'clone') {\n this._hideClone();\n\n return;\n }\n\n if (cloneHidden) {\n pluginEvent('showClone', this);\n if (Sortable.eventCanceled) return; // show clone at dragEl or original position\n\n if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {\n rootEl.insertBefore(cloneEl, dragEl);\n } else if (nextEl) {\n rootEl.insertBefore(cloneEl, nextEl);\n } else {\n rootEl.appendChild(cloneEl);\n }\n\n if (this.options.group.revertClone) {\n this.animate(dragEl, cloneEl);\n }\n\n css(cloneEl, 'display', '');\n cloneHidden = false;\n }\n }\n};\n\nfunction _globalDragOver(\n/**Event*/\nevt) {\n if (evt.dataTransfer) {\n evt.dataTransfer.dropEffect = 'move';\n }\n\n evt.cancelable && evt.preventDefault();\n}\n\nfunction _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {\n var evt,\n sortable = fromEl[expando],\n onMoveFn = sortable.options.onMove,\n retVal; // Support for new CustomEvent feature\n\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent('move', {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent('move', true, true);\n }\n\n evt.to = toEl;\n evt.from = fromEl;\n evt.dragged = dragEl;\n evt.draggedRect = dragRect;\n evt.related = targetEl || toEl;\n evt.relatedRect = targetRect || getRect(toEl);\n evt.willInsertAfter = willInsertAfter;\n evt.originalEvent = originalEvent;\n fromEl.dispatchEvent(evt);\n\n if (onMoveFn) {\n retVal = onMoveFn.call(sortable, evt, originalEvent);\n }\n\n return retVal;\n}\n\nfunction _disableDraggable(el) {\n el.draggable = false;\n}\n\nfunction _unsilent() {\n _silent = false;\n}\n\nfunction _ghostIsFirst(evt, vertical, sortable) {\n var rect = getRect(getChild(sortable.el, 0, sortable.options, true));\n var spacer = 10;\n return vertical ? evt.clientX < rect.left - spacer || evt.clientY < rect.top && evt.clientX < rect.right : evt.clientY < rect.top - spacer || evt.clientY < rect.bottom && evt.clientX < rect.left;\n}\n\nfunction _ghostIsLast(evt, vertical, sortable) {\n var rect = getRect(lastChild(sortable.el, sortable.options.draggable));\n var spacer = 10;\n return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer;\n}\n\nfunction _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {\n var mouseOnAxis = vertical ? evt.clientY : evt.clientX,\n targetLength = vertical ? targetRect.height : targetRect.width,\n targetS1 = vertical ? targetRect.top : targetRect.left,\n targetS2 = vertical ? targetRect.bottom : targetRect.right,\n invert = false;\n\n if (!invertSwap) {\n // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold\n if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {\n // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2\n // check if past first invert threshold on side opposite of lastDirection\n if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {\n // past first invert threshold, do not restrict inverted threshold to dragEl shadow\n pastFirstInvertThresh = true;\n }\n\n if (!pastFirstInvertThresh) {\n // dragEl shadow (target move distance shadow)\n if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow\n : mouseOnAxis > targetS2 - targetMoveDistance) {\n return -lastDirection;\n }\n } else {\n invert = true;\n }\n } else {\n // Regular\n if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {\n return _getInsertDirection(target);\n }\n }\n }\n\n invert = invert || invertSwap;\n\n if (invert) {\n // Invert of regular\n if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {\n return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;\n }\n }\n\n return 0;\n}\n/**\r\n * Gets the direction dragEl must be swapped relative to target in order to make it\r\n * seem that dragEl has been \"inserted\" into that element's position\r\n * @param {HTMLElement} target The target whose position dragEl is being inserted at\r\n * @return {Number} Direction dragEl must be swapped\r\n */\n\n\nfunction _getInsertDirection(target) {\n if (index(dragEl) < index(target)) {\n return 1;\n } else {\n return -1;\n }\n}\n/**\r\n * Generate id\r\n * @param {HTMLElement} el\r\n * @returns {String}\r\n * @private\r\n */\n\n\nfunction _generateId(el) {\n var str = el.tagName + el.className + el.src + el.href + el.textContent,\n i = str.length,\n sum = 0;\n\n while (i--) {\n sum += str.charCodeAt(i);\n }\n\n return sum.toString(36);\n}\n\nfunction _saveInputCheckedState(root) {\n savedInputChecked.length = 0;\n var inputs = root.getElementsByTagName('input');\n var idx = inputs.length;\n\n while (idx--) {\n var el = inputs[idx];\n el.checked && savedInputChecked.push(el);\n }\n}\n\nfunction _nextTick(fn) {\n return setTimeout(fn, 0);\n}\n\nfunction _cancelNextTick(id) {\n return clearTimeout(id);\n} // Fixed #973:\n\n\nif (documentExists) {\n on(document, 'touchmove', function (evt) {\n if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {\n evt.preventDefault();\n }\n });\n} // Export utils\n\n\nSortable.utils = {\n on: on,\n off: off,\n css: css,\n find: find,\n is: function is(el, selector) {\n return !!closest(el, selector, el, false);\n },\n extend: extend,\n throttle: throttle,\n closest: closest,\n toggleClass: toggleClass,\n clone: clone,\n index: index,\n nextTick: _nextTick,\n cancelNextTick: _cancelNextTick,\n detectDirection: _detectDirection,\n getChild: getChild\n};\n/**\r\n * Get the Sortable instance of an element\r\n * @param {HTMLElement} element The element\r\n * @return {Sortable|undefined} The instance of Sortable\r\n */\n\nSortable.get = function (element) {\n return element[expando];\n};\n/**\r\n * Mount a plugin to Sortable\r\n * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted\r\n */\n\n\nSortable.mount = function () {\n for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n plugins[_key] = arguments[_key];\n }\n\n if (plugins[0].constructor === Array) plugins = plugins[0];\n plugins.forEach(function (plugin) {\n if (!plugin.prototype || !plugin.prototype.constructor) {\n throw \"Sortable: Mounted plugin must be a constructor function, not \".concat({}.toString.call(plugin));\n }\n\n if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);\n PluginManager.mount(plugin);\n });\n};\n/**\r\n * Create sortable instance\r\n * @param {HTMLElement} el\r\n * @param {Object} [options]\r\n */\n\n\nSortable.create = function (el, options) {\n return new Sortable(el, options);\n}; // Export\n\n\nSortable.version = version;\n\nvar autoScrolls = [],\n scrollEl,\n scrollRootEl,\n scrolling = false,\n lastAutoScrollX,\n lastAutoScrollY,\n touchEvt$1,\n pointerElemChangedInterval;\n\nfunction AutoScrollPlugin() {\n function AutoScroll() {\n this.defaults = {\n scroll: true,\n forceAutoScrollFallback: false,\n scrollSensitivity: 30,\n scrollSpeed: 10,\n bubbleScroll: true\n }; // Bind all private methods\n\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n }\n\n AutoScroll.prototype = {\n dragStarted: function dragStarted(_ref) {\n var originalEvent = _ref.originalEvent;\n\n if (this.sortable.nativeDraggable) {\n on(document, 'dragover', this._handleAutoScroll);\n } else {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._handleFallbackAutoScroll);\n } else if (originalEvent.touches) {\n on(document, 'touchmove', this._handleFallbackAutoScroll);\n } else {\n on(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref2) {\n var originalEvent = _ref2.originalEvent;\n\n // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)\n if (!this.options.dragOverBubble && !originalEvent.rootEl) {\n this._handleAutoScroll(originalEvent);\n }\n },\n drop: function drop() {\n if (this.sortable.nativeDraggable) {\n off(document, 'dragover', this._handleAutoScroll);\n } else {\n off(document, 'pointermove', this._handleFallbackAutoScroll);\n off(document, 'touchmove', this._handleFallbackAutoScroll);\n off(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n\n clearPointerElemChangedInterval();\n clearAutoScrolls();\n cancelThrottle();\n },\n nulling: function nulling() {\n touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;\n autoScrolls.length = 0;\n },\n _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {\n this._handleAutoScroll(evt, true);\n },\n _handleAutoScroll: function _handleAutoScroll(evt, fallback) {\n var _this = this;\n\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n elem = document.elementFromPoint(x, y);\n touchEvt$1 = evt; // IE does not seem to have native autoscroll,\n // Edge's autoscroll seems too conditional,\n // MACOS Safari does not have autoscroll,\n // Firefox and Chrome are good\n\n if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {\n autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change\n\n var ogElemScroller = getParentAutoScrollElement(elem, true);\n\n if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {\n pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour\n\n pointerElemChangedInterval = setInterval(function () {\n var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);\n\n if (newElem !== ogElemScroller) {\n ogElemScroller = newElem;\n clearAutoScrolls();\n }\n\n autoScroll(evt, _this.options, newElem, fallback);\n }, 10);\n lastAutoScrollX = x;\n lastAutoScrollY = y;\n }\n } else {\n // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll\n if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {\n clearAutoScrolls();\n return;\n }\n\n autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);\n }\n }\n };\n return _extends(AutoScroll, {\n pluginName: 'scroll',\n initializeByDefault: true\n });\n}\n\nfunction clearAutoScrolls() {\n autoScrolls.forEach(function (autoScroll) {\n clearInterval(autoScroll.pid);\n });\n autoScrolls = [];\n}\n\nfunction clearPointerElemChangedInterval() {\n clearInterval(pointerElemChangedInterval);\n}\n\nvar autoScroll = throttle(function (evt, options, rootEl, isFallback) {\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521\n if (!options.scroll) return;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n sens = options.scrollSensitivity,\n speed = options.scrollSpeed,\n winScroller = getWindowScrollingElement();\n var scrollThisInstance = false,\n scrollCustomFn; // New scroll root, set scrollEl\n\n if (scrollRootEl !== rootEl) {\n scrollRootEl = rootEl;\n clearAutoScrolls();\n scrollEl = options.scroll;\n scrollCustomFn = options.scrollFn;\n\n if (scrollEl === true) {\n scrollEl = getParentAutoScrollElement(rootEl, true);\n }\n }\n\n var layersOut = 0;\n var currentParent = scrollEl;\n\n do {\n var el = currentParent,\n rect = getRect(el),\n top = rect.top,\n bottom = rect.bottom,\n left = rect.left,\n right = rect.right,\n width = rect.width,\n height = rect.height,\n canScrollX = void 0,\n canScrollY = void 0,\n scrollWidth = el.scrollWidth,\n scrollHeight = el.scrollHeight,\n elCSS = css(el),\n scrollPosX = el.scrollLeft,\n scrollPosY = el.scrollTop;\n\n if (el === winScroller) {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');\n } else {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');\n }\n\n var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);\n var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);\n\n if (!autoScrolls[layersOut]) {\n for (var i = 0; i <= layersOut; i++) {\n if (!autoScrolls[i]) {\n autoScrolls[i] = {};\n }\n }\n }\n\n if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {\n autoScrolls[layersOut].el = el;\n autoScrolls[layersOut].vx = vx;\n autoScrolls[layersOut].vy = vy;\n clearInterval(autoScrolls[layersOut].pid);\n\n if (vx != 0 || vy != 0) {\n scrollThisInstance = true;\n /* jshint loopfunc:true */\n\n autoScrolls[layersOut].pid = setInterval(function () {\n // emulate drag over during autoscroll (fallback), emulating native DnD behaviour\n if (isFallback && this.layer === 0) {\n Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely\n\n }\n\n var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;\n var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;\n\n if (typeof scrollCustomFn === 'function') {\n if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {\n return;\n }\n }\n\n scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);\n }.bind({\n layer: layersOut\n }), 24);\n }\n }\n\n layersOut++;\n } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));\n\n scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not\n}, 30);\n\nvar drop = function drop(_ref) {\n var originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n dragEl = _ref.dragEl,\n activeSortable = _ref.activeSortable,\n dispatchSortableEvent = _ref.dispatchSortableEvent,\n hideGhostForTarget = _ref.hideGhostForTarget,\n unhideGhostForTarget = _ref.unhideGhostForTarget;\n if (!originalEvent) return;\n var toSortable = putSortable || activeSortable;\n hideGhostForTarget();\n var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;\n var target = document.elementFromPoint(touch.clientX, touch.clientY);\n unhideGhostForTarget();\n\n if (toSortable && !toSortable.el.contains(target)) {\n dispatchSortableEvent('spill');\n this.onSpill({\n dragEl: dragEl,\n putSortable: putSortable\n });\n }\n};\n\nfunction Revert() {}\n\nRevert.prototype = {\n startIndex: null,\n dragStart: function dragStart(_ref2) {\n var oldDraggableIndex = _ref2.oldDraggableIndex;\n this.startIndex = oldDraggableIndex;\n },\n onSpill: function onSpill(_ref3) {\n var dragEl = _ref3.dragEl,\n putSortable = _ref3.putSortable;\n this.sortable.captureAnimationState();\n\n if (putSortable) {\n putSortable.captureAnimationState();\n }\n\n var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);\n\n if (nextSibling) {\n this.sortable.el.insertBefore(dragEl, nextSibling);\n } else {\n this.sortable.el.appendChild(dragEl);\n }\n\n this.sortable.animateAll();\n\n if (putSortable) {\n putSortable.animateAll();\n }\n },\n drop: drop\n};\n\n_extends(Revert, {\n pluginName: 'revertOnSpill'\n});\n\nfunction Remove() {}\n\nRemove.prototype = {\n onSpill: function onSpill(_ref4) {\n var dragEl = _ref4.dragEl,\n putSortable = _ref4.putSortable;\n var parentSortable = putSortable || this.sortable;\n parentSortable.captureAnimationState();\n dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);\n parentSortable.animateAll();\n },\n drop: drop\n};\n\n_extends(Remove, {\n pluginName: 'removeOnSpill'\n});\n\nvar lastSwapEl;\n\nfunction SwapPlugin() {\n function Swap() {\n this.defaults = {\n swapClass: 'sortable-swap-highlight'\n };\n }\n\n Swap.prototype = {\n dragStart: function dragStart(_ref) {\n var dragEl = _ref.dragEl;\n lastSwapEl = dragEl;\n },\n dragOverValid: function dragOverValid(_ref2) {\n var completed = _ref2.completed,\n target = _ref2.target,\n onMove = _ref2.onMove,\n activeSortable = _ref2.activeSortable,\n changed = _ref2.changed,\n cancel = _ref2.cancel;\n if (!activeSortable.options.swap) return;\n var el = this.sortable.el,\n options = this.options;\n\n if (target && target !== el) {\n var prevSwapEl = lastSwapEl;\n\n if (onMove(target) !== false) {\n toggleClass(target, options.swapClass, true);\n lastSwapEl = target;\n } else {\n lastSwapEl = null;\n }\n\n if (prevSwapEl && prevSwapEl !== lastSwapEl) {\n toggleClass(prevSwapEl, options.swapClass, false);\n }\n }\n\n changed();\n completed(true);\n cancel();\n },\n drop: function drop(_ref3) {\n var activeSortable = _ref3.activeSortable,\n putSortable = _ref3.putSortable,\n dragEl = _ref3.dragEl;\n var toSortable = putSortable || this.sortable;\n var options = this.options;\n lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);\n\n if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {\n if (dragEl !== lastSwapEl) {\n toSortable.captureAnimationState();\n if (toSortable !== activeSortable) activeSortable.captureAnimationState();\n swapNodes(dragEl, lastSwapEl);\n toSortable.animateAll();\n if (toSortable !== activeSortable) activeSortable.animateAll();\n }\n }\n },\n nulling: function nulling() {\n lastSwapEl = null;\n }\n };\n return _extends(Swap, {\n pluginName: 'swap',\n eventProperties: function eventProperties() {\n return {\n swapItem: lastSwapEl\n };\n }\n });\n}\n\nfunction swapNodes(n1, n2) {\n var p1 = n1.parentNode,\n p2 = n2.parentNode,\n i1,\n i2;\n if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;\n i1 = index(n1);\n i2 = index(n2);\n\n if (p1.isEqualNode(p2) && i1 < i2) {\n i2++;\n }\n\n p1.insertBefore(n2, p1.children[i1]);\n p2.insertBefore(n1, p2.children[i2]);\n}\n\nvar multiDragElements = [],\n multiDragClones = [],\n lastMultiDragSelect,\n // for selection with modifier key down (SHIFT)\nmultiDragSortable,\n initialFolding = false,\n // Initial multi-drag fold when drag started\nfolding = false,\n // Folding any other time\ndragStarted = false,\n dragEl$1,\n clonesFromRect,\n clonesHidden;\n\nfunction MultiDragPlugin() {\n function MultiDrag(sortable) {\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n\n if (!sortable.options.avoidImplicitDeselect) {\n if (sortable.options.supportPointer) {\n on(document, 'pointerup', this._deselectMultiDrag);\n } else {\n on(document, 'mouseup', this._deselectMultiDrag);\n on(document, 'touchend', this._deselectMultiDrag);\n }\n }\n\n on(document, 'keydown', this._checkKeyDown);\n on(document, 'keyup', this._checkKeyUp);\n this.defaults = {\n selectedClass: 'sortable-selected',\n multiDragKey: null,\n avoidImplicitDeselect: false,\n setData: function setData(dataTransfer, dragEl) {\n var data = '';\n\n if (multiDragElements.length && multiDragSortable === sortable) {\n multiDragElements.forEach(function (multiDragElement, i) {\n data += (!i ? '' : ', ') + multiDragElement.textContent;\n });\n } else {\n data = dragEl.textContent;\n }\n\n dataTransfer.setData('Text', data);\n }\n };\n }\n\n MultiDrag.prototype = {\n multiDragKeyDown: false,\n isMultiDrag: false,\n delayStartGlobal: function delayStartGlobal(_ref) {\n var dragged = _ref.dragEl;\n dragEl$1 = dragged;\n },\n delayEnded: function delayEnded() {\n this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1);\n },\n setupClone: function setupClone(_ref2) {\n var sortable = _ref2.sortable,\n cancel = _ref2.cancel;\n if (!this.isMultiDrag) return;\n\n for (var i = 0; i < multiDragElements.length; i++) {\n multiDragClones.push(clone(multiDragElements[i]));\n multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;\n multiDragClones[i].draggable = false;\n multiDragClones[i].style['will-change'] = '';\n toggleClass(multiDragClones[i], this.options.selectedClass, false);\n multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);\n }\n\n sortable._hideClone();\n\n cancel();\n },\n clone: function clone(_ref3) {\n var sortable = _ref3.sortable,\n rootEl = _ref3.rootEl,\n dispatchSortableEvent = _ref3.dispatchSortableEvent,\n cancel = _ref3.cancel;\n if (!this.isMultiDrag) return;\n\n if (!this.options.removeCloneOnHide) {\n if (multiDragElements.length && multiDragSortable === sortable) {\n insertMultiDragClones(true, rootEl);\n dispatchSortableEvent('clone');\n cancel();\n }\n }\n },\n showClone: function showClone(_ref4) {\n var cloneNowShown = _ref4.cloneNowShown,\n rootEl = _ref4.rootEl,\n cancel = _ref4.cancel;\n if (!this.isMultiDrag) return;\n insertMultiDragClones(false, rootEl);\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', '');\n });\n cloneNowShown();\n clonesHidden = false;\n cancel();\n },\n hideClone: function hideClone(_ref5) {\n var _this = this;\n\n var sortable = _ref5.sortable,\n cloneNowHidden = _ref5.cloneNowHidden,\n cancel = _ref5.cancel;\n if (!this.isMultiDrag) return;\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', 'none');\n\n if (_this.options.removeCloneOnHide && clone.parentNode) {\n clone.parentNode.removeChild(clone);\n }\n });\n cloneNowHidden();\n clonesHidden = true;\n cancel();\n },\n dragStartGlobal: function dragStartGlobal(_ref6) {\n var sortable = _ref6.sortable;\n\n if (!this.isMultiDrag && multiDragSortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n }\n\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.sortableIndex = index(multiDragElement);\n }); // Sort multi-drag elements\n\n multiDragElements = multiDragElements.sort(function (a, b) {\n return a.sortableIndex - b.sortableIndex;\n });\n dragStarted = true;\n },\n dragStarted: function dragStarted(_ref7) {\n var _this2 = this;\n\n var sortable = _ref7.sortable;\n if (!this.isMultiDrag) return;\n\n if (this.options.sort) {\n // Capture rects,\n // hide multi drag elements (by positioning them absolute),\n // set multi drag elements rects to dragRect,\n // show multi drag elements,\n // animate to rects,\n // unset rects & remove from DOM\n sortable.captureAnimationState();\n\n if (this.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n css(multiDragElement, 'position', 'absolute');\n });\n var dragRect = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRect);\n });\n folding = true;\n initialFolding = true;\n }\n }\n\n sortable.animateAll(function () {\n folding = false;\n initialFolding = false;\n\n if (_this2.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n } // Remove all auxiliary multidrag items from el, if sorting enabled\n\n\n if (_this2.options.sort) {\n removeMultiDragElements();\n }\n });\n },\n dragOver: function dragOver(_ref8) {\n var target = _ref8.target,\n completed = _ref8.completed,\n cancel = _ref8.cancel;\n\n if (folding && ~multiDragElements.indexOf(target)) {\n completed(false);\n cancel();\n }\n },\n revert: function revert(_ref9) {\n var fromSortable = _ref9.fromSortable,\n rootEl = _ref9.rootEl,\n sortable = _ref9.sortable,\n dragRect = _ref9.dragRect;\n\n if (multiDragElements.length > 1) {\n // Setup unfold animation\n multiDragElements.forEach(function (multiDragElement) {\n sortable.addAnimationState({\n target: multiDragElement,\n rect: folding ? getRect(multiDragElement) : dragRect\n });\n unsetRect(multiDragElement);\n multiDragElement.fromRect = dragRect;\n fromSortable.removeAnimationState(multiDragElement);\n });\n folding = false;\n insertMultiDragElements(!this.options.removeCloneOnHide, rootEl);\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref10) {\n var sortable = _ref10.sortable,\n isOwner = _ref10.isOwner,\n insertion = _ref10.insertion,\n activeSortable = _ref10.activeSortable,\n parentEl = _ref10.parentEl,\n putSortable = _ref10.putSortable;\n var options = this.options;\n\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n }\n\n initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location\n\n if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {\n // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible\n var dragRectAbsolute = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted\n // while folding, and so that we can capture them again because old sortable will no longer be fromSortable\n\n parentEl.appendChild(multiDragElement);\n });\n folding = true;\n } // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out\n\n\n if (!isOwner) {\n // Only remove if not folding (folding will remove them anyways)\n if (!folding) {\n removeMultiDragElements();\n }\n\n if (multiDragElements.length > 1) {\n var clonesHiddenBefore = clonesHidden;\n\n activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden\n\n\n if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {\n multiDragClones.forEach(function (clone) {\n activeSortable.addAnimationState({\n target: clone,\n rect: clonesFromRect\n });\n clone.fromRect = clonesFromRect;\n clone.thisAnimationDuration = null;\n });\n }\n } else {\n activeSortable._showClone(sortable);\n }\n }\n }\n },\n dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {\n var dragRect = _ref11.dragRect,\n isOwner = _ref11.isOwner,\n activeSortable = _ref11.activeSortable;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n });\n\n if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {\n clonesFromRect = _extends({}, dragRect);\n var dragMatrix = matrix(dragEl$1, true);\n clonesFromRect.top -= dragMatrix.f;\n clonesFromRect.left -= dragMatrix.e;\n }\n },\n dragOverAnimationComplete: function dragOverAnimationComplete() {\n if (folding) {\n folding = false;\n removeMultiDragElements();\n }\n },\n drop: function drop(_ref12) {\n var evt = _ref12.originalEvent,\n rootEl = _ref12.rootEl,\n parentEl = _ref12.parentEl,\n sortable = _ref12.sortable,\n dispatchSortableEvent = _ref12.dispatchSortableEvent,\n oldIndex = _ref12.oldIndex,\n putSortable = _ref12.putSortable;\n var toSortable = putSortable || this.sortable;\n if (!evt) return;\n var options = this.options,\n children = parentEl.children; // Multi-drag selection\n\n if (!dragStarted) {\n if (options.multiDragKey && !this.multiDragKeyDown) {\n this._deselectMultiDrag();\n }\n\n toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));\n\n if (!~multiDragElements.indexOf(dragEl$1)) {\n multiDragElements.push(dragEl$1);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: dragEl$1,\n originalEvent: evt\n }); // Modifier activated, select from last to dragEl\n\n if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {\n var lastIndex = index(lastMultiDragSelect),\n currentIndex = index(dragEl$1);\n\n if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {\n // Must include lastMultiDragSelect (select it), in case modified selection from no selection\n // (but previous selection existed)\n var n, i;\n\n if (currentIndex > lastIndex) {\n i = lastIndex;\n n = currentIndex;\n } else {\n i = currentIndex;\n n = lastIndex + 1;\n }\n\n for (; i < n; i++) {\n if (~multiDragElements.indexOf(children[i])) continue;\n toggleClass(children[i], options.selectedClass, true);\n multiDragElements.push(children[i]);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: children[i],\n originalEvent: evt\n });\n }\n }\n } else {\n lastMultiDragSelect = dragEl$1;\n }\n\n multiDragSortable = toSortable;\n } else {\n multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);\n lastMultiDragSelect = null;\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'deselect',\n targetEl: dragEl$1,\n originalEvent: evt\n });\n }\n } // Multi-drag drop\n\n\n if (dragStarted && this.isMultiDrag) {\n folding = false; // Do not \"unfold\" after around dragEl if reverted\n\n if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {\n var dragRect = getRect(dragEl$1),\n multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');\n if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;\n toSortable.captureAnimationState();\n\n if (!initialFolding) {\n if (options.animation) {\n dragEl$1.fromRect = dragRect;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n\n if (multiDragElement !== dragEl$1) {\n var rect = folding ? getRect(multiDragElement) : dragRect;\n multiDragElement.fromRect = rect; // Prepare unfold animation\n\n toSortable.addAnimationState({\n target: multiDragElement,\n rect: rect\n });\n }\n });\n } // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert\n // properly they must all be removed\n\n\n removeMultiDragElements();\n multiDragElements.forEach(function (multiDragElement) {\n if (children[multiDragIndex]) {\n parentEl.insertBefore(multiDragElement, children[multiDragIndex]);\n } else {\n parentEl.appendChild(multiDragElement);\n }\n\n multiDragIndex++;\n }); // If initial folding is done, the elements may have changed position because they are now\n // unfolding around dragEl, even though dragEl may not have his index changed, so update event\n // must be fired here as Sortable will not.\n\n if (oldIndex === index(dragEl$1)) {\n var update = false;\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement.sortableIndex !== index(multiDragElement)) {\n update = true;\n return;\n }\n });\n\n if (update) {\n dispatchSortableEvent('update');\n }\n }\n } // Must be done after capturing individual rects (scroll bar)\n\n\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n toSortable.animateAll();\n }\n\n multiDragSortable = toSortable;\n } // Remove clones if necessary\n\n\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n multiDragClones.forEach(function (clone) {\n clone.parentNode && clone.parentNode.removeChild(clone);\n });\n }\n },\n nullingGlobal: function nullingGlobal() {\n this.isMultiDrag = dragStarted = false;\n multiDragClones.length = 0;\n },\n destroyGlobal: function destroyGlobal() {\n this._deselectMultiDrag();\n\n off(document, 'pointerup', this._deselectMultiDrag);\n off(document, 'mouseup', this._deselectMultiDrag);\n off(document, 'touchend', this._deselectMultiDrag);\n off(document, 'keydown', this._checkKeyDown);\n off(document, 'keyup', this._checkKeyUp);\n },\n _deselectMultiDrag: function _deselectMultiDrag(evt) {\n if (typeof dragStarted !== \"undefined\" && dragStarted) return; // Only deselect if selection is in this sortable\n\n if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable\n\n if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click\n\n if (evt && evt.button !== 0) return;\n\n while (multiDragElements.length) {\n var el = multiDragElements[0];\n toggleClass(el, this.options.selectedClass, false);\n multiDragElements.shift();\n dispatchEvent({\n sortable: this.sortable,\n rootEl: this.sortable.el,\n name: 'deselect',\n targetEl: el,\n originalEvent: evt\n });\n }\n },\n _checkKeyDown: function _checkKeyDown(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = true;\n }\n },\n _checkKeyUp: function _checkKeyUp(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = false;\n }\n }\n };\n return _extends(MultiDrag, {\n // Static methods & properties\n pluginName: 'multiDrag',\n utils: {\n /**\r\n * Selects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be selected\r\n */\n select: function select(el) {\n var sortable = el.parentNode[expando];\n if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;\n\n if (multiDragSortable && multiDragSortable !== sortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n\n multiDragSortable = sortable;\n }\n\n toggleClass(el, sortable.options.selectedClass, true);\n multiDragElements.push(el);\n },\n\n /**\r\n * Deselects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be deselected\r\n */\n deselect: function deselect(el) {\n var sortable = el.parentNode[expando],\n index = multiDragElements.indexOf(el);\n if (!sortable || !sortable.options.multiDrag || !~index) return;\n toggleClass(el, sortable.options.selectedClass, false);\n multiDragElements.splice(index, 1);\n }\n },\n eventProperties: function eventProperties() {\n var _this3 = this;\n\n var oldIndicies = [],\n newIndicies = [];\n multiDragElements.forEach(function (multiDragElement) {\n oldIndicies.push({\n multiDragElement: multiDragElement,\n index: multiDragElement.sortableIndex\n }); // multiDragElements will already be sorted if folding\n\n var newIndex;\n\n if (folding && multiDragElement !== dragEl$1) {\n newIndex = -1;\n } else if (folding) {\n newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')');\n } else {\n newIndex = index(multiDragElement);\n }\n\n newIndicies.push({\n multiDragElement: multiDragElement,\n index: newIndex\n });\n });\n return {\n items: _toConsumableArray(multiDragElements),\n clones: [].concat(multiDragClones),\n oldIndicies: oldIndicies,\n newIndicies: newIndicies\n };\n },\n optionListeners: {\n multiDragKey: function multiDragKey(key) {\n key = key.toLowerCase();\n\n if (key === 'ctrl') {\n key = 'Control';\n } else if (key.length > 1) {\n key = key.charAt(0).toUpperCase() + key.substr(1);\n }\n\n return key;\n }\n }\n });\n}\n\nfunction insertMultiDragElements(clonesInserted, rootEl) {\n multiDragElements.forEach(function (multiDragElement, i) {\n var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];\n\n if (target) {\n rootEl.insertBefore(multiDragElement, target);\n } else {\n rootEl.appendChild(multiDragElement);\n }\n });\n}\n/**\r\n * Insert multi-drag clones\r\n * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted\r\n * @param {HTMLElement} rootEl\r\n */\n\n\nfunction insertMultiDragClones(elementsInserted, rootEl) {\n multiDragClones.forEach(function (clone, i) {\n var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];\n\n if (target) {\n rootEl.insertBefore(clone, target);\n } else {\n rootEl.appendChild(clone);\n }\n });\n}\n\nfunction removeMultiDragElements() {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement);\n });\n}\n\nSortable.mount(new AutoScrollPlugin());\nSortable.mount(Remove, Revert);\n\nexport default Sortable;\nexport { MultiDragPlugin as MultiDrag, Sortable, SwapPlugin as Swap };\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/ExtensionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/withAttr'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/ColorPreviewInput'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/string'];","import app from 'flarum/admin/app';\nimport Modal, { IInternalModalAttrs } from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport ColorPreviewInput from 'flarum/common/components/ColorPreviewInput';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport { slug } from 'flarum/common/utils/string';\nimport Stream from 'flarum/common/utils/Stream';\n\nimport tagLabel from '../../common/helpers/tagLabel';\nimport type Mithril from 'mithril';\nimport type Tag from '../../common/models/Tag';\nimport extractText from 'flarum/common/utils/extractText';\nimport { ModelIdentifier } from 'flarum/common/Model';\n\nexport interface EditTagModalAttrs extends IInternalModalAttrs {\n primary?: boolean;\n model?: Tag;\n}\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 tag!: Tag;\n\n name!: Stream;\n slug!: Stream;\n description!: Stream;\n color!: Stream;\n icon!: Stream;\n isHidden!: Stream;\n primary!: Stream;\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n this.tag = this.attrs.model || app.store.createRecord('tags');\n\n this.name = Stream(this.tag.name() || '');\n this.slug = Stream(this.tag.slug() || '');\n this.description = Stream(this.tag.description() || '');\n this.color = Stream(this.tag.color() || '');\n this.icon = Stream(this.tag.icon() || '');\n this.isHidden = Stream(this.tag.isHidden() || false);\n this.primary = Stream(this.attrs.primary || false);\n }\n\n className() {\n return 'EditTagModal Modal--small';\n }\n\n title() {\n return this.name()\n ? tagLabel(app.store.createRecord('tags', { attributes: this.submitData() }))\n : app.translator.trans('flarum-tags.admin.edit_tag.title');\n }\n\n content() {\n return (\n
\n
{this.fields().toArray()}
\n
\n );\n }\n\n fields() {\n const items = new ItemList();\n\n items.add(\n 'name',\n
\n \n {\n const target = e.target as HTMLInputElement;\n this.name(target.value);\n this.slug(slug(target.value));\n }}\n />\n
,\n 50\n );\n\n items.add(\n 'slug',\n
\n \n \n
,\n 40\n );\n\n items.add(\n 'description',\n
\n \n