!function(t){function i(n){if(e[n])return e[n].exports;var s=e[n]={exports:{},id:n,loaded:!1};return t[n].call(s.exports,s,s.exports,i),s.loaded=!0,s.exports}var e={};return i.m=t,i.c=e,i.p="",i(0)}([function(t,i){t.exports={el:"#widgets",mixins:[window.Widgets],data:function(){return _.merge({position:this.$session.get("widget.position"),selected:[],config:{positions:[],filter:this.$session.get("widget.filter",{})},unassignedWidgets:[],type:{}},window.$data)},ready:function(){this.load()},computed:{positions:function(){return this.config.positions.concat(this.unassigned)},unassigned:function(){return{name:"_unassigned",label:this.$trans("Unassigned"),assigned:_.pluck(this.unassignedWidgets,"id"),widgets:this.unassignedWidgets}},empty:function(){return!this.position&&!this.get("assigned").length},nodes:function(){var t=[],i=_(this.config.nodes).groupBy("menu").value();return _.forEach(this.config.menus,function(e,n){var s=i[n];s&&t.push({label:e.label,options:_.map(s,function(t){return{text:t.title,value:t.id}})})},this),t}},methods:{get:function(t){var i={selected:function(t){return-1!==this.selected.indexOf(t.id)},assigned:function(t){return this.positions.some(function(i){return-1!==i.assigned.indexOf(t.id)})},unassigned:function(t){return!this.positions.some(function(i){return-1!==i.assigned.indexOf(t.id)})}};return i[t]?this.widgets.filter(i[t],this):this.widgets},load:function(){return this.resource.query().then(function(t){this.$set("config.positions",t.data.positions),this.$set("unassignedWidgets",t.data.unassigned)})},active:function(t){return this.position===t||t&&this.position&&this.position.name==t.name},select:function(t){t&&this.$set("selected",[]),this.$set("position",t),t?this.$session.set("widget.position",t):this.$session.remove("widget.position")},assign:function(t,i){return this.resource.save({id:"assign"},{position:t,ids:i}).then(function(){this.load(),this.$set("selected",[])})},move:function(t,i){t=_.find(this.positions,"name",t),this.assign(t.name,t.assigned.concat(i)).then(function(){this.$notify(this.$transChoice("{1} %count% Widget moved|]1,Inf[ %count% Widgets moved",i.length,{count:i.length}))})},copy:function(){this.resource.save({id:"copy"},{ids:this.selected}).then(function(t){this.load().then(),this.$set("selected",[]),this.$notify("Widget(s) copied.")})},remove:function(){this.resource["delete"]({id:"bulk"},{ids:this.selected}).then(function(){this.load(),this.$notify("Widget(s) removed."),this.$set("selected",[])})},status:function(t){var i=this.get("selected");i.forEach(function(i){i.status=t}),this.resource.save({id:"bulk"},{widgets:i}).then(function(){this.load(),this.$set("selected",[]),this.$notify("Widget(s) saved.")})},toggleStatus:function(t){t.status=t.status?0:1,this.resource.save({id:t.id},{widget:t}).then(function(){this.load(),this.$notify("Widget saved.")})},infilter:function(t){return this.config.filter.search?-1!=t.title.toLowerCase().indexOf(this.config.filter.search.toLowerCase()):this.config.filter.node&&t.nodes.length?t.nodes.some(function(t){return t===this.config.filter.node},this):!0},emptyafterfilter:function(t){return t=t||this.config.positions.reduce(function(t,i){return t.concat(i.widgets)},[]),!t.some(function(t){return this.infilter(t)},this)},getPageFilter:function(t){return t.nodes.length?t.nodes.length>1?this.$trans("Selected"):(_.find(this.config.nodes,"id",t.nodes[0])||{}).title:this.$trans("All")},isSelected:function(t){return-1!==this.selected.indexOf(t)}},watch:{"config.filter":{handler:function(t){this.$session.set("widget.filter",t)},deep:!0}},filters:{show:function(t){return this.position?this.active(t):"_unassigned"!=t.name?t.widgets.length:0},type:function(t){var i=_.find(this.types,{name:t.type});if(i)return i.label||i.name},assigned:function(t){return t.map(function(t){return _.find(this.widgets,"id",t)},this).filter(function(t){return void 0!==t})}},directives:{sortable:{params:["group"],bind:function(){var t=this;"_unassigned"!=this.el.getAttribute("data-position")&&Vue.nextTick(function(){UIkit.sortable(this.el,{group:"position",removeWhitespace:!1}).element.off("change.uk.sortable").on("change.uk.sortable",function(i,e,n,s){"added"!=s&&"moved"!=s||t.vm.assign(t._frag.scope.$get("pos.name"),_.pluck(e.serialize(),"id"))})}.bind(this))}}}},Vue.ready(t.exports)}]);