/*! * LiteRyzJS/Treeview v0.2.0.248 * Copyright 2023-2024 Ray Lam (https://www.hiimray.co.uk) * */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.LiteRyzJS=t():e.LiteRyzJS=t()}(this,(()=>(()=>{"use strict";var e={879:(e,t,n)=>{n.d(t,{A:()=>v});var i=n(601),o=n.n(i),r=n(314),a=n.n(r),l=n(417),s=n.n(l),c=new URL(n(553),n.b),d=new URL(n(532),n.b),u=a()(o()),p=s()(c),h=s()(d);u.push([e.id,`ul.bbtreeview{background-image:url(${p});background-repeat:repeat-y;list-style:none;padding:0;margin:0 0 0 8px}ul.bbtreeview ul{background-image:url(${p});background-repeat:repeat-y;list-style:none;margin:0 0 0 22px;padding:0}ul.bbtreeview li{background-repeat:no-repeat;cursor:default;display:block}ul.bbtreeview li div.icon.expand{margin-right:2px}ul.bbtreeview div.li{height:1.2em}ul.bbtreeview div.li span{-webkit-user-select:none;-ms-user-select:none;user-select:none;display:inline-block;height:1.2em;line-height:1.2em;overflow:hidden;padding-left:6px;text-overflow:ellipsis;vertical-align:top;white-space:nowrap}ul.bbtreeview div.li span.noicon{padding-left:0px !important}ul.bbtreeview div.li.highlighted{background-color:rgba(169,201,249,.7)}ul.bbtreeview div.icon{background-position-x:0px;background-repeat:no-repeat;display:inline-block;height:16px;width:16px}ul.bbtreeview div.icon.folder{background-image:url(${h});background-position-y:-32px}ul.bbtreeview .c>ul{display:none}ul.bbtreeview .c>div>div.icon.expand{background-image:url(${h});background-position-y:-64px}ul.bbtreeview .e>div>div.icon.expand{background-image:url(${h});background-position-y:-48px}ul.bbtreeview .nc>div>div.icon.expand{background-image:url(${h});background-position-y:-80px}ul.bbtreeview .o>div>div.icon.checkbox{background-image:url(${h});background-position-y:-16px}ul.bbtreeview .x>div>div.icon.checkbox{background-image:url(${h});background-position-y:0px}`,""]);const v=u},314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,o,r){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(i)for(var l=0;l0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=r),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),o&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=o):d[4]="".concat(o)),t.push(d))}},t}},417:e=>{e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},601:e=>{e.exports=function(e){return e[1]}},72:e=>{var t=[];function n(e){for(var n=-1,i=0;i{var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,o&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},553:(e,t,n)=>{e.exports=n.p+"3d8c3a36ba28a63fb45e.png"},532:(e,t,n)=>{e.exports=n.p+"d569c63e87173fe0853a.png"}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={id:i,exports:{}};return e[i](r,r.exports,n),r.exports}n.m=e,n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var i=t.getElementsByTagName("script");if(i.length)for(var o=i.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=i[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var i={};n.r(i),n.d(i,{Treeview:()=>x});const o=class{constructor(e,t){this.Treeview=e,this.Node=t}get Expandbox(){const e=this.Node.querySelectorAll("div.icon.expand");return void 0===e?null:e[0]}get Checkbox(){if(!this.Treeview.Options.ShowCheckbox)return null;const e=this.Node.querySelectorAll("div.icon.checkbox");return void 0===e?null:e[0]}get ChildNode(){let e=this.Node.querySelectorAll("ul");return e.length<=0?null:e[0]}get ChildNodes(){const e=this.ChildNode;if(null==e)return[];let t=e.querySelectorAll("li");if(t.length<=0)return[];let n=[];return t.forEach((function(t){void 0!==t.parentNode&&t.parentNode==e&&n.push(t)})),n}get Container(){return this.Node.querySelectorAll("div.li")[0]}get Hint(){return this.Label.getAttribute("title")}get ID(){return this.Node.getAttribute("data-bbtv-id")}get IsChecked(){return!!this.Treeview.Options.ShowCheckbox&&this.Node.classList.contains("x")}get IsExpanded(){return this.Node.classList.contains("e")}get IsHighlighted(){return this.Container.classList.contains("highlighted")}get Label(){return this.Node.querySelectorAll("span")[0]}get Name(){return this.Label.textContent}get ParentID(){const e=this.ParentNode;return null==e?null:e.getAttribute("data-bbtv-id")}get ParentNode(){return this.#e(this.Node,"li")}get Tag(){let e=this.Node.getAttribute("data-bbtv-tag");return this.Treeview.isNullOrWhitespace(e)?null:JSON.parse(decodeURIComponent(e))}get Value(){return this.Node.getAttribute("data-bbtv-value")}Check(e){const t=this;t.#t(t.Node,e),t.Node.querySelectorAll("li").forEach((function(n){t.#t(n,e)}));let n=t.ParentNode;if(null!=n){if(t.Treeview.Options.EnableGuardian)for(;;){const e=n.querySelectorAll("li.x").length>0;if(t.#t(n,e),n=t.Treeview.GetTreeNode(n),n=n.ParentNode,null==n)break}if(t.Treeview.Options.EnableCascade){let e=0;n.querySelectorAll("li").forEach((function(t){t.classList.contains("x")||e++})),t.#t(n,e<=0)}}}Expand(e){this.#n(this.Node,e)}Remove(){const e=this;null!=e.ParentNode&&(e.ParentNode.classList.contains("e")&&e.ParentNode.classList.remove("e"),e.ParentNode.classList.contains("c")&&e.ParentNode.classList.remove("c")),e.Node.parentNode.removeChild(e.Node)}InitialiseComponents(){const e=this;e.#i(),e.#o(),e.#r(),e.Expand(e.IsExpanded),e.Check(e.IsChecked)}#i(){const e=this;e.Expandbox.addEventListener("mousedown",(function(t){t.stopPropagation(),t.preventDefault(),e.Expand(!e.IsExpanded)})),e.Expandbox.addEventListener("click",(function(e){e.stopPropagation(),e.preventDefault()})),e.Expandbox.addEventListener("dblclick",(function(e){e.stopPropagation(),e.preventDefault()}))}#o(){const e=this;e.Treeview.Options.ShowCheckbox&&(e.Checkbox.addEventListener("mousedown",(function(t){t.stopPropagation(),t.preventDefault(),e.Check(!e.IsChecked)})),e.Checkbox.addEventListener("click",(function(e){e.stopPropagation(),e.preventDefault()})),e.Checkbox.addEventListener("dblclick",(function(e){e.stopPropagation(),e.preventDefault()})))}#r(){const e=this;e.Container.addEventListener("dblclick",(function(t){t.stopPropagation(),t.preventDefault(),null!=e.Treeview.GetTreeNode(t.target)&&e.Expand(!e.IsExpanded)})),e.Container.addEventListener("mousedown",(function(t){t.stopPropagation(),t.preventDefault();const n=e.Treeview.GetTreeNode(t.target);null!=n&&(e.Treeview.Container.querySelectorAll("div.highlighted").forEach((function(e){e.classList.remove("highlighted")})),e.Treeview.Options.ShowSelection&&n.Container.classList.add("highlighted"))}))}#a(e,t){return e.tagName.toLowerCase()==t}#e(e,t){const n=this;let i=e;for(;void 0!==i.parentNode&&(i=i.parentNode,void 0!==i);){if(n.#a(i,"ul")&&i.classList.contains("bbtreeview"))return null;if(n.#a(i,t))break}return i}#t(e,t){e.classList.remove("x"),e.classList.remove("o"),e.classList.add(t?"x":"o")}#n(e,t){e.classList.remove("e"),e.classList.remove("c"),t?e.querySelectorAll("li").length>0?e.classList.add("e"):e.classList.add("nc"):e.classList.add("c")}};var r=n(72),a=n.n(r),l=n(825),s=n.n(l),c=n(659),d=n.n(c),u=n(56),p=n.n(u),h=n(540),v=n.n(h),b=n(113),g=n.n(b),f=n(879),m={};m.styleTagTransform=g(),m.setAttributes=p(),m.insert=d().bind(null,"head"),m.domAPI=s(),m.insertStyleElement=v(),a()(f.A,m),f.A&&f.A.locals&&f.A.locals;const x=class{constructor(e){this.Options={},this.#l(e)}#l(e){this.Options=Object.assign({ID:null,ShowCheckbox:!1,ShowSelection:!0,EnableGuardian:!1,EnableCascade:!0,ShowIcon:!0},e),this.#s()}get Node(){let e=document.getElementsByTagName("body");if(!(e.length<=0||(e=e[0],e=e.querySelectorAll(this.Options.ID),e.length<=0)))return e=e[0],e}get Container(){let e=this.Node;if(null!=e&&(e=e.querySelectorAll("ul.bbtreeview"),!(e.length<=0)))return e=e[0],e}AddItem(e){const t=this,n=Object.assign({ID:null,ParentID:null,Name:"",Hint:"",Value:"",Icon:"folder",Checked:!1,Tag:null},e);if(null==n.ID&&(n.ID=t.#c()),null==n.Tag&&(n.Tag=""),null!=t.Find(n.ID))return!1;let i=null;if(null!=n.ParentID&&(i=t.Find(n.ParentID),null==i))return!1;i=null==i?t.Container:i.ChildNode;const o=t.#d(n);return t.#u(i,o),t.Find(n.ID).InitialiseComponents(),!0}Remove(e){const t=this.Find(e);return null!=t&&(t.Remove(),!0)}Clear(){this.#l(this.Options)}CollapseAll(){this.GetAllNodes().forEach((function(e){e.Expand(!1)}))}ExpandAll(){this.GetAllNodes().forEach((function(e){e.Expand(!0)}))}CheckAll(e){this.Options.ShowCheckbox&&this.GetAllNodes().forEach((function(t){t.Check(e)}))}Find(e){if(null==this.Container)return void console.log("Treeview container not found");const t=this.Container.querySelectorAll("li[data-bbtv-id='"+e+"']");return t.length<=0?null:new o(this,t[0])}FindByName(e){let t=[];return this.GetAllNodes().forEach((function(n){n.Name==e&&t.push(n)})),t}FindByValue(e){let t=[];return this.GetAllNodes().forEach((function(n){n.Value==e&&t.push(n)})),t}GetAllNodes(){const e=this,t=e.Container.querySelectorAll("li");if(t.length<=0)return[];let n=[];return t.forEach((function(t){const i=t.getAttribute("data-bbtv-id");if(e.#p(i))return;const o=e.Find(i);null!=o&&n.push(o)})),n}GetCheckedNodes(){let e=[];return this.GetAllNodes().forEach((function(t){t.IsChecked&&e.push(t)})),e}GetCheckedValues(){let e=[];return this.GetCheckedNodes().map((function(t){e.push(t.Value)})),e}GetCheckedTags(){let e=[];return this.GetCheckedNodes().map((function(t){e.push(t.Tag)})),e}GetSelectedNode(){let e=null;return this.GetAllNodes().forEach((function(t){if(t.IsHighlighted)return e=t,!1})),e}GetTreeNode(e){const t=this;let n=null;n=t.#a(e,"li")?e:t.#e(e,"li");const i=n.getAttribute("data-bbtv-id");return t.#p(i)?null:t.Find(i)}#u(e,t){let n=document.createElement("template");n.innerHTML=t,n=n.content.firstChild,e.appendChild(n)}#s(){let e=this.Node;null!=e&&(e.innerHTML='')}#c(){return"treeviewItem"+(Math.floor(1000001*Math.random())+100).toString()}#d(e){const t=this;let n="";t.#p(e.Tag)||(n=encodeURIComponent(JSON.stringify(e.Tag)));let i='
  • ';return i+='
    ',i+='
    ',t.Options.ShowCheckbox&&(i+='
    '),t.Options.ShowIcon?(i+='
    ',i+=''+e.Name+""):i+=''+e.Name+"",i+="
    ",i+="
      ",i+="
    • ",i}#p(e){return void 0===e||null==e||e.toString().trim().length<=0}#a(e,t){return e.tagName.toLowerCase()==t}#e(e,t){const n=this;let i=e;for(;void 0!==i.parentNode&&(i=i.parentNode,void 0!==i);){if(n.#a(i,"ul")&&i.classList.contains("bbtreeview"))return null;if(n.#a(i,t))break}return i}};return i})()));