$(document).ready((function(){"use strict";var t=$("#chatinput-form"),a=$("#chat-input"),n=$(".kanban-group-chat .chat"),e=!0;if(t.length&&a.length&&n.length){function l(){var t=n[0].scrollHeight-(n.scrollTop()+n.innerHeight());e=t<=150}function r(){e&&n.stop().animate({scrollTop:n[0].scrollHeight},200)}function d(t){if(t){var e=`\n                <div class="chat-item chat-item-end">\n                    <div class="chat-content">\n                        <p class="chat-bubble">${t}<i data-eva="done-all-outline" class="size-4 text-success align-middle blue-tick"></i></p>\n                        <small class="chat-time text-muted">${(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}</small>\n                    </div>\n                </div>`;n.append(e),a.val(""),r()}}function u(t,a="assets/images/users/avatar-7.png"){var e=`\n                <div class="chat-item chat-item-start">\n                    <a href="#!" class="chat-avatar">\n                        <div class="avatar-xs avatar avatar-circle">\n                            <img src="${a}" alt="Avatar" class="avatar-2xs">\n                        </div>\n                    </a>\n                    <div class="chat-content">\n                        <p class="chat-bubble">${t}</p>\n                        <span class="chat-time text-muted fs-12">${(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}</span>\n                    </div>\n                </div>`;n.append(e),r()}n.css({"max-height":"650px","overflow-y":"auto"}),n.on("scroll",l),$(window).on("resize",l),l(),t.on("submit",(function(t){t.preventDefault();var n=a.val().trim();n&&(d(n),setTimeout((()=>u("Got your message!")),1e3))})),t.find('[title="Send"]').on("click",(function(t){t.preventDefault();var n=a.val().trim();n&&(d(n),setTimeout((()=>u("Got your message!")),1e3))})),new MutationObserver(r).observe(n[0],{childList:!0,subtree:!0}),r()}var s=[];$(".tasks").each((function(){s.push(this)}));var i=dragula(s,{moves:function(t){return t.classList.contains("tasks-box")}}).on("drop",(function(){c()})),o=document.querySelector("#kanbanboard");function c(){$(".tasks-list").each((function(){var t=$(this).find(".tasks-box").length;$(this).find(".totaltask-badge").text(t)}))}o&&"function"==typeof autoScroll&&autoScroll([o],{margin:20,maxSpeed:100,scrollWhenOutside:!0,autoScroll:function(){return this.down&&i.dragging}}),$("#addNewBoard").on("click",(function(){var t=$("#boardName").val().trim();if(t){var a=Math.floor(1e4*Math.random()),n="tasks_"+a,e=`\n        <div class="tasks-list card mb-3" id="${"board_"+a}">\n            <div class="d-flex mb-3 align-items-center p-2 bg-light">\n                <h6 class="fs-14 text-uppercase fw-semibold mb-0 flex-grow-1">\n                    ${t} <small class="badge bg-success ms-1 totaltask-badge">0</small>\n                </h6>\n                <button class="btn btn-sm btn-danger remove-board">X</button>\n            </div>\n            <div data-simplebar class="tasks-wrapper px-3 mx-n3">\n                <div class="tasks" id="${n}"></div>\n            </div>\n            <div class="my-3 px-2">\n                <button class="btn btn-soft-info w-100 add-task-btn">Add Task</button>\n            </div>\n        </div>`;$("#kanbanboard").append(e),$("#boardName").val("");var o=document.getElementById("createboardModal"),l=bootstrap.Modal.getInstance(o);l&&l.hide();var r=document.getElementById(n);s.push(r),i.containers.push(r),c()}else alert("Please enter board name")})),$(document).on("click",".remove-board",(function(){$(this).closest(".tasks-list").remove(),c()})),$(document).on("click",".add-task-btn",(function(){var t=$(this).closest(".tasks-list").find(".tasks")[0];t.insertAdjacentHTML("beforeend",'\n        <div class="tasks-box p-2 mb-2 bg-white border rounded d-flex justify-content-between align-items-center">\n            <span class="task-title" contenteditable="true">New Task</span>\n            <button type="button" class="btn btn-sm btn-danger remove-task">X</button>\n        </div>'),s.includes(t)||(s.push(t),i.containers.push(t)),c()})),$(document).on("click",".remove-task",(function(){$(this).closest(".tasks-box").remove(),c()})),c()}));