diff --git a/ui/dist/assets/index.4a3e19b9.js b/ui/dist/assets/index.a335f39f.js similarity index 99% rename from ui/dist/assets/index.4a3e19b9.js rename to ui/dist/assets/index.a335f39f.js index d1c32af..0fa3277 100644 --- a/ui/dist/assets/index.4a3e19b9.js +++ b/ui/dist/assets/index.a335f39f.js @@ -793,4 +793,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ba=60103,Ha=60106,Ar=60107,Nr=60108,Tr=60114,Rr=60109,Dr=60110,Mr=60112,Lr=60113,yo=60120,$r=60115,Fr=60116,Uu=60121,Bu=60122,Hu=60117,Vu=60129,Wu=60131;if(typeof Symbol=="function"&&Symbol.for){var je=Symbol.for;Ba=je("react.element"),Ha=je("react.portal"),Ar=je("react.fragment"),Nr=je("react.strict_mode"),Tr=je("react.profiler"),Rr=je("react.provider"),Dr=je("react.context"),Mr=je("react.forward_ref"),Lr=je("react.suspense"),yo=je("react.suspense_list"),$r=je("react.memo"),Fr=je("react.lazy"),Uu=je("react.block"),Bu=je("react.server.block"),Hu=je("react.fundamental"),Vu=je("react.debug_trace_mode"),Wu=je("react.legacy_hidden")}function bt(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Ba:switch(e=e.type,e){case Ar:case Tr:case Nr:case Lr:case yo:return e;default:switch(e=e&&e.$$typeof,e){case Dr:case Mr:case Fr:case $r:case Rr:return e;default:return t}}case Ha:return t}}}var pv=Rr,gv=Ba,vv=Mr,bv=Ar,yv=Fr,_v=$r,wv=Ha,Sv=Tr,xv=Nr,Iv=Lr;ve.ContextConsumer=Dr;ve.ContextProvider=pv;ve.Element=gv;ve.ForwardRef=vv;ve.Fragment=bv;ve.Lazy=yv;ve.Memo=_v;ve.Portal=wv;ve.Profiler=Sv;ve.StrictMode=xv;ve.Suspense=Iv;ve.isAsyncMode=function(){return!1};ve.isConcurrentMode=function(){return!1};ve.isContextConsumer=function(e){return bt(e)===Dr};ve.isContextProvider=function(e){return bt(e)===Rr};ve.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ba};ve.isForwardRef=function(e){return bt(e)===Mr};ve.isFragment=function(e){return bt(e)===Ar};ve.isLazy=function(e){return bt(e)===Fr};ve.isMemo=function(e){return bt(e)===$r};ve.isPortal=function(e){return bt(e)===Ha};ve.isProfiler=function(e){return bt(e)===Tr};ve.isStrictMode=function(e){return bt(e)===Nr};ve.isSuspense=function(e){return bt(e)===Lr};ve.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Ar||e===Tr||e===Vu||e===Nr||e===Lr||e===yo||e===Wu||typeof e=="object"&&e!==null&&(e.$$typeof===Fr||e.$$typeof===$r||e.$$typeof===Rr||e.$$typeof===Dr||e.$$typeof===Mr||e.$$typeof===Hu||e.$$typeof===Uu||e[0]===Bu)};ve.typeOf=bt;(function(e){e.exports=ve})(mv);let ml=e=>typeof e=="object"&&e!=null&&e.nodeType===1,pl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",li=(e,t)=>{if(e.clientHeight{let a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeightit||i>e&&o=t&&l>=n?i-e-r:o>t&&ln?o-t+a:0,Cv=e=>{let t=e.parentElement;return t==null?e.getRootNode().host||null:t};var kv=(e,t)=>{var n,r,a,i,o,l;if(typeof document>"u")return[];let{scrollMode:c,block:d,inline:u,boundary:f,skipOverflowHiddenElements:m}=t,p=typeof f=="function"?f:ce=>ce!==f;if(!ml(e))throw new TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,v=[],h=e;for(;ml(h)&&p(h);){if(h=Cv(h),h===g){v.push(h);break}h!=null&&h===document.body&&li(h)&&!li(document.documentElement)||h!=null&&li(h,m)&&v.push(h)}let y=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,S=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,_=(o=window.scrollX)!=null?o:pageXOffset,k=(l=window.scrollY)!=null?l:pageYOffset,{height:N,width:T,top:E,right:A,bottom:K,left:re}=e.getBoundingClientRect(),fe=d==="start"||d==="nearest"?E:d==="end"?K:E+N/2,ie=u==="center"?re+T/2:u==="end"?A:re,Ee=[];for(let ce=0;ce=0&&re>=0&&K<=S&&A<=y&&E>=H&&K<=me&&re>=Ce&&A<=he)return Ee;let M=getComputedStyle(te),F=parseInt(M.borderLeftWidth,10),O=parseInt(M.borderTopWidth,10),R=parseInt(M.borderRightWidth,10),V=parseInt(M.borderBottomWidth,10),w=0,P=0,W="offsetWidth"in te?te.offsetWidth-te.clientWidth-F-R:0,q="offsetHeight"in te?te.offsetHeight-te.clientHeight-O-V:0,we="offsetWidth"in te?te.offsetWidth===0?0:Ue/te.offsetWidth:0,ke="offsetHeight"in te?te.offsetHeight===0?0:Pe/te.offsetHeight:0;if(g===te)w=d==="start"?fe:d==="end"?fe-S:d==="nearest"?Xr(k,k+S,S,O,V,k+fe,k+fe+N,N):fe-S/2,P=u==="start"?ie:u==="center"?ie-y/2:u==="end"?ie-y:Xr(_,_+y,y,F,R,_+ie,_+ie+T,T),w=Math.max(0,w+k),P=Math.max(0,P+_);else{w=d==="start"?fe-H-O:d==="end"?fe-me+V+q:d==="nearest"?Xr(H,me,Pe,O,V+q,fe,fe+N,N):fe-(H+Pe/2)+q/2,P=u==="start"?ie-Ce-F:u==="center"?ie-(Ce+Ue/2)+W/2:u==="end"?ie-he+R+W:Xr(Ce,he,Ue,F,R+W,ie,ie+T,T);let{scrollLeft:Ae,scrollTop:be}=te;w=Math.max(0,Math.min(be+w/ke,te.scrollHeight-Pe/ke+q)),P=Math.max(0,Math.min(Ae+P/we,te.scrollWidth-Ue/we+W)),fe+=be-w,ie+=Ae-P}Ee.push({el:te,top:w,left:P})}return Ee},ya=function(){return ya=Object.assign||function(t){for(var n,r=1,a=arguments.length;r1?a-1:0),o=1;o=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Bt(e,t,n,r,a){if(a===void 0&&(a=!0),n===0)return-1;var i=n-1;(typeof t!="number"||t<0||t>=n)&&(t=e>0?-1:i+1);var o=t+e;o<0?o=a?i:0:o>i&&(o=a?0:i);var l=sn(e,o,n,r,a);return l===-1?t>=n?-1:t:l}function sn(e,t,n,r,a){var i=r(t);if(!i||!i.hasAttribute("disabled"))return t;if(e>0){for(var o=t+1;o=0;l--)if(!r(l).hasAttribute("disabled"))return l;return a?e>0?sn(1,0,n,r,!1):sn(-1,n-1,n,r,!1):-1}function vl(e,t,n,r){return r===void 0&&(r=!0),t.some(function(a){return a&&(gl(a,e,n)||r&&gl(a,n.document.activeElement,n))})}var Nv=_o(function(e){Gu(e).textContent=""},500);function Tv(e,t){var n=Gu(t);!e||(n.textContent=e,Nv(t))}function Gu(e){e===void 0&&(e=document);var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var Rv=["isInitialMount","highlightedIndex","items","environment"],Yu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Dv(e,t,n){var r=e.props,a=e.type,i={};Object.keys(t).forEach(function(o){Mv(o,e,t,n),n[o]!==t[o]&&(i[o]=n[o])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(se({type:a},i))}function Mv(e,t,n,r){var a=t.props,i=t.type,o="on"+wo(e)+"Change";a[o]&&r[e]!==void 0&&r[e]!==n[e]&&a[o](se({type:i},r))}function Lv(e,t){return t.changes}function $v(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""}var Fv=_o(function(e,t){Tv(e(),t)},200),jv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Bn:ee;function Ju(e){var t=e.id,n=t===void 0?"downshift-"+Pv():t,r=e.labelId,a=e.menuId,i=e.getItemId,o=e.toggleButtonId,l=e.inputId,c=Ie({labelId:r||n+"-label",menuId:a||n+"-menu",getItemId:i||function(d){return n+"-item-"+d},toggleButtonId:o||n+"-toggle-button",inputId:l||n+"-input"});return c.current}function Xu(e,t,n,r){var a,i;if(e===void 0){if(t===void 0)throw new Error(r);a=n[t],i=t}else i=t===void 0?n.indexOf(e):t,a=e;return[a,i]}function Uv(e){return e?String(e):""}function Bv(e){return/^\S{1}$/.test(e)}function wo(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function So(e){var t=Ie(e);return t.current=e,t}function Zu(e,t,n){var r=Ie(),a=Ie(),i=oe(function(m,p){a.current=p,m=_a(m,p.props);var g=e(m,p),v=p.props.stateReducer(m,se({},p,{changes:g}));return v},[e]),o=Na(i,t),l=o[0],c=o[1],d=So(n),u=oe(function(m){return c(se({props:d.current},m))},[d]),f=a.current;return ee(function(){f&&r.current&&r.current!==l&&Dv(f,_a(r.current,f.props),l),r.current=l},[l,n,f]),[l,u]}function Hv(e,t,n){var r=Zu(e,t,n),a=r[0],i=r[1];return[_a(a,n),i]}var ir={itemToString:Uv,stateReducer:Lv,getA11ySelectionMessage:$v,scrollIntoView:Ev,environment:typeof window>"u"?{}:window};function tt(e,t,n){n===void 0&&(n=Yu);var r=e["default"+wo(t)];return r!==void 0?r:n[t]}function Zr(e,t,n){n===void 0&&(n=Yu);var r=e[t];if(r!==void 0)return r;var a=e["initial"+wo(t)];return a!==void 0?a:tt(e,t,n)}function Qu(e){var t=Zr(e,"selectedItem"),n=Zr(e,"isOpen"),r=Zr(e,"highlightedIndex"),a=Zr(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.indexOf(t):r,isOpen:n,selectedItem:t,inputValue:a}}function nn(e,t,n){var r=e.items,a=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,o=t.selectedItem,l=t.highlightedIndex;return r.length===0?-1:a!==void 0&&l===a?a:i!==void 0?i:o?r.indexOf(o):n===0?-1:n<0?r.length-1:0}function ed(e,t,n,r){var a=Ie({isMouseDown:!1,isTouchMove:!1});return ee(function(){if((n==null?void 0:n.addEventListener)!=null){var i=function(){a.current.isMouseDown=!0},o=function(f){a.current.isMouseDown=!1,e&&!vl(f.target,t.map(function(m){return m.current}),n)&&r()},l=function(){a.current.isTouchMove=!1},c=function(){a.current.isTouchMove=!0},d=function(f){e&&!a.current.isTouchMove&&!vl(f.target,t.map(function(m){return m.current}),n,!1)&&r()};return n.addEventListener("mousedown",i),n.addEventListener("mouseup",o),n.addEventListener("touchstart",l),n.addEventListener("touchmove",c),n.addEventListener("touchend",d),function(){n.removeEventListener("mousedown",i),n.removeEventListener("mouseup",o),n.removeEventListener("touchstart",l),n.removeEventListener("touchmove",c),n.removeEventListener("touchend",d)}}},[e,n]),a}var td=function(){return Ku};function wa(e,t,n){var r=n.isInitialMount,a=n.highlightedIndex,i=n.items,o=n.environment,l=Ut(n,Rv);ee(function(){r||Fv(function(){return e(se({highlightedIndex:a,highlightedItem:i[a],resultCount:i.length},l))},o.document)},t)}function nd(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,a=e.getItemNodeFromIndex,i=e.menuElement,o=e.scrollIntoView,l=Ie(!0);return jv(function(){t<0||!n||!Object.keys(r.current).length||(l.current===!1?l.current=!0:o(a(t),i))},[t]),l}var rd=Ku;function Sa(e,t,n){var r;n===void 0&&(n=!0);var a=((r=e.items)==null?void 0:r.length)&&t>=0;return se({isOpen:!1,highlightedIndex:-1},a&&se({selectedItem:e.items[t],isOpen:tt(e,"isOpen"),highlightedIndex:tt(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function ad(e,t,n){var r=t.type,a=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:nn(a,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:nn(a,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:tt(a,"highlightedIndex"),isOpen:tt(a,"isOpen"),selectedItem:tt(a,"selectedItem"),inputValue:tt(a,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return se({},e,i)}function Vv(e){for(var t=e.keysSoFar,n=e.highlightedIndex,r=e.items,a=e.itemToString,i=e.getItemNodeFromIndex,o=t.toLowerCase(),l=0;l=0&&((n=a.items)==null?void 0:n.length)&&{selectedItem:a.items[e.highlightedIndex]});break;case Ro:o={selectedItem:t.selectedItem};break;default:return ad(e,t,fd)}return se({},e,o)}var qv=["onMouseLeave","refKey","onKeyDown","onBlur","ref"],Gv=["onBlur","onClick","onPress","onKeyDown","refKey","ref"],Yv=["item","index","onMouseMove","onClick","onPress","refKey","ref","disabled"];hd.stateChangeTypes=fd;function hd(e){e===void 0&&(e={});var t=se({},Kv,e),n=t.items,r=t.scrollIntoView,a=t.environment,i=t.itemToString,o=t.getA11ySelectionMessage,l=t.getA11yStatusMessage,c=Qu(t),d=Hv(zv,c,t),u=d[0],f=d[1],m=u.isOpen,p=u.highlightedIndex,g=u.selectedItem,v=u.inputValue,h=Ie(null),y=Ie(null),S=Ie({}),_=Ie(null),k=Ju(t),N=Ie(),T=Ie(!0),E=So({state:u,props:t}),A=oe(function(O){return S.current[k.getItemId(O)]},[k]);wa(l,[m,p,v,n],se({isInitialMount:T.current,previousResultCount:N.current,items:n,environment:a,itemToString:i},u)),wa(o,[g],se({isInitialMount:T.current,previousResultCount:N.current,items:n,environment:a,itemToString:i},u));var K=nd({menuElement:y.current,highlightedIndex:p,isOpen:m,itemRefs:S,scrollIntoView:r,getItemNodeFromIndex:A});ee(function(){return _.current=_o(function(O){O({type:$i,inputValue:""})},500),function(){_.current.cancel()}},[]),ee(function(){!v||_.current(f)},[f,v]),rd({isInitialMount:T.current,props:t,state:u}),ee(function(){T.current||(N.current=n.length)});var re=ed(m,[y,h],a,function(){f({type:Ia})}),fe=td();ee(function(){return T.current=!1,function(){T.current=!0}},[]),ee(function(){m||(S.current={})},[m]);var ie=rt(function(){return{ArrowDown:function(R){R.preventDefault(),f({type:xo,getItemNodeFromIndex:A,altKey:R.altKey})},ArrowUp:function(R){R.preventDefault(),f({type:Io,getItemNodeFromIndex:A,altKey:R.altKey})},Home:function(R){R.preventDefault(),f({type:ko,getItemNodeFromIndex:A})},End:function(R){R.preventDefault(),f({type:Oo,getItemNodeFromIndex:A})},Escape:function(){E.current.state.isOpen&&f({type:Co})},Enter:function(R){R.preventDefault(),f({type:E.current.state.isOpen?Eo:aa})},PageUp:function(R){E.current.state.isOpen&&(R.preventDefault(),f({type:Ao,getItemNodeFromIndex:A}))},PageDown:function(R){E.current.state.isOpen&&(R.preventDefault(),f({type:No,getItemNodeFromIndex:A}))}," ":function(R){R.preventDefault();var V=E.current.state;if(!V.isOpen){f({type:aa});return}V.inputValue?f({type:xa,key:" ",getItemNodeFromIndex:A}):f({type:Po})}}},[f,A,E]),Ee=oe(function(){f({type:sd})},[f]),ce=oe(function(){f({type:cd})},[f]),te=oe(function(){f({type:ld})},[f]),Pe=oe(function(O){f({type:ud,highlightedIndex:O})},[f]),Ue=oe(function(O){f({type:Ro,selectedItem:O})},[f]),H=oe(function(){f({type:dd})},[f]),he=oe(function(O){f({type:$i,inputValue:O})},[f]),me=oe(function(O){return se({id:k.labelId,htmlFor:k.toggleButtonId},O)},[k]),Ce=oe(function(O,R){var V,w=O===void 0?{}:O,P=w.onMouseLeave,W=w.refKey,q=W===void 0?"ref":W;w.onKeyDown,w.onBlur;var we=w.ref,ke=Ut(w,qv),Ae=R===void 0?{}:R;Ae.suppressRefError;var be=function(){f({type:id})};return se((V={},V[q]=en(we,function(Te){y.current=Te}),V.id=k.menuId,V.role="listbox",V["aria-labelledby"]=ke&&ke["aria-label"]?void 0:""+k.labelId,V.onMouseLeave=qe(P,be),V),ke)},[f,fe,k]),M=oe(function(O,R){var V,w=O===void 0?{}:O,P=w.onBlur,W=w.onClick;w.onPress;var q=w.onKeyDown,we=w.refKey,ke=we===void 0?"ref":we,Ae=w.ref,be=Ut(w,Gv),Te=R===void 0?{}:R;Te.suppressRefError;var Ne=E.current.state,We=function(){f({type:aa})},xt=function(){Ne.isOpen&&!re.current.isMouseDown&&f({type:Ia})},Be=function(Je){var Ke=qu(Je);Ke&&ie[Ke]?ie[Ke](Je):Bv(Ke)&&f({type:xa,key:Ke,getItemNodeFromIndex:A})},at=se((V={},V[ke]=en(Ae,function(pe){h.current=pe}),V["aria-activedescendant"]=Ne.isOpen&&Ne.highlightedIndex>-1?k.getItemId(Ne.highlightedIndex):"",V["aria-controls"]=k.menuId,V["aria-expanded"]=E.current.state.isOpen,V["aria-haspopup"]="listbox",V["aria-labelledby"]=be&&be["aria-label"]?void 0:""+k.labelId,V.id=k.toggleButtonId,V.role="combobox",V.tabIndex=0,V.onBlur=qe(P,xt),V),be);return be.disabled||(at.onClick=qe(W,We),at.onKeyDown=qe(q,Be)),at},[E,k,fe,f,re,ie,A]),F=oe(function(O){var R,V=O===void 0?{}:O,w=V.item,P=V.index,W=V.onMouseMove,q=V.onClick;V.onPress;var we=V.refKey,ke=we===void 0?"ref":we,Ae=V.ref,be=V.disabled,Te=Ut(V,Yv),Ne=E.current,We=Ne.state,xt=Ne.props,Be=Xu(w,P,xt.items,"Pass either item or index to getItemProps!"),at=Be[0],pe=Be[1],Je=function(){pe!==We.highlightedIndex&&(K.current=!1,f({type:od,index:pe,disabled:be}))},Ke=function(){f({type:To,index:pe})},it=se((R={disabled:be,role:"option","aria-selected":""+(at===g),id:k.getItemId(pe)},R[ke]=en(Ae,function(ze){ze&&(S.current[k.getItemId(pe)]=ze)}),R),Te);return be||(it.onClick=qe(q,Ke)),it.onMouseMove=qe(W,Je),it},[E,g,k,K,f]);return{getToggleButtonProps:M,getLabelProps:me,getMenuProps:Ce,getItemProps:F,toggleMenu:Ee,openMenu:te,closeMenu:ce,setHighlightedIndex:Pe,selectItem:Ue,reset:H,setInputValue:he,highlightedIndex:p,isOpen:m,selectedItem:g,inputValue:v}}var Do=0,Mo=1,Lo=2,$o=3,Fo=4,jo=5,Uo=6,Bo=7,Ho=8,Ca=9,Vo=10,md=11,pd=12,Wo=13,gd=14,vd=15,bd=16,yd=17,_d=18,Ko=19,wd=20,Sd=21,zo=22,xd=Object.freeze({__proto__:null,InputKeyDownArrowDown:Do,InputKeyDownArrowUp:Mo,InputKeyDownEscape:Lo,InputKeyDownHome:$o,InputKeyDownEnd:Fo,InputKeyDownPageUp:jo,InputKeyDownPageDown:Uo,InputKeyDownEnter:Bo,InputChange:Ho,InputBlur:Ca,InputFocus:Vo,MenuMouseLeave:md,ItemMouseMove:pd,ItemClick:Wo,ToggleButtonClick:gd,FunctionToggleMenu:vd,FunctionOpenMenu:bd,FunctionCloseMenu:yd,FunctionSetHighlightedIndex:_d,FunctionSelectItem:Ko,FunctionSetInputValue:wd,FunctionReset:Sd,ControlledPropUpdatedSelectedItem:zo});function Jv(e){var t=Qu(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),se({},t,{inputValue:r})}I.exports.array.isRequired,I.exports.func,I.exports.func,I.exports.func,I.exports.func,I.exports.number,I.exports.number,I.exports.number,I.exports.bool,I.exports.bool,I.exports.bool,I.exports.any,I.exports.any,I.exports.any,I.exports.string,I.exports.string,I.exports.string,I.exports.string,I.exports.string,I.exports.string,I.exports.func,I.exports.string,I.exports.string,I.exports.func,I.exports.func,I.exports.func,I.exports.func,I.exports.func,I.exports.func,I.exports.shape({addEventListener:I.exports.func,removeEventListener:I.exports.func,document:I.exports.shape({getElementById:I.exports.func,activeElement:I.exports.any,body:I.exports.any})});function Xv(e,t,n){var r=Ie(),a=Zu(e,t,n),i=a[0],o=a[1];return ee(function(){!zu(n,"selectedItem")||(n.selectedItemChanged(r.current,n.selectedItem)&&o({type:zo,inputValue:n.itemToString(n.selectedItem)}),r.current=i.selectedItem===r.current?n.selectedItem:i.selectedItem)},[i.selectedItem,n.selectedItem]),[_a(i,n),o]}var Zv=se({},ir,{selectedItemChanged:function(t,n){return t!==n},getA11yStatusMessage:Av});function Qv(e,t){var n,r=t.type,a=t.props,i=t.altKey,o;switch(r){case Wo:o={isOpen:tt(a,"isOpen"),highlightedIndex:tt(a,"highlightedIndex"),selectedItem:a.items[t.index],inputValue:a.itemToString(a.items[t.index])};break;case Do:e.isOpen?o={highlightedIndex:Bt(1,e.highlightedIndex,a.items.length,t.getItemNodeFromIndex,!0)}:o={highlightedIndex:i&&e.selectedItem==null?-1:nn(a,e,1,t.getItemNodeFromIndex),isOpen:a.items.length>=0};break;case Mo:e.isOpen?i?o=Sa(a,e.highlightedIndex):o={highlightedIndex:Bt(-1,e.highlightedIndex,a.items.length,t.getItemNodeFromIndex,!0)}:o={highlightedIndex:nn(a,e,-1,t.getItemNodeFromIndex),isOpen:a.items.length>=0};break;case Bo:o=Sa(a,e.highlightedIndex);break;case Lo:o=se({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case jo:o={highlightedIndex:Bt(-10,e.highlightedIndex,a.items.length,t.getItemNodeFromIndex,!1)};break;case Uo:o={highlightedIndex:Bt(10,e.highlightedIndex,a.items.length,t.getItemNodeFromIndex,!1)};break;case $o:o={highlightedIndex:sn(1,0,a.items.length,t.getItemNodeFromIndex,!1)};break;case Fo:o={highlightedIndex:sn(-1,a.items.length-1,a.items.length,t.getItemNodeFromIndex,!1)};break;case Ca:o=se({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=a.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:a.items[e.highlightedIndex],inputValue:a.itemToString(a.items[e.highlightedIndex])});break;case Ho:o={isOpen:!0,highlightedIndex:tt(a,"highlightedIndex"),inputValue:t.inputValue};break;case Vo:o={isOpen:!0,highlightedIndex:nn(a,e,0)};break;case Ko:o={selectedItem:t.selectedItem,inputValue:a.itemToString(t.selectedItem)};break;case zo:o={inputValue:t.inputValue};break;default:return ad(e,t,xd)}return se({},e,o)}var eb=["onMouseLeave","refKey","ref"],tb=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],nb=["onClick","onPress","refKey","ref"],rb=["onKeyDown","onChange","onInput","onFocus","onBlur","onChangeText","refKey","ref"];Id.stateChangeTypes=xd;function Id(e){e===void 0&&(e={});var t=se({},Zv,e),n=t.initialIsOpen,r=t.defaultIsOpen,a=t.items,i=t.scrollIntoView,o=t.environment,l=t.getA11yStatusMessage,c=t.getA11ySelectionMessage,d=t.itemToString,u=Jv(t),f=Xv(Qv,u,t),m=f[0],p=f[1],g=m.isOpen,v=m.highlightedIndex,h=m.selectedItem,y=m.inputValue,S=Ie(null),_=Ie({}),k=Ie(null),N=Ie(null),T=Ie(!0),E=Ju(t),A=Ie(),K=So({state:m,props:t}),re=oe(function(w){return _.current[E.getItemId(w)]},[E]);wa(l,[g,v,y,a],se({isInitialMount:T.current,previousResultCount:A.current,items:a,environment:o,itemToString:d},m)),wa(c,[h],se({isInitialMount:T.current,previousResultCount:A.current,items:a,environment:o,itemToString:d},m));var fe=nd({menuElement:S.current,highlightedIndex:v,isOpen:g,itemRefs:_,scrollIntoView:i,getItemNodeFromIndex:re});rd({isInitialMount:T.current,props:t,state:m}),ee(function(){var w=n||r||g;w&&k.current&&k.current.focus()},[]),ee(function(){T.current||(A.current=a.length)});var ie=ed(g,[k,S,N],o,function(){p({type:Ca,selectItem:!1})}),Ee=td();ee(function(){return T.current=!1,function(){T.current=!0}},[]),ee(function(){var w;if(!g)_.current={};else if(((w=o.document)==null?void 0:w.activeElement)!==k.current){var P;k==null||(P=k.current)==null||P.focus()}},[g,o]);var ce=rt(function(){return{ArrowDown:function(P){P.preventDefault(),p({type:Do,altKey:P.altKey,getItemNodeFromIndex:re})},ArrowUp:function(P){P.preventDefault(),p({type:Mo,altKey:P.altKey,getItemNodeFromIndex:re})},Home:function(P){!K.current.state.isOpen||(P.preventDefault(),p({type:$o,getItemNodeFromIndex:re}))},End:function(P){!K.current.state.isOpen||(P.preventDefault(),p({type:Fo,getItemNodeFromIndex:re}))},Escape:function(P){var W=K.current.state;(W.isOpen||W.inputValue||W.selectedItem||W.highlightedIndex>-1)&&(P.preventDefault(),p({type:Lo}))},Enter:function(P){var W=K.current.state;!W.isOpen||P.which===229||(P.preventDefault(),p({type:Bo,getItemNodeFromIndex:re}))},PageUp:function(P){K.current.state.isOpen&&(P.preventDefault(),p({type:jo,getItemNodeFromIndex:re}))},PageDown:function(P){K.current.state.isOpen&&(P.preventDefault(),p({type:Uo,getItemNodeFromIndex:re}))}}},[p,K,re]),te=oe(function(w){return se({id:E.labelId,htmlFor:E.inputId},w)},[E]),Pe=oe(function(w,P){var W,q=w===void 0?{}:w,we=q.onMouseLeave,ke=q.refKey,Ae=ke===void 0?"ref":ke,be=q.ref,Te=Ut(q,eb),Ne=P===void 0?{}:P;return Ne.suppressRefError,se((W={},W[Ae]=en(be,function(We){S.current=We}),W.id=E.menuId,W.role="listbox",W["aria-labelledby"]=Te&&Te["aria-label"]?void 0:""+E.labelId,W.onMouseLeave=qe(we,function(){p({type:md})}),W),Te)},[p,Ee,E]),Ue=oe(function(w){var P,W,q=w===void 0?{}:w,we=q.item,ke=q.index,Ae=q.refKey,be=Ae===void 0?"ref":Ae,Te=q.ref,Ne=q.onMouseMove,We=q.onMouseDown,xt=q.onClick;q.onPress;var Be=q.disabled,at=Ut(q,tb),pe=K.current,Je=pe.props,Ke=pe.state,it=Xu(we,ke,Je.items,"Pass either item or index to getItemProps!"),ze=it[1],Kn="onClick",Gt=xt,yt=function(){ze!==Ke.highlightedIndex&&(fe.current=!1,p({type:pd,index:ze,disabled:Be}))},b=function(){p({type:Wo,index:ze})},x=function($){return $.preventDefault()};return se((P={},P[be]=en(Te,function(C){C&&(_.current[E.getItemId(ze)]=C)}),P.disabled=Be,P.role="option",P["aria-selected"]=""+(ze===Ke.highlightedIndex),P.id=E.getItemId(ze),P),!Be&&(W={},W[Kn]=qe(Gt,b),W),{onMouseMove:qe(Ne,yt),onMouseDown:qe(We,x)},at)},[p,K,fe,E]),H=oe(function(w){var P,W=w===void 0?{}:w,q=W.onClick;W.onPress;var we=W.refKey,ke=we===void 0?"ref":we,Ae=W.ref,be=Ut(W,nb),Te=K.current.state,Ne=function(){p({type:gd})};return se((P={},P[ke]=en(Ae,function(We){N.current=We}),P["aria-controls"]=E.menuId,P["aria-expanded"]=Te.isOpen,P.id=E.toggleButtonId,P.tabIndex=-1,P),!be.disabled&&se({},{onClick:qe(q,Ne)}),be)},[p,K,E]),he=oe(function(w,P){var W,q=w===void 0?{}:w,we=q.onKeyDown,ke=q.onChange,Ae=q.onInput,be=q.onFocus,Te=q.onBlur;q.onChangeText;var Ne=q.refKey,We=Ne===void 0?"ref":Ne,xt=q.ref,Be=Ut(q,rb),at=P===void 0?{}:P;at.suppressRefError;var pe=K.current.state,Je=function(x){var C=qu(x);C&&ce[C]&&ce[C](x)},Ke=function(x){p({type:Ho,inputValue:x.target.value})},it=function(x){pe.isOpen&&!ie.current.isMouseDown&&p({type:Ca,selectItem:x.relatedTarget!==null})},ze=function(){pe.isOpen||p({type:Vo})},Kn="onChange",Gt={};if(!Be.disabled){var yt;Gt=(yt={},yt[Kn]=qe(ke,Ae,Ke),yt.onKeyDown=qe(we,Je),yt.onBlur=qe(Te,it),yt.onFocus=qe(be,ze),yt)}return se((W={},W[We]=en(xt,function(b){k.current=b}),W["aria-activedescendant"]=pe.isOpen&&pe.highlightedIndex>-1?E.getItemId(pe.highlightedIndex):"",W["aria-autocomplete"]="list",W["aria-controls"]=E.menuId,W["aria-expanded"]=pe.isOpen,W["aria-labelledby"]=Be&&Be["aria-label"]?void 0:""+E.labelId,W.autoComplete="off",W.id=E.inputId,W.role="combobox",W.value=pe.inputValue,W),Gt,Be)},[p,ce,K,ie,Ee,E]),me=oe(function(){p({type:vd})},[p]),Ce=oe(function(){p({type:yd})},[p]),M=oe(function(){p({type:bd})},[p]),F=oe(function(w){p({type:_d,highlightedIndex:w})},[p]),O=oe(function(w){p({type:Ko,selectedItem:w})},[p]),R=oe(function(w){p({type:wd,inputValue:w})},[p]),V=oe(function(){p({type:Sd})},[p]);return{getItemProps:Ue,getLabelProps:te,getMenuProps:Pe,getInputProps:he,getToggleButtonProps:H,toggleMenu:me,openMenu:M,closeMenu:Ce,setHighlightedIndex:F,setInputValue:R,selectItem:O,reset:V,highlightedIndex:v,isOpen:g,selectedItem:h,inputValue:y}}function ab(e){var t=e.removedSelectedItem,n=e.itemToString;return n(t)+" has been removed."}I.exports.array,I.exports.array,I.exports.array,I.exports.func,I.exports.func,I.exports.func,I.exports.number,I.exports.number,I.exports.number,I.exports.func,I.exports.func,I.exports.string,I.exports.string,I.exports.shape({addEventListener:I.exports.func,removeEventListener:I.exports.func,document:I.exports.shape({getElementById:I.exports.func,activeElement:I.exports.any,body:I.exports.any})});ir.itemToString,ir.stateReducer,ir.environment;var qo={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="fas",n="caret-up",r=320,a=512,i=[],o="f0d8",l="M182.6 137.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8H288c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z";e.definition={prefix:t,iconName:n,icon:[r,a,i,o,l]},e.faCaretUp=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=a,e.ligatures=i,e.unicode=o,e.svgPathData=l,e.aliases=i})(qo);function bl(e){return e?e.title:""}function ib(e,t){return e.map(n=>{var r;return n.title.toLowerCase().includes(t.toLowerCase())||((r=n.description)==null?void 0:r.toLowerCase().includes(t.toLowerCase()))?n:null})}function Go(e){var d;const{isOpen:t,selectedItem:n,getToggleButtonProps:r,getLabelProps:a,getMenuProps:i,highlightedIndex:o,getItemProps:l,inputValue:c}=hd({items:e.items,defaultSelectedItem:e.defaultValue,itemToString:bl});return ee(()=>{var u;(u=e.onSelectedItemChange)==null||u.call(e,n)},[n]),s("div",{class:"dialog-input-dropdown",children:[s("div",{className:"dialog-input-dropdown-dropdown",...r(),children:[s("label",{...a(),class:"dialog-input-dropdown-dropdown-text",children:n?bl(n):(d=e.selectText)!=null?d:"Select Item"}),s("span",{class:"dialog-input-dropdown-dropdown-icon",children:t?s(_e,{icon:qo.faCaretUp}):s(_e,{icon:Ma.faCaretDown})})]}),s("ul",{className:`dialog-input-dropdown-dropdown-items ${!t&&"dialog-input-dropdown-dropdown-items__hidden"}`,...i(),children:t&&ib(e.items,c).map((u,f)=>{var m;return u&&s("li",{className:`${o===f&&"dialog-input-dropdown-dropdown-item__highlighted"} ${n===u&&"dialog-input-dropdown-dropdown-item__selected"} dialog-input-dropdown-dropdown-item`,...l({item:u,index:f}),children:[s("span",{class:"dialog-input-dropdown-dropdown-item-name",children:u.title}),s("span",{className:"dialog-input-dropdown-dropdown-item-username",children:(m=u.description)!=null?m:""})]},`${u.value}${f}`)})})]})}function yl(e){return e.map(t=>({value:t.id,title:t.name}))}function Yo(e){var o,l,c;const t=Ye(),[n,r]=Q.useState(yl(e.environment?[e.environment]:[])),a=e.environment?{value:e.environment.id,title:e.environment.name}:null;ee(()=>{e.project&&L.collection("environment").getFullList(void 0,{filter:`project = "${e.project.id}"`}).then(d=>{r(yl(d))})},[e.project]);const i=d=>{d!==null&&t("./../"+d.value)};return s("div",{className:"navbar-links-breadcrumb",children:[e.team&&s(de,{children:s(Ze,{class:"breadcrumb-page",to:`/dashboard/${e.team.id}`,children:e.team.name})}),e.project&&s(de,{children:[s("div",{class:"breadcrumb-spacer",children:">"}),s(Ze,{class:"breadcrumb-page",to:`/dashboard/${(o=e.team)==null?void 0:o.id}/${e.project.id}`,children:e.project.name})]}),e.config&&s(de,{children:[s("div",{class:"breadcrumb-spacer",children:">"}),e.environment?s(Ze,{class:"breadcrumb-page",to:`/dashboard/${(l=e.team)==null?void 0:l.id}/${(c=e.project)==null?void 0:c.id}/${e.config.id}/${e.environment.id}`,children:e.config.name}):s("p",{children:e.config.name})]}),e.environment&&s(de,{children:[s("div",{class:"breadcrumb-spacer",children:">"}),s(Go,{items:n,defaultValue:a,onSelectedItemChange:i})]})]})}var jn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="fas",n="plus",r=448,a=512,i=[10133,61543,"add"],o="2b",l="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z";e.definition={prefix:t,iconName:n,icon:[r,a,i,o,l]},e.faPlus=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=a,e.ligatures=i,e.unicode=o,e.svgPathData=l,e.aliases=i})(jn);function ob(e){return s("div",{className:"dialog-overlay",onClick:e.onClick?e.onClick:()=>null,children:e.children})}function mt(e,t){const[n,r]=J(!1);ee(()=>{t!=null&&t.afterSetShowing&&t.afterSetShowing(n)},[n]);function a(i){i.target===i.currentTarget&&r(!1)}return[r,n?s(ob,{onClick:a,children:e}):null]}function At(e){return s("div",{className:"dialog",children:e.children})}function pt(e){return s("div",{className:"dialog-header",children:e.children})}function gt(e){var t;return s("div",{className:`dialog-body ${(t=e.class)!=null?t:""}`,children:e.children})}function vt(e){return s("div",{className:"dialog-footer",children:e.children})}function _l(e){return e?e.username:""}function sb(e,t){return e.map(n=>n.name.toLowerCase().includes(t.toLowerCase())||n.username.toLowerCase().includes(t.toLowerCase())?n:null)}function lb(e){const{isOpen:t,selectedItem:n,getToggleButtonProps:r,getLabelProps:a,getInputProps:i,getMenuProps:o,highlightedIndex:l,getItemProps:c,inputValue:d,reset:u}=Id({items:e.users,itemToString:_l});return ee(()=>{e.reset&&u()},[e.reset]),ee(()=>{var f;(f=e.onSelectedUserChange)==null||f.call(e,n)},[n]),s("div",{class:"dialog-input-dropdown",children:[s("div",{className:"dialog-input-dropdown-dropdown",...r(),children:[t?s("input",{...i(),class:"dialog-input-dropdown-dropdown-input",placeholder:"Search Users"}):s("label",{...a(),class:"dialog-input-dropdown-dropdown-text",children:n?_l(n):"Select User"}),s("span",{class:"dialog-input-dropdown-dropdown-icon",children:t?s(_e,{icon:qo.faCaretUp}):s(_e,{icon:Ma.faCaretDown})})]}),s("ul",{className:`dialog-input-dropdown-dropdown-items ${!t&&"dialog-input-dropdown-dropdown-items__hidden"}`,...o(),children:t&&sb(e.users,d).map((f,m)=>{var p;return f&&s("li",{className:`${l===m&&"dialog-input-dropdown-dropdown-item__highlighted"} ${n===f&&"dialog-input-dropdown-dropdown-item__selected"} dialog-input-dropdown-dropdown-item`,...c({item:f,index:m}),children:[s("span",{class:"dialog-input-dropdown-dropdown-item-name",children:f.username}),s("span",{className:"dialog-input-dropdown-dropdown-item-username",children:(p=f.name)!=null?p:""})]},`${f.value}${m}`)})})]})}const wl=[{value:"viewers",title:"Viewer",description:"Can view all flags and values but can't edit anything."},{value:"editors",title:"Editor",description:"Can manage, create and delete all flags and values."},{value:"admins",title:"Admin",description:"Can manage, create and delete all projects, configs, environments, flags and values."},{value:"owner",title:"Owner",description:"Owns this team and can change it in any way. Selecting this option will change the ownership of this team."}];function cb(){var R,V;const[e,t,n]=mn(),[r,a]=J(t),[i,o]=J(""),[l,c]=J(null),[d,u]=J(wl[0]),[f,m]=J(""),[p,g]=J(""),[v,h]=J(e),[y,S]=J(!1),[_,k]=J(!1),[N,T]=J(""),[E,A]=J(null),[K,re]=J("");function fe(w){k(!1),u(w)}function ie(w){k(!1),c(w)}const Ee=Ye();ee(()=>{h(e)},[e]),ee(()=>{a(t)},[t]);const[ce,te]=mt(s(At,{children:[s(pt,{children:s("h1",{class:"dialog-heading",children:["Delete ",N]})}),s(gt,{class:"dialog-form",children:s("p",{children:["Are you sure you want to remove the ",N," ",(R=E==null?void 0:E.username)!=null?R:E==null?void 0:E.name,"?"]})}),s(vt,{children:[s("button",{className:"dialog-action dialog-action__delete",onClick:()=>me(),children:"Remove"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>ce(!1),children:"Cancel"}),s("p",{class:"dialog-error",children:K})]})]}),{afterSetShowing:w=>{w||(T(""),A(null),re(""))}}),[Pe,Ue]=mt(s(At,{children:[s(pt,{children:s("h1",{class:"dialog-heading",children:"Create Team"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"Project Name:"}),s("input",{class:"dialog-input",value:i,onChange:w=>o(w==null?void 0:w.currentTarget.value),type:"text",placeholder:"Project Name"})]}),s(vt,{children:[s("button",{className:"dialog-action dialog-action__save",onClick:()=>O(),children:"Create"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>Pe(!1),children:"Cancel"}),s("p",{class:"dialog-error",children:f})]})]}),{afterSetShowing:w=>{w||o("")}}),[H,he]=mt(s(At,{children:[s(pt,{children:s("h1",{class:"dialog-heading",children:"Add User"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"User:"}),s(lb,{users:n,onSelectedUserChange:ie,reset:y}),s("label",{class:"dialog-input-label",children:"Role:"}),s(Go,{items:wl,onSelectedItemChange:fe,defaultValue:d})]}),s(vt,{children:[s("button",{className:"dialog-action "+((d==null?void 0:d.value)==="owner"?" dialog-action__delete":" dialog-action__save"),onClick:()=>F(),children:(d==null?void 0:d.value)==="owner"?"Transfer Ownership":"Add Member"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>H(!1),children:"Cancel"}),s("p",{class:"dialog-error",children:p})]})]}),{afterSetShowing:w=>{w?S(!1):(ie(null),S(!0),k(!1))}}),me=async()=>{E!==null&&N!==""&&(N==="project"&&L.collection("project").delete(E.id).then(()=>{a(r.filter(w=>w.id!==E.id)),ce(!1)}).catch(w=>{re(w.message)}),N==="user"&&L.collection("team").update(v.id,{admins:v.admins.filter(w=>w!==E.id),editors:v.editors.filter(w=>w!==E.id),viewers:v.viewers.filter(w=>w!==E.id)}).then(()=>{h(w=>(w.admins=w.admins.filter(P=>P!==E.id),w.editors=w.editors.filter(P=>P!==E.id),w.viewers=w.viewers.filter(P=>P!==E.id),w.expand.admins&&(w.expand.admins=w.expand.admins.filter(P=>P.id!==E.id)),w.expand.editors&&(w.expand.editors=w.expand.editors.filter(P=>P.id!==E.id)),w.expand.viewers&&(w.expand.viewers=w.expand.viewers.filter(P=>P.id!==E.id)),w)),ce(!1)}).catch(w=>{re(w.message)}))},Ce=(w,P)=>{w.stopPropagation(),T("user"),A(P),ce(!0)},M=(w,P)=>{w.stopPropagation(),T("project"),A(P),ce(!0)},F=()=>{if(l===null){g("Please select a user to add"),setTimeout(()=>g(""),5e3);return}if((d==null?void 0:d.value)==="owner"){if(!_){g("Please click again to confirm that you want to transfer ownership"),setTimeout(()=>g(""),5e3),k(!0);return}}else k(!1);if((d==null?void 0:d.value)==="owner"&&v.owner===l.id){g("User is already the owner of the team"),setTimeout(()=>g(""),5e3);return}if(d===null){g("Please select a role for the user"),setTimeout(()=>g(""),5e3);return}if(v.owner===l.id){g("User is already in the team"),setTimeout(()=>g(""),5e3);return}if(v.admins.includes(l.id)){g("User is already in the team"),setTimeout(()=>g(""),5e3);return}if(v.editors.includes(l.id)){g("User is already in the team"),setTimeout(()=>g(""),5e3);return}if(v.viewers.includes(l.id)){g("User is already in the team"),setTimeout(()=>g(""),5e3);return}let w={[d.value]:[...v[d.value],l.id]};d.value==="owner"&&(w={...w,owner:l.id}),L.collection("team").update(v.id,w).then(()=>{const P={...l};h(W=>{let q={...W};return d.value==="owner"?q.owner=P.id:(q[d.value].push(P.id),q.expand[d.value]&&q.expand[d.value].push(P)),q}),H(!1)}).catch(P=>{g("Error adding user to team: "+P),setTimeout(()=>g(""),5e3)})},O=()=>{L.collection("project").create({name:i,team:v.id}).then(w=>{a([...r,w]),o(""),Pe(!1)}).catch(w=>{m("Error creating project: "+w),setTimeout(()=>m(""),5e3)})};return s(de,{children:[s(Wn,{children:s(Yo,{team:v})}),s(Ge,{pageName:"dashboard",children:[s(gr,{children:[s(vr,{children:"Projects"}),s(br,{children:[r.map(w=>s(ht,{onClick:()=>Ee(`./${w.id}`),children:s(ut,{children:[s(dt,{children:s(Fn,{value:w.name})}),s(ft,{children:w.name}),s(mr,{children:s(pr,{onClick:P=>M(P,w),children:s(_e,{icon:on.faTrash})})})]})})),s(ht,{onClick:()=>Pe(!0),children:s(ut,{children:[s(dt,{children:s(_e,{icon:jn.faPlus})}),s(ft,{children:"New Project"})]})})]})]}),v.owner===((V=L.authStore.model)==null?void 0:V.id)&&s(gr,{children:[s(vr,{children:"Members"}),s(br,{children:[s(Jr,{title:"Owner",expand:v.expand.owner,onUserDelete:Ce}),s(Jr,{title:"Admin",expand:v.expand.admins,onUserDelete:Ce}),s(Jr,{title:"Editor",expand:v.expand.editors,onUserDelete:Ce}),s(Jr,{title:"Viewer",expand:v.expand.viewers,onUserDelete:Ce}),s(ht,{onClick:()=>H(!0),children:[s(ut,{children:[s(dt,{children:s(_e,{icon:jn.faPlus})}),s(ft,{children:"Add Member"})]}),s(Mi,{children:s("p",{children:"Also allows transfer of ownership."})})]})]})]})]}),Ue,he,te]})}function ub({params:e}){return Promise.all([L.collection("team").getOne(e.team,{expand:"owner,admins,editors,viewers"}),L.collection("project").getFullList(void 0,{filter:`team = "${e.team}"`}),L.collection("users").getFullList()])}function db(){const[e,t,n,r]=mn(),a=Ye(),[i,o]=J([]),[l,c]=J([]),[d,u]=J(""),[f,m]=J(""),[p,g]=J(""),[v,h]=J(""),[y,S]=J(""),[_,k]=J(null),[N,T]=J("");ee(()=>{o(n)},[n]),ee(()=>{c(r)},[r]);const E=()=>{if(d.length===0){g("Error: Config name cannot be empty."),setTimeout(()=>g(""),5e3);return}L.collection("config").create({name:d,project:t.id}).then(H=>{o(he=>[...he,H]),ie(!1)}).catch(H=>{console.error(H),g("Error: Could not create config."),setTimeout(()=>g(""),5e3)})},A=()=>{if(f.length===0){h("Error: Environment name cannot be empty."),setTimeout(()=>h(""),5e3);return}L.collection("environment").create({name:f,project:t.id}).then(H=>{c(he=>[...he,H]),ce(!1)}).catch(H=>{console.error(H),h("Error: Could not create environment."),setTimeout(()=>h(""),5e3)})},[K,re]=mt(s(At,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:["Delete ",y]})}),s(gt,{class:"dialog-form",children:s("p",{children:["Are you sure you want to delete the ",y," ",_==null?void 0:_.name,"?"]})}),s(vt,{children:[s("button",{class:"dialog-action dialog-action__delete",onClick:()=>fe(),children:"Delete"}),s("button",{class:"dialog-action dialog-action__cancel",onClick:()=>K(!1),children:"Cancel"}),s("p",{className:"dialog-error",children:N})]})]}),{afterSetShowing:H=>{H||(S(""),k(null),T(""))}}),fe=()=>{if(_===null){T("Error: Could not delete object.");return}y==="config"?L.collection("config").delete(_==null?void 0:_.id).then(()=>{o(H=>H.filter(he=>he.id!==(_==null?void 0:_.id))),K(!1)}).catch(H=>{console.error(H),T("Error: Could not delete config."),setTimeout(()=>T(""),5e3)}):y==="environment"&&L.collection("environment").delete(_==null?void 0:_.id).then(()=>{c(H=>H.filter(he=>he.id!==(_==null?void 0:_.id))),K(!1)}).catch(H=>{console.error(H),T("Error: Could not delete environment."),setTimeout(()=>T(""),5e3)})},[ie,Ee]=mt(s(At,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:"Create Config"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"Config Name:"}),s("input",{type:"text",class:"dialog-input",value:d,placeholder:"Config Name",onInput:H=>u(H.currentTarget.value)})]}),s(vt,{children:[s("button",{class:"dialog-action dialog-action__save",onClick:()=>E(),children:"Create"}),s("button",{class:"dialog-action dialog-action__cancel",onClick:()=>ie(!1),children:"Cancel"}),s("p",{className:"dialog-error",children:p})]})]}),{afterSetShowing:H=>{H||(u(""),g(""))}}),[ce,te]=mt(s(At,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:"Create Environment"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"Environment Name:"}),s("input",{type:"text",class:"dialog-input",value:f,placeholder:"Environment Name",onInput:H=>m(H.currentTarget.value)})]}),s(vt,{children:[s("button",{class:"dialog-action dialog-action__save",onClick:()=>A(),children:"Create"}),s("button",{class:"dialog-action dialog-action__cancel",onClick:()=>ce(!1),children:"Cancel"}),s("p",{className:"dialog-error",children:v})]})]}),{afterSetShowing:H=>{H||(m(""),h(""))}}),Pe=(H,he)=>{H.stopPropagation(),S("config"),k(he),K(!0)},Ue=(H,he)=>{H.stopPropagation(),S("environment"),k(he),K(!0)};return s(de,{children:[s(Wn,{children:s(Yo,{team:e,project:t})}),s(Ge,{pageName:"dashboard",children:[s(gr,{children:[s(vr,{children:"Environments"}),s(br,{children:[l.map(H=>s(ht,{children:s(ut,{children:[s(dt,{children:s(Fn,{value:H.name})}),s(ft,{children:H.name}),s(mr,{children:s(pr,{onClick:he=>Ue(he,H),children:s(_e,{icon:on.faTrash})})})]})})),s(ht,{onClick:()=>ce(!0),children:s(ut,{children:[s(dt,{children:s(_e,{icon:jn.faPlus})}),s(ft,{children:"New Environment"})]})})]})]}),s(gr,{children:[s(vr,{children:"Configs"}),s(br,{children:[i.map(H=>s(ht,{onClick:()=>l.length===0?a(`./${H.id}`):a(`./${H.id}/${l[0].id}`),children:s(ut,{children:[s(dt,{children:s(Fn,{value:H.name})}),s(ft,{children:H.name}),s(mr,{children:s(pr,{onClick:he=>Pe(he,H),children:s(_e,{icon:on.faTrash})})})]})})),s(ht,{onClick:()=>ie(!0),children:s(ut,{children:[s(dt,{children:s(_e,{icon:jn.faPlus})}),s(ft,{children:"New Config"})]})})]})]})]}),Ee,te,re]})}function fb({params:e}){return Promise.all([L.collection("team").getOne(e.team),L.collection("project").getOne(e.project,{}),L.collection("config").getFullList(void 0,{filter:`project = "${e.project}"`}),L.collection("environment").getFullList(void 0,{filter:`project = "${e.project}"`})])}const hb=[{value:"boolean",title:"Boolean",description:"True or false"},{value:"string",title:"String",description:"A string of text"},{value:"number",title:"Number",description:"A number"},{value:"json",title:"JSON",description:"A JSON object"},{value:"array",title:"Array",description:"A JSON array of values"}];function mb(e){switch(e){case"boolean":return"checkbox";case"string":return"text";case"number":return"number";case"json":return"text";case"array":return"text";default:return"text"}}var Cd={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="fas",n="up-right-and-down-left-from-center",r=512,a=512,i=["expand-alt"],o="f424",l="M344 0H488c13.3 0 24 10.7 24 24V168c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39-87 87c-9.4 9.4-24.6 9.4-33.9 0l-32-32c-9.4-9.4-9.4-24.6 0-33.9l87-87L327 41c-6.9-6.9-8.9-17.2-5.2-26.2S334.3 0 344 0zM168 512H24c-13.3 0-24-10.7-24-24V344c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l39 39 87-87c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8z";e.definition={prefix:t,iconName:n,icon:[r,a,i,o,l]},e.faUpRightAndDownLeftFromCenter=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=a,e.ligatures=i,e.unicode=o,e.svgPathData=l,e.aliases=i})(Cd);function Sl(e){return s("div",{className:"dialog dialog__wide",children:e.children})}function pb(e){const[t,n]=J(null),{flag:r,originalValue:a,value:i,setValue:o,saveValue:l}=e;function c(_){let k={...e.value};k.value=_,o(k)}const[d,u]=mt(s(Sl,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:["Update ",r.name," Value"]})}),s(gt,{children:s("textarea",{className:"dialog-input-large",value:i.value,onInput:_=>c(_.currentTarget.value)})}),s(vt,{children:s("button",{className:"dialog-action dialog-action__save",onClick:()=>d(!1),children:"Done"})})]})),[f,m]=mt(s(Sl,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:["Delete ",r.name,"?"]})}),s(gt,{children:s("p",{children:["Are you sure you want to delete the flag ",r.name,"? This action cannot be undone."]})}),s(vt,{children:[s("button",{className:"dialog-action dialog-action__delete",onClick:_=>e.onDelete(_,r),children:"Delete"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>f(!1),children:"Cancel"})]})]})),p=mb(r.type);let g;function v(){l(i).then(_=>{n(_),setTimeout(()=>n(null),5e3)})}let h=s("button",{onClick:()=>d(!0),className:"setting-card-button",title:"Expand Editor",children:s(_e,{icon:Cd.faUpRightAndDownLeftFromCenter})});switch(p){case"text":g=s("input",{type:p,value:i.value,class:"setting-card-value",onInput:_=>c(_.currentTarget.value)});break;case"number":g=s("input",{type:p,value:i.value,class:"setting-card-value",onInput:_=>c(_.currentTarget.value)}),h=null;break;case"checkbox":g=s("label",{className:"setting-card-value-switch",children:[s("input",{type:p,checked:i.value==="true",className:"setting-card-value",onClick:_=>c(_.currentTarget.checked?"true":"false")}),s("span",{className:"setting-card-value-slider"})]}),h=null;break}const y=_=>{_.preventDefault(),c(a.value)};function S(){return t===null?null:t[0]===1?s("p",{class:"setting-card-save-status-message",children:"Value saved successfully."}):t[0]===0?t[1].toString().startsWith("SyntaxError: JSON.parse")?s("p",{class:"setting-card-save-status-message",children:"JSON is not correctly formatted."}):s("p",{class:"setting-card-save-status-message",children:"Failed to save value."}):s("p",{class:"setting-card-save-status-message",children:t[1]})}return s("div",{class:"setting-card",children:[s("div",{class:"setting-card-header",children:[s("h3",{class:"setting-card-title",children:r.name}),s("p",{class:"setting-card-key",children:r.identifier})]}),s("div",{class:"setting-card-body",children:[g,h]}),s("div",{class:"setting-card-footer",children:[S(),s("button",{class:"setting-card-button",onClick:()=>f(!0),children:s(_e,{icon:on.faTrash})}),s("button",{class:"setting-card-button",onClick:y,disabled:a.value===i.value,children:"Reset"}),s("button",{class:"setting-card-button",onClick:v,disabled:a.value===i.value,children:"Save"})]}),u,m]})}function kd(){return s("div",{className:"dashboard-spacer"})}function gb(e){const[t,n]=J("go"),r={go:`let configDN = new ConfigDN("${e.apiKey}");`,javascript:`let configDN = new ConfigDN("${e.apiKey}");`};return s("div",{className:"api-info",children:[s("h1",{className:"api-info-title",children:"Accessing this config"}),s("div",{className:"api-info-key",children:[s("p",{className:"api-info-section-title",children:["API Key (",e.config,", ",e.environment," Environment)"]}),s("p",{className:"api-info-box",children:e.apiKey})]}),s("h2",{className:"api-info-section-title",children:"Integrations"}),s("div",{className:"language-buttons",children:[s("button",{className:`language-button ${t==="go"?"selected":""}`,onClick:()=>n("go"),children:"Go"}),s("button",{className:`language-button ${t==="javascript"?"selected":""}`,onClick:()=>n("javascript"),children:"JavaScript"})]}),s("div",{className:"api-info-box",children:s("pre",{children:r[t]})})]})}function Fi(e){return s("div",{className:"setting-buttons",children:e.children})}function or(e){return s("button",{class:`setting-buttons-button button__${e.type.toLowerCase().replaceAll(" ","-")}`,onClick:e.onClick?e.onClick:()=>null,children:e.type})}function vb(e){return s("div",{className:"setting-cards",children:e.children})}const bb=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"],yb=[..."0123456789"],_b=[..."CDEHKMPRTUWXY012458"],wb=[..."!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],Sb=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],xb=(e,t)=>e[t]+(e[t+1]<<8),Ib=(e,t,n)=>{const r=t.length,a=Math.floor(65536/r)*r-1,i=2*Math.ceil(1.1*e);let o="",l=0;for(;la)&&(o+=t[u%r],l++)}}return o},Cb=new Set([void 0,"hex","base64","url-safe","numeric","distinguishable","ascii-printable","alphanumeric"]),kb=(e,t,n)=>({length:r,type:a,characters:i})=>{if(!(r>=0&&Number.isFinite(r)))throw new TypeError("Expected a `length` to be a non-negative finite number");if(a!==void 0&&i!==void 0)throw new TypeError("Expected either `type` or `characters`");if(i!==void 0&&typeof i!="string")throw new TypeError("Expected `characters` to be string");if(!Cb.has(a))throw new TypeError(`Unknown type: ${a}`);if(a===void 0&&i===void 0&&(a="hex"),a==="hex"||a===void 0&&i===void 0)return t(Math.ceil(r*.5),"hex",r);if(a==="base64")return t(Math.ceil(r*.75),"base64",r);if(a==="url-safe")return e(r,bb,n);if(a==="numeric")return e(r,yb,n);if(a==="distinguishable")return e(r,_b,n);if(a==="ascii-printable")return e(r,wb,n);if(a==="alphanumeric")return e(r,Sb,n);if(i.length===0)throw new TypeError("Expected `characters` string length to be greater than or equal to 1");if(i.length>65536)throw new TypeError("Expected `characters` string length to be less or equal to 65536");return e(r,i,n)};function Ob(e,t){return kb(Ib,e,t)}const Eb=e=>[...e].map(t=>t.toString(16).padStart(2,"0")).join(""),Pb=e=>btoa(String.fromCodePoint(...e)),xl=65536;function Od(e){const t=new Uint8Array(e);for(let n=0;n{c(a)},[a]),ee(()=>{const M=i.map(F=>{var R;const O=(R=a.find(V=>V.id===F.flag))==null?void 0:R.type;return F={...F},F.value=Il(F.value,O),F});m(M.map(F=>({...F}))),g(M.map(F=>({...F})))},[i,a]),ee(()=>{u(o)},[o]);const K=()=>{if(v===""){A("Flag name cannot be blank"),setTimeout(()=>A(""),5e3);return}if(y===""){A("Flag identifier cannot be blank"),setTimeout(()=>A(""),5e3);return}if(N===null){A("Flag type cannot be blank"),setTimeout(()=>A(""),5e3);return}if(e===void 0){A("Environment not found"),setTimeout(()=>A(""),5e3);return}L.collection("flag").create({config:r.id,type:N.value,name:v,identifier:y}).then(M=>{L.collection("value").create({environment:e.id,flag:M.id,value:ji(N.value)}).then(F=>{c(O=>[...O,{...M}]),F.value=ka(F.value,N.value),g(O=>[...O,{...F}]),m(O=>[...O,{...F}]),re(!1)}).catch(F=>{console.error(F)})}).catch(M=>{console.error(M),A("An error occurred while creating the flag")})},[re,fe]=mt(s(At,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:"Create Flag"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"Flag Name:"}),s("input",{type:"text",class:"dialog-input",value:v,placeholder:"Flag Name",onInput:M=>{if(h(M.currentTarget.value),_){let F=M.currentTarget.value.replace(/^\w|[A-Z]|\b\w/g,function(O,R){return R===0?O.toLowerCase():O.toUpperCase()}).replace(/\W+/g,"");S(F)}}}),s("label",{class:"dialog-input-label",children:"Flag Identifier:"}),s("input",{type:"text",class:"dialog-input",value:y,placeholder:"Flag Identifier",onInput:M=>{k(!1),S(M.currentTarget.value)}}),s("label",{class:"dialog-input-label",children:"Flag Type:"}),s(Go,{selectText:"Select Type",items:hb,onSelectedItemChange:T})]}),s(vt,{children:[s("button",{class:"dialog-action dialog-action__save",onClick:()=>K(),children:"Create"}),s("button",{class:"dialog-action dialog-action__cancel",onClick:()=>re(!1),children:"Cancel"}),s("p",{className:"dialog-error",children:E})]})]}),{afterSetShowing:M=>{M||(h(""),S(""),T(null),k(!0),A(""))}});if(typeof e>"u")return s("div",{class:"content",children:[s("h1",{children:"No environments found!"}),s("p",{children:["Go back to the ",s(Ze,{to:"../",children:"project page"})," to create a new environment."]})]});ee(()=>{o.length===0&&typeof e<"u"&&L.collection("api_key").create({environment:e.id,config:r.id,name:`Default API Key For ${t.name}/${n.name}/${r.name}/${e.name}`,key:Nb({length:45,type:"alphanumeric"})}).then(M=>{u([M])}).catch(M=>{console.error(M)})},[o]),ee(()=>{for(let M=0;MO.flag===F.id)===void 0&&L.collection("value").create({environment:e.id,flag:F.id,value:ji(F.type)}).then(O=>{O.value=ka(O.value,F.type),g(R=>[...R,{...O}]),m(R=>[...R,{...O}])}).catch(O=>{console.error(O)})}},[a,i]);function ie(M){g(F=>F.map(O=>O.id===M.id?M:O))}const Ee=M=>{var F;return(F=p.find(O=>O.flag===M.id))!=null?F:kl(M.type)};function ce(M){var F;return(F=f.find(O=>O.flag===M.id))!=null?F:kl(M.type)}function te(M){const F=JSON.parse(JSON.stringify(M));m(O=>O.map(R=>R.id===F.id?F:R))}function Pe(M){var R;const F=(R=a.find(V=>V.id===M.flag))==null?void 0:R.type,O={...M};return O.value=Il(M.value,F),O}function Ue(M){var F;M.preventDefault();for(let O=0;OP.id===R.id),w=f[V];if(JSON.stringify(w.value)!==JSON.stringify(p[O].value)){const P={...R};P.value=Cl(R.value,(F=a.find(W=>W.id===R.flag))==null?void 0:F.type),L.collection("value").update(R.id,P),te(R)}}}async function H(M){var O;const F=f.findIndex(R=>R.id===M.id);if(JSON.stringify(f[F].value)===JSON.stringify(M.value))return[-1,"Value is the same as the previous value"];try{const R={...M};R.value=Cl(M.value,(O=a.find(w=>w.id===M.flag))==null?void 0:O.type);const V=await L.collection("value").update(M.id,R);return te(Pe(V)),ie(Pe(V)),[1,V]}catch(R){return[0,R]}}const he=(M,F)=>{M.stopPropagation(),L.collection("flag").delete(F.id).then(()=>{c(l.filter(O=>O.id!==F.id)),g(p.filter(O=>O.flag!==F.id)),m(f.filter(O=>O.flag!==F.id))})};function me(){g(JSON.parse(JSON.stringify(f)))}return s(de,{children:[s(Wn,{children:s(Yo,{team:t,project:n,environment:e,config:r})}),s(Ge,{pageName:"dashboard dashboard-config",children:[s(vb,{children:[s("h2",{children:"Flags"}),l.map(M=>s(pb,{flag:M,originalValue:ce(M),onDelete:he,value:Ee(M),saveValue:H,setValue:ie}))]}),s(Fi,{children:[s(or,{onClick:()=>re(!0),type:"New Flag"}),s(or,{onClick:me,type:"Reset All"}),s(or,{onClick:Ue,type:"Save All"})]}),s(kd,{}),s(gb,{config:r.name,environment:e.name,apiKey:(Ce=d[0])==null?void 0:Ce.key})]}),fe]})}function Db({params:e}){return e.environment?Promise.all([L.collection("environment").getOne(e.environment,{}),L.collection("team").getOne(e.team,{expand:"owner,admins,editors,viewers"}),L.collection("project").getOne(e.project,{}),L.collection("config").getOne(e.config,{}),L.collection("flag").getFullList(void 0,{filter:`config = "${e.config}"`}),L.collection("value").getFullList(void 0,{filter:`environment = "${e.environment}" && flag.config = "${e.config}"`}),L.collection("api_key").getFullList(void 0,{filter:`config = "${e.config}" && environment = "${e.environment}"`})]):Promise.all([L.collection("environment").getList(void 0,1,{filter:`project = "${e.project}"`}).then(t=>t.items[0]||void 0)])}const Mb="/assets/404.571aed3a.svg",Ol="/assets/error.7cebe82a.svg";function Qr(){const e=bu();let t;if(e instanceof Ve)switch(e.status){case 404:t=s(Ge,{pageName:"dashboard dashboard-error",children:[s("img",{src:Mb,alt:"404"}),s("h1",{children:"404"}),s("p",{children:e.message})]});break;default:t=s(Ge,{pageName:"dashboard dashboard-error",children:[s("img",{src:Ol,alt:"500"}),s("h1",{children:"500"}),s("p",{children:e.message})]});break}else t=s(Ge,{pageName:"dashboard dashboard-error",children:[s("img",{src:Ol,alt:"500"}),s("h1",{children:"500"}),s("p",{children:e.message})]});return s(de,{children:[s(Wn,{}),t]})}function Lb(){const[e]=mn(),[t,n]=Q.useState([]),[r,a]=Q.useState(""),[i,o]=Q.useState(""),[l,c]=Q.useState(null),[d,u]=Q.useState(""),f=Ye();ee(()=>{n(e)},[e]);const m=()=>{var S,_;if(r.length===0){o("Error: Team name cannot be empty."),setTimeout(()=>o(""),5e3);return}L.collection("team").create({name:r,owner:[(_=(S=L.authStore)==null?void 0:S.model)==null?void 0:_.id]}).then(k=>{n([...t,k]),a(""),h(!1)}).catch(k=>{o("Error Creating Team: "+k.message),setTimeout(()=>o(""),5e3)})},p=()=>{l!==null&&L.collection("team").delete(l.id).then(()=>{n(S=>S.filter(_=>_.id!==l.id)),c(null),g(!1)}).catch(S=>{u("Error Deleting Team: "+S.message),setTimeout(()=>u(""),5e3)})},[g,v]=mt(s(At,{children:[s(pt,{children:s("h1",{class:"dialog-heading",children:"Delete Team"})}),s(gt,{class:"dialog-form",children:s("p",{children:["Are you sure you want to delete the team ",l==null?void 0:l.name,"? This is irreversible and will delete all associated configs, projects, environments and API Keys."]})}),s(vt,{children:[s("button",{className:"dialog-action dialog-action__delete",onClick:p,children:"Delete"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>g(!1),children:"Cancel"}),s("p",{class:"dialog-error",children:d})]})]}),{afterSetShowing:S=>{S||(c(null),u(""))}}),[h,y]=mt(s(At,{children:[s(pt,{children:s("h1",{class:"dialog-heading",children:"Create Team"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"Team Name:"}),s("input",{class:"dialog-input",value:r,onChange:S=>a(S==null?void 0:S.currentTarget.value),type:"text",placeholder:"Team Name"})]}),s(vt,{children:[s("button",{className:"dialog-action dialog-action__save",onClick:()=>m(),children:"Create"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>h(!1),children:"Cancel"}),s("p",{class:"dialog-error",children:i})]})]}),{afterSetShowing:S=>{S||a("")}});return s(de,{children:[s(Wn,{}),s(Ge,{pageName:"dashboard",children:[s(gr,{children:[s(vr,{children:"Teams"}),s(br,{children:[t.map(S=>{var _;return s(ht,{onClick:()=>f(`./${S.id}`),children:s(ut,{children:[s(dt,{children:s(Fn,{value:S.name})}),s(ft,{children:S.name}),s(mr,{children:S.owner===((_=L.authStore.model)==null?void 0:_.id)?s(pr,{onClick:k=>{k.stopPropagation(),c(S),g(!0)},children:s(_e,{icon:on.faTrash})}):null})]})},S.id)}),s(ht,{onClick:()=>h(!0),children:s(ut,{children:[s(dt,{children:s(_e,{icon:jn.faPlus})}),s(ft,{children:"New Team"})]})})]})]}),y,v]})]})}function $b(){return Promise.all([L.collection("team").getFullList()])}function Fb(){const[e]=yu(),t=Ye();return ee(()=>{const n=e.get("code"),r=Ou.get("provider"),a=location.origin+Z.OAUTH2_REDIRECT;r.state!==e.get("state")&&t(Z.LOGIN+"?error=Could not verify state, please try to login again."),n&&L.collection("users").authWithOAuth2Code(r.name,n,r.codeVerifier,a,{emailVisibility:!1}).then(async i=>{var o,l,c,d;L.collection("users").update(i.record.id,{name:(l=(o=i.meta)==null?void 0:o.name)!=null?l:"",username:(d=(c=i.meta)==null?void 0:c.username.replace(/\W/g,""))!=null?d:""}).catch(u=>console.error(u)),t(Z.DASHBOARD)}).catch(i=>t(Z.LOGIN+"?error="+i.message))},[]),s("div",{children:"Please wait while we log you in..."})}function jb(){const[e,t]=Q.useState(""),[n,r]=Q.useState({}),[a,i]=Q.useState(""),[o,l]=Q.useState(""),[c,d]=Q.useState(""),[u,f]=Q.useState(!1),[m,p]=Q.useState(!0);gn(Z.DASHBOARD,!0);async function g(v){v.preventDefault(),p(!1);try{f(!1),l(""),d(null),fetch("https://webmail-url-api.dbuidl.com/api/v1/get_web_mail?email="+encodeURIComponent(e)).then(async h=>{if(h.ok){const y=await h.json();y.success&&(l(y.web_mail_url),d(y.service_name))}}),await L.collection("users").requestPasswordReset(e),f(!0),r({}),i("If an account is associated with this email address, a password reset email has been sent."),setTimeout(()=>{window.location.pathname===Z.FORGOT_PASSWORD&&i("")},5e3)}catch(h){r(Er(h))}p(!0)}return s(ln,{class:"auth-page",children:[s(cn,{logo:un,children:s(dn,{children:s(pn,{})})}),s(Ge,{pageName:"auth-content",children:s("form",{class:"auth-form",onSubmit:g,children:[s("div",{class:"auth-form-header",children:s("p",{children:"Forgot Password?"})}),s("div",{class:"auth-form-body",children:s(et,{value:e,valueUpdate:t,name:"email",label:"Email",errors:n,type:"email",required:!0})}),s("div",{className:"auth-form-footer",children:[s("button",{className:"auth-form-submit-button",type:"submit",disabled:!m,children:"Send Password Reset"}),s("div",{className:"auth-form-submit-error",children:n.form?n.form:""}),s("div",{className:"auth-form-submit-success",children:a||""}),s("button",{style:!u||o===""?{display:"none"}:{},onClick:()=>window.open(o,"_blank")&&!1,className:"auth-form-submit-button",children:["Click here to open your ",c?c+"":"email"," inbox."]}),s("p",{className:"auth-form-text",children:["Remember your password? ",s(Ze,{to:Z.LOGIN,class:"auth-form-link",children:"Login"})]}),s("p",{className:"auth-form-text",children:["Need an account? ",s(Ze,{to:Z.REGISTER,class:"auth-form-link",children:"Register"})]})]})]})})]})}function Ub(){const[e,t]=Q.useState(""),[n,r]=Q.useState(""),[a,i]=Q.useState({}),[o,l]=Q.useState(""),[c,d]=Q.useState(!0);gn(Z.DASHBOARD,!0);const u=yp(),f=Ye();async function m(p){p.preventDefault(),d(!1);try{await L.collection("users").confirmPasswordReset(u.token||"",e,n),i({}),l("Your password has been reset successfully. You can now login."),setTimeout(()=>{window.location.pathname===Z.RESET_PASSWORD+"/"+u.token&&f(Z.LOGIN)},5e3)}catch(g){i(Er(g))}d(!0)}return s(ln,{class:"auth-page",children:[s(cn,{logo:un,children:s(dn,{children:s(pn,{})})}),s(Ge,{pageName:"auth-content",children:s("form",{class:"auth-form",onSubmit:m,children:[s("div",{class:"auth-form-header",children:s("p",{children:"Reset Password"})}),s("div",{class:"auth-form-body",children:[s(et,{value:e,valueUpdate:t,name:"password",label:"New Password",errors:a,type:"password",required:!0}),s(et,{value:n,valueUpdate:r,name:"passwordConfirm",label:"Confirm New Password",errors:a,type:"password",required:!0})]}),s("div",{className:"auth-form-footer",children:[s("button",{className:"auth-form-submit-button",type:"submit",disabled:!c,children:"Reset Password"}),s("div",{className:"auth-form-submit-error",children:[a.form?a.form:"",a.token?a.token:""]}),s("div",{className:"auth-form-submit-success",children:o||""}),s("p",{className:"auth-form-text",children:["Need a new link? ",s(Ze,{to:Z.FORGOT_PASSWORD,class:"auth-form-link",children:"Forgot Password"})]}),s("p",{className:"auth-form-text",children:["Remember your password? ",s(Ze,{to:Z.LOGIN,class:"auth-form-link",children:"Login"})]})]})]})})]})}function Bb(){const[e,t]=Q.useState(""),[n,r]=Q.useState(""),[a,i]=Q.useState(""),[o,l]=Q.useState({}),[c,d]=Q.useState(""),[u,f]=Q.useState(!0);gn(Z.DASHBOARD,!1);const[,m]=oo(),p=Ye();async function g(v){v.preventDefault(),f(!1);try{if(!m)return;await L.collection("users").update(m.id,{oldPassword:e,password:n,passwordConfirm:a}),await L.collection("users").authWithPassword(m.email,n),l({}),d("Your password has been changed successfully."),setTimeout(()=>{window.location.pathname===Z.CHANGE_PASSWORD&&p(Z.DASHBOARD)},5e3)}catch(h){l(Er(h))}f(!0)}return s(ln,{class:"auth-page",children:[s(cn,{logo:un,children:s(dn,{children:s(pn,{})})}),s(Ge,{pageName:"auth-content",children:s("form",{class:"auth-form",onSubmit:g,children:[s("div",{class:"auth-form-header",children:s("p",{children:"Reset Password"})}),s("div",{class:"auth-form-body",children:[s(et,{value:e,valueUpdate:t,name:"oldPassword",label:"Old Password",errors:o,type:"password",required:!0}),s(et,{value:n,valueUpdate:r,name:"password",label:"New Password",errors:o,type:"password",required:!0}),s(et,{value:a,valueUpdate:i,name:"passwordConfirm",label:"Confirm New Password",errors:o,type:"password",required:!0})]}),s("div",{className:"auth-form-footer",children:[s("button",{className:"auth-form-submit-button",type:"submit",disabled:!u,children:"Reset Password"}),s("div",{className:"auth-form-submit-error",children:[o.form?o.form:"",o.token?o.token:""]}),s("div",{className:"auth-form-submit-success",children:c||""}),s("p",{className:"auth-form-text",children:["Want to go back? ",s(Ze,{to:Z.USER_SETTINGS,class:"auth-form-link",children:"Account Settings"})]})]})]})})]})}function Hb(){const[,e]=oo(),t=Ye();gn(Z.LOGIN,!1);const[n,r]=J(!1),[a,i]=J(""),o=mn(),l=()=>{if(!n){r(!0),i("Are you sure you want to delete your account? This action is irreversible! Click the button again to confirm.");return}L.collection("users").delete(e==null?void 0:e.id).then(()=>{var c;(c=L.authStore)==null||c.clear(),t(Z.HOME)}).catch(()=>{i("An error occurred while deleting your account. Please try again later.")})};return s(de,{children:[s(Wn,{children:e?s("div",{className:"navbar-links-breadcrumb",children:s(Ze,{class:"breadcrumb-page",to:"/dashboard/user",children:s("p",{children:"Account Settings"})})}):null}),s(Ge,{pageName:"dashboard dashboard-user-settings",children:[s("h1",{className:"action-header",children:"Change your password"}),s("p",{children:"You can do so using the button below if you know your current password. If you have forgotten it, please log out and use the forgotten password process."}),s(Fi,{children:s(or,{onClick:()=>t(Z.CHANGE_PASSWORD),type:"Change Password"})}),s("h1",{className:"action-header",children:"Delete account"}),s("p",{children:["If you want to, you can delete your ConfigDN account. This actions is ",s("strong",{children:"irreversible"}),"! ",s("strong",{children:"All teams"})," you are the owner of will also be deleted."]}),s("p",{children:"You currently own the following teams:"}),s("ul",{class:"owned-teams-list",children:o.items.map(c=>s("li",{children:s("a",{href:Z.DASHBOARD+"/"+c.id,children:c.name})}))}),s("p",{children:"You can transfer them by clicking on the links above, choosing add member, then owner and set the owner to the new owner."}),s(Fi,{children:s(or,{onClick:()=>l(),type:"Delete Account"})}),s("p",{class:"delete-account-warning",children:a}),s(kd,{})]})]})}function Vb({params:e}){return L.collection("team").getList(e.team,void 0,{expand:"owner",filter:`owner = "${e.id}"`})}const Wb=$p([{path:Z.HOME,errorElement:s(dl,{}),element:s(zp,{})},{path:Z.LOGIN,element:s(Bg,{}),loader:Hg},{path:Z.REGISTER,element:s(Vg,{}),loader:Wg},{path:Z.FORGOT_PASSWORD,element:s(jb,{})},{path:Z.RESET_PASSWORD+"/:token",element:s(Ub,{})},{path:Z.CHANGE_PASSWORD,element:s(Bb,{})},{path:Z.OAUTH2_REDIRECT,element:s(Fb,{})},{path:Z.DASHBOARD,element:s(zg,{}),children:[{path:"",element:s(Lb,{}),loader:$b,errorElement:s(Qr,{})},{path:":team",element:s(cb,{}),loader:ub,errorElement:s(Qr,{})},{path:":team/:project",element:s(db,{}),loader:fb,errorElement:s(Qr,{})},{path:":team/:project/:config",element:s(dl,{})},{path:":team/:project/:config/:environment",element:s(Rb,{}),loader:Db,errorElement:s(Qr,{})},{path:"user/:id",element:s(Hb,{}),loader:Vb}]},{path:Z.LOGOUT,element:s(qg,{})}]);An(s(kp,{router:Wb}),document.getElementById("app")); + */var Ba=60103,Ha=60106,Ar=60107,Nr=60108,Tr=60114,Rr=60109,Dr=60110,Mr=60112,Lr=60113,yo=60120,$r=60115,Fr=60116,Uu=60121,Bu=60122,Hu=60117,Vu=60129,Wu=60131;if(typeof Symbol=="function"&&Symbol.for){var je=Symbol.for;Ba=je("react.element"),Ha=je("react.portal"),Ar=je("react.fragment"),Nr=je("react.strict_mode"),Tr=je("react.profiler"),Rr=je("react.provider"),Dr=je("react.context"),Mr=je("react.forward_ref"),Lr=je("react.suspense"),yo=je("react.suspense_list"),$r=je("react.memo"),Fr=je("react.lazy"),Uu=je("react.block"),Bu=je("react.server.block"),Hu=je("react.fundamental"),Vu=je("react.debug_trace_mode"),Wu=je("react.legacy_hidden")}function bt(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Ba:switch(e=e.type,e){case Ar:case Tr:case Nr:case Lr:case yo:return e;default:switch(e=e&&e.$$typeof,e){case Dr:case Mr:case Fr:case $r:case Rr:return e;default:return t}}case Ha:return t}}}var pv=Rr,gv=Ba,vv=Mr,bv=Ar,yv=Fr,_v=$r,wv=Ha,Sv=Tr,xv=Nr,Iv=Lr;ve.ContextConsumer=Dr;ve.ContextProvider=pv;ve.Element=gv;ve.ForwardRef=vv;ve.Fragment=bv;ve.Lazy=yv;ve.Memo=_v;ve.Portal=wv;ve.Profiler=Sv;ve.StrictMode=xv;ve.Suspense=Iv;ve.isAsyncMode=function(){return!1};ve.isConcurrentMode=function(){return!1};ve.isContextConsumer=function(e){return bt(e)===Dr};ve.isContextProvider=function(e){return bt(e)===Rr};ve.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ba};ve.isForwardRef=function(e){return bt(e)===Mr};ve.isFragment=function(e){return bt(e)===Ar};ve.isLazy=function(e){return bt(e)===Fr};ve.isMemo=function(e){return bt(e)===$r};ve.isPortal=function(e){return bt(e)===Ha};ve.isProfiler=function(e){return bt(e)===Tr};ve.isStrictMode=function(e){return bt(e)===Nr};ve.isSuspense=function(e){return bt(e)===Lr};ve.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Ar||e===Tr||e===Vu||e===Nr||e===Lr||e===yo||e===Wu||typeof e=="object"&&e!==null&&(e.$$typeof===Fr||e.$$typeof===$r||e.$$typeof===Rr||e.$$typeof===Dr||e.$$typeof===Mr||e.$$typeof===Hu||e.$$typeof===Uu||e[0]===Bu)};ve.typeOf=bt;(function(e){e.exports=ve})(mv);let ml=e=>typeof e=="object"&&e!=null&&e.nodeType===1,pl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",li=(e,t)=>{if(e.clientHeight{let a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeightit||i>e&&o=t&&l>=n?i-e-r:o>t&&ln?o-t+a:0,Cv=e=>{let t=e.parentElement;return t==null?e.getRootNode().host||null:t};var kv=(e,t)=>{var n,r,a,i,o,l;if(typeof document>"u")return[];let{scrollMode:c,block:d,inline:u,boundary:f,skipOverflowHiddenElements:m}=t,p=typeof f=="function"?f:ce=>ce!==f;if(!ml(e))throw new TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,v=[],h=e;for(;ml(h)&&p(h);){if(h=Cv(h),h===g){v.push(h);break}h!=null&&h===document.body&&li(h)&&!li(document.documentElement)||h!=null&&li(h,m)&&v.push(h)}let y=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,S=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,_=(o=window.scrollX)!=null?o:pageXOffset,k=(l=window.scrollY)!=null?l:pageYOffset,{height:N,width:T,top:E,right:A,bottom:K,left:re}=e.getBoundingClientRect(),fe=d==="start"||d==="nearest"?E:d==="end"?K:E+N/2,ie=u==="center"?re+T/2:u==="end"?A:re,Ee=[];for(let ce=0;ce=0&&re>=0&&K<=S&&A<=y&&E>=H&&K<=me&&re>=Ce&&A<=he)return Ee;let M=getComputedStyle(te),F=parseInt(M.borderLeftWidth,10),O=parseInt(M.borderTopWidth,10),R=parseInt(M.borderRightWidth,10),V=parseInt(M.borderBottomWidth,10),w=0,P=0,W="offsetWidth"in te?te.offsetWidth-te.clientWidth-F-R:0,q="offsetHeight"in te?te.offsetHeight-te.clientHeight-O-V:0,we="offsetWidth"in te?te.offsetWidth===0?0:Ue/te.offsetWidth:0,ke="offsetHeight"in te?te.offsetHeight===0?0:Pe/te.offsetHeight:0;if(g===te)w=d==="start"?fe:d==="end"?fe-S:d==="nearest"?Xr(k,k+S,S,O,V,k+fe,k+fe+N,N):fe-S/2,P=u==="start"?ie:u==="center"?ie-y/2:u==="end"?ie-y:Xr(_,_+y,y,F,R,_+ie,_+ie+T,T),w=Math.max(0,w+k),P=Math.max(0,P+_);else{w=d==="start"?fe-H-O:d==="end"?fe-me+V+q:d==="nearest"?Xr(H,me,Pe,O,V+q,fe,fe+N,N):fe-(H+Pe/2)+q/2,P=u==="start"?ie-Ce-F:u==="center"?ie-(Ce+Ue/2)+W/2:u==="end"?ie-he+R+W:Xr(Ce,he,Ue,F,R+W,ie,ie+T,T);let{scrollLeft:Ae,scrollTop:be}=te;w=Math.max(0,Math.min(be+w/ke,te.scrollHeight-Pe/ke+q)),P=Math.max(0,Math.min(Ae+P/we,te.scrollWidth-Ue/we+W)),fe+=be-w,ie+=Ae-P}Ee.push({el:te,top:w,left:P})}return Ee},ya=function(){return ya=Object.assign||function(t){for(var n,r=1,a=arguments.length;r1?a-1:0),o=1;o=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Bt(e,t,n,r,a){if(a===void 0&&(a=!0),n===0)return-1;var i=n-1;(typeof t!="number"||t<0||t>=n)&&(t=e>0?-1:i+1);var o=t+e;o<0?o=a?i:0:o>i&&(o=a?0:i);var l=sn(e,o,n,r,a);return l===-1?t>=n?-1:t:l}function sn(e,t,n,r,a){var i=r(t);if(!i||!i.hasAttribute("disabled"))return t;if(e>0){for(var o=t+1;o=0;l--)if(!r(l).hasAttribute("disabled"))return l;return a?e>0?sn(1,0,n,r,!1):sn(-1,n-1,n,r,!1):-1}function vl(e,t,n,r){return r===void 0&&(r=!0),t.some(function(a){return a&&(gl(a,e,n)||r&&gl(a,n.document.activeElement,n))})}var Nv=_o(function(e){Gu(e).textContent=""},500);function Tv(e,t){var n=Gu(t);!e||(n.textContent=e,Nv(t))}function Gu(e){e===void 0&&(e=document);var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var Rv=["isInitialMount","highlightedIndex","items","environment"],Yu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Dv(e,t,n){var r=e.props,a=e.type,i={};Object.keys(t).forEach(function(o){Mv(o,e,t,n),n[o]!==t[o]&&(i[o]=n[o])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(se({type:a},i))}function Mv(e,t,n,r){var a=t.props,i=t.type,o="on"+wo(e)+"Change";a[o]&&r[e]!==void 0&&r[e]!==n[e]&&a[o](se({type:i},r))}function Lv(e,t){return t.changes}function $v(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""}var Fv=_o(function(e,t){Tv(e(),t)},200),jv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Bn:ee;function Ju(e){var t=e.id,n=t===void 0?"downshift-"+Pv():t,r=e.labelId,a=e.menuId,i=e.getItemId,o=e.toggleButtonId,l=e.inputId,c=Ie({labelId:r||n+"-label",menuId:a||n+"-menu",getItemId:i||function(d){return n+"-item-"+d},toggleButtonId:o||n+"-toggle-button",inputId:l||n+"-input"});return c.current}function Xu(e,t,n,r){var a,i;if(e===void 0){if(t===void 0)throw new Error(r);a=n[t],i=t}else i=t===void 0?n.indexOf(e):t,a=e;return[a,i]}function Uv(e){return e?String(e):""}function Bv(e){return/^\S{1}$/.test(e)}function wo(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function So(e){var t=Ie(e);return t.current=e,t}function Zu(e,t,n){var r=Ie(),a=Ie(),i=oe(function(m,p){a.current=p,m=_a(m,p.props);var g=e(m,p),v=p.props.stateReducer(m,se({},p,{changes:g}));return v},[e]),o=Na(i,t),l=o[0],c=o[1],d=So(n),u=oe(function(m){return c(se({props:d.current},m))},[d]),f=a.current;return ee(function(){f&&r.current&&r.current!==l&&Dv(f,_a(r.current,f.props),l),r.current=l},[l,n,f]),[l,u]}function Hv(e,t,n){var r=Zu(e,t,n),a=r[0],i=r[1];return[_a(a,n),i]}var ir={itemToString:Uv,stateReducer:Lv,getA11ySelectionMessage:$v,scrollIntoView:Ev,environment:typeof window>"u"?{}:window};function tt(e,t,n){n===void 0&&(n=Yu);var r=e["default"+wo(t)];return r!==void 0?r:n[t]}function Zr(e,t,n){n===void 0&&(n=Yu);var r=e[t];if(r!==void 0)return r;var a=e["initial"+wo(t)];return a!==void 0?a:tt(e,t,n)}function Qu(e){var t=Zr(e,"selectedItem"),n=Zr(e,"isOpen"),r=Zr(e,"highlightedIndex"),a=Zr(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.indexOf(t):r,isOpen:n,selectedItem:t,inputValue:a}}function nn(e,t,n){var r=e.items,a=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,o=t.selectedItem,l=t.highlightedIndex;return r.length===0?-1:a!==void 0&&l===a?a:i!==void 0?i:o?r.indexOf(o):n===0?-1:n<0?r.length-1:0}function ed(e,t,n,r){var a=Ie({isMouseDown:!1,isTouchMove:!1});return ee(function(){if((n==null?void 0:n.addEventListener)!=null){var i=function(){a.current.isMouseDown=!0},o=function(f){a.current.isMouseDown=!1,e&&!vl(f.target,t.map(function(m){return m.current}),n)&&r()},l=function(){a.current.isTouchMove=!1},c=function(){a.current.isTouchMove=!0},d=function(f){e&&!a.current.isTouchMove&&!vl(f.target,t.map(function(m){return m.current}),n,!1)&&r()};return n.addEventListener("mousedown",i),n.addEventListener("mouseup",o),n.addEventListener("touchstart",l),n.addEventListener("touchmove",c),n.addEventListener("touchend",d),function(){n.removeEventListener("mousedown",i),n.removeEventListener("mouseup",o),n.removeEventListener("touchstart",l),n.removeEventListener("touchmove",c),n.removeEventListener("touchend",d)}}},[e,n]),a}var td=function(){return Ku};function wa(e,t,n){var r=n.isInitialMount,a=n.highlightedIndex,i=n.items,o=n.environment,l=Ut(n,Rv);ee(function(){r||Fv(function(){return e(se({highlightedIndex:a,highlightedItem:i[a],resultCount:i.length},l))},o.document)},t)}function nd(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,a=e.getItemNodeFromIndex,i=e.menuElement,o=e.scrollIntoView,l=Ie(!0);return jv(function(){t<0||!n||!Object.keys(r.current).length||(l.current===!1?l.current=!0:o(a(t),i))},[t]),l}var rd=Ku;function Sa(e,t,n){var r;n===void 0&&(n=!0);var a=((r=e.items)==null?void 0:r.length)&&t>=0;return se({isOpen:!1,highlightedIndex:-1},a&&se({selectedItem:e.items[t],isOpen:tt(e,"isOpen"),highlightedIndex:tt(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function ad(e,t,n){var r=t.type,a=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:nn(a,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:nn(a,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:tt(a,"highlightedIndex"),isOpen:tt(a,"isOpen"),selectedItem:tt(a,"selectedItem"),inputValue:tt(a,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return se({},e,i)}function Vv(e){for(var t=e.keysSoFar,n=e.highlightedIndex,r=e.items,a=e.itemToString,i=e.getItemNodeFromIndex,o=t.toLowerCase(),l=0;l=0&&((n=a.items)==null?void 0:n.length)&&{selectedItem:a.items[e.highlightedIndex]});break;case Ro:o={selectedItem:t.selectedItem};break;default:return ad(e,t,fd)}return se({},e,o)}var qv=["onMouseLeave","refKey","onKeyDown","onBlur","ref"],Gv=["onBlur","onClick","onPress","onKeyDown","refKey","ref"],Yv=["item","index","onMouseMove","onClick","onPress","refKey","ref","disabled"];hd.stateChangeTypes=fd;function hd(e){e===void 0&&(e={});var t=se({},Kv,e),n=t.items,r=t.scrollIntoView,a=t.environment,i=t.itemToString,o=t.getA11ySelectionMessage,l=t.getA11yStatusMessage,c=Qu(t),d=Hv(zv,c,t),u=d[0],f=d[1],m=u.isOpen,p=u.highlightedIndex,g=u.selectedItem,v=u.inputValue,h=Ie(null),y=Ie(null),S=Ie({}),_=Ie(null),k=Ju(t),N=Ie(),T=Ie(!0),E=So({state:u,props:t}),A=oe(function(O){return S.current[k.getItemId(O)]},[k]);wa(l,[m,p,v,n],se({isInitialMount:T.current,previousResultCount:N.current,items:n,environment:a,itemToString:i},u)),wa(o,[g],se({isInitialMount:T.current,previousResultCount:N.current,items:n,environment:a,itemToString:i},u));var K=nd({menuElement:y.current,highlightedIndex:p,isOpen:m,itemRefs:S,scrollIntoView:r,getItemNodeFromIndex:A});ee(function(){return _.current=_o(function(O){O({type:$i,inputValue:""})},500),function(){_.current.cancel()}},[]),ee(function(){!v||_.current(f)},[f,v]),rd({isInitialMount:T.current,props:t,state:u}),ee(function(){T.current||(N.current=n.length)});var re=ed(m,[y,h],a,function(){f({type:Ia})}),fe=td();ee(function(){return T.current=!1,function(){T.current=!0}},[]),ee(function(){m||(S.current={})},[m]);var ie=rt(function(){return{ArrowDown:function(R){R.preventDefault(),f({type:xo,getItemNodeFromIndex:A,altKey:R.altKey})},ArrowUp:function(R){R.preventDefault(),f({type:Io,getItemNodeFromIndex:A,altKey:R.altKey})},Home:function(R){R.preventDefault(),f({type:ko,getItemNodeFromIndex:A})},End:function(R){R.preventDefault(),f({type:Oo,getItemNodeFromIndex:A})},Escape:function(){E.current.state.isOpen&&f({type:Co})},Enter:function(R){R.preventDefault(),f({type:E.current.state.isOpen?Eo:aa})},PageUp:function(R){E.current.state.isOpen&&(R.preventDefault(),f({type:Ao,getItemNodeFromIndex:A}))},PageDown:function(R){E.current.state.isOpen&&(R.preventDefault(),f({type:No,getItemNodeFromIndex:A}))}," ":function(R){R.preventDefault();var V=E.current.state;if(!V.isOpen){f({type:aa});return}V.inputValue?f({type:xa,key:" ",getItemNodeFromIndex:A}):f({type:Po})}}},[f,A,E]),Ee=oe(function(){f({type:sd})},[f]),ce=oe(function(){f({type:cd})},[f]),te=oe(function(){f({type:ld})},[f]),Pe=oe(function(O){f({type:ud,highlightedIndex:O})},[f]),Ue=oe(function(O){f({type:Ro,selectedItem:O})},[f]),H=oe(function(){f({type:dd})},[f]),he=oe(function(O){f({type:$i,inputValue:O})},[f]),me=oe(function(O){return se({id:k.labelId,htmlFor:k.toggleButtonId},O)},[k]),Ce=oe(function(O,R){var V,w=O===void 0?{}:O,P=w.onMouseLeave,W=w.refKey,q=W===void 0?"ref":W;w.onKeyDown,w.onBlur;var we=w.ref,ke=Ut(w,qv),Ae=R===void 0?{}:R;Ae.suppressRefError;var be=function(){f({type:id})};return se((V={},V[q]=en(we,function(Te){y.current=Te}),V.id=k.menuId,V.role="listbox",V["aria-labelledby"]=ke&&ke["aria-label"]?void 0:""+k.labelId,V.onMouseLeave=qe(P,be),V),ke)},[f,fe,k]),M=oe(function(O,R){var V,w=O===void 0?{}:O,P=w.onBlur,W=w.onClick;w.onPress;var q=w.onKeyDown,we=w.refKey,ke=we===void 0?"ref":we,Ae=w.ref,be=Ut(w,Gv),Te=R===void 0?{}:R;Te.suppressRefError;var Ne=E.current.state,We=function(){f({type:aa})},xt=function(){Ne.isOpen&&!re.current.isMouseDown&&f({type:Ia})},Be=function(Je){var Ke=qu(Je);Ke&&ie[Ke]?ie[Ke](Je):Bv(Ke)&&f({type:xa,key:Ke,getItemNodeFromIndex:A})},at=se((V={},V[ke]=en(Ae,function(pe){h.current=pe}),V["aria-activedescendant"]=Ne.isOpen&&Ne.highlightedIndex>-1?k.getItemId(Ne.highlightedIndex):"",V["aria-controls"]=k.menuId,V["aria-expanded"]=E.current.state.isOpen,V["aria-haspopup"]="listbox",V["aria-labelledby"]=be&&be["aria-label"]?void 0:""+k.labelId,V.id=k.toggleButtonId,V.role="combobox",V.tabIndex=0,V.onBlur=qe(P,xt),V),be);return be.disabled||(at.onClick=qe(W,We),at.onKeyDown=qe(q,Be)),at},[E,k,fe,f,re,ie,A]),F=oe(function(O){var R,V=O===void 0?{}:O,w=V.item,P=V.index,W=V.onMouseMove,q=V.onClick;V.onPress;var we=V.refKey,ke=we===void 0?"ref":we,Ae=V.ref,be=V.disabled,Te=Ut(V,Yv),Ne=E.current,We=Ne.state,xt=Ne.props,Be=Xu(w,P,xt.items,"Pass either item or index to getItemProps!"),at=Be[0],pe=Be[1],Je=function(){pe!==We.highlightedIndex&&(K.current=!1,f({type:od,index:pe,disabled:be}))},Ke=function(){f({type:To,index:pe})},it=se((R={disabled:be,role:"option","aria-selected":""+(at===g),id:k.getItemId(pe)},R[ke]=en(Ae,function(ze){ze&&(S.current[k.getItemId(pe)]=ze)}),R),Te);return be||(it.onClick=qe(q,Ke)),it.onMouseMove=qe(W,Je),it},[E,g,k,K,f]);return{getToggleButtonProps:M,getLabelProps:me,getMenuProps:Ce,getItemProps:F,toggleMenu:Ee,openMenu:te,closeMenu:ce,setHighlightedIndex:Pe,selectItem:Ue,reset:H,setInputValue:he,highlightedIndex:p,isOpen:m,selectedItem:g,inputValue:v}}var Do=0,Mo=1,Lo=2,$o=3,Fo=4,jo=5,Uo=6,Bo=7,Ho=8,Ca=9,Vo=10,md=11,pd=12,Wo=13,gd=14,vd=15,bd=16,yd=17,_d=18,Ko=19,wd=20,Sd=21,zo=22,xd=Object.freeze({__proto__:null,InputKeyDownArrowDown:Do,InputKeyDownArrowUp:Mo,InputKeyDownEscape:Lo,InputKeyDownHome:$o,InputKeyDownEnd:Fo,InputKeyDownPageUp:jo,InputKeyDownPageDown:Uo,InputKeyDownEnter:Bo,InputChange:Ho,InputBlur:Ca,InputFocus:Vo,MenuMouseLeave:md,ItemMouseMove:pd,ItemClick:Wo,ToggleButtonClick:gd,FunctionToggleMenu:vd,FunctionOpenMenu:bd,FunctionCloseMenu:yd,FunctionSetHighlightedIndex:_d,FunctionSelectItem:Ko,FunctionSetInputValue:wd,FunctionReset:Sd,ControlledPropUpdatedSelectedItem:zo});function Jv(e){var t=Qu(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),se({},t,{inputValue:r})}I.exports.array.isRequired,I.exports.func,I.exports.func,I.exports.func,I.exports.func,I.exports.number,I.exports.number,I.exports.number,I.exports.bool,I.exports.bool,I.exports.bool,I.exports.any,I.exports.any,I.exports.any,I.exports.string,I.exports.string,I.exports.string,I.exports.string,I.exports.string,I.exports.string,I.exports.func,I.exports.string,I.exports.string,I.exports.func,I.exports.func,I.exports.func,I.exports.func,I.exports.func,I.exports.func,I.exports.shape({addEventListener:I.exports.func,removeEventListener:I.exports.func,document:I.exports.shape({getElementById:I.exports.func,activeElement:I.exports.any,body:I.exports.any})});function Xv(e,t,n){var r=Ie(),a=Zu(e,t,n),i=a[0],o=a[1];return ee(function(){!zu(n,"selectedItem")||(n.selectedItemChanged(r.current,n.selectedItem)&&o({type:zo,inputValue:n.itemToString(n.selectedItem)}),r.current=i.selectedItem===r.current?n.selectedItem:i.selectedItem)},[i.selectedItem,n.selectedItem]),[_a(i,n),o]}var Zv=se({},ir,{selectedItemChanged:function(t,n){return t!==n},getA11yStatusMessage:Av});function Qv(e,t){var n,r=t.type,a=t.props,i=t.altKey,o;switch(r){case Wo:o={isOpen:tt(a,"isOpen"),highlightedIndex:tt(a,"highlightedIndex"),selectedItem:a.items[t.index],inputValue:a.itemToString(a.items[t.index])};break;case Do:e.isOpen?o={highlightedIndex:Bt(1,e.highlightedIndex,a.items.length,t.getItemNodeFromIndex,!0)}:o={highlightedIndex:i&&e.selectedItem==null?-1:nn(a,e,1,t.getItemNodeFromIndex),isOpen:a.items.length>=0};break;case Mo:e.isOpen?i?o=Sa(a,e.highlightedIndex):o={highlightedIndex:Bt(-1,e.highlightedIndex,a.items.length,t.getItemNodeFromIndex,!0)}:o={highlightedIndex:nn(a,e,-1,t.getItemNodeFromIndex),isOpen:a.items.length>=0};break;case Bo:o=Sa(a,e.highlightedIndex);break;case Lo:o=se({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case jo:o={highlightedIndex:Bt(-10,e.highlightedIndex,a.items.length,t.getItemNodeFromIndex,!1)};break;case Uo:o={highlightedIndex:Bt(10,e.highlightedIndex,a.items.length,t.getItemNodeFromIndex,!1)};break;case $o:o={highlightedIndex:sn(1,0,a.items.length,t.getItemNodeFromIndex,!1)};break;case Fo:o={highlightedIndex:sn(-1,a.items.length-1,a.items.length,t.getItemNodeFromIndex,!1)};break;case Ca:o=se({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=a.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:a.items[e.highlightedIndex],inputValue:a.itemToString(a.items[e.highlightedIndex])});break;case Ho:o={isOpen:!0,highlightedIndex:tt(a,"highlightedIndex"),inputValue:t.inputValue};break;case Vo:o={isOpen:!0,highlightedIndex:nn(a,e,0)};break;case Ko:o={selectedItem:t.selectedItem,inputValue:a.itemToString(t.selectedItem)};break;case zo:o={inputValue:t.inputValue};break;default:return ad(e,t,xd)}return se({},e,o)}var eb=["onMouseLeave","refKey","ref"],tb=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],nb=["onClick","onPress","refKey","ref"],rb=["onKeyDown","onChange","onInput","onFocus","onBlur","onChangeText","refKey","ref"];Id.stateChangeTypes=xd;function Id(e){e===void 0&&(e={});var t=se({},Zv,e),n=t.initialIsOpen,r=t.defaultIsOpen,a=t.items,i=t.scrollIntoView,o=t.environment,l=t.getA11yStatusMessage,c=t.getA11ySelectionMessage,d=t.itemToString,u=Jv(t),f=Xv(Qv,u,t),m=f[0],p=f[1],g=m.isOpen,v=m.highlightedIndex,h=m.selectedItem,y=m.inputValue,S=Ie(null),_=Ie({}),k=Ie(null),N=Ie(null),T=Ie(!0),E=Ju(t),A=Ie(),K=So({state:m,props:t}),re=oe(function(w){return _.current[E.getItemId(w)]},[E]);wa(l,[g,v,y,a],se({isInitialMount:T.current,previousResultCount:A.current,items:a,environment:o,itemToString:d},m)),wa(c,[h],se({isInitialMount:T.current,previousResultCount:A.current,items:a,environment:o,itemToString:d},m));var fe=nd({menuElement:S.current,highlightedIndex:v,isOpen:g,itemRefs:_,scrollIntoView:i,getItemNodeFromIndex:re});rd({isInitialMount:T.current,props:t,state:m}),ee(function(){var w=n||r||g;w&&k.current&&k.current.focus()},[]),ee(function(){T.current||(A.current=a.length)});var ie=ed(g,[k,S,N],o,function(){p({type:Ca,selectItem:!1})}),Ee=td();ee(function(){return T.current=!1,function(){T.current=!0}},[]),ee(function(){var w;if(!g)_.current={};else if(((w=o.document)==null?void 0:w.activeElement)!==k.current){var P;k==null||(P=k.current)==null||P.focus()}},[g,o]);var ce=rt(function(){return{ArrowDown:function(P){P.preventDefault(),p({type:Do,altKey:P.altKey,getItemNodeFromIndex:re})},ArrowUp:function(P){P.preventDefault(),p({type:Mo,altKey:P.altKey,getItemNodeFromIndex:re})},Home:function(P){!K.current.state.isOpen||(P.preventDefault(),p({type:$o,getItemNodeFromIndex:re}))},End:function(P){!K.current.state.isOpen||(P.preventDefault(),p({type:Fo,getItemNodeFromIndex:re}))},Escape:function(P){var W=K.current.state;(W.isOpen||W.inputValue||W.selectedItem||W.highlightedIndex>-1)&&(P.preventDefault(),p({type:Lo}))},Enter:function(P){var W=K.current.state;!W.isOpen||P.which===229||(P.preventDefault(),p({type:Bo,getItemNodeFromIndex:re}))},PageUp:function(P){K.current.state.isOpen&&(P.preventDefault(),p({type:jo,getItemNodeFromIndex:re}))},PageDown:function(P){K.current.state.isOpen&&(P.preventDefault(),p({type:Uo,getItemNodeFromIndex:re}))}}},[p,K,re]),te=oe(function(w){return se({id:E.labelId,htmlFor:E.inputId},w)},[E]),Pe=oe(function(w,P){var W,q=w===void 0?{}:w,we=q.onMouseLeave,ke=q.refKey,Ae=ke===void 0?"ref":ke,be=q.ref,Te=Ut(q,eb),Ne=P===void 0?{}:P;return Ne.suppressRefError,se((W={},W[Ae]=en(be,function(We){S.current=We}),W.id=E.menuId,W.role="listbox",W["aria-labelledby"]=Te&&Te["aria-label"]?void 0:""+E.labelId,W.onMouseLeave=qe(we,function(){p({type:md})}),W),Te)},[p,Ee,E]),Ue=oe(function(w){var P,W,q=w===void 0?{}:w,we=q.item,ke=q.index,Ae=q.refKey,be=Ae===void 0?"ref":Ae,Te=q.ref,Ne=q.onMouseMove,We=q.onMouseDown,xt=q.onClick;q.onPress;var Be=q.disabled,at=Ut(q,tb),pe=K.current,Je=pe.props,Ke=pe.state,it=Xu(we,ke,Je.items,"Pass either item or index to getItemProps!"),ze=it[1],Kn="onClick",Gt=xt,yt=function(){ze!==Ke.highlightedIndex&&(fe.current=!1,p({type:pd,index:ze,disabled:Be}))},b=function(){p({type:Wo,index:ze})},x=function($){return $.preventDefault()};return se((P={},P[be]=en(Te,function(C){C&&(_.current[E.getItemId(ze)]=C)}),P.disabled=Be,P.role="option",P["aria-selected"]=""+(ze===Ke.highlightedIndex),P.id=E.getItemId(ze),P),!Be&&(W={},W[Kn]=qe(Gt,b),W),{onMouseMove:qe(Ne,yt),onMouseDown:qe(We,x)},at)},[p,K,fe,E]),H=oe(function(w){var P,W=w===void 0?{}:w,q=W.onClick;W.onPress;var we=W.refKey,ke=we===void 0?"ref":we,Ae=W.ref,be=Ut(W,nb),Te=K.current.state,Ne=function(){p({type:gd})};return se((P={},P[ke]=en(Ae,function(We){N.current=We}),P["aria-controls"]=E.menuId,P["aria-expanded"]=Te.isOpen,P.id=E.toggleButtonId,P.tabIndex=-1,P),!be.disabled&&se({},{onClick:qe(q,Ne)}),be)},[p,K,E]),he=oe(function(w,P){var W,q=w===void 0?{}:w,we=q.onKeyDown,ke=q.onChange,Ae=q.onInput,be=q.onFocus,Te=q.onBlur;q.onChangeText;var Ne=q.refKey,We=Ne===void 0?"ref":Ne,xt=q.ref,Be=Ut(q,rb),at=P===void 0?{}:P;at.suppressRefError;var pe=K.current.state,Je=function(x){var C=qu(x);C&&ce[C]&&ce[C](x)},Ke=function(x){p({type:Ho,inputValue:x.target.value})},it=function(x){pe.isOpen&&!ie.current.isMouseDown&&p({type:Ca,selectItem:x.relatedTarget!==null})},ze=function(){pe.isOpen||p({type:Vo})},Kn="onChange",Gt={};if(!Be.disabled){var yt;Gt=(yt={},yt[Kn]=qe(ke,Ae,Ke),yt.onKeyDown=qe(we,Je),yt.onBlur=qe(Te,it),yt.onFocus=qe(be,ze),yt)}return se((W={},W[We]=en(xt,function(b){k.current=b}),W["aria-activedescendant"]=pe.isOpen&&pe.highlightedIndex>-1?E.getItemId(pe.highlightedIndex):"",W["aria-autocomplete"]="list",W["aria-controls"]=E.menuId,W["aria-expanded"]=pe.isOpen,W["aria-labelledby"]=Be&&Be["aria-label"]?void 0:""+E.labelId,W.autoComplete="off",W.id=E.inputId,W.role="combobox",W.value=pe.inputValue,W),Gt,Be)},[p,ce,K,ie,Ee,E]),me=oe(function(){p({type:vd})},[p]),Ce=oe(function(){p({type:yd})},[p]),M=oe(function(){p({type:bd})},[p]),F=oe(function(w){p({type:_d,highlightedIndex:w})},[p]),O=oe(function(w){p({type:Ko,selectedItem:w})},[p]),R=oe(function(w){p({type:wd,inputValue:w})},[p]),V=oe(function(){p({type:Sd})},[p]);return{getItemProps:Ue,getLabelProps:te,getMenuProps:Pe,getInputProps:he,getToggleButtonProps:H,toggleMenu:me,openMenu:M,closeMenu:Ce,setHighlightedIndex:F,setInputValue:R,selectItem:O,reset:V,highlightedIndex:v,isOpen:g,selectedItem:h,inputValue:y}}function ab(e){var t=e.removedSelectedItem,n=e.itemToString;return n(t)+" has been removed."}I.exports.array,I.exports.array,I.exports.array,I.exports.func,I.exports.func,I.exports.func,I.exports.number,I.exports.number,I.exports.number,I.exports.func,I.exports.func,I.exports.string,I.exports.string,I.exports.shape({addEventListener:I.exports.func,removeEventListener:I.exports.func,document:I.exports.shape({getElementById:I.exports.func,activeElement:I.exports.any,body:I.exports.any})});ir.itemToString,ir.stateReducer,ir.environment;var qo={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="fas",n="caret-up",r=320,a=512,i=[],o="f0d8",l="M182.6 137.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8H288c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z";e.definition={prefix:t,iconName:n,icon:[r,a,i,o,l]},e.faCaretUp=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=a,e.ligatures=i,e.unicode=o,e.svgPathData=l,e.aliases=i})(qo);function bl(e){return e?e.title:""}function ib(e,t){return e.map(n=>{var r;return n.title.toLowerCase().includes(t.toLowerCase())||((r=n.description)==null?void 0:r.toLowerCase().includes(t.toLowerCase()))?n:null})}function Go(e){var d;const{isOpen:t,selectedItem:n,getToggleButtonProps:r,getLabelProps:a,getMenuProps:i,highlightedIndex:o,getItemProps:l,inputValue:c}=hd({items:e.items,defaultSelectedItem:e.defaultValue,itemToString:bl});return ee(()=>{var u;(u=e.onSelectedItemChange)==null||u.call(e,n)},[n]),s("div",{class:"dialog-input-dropdown",children:[s("div",{className:"dialog-input-dropdown-dropdown",...r(),children:[s("label",{...a(),class:"dialog-input-dropdown-dropdown-text",children:n?bl(n):(d=e.selectText)!=null?d:"Select Item"}),s("span",{class:"dialog-input-dropdown-dropdown-icon",children:t?s(_e,{icon:qo.faCaretUp}):s(_e,{icon:Ma.faCaretDown})})]}),s("ul",{className:`dialog-input-dropdown-dropdown-items ${!t&&"dialog-input-dropdown-dropdown-items__hidden"}`,...i(),children:t&&ib(e.items,c).map((u,f)=>{var m;return u&&s("li",{className:`${o===f&&"dialog-input-dropdown-dropdown-item__highlighted"} ${n===u&&"dialog-input-dropdown-dropdown-item__selected"} dialog-input-dropdown-dropdown-item`,...l({item:u,index:f}),children:[s("span",{class:"dialog-input-dropdown-dropdown-item-name",children:u.title}),s("span",{className:"dialog-input-dropdown-dropdown-item-username",children:(m=u.description)!=null?m:""})]},`${u.value}${f}`)})})]})}function yl(e){return e.map(t=>({value:t.id,title:t.name}))}function Yo(e){var o,l,c;const t=Ye(),[n,r]=Q.useState(yl(e.environment?[e.environment]:[])),a=e.environment?{value:e.environment.id,title:e.environment.name}:null;ee(()=>{e.project&&L.collection("environment").getFullList(void 0,{filter:`project = "${e.project.id}"`}).then(d=>{r(yl(d))})},[e.project]);const i=d=>{d!==null&&t("./../"+d.value)};return s("div",{className:"navbar-links-breadcrumb",children:[e.team&&s(de,{children:s(Ze,{class:"breadcrumb-page",to:`/dashboard/${e.team.id}`,children:e.team.name})}),e.project&&s(de,{children:[s("div",{class:"breadcrumb-spacer",children:">"}),s(Ze,{class:"breadcrumb-page",to:`/dashboard/${(o=e.team)==null?void 0:o.id}/${e.project.id}`,children:e.project.name})]}),e.config&&s(de,{children:[s("div",{class:"breadcrumb-spacer",children:">"}),e.environment?s(Ze,{class:"breadcrumb-page",to:`/dashboard/${(l=e.team)==null?void 0:l.id}/${(c=e.project)==null?void 0:c.id}/${e.config.id}/${e.environment.id}`,children:e.config.name}):s("p",{children:e.config.name})]}),e.environment&&s(de,{children:[s("div",{class:"breadcrumb-spacer",children:">"}),s(Go,{items:n,defaultValue:a,onSelectedItemChange:i})]})]})}var jn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="fas",n="plus",r=448,a=512,i=[10133,61543,"add"],o="2b",l="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z";e.definition={prefix:t,iconName:n,icon:[r,a,i,o,l]},e.faPlus=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=a,e.ligatures=i,e.unicode=o,e.svgPathData=l,e.aliases=i})(jn);function ob(e){return s("div",{className:"dialog-overlay",onClick:e.onClick?e.onClick:()=>null,children:e.children})}function mt(e,t){const[n,r]=J(!1);ee(()=>{t!=null&&t.afterSetShowing&&t.afterSetShowing(n)},[n]);function a(i){i.target===i.currentTarget&&r(!1)}return[r,n?s(ob,{onClick:a,children:e}):null]}function At(e){return s("div",{className:"dialog",children:e.children})}function pt(e){return s("div",{className:"dialog-header",children:e.children})}function gt(e){var t;return s("div",{className:`dialog-body ${(t=e.class)!=null?t:""}`,children:e.children})}function vt(e){return s("div",{className:"dialog-footer",children:e.children})}function _l(e){return e?e.username:""}function sb(e,t){return e.map(n=>n.name.toLowerCase().includes(t.toLowerCase())||n.username.toLowerCase().includes(t.toLowerCase())?n:null)}function lb(e){const{isOpen:t,selectedItem:n,getToggleButtonProps:r,getLabelProps:a,getInputProps:i,getMenuProps:o,highlightedIndex:l,getItemProps:c,inputValue:d,reset:u}=Id({items:e.users,itemToString:_l});return ee(()=>{e.reset&&u()},[e.reset]),ee(()=>{var f;(f=e.onSelectedUserChange)==null||f.call(e,n)},[n]),s("div",{class:"dialog-input-dropdown",children:[s("div",{className:"dialog-input-dropdown-dropdown",...r(),children:[t?s("input",{...i(),class:"dialog-input-dropdown-dropdown-input",placeholder:"Search Users"}):s("label",{...a(),class:"dialog-input-dropdown-dropdown-text",children:n?_l(n):"Select User"}),s("span",{class:"dialog-input-dropdown-dropdown-icon",children:t?s(_e,{icon:qo.faCaretUp}):s(_e,{icon:Ma.faCaretDown})})]}),s("ul",{className:`dialog-input-dropdown-dropdown-items ${!t&&"dialog-input-dropdown-dropdown-items__hidden"}`,...o(),children:t&&sb(e.users,d).map((f,m)=>{var p;return f&&s("li",{className:`${l===m&&"dialog-input-dropdown-dropdown-item__highlighted"} ${n===f&&"dialog-input-dropdown-dropdown-item__selected"} dialog-input-dropdown-dropdown-item`,...c({item:f,index:m}),children:[s("span",{class:"dialog-input-dropdown-dropdown-item-name",children:f.username}),s("span",{className:"dialog-input-dropdown-dropdown-item-username",children:(p=f.name)!=null?p:""})]},`${f.value}${m}`)})})]})}const wl=[{value:"viewers",title:"Viewer",description:"Can view all flags and values but can't edit anything."},{value:"editors",title:"Editor",description:"Can manage, create and delete all flags and values."},{value:"admins",title:"Admin",description:"Can manage, create and delete all projects, configs, environments, flags and values."},{value:"owner",title:"Owner",description:"Owns this team and can change it in any way. Selecting this option will change the ownership of this team."}];function cb(){var R,V;const[e,t,n]=mn(),[r,a]=J(t),[i,o]=J(""),[l,c]=J(null),[d,u]=J(wl[0]),[f,m]=J(""),[p,g]=J(""),[v,h]=J(e),[y,S]=J(!1),[_,k]=J(!1),[N,T]=J(""),[E,A]=J(null),[K,re]=J("");function fe(w){k(!1),u(w)}function ie(w){k(!1),c(w)}const Ee=Ye();ee(()=>{h(e)},[e]),ee(()=>{a(t)},[t]);const[ce,te]=mt(s(At,{children:[s(pt,{children:s("h1",{class:"dialog-heading",children:["Delete ",N]})}),s(gt,{class:"dialog-form",children:s("p",{children:["Are you sure you want to remove the ",N," ",(R=E==null?void 0:E.username)!=null?R:E==null?void 0:E.name,"?"]})}),s(vt,{children:[s("button",{className:"dialog-action dialog-action__delete",onClick:()=>me(),children:"Remove"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>ce(!1),children:"Cancel"}),s("p",{class:"dialog-error",children:K})]})]}),{afterSetShowing:w=>{w||(T(""),A(null),re(""))}}),[Pe,Ue]=mt(s(At,{children:[s(pt,{children:s("h1",{class:"dialog-heading",children:"Create Team"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"Project Name:"}),s("input",{class:"dialog-input",value:i,onChange:w=>o(w==null?void 0:w.currentTarget.value),type:"text",placeholder:"Project Name"})]}),s(vt,{children:[s("button",{className:"dialog-action dialog-action__save",onClick:()=>O(),children:"Create"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>Pe(!1),children:"Cancel"}),s("p",{class:"dialog-error",children:f})]})]}),{afterSetShowing:w=>{w||o("")}}),[H,he]=mt(s(At,{children:[s(pt,{children:s("h1",{class:"dialog-heading",children:"Add User"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"User:"}),s(lb,{users:n,onSelectedUserChange:ie,reset:y}),s("label",{class:"dialog-input-label",children:"Role:"}),s(Go,{items:wl,onSelectedItemChange:fe,defaultValue:d})]}),s(vt,{children:[s("button",{className:"dialog-action "+((d==null?void 0:d.value)==="owner"?" dialog-action__delete":" dialog-action__save"),onClick:()=>F(),children:(d==null?void 0:d.value)==="owner"?"Transfer Ownership":"Add Member"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>H(!1),children:"Cancel"}),s("p",{class:"dialog-error",children:p})]})]}),{afterSetShowing:w=>{w?S(!1):(ie(null),S(!0),k(!1))}}),me=async()=>{E!==null&&N!==""&&(N==="project"&&L.collection("project").delete(E.id).then(()=>{a(r.filter(w=>w.id!==E.id)),ce(!1)}).catch(w=>{re(w.message)}),N==="user"&&L.collection("team").update(v.id,{admins:v.admins.filter(w=>w!==E.id),editors:v.editors.filter(w=>w!==E.id),viewers:v.viewers.filter(w=>w!==E.id)}).then(()=>{h(w=>(w.admins=w.admins.filter(P=>P!==E.id),w.editors=w.editors.filter(P=>P!==E.id),w.viewers=w.viewers.filter(P=>P!==E.id),w.expand.admins&&(w.expand.admins=w.expand.admins.filter(P=>P.id!==E.id)),w.expand.editors&&(w.expand.editors=w.expand.editors.filter(P=>P.id!==E.id)),w.expand.viewers&&(w.expand.viewers=w.expand.viewers.filter(P=>P.id!==E.id)),w)),ce(!1)}).catch(w=>{re(w.message)}))},Ce=(w,P)=>{w.stopPropagation(),T("user"),A(P),ce(!0)},M=(w,P)=>{w.stopPropagation(),T("project"),A(P),ce(!0)},F=()=>{if(l===null){g("Please select a user to add"),setTimeout(()=>g(""),5e3);return}if((d==null?void 0:d.value)==="owner"){if(!_){g("Please click again to confirm that you want to transfer ownership"),setTimeout(()=>g(""),5e3),k(!0);return}}else k(!1);if((d==null?void 0:d.value)==="owner"&&v.owner===l.id){g("User is already the owner of the team"),setTimeout(()=>g(""),5e3);return}if(d===null){g("Please select a role for the user"),setTimeout(()=>g(""),5e3);return}if(v.owner===l.id){g("User is already in the team"),setTimeout(()=>g(""),5e3);return}if(v.admins.includes(l.id)){g("User is already in the team"),setTimeout(()=>g(""),5e3);return}if(v.editors.includes(l.id)){g("User is already in the team"),setTimeout(()=>g(""),5e3);return}if(v.viewers.includes(l.id)){g("User is already in the team"),setTimeout(()=>g(""),5e3);return}let w={[d.value]:[...v[d.value],l.id]};d.value==="owner"&&(w={...w,owner:l.id}),L.collection("team").update(v.id,w).then(()=>{const P={...l};h(W=>{let q={...W};return d.value==="owner"?q.owner=P.id:(q[d.value].push(P.id),q.expand[d.value]&&q.expand[d.value].push(P)),q}),H(!1)}).catch(P=>{g("Error adding user to team: "+P),setTimeout(()=>g(""),5e3)})},O=()=>{L.collection("project").create({name:i,team:v.id}).then(w=>{a([...r,w]),o(""),Pe(!1)}).catch(w=>{m("Error creating project: "+w),setTimeout(()=>m(""),5e3)})};return s(de,{children:[s(Wn,{children:s(Yo,{team:v})}),s(Ge,{pageName:"dashboard",children:[s(gr,{children:[s(vr,{children:"Projects"}),s(br,{children:[r.map(w=>s(ht,{onClick:()=>Ee(`./${w.id}`),children:s(ut,{children:[s(dt,{children:s(Fn,{value:w.name})}),s(ft,{children:w.name}),s(mr,{children:s(pr,{onClick:P=>M(P,w),children:s(_e,{icon:on.faTrash})})})]})})),s(ht,{onClick:()=>Pe(!0),children:s(ut,{children:[s(dt,{children:s(_e,{icon:jn.faPlus})}),s(ft,{children:"New Project"})]})})]})]}),v.owner===((V=L.authStore.model)==null?void 0:V.id)&&s(gr,{children:[s(vr,{children:"Members"}),s(br,{children:[s(Jr,{title:"Owner",expand:v.expand.owner,onUserDelete:Ce}),s(Jr,{title:"Admin",expand:v.expand.admins,onUserDelete:Ce}),s(Jr,{title:"Editor",expand:v.expand.editors,onUserDelete:Ce}),s(Jr,{title:"Viewer",expand:v.expand.viewers,onUserDelete:Ce}),s(ht,{onClick:()=>H(!0),children:[s(ut,{children:[s(dt,{children:s(_e,{icon:jn.faPlus})}),s(ft,{children:"Add Member"})]}),s(Mi,{children:s("p",{children:"Also allows transfer of ownership."})})]})]})]})]}),Ue,he,te]})}function ub({params:e}){return Promise.all([L.collection("team").getOne(e.team,{expand:"owner,admins,editors,viewers"}),L.collection("project").getFullList(void 0,{filter:`team = "${e.team}"`}),L.collection("users").getFullList()])}function db(){const[e,t,n,r]=mn(),a=Ye(),[i,o]=J([]),[l,c]=J([]),[d,u]=J(""),[f,m]=J(""),[p,g]=J(""),[v,h]=J(""),[y,S]=J(""),[_,k]=J(null),[N,T]=J("");ee(()=>{o(n)},[n]),ee(()=>{c(r)},[r]);const E=()=>{if(d.length===0){g("Error: Config name cannot be empty."),setTimeout(()=>g(""),5e3);return}L.collection("config").create({name:d,project:t.id}).then(H=>{o(he=>[...he,H]),ie(!1)}).catch(H=>{console.error(H),g("Error: Could not create config."),setTimeout(()=>g(""),5e3)})},A=()=>{if(f.length===0){h("Error: Environment name cannot be empty."),setTimeout(()=>h(""),5e3);return}L.collection("environment").create({name:f,project:t.id}).then(H=>{c(he=>[...he,H]),ce(!1)}).catch(H=>{console.error(H),h("Error: Could not create environment."),setTimeout(()=>h(""),5e3)})},[K,re]=mt(s(At,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:["Delete ",y]})}),s(gt,{class:"dialog-form",children:s("p",{children:["Are you sure you want to delete the ",y," ",_==null?void 0:_.name,"?"]})}),s(vt,{children:[s("button",{class:"dialog-action dialog-action__delete",onClick:()=>fe(),children:"Delete"}),s("button",{class:"dialog-action dialog-action__cancel",onClick:()=>K(!1),children:"Cancel"}),s("p",{className:"dialog-error",children:N})]})]}),{afterSetShowing:H=>{H||(S(""),k(null),T(""))}}),fe=()=>{if(_===null){T("Error: Could not delete object.");return}y==="config"?L.collection("config").delete(_==null?void 0:_.id).then(()=>{o(H=>H.filter(he=>he.id!==(_==null?void 0:_.id))),K(!1)}).catch(H=>{console.error(H),T("Error: Could not delete config."),setTimeout(()=>T(""),5e3)}):y==="environment"&&L.collection("environment").delete(_==null?void 0:_.id).then(()=>{c(H=>H.filter(he=>he.id!==(_==null?void 0:_.id))),K(!1)}).catch(H=>{console.error(H),T("Error: Could not delete environment."),setTimeout(()=>T(""),5e3)})},[ie,Ee]=mt(s(At,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:"Create Config"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"Config Name:"}),s("input",{type:"text",class:"dialog-input",value:d,placeholder:"Config Name",onInput:H=>u(H.currentTarget.value)})]}),s(vt,{children:[s("button",{class:"dialog-action dialog-action__save",onClick:()=>E(),children:"Create"}),s("button",{class:"dialog-action dialog-action__cancel",onClick:()=>ie(!1),children:"Cancel"}),s("p",{className:"dialog-error",children:p})]})]}),{afterSetShowing:H=>{H||(u(""),g(""))}}),[ce,te]=mt(s(At,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:"Create Environment"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"Environment Name:"}),s("input",{type:"text",class:"dialog-input",value:f,placeholder:"Environment Name",onInput:H=>m(H.currentTarget.value)})]}),s(vt,{children:[s("button",{class:"dialog-action dialog-action__save",onClick:()=>A(),children:"Create"}),s("button",{class:"dialog-action dialog-action__cancel",onClick:()=>ce(!1),children:"Cancel"}),s("p",{className:"dialog-error",children:v})]})]}),{afterSetShowing:H=>{H||(m(""),h(""))}}),Pe=(H,he)=>{H.stopPropagation(),S("config"),k(he),K(!0)},Ue=(H,he)=>{H.stopPropagation(),S("environment"),k(he),K(!0)};return s(de,{children:[s(Wn,{children:s(Yo,{team:e,project:t})}),s(Ge,{pageName:"dashboard",children:[s(gr,{children:[s(vr,{children:"Environments"}),s(br,{children:[l.map(H=>s(ht,{children:s(ut,{children:[s(dt,{children:s(Fn,{value:H.name})}),s(ft,{children:H.name}),s(mr,{children:s(pr,{onClick:he=>Ue(he,H),children:s(_e,{icon:on.faTrash})})})]})})),s(ht,{onClick:()=>ce(!0),children:s(ut,{children:[s(dt,{children:s(_e,{icon:jn.faPlus})}),s(ft,{children:"New Environment"})]})})]})]}),s(gr,{children:[s(vr,{children:"Configs"}),s(br,{children:[i.map(H=>s(ht,{onClick:()=>l.length===0?a(`./${H.id}`):a(`./${H.id}/${l[0].id}`),children:s(ut,{children:[s(dt,{children:s(Fn,{value:H.name})}),s(ft,{children:H.name}),s(mr,{children:s(pr,{onClick:he=>Pe(he,H),children:s(_e,{icon:on.faTrash})})})]})})),s(ht,{onClick:()=>ie(!0),children:s(ut,{children:[s(dt,{children:s(_e,{icon:jn.faPlus})}),s(ft,{children:"New Config"})]})})]})]})]}),Ee,te,re]})}function fb({params:e}){return Promise.all([L.collection("team").getOne(e.team),L.collection("project").getOne(e.project,{}),L.collection("config").getFullList(void 0,{filter:`project = "${e.project}"`}),L.collection("environment").getFullList(void 0,{filter:`project = "${e.project}"`})])}const hb=[{value:"boolean",title:"Boolean",description:"True or false"},{value:"string",title:"String",description:"A string of text"},{value:"number",title:"Number",description:"A number"},{value:"json",title:"JSON",description:"A JSON object"},{value:"array",title:"Array",description:"A JSON array of values"}];function mb(e){switch(e){case"boolean":return"checkbox";case"string":return"text";case"number":return"number";case"json":return"text";case"array":return"text";default:return"text"}}var Cd={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="fas",n="up-right-and-down-left-from-center",r=512,a=512,i=["expand-alt"],o="f424",l="M344 0H488c13.3 0 24 10.7 24 24V168c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39-87 87c-9.4 9.4-24.6 9.4-33.9 0l-32-32c-9.4-9.4-9.4-24.6 0-33.9l87-87L327 41c-6.9-6.9-8.9-17.2-5.2-26.2S334.3 0 344 0zM168 512H24c-13.3 0-24-10.7-24-24V344c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l39 39 87-87c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8z";e.definition={prefix:t,iconName:n,icon:[r,a,i,o,l]},e.faUpRightAndDownLeftFromCenter=e.definition,e.prefix=t,e.iconName=n,e.width=r,e.height=a,e.ligatures=i,e.unicode=o,e.svgPathData=l,e.aliases=i})(Cd);function Sl(e){return s("div",{className:"dialog dialog__wide",children:e.children})}function pb(e){const[t,n]=J(null),{flag:r,originalValue:a,value:i,setValue:o,saveValue:l}=e;function c(_){let k={...e.value};k.value=_,o(k)}const[d,u]=mt(s(Sl,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:["Update ",r.name," Value"]})}),s(gt,{children:s("textarea",{className:"dialog-input-large",value:i.value,onInput:_=>c(_.currentTarget.value)})}),s(vt,{children:s("button",{className:"dialog-action dialog-action__save",onClick:()=>d(!1),children:"Done"})})]})),[f,m]=mt(s(Sl,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:["Delete ",r.name,"?"]})}),s(gt,{children:s("p",{children:["Are you sure you want to delete the flag ",r.name,"? This action cannot be undone."]})}),s(vt,{children:[s("button",{className:"dialog-action dialog-action__delete",onClick:_=>e.onDelete(_,r),children:"Delete"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>f(!1),children:"Cancel"})]})]})),p=mb(r.type);let g;function v(){l(i).then(_=>{n(_),setTimeout(()=>n(null),5e3)})}let h=s("button",{onClick:()=>d(!0),className:"setting-card-button",title:"Expand Editor",children:s(_e,{icon:Cd.faUpRightAndDownLeftFromCenter})});switch(p){case"text":g=s("input",{type:p,value:i.value,class:"setting-card-value",onInput:_=>c(_.currentTarget.value)});break;case"number":g=s("input",{type:p,value:i.value,class:"setting-card-value",onInput:_=>c(_.currentTarget.value)}),h=null;break;case"checkbox":g=s("label",{className:"setting-card-value-switch",children:[s("input",{type:p,checked:i.value==="true",className:"setting-card-value",onClick:_=>c(_.currentTarget.checked?"true":"false")}),s("span",{className:"setting-card-value-slider"})]}),h=null;break}const y=_=>{_.preventDefault(),c(a.value)};function S(){return t===null?null:t[0]===1?s("p",{class:"setting-card-save-status-message",children:"Value saved successfully."}):t[0]===0?t[1].toString().startsWith("SyntaxError: JSON.parse")?s("p",{class:"setting-card-save-status-message",children:"JSON is not correctly formatted."}):s("p",{class:"setting-card-save-status-message",children:"Failed to save value."}):s("p",{class:"setting-card-save-status-message",children:t[1]})}return s("div",{class:"setting-card",children:[s("div",{class:"setting-card-header",children:[s("h3",{class:"setting-card-title",children:r.name}),s("p",{class:"setting-card-key",children:r.identifier})]}),s("div",{class:"setting-card-body",children:[g,h]}),s("div",{class:"setting-card-footer",children:[S(),s("button",{class:"setting-card-button",onClick:()=>f(!0),children:s(_e,{icon:on.faTrash})}),s("button",{class:"setting-card-button",onClick:y,disabled:a.value===i.value,children:"Reset"}),s("button",{class:"setting-card-button",onClick:v,disabled:a.value===i.value,children:"Save"})]}),u,m]})}function kd(){return s("div",{className:"dashboard-spacer"})}function gb(e){const[t,n]=J("go"),r={go:`let configDN = new ConfigDN("${e.apiKey}");`,javascript:`let configDN = new ConfigDN("${e.apiKey}");`};return s("div",{className:"api-info",children:[s("h1",{className:"api-info-title",children:"Accessing this config"}),s("div",{className:"api-info-key",children:[s("p",{className:"api-info-section-title",children:["API Key (",e.config,", ",e.environment," Environment)"]}),s("p",{className:"api-info-box",children:e.apiKey})]}),s("h2",{className:"api-info-section-title",children:"Integrations"}),s("div",{className:"language-buttons",children:[s("button",{className:`language-button ${t==="go"?"selected":""}`,onClick:()=>n("go"),children:"Go"}),s("button",{className:`language-button ${t==="javascript"?"selected":""}`,onClick:()=>n("javascript"),children:"JavaScript"})]}),s("div",{className:"api-info-box",children:s("pre",{children:r[t]})})]})}function Fi(e){return s("div",{className:"setting-buttons",children:e.children})}function or(e){return s("button",{class:`setting-buttons-button button__${e.type.toLowerCase().replaceAll(" ","-")}`,onClick:e.onClick?e.onClick:()=>null,children:e.type})}function vb(e){return s("div",{className:"setting-cards",children:e.children})}const bb=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"],yb=[..."0123456789"],_b=[..."CDEHKMPRTUWXY012458"],wb=[..."!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],Sb=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],xb=(e,t)=>e[t]+(e[t+1]<<8),Ib=(e,t,n)=>{const r=t.length,a=Math.floor(65536/r)*r-1,i=2*Math.ceil(1.1*e);let o="",l=0;for(;la)&&(o+=t[u%r],l++)}}return o},Cb=new Set([void 0,"hex","base64","url-safe","numeric","distinguishable","ascii-printable","alphanumeric"]),kb=(e,t,n)=>({length:r,type:a,characters:i})=>{if(!(r>=0&&Number.isFinite(r)))throw new TypeError("Expected a `length` to be a non-negative finite number");if(a!==void 0&&i!==void 0)throw new TypeError("Expected either `type` or `characters`");if(i!==void 0&&typeof i!="string")throw new TypeError("Expected `characters` to be string");if(!Cb.has(a))throw new TypeError(`Unknown type: ${a}`);if(a===void 0&&i===void 0&&(a="hex"),a==="hex"||a===void 0&&i===void 0)return t(Math.ceil(r*.5),"hex",r);if(a==="base64")return t(Math.ceil(r*.75),"base64",r);if(a==="url-safe")return e(r,bb,n);if(a==="numeric")return e(r,yb,n);if(a==="distinguishable")return e(r,_b,n);if(a==="ascii-printable")return e(r,wb,n);if(a==="alphanumeric")return e(r,Sb,n);if(i.length===0)throw new TypeError("Expected `characters` string length to be greater than or equal to 1");if(i.length>65536)throw new TypeError("Expected `characters` string length to be less or equal to 65536");return e(r,i,n)};function Ob(e,t){return kb(Ib,e,t)}const Eb=e=>[...e].map(t=>t.toString(16).padStart(2,"0")).join(""),Pb=e=>btoa(String.fromCodePoint(...e)),xl=65536;function Od(e){const t=new Uint8Array(e);for(let n=0;n{c(a)},[a]),ee(()=>{const M=i.map(F=>{var R;const O=(R=a.find(V=>V.id===F.flag))==null?void 0:R.type;return F={...F},F.value=Il(F.value,O),F});m(M.map(F=>({...F}))),g(M.map(F=>({...F})))},[i,a]),ee(()=>{u(o)},[o]);const K=()=>{if(v===""){A("Flag name cannot be blank"),setTimeout(()=>A(""),5e3);return}if(y===""){A("Flag identifier cannot be blank"),setTimeout(()=>A(""),5e3);return}if(N===null){A("Flag type cannot be blank"),setTimeout(()=>A(""),5e3);return}if(e===void 0){A("Environment not found"),setTimeout(()=>A(""),5e3);return}L.collection("flag").create({config:r.id,type:N.value,name:v,identifier:y}).then(M=>{L.collection("value").create({environment:e.id,flag:M.id,value:ji(N.value)}).then(F=>{c(O=>[...O,{...M}]),F.value=ka(F.value,N.value),g(O=>[...O,{...F}]),m(O=>[...O,{...F}]),re(!1)}).catch(F=>{console.error(F)})}).catch(M=>{console.error(M),A("An error occurred while creating the flag")})},[re,fe]=mt(s(At,{children:[s(pt,{children:s("h1",{className:"dialog-heading",children:"Create Flag"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"Flag Name:"}),s("input",{type:"text",class:"dialog-input",value:v,placeholder:"Flag Name",onInput:M=>{if(h(M.currentTarget.value),_){let F=M.currentTarget.value.replace(/^\w|[A-Z]|\b\w/g,function(O,R){return R===0?O.toLowerCase():O.toUpperCase()}).replace(/\W+/g,"");S(F)}}}),s("label",{class:"dialog-input-label",children:"Flag Identifier:"}),s("input",{type:"text",class:"dialog-input",value:y,placeholder:"Flag Identifier",onInput:M=>{k(!1),S(M.currentTarget.value)}}),s("label",{class:"dialog-input-label",children:"Flag Type:"}),s(Go,{selectText:"Select Type",items:hb,onSelectedItemChange:T})]}),s(vt,{children:[s("button",{class:"dialog-action dialog-action__save",onClick:()=>K(),children:"Create"}),s("button",{class:"dialog-action dialog-action__cancel",onClick:()=>re(!1),children:"Cancel"}),s("p",{className:"dialog-error",children:E})]})]}),{afterSetShowing:M=>{M||(h(""),S(""),T(null),k(!0),A(""))}});if(typeof e>"u")return s("div",{class:"content",children:[s("h1",{children:"No environments found!"}),s("p",{children:["Go back to the ",s(Ze,{to:"../",children:"project page"})," to create a new environment."]})]});ee(()=>{o.length===0&&typeof e<"u"&&L.collection("api_key").create({environment:e.id,config:r.id,name:`Default API Key For ${t.name}/${n.name}/${r.name}/${e.name}`,key:Nb({length:45,type:"alphanumeric"})}).then(M=>{u([M])}).catch(M=>{console.error(M)})},[o]),ee(()=>{for(let M=0;MO.flag===F.id)===void 0&&L.collection("value").create({environment:e.id,flag:F.id,value:ji(F.type)}).then(O=>{O.value=ka(O.value,F.type),g(R=>[...R,{...O}]),m(R=>[...R,{...O}])}).catch(O=>{console.error(O)})}},[a,i]);function ie(M){g(F=>F.map(O=>O.id===M.id?M:O))}const Ee=M=>{var F;return(F=p.find(O=>O.flag===M.id))!=null?F:kl(M.type)};function ce(M){var F;return(F=f.find(O=>O.flag===M.id))!=null?F:kl(M.type)}function te(M){const F=JSON.parse(JSON.stringify(M));m(O=>O.map(R=>R.id===F.id?F:R))}function Pe(M){var R;const F=(R=a.find(V=>V.id===M.flag))==null?void 0:R.type,O={...M};return O.value=Il(M.value,F),O}function Ue(M){var F;M.preventDefault();for(let O=0;OP.id===R.id),w=f[V];if(JSON.stringify(w.value)!==JSON.stringify(p[O].value)){const P={...R};P.value=Cl(R.value,(F=a.find(W=>W.id===R.flag))==null?void 0:F.type),L.collection("value").update(R.id,P),te(R)}}}async function H(M){var O;const F=f.findIndex(R=>R.id===M.id);if(JSON.stringify(f[F].value)===JSON.stringify(M.value))return[-1,"Value is the same as the previous value"];try{const R={...M};R.value=Cl(M.value,(O=a.find(w=>w.id===M.flag))==null?void 0:O.type);const V=await L.collection("value").update(M.id,R);return te(Pe(V)),ie(Pe(V)),[1,V]}catch(R){return[0,R]}}const he=(M,F)=>{M.stopPropagation(),L.collection("flag").delete(F.id).then(()=>{c(l.filter(O=>O.id!==F.id)),g(p.filter(O=>O.flag!==F.id)),m(f.filter(O=>O.flag!==F.id))})};function me(){g(JSON.parse(JSON.stringify(f)))}return s(de,{children:[s(Wn,{children:s(Yo,{team:t,project:n,environment:e,config:r})}),s(Ge,{pageName:"dashboard dashboard-config",children:[s(vb,{children:[s("h2",{children:"Flags"}),l.map(M=>s(pb,{flag:M,originalValue:ce(M),onDelete:he,value:Ee(M),saveValue:H,setValue:ie}))]}),s(Fi,{children:[s(or,{onClick:()=>re(!0),type:"New Flag"}),s(or,{onClick:me,type:"Reset All"}),s(or,{onClick:Ue,type:"Save All"})]}),s(kd,{}),s(gb,{config:r.name,environment:e.name,apiKey:(Ce=d[0])==null?void 0:Ce.key})]}),fe]})}function Db({params:e}){return e.environment?Promise.all([L.collection("environment").getOne(e.environment,{}),L.collection("team").getOne(e.team,{expand:"owner,admins,editors,viewers"}),L.collection("project").getOne(e.project,{}),L.collection("config").getOne(e.config,{}),L.collection("flag").getFullList(void 0,{filter:`config = "${e.config}"`}),L.collection("value").getFullList(void 0,{filter:`environment = "${e.environment}" && flag.config = "${e.config}"`}),L.collection("api_key").getFullList(void 0,{filter:`config = "${e.config}" && environment = "${e.environment}"`})]):Promise.all([L.collection("environment").getList(void 0,1,{filter:`project = "${e.project}"`}).then(t=>t.items[0]||void 0)])}const Mb="/assets/404.571aed3a.svg",Ol="/assets/error.7cebe82a.svg";function Qr(){const e=bu();let t;if(e instanceof Ve)switch(e.status){case 404:t=s(Ge,{pageName:"dashboard dashboard-error",children:[s("img",{src:Mb,alt:"404"}),s("h1",{children:"404"}),s("p",{children:e.message})]});break;default:t=s(Ge,{pageName:"dashboard dashboard-error",children:[s("img",{src:Ol,alt:"500"}),s("h1",{children:"500"}),s("p",{children:e.message})]});break}else t=s(Ge,{pageName:"dashboard dashboard-error",children:[s("img",{src:Ol,alt:"500"}),s("h1",{children:"500"}),s("p",{children:e.message})]});return s(de,{children:[s(Wn,{}),t]})}function Lb(){const[e]=mn(),[t,n]=Q.useState([]),[r,a]=Q.useState(""),[i,o]=Q.useState(""),[l,c]=Q.useState(null),[d,u]=Q.useState(""),f=Ye();ee(()=>{n(e)},[e]);const m=()=>{var S,_;if(r.length===0){o("Error: Team name cannot be empty."),setTimeout(()=>o(""),5e3);return}L.collection("team").create({name:r,owner:[(_=(S=L.authStore)==null?void 0:S.model)==null?void 0:_.id]}).then(k=>{n([...t,k]),a(""),h(!1)}).catch(k=>{o("Error Creating Team: "+k.message),setTimeout(()=>o(""),5e3)})},p=()=>{l!==null&&L.collection("team").delete(l.id).then(()=>{n(S=>S.filter(_=>_.id!==l.id)),c(null),g(!1)}).catch(S=>{u("Error Deleting Team: "+S.message),setTimeout(()=>u(""),5e3)})},[g,v]=mt(s(At,{children:[s(pt,{children:s("h1",{class:"dialog-heading",children:"Delete Team"})}),s(gt,{class:"dialog-form",children:s("p",{children:["Are you sure you want to delete the team ",l==null?void 0:l.name,"? This is irreversible and will delete all associated configs, projects, environments and API Keys."]})}),s(vt,{children:[s("button",{className:"dialog-action dialog-action__delete",onClick:p,children:"Delete"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>g(!1),children:"Cancel"}),s("p",{class:"dialog-error",children:d})]})]}),{afterSetShowing:S=>{S||(c(null),u(""))}}),[h,y]=mt(s(At,{children:[s(pt,{children:s("h1",{class:"dialog-heading",children:"Create Team"})}),s(gt,{class:"dialog-form",children:[s("label",{class:"dialog-input-label",children:"Team Name:"}),s("input",{class:"dialog-input",value:r,onChange:S=>a(S==null?void 0:S.currentTarget.value),type:"text",placeholder:"Team Name"})]}),s(vt,{children:[s("button",{className:"dialog-action dialog-action__save",onClick:()=>m(),children:"Create"}),s("button",{className:"dialog-action dialog-action__cancel",onClick:()=>h(!1),children:"Cancel"}),s("p",{class:"dialog-error",children:i})]})]}),{afterSetShowing:S=>{S||a("")}});return s(de,{children:[s(Wn,{}),s(Ge,{pageName:"dashboard",children:[s(gr,{children:[s(vr,{children:"Teams"}),s(br,{children:[t.map(S=>{var _;return s(ht,{onClick:()=>f(`./${S.id}`),children:s(ut,{children:[s(dt,{children:s(Fn,{value:S.name})}),s(ft,{children:S.name}),s(mr,{children:S.owner===((_=L.authStore.model)==null?void 0:_.id)?s(pr,{onClick:k=>{k.stopPropagation(),c(S),g(!0)},children:s(_e,{icon:on.faTrash})}):null})]})},S.id)}),s(ht,{onClick:()=>h(!0),children:s(ut,{children:[s(dt,{children:s(_e,{icon:jn.faPlus})}),s(ft,{children:"New Team"})]})})]})]}),y,v]})]})}function $b(){return Promise.all([L.collection("team").getFullList()])}function Fb(){const[e]=yu(),t=Ye();return ee(()=>{const n=e.get("code"),r=Ou.get("provider"),a=location.origin+Z.OAUTH2_REDIRECT;r.state!==e.get("state")&&t(Z.LOGIN+"?error=Could not verify state, please try to login again."),n&&L.collection("users").authWithOAuth2Code(r.name,n,r.codeVerifier,a,{emailVisibility:!1}).then(async i=>{var o,l,c,d;L.collection("users").update(i.record.id,{name:(l=(o=i.meta)==null?void 0:o.name)!=null?l:"",username:(d=(c=i.meta)==null?void 0:c.username.replace(/\W/g,""))!=null?d:""}).catch(u=>console.error(u)),t(Z.DASHBOARD)}).catch(i=>t(Z.LOGIN+"?error="+i.message))},[]),s("div",{children:"Please wait while we log you in..."})}function jb(){const[e,t]=Q.useState(""),[n,r]=Q.useState({}),[a,i]=Q.useState(""),[o,l]=Q.useState(""),[c,d]=Q.useState(""),[u,f]=Q.useState(!1),[m,p]=Q.useState(!0);gn(Z.DASHBOARD,!0);async function g(v){v.preventDefault(),p(!1);try{f(!1),l(""),d(null),fetch("https://webmail-url-api.dbuidl.com/api/v1/get_web_mail?email="+encodeURIComponent(e)).then(async h=>{if(h.ok){const y=await h.json();y.success&&(l(y.web_mail_url),d(y.service_name))}}),await L.collection("users").requestPasswordReset(e),f(!0),r({}),i("If an account is associated with this email address, a password reset email has been sent."),setTimeout(()=>{window.location.pathname===Z.FORGOT_PASSWORD&&i("")},5e3)}catch(h){r(Er(h))}p(!0)}return s(ln,{class:"auth-page",children:[s(cn,{logo:un,children:s(dn,{children:s(pn,{})})}),s(Ge,{pageName:"auth-content",children:s("form",{class:"auth-form",onSubmit:g,children:[s("div",{class:"auth-form-header",children:s("p",{children:"Forgot Password?"})}),s("div",{class:"auth-form-body",children:s(et,{value:e,valueUpdate:t,name:"email",label:"Email",errors:n,type:"email",required:!0})}),s("div",{className:"auth-form-footer",children:[s("button",{className:"auth-form-submit-button",type:"submit",disabled:!m,children:"Send Password Reset"}),s("div",{className:"auth-form-submit-error",children:n.form?n.form:""}),s("div",{className:"auth-form-submit-success",children:a||""}),s("button",{style:!u||o===""?{display:"none"}:{},onClick:()=>window.open(o,"_blank")&&!1,className:"auth-form-submit-button",children:["Click here to open your ",c?c+"":"email"," inbox."]}),s("p",{className:"auth-form-text",children:["Remember your password? ",s(Ze,{to:Z.LOGIN,class:"auth-form-link",children:"Login"})]}),s("p",{className:"auth-form-text",children:["Need an account? ",s(Ze,{to:Z.REGISTER,class:"auth-form-link",children:"Register"})]})]})]})})]})}function Ub(){const[e,t]=Q.useState(""),[n,r]=Q.useState(""),[a,i]=Q.useState({}),[o,l]=Q.useState(""),[c,d]=Q.useState(!0);gn(Z.DASHBOARD,!0);const u=yp(),f=Ye();async function m(p){p.preventDefault(),d(!1);try{await L.collection("users").confirmPasswordReset(u.token||"",e,n),i({}),l("Your password has been reset successfully. You can now login."),setTimeout(()=>{window.location.pathname===Z.RESET_PASSWORD+"/"+u.token&&f(Z.LOGIN)},5e3)}catch(g){i(Er(g))}d(!0)}return s(ln,{class:"auth-page",children:[s(cn,{logo:un,children:s(dn,{children:s(pn,{})})}),s(Ge,{pageName:"auth-content",children:s("form",{class:"auth-form",onSubmit:m,children:[s("div",{class:"auth-form-header",children:s("p",{children:"Reset Password"})}),s("div",{class:"auth-form-body",children:[s(et,{value:e,valueUpdate:t,name:"password",label:"New Password",errors:a,type:"password",required:!0}),s(et,{value:n,valueUpdate:r,name:"passwordConfirm",label:"Confirm New Password",errors:a,type:"password",required:!0})]}),s("div",{className:"auth-form-footer",children:[s("button",{className:"auth-form-submit-button",type:"submit",disabled:!c,children:"Reset Password"}),s("div",{className:"auth-form-submit-error",children:[a.form?a.form:"",a.token?a.token:""]}),s("div",{className:"auth-form-submit-success",children:o||""}),s("p",{className:"auth-form-text",children:["Need a new link? ",s(Ze,{to:Z.FORGOT_PASSWORD,class:"auth-form-link",children:"Forgot Password"})]}),s("p",{className:"auth-form-text",children:["Remember your password? ",s(Ze,{to:Z.LOGIN,class:"auth-form-link",children:"Login"})]})]})]})})]})}function Bb(){const[e,t]=Q.useState(""),[n,r]=Q.useState(""),[a,i]=Q.useState(""),[o,l]=Q.useState({}),[c,d]=Q.useState(""),[u,f]=Q.useState(!0);gn(Z.DASHBOARD,!1);const[,m]=oo(),p=Ye();async function g(v){v.preventDefault(),f(!1);try{if(!m)return;await L.collection("users").update(m.id,{oldPassword:e,password:n,passwordConfirm:a}),await L.collection("users").authWithPassword(m.email,n),l({}),d("Your password has been changed successfully."),setTimeout(()=>{window.location.pathname===Z.CHANGE_PASSWORD&&p(Z.DASHBOARD)},5e3)}catch(h){l(Er(h))}f(!0)}return s(ln,{class:"auth-page",children:[s(cn,{logo:un,children:s(dn,{children:s(pn,{})})}),s(Ge,{pageName:"auth-content",children:s("form",{class:"auth-form",onSubmit:g,children:[s("div",{class:"auth-form-header",children:s("p",{children:"Reset Password"})}),s("div",{class:"auth-form-body",children:[s(et,{value:e,valueUpdate:t,name:"oldPassword",label:"Old Password",errors:o,type:"password",required:!0}),s(et,{value:n,valueUpdate:r,name:"password",label:"New Password",errors:o,type:"password",required:!0}),s(et,{value:a,valueUpdate:i,name:"passwordConfirm",label:"Confirm New Password",errors:o,type:"password",required:!0})]}),s("div",{className:"auth-form-footer",children:[s("button",{className:"auth-form-submit-button",type:"submit",disabled:!u,children:"Reset Password"}),s("div",{className:"auth-form-submit-error",children:[o.form?o.form:"",o.token?o.token:""]}),s("div",{className:"auth-form-submit-success",children:c||""}),s("p",{className:"auth-form-text",children:["Want to go back? ",s(Ze,{to:Z.USER_SETTINGS,class:"auth-form-link",children:"Account Settings"})]})]})]})})]})}function Hb(){const[,e]=oo(),t=Ye();gn(Z.LOGIN,!1);const[n,r]=J(!1),[a,i]=J(""),o=mn(),l=()=>{if(!n){r(!0),i("Are you sure you want to delete your account? This action is irreversible! Click the button again to confirm.");return}L.collection("users").delete(e==null?void 0:e.id).then(()=>{var c;(c=L.authStore)==null||c.clear(),t(Z.HOME)}).catch(()=>{i("An error occurred while deleting your account. Please try again later.")})};return s(de,{children:[s(Wn,{children:e?s("div",{className:"navbar-links-breadcrumb",children:s(Ze,{class:"breadcrumb-page",to:`/dashboard/user/${e==null?void 0:e.id}`,children:s("p",{children:"Account Settings"})})}):null}),s(Ge,{pageName:"dashboard dashboard-user-settings",children:[s("h1",{className:"action-header",children:"Change your password"}),s("p",{children:"You can do so using the button below if you know your current password. If you have forgotten it, please log out and use the forgotten password process."}),s(Fi,{children:s(or,{onClick:()=>t(Z.CHANGE_PASSWORD),type:"Change Password"})}),s("h1",{className:"action-header",children:"Delete account"}),s("p",{children:["If you want to, you can delete your ConfigDN account. This actions is ",s("strong",{children:"irreversible"}),"! ",s("strong",{children:"All teams"})," you are the owner of will also be deleted."]}),s("p",{children:"You currently own the following teams:"}),s("ul",{class:"owned-teams-list",children:o.items.map(c=>s("li",{children:s("a",{href:Z.DASHBOARD+"/"+c.id,children:c.name})}))}),s("p",{children:"You can transfer them by clicking on the links above, choosing add member, then owner and set the owner to the new owner."}),s(Fi,{children:s(or,{onClick:()=>l(),type:"Delete Account"})}),s("p",{class:"delete-account-warning",children:a}),s(kd,{})]})]})}function Vb({params:e}){return L.collection("team").getList(e.team,void 0,{expand:"owner",filter:`owner = "${e.id}"`})}const Wb=$p([{path:Z.HOME,errorElement:s(dl,{}),element:s(zp,{})},{path:Z.LOGIN,element:s(Bg,{}),loader:Hg},{path:Z.REGISTER,element:s(Vg,{}),loader:Wg},{path:Z.FORGOT_PASSWORD,element:s(jb,{})},{path:Z.RESET_PASSWORD+"/:token",element:s(Ub,{})},{path:Z.CHANGE_PASSWORD,element:s(Bb,{})},{path:Z.OAUTH2_REDIRECT,element:s(Fb,{})},{path:Z.DASHBOARD,element:s(zg,{}),children:[{path:"",element:s(Lb,{}),loader:$b,errorElement:s(Qr,{})},{path:":team",element:s(cb,{}),loader:ub,errorElement:s(Qr,{})},{path:":team/:project",element:s(db,{}),loader:fb,errorElement:s(Qr,{})},{path:":team/:project/:config",element:s(dl,{})},{path:":team/:project/:config/:environment",element:s(Rb,{}),loader:Db,errorElement:s(Qr,{})},{path:"user/:id",element:s(Hb,{}),loader:Vb}]},{path:Z.LOGOUT,element:s(qg,{})}]);An(s(kp,{router:Wb}),document.getElementById("app")); diff --git a/ui/dist/index.html b/ui/dist/index.html index 0ebea8b..0f2448a 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -5,7 +5,7 @@ ConfigDN - + diff --git a/ui/src/routes/Dashboards/User.tsx b/ui/src/routes/Dashboards/User.tsx index ec1fb2a..baf6e9d 100644 --- a/ui/src/routes/Dashboards/User.tsx +++ b/ui/src/routes/Dashboards/User.tsx @@ -40,7 +40,7 @@ export default function User() { {model ?

Account Settings

+ to={`/dashboard/user/${model?.id}`}>

Account Settings

: null}