function selectAll(e,t){"string"==typeof t&&null===(t=document.querySelector(t))&&console.log("%cMake sure the %cPARENT %cselector is correct!: %c"+e,"font-weight: bold;","color: red;","font-weight: bold;","color: red;");var i=(t||document).querySelectorAll(e);return null===i&&console.log("%cMake sure the %cCHILD %cselector is correct!: %c"+e,"font-weight: bold;","color: red;","font-weight: bold;","color: red;"),[...i]}function select(e,t){"string"==typeof t&&null===(t=document.querySelector(t))&&console.log("%cMake sure the %cPARENT %cselector is correct!: %c"+e,"font-weight: bold;","color: red;","font-weight: bold;","color: red;");var i=(t||document).querySelector(e);return null===i&&console.log("%cMake sure the %cCHILD %cselector is correct!: %c"+e,"font-weight: bold;","color: red;","font-weight: bold;","color: red;"),i}function elementAll(e,t){return selectAll(e,t)}function element(e,t){return select(e,t)}function pickAll(e,t){return selectAll(e,t)}function pick(e,t){return select(e,t)}var SDB={init:function(){for(var e=pickAll('[data-item-type="edittext"]'),t=0;t .padding-box > '}return n?selectAll(a+"[data-item-"+i+'="'+e+'"]'):select(a+"[data-item-"+i+'="'+e+'"]')},id:function(e,t){return SDB.elementGetter(e,t,"id")},name:function(e,t){return SDB.elementGetter(e,t,"name")},typeAll:function(e,t){return SDB.elementGetter(e,t,"type","all")},disabled:function(e){return e.classList.contains("disable-item")},disable:{init:function(e){e.classList.add("disable-item"),"edittext"===e.getAttribute("data-item-type")&&select("[contenteditable]",e).setAttribute("contenteditable",!1)},element:function(e){if(Array.isArray(e))for(var t of e)SDB.disable.init(t);else SDB.disable.init(e)},id:function(e){if(Array.isArray(e))for(var t of e){var i=SDB.id(t);SDB.disable.init(i)}else{i=SDB.id(e);SDB.disable.init(i)}},name:function(e){if(Array.isArray(e))for(var t of e){var i=SDB.name(t);SDB.disable.init(i)}else{i=SDB.name(e);SDB.disable.init(i)}}},enable:{init:function(e){e.classList.remove("disable-item"),"edittext"===e.getAttribute("data-item-type")&&select("[contenteditable]",e).setAttribute("contenteditable",!0)},element:function(e){if(Array.isArray(e))for(var t of e)SDB.enable.init(t);else SDB.enable.init(e)},id:function(e){if(Array.isArray(e))for(var t of e){var i=SDB.id(t);SDB.enable.init(i)}else{i=SDB.id(e);SDB.enable.init(i)}},name:function(e){if(Array.isArray(e))for(var t of e){var i=SDB.name(t);SDB.enable.init(i)}else{i=SDB.name(e);SDB.enable.init(i)}}},editTextEvent:function(){this.parentNode.parentNode.classList.contains("disable-item")&&this.blur()},inspector:function(){function e(t){try{if(null!==t){var i=t.getAttribute("data-item-id"),n=t.getAttribute("data-tab-id"),a=t.getAttribute("data-tree-item-id");if(null!==a)SDB.updateInspector({id:a,parentId:t.getAttribute("data-item-parent-id"),name:t.getAttribute("data-item-name"),type:t.getAttribute("data-item-type")});else if(null!==n){var c=n,r=pick('[data-item-id="'+c+'"]');SDB.updateInspector({id:c,parentId:r.getAttribute("data-item-parent-id"),name:r.getAttribute("data-item-name"),type:r.getAttribute("data-item-type")})}else null!==i?SDB.updateInspector({id:i,parentId:t.getAttribute("data-item-parent-id"),name:t.getAttribute("data-item-name"),type:t.getAttribute("data-item-type")}):e(t.parentNode)}else e(t.parentNode)}catch(e){}}SDB.launchInspector(),document.addEventListener("mousemove",(function(t){var i=pick("#sdb-inspector");if(t.target===i){var n=i.classList.contains("top-right")?"remove":"add";i.classList[n]("top-right")}e(t.target)}))},launchInspector:function(){var e=document.createElement("div");e.setAttribute("id","sdb-inspector"),select("body").appendChild(e)},updateInspector:function(e){var t=pick("#sdb-inspector");null!==t&&(t.innerHTML='
Type: '+e.type+'
ID: '+e.id+'
Parent ID: '+e.parentId+"
"+(e.name?'
Name: '+e.name+"
":""))},themeManager:{init:function(e){SDB.themeManager.changeColor(e.hostEnvironment.appSkinInfo),e.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT,(function(){var e=JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo;SDB.themeManager.changeColor(e)}))},changeColor:function(e){var t="",i=e.panelBackgroundColor.color.red;t=i>200?"lightest":i>180?"light":i>80?"dark":"darkest",$("html").attr("data-theme-color",t)}}};SDB.init(),SDB.Dropdownlist={init:function(){for(var e=selectAll(".drop-list-wrap"),t=0;t li",l),u=0;u div",e),i=document.createElement("ul"),n=0;n div",e))n.textContent.includes(t)&&n.classList.add("selected");else"number"==typeof t&&selectAll(".items > div",e)[t].classList.add("selected");SDB.Dropdownlist.close(e)},selection:{index:function(e){var t=pickAll(".items > div",e),i=pick(".selected",e);return t.indexOf(i)},text:function(e){return pick(".selected",e).textContent},value:function(e){return pick(".selected",e).textContent}},add:function(e,t){var i=document.createElement("div");"-"===t&&i.classList.add("horizontal-line"),i.textContent=t;var n=pick(".items",e);n.appendChild(i),SDB.Dropdownlist.setSize(n),1===pickAll(".items > div",e).length&&SDB.Dropdownlist.select(e,0)},setSize:function(e){e.classList.add("getSize");var t=e.clientWidth;e.style.minWidth=t+13+"px",e.classList.remove("getSize")},remove:function(e,t){var i=pickAll(".items > div",e)[t],n=i.classList.contains("selected");if("string"==typeof t)for(var a of selectAll(".items > div",e))a.textContent.includes(t)&&(n=a.classList.contains("selected"),a.remove());else"number"==typeof t&&i.remove();n&&pickAll(".items > div",e)[0].classList.add("selected")},empty:function(e){pick(".items",e).innerHTML=""},close:function(e){try{document.querySelector("#drop-list").remove(),e.classList.remove("open")}catch(e){}}},SDB.Dropdownlist.init(),SDB.Radiocheck={init:function(){for(var e=selectAll('#dialog [data-item-type="radiobutton"], #dialog [data-item-type="checkbox"]'),t=0;t .tab-container > div');for(var t of e)SDB.Tabbedpanel.clickEvent(t)},clickEvent:function(e){e.addEventListener("click",(function(){var t=this.parentNode.parentNode,i=this.getAttribute("data-tab-id");SDB.Tabbedpanel.select.id(t,i);var n=new CustomEvent("onSelect",{detail:{selected:{index:[...e.parentNode.children].indexOf(e),text:e.textContent,id:parseInt(i,10)}}});t.dispatchEvent(n)}))},matchHeight:function(e){var t=[];for(var i of e.parentNode.children)"DIV"==i.tagName&&(i.classList.contains("visible-tab")&&i.classList.remove("visible-tab"),i!=e&&t.push(i));var n=e.offsetHeight;e.classList.remove("visible-tab");var a=0;for(var c of t){c.classList.add("visible-tab","tab-width-auto");var r=c.offsetHeight;r>a&&(a=r),c.classList.remove("visible-tab","tab-width-auto")}a>n&&(e.style.minHeight=a+"px"),e.classList.add("visible-tab")},select:{init:function(e,t,i){var n,a;if("index"===i){for(var c=e.children[0].querySelectorAll("div"),r=0;r .item-wrap",a);this.attachClick(c,i)}}},add:function(e,t){if(!Array.isArray(t))return this.makeItem(e,t),select(":scope > .padding-box > .tree-view-item:last-child",e);SDB.Treeview.addInBulk(e,t)},remove:function(e){if(e.classList.contains("tree-view-item")){var t=e.parentNode.parentNode;[...t.querySelectorAll(":scope > .padding-box > .tree-view-item")].length<=1&&t.classList.remove("tree-node"),e.remove()}},expand:function(e){if(e.classList.contains("tree-view-item"))return SDB.Treeview.classOperation(e,"add"),e},expanded:function(e){if(e.classList.contains("tree-view-item"))return e.classList.contains("expanded")},expandAll:function(e,t){var i=[e];for(var n of i=i.concat(pickAll(".tree-view-item.tree-node",e)))SDB.Treeview.classOperation(n,t?"remove":"add");return i},collapse:function(e){if(e.classList.contains("tree-view-item"))return this.classOperation(e,"remove"),e},collapseAll:function(e){return SDB.Treeview.expandAll(e,"remove")},text:function(e){if(e.classList.contains("tree-view-item"))return select(":scope > .item-wrap .text-container",e).textContent},empty:function(e){var t=e.classList.contains("tree-node");(e.classList.contains("tree-view")||t)&&(pick(":scope > .padding-box",e).innerHTML="",t&&e.classList.remove("tree-node"))},addInBulk:function(e,t){for(var i,n=0;n0){for(var c=[],r=0;r';var p=document.createElement("span");p.classList.add("text-container"),p.textContent=t;var v=document.createElement("div");v.classList.add("padding-box"),d.appendChild(u),d.appendChild(p),i.appendChild(d),i.appendChild(v),pick(":scope > .padding-box",e).appendChild(i),i.setAttribute("data-item-type","treeitem"),i.setAttribute("data-tree-item-id",l),i.setAttribute("data-item-name","tree-item-"+l);var f=d.parentNode.parentNode.parentNode;i.setAttribute("data-item-parent-id",f.getAttribute("data-tree-item-id")||f.getAttribute("data-item-id")),this.initParentMode(e),this.attachClick(d,n)},attachClick:function(e,t){t=e.closest(".tree-view");e.addEventListener("click",(function(){var i=this.parentNode;SDB.Treeview.classOperation(i,"toggle");var n={element:i,index:pickAll(".tree-view-item",t).indexOf(i),id:parseInt(i.getAttribute("data-tree-item-id"),10),text:select(".text-container",e).textContent},a=i.classList.contains("tree-node");n.isParent=a,n.expanded=i.classList.contains("expanded");var c=new CustomEvent("onClick",{detail:n});t.dispatchEvent(c)}))},classOperation:function(e,t){e.classList[t]("expanded")},initParentMode:function(e){e.classList.contains("tree-view-item")&&e.classList.add("tree-node")}},SDB.Treeview.init();