From 4befee8575986b94b1fa47b133736c06870aa159 Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Sun, 3 Jul 2022 22:30:54 +0000 Subject: [PATCH] Bundled output for commit f7d39e2a56fad7642436bf284db851f98ac50baa Includes transpiled JS/TS. [skip ci] --- js/dist/admin.js | 2 +- js/dist/admin.js.map | 2 +- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/dist/admin.js b/js/dist/admin.js index ff8ee13..d63de3c 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={n:e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return t.d(a,{a}),a},d:(e,a)=>{for(var n in a)t.o(a,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:a[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e);const a=flarum.core.compat["common/app"];function n(t,e){return n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}t.n(a)().initializers.add("v17development/flarum-user-badges",(function(){}));const r=flarum.core.compat.Model;var i=t.n(r);const s=flarum.core.compat["utils/mixin"];var l=t.n(s);const d=flarum.core.compat["components/Modal"];var c=t.n(d);const u=flarum.core.compat["components/Button"];var p=t.n(u);const g=flarum.core.compat["helpers/fullTime"];var h=t.n(g);const f=flarum.core.compat["utils/ItemList"];var v=t.n(f);const b=flarum.core.compat["components/LinkButton"];var y=t.n(b);flarum.core.compat["components/Select"];const _=flarum.core.compat["utils/Stream"];var w=t.n(_),C=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var a=e.prototype;return a.oninit=function(e){var a=this;t.prototype.oninit.call(this,e),this.selectedBadge=this.attrs.badge?this.attrs.badge.badge():null,this.user=this.attrs.badge?this.attrs.badge.user():this.attrs.user,this.userHasBadge=!1,this.badge=this.attrs.badge?this.attrs.badge:app.store.createRecord("userBadges"),this.description=w()(this.badge.description()),this.categories={},this.uncategorizedBadges=[],this.loading=!1,this.attrs.badge||(this.loading=!0,app.store.find("badges",{include:"category"}).then((function(t){t.forEach((function(t){if(t.category()){var e=t.category();a.categories[e.id()]?a.categories[e.id()].badges.push(t):a.categories[e.id()]={category:e,badges:[t]}}else a.uncategorizedBadges.push(t)})),a.loading=!1,m.redraw()})))},a.className=function(){return"Modal--small BadgeModal"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum."+(this.badge.exists?"update":"give")+"_badge")},a.content=function(){return m("div",null,m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray())),m("div",{className:"Modal-footer"},m(p(),{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:this.userHasBadge},app.translator.trans("core.forum.composer_edit.submit_button"))))},a.fields=function(){var t=this,e=new(v());return e.add("badge",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.badge"))),m("div",{className:"Select"},m("select",{value:this.selectedBadge?this.selectedBadge.id():"empty",disabled:!!this.attrs.badge,onchange:function(e){"empty"!==e.target.value&&(t.selectedBadge=app.store.getById("badges",e.target.value),t.checkUserHasBadge(t.selectedBadge))},className:"Select-input FormControl"},m("option",{value:"empty"},app.translator.trans("v17development-flarum-badges.forum.select_badge")),!this.attrs.badge&&Object.values(this.categories).map((function(t){var e=t.category,a=t.badges;return m("optgroup",{label:e.name()},a.map((function(t){return m("option",{value:t.id()},t.name())})))})),!this.attrs.badge&&this.uncategorizedBadges.length>=1&&m("optgroup",{label:app.translator.trans("v17development-flarum-badges.forum.uncategorized")},this.uncategorizedBadges.map((function(t){return m("option",{value:t.id()},t.name())}))),!!this.attrs.badge&&m("option",{value:this.selectedBadge.id()},this.selectedBadge.name())),m("i",{class:"icon fas fa-caret-down Select-caret"})),this.userHasBadge&&m("p",{className:"UserHasBadge"},app.translator.trans("v17development-flarum-badges.forum.user_has_badge"))),30),e.add("badge_description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.selectedBadge?this.selectedBadge.description():app.translator.trans("v17development-flarum-badges.forum.select_badge"))),30),e.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"))),m("textarea",{className:"FormControl",placeholder:app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),bidi:this.description})),30),e},a.checkUserHasBadge=function(t){var e=!1;this.user.userBadges().map((function(a){a.badge()==t&&(e=!0)})),this.userHasBadge=e,m.redraw()},a.onsubmit=function(t){var e=this;t.preventDefault(),this.loading=!0,this.badge.save({description:this.description(),relationships:this.attrs.badge?{}:{badge:this.selectedBadge,user:this.user}}).then((function(){e.attrs.badge?app.modal.show(N,{badge:e.attrs.badge.badge(),userBadgeData:e.attrs.badge}):e.hide(),m.redraw()}),(function(t){e.loading=!1,e.handleErrors(t)}))},e}(c()),N=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.loading=!1},a.className=function(){return"Modal--small"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum.badge_information")},a.content=function(){var t=this;return m("div",null,m("div",{className:"Modal-body"},this.data().toArray()),m("div",{className:"Modal-footer"},m(y(),{href:app.route("badges.item",{id:this.attrs.badge.id()}),className:"Button",style:{margin:"0 10px"}},app.translator.trans("v17development-flarum-badges.forum.badge.badge_details")),this.attrs.userBadgeData&&app.forum.attribute("canGiveBadge")&&m(p(),{className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge_confirm"))&&(t.loading=!0,t.attrs.userBadgeData.delete().then((function(){return t.hide()})))},loading:this.loading},app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge"))))},a.data=function(){var t=this,e=new(v());return e.add("name",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.name"),":")),m("p",null,this.attrs.badge.name()))),e.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.attrs.badge.description()))),this.attrs.userBadgeData&&(this.attrs.userBadgeData.description()||app.forum.attribute("canGiveBadge"))&&e.add("earning_reason",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),":")),m("p",null,this.attrs.userBadgeData.description()?this.attrs.userBadgeData.description():m("i",null,app.translator.trans("v17development-flarum-badges.forum.badge.no_earning_reason"))),m("p",null,app.forum.attribute("canGiveBadge")&&m("a",{href:"#",onclick:function(e){e.preventDefault(),app.modal.show(C,{badge:t.attrs.userBadgeData})}},app.translator.trans("v17development-flarum-badges.forum.badge.update_earning_reason"))))),this.attrs.userBadgeData&&e.add("earned_date",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_on"),":")),m("p",null,h()(this.attrs.userBadgeData.assignedAt())))),this.attrs.userBadgeData&&e.add("category",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.category"),":")),m("p",null,this.attrs.badge.category()&&this.attrs.badge.category().name(),!this.attrs.badge.category()&&app.translator.trans("v17development-flarum-badges.forum.uncategorized")))),this.attrs.badge&&this.attrs.badge.earnedAmount()&&e.add("earned_amount",m("div",{className:"BadgeModalListItem"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:this.attrs.badge.earnedAmount()})))),e},e}(c()),E=function(t){function e(){return t.apply(this,arguments)||this}return o(e,t),e.prototype.apiEndpoint=function(){return"/badges"+(this.exists?"/"+this.data.id:"")},e}(l()(i(),{name:i().attribute("name"),icon:i().attribute("icon"),order:i().attribute("order"),image:i().attribute("image"),description:i().attribute("description"),isVisible:i().attribute("isVisible"),createdAt:i().attribute("createdAt"),earnedAmount:i().attribute("earnedAmount"),category:i().hasOne("category"),backgroundColor:i().attribute("backgroundColor"),iconColor:i().attribute("iconColor"),labelColor:i().attribute("labelColor")})),S=function(t){function e(){return t.apply(this,arguments)||this}return o(e,t),e.prototype.apiEndpoint=function(){return"/badge_categories"+(this.exists?"/"+this.data.id:"")},e}(l()(i(),{name:i().attribute("name"),order:i().attribute("order"),description:i().attribute("description"),isEnabled:i().attribute("isEnabled"),createdAt:i().attribute("createdAt"),isTable:i().attribute("isTable"),users:i().hasMany("users"),badges:i().hasMany("badges")}));const D=flarum.core.compat.Component;var B=t.n(D);const T=flarum.core.compat["components/Dropdown"];var x=t.n(T);const M=flarum.core.compat["helpers/icon"];var k=t.n(M),F=!1,O=!1,I=[],P=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var a=e.prototype;return a.oninit=function(e){var a,n=this;t.prototype.oninit.call(this,e),this.loaded=!1,a=function(){return n.loaded=!0},O?a():F?I.push(a):(F=!0,app.store.find("badges").then((function(){O=!0,F=!1,a(),I.map((function(t){return t()})),m.redraw()})))},a.view=function(){var t=this;if(!this.loaded)return m("div",{className:"Form-group"},m("label",null,this.attrs.label),m(p(),{className:"Button Button--danger",style:{float:"none"},loading:!0},app.translator.trans("v17development-flarum-badges.admin.auto_moderator.badge_selector.loading_badges")));var e=app.store.getById("badges",this.attrs.value),a=e?[k()(e.icon()),"\t",e.name()]:app.translator.trans("v17development-flarum-badges.admin.auto_moderator.badge_selector.placeholder");return m("div",{className:"Form-group"},m("label",null,this.attrs.label),this.attrs.disabled?m("div",{className:"Button Button--danger"},a):m(x(),{label:a,disabled:this.attrs.disabled,buttonClassName:"Button Button--danger"},app.store.all("badges").map((function(a){return p().component({active:e&&e.id()===a.id(),disabled:e&&e.id()===a.id(),icon:a.icon(),onclick:function(){t.attrs.onchange(a.id())}},a.name())}))))},e}(B()),A=function(t){function e(){return t.apply(this,arguments)||this}return o(e,t),e.prototype.view=function(){var t=this.attrs.settings;return m(P,{value:t().badge_id,onchange:function(e){return t({badge_id:e})}})},e}(B());function R(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function X(t){for(var e=1;e=0||(o[a]=t[a]);return o}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(o[a]=t[a])}return o}function z(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var V=z(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),W=z(/Edge/i),U=z(/firefox/i),G=z(/safari/i)&&!z(/chrome/i)&&!z(/android/i),K=z(/iP(ad|od|hone)/i),q=z(/chrome/i)&&z(/android/i),Z={capture:!1,passive:!1};function Q(t,e,a){t.addEventListener(e,a,!V&&Z)}function J(t,e,a){t.removeEventListener(e,a,!V&&Z)}function tt(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 et(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function at(t,e,a,n){if(t){a=a||document;do{if(null!=e&&(">"===e[0]?t.parentNode===a&&tt(t,e):tt(t,e))||n&&t===a)return t;if(t===a)break}while(t=et(t))}return null}var nt,ot=/\s+/g;function rt(t,e,a){if(t&&e)if(t.classList)t.classList[a?"add":"remove"](e);else{var n=(" "+t.className+" ").replace(ot," ").replace(" "+e+" "," ");t.className=(n+(a?" "+e:"")).replace(ot," ")}}function it(t,e,a){var n=t&&t.style;if(n){if(void 0===a)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(a=t.currentStyle),void 0===e?a:a[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=a+("string"==typeof a?"":"px")}}function st(t,e){var a="";if("string"==typeof t)a=t;else do{var n=it(t,"transform");n&&"none"!==n&&(a=n+" "+a)}while(!e&&(t=t.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(a)}function lt(t,e,a){if(t){var n=t.getElementsByTagName(e),o=0,r=n.length;if(a)for(;o=r:o<=r))return n;if(n===dt())break;n=ft(n,!1)}return!1}function mt(t,e,a,n){for(var o=0,r=0,i=t.children;r2&&void 0!==arguments[2]?arguments[2]:{},n=a.evt,o=H(a,St);Et.pluginEvent.bind(be)(t,e,X({dragEl:Tt,parentEl:xt,ghostEl:Mt,rootEl:kt,nextEl:Ft,lastDownEl:Ot,cloneEl:It,cloneHidden:Pt,dragStarted:Kt,putSortable:jt,activeSortable:be.active,originalEvent:n,oldIndex:At,oldDraggableIndex:Xt,newIndex:Rt,newDraggableIndex:Yt,hideGhostForTarget:ge,unhideGhostForTarget:he,cloneNowHidden:function(){Pt=!0},cloneNowShown:function(){Pt=!1},dispatchSortableEvent:function(t){Bt({sortable:e,name:t,originalEvent:n})}},o))};function Bt(t){!function(t){var e=t.sortable,a=t.rootEl,n=t.name,o=t.targetEl,r=t.cloneEl,i=t.toEl,s=t.fromEl,l=t.oldIndex,d=t.newIndex,c=t.oldDraggableIndex,u=t.newDraggableIndex,m=t.originalEvent,p=t.putSortable,g=t.extraEventProperties;if(e=e||a&&a[wt]){var h,f=e.options,v="on"+n.charAt(0).toUpperCase()+n.substr(1);!window.CustomEvent||V||W?(h=document.createEvent("Event")).initEvent(n,!0,!0):h=new CustomEvent(n,{bubbles:!0,cancelable:!0}),h.to=i||a,h.from=s||a,h.item=o||a,h.clone=r,h.oldIndex=l,h.newIndex=d,h.oldDraggableIndex=c,h.newDraggableIndex=u,h.originalEvent=m,h.pullMode=p?p.lastPutMode:void 0;var b=X(X({},g),Et.getEventProperties(n,e));for(var y in b)h[y]=b[y];a&&a.dispatchEvent(h),f[v]&&f[v].call(e,h)}}(X({putSortable:jt,cloneEl:It,targetEl:Tt,rootEl:kt,oldIndex:At,oldDraggableIndex:Xt,newIndex:Rt,newDraggableIndex:Yt},t))}var Tt,xt,Mt,kt,Ft,Ot,It,Pt,At,Rt,Xt,Yt,Lt,jt,Ht,zt,Vt,Wt,Ut,Gt,Kt,$t,qt,Zt,Qt,Jt=!1,te=!1,ee=[],ae=!1,ne=!1,oe=[],re=!1,ie=[],se="undefined"!=typeof document,le=K,de=W||V?"cssFloat":"float",ce=se&&!q&&!K&&"draggable"in document.createElement("div"),ue=function(){if(se){if(V)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),me=function(t,e){var a=it(t),n=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),o=mt(t,0,e),r=mt(t,1,e),i=o&&it(o),s=r&&it(r),l=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+ct(o).width,d=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+ct(r).width;if("flex"===a.display)return"column"===a.flexDirection||"column-reverse"===a.flexDirection?"vertical":"horizontal";if("grid"===a.display)return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&i.float&&"none"!==i.float){var c="left"===i.float?"left":"right";return!r||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===i.display||"flex"===i.display||"table"===i.display||"grid"===i.display||l>=n&&"none"===a[de]||r&&"none"===a[de]&&l+d>n)?"vertical":"horizontal"},pe=function(t){function e(t,a){return function(n,o,r,i){var s=n.options.group.name&&o.options.group.name&&n.options.group.name===o.options.group.name;if(null==t&&(a||s))return!0;if(null==t||!1===t)return!1;if(a&&"clone"===t)return t;if("function"==typeof t)return e(t(n,o,r,i),a)(n,o,r,i);var l=(a?n:o).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var a={},n=t.group;n&&"object"==Y(n)||(n={name:n}),a.name=n.name,a.checkPull=e(n.pull,!0),a.checkPut=e(n.put),a.revertClone=n.revertClone,t.group=a},ge=function(){!ue&&Mt&&it(Mt,"display","none")},he=function(){!ue&&Mt&&it(Mt,"display","")};se&&document.addEventListener("click",(function(t){if(te)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),te=!1,!1}),!0);var fe=function(t){if(Tt){t=t.touches?t.touches[0]:t;var e=(o=t.clientX,r=t.clientY,ee.some((function(t){var e=t[wt].options.emptyInsertThreshold;if(e&&!pt(t)){var a=ct(t),n=o>=a.left-e&&o<=a.right+e,s=r>=a.top-e&&r<=a.bottom+e;return n&&s?i=t:void 0}})),i);if(e){var a={};for(var n in t)t.hasOwnProperty(n)&&(a[n]=t[n]);a.target=a.rootEl=e,a.preventDefault=void 0,a.stopPropagation=void 0,e[wt]._onDragOver(a)}}var o,r,i},ve=function(t){Tt&&Tt.parentNode[wt]._isOutsideThisEl(t.target)};function be(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=j({},e),t[wt]=this;var a,n,o={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 me(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!==be.supportPointer&&"PointerEvent"in window&&!G,emptyInsertThreshold:5};for(var r in Et.initializePlugins(this,t,o),o)!(r in e)&&(e[r]=o[r]);for(var i in pe(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&ce,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Q(t,"pointerdown",this._onTapStart):(Q(t,"mousedown",this._onTapStart),Q(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Q(t,"dragover",this),Q(t,"dragenter",this)),ee.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),j(this,(n=[],{captureAnimationState:function(){n=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(t){if("none"!==it(t,"display")&&t!==be.ghost){n.push({target:t,rect:ct(t)});var e=X({},n[n.length-1].rect);if(t.thisAnimationDuration){var a=st(t,!0);a&&(e.top-=a.f,e.left-=a.e)}t.fromRect=e}}))},addAnimationState:function(t){n.push(t)},removeAnimationState:function(t){n.splice(function(t,e){for(var a in t)if(t.hasOwnProperty(a))for(var n in e)if(e.hasOwnProperty(n)&&e[n]===t[a][n])return Number(a);return-1}(n,{target:t}),1)},animateAll:function(t){var e=this;if(!this.options.animation)return clearTimeout(a),void("function"==typeof t&&t());var o=!1,r=0;n.forEach((function(t){var a=0,n=t.target,i=n.fromRect,s=ct(n),l=n.prevFromRect,d=n.prevToRect,c=t.rect,u=st(n,!0);u&&(s.top-=u.f,s.left-=u.e),n.toRect=s,n.thisAnimationDuration&&vt(l,s)&&!vt(i,s)&&(c.top-s.top)/(c.left-s.left)==(i.top-s.top)/(i.left-s.left)&&(a=function(t,e,a,n){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-a.top,2)+Math.pow(e.left-a.left,2))*n.animation}(c,l,d,e.options)),vt(s,i)||(n.prevFromRect=i,n.prevToRect=s,a||(a=e.options.animation),e.animate(n,c,s,a)),a&&(o=!0,r=Math.max(r,a),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),a),n.thisAnimationDuration=a)})),clearTimeout(a),o?a=setTimeout((function(){"function"==typeof t&&t()}),r):"function"==typeof t&&t(),n=[]},animate:function(t,e,a,n){if(n){it(t,"transition",""),it(t,"transform","");var o=st(this.el),r=o&&o.a,i=o&&o.d,s=(e.left-a.left)/(r||1),l=(e.top-a.top)/(i||1);t.animatingX=!!s,t.animatingY=!!l,it(t,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),it(t,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),it(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){it(t,"transition",""),it(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),n)}}}))}function ye(t,e,a,n,o,r,i,s){var l,d,c=t[wt],u=c.options.onMove;return!window.CustomEvent||V||W?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=a,l.draggedRect=n,l.related=o||e,l.relatedRect=r||ct(e),l.willInsertAfter=s,l.originalEvent=i,t.dispatchEvent(l),u&&(d=u.call(c,l,i)),d}function _e(t){t.draggable=!1}function we(){re=!1}function Ce(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,a=e.length,n=0;a--;)n+=e.charCodeAt(a);return n.toString(36)}function Ne(t){return setTimeout(t,0)}function Ee(t){return clearTimeout(t)}be.prototype={constructor:be,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||($t=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Tt):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,a=this.el,n=this.options,o=n.preventOnFilter,r=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,d=n.filter;if(function(t){ie.length=0;for(var e=t.getElementsByTagName("input"),a=e.length;a--;){var n=e[a];n.checked&&ie.push(n)}}(a),!Tt&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||n.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!G||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=at(s,n.draggable,a,!1))&&s.animated||Ot===s)){if(At=gt(s),Xt=gt(s,n.draggable),"function"==typeof d){if(d.call(this,t,s,this))return Bt({sortable:e,rootEl:l,name:"filter",targetEl:s,toEl:a,fromEl:a}),Dt("filter",e,{evt:t}),void(o&&t.cancelable&&t.preventDefault())}else if(d&&(d=d.split(",").some((function(n){if(n=at(l,n.trim(),a,!1))return Bt({sortable:e,rootEl:n,name:"filter",targetEl:s,fromEl:a,toEl:a}),Dt("filter",e,{evt:t}),!0}))))return void(o&&t.cancelable&&t.preventDefault());n.handle&&!at(l,n.handle,a,!1)||this._prepareDragStart(t,i,s)}}},_prepareDragStart:function(t,e,a){var n,o=this,r=o.el,i=o.options,s=r.ownerDocument;if(a&&!Tt&&a.parentNode===r){var l=ct(a);if(kt=r,xt=(Tt=a).parentNode,Ft=Tt.nextSibling,Ot=a,Lt=i.group,be.dragged=Tt,Ht={target:Tt,clientX:(e||t).clientX,clientY:(e||t).clientY},Ut=Ht.clientX-l.left,Gt=Ht.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Tt.style["will-change"]="all",n=function(){Dt("delayEnded",o,{evt:t}),be.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!U&&o.nativeDraggable&&(Tt.draggable=!0),o._triggerDragStart(t,e),Bt({sortable:o,name:"choose",originalEvent:t}),rt(Tt,i.chosenClass,!0))},i.ignore.split(",").forEach((function(t){lt(Tt,t.trim(),_e)})),Q(s,"dragover",fe),Q(s,"mousemove",fe),Q(s,"touchmove",fe),Q(s,"mouseup",o._onDrop),Q(s,"touchend",o._onDrop),Q(s,"touchcancel",o._onDrop),U&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Tt.draggable=!0),Dt("delayStart",this,{evt:t}),!i.delay||i.delayOnTouchOnly&&!e||this.nativeDraggable&&(W||V))n();else{if(be.eventCanceled)return void this._onDrop();Q(s,"mouseup",o._disableDelayedDrag),Q(s,"touchend",o._disableDelayedDrag),Q(s,"touchcancel",o._disableDelayedDrag),Q(s,"mousemove",o._delayedDragTouchMoveHandler),Q(s,"touchmove",o._delayedDragTouchMoveHandler),i.supportPointer&&Q(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(n,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(){Tt&&_e(Tt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;J(t,"mouseup",this._disableDelayedDrag),J(t,"touchend",this._disableDelayedDrag),J(t,"touchcancel",this._disableDelayedDrag),J(t,"mousemove",this._delayedDragTouchMoveHandler),J(t,"touchmove",this._delayedDragTouchMoveHandler),J(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Q(document,"pointermove",this._onTouchMove):Q(document,e?"touchmove":"mousemove",this._onTouchMove):(Q(Tt,"dragend",this),Q(kt,"dragstart",this._onDragStart));try{document.selection?Ne((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(Jt=!1,kt&&Tt){Dt("dragStarted",this,{evt:e}),this.nativeDraggable&&Q(document,"dragover",ve);var a=this.options;!t&&rt(Tt,a.dragClass,!1),rt(Tt,a.ghostClass,!0),be.active=this,t&&this._appendGhost(),Bt({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(zt){this._lastX=zt.clientX,this._lastY=zt.clientY,ge();for(var t=document.elementFromPoint(zt.clientX,zt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(zt.clientX,zt.clientY))!==e;)e=t;if(Tt.parentNode[wt]._isOutsideThisEl(t),e)do{if(e[wt]&&e[wt]._onDragOver({clientX:zt.clientX,clientY:zt.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break;t=e}while(e=e.parentNode);he()}},_onTouchMove:function(t){if(Ht){var e=this.options,a=e.fallbackTolerance,n=e.fallbackOffset,o=t.touches?t.touches[0]:t,r=Mt&&st(Mt,!0),i=Mt&&r&&r.a,s=Mt&&r&&r.d,l=le&&Qt&&ht(Qt),d=(o.clientX-Ht.clientX+n.x)/(i||1)+(l?l[0]-oe[0]:0)/(i||1),c=(o.clientY-Ht.clientY+n.y)/(s||1)+(l?l[1]-oe[1]:0)/(s||1);if(!be.active&&!Jt){if(a&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))n.right+10||t.clientX<=n.right&&t.clientY>n.bottom&&t.clientX>=n.left:t.clientX>n.right&&t.clientY>n.top||t.clientX<=n.right&&t.clientY>n.bottom+10}(t,o,this)&&!h.animated){if(h===Tt)return k(!1);if(h&&r===t.target&&(i=h),i&&(a=ct(i)),!1!==ye(kt,r,Tt,e,i,a,t,!!i))return M(),r.appendChild(Tt),xt=r,F(),k(!0)}else if(h&&function(t,e,a){var n=ct(mt(a.el,0,a.options,!0));return e?t.clientXc+d*r/2:lu-Zt)return-qt}else if(l>c+d*(1-o)/2&&lu-d*r/2)?l>c+d/2?1:-1:0}(t,i,a,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,ne,$t===i),0!==v){var S=gt(Tt);do{S-=v,y=xt.children[S]}while(y&&("none"===it(y,"display")||y===Mt))}if(0===v||y===i)return k(!1);$t=i,qt=v;var D=i.nextElementSibling,B=!1,T=ye(kt,r,Tt,e,i,a,t,B=1===v);if(!1!==T)return 1!==T&&-1!==T||(B=1===T),re=!0,setTimeout(we,30),M(),B&&!D?r.appendChild(Tt):i.parentNode.insertBefore(Tt,B?D:i),N&&yt(N,0,E-N.scrollTop),xt=Tt.parentNode,void 0===b||ne||(Zt=Math.abs(b-ct(i)[C])),F(),k(!0)}if(r.contains(Tt))return k(!1)}return!1}function x(s,l){Dt(s,p,X({evt:t,isOwner:c,axis:o?"vertical":"horizontal",revert:n,dragRect:e,targetRect:a,canSort:u,fromSortable:m,target:i,completed:k,onMove:function(a,n){return ye(kt,r,Tt,e,a,ct(a),t,n)},changed:F},l))}function M(){x("dragOverAnimationCapture"),p.captureAnimationState(),p!==m&&m.captureAnimationState()}function k(e){return x("dragOverCompleted",{insertion:e}),e&&(c?d._hideClone():d._showClone(p),p!==m&&(rt(Tt,jt?jt.options.ghostClass:d.options.ghostClass,!1),rt(Tt,s.ghostClass,!0)),jt!==p&&p!==be.active?jt=p:p===be.active&&jt&&(jt=null),m===p&&(p._ignoreWhileAnimating=i),p.animateAll((function(){x("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(i===Tt&&!Tt.animated||i===r&&!i.animated)&&($t=null),s.dragoverBubble||t.rootEl||i===document||(Tt.parentNode[wt]._isOutsideThisEl(t.target),!e&&fe(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),g=!0}function F(){Rt=gt(Tt),Yt=gt(Tt,s.draggable),Bt({sortable:p,name:"change",toEl:r,newIndex:Rt,newDraggableIndex:Yt,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){J(document,"mousemove",this._onTouchMove),J(document,"touchmove",this._onTouchMove),J(document,"pointermove",this._onTouchMove),J(document,"dragover",fe),J(document,"mousemove",fe),J(document,"touchmove",fe)},_offUpEvents:function(){var t=this.el.ownerDocument;J(t,"mouseup",this._onDrop),J(t,"touchend",this._onDrop),J(t,"pointerup",this._onDrop),J(t,"touchcancel",this._onDrop),J(document,"selectstart",this)},_onDrop:function(t){var e=this.el,a=this.options;Rt=gt(Tt),Yt=gt(Tt,a.draggable),Dt("drop",this,{evt:t}),xt=Tt&&Tt.parentNode,Rt=gt(Tt),Yt=gt(Tt,a.draggable),be.eventCanceled||(Jt=!1,ne=!1,ae=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ee(this.cloneId),Ee(this._dragStartId),this.nativeDraggable&&(J(document,"drop",this),J(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),G&&it(document.body,"user-select",""),it(Tt,"transform",""),t&&(Kt&&(t.cancelable&&t.preventDefault(),!a.dropBubble&&t.stopPropagation()),Mt&&Mt.parentNode&&Mt.parentNode.removeChild(Mt),(kt===xt||jt&&"clone"!==jt.lastPutMode)&&It&&It.parentNode&&It.parentNode.removeChild(It),Tt&&(this.nativeDraggable&&J(Tt,"dragend",this),_e(Tt),Tt.style["will-change"]="",Kt&&!Jt&&rt(Tt,jt?jt.options.ghostClass:this.options.ghostClass,!1),rt(Tt,this.options.chosenClass,!1),Bt({sortable:this,name:"unchoose",toEl:xt,newIndex:null,newDraggableIndex:null,originalEvent:t}),kt!==xt?(Rt>=0&&(Bt({rootEl:xt,name:"add",toEl:xt,fromEl:kt,originalEvent:t}),Bt({sortable:this,name:"remove",toEl:xt,originalEvent:t}),Bt({rootEl:xt,name:"sort",toEl:xt,fromEl:kt,originalEvent:t}),Bt({sortable:this,name:"sort",toEl:xt,originalEvent:t})),jt&&jt.save()):Rt!==At&&Rt>=0&&(Bt({sortable:this,name:"update",toEl:xt,originalEvent:t}),Bt({sortable:this,name:"sort",toEl:xt,originalEvent:t})),be.active&&(null!=Rt&&-1!==Rt||(Rt=At,Yt=Xt),Bt({sortable:this,name:"end",toEl:xt,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){Dt("nulling",this),kt=Tt=xt=Mt=Ft=It=Ot=Pt=Ht=zt=Kt=Rt=Yt=At=Xt=$t=qt=jt=Lt=be.dragged=be.ghost=be.clone=be.active=null,ie.forEach((function(t){t.checked=!0})),ie.length=Vt=Wt=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Tt&&(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=[],a=this.el.children,n=0,o=a.length,r=this.options;n{var t={n:e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return t.d(a,{a}),a},d:(e,a)=>{for(var n in a)t.o(a,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:a[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e);const a=flarum.core.compat["common/app"];function n(t,e){return n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}t.n(a)().initializers.add("v17development/flarum-user-badges",(function(){}));const r=flarum.core.compat.Model;var i=t.n(r);const s=flarum.core.compat["utils/mixin"];var l=t.n(s);const d=flarum.core.compat["components/Modal"];var c=t.n(d);const u=flarum.core.compat["components/Button"];var p=t.n(u);const g=flarum.core.compat["helpers/fullTime"];var h=t.n(g);const f=flarum.core.compat["utils/ItemList"];var v=t.n(f);const b=flarum.core.compat["components/LinkButton"];var y=t.n(b);flarum.core.compat["components/Select"];const _=flarum.core.compat["utils/Stream"];var w=t.n(_),C=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var a=e.prototype;return a.oninit=function(e){var a=this;t.prototype.oninit.call(this,e),this.selectedBadge=this.attrs.badge?this.attrs.badge.badge():null,this.user=this.attrs.badge?this.attrs.badge.user():this.attrs.user,this.userHasBadge=!1,this.badge=this.attrs.badge?this.attrs.badge:app.store.createRecord("userBadges"),this.description=w()(this.badge.description()),this.categories={},this.uncategorizedBadges=[],this.loading=!1,this.attrs.badge||(this.loading=!0,app.store.find("badges",{include:"category"}).then((function(t){t.forEach((function(t){if(t.category()){var e=t.category();a.categories[e.id()]?a.categories[e.id()].badges.push(t):a.categories[e.id()]={category:e,badges:[t]}}else a.uncategorizedBadges.push(t)})),a.loading=!1,m.redraw()})))},a.className=function(){return"Modal--small BadgeModal"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum."+(this.badge.exists?"update":"give")+"_badge")},a.content=function(){return m("div",null,m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray())),m("div",{className:"Modal-footer"},m(p(),{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:this.userHasBadge},app.translator.trans("core.forum.composer_edit.submit_button"))))},a.fields=function(){var t=this,e=new(v());return e.add("badge",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.badge"))),m("div",{className:"Select"},m("select",{value:this.selectedBadge?this.selectedBadge.id():"empty",disabled:!!this.attrs.badge,onchange:function(e){"empty"!==e.target.value&&(t.selectedBadge=app.store.getById("badges",e.target.value),t.checkUserHasBadge(t.selectedBadge))},className:"Select-input FormControl"},m("option",{value:"empty"},app.translator.trans("v17development-flarum-badges.forum.select_badge")),!this.attrs.badge&&Object.values(this.categories).map((function(t){var e=t.category,a=t.badges;return m("optgroup",{label:e.name()},a.map((function(t){return m("option",{value:t.id()},t.name())})))})),!this.attrs.badge&&this.uncategorizedBadges.length>=1&&m("optgroup",{label:app.translator.trans("v17development-flarum-badges.forum.uncategorized")},this.uncategorizedBadges.map((function(t){return m("option",{value:t.id()},t.name())}))),!!this.attrs.badge&&m("option",{value:this.selectedBadge.id()},this.selectedBadge.name())),m("i",{class:"icon fas fa-caret-down Select-caret"})),this.userHasBadge&&m("p",{className:"UserHasBadge"},app.translator.trans("v17development-flarum-badges.forum.user_has_badge"))),30),e.add("badge_description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.selectedBadge?this.selectedBadge.description():app.translator.trans("v17development-flarum-badges.forum.select_badge"))),30),e.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"))),m("textarea",{className:"FormControl",placeholder:app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),bidi:this.description})),30),e},a.checkUserHasBadge=function(t){var e=!1;this.user.userBadges().map((function(a){a.badge()==t&&(e=!0)})),this.userHasBadge=e,m.redraw()},a.onsubmit=function(t){var e=this;t.preventDefault(),this.loading=!0,this.badge.save({description:this.description(),relationships:this.attrs.badge?{}:{badge:this.selectedBadge,user:this.user}}).then((function(){e.attrs.badge?app.modal.show(N,{badge:e.attrs.badge.badge(),userBadgeData:e.attrs.badge}):e.hide(),m.redraw()}),(function(t){e.loading=!1,e.handleErrors(t)}))},e}(c()),N=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.loading=!1},a.className=function(){return"Modal--small"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum.badge_information")},a.content=function(){var t=this;return m("div",null,m("div",{className:"Modal-body"},this.data().toArray()),m("div",{className:"Modal-footer"},m(y(),{href:app.route("badges.item",{id:this.attrs.badge.id()}),className:"Button",style:{margin:"0 10px"}},app.translator.trans("v17development-flarum-badges.forum.badge.badge_details")),this.attrs.userBadgeData&&app.forum.attribute("canGiveBadge")&&m(p(),{className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge_confirm"))&&(t.loading=!0,t.attrs.userBadgeData.delete().then((function(){return t.hide()})))},loading:this.loading},app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge"))))},a.data=function(){var t=this,e=new(v());return e.add("name",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.name"),":")),m("p",null,this.attrs.badge.name()))),e.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.attrs.badge.description()))),this.attrs.userBadgeData&&(this.attrs.userBadgeData.description()||app.forum.attribute("canGiveBadge"))&&e.add("earning_reason",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),":")),m("p",null,this.attrs.userBadgeData.description()?this.attrs.userBadgeData.description():m("i",null,app.translator.trans("v17development-flarum-badges.forum.badge.no_earning_reason"))),m("p",null,app.forum.attribute("canGiveBadge")&&m("a",{href:"#",onclick:function(e){e.preventDefault(),app.modal.show(C,{badge:t.attrs.userBadgeData})}},app.translator.trans("v17development-flarum-badges.forum.badge.update_earning_reason"))))),this.attrs.userBadgeData&&e.add("earned_date",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_on"),":")),m("p",null,h()(this.attrs.userBadgeData.assignedAt())))),this.attrs.userBadgeData&&e.add("category",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.category"),":")),m("p",null,this.attrs.badge.category()&&this.attrs.badge.category().name(),!this.attrs.badge.category()&&app.translator.trans("v17development-flarum-badges.forum.uncategorized")))),this.attrs.badge&&this.attrs.badge.earnedAmount()&&e.add("earned_amount",m("div",{className:"BadgeModalListItem"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:this.attrs.badge.earnedAmount()})))),e},e}(c()),E=function(t){function e(){return t.apply(this,arguments)||this}return o(e,t),e.prototype.apiEndpoint=function(){return"/badges"+(this.exists?"/"+this.data.id:"")},e}(l()(i(),{name:i().attribute("name"),icon:i().attribute("icon"),order:i().attribute("order"),image:i().attribute("image"),description:i().attribute("description"),isVisible:i().attribute("isVisible"),createdAt:i().attribute("createdAt"),earnedAmount:i().attribute("earnedAmount"),category:i().hasOne("category"),backgroundColor:i().attribute("backgroundColor"),iconColor:i().attribute("iconColor"),labelColor:i().attribute("labelColor")})),S=function(t){function e(){return t.apply(this,arguments)||this}return o(e,t),e.prototype.apiEndpoint=function(){return"/badge_categories"+(this.exists?"/"+this.data.id:"")},e}(l()(i(),{name:i().attribute("name"),order:i().attribute("order"),description:i().attribute("description"),isEnabled:i().attribute("isEnabled"),createdAt:i().attribute("createdAt"),isTable:i().attribute("isTable"),users:i().hasMany("users"),badges:i().hasMany("badges")}));const B=flarum.core.compat.Component;var D=t.n(B);const T=flarum.core.compat["components/Dropdown"];var x=t.n(T);const M=flarum.core.compat["helpers/icon"];var k=t.n(M),O=!1,F=!1,I=[],P=function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var a=e.prototype;return a.oninit=function(e){var a,n=this;t.prototype.oninit.call(this,e),this.loaded=!1,a=function(){return n.loaded=!0},F?a():O?I.push(a):(O=!0,app.store.find("badges").then((function(){F=!0,O=!1,a(),I.map((function(t){return t()})),m.redraw()})))},a.view=function(){var t=this;if(!this.loaded)return m("div",{className:"Form-group"},m("label",null,this.attrs.label),m(p(),{className:"Button Button--danger",style:{float:"none"},loading:!0},app.translator.trans("v17development-flarum-badges.admin.auto_moderator.badge_selector.loading_badges")));var e=app.store.getById("badges",this.attrs.value),a=e?[k()(e.icon()),"\t",e.name()]:app.translator.trans("v17development-flarum-badges.admin.auto_moderator.badge_selector.placeholder");return m("div",{className:"Form-group"},m("label",null,this.attrs.label),this.attrs.disabled?m("div",{className:"Button Button--danger"},a):m(x(),{label:a,disabled:this.attrs.disabled,buttonClassName:"Button Button--danger"},app.store.all("badges").map((function(a){return p().component({active:e&&e.id()===a.id(),disabled:e&&e.id()===a.id(),icon:a.icon(),onclick:function(){t.attrs.onchange(a.id())}},a.name())}))))},e}(D()),A=function(t){function e(){return t.apply(this,arguments)||this}return o(e,t),e.prototype.view=function(){var t=this.attrs.settings;return m(P,{value:t().badge_id,onchange:function(e){return t({badge_id:e})}})},e}(D());function R(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function X(t){for(var e=1;e=0||(o[a]=t[a]);return o}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(o[a]=t[a])}return o}function z(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var V=z(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),U=z(/Edge/i),W=z(/firefox/i),G=z(/safari/i)&&!z(/chrome/i)&&!z(/android/i),K=z(/iP(ad|od|hone)/i),q=z(/chrome/i)&&z(/android/i),Z={capture:!1,passive:!1};function Q(t,e,a){t.addEventListener(e,a,!V&&Z)}function J(t,e,a){t.removeEventListener(e,a,!V&&Z)}function tt(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 et(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function at(t,e,a,n){if(t){a=a||document;do{if(null!=e&&(">"===e[0]?t.parentNode===a&&tt(t,e):tt(t,e))||n&&t===a)return t;if(t===a)break}while(t=et(t))}return null}var nt,ot=/\s+/g;function rt(t,e,a){if(t&&e)if(t.classList)t.classList[a?"add":"remove"](e);else{var n=(" "+t.className+" ").replace(ot," ").replace(" "+e+" "," ");t.className=(n+(a?" "+e:"")).replace(ot," ")}}function it(t,e,a){var n=t&&t.style;if(n){if(void 0===a)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(a=t.currentStyle),void 0===e?a:a[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=a+("string"==typeof a?"":"px")}}function st(t,e){var a="";if("string"==typeof t)a=t;else do{var n=it(t,"transform");n&&"none"!==n&&(a=n+" "+a)}while(!e&&(t=t.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(a)}function lt(t,e,a){if(t){var n=t.getElementsByTagName(e),o=0,r=n.length;if(a)for(;o=r:o<=r))return n;if(n===dt())break;n=ft(n,!1)}return!1}function mt(t,e,a,n){for(var o=0,r=0,i=t.children;r2&&void 0!==arguments[2]?arguments[2]:{},n=a.evt,o=H(a,St);Et.pluginEvent.bind(be)(t,e,X({dragEl:Tt,parentEl:xt,ghostEl:Mt,rootEl:kt,nextEl:Ot,lastDownEl:Ft,cloneEl:It,cloneHidden:Pt,dragStarted:Kt,putSortable:jt,activeSortable:be.active,originalEvent:n,oldIndex:At,oldDraggableIndex:Xt,newIndex:Rt,newDraggableIndex:Yt,hideGhostForTarget:ge,unhideGhostForTarget:he,cloneNowHidden:function(){Pt=!0},cloneNowShown:function(){Pt=!1},dispatchSortableEvent:function(t){Dt({sortable:e,name:t,originalEvent:n})}},o))};function Dt(t){!function(t){var e=t.sortable,a=t.rootEl,n=t.name,o=t.targetEl,r=t.cloneEl,i=t.toEl,s=t.fromEl,l=t.oldIndex,d=t.newIndex,c=t.oldDraggableIndex,u=t.newDraggableIndex,m=t.originalEvent,p=t.putSortable,g=t.extraEventProperties;if(e=e||a&&a[wt]){var h,f=e.options,v="on"+n.charAt(0).toUpperCase()+n.substr(1);!window.CustomEvent||V||U?(h=document.createEvent("Event")).initEvent(n,!0,!0):h=new CustomEvent(n,{bubbles:!0,cancelable:!0}),h.to=i||a,h.from=s||a,h.item=o||a,h.clone=r,h.oldIndex=l,h.newIndex=d,h.oldDraggableIndex=c,h.newDraggableIndex=u,h.originalEvent=m,h.pullMode=p?p.lastPutMode:void 0;var b=X(X({},g),Et.getEventProperties(n,e));for(var y in b)h[y]=b[y];a&&a.dispatchEvent(h),f[v]&&f[v].call(e,h)}}(X({putSortable:jt,cloneEl:It,targetEl:Tt,rootEl:kt,oldIndex:At,oldDraggableIndex:Xt,newIndex:Rt,newDraggableIndex:Yt},t))}var Tt,xt,Mt,kt,Ot,Ft,It,Pt,At,Rt,Xt,Yt,Lt,jt,Ht,zt,Vt,Ut,Wt,Gt,Kt,$t,qt,Zt,Qt,Jt=!1,te=!1,ee=[],ae=!1,ne=!1,oe=[],re=!1,ie=[],se="undefined"!=typeof document,le=K,de=U||V?"cssFloat":"float",ce=se&&!q&&!K&&"draggable"in document.createElement("div"),ue=function(){if(se){if(V)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),me=function(t,e){var a=it(t),n=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),o=mt(t,0,e),r=mt(t,1,e),i=o&&it(o),s=r&&it(r),l=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+ct(o).width,d=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+ct(r).width;if("flex"===a.display)return"column"===a.flexDirection||"column-reverse"===a.flexDirection?"vertical":"horizontal";if("grid"===a.display)return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&i.float&&"none"!==i.float){var c="left"===i.float?"left":"right";return!r||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===i.display||"flex"===i.display||"table"===i.display||"grid"===i.display||l>=n&&"none"===a[de]||r&&"none"===a[de]&&l+d>n)?"vertical":"horizontal"},pe=function(t){function e(t,a){return function(n,o,r,i){var s=n.options.group.name&&o.options.group.name&&n.options.group.name===o.options.group.name;if(null==t&&(a||s))return!0;if(null==t||!1===t)return!1;if(a&&"clone"===t)return t;if("function"==typeof t)return e(t(n,o,r,i),a)(n,o,r,i);var l=(a?n:o).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var a={},n=t.group;n&&"object"==Y(n)||(n={name:n}),a.name=n.name,a.checkPull=e(n.pull,!0),a.checkPut=e(n.put),a.revertClone=n.revertClone,t.group=a},ge=function(){!ue&&Mt&&it(Mt,"display","none")},he=function(){!ue&&Mt&&it(Mt,"display","")};se&&document.addEventListener("click",(function(t){if(te)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),te=!1,!1}),!0);var fe=function(t){if(Tt){t=t.touches?t.touches[0]:t;var e=(o=t.clientX,r=t.clientY,ee.some((function(t){var e=t[wt].options.emptyInsertThreshold;if(e&&!pt(t)){var a=ct(t),n=o>=a.left-e&&o<=a.right+e,s=r>=a.top-e&&r<=a.bottom+e;return n&&s?i=t:void 0}})),i);if(e){var a={};for(var n in t)t.hasOwnProperty(n)&&(a[n]=t[n]);a.target=a.rootEl=e,a.preventDefault=void 0,a.stopPropagation=void 0,e[wt]._onDragOver(a)}}var o,r,i},ve=function(t){Tt&&Tt.parentNode[wt]._isOutsideThisEl(t.target)};function be(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=j({},e),t[wt]=this;var a,n,o={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 me(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!==be.supportPointer&&"PointerEvent"in window&&!G,emptyInsertThreshold:5};for(var r in Et.initializePlugins(this,t,o),o)!(r in e)&&(e[r]=o[r]);for(var i in pe(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&ce,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Q(t,"pointerdown",this._onTapStart):(Q(t,"mousedown",this._onTapStart),Q(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Q(t,"dragover",this),Q(t,"dragenter",this)),ee.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),j(this,(n=[],{captureAnimationState:function(){n=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(t){if("none"!==it(t,"display")&&t!==be.ghost){n.push({target:t,rect:ct(t)});var e=X({},n[n.length-1].rect);if(t.thisAnimationDuration){var a=st(t,!0);a&&(e.top-=a.f,e.left-=a.e)}t.fromRect=e}}))},addAnimationState:function(t){n.push(t)},removeAnimationState:function(t){n.splice(function(t,e){for(var a in t)if(t.hasOwnProperty(a))for(var n in e)if(e.hasOwnProperty(n)&&e[n]===t[a][n])return Number(a);return-1}(n,{target:t}),1)},animateAll:function(t){var e=this;if(!this.options.animation)return clearTimeout(a),void("function"==typeof t&&t());var o=!1,r=0;n.forEach((function(t){var a=0,n=t.target,i=n.fromRect,s=ct(n),l=n.prevFromRect,d=n.prevToRect,c=t.rect,u=st(n,!0);u&&(s.top-=u.f,s.left-=u.e),n.toRect=s,n.thisAnimationDuration&&vt(l,s)&&!vt(i,s)&&(c.top-s.top)/(c.left-s.left)==(i.top-s.top)/(i.left-s.left)&&(a=function(t,e,a,n){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-a.top,2)+Math.pow(e.left-a.left,2))*n.animation}(c,l,d,e.options)),vt(s,i)||(n.prevFromRect=i,n.prevToRect=s,a||(a=e.options.animation),e.animate(n,c,s,a)),a&&(o=!0,r=Math.max(r,a),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),a),n.thisAnimationDuration=a)})),clearTimeout(a),o?a=setTimeout((function(){"function"==typeof t&&t()}),r):"function"==typeof t&&t(),n=[]},animate:function(t,e,a,n){if(n){it(t,"transition",""),it(t,"transform","");var o=st(this.el),r=o&&o.a,i=o&&o.d,s=(e.left-a.left)/(r||1),l=(e.top-a.top)/(i||1);t.animatingX=!!s,t.animatingY=!!l,it(t,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),it(t,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),it(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){it(t,"transition",""),it(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),n)}}}))}function ye(t,e,a,n,o,r,i,s){var l,d,c=t[wt],u=c.options.onMove;return!window.CustomEvent||V||U?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=a,l.draggedRect=n,l.related=o||e,l.relatedRect=r||ct(e),l.willInsertAfter=s,l.originalEvent=i,t.dispatchEvent(l),u&&(d=u.call(c,l,i)),d}function _e(t){t.draggable=!1}function we(){re=!1}function Ce(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,a=e.length,n=0;a--;)n+=e.charCodeAt(a);return n.toString(36)}function Ne(t){return setTimeout(t,0)}function Ee(t){return clearTimeout(t)}be.prototype={constructor:be,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||($t=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Tt):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,a=this.el,n=this.options,o=n.preventOnFilter,r=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,d=n.filter;if(function(t){ie.length=0;for(var e=t.getElementsByTagName("input"),a=e.length;a--;){var n=e[a];n.checked&&ie.push(n)}}(a),!Tt&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||n.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!G||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=at(s,n.draggable,a,!1))&&s.animated||Ft===s)){if(At=gt(s),Xt=gt(s,n.draggable),"function"==typeof d){if(d.call(this,t,s,this))return Dt({sortable:e,rootEl:l,name:"filter",targetEl:s,toEl:a,fromEl:a}),Bt("filter",e,{evt:t}),void(o&&t.cancelable&&t.preventDefault())}else if(d&&(d=d.split(",").some((function(n){if(n=at(l,n.trim(),a,!1))return Dt({sortable:e,rootEl:n,name:"filter",targetEl:s,fromEl:a,toEl:a}),Bt("filter",e,{evt:t}),!0}))))return void(o&&t.cancelable&&t.preventDefault());n.handle&&!at(l,n.handle,a,!1)||this._prepareDragStart(t,i,s)}}},_prepareDragStart:function(t,e,a){var n,o=this,r=o.el,i=o.options,s=r.ownerDocument;if(a&&!Tt&&a.parentNode===r){var l=ct(a);if(kt=r,xt=(Tt=a).parentNode,Ot=Tt.nextSibling,Ft=a,Lt=i.group,be.dragged=Tt,Ht={target:Tt,clientX:(e||t).clientX,clientY:(e||t).clientY},Wt=Ht.clientX-l.left,Gt=Ht.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Tt.style["will-change"]="all",n=function(){Bt("delayEnded",o,{evt:t}),be.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!W&&o.nativeDraggable&&(Tt.draggable=!0),o._triggerDragStart(t,e),Dt({sortable:o,name:"choose",originalEvent:t}),rt(Tt,i.chosenClass,!0))},i.ignore.split(",").forEach((function(t){lt(Tt,t.trim(),_e)})),Q(s,"dragover",fe),Q(s,"mousemove",fe),Q(s,"touchmove",fe),Q(s,"mouseup",o._onDrop),Q(s,"touchend",o._onDrop),Q(s,"touchcancel",o._onDrop),W&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Tt.draggable=!0),Bt("delayStart",this,{evt:t}),!i.delay||i.delayOnTouchOnly&&!e||this.nativeDraggable&&(U||V))n();else{if(be.eventCanceled)return void this._onDrop();Q(s,"mouseup",o._disableDelayedDrag),Q(s,"touchend",o._disableDelayedDrag),Q(s,"touchcancel",o._disableDelayedDrag),Q(s,"mousemove",o._delayedDragTouchMoveHandler),Q(s,"touchmove",o._delayedDragTouchMoveHandler),i.supportPointer&&Q(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(n,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(){Tt&&_e(Tt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;J(t,"mouseup",this._disableDelayedDrag),J(t,"touchend",this._disableDelayedDrag),J(t,"touchcancel",this._disableDelayedDrag),J(t,"mousemove",this._delayedDragTouchMoveHandler),J(t,"touchmove",this._delayedDragTouchMoveHandler),J(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?Q(document,"pointermove",this._onTouchMove):Q(document,e?"touchmove":"mousemove",this._onTouchMove):(Q(Tt,"dragend",this),Q(kt,"dragstart",this._onDragStart));try{document.selection?Ne((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(Jt=!1,kt&&Tt){Bt("dragStarted",this,{evt:e}),this.nativeDraggable&&Q(document,"dragover",ve);var a=this.options;!t&&rt(Tt,a.dragClass,!1),rt(Tt,a.ghostClass,!0),be.active=this,t&&this._appendGhost(),Dt({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(zt){this._lastX=zt.clientX,this._lastY=zt.clientY,ge();for(var t=document.elementFromPoint(zt.clientX,zt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(zt.clientX,zt.clientY))!==e;)e=t;if(Tt.parentNode[wt]._isOutsideThisEl(t),e)do{if(e[wt]&&e[wt]._onDragOver({clientX:zt.clientX,clientY:zt.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break;t=e}while(e=e.parentNode);he()}},_onTouchMove:function(t){if(Ht){var e=this.options,a=e.fallbackTolerance,n=e.fallbackOffset,o=t.touches?t.touches[0]:t,r=Mt&&st(Mt,!0),i=Mt&&r&&r.a,s=Mt&&r&&r.d,l=le&&Qt&&ht(Qt),d=(o.clientX-Ht.clientX+n.x)/(i||1)+(l?l[0]-oe[0]:0)/(i||1),c=(o.clientY-Ht.clientY+n.y)/(s||1)+(l?l[1]-oe[1]:0)/(s||1);if(!be.active&&!Jt){if(a&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))n.right+10||t.clientX<=n.right&&t.clientY>n.bottom&&t.clientX>=n.left:t.clientX>n.right&&t.clientY>n.top||t.clientX<=n.right&&t.clientY>n.bottom+10}(t,o,this)&&!h.animated){if(h===Tt)return k(!1);if(h&&r===t.target&&(i=h),i&&(a=ct(i)),!1!==ye(kt,r,Tt,e,i,a,t,!!i))return M(),r.appendChild(Tt),xt=r,O(),k(!0)}else if(h&&function(t,e,a){var n=ct(mt(a.el,0,a.options,!0));return e?t.clientXc+d*r/2:lu-Zt)return-qt}else if(l>c+d*(1-o)/2&&lu-d*r/2)?l>c+d/2?1:-1:0}(t,i,a,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,ne,$t===i),0!==v){var S=gt(Tt);do{S-=v,y=xt.children[S]}while(y&&("none"===it(y,"display")||y===Mt))}if(0===v||y===i)return k(!1);$t=i,qt=v;var B=i.nextElementSibling,D=!1,T=ye(kt,r,Tt,e,i,a,t,D=1===v);if(!1!==T)return 1!==T&&-1!==T||(D=1===T),re=!0,setTimeout(we,30),M(),D&&!B?r.appendChild(Tt):i.parentNode.insertBefore(Tt,D?B:i),N&&yt(N,0,E-N.scrollTop),xt=Tt.parentNode,void 0===b||ne||(Zt=Math.abs(b-ct(i)[C])),O(),k(!0)}if(r.contains(Tt))return k(!1)}return!1}function x(s,l){Bt(s,p,X({evt:t,isOwner:c,axis:o?"vertical":"horizontal",revert:n,dragRect:e,targetRect:a,canSort:u,fromSortable:m,target:i,completed:k,onMove:function(a,n){return ye(kt,r,Tt,e,a,ct(a),t,n)},changed:O},l))}function M(){x("dragOverAnimationCapture"),p.captureAnimationState(),p!==m&&m.captureAnimationState()}function k(e){return x("dragOverCompleted",{insertion:e}),e&&(c?d._hideClone():d._showClone(p),p!==m&&(rt(Tt,jt?jt.options.ghostClass:d.options.ghostClass,!1),rt(Tt,s.ghostClass,!0)),jt!==p&&p!==be.active?jt=p:p===be.active&&jt&&(jt=null),m===p&&(p._ignoreWhileAnimating=i),p.animateAll((function(){x("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(i===Tt&&!Tt.animated||i===r&&!i.animated)&&($t=null),s.dragoverBubble||t.rootEl||i===document||(Tt.parentNode[wt]._isOutsideThisEl(t.target),!e&&fe(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),g=!0}function O(){Rt=gt(Tt),Yt=gt(Tt,s.draggable),Dt({sortable:p,name:"change",toEl:r,newIndex:Rt,newDraggableIndex:Yt,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){J(document,"mousemove",this._onTouchMove),J(document,"touchmove",this._onTouchMove),J(document,"pointermove",this._onTouchMove),J(document,"dragover",fe),J(document,"mousemove",fe),J(document,"touchmove",fe)},_offUpEvents:function(){var t=this.el.ownerDocument;J(t,"mouseup",this._onDrop),J(t,"touchend",this._onDrop),J(t,"pointerup",this._onDrop),J(t,"touchcancel",this._onDrop),J(document,"selectstart",this)},_onDrop:function(t){var e=this.el,a=this.options;Rt=gt(Tt),Yt=gt(Tt,a.draggable),Bt("drop",this,{evt:t}),xt=Tt&&Tt.parentNode,Rt=gt(Tt),Yt=gt(Tt,a.draggable),be.eventCanceled||(Jt=!1,ne=!1,ae=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ee(this.cloneId),Ee(this._dragStartId),this.nativeDraggable&&(J(document,"drop",this),J(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),G&&it(document.body,"user-select",""),it(Tt,"transform",""),t&&(Kt&&(t.cancelable&&t.preventDefault(),!a.dropBubble&&t.stopPropagation()),Mt&&Mt.parentNode&&Mt.parentNode.removeChild(Mt),(kt===xt||jt&&"clone"!==jt.lastPutMode)&&It&&It.parentNode&&It.parentNode.removeChild(It),Tt&&(this.nativeDraggable&&J(Tt,"dragend",this),_e(Tt),Tt.style["will-change"]="",Kt&&!Jt&&rt(Tt,jt?jt.options.ghostClass:this.options.ghostClass,!1),rt(Tt,this.options.chosenClass,!1),Dt({sortable:this,name:"unchoose",toEl:xt,newIndex:null,newDraggableIndex:null,originalEvent:t}),kt!==xt?(Rt>=0&&(Dt({rootEl:xt,name:"add",toEl:xt,fromEl:kt,originalEvent:t}),Dt({sortable:this,name:"remove",toEl:xt,originalEvent:t}),Dt({rootEl:xt,name:"sort",toEl:xt,fromEl:kt,originalEvent:t}),Dt({sortable:this,name:"sort",toEl:xt,originalEvent:t})),jt&&jt.save()):Rt!==At&&Rt>=0&&(Dt({sortable:this,name:"update",toEl:xt,originalEvent:t}),Dt({sortable:this,name:"sort",toEl:xt,originalEvent:t})),be.active&&(null!=Rt&&-1!==Rt||(Rt=At,Yt=Xt),Dt({sortable:this,name:"end",toEl:xt,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){Bt("nulling",this),kt=Tt=xt=Mt=Ot=It=Ft=Pt=Ht=zt=Kt=Rt=Yt=At=Xt=$t=qt=jt=Lt=be.dragged=be.ghost=be.clone=be.active=null,ie.forEach((function(t){t.checked=!0})),ie.length=Vt=Ut=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Tt&&(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=[],a=this.el.children,n=0,o=a.length,r=this.options;n {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/app'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\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}","import app from 'flarum/common/app';\n\napp.initializers.add('v17development/flarum-user-badges', () => {\n // console.log('[v17development/flarum-user-badges] Hello, forum and admin!')\n});\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/mixin'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['helpers/fullTime'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/LinkButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Select'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/Stream'];","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport ItemList from 'flarum/utils/ItemList';\nimport Select from 'flarum/components/Select';\nimport Stream from 'flarum/utils/Stream';\nimport BadgeModal from './BadgeModal';\n\nexport default class GiveBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Select image\n this.selectedBadge = this.attrs.badge ? this.attrs.badge.badge() : null;\n\n // Current user\n this.user = this.attrs.badge ? this.attrs.badge.user() : this.attrs.user;\n\n // User has badge\n this.userHasBadge = false;\n\n // Badge model\n this.badge = this.attrs.badge ? this.attrs.badge : app.store.createRecord('userBadges');\n\n // Earning reason\n this.description = Stream(this.badge.description());\n\n // List of available bagges\n this.categories = {};\n\n this.uncategorizedBadges = [];\n\n this.loading = false;\n\n // Load all available badges\n if (!this.attrs.badge) {\n this.loading = true;\n\n app.store\n .find('badges', {\n include: 'category',\n })\n .then((badges) => {\n badges.forEach((badge) => {\n // Categorized\n if (badge.category()) {\n const category = badge.category();\n\n if (!this.categories[category.id()]) {\n this.categories[category.id()] = {\n category,\n badges: [badge],\n };\n } else {\n this.categories[category.id()].badges.push(badge);\n }\n }\n // Uncategorized\n else {\n this.uncategorizedBadges.push(badge);\n }\n });\n\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n }\n }\n\n className() {\n return 'Modal--small BadgeModal';\n }\n\n title() {\n return app.translator.trans(`v17development-flarum-badges.forum.${this.badge.exists ? 'update' : 'give'}_badge`);\n }\n\n content() {\n return (\n
\n
\n
{this.fields().toArray()}
\n
\n\n
\n \n
\n
\n );\n }\n\n fields() {\n const items = new ItemList();\n\n // Badge selector\n items.add(\n 'badge',\n
\n

\n {app.translator.trans('v17development-flarum-badges.forum.badge.badge')}\n

\n\n
\n {\n if (e.target.value === 'empty') return;\n this.selectedBadge = app.store.getById('badges', e.target.value);\n\n // Check if the user already has this badge\n this.checkUserHasBadge(this.selectedBadge);\n }}\n className=\"Select-input FormControl\"\n >\n \n\n {/* When no badge is selected, show all available badges */}\n {!this.attrs.badge &&\n Object.values(this.categories).map(({ category, badges }) => (\n \n {badges.map((badge) => (\n \n ))}\n \n ))}\n\n {!this.attrs.badge && this.uncategorizedBadges.length >= 1 && (\n \n {this.uncategorizedBadges.map((badge) => (\n \n ))}\n \n )}\n\n {/* When a badge is already assigned */}\n {!!this.attrs.badge && }\n \n \n
\n\n {this.userHasBadge &&

{app.translator.trans('v17development-flarum-badges.forum.user_has_badge')}

}\n
,\n 30\n );\n\n // Badge description\n items.add(\n 'badge_description',\n
\n

\n {app.translator.trans('v17development-flarum-badges.forum.badge.description')}:\n

\n

{this.selectedBadge ? this.selectedBadge.description() : app.translator.trans('v17development-flarum-badges.forum.select_badge')}

\n
,\n 30\n );\n\n // Badge earning reason\n items.add(\n 'description',\n
\n

\n {app.translator.trans('v17development-flarum-badges.forum.badge.earning_reason')}\n

\n \n
,\n 30\n );\n\n return items;\n }\n\n checkUserHasBadge(badge) {\n let foundBadge = false;\n\n this.user.userBadges().map((userBadge) => {\n if (userBadge.badge() == badge) {\n foundBadge = true;\n }\n });\n\n this.userHasBadge = foundBadge;\n\n m.redraw();\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n description: this.description(),\n relationships: this.attrs.badge\n ? {}\n : {\n badge: this.selectedBadge,\n user: this.user,\n },\n })\n .then(\n () => {\n // Re-open badge modal\n if (this.attrs.badge) {\n app.modal.show(BadgeModal, {\n badge: this.attrs.badge.badge(),\n userBadgeData: this.attrs.badge,\n });\n } else {\n this.hide();\n }\n\n m.redraw();\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport fullTime from 'flarum/helpers/fullTime';\nimport ItemList from 'flarum/utils/ItemList';\nimport LinkButton from 'flarum/components/LinkButton';\nimport GiveBadgeModal from './GiveBadgeModal';\n\nexport default class BadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--small';\n }\n\n title() {\n return app.translator.trans('v17development-flarum-badges.forum.badge_information');\n }\n\n content() {\n return (\n
\n
{this.data().toArray()}
\n
\n \n {app.translator.trans('v17development-flarum-badges.forum.badge.badge_details')}\n \n\n {this.attrs.userBadgeData && app.forum.attribute('canGiveBadge') && (\n {\n if (confirm(app.translator.trans('v17development-flarum-badges.forum.moderation.remove_badge_confirm'))) {\n this.loading = true;\n this.attrs.userBadgeData.delete().then(() => this.hide());\n }\n }}\n loading={this.loading}\n >\n {app.translator.trans('v17development-flarum-badges.forum.moderation.remove_badge')}\n \n )}\n
\n
\n );\n }\n\n data() {\n const items = new ItemList();\n\n // Badge name\n items.add(\n 'name',\n
\n

\n {app.translator.trans('v17development-flarum-badges.forum.badge.name')}:\n

\n

{this.attrs.badge.name()}

\n
\n );\n\n // Badge description\n items.add(\n 'description',\n
\n

\n {app.translator.trans('v17development-flarum-badges.forum.badge.description')}:\n

\n

{this.attrs.badge.description()}

\n
\n );\n\n // Badge earning reason\n if (this.attrs.userBadgeData && (this.attrs.userBadgeData.description() || app.forum.attribute('canGiveBadge'))) {\n items.add(\n 'earning_reason',\n
\n

\n {app.translator.trans('v17development-flarum-badges.forum.badge.earning_reason')}:\n

\n\n

\n {this.attrs.userBadgeData.description() ? (\n this.attrs.userBadgeData.description()\n ) : (\n {app.translator.trans('v17development-flarum-badges.forum.badge.no_earning_reason')}\n )}\n

\n

\n {app.forum.attribute('canGiveBadge') && (\n {\n e.preventDefault();\n app.modal.show(GiveBadgeModal, {\n badge: this.attrs.userBadgeData,\n });\n }}\n >\n {app.translator.trans('v17development-flarum-badges.forum.badge.update_earning_reason')}\n \n )}\n

\n
\n );\n }\n\n // Badge earned on\n if (this.attrs.userBadgeData) {\n items.add(\n 'earned_date',\n
\n

\n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_on')}:\n

\n

{fullTime(this.attrs.userBadgeData.assignedAt())}

\n
\n );\n }\n\n // Badge category\n if (this.attrs.userBadgeData) {\n items.add(\n 'category',\n
\n

\n {app.translator.trans('v17development-flarum-badges.forum.badge.category')}:\n

\n

\n {this.attrs.badge.category() && this.attrs.badge.category().name()}\n\n {/* Uncategorized */}\n {!this.attrs.badge.category() && app.translator.trans('v17development-flarum-badges.forum.uncategorized')}\n {/* \n {app.translator.trans(\n \"v17development-flarum-badges.forum.all_badges\"\n )}\n */}\n

\n
\n );\n }\n\n // Badge category\n if (this.attrs.badge && this.attrs.badge.earnedAmount()) {\n items.add(\n 'earned_amount',\n
\n

\n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_count', {\n count: this.attrs.badge.earnedAmount(),\n })}\n

\n
\n );\n }\n\n return items;\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport BadgeModal from '../../forum/components/BadgeModal';\n\nexport default class Badge extends mixin(Model, {\n name: Model.attribute('name'),\n icon: Model.attribute('icon'),\n order: Model.attribute('order'),\n image: Model.attribute('image'),\n description: Model.attribute('description'),\n isVisible: Model.attribute('isVisible'),\n createdAt: Model.attribute('createdAt'),\n earnedAmount: Model.attribute('earnedAmount'),\n category: Model.hasOne('category'),\n backgroundColor: Model.attribute('backgroundColor'),\n iconColor: Model.attribute('iconColor'),\n labelColor: Model.attribute('labelColor'),\n}) {\n apiEndpoint() {\n return '/badges' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class BadgeCategory extends mixin(Model, {\n name: Model.attribute('name'),\n order: Model.attribute('order'),\n description: Model.attribute('description'),\n isEnabled: Model.attribute('isEnabled'),\n createdAt: Model.attribute('createdAt'),\n isTable: Model.attribute('isTable'),\n users: Model.hasMany('users'),\n badges: Model.hasMany('badges'),\n}) {\n apiEndpoint() {\n return '/badge_categories' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Dropdown'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['helpers/icon'];","let loading = false;\nlet hasLoaded = false;\nlet onLoadedCallbacks = [];\n\nexport default function loadAllBadges(onLoadedCallback) {\n // Badges have already been loaded\n if (hasLoaded) {\n onLoadedCallback();\n return;\n }\n\n // Load badges if not already loading\n if (!loading) {\n loading = true;\n\n // Load badges\n app.store.find('badges').then(() => {\n hasLoaded = true;\n loading = false;\n\n onLoadedCallback();\n\n // Give callback\n onLoadedCallbacks.map((cb) => cb());\n\n m.redraw();\n });\n } else {\n onLoadedCallbacks.push(onLoadedCallback);\n }\n}\n","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport Dropdown from 'flarum/components/Dropdown';\nimport icon from 'flarum/helpers/icon';\nimport loadAllBadges from '../utils/loadBadges';\n\nexport default class BadgeSelector extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loaded = false;\n\n // Load badges\n loadAllBadges(() => (this.loaded = true));\n }\n\n view() {\n if (!this.loaded) {\n return (\n
\n \n\n \n
\n );\n }\n\n const badge = app.store.getById('badges', this.attrs.value);\n const label = badge\n ? [icon(badge.icon()), '\\t', badge.name()]\n : app.translator.trans('v17development-flarum-badges.admin.auto_moderator.badge_selector.placeholder');\n return (\n
\n \n\n {this.attrs.disabled ? (\n
{label}
\n ) : (\n \n {app.store.all('badges').map((g) =>\n Button.component(\n {\n active: badge && badge.id() === g.id(),\n disabled: badge && badge.id() === g.id(),\n icon: g.icon(),\n onclick: () => {\n this.attrs.onchange(g.id());\n },\n },\n g.name()\n )\n )}\n \n )}\n
\n );\n }\n}\n","import Component from 'flarum/Component';\nimport BadgeSelector from './BadgeSelector';\n\nexport default class BadgeActionDriverSettings extends Component {\n view() {\n const settings = this.attrs.settings;\n\n return settings({ badge_id: val })} />;\n }\n}\n","/**!\n * Sortable 1.14.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.14.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/**\n * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\n * @param {Number} x X position\n * @param {Number} y Y position\n * @return {HTMLElement} Element of the first found nearest Sortable\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) {\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/**\n * @class Sortable\n * @param {HTMLElement} el\n * @param {Object} [options]\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.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 el.appendChild(dragEl);\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 /**\n * Serializes the item into an array of string.\n * @returns {String[]}\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 /**\n * Sorts the elements according to the array.\n * @param {String[]} order order of the items\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 /**\n * Save the current sorting\n */\n save: function save() {\n var store = this.options.store;\n store && store.set && store.set(this);\n },\n\n /**\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.\n * @param {HTMLElement} el\n * @param {String} [selector] default: `options.draggable`\n * @returns {HTMLElement|null}\n */\n closest: function closest$1(el, selector) {\n return closest(el, selector || this.options.draggable, this.el, false);\n },\n\n /**\n * Set/get option\n * @param {string} name\n * @param {*} [value]\n * @returns {*}\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 /**\n * Destroy\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/**\n * Gets the direction dragEl must be swapped relative to target in order to make it\n * seem that dragEl has been \"inserted\" into that element's position\n * @param {HTMLElement} target The target whose position dragEl is being inserted at\n * @return {Number} Direction dragEl must be swapped\n */\n\n\nfunction _getInsertDirection(target) {\n if (index(dragEl) < index(target)) {\n return 1;\n } else {\n return -1;\n }\n}\n/**\n * Generate id\n * @param {HTMLElement} el\n * @returns {String}\n * @private\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/**\n * Get the Sortable instance of an element\n * @param {HTMLElement} element The element\n * @return {Sortable|undefined} The instance of Sortable\n */\n\nSortable.get = function (element) {\n return element[expando];\n};\n/**\n * Mount a plugin to Sortable\n * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted\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/**\n * Create sortable instance\n * @param {HTMLElement} el\n * @param {Object} [options]\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.supportPointer) {\n on(document, 'pointerup', this._deselectMultiDrag);\n } else {\n on(document, 'mouseup', this._deselectMultiDrag);\n on(document, 'touchend', this._deselectMultiDrag);\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 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 originalEvt: 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 originalEvt: 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 originalEvt: 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 originalEvt: 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 /**\n * Selects the provided multi-drag item\n * @param {HTMLElement} el The element to be selected\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 /**\n * Deselects the provided multi-drag item\n * @param {HTMLElement} el The element to be deselected\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/**\n * Insert multi-drag clones\n * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted\n * @param {HTMLElement} rootEl\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['components/ExtensionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","import Component from 'flarum/common/Component';\nimport Tooltip from 'flarum/common/components/Tooltip';\nimport BadgeModal from '../../forum/components/BadgeModal';\n\nexport default class UserBadge extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.tooltip = this.attrs.tooltip !== false;\n this.forceVisibility = this.attrs.forceVisibility === true;\n }\n\n view() {\n // Hide badge when not enabled\n if (!this.attrs.badge.isVisible() && !this.forceVisibility) {\n return null;\n }\n\n // Just show badge\n if (this.tooltip === false) return this.badge();\n\n return {this.badge()};\n }\n\n badge() {\n const isPartlyHidden = !this.attrs.badge.isVisible() && this.forceVisibility;\n\n // This badge is an image\n if (this.attrs.badge.image()) {\n return (\n {\n if (this.attrs.onclick) {\n this.attrs.onclick();\n }\n }}\n style={{\n opacity: isPartlyHidden ? 0.5 : undefined,\n }}\n />\n );\n }\n\n return (\n {\n if (this.attrs.onclick) {\n this.attrs.onclick();\n }\n }}\n style={{\n backgroundColor: this.attrs.badge.backgroundColor(),\n color: this.attrs.badge.labelColor(),\n borderColor: this.attrs.badge.backgroundColor(),\n opacity: isPartlyHidden ? 0.5 : undefined,\n }}\n >\n {this.attrs.badge.name()}\n \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Switch'];","import Modal from 'flarum/components/Modal';\nimport ItemList from 'flarum/utils/ItemList';\nimport Button from 'flarum/components/Button';\nimport Switch from 'flarum/components/Switch';\nimport Stream from 'flarum/utils/Stream';\n\nexport default class ConfirmModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--small FlarumBadgesConfirmModal';\n }\n\n title() {\n return app.translator.trans(`v17development-flarum-badges.admin.confirm_dialog.title`);\n }\n\n content() {\n return [\n
\n

{this.attrs.text}

\n
,\n\n
\n {Button.component(\n {\n className: 'Button',\n disabled: this.loading,\n onclick: () => this.hide(),\n },\n app.translator.trans('v17development-flarum-badges.admin.confirm_dialog.no')\n )}\n {Button.component(\n {\n className: 'Button Button--primary',\n loading: this.loading,\n onclick: () => this.confirm(),\n },\n app.translator.trans('v17development-flarum-badges.admin.confirm_dialog.yes')\n )}\n
,\n ];\n }\n\n /**\n * Confirm\n */\n confirm() {\n // Act as promise\n if (this.attrs.promise) {\n this.loading = true;\n\n this.attrs.onconfirm(\n () => this.hide(),\n () => {\n this.loading = false;\n m.redraw();\n }\n );\n return;\n }\n\n this.attrs.onconfirm();\n this.hide();\n }\n}\n","import Modal from 'flarum/components/Modal';\nimport ItemList from 'flarum/utils/ItemList';\nimport Button from 'flarum/components/Button';\nimport Switch from 'flarum/components/Switch';\nimport Stream from 'flarum/utils/Stream';\n\nexport default class EditBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Badge model\n this.badge = this.attrs.badge ? this.attrs.badge : app.store.createRecord('badges');\n\n // Name\n this.name = Stream(this.badge.name());\n\n // Is image\n this.isImage = Stream(this.badge.exists ? this.badge.image() !== null : false);\n\n // Icon\n this.icon = Stream(this.badge.icon());\n\n // Image\n this.image = Stream(this.badge.image());\n\n // Description\n this.description = Stream(this.badge.description());\n\n // Is visible\n this.isVisible = Stream(this.badge.exists ? this.badge.isVisible() : true);\n\n // Background color\n this.backgroundColor = Stream(this.badge.backgroundColor());\n\n // Icon color\n this.iconColor = Stream(this.badge.iconColor());\n\n // Label color\n this.labelColor = Stream(this.badge.labelColor());\n }\n\n className() {\n return this.isImage() ? 'Modal--small' : 'Modal--large';\n }\n\n title() {\n return app.translator.trans(`v17development-flarum-badges.admin.${this.badge.exists ? 'update_badge' : 'new_badge'}`);\n }\n\n content() {\n return [\n
\n
{this.data().toArray()}
\n
,\n
\n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.loading,\n },\n app.translator.trans('core.admin.settings.submit_button')\n )}\n
,\n ];\n }\n\n data() {\n const items = new ItemList();\n\n items.add(\n 'name',\n
\n \n \n
,\n 50\n );\n\n items.add(\n 'description',\n
\n \n \n
,\n 50\n );\n\n // Is image\n items.add(\n 'is_image',\n
\n {Switch.component(\n {\n state: this.isImage() == true,\n onchange: (val) => this.isImage(val),\n },\n [\n {app.translator.trans('v17development-flarum-badges.admin.badge.is_image')},\n
{app.translator.trans('v17development-flarum-badges.admin.badge.is_image_description')}
,\n ]\n )}\n
,\n 50\n );\n\n // Image field\n if (this.isImage()) {\n items.add(\n 'image',\n
\n \n \n
,\n 50\n );\n }\n // Non-image fields\n else {\n items.add(\n 'icon',\n
\n \n \n \n
,\n 50\n );\n\n items.add(\n 'icon_color',\n
\n \n \n \n
,\n 50\n );\n\n items.add(\n 'background_color',\n
\n \n \n \n
,\n 50\n );\n\n items.add(\n 'label_color',\n
\n \n \n \n
,\n 50\n );\n }\n\n // Enabled\n items.add(\n 'enabled',\n
\n {Switch.component(\n {\n state: this.isVisible() == true,\n onchange: (val) => this.isVisible(val),\n },\n [\n {app.translator.trans('v17development-flarum-badges.admin.badge.visible')},\n
{app.translator.trans('v17development-flarum-badges.admin.badge.visible_description')}
,\n ]\n )}\n
,\n 50\n );\n\n return items;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n name: this.name(),\n icon: this.icon(),\n image: this.image(),\n description: this.description(),\n isVisible: this.isVisible(),\n iconColor: this.iconColor(),\n backgroundColor: this.backgroundColor(),\n labelColor: this.labelColor(),\n })\n .then(\n () => this.hide(),\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Component from 'flarum/common/Component';\nimport Button from 'flarum/components/Button';\nimport UserBadge from '../../common/components/UserBadge';\nimport ConfirmModal from './ConfirmModal';\nimport EditBadgeModal from './EditBadgeModal';\n\nexport default class SortableBadge extends Component {\n oninit(attrs) {\n super.oninit(attrs);\n\n this.loading = false;\n }\n\n view() {\n const badge = this.attrs.badge;\n\n if (!badge) return null;\n\n return (\n
  • \n
    \n \n \n app.modal.show(EditBadgeModal, {\n badge,\n })\n }\n forceVisibility={true}\n />\n \n \n \n app.modal.show(EditBadgeModal, {\n badge,\n })\n }\n >\n \n \n \n app.modal.show(ConfirmModal, {\n text: app.translator.trans('v17development-flarum-badges.admin.confirm_messages.delete_badge'),\n promise: true,\n onconfirm: (resolve, reject) => badge.delete().then(resolve).catch(reject),\n })\n }\n >\n \n \n \n
    \n
  • \n );\n }\n}\n","import Modal from 'flarum/components/Modal';\nimport ItemList from 'flarum/utils/ItemList';\nimport Button from 'flarum/components/Button';\nimport Switch from 'flarum/components/Switch';\nimport Stream from 'flarum/utils/Stream';\n\nexport default class EditBadgeCategoryModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Badge model\n this.badgeCategory = this.attrs.badgeCategory ? this.attrs.badgeCategory : app.store.createRecord('badgeCategories');\n\n // Name\n this.name = Stream(this.badgeCategory.name());\n\n // Description\n this.description = Stream(this.badgeCategory.description());\n\n // Is enabled\n this.isTable = Stream(this.badgeCategory.exists ? this.badgeCategory.isTable() : true);\n\n // Is enabled\n this.isEnabled = Stream(this.badgeCategory.exists ? this.badgeCategory.isEnabled() : true);\n }\n\n className() {\n return 'Modal--small';\n }\n\n title() {\n return app.translator.trans(`v17development-flarum-badges.admin.${this.badgeCategory.exists ? 'update_category' : 'create_category'}`);\n }\n\n content() {\n return [\n
    \n
    {this.data().toArray()}
    \n
    ,\n
    \n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.loading,\n },\n app.translator.trans('core.admin.settings.submit_button')\n )}\n
    ,\n ];\n }\n\n data() {\n const items = new ItemList();\n\n items.add(\n 'name',\n
    \n \n \n
    ,\n 50\n );\n\n items.add(\n 'description',\n
    \n \n \n
    ,\n 50\n );\n\n // Enabled\n items.add(\n 'blockview',\n
    \n {Switch.component(\n {\n state: this.isTable() === false,\n onchange: (val) => this.isTable(!val),\n },\n [\n {app.translator.trans('v17development-flarum-badges.admin.badge_category.blockview')},\n
    {app.translator.trans('v17development-flarum-badges.admin.badge_category.blockview_description')}
    ,\n ]\n )}\n
    ,\n 50\n );\n\n // Enabled\n items.add(\n 'enabled',\n
    \n {Switch.component(\n {\n state: this.isEnabled() == true,\n onchange: (val) => this.isEnabled(val),\n },\n [\n {app.translator.trans('v17development-flarum-badges.admin.badge_category.enabled')},\n
    {app.translator.trans('v17development-flarum-badges.admin.badge_category.enabled_description')}
    ,\n ]\n )}\n
    ,\n 50\n );\n\n return items;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badgeCategory\n .save({\n name: this.name(),\n description: this.description(),\n isTable: this.isTable(),\n isEnabled: this.isEnabled(),\n })\n .then(\n () => {\n this.hide();\n\n if (this.attrs.onCreate) {\n this.attrs.onCreate();\n }\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/saveSettings'];","import Component from 'flarum/common/Component';\nimport Button from 'flarum/components/Button';\nimport saveSettings from 'flarum/utils/saveSettings';\n\nexport default class InstallAutoModerationMessage extends Component {\n view() {\n // Message is dismissed\n if (typeof app.data.settings.badges_install_automoderation !== 'undefined') {\n return null;\n }\n\n const extensionInstalled = typeof app.data.extensions['askvortsov-auto-moderator'] !== 'undefined';\n\n return (\n
    \n
    \n {app.translator.trans('v17development-flarum-badges.admin.auto_moderator.not_installed.title')}\n
    \n
    \n {app.translator.trans('v17development-flarum-badges.admin.auto_moderator.not_installed.content', {\n a: ,\n })}\n
    \n
    \n \n \n\n \n {app.translator.trans(\n extensionInstalled ? 'core.admin.extension.open_modal' : 'v17development-flarum-badges.admin.auto_moderator.not_installed.install'\n )}\n \n \n \n saveSettings({\n badges_install_automoderation: 'dismissed',\n })\n }\n icon={'fas fa-times'}\n >\n {app.translator.trans('v17development-flarum-badges.admin.auto_moderator.not_installed.dismiss')}\n \n
    \n
    \n );\n }\n}\n","import sortable from 'sortablejs';\nimport ExtensionPage from 'flarum/components/ExtensionPage';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport SortableBadge from './SortableBadge';\nimport Button from 'flarum/components/Button';\nimport EditBadgeModal from './EditBadgeModal';\nimport EditBadgeCategoryModal from './EditBadgeCategoryModal';\nimport ConfirmModal from './ConfirmModal';\nimport InstallAutoModerationMessage from './InstallAutoModerationMessage';\n\nexport default class SettingsPage extends ExtensionPage {\n oninit(attrs) {\n super.oninit(attrs);\n\n this.loading = true;\n\n this.updating = false;\n this.forcedRefreshKey = 0;\n\n app.store.find('badge_categories').then(() => {\n app.store.find('badges').then(() => {\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n });\n }\n\n content() {\n const categories = app.store.all('badgeCategories').sort((a, b) => a.order() - b.order());\n\n const uncategorizedBadges = app.store.all('badges').filter((badge) => badge.category() == false);\n\n return (\n
    \n
    \n {app.data.settings.extensions_enabled.indexOf('askvortsov-auto-moderator') === -1 && }\n\n
    \n \n app.modal.show(EditBadgeCategoryModal, {\n onCreate: () => this.nextRefreshKey(),\n })\n }\n icon={'fas fa-project-diagram'}\n >\n {app.translator.trans('v17development-flarum-badges.admin.create_category')}\n \n \n
    \n\n
    \n {!this.loading && (\n
    \n {categories &&\n categories.map((category, key) => {\n return (\n
    \n
    \n \n {!category.isEnabled() && }\n {category.name()}\n \n\n \n \n app.modal.show(EditBadgeCategoryModal, {\n badgeCategory: category,\n })\n }\n >\n {app.translator.trans('v17development-flarum-badges.admin.edit_category')}\n \n this.updateCategorySort(category, 'up')}\n className={key === 0 ? 'LinkDisabled' : null}\n >\n \n \n this.updateCategorySort(category, 'down')}\n className={key === categories.length - 1 ? 'LinkDisabled' : null}\n >\n \n \n \n app.modal.show(ConfirmModal, {\n text: app.translator.trans('v17development-flarum-badges.admin.confirm_messages.delete_category'),\n promise: true,\n onconfirm: (resolve, reject) => {\n const badges = category.badges();\n\n category\n .delete()\n .then(() => {\n resolve();\n\n badges.forEach((badge) =>\n badge.pushData({\n relationships: {\n category: null,\n },\n })\n );\n })\n .catch(reject);\n },\n })\n }\n >\n \n \n \n
    \n\n
      \n {category.badges() &&\n category\n .badges()\n .sort((a, b) => a.order() - b.order())\n .map((badge) => )}\n
    \n
    \n );\n })}\n\n {/* Uncategorized badges */}\n
    \n
    \n \n {app.translator.trans('v17development-flarum-badges.admin.uncategorized')}\n \n
    \n\n
      \n {uncategorizedBadges\n .sort((a, b) => a.order() - b.order())\n .map((badge) => (\n \n ))}\n
    \n
    \n
    \n )}\n
    \n\n {this.loading && }\n\n {!this.loading && uncategorizedBadges.length === 0 && categories.length === 0 && (\n

    {app.translator.trans('v17development-flarum-badges.admin.nothing_here_yet')}

    \n )}\n {this.buildSettingComponent({\n type: 'switch',\n setting: 'v17development-user-badges.show_badges_on_user_card',\n label: app.translator.trans('v17development-flarum-badges.admin.show_badges_on_user_card'),\n })}\n {this.buildSettingComponent({\n type: 'number',\n setting: 'v17development-user-badges.number_of_badges_on_user_card',\n label: app.translator.trans('v17development-flarum-badges.admin.number_of_badges_on_user_card'),\n help: app.translator.trans('v17development-flarum-badges.admin.number_of_badges_on_user_card_help'),\n })}\n
    {this.submitButton()}
    \n
    \n
    \n );\n }\n\n onBadgeListReady(vnode) {\n this.$('.SortableBadges')\n .get()\n .map((e) => {\n sortable.create(e, {\n group: 'tags',\n animation: 150,\n swapThreshold: 0.65,\n dragClass: 'SortableBadges-dragging',\n ghostClass: 'SortableBadges-placeholder',\n direction: 'horizontal',\n onSort: (e) => this.onSortUpdate(e),\n });\n });\n }\n\n /**\n *\n * @param {categoryObject} category\n * @param {string} action\n * @returns\n */\n updateCategorySort(category, action) {\n const newPosition = action === 'up' ? category.order() - 1 : category.order() + 1;\n const order = [];\n\n console.log(category.id(), action, newPosition);\n\n // Bring to top\n if (newPosition <= 0) {\n order.push(category.id());\n }\n\n // Get all categories\n const categories = app.store.all('badgeCategories').sort((a, b) => a.order() - b.order());\n\n // Loop through the categories\n categories.forEach((obj, key) => {\n // Skip current category\n if (obj === category) return;\n\n // Add before current key\n if (newPosition !== 0 && key === newPosition && action === 'up') {\n order.push(category.id());\n }\n\n // Add object\n order.push(obj.id());\n\n // Add after current key\n if (key === newPosition && action === 'down') {\n order.push(category.id());\n }\n });\n\n // Save list\n app\n .request({\n url: app.forum.attribute('apiUrl') + '/badge_categories/order',\n method: 'POST',\n body: { order },\n })\n .catch((e) => console.error(e))\n .then((payload) => {\n app.store.pushPayload(payload);\n\n this.nextRefreshKey();\n });\n }\n\n /**\n * Sort badges\n */\n onSortUpdate() {\n // Skip if already updating\n if (this.updating) return;\n\n this.updating = true;\n\n // Get through the categories and find the children currently attached to them\n const order = this.$('.FlarumBadgeCategory')\n .map(function () {\n return {\n id: $(this).data('id') ? $(this).data('id') : null,\n children: $(this)\n .find('li')\n .map(function () {\n return $(this).data('id');\n })\n .get(),\n };\n })\n .get();\n\n app\n .request({\n url: app.forum.attribute('apiUrl') + '/badges/order',\n method: 'POST',\n body: { order },\n })\n .catch((e) => console.error(e))\n .then(() => {\n // Update local store\n order.map((categoryObject) => {\n const category = categoryObject.id !== null ? app.store.getById('badgeCategories', categoryObject.id) : null;\n\n // Loop through the badges\n const badges = categoryObject.children.map((badgeId, badgePosition) => {\n const badge = app.store.getById('badges', badgeId);\n\n badge.pushData({\n attributes: {\n order: badgePosition,\n },\n relationships: {\n category,\n },\n });\n\n return badge;\n });\n\n // Update the category\n if (category) {\n category.pushData({\n relationships: {\n badges: {\n data: badges.map((badge) => ({\n type: 'badges',\n id: badge.id(),\n })),\n },\n },\n });\n }\n });\n\n this.updating = false;\n this.nextRefreshKey();\n });\n }\n\n nextRefreshKey() {\n this.forcedRefreshKey++;\n m.redraw();\n }\n}\n","import Badge from '../common/models/Badge';\nimport BadgeCategory from '../common/models/BadgeCategory';\nimport BadgeActionDriverSettings from './components/BadgeActionDriverSettings';\nimport SettingsPage from './components/SettingsPage';\n\napp.initializers.add('v17development-user-badges', () => {\n app.store.models.badges = Badge;\n app.store.models.badgeCategories = BadgeCategory;\n\n // Register extension settings page\n app.extensionData.for('v17development-user-badges').registerPage(SettingsPage);\n\n app.extensionData\n .for('v17development-user-badges')\n .registerPermission(\n {\n icon: 'fas fa-users',\n label: app.translator.trans('v17development-flarum-badges.admin.permissions.badge_detail_users'),\n permission: 'badges.canViewDetailedUsers',\n allowGuest: true,\n },\n 'view',\n 90\n )\n .registerPermission(\n {\n icon: 'fas fa-user-tag',\n label: app.translator.trans('v17development-flarum-badges.admin.permissions.give_badge'),\n permission: 'badges.giveBadge',\n },\n 'moderate',\n 90\n )\n .registerPermission(\n {\n icon: 'fas fa-user-times',\n label: app.translator.trans('v17development-flarum-badges.admin.permissions.take_badge'),\n permission: 'badges.removeBadge',\n },\n 'moderate',\n 90\n );\n\n // Auto moderation\n if (app.autoModeratorForms) {\n app.autoModeratorForms.action.give_badge = BadgeActionDriverSettings;\n app.autoModeratorForms.action.remove_badge = BadgeActionDriverSettings;\n\n app.autoModeratorForms.requirement.has_badge = BadgeActionDriverSettings;\n }\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","create","constructor","app","GiveBadgeModal","oninit","vnode","this","selectedBadge","attrs","badge","user","userHasBadge","store","createRecord","description","Stream","categories","uncategorizedBadges","loading","find","include","then","badges","forEach","category","id","push","m","redraw","className","title","translator","trans","exists","content","fields","toArray","type","disabled","items","ItemList","add","onchange","e","target","getById","checkUserHasBadge","values","map","label","name","length","class","placeholder","bidi","foundBadge","userBadges","userBadge","onsubmit","preventDefault","save","relationships","modal","show","BadgeModal","userBadgeData","hide","response","handleErrors","Modal","data","href","route","style","margin","forum","attribute","onclick","confirm","fullTime","assignedAt","earnedAmount","count","Badge","apiEndpoint","mixin","Model","icon","order","image","isVisible","createdAt","backgroundColor","iconColor","labelColor","BadgeCategory","isEnabled","isTable","users","hasLoaded","onLoadedCallbacks","BadgeSelector","onLoadedCallback","loaded","cb","view","float","buttonClassName","all","g","Button","active","Component","BadgeActionDriverSettings","settings","badge_id","val","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","apply","_objectSpread2","i","arguments","source","_defineProperty","getOwnPropertyDescriptors","defineProperties","_typeof","iterator","configurable","writable","_extends","assign","_objectWithoutProperties","excluded","sourceKeys","indexOf","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","userAgent","pattern","window","navigator","match","IE11OrLess","Edge","FireFox","Safari","IOS","ChromeForAndroid","captureMode","capture","passive","on","el","event","fn","addEventListener","off","removeEventListener","matches","selector","substring","msMatchesSelector","webkitMatchesSelector","_","getParentOrHost","host","document","nodeType","parentNode","closest","ctx","includeCTX","_throttleTimeout","R_SPACE","toggleClass","state","classList","replace","css","defaultView","getComputedStyle","currentStyle","matrix","selfOnly","appliedTransforms","transform","matrixFn","DOMMatrix","WebKitCSSMatrix","CSSMatrix","MSCSSMatrix","tagName","list","getElementsByTagName","n","getWindowScrollingElement","scrollingElement","documentElement","getRect","relativeToContainingBlock","relativeToNonStaticParent","undoScale","container","getBoundingClientRect","elRect","top","left","bottom","right","height","width","innerHeight","innerWidth","containerRect","parseInt","elMatrix","scaleX","scaleY","isScrolledPast","elSide","parentSide","parent","getParentAutoScrollElement","elSideVal","parentSideVal","getChild","childNum","options","includeDragEl","currentChild","children","display","Sortable","ghost","dragged","draggable","lastChild","last","lastElementChild","previousElementSibling","index","nodeName","toUpperCase","clone","getRelativeScrollOffset","offsetLeft","offsetTop","winScroller","scrollLeft","scrollTop","includeSelf","elem","gotSelf","clientWidth","scrollWidth","clientHeight","scrollHeight","elemCSS","overflowX","overflowY","body","isRectEqual","rect1","rect2","Math","round","throttle","callback","ms","args","_this","setTimeout","scrollBy","x","y","Polymer","$","jQuery","Zepto","dom","cloneNode","expando","Date","getTime","plugins","defaults","initializeByDefault","PluginManager","mount","plugin","option","pluginName","concat","pluginEvent","eventName","sortable","evt","eventCanceled","cancel","eventNameGlobal","initializePlugins","initialized","modified","modifyOption","getEventProperties","eventProperties","modifiedValue","optionListeners","_excluded","_ref","undefined","originalEvent","bind","dragEl","parentEl","ghostEl","rootEl","nextEl","lastDownEl","cloneEl","cloneHidden","dragStarted","moved","putSortable","activeSortable","oldIndex","oldDraggableIndex","newIndex","newDraggableIndex","hideGhostForTarget","_hideGhostForTarget","unhideGhostForTarget","_unhideGhostForTarget","cloneNowHidden","cloneNowShown","dispatchSortableEvent","_dispatchEvent","info","targetEl","toEl","fromEl","extraEventProperties","onName","charAt","substr","CustomEvent","createEvent","initEvent","bubbles","cancelable","to","from","item","pullMode","lastPutMode","allEventProperties","dispatchEvent","activeGroup","tapEvt","touchEvt","lastDx","lastDy","tapDistanceLeft","tapDistanceTop","lastTarget","lastDirection","targetMoveDistance","ghostRelativeParent","awaitingDragStarted","ignoreNextClick","sortables","pastFirstInvertThresh","isCircumstantialInvert","ghostRelativeParentInitialScroll","_silent","savedInputChecked","documentExists","PositionGhostAbsolutely","CSSFloatProperty","supportDraggable","createElement","supportCssPointerEvents","cssText","pointerEvents","_detectDirection","elCSS","elWidth","paddingLeft","paddingRight","borderLeftWidth","borderRightWidth","child1","child2","firstChildCSS","secondChildCSS","firstChildWidth","marginLeft","marginRight","secondChildWidth","flexDirection","gridTemplateColumns","split","touchingSideChild2","clear","_prepareGroup","toFn","pull","sameGroup","group","otherGroup","join","originalGroup","checkPull","checkPut","put","revertClone","stopPropagation","stopImmediatePropagation","nearestEmptyInsertDetectEvent","touches","nearest","clientX","clientY","some","threshold","emptyInsertThreshold","rect","insideHorizontally","insideVertically","ret","_onDragOver","_checkOutsideTargetEl","_isOutsideThisEl","toString","animationCallbackId","animationStates","sort","handle","test","swapThreshold","invertSwap","invertedSwapThreshold","removeCloneOnHide","direction","ghostClass","chosenClass","dragClass","ignore","preventOnFilter","animation","easing","setData","dataTransfer","textContent","dropBubble","dragoverBubble","dataIdAttr","delay","delayOnTouchOnly","touchStartThreshold","Number","devicePixelRatio","forceFallback","fallbackClass","fallbackOnBody","fallbackTolerance","fallbackOffset","supportPointer","nativeDraggable","_onTapStart","captureAnimationState","slice","child","fromRect","thisAnimationDuration","childMatrix","f","addAnimationState","removeAnimationState","splice","arr","indexOfObject","animateAll","clearTimeout","animating","animationTime","time","toRect","prevFromRect","prevToRect","animatingRect","targetMatrix","sqrt","pow","calculateRealTime","animate","max","animationResetTimer","currentRect","duration","translateX","translateY","animatingX","animatingY","forRepaintDummy","offsetWidth","repaint","animated","_onMove","dragRect","targetRect","willInsertAfter","retVal","onMoveFn","onMove","draggedRect","related","relatedRect","_disableDraggable","_unsilent","_generateId","str","src","sum","charCodeAt","_nextTick","_cancelNextTick","contains","_getDirection","touch","pointerType","originalTarget","shadowRoot","path","composedPath","root","inputs","idx","checked","_saveInputCheckedState","button","isContentEditable","criteria","trim","_prepareDragStart","dragStartFn","ownerDocument","nextSibling","_lastX","_lastY","_onDrop","_disableDelayedDragEvents","_triggerDragStart","_disableDelayedDrag","_delayedDragTouchMoveHandler","_dragStartTimer","abs","floor","_onTouchMove","_onDragStart","selection","empty","getSelection","removeAllRanges","err","_dragStarted","fallback","_appendGhost","_nulling","_emulateDragOver","elementFromPoint","ghostMatrix","relativeScrollOffset","dx","dy","b","c","cssMatrix","appendChild","_hideClone","cloneId","insertBefore","_loopId","setInterval","effectAllowed","_dragStartId","revert","vertical","isOwner","canSort","fromSortable","completedFired","dragOverEvent","_ignoreWhileAnimating","completed","elLastChild","_ghostIsLast","changed","_ghostIsFirst","firstChild","targetBeforeFirstSwap","sibling","differentLevel","differentRowCol","dragElS1Opp","dragElS2Opp","dragElOppLength","targetS1Opp","targetS2Opp","targetOppLength","_dragElInRowColumn","side1","scrolledPastTop","scrollBefore","isLastTarget","mouseOnAxis","targetLength","targetS1","targetS2","invert","_getInsertDirection","_getSwapDirection","dragIndex","nextElementSibling","after","moveVector","extra","axis","insertion","_showClone","_offMoveEvents","_offUpEvents","clearInterval","removeChild","handleEvent","dropEffect","_globalDragOver","getAttribute","useAnimation","set","destroy","Array","querySelectorAll","removeAttribute","utils","is","extend","dst","nextTick","cancelNextTick","detectDirection","element","_len","_key","version","scrollEl","scrollRootEl","lastAutoScrollX","lastAutoScrollY","touchEvt$1","pointerElemChangedInterval","autoScrolls","scrolling","clearAutoScrolls","autoScroll","pid","clearPointerElemChangedInterval","isFallback","scroll","scrollCustomFn","sens","scrollSensitivity","speed","scrollSpeed","scrollThisInstance","scrollFn","layersOut","currentParent","canScrollX","canScrollY","scrollPosX","scrollPosY","vx","vy","layer","scrollOffsetY","scrollOffsetX","bubbleScroll","drop","toSortable","changedTouches","onSpill","Revert","Remove","startIndex","dragStart","_ref2","_ref3","_ref4","parentSortable","AutoScroll","forceAutoScrollFallback","_handleAutoScroll","_handleFallbackAutoScroll","dragOverCompleted","dragOverBubble","nulling","ogElemScroller","newElem","UserBadge","tooltip","forceVisibility","text","isPartlyHidden","opacity","color","borderColor","ConfirmModal","promise","onconfirm","EditBadgeModal","isImage","Switch","SortableBadge","resolve","reject","EditBadgeCategoryModal","badgeCategory","onCreate","InstallAutoModerationMessage","badges_install_automoderation","extensionInstalled","extensions","saveSettings","SettingsPage","updating","forcedRefreshKey","extensions_enabled","nextRefreshKey","oncreate","onBadgeListReady","updateCategorySort","pushData","size","buildSettingComponent","setting","help","submitButton","onSort","onSortUpdate","action","newPosition","console","log","request","url","method","error","payload","pushPayload","categoryObject","badgeId","badgePosition","attributes","ExtensionPage","initializers","models","badgeCategories","extensionData","registerPage","registerPermission","permission","allowGuest","autoModeratorForms","give_badge","remove_badge","requirement","has_badge"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":";MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,IACzBH,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,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rap","webpack://@v17development/flarum-user-badges/webpack/runtime/compat get default export","webpack://@v17development/flarum-user-badges/webpack/runtime/define property getters","webpack://@v17development/flarum-user-badges/webpack/runtime/hasOwnProperty shorthand","webpack://@v17development/flarum-user-badges/webpack/runtime/make namespace object","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['common/app']\"","webpack://@v17development/flarum-user-badges/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@v17development/flarum-user-badges/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@v17development/flarum-user-badges/./src/common/index.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['Model']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['utils/mixin']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Modal']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Button']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['helpers/fullTime']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['utils/ItemList']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/LinkButton']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Select']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['utils/Stream']\"","webpack://@v17development/flarum-user-badges/./src/forum/components/GiveBadgeModal.js","webpack://@v17development/flarum-user-badges/./src/forum/components/BadgeModal.js","webpack://@v17development/flarum-user-badges/./src/common/models/Badge.js","webpack://@v17development/flarum-user-badges/./src/common/models/BadgeCategory.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['Component']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Dropdown']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['helpers/icon']\"","webpack://@v17development/flarum-user-badges/./src/admin/utils/loadBadges.js","webpack://@v17development/flarum-user-badges/./src/admin/components/BadgeSelector.js","webpack://@v17development/flarum-user-badges/./src/admin/components/BadgeActionDriverSettings.js","webpack://@v17development/flarum-user-badges/./node_modules/sortablejs/modular/sortable.esm.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/ExtensionPage']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['common/Component']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['common/components/Tooltip']\"","webpack://@v17development/flarum-user-badges/./src/common/components/UserBadge.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Switch']\"","webpack://@v17development/flarum-user-badges/./src/admin/components/ConfirmModal.js","webpack://@v17development/flarum-user-badges/./src/admin/components/EditBadgeModal.js","webpack://@v17development/flarum-user-badges/./src/admin/components/SortableBadge.js","webpack://@v17development/flarum-user-badges/./src/admin/components/EditBadgeCategoryModal.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['utils/saveSettings']\"","webpack://@v17development/flarum-user-badges/./src/admin/components/InstallAutoModerationMessage.js","webpack://@v17development/flarum-user-badges/./src/admin/components/SettingsPage.js","webpack://@v17development/flarum-user-badges/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/app'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\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}","import app from 'flarum/common/app';\n\napp.initializers.add('v17development/flarum-user-badges', () => {\n // console.log('[v17development/flarum-user-badges] Hello, forum and admin!')\n});\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/mixin'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['helpers/fullTime'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/LinkButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Select'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/Stream'];","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport ItemList from 'flarum/utils/ItemList';\nimport Select from 'flarum/components/Select';\nimport Stream from 'flarum/utils/Stream';\nimport BadgeModal from './BadgeModal';\n\nexport default class GiveBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Select image\n this.selectedBadge = this.attrs.badge ? this.attrs.badge.badge() : null;\n\n // Current user\n this.user = this.attrs.badge ? this.attrs.badge.user() : this.attrs.user;\n\n // User has badge\n this.userHasBadge = false;\n\n // Badge model\n this.badge = this.attrs.badge ? this.attrs.badge : app.store.createRecord('userBadges');\n\n // Earning reason\n this.description = Stream(this.badge.description());\n\n // List of available bagges\n this.categories = {};\n\n this.uncategorizedBadges = [];\n\n this.loading = false;\n\n // Load all available badges\n if (!this.attrs.badge) {\n this.loading = true;\n\n app.store\n .find('badges', {\n include: 'category',\n })\n .then((badges) => {\n badges.forEach((badge) => {\n // Categorized\n if (badge.category()) {\n const category = badge.category();\n\n if (!this.categories[category.id()]) {\n this.categories[category.id()] = {\n category,\n badges: [badge],\n };\n } else {\n this.categories[category.id()].badges.push(badge);\n }\n }\n // Uncategorized\n else {\n this.uncategorizedBadges.push(badge);\n }\n });\n\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n }\n }\n\n className() {\n return 'Modal--small BadgeModal';\n }\n\n title() {\n return app.translator.trans(`v17development-flarum-badges.forum.${this.badge.exists ? 'update' : 'give'}_badge`);\n }\n\n content() {\n return (\n
    \n
    \n
    {this.fields().toArray()}
    \n
    \n\n
    \n \n
    \n
    \n );\n }\n\n fields() {\n const items = new ItemList();\n\n // Badge selector\n items.add(\n 'badge',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.badge')}\n

    \n\n
    \n {\n if (e.target.value === 'empty') return;\n this.selectedBadge = app.store.getById('badges', e.target.value);\n\n // Check if the user already has this badge\n this.checkUserHasBadge(this.selectedBadge);\n }}\n className=\"Select-input FormControl\"\n >\n \n\n {/* When no badge is selected, show all available badges */}\n {!this.attrs.badge &&\n Object.values(this.categories).map(({ category, badges }) => (\n \n {badges.map((badge) => (\n \n ))}\n \n ))}\n\n {!this.attrs.badge && this.uncategorizedBadges.length >= 1 && (\n \n {this.uncategorizedBadges.map((badge) => (\n \n ))}\n \n )}\n\n {/* When a badge is already assigned */}\n {!!this.attrs.badge && }\n \n \n
    \n\n {this.userHasBadge &&

    {app.translator.trans('v17development-flarum-badges.forum.user_has_badge')}

    }\n
    ,\n 30\n );\n\n // Badge description\n items.add(\n 'badge_description',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.description')}:\n

    \n

    {this.selectedBadge ? this.selectedBadge.description() : app.translator.trans('v17development-flarum-badges.forum.select_badge')}

    \n
    ,\n 30\n );\n\n // Badge earning reason\n items.add(\n 'description',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earning_reason')}\n

    \n \n
    ,\n 30\n );\n\n return items;\n }\n\n checkUserHasBadge(badge) {\n let foundBadge = false;\n\n this.user.userBadges().map((userBadge) => {\n if (userBadge.badge() == badge) {\n foundBadge = true;\n }\n });\n\n this.userHasBadge = foundBadge;\n\n m.redraw();\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n description: this.description(),\n relationships: this.attrs.badge\n ? {}\n : {\n badge: this.selectedBadge,\n user: this.user,\n },\n })\n .then(\n () => {\n // Re-open badge modal\n if (this.attrs.badge) {\n app.modal.show(BadgeModal, {\n badge: this.attrs.badge.badge(),\n userBadgeData: this.attrs.badge,\n });\n } else {\n this.hide();\n }\n\n m.redraw();\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport fullTime from 'flarum/helpers/fullTime';\nimport ItemList from 'flarum/utils/ItemList';\nimport LinkButton from 'flarum/components/LinkButton';\nimport GiveBadgeModal from './GiveBadgeModal';\n\nexport default class BadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--small';\n }\n\n title() {\n return app.translator.trans('v17development-flarum-badges.forum.badge_information');\n }\n\n content() {\n return (\n
    \n
    {this.data().toArray()}
    \n
    \n \n {app.translator.trans('v17development-flarum-badges.forum.badge.badge_details')}\n \n\n {this.attrs.userBadgeData && app.forum.attribute('canGiveBadge') && (\n {\n if (confirm(app.translator.trans('v17development-flarum-badges.forum.moderation.remove_badge_confirm'))) {\n this.loading = true;\n this.attrs.userBadgeData.delete().then(() => this.hide());\n }\n }}\n loading={this.loading}\n >\n {app.translator.trans('v17development-flarum-badges.forum.moderation.remove_badge')}\n \n )}\n
    \n
    \n );\n }\n\n data() {\n const items = new ItemList();\n\n // Badge name\n items.add(\n 'name',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.name')}:\n

    \n

    {this.attrs.badge.name()}

    \n
    \n );\n\n // Badge description\n items.add(\n 'description',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.description')}:\n

    \n

    {this.attrs.badge.description()}

    \n
    \n );\n\n // Badge earning reason\n if (this.attrs.userBadgeData && (this.attrs.userBadgeData.description() || app.forum.attribute('canGiveBadge'))) {\n items.add(\n 'earning_reason',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earning_reason')}:\n

    \n\n

    \n {this.attrs.userBadgeData.description() ? (\n this.attrs.userBadgeData.description()\n ) : (\n {app.translator.trans('v17development-flarum-badges.forum.badge.no_earning_reason')}\n )}\n

    \n

    \n {app.forum.attribute('canGiveBadge') && (\n {\n e.preventDefault();\n app.modal.show(GiveBadgeModal, {\n badge: this.attrs.userBadgeData,\n });\n }}\n >\n {app.translator.trans('v17development-flarum-badges.forum.badge.update_earning_reason')}\n \n )}\n

    \n
    \n );\n }\n\n // Badge earned on\n if (this.attrs.userBadgeData) {\n items.add(\n 'earned_date',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_on')}:\n

    \n

    {fullTime(this.attrs.userBadgeData.assignedAt())}

    \n
    \n );\n }\n\n // Badge category\n if (this.attrs.userBadgeData) {\n items.add(\n 'category',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.category')}:\n

    \n

    \n {this.attrs.badge.category() && this.attrs.badge.category().name()}\n\n {/* Uncategorized */}\n {!this.attrs.badge.category() && app.translator.trans('v17development-flarum-badges.forum.uncategorized')}\n {/* \n {app.translator.trans(\n \"v17development-flarum-badges.forum.all_badges\"\n )}\n */}\n

    \n
    \n );\n }\n\n // Badge category\n if (this.attrs.badge && this.attrs.badge.earnedAmount()) {\n items.add(\n 'earned_amount',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_count', {\n count: this.attrs.badge.earnedAmount(),\n })}\n

    \n
    \n );\n }\n\n return items;\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport BadgeModal from '../../forum/components/BadgeModal';\n\nexport default class Badge extends mixin(Model, {\n name: Model.attribute('name'),\n icon: Model.attribute('icon'),\n order: Model.attribute('order'),\n image: Model.attribute('image'),\n description: Model.attribute('description'),\n isVisible: Model.attribute('isVisible'),\n createdAt: Model.attribute('createdAt'),\n earnedAmount: Model.attribute('earnedAmount'),\n category: Model.hasOne('category'),\n backgroundColor: Model.attribute('backgroundColor'),\n iconColor: Model.attribute('iconColor'),\n labelColor: Model.attribute('labelColor'),\n}) {\n apiEndpoint() {\n return '/badges' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class BadgeCategory extends mixin(Model, {\n name: Model.attribute('name'),\n order: Model.attribute('order'),\n description: Model.attribute('description'),\n isEnabled: Model.attribute('isEnabled'),\n createdAt: Model.attribute('createdAt'),\n isTable: Model.attribute('isTable'),\n users: Model.hasMany('users'),\n badges: Model.hasMany('badges'),\n}) {\n apiEndpoint() {\n return '/badge_categories' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Dropdown'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['helpers/icon'];","let loading = false;\nlet hasLoaded = false;\nlet onLoadedCallbacks = [];\n\nexport default function loadAllBadges(onLoadedCallback) {\n // Badges have already been loaded\n if (hasLoaded) {\n onLoadedCallback();\n return;\n }\n\n // Load badges if not already loading\n if (!loading) {\n loading = true;\n\n // Load badges\n app.store.find('badges').then(() => {\n hasLoaded = true;\n loading = false;\n\n onLoadedCallback();\n\n // Give callback\n onLoadedCallbacks.map((cb) => cb());\n\n m.redraw();\n });\n } else {\n onLoadedCallbacks.push(onLoadedCallback);\n }\n}\n","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport Dropdown from 'flarum/components/Dropdown';\nimport icon from 'flarum/helpers/icon';\nimport loadAllBadges from '../utils/loadBadges';\n\nexport default class BadgeSelector extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loaded = false;\n\n // Load badges\n loadAllBadges(() => (this.loaded = true));\n }\n\n view() {\n if (!this.loaded) {\n return (\n
    \n \n\n \n
    \n );\n }\n\n const badge = app.store.getById('badges', this.attrs.value);\n const label = badge\n ? [icon(badge.icon()), '\\t', badge.name()]\n : app.translator.trans('v17development-flarum-badges.admin.auto_moderator.badge_selector.placeholder');\n return (\n
    \n \n\n {this.attrs.disabled ? (\n
    {label}
    \n ) : (\n \n {app.store.all('badges').map((g) =>\n Button.component(\n {\n active: badge && badge.id() === g.id(),\n disabled: badge && badge.id() === g.id(),\n icon: g.icon(),\n onclick: () => {\n this.attrs.onchange(g.id());\n },\n },\n g.name()\n )\n )}\n \n )}\n
    \n );\n }\n}\n","import Component from 'flarum/Component';\nimport BadgeSelector from './BadgeSelector';\n\nexport default class BadgeActionDriverSettings extends Component {\n view() {\n const settings = this.attrs.settings;\n\n return settings({ badge_id: val })} />;\n }\n}\n","/**!\n * Sortable 1.14.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.14.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/**\n * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\n * @param {Number} x X position\n * @param {Number} y Y position\n * @return {HTMLElement} Element of the first found nearest Sortable\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) {\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/**\n * @class Sortable\n * @param {HTMLElement} el\n * @param {Object} [options]\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.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 el.appendChild(dragEl);\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 /**\n * Serializes the item into an array of string.\n * @returns {String[]}\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 /**\n * Sorts the elements according to the array.\n * @param {String[]} order order of the items\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 /**\n * Save the current sorting\n */\n save: function save() {\n var store = this.options.store;\n store && store.set && store.set(this);\n },\n\n /**\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.\n * @param {HTMLElement} el\n * @param {String} [selector] default: `options.draggable`\n * @returns {HTMLElement|null}\n */\n closest: function closest$1(el, selector) {\n return closest(el, selector || this.options.draggable, this.el, false);\n },\n\n /**\n * Set/get option\n * @param {string} name\n * @param {*} [value]\n * @returns {*}\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 /**\n * Destroy\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/**\n * Gets the direction dragEl must be swapped relative to target in order to make it\n * seem that dragEl has been \"inserted\" into that element's position\n * @param {HTMLElement} target The target whose position dragEl is being inserted at\n * @return {Number} Direction dragEl must be swapped\n */\n\n\nfunction _getInsertDirection(target) {\n if (index(dragEl) < index(target)) {\n return 1;\n } else {\n return -1;\n }\n}\n/**\n * Generate id\n * @param {HTMLElement} el\n * @returns {String}\n * @private\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/**\n * Get the Sortable instance of an element\n * @param {HTMLElement} element The element\n * @return {Sortable|undefined} The instance of Sortable\n */\n\nSortable.get = function (element) {\n return element[expando];\n};\n/**\n * Mount a plugin to Sortable\n * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted\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/**\n * Create sortable instance\n * @param {HTMLElement} el\n * @param {Object} [options]\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.supportPointer) {\n on(document, 'pointerup', this._deselectMultiDrag);\n } else {\n on(document, 'mouseup', this._deselectMultiDrag);\n on(document, 'touchend', this._deselectMultiDrag);\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 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 originalEvt: 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 originalEvt: 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 originalEvt: 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 originalEvt: 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 /**\n * Selects the provided multi-drag item\n * @param {HTMLElement} el The element to be selected\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 /**\n * Deselects the provided multi-drag item\n * @param {HTMLElement} el The element to be deselected\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/**\n * Insert multi-drag clones\n * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted\n * @param {HTMLElement} rootEl\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['components/ExtensionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","import Component from 'flarum/common/Component';\nimport Tooltip from 'flarum/common/components/Tooltip';\nimport BadgeModal from '../../forum/components/BadgeModal';\n\nexport default class UserBadge extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.tooltip = this.attrs.tooltip !== false;\n this.forceVisibility = this.attrs.forceVisibility === true;\n }\n\n view() {\n // Hide badge when not enabled\n if (!this.attrs.badge.isVisible() && !this.forceVisibility) {\n return null;\n }\n\n // Just show badge\n if (this.tooltip === false) return this.badge();\n\n return {this.badge()};\n }\n\n badge() {\n const isPartlyHidden = !this.attrs.badge.isVisible() && this.forceVisibility;\n\n // This badge is an image\n if (this.attrs.badge.image()) {\n return (\n {\n if (this.attrs.onclick) {\n this.attrs.onclick();\n }\n }}\n style={{\n opacity: isPartlyHidden ? 0.5 : undefined,\n }}\n />\n );\n }\n\n return (\n {\n if (this.attrs.onclick) {\n this.attrs.onclick();\n }\n }}\n style={{\n backgroundColor: this.attrs.badge.backgroundColor(),\n color: this.attrs.badge.labelColor(),\n borderColor: this.attrs.badge.backgroundColor(),\n opacity: isPartlyHidden ? 0.5 : undefined,\n }}\n >\n {this.attrs.badge.name()}\n \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Switch'];","import Modal from 'flarum/components/Modal';\nimport ItemList from 'flarum/utils/ItemList';\nimport Button from 'flarum/components/Button';\nimport Switch from 'flarum/components/Switch';\nimport Stream from 'flarum/utils/Stream';\n\nexport default class ConfirmModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--small FlarumBadgesConfirmModal';\n }\n\n title() {\n return app.translator.trans(`v17development-flarum-badges.admin.confirm_dialog.title`);\n }\n\n content() {\n return [\n
    \n

    {this.attrs.text}

    \n
    ,\n\n
    \n {Button.component(\n {\n className: 'Button',\n disabled: this.loading,\n onclick: () => this.hide(),\n },\n app.translator.trans('v17development-flarum-badges.admin.confirm_dialog.no')\n )}\n {Button.component(\n {\n className: 'Button Button--primary',\n loading: this.loading,\n onclick: () => this.confirm(),\n },\n app.translator.trans('v17development-flarum-badges.admin.confirm_dialog.yes')\n )}\n
    ,\n ];\n }\n\n /**\n * Confirm\n */\n confirm() {\n // Act as promise\n if (this.attrs.promise) {\n this.loading = true;\n\n this.attrs.onconfirm(\n () => this.hide(),\n () => {\n this.loading = false;\n m.redraw();\n }\n );\n return;\n }\n\n this.attrs.onconfirm();\n this.hide();\n }\n}\n","import Modal from 'flarum/components/Modal';\nimport ItemList from 'flarum/utils/ItemList';\nimport Button from 'flarum/components/Button';\nimport Switch from 'flarum/components/Switch';\nimport Stream from 'flarum/utils/Stream';\n\nexport default class EditBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Badge model\n this.badge = this.attrs.badge ? this.attrs.badge : app.store.createRecord('badges');\n\n // Name\n this.name = Stream(this.badge.name());\n\n // Is image\n this.isImage = Stream(this.badge.exists ? this.badge.image() !== null : false);\n\n // Icon\n this.icon = Stream(this.badge.icon());\n\n // Image\n this.image = Stream(this.badge.image());\n\n // Description\n this.description = Stream(this.badge.description());\n\n // Is visible\n this.isVisible = Stream(this.badge.exists ? this.badge.isVisible() : true);\n\n // Background color\n this.backgroundColor = Stream(this.badge.backgroundColor());\n\n // Icon color\n this.iconColor = Stream(this.badge.iconColor());\n\n // Label color\n this.labelColor = Stream(this.badge.labelColor());\n }\n\n className() {\n return this.isImage() ? 'Modal--small' : 'Modal--large';\n }\n\n title() {\n return app.translator.trans(`v17development-flarum-badges.admin.${this.badge.exists ? 'update_badge' : 'new_badge'}`);\n }\n\n content() {\n return [\n
    \n
    {this.data().toArray()}
    \n
    ,\n
    \n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.loading,\n },\n app.translator.trans('core.admin.settings.submit_button')\n )}\n
    ,\n ];\n }\n\n data() {\n const items = new ItemList();\n\n items.add(\n 'name',\n
    \n \n \n
    ,\n 50\n );\n\n items.add(\n 'description',\n
    \n \n \n
    ,\n 50\n );\n\n // Is image\n items.add(\n 'is_image',\n
    \n {Switch.component(\n {\n state: this.isImage() == true,\n onchange: (val) => this.isImage(val),\n },\n [\n {app.translator.trans('v17development-flarum-badges.admin.badge.is_image')},\n
    {app.translator.trans('v17development-flarum-badges.admin.badge.is_image_description')}
    ,\n ]\n )}\n
    ,\n 50\n );\n\n // Image field\n if (this.isImage()) {\n items.add(\n 'image',\n
    \n \n \n
    ,\n 50\n );\n }\n // Non-image fields\n else {\n items.add(\n 'icon',\n
    \n \n \n \n
    ,\n 50\n );\n\n items.add(\n 'icon_color',\n
    \n \n \n \n
    ,\n 50\n );\n\n items.add(\n 'background_color',\n
    \n \n \n \n
    ,\n 50\n );\n\n items.add(\n 'label_color',\n
    \n \n \n \n
    ,\n 50\n );\n }\n\n // Enabled\n items.add(\n 'enabled',\n
    \n {Switch.component(\n {\n state: this.isVisible() == true,\n onchange: (val) => this.isVisible(val),\n },\n [\n {app.translator.trans('v17development-flarum-badges.admin.badge.visible')},\n
    {app.translator.trans('v17development-flarum-badges.admin.badge.visible_description')}
    ,\n ]\n )}\n
    ,\n 50\n );\n\n return items;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n name: this.name(),\n icon: this.icon(),\n image: this.image(),\n description: this.description(),\n isVisible: this.isVisible(),\n iconColor: this.iconColor(),\n backgroundColor: this.backgroundColor(),\n labelColor: this.labelColor(),\n })\n .then(\n () => this.hide(),\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Component from 'flarum/common/Component';\nimport Button from 'flarum/components/Button';\nimport UserBadge from '../../common/components/UserBadge';\nimport ConfirmModal from './ConfirmModal';\nimport EditBadgeModal from './EditBadgeModal';\n\nexport default class SortableBadge extends Component {\n oninit(attrs) {\n super.oninit(attrs);\n\n this.loading = false;\n }\n\n view() {\n const badge = this.attrs.badge;\n\n if (!badge) return null;\n\n return (\n
  • \n
    \n \n \n app.modal.show(EditBadgeModal, {\n badge,\n })\n }\n forceVisibility={true}\n />\n \n \n \n app.modal.show(EditBadgeModal, {\n badge,\n })\n }\n >\n \n \n \n app.modal.show(ConfirmModal, {\n text: app.translator.trans('v17development-flarum-badges.admin.confirm_messages.delete_badge'),\n promise: true,\n onconfirm: (resolve, reject) => badge.delete().then(resolve).catch(reject),\n })\n }\n >\n \n \n \n
    \n
  • \n );\n }\n}\n","import Modal from 'flarum/components/Modal';\nimport ItemList from 'flarum/utils/ItemList';\nimport Button from 'flarum/components/Button';\nimport Switch from 'flarum/components/Switch';\nimport Stream from 'flarum/utils/Stream';\n\nexport default class EditBadgeCategoryModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Badge model\n this.badgeCategory = this.attrs.badgeCategory ? this.attrs.badgeCategory : app.store.createRecord('badgeCategories');\n\n // Name\n this.name = Stream(this.badgeCategory.name());\n\n // Description\n this.description = Stream(this.badgeCategory.description());\n\n // Is enabled\n this.isTable = Stream(this.badgeCategory.exists ? this.badgeCategory.isTable() : true);\n\n // Is enabled\n this.isEnabled = Stream(this.badgeCategory.exists ? this.badgeCategory.isEnabled() : true);\n }\n\n className() {\n return 'Modal--small';\n }\n\n title() {\n return app.translator.trans(`v17development-flarum-badges.admin.${this.badgeCategory.exists ? 'update_category' : 'create_category'}`);\n }\n\n content() {\n return [\n
    \n
    {this.data().toArray()}
    \n
    ,\n
    \n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.loading,\n },\n app.translator.trans('core.admin.settings.submit_button')\n )}\n
    ,\n ];\n }\n\n data() {\n const items = new ItemList();\n\n items.add(\n 'name',\n
    \n \n \n
    ,\n 50\n );\n\n items.add(\n 'description',\n
    \n \n \n
    ,\n 50\n );\n\n // Enabled\n items.add(\n 'blockview',\n
    \n {Switch.component(\n {\n state: this.isTable() === false,\n onchange: (val) => this.isTable(!val),\n },\n [\n {app.translator.trans('v17development-flarum-badges.admin.badge_category.blockview')},\n
    {app.translator.trans('v17development-flarum-badges.admin.badge_category.blockview_description')}
    ,\n ]\n )}\n
    ,\n 50\n );\n\n // Enabled\n items.add(\n 'enabled',\n
    \n {Switch.component(\n {\n state: this.isEnabled() == true,\n onchange: (val) => this.isEnabled(val),\n },\n [\n {app.translator.trans('v17development-flarum-badges.admin.badge_category.enabled')},\n
    {app.translator.trans('v17development-flarum-badges.admin.badge_category.enabled_description')}
    ,\n ]\n )}\n
    ,\n 50\n );\n\n return items;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badgeCategory\n .save({\n name: this.name(),\n description: this.description(),\n isTable: this.isTable(),\n isEnabled: this.isEnabled(),\n })\n .then(\n () => {\n this.hide();\n\n if (this.attrs.onCreate) {\n this.attrs.onCreate();\n }\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/saveSettings'];","import Component from 'flarum/common/Component';\nimport Button from 'flarum/components/Button';\nimport saveSettings from 'flarum/utils/saveSettings';\n\nexport default class InstallAutoModerationMessage extends Component {\n view() {\n // Message is dismissed\n if (typeof app.data.settings.badges_install_automoderation !== 'undefined') {\n return null;\n }\n\n const extensionInstalled = typeof app.data.extensions['askvortsov-auto-moderator'] !== 'undefined';\n\n return (\n
    \n
    \n {app.translator.trans('v17development-flarum-badges.admin.auto_moderator.not_installed.title')}\n
    \n
    \n {app.translator.trans('v17development-flarum-badges.admin.auto_moderator.not_installed.content', {\n a: ,\n })}\n
    \n
    \n \n \n\n \n {app.translator.trans(\n extensionInstalled ? 'core.admin.extension.open_modal' : 'v17development-flarum-badges.admin.auto_moderator.not_installed.install'\n )}\n \n \n \n saveSettings({\n badges_install_automoderation: 'dismissed',\n })\n }\n icon={'fas fa-times'}\n >\n {app.translator.trans('v17development-flarum-badges.admin.auto_moderator.not_installed.dismiss')}\n \n
    \n
    \n );\n }\n}\n","import sortable from 'sortablejs';\nimport ExtensionPage from 'flarum/components/ExtensionPage';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport SortableBadge from './SortableBadge';\nimport Button from 'flarum/components/Button';\nimport EditBadgeModal from './EditBadgeModal';\nimport EditBadgeCategoryModal from './EditBadgeCategoryModal';\nimport ConfirmModal from './ConfirmModal';\nimport InstallAutoModerationMessage from './InstallAutoModerationMessage';\n\nexport default class SettingsPage extends ExtensionPage {\n oninit(attrs) {\n super.oninit(attrs);\n\n this.loading = true;\n\n this.updating = false;\n this.forcedRefreshKey = 0;\n\n app.store.find('badge_categories').then(() => {\n app.store.find('badges').then(() => {\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n });\n }\n\n content() {\n const categories = app.store.all('badgeCategories').sort((a, b) => a.order() - b.order());\n\n const uncategorizedBadges = app.store.all('badges').filter((badge) => badge.category() == false);\n\n return (\n
    \n
    \n {app.data.settings.extensions_enabled.indexOf('askvortsov-auto-moderator') === -1 && }\n\n
    \n \n app.modal.show(EditBadgeCategoryModal, {\n onCreate: () => this.nextRefreshKey(),\n })\n }\n icon={'fas fa-project-diagram'}\n >\n {app.translator.trans('v17development-flarum-badges.admin.create_category')}\n \n \n
    \n\n
    \n {!this.loading && (\n
    \n {categories &&\n categories.map((category, key) => {\n return (\n
    \n
    \n \n {!category.isEnabled() && }\n {category.name()}\n \n\n \n \n app.modal.show(EditBadgeCategoryModal, {\n badgeCategory: category,\n })\n }\n >\n {app.translator.trans('v17development-flarum-badges.admin.edit_category')}\n \n this.updateCategorySort(category, 'up')}\n className={key === 0 ? 'LinkDisabled' : null}\n >\n \n \n this.updateCategorySort(category, 'down')}\n className={key === categories.length - 1 ? 'LinkDisabled' : null}\n >\n \n \n \n app.modal.show(ConfirmModal, {\n text: app.translator.trans('v17development-flarum-badges.admin.confirm_messages.delete_category'),\n promise: true,\n onconfirm: (resolve, reject) => {\n const badges = category.badges();\n\n category\n .delete()\n .then(() => {\n resolve();\n\n badges.forEach((badge) =>\n badge.pushData({\n relationships: {\n category: null,\n },\n })\n );\n })\n .catch(reject);\n },\n })\n }\n >\n \n \n \n
    \n\n
      \n {category.badges() &&\n category\n .badges()\n .sort((a, b) => a.order() - b.order())\n .map((badge) => )}\n
    \n
    \n );\n })}\n\n {/* Uncategorized badges */}\n
    \n
    \n \n {app.translator.trans('v17development-flarum-badges.admin.uncategorized')}\n \n
    \n\n
      \n {uncategorizedBadges\n .sort((a, b) => a.order() - b.order())\n .map((badge) => (\n \n ))}\n
    \n
    \n
    \n )}\n
    \n\n {this.loading && }\n\n {!this.loading && uncategorizedBadges.length === 0 && categories.length === 0 && (\n

    {app.translator.trans('v17development-flarum-badges.admin.nothing_here_yet')}

    \n )}\n {this.buildSettingComponent({\n type: 'switch',\n setting: 'v17development-user-badges.show_badges_on_user_card',\n label: app.translator.trans('v17development-flarum-badges.admin.show_badges_on_user_card'),\n })}\n {this.buildSettingComponent({\n type: 'number',\n setting: 'v17development-user-badges.number_of_badges_on_user_card',\n label: app.translator.trans('v17development-flarum-badges.admin.number_of_badges_on_user_card'),\n help: app.translator.trans('v17development-flarum-badges.admin.number_of_badges_on_user_card_help'),\n })}\n
    {this.submitButton()}
    \n
    \n
    \n );\n }\n\n onBadgeListReady(vnode) {\n this.$('.SortableBadges')\n .get()\n .map((e) => {\n sortable.create(e, {\n group: 'tags',\n animation: 150,\n swapThreshold: 0.65,\n dragClass: 'SortableBadges-dragging',\n ghostClass: 'SortableBadges-placeholder',\n direction: 'horizontal',\n onSort: (e) => this.onSortUpdate(e),\n });\n });\n }\n\n /**\n *\n * @param {categoryObject} category\n * @param {string} action\n * @returns\n */\n updateCategorySort(category, action) {\n const newPosition = action === 'up' ? category.order() - 1 : category.order() + 1;\n const order = [];\n\n console.log(category.id(), action, newPosition);\n\n // Bring to top\n if (newPosition <= 0) {\n order.push(category.id());\n }\n\n // Get all categories\n const categories = app.store.all('badgeCategories').sort((a, b) => a.order() - b.order());\n\n // Loop through the categories\n categories.forEach((obj, key) => {\n // Skip current category\n if (obj === category) return;\n\n // Add before current key\n if (newPosition !== 0 && key === newPosition && action === 'up') {\n order.push(category.id());\n }\n\n // Add object\n order.push(obj.id());\n\n // Add after current key\n if (key === newPosition && action === 'down') {\n order.push(category.id());\n }\n });\n\n // Save list\n app\n .request({\n url: app.forum.attribute('apiUrl') + '/badge_categories/order',\n method: 'POST',\n body: { order },\n })\n .catch((e) => console.error(e))\n .then((payload) => {\n app.store.pushPayload(payload);\n\n this.nextRefreshKey();\n });\n }\n\n /**\n * Sort badges\n */\n onSortUpdate() {\n // Skip if already updating\n if (this.updating) return;\n\n this.updating = true;\n\n // Get through the categories and find the children currently attached to them\n const order = this.$('.FlarumBadgeCategory')\n .map(function () {\n return {\n id: $(this).data('id') ? $(this).data('id') : null,\n children: $(this)\n .find('li')\n .map(function () {\n return $(this).data('id');\n })\n .get(),\n };\n })\n .get();\n\n app\n .request({\n url: app.forum.attribute('apiUrl') + '/badges/order',\n method: 'POST',\n body: { order },\n })\n .catch((e) => console.error(e))\n .then(() => {\n // Update local store\n order.map((categoryObject) => {\n const category = categoryObject.id !== null ? app.store.getById('badgeCategories', categoryObject.id) : null;\n\n // Loop through the badges\n const badges = categoryObject.children.map((badgeId, badgePosition) => {\n const badge = app.store.getById('badges', badgeId);\n\n badge.pushData({\n attributes: {\n order: badgePosition,\n },\n relationships: {\n category,\n },\n });\n\n return badge;\n });\n\n // Update the category\n if (category) {\n category.pushData({\n relationships: {\n badges: {\n data: badges.map((badge) => ({\n type: 'badges',\n id: badge.id(),\n })),\n },\n },\n });\n }\n });\n\n this.updating = false;\n this.nextRefreshKey();\n });\n }\n\n nextRefreshKey() {\n this.forcedRefreshKey++;\n m.redraw();\n }\n}\n","import Badge from '../common/models/Badge';\nimport BadgeCategory from '../common/models/BadgeCategory';\nimport BadgeActionDriverSettings from './components/BadgeActionDriverSettings';\nimport SettingsPage from './components/SettingsPage';\n\napp.initializers.add('v17development-user-badges', () => {\n app.store.models.badges = Badge;\n app.store.models.badgeCategories = BadgeCategory;\n\n // Register extension settings page\n app.extensionData.for('v17development-user-badges').registerPage(SettingsPage);\n\n app.extensionData\n .for('v17development-user-badges')\n .registerPermission(\n {\n icon: 'fas fa-users',\n label: app.translator.trans('v17development-flarum-badges.admin.permissions.badge_detail_users'),\n permission: 'badges.canViewDetailedUsers',\n allowGuest: true,\n },\n 'view',\n 90\n )\n .registerPermission(\n {\n icon: 'fas fa-id-card',\n label: app.translator.trans('v17development-flarum-badges.admin.permissions.edit_own_card_badges'),\n permission: 'badges.editOwnUserCardBadges',\n },\n 'start',\n 90\n )\n .registerPermission(\n {\n icon: 'fas fa-address-card',\n label: app.translator.trans('v17development-flarum-badges.admin.permissions.edit_card_badges'),\n permission: 'badges.editUserCardBadges',\n },\n 'moderate',\n 90\n )\n .registerPermission(\n {\n icon: 'fas fa-user-tag',\n label: app.translator.trans('v17development-flarum-badges.admin.permissions.give_badge'),\n permission: 'badges.giveBadge',\n },\n 'moderate',\n 90\n )\n .registerPermission(\n {\n icon: 'fas fa-user-times',\n label: app.translator.trans('v17development-flarum-badges.admin.permissions.take_badge'),\n permission: 'badges.removeBadge',\n },\n 'moderate',\n 90\n );\n\n // Auto moderation\n if (app.autoModeratorForms) {\n app.autoModeratorForms.action.give_badge = BadgeActionDriverSettings;\n app.autoModeratorForms.action.remove_badge = BadgeActionDriverSettings;\n\n app.autoModeratorForms.requirement.has_badge = BadgeActionDriverSettings;\n }\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","create","constructor","app","GiveBadgeModal","oninit","vnode","this","selectedBadge","attrs","badge","user","userHasBadge","store","createRecord","description","Stream","categories","uncategorizedBadges","loading","find","include","then","badges","forEach","category","id","push","m","redraw","className","title","translator","trans","exists","content","fields","toArray","type","disabled","items","ItemList","add","onchange","e","target","getById","checkUserHasBadge","values","map","label","name","length","class","placeholder","bidi","foundBadge","userBadges","userBadge","onsubmit","preventDefault","save","relationships","modal","show","BadgeModal","userBadgeData","hide","response","handleErrors","Modal","data","href","route","style","margin","forum","attribute","onclick","confirm","fullTime","assignedAt","earnedAmount","count","Badge","apiEndpoint","mixin","Model","icon","order","image","isVisible","createdAt","backgroundColor","iconColor","labelColor","BadgeCategory","isEnabled","isTable","users","hasLoaded","onLoadedCallbacks","BadgeSelector","onLoadedCallback","loaded","cb","view","float","buttonClassName","all","g","Button","active","Component","BadgeActionDriverSettings","settings","badge_id","val","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","apply","_objectSpread2","i","arguments","source","_defineProperty","getOwnPropertyDescriptors","defineProperties","_typeof","iterator","configurable","writable","_extends","assign","_objectWithoutProperties","excluded","sourceKeys","indexOf","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","userAgent","pattern","window","navigator","match","IE11OrLess","Edge","FireFox","Safari","IOS","ChromeForAndroid","captureMode","capture","passive","on","el","event","fn","addEventListener","off","removeEventListener","matches","selector","substring","msMatchesSelector","webkitMatchesSelector","_","getParentOrHost","host","document","nodeType","parentNode","closest","ctx","includeCTX","_throttleTimeout","R_SPACE","toggleClass","state","classList","replace","css","defaultView","getComputedStyle","currentStyle","matrix","selfOnly","appliedTransforms","transform","matrixFn","DOMMatrix","WebKitCSSMatrix","CSSMatrix","MSCSSMatrix","tagName","list","getElementsByTagName","n","getWindowScrollingElement","scrollingElement","documentElement","getRect","relativeToContainingBlock","relativeToNonStaticParent","undoScale","container","getBoundingClientRect","elRect","top","left","bottom","right","height","width","innerHeight","innerWidth","containerRect","parseInt","elMatrix","scaleX","scaleY","isScrolledPast","elSide","parentSide","parent","getParentAutoScrollElement","elSideVal","parentSideVal","getChild","childNum","options","includeDragEl","currentChild","children","display","Sortable","ghost","dragged","draggable","lastChild","last","lastElementChild","previousElementSibling","index","nodeName","toUpperCase","clone","getRelativeScrollOffset","offsetLeft","offsetTop","winScroller","scrollLeft","scrollTop","includeSelf","elem","gotSelf","clientWidth","scrollWidth","clientHeight","scrollHeight","elemCSS","overflowX","overflowY","body","isRectEqual","rect1","rect2","Math","round","throttle","callback","ms","args","_this","setTimeout","scrollBy","x","y","Polymer","$","jQuery","Zepto","dom","cloneNode","expando","Date","getTime","plugins","defaults","initializeByDefault","PluginManager","mount","plugin","option","pluginName","concat","pluginEvent","eventName","sortable","evt","eventCanceled","cancel","eventNameGlobal","initializePlugins","initialized","modified","modifyOption","getEventProperties","eventProperties","modifiedValue","optionListeners","_excluded","_ref","undefined","originalEvent","bind","dragEl","parentEl","ghostEl","rootEl","nextEl","lastDownEl","cloneEl","cloneHidden","dragStarted","moved","putSortable","activeSortable","oldIndex","oldDraggableIndex","newIndex","newDraggableIndex","hideGhostForTarget","_hideGhostForTarget","unhideGhostForTarget","_unhideGhostForTarget","cloneNowHidden","cloneNowShown","dispatchSortableEvent","_dispatchEvent","info","targetEl","toEl","fromEl","extraEventProperties","onName","charAt","substr","CustomEvent","createEvent","initEvent","bubbles","cancelable","to","from","item","pullMode","lastPutMode","allEventProperties","dispatchEvent","activeGroup","tapEvt","touchEvt","lastDx","lastDy","tapDistanceLeft","tapDistanceTop","lastTarget","lastDirection","targetMoveDistance","ghostRelativeParent","awaitingDragStarted","ignoreNextClick","sortables","pastFirstInvertThresh","isCircumstantialInvert","ghostRelativeParentInitialScroll","_silent","savedInputChecked","documentExists","PositionGhostAbsolutely","CSSFloatProperty","supportDraggable","createElement","supportCssPointerEvents","cssText","pointerEvents","_detectDirection","elCSS","elWidth","paddingLeft","paddingRight","borderLeftWidth","borderRightWidth","child1","child2","firstChildCSS","secondChildCSS","firstChildWidth","marginLeft","marginRight","secondChildWidth","flexDirection","gridTemplateColumns","split","touchingSideChild2","clear","_prepareGroup","toFn","pull","sameGroup","group","otherGroup","join","originalGroup","checkPull","checkPut","put","revertClone","stopPropagation","stopImmediatePropagation","nearestEmptyInsertDetectEvent","touches","nearest","clientX","clientY","some","threshold","emptyInsertThreshold","rect","insideHorizontally","insideVertically","ret","_onDragOver","_checkOutsideTargetEl","_isOutsideThisEl","toString","animationCallbackId","animationStates","sort","handle","test","swapThreshold","invertSwap","invertedSwapThreshold","removeCloneOnHide","direction","ghostClass","chosenClass","dragClass","ignore","preventOnFilter","animation","easing","setData","dataTransfer","textContent","dropBubble","dragoverBubble","dataIdAttr","delay","delayOnTouchOnly","touchStartThreshold","Number","devicePixelRatio","forceFallback","fallbackClass","fallbackOnBody","fallbackTolerance","fallbackOffset","supportPointer","nativeDraggable","_onTapStart","captureAnimationState","slice","child","fromRect","thisAnimationDuration","childMatrix","f","addAnimationState","removeAnimationState","splice","arr","indexOfObject","animateAll","clearTimeout","animating","animationTime","time","toRect","prevFromRect","prevToRect","animatingRect","targetMatrix","sqrt","pow","calculateRealTime","animate","max","animationResetTimer","currentRect","duration","translateX","translateY","animatingX","animatingY","forRepaintDummy","offsetWidth","repaint","animated","_onMove","dragRect","targetRect","willInsertAfter","retVal","onMoveFn","onMove","draggedRect","related","relatedRect","_disableDraggable","_unsilent","_generateId","str","src","sum","charCodeAt","_nextTick","_cancelNextTick","contains","_getDirection","touch","pointerType","originalTarget","shadowRoot","path","composedPath","root","inputs","idx","checked","_saveInputCheckedState","button","isContentEditable","criteria","trim","_prepareDragStart","dragStartFn","ownerDocument","nextSibling","_lastX","_lastY","_onDrop","_disableDelayedDragEvents","_triggerDragStart","_disableDelayedDrag","_delayedDragTouchMoveHandler","_dragStartTimer","abs","floor","_onTouchMove","_onDragStart","selection","empty","getSelection","removeAllRanges","err","_dragStarted","fallback","_appendGhost","_nulling","_emulateDragOver","elementFromPoint","ghostMatrix","relativeScrollOffset","dx","dy","b","c","cssMatrix","appendChild","_hideClone","cloneId","insertBefore","_loopId","setInterval","effectAllowed","_dragStartId","revert","vertical","isOwner","canSort","fromSortable","completedFired","dragOverEvent","_ignoreWhileAnimating","completed","elLastChild","_ghostIsLast","changed","_ghostIsFirst","firstChild","targetBeforeFirstSwap","sibling","differentLevel","differentRowCol","dragElS1Opp","dragElS2Opp","dragElOppLength","targetS1Opp","targetS2Opp","targetOppLength","_dragElInRowColumn","side1","scrolledPastTop","scrollBefore","isLastTarget","mouseOnAxis","targetLength","targetS1","targetS2","invert","_getInsertDirection","_getSwapDirection","dragIndex","nextElementSibling","after","moveVector","extra","axis","insertion","_showClone","_offMoveEvents","_offUpEvents","clearInterval","removeChild","handleEvent","dropEffect","_globalDragOver","getAttribute","useAnimation","set","destroy","Array","querySelectorAll","removeAttribute","utils","is","extend","dst","nextTick","cancelNextTick","detectDirection","element","_len","_key","version","scrollEl","scrollRootEl","lastAutoScrollX","lastAutoScrollY","touchEvt$1","pointerElemChangedInterval","autoScrolls","scrolling","clearAutoScrolls","autoScroll","pid","clearPointerElemChangedInterval","isFallback","scroll","scrollCustomFn","sens","scrollSensitivity","speed","scrollSpeed","scrollThisInstance","scrollFn","layersOut","currentParent","canScrollX","canScrollY","scrollPosX","scrollPosY","vx","vy","layer","scrollOffsetY","scrollOffsetX","bubbleScroll","drop","toSortable","changedTouches","onSpill","Revert","Remove","startIndex","dragStart","_ref2","_ref3","_ref4","parentSortable","AutoScroll","forceAutoScrollFallback","_handleAutoScroll","_handleFallbackAutoScroll","dragOverCompleted","dragOverBubble","nulling","ogElemScroller","newElem","UserBadge","tooltip","forceVisibility","text","isPartlyHidden","opacity","color","borderColor","ConfirmModal","promise","onconfirm","EditBadgeModal","isImage","Switch","SortableBadge","resolve","reject","EditBadgeCategoryModal","badgeCategory","onCreate","InstallAutoModerationMessage","badges_install_automoderation","extensionInstalled","extensions","saveSettings","SettingsPage","updating","forcedRefreshKey","extensions_enabled","nextRefreshKey","oncreate","onBadgeListReady","updateCategorySort","pushData","size","buildSettingComponent","setting","help","submitButton","onSort","onSortUpdate","action","newPosition","console","log","request","url","method","error","payload","pushPayload","categoryObject","badgeId","badgePosition","attributes","ExtensionPage","initializers","models","badgeCategories","extensionData","registerPage","registerPermission","permission","allowGuest","autoModeratorForms","give_badge","remove_badge","requirement","has_badge"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index c2fcad2..63796c5 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t);const a=flarum.core.compat["common/app"];e.n(a)().initializers.add("v17development/flarum-user-badges",(function(){}));const r=flarum.core.compat.extend,s=flarum.core.compat.Model;var n=e.n(s);const o=flarum.core.compat["models/User"];var i=e.n(o);const d=flarum.core.compat["components/UserPage"];var l=e.n(d);const u=flarum.core.compat["utils/UserControls"];var c=e.n(u);const p=flarum.core.compat["components/LinkButton"];var g=e.n(p);const f=flarum.core.compat["components/Button"];var b=e.n(f);function h(e,t){return h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},h(e,t)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,h(e,t)}const y=flarum.core.compat["utils/mixin"];var B=e.n(y);const N=flarum.core.compat["components/Modal"];var _=e.n(N);const C=flarum.core.compat["helpers/fullTime"];var w=e.n(C);const I=flarum.core.compat["utils/ItemList"];var U=e.n(I);flarum.core.compat["components/Select"];const x=flarum.core.compat["utils/Stream"];var M=e.n(x),O=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){var a=this;e.prototype.oninit.call(this,t),this.selectedBadge=this.attrs.badge?this.attrs.badge.badge():null,this.user=this.attrs.badge?this.attrs.badge.user():this.attrs.user,this.userHasBadge=!1,this.badge=this.attrs.badge?this.attrs.badge:app.store.createRecord("userBadges"),this.description=M()(this.badge.description()),this.categories={},this.uncategorizedBadges=[],this.loading=!1,this.attrs.badge||(this.loading=!0,app.store.find("badges",{include:"category"}).then((function(e){e.forEach((function(e){if(e.category()){var t=e.category();a.categories[t.id()]?a.categories[t.id()].badges.push(e):a.categories[t.id()]={category:t,badges:[e]}}else a.uncategorizedBadges.push(e)})),a.loading=!1,m.redraw()})))},a.className=function(){return"Modal--small BadgeModal"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum."+(this.badge.exists?"update":"give")+"_badge")},a.content=function(){return m("div",null,m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray())),m("div",{className:"Modal-footer"},m(b(),{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:this.userHasBadge},app.translator.trans("core.forum.composer_edit.submit_button"))))},a.fields=function(){var e=this,t=new(U());return t.add("badge",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.badge"))),m("div",{className:"Select"},m("select",{value:this.selectedBadge?this.selectedBadge.id():"empty",disabled:!!this.attrs.badge,onchange:function(t){"empty"!==t.target.value&&(e.selectedBadge=app.store.getById("badges",t.target.value),e.checkUserHasBadge(e.selectedBadge))},className:"Select-input FormControl"},m("option",{value:"empty"},app.translator.trans("v17development-flarum-badges.forum.select_badge")),!this.attrs.badge&&Object.values(this.categories).map((function(e){var t=e.category,a=e.badges;return m("optgroup",{label:t.name()},a.map((function(e){return m("option",{value:e.id()},e.name())})))})),!this.attrs.badge&&this.uncategorizedBadges.length>=1&&m("optgroup",{label:app.translator.trans("v17development-flarum-badges.forum.uncategorized")},this.uncategorizedBadges.map((function(e){return m("option",{value:e.id()},e.name())}))),!!this.attrs.badge&&m("option",{value:this.selectedBadge.id()},this.selectedBadge.name())),m("i",{class:"icon fas fa-caret-down Select-caret"})),this.userHasBadge&&m("p",{className:"UserHasBadge"},app.translator.trans("v17development-flarum-badges.forum.user_has_badge"))),30),t.add("badge_description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.selectedBadge?this.selectedBadge.description():app.translator.trans("v17development-flarum-badges.forum.select_badge"))),30),t.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"))),m("textarea",{className:"FormControl",placeholder:app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),bidi:this.description})),30),t},a.checkUserHasBadge=function(e){var t=!1;this.user.userBadges().map((function(a){a.badge()==e&&(t=!0)})),this.userHasBadge=t,m.redraw()},a.onsubmit=function(e){var t=this;e.preventDefault(),this.loading=!0,this.badge.save({description:this.description(),relationships:this.attrs.badge?{}:{badge:this.selectedBadge,user:this.user}}).then((function(){t.attrs.badge?app.modal.show(k,{badge:t.attrs.badge.badge(),userBadgeData:t.attrs.badge}):t.hide(),m.redraw()}),(function(e){t.loading=!1,t.handleErrors(e)}))},t}(_()),k=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.loading=!1},a.className=function(){return"Modal--small"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum.badge_information")},a.content=function(){var e=this;return m("div",null,m("div",{className:"Modal-body"},this.data().toArray()),m("div",{className:"Modal-footer"},m(g(),{href:app.route("badges.item",{id:this.attrs.badge.id()}),className:"Button",style:{margin:"0 10px"}},app.translator.trans("v17development-flarum-badges.forum.badge.badge_details")),this.attrs.userBadgeData&&app.forum.attribute("canGiveBadge")&&m(b(),{className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge_confirm"))&&(e.loading=!0,e.attrs.userBadgeData.delete().then((function(){return e.hide()})))},loading:this.loading},app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge"))))},a.data=function(){var e=this,t=new(U());return t.add("name",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.name"),":")),m("p",null,this.attrs.badge.name()))),t.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.attrs.badge.description()))),this.attrs.userBadgeData&&(this.attrs.userBadgeData.description()||app.forum.attribute("canGiveBadge"))&&t.add("earning_reason",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),":")),m("p",null,this.attrs.userBadgeData.description()?this.attrs.userBadgeData.description():m("i",null,app.translator.trans("v17development-flarum-badges.forum.badge.no_earning_reason"))),m("p",null,app.forum.attribute("canGiveBadge")&&m("a",{href:"#",onclick:function(t){t.preventDefault(),app.modal.show(O,{badge:e.attrs.userBadgeData})}},app.translator.trans("v17development-flarum-badges.forum.badge.update_earning_reason"))))),this.attrs.userBadgeData&&t.add("earned_date",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_on"),":")),m("p",null,w()(this.attrs.userBadgeData.assignedAt())))),this.attrs.userBadgeData&&t.add("category",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.category"),":")),m("p",null,this.attrs.badge.category()&&this.attrs.badge.category().name(),!this.attrs.badge.category()&&app.translator.trans("v17development-flarum-badges.forum.uncategorized")))),this.attrs.badge&&this.attrs.badge.earnedAmount()&&t.add("earned_amount",m("div",{className:"BadgeModalListItem"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:this.attrs.badge.earnedAmount()})))),t},t}(_()),L=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.apiEndpoint=function(){return"/badges"+(this.exists?"/"+this.data.id:"")},t}(B()(n(),{name:n().attribute("name"),icon:n().attribute("icon"),order:n().attribute("order"),image:n().attribute("image"),description:n().attribute("description"),isVisible:n().attribute("isVisible"),createdAt:n().attribute("createdAt"),earnedAmount:n().attribute("earnedAmount"),category:n().hasOne("category"),backgroundColor:n().attribute("backgroundColor"),iconColor:n().attribute("iconColor"),labelColor:n().attribute("labelColor")})),P=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.apiEndpoint=function(){return"/badge_categories"+(this.exists?"/"+this.data.id:"")},t}(B()(n(),{name:n().attribute("name"),order:n().attribute("order"),description:n().attribute("description"),isEnabled:n().attribute("isEnabled"),createdAt:n().attribute("createdAt"),isTable:n().attribute("isTable"),users:n().hasMany("users"),badges:n().hasMany("badges")})),A=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.apiEndpoint=function(){return"/user_badges"+(this.exists?"/"+this.data.id:"")},t}(B()(n(),{user:n().hasOne("user"),badge:n().hasOne("badge"),description:n().attribute("description"),isPrimary:n().attribute("isPrimary"),assignedAt:n().attribute("assignedAt"),inUserCard:n().attribute("inUserCard")}));const D=flarum.core.compat["components/LoadingIndicator"];var T=e.n(D);const S=flarum.core.compat["common/Component"];var z=e.n(S);const j=flarum.core.compat["common/components/Tooltip"];var E=e.n(j),V=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.tooltip=!1!==this.attrs.tooltip,this.forceVisibility=!0===this.attrs.forceVisibility},a.view=function(){return this.attrs.badge.isVisible()||this.forceVisibility?!1===this.tooltip?this.badge():m(E(),{text:""+(this.attrs.badge.description()?this.attrs.badge.description():"")},this.badge()):null},a.badge=function(){var e=this,t=!this.attrs.badge.isVisible()&&this.forceVisibility;return this.attrs.badge.image()?m("img",{src:this.attrs.badge.image(),className:"UserBadgeImage",onclick:function(){e.attrs.onclick&&e.attrs.onclick()},style:{opacity:t?.5:void 0}}):m("span",{className:"UserBadge UserBadge-"+this.attrs.badge.id(),onclick:function(){e.attrs.onclick&&e.attrs.onclick()},style:{backgroundColor:this.attrs.badge.backgroundColor(),color:this.attrs.badge.labelColor(),borderColor:this.attrs.badge.backgroundColor(),opacity:t?.5:void 0}},m("i",{className:this.attrs.badge.icon(),style:{color:this.attrs.badge.iconColor()}})," ",this.attrs.badge.name())},t}(z());function H(e){var t={},a=[];e.userBadges().map((function(e){if(!e)return null;if(e.badge().category()){var r=e.badge().category();t[r.id()]?t[r.id()].badges.push(e):t[r.id()]={name:r.name(),category:r,badges:[e]}}else a.push(e)}));var r=Object.keys(t).sort((function(e,a){return t[e].category.order()-t[a].category.order()})).map((function(e){return t[e]}));return r.push({name:app.translator.trans("v17development-flarum-badges.forum.uncategorized"),category:null,badges:a}),r}var G=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.view=function(){var e=H(this.attrs.user);return m("div",{className:"UserBadges"},0===e.length&&m("div",{className:"Placeholder"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.user_no_badges"))),e.length>=1&&e.map((function(e){var t=e.name,a=e.category,r=e.badges;return a&&!a.isEnabled()?null:m("div",{className:"UserBadgesCategory"},m("h3",null,t),a&&a.description()&&m("p",null,a.description()),r.sort((function(e,t){return e.badge().order()-t.badge().order()})).map((function(e){return m(V,{badge:e.badge(),onclick:function(){return app.modal.show(k,{badge:e.badge(),userBadgeData:e})}})})))})))},t}(z()),R=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.user=null,this.loading=!0,this.loadUser(m.route.param("username"))},a.content=function(){return!this.user||this.loading?m(T(),{size:46}):G.component({user:this.user})},a.show=function(t){var a=this;e.prototype.show.call(this,t),this.user=t,app.store.find("users",t.id(),{include:"userBadges,userBadges.badge,userBadges.badge.category"}).then((function(){a.loading=!1,m.redraw()}))},t}(l());const F=flarum.core.compat["components/Page"];var q=e.n(F);const J=flarum.core.compat["components/IndexPage"];var K=e.n(J);const Q=flarum.core.compat["common/helpers/listItems"];var W=e.n(Q);const X=flarum.core.compat["components/Link"];var Y=e.n(X),Z=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.view=function(){if(!this.attrs.badges)return null;var e=this.attrs.badges;return m("table",{width:"100%",className:"BadgeTable"},m("thead",null,m("tr",null,m("th",{scope:"col"},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),m("th",{scope:"col"},app.translator.trans("v17development-flarum-badges.forum.badge.description")))),m("tbody",null,e.map((function(e){return m("tr",null,m("td",null,m(Y(),{href:app.route("badges.item",{id:e.id()})},m(V,{badge:e,tooltip:!1}))),m("td",null,e.description(),m("div",{className:"BadgeTableRewarded"},app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:e.earnedAmount()}))))}))))},t}(z()),$=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.view=function(){if(!this.attrs.badges)return null;var e=this.attrs.badges;return m("ul",{className:"BadgeCategoryList"},e.map((function(e){return m("li",null,m(Y(),{href:app.route("badges.item",{id:e.id()}),className:"BadgeContainer"},m("div",{className:"BadgeContainerInfo"},m(V,{badge:e,tooltip:!1}),m("p",{className:"BadgeDescription"},e.description()),m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:e.earnedAmount()})))))})))},t}(z()),ee=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){var a=this;e.prototype.oninit.call(this,t),this.bodyClass="App--index",this.loading=!0,app.history.push("badgeOverviewPage"),app.setTitle(app.translator.trans("v17development-flarum-badges.forum.badge.badges")),app.store.find("badge_categories").then((function(){a.loading=!1,m.redraw()}))},a.view=function(){var e=app.store.all("badgeCategories").sort((function(e,t){return e.order()-t.order()}));return m("div",{className:"IndexPage"},K().prototype.hero(),m("div",{className:"container"},m("div",{className:"sideNavContainer"},m("nav",{className:"IndexPage-nav sideNav"},m("ul",null,W()(K().prototype.sidebarItems().toArray()))),m("div",{className:"IndexPage-results sideNavOffset"},m("h2",{className:"BadgeOverviewTitle"},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),this.loading&&m(T(),{size:"large"}),!this.loading&&e.map((function(e){var t=e.badges().sort((function(e,t){return e.order()-t.order()}));return m("div",{className:"BadgeCategory"},m("h3",null,e.name()),e.description()&&m("p",null,e.description()),e.isTable()&&m(Z,{badges:t}),!e.isTable()&&m($,{badges:t}))}))))))},t}(q());const te=flarum.core.compat["helpers/avatar"];var ae=e.n(te);const re=flarum.core.compat["helpers/humanTime"];var se=e.n(re),ne=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.attrs.state.refreshParams({filter:{badge:this.attrs.badgeId},sort:"-assignedAt"})},a.view=function(){var e=this.attrs.state,t=null;return e.isInitialLoading()||e.isLoadingNext()?t=T().component({size:"large"}):e.hasNext()&&(t=b().component({className:"Button",icon:"fas fa-chevron-down",onclick:e.loadNext.bind(e)},app.translator.trans("core.forum.discussion_list.load_more_button"))),e.isInitialLoading()&&e.isEmpty()?m(T(),null):e.isEmpty()?m("div",{className:"BadgeUserList-empty"},app.translator.trans("v17development-flarum-badges.forum.no_received")):m("div",null,m("ul",{className:"BadgeUserList"},e.getPages().map((function(e){return e.items.map((function(e){return m("li",null,m(Y(),{href:app.route("user.badges",{username:e.user().username()}),className:"BadgeUserList-user"},ae()(e.user()),m("div",{className:"BadgeUserList-userinfo"},m("h4",null,e.user().displayName()),m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.received_on",{date:se()(e.assignedAt())})))))}))}))),t&&m("div",{className:"SupportSearchList-loadMore"},t))},t}(z()),oe=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){var a=this;e.prototype.oninit.call(this,t),this.bodyClass="App--index";var r=app.store.getById("badges",m.route.param("id"));this.loading=!r,r?(app.history.push("badgeItemPage",r.name()),this.setTitle(r)):app.store.find("badges/"+m.route.param("id")).then((function(e){a.loading=!1,app.history.push("badgeItemPage",e.name()),a.setTitle(e),m.redraw()}))},a.setTitle=function(e){app.setTitle(e.name()+" - "+app.translator.trans("v17development-flarum-badges.forum.badge.badges"))},a.view=function(){var e=app.store.getById("badges",m.route.param("id"));return m("div",{className:"IndexPage"},K().prototype.hero(),m("div",{className:"container"},m("div",{className:"sideNavContainer"},m("nav",{className:"IndexPage-nav sideNav"},m("ul",null,W()(K().prototype.sidebarItems().toArray()))),m("div",{className:"IndexPage-results sideNavOffset"},m(g(),{href:app.route("badges"),icon:"fas fa-chevron-left",className:"Button BadgesOverviewButton"},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),this.loading&&m(T(),{size:"large"}),!this.loading&&m("div",{className:"BadgeUserListInfo"},m("i",{className:e.icon()}),m("div",{className:"BadgeUserListInfo-meta"},m("h3",null,e.name()),m("p",null,e.description()))),e&&m("h3",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_by_count",{count:e.earnedAmount()})),!this.loading&&app.forum.attribute("canViewDetailedBadgeUsers")&&m(ne,{state:app.userBadgeListState,badgeId:e.id()})))))},t}(q());function ie(){(0,r.extend)(K().prototype,"navItems",(function(e){return e.add("badges",m(g(),{icon:"fas fa-id-badge",href:app.route("badges")},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),15),e}))}function de(e,t){for(var a=0;a=e.limit&&-1===e.selectedBadges.indexOf(t.id());return m(E(),{text:a?app.translator.trans("v17development-flarum-badges.forum.badges_in_card.hit_limit",{limit:app.forum.attribute("numberOfBadgesOnUserCard")}):"",position:"bottom"},m("div",{className:"UserCardBadgesModalCategory-badge",onclick:function(){if(!a){var r=e.selectedBadges.indexOf(t.id());r>=0?e.selectedBadges.splice(r,1):e.selectedBadges.push(t.id())}}},m("div",{className:"UserCardBadgesModalCategory-badge-preview"},m(V,{badge:t.badge(),onclick:function(){}})),m("div",{className:"UserCardBadgesModalCategory-badge-switch"},Ce().component({state:e.selectedBadges.indexOf(t.id())>=0,disabled:a}))))}))))})),t},a.save=function(){var e=this;this.loading=!0,this.attrs.user.save({userCardBadges:this.selectedBadges}).then((function(){e.attrs.user.userBadges().map((function(t){t.pushAttributes({inUserCard:e.selectedBadges.indexOf(t.id())>=0})})),e.hide()})).catch((function(){})).then((function(){e.loading=!1,m.redraw()}))},t}(_());app.initializers.add("v17development-flarum-badges",(function(e){e.store.models.badges=L,e.store.models.badgeCategories=P,e.store.models.userBadges=A,i().prototype.userBadges=n().hasMany("userBadges"),i().prototype.userPrimaryBadge=n().hasOne("userPrimaryBadge"),e.routes["user.badges"]={path:"/u/:username/badges",component:R},e.routes.badges={path:"/badges",component:ee},e.routes["badges.item"]={path:"/badges/:id",component:oe},ie(),e.userBadgeListState=new ue({}),e.notificationComponents.badgeReceived=ce,(0,r.extend)(ge().prototype,"notificationTypes",(function(t){t.add("badgeReceived",{name:"badgeReceived",icon:"fas fa-user-tag",label:e.translator.trans("v17development-flarum-badges.forum.notification.settings")})})),(0,r.extend)(l().prototype,"navItems",(function(t){t.add("badges",g().component({href:e.route("user.badges",{username:this.user.username()}),name:"badges",icon:"fas fa-user-tag"},[e.translator.trans("v17development-flarum-badges.forum.badge.badges"),m("span",{className:"Button-badge"},this.user.userBadges().length)]),90)})),(0,r.extend)(c(),"moderationControls",(function(t,a){e.forum.attribute("canGiveBadge")&&t.add("test",m(b(),{icon:"fas fa-user-tag",onclick:function(){return e.modal.show(O,{user:a})}},e.translator.trans("v17development-flarum-badges.forum.give_badge")))})),(0,he.extend)(ye().prototype,"infoItems",(function(e){var t=this.attrs.user,a=t.userBadges();if(!(a.length<1)&&be().forum.attribute("showBadgesOnUserCard")){var r=be().forum.attribute("numberOfBadgesOnUserCard"),s=a.filter((function(e){return e.inUserCard()}));0===s.length&&(s=a.slice(0,r));var n=s.map((function(e){return m(V,{badge:e.badge(),onclick:function(){return be().modal.show(k,{badge:e.badge(),userBadgeData:e})}})}));if(n.length{var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t);const a=flarum.core.compat["common/app"];e.n(a)().initializers.add("v17development/flarum-user-badges",(function(){}));const r=flarum.core.compat.extend,s=flarum.core.compat.Model;var n=e.n(s);const o=flarum.core.compat["models/User"];var i=e.n(o);const d=flarum.core.compat["components/UserPage"];var l=e.n(d);const u=flarum.core.compat["utils/UserControls"];var c=e.n(u);const p=flarum.core.compat["components/LinkButton"];var g=e.n(p);const f=flarum.core.compat["components/Button"];var b=e.n(f);function h(e,t){return h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},h(e,t)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,h(e,t)}const y=flarum.core.compat["utils/mixin"];var B=e.n(y);const N=flarum.core.compat["components/Modal"];var _=e.n(N);const C=flarum.core.compat["helpers/fullTime"];var w=e.n(C);const U=flarum.core.compat["utils/ItemList"];var I=e.n(U);flarum.core.compat["components/Select"];const x=flarum.core.compat["utils/Stream"];var M=e.n(x),O=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){var a=this;e.prototype.oninit.call(this,t),this.selectedBadge=this.attrs.badge?this.attrs.badge.badge():null,this.user=this.attrs.badge?this.attrs.badge.user():this.attrs.user,this.userHasBadge=!1,this.badge=this.attrs.badge?this.attrs.badge:app.store.createRecord("userBadges"),this.description=M()(this.badge.description()),this.categories={},this.uncategorizedBadges=[],this.loading=!1,this.attrs.badge||(this.loading=!0,app.store.find("badges",{include:"category"}).then((function(e){e.forEach((function(e){if(e.category()){var t=e.category();a.categories[t.id()]?a.categories[t.id()].badges.push(e):a.categories[t.id()]={category:t,badges:[e]}}else a.uncategorizedBadges.push(e)})),a.loading=!1,m.redraw()})))},a.className=function(){return"Modal--small BadgeModal"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum."+(this.badge.exists?"update":"give")+"_badge")},a.content=function(){return m("div",null,m("div",{className:"Modal-body"},m("div",{className:"Form"},this.fields().toArray())),m("div",{className:"Modal-footer"},m(b(),{className:"Button Button--primary",type:"submit",loading:this.loading,disabled:this.userHasBadge},app.translator.trans("core.forum.composer_edit.submit_button"))))},a.fields=function(){var e=this,t=new(I());return t.add("badge",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.badge"))),m("div",{className:"Select"},m("select",{value:this.selectedBadge?this.selectedBadge.id():"empty",disabled:!!this.attrs.badge,onchange:function(t){"empty"!==t.target.value&&(e.selectedBadge=app.store.getById("badges",t.target.value),e.checkUserHasBadge(e.selectedBadge))},className:"Select-input FormControl"},m("option",{value:"empty"},app.translator.trans("v17development-flarum-badges.forum.select_badge")),!this.attrs.badge&&Object.values(this.categories).map((function(e){var t=e.category,a=e.badges;return m("optgroup",{label:t.name()},a.map((function(e){return m("option",{value:e.id()},e.name())})))})),!this.attrs.badge&&this.uncategorizedBadges.length>=1&&m("optgroup",{label:app.translator.trans("v17development-flarum-badges.forum.uncategorized")},this.uncategorizedBadges.map((function(e){return m("option",{value:e.id()},e.name())}))),!!this.attrs.badge&&m("option",{value:this.selectedBadge.id()},this.selectedBadge.name())),m("i",{class:"icon fas fa-caret-down Select-caret"})),this.userHasBadge&&m("p",{className:"UserHasBadge"},app.translator.trans("v17development-flarum-badges.forum.user_has_badge"))),30),t.add("badge_description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.selectedBadge?this.selectedBadge.description():app.translator.trans("v17development-flarum-badges.forum.select_badge"))),30),t.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"))),m("textarea",{className:"FormControl",placeholder:app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),bidi:this.description})),30),t},a.checkUserHasBadge=function(e){var t=!1;this.user.userBadges().map((function(a){a.badge()==e&&(t=!0)})),this.userHasBadge=t,m.redraw()},a.onsubmit=function(e){var t=this;e.preventDefault(),this.loading=!0,this.badge.save({description:this.description(),relationships:this.attrs.badge?{}:{badge:this.selectedBadge,user:this.user}}).then((function(){t.attrs.badge?app.modal.show(k,{badge:t.attrs.badge.badge(),userBadgeData:t.attrs.badge}):t.hide(),m.redraw()}),(function(e){t.loading=!1,t.handleErrors(e)}))},t}(_()),k=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.loading=!1},a.className=function(){return"Modal--small"},a.title=function(){return app.translator.trans("v17development-flarum-badges.forum.badge_information")},a.content=function(){var e=this;return m("div",null,m("div",{className:"Modal-body"},this.data().toArray()),m("div",{className:"Modal-footer"},m(g(),{href:app.route("badges.item",{id:this.attrs.badge.id()}),className:"Button",style:{margin:"0 10px"}},app.translator.trans("v17development-flarum-badges.forum.badge.badge_details")),this.attrs.userBadgeData&&app.forum.attribute("canGiveBadge")&&m(b(),{className:"Button Button--primary",onclick:function(){confirm(app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge_confirm"))&&(e.loading=!0,e.attrs.userBadgeData.delete().then((function(){return e.hide()})))},loading:this.loading},app.translator.trans("v17development-flarum-badges.forum.moderation.remove_badge"))))},a.data=function(){var e=this,t=new(I());return t.add("name",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.name"),":")),m("p",null,this.attrs.badge.name()))),t.add("description",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.description"),":")),m("p",null,this.attrs.badge.description()))),this.attrs.userBadgeData&&(this.attrs.userBadgeData.description()||app.forum.attribute("canGiveBadge"))&&t.add("earning_reason",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earning_reason"),":")),m("p",null,this.attrs.userBadgeData.description()?this.attrs.userBadgeData.description():m("i",null,app.translator.trans("v17development-flarum-badges.forum.badge.no_earning_reason"))),m("p",null,app.forum.attribute("canGiveBadge")&&m("a",{href:"#",onclick:function(t){t.preventDefault(),app.modal.show(O,{badge:e.attrs.userBadgeData})}},app.translator.trans("v17development-flarum-badges.forum.badge.update_earning_reason"))))),this.attrs.userBadgeData&&t.add("earned_date",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_on"),":")),m("p",null,w()(this.attrs.userBadgeData.assignedAt())))),this.attrs.userBadgeData&&t.add("category",m("div",{className:"BadgeModalListItem"},m("p",null,m("b",null,app.translator.trans("v17development-flarum-badges.forum.badge.category"),":")),m("p",null,this.attrs.badge.category()&&this.attrs.badge.category().name(),!this.attrs.badge.category()&&app.translator.trans("v17development-flarum-badges.forum.uncategorized")))),this.attrs.badge&&this.attrs.badge.earnedAmount()&&t.add("earned_amount",m("div",{className:"BadgeModalListItem"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:this.attrs.badge.earnedAmount()})))),t},t}(_()),L=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.apiEndpoint=function(){return"/badges"+(this.exists?"/"+this.data.id:"")},t}(B()(n(),{name:n().attribute("name"),icon:n().attribute("icon"),order:n().attribute("order"),image:n().attribute("image"),description:n().attribute("description"),isVisible:n().attribute("isVisible"),createdAt:n().attribute("createdAt"),earnedAmount:n().attribute("earnedAmount"),category:n().hasOne("category"),backgroundColor:n().attribute("backgroundColor"),iconColor:n().attribute("iconColor"),labelColor:n().attribute("labelColor")})),P=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.apiEndpoint=function(){return"/badge_categories"+(this.exists?"/"+this.data.id:"")},t}(B()(n(),{name:n().attribute("name"),order:n().attribute("order"),description:n().attribute("description"),isEnabled:n().attribute("isEnabled"),createdAt:n().attribute("createdAt"),isTable:n().attribute("isTable"),users:n().hasMany("users"),badges:n().hasMany("badges")})),A=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.apiEndpoint=function(){return"/user_badges"+(this.exists?"/"+this.data.id:"")},t}(B()(n(),{user:n().hasOne("user"),badge:n().hasOne("badge"),description:n().attribute("description"),isPrimary:n().attribute("isPrimary"),assignedAt:n().attribute("assignedAt"),inUserCard:n().attribute("inUserCard")}));const D=flarum.core.compat["components/LoadingIndicator"];var T=e.n(D);const S=flarum.core.compat["common/Component"];var z=e.n(S);const j=flarum.core.compat["common/components/Tooltip"];var E=e.n(j),V=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.tooltip=!1!==this.attrs.tooltip,this.forceVisibility=!0===this.attrs.forceVisibility},a.view=function(){return this.attrs.badge.isVisible()||this.forceVisibility?!1===this.tooltip?this.badge():m(E(),{text:""+(this.attrs.badge.description()?this.attrs.badge.description():"")},this.badge()):null},a.badge=function(){var e=this,t=!this.attrs.badge.isVisible()&&this.forceVisibility;return this.attrs.badge.image()?m("img",{src:this.attrs.badge.image(),className:"UserBadgeImage",onclick:function(){e.attrs.onclick&&e.attrs.onclick()},style:{opacity:t?.5:void 0}}):m("span",{className:"UserBadge UserBadge-"+this.attrs.badge.id(),onclick:function(){e.attrs.onclick&&e.attrs.onclick()},style:{backgroundColor:this.attrs.badge.backgroundColor(),color:this.attrs.badge.labelColor(),borderColor:this.attrs.badge.backgroundColor(),opacity:t?.5:void 0}},m("i",{className:this.attrs.badge.icon(),style:{color:this.attrs.badge.iconColor()}})," ",this.attrs.badge.name())},t}(z());function H(e){var t={},a=[];e.userBadges().map((function(e){if(!e)return null;if(e.badge().category()){var r=e.badge().category();t[r.id()]?t[r.id()].badges.push(e):t[r.id()]={name:r.name(),category:r,badges:[e]}}else a.push(e)}));var r=Object.keys(t).sort((function(e,a){return t[e].category.order()-t[a].category.order()})).map((function(e){return t[e]}));return a.length>=1&&r.push({name:app.translator.trans("v17development-flarum-badges.forum.uncategorized"),category:null,badges:a}),r}var G=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.view=function(){var e=H(this.attrs.user);return m("div",{className:"UserBadges"},0===e.length&&m("div",{className:"Placeholder"},m("p",null,app.translator.trans("v17development-flarum-badges.forum.user_no_badges"))),e.length>=1&&e.map((function(e){var t=e.name,a=e.category,r=e.badges;return a&&!a.isEnabled()?null:m("div",{className:"UserBadgesCategory"},m("h3",null,t),a&&a.description()&&m("p",null,a.description()),r.sort((function(e,t){return e.badge().order()-t.badge().order()})).map((function(e){return m(V,{badge:e.badge(),onclick:function(){return app.modal.show(k,{badge:e.badge(),userBadgeData:e})}})})))})))},t}(z()),R=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.user=null,this.loading=!0,this.loadUser(m.route.param("username"))},a.content=function(){return!this.user||this.loading?m(T(),{size:46}):G.component({user:this.user})},a.show=function(t){var a=this;e.prototype.show.call(this,t),this.user=t,app.store.find("users",t.id(),{include:"userBadges,userBadges.badge,userBadges.badge.category"}).then((function(){a.loading=!1,m.redraw()}))},t}(l());const F=flarum.core.compat["components/Page"];var q=e.n(F);const J=flarum.core.compat["components/IndexPage"];var K=e.n(J);const Q=flarum.core.compat["common/helpers/listItems"];var W=e.n(Q);const X=flarum.core.compat["components/Link"];var Y=e.n(X),Z=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.view=function(){if(!this.attrs.badges)return null;var e=this.attrs.badges;return m("table",{width:"100%",className:"BadgeTable"},m("thead",null,m("tr",null,m("th",{scope:"col"},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),m("th",{scope:"col"},app.translator.trans("v17development-flarum-badges.forum.badge.description")))),m("tbody",null,e.map((function(e){return m("tr",null,m("td",null,m(Y(),{href:app.route("badges.item",{id:e.id()})},m(V,{badge:e,tooltip:!1}))),m("td",null,e.description(),m("div",{className:"BadgeTableRewarded"},app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:e.earnedAmount()}))))}))))},t}(z()),$=function(e){function t(){return e.apply(this,arguments)||this}return v(t,e),t.prototype.view=function(){if(!this.attrs.badges)return null;var e=this.attrs.badges;return m("ul",{className:"BadgeCategoryList"},e.map((function(e){return m("li",null,m(Y(),{href:app.route("badges.item",{id:e.id()}),className:"BadgeContainer"},m("div",{className:"BadgeContainerInfo"},m(V,{badge:e,tooltip:!1}),m("p",{className:"BadgeDescription"},e.description()),m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_count",{count:e.earnedAmount()})))))})))},t}(z()),ee=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){var a=this;e.prototype.oninit.call(this,t),this.bodyClass="App--index",this.loading=!0,app.history.push("badgeOverviewPage"),app.setTitle(app.translator.trans("v17development-flarum-badges.forum.badge.badges")),app.store.find("badge_categories").then((function(){a.loading=!1,m.redraw()}))},a.view=function(){var e=app.store.all("badgeCategories").sort((function(e,t){return e.order()-t.order()}));return m("div",{className:"IndexPage"},K().prototype.hero(),m("div",{className:"container"},m("div",{className:"sideNavContainer"},m("nav",{className:"IndexPage-nav sideNav"},m("ul",null,W()(K().prototype.sidebarItems().toArray()))),m("div",{className:"IndexPage-results sideNavOffset"},m("h2",{className:"BadgeOverviewTitle"},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),this.loading&&m(T(),{size:"large"}),!this.loading&&e.map((function(e){var t=e.badges().sort((function(e,t){return e.order()-t.order()}));return m("div",{className:"BadgeCategory"},m("h3",null,e.name()),e.description()&&m("p",null,e.description()),e.isTable()&&m(Z,{badges:t}),!e.isTable()&&m($,{badges:t}))}))))))},t}(q());const te=flarum.core.compat["helpers/avatar"];var ae=e.n(te);const re=flarum.core.compat["helpers/humanTime"];var se=e.n(re),ne=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){e.prototype.oninit.call(this,t),this.attrs.state.refreshParams({filter:{badge:this.attrs.badgeId},sort:"-assignedAt"})},a.view=function(){var e=this.attrs.state,t=null;return e.isInitialLoading()||e.isLoadingNext()?t=T().component({size:"large"}):e.hasNext()&&(t=b().component({className:"Button",icon:"fas fa-chevron-down",onclick:e.loadNext.bind(e)},app.translator.trans("core.forum.discussion_list.load_more_button"))),e.isInitialLoading()&&e.isEmpty()?m(T(),null):e.isEmpty()?m("div",{className:"BadgeUserList-empty"},app.translator.trans("v17development-flarum-badges.forum.no_received")):m("div",null,m("ul",{className:"BadgeUserList"},e.getPages().map((function(e){return e.items.map((function(e){return m("li",null,m(Y(),{href:app.route("user.badges",{username:e.user().username()}),className:"BadgeUserList-user"},ae()(e.user()),m("div",{className:"BadgeUserList-userinfo"},m("h4",null,e.user().displayName()),m("p",null,app.translator.trans("v17development-flarum-badges.forum.badge.received_on",{date:se()(e.assignedAt())})))))}))}))),t&&m("div",{className:"SupportSearchList-loadMore"},t))},t}(z()),oe=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var a=t.prototype;return a.oninit=function(t){var a=this;e.prototype.oninit.call(this,t),this.bodyClass="App--index";var r=app.store.getById("badges",m.route.param("id"));this.loading=!r,r?(app.history.push("badgeItemPage",r.name()),this.setTitle(r)):app.store.find("badges/"+m.route.param("id")).then((function(e){a.loading=!1,app.history.push("badgeItemPage",e.name()),a.setTitle(e),m.redraw()}))},a.setTitle=function(e){app.setTitle(e.name()+" - "+app.translator.trans("v17development-flarum-badges.forum.badge.badges"))},a.view=function(){var e=app.store.getById("badges",m.route.param("id"));return m("div",{className:"IndexPage"},K().prototype.hero(),m("div",{className:"container"},m("div",{className:"sideNavContainer"},m("nav",{className:"IndexPage-nav sideNav"},m("ul",null,W()(K().prototype.sidebarItems().toArray()))),m("div",{className:"IndexPage-results sideNavOffset"},m(g(),{href:app.route("badges"),icon:"fas fa-chevron-left",className:"Button BadgesOverviewButton"},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),this.loading&&m(T(),{size:"large"}),!this.loading&&m("div",{className:"BadgeUserListInfo"},m("i",{className:e.icon()}),m("div",{className:"BadgeUserListInfo-meta"},m("h3",null,e.name()),m("p",null,e.description()))),e&&m("h3",null,app.translator.trans("v17development-flarum-badges.forum.badge.earned_by_count",{count:e.earnedAmount()})),!this.loading&&app.forum.attribute("canViewDetailedBadgeUsers")&&m(ne,{state:app.userBadgeListState,badgeId:e.id()})))))},t}(q());function ie(){(0,r.extend)(K().prototype,"navItems",(function(e){return e.add("badges",m(g(),{icon:"fas fa-id-badge",href:app.route("badges")},app.translator.trans("v17development-flarum-badges.forum.badge.badges")),15),e}))}function de(e,t){for(var a=0;a=e.limit&&-1===e.selectedBadges.indexOf(t.id());return m(E(),{text:a?app.translator.trans("v17development-flarum-badges.forum.badges_in_card.hit_limit",{limit:app.forum.attribute("numberOfBadgesOnUserCard")}):"",position:"bottom"},m("div",{className:"UserCardBadgesModalCategory-badge",onclick:function(){if(!a){var r=e.selectedBadges.indexOf(t.id());r>=0?e.selectedBadges.splice(r,1):e.selectedBadges.push(t.id())}}},m("div",{className:"UserCardBadgesModalCategory-badge-preview"},m(V,{badge:t.badge(),onclick:function(){}})),m("div",{className:"UserCardBadgesModalCategory-badge-switch"},Ce().component({state:e.selectedBadges.indexOf(t.id())>=0,disabled:a}))))}))))})),t},a.save=function(){var e=this;this.loading=!0,this.attrs.user.save({userCardBadges:this.selectedBadges}).then((function(){e.attrs.user.userBadges().map((function(t){t.pushAttributes({inUserCard:e.selectedBadges.indexOf(t.id())>=0})})),e.hide()})).catch((function(){})).then((function(){e.loading=!1,m.redraw()}))},t}(_());const Ue=flarum.core.compat["forum/states/DiscussionListState"];var Ie=e.n(Ue);app.initializers.add("v17development-flarum-badges",(function(e){e.store.models.badges=L,e.store.models.badgeCategories=P,e.store.models.userBadges=A,i().prototype.userBadges=n().hasMany("userBadges"),i().prototype.userPrimaryBadge=n().hasOne("userPrimaryBadge"),e.routes["user.badges"]={path:"/u/:username/badges",component:R},e.routes.badges={path:"/badges",component:ee},e.routes["badges.item"]={path:"/badges/:id",component:oe},ie(),e.userBadgeListState=new ue({}),e.notificationComponents.badgeReceived=ce,(0,r.extend)(ge().prototype,"notificationTypes",(function(t){t.add("badgeReceived",{name:"badgeReceived",icon:"fas fa-user-tag",label:e.translator.trans("v17development-flarum-badges.forum.notification.settings")})})),(0,r.extend)(l().prototype,"navItems",(function(t){t.add("badges",g().component({href:e.route("user.badges",{username:this.user.username()}),name:"badges",icon:"fas fa-user-tag"},[e.translator.trans("v17development-flarum-badges.forum.badge.badges"),m("span",{className:"Button-badge"},this.user.userBadges().length)]),90)})),(0,r.extend)(c(),"moderationControls",(function(t,a){e.forum.attribute("canGiveBadge")&&t.add("test",m(b(),{icon:"fas fa-user-tag",onclick:function(){return e.modal.show(O,{user:a})}},e.translator.trans("v17development-flarum-badges.forum.give_badge")))})),(0,he.extend)(ye().prototype,"infoItems",(function(e){var t,a=this.attrs.user;if(be().forum.attribute("showBadgesOnUserCard")&&a.userBadges){var r=null!=(t=a.userBadges())?t:[];if(!(r.length<1)&&r){var s=be().forum.attribute("numberOfBadgesOnUserCard"),n=r.filter((function(e){return e.inUserCard()}));0===n.length&&(n=r.slice(0,s));var o=n.map((function(e){return m(V,{badge:e.badge(),onclick:function(){return be().modal.show(k,{badge:e.badge(),userBadgeData:e})}})}));if(o.length {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/app'];","import app from 'flarum/common/app';\n\napp.initializers.add('v17development/flarum-user-badges', () => {\n // console.log('[v17development/flarum-user-badges] Hello, forum and admin!')\n});\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['models/User'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/UserPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/UserControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/LinkButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Button'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\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['utils/mixin'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['helpers/fullTime'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Select'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/Stream'];","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport ItemList from 'flarum/utils/ItemList';\nimport Select from 'flarum/components/Select';\nimport Stream from 'flarum/utils/Stream';\nimport BadgeModal from './BadgeModal';\n\nexport default class GiveBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Select image\n this.selectedBadge = this.attrs.badge ? this.attrs.badge.badge() : null;\n\n // Current user\n this.user = this.attrs.badge ? this.attrs.badge.user() : this.attrs.user;\n\n // User has badge\n this.userHasBadge = false;\n\n // Badge model\n this.badge = this.attrs.badge ? this.attrs.badge : app.store.createRecord('userBadges');\n\n // Earning reason\n this.description = Stream(this.badge.description());\n\n // List of available bagges\n this.categories = {};\n\n this.uncategorizedBadges = [];\n\n this.loading = false;\n\n // Load all available badges\n if (!this.attrs.badge) {\n this.loading = true;\n\n app.store\n .find('badges', {\n include: 'category',\n })\n .then((badges) => {\n badges.forEach((badge) => {\n // Categorized\n if (badge.category()) {\n const category = badge.category();\n\n if (!this.categories[category.id()]) {\n this.categories[category.id()] = {\n category,\n badges: [badge],\n };\n } else {\n this.categories[category.id()].badges.push(badge);\n }\n }\n // Uncategorized\n else {\n this.uncategorizedBadges.push(badge);\n }\n });\n\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n }\n }\n\n className() {\n return 'Modal--small BadgeModal';\n }\n\n title() {\n return app.translator.trans(`v17development-flarum-badges.forum.${this.badge.exists ? 'update' : 'give'}_badge`);\n }\n\n content() {\n return (\n
    \n
    \n
    {this.fields().toArray()}
    \n
    \n\n
    \n \n
    \n
    \n );\n }\n\n fields() {\n const items = new ItemList();\n\n // Badge selector\n items.add(\n 'badge',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.badge')}\n

    \n\n
    \n {\n if (e.target.value === 'empty') return;\n this.selectedBadge = app.store.getById('badges', e.target.value);\n\n // Check if the user already has this badge\n this.checkUserHasBadge(this.selectedBadge);\n }}\n className=\"Select-input FormControl\"\n >\n \n\n {/* When no badge is selected, show all available badges */}\n {!this.attrs.badge &&\n Object.values(this.categories).map(({ category, badges }) => (\n \n {badges.map((badge) => (\n \n ))}\n \n ))}\n\n {!this.attrs.badge && this.uncategorizedBadges.length >= 1 && (\n \n {this.uncategorizedBadges.map((badge) => (\n \n ))}\n \n )}\n\n {/* When a badge is already assigned */}\n {!!this.attrs.badge && }\n \n \n
    \n\n {this.userHasBadge &&

    {app.translator.trans('v17development-flarum-badges.forum.user_has_badge')}

    }\n
    ,\n 30\n );\n\n // Badge description\n items.add(\n 'badge_description',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.description')}:\n

    \n

    {this.selectedBadge ? this.selectedBadge.description() : app.translator.trans('v17development-flarum-badges.forum.select_badge')}

    \n
    ,\n 30\n );\n\n // Badge earning reason\n items.add(\n 'description',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earning_reason')}\n

    \n \n
    ,\n 30\n );\n\n return items;\n }\n\n checkUserHasBadge(badge) {\n let foundBadge = false;\n\n this.user.userBadges().map((userBadge) => {\n if (userBadge.badge() == badge) {\n foundBadge = true;\n }\n });\n\n this.userHasBadge = foundBadge;\n\n m.redraw();\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n description: this.description(),\n relationships: this.attrs.badge\n ? {}\n : {\n badge: this.selectedBadge,\n user: this.user,\n },\n })\n .then(\n () => {\n // Re-open badge modal\n if (this.attrs.badge) {\n app.modal.show(BadgeModal, {\n badge: this.attrs.badge.badge(),\n userBadgeData: this.attrs.badge,\n });\n } else {\n this.hide();\n }\n\n m.redraw();\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport fullTime from 'flarum/helpers/fullTime';\nimport ItemList from 'flarum/utils/ItemList';\nimport LinkButton from 'flarum/components/LinkButton';\nimport GiveBadgeModal from './GiveBadgeModal';\n\nexport default class BadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--small';\n }\n\n title() {\n return app.translator.trans('v17development-flarum-badges.forum.badge_information');\n }\n\n content() {\n return (\n
    \n
    {this.data().toArray()}
    \n
    \n \n {app.translator.trans('v17development-flarum-badges.forum.badge.badge_details')}\n \n\n {this.attrs.userBadgeData && app.forum.attribute('canGiveBadge') && (\n {\n if (confirm(app.translator.trans('v17development-flarum-badges.forum.moderation.remove_badge_confirm'))) {\n this.loading = true;\n this.attrs.userBadgeData.delete().then(() => this.hide());\n }\n }}\n loading={this.loading}\n >\n {app.translator.trans('v17development-flarum-badges.forum.moderation.remove_badge')}\n \n )}\n
    \n
    \n );\n }\n\n data() {\n const items = new ItemList();\n\n // Badge name\n items.add(\n 'name',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.name')}:\n

    \n

    {this.attrs.badge.name()}

    \n
    \n );\n\n // Badge description\n items.add(\n 'description',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.description')}:\n

    \n

    {this.attrs.badge.description()}

    \n
    \n );\n\n // Badge earning reason\n if (this.attrs.userBadgeData && (this.attrs.userBadgeData.description() || app.forum.attribute('canGiveBadge'))) {\n items.add(\n 'earning_reason',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earning_reason')}:\n

    \n\n

    \n {this.attrs.userBadgeData.description() ? (\n this.attrs.userBadgeData.description()\n ) : (\n {app.translator.trans('v17development-flarum-badges.forum.badge.no_earning_reason')}\n )}\n

    \n

    \n {app.forum.attribute('canGiveBadge') && (\n {\n e.preventDefault();\n app.modal.show(GiveBadgeModal, {\n badge: this.attrs.userBadgeData,\n });\n }}\n >\n {app.translator.trans('v17development-flarum-badges.forum.badge.update_earning_reason')}\n \n )}\n

    \n
    \n );\n }\n\n // Badge earned on\n if (this.attrs.userBadgeData) {\n items.add(\n 'earned_date',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_on')}:\n

    \n

    {fullTime(this.attrs.userBadgeData.assignedAt())}

    \n
    \n );\n }\n\n // Badge category\n if (this.attrs.userBadgeData) {\n items.add(\n 'category',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.category')}:\n

    \n

    \n {this.attrs.badge.category() && this.attrs.badge.category().name()}\n\n {/* Uncategorized */}\n {!this.attrs.badge.category() && app.translator.trans('v17development-flarum-badges.forum.uncategorized')}\n {/* \n {app.translator.trans(\n \"v17development-flarum-badges.forum.all_badges\"\n )}\n */}\n

    \n
    \n );\n }\n\n // Badge category\n if (this.attrs.badge && this.attrs.badge.earnedAmount()) {\n items.add(\n 'earned_amount',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_count', {\n count: this.attrs.badge.earnedAmount(),\n })}\n

    \n
    \n );\n }\n\n return items;\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport BadgeModal from '../../forum/components/BadgeModal';\n\nexport default class Badge extends mixin(Model, {\n name: Model.attribute('name'),\n icon: Model.attribute('icon'),\n order: Model.attribute('order'),\n image: Model.attribute('image'),\n description: Model.attribute('description'),\n isVisible: Model.attribute('isVisible'),\n createdAt: Model.attribute('createdAt'),\n earnedAmount: Model.attribute('earnedAmount'),\n category: Model.hasOne('category'),\n backgroundColor: Model.attribute('backgroundColor'),\n iconColor: Model.attribute('iconColor'),\n labelColor: Model.attribute('labelColor'),\n}) {\n apiEndpoint() {\n return '/badges' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class BadgeCategory extends mixin(Model, {\n name: Model.attribute('name'),\n order: Model.attribute('order'),\n description: Model.attribute('description'),\n isEnabled: Model.attribute('isEnabled'),\n createdAt: Model.attribute('createdAt'),\n isTable: Model.attribute('isTable'),\n users: Model.hasMany('users'),\n badges: Model.hasMany('badges'),\n}) {\n apiEndpoint() {\n return '/badge_categories' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class UserBadge extends mixin(Model, {\n user: Model.hasOne('user'),\n badge: Model.hasOne('badge'),\n description: Model.attribute('description'),\n isPrimary: Model.attribute('isPrimary'),\n assignedAt: Model.attribute('assignedAt'),\n inUserCard: Model.attribute('inUserCard'),\n}) {\n apiEndpoint() {\n return '/user_badges' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","import Component from 'flarum/common/Component';\nimport Tooltip from 'flarum/common/components/Tooltip';\nimport BadgeModal from '../../forum/components/BadgeModal';\n\nexport default class UserBadge extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.tooltip = this.attrs.tooltip !== false;\n this.forceVisibility = this.attrs.forceVisibility === true;\n }\n\n view() {\n // Hide badge when not enabled\n if (!this.attrs.badge.isVisible() && !this.forceVisibility) {\n return null;\n }\n\n // Just show badge\n if (this.tooltip === false) return this.badge();\n\n return {this.badge()};\n }\n\n badge() {\n const isPartlyHidden = !this.attrs.badge.isVisible() && this.forceVisibility;\n\n // This badge is an image\n if (this.attrs.badge.image()) {\n return (\n {\n if (this.attrs.onclick) {\n this.attrs.onclick();\n }\n }}\n style={{\n opacity: isPartlyHidden ? 0.5 : undefined,\n }}\n />\n );\n }\n\n return (\n {\n if (this.attrs.onclick) {\n this.attrs.onclick();\n }\n }}\n style={{\n backgroundColor: this.attrs.badge.backgroundColor(),\n color: this.attrs.badge.labelColor(),\n borderColor: this.attrs.badge.backgroundColor(),\n opacity: isPartlyHidden ? 0.5 : undefined,\n }}\n >\n {this.attrs.badge.name()}\n \n );\n }\n}\n","export default function categorizeUserBadges(user) {\n const categories = {};\n const uncategorized = [];\n\n user.userBadges().map((userBadge) => {\n if (!userBadge) return null;\n\n // Categorized\n if (userBadge.badge().category()) {\n const category = userBadge.badge().category();\n\n if (!categories[category.id()]) {\n categories[category.id()] = {\n name: category.name(),\n category,\n badges: [userBadge],\n };\n } else {\n categories[category.id()].badges.push(userBadge);\n }\n }\n // Uncategorized\n else {\n uncategorized.push(userBadge);\n }\n });\n\n // Sort categories and map them into an array\n let sortedCategories = Object.keys(categories)\n .sort((a, b) => categories[a].category.order() - categories[b].category.order())\n .map((category) => categories[category]);\n\n sortedCategories.push({\n name: app.translator.trans('v17development-flarum-badges.forum.uncategorized'),\n category: null,\n badges: uncategorized,\n });\n\n return sortedCategories;\n}\n","import Component from 'flarum/common/Component';\nimport UserBadge from '../../common/components/UserBadge';\nimport categorizeUserBadges from '../utils/categorizeUserBadges';\nimport BadgeModal from './BadgeModal';\n\nexport default class UserBadgeList extends Component {\n view() {\n const categories = categorizeUserBadges(this.attrs.user);\n\n return (\n
    \n {categories.length === 0 && (\n
    \n

    {app.translator.trans('v17development-flarum-badges.forum.user_no_badges')}

    \n
    \n )}\n\n {categories.length >= 1 &&\n categories.map(({ name, category, badges }) => {\n if (category && !category.isEnabled()) return null;\n\n return (\n
    \n

    {name}

    \n\n {category && category.description() &&

    {category.description()}

    }\n\n {badges\n .sort((a, b) => a.badge().order() - b.badge().order())\n .map((userBadge) => (\n \n app.modal.show(BadgeModal, {\n badge: userBadge.badge(),\n userBadgeData: userBadge,\n })\n }\n />\n ))}\n
    \n );\n })}\n
    \n );\n }\n}\n","import UserPage from 'flarum/components/UserPage';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport UserBadgeList from './UserBadgeList';\n\nexport default class BadgesProfilePage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.user = null;\n\n this.loading = true;\n\n this.loadUser(m.route.param('username'));\n }\n\n content() {\n if (!this.user || this.loading) {\n return ;\n }\n\n return UserBadgeList.component({\n user: this.user,\n });\n }\n\n show(user) {\n super.show(user);\n this.user = user;\n\n app.store\n .find('users', user.id(), {\n include: 'userBadges,userBadges.badge,userBadges.badge.category',\n })\n .then(() => {\n this.loading = false;\n m.redraw();\n });\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Page'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/listItems'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Link'];","import Component from 'flarum/common/Component';\nimport Link from 'flarum/components/Link';\nimport UserBadge from '../../../common/components/UserBadge';\n\nexport default class TableView extends Component {\n view() {\n if (!this.attrs.badges) {\n return null;\n }\n\n const badges = this.attrs.badges;\n\n return (\n \n \n \n \n \n \n \n \n {badges.map((badge) => {\n return (\n \n \n \n \n );\n })}\n \n
    {app.translator.trans('v17development-flarum-badges.forum.badge.badges')}{app.translator.trans('v17development-flarum-badges.forum.badge.description')}
    \n \n \n \n \n {badge.description()}\n\n
    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_count', {\n count: badge.earnedAmount(),\n })}\n
    \n
    \n );\n }\n}\n","import Component from 'flarum/common/Component';\nimport Link from 'flarum/components/Link';\nimport UserBadge from '../../../common/components/UserBadge';\n\nexport default class BlockListView extends Component {\n view() {\n if (!this.attrs.badges) {\n return null;\n }\n\n const badges = this.attrs.badges;\n\n return (\n
      \n {badges.map((badge) => {\n return (\n
    • \n \n
      \n \n\n

      {badge.description()}

      \n\n

      \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_count', {\n count: badge.earnedAmount(),\n })}\n

      \n
      \n \n
    • \n );\n })}\n
    \n );\n }\n}\n","import Page from 'flarum/components/Page';\nimport IndexPage from 'flarum/components/IndexPage';\nimport listItems from 'flarum/common/helpers/listItems';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport TableView from './BadgeCategoryList/TableView';\nimport BlockListView from './BadgeCategoryList/BlockListView';\n\nexport default class BadgesOverviewPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.bodyClass = 'App--index';\n\n this.loading = true;\n\n app.history.push('badgeOverviewPage');\n\n app.setTitle(app.translator.trans('v17development-flarum-badges.forum.badge.badges'));\n\n // Load badge categories\n app.store.find('badge_categories').then(() => {\n this.loading = false;\n\n m.redraw();\n });\n }\n\n view() {\n const categories = app.store.all('badgeCategories').sort((a, b) => a.order() - b.order());\n\n return (\n
    \n {IndexPage.prototype.hero()}\n\n
    \n
    \n \n
    \n

    {app.translator.trans('v17development-flarum-badges.forum.badge.badges')}

    \n\n {this.loading && }\n\n {!this.loading &&\n categories.map((category) => {\n const badges = category.badges().sort((a, b) => a.order() - b.order());\n\n return (\n
    \n

    {category.name()}

    \n {category.description() &&

    {category.description()}

    }\n\n {category.isTable() && }\n\n {!category.isTable() && }\n
    \n );\n })}\n
    \n
    \n
    \n
    \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['helpers/humanTime'];","import Component from 'flarum/common/Component';\nimport Button from 'flarum/components/Button';\nimport Link from 'flarum/components/Link';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport avatar from 'flarum/helpers/avatar';\nimport humanTime from 'flarum/helpers/humanTime';\n\nexport default class BadgeUserList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Load articles\n this.attrs.state.refreshParams({\n filter: {\n badge: this.attrs.badgeId,\n },\n sort: '-assignedAt',\n });\n }\n\n view() {\n const state = this.attrs.state;\n\n let loading = null;\n\n if (state.isInitialLoading() || state.isLoadingNext()) {\n loading = LoadingIndicator.component({\n size: 'large',\n });\n } else if (state.hasNext()) {\n loading = Button.component(\n {\n className: 'Button',\n icon: 'fas fa-chevron-down',\n onclick: state.loadNext.bind(state),\n },\n app.translator.trans('core.forum.discussion_list.load_more_button')\n );\n }\n\n // No items\n if (state.isInitialLoading() && state.isEmpty()) {\n return ;\n }\n\n // No items\n if (state.isEmpty()) {\n return
    {app.translator.trans('v17development-flarum-badges.forum.no_received')}
    ;\n }\n\n return (\n
    \n
      \n {state.getPages().map((pg) => {\n return pg.items.map((userBadge) => {\n return (\n
    • \n \n {avatar(userBadge.user())}\n\n
      \n

      {userBadge.user().displayName()}

      \n\n

      \n {app.translator.trans('v17development-flarum-badges.forum.badge.received_on', {\n date: humanTime(userBadge.assignedAt()),\n })}\n

      \n
      \n \n
    • \n );\n });\n })}\n
    \n\n {loading &&
    {loading}
    }\n
    \n );\n }\n}\n","import Page from 'flarum/components/Page';\nimport IndexPage from 'flarum/components/IndexPage';\nimport listItems from 'flarum/common/helpers/listItems';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport LinkButton from 'flarum/components/LinkButton';\nimport BadgeUserList from './BadgeUserList';\n\nexport default class BadgeItemPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.bodyClass = 'App--index';\n\n const found = app.store.getById('badges', m.route.param('id'));\n\n this.loading = !found;\n\n if (!found) {\n // Load badge categories\n app.store.find(`badges/${m.route.param('id')}`).then((badge) => {\n this.loading = false;\n\n app.history.push('badgeItemPage', badge.name());\n\n this.setTitle(badge);\n\n m.redraw();\n });\n } else {\n app.history.push('badgeItemPage', found.name());\n\n this.setTitle(found);\n }\n }\n\n setTitle(badge) {\n app.setTitle(`${badge.name()} - ${app.translator.trans('v17development-flarum-badges.forum.badge.badges')}`);\n }\n\n view() {\n const badge = app.store.getById('badges', m.route.param('id'));\n\n return (\n
    \n {IndexPage.prototype.hero()}\n\n
    \n
    \n \n
    \n \n {app.translator.trans('v17development-flarum-badges.forum.badge.badges')}\n \n\n {this.loading && }\n\n {!this.loading && (\n
    \n \n\n
    \n

    {badge.name()}

    \n

    {badge.description()}

    \n
    \n
    \n )}\n\n {badge && (\n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_by_count', {\n count: badge.earnedAmount(),\n })}\n

    \n )}\n\n {!this.loading && app.forum.attribute('canViewDetailedBadgeUsers') && (\n \n )}\n
    \n
    \n
    \n
    \n );\n }\n}\n","import { extend } from 'flarum/extend';\nimport IndexPage from 'flarum/components/IndexPage';\nimport LinkButton from 'flarum/components/LinkButton';\n\nexport default function addSidebarNav() {\n extend(IndexPage.prototype, 'navItems', function (items) {\n items.add(\n 'badges',\n \n {app.translator.trans('v17development-flarum-badges.forum.badge.badges')}\n ,\n 15\n );\n\n return items;\n });\n}\n","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/states/PaginatedListState'];","import PaginatedListState from 'flarum/common/states/PaginatedListState';\n\nexport default class UserBadgeListState extends PaginatedListState {\n constructor(params, page = 1) {\n super(params, page, 18);\n }\n\n get type() {\n return 'user_badges';\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Notification'];","import Notification from 'flarum/forum/components/Notification';\n\nexport default class BadgeReceivedNotification extends Notification {\n icon() {\n return '';\n }\n\n href() {\n return app.route('user.badges', {\n username: app.session.user.username(),\n });\n }\n\n content() {\n return app.translator.trans('v17development-flarum-badges.forum.notification.title');\n }\n\n excerpt() {\n const subject = this.attrs.notification.subject();\n\n return (\n
    \n \n\n {subject.badge().name()}\n
    \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/NotificationGrid'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/UserCard'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Switch'];","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport ItemList from 'flarum/utils/ItemList';\nimport Switch from 'flarum/components/Switch';\nimport UserBadge from '../../common/components/UserBadge';\nimport categorizeUserBadges from '../utils/categorizeUserBadges';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default class SelectUserCardBadgesModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n\n this.limit = app.forum.attribute('numberOfBadgesOnUserCard');\n this.selectedBadges = this.attrs.user\n .userBadges()\n .filter((userBadge) => userBadge.inUserCard())\n .map((userBadge) => userBadge.id());\n }\n\n className() {\n return 'Modal--big UserCardBadgesModal';\n }\n\n title() {\n return app.translator.trans('v17development-flarum-badges.forum.badges_in_card.title');\n }\n\n content() {\n return (\n
    \n
    {this.data().toArray()}
    \n
    \n \n
    \n
    \n );\n }\n\n data() {\n const items = new ItemList();\n\n const categories = categorizeUserBadges(this.attrs.user);\n\n // Badge name\n items.add(\n 'info',\n
    \n

    {app.translator.trans('v17development-flarum-badges.forum.badges_in_card.description')}

    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badges_in_card.select_limit', {\n limit: app.forum.attribute('numberOfBadgesOnUserCard'),\n })}\n

    \n
    \n );\n\n // Loop through all badge categories\n categories.map(({ name, category, badges }) => {\n items.add(\n `badge_category_${category ? category.id() : 'uncategorized'}`,\n
    \n
    {name}
    \n\n {/* Loop through the badges */}\n {badges\n .sort((a, b) => a.badge().order() - b.badge().order())\n .map((userBadge) => {\n const disabled = this.selectedBadges.length >= this.limit && this.selectedBadges.indexOf(userBadge.id()) === -1;\n\n return (\n \n {\n if (disabled) {\n return;\n }\n\n const currentIndex = this.selectedBadges.indexOf(userBadge.id());\n\n // Remove from selected list\n if (currentIndex >= 0) {\n this.selectedBadges.splice(currentIndex, 1);\n } else {\n // Add to list\n this.selectedBadges.push(userBadge.id());\n }\n }}\n >\n
    \n {}} />\n
    \n {/*
    */}\n
    \n {Switch.component({\n state: this.selectedBadges.indexOf(userBadge.id()) >= 0,\n disabled,\n })}\n
    \n
    \n \n );\n })}\n \n );\n });\n\n return items;\n }\n\n save() {\n this.loading = true;\n\n this.attrs.user\n .save({ userCardBadges: this.selectedBadges })\n .then(() => {\n // Update current user badges store\n this.attrs.user.userBadges().map((userBadge) => {\n userBadge.pushAttributes({\n inUserCard: this.selectedBadges.indexOf(userBadge.id()) >= 0,\n });\n });\n\n this.hide();\n })\n .catch(() => {})\n .then(() => {\n this.loading = false;\n m.redraw();\n });\n }\n}\n","import { extend } from 'flarum/extend';\nimport Model from 'flarum/Model';\nimport User from 'flarum/models/User';\nimport UserPage from 'flarum/components/UserPage';\nimport UserControls from 'flarum/utils/UserControls';\nimport LinkButton from 'flarum/components/LinkButton';\nimport Button from 'flarum/components/Button';\nimport Badge from '../common/models/Badge';\nimport BadgeCategory from '../common/models/BadgeCategory';\nimport UserBadge from '../common/models/UserBadge';\nimport BadgesProfilePage from './components/BadgesProfilePage';\nimport BadgesOverviewPage from './components/BadgesOverviewPage';\nimport BadgeItemPage from './components/BadgeItemPage';\nimport GiveBadgeModal from './components/GiveBadgeModal';\nimport addSidebarNav from './addSidebarNav';\nimport UserBadgeListState from './states/UserBadgeListState';\nimport BadgeReceivedNotification from './notification/BadgeReceivedNotification';\nimport NotificationGrid from 'flarum/forum/components/NotificationGrid';\nimport addBadgeListUserCard from './addBadgeListUserCard';\n\napp.initializers.add('v17development-flarum-badges', (app) => {\n app.store.models.badges = Badge;\n app.store.models.badgeCategories = BadgeCategory;\n app.store.models.userBadges = UserBadge;\n\n User.prototype.userBadges = Model.hasMany('userBadges');\n User.prototype.userPrimaryBadge = Model.hasOne('userPrimaryBadge');\n\n // Add user badges to the user profile\n app.routes['user.badges'] = {\n path: '/u/:username/badges',\n component: BadgesProfilePage,\n };\n\n // Badges overview page\n app.routes.badges = {\n path: '/badges',\n component: BadgesOverviewPage,\n };\n\n // Future\n // // Badges overview page\n // app.routes[\"badges.category\"] = {\n // path: \"/badges/category/:id\",\n // component: BadgesOverviewPage,\n // };\n\n // Badge item page\n app.routes['badges.item'] = {\n path: '/badges/:id',\n component: BadgeItemPage,\n };\n\n addSidebarNav();\n\n app.userBadgeListState = new UserBadgeListState({});\n\n // Badge received notification\n app.notificationComponents.badgeReceived = BadgeReceivedNotification;\n\n // Enable badge notifications?\n extend(NotificationGrid.prototype, 'notificationTypes', function (items) {\n items.add('badgeReceived', {\n name: 'badgeReceived',\n icon: 'fas fa-user-tag',\n label: app.translator.trans('v17development-flarum-badges.forum.notification.settings'),\n });\n });\n\n // Add uploads to user page menu items\n extend(UserPage.prototype, 'navItems', function (items) {\n items.add(\n 'badges',\n LinkButton.component(\n {\n href: app.route('user.badges', {\n username: this.user.username(),\n }),\n name: 'badges',\n icon: 'fas fa-user-tag',\n },\n [\n app.translator.trans('v17development-flarum-badges.forum.badge.badges'),\n {this.user.userBadges().length},\n ]\n ),\n 90\n );\n });\n\n extend(UserControls, 'moderationControls', function (items, user) {\n // User can give badges\n if (app.forum.attribute('canGiveBadge')) {\n items.add(\n 'test',\n \n app.modal.show(GiveBadgeModal, {\n user: user,\n })\n }\n >\n {app.translator.trans('v17development-flarum-badges.forum.give_badge')}\n \n );\n }\n });\n addBadgeListUserCard();\n});\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport UserCard from 'flarum/forum/components/UserCard';\nimport Link from 'flarum/common/components/Link';\nimport UserBadge from '../common/components/UserBadge';\nimport BadgeModal from './components/BadgeModal';\nimport SelectUserCardBadgesModal from './components/SelectUserCardBadgesModal';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default function addBadgeListUserCard() {\n extend(UserCard.prototype, 'infoItems', function (items) {\n const user = this.attrs.user;\n const userBadges = user.userBadges();\n\n if (userBadges.length < 1 || !app.forum.attribute('showBadgesOnUserCard')) return;\n\n const limit = app.forum.attribute('numberOfBadgesOnUserCard');\n\n // Check for all badges\n let visibleBadges = userBadges.filter((userBadge) => {\n return userBadge.inUserCard();\n });\n\n // No badges selected (yet). Just select a few\n if (visibleBadges.length === 0) {\n visibleBadges = userBadges.slice(0, limit);\n }\n\n const badges = visibleBadges.map((userBadge) => {\n return (\n \n app.modal.show(BadgeModal, {\n badge: userBadge.badge(),\n userBadgeData: userBadge,\n })\n }\n />\n );\n });\n\n if (badges.length < userBadges.length) {\n const count = userBadges.length - visibleBadges.length;\n badges.push(\n \n {app.translator.trans('v17development-flarum-badges.forum.badge.others_link', { count })}\n \n );\n }\n\n // Manage badges\n if (user === app.session.user) {\n badges.push(\n \n {\n e.preventDefault();\n app.modal.show(SelectUserCardBadgesModal, { user });\n }}\n >\n \n \n \n );\n }\n\n items.add('badges', badges);\n });\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","_setPrototypeOf","p","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","create","constructor","GiveBadgeModal","oninit","vnode","this","selectedBadge","attrs","badge","user","userHasBadge","store","createRecord","description","Stream","categories","uncategorizedBadges","loading","find","include","then","badges","forEach","category","id","push","m","redraw","className","title","translator","trans","exists","content","fields","toArray","type","disabled","items","ItemList","add","onchange","e","target","getById","checkUserHasBadge","values","map","label","name","length","class","placeholder","bidi","foundBadge","userBadges","userBadge","onsubmit","preventDefault","save","relationships","modal","show","BadgeModal","userBadgeData","hide","response","handleErrors","Modal","data","href","route","style","margin","forum","attribute","onclick","confirm","fullTime","assignedAt","earnedAmount","count","Badge","apiEndpoint","mixin","Model","icon","order","image","isVisible","createdAt","backgroundColor","iconColor","labelColor","BadgeCategory","isEnabled","isTable","users","UserBadge","isPrimary","inUserCard","tooltip","forceVisibility","view","text","isPartlyHidden","src","opacity","undefined","color","borderColor","Component","categorizeUserBadges","uncategorized","sortedCategories","keys","sort","b","UserBadgeList","BadgesProfilePage","loadUser","param","size","component","UserPage","TableView","width","scope","BlockListView","BadgesOverviewPage","bodyClass","history","setTitle","all","IndexPage","listItems","Page","BadgeUserList","state","refreshParams","filter","badgeId","isInitialLoading","isLoadingNext","LoadingIndicator","hasNext","Button","loadNext","bind","isEmpty","getPages","pg","username","avatar","displayName","date","humanTime","BadgeItemPage","found","userBadgeListState","addSidebarNav","extend","_defineProperties","props","i","descriptor","configurable","writable","UserBadgeListState","params","page","Constructor","protoProps","PaginatedListState","BadgeReceivedNotification","session","excerpt","subject","notification","Notification","SelectUserCardBadgesModal","limit","selectedBadges","indexOf","position","currentIndex","splice","Switch","userCardBadges","pushAttributes","initializers","models","badgeCategories","User","routes","path","notificationComponents","badgeReceived","NotificationGrid","LinkButton","UserControls","UserCard","visibleBadges","slice"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,IACzBH,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,+BCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,c,MCExDC,GAAAA,a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EAAOI,KACL,EAAC,KAAD,CACE6C,KAAM9E,KAAAA,MAAU,cAAe,CAC7BgK,SAAU/I,EAAK+I,aAEjB5H,UAAU,yBAETpC,KAAAA,WAAAA,MAAqB,uDAAwD,CAAEyF,MAAAA,OAMjFxE,IAASjB,KAAAA,QAAAA,MAAoBA,KAAAA,MAAAA,UAAoB,0BAA6BA,KAAAA,MAAAA,UAAoB,wBACrG6B,EAAOI,KACL,EAAC,IAAD,CAAS+E,KAAMhH,KAAAA,WAAAA,MAAqB,oEAClC,OACE8E,KAAM,IACN1C,UAAU,wBACVgD,QAAS,SAAClC,GACRA,EAAEgB,iBACFlE,KAAAA,MAAAA,KAAe4L,GAA2B,CAAE3K,KAAAA,MAG9C,OAAGmB,UAAW,uCAMtBU,EAAME,IAAI,SAAUnB,SDgCtB4I,EAAAA,EAAAA,QAAO2C,KAAAA,UAA+B,iBAAiB,SAAUnC,GAGxD,MAFuB,iBAAnBA,EAAOtJ,QAChBsJ,EAAOtJ,QAAU,CAACsJ,EAAOtJ,SAEzB,SAAAsJ,EAAOtJ,UAAP,EAAgBM,KAAK,kBAAmB,gC","sources":["webpack://@v17development/flarum-user-badges/webpack/bootstrap","webpack://@v17development/flarum-user-badges/webpack/runtime/compat get default export","webpack://@v17development/flarum-user-badges/webpack/runtime/define property getters","webpack://@v17development/flarum-user-badges/webpack/runtime/hasOwnProperty shorthand","webpack://@v17development/flarum-user-badges/webpack/runtime/make namespace object","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['common/app']\"","webpack://@v17development/flarum-user-badges/./src/common/index.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['extend']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['Model']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['models/User']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/UserPage']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['utils/UserControls']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/LinkButton']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Button']\"","webpack://@v17development/flarum-user-badges/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@v17development/flarum-user-badges/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['utils/mixin']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Modal']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['helpers/fullTime']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['utils/ItemList']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Select']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['utils/Stream']\"","webpack://@v17development/flarum-user-badges/./src/forum/components/GiveBadgeModal.js","webpack://@v17development/flarum-user-badges/./src/forum/components/BadgeModal.js","webpack://@v17development/flarum-user-badges/./src/common/models/Badge.js","webpack://@v17development/flarum-user-badges/./src/common/models/BadgeCategory.js","webpack://@v17development/flarum-user-badges/./src/common/models/UserBadge.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/LoadingIndicator']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['common/Component']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['common/components/Tooltip']\"","webpack://@v17development/flarum-user-badges/./src/common/components/UserBadge.js","webpack://@v17development/flarum-user-badges/./src/forum/utils/categorizeUserBadges.js","webpack://@v17development/flarum-user-badges/./src/forum/components/UserBadgeList.js","webpack://@v17development/flarum-user-badges/./src/forum/components/BadgesProfilePage.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Page']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/IndexPage']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['common/helpers/listItems']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Link']\"","webpack://@v17development/flarum-user-badges/./src/forum/components/BadgeCategoryList/TableView.js","webpack://@v17development/flarum-user-badges/./src/forum/components/BadgeCategoryList/BlockListView.js","webpack://@v17development/flarum-user-badges/./src/forum/components/BadgesOverviewPage.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['helpers/avatar']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['helpers/humanTime']\"","webpack://@v17development/flarum-user-badges/./src/forum/components/BadgeUserList.js","webpack://@v17development/flarum-user-badges/./src/forum/components/BadgeItemPage.js","webpack://@v17development/flarum-user-badges/./src/forum/addSidebarNav.js","webpack://@v17development/flarum-user-badges/./node_modules/@babel/runtime/helpers/esm/createClass.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['common/states/PaginatedListState']\"","webpack://@v17development/flarum-user-badges/./src/forum/states/UserBadgeListState.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['forum/components/Notification']\"","webpack://@v17development/flarum-user-badges/./src/forum/notification/BadgeReceivedNotification.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['forum/components/NotificationGrid']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['forum/app']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['common/extend']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['forum/components/UserCard']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['common/components/Link']\"","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['components/Switch']\"","webpack://@v17development/flarum-user-badges/./src/forum/components/SelectUserCardBadgesModal.js","webpack://@v17development/flarum-user-badges/external root \"flarum.core.compat['forum/states/DiscussionListState']\"","webpack://@v17development/flarum-user-badges/./src/forum/index.js","webpack://@v17development/flarum-user-badges/./src/forum/addBadgeListUserCard.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/app'];","import app from 'flarum/common/app';\n\napp.initializers.add('v17development/flarum-user-badges', () => {\n // console.log('[v17development/flarum-user-badges] Hello, forum and admin!')\n});\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['models/User'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/UserPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/UserControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/LinkButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Button'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\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['utils/mixin'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['helpers/fullTime'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Select'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['utils/Stream'];","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport ItemList from 'flarum/utils/ItemList';\nimport Select from 'flarum/components/Select';\nimport Stream from 'flarum/utils/Stream';\nimport BadgeModal from './BadgeModal';\n\nexport default class GiveBadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Select image\n this.selectedBadge = this.attrs.badge ? this.attrs.badge.badge() : null;\n\n // Current user\n this.user = this.attrs.badge ? this.attrs.badge.user() : this.attrs.user;\n\n // User has badge\n this.userHasBadge = false;\n\n // Badge model\n this.badge = this.attrs.badge ? this.attrs.badge : app.store.createRecord('userBadges');\n\n // Earning reason\n this.description = Stream(this.badge.description());\n\n // List of available bagges\n this.categories = {};\n\n this.uncategorizedBadges = [];\n\n this.loading = false;\n\n // Load all available badges\n if (!this.attrs.badge) {\n this.loading = true;\n\n app.store\n .find('badges', {\n include: 'category',\n })\n .then((badges) => {\n badges.forEach((badge) => {\n // Categorized\n if (badge.category()) {\n const category = badge.category();\n\n if (!this.categories[category.id()]) {\n this.categories[category.id()] = {\n category,\n badges: [badge],\n };\n } else {\n this.categories[category.id()].badges.push(badge);\n }\n }\n // Uncategorized\n else {\n this.uncategorizedBadges.push(badge);\n }\n });\n\n this.loading = false;\n\n // Redraw\n m.redraw();\n });\n }\n }\n\n className() {\n return 'Modal--small BadgeModal';\n }\n\n title() {\n return app.translator.trans(`v17development-flarum-badges.forum.${this.badge.exists ? 'update' : 'give'}_badge`);\n }\n\n content() {\n return (\n
    \n
    \n
    {this.fields().toArray()}
    \n
    \n\n
    \n \n
    \n
    \n );\n }\n\n fields() {\n const items = new ItemList();\n\n // Badge selector\n items.add(\n 'badge',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.badge')}\n

    \n\n
    \n {\n if (e.target.value === 'empty') return;\n this.selectedBadge = app.store.getById('badges', e.target.value);\n\n // Check if the user already has this badge\n this.checkUserHasBadge(this.selectedBadge);\n }}\n className=\"Select-input FormControl\"\n >\n \n\n {/* When no badge is selected, show all available badges */}\n {!this.attrs.badge &&\n Object.values(this.categories).map(({ category, badges }) => (\n \n {badges.map((badge) => (\n \n ))}\n \n ))}\n\n {!this.attrs.badge && this.uncategorizedBadges.length >= 1 && (\n \n {this.uncategorizedBadges.map((badge) => (\n \n ))}\n \n )}\n\n {/* When a badge is already assigned */}\n {!!this.attrs.badge && }\n \n \n
    \n\n {this.userHasBadge &&

    {app.translator.trans('v17development-flarum-badges.forum.user_has_badge')}

    }\n
    ,\n 30\n );\n\n // Badge description\n items.add(\n 'badge_description',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.description')}:\n

    \n

    {this.selectedBadge ? this.selectedBadge.description() : app.translator.trans('v17development-flarum-badges.forum.select_badge')}

    \n
    ,\n 30\n );\n\n // Badge earning reason\n items.add(\n 'description',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earning_reason')}\n

    \n \n
    ,\n 30\n );\n\n return items;\n }\n\n checkUserHasBadge(badge) {\n let foundBadge = false;\n\n this.user.userBadges().map((userBadge) => {\n if (userBadge.badge() == badge) {\n foundBadge = true;\n }\n });\n\n this.userHasBadge = foundBadge;\n\n m.redraw();\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n this.loading = true;\n\n this.badge\n .save({\n description: this.description(),\n relationships: this.attrs.badge\n ? {}\n : {\n badge: this.selectedBadge,\n user: this.user,\n },\n })\n .then(\n () => {\n // Re-open badge modal\n if (this.attrs.badge) {\n app.modal.show(BadgeModal, {\n badge: this.attrs.badge.badge(),\n userBadgeData: this.attrs.badge,\n });\n } else {\n this.hide();\n }\n\n m.redraw();\n },\n (response) => {\n this.loading = false;\n this.handleErrors(response);\n }\n );\n }\n}\n","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport fullTime from 'flarum/helpers/fullTime';\nimport ItemList from 'flarum/utils/ItemList';\nimport LinkButton from 'flarum/components/LinkButton';\nimport GiveBadgeModal from './GiveBadgeModal';\n\nexport default class BadgeModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n }\n\n className() {\n return 'Modal--small';\n }\n\n title() {\n return app.translator.trans('v17development-flarum-badges.forum.badge_information');\n }\n\n content() {\n return (\n
    \n
    {this.data().toArray()}
    \n
    \n \n {app.translator.trans('v17development-flarum-badges.forum.badge.badge_details')}\n \n\n {this.attrs.userBadgeData && app.forum.attribute('canGiveBadge') && (\n {\n if (confirm(app.translator.trans('v17development-flarum-badges.forum.moderation.remove_badge_confirm'))) {\n this.loading = true;\n this.attrs.userBadgeData.delete().then(() => this.hide());\n }\n }}\n loading={this.loading}\n >\n {app.translator.trans('v17development-flarum-badges.forum.moderation.remove_badge')}\n \n )}\n
    \n
    \n );\n }\n\n data() {\n const items = new ItemList();\n\n // Badge name\n items.add(\n 'name',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.name')}:\n

    \n

    {this.attrs.badge.name()}

    \n
    \n );\n\n // Badge description\n items.add(\n 'description',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.description')}:\n

    \n

    {this.attrs.badge.description()}

    \n
    \n );\n\n // Badge earning reason\n if (this.attrs.userBadgeData && (this.attrs.userBadgeData.description() || app.forum.attribute('canGiveBadge'))) {\n items.add(\n 'earning_reason',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earning_reason')}:\n

    \n\n

    \n {this.attrs.userBadgeData.description() ? (\n this.attrs.userBadgeData.description()\n ) : (\n {app.translator.trans('v17development-flarum-badges.forum.badge.no_earning_reason')}\n )}\n

    \n

    \n {app.forum.attribute('canGiveBadge') && (\n {\n e.preventDefault();\n app.modal.show(GiveBadgeModal, {\n badge: this.attrs.userBadgeData,\n });\n }}\n >\n {app.translator.trans('v17development-flarum-badges.forum.badge.update_earning_reason')}\n \n )}\n

    \n
    \n );\n }\n\n // Badge earned on\n if (this.attrs.userBadgeData) {\n items.add(\n 'earned_date',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_on')}:\n

    \n

    {fullTime(this.attrs.userBadgeData.assignedAt())}

    \n
    \n );\n }\n\n // Badge category\n if (this.attrs.userBadgeData) {\n items.add(\n 'category',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.category')}:\n

    \n

    \n {this.attrs.badge.category() && this.attrs.badge.category().name()}\n\n {/* Uncategorized */}\n {!this.attrs.badge.category() && app.translator.trans('v17development-flarum-badges.forum.uncategorized')}\n {/* \n {app.translator.trans(\n \"v17development-flarum-badges.forum.all_badges\"\n )}\n */}\n

    \n
    \n );\n }\n\n // Badge category\n if (this.attrs.badge && this.attrs.badge.earnedAmount()) {\n items.add(\n 'earned_amount',\n
    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_count', {\n count: this.attrs.badge.earnedAmount(),\n })}\n

    \n
    \n );\n }\n\n return items;\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\nimport BadgeModal from '../../forum/components/BadgeModal';\n\nexport default class Badge extends mixin(Model, {\n name: Model.attribute('name'),\n icon: Model.attribute('icon'),\n order: Model.attribute('order'),\n image: Model.attribute('image'),\n description: Model.attribute('description'),\n isVisible: Model.attribute('isVisible'),\n createdAt: Model.attribute('createdAt'),\n earnedAmount: Model.attribute('earnedAmount'),\n category: Model.hasOne('category'),\n backgroundColor: Model.attribute('backgroundColor'),\n iconColor: Model.attribute('iconColor'),\n labelColor: Model.attribute('labelColor'),\n}) {\n apiEndpoint() {\n return '/badges' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class BadgeCategory extends mixin(Model, {\n name: Model.attribute('name'),\n order: Model.attribute('order'),\n description: Model.attribute('description'),\n isEnabled: Model.attribute('isEnabled'),\n createdAt: Model.attribute('createdAt'),\n isTable: Model.attribute('isTable'),\n users: Model.hasMany('users'),\n badges: Model.hasMany('badges'),\n}) {\n apiEndpoint() {\n return '/badge_categories' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class UserBadge extends mixin(Model, {\n user: Model.hasOne('user'),\n badge: Model.hasOne('badge'),\n description: Model.attribute('description'),\n isPrimary: Model.attribute('isPrimary'),\n assignedAt: Model.attribute('assignedAt'),\n inUserCard: Model.attribute('inUserCard'),\n}) {\n apiEndpoint() {\n return '/user_badges' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/LoadingIndicator'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","import Component from 'flarum/common/Component';\nimport Tooltip from 'flarum/common/components/Tooltip';\nimport BadgeModal from '../../forum/components/BadgeModal';\n\nexport default class UserBadge extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.tooltip = this.attrs.tooltip !== false;\n this.forceVisibility = this.attrs.forceVisibility === true;\n }\n\n view() {\n // Hide badge when not enabled\n if (!this.attrs.badge.isVisible() && !this.forceVisibility) {\n return null;\n }\n\n // Just show badge\n if (this.tooltip === false) return this.badge();\n\n return {this.badge()};\n }\n\n badge() {\n const isPartlyHidden = !this.attrs.badge.isVisible() && this.forceVisibility;\n\n // This badge is an image\n if (this.attrs.badge.image()) {\n return (\n {\n if (this.attrs.onclick) {\n this.attrs.onclick();\n }\n }}\n style={{\n opacity: isPartlyHidden ? 0.5 : undefined,\n }}\n />\n );\n }\n\n return (\n {\n if (this.attrs.onclick) {\n this.attrs.onclick();\n }\n }}\n style={{\n backgroundColor: this.attrs.badge.backgroundColor(),\n color: this.attrs.badge.labelColor(),\n borderColor: this.attrs.badge.backgroundColor(),\n opacity: isPartlyHidden ? 0.5 : undefined,\n }}\n >\n {this.attrs.badge.name()}\n \n );\n }\n}\n","export default function categorizeUserBadges(user) {\n const categories = {};\n const uncategorized = [];\n\n user.userBadges().map((userBadge) => {\n if (!userBadge) return null;\n\n // Categorized\n if (userBadge.badge().category()) {\n const category = userBadge.badge().category();\n\n if (!categories[category.id()]) {\n categories[category.id()] = {\n name: category.name(),\n category,\n badges: [userBadge],\n };\n } else {\n categories[category.id()].badges.push(userBadge);\n }\n }\n // Uncategorized\n else {\n uncategorized.push(userBadge);\n }\n });\n\n // Sort categories and map them into an array\n let sortedCategories = Object.keys(categories)\n .sort((a, b) => categories[a].category.order() - categories[b].category.order())\n .map((category) => categories[category]);\n\n // Add uncategorized category to list\n if (uncategorized.length >= 1) {\n sortedCategories.push({\n name: app.translator.trans('v17development-flarum-badges.forum.uncategorized'),\n category: null,\n badges: uncategorized,\n });\n }\n\n return sortedCategories;\n}\n","import Component from 'flarum/common/Component';\nimport UserBadge from '../../common/components/UserBadge';\nimport categorizeUserBadges from '../utils/categorizeUserBadges';\nimport BadgeModal from './BadgeModal';\n\nexport default class UserBadgeList extends Component {\n view() {\n const categories = categorizeUserBadges(this.attrs.user);\n\n return (\n
    \n {categories.length === 0 && (\n
    \n

    {app.translator.trans('v17development-flarum-badges.forum.user_no_badges')}

    \n
    \n )}\n\n {categories.length >= 1 &&\n categories.map(({ name, category, badges }) => {\n if (category && !category.isEnabled()) return null;\n\n return (\n
    \n

    {name}

    \n\n {category && category.description() &&

    {category.description()}

    }\n\n {badges\n .sort((a, b) => a.badge().order() - b.badge().order())\n .map((userBadge) => (\n \n app.modal.show(BadgeModal, {\n badge: userBadge.badge(),\n userBadgeData: userBadge,\n })\n }\n />\n ))}\n
    \n );\n })}\n
    \n );\n }\n}\n","import UserPage from 'flarum/components/UserPage';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport UserBadgeList from './UserBadgeList';\n\nexport default class BadgesProfilePage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.user = null;\n\n this.loading = true;\n\n this.loadUser(m.route.param('username'));\n }\n\n content() {\n if (!this.user || this.loading) {\n return ;\n }\n\n return UserBadgeList.component({\n user: this.user,\n });\n }\n\n show(user) {\n super.show(user);\n this.user = user;\n\n app.store\n .find('users', user.id(), {\n include: 'userBadges,userBadges.badge,userBadges.badge.category',\n })\n .then(() => {\n this.loading = false;\n m.redraw();\n });\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Page'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/listItems'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Link'];","import Component from 'flarum/common/Component';\nimport Link from 'flarum/components/Link';\nimport UserBadge from '../../../common/components/UserBadge';\n\nexport default class TableView extends Component {\n view() {\n if (!this.attrs.badges) {\n return null;\n }\n\n const badges = this.attrs.badges;\n\n return (\n \n \n \n \n \n \n \n \n {badges.map((badge) => {\n return (\n \n \n \n \n );\n })}\n \n
    {app.translator.trans('v17development-flarum-badges.forum.badge.badges')}{app.translator.trans('v17development-flarum-badges.forum.badge.description')}
    \n \n \n \n \n {badge.description()}\n\n
    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_count', {\n count: badge.earnedAmount(),\n })}\n
    \n
    \n );\n }\n}\n","import Component from 'flarum/common/Component';\nimport Link from 'flarum/components/Link';\nimport UserBadge from '../../../common/components/UserBadge';\n\nexport default class BlockListView extends Component {\n view() {\n if (!this.attrs.badges) {\n return null;\n }\n\n const badges = this.attrs.badges;\n\n return (\n
      \n {badges.map((badge) => {\n return (\n
    • \n \n
      \n \n\n

      {badge.description()}

      \n\n

      \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_count', {\n count: badge.earnedAmount(),\n })}\n

      \n
      \n \n
    • \n );\n })}\n
    \n );\n }\n}\n","import Page from 'flarum/components/Page';\nimport IndexPage from 'flarum/components/IndexPage';\nimport listItems from 'flarum/common/helpers/listItems';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport TableView from './BadgeCategoryList/TableView';\nimport BlockListView from './BadgeCategoryList/BlockListView';\n\nexport default class BadgesOverviewPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.bodyClass = 'App--index';\n\n this.loading = true;\n\n app.history.push('badgeOverviewPage');\n\n app.setTitle(app.translator.trans('v17development-flarum-badges.forum.badge.badges'));\n\n // Load badge categories\n app.store.find('badge_categories').then(() => {\n this.loading = false;\n\n m.redraw();\n });\n }\n\n view() {\n const categories = app.store.all('badgeCategories').sort((a, b) => a.order() - b.order());\n\n return (\n
    \n {IndexPage.prototype.hero()}\n\n
    \n
    \n \n
    \n

    {app.translator.trans('v17development-flarum-badges.forum.badge.badges')}

    \n\n {this.loading && }\n\n {!this.loading &&\n categories.map((category) => {\n const badges = category.badges().sort((a, b) => a.order() - b.order());\n\n return (\n
    \n

    {category.name()}

    \n {category.description() &&

    {category.description()}

    }\n\n {category.isTable() && }\n\n {!category.isTable() && }\n
    \n );\n })}\n
    \n
    \n
    \n
    \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['helpers/humanTime'];","import Component from 'flarum/common/Component';\nimport Button from 'flarum/components/Button';\nimport Link from 'flarum/components/Link';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport avatar from 'flarum/helpers/avatar';\nimport humanTime from 'flarum/helpers/humanTime';\n\nexport default class BadgeUserList extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n // Load articles\n this.attrs.state.refreshParams({\n filter: {\n badge: this.attrs.badgeId,\n },\n sort: '-assignedAt',\n });\n }\n\n view() {\n const state = this.attrs.state;\n\n let loading = null;\n\n if (state.isInitialLoading() || state.isLoadingNext()) {\n loading = LoadingIndicator.component({\n size: 'large',\n });\n } else if (state.hasNext()) {\n loading = Button.component(\n {\n className: 'Button',\n icon: 'fas fa-chevron-down',\n onclick: state.loadNext.bind(state),\n },\n app.translator.trans('core.forum.discussion_list.load_more_button')\n );\n }\n\n // No items\n if (state.isInitialLoading() && state.isEmpty()) {\n return ;\n }\n\n // No items\n if (state.isEmpty()) {\n return
    {app.translator.trans('v17development-flarum-badges.forum.no_received')}
    ;\n }\n\n return (\n
    \n
      \n {state.getPages().map((pg) => {\n return pg.items.map((userBadge) => {\n return (\n
    • \n \n {avatar(userBadge.user())}\n\n
      \n

      {userBadge.user().displayName()}

      \n\n

      \n {app.translator.trans('v17development-flarum-badges.forum.badge.received_on', {\n date: humanTime(userBadge.assignedAt()),\n })}\n

      \n
      \n \n
    • \n );\n });\n })}\n
    \n\n {loading &&
    {loading}
    }\n
    \n );\n }\n}\n","import Page from 'flarum/components/Page';\nimport IndexPage from 'flarum/components/IndexPage';\nimport listItems from 'flarum/common/helpers/listItems';\nimport LoadingIndicator from 'flarum/components/LoadingIndicator';\nimport LinkButton from 'flarum/components/LinkButton';\nimport BadgeUserList from './BadgeUserList';\n\nexport default class BadgeItemPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.bodyClass = 'App--index';\n\n const found = app.store.getById('badges', m.route.param('id'));\n\n this.loading = !found;\n\n if (!found) {\n // Load badge categories\n app.store.find(`badges/${m.route.param('id')}`).then((badge) => {\n this.loading = false;\n\n app.history.push('badgeItemPage', badge.name());\n\n this.setTitle(badge);\n\n m.redraw();\n });\n } else {\n app.history.push('badgeItemPage', found.name());\n\n this.setTitle(found);\n }\n }\n\n setTitle(badge) {\n app.setTitle(`${badge.name()} - ${app.translator.trans('v17development-flarum-badges.forum.badge.badges')}`);\n }\n\n view() {\n const badge = app.store.getById('badges', m.route.param('id'));\n\n return (\n
    \n {IndexPage.prototype.hero()}\n\n
    \n
    \n \n
    \n \n {app.translator.trans('v17development-flarum-badges.forum.badge.badges')}\n \n\n {this.loading && }\n\n {!this.loading && (\n
    \n \n\n
    \n

    {badge.name()}

    \n

    {badge.description()}

    \n
    \n
    \n )}\n\n {badge && (\n

    \n {app.translator.trans('v17development-flarum-badges.forum.badge.earned_by_count', {\n count: badge.earnedAmount(),\n })}\n

    \n )}\n\n {!this.loading && app.forum.attribute('canViewDetailedBadgeUsers') && (\n \n )}\n
    \n
    \n
    \n
    \n );\n }\n}\n","import { extend } from 'flarum/extend';\nimport IndexPage from 'flarum/components/IndexPage';\nimport LinkButton from 'flarum/components/LinkButton';\n\nexport default function addSidebarNav() {\n extend(IndexPage.prototype, 'navItems', function (items) {\n items.add(\n 'badges',\n \n {app.translator.trans('v17development-flarum-badges.forum.badge.badges')}\n ,\n 15\n );\n\n return items;\n });\n}\n","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/states/PaginatedListState'];","import PaginatedListState from 'flarum/common/states/PaginatedListState';\n\nexport default class UserBadgeListState extends PaginatedListState {\n constructor(params, page = 1) {\n super(params, page, 18);\n }\n\n get type() {\n return 'user_badges';\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Notification'];","import Notification from 'flarum/forum/components/Notification';\n\nexport default class BadgeReceivedNotification extends Notification {\n icon() {\n return '';\n }\n\n href() {\n return app.route('user.badges', {\n username: app.session.user.username(),\n });\n }\n\n content() {\n return app.translator.trans('v17development-flarum-badges.forum.notification.title');\n }\n\n excerpt() {\n const subject = this.attrs.notification.subject();\n\n return (\n
    \n \n\n {subject.badge().name()}\n
    \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/NotificationGrid'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/UserCard'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['components/Switch'];","import Modal from 'flarum/components/Modal';\nimport Button from 'flarum/components/Button';\nimport ItemList from 'flarum/utils/ItemList';\nimport Switch from 'flarum/components/Switch';\nimport UserBadge from '../../common/components/UserBadge';\nimport categorizeUserBadges from '../utils/categorizeUserBadges';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default class SelectUserCardBadgesModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = false;\n\n this.limit = app.forum.attribute('numberOfBadgesOnUserCard');\n this.selectedBadges = this.attrs.user\n .userBadges()\n .filter((userBadge) => userBadge.inUserCard())\n .map((userBadge) => userBadge.id());\n }\n\n className() {\n return 'Modal--big UserCardBadgesModal';\n }\n\n title() {\n return app.translator.trans('v17development-flarum-badges.forum.badges_in_card.title');\n }\n\n content() {\n return (\n
    \n
    {this.data().toArray()}
    \n
    \n \n
    \n
    \n );\n }\n\n data() {\n const items = new ItemList();\n\n const categories = categorizeUserBadges(this.attrs.user);\n\n // Badge name\n items.add(\n 'info',\n
    \n

    {app.translator.trans('v17development-flarum-badges.forum.badges_in_card.description')}

    \n

    \n {app.translator.trans('v17development-flarum-badges.forum.badges_in_card.select_limit', {\n limit: app.forum.attribute('numberOfBadgesOnUserCard'),\n })}\n

    \n
    \n );\n\n // Loop through all badge categories\n categories.map(({ name, category, badges }) => {\n items.add(\n `badge_category_${category ? category.id() : 'uncategorized'}`,\n
    \n
    {name}
    \n\n {/* Loop through the badges */}\n {badges\n .sort((a, b) => a.badge().order() - b.badge().order())\n .map((userBadge) => {\n const disabled = this.selectedBadges.length >= this.limit && this.selectedBadges.indexOf(userBadge.id()) === -1;\n\n return (\n \n {\n if (disabled) {\n return;\n }\n\n const currentIndex = this.selectedBadges.indexOf(userBadge.id());\n\n // Remove from selected list\n if (currentIndex >= 0) {\n this.selectedBadges.splice(currentIndex, 1);\n } else {\n // Add to list\n this.selectedBadges.push(userBadge.id());\n }\n }}\n >\n
    \n {}} />\n
    \n {/*
    */}\n
    \n {Switch.component({\n state: this.selectedBadges.indexOf(userBadge.id()) >= 0,\n disabled,\n })}\n
    \n
    \n \n );\n })}\n \n );\n });\n\n return items;\n }\n\n save() {\n this.loading = true;\n\n this.attrs.user\n .save({ userCardBadges: this.selectedBadges })\n .then(() => {\n // Update current user badges store\n this.attrs.user.userBadges().map((userBadge) => {\n userBadge.pushAttributes({\n inUserCard: this.selectedBadges.indexOf(userBadge.id()) >= 0,\n });\n });\n\n this.hide();\n })\n .catch(() => {})\n .then(() => {\n this.loading = false;\n m.redraw();\n });\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/states/DiscussionListState'];","import { extend } from 'flarum/extend';\nimport Model from 'flarum/Model';\nimport User from 'flarum/models/User';\nimport UserPage from 'flarum/components/UserPage';\nimport UserControls from 'flarum/utils/UserControls';\nimport LinkButton from 'flarum/components/LinkButton';\nimport Button from 'flarum/components/Button';\nimport Badge from '../common/models/Badge';\nimport BadgeCategory from '../common/models/BadgeCategory';\nimport UserBadge from '../common/models/UserBadge';\nimport BadgesProfilePage from './components/BadgesProfilePage';\nimport BadgesOverviewPage from './components/BadgesOverviewPage';\nimport BadgeItemPage from './components/BadgeItemPage';\nimport GiveBadgeModal from './components/GiveBadgeModal';\nimport addSidebarNav from './addSidebarNav';\nimport UserBadgeListState from './states/UserBadgeListState';\nimport BadgeReceivedNotification from './notification/BadgeReceivedNotification';\nimport NotificationGrid from 'flarum/forum/components/NotificationGrid';\nimport addBadgeListUserCard from './addBadgeListUserCard';\nimport DiscussionListState from 'flarum/forum/states/DiscussionListState';\n\napp.initializers.add('v17development-flarum-badges', (app) => {\n app.store.models.badges = Badge;\n app.store.models.badgeCategories = BadgeCategory;\n app.store.models.userBadges = UserBadge;\n\n User.prototype.userBadges = Model.hasMany('userBadges');\n User.prototype.userPrimaryBadge = Model.hasOne('userPrimaryBadge');\n\n // Add user badges to the user profile\n app.routes['user.badges'] = {\n path: '/u/:username/badges',\n component: BadgesProfilePage,\n };\n\n // Badges overview page\n app.routes.badges = {\n path: '/badges',\n component: BadgesOverviewPage,\n };\n\n // Future\n // // Badges overview page\n // app.routes[\"badges.category\"] = {\n // path: \"/badges/category/:id\",\n // component: BadgesOverviewPage,\n // };\n\n // Badge item page\n app.routes['badges.item'] = {\n path: '/badges/:id',\n component: BadgeItemPage,\n };\n\n addSidebarNav();\n\n app.userBadgeListState = new UserBadgeListState({});\n\n // Badge received notification\n app.notificationComponents.badgeReceived = BadgeReceivedNotification;\n\n // Enable badge notifications?\n extend(NotificationGrid.prototype, 'notificationTypes', function (items) {\n items.add('badgeReceived', {\n name: 'badgeReceived',\n icon: 'fas fa-user-tag',\n label: app.translator.trans('v17development-flarum-badges.forum.notification.settings'),\n });\n });\n\n // Add uploads to user page menu items\n extend(UserPage.prototype, 'navItems', function (items) {\n items.add(\n 'badges',\n LinkButton.component(\n {\n href: app.route('user.badges', {\n username: this.user.username(),\n }),\n name: 'badges',\n icon: 'fas fa-user-tag',\n },\n [\n app.translator.trans('v17development-flarum-badges.forum.badge.badges'),\n {this.user.userBadges().length},\n ]\n ),\n 90\n );\n });\n\n extend(UserControls, 'moderationControls', function (items, user) {\n // User can give badges\n if (app.forum.attribute('canGiveBadge')) {\n items.add(\n 'test',\n \n app.modal.show(GiveBadgeModal, {\n user: user,\n })\n }\n >\n {app.translator.trans('v17development-flarum-badges.forum.give_badge')}\n \n );\n }\n });\n\n addBadgeListUserCard();\n\n extend(DiscussionListState.prototype, 'requestParams', function (params) {\n if (typeof params.include === 'string') {\n params.include = [params.include];\n } else {\n params.include?.push('user.userBadges', 'user.userBadges.badge');\n }\n });\n});\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport UserCard from 'flarum/forum/components/UserCard';\nimport Link from 'flarum/common/components/Link';\nimport UserBadge from '../common/components/UserBadge';\nimport BadgeModal from './components/BadgeModal';\nimport SelectUserCardBadgesModal from './components/SelectUserCardBadgesModal';\nimport Tooltip from 'flarum/common/components/Tooltip';\n\nexport default function addBadgeListUserCard() {\n extend(UserCard.prototype, 'infoItems', function (items) {\n // Get user\n const user = this.attrs.user;\n\n // Don't show badges\n if (!app.forum.attribute('showBadgesOnUserCard') || !user.userBadges) return;\n\n const userBadges = user.userBadges() ?? [];\n\n // No badges to show\n if (userBadges.length < 1 || !userBadges) return;\n\n const limit = app.forum.attribute('numberOfBadgesOnUserCard');\n\n // Check for all badges\n let visibleBadges = userBadges.filter((userBadge) => {\n return userBadge.inUserCard();\n });\n\n // No badges selected (yet). Just select a few\n if (visibleBadges.length === 0) {\n visibleBadges = userBadges.slice(0, limit);\n }\n\n const badges = visibleBadges.map((userBadge) => {\n return (\n \n app.modal.show(BadgeModal, {\n badge: userBadge.badge(),\n userBadgeData: userBadge,\n })\n }\n />\n );\n });\n\n if (badges.length < userBadges.length) {\n const count = userBadges.length - visibleBadges.length;\n badges.push(\n \n {app.translator.trans('v17development-flarum-badges.forum.badge.others_link', { count })}\n \n );\n }\n\n // Manage badges\n if ((user === app.session.user && app.forum.attribute('editOwnUserCardBadges')) || app.forum.attribute('editUserCardBadges')) {\n badges.push(\n \n {\n e.preventDefault();\n app.modal.show(SelectUserCardBadgesModal, { user });\n }}\n >\n \n \n \n );\n }\n\n items.add('badges', badges);\n });\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","_setPrototypeOf","p","setPrototypeOf","__proto__","_inheritsLoose","subClass","superClass","create","constructor","GiveBadgeModal","oninit","vnode","this","selectedBadge","attrs","badge","user","userHasBadge","store","createRecord","description","Stream","categories","uncategorizedBadges","loading","find","include","then","badges","forEach","category","id","push","m","redraw","className","title","translator","trans","exists","content","fields","toArray","type","disabled","items","ItemList","add","onchange","e","target","getById","checkUserHasBadge","values","map","label","name","length","class","placeholder","bidi","foundBadge","userBadges","userBadge","onsubmit","preventDefault","save","relationships","modal","show","BadgeModal","userBadgeData","hide","response","handleErrors","Modal","data","href","route","style","margin","forum","attribute","onclick","confirm","fullTime","assignedAt","earnedAmount","count","Badge","apiEndpoint","mixin","Model","icon","order","image","isVisible","createdAt","backgroundColor","iconColor","labelColor","BadgeCategory","isEnabled","isTable","users","UserBadge","isPrimary","inUserCard","tooltip","forceVisibility","view","text","isPartlyHidden","src","opacity","undefined","color","borderColor","Component","categorizeUserBadges","uncategorized","sortedCategories","keys","sort","b","UserBadgeList","BadgesProfilePage","loadUser","param","size","component","UserPage","TableView","width","scope","BlockListView","BadgesOverviewPage","bodyClass","history","setTitle","all","IndexPage","listItems","Page","BadgeUserList","state","refreshParams","filter","badgeId","isInitialLoading","isLoadingNext","LoadingIndicator","hasNext","Button","loadNext","bind","isEmpty","getPages","pg","username","avatar","displayName","date","humanTime","BadgeItemPage","found","userBadgeListState","addSidebarNav","extend","_defineProperties","props","i","descriptor","configurable","writable","UserBadgeListState","params","page","Constructor","protoProps","PaginatedListState","BadgeReceivedNotification","session","excerpt","subject","notification","Notification","SelectUserCardBadgesModal","limit","selectedBadges","indexOf","position","currentIndex","splice","Switch","userCardBadges","pushAttributes","initializers","models","badgeCategories","User","routes","path","notificationComponents","badgeReceived","NotificationGrid","LinkButton","UserControls","UserCard","visibleBadges","slice","DiscussionListState"],"sourceRoot":""} \ No newline at end of file