!function(){return function e(t,n,o){function i(a,c){if(!n[a]){if(!t[a]){var d="function"==typeof require&&require;if(!c&&d)return d(a,!0);if(r)return r(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){return i(t[a][1][e]||e)},l,l.exports,e,t,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a-1||t.setAttribute("data-"+o,n[o])}function s(t){var n=t;if(e.options.itemHandleOptions.enabled)if(void 0===(e.options.itemHandleOptions.customHandler||void 0)){var o=e.options.itemHandleOptions.customCssHandler,i=e.options.itemHandleOptions.customCssIconHandler;void 0===(o||void 0)&&(o="drag_handler"),void 0===(i||void 0)&&(i=o+"_icon"),n="
"+n+"
"}else n=e.options.itemHandleOptions.customHandler.replace("%s",n);return n}arguments[0]&&"object"==typeof arguments[0]&&(this.options=function(e,t){var n;for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(i,arguments[0])),this.__getCanMove=function(t){return e.options.itemHandleOptions.enabled?e.options.itemHandleOptions.handleClass?t.classList.contains(e.options.itemHandleOptions.handleClass):t.classList.contains("item_handle"):!!e.options.dragItems},this.init=function(){!function(){e.element=document.querySelector(e.options.element);var t=document.createElement("div");t.classList.add("kanban-container"),e.container=t,document.querySelector(e.options.element).dataset.hasOwnProperty("board")?(url=document.querySelector(e.options.element).dataset.board,window.fetch(url,{method:"GET",headers:{"Content-Type":"application/json"}}).then(t=>{t.json().then(function(t){e.options.boards=t,e.addBoards(e.options.boards,!0)})}).catch(e=>{console.log("Error: ",e)})):e.addBoards(e.options.boards,!0);e.element.appendChild(e.container)}(),window.innerWidth>e.options.responsive&&(e.drakeBoard=e.dragula([e.container],{moves:function(t,n,o,i){return!!e.options.dragBoards&&(o.classList.contains("kanban-board-header")||o.classList.contains("kanban-title-board"))},accepts:function(e,t,n,o){return t.classList.contains("kanban-container")},revertOnSpill:!0,direction:"horizontal"}).on("drag",function(t,n){t.classList.add("is-moving"),e.options.dragBoard(t,n),"function"==typeof t.dragfn&&t.dragfn(t,n)}).on("dragend",function(t){!function(){for(var t=1,n=0;n-1)e.drake.cancel(!0);else{t.classList.add("is-moving"),e.options.dragEl(t,n);var i=c(n.parentNode.dataset.id);void 0!==i.dragTo&&e.options.boards.map(function(t){-1===i.dragTo.indexOf(t.id)&&t.id!==n.parentNode.dataset.id&&e.findBoard(t.id).classList.add("disabled-board")}),null!==t&&"function"==typeof t.dragfn&&t.dragfn(t,n)}}).on("dragend",function(t){e.options.dragendEl(t),null!==t&&"function"==typeof t.dragendfn&&t.dragendfn(t)}).on("drop",function(t,n,o,i){e.enableAllBoards();var r=c(o.parentNode.dataset.id);(void 0!==r.dragTo&&-1===r.dragTo.indexOf(n.parentNode.dataset.id)&&n.parentNode.dataset.id!==o.parentNode.dataset.id&&e.drake.cancel(!0),null!==t)&&(!1===e.options.dropEl(t,n,o,i)&&e.drake.cancel(!0),t.classList.remove("is-moving"),"function"==typeof t.dropfn&&t.dropfn(t,n,o,i))}))},this.enableAllBoards=function(){var e=document.querySelectorAll(".kanban-board");if(e.length>0&&void 0!==e)for(var t=0;te.options.responsive)var o=(100-2*t.length)/t.length;else o=100-2*t.length;else o=e.options.widthBoard;var i=e.options.itemAddOptions.enabled,c=e.options.itemAddOptions.content,l=e.options.itemAddOptions.class,u=e.options.itemAddOptions.footer;for(var f in t){var p=t[f];n||e.options.boards.push(p),e.options.responsivePercentage||(""===e.container.style.width?e.container.style.width=parseInt(o)+2*parseInt(e.options.gutter)+"px":e.container.style.width=parseInt(e.container.style.width)+parseInt(o)+2*parseInt(e.options.gutter)+"px");var m=document.createElement("div");m.dataset.id=p.id,m.dataset.order=e.container.childNodes.length+1,m.classList.add("kanban-board"),e.options.responsivePercentage?m.style.width=o+"%":m.style.width=o,m.style.marginLeft=e.options.gutter,m.style.marginRight=e.options.gutter;var v=document.createElement("header");if(""!==p.class&&void 0!==p.class)var h=p.class.split(",");else h=[];v.classList.add("kanban-board-header"),h.map(function(e){e=e.replace(/^[ ]+/g,""),v.classList.add(e)}),v.innerHTML='
'+p.title+"
";var g=document.createElement("main");if(g.classList.add("kanban-drag"),""!==p.bodyClass&&void 0!==p.bodyClass)var b=p.bodyClass.split(",");else b=[];for(var y in b.map(function(e){g.classList.add(e)}),e.boardContainer.push(g),p.item){var w=p.item[y],E=document.createElement("div");E.classList.add("kanban-item"),w.id&&(E.dataset.eid=w.id),w.class&&Array.isArray(w.class)&&w.class.forEach(function(e){E.classList.add(e)}),E.innerHTML=s(w.title),E.clickfn=w.click,E.dragfn=w.drag,E.dragendfn=w.dragend,E.dropfn=w.drop,d(E,w),r(E),e.options.itemHandleOptions.enabled&&(E.style.cursor="default"),g.appendChild(E)}var T=document.createElement("footer");if(i){var C=document.createElement("BUTTON"),O=document.createTextNode(c||"+");C.setAttribute("class",l||"kanban-title-button btn btn-default btn-xs"),C.appendChild(O),u?T.appendChild(C):v.appendChild(C),a(C,p.id)}m.appendChild(v),m.appendChild(g),m.appendChild(T),e.container.appendChild(m)}return e},this.findBoard=function(t){return e.element.querySelector('[data-id="'+t+'"]')},this.getParentBoardID=function(t){return"string"==typeof t&&(t=e.element.querySelector('[data-eid="'+t+'"]')),null===t?null:t.parentNode.parentNode.dataset.id},this.moveElement=function(e,t,n){if(e!==this.getParentBoardID(t))return this.removeElement(t),this.addElement(e,n)},this.replaceElement=function(t,n){var o=t;return"string"==typeof o&&(o=e.element.querySelector('[data-eid="'+t+'"]')),o.innerHTML=n.title,o.clickfn=n.click,o.dragfn=n.drag,o.dragendfn=n.dragend,o.dropfn=n.drop,d(o,n),e},this.findElement=function(t){return e.element.querySelector('[data-eid="'+t+'"]')},this.getBoardElements=function(t){return e.element.querySelector('[data-id="'+t+'"] .kanban-drag').childNodes},this.removeElement=function(t){return"string"==typeof t&&(t=e.element.querySelector('[data-eid="'+t+'"]')),null!==t&&("function"==typeof t.remove?t.remove():t.parentNode.removeChild(t)),e},this.removeBoard=function(t){var n=null;"string"==typeof t&&(n=e.element.querySelector('[data-id="'+t+'"]')),null!==n&&("function"==typeof n.remove?n.remove():n.parentNode.removeChild(n));for(var o=0;o0?e:A.revertOnSpill,n=L||E,o=h(n),i=$(o);!1===i&&t&&(L?o&&o.removeChild(L):w.insertBefore(n,S)),i||t?_.emit("cancel",n,w,w):_.emit("drop",n,o,w,x),V()}}function V(){var e=L||E;U(),n&&(r.rm(A.mirrorContainer,"gu-unselectable"),d(c,"remove","mousemove",Q),h(n).removeChild(n),n=null),e&&r.rm(e,"gu-transit"),B&&clearTimeout(B),_.dragging=!1,I&&_.emit("out",e,I,w),_.emit("dragend",e),w=E=L=S=x=B=I=null}function $(e,t){var o;return o=void 0!==t?t:n?x:b(L||E),e===w&&o===S}function J(e,t,n){for(var o=e;o&&!i();)o=h(o);return o;function i(){if(!1===H(o))return!1;var i=Z(o,e),r=ee(o,i,t,n);return!!$(o,r)||A.accepts(E,o,w,r)}}function Q(e){if(n){e.preventDefault();var t=y("clientX",e)||0,o=y("clientY",e)||0,i=t-T,r=o-C;n.style.left=i+"px",n.style.top=r+"px";var a=L||E,c=u(n,t,o),d=J(c,t,o),s=null!==d&&d!==I;(s||null===d)&&(I&&m("out"),I=d,s&&m("over"));var l=h(a);if(d!==w||!L||A.copySortSource){var f,p=Z(d,c);if(null!==p)f=ee(d,p,t,o);else{if(!0!==A.revertOnSpill||L)return void(L&&l&&l.removeChild(a));f=S,d=w}(null===f&&s||f!==a&&f!==b(a))&&(x=f,d.insertBefore(a,f),_.emit("shadow",a,d,w))}else l&&l.removeChild(a)}function m(e){_.emit(e,a,I,w)}}function Z(e,t){for(var n=t;n!==e&&h(n)!==e;)n=h(n);return n===c?null:n}function ee(e,t,n,o){var i,r="horizontal"===A.direction;return t!==e?(i=t.getBoundingClientRect(),a(r?n>i.left+m(i)/2:o>i.top+v(i)/2)):function(){var t,i,a,c=e.children.length;for(t=0;tn)return i;if(!r&&a.top+a.height/2>o)return i}return null}();function a(e){return e?b(t):t}}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./classes":8,"contra/emitter":4,crossvent:5}],10:[function(e,t,n){var o,i,r=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function d(e){if(o===setTimeout)return setTimeout(e,0);if((o===a||!o)&&setTimeout)return o=setTimeout,setTimeout(e,0);try{return o(e,0)}catch(t){try{return o.call(null,e,0)}catch(t){return o.call(this,e,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:a}catch(e){o=a}try{i="function"==typeof clearTimeout?clearTimeout:c}catch(e){i=c}}();var s,l=[],u=!1,f=-1;function p(){u&&s&&(u=!1,s.length?l=s.concat(l):f=-1,l.length&&m())}function m(){if(!u){var e=d(p);u=!0;for(var t=l.length;t;){for(s=l,l=[];++f1)for(var n=1;n=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=d++,o=!(arguments.length<2)&&a.call(arguments,1);return c[t]=!0,i(function(){c[t]&&(o?e.apply(null,o):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof o?o:function(e){delete c[e]}}).call(this)}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":10,timers:12}]},{},[1]);