var GNexusUIKit=(()=>{var H=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var ge=(e,t)=>{for(var a in t)H(e,a,{get:t[a],enumerable:!0})},ye=(e,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of he(t))!ve.call(e,i)&&i!==a&&H(e,i,{get:()=>t[i],enumerable:!(n=pe(t,i))||n.enumerable});return e};var be=e=>ye(H({},"__esModule",{value:!0}),e);var pt={};ge(pt,{Accordion:()=>q,Drawer:()=>O,Helper:()=>m,InputPatterns:()=>$,Modals:()=>g,NavigationShell:()=>x,Overlays:()=>A,Tabs:()=>N,Toasts:()=>C,advancedSelect:()=>b,confirmPopup:()=>S,default:()=>mt,editableString:()=>E});function Ee(e){let t="";for(let a of e){let n="",i="";a.route&&(n=`<a class="list-action" href="${a.route}">`,i="</a>"),t+=`
<li class="list-item ${a.is_active?"list-item-active":""}">
${n}${a.content}${i}
</li>
`}return`
<div class="sidebar block">
<ul class="list list-nav">
${t}
</ul>
</div>
`}function Se(e,t,a,n){let i='<tr class="table-row">',o=0;for(let d in t)i+=`<th scope="col">${t[d]}</th>`,o++;i+="</tr>";let l="";for(let d of a){l+='<tr class="table-row">';for(let f in t)l+=`<td>${d[f]}</td>`;l+="</tr>"}let c="";typeof n!="undefined"&&(c=`
<tfoot class="table-foot">
<tr class="table-row">
<td colspan="${o}">
${n}
</td>
</tr>
</tfoot>
`);let s=e?`<caption class="table-caption">${e}</caption>`:"",r=a.length?`<thead class="table-head">${i}</thead>`:"";return l=a.length?l:'<tr><td class="is-empty">Empty</td></tr>',`
<div class="table-wrapper">
<table class="table data-list ${a.length?"":"table-empty"}">
${s}
${r}
<tbody class="table-body">${l}</tbody>
${c}
</table>
</div>
`}function Y(e,t,a){let n=document.createElement(e);for(let[i,o]of Object.entries(t))i==="class"?n.className=o:i==="dataset"?Object.assign(n.dataset,o):n.setAttribute(i,o);return n.innerHTML=typeof a!="undefined"?a:"",n}function Le(e,t){return["primary","success","secondary","info","warning","error","danger"].indexOf(e)<0?console.error("createAlert()","Error of type: "+e):Y("div",{class:`alert alert-${e}`},t)}function we(e,t={}){let a={};for(let n in e){if(typeof t[n]!="undefined"){a[t[n]]=e[n];continue}a[n]=e[n]}return a}function xe(e,t){if((e==null?void 0:e.isLoading)==t)return!1;if(t)e.isLoading=!0,e.originalContent=e.innerHTML,e.classList.contains("with-icon")?e.originalWithIcon=!0:e.classList.add("with-icon"),e.classList.add("loading-state"),e.setAttribute("disabled","disabled"),e.innerHTML='<i class="ph ph-bold ph-spinner"></i> Loading';else{if(e.isLoading=!1,!e.originalContent)return!1;e.removeAttribute("disabled"),e.classList.remove("loading-state"),e.originalWithIcon||e.classList.remove("with-icon"),e.innerHTML=e.originalContent}return e}function Ae(e,t){if((e==null?void 0:e.isLoading)==t)return!1;let a=e.querySelector(".status-icon");if(t)e.isLoading=!0,e.originalContent=a.innerHTML,e.classList.add("loading-state"),e.setAttribute("disabled","disabled"),a.innerHTML='<i class="ph ph-bold ph-spinner"></i>';else{if(e.isLoading=!1,!e.originalContent)return!1;e.removeAttribute("disabled"),e.classList.remove("loading-state"),a.innerHTML=e.originalContent}return e}function ke(e,t){return t=t!=null?t:"",`
<div class="container">
<div class="row adaptive g-6">
<div class="col sidebar-container">
${e}
</div>
<div class="col main-container w-100">
${t}
</div>
</div>
</div>
`}function $e(e){return e=="active"?'<span class="badge badge-success">Online</span>':'<span class="badge badge-warning">Offline</span>'}function qe(e){return e=="enabled"?'<span class="badge badge-success">Enabled</span>':'<span class="badge badge-primary">Disabled</span>'}function Te(e){let t=new Date(e.replace(" ","T")),n=Math.floor((new Date-t)/1e3);if(n<60)return"less than a minute ago";let i=Math.floor(n/60),o=Math.floor(i/60),l=Math.floor(o/24);if(i<60)return`${i} minute${i!==1?"s":""} ago`;if(o<24){let c=i%60;return`${o} hour${o!==1?"s":""} ${c} minute${c!==1?"s":""} ago`}return`${l} day${l!==1?"s":""} ago`}function Ne(e){let t=new Date(e.replace(" ","T")),a=new Date,n=new Date(a.getFullYear(),a.getMonth(),a.getDate()),i=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=Math.floor((n-i)/864e5),l=String(t.getHours()).padStart(2,"0"),c=String(t.getMinutes()).padStart(2,"0");if(o===0)return`Today at ${l}:${c}`;if(o===1)return`Yesterday at ${l}:${c}`;let s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return`${t.getDate()} ${s[t.getMonth()]} ${t.getFullYear()} at ${l}:${c}`}function He(){return`
<div class="circle-loader">
<i class="ph ph-bold ph-spinner normalize"></i>
Loading
</div>
`}function Ce(){return`
<div class="empty-here">
<div class="icon"><i class="ph ph-placeholder normalize"></i></div>
<p class="text-msg">It's empty here yet</p>
</div>
`}var m={template:{sidebarNav:Ee,table:Se,createElement:Y,createAlert:Le,mainTemplate:ke,connectionStatusBadge:$e,toogleStateBadge:qe,circleLoaderHTML:He,emptyHereHTML:Ce},unification:{fieldsUnification:we,timeAgo:Te,formatDate:Ne},states:{btnLoadingState:xe,cardStatusLoadingState:Ae}};function Me(e,t){if(t instanceof Node){e.append(t);return}let a=document.createElement("span");a.innerHTML=t,e.append(...a.childNodes)}function De(e,t,a,n){let i=document.createElement("div");i.className=`toast toast-${e}`,i.setAttribute("role","alert");let o=document.createElement("div");o.className="toast-content";let l=document.createElement("h4");l.className="toast-title",Me(l,t),l.append(document.createTextNode(` ${a!=null?a:""}`));let c=document.createElement("p");c.className="toast-text",c.textContent=n!=null?n:"";let s=document.createElement("button");return s.className="btn-icon toast-close",s.type="button",s.setAttribute("aria-label","Close"),s.textContent="\u2715",o.append(l,c),i.append(o,s),i}function Oe(e,t){if(t!=null&&t.alone&&document.querySelectorAll(".toast").forEach(a=>{var n;return(n=a.close)==null?void 0:n.call(a)}),e.close=function(){this.classList.add("a-hide"),setTimeout(()=>{this.remove()},300)},e.querySelector(".toast-close").addEventListener("click",a=>{e.close()}),e.show=function(){document.querySelector("body").append(e),setTimeout(()=>{e.classList.add("a-show")},10)},e.addEventListener("mouseover",a=>e.ishovered=!0),e.addEventListener("mouseout",a=>e.ishovered=!1),t!=null&&t.lifetime){let a=setInterval(()=>{e.ishovered||(e.close(),clearInterval(a))},t==null?void 0:t.lifetime)}return e}function v(e,t,a,n,i){return Oe(De(e,t,a,n),i)}function Fe(e,t,a){return typeof a=="undefined"&&(a={}),typeof a.lifetime=="undefined"&&(a.lifetime=4e3),typeof a.alone=="undefined"&&(a.alone=!0),v("success",'<i class="ph ph-check-circle"></i>',e,t,a)}function Ie(e,t,a){return v("info",'<i class="ph ph-info"></i>',e,t,a)}function je(e,t,a){return v("warning",'<i class="ph ph-warning"></i>',e,t,a)}function _(e,t,a){return v("danger",'<i class="ph ph-warning-octagon"></i>',e,t,a)}var C={create:v,createInfo:Ie,createSuccess:Fe,createWarning:je,createError:_,createDanger:_};function y(e,t,a="html"){if(t instanceof Node){e.append(t);return}typeof t!="undefined"&&t!==null&&(a==="text"?e.textContent=t:e.innerHTML=t)}function Re(e,t,a,n={}){var V;let i=document.createElement("div");i.className="modal",i.setAttribute("aria-hidden","true"),i.id=e;let o=document.createElement("div");o.className="modal-backdrop";let l=document.createElement("div");l.className="modal-dialog",l.setAttribute("role","dialog"),l.setAttribute("aria-modal","true"),l.setAttribute("aria-labelledby",`${e}-title`);let c=document.createElement("div");c.className="modal-panel";let s=document.createElement("header");s.className="modal-header";let r=document.createElement("h4");r.className="modal-title",r.id=`${e}-title`,r.textContent=t;let u=document.createElement("button");u.className="btn-icon modal-close",u.type="button",u.setAttribute("aria-label","Close"),u.textContent="\u2715";let d=document.createElement("div");d.className="modal-body";let f=document.createElement("footer");return f.className="modal-footer",y(f,a,(V=n.footerMode)!=null?V:"html"),s.append(r,u),c.append(d,f),l.append(s,c),i.append(o,l),i}function Be(e,t){return e.show=function(){document.querySelector("body").append(e),setTimeout(()=>{e.classList.add("a-show")},10)},e.close=function(){e.classList.add("a-hide"),setTimeout(()=>{e.remove()},300)},e.querySelector(".modal-close").addEventListener("click",a=>{e.close()}),typeof t=="function"&&t(e),e}function Ue(e,t){var c;t=t!=null?t:{};let a=t.title||"",n=t.footer||"",i=Re(e,a,n,t),o=i.querySelector(".modal-body"),l=i.querySelector(".modal-footer");if(typeof t.actions=="function"){let s=t.actions(i);if(Array.isArray(s)&&s[0]instanceof Node){let r=document.createElement("div");r.classList.add("actions");for(let u of s)r.append(u);l.append(r)}else s instanceof Node&&l.append(s)}if(typeof t.body=="function"){let s=t.body(i);y(o,s,(c=t.bodyMode)!=null?c:"html")}else typeof t.bodyText!="undefined"?y(o,t.bodyText,"text"):typeof t.bodyHtml!="undefined"&&y(o,t.bodyHtml,"html");return Be(i,t==null?void 0:t.onready)}var g={create:Ue};function K(e){let t=e.querySelector(".focus");if(!t)return;let a=e.getBoundingClientRect(),n=t.getBoundingClientRect();n.top<a.top?e.scrollTop-=a.top-n.top:n.bottom>a.bottom&&(e.scrollTop+=n.bottom-a.bottom)}function M(e){e.advancedSelect.optionsElements.length-e.querySelectorAll(".option.hide").length==0?e.advancedSelect.showState("not-found"):e.advancedSelect.showState("options")}function D(e){return e.querySelector(".option:not(.hide)")}function We(e){return e.querySelector(".option:not(.hide):last-child")}function J(e,t,a){a&&(e.value=a.dataset.displayValue,e.blur(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),t.advancedSelect.dispatchEvent("selected"),t.advancedSelect.closeList())}function b(e,t,a){let n=document.createElement("div");n.classList.add("advanced-select");let i=document.createElement("div");i.className="popup-options-container";let o=document.createElement("div");o.className="not-found",o.textContent=a!=null?a:"Nothing found";let l=document.createElement("div");l.className="options";for(let s in t){let r=document.createElement("div");r.className="option",r.dataset.value=s,r.dataset.displayValue=t[s],r.textContent=t[s],l.append(r)}i.append(o,l),n.append(i);let c=(s,r)=>{for(let u in r)if(r[u]==s){let d={};return d[u]=r[u],d}return!1};return n.advancedSelect={isOpened:!1,options:t,eventsHandlers:{openList:[],closeList:[],selected:[],changed:[]},openList:()=>{n.advancedSelect.isOpened=!0,n.classList.add("a-show"),M(n),n.advancedSelect.dispatchEvent("openList")},closeList:()=>{n.advancedSelect.isOpened=!1,n.classList.remove("a-show"),M(n),n.advancedSelect.dispatchEvent("closeList")},showState:s=>{s=="options"?(n.querySelector(".options").classList.add("show"),n.querySelector(".not-found").classList.remove("show")):s=="not-found"&&(n.querySelector(".options").classList.remove("show"),n.querySelector(".not-found").classList.add("show"))},optionsElements:n.querySelectorAll(".option"),value:()=>{let s=c(e.value,t);return{inputValue:e.value,isOption:!!s,option:s}},addEventListener:(s,r)=>{if(typeof n.advancedSelect.eventsHandlers[s]!="undefined")return n.advancedSelect.eventsHandlers[s].push(r);console.error("Advanced Select component.","addEventListener()","Invalid event name")},dispatchEvent:s=>{if(typeof n.advancedSelect.eventsHandlers[s]=="undefined")return console.error("Advanced Select component.","dispatchEvent()","Invalid event name");for(let r of n.advancedSelect.eventsHandlers[s])r(n)}},e.setAttribute("autocomplete","nope"),e.advancedSelect={value:()=>n.advancedSelect.value()},e.addEventListener("focus",s=>{n.advancedSelect.openList()}),e.addEventListener("blur",s=>{requestAnimationFrame(()=>{n.matches(":hover")||n.advancedSelect.closeList()})}),e.addEventListener("keydown",s=>{var r,u;if(s.key==="ArrowUp"){s.preventDefault();let d=n.querySelector(".option.focus");if(d){d.classList.remove("focus");let f=d.previousElementSibling;for(;f&&f.classList.contains("hide");)f=f.previousElementSibling;f||(f=D(n)),f==null||f.classList.add("focus")}else(r=We(n))==null||r.classList.add("focus");K(n)}else if(s.key==="ArrowDown"){s.preventDefault();let d=n.querySelector(".option.focus");if(d){d.classList.remove("focus");let f=d.nextElementSibling;for(;f&&f.classList.contains("hide");)f=f.nextElementSibling;f||(f=D(n)),f==null||f.classList.add("focus")}else(u=D(n))==null||u.classList.add("focus");K(n)}else if(s.key==="Enter"){s.preventDefault();let d=n.querySelector(".option.focus");J(e,n,d)}else s.key==="Escape"&&(n.advancedSelect.closeList(),e.blur())}),e.addEventListener("input",s=>{var u;let r=s.currentTarget.value.toLowerCase();r==""?n.advancedSelect.optionsElements.forEach(d=>d.classList.remove("hide")):([...n.advancedSelect.optionsElements].filter(d=>d.dataset.displayValue.toLowerCase().indexOf(r)!=-1).forEach(d=>d.classList.remove("hide")),[...n.advancedSelect.optionsElements].filter(d=>d.dataset.displayValue.toLowerCase().indexOf(r)==-1).forEach(d=>d.classList.add("hide")),M(n),(u=n.querySelector(".option.focus"))==null||u.classList.remove("focus"))}),e.addEventListener("change",s=>{n.advancedSelect.dispatchEvent("changed")}),[...n.advancedSelect.optionsElements].forEach(s=>{s.addEventListener("pointerdown",r=>{r.preventDefault(),J(e,n,r.currentTarget)})}),n}function Pe(e,t){let a="Write something",n=t?`<textarea class="input" placeholder="${a}"></textarea>`:`<input type="text" class="input" placeholder="${a}">`;return`
<div class="editable-string-content">
<span class="editable-string">${e}</span>
<button class="btn-icon without-hover edit-text-btn"><i class="ph ph-pencil-simple"></i></button>
</div>
<div class="editable-string-form d-none">
<div class="form-group">
<label class="label">
${n}
</label>
</div>
<button class="btn-icon without-hover apply-changes-btn"><i class="ph ph-check"></i></button>
<button class="btn-icon without-hover cancel-changes-btn"><i class="ph ph-x"></i></button>
</div>
`}function E(e,t){t=t!=null?t:!1;let a=e.innerHTML,n=m.template.createElement("div",{class:"component editable-string-component"},Pe(a,t));e.innerHTML="",e.append(n);let i=n.querySelector(".edit-text-btn"),o=n.querySelector(".apply-changes-btn"),l=n.querySelector(".cancel-changes-btn"),c=n.querySelector(".editable-string-content"),s=n.querySelector(".editable-string"),r=n.querySelector(".editable-string-form"),u=n.querySelector(".input");return n.editableString={formIsDisplaying:!1,value:a,input:u,eventsHandlers:{onChange:[],onSwitch:[]},switch:()=>{n.formIsDisplaying?(r.classList.add("d-none"),c.classList.remove("d-none"),s.innerText=n.editableString.value):(r.classList.remove("d-none"),c.classList.add("d-none"),u.value=n.editableString.value),n.formIsDisplaying=!n.formIsDisplaying,n.editableString.runEventHandler("onSwitch")},setValue:d=>{n.editableString.value=d,u.value=d,s.innerText=d},apply:()=>{n.editableString.value=u.value,n.editableString.switch(),u.value!=a&&n.editableString.runEventHandler("onChange")},onChange:d=>{n.editableString.eventsHandlers.onChange.push(d)},onSwitch:d=>{n.editableString.eventsHandlers.onSwitch.push(d)},runEventHandler:d=>{n.editableString.eventsHandlers[d].forEach(f=>f(n.editableString))}},i.addEventListener("click",d=>{n.editableString.switch()}),l.addEventListener("click",d=>{n.editableString.switch()}),o.addEventListener("click",d=>{n.editableString.apply()}),u.addEventListener("keydown",d=>{d.key==="Enter"&&(u.blur(),n.editableString.apply())}),n}function S(e,t,a){g.create("confirm-popup",{title:"Requires confirmation",body:()=>{let n=document.createElement("p");return n.textContent=e!=null?e:"",n},actions:n=>{let i=m.template.createElement("button",{class:"btn btn-primary"},"NO"),o=m.template.createElement("button",{class:"btn btn-warning"},"YES");return i.addEventListener("click",l=>{n.close(),a==null||a()}),o.addEventListener("click",l=>{n.close(),t==null||t()}),[i,o]}}).show()}function L(e,t,a="html"){if(t instanceof Node){e.append(t);return}typeof t!="undefined"&&t!==null&&(a==="text"?e.textContent=t:e.innerHTML=t)}function ze(e,t,a,n={}){var f;let i=document.createElement("div");i.className="drawer",i.setAttribute("aria-hidden","true"),i.id=e,n.position==="left"&&i.classList.add("drawer-left");let o=document.createElement("div");o.className="drawer-backdrop";let l=document.createElement("aside");l.className="drawer-panel",l.setAttribute("role","dialog"),l.setAttribute("aria-modal","true"),l.setAttribute("aria-labelledby",`${e}-title`);let c=document.createElement("header");c.className="drawer-header";let s=document.createElement("h4");s.className="drawer-title",s.id=`${e}-title`,s.textContent=t;let r=document.createElement("button");r.className="btn-icon drawer-close",r.type="button",r.setAttribute("aria-label","Close"),r.textContent="\u2715";let u=document.createElement("div");u.className="drawer-body";let d=document.createElement("footer");return d.className="drawer-footer",L(d,a,(f=n.footerMode)!=null?f:"html"),c.append(s,r),l.append(c,u,d),i.append(o,l),i}function Ve(e,t){return e.show=function(){document.querySelector("body").append(e),setTimeout(()=>{e.classList.add("a-show")},10)},e.close=function(){e.classList.add("a-hide"),setTimeout(()=>{e.remove()},300)},e.querySelector(".drawer-close").addEventListener("click",()=>{e.close()}),e.querySelector(".drawer-backdrop").addEventListener("click",()=>{e.close()}),typeof t=="function"&&t(e),e}function Ye(e,t){var c;t=t!=null?t:{};let a=t.title||"",n=t.footer||"",i=ze(e,a,n,t),o=i.querySelector(".drawer-body"),l=i.querySelector(".drawer-footer");if(typeof t.actions=="function"){let s=t.actions(i);if(Array.isArray(s)&&s[0]instanceof Node){let r=document.createElement("div");r.classList.add("actions");for(let u of s)r.append(u);l.append(r)}else s instanceof Node&&l.append(s)}if(typeof t.body=="function"){let s=t.body(i);L(o,s,(c=t.bodyMode)!=null?c:"html")}else typeof t.bodyText!="undefined"?L(o,t.bodyText,"text"):typeof t.bodyHtml!="undefined"&&L(o,t.bodyHtml,"html");return Ve(i,t==null?void 0:t.onready)}var O={create:Ye};var G=new WeakSet;function _e(e,t){var n,i;let a=e.getAttribute("aria-controls");return a?((n=t.getElementById)==null?void 0:n.call(t,a))||document.getElementById(a):((i=t.querySelector)==null?void 0:i.call(t,"[data-navigation-drawer]"))||document.querySelector("[data-navigation-drawer]")}function Z(e,t){var n;if(!e)return;e.classList.add("is-open"),e.setAttribute("aria-hidden","false"),e.removeAttribute("inert"),t==null||t.setAttribute("aria-expanded","true"),document.body.classList.add("nav-drawer-open");let a=e.querySelector("[data-navigation-close], a, button, input, select, textarea");(n=a==null?void 0:a.focus)==null||n.call(a)}function w(e,t,a=!0){var n;e&&(e.classList.remove("is-open"),e.setAttribute("aria-hidden","true"),e.setAttribute("inert",""),t==null||t.setAttribute("aria-expanded","false"),document.body.classList.remove("nav-drawer-open"),a&&((n=t==null?void 0:t.focus)==null||n.call(t)))}function Ke(e=document){G.has(e)||(e.addEventListener("click",t=>{let a=t.target.closest("[data-navigation-toggle]");if(!a)return;let n=_e(a,e);n!=null&&n.classList.contains("is-open")?w(n,a):Z(n,a)}),e.addEventListener("click",t=>{let a=t.target.closest("[data-navigation-close], [data-navigation-link], .nav-drawer .list-action");if(!a)return;let n=a.closest("[data-navigation-drawer]")||e.querySelector("[data-navigation-drawer]"),i=n!=null&&n.id?e.querySelector(`[data-navigation-toggle][aria-controls="${n.id}"]`):e.querySelector("[data-navigation-toggle]"),o=!a.matches("[data-navigation-link]");w(n,i,o)}),document.addEventListener("keydown",t=>{t.key==="Escape"&&e.querySelectorAll("[data-navigation-drawer].is-open").forEach(a=>{let n=a.id?e.querySelector(`[data-navigation-toggle][aria-controls="${a.id}"]`):e.querySelector("[data-navigation-toggle]");w(a,n)})}),G.add(e))}var x={init:Ke,open:Z,close:w};var Q=new WeakSet,X=!1;function Je(e){e.classList.remove("is-open"),e.querySelectorAll("[aria-expanded='true']").forEach(t=>{t.setAttribute("aria-expanded","false")})}function p(e=null){document.querySelectorAll(".dropdown.is-open, .popover.is-open, .tooltip.is-open").forEach(t=>{t!==e&&Je(t)})}function Ge(e=document){e.addEventListener("click",t=>{let a=t.target.closest("[data-dropdown-toggle]");if(!a)return;let n=a.closest(".dropdown");if(!n)return;t.preventDefault();let i=n.classList.contains("is-open");p(n),n.classList.toggle("is-open",!i),a.setAttribute("aria-expanded",String(!i))})}function Ze(e=document){e.addEventListener("click",t=>{let a=t.target.closest("[data-popover-toggle]");if(!a)return;let n=a.closest(".popover");if(!n)return;t.preventDefault();let i=n.classList.contains("is-open");p(n),n.classList.toggle("is-open",!i),a.setAttribute("aria-expanded",String(!i))})}function Qe(e=document){e.addEventListener("click",t=>{let a=t.target.closest("[data-tooltip-toggle]");if(!a)return;let n=a.closest(".tooltip");if(!n)return;t.preventDefault();let i=n.classList.contains("is-open");p(n),n.classList.toggle("is-open",!i)})}function Xe(e=document){e.addEventListener("click",t=>{t.target.closest(".dropdown, .popover, .tooltip")||p()}),X||(document.addEventListener("keydown",t=>{t.key==="Escape"&&p()}),X=!0)}function et(e=document){Q.has(e)||(Ge(e),Ze(e),Qe(e),Xe(e),Q.add(e))}var A={init:et,closeAll:p};var ee=new WeakSet,ae=new WeakMap;function te(e){return`${e.name}:${e.size}:${e.lastModified}`}function ie(e){e&&(e.querySelectorAll("img[data-object-url]").forEach(t=>{URL.revokeObjectURL(t.dataset.objectUrl)}),e.innerHTML="",e.hidden=!0)}function F(e){return ae.get(e)||[]}function I(e,t){ae.set(e,t);let a=new DataTransfer;t.forEach(n=>a.items.add(n)),e.files=a.files}function tt(e,t){let a=F(e),n=new Set(a.map(te)),i=[...a];return t.forEach(o=>{let l=te(o);n.has(l)||(n.add(l),i.push(o))}),I(e,i),i}function nt(e,t){let a=F(e).filter((n,i)=>i!==t);return I(e,a),a}function ne(e){let t=e.name.split("."),a=t.length>1?t.pop().trim():"";return a?a.slice(0,6).toUpperCase():e.type?e.type.split("/").pop().slice(0,6).toUpperCase():"FILE"}function at(e){if(!Number.isFinite(e))return"";if(e===0)return"0 B";let t=["B","KB","MB","GB"],a=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),n=e/Math.pow(1024,a);return`${n.toFixed(n>=10||a===0?0:1)} ${t[a]}`}function k(e){let t=e.closest(".file-upload-panel, .file-upload"),a=t==null?void 0:t.querySelector("[data-file-upload-preview]");if(!t||!a)return;let n=F(e);if(!n.length){ie(a);return}it(a,n)}function it(e,t){e&&(ie(e),t.forEach((a,n)=>{let i=document.createElement("figure");i.className="file-upload-preview-item",i.dataset.fileUploadIndex=String(n);let o=document.createElement("div");if(o.className="file-upload-preview-visual",a.type.startsWith("image/")){let u=document.createElement("img"),d=URL.createObjectURL(a);u.src=d,u.dataset.objectUrl=d,u.alt="",u.loading="lazy",o.append(u)}else{let u=document.createElement("span");u.className="file-upload-preview-type",u.textContent=ne(a),o.append(u)}let l=document.createElement("figcaption"),c=document.createElement("span");c.className="file-upload-preview-name",c.textContent=a.name;let s=document.createElement("span");s.className="file-upload-preview-meta",s.textContent=`${ne(a)} / ${at(a.size)}`;let r=document.createElement("button");r.className="file-upload-preview-remove",r.type="button",r.dataset.fileUploadRemove=String(n),r.setAttribute("aria-label",`Remove ${a.name}`),r.innerHTML='<i class="ph ph-x"></i>',l.append(c,s),i.append(r,o,l),e.append(i)}),e.hidden=!1)}function ot(e=document){ee.has(e)||(e.addEventListener("click",t=>{let a=t.target.closest("[data-input-clear]");if(!a)return;let n=a.closest(".input-group"),i=n==null?void 0:n.querySelector("input, textarea");i&&(i.value="",i.dispatchEvent(new Event("input",{bubbles:!0})),i.focus())}),e.addEventListener("click",t=>{let a=t.target.closest("[data-file-upload-remove]");if(!a)return;let n=a.closest(".file-upload-panel, .file-upload"),i=n==null?void 0:n.querySelector("[data-file-upload-input]");i&&(nt(i,Number(a.dataset.fileUploadRemove)),k(i),i.dispatchEvent(new Event("change",{bubbles:!0})))}),e.addEventListener("click",t=>{let a=t.target.closest("[data-date-picker]");if(a&&(a.focus(),typeof a.showPicker=="function"))try{a.showPicker()}catch(n){}}),e.addEventListener("change",t=>{let a=t.target.closest("[data-file-upload-input]");a&&(tt(a,Array.from(a.files||[])),k(a))}),e.addEventListener("reset",t=>{let a=t.target.closest("form");a&&setTimeout(()=>{a.querySelectorAll("[data-file-upload-input]").forEach(n=>{I(n,[]),k(n)})},0)}),ee.add(e))}var $={init:ot,updateFileUpload:k};var oe=new WeakSet;function j(e){return e.querySelector(".accordion-panel")}function st(e){let t=j(e);t&&(t.style.height="auto",t.style.opacity="1",t.style.transform="translateY(0)")}function se(e){let t=j(e);if(!t||e.dataset.animating==="true")return;e.dataset.animating="true",e.open=!0,t.style.height="0px",t.style.opacity="0",t.style.transform="translateY(-8px)",requestAnimationFrame(()=>{t.style.height=`${t.scrollHeight}px`,t.style.opacity="1",t.style.transform="translateY(0)"});let a=n=>{n.propertyName==="height"&&(t.removeEventListener("transitionend",a),t.style.height="auto",delete e.dataset.animating)};t.addEventListener("transitionend",a)}function le(e){let t=j(e);if(!t||e.dataset.animating==="true")return;e.dataset.animating="true",t.style.height=`${t.scrollHeight}px`,t.style.opacity="1",t.style.transform="translateY(0)",requestAnimationFrame(()=>{t.style.height="0px",t.style.opacity="0",t.style.transform="translateY(-8px)"});let a=n=>{n.propertyName==="height"&&(t.removeEventListener("transitionend",a),e.open=!1,t.style.height="",t.style.opacity="",t.style.transform="",delete e.dataset.animating)};t.addEventListener("transitionend",a)}function ce(e){e.open?le(e):se(e)}function lt(e=document){oe.has(e)||(e.querySelectorAll(".accordion-item[open], .disclosure[open]").forEach(st),e.addEventListener("click",t=>{let a=t.target.closest(".accordion-summary");if(!a)return;let n=a.closest(".accordion-item, .disclosure");n&&(t.preventDefault(),ce(n))}),oe.add(e))}var q={init:lt,expand:se,collapse:le,toggle:ce};var re=new WeakSet;function B(e){return[...e.querySelectorAll('[role="tab"], .tab')]}function de(e){return[...e.querySelectorAll('[role="tabpanel"], .tab-panel')]}function ue(e,t){let a=t.getAttribute("aria-controls");return a?e.querySelector(`#${CSS.escape(a)}`):null}function fe(e,t){e.classList.toggle("tab-active",t),e.setAttribute("aria-selected",t?"true":"false"),e.setAttribute("tabindex",t?"0":"-1")}function R(e,t){e.classList.toggle("tab-panel-active",t),e.toggleAttribute("hidden",!t)}function U(e,t={}){var i;if(!e||e.disabled||e.getAttribute("aria-disabled")==="true")return;let a=e.closest(".tabs")||((i=e.closest('[role="tablist"]'))==null?void 0:i.parentElement);if(!a)return;B(a).forEach(o=>fe(o,o===e)),de(a).forEach(o=>R(o,!1));let n=ue(a,e);n&&R(n,!0),t.focus!==!1&&e.focus()}function T(e,t,a){for(let n=1;n<=e.length;n++){let i=(t+n*a+e.length)%e.length,o=e[i];if(!o.disabled&&o.getAttribute("aria-disabled")!=="true")return o}return e[t]}function ct(e){var l;let t=e.target.closest('[role="tab"], .tab');if(!t)return;let a=t.closest(".tabs")||((l=t.closest('[role="tablist"]'))==null?void 0:l.parentElement),n=a?B(a):[],i=n.indexOf(t);if(i<0)return;let o=null;e.key==="ArrowRight"||e.key==="ArrowDown"?o=T(n,i,1):e.key==="ArrowLeft"||e.key==="ArrowUp"?o=T(n,i,-1):e.key==="Home"?o=T(n,-1,1):e.key==="End"&&(o=T(n,0,-1)),o&&(e.preventDefault(),U(o))}function rt(e){let t=B(e),a=t.find(n=>n.classList.contains("tab-active")||n.getAttribute("aria-selected")==="true")||t.find(n=>!n.disabled&&n.getAttribute("aria-disabled")!=="true");t.forEach(n=>{n.setAttribute("role","tab"),fe(n,n===a)}),e.querySelectorAll(".tabs-list").forEach(n=>{n.setAttribute("role","tablist")}),de(e).forEach(n=>{n.setAttribute("role","tabpanel"),R(n,a?n===ue(e,a):n.classList.contains("tab-panel-active"))})}function dt(e=document){re.has(e)||(e.querySelectorAll(".tabs").forEach(rt),e.addEventListener("click",t=>{let a=t.target.closest('[role="tab"], .tab');!a||!e.contains(a)||(t.preventDefault(),U(a,{focus:!1}))}),e.addEventListener("keydown",ct),re.add(e))}var N={init:dt,activate:U};function W(){let e=[...document.querySelectorAll(".nav-drawer .list-item")],t=document.querySelector("[data-docs-current-section]");if(!e.length)return;let a=i=>{e.forEach(o=>{var s;let l=o.querySelector(".list-action"),c=(l==null?void 0:l.getAttribute("href"))===`#${i}`;o.classList.toggle("list-item-active",c),c&&t&&(t.textContent=((s=l.querySelector(".list-label"))==null?void 0:s.textContent.trim())||i)})},n=()=>{var o;let i=(o=window.location.hash)==null?void 0:o.slice(1);i&&a(i)};window.addEventListener("hashchange",n),n()}function me(e){let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","readonly"),t.style.position="fixed",t.style.opacity="0",document.body.append(t),t.select(),document.execCommand("copy"),t.remove()}function h(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ut(e){var l;let t=e.textContent,a=/\/\/.*$|\/\*[\s\S]*?\*\/|`(?:\\[\s\S]|[^`\\])*`|'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|\b(?:async|await|break|case|catch|class|const|continue|default|do|else|export|for|from|function|if|import|let|new|null|return|switch|throw|try|var|while)\b|\b\d+(?:\.\d+)?\b|\b[A-Za-z_$][\w$]*(?=\s*\()/gm,n="",i=0,o;for(;(o=a.exec(t))!==null;){let c=o[0];if(n+=h(t.slice(i,o.index)),c.startsWith("//")||c.startsWith("/*"))n+=`<span class="hljs-comment">${h(c)}</span>`;else if(c.startsWith('"')||c.startsWith("'")||c.startsWith("`"))n+=`<span class="hljs-string">${h(c)}</span>`;else if(/^\d/.test(c))n+=`<span class="hljs-number">${h(c)}</span>`;else if(/^[A-Za-z_$][\w$]*$/.test(c)&&((l=t[o.index+c.length])!=null&&l.match(/\s|\(/))){let s=/^(async|await|break|case|catch|class|const|continue|default|do|else|export|for|from|function|if|import|let|new|null|return|switch|throw|try|var|while)$/.test(c);n+=s?`<span class="hljs-keyword">${c}</span>`:`<span class="hljs-title function_">${c}</span>`}else n+=h(c);i=o.index+c.length}n+=h(t.slice(i)),e.innerHTML=n,e.classList.add("hljs")}function ft(){document.querySelectorAll("code.language-js, code.language-javascript").forEach(ut),window.hljs&&document.querySelectorAll("code:not(.language-js):not(.language-javascript)").forEach(e=>window.hljs.highlightElement(e))}function P(){ft(),document.querySelectorAll(".code-example .btn-icon").forEach(e=>{e.addEventListener("click",async()=>{var o,l;let t=e.closest(".code-example"),a=t==null?void 0:t.querySelector("code"),n=(o=a==null?void 0:a.textContent)!=null?o:"",i=e.innerHTML;if(n){try{(l=navigator.clipboard)!=null&&l.writeText?await navigator.clipboard.writeText(n):me(n)}catch(c){me(n)}e.innerHTML='<i class="ph ph-check"></i>',setTimeout(()=>{e.innerHTML=i},1200)}})})}var z={Helper:m,Toasts:C,Modals:g,advancedSelect:b,editableString:E,confirmPopup:S,Drawer:O,NavigationShell:x,Overlays:A,InputPatterns:$,Accordion:q,Tabs:N};window.GNexusUIKit=z;Object.assign(window,z);document.addEventListener("DOMContentLoaded",()=>{A.init(),x.init(),$.init(),q.init(),N.init(),W(),P()});var mt=z;return be(pt);})();
//# sourceMappingURL=gnexus-ui-kit.js.map