@xras/ui 0.21.0-beta1 → 0.21.0-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/xras-ui.cjs +1 -1
- package/dist/xras-ui.js +1 -1
- package/package.json +1 -1
package/dist/xras-ui.cjs
CHANGED
|
@@ -67,4 +67,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
67
67
|
*/var ze=typeof Symbol=="function"&&Symbol.for,pp=ze?Symbol.for("react.element"):60103,hp=ze?Symbol.for("react.portal"):60106,zl=ze?Symbol.for("react.fragment"):60107,ql=ze?Symbol.for("react.strict_mode"):60108,Hl=ze?Symbol.for("react.profiler"):60114,Wl=ze?Symbol.for("react.provider"):60109,Kl=ze?Symbol.for("react.context"):60110,mp=ze?Symbol.for("react.async_mode"):60111,Gl=ze?Symbol.for("react.concurrent_mode"):60111,Yl=ze?Symbol.for("react.forward_ref"):60112,Ql=ze?Symbol.for("react.suspense"):60113,UO=ze?Symbol.for("react.suspense_list"):60120,Xl=ze?Symbol.for("react.memo"):60115,Zl=ze?Symbol.for("react.lazy"):60116,VO=ze?Symbol.for("react.block"):60121,BO=ze?Symbol.for("react.fundamental"):60117,zO=ze?Symbol.for("react.responder"):60118,qO=ze?Symbol.for("react.scope"):60119;function Ot(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case pp:switch(e=e.type,e){case mp:case Gl:case zl:case Hl:case ql:case Ql:return e;default:switch(e=e&&e.$$typeof,e){case Kl:case Yl:case Zl:case Xl:case Wl:return e;default:return t}}case hp:return t}}}function Db(e){return Ot(e)===Gl}me.AsyncMode=mp;me.ConcurrentMode=Gl;me.ContextConsumer=Kl;me.ContextProvider=Wl;me.Element=pp;me.ForwardRef=Yl;me.Fragment=zl;me.Lazy=Zl;me.Memo=Xl;me.Portal=hp;me.Profiler=Hl;me.StrictMode=ql;me.Suspense=Ql;me.isAsyncMode=function(e){return Db(e)||Ot(e)===mp};me.isConcurrentMode=Db;me.isContextConsumer=function(e){return Ot(e)===Kl};me.isContextProvider=function(e){return Ot(e)===Wl};me.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===pp};me.isForwardRef=function(e){return Ot(e)===Yl};me.isFragment=function(e){return Ot(e)===zl};me.isLazy=function(e){return Ot(e)===Zl};me.isMemo=function(e){return Ot(e)===Xl};me.isPortal=function(e){return Ot(e)===hp};me.isProfiler=function(e){return Ot(e)===Hl};me.isStrictMode=function(e){return Ot(e)===ql};me.isSuspense=function(e){return Ot(e)===Ql};me.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===zl||e===Gl||e===Hl||e===ql||e===Ql||e===UO||typeof e=="object"&&e!==null&&(e.$$typeof===Zl||e.$$typeof===Xl||e.$$typeof===Wl||e.$$typeof===Kl||e.$$typeof===Yl||e.$$typeof===BO||e.$$typeof===zO||e.$$typeof===qO||e.$$typeof===VO)};me.typeOf=Ot;Mb.exports=me;var HO=Mb.exports,Fb=HO,WO={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},KO={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Lb={};Lb[Fb.ForwardRef]=WO;Lb[Fb.Memo]=KO;var GO=!0;function YO(e,t,n){var r="";return n.split(" ").forEach(function(o){e[o]!==void 0?t.push(e[o]+";"):r+=o+" "}),r}var Ub=function(t,n,r){var o=t.key+"-"+n.name;(r===!1||GO===!1)&&t.registered[o]===void 0&&(t.registered[o]=n.styles)},QO=function(t,n,r){Ub(t,n,r);var o=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var s=n;do t.insert(n===s?"."+o:"",s,t.sheet,!0),s=s.next;while(s!==void 0)}};function XO(e){for(var t=0,n,r=0,o=e.length;o>=4;++r,o-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var ZO={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},JO=/[A-Z]|^ms/g,eP=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Vb=function(t){return t.charCodeAt(1)===45},Qm=function(t){return t!=null&&typeof t!="boolean"},Bc=OO(function(e){return Vb(e)?e:e.replace(JO,"-$&").toLowerCase()}),Xm=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(eP,function(r,o,s){return ln={name:o,styles:s,next:ln},o})}return ZO[t]!==1&&!Vb(t)&&typeof n=="number"&&n!==0?n+"px":n};function Ys(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return ln={name:n.name,styles:n.styles,next:ln},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)ln={name:r.name,styles:r.styles,next:ln},r=r.next;var o=n.styles+";";return o}return tP(e,t,n)}case"function":{if(e!==void 0){var s=ln,i=n(e);return ln=s,Ys(e,t,i)}break}}if(t==null)return n;var l=t[n];return l!==void 0?l:n}function tP(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o<n.length;o++)r+=Ys(e,t,n[o])+";";else for(var s in n){var i=n[s];if(typeof i!="object")t!=null&&t[i]!==void 0?r+=s+"{"+t[i]+"}":Qm(i)&&(r+=Bc(s)+":"+Xm(s,i)+";");else if(Array.isArray(i)&&typeof i[0]=="string"&&(t==null||t[i[0]]===void 0))for(var l=0;l<i.length;l++)Qm(i[l])&&(r+=Bc(s)+":"+Xm(s,i[l])+";");else{var c=Ys(e,t,i);switch(s){case"animation":case"animationName":{r+=Bc(s)+":"+c+";";break}default:r+=s+"{"+c+"}"}}}return r}var Zm=/label:\s*([^\s;\n{]+)\s*(;|$)/g,ln,Bb=function(t,n,r){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var o=!0,s="";ln=void 0;var i=t[0];i==null||i.raw===void 0?(o=!1,s+=Ys(r,n,i)):s+=i[0];for(var l=1;l<t.length;l++)s+=Ys(r,n,t[l]),o&&(s+=i[l]);Zm.lastIndex=0;for(var c="",u;(u=Zm.exec(s))!==null;)c+="-"+u[1];var d=XO(s)+c;return{name:d,styles:s,next:ln}},nP=function(t){return t()},rP=ma.useInsertionEffect?ma.useInsertionEffect:!1,oP=rP||nP,gp={}.hasOwnProperty,zb=w.createContext(typeof HTMLElement<"u"?LO({key:"css"}):null);zb.Provider;var sP=function(t){return w.forwardRef(function(n,r){var o=w.useContext(zb);return t(n,o,r)})},iP=w.createContext({}),xd="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",aP=function(t,n){var r={};for(var o in n)gp.call(n,o)&&(r[o]=n[o]);return r[xd]=t,r},lP=function(t){var n=t.cache,r=t.serialized,o=t.isStringTag;return Ub(n,r,o),oP(function(){return QO(n,r,o)}),null},cP=sP(function(e,t,n){var r=e.css;typeof r=="string"&&t.registered[r]!==void 0&&(r=t.registered[r]);var o=e[xd],s=[r],i="";typeof e.className=="string"?i=YO(t.registered,s,e.className):e.className!=null&&(i=e.className+" ");var l=Bb(s,void 0,w.useContext(iP));i+=t.key+"-"+l.name;var c={};for(var u in e)gp.call(e,u)&&u!=="css"&&u!==xd&&(c[u]=e[u]);return c.ref=n,c.className=i,w.createElement(w.Fragment,null,w.createElement(lP,{cache:t,serialized:l,isStringTag:typeof o=="string"}),w.createElement(o,c))}),uP=cP,G=function(t,n){var r=arguments;if(n==null||!gp.call(n,"css"))return w.createElement.apply(void 0,r);var o=r.length,s=new Array(o);s[0]=uP,s[1]=aP(t,n);for(var i=2;i<o;i++)s[i]=r[i];return w.createElement.apply(null,s)};function vp(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Bb(t)}var dP=function(){var t=vp.apply(void 0,arguments),n="animation-"+t.name;return{name:n,styles:"@keyframes "+n+"{"+t.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}};function fP(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const pP=Math.min,hP=Math.max,ol=Math.round,Fi=Math.floor,sl=e=>({x:e,y:e});function mP(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function qb(e){return Wb(e)?(e.nodeName||"").toLowerCase():"#document"}function Jt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Hb(e){var t;return(t=(Wb(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Wb(e){return e instanceof Node||e instanceof Jt(e).Node}function bd(e){return e instanceof Element||e instanceof Jt(e).Element}function yp(e){return e instanceof HTMLElement||e instanceof Jt(e).HTMLElement}function Jm(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jt(e).ShadowRoot}function Kb(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=xp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function gP(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function vP(e){return["html","body","#document"].includes(qb(e))}function xp(e){return Jt(e).getComputedStyle(e)}function yP(e){if(qb(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Jm(e)&&e.host||Hb(e);return Jm(t)?t.host:t}function Gb(e){const t=yP(e);return vP(t)?e.ownerDocument?e.ownerDocument.body:e.body:yp(t)&&Kb(t)?t:Gb(t)}function il(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Gb(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Jt(o);return s?t.concat(i,i.visualViewport||[],Kb(o)?o:[],i.frameElement&&n?il(i.frameElement):[]):t.concat(o,il(o,[],n))}function xP(e){const t=xp(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=yp(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=ol(n)!==s||ol(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function bp(e){return bd(e)?e:e.contextElement}function zc(e){const t=bp(e);if(!yp(t))return sl(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=xP(t);let i=(s?ol(n.width):n.width)/r,l=(s?ol(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const bP=sl(0);function wP(e){const t=Jt(e);return!gP()||!t.visualViewport?bP:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function SP(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Jt(e)?!1:t}function eg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=bp(e);let i=sl(1);t&&(r?bd(r)&&(i=zc(r)):i=zc(e));const l=SP(s,n,r)?wP(s):sl(0);let c=(o.left+l.x)/i.x,u=(o.top+l.y)/i.y,d=o.width/i.x,f=o.height/i.y;if(s){const p=Jt(s),y=r&&bd(r)?Jt(r):r;let m=p.frameElement;for(;m&&r&&y!==p;){const h=zc(m),x=m.getBoundingClientRect(),v=xp(m),g=x.left+(m.clientLeft+parseFloat(v.paddingLeft))*h.x,b=x.top+(m.clientTop+parseFloat(v.paddingTop))*h.y;c*=h.x,u*=h.y,d*=h.x,f*=h.y,c+=g,u+=b,m=Jt(m).frameElement}}return mP({width:d,height:f,x:c,y:u})}function _P(e,t){let n=null,r;const o=Hb(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const{left:u,top:d,width:f,height:p}=e.getBoundingClientRect();if(l||t(),!f||!p)return;const y=Fi(d),m=Fi(o.clientWidth-(u+f)),h=Fi(o.clientHeight-(d+p)),x=Fi(u),g={rootMargin:-y+"px "+-m+"px "+-h+"px "+-x+"px",threshold:hP(0,pP(1,c))||1};let b=!0;function S(_){const j=_[0].intersectionRatio;if(j!==c){if(!b)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},100)}b=!1}try{n=new IntersectionObserver(S,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,g)}n.observe(e)}return i(!0),s}function jP(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=bp(e),d=o||s?[...u?il(u):[],...il(t)]:[];d.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const f=u&&l?_P(u,n):null;let p=-1,y=null;i&&(y=new ResizeObserver(v=>{let[g]=v;g&&g.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var b;(b=y)==null||b.observe(t)})),n()}),u&&!c&&y.observe(u),y.observe(t));let m,h=c?eg(e):null;c&&x();function x(){const v=eg(e);h&&(v.x!==h.x||v.y!==h.y||v.width!==h.width||v.height!==h.height)&&n(),h=v,m=requestAnimationFrame(x)}return n(),()=>{var v;d.forEach(g=>{o&&g.removeEventListener("scroll",n),s&&g.removeEventListener("resize",n)}),f==null||f(),(v=y)==null||v.disconnect(),y=null,c&&cancelAnimationFrame(m)}}var wd=w.useLayoutEffect,CP=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],al=function(){};function EP(e,t){return t?t[0]==="-"?e+t:e+"__"+t:e}function RP(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];var s=[].concat(r);if(t&&e)for(var i in t)t.hasOwnProperty(i)&&t[i]&&s.push("".concat(EP(e,i)));return s.filter(function(l){return l}).map(function(l){return String(l).trim()}).join(" ")}var tg=function(t){return DP(t)?t.filter(Boolean):Dr(t)==="object"&&t!==null?[t]:[]},Yb=function(t){t.className,t.clearValue,t.cx,t.getStyles,t.getClassNames,t.getValue,t.hasValue,t.isMulti,t.isRtl,t.options,t.selectOption,t.selectProps,t.setValue,t.theme;var n=gn(t,CP);return K({},n)},Oe=function(t,n,r){var o=t.cx,s=t.getStyles,i=t.getClassNames,l=t.className;return{css:s(n,t),className:o(r??{},i(n,t),l)}};function NP(e,t,n){if(n){var r=n(e,t);if(typeof r=="string")return r}return e}function Jl(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function kP(e){return Jl(e)?window.innerHeight:e.clientHeight}function Qb(e){return Jl(e)?window.pageYOffset:e.scrollTop}function ll(e,t){if(Jl(e)){window.scrollTo(0,t);return}e.scrollTop=t}function TP(e){var t=getComputedStyle(e),n=t.position==="absolute",r=/(auto|scroll)/;if(t.position==="fixed")return document.documentElement;for(var o=e;o=o.parentElement;)if(t=getComputedStyle(o),!(n&&t.position==="static")&&r.test(t.overflow+t.overflowY+t.overflowX))return o;return document.documentElement}function OP(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function Li(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:al,o=Qb(e),s=t-o,i=10,l=0;function c(){l+=i;var u=OP(l,o,s,n);ll(e,u),l<n?window.requestAnimationFrame(c):r(e)}c()}function ng(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=t.offsetHeight/3;r.bottom+o>n.bottom?ll(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+o,e.scrollHeight)):r.top-o<n.top&&ll(e,Math.max(t.offsetTop-o,0))}function PP(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}function rg(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function IP(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var Xb=!1,$P={get passive(){return Xb=!0}},Ui=typeof window<"u"?window:{};Ui.addEventListener&&Ui.removeEventListener&&(Ui.addEventListener("p",al,$P),Ui.removeEventListener("p",al,!1));var AP=Xb;function MP(e){return e!=null}function DP(e){return Array.isArray(e)}function Vi(e,t,n){return e?t:n}var FP=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var s=Object.entries(t).filter(function(i){var l=Ue(i,1),c=l[0];return!r.includes(c)});return s.reduce(function(i,l){var c=Ue(l,2),u=c[0],d=c[1];return i[u]=d,i},{})},LP=["children","innerProps"],UP=["children","innerProps"];function VP(e){var t=e.maxHeight,n=e.menuEl,r=e.minHeight,o=e.placement,s=e.shouldScroll,i=e.isFixedPosition,l=e.controlHeight,c=TP(n),u={placement:"bottom",maxHeight:t};if(!n||!n.offsetParent)return u;var d=c.getBoundingClientRect(),f=d.height,p=n.getBoundingClientRect(),y=p.bottom,m=p.height,h=p.top,x=n.offsetParent.getBoundingClientRect(),v=x.top,g=i?window.innerHeight:kP(c),b=Qb(c),S=parseInt(getComputedStyle(n).marginBottom,10),_=parseInt(getComputedStyle(n).marginTop,10),j=v-_,C=g-h,E=j+b,N=f-b-h,R=y-g+b+S,T=b+h-_,k=160;switch(o){case"auto":case"bottom":if(C>=m)return{placement:"bottom",maxHeight:t};if(N>=m&&!i)return s&&Li(c,R,k),{placement:"bottom",maxHeight:t};if(!i&&N>=r||i&&C>=r){s&&Li(c,R,k);var P=i?C-S:N-S;return{placement:"bottom",maxHeight:P}}if(o==="auto"||i){var M=t,D=i?j:E;return D>=r&&(M=Math.min(D-S-l,t)),{placement:"top",maxHeight:M}}if(o==="bottom")return s&&ll(c,R),{placement:"bottom",maxHeight:t};break;case"top":if(j>=m)return{placement:"top",maxHeight:t};if(E>=m&&!i)return s&&Li(c,T,k),{placement:"top",maxHeight:t};if(!i&&E>=r||i&&j>=r){var V=t;return(!i&&E>=r||i&&j>=r)&&(V=i?j-_:E-_),s&&Li(c,T,k),{placement:"top",maxHeight:V}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(o,'".'))}return u}function BP(e){var t={bottom:"top",top:"bottom"};return e?t[e]:"bottom"}var Zb=function(t){return t==="auto"?"bottom":t},zP=function(t,n){var r,o=t.placement,s=t.theme,i=s.borderRadius,l=s.spacing,c=s.colors;return K((r={label:"menu"},so(r,BP(o),"100%"),so(r,"position","absolute"),so(r,"width","100%"),so(r,"zIndex",1),r),n?{}:{backgroundColor:c.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:l.menuGutter,marginTop:l.menuGutter})},Jb=w.createContext(null),qP=function(t){var n=t.children,r=t.minMenuHeight,o=t.maxMenuHeight,s=t.menuPlacement,i=t.menuPosition,l=t.menuShouldScrollIntoView,c=t.theme,u=w.useContext(Jb)||{},d=u.setPortalPlacement,f=w.useRef(null),p=w.useState(o),y=Ue(p,2),m=y[0],h=y[1],x=w.useState(null),v=Ue(x,2),g=v[0],b=v[1],S=c.spacing.controlHeight;return wd(function(){var _=f.current;if(_){var j=i==="fixed",C=l&&!j,E=VP({maxHeight:o,menuEl:_,minHeight:r,placement:s,shouldScroll:C,isFixedPosition:j,controlHeight:S});h(E.maxHeight),b(E.placement),d==null||d(E.placement)}},[o,s,i,l,r,d,S]),n({ref:f,placerProps:K(K({},t),{},{placement:g||Zb(s),maxHeight:m})})},HP=function(t){var n=t.children,r=t.innerRef,o=t.innerProps;return G("div",Y({},Oe(t,"menu",{menu:!0}),{ref:r},o),n)},WP=HP,KP=function(t,n){var r=t.maxHeight,o=t.theme.spacing.baseUnit;return K({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:o,paddingTop:o})},GP=function(t){var n=t.children,r=t.innerProps,o=t.innerRef,s=t.isMulti;return G("div",Y({},Oe(t,"menuList",{"menu-list":!0,"menu-list--is-multi":s}),{ref:o},r),n)},ew=function(t,n){var r=t.theme,o=r.spacing.baseUnit,s=r.colors;return K({textAlign:"center"},n?{}:{color:s.neutral40,padding:"".concat(o*2,"px ").concat(o*3,"px")})},YP=ew,QP=ew,XP=function(t){var n=t.children,r=n===void 0?"No options":n,o=t.innerProps,s=gn(t,LP);return G("div",Y({},Oe(K(K({},s),{},{children:r,innerProps:o}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),o),r)},ZP=function(t){var n=t.children,r=n===void 0?"Loading...":n,o=t.innerProps,s=gn(t,UP);return G("div",Y({},Oe(K(K({},s),{},{children:r,innerProps:o}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),o),r)},JP=function(t){var n=t.rect,r=t.offset,o=t.position;return{left:n.left,position:o,top:r,width:n.width,zIndex:1}},eI=function(t){var n=t.appendTo,r=t.children,o=t.controlElement,s=t.innerProps,i=t.menuPlacement,l=t.menuPosition,c=w.useRef(null),u=w.useRef(null),d=w.useState(Zb(i)),f=Ue(d,2),p=f[0],y=f[1],m=w.useMemo(function(){return{setPortalPlacement:y}},[]),h=w.useState(null),x=Ue(h,2),v=x[0],g=x[1],b=w.useCallback(function(){if(o){var C=PP(o),E=l==="fixed"?0:window.pageYOffset,N=C[p]+E;(N!==(v==null?void 0:v.offset)||C.left!==(v==null?void 0:v.rect.left)||C.width!==(v==null?void 0:v.rect.width))&&g({offset:N,rect:C})}},[o,l,p,v==null?void 0:v.offset,v==null?void 0:v.rect.left,v==null?void 0:v.rect.width]);wd(function(){b()},[b]);var S=w.useCallback(function(){typeof u.current=="function"&&(u.current(),u.current=null),o&&c.current&&(u.current=jP(o,c.current,b,{elementResize:"ResizeObserver"in window}))},[o,b]);wd(function(){S()},[S]);var _=w.useCallback(function(C){c.current=C,S()},[S]);if(!n&&l!=="fixed"||!v)return null;var j=G("div",Y({ref:_},Oe(K(K({},t),{},{offset:v.offset,position:l,rect:v.rect}),"menuPortal",{"menu-portal":!0}),s),r);return G(Jb.Provider,{value:m},n?Cf.createPortal(j,n):j)},tI=function(t){var n=t.isDisabled,r=t.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},nI=function(t){var n=t.children,r=t.innerProps,o=t.isDisabled,s=t.isRtl;return G("div",Y({},Oe(t,"container",{"--is-disabled":o,"--is-rtl":s}),r),n)},rI=function(t,n){var r=t.theme.spacing,o=t.isMulti,s=t.hasValue,i=t.selectProps.controlShouldRenderValue;return K({alignItems:"center",display:o&&s&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},oI=function(t){var n=t.children,r=t.innerProps,o=t.isMulti,s=t.hasValue;return G("div",Y({},Oe(t,"valueContainer",{"value-container":!0,"value-container--is-multi":o,"value-container--has-value":s}),r),n)},sI=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},iI=function(t){var n=t.children,r=t.innerProps;return G("div",Y({},Oe(t,"indicatorsContainer",{indicators:!0}),r),n)},og,aI=["size"],lI=["innerProps","isRtl","size"],cI={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},tw=function(t){var n=t.size,r=gn(t,aI);return G("svg",Y({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:cI},r))},wp=function(t){return G(tw,Y({size:20},t),G("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},nw=function(t){return G(tw,Y({size:20},t),G("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},rw=function(t,n){var r=t.isFocused,o=t.theme,s=o.spacing.baseUnit,i=o.colors;return K({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?i.neutral60:i.neutral20,padding:s*2,":hover":{color:r?i.neutral80:i.neutral40}})},uI=rw,dI=function(t){var n=t.children,r=t.innerProps;return G("div",Y({},Oe(t,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||G(nw,null))},fI=rw,pI=function(t){var n=t.children,r=t.innerProps;return G("div",Y({},Oe(t,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||G(wp,null))},hI=function(t,n){var r=t.isDisabled,o=t.theme,s=o.spacing.baseUnit,i=o.colors;return K({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?i.neutral10:i.neutral20,marginBottom:s*2,marginTop:s*2})},mI=function(t){var n=t.innerProps;return G("span",Y({},n,Oe(t,"indicatorSeparator",{"indicator-separator":!0})))},gI=dP(og||(og=fP([`
|
|
68
68
|
0%, 80%, 100% { opacity: 0; }
|
|
69
69
|
40% { opacity: 1; }
|
|
70
|
-
`]))),vI=function(t,n){var r=t.isFocused,o=t.size,s=t.theme,i=s.colors,l=s.spacing.baseUnit;return K({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:o,lineHeight:1,marginRight:o,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?i.neutral60:i.neutral20,padding:l*2})},qc=function(t){var n=t.delay,r=t.offset;return G("span",{css:vp({animation:"".concat(gI," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},yI=function(t){var n=t.innerProps,r=t.isRtl,o=t.size,s=o===void 0?4:o,i=gn(t,lI);return G("div",Y({},Oe(K(K({},i),{},{innerProps:n,isRtl:r,size:s}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),G(qc,{delay:0,offset:r}),G(qc,{delay:160,offset:!0}),G(qc,{delay:320,offset:!r}))},xI=function(t,n){var r=t.isDisabled,o=t.isFocused,s=t.theme,i=s.colors,l=s.borderRadius,c=s.spacing;return K({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:c.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?i.neutral5:i.neutral0,borderColor:r?i.neutral10:o?i.primary:i.neutral20,borderRadius:l,borderStyle:"solid",borderWidth:1,boxShadow:o?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:o?i.primary:i.neutral30}})},bI=function(t){var n=t.children,r=t.isDisabled,o=t.isFocused,s=t.innerRef,i=t.innerProps,l=t.menuIsOpen;return G("div",Y({ref:s},Oe(t,"control",{control:!0,"control--is-disabled":r,"control--is-focused":o,"control--menu-is-open":l}),i,{"aria-disabled":r||void 0}),n)},wI=bI,SI=["data"],_I=function(t,n){var r=t.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},jI=function(t){var n=t.children,r=t.cx,o=t.getStyles,s=t.getClassNames,i=t.Heading,l=t.headingProps,c=t.innerProps,u=t.label,d=t.theme,f=t.selectProps;return G("div",Y({},Oe(t,"group",{group:!0}),c),G(i,Y({},l,{selectProps:f,theme:d,getStyles:o,getClassNames:s,cx:r}),u),G("div",null,n))},CI=function(t,n){var r=t.theme,o=r.colors,s=r.spacing;return K({label:"group",cursor:"default",display:"block"},n?{}:{color:o.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:s.baseUnit*3,paddingRight:s.baseUnit*3,textTransform:"uppercase"})},EI=function(t){var n=Yb(t);n.data;var r=gn(n,SI);return G("div",Y({},Oe(t,"groupHeading",{"group-heading":!0}),r))},RI=jI,NI=["innerRef","isDisabled","isHidden","inputClassName"],kI=function(t,n){var r=t.isDisabled,o=t.value,s=t.theme,i=s.spacing,l=s.colors;return K(K({visibility:r?"hidden":"visible",transform:o?"translateZ(0)":""},TI),n?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:l.neutral80})},ow={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},TI={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":K({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},ow)},OI=function(t){return K({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},ow)},PI=function(t){var n=t.cx,r=t.value,o=Yb(t),s=o.innerRef,i=o.isDisabled,l=o.isHidden,c=o.inputClassName,u=gn(o,NI);return G("div",Y({},Oe(t,"input",{"input-container":!0}),{"data-value":r||""}),G("input",Y({className:n({input:!0},c),ref:s,style:OI(l),disabled:i},u)))},II=PI,$I=function(t,n){var r=t.theme,o=r.spacing,s=r.borderRadius,i=r.colors;return K({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:i.neutral10,borderRadius:s/2,margin:o.baseUnit/2})},AI=function(t,n){var r=t.theme,o=r.borderRadius,s=r.colors,i=t.cropWithEllipsis;return K({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:o/2,color:s.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},MI=function(t,n){var r=t.theme,o=r.spacing,s=r.borderRadius,i=r.colors,l=t.isFocused;return K({alignItems:"center",display:"flex"},n?{}:{borderRadius:s/2,backgroundColor:l?i.dangerLight:void 0,paddingLeft:o.baseUnit,paddingRight:o.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},sw=function(t){var n=t.children,r=t.innerProps;return G("div",r,n)},DI=sw,FI=sw;function LI(e){var t=e.children,n=e.innerProps;return G("div",Y({role:"button"},n),t||G(wp,{size:14}))}var UI=function(t){var n=t.children,r=t.components,o=t.data,s=t.innerProps,i=t.isDisabled,l=t.removeProps,c=t.selectProps,u=r.Container,d=r.Label,f=r.Remove;return G(u,{data:o,innerProps:K(K({},Oe(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),s),selectProps:c},G(d,{data:o,innerProps:K({},Oe(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:c},n),G(f,{data:o,innerProps:K(K({},Oe(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},l),selectProps:c}))},VI=UI,BI=function(t,n){var r=t.isDisabled,o=t.isFocused,s=t.isSelected,i=t.theme,l=i.spacing,c=i.colors;return K({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:s?c.primary:o?c.primary25:"transparent",color:r?c.neutral20:s?c.neutral0:"inherit",padding:"".concat(l.baseUnit*2,"px ").concat(l.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:s?c.primary:c.primary50}})},zI=function(t){var n=t.children,r=t.isDisabled,o=t.isFocused,s=t.isSelected,i=t.innerRef,l=t.innerProps;return G("div",Y({},Oe(t,"option",{option:!0,"option--is-disabled":r,"option--is-focused":o,"option--is-selected":s}),{ref:i,"aria-disabled":r},l),n)},qI=zI,HI=function(t,n){var r=t.theme,o=r.spacing,s=r.colors;return K({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:s.neutral50,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},WI=function(t){var n=t.children,r=t.innerProps;return G("div",Y({},Oe(t,"placeholder",{placeholder:!0}),r),n)},KI=WI,GI=function(t,n){var r=t.isDisabled,o=t.theme,s=o.spacing,i=o.colors;return K({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?i.neutral40:i.neutral80,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},YI=function(t){var n=t.children,r=t.isDisabled,o=t.innerProps;return G("div",Y({},Oe(t,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),o),n)},QI=YI,XI={ClearIndicator:pI,Control:wI,DropdownIndicator:dI,DownChevron:nw,CrossIcon:wp,Group:RI,GroupHeading:EI,IndicatorsContainer:iI,IndicatorSeparator:mI,Input:II,LoadingIndicator:yI,Menu:WP,MenuList:GP,MenuPortal:eI,LoadingMessage:ZP,NoOptionsMessage:XP,MultiValue:VI,MultiValueContainer:DI,MultiValueLabel:FI,MultiValueRemove:LI,Option:qI,Placeholder:KI,SelectContainer:nI,SingleValue:QI,ValueContainer:oI},ZI=function(t){return K(K({},XI),t.components)},sg=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function JI(e,t){return!!(e===t||sg(e)&&sg(t))}function e$(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!JI(e[n],t[n]))return!1;return!0}function t$(e,t){t===void 0&&(t=e$);var n=null;function r(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];if(n&&n.lastThis===this&&t(o,n.lastArgs))return n.lastResult;var i=e.apply(this,o);return n={lastResult:i,lastArgs:o,lastThis:this},i}return r.clear=function(){n=null},r}var n$={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},r$=function(t){return G("span",Y({css:n$},t))},ig=r$,o$={guidance:function(t){var n=t.isSearchable,r=t.isMulti,o=t.tabSelectsValue,s=t.context,i=t.isInitialFocus;switch(s){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(o?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(t["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(t){var n=t.action,r=t.label,o=r===void 0?"":r,s=t.labels,i=t.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(o,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(s.length>1?"s":""," ").concat(s.join(","),", selected.");case"select-option":return i?"option ".concat(o," is disabled. Select another option."):"option ".concat(o,", selected.");default:return""}},onFocus:function(t){var n=t.context,r=t.focused,o=t.options,s=t.label,i=s===void 0?"":s,l=t.selectValue,c=t.isDisabled,u=t.isSelected,d=t.isAppleDevice,f=function(h,x){return h&&h.length?"".concat(h.indexOf(x)+1," of ").concat(h.length):""};if(n==="value"&&l)return"value ".concat(i," focused, ").concat(f(l,r),".");if(n==="menu"&&d){var p=c?" disabled":"",y="".concat(u?" selected":"").concat(p);return"".concat(i).concat(y,", ").concat(f(o,r),".")}return""},onFilter:function(t){var n=t.inputValue,r=t.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},s$=function(t){var n=t.ariaSelection,r=t.focusedOption,o=t.focusedValue,s=t.focusableOptions,i=t.isFocused,l=t.selectValue,c=t.selectProps,u=t.id,d=t.isAppleDevice,f=c.ariaLiveMessages,p=c.getOptionLabel,y=c.inputValue,m=c.isMulti,h=c.isOptionDisabled,x=c.isSearchable,v=c.menuIsOpen,g=c.options,b=c.screenReaderStatus,S=c.tabSelectsValue,_=c.isLoading,j=c["aria-label"],C=c["aria-live"],E=w.useMemo(function(){return K(K({},o$),f||{})},[f]),N=w.useMemo(function(){var D="";if(n&&E.onChange){var V=n.option,Q=n.options,O=n.removedValue,U=n.removedValues,A=n.value,H=function(ge){return Array.isArray(ge)?null:ge},B=O||V||H(A),W=B?p(B):"",Z=Q||U||void 0,ee=Z?Z.map(p):[],X=K({isDisabled:B&&h(B,l),label:W,labels:ee},n);D=E.onChange(X)}return D},[n,E,h,l,p]),R=w.useMemo(function(){var D="",V=r||o,Q=!!(r&&l&&l.includes(r));if(V&&E.onFocus){var O={focused:V,label:p(V),isDisabled:h(V,l),isSelected:Q,options:s,context:V===r?"menu":"value",selectValue:l,isAppleDevice:d};D=E.onFocus(O)}return D},[r,o,p,h,E,s,l,d]),T=w.useMemo(function(){var D="";if(v&&g.length&&!_&&E.onFilter){var V=b({count:s.length});D=E.onFilter({inputValue:y,resultsMessage:V})}return D},[s,y,v,E,g,b,_]),k=(n==null?void 0:n.action)==="initial-input-focus",P=w.useMemo(function(){var D="";if(E.guidance){var V=o?"value":v?"menu":"input";D=E.guidance({"aria-label":j,context:V,isDisabled:r&&h(r,l),isMulti:m,isSearchable:x,tabSelectsValue:S,isInitialFocus:k})}return D},[j,r,o,m,h,x,v,E,l,S,k]),M=G(w.Fragment,null,G("span",{id:"aria-selection"},N),G("span",{id:"aria-focused"},R),G("span",{id:"aria-results"},T),G("span",{id:"aria-guidance"},P));return G(w.Fragment,null,G(ig,{id:u},k&&M),G(ig,{"aria-live":C,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!k&&M))},i$=s$,Sd=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],a$=new RegExp("["+Sd.map(function(e){return e.letters}).join("")+"]","g"),iw={};for(var Hc=0;Hc<Sd.length;Hc++)for(var Wc=Sd[Hc],Kc=0;Kc<Wc.letters.length;Kc++)iw[Wc.letters[Kc]]=Wc.base;var aw=function(t){return t.replace(a$,function(n){return iw[n]})},l$=t$(aw),ag=function(t){return t.replace(/^\s+|\s+$/g,"")},c$=function(t){return"".concat(t.label," ").concat(t.value)},u$=function(t){return function(n,r){if(n.data.__isNew__)return!0;var o=K({ignoreCase:!0,ignoreAccents:!0,stringify:c$,trim:!0,matchFrom:"any"},t),s=o.ignoreCase,i=o.ignoreAccents,l=o.stringify,c=o.trim,u=o.matchFrom,d=c?ag(r):r,f=c?ag(l(n)):l(n);return s&&(d=d.toLowerCase(),f=f.toLowerCase()),i&&(d=l$(d),f=aw(f)),u==="start"?f.substr(0,d.length)===d:f.indexOf(d)>-1}},d$=["innerRef"];function f$(e){var t=e.innerRef,n=gn(e,d$),r=FP(n,"onExited","in","enter","exit","appear");return G("input",Y({ref:t},r,{css:vp({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var p$=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function h$(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,o=e.onTopArrive,s=e.onTopLeave,i=w.useRef(!1),l=w.useRef(!1),c=w.useRef(0),u=w.useRef(null),d=w.useCallback(function(x,v){if(u.current!==null){var g=u.current,b=g.scrollTop,S=g.scrollHeight,_=g.clientHeight,j=u.current,C=v>0,E=S-_-b,N=!1;E>v&&i.current&&(r&&r(x),i.current=!1),C&&l.current&&(s&&s(x),l.current=!1),C&&v>E?(n&&!i.current&&n(x),j.scrollTop=S,N=!0,i.current=!0):!C&&-v>b&&(o&&!l.current&&o(x),j.scrollTop=0,N=!0,l.current=!0),N&&p$(x)}},[n,r,o,s]),f=w.useCallback(function(x){d(x,x.deltaY)},[d]),p=w.useCallback(function(x){c.current=x.changedTouches[0].clientY},[]),y=w.useCallback(function(x){var v=c.current-x.changedTouches[0].clientY;d(x,v)},[d]),m=w.useCallback(function(x){if(x){var v=AP?{passive:!1}:!1;x.addEventListener("wheel",f,v),x.addEventListener("touchstart",p,v),x.addEventListener("touchmove",y,v)}},[y,p,f]),h=w.useCallback(function(x){x&&(x.removeEventListener("wheel",f,!1),x.removeEventListener("touchstart",p,!1),x.removeEventListener("touchmove",y,!1))},[y,p,f]);return w.useEffect(function(){if(t){var x=u.current;return m(x),function(){h(x)}}},[t,m,h]),function(x){u.current=x}}var lg=["boxSizing","height","overflow","paddingRight","position"],cg={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function ug(e){e.preventDefault()}function dg(e){e.stopPropagation()}function fg(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;e===0?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function pg(){return"ontouchstart"in window||navigator.maxTouchPoints}var hg=!!(typeof window<"u"&&window.document&&window.document.createElement),rs=0,Wr={capture:!1,passive:!1};function m$(e){var t=e.isEnabled,n=e.accountForScrollbars,r=n===void 0?!0:n,o=w.useRef({}),s=w.useRef(null),i=w.useCallback(function(c){if(hg){var u=document.body,d=u&&u.style;if(r&&lg.forEach(function(m){var h=d&&d[m];o.current[m]=h}),r&&rs<1){var f=parseInt(o.current.paddingRight,10)||0,p=document.body?document.body.clientWidth:0,y=window.innerWidth-p+f||0;Object.keys(cg).forEach(function(m){var h=cg[m];d&&(d[m]=h)}),d&&(d.paddingRight="".concat(y,"px"))}u&&pg()&&(u.addEventListener("touchmove",ug,Wr),c&&(c.addEventListener("touchstart",fg,Wr),c.addEventListener("touchmove",dg,Wr))),rs+=1}},[r]),l=w.useCallback(function(c){if(hg){var u=document.body,d=u&&u.style;rs=Math.max(rs-1,0),r&&rs<1&&lg.forEach(function(f){var p=o.current[f];d&&(d[f]=p)}),u&&pg()&&(u.removeEventListener("touchmove",ug,Wr),c&&(c.removeEventListener("touchstart",fg,Wr),c.removeEventListener("touchmove",dg,Wr)))}},[r]);return w.useEffect(function(){if(t){var c=s.current;return i(c),function(){l(c)}}},[t,i,l]),function(c){s.current=c}}var g$=function(t){var n=t.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},v$={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function y$(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,o=r===void 0?!0:r,s=e.onBottomArrive,i=e.onBottomLeave,l=e.onTopArrive,c=e.onTopLeave,u=h$({isEnabled:o,onBottomArrive:s,onBottomLeave:i,onTopArrive:l,onTopLeave:c}),d=m$({isEnabled:n}),f=function(y){u(y),d(y)};return G(w.Fragment,null,n&&G("div",{onClick:g$,css:v$}),t(f))}var x$={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},b$=function(t){var n=t.name,r=t.onFocus;return G("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:x$,value:"",onChange:function(){}})},w$=b$;function Sp(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function S$(){return Sp(/^iPhone/i)}function lw(){return Sp(/^Mac/i)}function _$(){return Sp(/^iPad/i)||lw()&&navigator.maxTouchPoints>1}function j$(){return S$()||_$()}function C$(){return lw()||j$()}var E$=function(t){return t.label},R$=function(t){return t.label},N$=function(t){return t.value},k$=function(t){return!!t.isDisabled},T$={clearIndicator:fI,container:tI,control:xI,dropdownIndicator:uI,group:_I,groupHeading:CI,indicatorsContainer:sI,indicatorSeparator:hI,input:kI,loadingIndicator:vI,loadingMessage:QP,menu:zP,menuList:KP,menuPortal:JP,multiValue:$I,multiValueLabel:AI,multiValueRemove:MI,noOptionsMessage:YP,option:BI,placeholder:HI,singleValue:GI,valueContainer:rI},O$={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},P$=4,cw=4,I$=38,$$=cw*2,A$={baseUnit:cw,controlHeight:I$,menuGutter:$$},Gc={borderRadius:P$,colors:O$,spacing:A$},M$={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:rg(),captureMenuScroll:!rg(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:u$(),formatGroupLabel:E$,getOptionLabel:R$,getOptionValue:N$,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:k$,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!IP(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var n=t.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function mg(e,t,n,r){var o=fw(e,t,n),s=pw(e,t,n),i=dw(e,t),l=cl(e,t);return{type:"option",data:t,isDisabled:o,isSelected:s,label:i,value:l,index:r}}function fa(e,t){return e.options.map(function(n,r){if("options"in n){var o=n.options.map(function(i,l){return mg(e,i,t,l)}).filter(function(i){return vg(e,i)});return o.length>0?{type:"group",data:n,options:o,index:r}:void 0}var s=mg(e,n,t,r);return vg(e,s)?s:void 0}).filter(MP)}function uw(e){return e.reduce(function(t,n){return n.type==="group"?t.push.apply(t,cp(n.options.map(function(r){return r.data}))):t.push(n.data),t},[])}function gg(e,t){return e.reduce(function(n,r){return r.type==="group"?n.push.apply(n,cp(r.options.map(function(o){return{data:o.data,id:"".concat(t,"-").concat(r.index,"-").concat(o.index)}}))):n.push({data:r.data,id:"".concat(t,"-").concat(r.index)}),n},[])}function D$(e,t){return uw(fa(e,t))}function vg(e,t){var n=e.inputValue,r=n===void 0?"":n,o=t.data,s=t.isSelected,i=t.label,l=t.value;return(!mw(e)||!s)&&hw(e,{label:i,value:l,data:o},r)}function F$(e,t){var n=e.focusedValue,r=e.selectValue,o=r.indexOf(n);if(o>-1){var s=t.indexOf(n);if(s>-1)return n;if(o<t.length)return t[o]}return null}function L$(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}var Yc=function(t,n){var r,o=(r=t.find(function(s){return s.data===n}))===null||r===void 0?void 0:r.id;return o||null},dw=function(t,n){return t.getOptionLabel(n)},cl=function(t,n){return t.getOptionValue(n)};function fw(e,t,n){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,n):!1}function pw(e,t,n){if(n.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,n);var r=cl(e,t);return n.some(function(o){return cl(e,o)===r})}function hw(e,t,n){return e.filterOption?e.filterOption(t,n):!0}var mw=function(t){var n=t.hideSelectedOptions,r=t.isMulti;return n===void 0?r:n},U$=1,_p=function(e){rO(n,e);var t=iO(n);function n(r){var o;if(tO(this,n),o=t.call(this,r),o.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},o.blockOptionHover=!1,o.isComposing=!1,o.commonProps=void 0,o.initialTouchX=0,o.initialTouchY=0,o.openAfterFocus=!1,o.scrollToFocusedOptionOnUpdate=!1,o.userIsDragging=void 0,o.isAppleDevice=C$(),o.controlRef=null,o.getControlRef=function(c){o.controlRef=c},o.focusedOptionRef=null,o.getFocusedOptionRef=function(c){o.focusedOptionRef=c},o.menuListRef=null,o.getMenuListRef=function(c){o.menuListRef=c},o.inputRef=null,o.getInputRef=function(c){o.inputRef=c},o.focus=o.focusInput,o.blur=o.blurInput,o.onChange=function(c,u){var d=o.props,f=d.onChange,p=d.name;u.name=p,o.ariaOnChange(c,u),f(c,u)},o.setValue=function(c,u,d){var f=o.props,p=f.closeMenuOnSelect,y=f.isMulti,m=f.inputValue;o.onInputChange("",{action:"set-value",prevInputValue:m}),p&&(o.setState({inputIsHiddenAfterUpdate:!y}),o.onMenuClose()),o.setState({clearFocusValueOnUpdate:!0}),o.onChange(c,{action:u,option:d})},o.selectOption=function(c){var u=o.props,d=u.blurInputOnSelect,f=u.isMulti,p=u.name,y=o.state.selectValue,m=f&&o.isOptionSelected(c,y),h=o.isOptionDisabled(c,y);if(m){var x=o.getOptionValue(c);o.setValue(y.filter(function(v){return o.getOptionValue(v)!==x}),"deselect-option",c)}else if(!h)f?o.setValue([].concat(cp(y),[c]),"select-option",c):o.setValue(c,"select-option");else{o.ariaOnChange(c,{action:"select-option",option:c,name:p});return}d&&o.blurInput()},o.removeValue=function(c){var u=o.props.isMulti,d=o.state.selectValue,f=o.getOptionValue(c),p=d.filter(function(m){return o.getOptionValue(m)!==f}),y=Vi(u,p,p[0]||null);o.onChange(y,{action:"remove-value",removedValue:c}),o.focusInput()},o.clearValue=function(){var c=o.state.selectValue;o.onChange(Vi(o.props.isMulti,[],null),{action:"clear",removedValues:c})},o.popValue=function(){var c=o.props.isMulti,u=o.state.selectValue,d=u[u.length-1],f=u.slice(0,u.length-1),p=Vi(c,f,f[0]||null);o.onChange(p,{action:"pop-value",removedValue:d})},o.getFocusedOptionId=function(c){return Yc(o.state.focusableOptionsWithIds,c)},o.getFocusableOptionsWithIds=function(){return gg(fa(o.props,o.state.selectValue),o.getElementId("option"))},o.getValue=function(){return o.state.selectValue},o.cx=function(){for(var c=arguments.length,u=new Array(c),d=0;d<c;d++)u[d]=arguments[d];return RP.apply(void 0,[o.props.classNamePrefix].concat(u))},o.getOptionLabel=function(c){return dw(o.props,c)},o.getOptionValue=function(c){return cl(o.props,c)},o.getStyles=function(c,u){var d=o.props.unstyled,f=T$[c](u,d);f.boxSizing="border-box";var p=o.props.styles[c];return p?p(f,u):f},o.getClassNames=function(c,u){var d,f;return(d=(f=o.props.classNames)[c])===null||d===void 0?void 0:d.call(f,u)},o.getElementId=function(c){return"".concat(o.state.instancePrefix,"-").concat(c)},o.getComponents=function(){return ZI(o.props)},o.buildCategorizedOptions=function(){return fa(o.props,o.state.selectValue)},o.getCategorizedOptions=function(){return o.props.menuIsOpen?o.buildCategorizedOptions():[]},o.buildFocusableOptions=function(){return uw(o.buildCategorizedOptions())},o.getFocusableOptions=function(){return o.props.menuIsOpen?o.buildFocusableOptions():[]},o.ariaOnChange=function(c,u){o.setState({ariaSelection:K({value:c},u)})},o.onMenuMouseDown=function(c){c.button===0&&(c.stopPropagation(),c.preventDefault(),o.focusInput())},o.onMenuMouseMove=function(c){o.blockOptionHover=!1},o.onControlMouseDown=function(c){if(!c.defaultPrevented){var u=o.props.openMenuOnClick;o.state.isFocused?o.props.menuIsOpen?c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&o.onMenuClose():u&&o.openMenu("first"):(u&&(o.openAfterFocus=!0),o.focusInput()),c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&c.preventDefault()}},o.onDropdownIndicatorMouseDown=function(c){if(!(c&&c.type==="mousedown"&&c.button!==0)&&!o.props.isDisabled){var u=o.props,d=u.isMulti,f=u.menuIsOpen;o.focusInput(),f?(o.setState({inputIsHiddenAfterUpdate:!d}),o.onMenuClose()):o.openMenu("first"),c.preventDefault()}},o.onClearIndicatorMouseDown=function(c){c&&c.type==="mousedown"&&c.button!==0||(o.clearValue(),c.preventDefault(),o.openAfterFocus=!1,c.type==="touchend"?o.focusInput():setTimeout(function(){return o.focusInput()}))},o.onScroll=function(c){typeof o.props.closeMenuOnScroll=="boolean"?c.target instanceof HTMLElement&&Jl(c.target)&&o.props.onMenuClose():typeof o.props.closeMenuOnScroll=="function"&&o.props.closeMenuOnScroll(c)&&o.props.onMenuClose()},o.onCompositionStart=function(){o.isComposing=!0},o.onCompositionEnd=function(){o.isComposing=!1},o.onTouchStart=function(c){var u=c.touches,d=u&&u.item(0);d&&(o.initialTouchX=d.clientX,o.initialTouchY=d.clientY,o.userIsDragging=!1)},o.onTouchMove=function(c){var u=c.touches,d=u&&u.item(0);if(d){var f=Math.abs(d.clientX-o.initialTouchX),p=Math.abs(d.clientY-o.initialTouchY),y=5;o.userIsDragging=f>y||p>y}},o.onTouchEnd=function(c){o.userIsDragging||(o.controlRef&&!o.controlRef.contains(c.target)&&o.menuListRef&&!o.menuListRef.contains(c.target)&&o.blurInput(),o.initialTouchX=0,o.initialTouchY=0)},o.onControlTouchEnd=function(c){o.userIsDragging||o.onControlMouseDown(c)},o.onClearIndicatorTouchEnd=function(c){o.userIsDragging||o.onClearIndicatorMouseDown(c)},o.onDropdownIndicatorTouchEnd=function(c){o.userIsDragging||o.onDropdownIndicatorMouseDown(c)},o.handleInputChange=function(c){var u=o.props.inputValue,d=c.currentTarget.value;o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange(d,{action:"input-change",prevInputValue:u}),o.props.menuIsOpen||o.onMenuOpen()},o.onInputFocus=function(c){o.props.onFocus&&o.props.onFocus(c),o.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(o.openAfterFocus||o.props.openMenuOnFocus)&&o.openMenu("first"),o.openAfterFocus=!1},o.onInputBlur=function(c){var u=o.props.inputValue;if(o.menuListRef&&o.menuListRef.contains(document.activeElement)){o.inputRef.focus();return}o.props.onBlur&&o.props.onBlur(c),o.onInputChange("",{action:"input-blur",prevInputValue:u}),o.onMenuClose(),o.setState({focusedValue:null,isFocused:!1})},o.onOptionHover=function(c){if(!(o.blockOptionHover||o.state.focusedOption===c)){var u=o.getFocusableOptions(),d=u.indexOf(c);o.setState({focusedOption:c,focusedOptionId:d>-1?o.getFocusedOptionId(c):null})}},o.shouldHideSelectedOptions=function(){return mw(o.props)},o.onValueInputFocus=function(c){c.preventDefault(),c.stopPropagation(),o.focus()},o.onKeyDown=function(c){var u=o.props,d=u.isMulti,f=u.backspaceRemovesValue,p=u.escapeClearsValue,y=u.inputValue,m=u.isClearable,h=u.isDisabled,x=u.menuIsOpen,v=u.onKeyDown,g=u.tabSelectsValue,b=u.openMenuOnFocus,S=o.state,_=S.focusedOption,j=S.focusedValue,C=S.selectValue;if(!h&&!(typeof v=="function"&&(v(c),c.defaultPrevented))){switch(o.blockOptionHover=!0,c.key){case"ArrowLeft":if(!d||y)return;o.focusValue("previous");break;case"ArrowRight":if(!d||y)return;o.focusValue("next");break;case"Delete":case"Backspace":if(y)return;if(j)o.removeValue(j);else{if(!f)return;d?o.popValue():m&&o.clearValue()}break;case"Tab":if(o.isComposing||c.shiftKey||!x||!g||!_||b&&o.isOptionSelected(_,C))return;o.selectOption(_);break;case"Enter":if(c.keyCode===229)break;if(x){if(!_||o.isComposing)return;o.selectOption(_);break}return;case"Escape":x?(o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange("",{action:"menu-close",prevInputValue:y}),o.onMenuClose()):m&&p&&o.clearValue();break;case" ":if(y)return;if(!x){o.openMenu("first");break}if(!_)return;o.selectOption(_);break;case"ArrowUp":x?o.focusOption("up"):o.openMenu("last");break;case"ArrowDown":x?o.focusOption("down"):o.openMenu("first");break;case"PageUp":if(!x)return;o.focusOption("pageup");break;case"PageDown":if(!x)return;o.focusOption("pagedown");break;case"Home":if(!x)return;o.focusOption("first");break;case"End":if(!x)return;o.focusOption("last");break;default:return}c.preventDefault()}},o.state.instancePrefix="react-select-"+(o.props.instanceId||++U$),o.state.selectValue=tg(r.value),r.menuIsOpen&&o.state.selectValue.length){var s=o.getFocusableOptionsWithIds(),i=o.buildFocusableOptions(),l=i.indexOf(o.state.selectValue[0]);o.state.focusableOptionsWithIds=s,o.state.focusedOption=i[l],o.state.focusedOptionId=Yc(s,i[l])}return o}return nO(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&ng(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(o){var s=this.props,i=s.isDisabled,l=s.menuIsOpen,c=this.state.isFocused;(c&&!i&&o.isDisabled||c&&l&&!o.menuIsOpen)&&this.focusInput(),c&&i&&!o.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!c&&!i&&o.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(ng(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(o,s){this.props.onInputChange(o,s)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(o){var s=this,i=this.state,l=i.selectValue,c=i.isFocused,u=this.buildFocusableOptions(),d=o==="first"?0:u.length-1;if(!this.props.isMulti){var f=u.indexOf(l[0]);f>-1&&(d=f)}this.scrollToFocusedOptionOnUpdate=!(c&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[d],focusedOptionId:this.getFocusedOptionId(u[d])},function(){return s.onMenuOpen()})}},{key:"focusValue",value:function(o){var s=this.state,i=s.selectValue,l=s.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var c=i.indexOf(l);l||(c=-1);var u=i.length-1,d=-1;if(i.length){switch(o){case"previous":c===0?d=0:c===-1?d=u:d=c-1;break;case"next":c>-1&&c<u&&(d=c+1);break}this.setState({inputIsHidden:d!==-1,focusedValue:i[d]})}}}},{key:"focusOption",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",s=this.props.pageSize,i=this.state.focusedOption,l=this.getFocusableOptions();if(l.length){var c=0,u=l.indexOf(i);i||(u=-1),o==="up"?c=u>0?u-1:l.length-1:o==="down"?c=(u+1)%l.length:o==="pageup"?(c=u-s,c<0&&(c=0)):o==="pagedown"?(c=u+s,c>l.length-1&&(c=l.length-1)):o==="last"&&(c=l.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:l[c],focusedValue:null,focusedOptionId:this.getFocusedOptionId(l[c])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Gc):K(K({},Gc),this.props.theme):Gc}},{key:"getCommonProps",value:function(){var o=this.clearValue,s=this.cx,i=this.getStyles,l=this.getClassNames,c=this.getValue,u=this.selectOption,d=this.setValue,f=this.props,p=f.isMulti,y=f.isRtl,m=f.options,h=this.hasValue();return{clearValue:o,cx:s,getStyles:i,getClassNames:l,getValue:c,hasValue:h,isMulti:p,isRtl:y,options:m,selectOption:u,selectProps:f,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var o=this.state.selectValue;return o.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var o=this.props,s=o.isClearable,i=o.isMulti;return s===void 0?i:s}},{key:"isOptionDisabled",value:function(o,s){return fw(this.props,o,s)}},{key:"isOptionSelected",value:function(o,s){return pw(this.props,o,s)}},{key:"filterOption",value:function(o,s){return hw(this.props,o,s)}},{key:"formatOptionLabel",value:function(o,s){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,l=this.state.selectValue;return this.props.formatOptionLabel(o,{context:s,inputValue:i,selectValue:l})}else return this.getOptionLabel(o)}},{key:"formatGroupLabel",value:function(o){return this.props.formatGroupLabel(o)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var o=this.props,s=o.isDisabled,i=o.isSearchable,l=o.inputId,c=o.inputValue,u=o.tabIndex,d=o.form,f=o.menuIsOpen,p=o.required,y=this.getComponents(),m=y.Input,h=this.state,x=h.inputIsHidden,v=h.ariaSelection,g=this.commonProps,b=l||this.getElementId("input"),S=K(K(K({"aria-autocomplete":"list","aria-expanded":f,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":p,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},f&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?(v==null?void 0:v.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?w.createElement(m,Y({},g,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:b,innerRef:this.getInputRef,isDisabled:s,isHidden:x,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:d,type:"text",value:c},S)):w.createElement(f$,Y({id:b,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:al,onFocus:this.onInputFocus,disabled:s,tabIndex:u,inputMode:"none",form:d,value:""},S))}},{key:"renderPlaceholderOrValue",value:function(){var o=this,s=this.getComponents(),i=s.MultiValue,l=s.MultiValueContainer,c=s.MultiValueLabel,u=s.MultiValueRemove,d=s.SingleValue,f=s.Placeholder,p=this.commonProps,y=this.props,m=y.controlShouldRenderValue,h=y.isDisabled,x=y.isMulti,v=y.inputValue,g=y.placeholder,b=this.state,S=b.selectValue,_=b.focusedValue,j=b.isFocused;if(!this.hasValue()||!m)return v?null:w.createElement(f,Y({},p,{key:"placeholder",isDisabled:h,isFocused:j,innerProps:{id:this.getElementId("placeholder")}}),g);if(x)return S.map(function(E,N){var R=E===_,T="".concat(o.getOptionLabel(E),"-").concat(o.getOptionValue(E));return w.createElement(i,Y({},p,{components:{Container:l,Label:c,Remove:u},isFocused:R,isDisabled:h,key:T,index:N,removeProps:{onClick:function(){return o.removeValue(E)},onTouchEnd:function(){return o.removeValue(E)},onMouseDown:function(P){P.preventDefault()}},data:E}),o.formatOptionLabel(E,"value"))});if(v)return null;var C=S[0];return w.createElement(d,Y({},p,{data:C,isDisabled:h}),this.formatOptionLabel(C,"value"))}},{key:"renderClearIndicator",value:function(){var o=this.getComponents(),s=o.ClearIndicator,i=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!this.isClearable()||!s||c||!this.hasValue()||u)return null;var f={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return w.createElement(s,Y({},i,{innerProps:f,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var o=this.getComponents(),s=o.LoadingIndicator,i=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!s||!u)return null;var f={"aria-hidden":"true"};return w.createElement(s,Y({},i,{innerProps:f,isDisabled:c,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var o=this.getComponents(),s=o.DropdownIndicator,i=o.IndicatorSeparator;if(!s||!i)return null;var l=this.commonProps,c=this.props.isDisabled,u=this.state.isFocused;return w.createElement(i,Y({},l,{isDisabled:c,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var o=this.getComponents(),s=o.DropdownIndicator;if(!s)return null;var i=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return w.createElement(s,Y({},i,{innerProps:u,isDisabled:l,isFocused:c}))}},{key:"renderMenu",value:function(){var o=this,s=this.getComponents(),i=s.Group,l=s.GroupHeading,c=s.Menu,u=s.MenuList,d=s.MenuPortal,f=s.LoadingMessage,p=s.NoOptionsMessage,y=s.Option,m=this.commonProps,h=this.state.focusedOption,x=this.props,v=x.captureMenuScroll,g=x.inputValue,b=x.isLoading,S=x.loadingMessage,_=x.minMenuHeight,j=x.maxMenuHeight,C=x.menuIsOpen,E=x.menuPlacement,N=x.menuPosition,R=x.menuPortalTarget,T=x.menuShouldBlockScroll,k=x.menuShouldScrollIntoView,P=x.noOptionsMessage,M=x.onMenuScrollToTop,D=x.onMenuScrollToBottom;if(!C)return null;var V=function(W,Z){var ee=W.type,X=W.data,ie=W.isDisabled,ge=W.isSelected,Se=W.label,Ae=W.value,F=h===X,L=ie?void 0:function(){return o.onOptionHover(X)},te=ie?void 0:function(){return o.selectOption(X)},J="".concat(o.getElementId("option"),"-").concat(Z),re={id:J,onClick:te,onMouseMove:L,onMouseOver:L,tabIndex:-1,role:"option","aria-selected":o.isAppleDevice?void 0:ge};return w.createElement(y,Y({},m,{innerProps:re,data:X,isDisabled:ie,isSelected:ge,key:J,label:Se,type:ee,value:Ae,isFocused:F,innerRef:F?o.getFocusedOptionRef:void 0}),o.formatOptionLabel(W.data,"menu"))},Q;if(this.hasOptions())Q=this.getCategorizedOptions().map(function(B){if(B.type==="group"){var W=B.data,Z=B.options,ee=B.index,X="".concat(o.getElementId("group"),"-").concat(ee),ie="".concat(X,"-heading");return w.createElement(i,Y({},m,{key:X,data:W,options:Z,Heading:l,headingProps:{id:ie,data:B.data},label:o.formatGroupLabel(B.data)}),B.options.map(function(ge){return V(ge,"".concat(ee,"-").concat(ge.index))}))}else if(B.type==="option")return V(B,"".concat(B.index))});else if(b){var O=S({inputValue:g});if(O===null)return null;Q=w.createElement(f,m,O)}else{var U=P({inputValue:g});if(U===null)return null;Q=w.createElement(p,m,U)}var A={minMenuHeight:_,maxMenuHeight:j,menuPlacement:E,menuPosition:N,menuShouldScrollIntoView:k},H=w.createElement(qP,Y({},m,A),function(B){var W=B.ref,Z=B.placerProps,ee=Z.placement,X=Z.maxHeight;return w.createElement(c,Y({},m,A,{innerRef:W,innerProps:{onMouseDown:o.onMenuMouseDown,onMouseMove:o.onMenuMouseMove},isLoading:b,placement:ee}),w.createElement(y$,{captureEnabled:v,onTopArrive:M,onBottomArrive:D,lockEnabled:T},function(ie){return w.createElement(u,Y({},m,{innerRef:function(Se){o.getMenuListRef(Se),ie(Se)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:o.getElementId("listbox")},isLoading:b,maxHeight:X,focusedOption:h}),Q)}))});return R||N==="fixed"?w.createElement(d,Y({},m,{appendTo:R,controlElement:this.controlRef,menuPlacement:E,menuPosition:N}),H):H}},{key:"renderFormField",value:function(){var o=this,s=this.props,i=s.delimiter,l=s.isDisabled,c=s.isMulti,u=s.name,d=s.required,f=this.state.selectValue;if(d&&!this.hasValue()&&!l)return w.createElement(w$,{name:u,onFocus:this.onValueInputFocus});if(!(!u||l))if(c)if(i){var p=f.map(function(h){return o.getOptionValue(h)}).join(i);return w.createElement("input",{name:u,type:"hidden",value:p})}else{var y=f.length>0?f.map(function(h,x){return w.createElement("input",{key:"i-".concat(x),name:u,type:"hidden",value:o.getOptionValue(h)})}):w.createElement("input",{name:u,type:"hidden",value:""});return w.createElement("div",null,y)}else{var m=f[0]?this.getOptionValue(f[0]):"";return w.createElement("input",{name:u,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var o=this.commonProps,s=this.state,i=s.ariaSelection,l=s.focusedOption,c=s.focusedValue,u=s.isFocused,d=s.selectValue,f=this.getFocusableOptions();return w.createElement(i$,Y({},o,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:l,focusedValue:c,isFocused:u,selectValue:d,focusableOptions:f,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var o=this.getComponents(),s=o.Control,i=o.IndicatorsContainer,l=o.SelectContainer,c=o.ValueContainer,u=this.props,d=u.className,f=u.id,p=u.isDisabled,y=u.menuIsOpen,m=this.state.isFocused,h=this.commonProps=this.getCommonProps();return w.createElement(l,Y({},h,{className:d,innerProps:{id:f,onKeyDown:this.onKeyDown},isDisabled:p,isFocused:m}),this.renderLiveRegion(),w.createElement(s,Y({},h,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:p,isFocused:m,menuIsOpen:y}),w.createElement(c,Y({},h,{isDisabled:p}),this.renderPlaceholderOrValue(),this.renderInput()),w.createElement(i,Y({},h,{isDisabled:p}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(o,s){var i=s.prevProps,l=s.clearFocusValueOnUpdate,c=s.inputIsHiddenAfterUpdate,u=s.ariaSelection,d=s.isFocused,f=s.prevWasFocused,p=s.instancePrefix,y=o.options,m=o.value,h=o.menuIsOpen,x=o.inputValue,v=o.isMulti,g=tg(m),b={};if(i&&(m!==i.value||y!==i.options||h!==i.menuIsOpen||x!==i.inputValue)){var S=h?D$(o,g):[],_=h?gg(fa(o,g),"".concat(p,"-option")):[],j=l?F$(s,g):null,C=L$(s,S),E=Yc(_,C);b={selectValue:g,focusedOption:C,focusedOptionId:E,focusableOptionsWithIds:_,focusedValue:j,clearFocusValueOnUpdate:!1}}var N=c!=null&&o!==i?{inputIsHidden:c,inputIsHiddenAfterUpdate:void 0}:{},R=u,T=d&&f;return d&&!T&&(R={value:Vi(v,g,g[0]||null),options:g,action:"initial-input-focus"},T=!f),(u==null?void 0:u.action)==="initial-input-focus"&&(R=null),K(K(K({},b),N),{},{prevProps:o,ariaSelection:R,prevWasFocused:T})}}]),n}(w.Component);_p.defaultProps=M$;var V$=w.forwardRef(function(e,t){var n=Rb(e);return w.createElement(_p,Y({ref:t},n))}),jp=V$;function go({bg:e="dark",children:t,color:n="light",fontWeight:r="bold",icon:o="info-circle-fill",initial:s=!1,maxWidth:i="200px",padding:l="10px",placement:c,target:u,trigger:d="click",visible:f=!0}){const p=typeof s=="string"||s instanceof String,[y,m]=w.useState(p?localStorage.getItem(s)!="true":s),[h,x]=w.useState(!1);w.useEffect(()=>{setTimeout(()=>x(!0),100)},[]);const v=()=>{p&&localStorage.setItem(s,"true")},g=a.jsxs(Ll,{style:{"--bs-tooltip-bg":`var(--bs-${e})`,"--bs-tooltip-color":`var(--bs-${n})`,"--bs-tooltip-max-width":i,"--bs-tooltip-padding-x":l,"--bs-tooltip-padding-y":l,fontWeight:r},children:[a.jsx("button",{"aria-label":"Close",onClick:()=>{v(),m(!1)},style:{background:"transparent",border:"0 none transparent",float:"right"},children:a.jsx("i",{className:"bi bi-x-lg"})}),t]});return u&&u.current?a.jsx(jb,{target:u.current,placement:c,show:y&&f&&h,children:g}):a.jsx(lp,{placement:c,onToggle:b=>{v(),m(b)},overlay:g,show:y&&f&&h,trigger:d,children:a.jsx("button",{className:"btn bnt-clear border-0",style:{backgroundColor:"transparent"},children:a.jsx("i",{className:`bi bi-${o}`})})})}const B$="_items_c2dbg_1",z$="_item_c2dbg_1",q$="_details_c2dbg_14",H$="_text_c2dbg_20",W$="_number_c2dbg_35",K$="_outer_c2dbg_50",G$="_inner_c2dbg_61",xn={items:B$,item:z$,details:q$,text:H$,number:W$,outer:K$,inner:G$},os=(e,t)=>`${Math.cos(2*Math.PI*e)*t} ${Math.sin(2*Math.PI*e)*t}`;function Y$({requestId:e,grantNumber:t,creditColorClass:n="gray-300",colorClasses:r=Zu}){const{request:o}=at(e,t);if(!o)return;let s=0,i;const l=[];for(let p of o.resources)p.isBoolean||(p.isCredit?i=p:l.push(p),s+=Ju(p));const c=[],u=[];let d=-.25;const f=[...l,i].map((p,y)=>{if(!p)return null;const m=y+1,x=Ju(p)/s,v=p.requested-p.used,g=Math.max(0,v),b=p.isCredit?s/p.exchangeRates.base.unitCost:p.requested,S=b==0?0:100*g/b,j=`var(--bs-${p.isCredit?n:r[y%r.length]})`;if(x>0){const C=d,E=d+x/2,N=d+=x,R=x>.5?1:0,T=[`M ${os(C,100)}`,`A 100 100 0 ${R} 1 ${os(N,100)}`,`L ${os(N,50)}`,`A 50 50 0 ${R} 0 ${os(C,50)}`].join(" "),[k,P]=os(E,75).split(" ").map(M=>parseFloat(M));c.push(a.jsx("path",{d:T,style:{fill:j}},p.resourceId)),u.push(a.jsx("circle",{cx:k,cy:P,r:"8",fill:"black"},`${p.resourceId}-circle`),a.jsx("text",{x:k-4,y:P+4,fill:"white",className:xn.number,children:m},`${p.resourceId}-text`))}return p.isCredit&&u.push(a.jsx("foreignObject",{x:"-50",y:"-50",width:"100",height:"100",children:a.jsx("div",{className:xn.text,children:a.jsxs("div",{children:[a.jsx("strong",{children:nt(g,{abbreviate:!0})}),p.unit," available"]})})},"center-text")),a.jsxs("li",{className:xn.item,children:[a.jsx("span",{className:xn.number,children:m}),a.jsx("span",{className:`${xn.outer} ms-2 me-2`,style:{borderColor:j},children:a.jsx("span",{className:xn.inner,style:{backgroundColor:j,width:`${S}%`}})}),a.jsxs("strong",{className:xn.name,children:[a.jsx(Jn,{resource:p,userGuide:!1}),": "]}),a.jsxs("span",{className:xn.details,children:[nt(v,{abbreviate:!0})," ",p.isCredit?null:a.jsxs(a.Fragment,{children:["of ",nt(b,{abbreviate:!0})," "]}),p.unit," ",p.isCredit?"available":"remaining"," (",Math.round(S),"%)"]})]},p.resourceId)});return a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-lg-3 mb-3 d-flex flex-row align-items-center justify-content-center",children:a.jsxs("svg",{version:"1.1",viewBox:"-100 -100 200 200",width:"200",height:"200",xmlns:"http://www.w3.org/2000/svg",children:[c,u]})}),a.jsx("div",{className:"col-lg-9 mb-3 d-flex flex-column justify-content-center",children:a.jsx("ul",{className:xn.items,children:f})})]})}const yg=e=>e;function Q$({classes:e,clean:t=yg,format:n=yg,label:r,setValue:o,style:s,value:i}){const l=n(i),[c,u]=w.useState(l);return w.useEffect(()=>{u(l)},[l]),a.jsx("input",{type:"text","aria-label":r,className:`form-control ${e}`,value:c,style:s,onChange:d=>u(d.target.value),onBlur:d=>{const f=t(d.target.value);u(n(f)),o(f)},onKeyDown:d=>{d.code=="Enter"&&(d.preventDefault(),d.target.blur())}})}function X$({requestId:e,grantNumber:t}){const{request:n,addResource:r,openUsageDetailModal:o,resetResources:s,setResourceRequest:i,setResourcesReason:l,statuses:c,toggleActionsModal:u,toggleConfirmModal:d,toggleResourcesModal:f}=at(e,t),{project:p}=Rt(t||n&&n.grantNumber),y=w.useRef(null),m=w.useRef(null);if(!n||!p)return;const h="Exchange"in n.allowedActions,x="Renewal"in n.allowedActions,v="Supplement"in n.allowedActions,g=n.exchangeStatus==c.pending,b=n.exchangeStatus==c.success,S=n.exchangeStatus==c.error,_=n.exchangeErrors,j=n.exchangeActionId!==null,C=n.exchangeActionEditable,E=n.resources,N=n.resourcesReason,R={};for(let F of E)R[F.resourceId]=F;const T=()=>{px(n)>=.75?u():d()},k=[];for(let F of E){let L=[];if(F.requested>0){for(let te of F.requires||[]){let J=R[te];if(J){if(J.requested>0){L=[];break}L.push(J)}}L.length&&k.push(a.jsxs("span",{children:[a.jsx(Jn,{resource:F,userGuide:!1})," requires"," ",fx(L.map(te=>a.jsx(Jn,{resource:te,userGuide:!1},te.resourceId)),"or"),"."]},F.resourceId))}}const P=k.length>0;let M;b?M=a.jsx(be,{color:"info",children:"Your exchange request has been submitted."}):S&&_.length>0&&_[0].includes("PI")&&_[0].includes("person status Unknown")?M=a.jsx(be,{color:"danger",children:p.currentUser.role==="pi"?a.jsxs(a.Fragment,{children:["Please"," ",a.jsx("a",{href:ne.routes.profile_path(),children:"update your academic status"})," ","before making an exchange request."]}):a.jsxs(a.Fragment,{children:["The primary investigator for this project has an unknown academic status. Please ask"," ",p.users.filter(F=>F.role==="pi").map(F=>`${F.firstName} ${F.lastName}`)," ","to update the academic status in their profile, and then try again."]})}):S?M=a.jsxs(be,{color:"danger",children:["Sorry, something went wrong: ",_.join(", "),". For assistance, please"," ",a.jsx("a",{href:"https://support.access-ci.org/open-a-ticket",children:"open a help ticket"})," ","and include this message."]}):j?M=a.jsx(be,{color:"warning",children:"You have an exchange request under review. The information below reflects the pending exchange request."}):n.timeStatus=="current"&&!p.isManager?M=a.jsxs(be,{color:"warning",children:["You do not have permission to manage resources for this project. Please contact ",Mf(p)," to request a change."]}):P&&(M=a.jsxs(be,{color:"warning",children:[k," Please adjust your balance values."]}));const D=N.length>0;let V=!1,Q=!1;for(let F of E)if(F.isNew&&(V=!0),F.allocated!=F.requested&&(Q=!0),V&&Q)break;const O=E.map(F=>F.resourceId),U={},A={},H=[];if(h&&C){n.allowedActions.Exchange.resources.filter(F=>!O.includes(F.resourceId)).map(F=>{U[F.resourceId]=F;const L=`${F.type} Resources (${F.unit})`;A[L]=A[L]||[],A[L].push(F)});for(const[F,L]of Object.entries(A))H.push({label:F,options:L.sort((te,J)=>te.exchangeRates.current.unitCost<J.exchangeRates.current.unitCost||te.exchangeRates.current.unitCost==J.exchangeRates.current.unitCost&&te.name<J.name?-1:1).map(te=>{const J=Ol(te.name),re=J.short?`${J.short} (${J.full.replace(/ \([^(]+\)/,"")})`:J.full;return{value:te.resourceId,label:re}})}),H.sort((te,J)=>te.label<J.label?-1:1)}const B=h?n.allowedActions.Exchange.resources.map(F=>F.resourceId):[];let W;const Z=[],ee=[];for(let F of E)F.isCredit?W=F:(Z.push(F),ee.push(C&&(F.isNew||F.allocated!=F.requested)?Cr.edited:B.includes(F.resourceId)?"":Cr.disabled));const X=`Add ${Z.length?"another":"a"} resource to your exchange...`,ie=F=>F.requested-F.used,ge=(F,L)=>{const te=L.allocated-L.used,J=po(Number(F.replace(/[^0-9-.]/g,"")),L.decimalPlaces),re=Math.min(0,te);if(J<re)return re;let lt=W.requested*W.exchangeRates.base.unitCost;const Pt=(L.allocated-L.requested)*L.exchangeRates.base.unitCost,It=Math.min(lt,Pt);lt-=It;let ct=L.requested-L.used+It/L.exchangeRates.base.unitCost;return lt>0&&(ct+=lt/L.exchangeRates.current.unitCost),J>ct?po(ct,L.decimalPlaces,"floor"):J},Se=F=>F.isBoolean?a.jsx(a.Fragment,{children:"—"}):a.jsxs(a.Fragment,{children:[kn(ne.resourceTypeIcons[W.icon]),a.jsx("span",{className:"ms-2",children:CC(F.unit,F.exchangeRates.current.unitCost,W.name)})]}),Ae=[{key:"name",name:"Resource",format:(F,L)=>a.jsxs(a.Fragment,{children:[a.jsx(Jn,{resource:L}),(p.currentUser.resourceIds.includes(L.resourceId)||p.currentUser.resourceAccountInactiveIds.includes(L.resourceId))&&a.jsx(tl,{icon:"table",onClick:()=>o(L.resourceRepositoryKey),target:"_blank",title:`${L.name} Usage Details`})," ",a.jsx(Oo,{status:L.isActive?"Active":L.isNew?"New":"Inactive"})]}),width:Math.min(350,window.innerWidth*.3)},{key:"unit",name:"Unit Cost",width:300,format:(F,L)=>Se(L)}];return h&&Ae.push({key:"requested",name:"Balance",class:"text-end",rowClass:F=>C&&B.includes(F.resourceId)?Cr.input:"",format:(F,L)=>{const te=C&&B.includes(L.resourceId);return L.isBoolean?a.jsxs("span",{className:"d-flex",children:[a.jsx("span",{className:"w-100",children:a.jsx("input",{className:"form-check-input",type:"checkbox",checked:F==1,disabled:!te,onChange:J=>i(L.resourceId,J.target.checked?1:0)})}),a.jsx("span",{className:"text-start ps-2",style:{width:"8rem"},children:"Requested"})]}):a.jsxs("span",{className:"d-flex",children:[te?a.jsx(Q$,{classes:"text-end w-100",clean:J=>ge(J,L),format:nt,label:`Balance for ${L.name}`,setValue:J=>{i(L.resourceId,J+L.used)},style:{padding:"0.1rem 0.5rem"},value:ie(L)}):a.jsx("span",{children:nt(ie(L))}),a.jsx("span",{className:"text-start ps-2",style:{width:"8rem"},children:L.unit})]})},formatHeader:F=>a.jsxs(a.Fragment,{children:[F,C?a.jsx(go,{bg:"secondary",color:"dark",initial:"myprojects.requestedAllocation",placement:"top-end",visible:p.tab=="resources",children:"You can increase or decrease the balance below to change your allocation on a resource. Enter the total amount you would like to have available once the exchange is complete."}):null]})},{key:"change",name:"Credit Change",format:(F,L)=>{const J=-1*(L.requested-L.allocated)*L.exchangeRates.current.unitCost;return J!==0?a.jsxs("span",{className:`badge bg-${J>0?"primary":"danger"} rounded-pill`,children:[J>0?"+":"",nt(J,W)," ",W.unit]}):a.jsx(a.Fragment,{children:"—"})}}),a.jsxs("div",{className:"resources",children:[M,E.length?a.jsx(Y$,{requestId:e}):null,W&&(h||x||v)?a.jsxs("h2",{className:"mb-1 mt-2 d-flex justify-content-between",children:[a.jsxs("span",{children:[kn(ne.resourceTypeIcons.credit)," ",nt(W.requested,W)," ",W.unit," available to exchange"]}),x||v?a.jsxs("button",{type:"button",className:"btn btn-sm btn-primary ms-2",onClick:T,children:[kn(ne.resourceTypeIcons.credit)," Request More"," ",n.usesCredits?"Credits":"Units"]}):null]}):null,Z.length?a.jsx(Un,{columns:Ae,rows:Z,rowClasses:ee,classes:H.length?"mb-0":"",frozenColumns:2,minWidth:"800px"}):a.jsx("div",{className:"card p-2 text-bg-light p-3",children:"This project does not have any resources."}),H.length?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"p-2",style:{backgroundColor:"var(--teal-200)",border:"1px solid #cccccc",marginTop:"-1px"},ref:y,children:a.jsx(jp,{classNames:{control:()=>"react-select mb-1"},options:H,onChange:F=>r(F.value),placeholder:X,value:null,"aria-label":X,formatOptionLabel:({value:F,label:L})=>{const te=U[F];return a.jsxs("span",{className:"d-flex justify-content-between",children:[a.jsx("span",{children:a.jsx(Jn,{resource:te,userGuide:!1},L)}),a.jsx("span",{children:Se(te)})]})}})}),Z.length?null:a.jsx(go,{bg:"secondary",color:"dark",visible:p.tab=="resources",initial:!0,target:y,children:"Ready to get started? Search for a resource to add it to your project."}),a.jsxs("p",{className:"text-black-50",style:{fontSize:"0.9rem"},children:["Need help choosing a resource? Visit our"," ",a.jsx("a",{href:ne.routes.resources_path(),children:"Resource Catalog"}),"."]})]}):null,h&&C?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{htmlFor:"resources-reason",className:"form-label required",children:"Please briefly explain how the requested resources and amounts will contribute to your research."}),a.jsx("textarea",{className:"form-control",id:"resources-reason",rows:"2",value:N,onChange:F=>l(F.target.value),style:{minHeight:"3rem"}})]}),a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",disabled:g||!Q&&!D&&!V,onClick:s,children:"Reset Form"}),a.jsx("button",{ref:m,type:"button",className:"btn btn-secondary",disabled:g||!Q||!D||P,onClick:f,children:g?"Submitting...":"Submit for Approval"})]}),Q&&!P?a.jsx(go,{bg:"secondary",color:"dark",initial:"myprojects.submitExchange",maxWidth:"390px",placement:"right",target:m,visible:p.tab=="resources",children:"When you are finished adding resources, enter a justification for the requested resources above. Then you can submit your exchange for approval."}):null]}):null]})}function Z$({question:e,requestId:t,grantNumber:n}){const{request:r,setResourceQuestionValues:o}=at(t,n),s=w.useId();if(!e||!r||r.error)return;const{attributeSetId:i,attributes:l,fieldType:c,label:u,resourceId:d,values:f}=e,p=l[0],y=p.required?"required":"",m=b=>o(d,i,b.target.value?[b.target.value]:[]),h=b=>{o(d,i,Array.from(b.target.options).filter(({selected:S})=>S).map(({value:S})=>parseInt(S,10)))},x=b=>{const S=parseInt(b.target.value,10),_=b.target.checked?[...f,S]:f.filter(j=>j!=S);o(d,i,_)},v=b=>{const S=parseInt(b.target.value);o(d,i,isNaN(S)?[]:[S])};let g;if(["calendar","integer_only","text"].includes(c)){const b={calendar:"date",integer_only:"number",text:"text"}[c];g=a.jsx("input",{className:"form-control",id:s,type:b,placeholder:p.label,required:p.required,value:f[0]||"",onChange:c=="integer_only"?v:m})}else if(c=="textarea")g=a.jsx("textarea",{className:"form-control",id:s,placeholder:p.label,required:p.required,value:f[0]||"",onChange:m});else if(c=="drop_down"||l.length>=10){const b=c=="multi_sel";g=a.jsxs("select",{id:s,className:"form-select",required:p.required,multiple:b,onChange:b?h:v,value:b?f:f[0]||"",children:[b?null:a.jsx("option",{}),l.map(S=>a.jsx("option",{value:S.resourceAttributeId,children:S.label},S.resourceAttributeId))]})}else g=a.jsx("div",{id:s,children:l.map(b=>{const S=`resource-attribute-${b.resourceAttributeId}`;return a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:c=="single_sel"?"radio":"checkbox",id:S,value:b.resourceAttributeId,checked:f.includes(b.resourceAttributeId),onChange:c=="single_sel"?v:x}),a.jsx("label",{className:"form-check-label",htmlFor:S,children:b.label})]},b.resourceAttributeId)})});return a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{htmlFor:s,className:`form-label ${y}`,children:u}),g]})}function J$({requestId:e,grantNumber:t}){const{request:n,saveResources:r,toggleResourcesModal:o}=at(e,t),{project:s}=Rt(t||n.grantNumber);if(!n||!s||n.error||s.error)return;const i=[],l=n.resources.filter(u=>u.allocated!=u.requested).map(u=>{const d=u.requested-u.allocated;return u.questions&&i.push(...u.questions),a.jsxs("li",{className:"list-group-item d-flex justify-content-between align-items-center mb-0",children:[u.name,a.jsx("span",{className:`badge bg-${d>0?"primary":"danger"} rounded-pill`,children:u.isBoolean?Af(u.requested):a.jsxs(a.Fragment,{children:[d>0?"+":"",nt(d,u)," ",u.unit]})})]},u.resourceId)}),c=i.some(({attributes:u,values:d})=>d.length==0&&u[0].required);return a.jsxs(ve,{size:"lg",show:n.showResourcesModal,onHide:o,scrollable:!0,children:[a.jsx(ve.Header,{closeButton:!0,children:a.jsx(ve.Title,{children:"Complete Your Exchange"})}),a.jsxs(ve.Body,{children:[a.jsx("p",{children:"Please review your exchange to make sure it includes all the resources you need. Once you submit it, you will not be able to request another exchange until this one has been processed by the resource providers."}),a.jsx("ul",{className:"list-group mb-3",children:l}),i.length?a.jsxs(a.Fragment,{children:[a.jsx("h2",{children:"Resource Questions"}),a.jsx("p",{children:"Some of the resources you selected have associated questions. Please answer the questions below."}),i.map(u=>a.jsx(Z$,{question:u,requestId:e,grantNumber:t},u.attributeSetId))]}):null]}),a.jsx(ve.Footer,{children:a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-primary me-2",onClick:o,children:"Continue Editing"}),a.jsx("button",{type:"button",className:"btn btn-secondary",onClick:r,disabled:c,children:"Submit"})]})})]})}function gw({user:e}){const t=`${e.lastName}, ${e.firstName}`;let n=t,r=[e.organization,e.email].filter(o=>o).join(", ");return r&&(n+=`: ${r}`),a.jsx("abbr",{title:n,children:t})}function eA({requestId:e,grantNumber:t}){const{project:n}=Rt(t),{request:r,closeUsageDetailModal:o}=at(e,t);if(!r||r.error||!n||n.error||!r.usageDetailStatus)return;let s,i="Usage";if(r.usageDetailStatus==Le.pending)s=a.jsx(Do,{});else if(r.usageDetailStatus==Le.error)s=a.jsx(be,{color:"danger",children:"An error occurred while loading usage data."});else{const{projectTitle:l,resourceDisplayName:c,resourceRepositoryKey:u,users:d}=r.usageDetail,{full:f,short:p}=Ol(c),y=r.resources.find(v=>v.resourceRepositoryKey==u),m=v=>nt(v,{decimalPlaces:y?y.decimalPlaces:void 0}),h={};for(let v of n.users)h[v.username]=v;i=a.jsxs(a.Fragment,{children:["Usage: ",p||f," for ",l]});const x=[{key:"name",name:"Name",format:(v,{lastName:g,firstName:b,portalUsername:S})=>{const _=h[S];return _?a.jsx(gw,{user:_}):`${g}, ${b}`}},{key:"portalUsername",name:"Resource Username",format:v=>{const g=h[v],b=g?g.resourceUsernames[y.resourceId]:null;return b||a.jsx(a.Fragment,{children:"—"})}},{key:"role",name:"Role",format:v=>hx[v].name},{key:"lastWeek",name:"Last Week",class:"text-end",format:m},{key:"lastMonth",name:"Last Month",class:"text-end",format:m},{key:"lastQuarter",name:"Last 3 Months",class:"text-end",format:m},{key:"currentRequest",name:"Current Allocation",class:"text-end",format:m},{key:"total",name:"All Time",class:"text-end",format:m}];s=d.length?a.jsx(Un,{rows:d,columns:x}):a.jsx(be,{color:"info",children:"There is no usage for this resource."})}return a.jsxs(ve,{show:!0,size:"lg",onHide:o,scrollable:!0,children:[a.jsx(ve.Header,{closeButton:!0,children:a.jsx(ve.Title,{children:i})}),a.jsx(ve.Body,{children:s})]})}var tA=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];function nA(e){var t=e.defaultOptions,n=t===void 0?!1:t,r=e.cacheOptions,o=r===void 0?!1:r,s=e.loadOptions;e.options;var i=e.isLoading,l=i===void 0?!1:i,c=e.onInputChange,u=e.filterOption,d=u===void 0?null:u,f=gn(e,tA),p=f.inputValue,y=w.useRef(void 0),m=w.useRef(!1),h=w.useState(Array.isArray(n)?n:void 0),x=Ue(h,2),v=x[0],g=x[1],b=w.useState(typeof p<"u"?p:""),S=Ue(b,2),_=S[0],j=S[1],C=w.useState(n===!0),E=Ue(C,2),N=E[0],R=E[1],T=w.useState(void 0),k=Ue(T,2),P=k[0],M=k[1],D=w.useState([]),V=Ue(D,2),Q=V[0],O=V[1],U=w.useState(!1),A=Ue(U,2),H=A[0],B=A[1],W=w.useState({}),Z=Ue(W,2),ee=Z[0],X=Z[1],ie=w.useState(void 0),ge=Ue(ie,2),Se=ge[0],Ae=ge[1],F=w.useState(void 0),L=Ue(F,2),te=L[0],J=L[1];o!==te&&(X({}),J(o)),n!==Se&&(g(Array.isArray(n)?n:void 0),Ae(n)),w.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var re=w.useCallback(function(It,ct){if(!s)return ct();var Ce=s(It,ct);Ce&&typeof Ce.then=="function"&&Ce.then(ct,function(){return ct()})},[s]);w.useEffect(function(){n===!0&&re(_,function(It){m.current&&(g(It||[]),R(!!y.current))})},[]);var lt=w.useCallback(function(It,ct){var Ce=NP(It,ct,c);if(!Ce){y.current=void 0,j(""),M(""),O([]),R(!1),B(!1);return}if(o&&ee[Ce])j(Ce),M(Ce),O(ee[Ce]),R(!1),B(!1);else{var Bn=y.current={};j(Ce),R(!0),B(!P),re(Ce,function(zn){m&&Bn===y.current&&(y.current=void 0,R(!1),M(Ce),O(zn||[]),B(!1),X(zn?K(K({},ee),{},so({},Ce,zn)):ee))})}},[o,re,P,ee,c]),Pt=H?[]:_&&P?Q:v||[];return K(K({},f),{},{options:Pt,isLoading:N||l,onInputChange:lt,filterOption:d})}var rA=w.forwardRef(function(e,t){var n=nA(e),r=Rb(n);return w.createElement(_p,Y({ref:t},r))}),oA=rA;const xg=({description:e,disabled:t=!1,onChange:n,selectedLength:r,totalLength:o})=>{const s=w.useRef(),i=w.useId();let l=r==o,c=r>0&&!l;return w.useEffect(()=>{s.current&&(s.current.checked=l,s.current.indeterminate=c)},[l,c]),a.jsxs(a.Fragment,{children:[a.jsx("input",{className:"custom-checkbox form-check-input",disabled:t,id:i,onChange:u=>n(u.target.checked),ref:s,type:"checkbox"}),a.jsx("label",{className:"form-check-label",htmlFor:i,"aria-description":`${l?"Deselect":"Select"} ${e}`})]})};function sA({grantNumber:e,requestId:t}){const{project:n,addUser:r,resetUsers:o,saveUsers:s,setTab:i,setUserRole:l,statuses:c,toggleUsersResources:u}=Rt(e),{request:d}=n?at(t||n.currentRequestId,e):{request:null};if(!n||!n.currentRequestId||!d||n.error||d.error)return;const f=n.isManager,p="Exchange"in d.allowedActions,y=n.usersStatus==c.pending,m=n.usersStatus==c.success,h=n.usersStatus==c.error,x=n.users,v=d.resources.filter(od),g=v.length==0,b=x.find(R=>R.hasChanges)!==void 0,S=x.find(R=>R.role!="pi")!==void 0;let _;m&&!b?_=a.jsx(be,{color:"info",children:"Your changes have been saved. Creation of user accounts can take some time. Users can check the status of their accounts on the Overview tab of the My Projects page."}):h?_=a.jsx(be,{color:"danger",children:"Sorry, your changes could not be saved. Please try again later."}):f?v.length?g&&(_=a.jsx(be,{color:"warning",children:"This project does not have any active resources."})):_=a.jsxs(be,{color:"warning",children:["This project does not have any resources."," ",p?a.jsx("a",{href:ne.routes.request_action_path(d.requestId,"new?action_type=Exchange"),onClick:R=>{R.preventDefault(),i("resources")},children:"Exchange credits for resources."}):null," ","Additional users can be added after an exchange is approved."]}):_=a.jsxs(be,{color:"warning",children:["You do not have permission to manage users for this project. Please contact ",Mf(n)," to request a change."]});const j=(R,T)=>{let k,P,M,D;if(T.key=="all"){k="all resources for all users",P=V=>u(V),M=0;for(let V of x)M+=V.resourceIds.length;D=x.length*v.length}else k=`all users for ${T.name}`,P=V=>u(V,null,T.key),M=x.filter(({resourceIds:V})=>V.includes(T.key)).length,D=x.length;return a.jsxs(a.Fragment,{children:[T.key=="all"?R:a.jsx(Jn,{resource:T,userGuide:!1}),a.jsx("br",{}),a.jsx(xg,{description:k,disabled:T.disabled,onChange:P,selectedLength:M,totalLength:D})]})},C=Pl.map(({role:R,name:T})=>a.jsx("option",{value:R,children:T},R)),E=[{key:"name",name:"Name",width:200,format:(R,T)=>a.jsx(gw,{user:T})},{key:"username",name:"ACCESS Username",width:100},{key:"role",name:"Role",width:100,format:(R,T)=>a.jsx("select",{className:"form-select",value:R,onChange:k=>l(T.username,k.target.value),disabled:!f||R=="pi"||R=="co_pi",style:{position:"absolute",left:0,top:0,bottom:0,right:0,borderWidth:0},children:C.filter(k=>k.key==R||!["pi","co_pi"].includes(k.key))})}];v.length&&E.push({key:"all",name:"All Resources",class:`text-center ${Cr.important}`,disabled:!f||g,width:100,format:(R,T)=>a.jsx(xg,{description:`all users for ${T.name}`,disabled:!f||g,onChange:k=>u(k,T.username),selectedLength:T.resourceIds.length,totalLength:v.length}),formatHeader:j});for(let R of v)E.push({key:R.resourceId,name:R.name,class:"text-center",disabled:!f||!R.isActive,icon:R.icon,format:(T,k)=>a.jsx(a.Fragment,{children:a.jsx("input",{className:"form-check-input",disabled:!f||!R.isActive,onChange:P=>u(P.target.checked,k.username,R.resourceId),type:"checkbox",checked:k.resourceIds.includes(R.resourceId)})}),formatHeader:j});const N=x.map(R=>R.hasChanges?Cr.edited:"");return a.jsxs(a.Fragment,{children:[_,a.jsx(Un,{rows:x,columns:E,frozenColumns:v.length?4:3,classes:"mb-0",minWidth:"800px",rowClasses:N,scrollRowIndex:n.usersNewRowIndex}),f&&v.length&&!g?a.jsx("div",{style:{marginTop:"-1px",position:"relative",zIndex:100},children:a.jsx(oA,{classNames:{control:()=>"react-select"},loadOptions:async R=>(await PE(R)).map(k=>({isDisabled:k.eligibility==="no",label:a.jsxs("span",{className:"d-flex justify-content-between",children:[a.jsxs("span",{className:k.eligibility==="no"?"text-decoration-line-through":"",style:{color:k.eligibility==="no"?"#707070":void 0},children:[k.username," (",k.firstName," ",k.lastName,","," ",k.organization,k.email?`, ${k.email}`:""]}),k.eligibility==="no"&&k.eligibilityReason&&a.jsxs("span",{className:"text-danger ms-2",children:[a.jsx("i",{className:"bi bi-exclamation-octagon"})," ",k.eligibilityReason]})]}),value:k})),onChange:R=>r(R.value),placeholder:"Add another user...",value:null,"aria-label":"Add another user"})}):null,f&&(v.length&&!g||S)?a.jsxs("div",{className:"d-flex mt-3",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",disabled:y||!b,onClick:o,children:"Reset Form"}),a.jsx("button",{type:"button",className:"btn btn-secondary",disabled:y||!b,onClick:s,children:y?"Saving...":"Save Changes"})]}):null]})}function iA({requestId:e,grantNumber:t}){const{request:n}=at(e,t),{project:r,setRequest:o,setTab:s}=Rt(t||n.grantNumber);if(!n)return;if(n.error)return a.jsx(be,{color:"danger",children:n.error});const i=n.timeStatus||n.actions[0].status.toLowerCase(),l=n.actions.find(({showDeleteModal:d})=>d),c=[];n.resources.length||c.push("resources"),e!=r.currentRequestId&&c.push("users");const u=(r.users||[]).filter(d=>d.eligibility==="no"&&d.role!=="user");return a.jsxs("div",{className:"request",children:[n.returnedForCorrections?a.jsxs(be,{color:"warning",children:[a.jsx("p",{children:"Your request has been returned for corrections. These are the notes from the Allocations Team"}),a.jsx("div",{className:iR.returnedForCorrectionsNotes,children:n.returnedForCorrectionsNotes}),a.jsx("p",{className:"mt-3",children:"Please address these issues by clicking the Edit button to edit your request."})]}):"",n.timeStatus!="current"&&!n.returnedForCorrections?a.jsxs(be,{color:"warning",children:["You are viewing ","aeiou".includes(i[0])?"an":"a"," ",i," request."," ",c.length?`You cannot manage ${c.join(" or ")} for this request.`:""," ",r.currentRequestId?a.jsx("a",{href:ne.routes.request_path(r.currentRequestId),onClick:d=>{d.preventDefault(),o(r.currentRequestId)},children:"Go to the current request."}):null]}):null,r.isManager&&e===r.currentRequestId&&u.length>0&&a.jsxs(be,{color:"danger",children:["Some project personnel need to update their profiles. You will be unable to submit exchanges, renewals, and other actions until these issues are resolved:",a.jsx("br",{}),a.jsx("ul",{className:"fs-6 mb-0",children:u.map(d=>a.jsxs("li",{children:[a.jsxs("strong",{children:[d.firstName," ",d.lastName," (",d.username,"):"]})," ",d.eligibilityReason]},d.username))})]}),a.jsxs(gN,{activeKey:r.tab,onSelect:s,className:"mt-3 mb-3",children:[a.jsx(Ii,{eventKey:"overview",title:"Overview",className:"mb-0",children:a.jsx(YT,{requestId:e,grantNumber:t})}),a.jsx(Ii,{eventKey:"resources",title:n.usesCredits?"Credits + Resources":"Resources",disabled:c.includes("resources"),children:a.jsx(X$,{requestId:e})}),a.jsx(Ii,{eventKey:"users",title:"Users + Roles",disabled:c.includes("users"),children:a.jsx(sA,{grantNumber:t})}),a.jsx(Ii,{eventKey:"history",title:"History",children:a.jsx(jT,{requestId:e})})]}),a.jsx(bT,{grantNumber:t,requestId:e}),a.jsx(wT,{grantNumber:t,requestId:e}),a.jsx(ST,{grantNumber:t,requestId:e,actionId:l?l.actionId:null}),a.jsx(J$,{grantNumber:t,requestId:e}),a.jsx(eA,{grantNumber:t,requestId:e})]})}function aA({requestId:e,grantNumber:t}){const{request:n,toggleActionsModal:r,toggleDeleteModal:o}=at(e,t);if(!n)return;const{actions:s,allowedActions:i}=n,l=[];i&&(("Extension"in i||"Renewal"in i)&&l.push(["Extend End Date",u=>{u.preventDefault(),r()},"calendar-plus"]),"Final Report"in i&&l.push(["Submit Final Report",`${ne.routes.request_action_path(e,"new")}?action_type=Final+Report`,"file-earmark-check"]));const c=s.find(u=>u.isRequest);if(c){const u=c.allowedOperations||[];u.includes("Edit")&&l.push(["Edit",ne.routes.edit_request_path(n.requestId),"pencil"]),u.includes("Delete")&&l.push(["Delete",d=>{d.preventDefault(),o(c.actionId)},"trash","danger"])}return l.map(([u,d,f,p])=>{const y=a.jsxs(a.Fragment,{children:[" ",f&&a.jsx("i",{className:`bi bi-${f} me-1`}),u]});return typeof d=="function"?a.jsx("button",{className:`btn btn-${p||"primary"} ms-2 text-nowrap`,onClick:d,children:y},u):a.jsx("a",{className:`btn btn-${p||"primary"} ms-2 text-nowrap`,href:d,children:y},u)})}function lA({open:e=!1,grantNumber:t,title:n,status:r}){const[o,s]=w.useState(e),{project:i,setRequest:l}=Rt(t,!o&&n&&r&&!0),c=`project-${t}`;let u=null;if(o&&i)if(i.error)u=a.jsx(be,{color:"danger",children:i.error});else{let d;const f=i.requestsList.map(p=>(p.requestId==i.selectedRequestId&&(d=p),a.jsx("option",{value:p.requestId,children:$f(p)},p.requestId)));u=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"d-flex",children:[a.jsx("select",{className:"form-select","aria-label":"Select a request to display",onChange:p=>l(parseInt(p.target.value,10)),value:i.selectedRequestId,disabled:f.length<2,children:f}),a.jsx(aA,{requestId:i.selectedRequestId,grantNumber:t})]}),d?a.jsx(iA,{...d,grantNumber:t}):null]})}return a.jsxs("div",{className:`${vm.project} card mb-3`,children:[a.jsxs("div",{className:`card-header d-flex justify-content-between ${o?"":"border-bottom-0"}`,children:[a.jsx("button",{"aria-expanded":o,"aria-controls":c,className:vm.expand,onClick:()=>s(!o),children:a.jsxs("h2",{className:"mb-1 mt-1 text-start",children:[a.jsx("i",{className:`bi bi-caret-${o?"down":"right"}-fill`})," ",/^[A-Z]/.test(t)?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"grant-number",children:[t,":"]})," "]}):null,n||i.title]})}),a.jsx(Oo,{status:r||i.status})]}),a.jsx("div",{className:"card-body",id:c,hidden:!o||!i,children:u})]})}function cA({username:e,openFirst:t=1}){const{error:n,loading:r,projects:o}=nR(e);if(r)return a.jsx(Do,{});if(n)return a.jsxs(be,{color:"danger",children:[n," ",a.jsx("a",{href:"#",onClick:i=>{i.preventDefault(),window.location.reload()},children:"Reload the page"})," ","to try again."]});if(!o.length)return a.jsxs("div",{className:"pt-5 pb-5 text-bg-light border border-light-subtle",children:[a.jsx("p",{className:"fs-2 text-center mb-4",children:"You don't have any projects yet."}),a.jsxs("div",{className:"d-flex gap-2 justify-content-center",children:[a.jsxs("a",{className:"btn btn-primary w-25",href:ne.routes.project_types_path(),children:[a.jsx("i",{className:"bi bi-boxes fs-1 d-block"})," Learn about Project Types"]}),a.jsxs("a",{className:"btn btn-secondary w-25",href:ne.routes.get_your_first_project_path(),children:[a.jsx("i",{className:"bi bi-cpu fs-1 d-block"})," Learn How to Get Your"," ",a.jsx("br",{className:"d-none d-xxl-inline"})," First Project"]}),a.jsxs("a",{className:"btn btn-primary w-25",href:ne.routes.how_to_path(),children:[a.jsx("i",{className:"bi bi-person-plus fs-1 d-block"})," Learn How to Join an Existing Project"]})]})]});const s=new URLSearchParams(window.location.hash.slice(1)).get("grantNumber");return o.map((i,l)=>a.jsx(lA,{open:s?s==i.grantNumber:l<t,...i},i.grantNumber))}const vw={apiUrl:null,listIsFiltered:!1,pages:1,projects:[],projectsLoaded:!1,filtersLoaded:!0,showPagination:!1,singleEntry:!1,filters:{org:"",allocationType:"",allFosToggled:!0,resource:"",requestNumber:""},pageData:{current_page:1,last_page:1},typeLists:{orgs:[],fosTypes:[],allocationTypes:[],resources:[]}},uA=Ye("projectsBrowser/initApp",async(e,{getState:t,dispatch:n})=>{const r=window.location.search,o=new URLSearchParams(r);o.has("_requestNumber")&&(n(Cd({name:"requestNumber",value:o.get("_requestNumber")})),n(xw(!0))),await n(_d()),await n(Rr()),n(dA())}),dA=Ye("projectsBrowser/filterCleanup",async(e,{getState:t,dispatch:n})=>{const o=t().projectsBrowser.typeLists;n(yw({...o,orgs:["-- ALL --"].concat(o.orgs)}))}),_d=Ye("projectsBrowser/getFilters",async(e,{getState:t,dispatch:n})=>{const o=`${t().projectsBrowser.apiUrl}?filters=1`,i=await(await fetch(o)).json();n(yw(i.filters))}),Rr=Ye("projectsBrowser/getProjects",async(e,{getState:t,dispatch:n})=>{const r=t().projectsBrowser,o=r.filters,s=r.typeLists,i=s.fosTypes.filter(d=>d.checked);let l=`${r.apiUrl}?page=${r.pageData.current_page}`;return o.requestNumber!=""?(l+=`&request_number=${o.requestNumber}`,n(bg(!0))):(n(bg(!1)),i.length!=s.fosTypes.length&&(l+=`&fos=${i.map(d=>d.fosTypeId).join(",")}`),o.org!=""&&o.org!="-- ALL --"&&(l+=`&org=${encodeURIComponent(o.org)}`),o.allocationType!=""&&(l+=`&allocation_type=${o.allocationType}`),o.resource!=""&&(l+=`&resources=${o.resource}`)),await(await fetch(l)).json()}),Cp=ri({name:"projectsBrowser",initialState:vw,reducers:{resetFilters:e=>{e.filters={org:"",allocationType:"",allFosToggled:!1,resource:"",requestNumber:""},e.singleEntry=!1,Cp.caseReducers.toggleAllFos(e)},setApiUrl:(e,{payload:t})=>{e.apiUrl=t},setShowPagination:(e,{payload:t})=>{e.showPagination=t},setTypeLists:(e,{payload:t})=>{e.typeLists=t},toggleAllFos:e=>{e.typeLists.fosTypes.forEach(t=>t.checked=!e.filters.allFosToggled),e.filters.allFosToggled=!e.filters.allFosToggled},toggleFos:(e,{payload:t})=>{e.typeLists.fosTypes.forEach(n=>{n.fosTypeId==t.fosTypeId&&(n.checked=!n.checked)}),e.typeLists.fosTypes.filter(n=>n.checked).length!=e.typeLists.fosTypes.length?e.filters.allFosToggled=!1:e.filters.allFosToggled=!0},toggleListFiltered:(e,{payload:t})=>{e.listIsFiltered=t},toggleSingleEntry:(e,{payload:t})=>{e.singleEntry=t},updateFilter:(e,{payload:t})=>{e.filters[t.name]=t.value},updatePageData:(e,{payload:t})=>{t.current_page&&(e.pageData.current_page=t.current_page),t.last_page&&(e.pageData.last_page=t.last_page)}},extraReducers:e=>{e.addCase(Rr.pending,t=>{t.projectsLoaded=!1}).addCase(Rr.fulfilled,(t,n)=>{const r=n.payload;t.projectsLoaded=!0,t.projects=r.projects,r.pages!=t.pageData.last_page&&(t.pageData.current_page=1),t.showPagination=!0,t.pageData.last_page=r.pages}).addCase(Rr.rejected,(t,n)=>{console.log(n.error)}).addCase(_d.pending,t=>{t.filtersLoaded=!1}).addCase(_d.fulfilled,t=>{t.filtersLoaded=!0})}}),{resetFilters:fA,setApiUrl:fD,setShowPagination:jd,setTypeLists:yw,toggleAllFos:pA,toggleFos:hA,toggleListFiltered:xw,toggleSingleEntry:bg,updateFilter:Cd,updatePageData:ul}=Cp.actions,mA=e=>e.projectsBrowser.filters,gA=e=>e.projectsBrowser.filtersLoaded,vA=e=>e.projectsBrowser.listIsFiltered,yA=e=>e.projectsBrowser.singleEntry,xA=e=>e.projectsBrowser.projectsLoaded,bA=e=>e.projectsBrowser.pageData,wA=e=>e.projectsBrowser.projects,SA=e=>e.projectsBrowser.filtersLoaded&&e.projectsBrowser.projectsLoaded&&e.projectsBrowser.pageData.last_page>1,_A=e=>e.projectsBrowser.typeLists,jA=Cp.reducer;const CA=()=>{const e=it(),t=pe(mA),n=pe(_A),r=pe(vA),o=n.orgs.map(h=>({label:h,value:h})),s=w.useRef(),[i,l]=w.useState(null),c={height:"200px",overflowX:"auto",padding:"2px"},u=h=>{e(Cd({name:h.target.name,value:h.target.value}))},d=()=>{window.scrollTo(0,0),p(!0),e(jd(!1)),e(ul({current_page:1})),e(Rr())},f=()=>{l(null),e(jd(!1)),e(ul({current_page:1})),e(fA()),r&&(window.scrollTo(0,0),e(Rr()),p(!1))},p=h=>{e(xw(h))},y=h=>{l(h),e(Cd({name:"org",value:h.value}))},m=()=>t.org==""&&t.allocationType==""&&t.allFosToggled&&t.resource==""&&t.requestNumber=="";return a.jsx("div",{className:"row sticky-top mb-2",children:a.jsxs("div",{className:"col",children:[a.jsx("h3",{className:"mb-2",children:"Filters"}),a.jsx("h5",{className:"mb-1",children:"Field of Science"}),a.jsxs("div",{className:"border mb-3",style:c,children:[a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:"checkbox",value:"",id:"toggle_all",checked:t.allFosToggled,onChange:()=>{e(pA())}}),a.jsx("label",{className:"form-check-label",htmlFor:"toggle_all",children:"(Toggle All)"})]}),n.fosTypes.map(h=>a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:"checkbox",value:h.fosTypeId,id:`fos_${h.fosTypeId}`,checked:h.checked,onChange:()=>e(hA(h))}),a.jsx("label",{className:"form-check-label",htmlFor:`fos_${h.fosTypeId}`,children:h.fosName})]},`fos_${h.fosTypeId}`))]}),a.jsx("h5",{id:"org_select_label",className:"mb-1",children:"Organization"}),a.jsx("div",{className:"mb-3",children:a.jsx(jp,{options:o,openMenuOnClick:!0,name:"org",inputId:"orgs_filter",ref:s,closeMenuOnSelect:!0,onChange:y,value:i,"aria-labelledby":"org_select_label"},"org_select")}),a.jsx("h5",{id:"project_type_label",className:"mb-1",children:a.jsx("abbr",{title:'A specific level of allocation; also referred to as "Opportunity"',children:"Project Type"})}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"allocationType",id:"project_type_select",value:t.allocationType,className:"form-control","aria-labelledby":"project_type_label",onChange:h=>u(h),children:[a.jsx("option",{value:"",children:"-- All --"}),n.allocationTypes.map((h,x)=>a.jsx("option",{value:h,children:h},`allocation_type_${x}`))]})}),a.jsx("h5",{id:"resource_filter_label",className:"mb-1",children:"Resource"}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"resource",id:"resource_select",value:t.resource,className:"form-control","aria-labelledby":"resource_filter_label",onChange:h=>u(h),children:[a.jsx("option",{value:"",children:"-- All --"}),n.resources.map((h,x)=>a.jsx("option",{value:h.resourceId,children:h.resourceName},`resource_${x}`))]})}),a.jsx("h5",{id:"request_number_label",className:"mb-1",children:"Request Number"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{type:"text",className:"form-control",value:t.requestNumber,name:"requestNumber",id:"requestNumber","aria-labelledby":"request_number_label",onChange:h=>u(h)})}),a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{className:"btn btn-primary me-2",onClick:d,children:"Submit"}),a.jsx("button",{className:"btn btn-secondary",disabled:m(),onClick:f,children:"Reset"})]})]})})};const EA=({project:e})=>{const t=e.resources,[n,r]=w.useState(!1),o=pe(yA);let s={flush:!0,className:"mt-3 mb-1",alwaysOpen:!0};const i=g=>{let b=g.units?g.units:g.resourceUnits;const S=g.allocation?g.allocation:g.amount;if(b=="[Yes = 1, No = 0]"||b=="Yes / No")return S=="1.0"?"Yes":"No";{let _="0";return parseInt(S)&&(_=parseInt(S).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")),b=="ACCESS Credits"&&(b=a.jsx("span",{className:"tooltip-underline",title:"universal currency that can be exchanged for resource units",children:"ACCESS Credits"})),b=="Dollars"?`$${_}`:a.jsxs(a.Fragment,{children:[_," ",b]})}},l=()=>{const{origin:g,pathname:b}=window.location,S=`${g}${b}?_requestNumber=${e.requestNumber}`;navigator.clipboard.writeText(S),setTimeout(()=>r(!1),2e3)},c=()=>e.requestNumber&&e.requestNumber!=""?`(${e.requestNumber})`:"",u=a.jsx(Ll,{id:"link-tooltip",children:"Link Copied!"}),d=()=>{if(c()){const g={background:"none",border:"none",color:"#fff",fontSize:"24px"};return a.jsx(lp,{placement:"left",trigger:"click",defaultShow:n,show:n,onToggle:()=>r(!n),overlay:u,children:a.jsx("button",{onClick:l,style:g,children:a.jsx("i",{className:"bi bi-link-45deg",children:a.jsx("div",{className:"d-none",children:"Direct link to project"})})})})}return a.jsx(a.Fragment,{})},f=()=>{const g=e.pi.split(",");return`${g[1]} ${g[0]}`},p=()=>!e.coPis||e.coPis.length<=0?"":a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsxs("small",{className:"fst-italic",children:["CoPI(s): ",e.coPis.map(g=>`${g.name} (${g.organization})`).join(";")]})]}),y=()=>!e.beginDate||!e.endDate?"-":a.jsxs(a.Fragment,{children:[e.beginDate," to ",e.endDate]}),m=()=>e.allocationType==="NAIRR Start-Up"?a.jsxs("span",{className:"fw-bold",children:[c()," Start-Up: ",f(),", ",a.jsxs("em",{children:[" ",e.piInstitution," "]})," "]}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"fw-bold",children:[c()," ",e.requestTitle]})," ",a.jsx("br",{}),a.jsxs("span",{className:"fst-italic",children:[e.pi," ",a.jsxs("small",{children:[" (",e.piInstitution,") "]})]}),p()]}),h=a.jsxs("table",{className:"table table-striped table-bordered mt-2 mb-0",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("span",{className:"m-0 p-0",children:"Resource"})}),a.jsx("td",{children:a.jsx("span",{className:"m-0 p-0 d-inline",children:"Allocation"})})]})}),a.jsx("tbody",{children:t.map((g,b)=>a.jsxs("tr",{children:[a.jsx("td",{children:g.resourceName}),a.jsx("td",{style:{whiteSpace:"nowrap"},children:i(g)})]},`resource_${e.requestId}_${b}`))})]}),x=a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row mt-2 fw-bold",children:a.jsx("div",{className:"col-3 border-bottom",children:"Resources"})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:h})})]}),v=()=>e.allocationType==="NAIRR Start-Up"?x:o?a.jsxs(a.Fragment,{children:[x,a.jsx("div",{className:"row mt-2 fw-bold",children:a.jsx("div",{className:"col-3 border-bottom",children:"Abstract"})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx("div",{style:{whiteSpace:"pre-wrap",padding:"5px"},children:e.abstract})})})]}):a.jsxs(Gt,{...s,children:[a.jsxs(Gt.Item,{eventKey:"0",children:[a.jsx(Gt.Header,{children:"Resources"}),a.jsx(Gt.Body,{children:h})]}),a.jsxs(Gt.Item,{eventKey:"1",children:[a.jsx(Gt.Header,{children:"Abstract"}),a.jsx(Gt.Body,{children:a.jsx("div",{style:{whiteSpace:"pre-wrap",padding:"5px"},children:e.abstract})})]})]});return a.jsxs("div",{className:"card mb-4",children:[a.jsx("div",{className:"card-header bg-primary text-white",children:a.jsxs("div",{className:"d-flex justify-content-between",children:[a.jsx("div",{children:m()}),a.jsx("div",{children:d()})]})}),a.jsxs("div",{className:"card-body",children:[a.jsxs("div",{className:"row fw-bold border-bottom",children:[a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0",children:"Field of Science"})}),a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0 tooltip-underline",title:'A specific level of allocation; also referred to as "Opportunity"',children:"Project Type"})}),a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0",children:"Dates"})})]}),a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col",children:e.fos}),a.jsx("div",{className:"col",children:e.allocationType}),a.jsx("div",{className:"col",children:y()})]}),v()]})]})},RA=()=>{const e=pe(wA);return e.length==0?a.jsx("div",{children:"No Projects Found"}):a.jsx("div",{children:e.map((t,n)=>a.jsx(EA,{project:t},`project_${n}`))})};const wg=()=>{const e=it(),t=pe(bA),[n,r]=w.useState([]),[o,s]=w.useState("0"),i=Array.from({length:t.last_page},(m,h)=>h),l=10,c={width:"50px",textAlign:"center"};w.useEffect(()=>{f()},[t]);const u=m=>{const h=parseInt(m);e(ul({current_page:m})),e(Rr(h))},d=m=>(event.preventDefault(),s("0"),u(m),!1),f=()=>{const m=[];if(t.last_page>l)if(t.current_page>4){m.push(1),m.push("spacer");for(var h=1;h>0;h--)t.current_page-h>1&&m.push(t.current_page-h);m.push(["current",t.current_page]);for(var h=1;h<2;h++)t.current_page+h<=t.last_page&&m.push(t.current_page+h);t.last_page-t.current_page>1&&(m.push("spacer"),m.push(t.last_page))}else[1,2,3,4,5].forEach(x=>{x==t.current_page?m.push(["current",x]):m.push(x)}),m.push("spacer"),m.push(t.last_page);else for(var h=1;h<=t.last_page;h++)h==t.current_page?m.push(["current",h]):m.push(h);r(m)},p=m=>{let h="";return typeof m=="object"?[m,h]=m:h=m,m=="spacer"?a.jsx("li",{className:"page-item disabled",children:a.jsx("span",{className:"page-link",style:c,children:". . ."})}):m=="current"?a.jsx("li",{className:"page-item active","aria-current":"page",children:a.jsx("span",{className:"page-link",style:c,children:h})}):a.jsx("li",{className:"page-item",children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(m),children:h})})},y=()=>a.jsx("li",{className:"page-item",children:a.jsxs("select",{className:"page-link",style:{...c,height:"100%"},value:o,onChange:m=>d(m.target.value),children:[a.jsx("option",{value:"0",children:"Go To"}),i.map(m=>a.jsx("option",{value:m+1,children:m+1},`page_option_${m}`))]})});return a.jsx("div",{children:a.jsx("nav",{"aria-label":"Pages for the table",children:a.jsxs("ul",{className:"pagination",children:[a.jsx("li",{className:`page-item ${t.current_page==1?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:{width:"50px",textAlign:"center"},onClick:()=>u(t.current_page-1),disabled:t.current_page==1,"aria-label":"Previous Page Button",children:"<"})}),n.map((m,h)=>a.jsx(je.Fragment,{children:p(m)},`page_${h}`)),t.last_page>l?y():"",a.jsx("li",{className:`page-item ${t.current_page==t.last_page?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(t.current_page+1),disabled:t.current_page==t.last_page,"aria-label":"Next Page Button",children:">"})})]})})})},NA=({api_url:e})=>{const t=it(),n=pe(xA),r=pe(gA),o=pe(SA),s=a.jsx("div",{className:"loadingDiv",children:"Loading ..."});return w.useEffect(()=>{t(uA())},[]),a.jsx("div",{className:"container-fluid",children:a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-sm-3",children:a.jsx(CA,{})}),a.jsxs("div",{className:"col-sm-9",children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:o?a.jsx(wg,{}):""})}),a.jsx("div",{className:"row",id:"projectListRow",children:a.jsx("div",{className:"col",children:n&&r?a.jsx(RA,{}):s})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:o?a.jsx(wg,{scroll:"projects_browser_app"}):""})})]})]})})},kA=e=>e.publications_store.publication,TA=e=>e.publications_store.publication.doi,OA=e=>e.publications_store.publication_types,bw=e=>e.publications_store.publication.authors,PA=e=>e.publications_store.tag_categories,IA=e=>e.publications_store.projects,$A=e=>e.publications_store.publication.tags,AA=e=>e.publications_store.errors,ww=e=>e.publications_store.data_loaded,Sw=e=>e.publications_store.show_saved,Ep=e=>e.publications_store.saving,MA=e=>e.publications_store.modal,_w=e=>e.publications_store.form_valid,jw=e=>!Ep(e)&&ww(e)&&_w(e)&&Cw(e)&&e.publications_store.projects.filter(t=>t.selected).length>0,Cw=e=>{const t=bw(e);return t.length==0?!1:t.filter(n=>n.first_name==""||n.last_name=="").length==0},Ew=e=>({type:"UPDATE_PUBLICATION",payload:e}),DA=e=>({type:"UPDATE_FIELD",payload:e}),Ed=e=>({type:"CHANGE_PUB_TYPE",payload:e}),FA=e=>({type:"SET_PUBLICATION",payload:e}),LA=()=>({type:"ADD_AUTHOR"}),UA=e=>({type:"UPDATE_AUTHOR",payload:e}),VA=e=>({type:"TOGGLE_REQUEST",payload:e}),Qs=e=>({type:"UPDATE_ERRORS",payload:e}),Rw=e=>({type:"HIDE_ERROR",payload:e}),BA=e=>({type:"UPDATE_SELECTED_TAGS",payload:e}),zA=e=>({type:"DELETE_AUTHOR",payload:e}),qA=e=>({type:"DATA_LOADED",payload:e}),Nw=e=>({type:"UPDATE_SHOW_SAVED",payload:e}),HA=()=>({type:"RESET_STATE"}),Qc=e=>({type:"UPDATE_SAVING",payload:e}),WA=e=>({type:"SET_FORM_VALID",payload:e}),kw=e=>({type:"SET_GRANT_NUMBER",payload:e}),KA=e=>({type:"ADD_PROJECT",payload:e}),GA=(e,t,n)=>{let r=!0;const o=[];for(const i of t)e[i]||(r=!1,o.push(i));const s=e.authors||[];for(const i of s)for(const l of n)i[l]||(r=!1,o.includes(l)||o.push(l));return{formValid:r,missingFields:o}},YA=e=>e.length>0?a.jsxs("div",{role:"alert",children:[a.jsx("p",{children:"Please provide the following information before submitting:"}),a.jsx("ul",{children:e.map(t=>a.jsx("li",{children:QA(t)},t))})]}):null;function QA(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}const XA=()=>async(e,t)=>{const n=t().publications_store.publication.doi,r=encodeURIComponent(n).replaceAll(".","%2E"),o="Unable to retrieve publication. Double check your DOI, or continue entering information manually.";fetch(`/publications/lookup?doi=${r}`).then(s=>s.json()).then(s=>{if(s.title!=""){let i=t().publications_store.publication_types.find(l=>l.citation_style_type==s.type);e(Ed(i?i.publication_type:"Other")),e(FA(s))}else e(Qs(o))},s=>{e(Qs(o))})},ZA=()=>async(e,t)=>{const n=t().publications_store.grant_number,r=ne.routes.publications_find_project_path();await fetch(`${r}?grant_number=${n}`).then(o=>o.json()).then(o=>{e(KA(o)),e(kw(""))},()=>{e(Qs("Unable to find a project with this grant number."))})},Tw=()=>async e=>{const t=/^\/requests/.test(window.location.pathname)?ne.routes.publication_path("new.json"):window.location.href+".json";await fetch(t).then(n=>n.json()).then(n=>{e(qA(n))})},Ow=()=>async(e,t)=>{const n=t().publications_store,r=n.projects.filter(p=>p.selected),o=Object.keys(n.selected_tags).map(p=>n.selected_tags[p]).flat(),s={...n.publication},i=n.errors,{formValid:l,missingFields:c}=GA(s,["title","publication_year","publication_month"],["first_name","last_name"]);if(!l){i.length>0&&Array.from(i).forEach(y=>{e(Rw(y.id))});const p=YA(c);e(Qs(p));return}const u={authenticity_token:document.getElementsByName("authenticity_token")[0].value,publication:s,authors:s.authors.map(p=>({...p,order:0})),tags:o,projects:r};let d,f;s.publication_id?(d=ne.routes.publication_path(s.publication_id),f="PATCH"):(d=ne.routes.publications_path(),f="POST"),e(Qc(!0)),await fetch(d,{method:f,headers:{"Content-Type":"application/json"},body:JSON.stringify(u)}).then(p=>{n.redirect?window.location.href=ne.routes.publications_path():(s.publication_id||(e(HA()),e(Tw())),e(Nw(!0)),e(Qc(!1)))},()=>{e(Qc(!1)),e(Qs("There was an error saving this publication."))})},JA=({doi:e,updatePublication:t,doiLookup:n})=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:"doi",className:"form-label",children:"DOI"}),a.jsxs("div",{className:"input-group",children:[a.jsx("input",{type:"text",className:"form-control",id:"doi",name:"publication[doi]","aria-label":"DOI Input and Search box","aria-describedby":"doi_button",value:e,onChange:r=>t(r.target.value)}),a.jsx("button",{className:"btn btn-primary",type:"button",id:"doi_button",onClick:()=>n(),children:"Lookup Publication"})]})]})}),e2=e=>({doi:TA(e)}),t2=e=>({updatePublication:t=>e(Ew({key:"doi",value:t})),doiLookup:()=>e(XA())}),n2=tn(e2,t2)(JA),r2=({author:e,authorKey:t,updateAuthor:n,deleteAuthor:r})=>{const o=l=>{n({key:l.target.name,value:l.target.value,idx:t})},s=l=>a.jsx("td",{children:a.jsx("input",{type:"text",className:"form-control",name:l,id:l,value:e[l],onChange:c=>o(c)})},`field_${l}`),i=["first_name","last_name","affiliation"];return a.jsxs("tr",{children:[i.map(l=>s(l)),a.jsx("td",{children:t!==0&&a.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>r(t),children:a.jsx("i",{className:"bi bi-trash"})})})]})},o2=e=>({updateAuthor:t=>e(UA(t)),deleteAuthor:t=>e(zA(t))}),Sg=tn(null,o2)(r2),s2=({authors:e,addAuthor:t,authors_exist:n})=>{const r=e.length===0,o=()=>n?"":a.jsx("div",{className:"alert alert-danger",children:"You must add at least one author and each author must have a first and last name"});return a.jsxs("div",{children:[o(),a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"First Name"}),a.jsx("th",{children:"Last Name"}),a.jsx("th",{children:"Affiliation"}),a.jsx("th",{})]})}),a.jsxs("tbody",{children:[e.map((s,i)=>a.jsx(Sg,{author:s,authorKey:i},`author_${i}`)),r&&a.jsx(Sg,{author:t()})]})]}),a.jsx("button",{className:"btn btn-primary mt-3",onClick:()=>t(),children:"Add Author"})]})},i2=e=>({authors:bw(e),authors_exist:Cw(e)}),a2=e=>({addAuthor:()=>e(LA())}),l2=tn(i2,a2)(s2),c2=({category:e,publication_tags:t,updateSelectedTags:n,index:r})=>{const o=w.useRef(null),s=()=>{const l=t.filter(c=>c.label==e.label)[0];return l?l.options:[]},i=l=>{n({category:e.label,tags:l})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fw-bold mb-1",children:e.label}),a.jsx("div",{className:"mb-3",children:a.jsx(jp,{classNames:{control:l=>l.isFocused?"custom-select-selected":"border-grey-300"},defaultValue:s(),options:e.options,isMulti:!0,openMenuOnClick:!0,name:`tags_${r}`,inputId:`tags_${r}`,ref:o,closeMenuOnSelect:!1,onChange:i})})]})},u2=e=>({updateSelectedTags:t=>e(BA(t))}),d2=e=>({publication_tags:$A(e)}),f2=tn(d2,u2)(c2),p2=({projects:e,toggleProject:t})=>{const n=o=>`list-group-item list-group-item-action clickable ${o.selected?"list-group-item-success":""}`,r=()=>e.filter(o=>o.selected).length>0;return a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[r()?"":a.jsx("div",{className:"alert alert-danger",children:"You must select at least one project"}),a.jsx("div",{className:"list-group",children:e.map((o,s)=>a.jsxs("div",{className:n(o),onClick:()=>t(s),children:[o.grant_number,": ",o.title]},`project_${o.grant_number}`))})]})})},h2=e=>({projects:IA(e)}),m2=e=>({toggleProject:t=>e(VA(t))}),g2=tn(h2,m2)(p2),v2=({grant_number:e,setGrantNumber:t,grantSearch:n})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:["If your project isn't listed above, you can manually add it by entering the grant number below.",a.jsxs("div",{className:"input-group mt-1",children:[a.jsx("input",{type:"text",className:"form-control",value:e,onChange:r=>t(r.target.value),placeholder:"Enter a grant number"}),a.jsx("button",{className:"btn btn-primary",onClick:()=>n(),children:"Find Project"})]})]})}),y2=e=>({setGrantNumber:t=>e(kw(t)),grantSearch:()=>e(ZA())}),x2=e=>({grant_number:e.publications_store.grant_number}),b2=tn(x2,y2)(v2),w2=({publication:e,updateField:t,publication_types:n,changePubType:r,updatePublication:o,tag_categories:s,savePublication:i,modal:l,save_enabled:c,setFormValid:u,form_valid:d})=>{const f=g=>{g.target.value.trim()==""?u(!1):u(!0),o({key:"title",value:g.target.value})},p=()=>e.fields.map((g,b)=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:`field_${g.csl_field_name}`,className:"form-label",children:g.name}),a.jsx("input",{type:"text",className:"form-control",name:`field_${g.csl_field_name}`,id:`field_${g.csl_field_name}`,value:g.field_value,onChange:S=>t({index:b,value:S.target.value})})]})},`field_${g.csl_field_name}`)),y=()=>{const g=new Date().getFullYear()+2;let b=1980;const S=[];for(;b<=g;)S.push(b++);const _=["January","February","March","April","May","June","July","August","September","October","November","December"],j=a.jsx("i",{className:"bi bi-asterisk text-danger"});return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsxs("label",{className:"form-label",htmlFor:"publication_title",children:["Title ",j]}),a.jsx("input",{name:"publication_title",id:"publication_title",type:"text",className:`form-control ${d?"":"is-invalid"}`,value:e.title,onChange:C=>f(C)})]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{className:"form-label",htmlFor:"publication_year",children:"Year Published"}),a.jsx("select",{name:"publication_year",id:"publication_year",className:"form-control",value:e.publication_year,onChange:C=>{o({key:"publication_year",value:C.target.value})},children:S.map(C=>a.jsx("option",{value:C,children:C},`year_${C}`))})]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{className:"form-label",htmlFor:"publication_month",children:"Month Published"}),a.jsx("select",{name:"publication_month",id:"publication_month",className:"form-control",value:e.publication_month,onChange:C=>{o({key:"publication_month",value:C.target.value})},children:_.map((C,E)=>a.jsx("option",{value:E+1,children:C},`month_${E}`))})]})})]})},m=a.jsxs("div",{className:"card",children:[a.jsx("div",{className:"card-header",children:a.jsx("h2",{children:"Publication Information"})}),a.jsxs("div",{className:"card-body",children:[a.jsx("p",{className:"mb-2",children:'Enter information about this publication below. If you have a DOI, you may use the "Lookup Publication" button to attempt to find this information automatically.'}),a.jsx(n2,{}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:"publication_type",className:"form-label",children:"Publication Type"}),a.jsx("select",{name:"publication[publication_type]",id:"publication_type",className:"form-control",value:e.publication_type,onChange:g=>r(g.target.value),children:n.map(g=>a.jsx("option",{value:g.publication_type,children:g.publication_type},`pub_type_${g.type_id}`))})]})}),y(),p()]})]}),h=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Authors"}),a.jsxs(go,{children:[`Add authors by clicking the "Add Authors" button below and entering the author's details. You may also remove authors by clicking the `,a.jsx("i",{className:"bi bi-trash fw-bold text-danger"})," ","button"]})]}),a.jsx("div",{className:"card-body",children:a.jsx(l2,{})})]}),x=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Tags"}),a.jsx(go,{children:"Add related tags from the lists below. You may choose multiple tags per category."})]}),a.jsx("div",{className:"card-body",children:s.map((g,b)=>a.jsx(f2,{index:b,category:g},`tc_${b}`))})]}),v=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Associated Projects"}),a.jsx(go,{children:"Click/Tap each project that this publication is related to."})]}),a.jsxs("div",{className:"card-body",children:[a.jsx(g2,{}),a.jsx("hr",{}),a.jsx(b2,{})]})]});return a.jsxs(a.Fragment,{children:[m,h,x,v,l?null:a.jsx("p",{className:"mt-3",children:a.jsx("button",{onClick:()=>i(),className:"btn btn-success",disabled:!c,children:"Save Publication"})})]})},S2=e=>({publication:kA(e),publication_types:OA(e),tag_categories:PA(e),saving:Ep(e),modal:MA(e),save_enabled:jw(e),form_valid:_w(e)}),_2=e=>({updateField:t=>e(DA(t)),changePubType:t=>e(Ed(t)),updatePublication:t=>e(Ew(t)),savePublication:()=>e(Ow()),setFormValid:t=>e(WA(t))}),j2=tn(S2,_2)(w2),C2=({errors:e,hideError:t})=>a.jsx(a.Fragment,{children:e.map(n=>a.jsxs("div",{className:"alert alert-danger alert-dismissible sticky-top",children:[n.message,a.jsx("button",{type:"button",className:"btn-close","aria-label":"Close",onClick:()=>t(n.id)})]},`err_${n.id}`))}),E2=e=>({errors:AA(e)}),R2=e=>({hideError:t=>e(Rw(t))}),N2=tn(E2,R2)(C2),k2=({show_saved:e,updateShowSaved:t})=>{const n=a.jsxs("div",{className:"alert alert-success alert-dismissible sticky-top",children:["Publication Saved Successfully!",a.jsx("button",{type:"button",className:"btn-close","aria-label":"Close",onClick:()=>t(!1)})]});return e?n:a.jsx(a.Fragment,{})},T2=e=>({show_saved:Sw(e)}),O2=e=>({updateShowSaved:t=>e(Nw(t))}),P2=tn(T2,O2)(k2),I2=({getData:e,data_loaded:t})=>(w.useEffect(()=>{e()},[]),a.jsxs(a.Fragment,{children:[a.jsx(P2,{}),a.jsx(N2,{}),t?a.jsx(j2,{}):a.jsx(Do,{})]})),$2=e=>({data_loaded:ww(e)}),A2=e=>({getData:()=>e(Tw())}),Pw=tn($2,A2)(I2),M2=({saving:e,savePublication:t,showSaved:n,updatePublications:r,save_enabled:o})=>{const[s,i]=w.useState(!1);return w.useEffect(()=>{!e&&n&&r()},[e,n]),a.jsxs(a.Fragment,{children:[a.jsxs(ve,{size:"xl",show:s,onHide:()=>i(!1),scrollable:!0,children:[a.jsx(ve.Header,{closeButton:!0,children:a.jsx(ve.Title,{children:"Add Publication"})}),a.jsx(ve.Body,{children:a.jsx(Pw,{})}),a.jsx(ve.Footer,{children:a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",onClick:()=>i(!1),children:"Cancel"}),a.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>{t(),i(!1)},children:"Save Publication"})]})})]}),a.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>i(!0),children:"Add a New Publication"})]})},D2=e=>({saving:Ep(e),showSaved:Sw(e),save_enabled:jw(e)}),F2=e=>({savePublication:()=>e(Ow())}),L2=tn(D2,F2)(M2),U2=({usernames:e=[],publication_ids:t=[]})=>{const[n,r]=w.useState(e),[o,s]=w.useState(t),[i,l]=w.useState([]),c=w.useRef(n),u=h=>{c.current=h,r(h)},d=async()=>{const x=await(await fetch(ne.routes.search_publications_path({usernames:n}))).json();l(x)};w.useEffect(()=>{d()},[n]),w.useEffect(()=>{addEventListener("requestAddRole",h=>u([...c.current,h.detail.username])),addEventListener("requestRemoveRole",h=>u(c.current.filter(x=>x!=h.detail.username)))},[]);let f=!1,p=!1;const y=i.map(h=>{const x=o.includes(h.publication_id);f=f||x,p=p||!x;const v=new Date(h.publication_year,h.publication_month-1);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("input",{type:"checkbox",name:"publication_ids[]",value:h.publication_id,checked:x,onChange:()=>s(x?o.filter(g=>g!=h.publication_id):[...o,h.publication_id])})}),a.jsx("td",{children:h.title}),a.jsx("td",{children:h.authors.map(g=>`${g.first_name} ${g.last_name}`).join(", ")}),a.jsx("td",{children:h.publication_type}),a.jsxs("td",{children:[v.toLocaleString("default",{month:"short"})," ",h.publication_year]})]},h.publication_id)}),m=`${p?"Select":"Deselect"} all`;return a.jsxs("div",{className:"publications-select",children:[a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:a.jsx("input",{type:"checkbox",value:"","aria-label":m,title:m,checked:f&&!p,onChange:()=>s(p?i.map(h=>h.publication_id):[]),ref:h=>{h&&(h.indeterminate=f&&p)}})}),a.jsx("th",{children:"Title"}),a.jsx("th",{children:"Authors"}),a.jsx("th",{children:"Type"}),a.jsx("th",{children:"Date"})]})}),a.jsx("tbody",{children:y})]}),a.jsx(L2,{updatePublications:d})]})},V2=()=>`${Math.random().toString(36).slice(2)}`,Rd=document.querySelector("#publications-react"),B2=Rd?Rd.dataset:{},_g={publication_types:[],tag_categories:[],publication:{},projects:[],errors:[],selected_tags:{},data_loaded:!1,saving:!1,show_saved:!1,redirect:B2.redirect||!1,modal:Rd==null,form_valid:!1,grant_number:""},z2=(e=_g,t)=>{const{type:n,payload:r}=t;switch(n){case"UPDATE_FIELD":return $t(e,s=>(s.publication.fields[r.index].field_value=r.value,s));case"CHANGE_PUB_TYPE":return $t(e,s=>{let i=s.publication_types.find(l=>l.publication_type==r).fields;return i.forEach(l=>{const c=s.publication.fields.find(u=>u.csl_field_name==l.csl_field_name);c&&(l.value=c.value)}),s.publication.publication_type=r,s.publication.fields=i,s});case"UPDATE_PUBLICATION":return{...e,publication:{...e.publication,[r.key]:r.value}};case"SET_PUBLICATION":return $t(e,s=>(s.publication.fields.forEach(i=>{i.field_value=r[i.csl_field_name]}),Object.keys(s.publication).forEach(i=>{r[i]&&(s.publication[i]=r[i])}),s.form_valid=r.title.trim()!="",s));case"ADD_AUTHOR":{const o={portal_username:"",first_name:"",middle_name:"",last_name:"",prefix:"",suffix:"",initials:"",affiliation:"",hash:{}};return $t(e,i=>{i.publication.authors.push(o)})}case"UPDATE_AUTHOR":return $t(e,s=>{s.publication.authors[r.idx][r.key]=r.value});case"TOGGLE_TAG":return $t(e,s=>{let i=s.tag_categories.find(l=>l.publication_tags_category_id==r.publication_tags_category_id);i.tags[r.idx].selected=!i.tags[r.idx].selected});case"TOGGLE_REQUEST":return $t(e,s=>(s.projects[r].selected=!s.projects[r].selected,s));case"UPDATE_ERRORS":{const o={id:V2(),message:r};return{...e,errors:[...e.errors,o]}}case"HIDE_ERROR":{const o=e.errors.filter(s=>s.id!=r);return{...e,errors:o}}case"UPDATE_SELECTED_TAGS":return $t(e,s=>{const i=r.tags.map(l=>l.value);return s.selected_tags[r.category]=i,s});case"DELETE_AUTHOR":return $t(e,s=>(s.publication.authors.splice(r,1),s));case"DATA_LOADED":return $t(e,s=>(s.publication=r.publication,s.form_valid=r.publication.title.trim()!="",s.publication.authors.forEach(i=>{i.affiliation||(i.affiliation="")}),s.publication_types=r.publication_types,s.tag_categories=r.tag_categories,s.projects=r.publication.projects,r.publication.tags.forEach(i=>s.selected_tags[i.label]=i.options.map(l=>l.value)),s.data_loaded=!0,s));case"UPDATE_SHOW_SAVED":return{...e,show_saved:r};case"UPDATE_SAVING":return{...e,saving:r};case"RESET_STATE":return _g;case"SET_FORM_VALID":return{...e,form_valid:r};case"SET_GRANT_NUMBER":return{...e,grant_number:r};case"ADD_PROJECT":return{...e,projects:[...e.projects,r]};default:return e}},q2={catalogs:{},filteredResources:[],filters:[],hasErrors:!1,onRamps:!1,resources:[],resourcesLoaded:!1,resourceSorting:{"NSF Capacity Resources":1,"NSF Innovative Testbeds":2,"Other NSF-funded Resources":3,"Services and Support":4}},pa=Ye("resourceCatalog/getResources",async(e,{dispatch:t})=>{t(jg(!1));let n=[];e.catalogSources?n=e.catalogSources:n.push({...e,catalogLabel:"Default"}),e.onRamps&&n.push({apiUrl:"https://allocations.access-ci.org/resources.json",catalogLabel:"ACCESS",allowedCategories:[],allowedFilters:[],allowedResources:[],excludedCategories:["Resource Category"],excludedFilters:[],excludedResources:["ACCESS Credits"]});const r=await Promise.all(n.map(async o=>{const i=await(await fetch(o.apiUrl)).json();return{...o,data:i}}));t(G2({data:r,params:e})),t(jg(!0))});Ye("resourceCatalog/getResources",async(e,{dispatch:t})=>{t(Q2(e)),t($w())});const H2=e=>{const t=[],n=e.filter(r=>r.features.filter(o=>o.selected).length>0);return e.forEach(r=>{r.features.forEach(o=>{o.selected&&t.push(o.featureId)})}),n.map(r=>({...r,features:r.features.filter(o=>o.selected)}))},W2=e=>{const t={},n={};let r={};return e.forEach(s=>{t[s.catalogLabel]={...s,resourceIds:[],selected:!1,catalogId:s.catalogLabel.replace(/[^(A-z)]/,"")},delete t[s.catalogLabel].data,s.data.forEach(i=>{if(Nd(s.allowedResources,s.excludedResources,i.resourceName)){const{categories:l,formattedResource:c}=K2(s,i,r);n[i.resourceId]=c,t[s.catalogLabel].resourceIds.push(i.resourceId),r=l}})}),{resources:Object.keys(n).map(s=>n[s]),catalogs:t,categories:r}},Nd=(e,t,n)=>!e&&!t||e&&e.length==0&&t&&t.length==0?!0:e&&e.length>0?e.find(r=>r==n):t&&t.length>0?!t.find(r=>r==n):!0,K2=(e,t,n)=>{const r=[];let o="";t.featureCategories.filter(l=>l.categoryIsFilter).forEach(l=>{const c=l.categoryId;l.categoryName=="ACCESS Resource Grouping"?o=l.features[0].name:(!n[c]&&Nd(e.allowedCategories,e.excludedCategories,l.categoryName)&&(n[c]={categoryId:c,categoryName:l.categoryName,categoryDescription:l.categoryDescription,features:{}}),l.features.forEach(u=>{const d={featureId:u.featureId,name:u.name,description:u.description,categoryId:c,selected:!1},f=Nd(e.allowedFilters,e.excludedFilters,d.name);f&&r.push(d),n[c]&&f&&!n[c].features[u.featureId]&&(n[c].features[u.featureId]=d)}))});const s=r.map(l=>l.name).sort((l,c)=>l>c);return{formattedResource:{...t,resourceName:t.resourceName.trim(),features:s,featureIds:r.map(l=>l.featureId),sortCategory:o},categories:n}},Iw=ri({name:"resourceCatalog",initialState:q2,reducers:{handleResponse:(e,{payload:t})=>{const n=t.data,{resources:r,catalogs:o,categories:s}=W2(n);e.catalogs=o,e.onRamps=t.params.onRamps;for(const i in s){const l=s[i],c=[];for(const u in l.features)c.push(l.features[u]);e.filters.push({...l,features:c.sort((u,d)=>u.name>d.name)})}e.filters=e.filters.sort((i,l)=>i.categoryName.localeCompare(l.categoryName)),e.resources=r.sort((i,l)=>i.resourceName.localeCompare(l.resourceName)).sort((i,l)=>e.resourceSorting[i.sortCategory]>e.resourceSorting[l.sortCategory]),e.filteredResources=[...e.resources],e.resourcesLoaded=!0},resetFilters:e=>{e.filters.forEach(t=>{t.features.forEach(n=>n.selected=!1)}),e.filteredResources=[...e.resources]},setResourcesLoaded:(e,{payload:t})=>{e.resourcesLoaded=t},toggleCatalog:(e,{payload:t})=>{const{catalog:n,selected:r}=t;e.catalogs[n.catalogLabel].selected=r},toggleFilter:(e,{payload:t})=>{if(t){const i=t,c=e.filters.find(u=>u.categoryId==i.categoryId).features.find(u=>u.featureId==i.featureId);c.selected=!c.selected}const n=H2(e.filters);let r=[];if(n.length>0){const i=n.map(l=>l.features.map(c=>c.featureId));e.resources.forEach(l=>{let c=0;i.forEach(u=>{let d=!1;l.featureIds.forEach(f=>{u.indexOf(f)>=0&&(d=!0)}),d&&(c+=1)}),c>=i.length&&r.push(l)})}else r=e.resources;const o=Object.keys(e.catalogs).map(i=>e.catalogs[i]),s=o.filter(i=>i.selected);if(s.length>0&&s.length<o.length){const i=s.map(l=>l.resourceIds).flat();r=r.filter(l=>i.indexOf(l.resourceId)>=0)}e.filteredResources=r}},extraReducers:e=>{e.addCase(pa.pending,t=>{}).addCase(pa.fulfilled,(t,n)=>{}).addCase(pa.rejected,(t,n)=>{t.hasErrors=!0,console.log(n.error)})}}),{handleResponse:G2,processData:pD,resetFilters:Y2,setResourcesLoaded:jg,toggleCatalog:Q2,toggleFilter:$w}=Iw.actions,Aw=e=>e.resourceCatalog.catalogs,X2=e=>e.resourceCatalog.filters,Z2=e=>e.resourceCatalog.hasErrors,J2=e=>e.resourceCatalog.resourcesLoaded,eM=e=>e.resourceCatalog.filteredResources,tM=Iw.reducer,nM="_access_1yrq0_2",rM="_resourceName_1yrq0_6",oM="_description_1yrq0_11",sM="_filterBar_1yrq0_15",iM="_cardBg_1yrq0_20",aM="_active_1yrq0_25",lM="_plainButton_1yrq0_30",cM="_btnSecondary_1yrq0_40",uM="_filtersHidden_1yrq0_51",dM="_filtersVisible_1yrq0_57",Dt={access:nM,resourceName:rM,description:oM,filterBar:sM,cardBg:iM,active:aM,plainButton:lM,btnSecondary:cM,filtersHidden:uM,filtersVisible:dM},fM=({resource:e})=>{const[t,n]=w.useState(!0),r=u=>{const d={"CPU Compute":"cpu-fill","GPU Compute":"gpu-card",Cloud:"cloud-fill","Commercial Cloud":"cloud-fill",Storage:"database-fill","Service / Other":"journal","Innovative / Novel Compute":"pc"};return d[u]?a.jsx("i",{title:u,className:`bi bi-${d[u]} me-2 `},`${e.resourceId}_${d[u]}`):""},o=()=>a.jsxs("span",{className:"float-end",children:[e.features.map(u=>r(u)),e.resourceType]}),s=u=>u.length==0?"":a.jsx(a.Fragment,{children:u.map((d,f)=>a.jsx("span",{className:"badge text-bg-secondary me-2",children:d},`feature_${e.resourceId}_${f}`))}),i=()=>{let u=e.resourceDescription;return u&&u!=""?(Dt.plainButton,a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col fw-bold",children:["About ",e.resourceName]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col ",children:[a.jsx("div",{className:Dt.description,dangerouslySetInnerHTML:{__html:u}}),""]})})]})):""},l=()=>e.recommendedUse&&e.recommendedUse!=""?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col fw-bold",children:"Recommended Use"})}),a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",children:a.jsx("div",{className:Dt.description,dangerouslySetInnerHTML:{__html:e.recommendedUse}})})})]}):"",c=()=>Dt.cardBg;return a.jsx(a.Fragment,{children:a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"card mb-3",children:[a.jsxs("div",{className:`card-header ${c()}`,children:[a.jsx("span",{className:"",children:e.resourceName}),o()]}),a.jsxs("div",{className:"card-body",children:[a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",children:s(e.features)})}),l(),i()]}),a.jsx("div",{className:"card-footer",children:a.jsxs("a",{target:"_blank",href:e.userGuideUrl,className:"btn btn-info me-2 fw-bold",children:["System Info ",a.jsx("i",{className:"bi bi-box-arrow-up-right"})]})})]})})})})},pM=({filter:e})=>{const t=it(),n=()=>{t($w(e))};return a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"form-check",children:[a.jsx("label",{className:"form-check-label",htmlFor:`filter_${e.featureId}`,children:e.name}),a.jsx("input",{className:"form-check-input",type:"checkbox",value:e.featureId,id:`filter_${e.featureId}`,checked:e.selected,onChange:n})]})})})},hM=({category:e})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("div",{className:"fw-bold mb-1 mt-1",children:a.jsx("abbr",{title:e.categoryDescription,children:e.categoryName})}),e.features.map(t=>a.jsx(pM,{filter:t},t.featureId))]})}),mM=({onReset:e})=>{const t=it(),n=pe(Aw),r=pe(X2),o=r.filter(s=>s.features.filter(i=>i.selected).length>0);return Object.keys(n).map(s=>n[s]),a.jsxs(a.Fragment,{children:[r.map(s=>a.jsx(hM,{category:s},s.categoryId)),a.jsx("button",{className:"btn btn-warning mt-2 mb-2",onClick:()=>t(Y2()),disabled:o.length==0,children:"Reset Filters"}),a.jsx("button",{className:"btn btn-outline-primary ms-3 mt-2 mb-2",onClick:e,children:"Close Menu"})]})},gM=()=>{const[e,t]=w.useState(!1),n=w.useRef(null),r=()=>{const o=n.current;e?(o.style.height="0px",o.classList.remove(Dt.filtersVisible),o.classList.add(Dt.filtersHidden)):(o.style.height=o.scrollHeight+"px",o.classList.remove(Dt.filtersHidden),o.classList.add(Dt.filtersVisible)),t(!e)};return a.jsx("div",{className:Dt.filterBar,children:a.jsx("div",{className:"row mb-2",children:a.jsx("div",{className:"col pt-2 pb-2",children:a.jsxs("div",{className:"p-1 pb-0 border-bottom bg-white shadow",children:[a.jsxs("button",{className:"btn btn-outline-primary mb-1 mt-1",type:"button",onClick:r,children:[a.jsx("i",{className:"bi bi-filter"})," Filters"]}),a.jsx("div",{className:`${Dt.filtersHidden} pe-2 ps-2`,id:"filtersList",ref:n,children:a.jsx(mM,{onReset:r})})]})})})})},vM=()=>{const e=pe(eM);return e.length==0?a.jsx("div",{className:"fw-bold",children:"No Resources Match Your Filters"}):a.jsx("div",{className:"card shadow",children:a.jsxs("div",{className:"card-body",children:[a.jsx(gM,{}),e.map(t=>a.jsx(fM,{resource:t},t.resourceId))]})})},yM=({baseUrl:e})=>a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col d-flex",children:a.jsx("img",{alt:"Access Logo",style:{height:"75px"},src:`${e}/access_logo.png`})})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx("h3",{className:"border-bottom",children:"NSF ACCESS Resources"})})}),a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("h4",{children:"Discover the nationwide NSF cyberinfrastructure"}),a.jsx("p",{children:"Need advanced computing and storage options for your research or classroom? The ACCESS program has been established and funded by the U.S. National Science Foundation to help you - the nation's researchers and educators - to use some of the country's most advanced computing systems and services - at no cost to you."}),a.jsx("p",{children:"Thousands of researchers, instructors, and students from institutions large and small use ACCESS-integrated resources every year. With more than 30 resources from more than 15 resource providers, there's bound to be a resource for you, your lab, or your class."}),a.jsx("p",{children:"Explore the resource catalog below - filter the list to discover the resources that have the features or services to accelerate your activities. The System Info button will take you to the resource's documentation for all the details."}),a.jsx("p",{children:'Ready to begin? Click the "Get Your First Project" button and join the ACCESS community!'}),a.jsx("p",{children:a.jsxs("a",{href:"https://allocations.access-ci.org/get-your-first-project",target:"_blank",className:`btn btn-secondary fw-bold ${Dt.btnSecondary}`,children:["Get Your First Project ",a.jsx("i",{className:"bi bi-box-arrow-up-right"})]})}),a.jsxs("p",{children:["If you have feedback for ACCESS, please complete our",a.jsx("a",{target:"_blank",href:"https://docs.google.com/forms/d/e/1FAIpQLSdn-SXokNB_5s0r2SA_S9ZIZWZFlVPRD2OHepTH5HY2YND_zw/viewform",children:" Feedback Form"}),".",a.jsx("br",{}),"If you have questions, please",a.jsx("a",{target:"_blank",href:"https://support.access-ci.org/user/login?destination=/open-a-ticket",children:" open a help ticket"}),"."]})]})})]}),xM=({catalogSources:e=[],onRamps:t=!1,baseUrl:n})=>{const r=it(),o=pe(J2),s=pe(Z2),i=pe(Aw),l=Object.keys(i).map(u=>i[u]);w.useEffect(()=>{r(pa({catalogSources:e,onRamps:t}))},[]);const c=()=>t&&l.length>1?a.jsx(a.Fragment,{children:l.filter(u=>u.catalogLabel!="ACCESS").map((u,d)=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsxs("h4",{className:"border-bottom",children:["About ",u.catalogLabel]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:u.description}})]})},`catalog_${d}`))}):"";return s?a.jsx("div",{className:"row",children:a.jsx("div",{className:"col text-center mt-2",children:a.jsx("h4",{children:"Unable to Load Resources"})})}):o?a.jsxs("div",{className:`container mt-3 ${Dt.access}`,children:[t?a.jsx(yM,{baseUrl:n}):"",c(),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(vM,{})})})]}):a.jsx(Do,{})},bM={filters:[],resources:[],filteredResources:[],resourcesLoaded:!1,hasErrors:!1,resourceSorting:{"NSF Capacity Resources":1,"NSF Innovative Testbeds":2,"Other NSF-funded Resources":3,"Services and Support":4}},ha=Ye("resourceCatalog/getResources",async(e,{dispatch:t})=>{const r=await(await fetch(e.apiUrl)).json();t(SM({data:r,params:e}))}),wM=e=>{const t=[],n=e.filter(r=>r.features.filter(o=>o.selected).length>0);return e.forEach(r=>{r.features.forEach(o=>{o.selected&&t.push(o.featureId)})}),n.map(r=>({...r,features:r.features.filter(o=>o.selected)}))},Cg=(e,t,n)=>{if(e.length==0&&t.length==0)return!0;if(e.length>0)return e.find(r=>r==n);if(t.length>0)return!t.find(r=>r==n)},Mw=ri({name:"resourceCatalog",initialState:bM,reducers:{handleResponse:(e,{payload:t})=>{const n=t.data,r=t.params.excludedCategories,o=t.params.excludedFilters,s=t.params.excludedResources,i=t.params.allowedCategories,l=t.params.allowedFilters,c=[],u={};n.filter(d=>!s.includes(d.resourceName)).forEach(d=>{const f=[];let p="";d.featureCategories.filter(m=>m.categoryIsFilter).forEach(m=>{const h=m.categoryId;m.categoryName=="ACCESS Resource Grouping"?p=m.features[0].name:(!u[h]&&Cg(i,r,m.categoryName)&&(u[h]={categoryId:h,categoryName:m.categoryName,categoryDescription:m.categoryDescription,features:{}}),m.features.forEach(x=>{const v={featureId:x.featureId,name:x.name,description:x.description,categoryId:h,selected:!1},g=Cg(l,o,v.name);g&&f.push(v),u[h]&&g&&!u[h].features[x.featureId]&&(u[h].features[x.featureId]=v)}))});const y={resourceName:d.resourceName,resourceId:d.resourceId,resourceType:d.resourceType,organization:d.organization,units:d.units,userGuideUrl:d.userGuideUrl,resourceDescription:d.resourceDescription,description:d.description,recommendedUse:d.recommendedUse,features:f.map(m=>m.name).sort((m,h)=>m>h),featureIds:f.map(m=>m.featureId),sortCategory:p};c.push(y)});for(const d in u){const f=u[d],p=[];for(const y in f.features)p.push(f.features[y]);e.filters.push({...f,features:p.sort((y,m)=>y.name>m.name)})}i.length>0?e.filters=e.filters.sort((d,f)=>i.indexOf(d.categoryName)>i.indexOf(f.categoryName)):e.filters=e.filters.sort((d,f)=>d.categoryName.localeCompare(f.categoryName)),e.resources=c.sort((d,f)=>d.resourceName.localeCompare(f.resourceName)).sort((d,f)=>e.resourceSorting[d.sortCategory]>e.resourceSorting[f.sortCategory]),e.filteredResources=[...e.resources],e.resourcesLoaded=!0},resetFilters:e=>{e.filters.forEach(t=>{t.features.forEach(n=>n.selected=!1)}),e.filteredResources=[...e.resources]},toggleFilter:(e,{payload:t})=>{const n=t,o=e.filters.find(i=>i.categoryId==n.categoryId).features.find(i=>i.featureId==n.featureId);o.selected=!o.selected;const s=wM(e.filters);if(s.length>0){const i=[],l=s.map(c=>c.features.map(u=>u.featureId));e.resources.forEach(c=>{let u=0;l.forEach(d=>{let f=!1;c.featureIds.forEach(p=>{d.indexOf(p)>=0&&(f=!0)}),f&&(u+=1)}),u>=l.length&&i.push(c)}),e.filteredResources=i}else e.filteredResources=[...e.resources]}},extraReducers:e=>{e.addCase(ha.pending,t=>{}).addCase(ha.fulfilled,(t,n)=>{}).addCase(ha.rejected,(t,n)=>{t.hasErrors=!0,console.log(n.error)})}}),{handleResponse:SM,processData:hD,resetFilters:_M,toggleFilter:jM}=Mw.actions,CM=e=>e.resourceCatalog.hasErrors,EM=e=>e.resourceCatalog.resourcesLoaded,RM=e=>e.resourceCatalog.filters,NM=e=>e.resourceCatalog.filteredResources,kM=Mw.reducer,TM=({resource:e})=>{const t=r=>r.length==0?"":a.jsx("ul",{children:r.map((o,s)=>a.jsx("li",{children:o},`feature_${e.resourceId}_${s}`))}),n=(r,o)=>o&&o!=""?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col fw-bold",children:r})}),a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",dangerouslySetInnerHTML:{__html:o}})})]}):"";return a.jsxs(Gt.Item,{eventKey:e.resourceId,children:[a.jsx(Gt.Header,{children:e.resourceName}),a.jsxs(Gt.Body,{children:[a.jsx("table",{className:"table",children:a.jsxs("tbody",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Resource Type:"}),a.jsx("td",{children:e.resourceType})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Organization:"}),a.jsx("td",{children:e.organization})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Units:"}),a.jsx("td",{children:e.units})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"User Guide:"}),a.jsx("td",{children:e.userGuideUrl==""?"":a.jsx("a",{href:e.userGuideUrl,target:"_blank",rel:"noreferrer",children:"Link to User Guide"})})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Features Available:"}),a.jsx("td",{children:t(e.features)})]})]})}),n("Resource Description",e.resourceDescription),n("Allocations Description",e.description),n("Recommended Use",e.recommendedUse)]})]})},OM=()=>{const e=pe(NM);return e.length==0?a.jsx("div",{className:"fw-bold",children:"No Resources Match Your Filters"}):a.jsxs("div",{children:[a.jsx("h4",{className:"mb-0",children:"Resources"}),a.jsx(Gt,{children:e.map(t=>a.jsx(TM,{resource:t},t.resourceId))})]})},PM=({filter:e})=>{const t=it(),n=()=>{t(jM(e))};return a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"form-check",children:[a.jsx("label",{className:"form-check-label",htmlFor:`filter_${e.featureId}`,children:e.name}),a.jsx("input",{className:"form-check-input",type:"checkbox",value:e.featureId,id:`filter_${e.featureId}`,checked:e.selected,onChange:n})]})})})},IM=({category:e})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("div",{className:"fw-bold mb-1 mt-1",children:a.jsx("abbr",{title:e.categoryDescription,children:e.categoryName})}),e.features.map(t=>a.jsx(PM,{filter:t},t.featureId))]})}),$M=()=>{const e=it(),t=pe(RM),n=t.filter(r=>r.features.filter(o=>o.selected).length>0);return a.jsxs("div",{children:[a.jsx("h4",{className:"mb-0",children:"Filters"}),t.map(r=>a.jsx(IM,{category:r},r.categoryId)),a.jsx("button",{className:"btn btn-warning mt-2 mb-2",onClick:()=>e(_M()),disabled:n.length==0,children:"Reset Filters"})]})},AM=({apiUrl:e,excludedCategories:t=[],excludedFilters:n=[],excludedResources:r=[],allowedCategories:o=[],allowedFilters:s=[]})=>{const i=it(),l=pe(EM),c=pe(CM);return w.useEffect(()=>{i(ha({apiUrl:e,excludedCategories:t,excludedFilters:n,excludedResources:r,allowedCategories:o,allowedFilters:s}))},[]),c?a.jsx("div",{className:"row",children:a.jsx("div",{className:"col text-center mt-2",children:a.jsx("h4",{children:"Unable to Load Resources"})})}):l?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"row mt-3",children:[a.jsx("div",{className:"col-sm-4",children:a.jsx($M,{})}),a.jsx("div",{className:"col-sm-8",children:a.jsx(OM,{})})]})}):a.jsx(Do,{})},Dw={apiUrl:null,pages:1,publications:[],publicationsLoaded:!0,showPagination:!1,filterSelections:{allJournalsToggled:!1,doi:"",journal:"",authorName:"",publicationType:""},pageData:{current_page:1,last_page:1},filterOptions:{journals:[],publication_types:[]}},MM=Ye("publicationsBrowser/initApp",async(e,{getState:t,dispatch:n})=>{await n(Nr()),await n(Fw())}),Nr=Ye("publicationsBrowser/getPublications",async(e,{getState:t})=>{const n=t().publicationsBrowser;let r=`${n.apiUrl}?page=${n.pageData.current_page}`;if(n.filterSelections.doi!==""&&(r+=`&doi=${encodeURIComponent(n.filterSelections.doi)}`),n.filterSelections.authorName!==""&&(r+=`&author_name=${encodeURIComponent(n.filterSelections.authorName)}`),n.filterSelections.journal!==""){const i=n.filterSelections.journal;n.filterOptions.journals.includes(i)&&(r+=`&journal=${encodeURIComponent(n.filterSelections.journal)}`)}return n.filterSelections.publicationType!==""&&(r+=`&publication_type=${encodeURIComponent(n.filterSelections.publicationType)}`),await(await fetch(r)).json()}),Fw=Ye("publicationsBrowser/getFilters",async(e,{getState:t,dispatch:n})=>{const o=`${t().publicationsBrowser.apiUrl}?filters=1`;return(await(await fetch(o)).json()).filters||[]}),Lw=ri({name:"publicationsBrowser",initialState:Dw,reducers:{updatePageData:(e,{payload:t})=>{t.current_page&&(e.pageData.current_page=t.current_page),t.last_page&&(e.pageData.last_page=t.last_page)},updateFilterSelection:(e,{payload:t})=>{e.filterSelections[t.name]=t.value},resetFilters:e=>{e.filterSelections={doi:"",allJournalsToggled:!1,journal:"",authorName:"",publicationType:""}}},extraReducers:e=>{e.addCase(Nr.pending,t=>{t.publicationsLoaded=!1,t.error=null}).addCase(Nr.fulfilled,(t,n)=>{t.publicationsLoaded=!0,t.publications=n.payload.publications||[],n.payload.pagination&&n.payload.pagination.last_page!==t.pageData.last_page&&(t.pageData.current_page=1),t.showPagination=!0,n.payload.pagination&&(t.pageData.last_page=n.payload.pagination.last_page)}).addCase(Nr.rejected,(t,n)=>{t.publicationsLoaded=!0,t.error=n.error.message}).addCase(Fw.fulfilled,(t,n)=>{t.filterOptions=n.payload})}}),{updatePageData:DM,updateFilterSelection:Eg,resetFilters:FM}=Lw.actions,LM=e=>e.publicationsBrowser.filterSelections,UM=e=>e.publicationsBrowser.publicationsLoaded,VM=e=>e.publicationsBrowser.publications,BM=e=>e.publicationsBrowser.filterOptions,zM=e=>e.publicationsBrowser.pageData,qM=Lw.reducer,kd=e=>(e=e.startsWith("https")?e.split("https://doi.org/").join(""):e,e),HM=({publication:e,index:t})=>{const n=e.authors.map(f=>`${f.last_name}, ${f.first_name.substr(0,1)}.`).join(", "),r=e.projects.map(f=>f.grant_number),o=e.publication_type==="Other"?"Publication":e.publication_type,s=e.projects,i=t%2==0?"bg-light":"",l={textIndent:"-50px",marginLeft:"50px"},c=e.publication_datas,u=f=>{switch(f){case"Publication Type":return e.publication_type;case"Publication Year":return e.publication_year?e.publication_year:"N/A";case"DOI":return e.doi?a.jsx("a",{href:`https://doi.org/${kd(e.doi)}`,target:"_blank",className:"fw-normal",children:kd(e.doi)}):!1;case"Journal":return e.journal.title?e.journal.title:!1;case"Volume/Issue":return c["Volume/Issue"]?c["Volume/Issue"]:!1;case"Pages":return c.Pages?c.Pages:!1;case"Publisher":return c.Publisher?c.Publisher:!1}},d=()=>{const f=u("Publication Year");let p=e.title;const y=u("Journal"),m=u("DOI"),h=u("Volume/Issue"),x=u("Pages"),v=u("Publisher");return p[p.length-1]!="."&&(p+="."),e.publication_type==="Journal Paper"||e.publication_type==="Other"?a.jsxs(a.Fragment,{children:[n," (",f,"). ",p,y?a.jsxs("em",{className:"ms-1",children:[y,"."]}):"",h?a.jsxs("span",{className:"ms-1",children:[h,","]}):"",x?a.jsxs("span",{className:"ms-1",children:[x,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Conference Paper"||e.publication_type==="Software"?a.jsxs(a.Fragment,{children:[n," (",f,"). ",p,y?a.jsxs("em",{className:"ms-1",children:[y,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Book"||e.publication_type==="Book Chapter"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p}),v?a.jsxs("em",{className:"ms-1",children:[v,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Dataset"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p})," [Dataset]. ",v||"",".",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Dissertation"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p}),". [Doctoral dissertation",v?", "+v:"","].",m?a.jsx("span",{className:"ms-1",children:m}):""]}):""};return a.jsx("div",{className:"col-12 mb-2 border-bottom",children:a.jsx("div",{className:"card",style:{border:"unset"},children:a.jsxs("div",{className:`card-body pt-2 mb-2 ${i}`,children:[a.jsx("p",{style:l,children:d()}),s.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-decoration-underline mb-2",children:["Projects Supporting this ",o]}),a.jsx("ul",{style:{...l,listStyleType:"none"},children:r.map((f,p)=>a.jsx("li",{id:`project_${p}`,children:a.jsx("a",{href:`https://allocations.access-ci.org/current-projects?_requestNumber=${f}`,id:`grant_link${p}`,target:"_blank",style:{fontWeight:"600"},children:f})},`grant_${p}`))})]})]})})})},WM=()=>{const e=pe(VM);return e.length===0?a.jsx("div",{children:"No Publications Found"}):a.jsx("div",{children:e.map((t,n)=>a.jsx(HM,{publication:t,index:n},`publication_${n}`))})},KM=()=>{const e=it(),t=pe(BM),n=pe(LM),r=()=>{window.scrollTo(0,0),e(jd(!1)),e(ul({current_page:1})),e(Nr())},o=()=>{e(FM()),window.scrollTo(0,0),e(Nr())};if(!t.journals)return a.jsx("p",{children:"Loading filters..."});const s=l=>{e(Eg({name:l.target.name,value:l.target.value}))},i=l=>{e(Eg({name:l.target.name,value:l.target.value}))};return a.jsx("div",{className:"row sticky-top mb-2",children:a.jsxs("div",{className:"col",children:[a.jsx("h3",{className:"mb-2",children:"Filters"}),a.jsx("h5",{id:"journals_filter_label",className:"mb-1",children:"Journals"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("input",{placeholder:"Type to search...",list:"journal_list",name:"journal",id:"journal_select",value:n.journal,className:"form-control","aria-labelledby":"journal_filter_label",onChange:l=>s(l),onInput:l=>i(l)}),a.jsx("datalist",{id:"journal_list",children:t.journals.map((l,c)=>a.jsx("option",{value:l,children:l},`journal_${c}`))})]}),a.jsx("h5",{id:"author_name_label",className:"mb-1",children:"Author Name"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{placeholder:"Last Name, First Initial",type:"text",className:"form-control",value:n.authorName,name:"authorName",id:"authorName","aria-labelledby":"author_name",onChange:s})}),a.jsx("h5",{id:"doi_number_label",className:"mb-1",children:"DOI"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{type:"text",className:"form-control",value:kd(n.doi),name:"doi",id:"doiNumber","aria-labelledby":"doi_number_label",onChange:s})}),a.jsx("h5",{id:"publication_type_label",className:"mb-1",children:"Publication Type"}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"publicationType",id:"publication_type_select",value:n.publicationType,className:"form-control","aria-labelledby":"publication_type_label",onChange:l=>s(l),children:[a.jsx("option",{value:"",children:"-- All --"}),t.publication_types.map((l,c)=>a.jsx("option",{value:l,children:l},`publication_type_${c}`))]})}),a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{className:"btn btn-primary me-2",onClick:r,children:"Submit"}),a.jsx("button",{className:"btn btn-secondary",onClick:o,children:"Reset"})]})]})})},Rg=()=>{const e=it(),t=pe(zM),[n,r]=w.useState([]),[o,s]=w.useState("0"),i=Array.from({length:t.last_page},(m,h)=>h),l=10,c={width:"50px",textAlign:"center"};w.useEffect(()=>{f()},[t]);const u=m=>{const h=parseInt(m);e(DM({current_page:m})),e(Nr(h))},d=m=>(event.preventDefault(),s("0"),u(m),!1),f=()=>{const m=[];if(t.last_page>l)if(t.current_page>4){m.push(1),m.push("spacer");for(var h=1;h>0;h--)t.current_page-h>1&&m.push(t.current_page-h);m.push(["current",t.current_page]);for(var h=1;h<2;h++)t.current_page+h<=t.last_page&&m.push(t.current_page+h);t.last_page-t.current_page>1&&(m.push("spacer"),m.push(t.last_page))}else[1,2,3,4,5].forEach(x=>{x==t.current_page?m.push(["current",x]):m.push(x)}),m.push("spacer"),m.push(t.last_page);else for(var h=1;h<=t.last_page;h++)h==t.current_page?m.push(["current",h]):m.push(h);r(m)},p=m=>{let h=m,x="";return typeof m=="object"?[h,x]=m:x=m,h=="spacer"?a.jsx("li",{className:"page-item disabled",children:a.jsx("span",{className:"page-link",style:c,children:". . ."})}):h=="current"?a.jsx("li",{className:"page-item active","aria-current":"page",children:a.jsx("span",{className:"page-link",style:c,children:x})}):a.jsx("li",{className:"page-item",children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(h),children:x})})},y=()=>a.jsx("li",{className:"page-item",children:a.jsxs("select",{className:"page-link",style:{...c,height:"100%"},value:o,onChange:m=>d(m.target.value),children:[a.jsx("option",{value:"0",children:"Go To"}),i.map(m=>a.jsx("option",{value:m+1,children:m+1},`page_option_${m}`))]})});return a.jsx("div",{children:a.jsx("nav",{"aria-label":"Pages for the table",children:a.jsxs("ul",{className:"pagination",children:[a.jsx("li",{className:`page-item ${t.current_page==1?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:{width:"50px",textAlign:"center"},onClick:()=>u(t.current_page-1),disabled:t.current_page==1,"aria-label":"Previous Page Button",children:"<"})}),n.map((m,h)=>a.jsx(je.Fragment,{children:p(m)},`page_${h}`)),t.last_page>l?y():"",a.jsx("li",{className:`page-item ${t.current_page==t.last_page?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(t.current_page+1),disabled:t.current_page==t.last_page,"aria-label":"Next Page Button",children:">"})})]})})})},GM=({apiUrl:e})=>{const t=it(),n=pe(UM),r=a.jsx("div",{className:"loadingDiv",children:"Loading ..."});return w.useEffect(()=>{t(MM())},[t]),a.jsx("div",{className:"container-fluid",children:a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-sm-3",children:a.jsx(KM,{})}),a.jsxs("div",{className:"col-sm-9",children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(Rg,{})})}),a.jsx("div",{className:"row",id:"publicationListRow",children:a.jsx("div",{className:"col",children:n?a.jsx(WM,{}):r})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(Rg,{})})})]})]})})},Uw=({id:e,type:t,checked:n,onChange:r})=>a.jsx("div",{className:"control-group",style:{marginBottom:"0px"},children:a.jsx("div",{className:"controls",children:a.jsxs("label",{htmlFor:e,className:"checkbox",children:[a.jsx("input",{onChange:()=>r(t.allocation_type_id),type:"checkbox",checked:n,id:e}),t.display_allocation_type]})})}),YM=({types:e,createData:t})=>{const[n,r]=w.useState(""),[o,s]=w.useState([]),i=async(u,d)=>{t(u,d),r(""),s([])};function l(u){let d=o;d.includes(u)?d=d.filter(f=>f!==u):d=[...d,u],s(d)}function c(){s(o.length===e.length?[]:[...e.map(d=>d.allocation_type_id)])}return a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Keyword"}),a.jsx("th",{children:"Allocation Type"}),a.jsx("td",{})]})}),a.jsx("tbody",{children:a.jsxs("tr",{children:[a.jsx("td",{style:{width:"150px"},children:a.jsx("input",{type:"text",value:n,className:"form-control",onChange:u=>r(u.target.value)})}),a.jsx("td",{children:a.jsxs("div",{className:"form-inline",children:[a.jsx("div",{className:"control-group",style:{marginBottom:"0px"},children:a.jsx("div",{className:"controls",children:a.jsxs("label",{htmlFor:"select-all-checkbox",className:"checkbox",children:[a.jsx("input",{onChange:()=>c(),type:"checkbox",checked:o.length===e.length,id:"select-all-checkbox"}),"Select All"]})})}),e.map(u=>a.jsx(Uw,{id:`id_create_alloc_type_${u.allocation_type_id}`,type:u,checked:o.includes(u.allocation_type_id),onChange:l},`create_keyword_alloc_t_${u.allocation_type_id}`))]})}),a.jsx("td",{style:{width:"50px"},children:a.jsx("button",{className:"btn btn-primary",type:"button",onClick:async()=>i(n,o),children:"Add"})})]})})]})},QM=({keyword:e,keywordAllocationTypeIds:t,types:n,saveData:r,deleteData:o})=>{const[s,i]=w.useState(!1),[l,c]=w.useState(e.keyword),[u,d]=w.useState(t),f=()=>{i(!1),r(e.keyword_id,l,u)},p=h=>{let x=u;x.includes(h)?x=x.filter(v=>v!==h):x=[...x,h],d(x)};let y="",m=e.keyword.toString();return s?(m=a.jsx("input",{type:"text",id:e.keyword_id,value:l,onChange:h=>c(h.target.value)}),y=n.map(h=>a.jsx(Uw,{checked:u.includes(h.allocation_type_id),id:`keyword_${e.keyword}_alloc_type_${h.allocation_type_id}`,onChange:p,type:h},`keyword_${e.keyword}_alloc_t_${h.allocation_type_id}`))):y=n.filter(h=>t.includes(h.allocation_type_id)).map(h=>h.display_allocation_type).join(", "),a.jsxs("tr",{children:[a.jsxs("td",{children:[" ",m," "]}),a.jsxs("td",{children:[" ",y," "]}),s?a.jsxs("td",{style:{width:"150px"},children:[a.jsx("button",{style:{marginRight:"5px"},className:"btn btn-warning btn-sm",onClick:()=>i(!1),children:"Cancel"}),a.jsx("button",{className:"btn btn-success btn-sm",onClick:async()=>{f()},children:"Save"})]}):a.jsxs("td",{style:{width:"150px"},children:[a.jsx("button",{style:{marginRight:"5px"},className:"btn btn-primary btn-sm",onClick:()=>i(!0),children:"Edit"}),a.jsx("button",{className:"btn btn-danger btn-sm",onClick:async()=>o(e.keyword_id),children:"Delete"})]})]})};function XM({allocationTypes:e}){const[t,n]=w.useState([]),[r,o]=w.useState([]),[s,i]=w.useState(""),[l,c]=w.useState(!0),u=async h=>{const v=(await h.json()).message??"Error: Changes not saved";h.ok&&await f(),i(v),c(h.ok)},d=async(h,x)=>{const v=await fetch("/keywords",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:JSON.stringify({value:h,allocation_types:x})});await u(v)},f=async()=>{r.length===0&&o(e);const x=await(await fetch("/keywords",{headers:{"Content-Type":"application/json",Accept:"application/json"}})).json();n(x)},p=async(h,x,v)=>{const g=await fetch(`/keywords/${h}`,{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:JSON.stringify({id:h,keyword:x,allocation_types:v})});await u(g)},y=async h=>{const x=await fetch(`/keywords/${h}`,{headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},method:"DELETE"});await u(x)};w.useEffect(()=>{f()},[]);let m=null;return s.length!==0&&(m=a.jsx(be,{color:l?"success":"warning",children:s})),a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"Type new keywords separated by semicolons, select the desired allocation types, and then submit."}),a.jsx(a.Fragment,{children:m}),a.jsx(YM,{types:r,createData:d},"add-keywords"),a.jsx("h3",{children:"Current Keywords"}),a.jsxs("table",{className:"table table-bordered",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Keyword"}),a.jsx("th",{children:"Allocation Types"}),a.jsx("td",{})]})}),a.jsx("tbody",{children:t.map(h=>a.jsx(QM,{keyword:h,keywordAllocationTypeIds:h.allocation_type_keywords.map(x=>x.allocation_type_id),types:r,saveData:p,deleteData:y},h.keyword_id))})]})]})}function ZM(e,{bootstrapFonts:t=!0,bootstrapVariables:n=!0,access:r=!1,baseUrl:o=null}={}){const s=e.attachShadow({mode:"open"}),i=document.createElement("div"),l=document.createElement("div"),c=document.createElement("div"),u=document.createElement("div"),d=document.createElement("link"),f=document.createElement("link"),p=document.createElement("link");return o=o??(typeof document>"u"?require("url").pathToFileURL(__filename).href:Rp&&Rp.src||new URL("xras-ui.cjs",document.baseURI).href).replace(/\/[^/]+$/,""),d.rel="stylesheet",d.href=`${o}/bootstrap.css`,f.rel="stylesheet",f.href=`${o}/xras-ui.css`,p.rel="stylesheet",p.href=`${o}/access.css`,c.appendChild(u),l.appendChild(c),i.appendChild(l),s.appendChild(d),s.appendChild(f),s.appendChild(p),s.appendChild(i),i.classList.add("bootstrap"),n&&l.classList.add("bootstrap-variables"),t&&(c.classList.add("bootstrap-fonts"),c.setAttribute("data-bs-theme","light")),u}function JM({target:e}){_t.createRoot(e).render(a.jsx(QC,{}))}function eD({availableResources:e,unavailableResources:t,canAdd:n,relativeUrlRoot:r,target:o}){_t.createRoot(o).render(a.jsx(mE,{availableResources:e,unavailableResources:t,canAdd:n,relativeUrlRoot:r}))}function tD({resourceId:e,target:t,setExternalSubmit:n,relativeUrlRoot:r}){_t.createRoot(t).render(a.jsx(_x,{resourceId:e,setExternalSubmit:n,relativeUrlRoot:r}))}function nD({target:e,username:t,routes:n}){Df(n);const r=Mo({reducer:{api:tR}});_t.createRoot(e).render(a.jsx(Ur,{store:r,children:a.jsx(cA,{username:t})}))}function rD({target:e,apiUrl:t}){const n=Mo({reducer:{projectsBrowser:jA},preloadedState:{projectsBrowser:{...vw,apiUrl:t}}});_t.createRoot(e).render(a.jsx(Ur,{store:n,children:a.jsx(NA,{})}))}function oD({target:e,apiUrl:t}){const n=Mo({reducer:{publicationsBrowser:qM},preloadedState:{publicationsBrowser:{...Dw,apiUrl:t}}});_t.createRoot(e).render(a.jsx(Ur,{store:n,children:a.jsx(GM,{apiUrl:t})}))}function Vw(){return Mo({reducer:{publications_store:z2}})}function sD({target:e,routes:t}){Df(t),_t.createRoot(e).render(a.jsx(Ur,{store:Vw(),children:a.jsx(Pw,{})}))}function iD({target:e,routes:t}){Df(t),_t.createRoot(e).render(a.jsx(Ur,{store:Vw(),children:a.jsx(U2,{...JSON.parse(e.dataset.publicationsSelectProps)})}))}function aD({target:e,catalogSources:t,onRamps:n,baseUrl:r}){const o=Mo({reducer:{resourceCatalog:tM}});_t.createRoot(e).render(a.jsx(Ur,{store:o,children:a.jsx(xM,{catalogSources:t,onRamps:n,baseUrl:r})}))}function lD({target:e,apiUrl:t,excludedCategories:n,excludedFilters:r,excludedResources:o,allowedCategories:s,allowedFilters:i}){const l=Mo({reducer:{resourceCatalog:kM}});_t.createRoot(e).render(a.jsx(Ur,{store:l,children:a.jsx(AM,{apiUrl:t,excludedCategories:n,excludedFilters:r,excludedResources:o,allowedCategories:s,allowedFilters:i})}))}function cD({allocationTypes:e,target:t}){_t.createRoot(t).render(a.jsx(XM,{allocationTypes:e}))}exports.allocationsMap=JM;exports.editResource=tD;exports.keywords=cD;exports.onRampsResourceCatalog=aD;exports.projects=nD;exports.projectsBrowser=rD;exports.publications=sD;exports.publicationsBrowser=oD;exports.publicationsSelect=iD;exports.resourceCatalog=lD;exports.resources=eD;exports.shadowTarget=ZM;
|
|
70
|
+
`]))),vI=function(t,n){var r=t.isFocused,o=t.size,s=t.theme,i=s.colors,l=s.spacing.baseUnit;return K({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:o,lineHeight:1,marginRight:o,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?i.neutral60:i.neutral20,padding:l*2})},qc=function(t){var n=t.delay,r=t.offset;return G("span",{css:vp({animation:"".concat(gI," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},yI=function(t){var n=t.innerProps,r=t.isRtl,o=t.size,s=o===void 0?4:o,i=gn(t,lI);return G("div",Y({},Oe(K(K({},i),{},{innerProps:n,isRtl:r,size:s}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),G(qc,{delay:0,offset:r}),G(qc,{delay:160,offset:!0}),G(qc,{delay:320,offset:!r}))},xI=function(t,n){var r=t.isDisabled,o=t.isFocused,s=t.theme,i=s.colors,l=s.borderRadius,c=s.spacing;return K({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:c.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?i.neutral5:i.neutral0,borderColor:r?i.neutral10:o?i.primary:i.neutral20,borderRadius:l,borderStyle:"solid",borderWidth:1,boxShadow:o?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:o?i.primary:i.neutral30}})},bI=function(t){var n=t.children,r=t.isDisabled,o=t.isFocused,s=t.innerRef,i=t.innerProps,l=t.menuIsOpen;return G("div",Y({ref:s},Oe(t,"control",{control:!0,"control--is-disabled":r,"control--is-focused":o,"control--menu-is-open":l}),i,{"aria-disabled":r||void 0}),n)},wI=bI,SI=["data"],_I=function(t,n){var r=t.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},jI=function(t){var n=t.children,r=t.cx,o=t.getStyles,s=t.getClassNames,i=t.Heading,l=t.headingProps,c=t.innerProps,u=t.label,d=t.theme,f=t.selectProps;return G("div",Y({},Oe(t,"group",{group:!0}),c),G(i,Y({},l,{selectProps:f,theme:d,getStyles:o,getClassNames:s,cx:r}),u),G("div",null,n))},CI=function(t,n){var r=t.theme,o=r.colors,s=r.spacing;return K({label:"group",cursor:"default",display:"block"},n?{}:{color:o.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:s.baseUnit*3,paddingRight:s.baseUnit*3,textTransform:"uppercase"})},EI=function(t){var n=Yb(t);n.data;var r=gn(n,SI);return G("div",Y({},Oe(t,"groupHeading",{"group-heading":!0}),r))},RI=jI,NI=["innerRef","isDisabled","isHidden","inputClassName"],kI=function(t,n){var r=t.isDisabled,o=t.value,s=t.theme,i=s.spacing,l=s.colors;return K(K({visibility:r?"hidden":"visible",transform:o?"translateZ(0)":""},TI),n?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:l.neutral80})},ow={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},TI={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":K({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},ow)},OI=function(t){return K({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},ow)},PI=function(t){var n=t.cx,r=t.value,o=Yb(t),s=o.innerRef,i=o.isDisabled,l=o.isHidden,c=o.inputClassName,u=gn(o,NI);return G("div",Y({},Oe(t,"input",{"input-container":!0}),{"data-value":r||""}),G("input",Y({className:n({input:!0},c),ref:s,style:OI(l),disabled:i},u)))},II=PI,$I=function(t,n){var r=t.theme,o=r.spacing,s=r.borderRadius,i=r.colors;return K({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:i.neutral10,borderRadius:s/2,margin:o.baseUnit/2})},AI=function(t,n){var r=t.theme,o=r.borderRadius,s=r.colors,i=t.cropWithEllipsis;return K({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:o/2,color:s.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},MI=function(t,n){var r=t.theme,o=r.spacing,s=r.borderRadius,i=r.colors,l=t.isFocused;return K({alignItems:"center",display:"flex"},n?{}:{borderRadius:s/2,backgroundColor:l?i.dangerLight:void 0,paddingLeft:o.baseUnit,paddingRight:o.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},sw=function(t){var n=t.children,r=t.innerProps;return G("div",r,n)},DI=sw,FI=sw;function LI(e){var t=e.children,n=e.innerProps;return G("div",Y({role:"button"},n),t||G(wp,{size:14}))}var UI=function(t){var n=t.children,r=t.components,o=t.data,s=t.innerProps,i=t.isDisabled,l=t.removeProps,c=t.selectProps,u=r.Container,d=r.Label,f=r.Remove;return G(u,{data:o,innerProps:K(K({},Oe(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),s),selectProps:c},G(d,{data:o,innerProps:K({},Oe(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:c},n),G(f,{data:o,innerProps:K(K({},Oe(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},l),selectProps:c}))},VI=UI,BI=function(t,n){var r=t.isDisabled,o=t.isFocused,s=t.isSelected,i=t.theme,l=i.spacing,c=i.colors;return K({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:s?c.primary:o?c.primary25:"transparent",color:r?c.neutral20:s?c.neutral0:"inherit",padding:"".concat(l.baseUnit*2,"px ").concat(l.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:s?c.primary:c.primary50}})},zI=function(t){var n=t.children,r=t.isDisabled,o=t.isFocused,s=t.isSelected,i=t.innerRef,l=t.innerProps;return G("div",Y({},Oe(t,"option",{option:!0,"option--is-disabled":r,"option--is-focused":o,"option--is-selected":s}),{ref:i,"aria-disabled":r},l),n)},qI=zI,HI=function(t,n){var r=t.theme,o=r.spacing,s=r.colors;return K({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:s.neutral50,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},WI=function(t){var n=t.children,r=t.innerProps;return G("div",Y({},Oe(t,"placeholder",{placeholder:!0}),r),n)},KI=WI,GI=function(t,n){var r=t.isDisabled,o=t.theme,s=o.spacing,i=o.colors;return K({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?i.neutral40:i.neutral80,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},YI=function(t){var n=t.children,r=t.isDisabled,o=t.innerProps;return G("div",Y({},Oe(t,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),o),n)},QI=YI,XI={ClearIndicator:pI,Control:wI,DropdownIndicator:dI,DownChevron:nw,CrossIcon:wp,Group:RI,GroupHeading:EI,IndicatorsContainer:iI,IndicatorSeparator:mI,Input:II,LoadingIndicator:yI,Menu:WP,MenuList:GP,MenuPortal:eI,LoadingMessage:ZP,NoOptionsMessage:XP,MultiValue:VI,MultiValueContainer:DI,MultiValueLabel:FI,MultiValueRemove:LI,Option:qI,Placeholder:KI,SelectContainer:nI,SingleValue:QI,ValueContainer:oI},ZI=function(t){return K(K({},XI),t.components)},sg=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function JI(e,t){return!!(e===t||sg(e)&&sg(t))}function e$(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!JI(e[n],t[n]))return!1;return!0}function t$(e,t){t===void 0&&(t=e$);var n=null;function r(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];if(n&&n.lastThis===this&&t(o,n.lastArgs))return n.lastResult;var i=e.apply(this,o);return n={lastResult:i,lastArgs:o,lastThis:this},i}return r.clear=function(){n=null},r}var n$={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},r$=function(t){return G("span",Y({css:n$},t))},ig=r$,o$={guidance:function(t){var n=t.isSearchable,r=t.isMulti,o=t.tabSelectsValue,s=t.context,i=t.isInitialFocus;switch(s){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(o?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(t["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(t){var n=t.action,r=t.label,o=r===void 0?"":r,s=t.labels,i=t.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(o,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(s.length>1?"s":""," ").concat(s.join(","),", selected.");case"select-option":return i?"option ".concat(o," is disabled. Select another option."):"option ".concat(o,", selected.");default:return""}},onFocus:function(t){var n=t.context,r=t.focused,o=t.options,s=t.label,i=s===void 0?"":s,l=t.selectValue,c=t.isDisabled,u=t.isSelected,d=t.isAppleDevice,f=function(h,x){return h&&h.length?"".concat(h.indexOf(x)+1," of ").concat(h.length):""};if(n==="value"&&l)return"value ".concat(i," focused, ").concat(f(l,r),".");if(n==="menu"&&d){var p=c?" disabled":"",y="".concat(u?" selected":"").concat(p);return"".concat(i).concat(y,", ").concat(f(o,r),".")}return""},onFilter:function(t){var n=t.inputValue,r=t.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},s$=function(t){var n=t.ariaSelection,r=t.focusedOption,o=t.focusedValue,s=t.focusableOptions,i=t.isFocused,l=t.selectValue,c=t.selectProps,u=t.id,d=t.isAppleDevice,f=c.ariaLiveMessages,p=c.getOptionLabel,y=c.inputValue,m=c.isMulti,h=c.isOptionDisabled,x=c.isSearchable,v=c.menuIsOpen,g=c.options,b=c.screenReaderStatus,S=c.tabSelectsValue,_=c.isLoading,j=c["aria-label"],C=c["aria-live"],E=w.useMemo(function(){return K(K({},o$),f||{})},[f]),N=w.useMemo(function(){var D="";if(n&&E.onChange){var V=n.option,Q=n.options,O=n.removedValue,U=n.removedValues,A=n.value,H=function(ge){return Array.isArray(ge)?null:ge},B=O||V||H(A),W=B?p(B):"",Z=Q||U||void 0,ee=Z?Z.map(p):[],X=K({isDisabled:B&&h(B,l),label:W,labels:ee},n);D=E.onChange(X)}return D},[n,E,h,l,p]),R=w.useMemo(function(){var D="",V=r||o,Q=!!(r&&l&&l.includes(r));if(V&&E.onFocus){var O={focused:V,label:p(V),isDisabled:h(V,l),isSelected:Q,options:s,context:V===r?"menu":"value",selectValue:l,isAppleDevice:d};D=E.onFocus(O)}return D},[r,o,p,h,E,s,l,d]),T=w.useMemo(function(){var D="";if(v&&g.length&&!_&&E.onFilter){var V=b({count:s.length});D=E.onFilter({inputValue:y,resultsMessage:V})}return D},[s,y,v,E,g,b,_]),k=(n==null?void 0:n.action)==="initial-input-focus",P=w.useMemo(function(){var D="";if(E.guidance){var V=o?"value":v?"menu":"input";D=E.guidance({"aria-label":j,context:V,isDisabled:r&&h(r,l),isMulti:m,isSearchable:x,tabSelectsValue:S,isInitialFocus:k})}return D},[j,r,o,m,h,x,v,E,l,S,k]),M=G(w.Fragment,null,G("span",{id:"aria-selection"},N),G("span",{id:"aria-focused"},R),G("span",{id:"aria-results"},T),G("span",{id:"aria-guidance"},P));return G(w.Fragment,null,G(ig,{id:u},k&&M),G(ig,{"aria-live":C,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!k&&M))},i$=s$,Sd=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],a$=new RegExp("["+Sd.map(function(e){return e.letters}).join("")+"]","g"),iw={};for(var Hc=0;Hc<Sd.length;Hc++)for(var Wc=Sd[Hc],Kc=0;Kc<Wc.letters.length;Kc++)iw[Wc.letters[Kc]]=Wc.base;var aw=function(t){return t.replace(a$,function(n){return iw[n]})},l$=t$(aw),ag=function(t){return t.replace(/^\s+|\s+$/g,"")},c$=function(t){return"".concat(t.label," ").concat(t.value)},u$=function(t){return function(n,r){if(n.data.__isNew__)return!0;var o=K({ignoreCase:!0,ignoreAccents:!0,stringify:c$,trim:!0,matchFrom:"any"},t),s=o.ignoreCase,i=o.ignoreAccents,l=o.stringify,c=o.trim,u=o.matchFrom,d=c?ag(r):r,f=c?ag(l(n)):l(n);return s&&(d=d.toLowerCase(),f=f.toLowerCase()),i&&(d=l$(d),f=aw(f)),u==="start"?f.substr(0,d.length)===d:f.indexOf(d)>-1}},d$=["innerRef"];function f$(e){var t=e.innerRef,n=gn(e,d$),r=FP(n,"onExited","in","enter","exit","appear");return G("input",Y({ref:t},r,{css:vp({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var p$=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function h$(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,o=e.onTopArrive,s=e.onTopLeave,i=w.useRef(!1),l=w.useRef(!1),c=w.useRef(0),u=w.useRef(null),d=w.useCallback(function(x,v){if(u.current!==null){var g=u.current,b=g.scrollTop,S=g.scrollHeight,_=g.clientHeight,j=u.current,C=v>0,E=S-_-b,N=!1;E>v&&i.current&&(r&&r(x),i.current=!1),C&&l.current&&(s&&s(x),l.current=!1),C&&v>E?(n&&!i.current&&n(x),j.scrollTop=S,N=!0,i.current=!0):!C&&-v>b&&(o&&!l.current&&o(x),j.scrollTop=0,N=!0,l.current=!0),N&&p$(x)}},[n,r,o,s]),f=w.useCallback(function(x){d(x,x.deltaY)},[d]),p=w.useCallback(function(x){c.current=x.changedTouches[0].clientY},[]),y=w.useCallback(function(x){var v=c.current-x.changedTouches[0].clientY;d(x,v)},[d]),m=w.useCallback(function(x){if(x){var v=AP?{passive:!1}:!1;x.addEventListener("wheel",f,v),x.addEventListener("touchstart",p,v),x.addEventListener("touchmove",y,v)}},[y,p,f]),h=w.useCallback(function(x){x&&(x.removeEventListener("wheel",f,!1),x.removeEventListener("touchstart",p,!1),x.removeEventListener("touchmove",y,!1))},[y,p,f]);return w.useEffect(function(){if(t){var x=u.current;return m(x),function(){h(x)}}},[t,m,h]),function(x){u.current=x}}var lg=["boxSizing","height","overflow","paddingRight","position"],cg={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function ug(e){e.preventDefault()}function dg(e){e.stopPropagation()}function fg(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;e===0?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function pg(){return"ontouchstart"in window||navigator.maxTouchPoints}var hg=!!(typeof window<"u"&&window.document&&window.document.createElement),rs=0,Wr={capture:!1,passive:!1};function m$(e){var t=e.isEnabled,n=e.accountForScrollbars,r=n===void 0?!0:n,o=w.useRef({}),s=w.useRef(null),i=w.useCallback(function(c){if(hg){var u=document.body,d=u&&u.style;if(r&&lg.forEach(function(m){var h=d&&d[m];o.current[m]=h}),r&&rs<1){var f=parseInt(o.current.paddingRight,10)||0,p=document.body?document.body.clientWidth:0,y=window.innerWidth-p+f||0;Object.keys(cg).forEach(function(m){var h=cg[m];d&&(d[m]=h)}),d&&(d.paddingRight="".concat(y,"px"))}u&&pg()&&(u.addEventListener("touchmove",ug,Wr),c&&(c.addEventListener("touchstart",fg,Wr),c.addEventListener("touchmove",dg,Wr))),rs+=1}},[r]),l=w.useCallback(function(c){if(hg){var u=document.body,d=u&&u.style;rs=Math.max(rs-1,0),r&&rs<1&&lg.forEach(function(f){var p=o.current[f];d&&(d[f]=p)}),u&&pg()&&(u.removeEventListener("touchmove",ug,Wr),c&&(c.removeEventListener("touchstart",fg,Wr),c.removeEventListener("touchmove",dg,Wr)))}},[r]);return w.useEffect(function(){if(t){var c=s.current;return i(c),function(){l(c)}}},[t,i,l]),function(c){s.current=c}}var g$=function(t){var n=t.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},v$={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function y$(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,o=r===void 0?!0:r,s=e.onBottomArrive,i=e.onBottomLeave,l=e.onTopArrive,c=e.onTopLeave,u=h$({isEnabled:o,onBottomArrive:s,onBottomLeave:i,onTopArrive:l,onTopLeave:c}),d=m$({isEnabled:n}),f=function(y){u(y),d(y)};return G(w.Fragment,null,n&&G("div",{onClick:g$,css:v$}),t(f))}var x$={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},b$=function(t){var n=t.name,r=t.onFocus;return G("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:x$,value:"",onChange:function(){}})},w$=b$;function Sp(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function S$(){return Sp(/^iPhone/i)}function lw(){return Sp(/^Mac/i)}function _$(){return Sp(/^iPad/i)||lw()&&navigator.maxTouchPoints>1}function j$(){return S$()||_$()}function C$(){return lw()||j$()}var E$=function(t){return t.label},R$=function(t){return t.label},N$=function(t){return t.value},k$=function(t){return!!t.isDisabled},T$={clearIndicator:fI,container:tI,control:xI,dropdownIndicator:uI,group:_I,groupHeading:CI,indicatorsContainer:sI,indicatorSeparator:hI,input:kI,loadingIndicator:vI,loadingMessage:QP,menu:zP,menuList:KP,menuPortal:JP,multiValue:$I,multiValueLabel:AI,multiValueRemove:MI,noOptionsMessage:YP,option:BI,placeholder:HI,singleValue:GI,valueContainer:rI},O$={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},P$=4,cw=4,I$=38,$$=cw*2,A$={baseUnit:cw,controlHeight:I$,menuGutter:$$},Gc={borderRadius:P$,colors:O$,spacing:A$},M$={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:rg(),captureMenuScroll:!rg(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:u$(),formatGroupLabel:E$,getOptionLabel:R$,getOptionValue:N$,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:k$,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!IP(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var n=t.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function mg(e,t,n,r){var o=fw(e,t,n),s=pw(e,t,n),i=dw(e,t),l=cl(e,t);return{type:"option",data:t,isDisabled:o,isSelected:s,label:i,value:l,index:r}}function fa(e,t){return e.options.map(function(n,r){if("options"in n){var o=n.options.map(function(i,l){return mg(e,i,t,l)}).filter(function(i){return vg(e,i)});return o.length>0?{type:"group",data:n,options:o,index:r}:void 0}var s=mg(e,n,t,r);return vg(e,s)?s:void 0}).filter(MP)}function uw(e){return e.reduce(function(t,n){return n.type==="group"?t.push.apply(t,cp(n.options.map(function(r){return r.data}))):t.push(n.data),t},[])}function gg(e,t){return e.reduce(function(n,r){return r.type==="group"?n.push.apply(n,cp(r.options.map(function(o){return{data:o.data,id:"".concat(t,"-").concat(r.index,"-").concat(o.index)}}))):n.push({data:r.data,id:"".concat(t,"-").concat(r.index)}),n},[])}function D$(e,t){return uw(fa(e,t))}function vg(e,t){var n=e.inputValue,r=n===void 0?"":n,o=t.data,s=t.isSelected,i=t.label,l=t.value;return(!mw(e)||!s)&&hw(e,{label:i,value:l,data:o},r)}function F$(e,t){var n=e.focusedValue,r=e.selectValue,o=r.indexOf(n);if(o>-1){var s=t.indexOf(n);if(s>-1)return n;if(o<t.length)return t[o]}return null}function L$(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}var Yc=function(t,n){var r,o=(r=t.find(function(s){return s.data===n}))===null||r===void 0?void 0:r.id;return o||null},dw=function(t,n){return t.getOptionLabel(n)},cl=function(t,n){return t.getOptionValue(n)};function fw(e,t,n){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,n):!1}function pw(e,t,n){if(n.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,n);var r=cl(e,t);return n.some(function(o){return cl(e,o)===r})}function hw(e,t,n){return e.filterOption?e.filterOption(t,n):!0}var mw=function(t){var n=t.hideSelectedOptions,r=t.isMulti;return n===void 0?r:n},U$=1,_p=function(e){rO(n,e);var t=iO(n);function n(r){var o;if(tO(this,n),o=t.call(this,r),o.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},o.blockOptionHover=!1,o.isComposing=!1,o.commonProps=void 0,o.initialTouchX=0,o.initialTouchY=0,o.openAfterFocus=!1,o.scrollToFocusedOptionOnUpdate=!1,o.userIsDragging=void 0,o.isAppleDevice=C$(),o.controlRef=null,o.getControlRef=function(c){o.controlRef=c},o.focusedOptionRef=null,o.getFocusedOptionRef=function(c){o.focusedOptionRef=c},o.menuListRef=null,o.getMenuListRef=function(c){o.menuListRef=c},o.inputRef=null,o.getInputRef=function(c){o.inputRef=c},o.focus=o.focusInput,o.blur=o.blurInput,o.onChange=function(c,u){var d=o.props,f=d.onChange,p=d.name;u.name=p,o.ariaOnChange(c,u),f(c,u)},o.setValue=function(c,u,d){var f=o.props,p=f.closeMenuOnSelect,y=f.isMulti,m=f.inputValue;o.onInputChange("",{action:"set-value",prevInputValue:m}),p&&(o.setState({inputIsHiddenAfterUpdate:!y}),o.onMenuClose()),o.setState({clearFocusValueOnUpdate:!0}),o.onChange(c,{action:u,option:d})},o.selectOption=function(c){var u=o.props,d=u.blurInputOnSelect,f=u.isMulti,p=u.name,y=o.state.selectValue,m=f&&o.isOptionSelected(c,y),h=o.isOptionDisabled(c,y);if(m){var x=o.getOptionValue(c);o.setValue(y.filter(function(v){return o.getOptionValue(v)!==x}),"deselect-option",c)}else if(!h)f?o.setValue([].concat(cp(y),[c]),"select-option",c):o.setValue(c,"select-option");else{o.ariaOnChange(c,{action:"select-option",option:c,name:p});return}d&&o.blurInput()},o.removeValue=function(c){var u=o.props.isMulti,d=o.state.selectValue,f=o.getOptionValue(c),p=d.filter(function(m){return o.getOptionValue(m)!==f}),y=Vi(u,p,p[0]||null);o.onChange(y,{action:"remove-value",removedValue:c}),o.focusInput()},o.clearValue=function(){var c=o.state.selectValue;o.onChange(Vi(o.props.isMulti,[],null),{action:"clear",removedValues:c})},o.popValue=function(){var c=o.props.isMulti,u=o.state.selectValue,d=u[u.length-1],f=u.slice(0,u.length-1),p=Vi(c,f,f[0]||null);o.onChange(p,{action:"pop-value",removedValue:d})},o.getFocusedOptionId=function(c){return Yc(o.state.focusableOptionsWithIds,c)},o.getFocusableOptionsWithIds=function(){return gg(fa(o.props,o.state.selectValue),o.getElementId("option"))},o.getValue=function(){return o.state.selectValue},o.cx=function(){for(var c=arguments.length,u=new Array(c),d=0;d<c;d++)u[d]=arguments[d];return RP.apply(void 0,[o.props.classNamePrefix].concat(u))},o.getOptionLabel=function(c){return dw(o.props,c)},o.getOptionValue=function(c){return cl(o.props,c)},o.getStyles=function(c,u){var d=o.props.unstyled,f=T$[c](u,d);f.boxSizing="border-box";var p=o.props.styles[c];return p?p(f,u):f},o.getClassNames=function(c,u){var d,f;return(d=(f=o.props.classNames)[c])===null||d===void 0?void 0:d.call(f,u)},o.getElementId=function(c){return"".concat(o.state.instancePrefix,"-").concat(c)},o.getComponents=function(){return ZI(o.props)},o.buildCategorizedOptions=function(){return fa(o.props,o.state.selectValue)},o.getCategorizedOptions=function(){return o.props.menuIsOpen?o.buildCategorizedOptions():[]},o.buildFocusableOptions=function(){return uw(o.buildCategorizedOptions())},o.getFocusableOptions=function(){return o.props.menuIsOpen?o.buildFocusableOptions():[]},o.ariaOnChange=function(c,u){o.setState({ariaSelection:K({value:c},u)})},o.onMenuMouseDown=function(c){c.button===0&&(c.stopPropagation(),c.preventDefault(),o.focusInput())},o.onMenuMouseMove=function(c){o.blockOptionHover=!1},o.onControlMouseDown=function(c){if(!c.defaultPrevented){var u=o.props.openMenuOnClick;o.state.isFocused?o.props.menuIsOpen?c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&o.onMenuClose():u&&o.openMenu("first"):(u&&(o.openAfterFocus=!0),o.focusInput()),c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&c.preventDefault()}},o.onDropdownIndicatorMouseDown=function(c){if(!(c&&c.type==="mousedown"&&c.button!==0)&&!o.props.isDisabled){var u=o.props,d=u.isMulti,f=u.menuIsOpen;o.focusInput(),f?(o.setState({inputIsHiddenAfterUpdate:!d}),o.onMenuClose()):o.openMenu("first"),c.preventDefault()}},o.onClearIndicatorMouseDown=function(c){c&&c.type==="mousedown"&&c.button!==0||(o.clearValue(),c.preventDefault(),o.openAfterFocus=!1,c.type==="touchend"?o.focusInput():setTimeout(function(){return o.focusInput()}))},o.onScroll=function(c){typeof o.props.closeMenuOnScroll=="boolean"?c.target instanceof HTMLElement&&Jl(c.target)&&o.props.onMenuClose():typeof o.props.closeMenuOnScroll=="function"&&o.props.closeMenuOnScroll(c)&&o.props.onMenuClose()},o.onCompositionStart=function(){o.isComposing=!0},o.onCompositionEnd=function(){o.isComposing=!1},o.onTouchStart=function(c){var u=c.touches,d=u&&u.item(0);d&&(o.initialTouchX=d.clientX,o.initialTouchY=d.clientY,o.userIsDragging=!1)},o.onTouchMove=function(c){var u=c.touches,d=u&&u.item(0);if(d){var f=Math.abs(d.clientX-o.initialTouchX),p=Math.abs(d.clientY-o.initialTouchY),y=5;o.userIsDragging=f>y||p>y}},o.onTouchEnd=function(c){o.userIsDragging||(o.controlRef&&!o.controlRef.contains(c.target)&&o.menuListRef&&!o.menuListRef.contains(c.target)&&o.blurInput(),o.initialTouchX=0,o.initialTouchY=0)},o.onControlTouchEnd=function(c){o.userIsDragging||o.onControlMouseDown(c)},o.onClearIndicatorTouchEnd=function(c){o.userIsDragging||o.onClearIndicatorMouseDown(c)},o.onDropdownIndicatorTouchEnd=function(c){o.userIsDragging||o.onDropdownIndicatorMouseDown(c)},o.handleInputChange=function(c){var u=o.props.inputValue,d=c.currentTarget.value;o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange(d,{action:"input-change",prevInputValue:u}),o.props.menuIsOpen||o.onMenuOpen()},o.onInputFocus=function(c){o.props.onFocus&&o.props.onFocus(c),o.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(o.openAfterFocus||o.props.openMenuOnFocus)&&o.openMenu("first"),o.openAfterFocus=!1},o.onInputBlur=function(c){var u=o.props.inputValue;if(o.menuListRef&&o.menuListRef.contains(document.activeElement)){o.inputRef.focus();return}o.props.onBlur&&o.props.onBlur(c),o.onInputChange("",{action:"input-blur",prevInputValue:u}),o.onMenuClose(),o.setState({focusedValue:null,isFocused:!1})},o.onOptionHover=function(c){if(!(o.blockOptionHover||o.state.focusedOption===c)){var u=o.getFocusableOptions(),d=u.indexOf(c);o.setState({focusedOption:c,focusedOptionId:d>-1?o.getFocusedOptionId(c):null})}},o.shouldHideSelectedOptions=function(){return mw(o.props)},o.onValueInputFocus=function(c){c.preventDefault(),c.stopPropagation(),o.focus()},o.onKeyDown=function(c){var u=o.props,d=u.isMulti,f=u.backspaceRemovesValue,p=u.escapeClearsValue,y=u.inputValue,m=u.isClearable,h=u.isDisabled,x=u.menuIsOpen,v=u.onKeyDown,g=u.tabSelectsValue,b=u.openMenuOnFocus,S=o.state,_=S.focusedOption,j=S.focusedValue,C=S.selectValue;if(!h&&!(typeof v=="function"&&(v(c),c.defaultPrevented))){switch(o.blockOptionHover=!0,c.key){case"ArrowLeft":if(!d||y)return;o.focusValue("previous");break;case"ArrowRight":if(!d||y)return;o.focusValue("next");break;case"Delete":case"Backspace":if(y)return;if(j)o.removeValue(j);else{if(!f)return;d?o.popValue():m&&o.clearValue()}break;case"Tab":if(o.isComposing||c.shiftKey||!x||!g||!_||b&&o.isOptionSelected(_,C))return;o.selectOption(_);break;case"Enter":if(c.keyCode===229)break;if(x){if(!_||o.isComposing)return;o.selectOption(_);break}return;case"Escape":x?(o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange("",{action:"menu-close",prevInputValue:y}),o.onMenuClose()):m&&p&&o.clearValue();break;case" ":if(y)return;if(!x){o.openMenu("first");break}if(!_)return;o.selectOption(_);break;case"ArrowUp":x?o.focusOption("up"):o.openMenu("last");break;case"ArrowDown":x?o.focusOption("down"):o.openMenu("first");break;case"PageUp":if(!x)return;o.focusOption("pageup");break;case"PageDown":if(!x)return;o.focusOption("pagedown");break;case"Home":if(!x)return;o.focusOption("first");break;case"End":if(!x)return;o.focusOption("last");break;default:return}c.preventDefault()}},o.state.instancePrefix="react-select-"+(o.props.instanceId||++U$),o.state.selectValue=tg(r.value),r.menuIsOpen&&o.state.selectValue.length){var s=o.getFocusableOptionsWithIds(),i=o.buildFocusableOptions(),l=i.indexOf(o.state.selectValue[0]);o.state.focusableOptionsWithIds=s,o.state.focusedOption=i[l],o.state.focusedOptionId=Yc(s,i[l])}return o}return nO(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&ng(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(o){var s=this.props,i=s.isDisabled,l=s.menuIsOpen,c=this.state.isFocused;(c&&!i&&o.isDisabled||c&&l&&!o.menuIsOpen)&&this.focusInput(),c&&i&&!o.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!c&&!i&&o.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(ng(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(o,s){this.props.onInputChange(o,s)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(o){var s=this,i=this.state,l=i.selectValue,c=i.isFocused,u=this.buildFocusableOptions(),d=o==="first"?0:u.length-1;if(!this.props.isMulti){var f=u.indexOf(l[0]);f>-1&&(d=f)}this.scrollToFocusedOptionOnUpdate=!(c&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[d],focusedOptionId:this.getFocusedOptionId(u[d])},function(){return s.onMenuOpen()})}},{key:"focusValue",value:function(o){var s=this.state,i=s.selectValue,l=s.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var c=i.indexOf(l);l||(c=-1);var u=i.length-1,d=-1;if(i.length){switch(o){case"previous":c===0?d=0:c===-1?d=u:d=c-1;break;case"next":c>-1&&c<u&&(d=c+1);break}this.setState({inputIsHidden:d!==-1,focusedValue:i[d]})}}}},{key:"focusOption",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",s=this.props.pageSize,i=this.state.focusedOption,l=this.getFocusableOptions();if(l.length){var c=0,u=l.indexOf(i);i||(u=-1),o==="up"?c=u>0?u-1:l.length-1:o==="down"?c=(u+1)%l.length:o==="pageup"?(c=u-s,c<0&&(c=0)):o==="pagedown"?(c=u+s,c>l.length-1&&(c=l.length-1)):o==="last"&&(c=l.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:l[c],focusedValue:null,focusedOptionId:this.getFocusedOptionId(l[c])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Gc):K(K({},Gc),this.props.theme):Gc}},{key:"getCommonProps",value:function(){var o=this.clearValue,s=this.cx,i=this.getStyles,l=this.getClassNames,c=this.getValue,u=this.selectOption,d=this.setValue,f=this.props,p=f.isMulti,y=f.isRtl,m=f.options,h=this.hasValue();return{clearValue:o,cx:s,getStyles:i,getClassNames:l,getValue:c,hasValue:h,isMulti:p,isRtl:y,options:m,selectOption:u,selectProps:f,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var o=this.state.selectValue;return o.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var o=this.props,s=o.isClearable,i=o.isMulti;return s===void 0?i:s}},{key:"isOptionDisabled",value:function(o,s){return fw(this.props,o,s)}},{key:"isOptionSelected",value:function(o,s){return pw(this.props,o,s)}},{key:"filterOption",value:function(o,s){return hw(this.props,o,s)}},{key:"formatOptionLabel",value:function(o,s){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,l=this.state.selectValue;return this.props.formatOptionLabel(o,{context:s,inputValue:i,selectValue:l})}else return this.getOptionLabel(o)}},{key:"formatGroupLabel",value:function(o){return this.props.formatGroupLabel(o)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var o=this.props,s=o.isDisabled,i=o.isSearchable,l=o.inputId,c=o.inputValue,u=o.tabIndex,d=o.form,f=o.menuIsOpen,p=o.required,y=this.getComponents(),m=y.Input,h=this.state,x=h.inputIsHidden,v=h.ariaSelection,g=this.commonProps,b=l||this.getElementId("input"),S=K(K(K({"aria-autocomplete":"list","aria-expanded":f,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":p,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},f&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?(v==null?void 0:v.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?w.createElement(m,Y({},g,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:b,innerRef:this.getInputRef,isDisabled:s,isHidden:x,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:d,type:"text",value:c},S)):w.createElement(f$,Y({id:b,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:al,onFocus:this.onInputFocus,disabled:s,tabIndex:u,inputMode:"none",form:d,value:""},S))}},{key:"renderPlaceholderOrValue",value:function(){var o=this,s=this.getComponents(),i=s.MultiValue,l=s.MultiValueContainer,c=s.MultiValueLabel,u=s.MultiValueRemove,d=s.SingleValue,f=s.Placeholder,p=this.commonProps,y=this.props,m=y.controlShouldRenderValue,h=y.isDisabled,x=y.isMulti,v=y.inputValue,g=y.placeholder,b=this.state,S=b.selectValue,_=b.focusedValue,j=b.isFocused;if(!this.hasValue()||!m)return v?null:w.createElement(f,Y({},p,{key:"placeholder",isDisabled:h,isFocused:j,innerProps:{id:this.getElementId("placeholder")}}),g);if(x)return S.map(function(E,N){var R=E===_,T="".concat(o.getOptionLabel(E),"-").concat(o.getOptionValue(E));return w.createElement(i,Y({},p,{components:{Container:l,Label:c,Remove:u},isFocused:R,isDisabled:h,key:T,index:N,removeProps:{onClick:function(){return o.removeValue(E)},onTouchEnd:function(){return o.removeValue(E)},onMouseDown:function(P){P.preventDefault()}},data:E}),o.formatOptionLabel(E,"value"))});if(v)return null;var C=S[0];return w.createElement(d,Y({},p,{data:C,isDisabled:h}),this.formatOptionLabel(C,"value"))}},{key:"renderClearIndicator",value:function(){var o=this.getComponents(),s=o.ClearIndicator,i=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!this.isClearable()||!s||c||!this.hasValue()||u)return null;var f={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return w.createElement(s,Y({},i,{innerProps:f,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var o=this.getComponents(),s=o.LoadingIndicator,i=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!s||!u)return null;var f={"aria-hidden":"true"};return w.createElement(s,Y({},i,{innerProps:f,isDisabled:c,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var o=this.getComponents(),s=o.DropdownIndicator,i=o.IndicatorSeparator;if(!s||!i)return null;var l=this.commonProps,c=this.props.isDisabled,u=this.state.isFocused;return w.createElement(i,Y({},l,{isDisabled:c,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var o=this.getComponents(),s=o.DropdownIndicator;if(!s)return null;var i=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return w.createElement(s,Y({},i,{innerProps:u,isDisabled:l,isFocused:c}))}},{key:"renderMenu",value:function(){var o=this,s=this.getComponents(),i=s.Group,l=s.GroupHeading,c=s.Menu,u=s.MenuList,d=s.MenuPortal,f=s.LoadingMessage,p=s.NoOptionsMessage,y=s.Option,m=this.commonProps,h=this.state.focusedOption,x=this.props,v=x.captureMenuScroll,g=x.inputValue,b=x.isLoading,S=x.loadingMessage,_=x.minMenuHeight,j=x.maxMenuHeight,C=x.menuIsOpen,E=x.menuPlacement,N=x.menuPosition,R=x.menuPortalTarget,T=x.menuShouldBlockScroll,k=x.menuShouldScrollIntoView,P=x.noOptionsMessage,M=x.onMenuScrollToTop,D=x.onMenuScrollToBottom;if(!C)return null;var V=function(W,Z){var ee=W.type,X=W.data,ie=W.isDisabled,ge=W.isSelected,Se=W.label,Ae=W.value,F=h===X,L=ie?void 0:function(){return o.onOptionHover(X)},te=ie?void 0:function(){return o.selectOption(X)},J="".concat(o.getElementId("option"),"-").concat(Z),re={id:J,onClick:te,onMouseMove:L,onMouseOver:L,tabIndex:-1,role:"option","aria-selected":o.isAppleDevice?void 0:ge};return w.createElement(y,Y({},m,{innerProps:re,data:X,isDisabled:ie,isSelected:ge,key:J,label:Se,type:ee,value:Ae,isFocused:F,innerRef:F?o.getFocusedOptionRef:void 0}),o.formatOptionLabel(W.data,"menu"))},Q;if(this.hasOptions())Q=this.getCategorizedOptions().map(function(B){if(B.type==="group"){var W=B.data,Z=B.options,ee=B.index,X="".concat(o.getElementId("group"),"-").concat(ee),ie="".concat(X,"-heading");return w.createElement(i,Y({},m,{key:X,data:W,options:Z,Heading:l,headingProps:{id:ie,data:B.data},label:o.formatGroupLabel(B.data)}),B.options.map(function(ge){return V(ge,"".concat(ee,"-").concat(ge.index))}))}else if(B.type==="option")return V(B,"".concat(B.index))});else if(b){var O=S({inputValue:g});if(O===null)return null;Q=w.createElement(f,m,O)}else{var U=P({inputValue:g});if(U===null)return null;Q=w.createElement(p,m,U)}var A={minMenuHeight:_,maxMenuHeight:j,menuPlacement:E,menuPosition:N,menuShouldScrollIntoView:k},H=w.createElement(qP,Y({},m,A),function(B){var W=B.ref,Z=B.placerProps,ee=Z.placement,X=Z.maxHeight;return w.createElement(c,Y({},m,A,{innerRef:W,innerProps:{onMouseDown:o.onMenuMouseDown,onMouseMove:o.onMenuMouseMove},isLoading:b,placement:ee}),w.createElement(y$,{captureEnabled:v,onTopArrive:M,onBottomArrive:D,lockEnabled:T},function(ie){return w.createElement(u,Y({},m,{innerRef:function(Se){o.getMenuListRef(Se),ie(Se)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:o.getElementId("listbox")},isLoading:b,maxHeight:X,focusedOption:h}),Q)}))});return R||N==="fixed"?w.createElement(d,Y({},m,{appendTo:R,controlElement:this.controlRef,menuPlacement:E,menuPosition:N}),H):H}},{key:"renderFormField",value:function(){var o=this,s=this.props,i=s.delimiter,l=s.isDisabled,c=s.isMulti,u=s.name,d=s.required,f=this.state.selectValue;if(d&&!this.hasValue()&&!l)return w.createElement(w$,{name:u,onFocus:this.onValueInputFocus});if(!(!u||l))if(c)if(i){var p=f.map(function(h){return o.getOptionValue(h)}).join(i);return w.createElement("input",{name:u,type:"hidden",value:p})}else{var y=f.length>0?f.map(function(h,x){return w.createElement("input",{key:"i-".concat(x),name:u,type:"hidden",value:o.getOptionValue(h)})}):w.createElement("input",{name:u,type:"hidden",value:""});return w.createElement("div",null,y)}else{var m=f[0]?this.getOptionValue(f[0]):"";return w.createElement("input",{name:u,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var o=this.commonProps,s=this.state,i=s.ariaSelection,l=s.focusedOption,c=s.focusedValue,u=s.isFocused,d=s.selectValue,f=this.getFocusableOptions();return w.createElement(i$,Y({},o,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:l,focusedValue:c,isFocused:u,selectValue:d,focusableOptions:f,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var o=this.getComponents(),s=o.Control,i=o.IndicatorsContainer,l=o.SelectContainer,c=o.ValueContainer,u=this.props,d=u.className,f=u.id,p=u.isDisabled,y=u.menuIsOpen,m=this.state.isFocused,h=this.commonProps=this.getCommonProps();return w.createElement(l,Y({},h,{className:d,innerProps:{id:f,onKeyDown:this.onKeyDown},isDisabled:p,isFocused:m}),this.renderLiveRegion(),w.createElement(s,Y({},h,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:p,isFocused:m,menuIsOpen:y}),w.createElement(c,Y({},h,{isDisabled:p}),this.renderPlaceholderOrValue(),this.renderInput()),w.createElement(i,Y({},h,{isDisabled:p}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(o,s){var i=s.prevProps,l=s.clearFocusValueOnUpdate,c=s.inputIsHiddenAfterUpdate,u=s.ariaSelection,d=s.isFocused,f=s.prevWasFocused,p=s.instancePrefix,y=o.options,m=o.value,h=o.menuIsOpen,x=o.inputValue,v=o.isMulti,g=tg(m),b={};if(i&&(m!==i.value||y!==i.options||h!==i.menuIsOpen||x!==i.inputValue)){var S=h?D$(o,g):[],_=h?gg(fa(o,g),"".concat(p,"-option")):[],j=l?F$(s,g):null,C=L$(s,S),E=Yc(_,C);b={selectValue:g,focusedOption:C,focusedOptionId:E,focusableOptionsWithIds:_,focusedValue:j,clearFocusValueOnUpdate:!1}}var N=c!=null&&o!==i?{inputIsHidden:c,inputIsHiddenAfterUpdate:void 0}:{},R=u,T=d&&f;return d&&!T&&(R={value:Vi(v,g,g[0]||null),options:g,action:"initial-input-focus"},T=!f),(u==null?void 0:u.action)==="initial-input-focus"&&(R=null),K(K(K({},b),N),{},{prevProps:o,ariaSelection:R,prevWasFocused:T})}}]),n}(w.Component);_p.defaultProps=M$;var V$=w.forwardRef(function(e,t){var n=Rb(e);return w.createElement(_p,Y({ref:t},n))}),jp=V$;function go({bg:e="dark",children:t,color:n="light",fontWeight:r="bold",icon:o="info-circle-fill",initial:s=!1,maxWidth:i="200px",padding:l="10px",placement:c,target:u,trigger:d="click",visible:f=!0}){const p=typeof s=="string"||s instanceof String,[y,m]=w.useState(p?localStorage.getItem(s)!="true":s),[h,x]=w.useState(!1);w.useEffect(()=>{setTimeout(()=>x(!0),100)},[]);const v=()=>{p&&localStorage.setItem(s,"true")},g=a.jsxs(Ll,{style:{"--bs-tooltip-bg":`var(--bs-${e})`,"--bs-tooltip-color":`var(--bs-${n})`,"--bs-tooltip-max-width":i,"--bs-tooltip-padding-x":l,"--bs-tooltip-padding-y":l,fontWeight:r},children:[a.jsx("button",{"aria-label":"Close",onClick:()=>{v(),m(!1)},style:{background:"transparent",border:"0 none transparent",float:"right"},children:a.jsx("i",{className:"bi bi-x-lg"})}),t]});return u&&u.current?a.jsx(jb,{target:u.current,placement:c,show:y&&f&&h,children:g}):a.jsx(lp,{placement:c,onToggle:b=>{v(),m(b)},overlay:g,show:y&&f&&h,trigger:d,children:a.jsx("button",{className:"btn bnt-clear border-0",style:{backgroundColor:"transparent"},children:a.jsx("i",{className:`bi bi-${o}`})})})}const B$="_items_c2dbg_1",z$="_item_c2dbg_1",q$="_details_c2dbg_14",H$="_text_c2dbg_20",W$="_number_c2dbg_35",K$="_outer_c2dbg_50",G$="_inner_c2dbg_61",xn={items:B$,item:z$,details:q$,text:H$,number:W$,outer:K$,inner:G$},os=(e,t)=>`${Math.cos(2*Math.PI*e)*t} ${Math.sin(2*Math.PI*e)*t}`;function Y$({requestId:e,grantNumber:t,creditColorClass:n="gray-300",colorClasses:r=Zu}){const{request:o}=at(e,t);if(!o)return;let s=0,i;const l=[];for(let p of o.resources)p.isBoolean||(p.isCredit?i=p:l.push(p),s+=Ju(p));const c=[],u=[];let d=-.25;const f=[...l,i].map((p,y)=>{if(!p)return null;const m=y+1,x=Ju(p)/s,v=p.requested-p.used,g=Math.max(0,v),b=p.isCredit?s/p.exchangeRates.base.unitCost:p.requested,S=b==0?0:100*g/b,j=`var(--bs-${p.isCredit?n:r[y%r.length]})`;if(x>0){const C=d,E=d+x/2,N=d+=x,R=x>.5?1:0,T=[`M ${os(C,100)}`,`A 100 100 0 ${R} 1 ${os(N,100)}`,`L ${os(N,50)}`,`A 50 50 0 ${R} 0 ${os(C,50)}`].join(" "),[k,P]=os(E,75).split(" ").map(M=>parseFloat(M));c.push(a.jsx("path",{d:T,style:{fill:j}},p.resourceId)),u.push(a.jsx("circle",{cx:k,cy:P,r:"8",fill:"black"},`${p.resourceId}-circle`),a.jsx("text",{x:k-4,y:P+4,fill:"white",className:xn.number,children:m},`${p.resourceId}-text`))}return p.isCredit&&u.push(a.jsx("foreignObject",{x:"-50",y:"-50",width:"100",height:"100",children:a.jsx("div",{className:xn.text,children:a.jsxs("div",{children:[a.jsx("strong",{children:nt(g,{abbreviate:!0})}),p.unit," available"]})})},"center-text")),a.jsxs("li",{className:xn.item,children:[a.jsx("span",{className:xn.number,children:m}),a.jsx("span",{className:`${xn.outer} ms-2 me-2`,style:{borderColor:j},children:a.jsx("span",{className:xn.inner,style:{backgroundColor:j,width:`${S}%`}})}),a.jsxs("strong",{className:xn.name,children:[a.jsx(Jn,{resource:p,userGuide:!1}),": "]}),a.jsxs("span",{className:xn.details,children:[nt(v,{abbreviate:!0})," ",p.isCredit?null:a.jsxs(a.Fragment,{children:["of ",nt(b,{abbreviate:!0})," "]}),p.unit," ",p.isCredit?"available":"remaining"," (",Math.round(S),"%)"]})]},p.resourceId)});return a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-lg-3 mb-3 d-flex flex-row align-items-center justify-content-center",children:a.jsxs("svg",{version:"1.1",viewBox:"-100 -100 200 200",width:"200",height:"200",xmlns:"http://www.w3.org/2000/svg",children:[c,u]})}),a.jsx("div",{className:"col-lg-9 mb-3 d-flex flex-column justify-content-center",children:a.jsx("ul",{className:xn.items,children:f})})]})}const yg=e=>e;function Q$({classes:e,clean:t=yg,format:n=yg,label:r,setValue:o,style:s,value:i}){const l=n(i),[c,u]=w.useState(l);return w.useEffect(()=>{u(l)},[l]),a.jsx("input",{type:"text","aria-label":r,className:`form-control ${e}`,value:c,style:s,onChange:d=>u(d.target.value),onBlur:d=>{const f=t(d.target.value);u(n(f)),o(f)},onKeyDown:d=>{d.code=="Enter"&&(d.preventDefault(),d.target.blur())}})}function X$({requestId:e,grantNumber:t}){const{request:n,addResource:r,openUsageDetailModal:o,resetResources:s,setResourceRequest:i,setResourcesReason:l,statuses:c,toggleActionsModal:u,toggleConfirmModal:d,toggleResourcesModal:f}=at(e,t),{project:p}=Rt(t||n&&n.grantNumber),y=w.useRef(null),m=w.useRef(null);if(!n||!p)return;const h="Exchange"in n.allowedActions,x="Renewal"in n.allowedActions,v="Supplement"in n.allowedActions,g=n.exchangeStatus==c.pending,b=n.exchangeStatus==c.success,S=n.exchangeStatus==c.error,_=n.exchangeErrors,j=n.exchangeActionId!==null,C=n.exchangeActionEditable,E=n.resources,N=n.resourcesReason,R={};for(let F of E)R[F.resourceId]=F;const T=()=>{px(n)>=.75?u():d()},k=[];for(let F of E){let L=[];if(F.requested>0){for(let te of F.requires||[]){let J=R[te];if(J){if(J.requested>0){L=[];break}L.push(J)}}L.length&&k.push(a.jsxs("span",{children:[a.jsx(Jn,{resource:F,userGuide:!1})," requires"," ",fx(L.map(te=>a.jsx(Jn,{resource:te,userGuide:!1},te.resourceId)),"or"),"."]},F.resourceId))}}const P=k.length>0;let M;b?M=a.jsx(be,{color:"info",children:"Your exchange request has been submitted."}):S&&_.length>0&&_[0].includes("PI")&&_[0].includes("person status Unknown")?M=a.jsx(be,{color:"danger",children:p.currentUser.role==="pi"?a.jsxs(a.Fragment,{children:["Please"," ",a.jsx("a",{href:ne.routes.profile_path(),children:"update your academic status"})," ","before making an exchange request."]}):a.jsxs(a.Fragment,{children:["The primary investigator for this project has an unknown academic status. Please ask"," ",p.users.filter(F=>F.role==="pi").map(F=>`${F.firstName} ${F.lastName}`)," ","to update the academic status in their profile, and then try again."]})}):S?M=a.jsxs(be,{color:"danger",children:["Sorry, something went wrong: ",_.join(", "),". For assistance, please"," ",a.jsx("a",{href:"https://support.access-ci.org/open-a-ticket",children:"open a help ticket"})," ","and include this message."]}):j?M=a.jsx(be,{color:"warning",children:"You have an exchange request under review. The information below reflects the pending exchange request."}):n.timeStatus=="current"&&!p.isManager?M=a.jsxs(be,{color:"warning",children:["You do not have permission to manage resources for this project. Please contact ",Mf(p)," to request a change."]}):P&&(M=a.jsxs(be,{color:"warning",children:[k," Please adjust your balance values."]}));const D=N.length>0;let V=!1,Q=!1;for(let F of E)if(F.isNew&&(V=!0),F.allocated!=F.requested&&(Q=!0),V&&Q)break;const O=E.map(F=>F.resourceId),U={},A={},H=[];if(h&&C){n.allowedActions.Exchange.resources.filter(F=>!O.includes(F.resourceId)).map(F=>{U[F.resourceId]=F;const L=`${F.type} Resources (${F.unit})`;A[L]=A[L]||[],A[L].push(F)});for(const[F,L]of Object.entries(A))H.push({label:F,options:L.sort((te,J)=>te.exchangeRates.current.unitCost<J.exchangeRates.current.unitCost||te.exchangeRates.current.unitCost==J.exchangeRates.current.unitCost&&te.name<J.name?-1:1).map(te=>{const J=Ol(te.name),re=J.short?`${J.short} (${J.full.replace(/ \([^(]+\)/,"")})`:J.full;return{value:te.resourceId,label:re}})}),H.sort((te,J)=>te.label<J.label?-1:1)}const B=h?n.allowedActions.Exchange.resources.map(F=>F.resourceId):[];let W;const Z=[],ee=[];for(let F of E)F.isCredit?W=F:(Z.push(F),ee.push(C&&(F.isNew||F.allocated!=F.requested)?Cr.edited:B.includes(F.resourceId)?"":Cr.disabled));const X=`Add ${Z.length?"another":"a"} resource to your exchange...`,ie=F=>F.requested-F.used,ge=(F,L)=>{const te=L.allocated-L.used,J=po(Number(F.replace(/[^0-9-.]/g,"")),L.decimalPlaces),re=Math.min(0,te);if(J<re)return re;let lt=W.requested*W.exchangeRates.base.unitCost;const Pt=(L.allocated-L.requested)*L.exchangeRates.base.unitCost,It=Math.min(lt,Pt);lt-=It;let ct=L.requested-L.used+It/L.exchangeRates.base.unitCost;return lt>0&&(ct+=lt/L.exchangeRates.current.unitCost),J>ct?po(ct,L.decimalPlaces,"floor"):J},Se=F=>F.isBoolean?a.jsx(a.Fragment,{children:"—"}):a.jsxs(a.Fragment,{children:[kn(ne.resourceTypeIcons[W.icon]),a.jsx("span",{className:"ms-2",children:CC(F.unit,F.exchangeRates.current.unitCost,W.name)})]}),Ae=[{key:"name",name:"Resource",format:(F,L)=>a.jsxs(a.Fragment,{children:[a.jsx(Jn,{resource:L}),(p.currentUser.resourceIds.includes(L.resourceId)||p.currentUser.resourceAccountInactiveIds.includes(L.resourceId))&&a.jsx(tl,{icon:"table",onClick:()=>o(L.resourceRepositoryKey),target:"_blank",title:`${L.name} Usage Details`})," ",a.jsx(Oo,{status:L.isActive?"Active":L.isNew?"New":"Inactive"})]}),width:Math.min(350,window.innerWidth*.3)},{key:"unit",name:"Unit Cost",width:300,format:(F,L)=>Se(L)}];return h&&Ae.push({key:"requested",name:"Balance",class:"text-end",rowClass:F=>C&&B.includes(F.resourceId)?Cr.input:"",format:(F,L)=>{const te=C&&B.includes(L.resourceId);return L.isBoolean?a.jsxs("span",{className:"d-flex",children:[a.jsx("span",{className:"w-100",children:a.jsx("input",{className:"form-check-input",type:"checkbox",checked:F==1,disabled:!te,onChange:J=>i(L.resourceId,J.target.checked?1:0)})}),a.jsx("span",{className:"text-start ps-2",style:{width:"8rem"},children:"Requested"})]}):a.jsxs("span",{className:"d-flex",children:[te?a.jsx(Q$,{classes:"text-end w-100",clean:J=>ge(J,L),format:nt,label:`Balance for ${L.name}`,setValue:J=>{i(L.resourceId,J+L.used)},style:{padding:"0.1rem 0.5rem"},value:ie(L)}):a.jsx("span",{children:nt(ie(L))}),a.jsx("span",{className:"text-start ps-2",style:{width:"8rem"},children:L.unit})]})},formatHeader:F=>a.jsxs(a.Fragment,{children:[F,C?a.jsx(go,{bg:"secondary",color:"dark",initial:"myprojects.requestedAllocation",placement:"top-end",visible:p.tab=="resources",children:"You can increase or decrease the balance below to change your allocation on a resource. Enter the total amount you would like to have available once the exchange is complete."}):null]})},{key:"change",name:"Credit Change",format:(F,L)=>{const J=-1*(L.requested-L.allocated)*L.exchangeRates.current.unitCost;return J!==0?a.jsxs("span",{className:`badge bg-${J>0?"primary":"danger"} rounded-pill`,children:[J>0?"+":"",nt(J,W)," ",W.unit]}):a.jsx(a.Fragment,{children:"—"})}}),a.jsxs("div",{className:"resources",children:[M,E.length?a.jsx(Y$,{requestId:e}):null,W&&(h||x||v)?a.jsxs("h2",{className:"mb-1 mt-2 d-flex justify-content-between",children:[a.jsxs("span",{children:[kn(ne.resourceTypeIcons.credit)," ",nt(W.requested,W)," ",W.unit," available to exchange"]}),x||v?a.jsxs("button",{type:"button",className:"btn btn-sm btn-primary ms-2",onClick:T,children:[kn(ne.resourceTypeIcons.credit)," Request More"," ",n.usesCredits?"Credits":"Units"]}):null]}):null,Z.length?a.jsx(Un,{columns:Ae,rows:Z,rowClasses:ee,classes:H.length?"mb-0":"",frozenColumns:2,minWidth:"800px"}):a.jsx("div",{className:"card p-2 text-bg-light p-3",children:"This project does not have any resources."}),H.length?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"p-2",style:{backgroundColor:"var(--teal-200)",border:"1px solid #cccccc",marginTop:"-1px"},ref:y,children:a.jsx(jp,{classNames:{control:()=>"react-select mb-1"},options:H,onChange:F=>r(F.value),placeholder:X,value:null,"aria-label":X,formatOptionLabel:({value:F,label:L})=>{const te=U[F];return a.jsxs("span",{className:"d-flex justify-content-between",children:[a.jsx("span",{children:a.jsx(Jn,{resource:te,userGuide:!1},L)}),a.jsx("span",{children:Se(te)})]})}})}),Z.length?null:a.jsx(go,{bg:"secondary",color:"dark",visible:p.tab=="resources",initial:!0,target:y,children:"Ready to get started? Search for a resource to add it to your project."}),a.jsxs("p",{className:"text-black-50",style:{fontSize:"0.9rem"},children:["Need help choosing a resource? Visit our"," ",a.jsx("a",{href:ne.routes.resources_path(),children:"Resource Catalog"}),"."]})]}):null,h&&C?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{htmlFor:"resources-reason",className:"form-label required",children:"Please briefly explain how the requested resources and amounts will contribute to your research."}),a.jsx("textarea",{className:"form-control",id:"resources-reason",rows:"2",value:N,onChange:F=>l(F.target.value),style:{minHeight:"3rem"}})]}),a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",disabled:g||!Q&&!D&&!V,onClick:s,children:"Reset Form"}),a.jsx("button",{ref:m,type:"button",className:"btn btn-secondary",disabled:g||!Q||!D||P,onClick:f,children:g?"Submitting...":"Submit for Approval"})]}),Q&&!P?a.jsx(go,{bg:"secondary",color:"dark",initial:"myprojects.submitExchange",maxWidth:"390px",placement:"right",target:m,visible:p.tab=="resources",children:"When you are finished adding resources, enter a justification for the requested resources above. Then you can submit your exchange for approval."}):null]}):null]})}function Z$({question:e,requestId:t,grantNumber:n}){const{request:r,setResourceQuestionValues:o}=at(t,n),s=w.useId();if(!e||!r||r.error)return;const{attributeSetId:i,attributes:l,fieldType:c,label:u,resourceId:d,values:f}=e,p=l[0],y=p.required?"required":"",m=b=>o(d,i,b.target.value?[b.target.value]:[]),h=b=>{o(d,i,Array.from(b.target.options).filter(({selected:S})=>S).map(({value:S})=>parseInt(S,10)))},x=b=>{const S=parseInt(b.target.value,10),_=b.target.checked?[...f,S]:f.filter(j=>j!=S);o(d,i,_)},v=b=>{const S=parseInt(b.target.value);o(d,i,isNaN(S)?[]:[S])};let g;if(["calendar","integer_only","text"].includes(c)){const b={calendar:"date",integer_only:"number",text:"text"}[c];g=a.jsx("input",{className:"form-control",id:s,type:b,placeholder:p.label,required:p.required,value:f[0]||"",onChange:c=="integer_only"?v:m})}else if(c=="textarea")g=a.jsx("textarea",{className:"form-control",id:s,placeholder:p.label,required:p.required,value:f[0]||"",onChange:m});else if(c=="drop_down"||l.length>=10){const b=c=="multi_sel";g=a.jsxs("select",{id:s,className:"form-select",required:p.required,multiple:b,onChange:b?h:v,value:b?f:f[0]||"",children:[b?null:a.jsx("option",{}),l.map(S=>a.jsx("option",{value:S.resourceAttributeId,children:S.label},S.resourceAttributeId))]})}else g=a.jsx("div",{id:s,children:l.map(b=>{const S=`resource-attribute-${b.resourceAttributeId}`;return a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:c=="single_sel"?"radio":"checkbox",id:S,value:b.resourceAttributeId,checked:f.includes(b.resourceAttributeId),onChange:c=="single_sel"?v:x}),a.jsx("label",{className:"form-check-label",htmlFor:S,children:b.label})]},b.resourceAttributeId)})});return a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{htmlFor:s,className:`form-label ${y}`,children:u}),g]})}function J$({requestId:e,grantNumber:t}){const{request:n,saveResources:r,toggleResourcesModal:o}=at(e,t),{project:s}=Rt(t||n.grantNumber);if(!n||!s||n.error||s.error)return;const i=[],l=n.resources.filter(u=>u.allocated!=u.requested).map(u=>{const d=u.requested-u.allocated;return u.questions&&i.push(...u.questions),a.jsxs("li",{className:"list-group-item d-flex justify-content-between align-items-center mb-0",children:[u.name,a.jsx("span",{className:`badge bg-${d>0?"primary":"danger"} rounded-pill`,children:u.isBoolean?Af(u.requested):a.jsxs(a.Fragment,{children:[d>0?"+":"",nt(d,u)," ",u.unit]})})]},u.resourceId)}),c=i.some(({attributes:u,values:d})=>d.length==0&&u[0].required);return a.jsxs(ve,{size:"lg",show:n.showResourcesModal,onHide:o,scrollable:!0,children:[a.jsx(ve.Header,{closeButton:!0,children:a.jsx(ve.Title,{children:"Complete Your Exchange"})}),a.jsxs(ve.Body,{children:[a.jsx("p",{children:"Please review your exchange to make sure it includes all the resources you need. Once you submit it, you will not be able to request another exchange until this one has been processed by the resource providers."}),a.jsx("ul",{className:"list-group mb-3",children:l}),i.length?a.jsxs(a.Fragment,{children:[a.jsx("h2",{children:"Resource Questions"}),a.jsx("p",{children:"Some of the resources you selected have associated questions. Please answer the questions below."}),i.map(u=>a.jsx(Z$,{question:u,requestId:e,grantNumber:t},u.attributeSetId))]}):null]}),a.jsx(ve.Footer,{children:a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-primary me-2",onClick:o,children:"Continue Editing"}),a.jsx("button",{type:"button",className:"btn btn-secondary",onClick:r,disabled:c,children:"Submit"})]})})]})}function gw({user:e}){const t=`${e.lastName}, ${e.firstName}`;let n=t,r=[e.organization,e.email].filter(o=>o).join(", ");return r&&(n+=`: ${r}`),a.jsx("abbr",{title:n,children:t})}function eA({requestId:e,grantNumber:t}){const{project:n}=Rt(t),{request:r,closeUsageDetailModal:o}=at(e,t);if(!r||r.error||!n||n.error||!r.usageDetailStatus)return;let s,i="Usage";if(r.usageDetailStatus==Le.pending)s=a.jsx(Do,{});else if(r.usageDetailStatus==Le.error)s=a.jsx(be,{color:"danger",children:"An error occurred while loading usage data."});else{const{projectTitle:l,resourceDisplayName:c,resourceRepositoryKey:u,users:d}=r.usageDetail,{full:f,short:p}=Ol(c),y=r.resources.find(v=>v.resourceRepositoryKey==u),m=v=>nt(v,{decimalPlaces:y?y.decimalPlaces:void 0}),h={};for(let v of n.users)h[v.username]=v;i=a.jsxs(a.Fragment,{children:["Usage: ",p||f," for ",l]});const x=[{key:"name",name:"Name",format:(v,{lastName:g,firstName:b,portalUsername:S})=>{const _=h[S];return _?a.jsx(gw,{user:_}):`${g}, ${b}`}},{key:"portalUsername",name:"Resource Username",format:v=>{const g=h[v],b=g?g.resourceUsernames[y.resourceId]:null;return b||a.jsx(a.Fragment,{children:"—"})}},{key:"role",name:"Role",format:v=>hx[v].name},{key:"lastWeek",name:"Last Week",class:"text-end",format:m},{key:"lastMonth",name:"Last Month",class:"text-end",format:m},{key:"lastQuarter",name:"Last 3 Months",class:"text-end",format:m},{key:"currentRequest",name:"Current Allocation",class:"text-end",format:m},{key:"total",name:"All Time",class:"text-end",format:m}];s=d.length?a.jsx(Un,{rows:d,columns:x}):a.jsx(be,{color:"info",children:"There is no usage for this resource."})}return a.jsxs(ve,{show:!0,size:"lg",onHide:o,scrollable:!0,children:[a.jsx(ve.Header,{closeButton:!0,children:a.jsx(ve.Title,{children:i})}),a.jsx(ve.Body,{children:s})]})}var tA=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];function nA(e){var t=e.defaultOptions,n=t===void 0?!1:t,r=e.cacheOptions,o=r===void 0?!1:r,s=e.loadOptions;e.options;var i=e.isLoading,l=i===void 0?!1:i,c=e.onInputChange,u=e.filterOption,d=u===void 0?null:u,f=gn(e,tA),p=f.inputValue,y=w.useRef(void 0),m=w.useRef(!1),h=w.useState(Array.isArray(n)?n:void 0),x=Ue(h,2),v=x[0],g=x[1],b=w.useState(typeof p<"u"?p:""),S=Ue(b,2),_=S[0],j=S[1],C=w.useState(n===!0),E=Ue(C,2),N=E[0],R=E[1],T=w.useState(void 0),k=Ue(T,2),P=k[0],M=k[1],D=w.useState([]),V=Ue(D,2),Q=V[0],O=V[1],U=w.useState(!1),A=Ue(U,2),H=A[0],B=A[1],W=w.useState({}),Z=Ue(W,2),ee=Z[0],X=Z[1],ie=w.useState(void 0),ge=Ue(ie,2),Se=ge[0],Ae=ge[1],F=w.useState(void 0),L=Ue(F,2),te=L[0],J=L[1];o!==te&&(X({}),J(o)),n!==Se&&(g(Array.isArray(n)?n:void 0),Ae(n)),w.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var re=w.useCallback(function(It,ct){if(!s)return ct();var Ce=s(It,ct);Ce&&typeof Ce.then=="function"&&Ce.then(ct,function(){return ct()})},[s]);w.useEffect(function(){n===!0&&re(_,function(It){m.current&&(g(It||[]),R(!!y.current))})},[]);var lt=w.useCallback(function(It,ct){var Ce=NP(It,ct,c);if(!Ce){y.current=void 0,j(""),M(""),O([]),R(!1),B(!1);return}if(o&&ee[Ce])j(Ce),M(Ce),O(ee[Ce]),R(!1),B(!1);else{var Bn=y.current={};j(Ce),R(!0),B(!P),re(Ce,function(zn){m&&Bn===y.current&&(y.current=void 0,R(!1),M(Ce),O(zn||[]),B(!1),X(zn?K(K({},ee),{},so({},Ce,zn)):ee))})}},[o,re,P,ee,c]),Pt=H?[]:_&&P?Q:v||[];return K(K({},f),{},{options:Pt,isLoading:N||l,onInputChange:lt,filterOption:d})}var rA=w.forwardRef(function(e,t){var n=nA(e),r=Rb(n);return w.createElement(_p,Y({ref:t},r))}),oA=rA;const xg=({description:e,disabled:t=!1,onChange:n,selectedLength:r,totalLength:o})=>{const s=w.useRef(),i=w.useId();let l=r==o,c=r>0&&!l;return w.useEffect(()=>{s.current&&(s.current.checked=l,s.current.indeterminate=c)},[l,c]),a.jsxs(a.Fragment,{children:[a.jsx("input",{className:"custom-checkbox form-check-input",disabled:t,id:i,onChange:u=>n(u.target.checked),ref:s,type:"checkbox"}),a.jsx("label",{className:"form-check-label",htmlFor:i,"aria-description":`${l?"Deselect":"Select"} ${e}`})]})};function sA({grantNumber:e,requestId:t}){const{project:n,addUser:r,resetUsers:o,saveUsers:s,setTab:i,setUserRole:l,statuses:c,toggleUsersResources:u}=Rt(e),{request:d}=n?at(t||n.currentRequestId,e):{request:null};if(!n||!n.currentRequestId||!d||n.error||d.error)return;const f=n.isManager,p="Exchange"in d.allowedActions,y=n.usersStatus==c.pending,m=n.usersStatus==c.success,h=n.usersStatus==c.error,x=n.users,v=d.resources.filter(od),g=v.length==0,b=x.find(R=>R.hasChanges)!==void 0,S=x.find(R=>R.role!="pi")!==void 0;let _;m&&!b?_=a.jsx(be,{color:"info",children:"Your changes have been saved. Creation of user accounts can take some time. Users can check the status of their accounts on the Overview tab of the My Projects page."}):h?_=a.jsx(be,{color:"danger",children:"Sorry, your changes could not be saved. Please try again later."}):f?v.length?g&&(_=a.jsx(be,{color:"warning",children:"This project does not have any active resources."})):_=a.jsxs(be,{color:"warning",children:["This project does not have any resources."," ",p?a.jsx("a",{href:ne.routes.request_action_path(d.requestId,"new?action_type=Exchange"),onClick:R=>{R.preventDefault(),i("resources")},children:"Exchange credits for resources."}):null," ","Additional users can be added after an exchange is approved."]}):_=a.jsxs(be,{color:"warning",children:["You do not have permission to manage users for this project. Please contact ",Mf(n)," to request a change."]});const j=(R,T)=>{let k,P,M,D;if(T.key=="all"){k="all resources for all users",P=V=>u(V),M=0;for(let V of x)M+=V.resourceIds.length;D=x.length*v.length}else k=`all users for ${T.name}`,P=V=>u(V,null,T.key),M=x.filter(({resourceIds:V})=>V.includes(T.key)).length,D=x.length;return a.jsxs(a.Fragment,{children:[T.key=="all"?R:a.jsx(Jn,{resource:T,userGuide:!1}),a.jsx("br",{}),a.jsx(xg,{description:k,disabled:T.disabled,onChange:P,selectedLength:M,totalLength:D})]})},C=Pl.map(({role:R,name:T})=>a.jsx("option",{value:R,children:T},R)),E=[{key:"name",name:"Name",width:200,format:(R,T)=>a.jsx(gw,{user:T})},{key:"username",name:"ACCESS Username",width:100},{key:"role",name:"Role",width:100,format:(R,T)=>a.jsx("select",{className:"form-select",value:R,onChange:k=>l(T.username,k.target.value),disabled:!f||R=="pi"||R=="co_pi",style:{position:"absolute",left:0,top:0,bottom:0,right:0,borderWidth:0},children:C.filter(k=>k.key==R||!["pi","co_pi"].includes(k.key))})}];v.length&&E.push({key:"all",name:"All Resources",class:`text-center ${Cr.important}`,disabled:!f||g,width:100,format:(R,T)=>a.jsx(xg,{description:`all users for ${T.name}`,disabled:!f||g,onChange:k=>u(k,T.username),selectedLength:T.resourceIds.length,totalLength:v.length}),formatHeader:j});for(let R of v)E.push({key:R.resourceId,name:R.name,class:"text-center",disabled:!f||!R.isActive,icon:R.icon,format:(T,k)=>a.jsx(a.Fragment,{children:a.jsx("input",{className:"form-check-input",disabled:!f||!R.isActive,onChange:P=>u(P.target.checked,k.username,R.resourceId),type:"checkbox",checked:k.resourceIds.includes(R.resourceId)})}),formatHeader:j});const N=x.map(R=>R.hasChanges?Cr.edited:"");return a.jsxs(a.Fragment,{children:[_,a.jsx(Un,{rows:x,columns:E,frozenColumns:v.length?4:3,classes:"mb-0",minWidth:"800px",rowClasses:N,scrollRowIndex:n.usersNewRowIndex}),f&&v.length&&!g?a.jsx("div",{style:{marginTop:"-1px",position:"relative",zIndex:100},children:a.jsx(oA,{classNames:{control:()=>"react-select"},loadOptions:async R=>(await PE(R)).map(k=>({isDisabled:k.eligibility==="no",label:a.jsxs("span",{className:"d-flex justify-content-between",children:[a.jsxs("span",{className:k.eligibility==="no"?"text-decoration-line-through":"",style:{color:k.eligibility==="no"?"#707070":void 0},children:[k.username," (",k.firstName," ",k.lastName,","," ",k.organization,k.email?`, ${k.email}`:""]}),k.eligibility==="no"&&k.eligibilityReason&&a.jsxs("span",{className:"text-danger ms-2",children:[a.jsx("i",{className:"bi bi-exclamation-octagon"})," ",k.eligibilityReason]})]}),value:k})),onChange:R=>r(R.value),placeholder:"Add another user...",value:null,"aria-label":"Add another user"})}):null,f&&(v.length&&!g||S)?a.jsxs("div",{className:"d-flex mt-3",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",disabled:y||!b,onClick:o,children:"Reset Form"}),a.jsx("button",{type:"button",className:"btn btn-secondary",disabled:y||!b,onClick:s,children:y?"Saving...":"Save Changes"})]}):null]})}function iA({requestId:e,grantNumber:t}){const{request:n}=at(e,t),{project:r,setRequest:o,setTab:s}=Rt(t||n.grantNumber);if(!n)return;if(n.error)return a.jsx(be,{color:"danger",children:n.error});const i=n.timeStatus||n.actions[0].status.toLowerCase(),l=n.actions.find(({showDeleteModal:d})=>d),c=[];n.resources.length||c.push("resources"),e!=r.currentRequestId&&c.push("users");const u=(r.users||[]).filter(d=>d.eligibility==="no"&&d.role!=="user");return a.jsxs("div",{className:"request",children:[n.returnedForCorrections?a.jsxs(be,{color:"warning",children:[a.jsx("p",{children:"Your request has been returned for corrections. These are the notes from the Allocations Team"}),a.jsx("div",{className:iR.returnedForCorrectionsNotes,children:n.returnedForCorrectionsNotes}),a.jsx("p",{className:"mt-3",children:"Please address these issues by clicking the Edit button to edit your request."})]}):"",n.timeStatus!="current"&&!n.returnedForCorrections?a.jsxs(be,{color:"warning",children:["You are viewing ","aeiou".includes(i[0])?"an":"a"," ",i," request."," ",c.length?`You cannot manage ${c.join(" or ")} for this request.`:""," ",r.currentRequestId?a.jsx("a",{href:ne.routes.request_path(r.currentRequestId),onClick:d=>{d.preventDefault(),o(r.currentRequestId)},children:"Go to the current request."}):null]}):null,r.isManager&&u.length>0&&a.jsxs(be,{color:"danger",children:["Some project personnel need to update their profiles. You will be unable to submit exchanges, renewals, and other actions until these issues are resolved:",a.jsx("br",{}),a.jsx("ul",{className:"fs-6 mb-0",children:u.map(d=>a.jsxs("li",{children:[a.jsxs("strong",{children:[d.firstName," ",d.lastName," (",d.username,"):"]})," ",d.eligibilityReason]},d.username))})]}),a.jsxs(gN,{activeKey:r.tab,onSelect:s,className:"mt-3 mb-3",children:[a.jsx(Ii,{eventKey:"overview",title:"Overview",className:"mb-0",children:a.jsx(YT,{requestId:e,grantNumber:t})}),a.jsx(Ii,{eventKey:"resources",title:n.usesCredits?"Credits + Resources":"Resources",disabled:c.includes("resources"),children:a.jsx(X$,{requestId:e})}),a.jsx(Ii,{eventKey:"users",title:"Users + Roles",disabled:c.includes("users"),children:a.jsx(sA,{grantNumber:t})}),a.jsx(Ii,{eventKey:"history",title:"History",children:a.jsx(jT,{requestId:e})})]}),a.jsx(bT,{grantNumber:t,requestId:e}),a.jsx(wT,{grantNumber:t,requestId:e}),a.jsx(ST,{grantNumber:t,requestId:e,actionId:l?l.actionId:null}),a.jsx(J$,{grantNumber:t,requestId:e}),a.jsx(eA,{grantNumber:t,requestId:e})]})}function aA({requestId:e,grantNumber:t}){const{request:n,toggleActionsModal:r,toggleDeleteModal:o}=at(e,t);if(!n)return;const{actions:s,allowedActions:i}=n,l=[];i&&(("Extension"in i||"Renewal"in i)&&l.push(["Extend End Date",u=>{u.preventDefault(),r()},"calendar-plus"]),"Final Report"in i&&l.push(["Submit Final Report",`${ne.routes.request_action_path(e,"new")}?action_type=Final+Report`,"file-earmark-check"]));const c=s.find(u=>u.isRequest);if(c){const u=c.allowedOperations||[];u.includes("Edit")&&l.push(["Edit",ne.routes.edit_request_path(n.requestId),"pencil"]),u.includes("Delete")&&l.push(["Delete",d=>{d.preventDefault(),o(c.actionId)},"trash","danger"])}return l.map(([u,d,f,p])=>{const y=a.jsxs(a.Fragment,{children:[" ",f&&a.jsx("i",{className:`bi bi-${f} me-1`}),u]});return typeof d=="function"?a.jsx("button",{className:`btn btn-${p||"primary"} ms-2 text-nowrap`,onClick:d,children:y},u):a.jsx("a",{className:`btn btn-${p||"primary"} ms-2 text-nowrap`,href:d,children:y},u)})}function lA({open:e=!1,grantNumber:t,title:n,status:r}){const[o,s]=w.useState(e),{project:i,setRequest:l}=Rt(t,!o&&n&&r&&!0),c=`project-${t}`;let u=null;if(o&&i)if(i.error)u=a.jsx(be,{color:"danger",children:i.error});else{let d;const f=i.requestsList.map(p=>(p.requestId==i.selectedRequestId&&(d=p),a.jsx("option",{value:p.requestId,children:$f(p)},p.requestId)));u=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"d-flex",children:[a.jsx("select",{className:"form-select","aria-label":"Select a request to display",onChange:p=>l(parseInt(p.target.value,10)),value:i.selectedRequestId,disabled:f.length<2,children:f}),a.jsx(aA,{requestId:i.selectedRequestId,grantNumber:t})]}),d?a.jsx(iA,{...d,grantNumber:t}):null]})}return a.jsxs("div",{className:`${vm.project} card mb-3`,children:[a.jsxs("div",{className:`card-header d-flex justify-content-between ${o?"":"border-bottom-0"}`,children:[a.jsx("button",{"aria-expanded":o,"aria-controls":c,className:vm.expand,onClick:()=>s(!o),children:a.jsxs("h2",{className:"mb-1 mt-1 text-start",children:[a.jsx("i",{className:`bi bi-caret-${o?"down":"right"}-fill`})," ",/^[A-Z]/.test(t)?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"grant-number",children:[t,":"]})," "]}):null,n||i.title]})}),a.jsx(Oo,{status:r||i.status})]}),a.jsx("div",{className:"card-body",id:c,hidden:!o||!i,children:u})]})}function cA({username:e,openFirst:t=1}){const{error:n,loading:r,projects:o}=nR(e);if(r)return a.jsx(Do,{});if(n)return a.jsxs(be,{color:"danger",children:[n," ",a.jsx("a",{href:"#",onClick:i=>{i.preventDefault(),window.location.reload()},children:"Reload the page"})," ","to try again."]});if(!o.length)return a.jsxs("div",{className:"pt-5 pb-5 text-bg-light border border-light-subtle",children:[a.jsx("p",{className:"fs-2 text-center mb-4",children:"You don't have any projects yet."}),a.jsxs("div",{className:"d-flex gap-2 justify-content-center",children:[a.jsxs("a",{className:"btn btn-primary w-25",href:ne.routes.project_types_path(),children:[a.jsx("i",{className:"bi bi-boxes fs-1 d-block"})," Learn about Project Types"]}),a.jsxs("a",{className:"btn btn-secondary w-25",href:ne.routes.get_your_first_project_path(),children:[a.jsx("i",{className:"bi bi-cpu fs-1 d-block"})," Learn How to Get Your"," ",a.jsx("br",{className:"d-none d-xxl-inline"})," First Project"]}),a.jsxs("a",{className:"btn btn-primary w-25",href:ne.routes.how_to_path(),children:[a.jsx("i",{className:"bi bi-person-plus fs-1 d-block"})," Learn How to Join an Existing Project"]})]})]});const s=new URLSearchParams(window.location.hash.slice(1)).get("grantNumber");return o.map((i,l)=>a.jsx(lA,{open:s?s==i.grantNumber:l<t,...i},i.grantNumber))}const vw={apiUrl:null,listIsFiltered:!1,pages:1,projects:[],projectsLoaded:!1,filtersLoaded:!0,showPagination:!1,singleEntry:!1,filters:{org:"",allocationType:"",allFosToggled:!0,resource:"",requestNumber:""},pageData:{current_page:1,last_page:1},typeLists:{orgs:[],fosTypes:[],allocationTypes:[],resources:[]}},uA=Ye("projectsBrowser/initApp",async(e,{getState:t,dispatch:n})=>{const r=window.location.search,o=new URLSearchParams(r);o.has("_requestNumber")&&(n(Cd({name:"requestNumber",value:o.get("_requestNumber")})),n(xw(!0))),await n(_d()),await n(Rr()),n(dA())}),dA=Ye("projectsBrowser/filterCleanup",async(e,{getState:t,dispatch:n})=>{const o=t().projectsBrowser.typeLists;n(yw({...o,orgs:["-- ALL --"].concat(o.orgs)}))}),_d=Ye("projectsBrowser/getFilters",async(e,{getState:t,dispatch:n})=>{const o=`${t().projectsBrowser.apiUrl}?filters=1`,i=await(await fetch(o)).json();n(yw(i.filters))}),Rr=Ye("projectsBrowser/getProjects",async(e,{getState:t,dispatch:n})=>{const r=t().projectsBrowser,o=r.filters,s=r.typeLists,i=s.fosTypes.filter(d=>d.checked);let l=`${r.apiUrl}?page=${r.pageData.current_page}`;return o.requestNumber!=""?(l+=`&request_number=${o.requestNumber}`,n(bg(!0))):(n(bg(!1)),i.length!=s.fosTypes.length&&(l+=`&fos=${i.map(d=>d.fosTypeId).join(",")}`),o.org!=""&&o.org!="-- ALL --"&&(l+=`&org=${encodeURIComponent(o.org)}`),o.allocationType!=""&&(l+=`&allocation_type=${o.allocationType}`),o.resource!=""&&(l+=`&resources=${o.resource}`)),await(await fetch(l)).json()}),Cp=ri({name:"projectsBrowser",initialState:vw,reducers:{resetFilters:e=>{e.filters={org:"",allocationType:"",allFosToggled:!1,resource:"",requestNumber:""},e.singleEntry=!1,Cp.caseReducers.toggleAllFos(e)},setApiUrl:(e,{payload:t})=>{e.apiUrl=t},setShowPagination:(e,{payload:t})=>{e.showPagination=t},setTypeLists:(e,{payload:t})=>{e.typeLists=t},toggleAllFos:e=>{e.typeLists.fosTypes.forEach(t=>t.checked=!e.filters.allFosToggled),e.filters.allFosToggled=!e.filters.allFosToggled},toggleFos:(e,{payload:t})=>{e.typeLists.fosTypes.forEach(n=>{n.fosTypeId==t.fosTypeId&&(n.checked=!n.checked)}),e.typeLists.fosTypes.filter(n=>n.checked).length!=e.typeLists.fosTypes.length?e.filters.allFosToggled=!1:e.filters.allFosToggled=!0},toggleListFiltered:(e,{payload:t})=>{e.listIsFiltered=t},toggleSingleEntry:(e,{payload:t})=>{e.singleEntry=t},updateFilter:(e,{payload:t})=>{e.filters[t.name]=t.value},updatePageData:(e,{payload:t})=>{t.current_page&&(e.pageData.current_page=t.current_page),t.last_page&&(e.pageData.last_page=t.last_page)}},extraReducers:e=>{e.addCase(Rr.pending,t=>{t.projectsLoaded=!1}).addCase(Rr.fulfilled,(t,n)=>{const r=n.payload;t.projectsLoaded=!0,t.projects=r.projects,r.pages!=t.pageData.last_page&&(t.pageData.current_page=1),t.showPagination=!0,t.pageData.last_page=r.pages}).addCase(Rr.rejected,(t,n)=>{console.log(n.error)}).addCase(_d.pending,t=>{t.filtersLoaded=!1}).addCase(_d.fulfilled,t=>{t.filtersLoaded=!0})}}),{resetFilters:fA,setApiUrl:fD,setShowPagination:jd,setTypeLists:yw,toggleAllFos:pA,toggleFos:hA,toggleListFiltered:xw,toggleSingleEntry:bg,updateFilter:Cd,updatePageData:ul}=Cp.actions,mA=e=>e.projectsBrowser.filters,gA=e=>e.projectsBrowser.filtersLoaded,vA=e=>e.projectsBrowser.listIsFiltered,yA=e=>e.projectsBrowser.singleEntry,xA=e=>e.projectsBrowser.projectsLoaded,bA=e=>e.projectsBrowser.pageData,wA=e=>e.projectsBrowser.projects,SA=e=>e.projectsBrowser.filtersLoaded&&e.projectsBrowser.projectsLoaded&&e.projectsBrowser.pageData.last_page>1,_A=e=>e.projectsBrowser.typeLists,jA=Cp.reducer;const CA=()=>{const e=it(),t=pe(mA),n=pe(_A),r=pe(vA),o=n.orgs.map(h=>({label:h,value:h})),s=w.useRef(),[i,l]=w.useState(null),c={height:"200px",overflowX:"auto",padding:"2px"},u=h=>{e(Cd({name:h.target.name,value:h.target.value}))},d=()=>{window.scrollTo(0,0),p(!0),e(jd(!1)),e(ul({current_page:1})),e(Rr())},f=()=>{l(null),e(jd(!1)),e(ul({current_page:1})),e(fA()),r&&(window.scrollTo(0,0),e(Rr()),p(!1))},p=h=>{e(xw(h))},y=h=>{l(h),e(Cd({name:"org",value:h.value}))},m=()=>t.org==""&&t.allocationType==""&&t.allFosToggled&&t.resource==""&&t.requestNumber=="";return a.jsx("div",{className:"row sticky-top mb-2",children:a.jsxs("div",{className:"col",children:[a.jsx("h3",{className:"mb-2",children:"Filters"}),a.jsx("h5",{className:"mb-1",children:"Field of Science"}),a.jsxs("div",{className:"border mb-3",style:c,children:[a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:"checkbox",value:"",id:"toggle_all",checked:t.allFosToggled,onChange:()=>{e(pA())}}),a.jsx("label",{className:"form-check-label",htmlFor:"toggle_all",children:"(Toggle All)"})]}),n.fosTypes.map(h=>a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:"checkbox",value:h.fosTypeId,id:`fos_${h.fosTypeId}`,checked:h.checked,onChange:()=>e(hA(h))}),a.jsx("label",{className:"form-check-label",htmlFor:`fos_${h.fosTypeId}`,children:h.fosName})]},`fos_${h.fosTypeId}`))]}),a.jsx("h5",{id:"org_select_label",className:"mb-1",children:"Organization"}),a.jsx("div",{className:"mb-3",children:a.jsx(jp,{options:o,openMenuOnClick:!0,name:"org",inputId:"orgs_filter",ref:s,closeMenuOnSelect:!0,onChange:y,value:i,"aria-labelledby":"org_select_label"},"org_select")}),a.jsx("h5",{id:"project_type_label",className:"mb-1",children:a.jsx("abbr",{title:'A specific level of allocation; also referred to as "Opportunity"',children:"Project Type"})}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"allocationType",id:"project_type_select",value:t.allocationType,className:"form-control","aria-labelledby":"project_type_label",onChange:h=>u(h),children:[a.jsx("option",{value:"",children:"-- All --"}),n.allocationTypes.map((h,x)=>a.jsx("option",{value:h,children:h},`allocation_type_${x}`))]})}),a.jsx("h5",{id:"resource_filter_label",className:"mb-1",children:"Resource"}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"resource",id:"resource_select",value:t.resource,className:"form-control","aria-labelledby":"resource_filter_label",onChange:h=>u(h),children:[a.jsx("option",{value:"",children:"-- All --"}),n.resources.map((h,x)=>a.jsx("option",{value:h.resourceId,children:h.resourceName},`resource_${x}`))]})}),a.jsx("h5",{id:"request_number_label",className:"mb-1",children:"Request Number"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{type:"text",className:"form-control",value:t.requestNumber,name:"requestNumber",id:"requestNumber","aria-labelledby":"request_number_label",onChange:h=>u(h)})}),a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{className:"btn btn-primary me-2",onClick:d,children:"Submit"}),a.jsx("button",{className:"btn btn-secondary",disabled:m(),onClick:f,children:"Reset"})]})]})})};const EA=({project:e})=>{const t=e.resources,[n,r]=w.useState(!1),o=pe(yA);let s={flush:!0,className:"mt-3 mb-1",alwaysOpen:!0};const i=g=>{let b=g.units?g.units:g.resourceUnits;const S=g.allocation?g.allocation:g.amount;if(b=="[Yes = 1, No = 0]"||b=="Yes / No")return S=="1.0"?"Yes":"No";{let _="0";return parseInt(S)&&(_=parseInt(S).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")),b=="ACCESS Credits"&&(b=a.jsx("span",{className:"tooltip-underline",title:"universal currency that can be exchanged for resource units",children:"ACCESS Credits"})),b=="Dollars"?`$${_}`:a.jsxs(a.Fragment,{children:[_," ",b]})}},l=()=>{const{origin:g,pathname:b}=window.location,S=`${g}${b}?_requestNumber=${e.requestNumber}`;navigator.clipboard.writeText(S),setTimeout(()=>r(!1),2e3)},c=()=>e.requestNumber&&e.requestNumber!=""?`(${e.requestNumber})`:"",u=a.jsx(Ll,{id:"link-tooltip",children:"Link Copied!"}),d=()=>{if(c()){const g={background:"none",border:"none",color:"#fff",fontSize:"24px"};return a.jsx(lp,{placement:"left",trigger:"click",defaultShow:n,show:n,onToggle:()=>r(!n),overlay:u,children:a.jsx("button",{onClick:l,style:g,children:a.jsx("i",{className:"bi bi-link-45deg",children:a.jsx("div",{className:"d-none",children:"Direct link to project"})})})})}return a.jsx(a.Fragment,{})},f=()=>{const g=e.pi.split(",");return`${g[1]} ${g[0]}`},p=()=>!e.coPis||e.coPis.length<=0?"":a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsxs("small",{className:"fst-italic",children:["CoPI(s): ",e.coPis.map(g=>`${g.name} (${g.organization})`).join(";")]})]}),y=()=>!e.beginDate||!e.endDate?"-":a.jsxs(a.Fragment,{children:[e.beginDate," to ",e.endDate]}),m=()=>e.allocationType==="NAIRR Start-Up"?a.jsxs("span",{className:"fw-bold",children:[c()," Start-Up: ",f(),", ",a.jsxs("em",{children:[" ",e.piInstitution," "]})," "]}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"fw-bold",children:[c()," ",e.requestTitle]})," ",a.jsx("br",{}),a.jsxs("span",{className:"fst-italic",children:[e.pi," ",a.jsxs("small",{children:[" (",e.piInstitution,") "]})]}),p()]}),h=a.jsxs("table",{className:"table table-striped table-bordered mt-2 mb-0",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("span",{className:"m-0 p-0",children:"Resource"})}),a.jsx("td",{children:a.jsx("span",{className:"m-0 p-0 d-inline",children:"Allocation"})})]})}),a.jsx("tbody",{children:t.map((g,b)=>a.jsxs("tr",{children:[a.jsx("td",{children:g.resourceName}),a.jsx("td",{style:{whiteSpace:"nowrap"},children:i(g)})]},`resource_${e.requestId}_${b}`))})]}),x=a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row mt-2 fw-bold",children:a.jsx("div",{className:"col-3 border-bottom",children:"Resources"})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:h})})]}),v=()=>e.allocationType==="NAIRR Start-Up"?x:o?a.jsxs(a.Fragment,{children:[x,a.jsx("div",{className:"row mt-2 fw-bold",children:a.jsx("div",{className:"col-3 border-bottom",children:"Abstract"})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx("div",{style:{whiteSpace:"pre-wrap",padding:"5px"},children:e.abstract})})})]}):a.jsxs(Gt,{...s,children:[a.jsxs(Gt.Item,{eventKey:"0",children:[a.jsx(Gt.Header,{children:"Resources"}),a.jsx(Gt.Body,{children:h})]}),a.jsxs(Gt.Item,{eventKey:"1",children:[a.jsx(Gt.Header,{children:"Abstract"}),a.jsx(Gt.Body,{children:a.jsx("div",{style:{whiteSpace:"pre-wrap",padding:"5px"},children:e.abstract})})]})]});return a.jsxs("div",{className:"card mb-4",children:[a.jsx("div",{className:"card-header bg-primary text-white",children:a.jsxs("div",{className:"d-flex justify-content-between",children:[a.jsx("div",{children:m()}),a.jsx("div",{children:d()})]})}),a.jsxs("div",{className:"card-body",children:[a.jsxs("div",{className:"row fw-bold border-bottom",children:[a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0",children:"Field of Science"})}),a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0 tooltip-underline",title:'A specific level of allocation; also referred to as "Opportunity"',children:"Project Type"})}),a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0",children:"Dates"})})]}),a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col",children:e.fos}),a.jsx("div",{className:"col",children:e.allocationType}),a.jsx("div",{className:"col",children:y()})]}),v()]})]})},RA=()=>{const e=pe(wA);return e.length==0?a.jsx("div",{children:"No Projects Found"}):a.jsx("div",{children:e.map((t,n)=>a.jsx(EA,{project:t},`project_${n}`))})};const wg=()=>{const e=it(),t=pe(bA),[n,r]=w.useState([]),[o,s]=w.useState("0"),i=Array.from({length:t.last_page},(m,h)=>h),l=10,c={width:"50px",textAlign:"center"};w.useEffect(()=>{f()},[t]);const u=m=>{const h=parseInt(m);e(ul({current_page:m})),e(Rr(h))},d=m=>(event.preventDefault(),s("0"),u(m),!1),f=()=>{const m=[];if(t.last_page>l)if(t.current_page>4){m.push(1),m.push("spacer");for(var h=1;h>0;h--)t.current_page-h>1&&m.push(t.current_page-h);m.push(["current",t.current_page]);for(var h=1;h<2;h++)t.current_page+h<=t.last_page&&m.push(t.current_page+h);t.last_page-t.current_page>1&&(m.push("spacer"),m.push(t.last_page))}else[1,2,3,4,5].forEach(x=>{x==t.current_page?m.push(["current",x]):m.push(x)}),m.push("spacer"),m.push(t.last_page);else for(var h=1;h<=t.last_page;h++)h==t.current_page?m.push(["current",h]):m.push(h);r(m)},p=m=>{let h="";return typeof m=="object"?[m,h]=m:h=m,m=="spacer"?a.jsx("li",{className:"page-item disabled",children:a.jsx("span",{className:"page-link",style:c,children:". . ."})}):m=="current"?a.jsx("li",{className:"page-item active","aria-current":"page",children:a.jsx("span",{className:"page-link",style:c,children:h})}):a.jsx("li",{className:"page-item",children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(m),children:h})})},y=()=>a.jsx("li",{className:"page-item",children:a.jsxs("select",{className:"page-link",style:{...c,height:"100%"},value:o,onChange:m=>d(m.target.value),children:[a.jsx("option",{value:"0",children:"Go To"}),i.map(m=>a.jsx("option",{value:m+1,children:m+1},`page_option_${m}`))]})});return a.jsx("div",{children:a.jsx("nav",{"aria-label":"Pages for the table",children:a.jsxs("ul",{className:"pagination",children:[a.jsx("li",{className:`page-item ${t.current_page==1?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:{width:"50px",textAlign:"center"},onClick:()=>u(t.current_page-1),disabled:t.current_page==1,"aria-label":"Previous Page Button",children:"<"})}),n.map((m,h)=>a.jsx(je.Fragment,{children:p(m)},`page_${h}`)),t.last_page>l?y():"",a.jsx("li",{className:`page-item ${t.current_page==t.last_page?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(t.current_page+1),disabled:t.current_page==t.last_page,"aria-label":"Next Page Button",children:">"})})]})})})},NA=({api_url:e})=>{const t=it(),n=pe(xA),r=pe(gA),o=pe(SA),s=a.jsx("div",{className:"loadingDiv",children:"Loading ..."});return w.useEffect(()=>{t(uA())},[]),a.jsx("div",{className:"container-fluid",children:a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-sm-3",children:a.jsx(CA,{})}),a.jsxs("div",{className:"col-sm-9",children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:o?a.jsx(wg,{}):""})}),a.jsx("div",{className:"row",id:"projectListRow",children:a.jsx("div",{className:"col",children:n&&r?a.jsx(RA,{}):s})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:o?a.jsx(wg,{scroll:"projects_browser_app"}):""})})]})]})})},kA=e=>e.publications_store.publication,TA=e=>e.publications_store.publication.doi,OA=e=>e.publications_store.publication_types,bw=e=>e.publications_store.publication.authors,PA=e=>e.publications_store.tag_categories,IA=e=>e.publications_store.projects,$A=e=>e.publications_store.publication.tags,AA=e=>e.publications_store.errors,ww=e=>e.publications_store.data_loaded,Sw=e=>e.publications_store.show_saved,Ep=e=>e.publications_store.saving,MA=e=>e.publications_store.modal,_w=e=>e.publications_store.form_valid,jw=e=>!Ep(e)&&ww(e)&&_w(e)&&Cw(e)&&e.publications_store.projects.filter(t=>t.selected).length>0,Cw=e=>{const t=bw(e);return t.length==0?!1:t.filter(n=>n.first_name==""||n.last_name=="").length==0},Ew=e=>({type:"UPDATE_PUBLICATION",payload:e}),DA=e=>({type:"UPDATE_FIELD",payload:e}),Ed=e=>({type:"CHANGE_PUB_TYPE",payload:e}),FA=e=>({type:"SET_PUBLICATION",payload:e}),LA=()=>({type:"ADD_AUTHOR"}),UA=e=>({type:"UPDATE_AUTHOR",payload:e}),VA=e=>({type:"TOGGLE_REQUEST",payload:e}),Qs=e=>({type:"UPDATE_ERRORS",payload:e}),Rw=e=>({type:"HIDE_ERROR",payload:e}),BA=e=>({type:"UPDATE_SELECTED_TAGS",payload:e}),zA=e=>({type:"DELETE_AUTHOR",payload:e}),qA=e=>({type:"DATA_LOADED",payload:e}),Nw=e=>({type:"UPDATE_SHOW_SAVED",payload:e}),HA=()=>({type:"RESET_STATE"}),Qc=e=>({type:"UPDATE_SAVING",payload:e}),WA=e=>({type:"SET_FORM_VALID",payload:e}),kw=e=>({type:"SET_GRANT_NUMBER",payload:e}),KA=e=>({type:"ADD_PROJECT",payload:e}),GA=(e,t,n)=>{let r=!0;const o=[];for(const i of t)e[i]||(r=!1,o.push(i));const s=e.authors||[];for(const i of s)for(const l of n)i[l]||(r=!1,o.includes(l)||o.push(l));return{formValid:r,missingFields:o}},YA=e=>e.length>0?a.jsxs("div",{role:"alert",children:[a.jsx("p",{children:"Please provide the following information before submitting:"}),a.jsx("ul",{children:e.map(t=>a.jsx("li",{children:QA(t)},t))})]}):null;function QA(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}const XA=()=>async(e,t)=>{const n=t().publications_store.publication.doi,r=encodeURIComponent(n).replaceAll(".","%2E"),o="Unable to retrieve publication. Double check your DOI, or continue entering information manually.";fetch(`/publications/lookup?doi=${r}`).then(s=>s.json()).then(s=>{if(s.title!=""){let i=t().publications_store.publication_types.find(l=>l.citation_style_type==s.type);e(Ed(i?i.publication_type:"Other")),e(FA(s))}else e(Qs(o))},s=>{e(Qs(o))})},ZA=()=>async(e,t)=>{const n=t().publications_store.grant_number,r=ne.routes.publications_find_project_path();await fetch(`${r}?grant_number=${n}`).then(o=>o.json()).then(o=>{e(KA(o)),e(kw(""))},()=>{e(Qs("Unable to find a project with this grant number."))})},Tw=()=>async e=>{const t=/^\/requests/.test(window.location.pathname)?ne.routes.publication_path("new.json"):window.location.href+".json";await fetch(t).then(n=>n.json()).then(n=>{e(qA(n))})},Ow=()=>async(e,t)=>{const n=t().publications_store,r=n.projects.filter(p=>p.selected),o=Object.keys(n.selected_tags).map(p=>n.selected_tags[p]).flat(),s={...n.publication},i=n.errors,{formValid:l,missingFields:c}=GA(s,["title","publication_year","publication_month"],["first_name","last_name"]);if(!l){i.length>0&&Array.from(i).forEach(y=>{e(Rw(y.id))});const p=YA(c);e(Qs(p));return}const u={authenticity_token:document.getElementsByName("authenticity_token")[0].value,publication:s,authors:s.authors.map(p=>({...p,order:0})),tags:o,projects:r};let d,f;s.publication_id?(d=ne.routes.publication_path(s.publication_id),f="PATCH"):(d=ne.routes.publications_path(),f="POST"),e(Qc(!0)),await fetch(d,{method:f,headers:{"Content-Type":"application/json"},body:JSON.stringify(u)}).then(p=>{n.redirect?window.location.href=ne.routes.publications_path():(s.publication_id||(e(HA()),e(Tw())),e(Nw(!0)),e(Qc(!1)))},()=>{e(Qc(!1)),e(Qs("There was an error saving this publication."))})},JA=({doi:e,updatePublication:t,doiLookup:n})=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:"doi",className:"form-label",children:"DOI"}),a.jsxs("div",{className:"input-group",children:[a.jsx("input",{type:"text",className:"form-control",id:"doi",name:"publication[doi]","aria-label":"DOI Input and Search box","aria-describedby":"doi_button",value:e,onChange:r=>t(r.target.value)}),a.jsx("button",{className:"btn btn-primary",type:"button",id:"doi_button",onClick:()=>n(),children:"Lookup Publication"})]})]})}),e2=e=>({doi:TA(e)}),t2=e=>({updatePublication:t=>e(Ew({key:"doi",value:t})),doiLookup:()=>e(XA())}),n2=tn(e2,t2)(JA),r2=({author:e,authorKey:t,updateAuthor:n,deleteAuthor:r})=>{const o=l=>{n({key:l.target.name,value:l.target.value,idx:t})},s=l=>a.jsx("td",{children:a.jsx("input",{type:"text",className:"form-control",name:l,id:l,value:e[l],onChange:c=>o(c)})},`field_${l}`),i=["first_name","last_name","affiliation"];return a.jsxs("tr",{children:[i.map(l=>s(l)),a.jsx("td",{children:t!==0&&a.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>r(t),children:a.jsx("i",{className:"bi bi-trash"})})})]})},o2=e=>({updateAuthor:t=>e(UA(t)),deleteAuthor:t=>e(zA(t))}),Sg=tn(null,o2)(r2),s2=({authors:e,addAuthor:t,authors_exist:n})=>{const r=e.length===0,o=()=>n?"":a.jsx("div",{className:"alert alert-danger",children:"You must add at least one author and each author must have a first and last name"});return a.jsxs("div",{children:[o(),a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"First Name"}),a.jsx("th",{children:"Last Name"}),a.jsx("th",{children:"Affiliation"}),a.jsx("th",{})]})}),a.jsxs("tbody",{children:[e.map((s,i)=>a.jsx(Sg,{author:s,authorKey:i},`author_${i}`)),r&&a.jsx(Sg,{author:t()})]})]}),a.jsx("button",{className:"btn btn-primary mt-3",onClick:()=>t(),children:"Add Author"})]})},i2=e=>({authors:bw(e),authors_exist:Cw(e)}),a2=e=>({addAuthor:()=>e(LA())}),l2=tn(i2,a2)(s2),c2=({category:e,publication_tags:t,updateSelectedTags:n,index:r})=>{const o=w.useRef(null),s=()=>{const l=t.filter(c=>c.label==e.label)[0];return l?l.options:[]},i=l=>{n({category:e.label,tags:l})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fw-bold mb-1",children:e.label}),a.jsx("div",{className:"mb-3",children:a.jsx(jp,{classNames:{control:l=>l.isFocused?"custom-select-selected":"border-grey-300"},defaultValue:s(),options:e.options,isMulti:!0,openMenuOnClick:!0,name:`tags_${r}`,inputId:`tags_${r}`,ref:o,closeMenuOnSelect:!1,onChange:i})})]})},u2=e=>({updateSelectedTags:t=>e(BA(t))}),d2=e=>({publication_tags:$A(e)}),f2=tn(d2,u2)(c2),p2=({projects:e,toggleProject:t})=>{const n=o=>`list-group-item list-group-item-action clickable ${o.selected?"list-group-item-success":""}`,r=()=>e.filter(o=>o.selected).length>0;return a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[r()?"":a.jsx("div",{className:"alert alert-danger",children:"You must select at least one project"}),a.jsx("div",{className:"list-group",children:e.map((o,s)=>a.jsxs("div",{className:n(o),onClick:()=>t(s),children:[o.grant_number,": ",o.title]},`project_${o.grant_number}`))})]})})},h2=e=>({projects:IA(e)}),m2=e=>({toggleProject:t=>e(VA(t))}),g2=tn(h2,m2)(p2),v2=({grant_number:e,setGrantNumber:t,grantSearch:n})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:["If your project isn't listed above, you can manually add it by entering the grant number below.",a.jsxs("div",{className:"input-group mt-1",children:[a.jsx("input",{type:"text",className:"form-control",value:e,onChange:r=>t(r.target.value),placeholder:"Enter a grant number"}),a.jsx("button",{className:"btn btn-primary",onClick:()=>n(),children:"Find Project"})]})]})}),y2=e=>({setGrantNumber:t=>e(kw(t)),grantSearch:()=>e(ZA())}),x2=e=>({grant_number:e.publications_store.grant_number}),b2=tn(x2,y2)(v2),w2=({publication:e,updateField:t,publication_types:n,changePubType:r,updatePublication:o,tag_categories:s,savePublication:i,modal:l,save_enabled:c,setFormValid:u,form_valid:d})=>{const f=g=>{g.target.value.trim()==""?u(!1):u(!0),o({key:"title",value:g.target.value})},p=()=>e.fields.map((g,b)=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:`field_${g.csl_field_name}`,className:"form-label",children:g.name}),a.jsx("input",{type:"text",className:"form-control",name:`field_${g.csl_field_name}`,id:`field_${g.csl_field_name}`,value:g.field_value,onChange:S=>t({index:b,value:S.target.value})})]})},`field_${g.csl_field_name}`)),y=()=>{const g=new Date().getFullYear()+2;let b=1980;const S=[];for(;b<=g;)S.push(b++);const _=["January","February","March","April","May","June","July","August","September","October","November","December"],j=a.jsx("i",{className:"bi bi-asterisk text-danger"});return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsxs("label",{className:"form-label",htmlFor:"publication_title",children:["Title ",j]}),a.jsx("input",{name:"publication_title",id:"publication_title",type:"text",className:`form-control ${d?"":"is-invalid"}`,value:e.title,onChange:C=>f(C)})]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{className:"form-label",htmlFor:"publication_year",children:"Year Published"}),a.jsx("select",{name:"publication_year",id:"publication_year",className:"form-control",value:e.publication_year,onChange:C=>{o({key:"publication_year",value:C.target.value})},children:S.map(C=>a.jsx("option",{value:C,children:C},`year_${C}`))})]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{className:"form-label",htmlFor:"publication_month",children:"Month Published"}),a.jsx("select",{name:"publication_month",id:"publication_month",className:"form-control",value:e.publication_month,onChange:C=>{o({key:"publication_month",value:C.target.value})},children:_.map((C,E)=>a.jsx("option",{value:E+1,children:C},`month_${E}`))})]})})]})},m=a.jsxs("div",{className:"card",children:[a.jsx("div",{className:"card-header",children:a.jsx("h2",{children:"Publication Information"})}),a.jsxs("div",{className:"card-body",children:[a.jsx("p",{className:"mb-2",children:'Enter information about this publication below. If you have a DOI, you may use the "Lookup Publication" button to attempt to find this information automatically.'}),a.jsx(n2,{}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:"publication_type",className:"form-label",children:"Publication Type"}),a.jsx("select",{name:"publication[publication_type]",id:"publication_type",className:"form-control",value:e.publication_type,onChange:g=>r(g.target.value),children:n.map(g=>a.jsx("option",{value:g.publication_type,children:g.publication_type},`pub_type_${g.type_id}`))})]})}),y(),p()]})]}),h=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Authors"}),a.jsxs(go,{children:[`Add authors by clicking the "Add Authors" button below and entering the author's details. You may also remove authors by clicking the `,a.jsx("i",{className:"bi bi-trash fw-bold text-danger"})," ","button"]})]}),a.jsx("div",{className:"card-body",children:a.jsx(l2,{})})]}),x=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Tags"}),a.jsx(go,{children:"Add related tags from the lists below. You may choose multiple tags per category."})]}),a.jsx("div",{className:"card-body",children:s.map((g,b)=>a.jsx(f2,{index:b,category:g},`tc_${b}`))})]}),v=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Associated Projects"}),a.jsx(go,{children:"Click/Tap each project that this publication is related to."})]}),a.jsxs("div",{className:"card-body",children:[a.jsx(g2,{}),a.jsx("hr",{}),a.jsx(b2,{})]})]});return a.jsxs(a.Fragment,{children:[m,h,x,v,l?null:a.jsx("p",{className:"mt-3",children:a.jsx("button",{onClick:()=>i(),className:"btn btn-success",disabled:!c,children:"Save Publication"})})]})},S2=e=>({publication:kA(e),publication_types:OA(e),tag_categories:PA(e),saving:Ep(e),modal:MA(e),save_enabled:jw(e),form_valid:_w(e)}),_2=e=>({updateField:t=>e(DA(t)),changePubType:t=>e(Ed(t)),updatePublication:t=>e(Ew(t)),savePublication:()=>e(Ow()),setFormValid:t=>e(WA(t))}),j2=tn(S2,_2)(w2),C2=({errors:e,hideError:t})=>a.jsx(a.Fragment,{children:e.map(n=>a.jsxs("div",{className:"alert alert-danger alert-dismissible sticky-top",children:[n.message,a.jsx("button",{type:"button",className:"btn-close","aria-label":"Close",onClick:()=>t(n.id)})]},`err_${n.id}`))}),E2=e=>({errors:AA(e)}),R2=e=>({hideError:t=>e(Rw(t))}),N2=tn(E2,R2)(C2),k2=({show_saved:e,updateShowSaved:t})=>{const n=a.jsxs("div",{className:"alert alert-success alert-dismissible sticky-top",children:["Publication Saved Successfully!",a.jsx("button",{type:"button",className:"btn-close","aria-label":"Close",onClick:()=>t(!1)})]});return e?n:a.jsx(a.Fragment,{})},T2=e=>({show_saved:Sw(e)}),O2=e=>({updateShowSaved:t=>e(Nw(t))}),P2=tn(T2,O2)(k2),I2=({getData:e,data_loaded:t})=>(w.useEffect(()=>{e()},[]),a.jsxs(a.Fragment,{children:[a.jsx(P2,{}),a.jsx(N2,{}),t?a.jsx(j2,{}):a.jsx(Do,{})]})),$2=e=>({data_loaded:ww(e)}),A2=e=>({getData:()=>e(Tw())}),Pw=tn($2,A2)(I2),M2=({saving:e,savePublication:t,showSaved:n,updatePublications:r,save_enabled:o})=>{const[s,i]=w.useState(!1);return w.useEffect(()=>{!e&&n&&r()},[e,n]),a.jsxs(a.Fragment,{children:[a.jsxs(ve,{size:"xl",show:s,onHide:()=>i(!1),scrollable:!0,children:[a.jsx(ve.Header,{closeButton:!0,children:a.jsx(ve.Title,{children:"Add Publication"})}),a.jsx(ve.Body,{children:a.jsx(Pw,{})}),a.jsx(ve.Footer,{children:a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",onClick:()=>i(!1),children:"Cancel"}),a.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>{t(),i(!1)},children:"Save Publication"})]})})]}),a.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>i(!0),children:"Add a New Publication"})]})},D2=e=>({saving:Ep(e),showSaved:Sw(e),save_enabled:jw(e)}),F2=e=>({savePublication:()=>e(Ow())}),L2=tn(D2,F2)(M2),U2=({usernames:e=[],publication_ids:t=[]})=>{const[n,r]=w.useState(e),[o,s]=w.useState(t),[i,l]=w.useState([]),c=w.useRef(n),u=h=>{c.current=h,r(h)},d=async()=>{const x=await(await fetch(ne.routes.search_publications_path({usernames:n}))).json();l(x)};w.useEffect(()=>{d()},[n]),w.useEffect(()=>{addEventListener("requestAddRole",h=>u([...c.current,h.detail.username])),addEventListener("requestRemoveRole",h=>u(c.current.filter(x=>x!=h.detail.username)))},[]);let f=!1,p=!1;const y=i.map(h=>{const x=o.includes(h.publication_id);f=f||x,p=p||!x;const v=new Date(h.publication_year,h.publication_month-1);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("input",{type:"checkbox",name:"publication_ids[]",value:h.publication_id,checked:x,onChange:()=>s(x?o.filter(g=>g!=h.publication_id):[...o,h.publication_id])})}),a.jsx("td",{children:h.title}),a.jsx("td",{children:h.authors.map(g=>`${g.first_name} ${g.last_name}`).join(", ")}),a.jsx("td",{children:h.publication_type}),a.jsxs("td",{children:[v.toLocaleString("default",{month:"short"})," ",h.publication_year]})]},h.publication_id)}),m=`${p?"Select":"Deselect"} all`;return a.jsxs("div",{className:"publications-select",children:[a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:a.jsx("input",{type:"checkbox",value:"","aria-label":m,title:m,checked:f&&!p,onChange:()=>s(p?i.map(h=>h.publication_id):[]),ref:h=>{h&&(h.indeterminate=f&&p)}})}),a.jsx("th",{children:"Title"}),a.jsx("th",{children:"Authors"}),a.jsx("th",{children:"Type"}),a.jsx("th",{children:"Date"})]})}),a.jsx("tbody",{children:y})]}),a.jsx(L2,{updatePublications:d})]})},V2=()=>`${Math.random().toString(36).slice(2)}`,Rd=document.querySelector("#publications-react"),B2=Rd?Rd.dataset:{},_g={publication_types:[],tag_categories:[],publication:{},projects:[],errors:[],selected_tags:{},data_loaded:!1,saving:!1,show_saved:!1,redirect:B2.redirect||!1,modal:Rd==null,form_valid:!1,grant_number:""},z2=(e=_g,t)=>{const{type:n,payload:r}=t;switch(n){case"UPDATE_FIELD":return $t(e,s=>(s.publication.fields[r.index].field_value=r.value,s));case"CHANGE_PUB_TYPE":return $t(e,s=>{let i=s.publication_types.find(l=>l.publication_type==r).fields;return i.forEach(l=>{const c=s.publication.fields.find(u=>u.csl_field_name==l.csl_field_name);c&&(l.value=c.value)}),s.publication.publication_type=r,s.publication.fields=i,s});case"UPDATE_PUBLICATION":return{...e,publication:{...e.publication,[r.key]:r.value}};case"SET_PUBLICATION":return $t(e,s=>(s.publication.fields.forEach(i=>{i.field_value=r[i.csl_field_name]}),Object.keys(s.publication).forEach(i=>{r[i]&&(s.publication[i]=r[i])}),s.form_valid=r.title.trim()!="",s));case"ADD_AUTHOR":{const o={portal_username:"",first_name:"",middle_name:"",last_name:"",prefix:"",suffix:"",initials:"",affiliation:"",hash:{}};return $t(e,i=>{i.publication.authors.push(o)})}case"UPDATE_AUTHOR":return $t(e,s=>{s.publication.authors[r.idx][r.key]=r.value});case"TOGGLE_TAG":return $t(e,s=>{let i=s.tag_categories.find(l=>l.publication_tags_category_id==r.publication_tags_category_id);i.tags[r.idx].selected=!i.tags[r.idx].selected});case"TOGGLE_REQUEST":return $t(e,s=>(s.projects[r].selected=!s.projects[r].selected,s));case"UPDATE_ERRORS":{const o={id:V2(),message:r};return{...e,errors:[...e.errors,o]}}case"HIDE_ERROR":{const o=e.errors.filter(s=>s.id!=r);return{...e,errors:o}}case"UPDATE_SELECTED_TAGS":return $t(e,s=>{const i=r.tags.map(l=>l.value);return s.selected_tags[r.category]=i,s});case"DELETE_AUTHOR":return $t(e,s=>(s.publication.authors.splice(r,1),s));case"DATA_LOADED":return $t(e,s=>(s.publication=r.publication,s.form_valid=r.publication.title.trim()!="",s.publication.authors.forEach(i=>{i.affiliation||(i.affiliation="")}),s.publication_types=r.publication_types,s.tag_categories=r.tag_categories,s.projects=r.publication.projects,r.publication.tags.forEach(i=>s.selected_tags[i.label]=i.options.map(l=>l.value)),s.data_loaded=!0,s));case"UPDATE_SHOW_SAVED":return{...e,show_saved:r};case"UPDATE_SAVING":return{...e,saving:r};case"RESET_STATE":return _g;case"SET_FORM_VALID":return{...e,form_valid:r};case"SET_GRANT_NUMBER":return{...e,grant_number:r};case"ADD_PROJECT":return{...e,projects:[...e.projects,r]};default:return e}},q2={catalogs:{},filteredResources:[],filters:[],hasErrors:!1,onRamps:!1,resources:[],resourcesLoaded:!1,resourceSorting:{"NSF Capacity Resources":1,"NSF Innovative Testbeds":2,"Other NSF-funded Resources":3,"Services and Support":4}},pa=Ye("resourceCatalog/getResources",async(e,{dispatch:t})=>{t(jg(!1));let n=[];e.catalogSources?n=e.catalogSources:n.push({...e,catalogLabel:"Default"}),e.onRamps&&n.push({apiUrl:"https://allocations.access-ci.org/resources.json",catalogLabel:"ACCESS",allowedCategories:[],allowedFilters:[],allowedResources:[],excludedCategories:["Resource Category"],excludedFilters:[],excludedResources:["ACCESS Credits"]});const r=await Promise.all(n.map(async o=>{const i=await(await fetch(o.apiUrl)).json();return{...o,data:i}}));t(G2({data:r,params:e})),t(jg(!0))});Ye("resourceCatalog/getResources",async(e,{dispatch:t})=>{t(Q2(e)),t($w())});const H2=e=>{const t=[],n=e.filter(r=>r.features.filter(o=>o.selected).length>0);return e.forEach(r=>{r.features.forEach(o=>{o.selected&&t.push(o.featureId)})}),n.map(r=>({...r,features:r.features.filter(o=>o.selected)}))},W2=e=>{const t={},n={};let r={};return e.forEach(s=>{t[s.catalogLabel]={...s,resourceIds:[],selected:!1,catalogId:s.catalogLabel.replace(/[^(A-z)]/,"")},delete t[s.catalogLabel].data,s.data.forEach(i=>{if(Nd(s.allowedResources,s.excludedResources,i.resourceName)){const{categories:l,formattedResource:c}=K2(s,i,r);n[i.resourceId]=c,t[s.catalogLabel].resourceIds.push(i.resourceId),r=l}})}),{resources:Object.keys(n).map(s=>n[s]),catalogs:t,categories:r}},Nd=(e,t,n)=>!e&&!t||e&&e.length==0&&t&&t.length==0?!0:e&&e.length>0?e.find(r=>r==n):t&&t.length>0?!t.find(r=>r==n):!0,K2=(e,t,n)=>{const r=[];let o="";t.featureCategories.filter(l=>l.categoryIsFilter).forEach(l=>{const c=l.categoryId;l.categoryName=="ACCESS Resource Grouping"?o=l.features[0].name:(!n[c]&&Nd(e.allowedCategories,e.excludedCategories,l.categoryName)&&(n[c]={categoryId:c,categoryName:l.categoryName,categoryDescription:l.categoryDescription,features:{}}),l.features.forEach(u=>{const d={featureId:u.featureId,name:u.name,description:u.description,categoryId:c,selected:!1},f=Nd(e.allowedFilters,e.excludedFilters,d.name);f&&r.push(d),n[c]&&f&&!n[c].features[u.featureId]&&(n[c].features[u.featureId]=d)}))});const s=r.map(l=>l.name).sort((l,c)=>l>c);return{formattedResource:{...t,resourceName:t.resourceName.trim(),features:s,featureIds:r.map(l=>l.featureId),sortCategory:o},categories:n}},Iw=ri({name:"resourceCatalog",initialState:q2,reducers:{handleResponse:(e,{payload:t})=>{const n=t.data,{resources:r,catalogs:o,categories:s}=W2(n);e.catalogs=o,e.onRamps=t.params.onRamps;for(const i in s){const l=s[i],c=[];for(const u in l.features)c.push(l.features[u]);e.filters.push({...l,features:c.sort((u,d)=>u.name>d.name)})}e.filters=e.filters.sort((i,l)=>i.categoryName.localeCompare(l.categoryName)),e.resources=r.sort((i,l)=>i.resourceName.localeCompare(l.resourceName)).sort((i,l)=>e.resourceSorting[i.sortCategory]>e.resourceSorting[l.sortCategory]),e.filteredResources=[...e.resources],e.resourcesLoaded=!0},resetFilters:e=>{e.filters.forEach(t=>{t.features.forEach(n=>n.selected=!1)}),e.filteredResources=[...e.resources]},setResourcesLoaded:(e,{payload:t})=>{e.resourcesLoaded=t},toggleCatalog:(e,{payload:t})=>{const{catalog:n,selected:r}=t;e.catalogs[n.catalogLabel].selected=r},toggleFilter:(e,{payload:t})=>{if(t){const i=t,c=e.filters.find(u=>u.categoryId==i.categoryId).features.find(u=>u.featureId==i.featureId);c.selected=!c.selected}const n=H2(e.filters);let r=[];if(n.length>0){const i=n.map(l=>l.features.map(c=>c.featureId));e.resources.forEach(l=>{let c=0;i.forEach(u=>{let d=!1;l.featureIds.forEach(f=>{u.indexOf(f)>=0&&(d=!0)}),d&&(c+=1)}),c>=i.length&&r.push(l)})}else r=e.resources;const o=Object.keys(e.catalogs).map(i=>e.catalogs[i]),s=o.filter(i=>i.selected);if(s.length>0&&s.length<o.length){const i=s.map(l=>l.resourceIds).flat();r=r.filter(l=>i.indexOf(l.resourceId)>=0)}e.filteredResources=r}},extraReducers:e=>{e.addCase(pa.pending,t=>{}).addCase(pa.fulfilled,(t,n)=>{}).addCase(pa.rejected,(t,n)=>{t.hasErrors=!0,console.log(n.error)})}}),{handleResponse:G2,processData:pD,resetFilters:Y2,setResourcesLoaded:jg,toggleCatalog:Q2,toggleFilter:$w}=Iw.actions,Aw=e=>e.resourceCatalog.catalogs,X2=e=>e.resourceCatalog.filters,Z2=e=>e.resourceCatalog.hasErrors,J2=e=>e.resourceCatalog.resourcesLoaded,eM=e=>e.resourceCatalog.filteredResources,tM=Iw.reducer,nM="_access_1yrq0_2",rM="_resourceName_1yrq0_6",oM="_description_1yrq0_11",sM="_filterBar_1yrq0_15",iM="_cardBg_1yrq0_20",aM="_active_1yrq0_25",lM="_plainButton_1yrq0_30",cM="_btnSecondary_1yrq0_40",uM="_filtersHidden_1yrq0_51",dM="_filtersVisible_1yrq0_57",Dt={access:nM,resourceName:rM,description:oM,filterBar:sM,cardBg:iM,active:aM,plainButton:lM,btnSecondary:cM,filtersHidden:uM,filtersVisible:dM},fM=({resource:e})=>{const[t,n]=w.useState(!0),r=u=>{const d={"CPU Compute":"cpu-fill","GPU Compute":"gpu-card",Cloud:"cloud-fill","Commercial Cloud":"cloud-fill",Storage:"database-fill","Service / Other":"journal","Innovative / Novel Compute":"pc"};return d[u]?a.jsx("i",{title:u,className:`bi bi-${d[u]} me-2 `},`${e.resourceId}_${d[u]}`):""},o=()=>a.jsxs("span",{className:"float-end",children:[e.features.map(u=>r(u)),e.resourceType]}),s=u=>u.length==0?"":a.jsx(a.Fragment,{children:u.map((d,f)=>a.jsx("span",{className:"badge text-bg-secondary me-2",children:d},`feature_${e.resourceId}_${f}`))}),i=()=>{let u=e.resourceDescription;return u&&u!=""?(Dt.plainButton,a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col fw-bold",children:["About ",e.resourceName]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col ",children:[a.jsx("div",{className:Dt.description,dangerouslySetInnerHTML:{__html:u}}),""]})})]})):""},l=()=>e.recommendedUse&&e.recommendedUse!=""?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col fw-bold",children:"Recommended Use"})}),a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",children:a.jsx("div",{className:Dt.description,dangerouslySetInnerHTML:{__html:e.recommendedUse}})})})]}):"",c=()=>Dt.cardBg;return a.jsx(a.Fragment,{children:a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"card mb-3",children:[a.jsxs("div",{className:`card-header ${c()}`,children:[a.jsx("span",{className:"",children:e.resourceName}),o()]}),a.jsxs("div",{className:"card-body",children:[a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",children:s(e.features)})}),l(),i()]}),a.jsx("div",{className:"card-footer",children:a.jsxs("a",{target:"_blank",href:e.userGuideUrl,className:"btn btn-info me-2 fw-bold",children:["System Info ",a.jsx("i",{className:"bi bi-box-arrow-up-right"})]})})]})})})})},pM=({filter:e})=>{const t=it(),n=()=>{t($w(e))};return a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"form-check",children:[a.jsx("label",{className:"form-check-label",htmlFor:`filter_${e.featureId}`,children:e.name}),a.jsx("input",{className:"form-check-input",type:"checkbox",value:e.featureId,id:`filter_${e.featureId}`,checked:e.selected,onChange:n})]})})})},hM=({category:e})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("div",{className:"fw-bold mb-1 mt-1",children:a.jsx("abbr",{title:e.categoryDescription,children:e.categoryName})}),e.features.map(t=>a.jsx(pM,{filter:t},t.featureId))]})}),mM=({onReset:e})=>{const t=it(),n=pe(Aw),r=pe(X2),o=r.filter(s=>s.features.filter(i=>i.selected).length>0);return Object.keys(n).map(s=>n[s]),a.jsxs(a.Fragment,{children:[r.map(s=>a.jsx(hM,{category:s},s.categoryId)),a.jsx("button",{className:"btn btn-warning mt-2 mb-2",onClick:()=>t(Y2()),disabled:o.length==0,children:"Reset Filters"}),a.jsx("button",{className:"btn btn-outline-primary ms-3 mt-2 mb-2",onClick:e,children:"Close Menu"})]})},gM=()=>{const[e,t]=w.useState(!1),n=w.useRef(null),r=()=>{const o=n.current;e?(o.style.height="0px",o.classList.remove(Dt.filtersVisible),o.classList.add(Dt.filtersHidden)):(o.style.height=o.scrollHeight+"px",o.classList.remove(Dt.filtersHidden),o.classList.add(Dt.filtersVisible)),t(!e)};return a.jsx("div",{className:Dt.filterBar,children:a.jsx("div",{className:"row mb-2",children:a.jsx("div",{className:"col pt-2 pb-2",children:a.jsxs("div",{className:"p-1 pb-0 border-bottom bg-white shadow",children:[a.jsxs("button",{className:"btn btn-outline-primary mb-1 mt-1",type:"button",onClick:r,children:[a.jsx("i",{className:"bi bi-filter"})," Filters"]}),a.jsx("div",{className:`${Dt.filtersHidden} pe-2 ps-2`,id:"filtersList",ref:n,children:a.jsx(mM,{onReset:r})})]})})})})},vM=()=>{const e=pe(eM);return e.length==0?a.jsx("div",{className:"fw-bold",children:"No Resources Match Your Filters"}):a.jsx("div",{className:"card shadow",children:a.jsxs("div",{className:"card-body",children:[a.jsx(gM,{}),e.map(t=>a.jsx(fM,{resource:t},t.resourceId))]})})},yM=({baseUrl:e})=>a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col d-flex",children:a.jsx("img",{alt:"Access Logo",style:{height:"75px"},src:`${e}/access_logo.png`})})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx("h3",{className:"border-bottom",children:"NSF ACCESS Resources"})})}),a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("h4",{children:"Discover the nationwide NSF cyberinfrastructure"}),a.jsx("p",{children:"Need advanced computing and storage options for your research or classroom? The ACCESS program has been established and funded by the U.S. National Science Foundation to help you - the nation's researchers and educators - to use some of the country's most advanced computing systems and services - at no cost to you."}),a.jsx("p",{children:"Thousands of researchers, instructors, and students from institutions large and small use ACCESS-integrated resources every year. With more than 30 resources from more than 15 resource providers, there's bound to be a resource for you, your lab, or your class."}),a.jsx("p",{children:"Explore the resource catalog below - filter the list to discover the resources that have the features or services to accelerate your activities. The System Info button will take you to the resource's documentation for all the details."}),a.jsx("p",{children:'Ready to begin? Click the "Get Your First Project" button and join the ACCESS community!'}),a.jsx("p",{children:a.jsxs("a",{href:"https://allocations.access-ci.org/get-your-first-project",target:"_blank",className:`btn btn-secondary fw-bold ${Dt.btnSecondary}`,children:["Get Your First Project ",a.jsx("i",{className:"bi bi-box-arrow-up-right"})]})}),a.jsxs("p",{children:["If you have feedback for ACCESS, please complete our",a.jsx("a",{target:"_blank",href:"https://docs.google.com/forms/d/e/1FAIpQLSdn-SXokNB_5s0r2SA_S9ZIZWZFlVPRD2OHepTH5HY2YND_zw/viewform",children:" Feedback Form"}),".",a.jsx("br",{}),"If you have questions, please",a.jsx("a",{target:"_blank",href:"https://support.access-ci.org/user/login?destination=/open-a-ticket",children:" open a help ticket"}),"."]})]})})]}),xM=({catalogSources:e=[],onRamps:t=!1,baseUrl:n})=>{const r=it(),o=pe(J2),s=pe(Z2),i=pe(Aw),l=Object.keys(i).map(u=>i[u]);w.useEffect(()=>{r(pa({catalogSources:e,onRamps:t}))},[]);const c=()=>t&&l.length>1?a.jsx(a.Fragment,{children:l.filter(u=>u.catalogLabel!="ACCESS").map((u,d)=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsxs("h4",{className:"border-bottom",children:["About ",u.catalogLabel]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:u.description}})]})},`catalog_${d}`))}):"";return s?a.jsx("div",{className:"row",children:a.jsx("div",{className:"col text-center mt-2",children:a.jsx("h4",{children:"Unable to Load Resources"})})}):o?a.jsxs("div",{className:`container mt-3 ${Dt.access}`,children:[t?a.jsx(yM,{baseUrl:n}):"",c(),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(vM,{})})})]}):a.jsx(Do,{})},bM={filters:[],resources:[],filteredResources:[],resourcesLoaded:!1,hasErrors:!1,resourceSorting:{"NSF Capacity Resources":1,"NSF Innovative Testbeds":2,"Other NSF-funded Resources":3,"Services and Support":4}},ha=Ye("resourceCatalog/getResources",async(e,{dispatch:t})=>{const r=await(await fetch(e.apiUrl)).json();t(SM({data:r,params:e}))}),wM=e=>{const t=[],n=e.filter(r=>r.features.filter(o=>o.selected).length>0);return e.forEach(r=>{r.features.forEach(o=>{o.selected&&t.push(o.featureId)})}),n.map(r=>({...r,features:r.features.filter(o=>o.selected)}))},Cg=(e,t,n)=>{if(e.length==0&&t.length==0)return!0;if(e.length>0)return e.find(r=>r==n);if(t.length>0)return!t.find(r=>r==n)},Mw=ri({name:"resourceCatalog",initialState:bM,reducers:{handleResponse:(e,{payload:t})=>{const n=t.data,r=t.params.excludedCategories,o=t.params.excludedFilters,s=t.params.excludedResources,i=t.params.allowedCategories,l=t.params.allowedFilters,c=[],u={};n.filter(d=>!s.includes(d.resourceName)).forEach(d=>{const f=[];let p="";d.featureCategories.filter(m=>m.categoryIsFilter).forEach(m=>{const h=m.categoryId;m.categoryName=="ACCESS Resource Grouping"?p=m.features[0].name:(!u[h]&&Cg(i,r,m.categoryName)&&(u[h]={categoryId:h,categoryName:m.categoryName,categoryDescription:m.categoryDescription,features:{}}),m.features.forEach(x=>{const v={featureId:x.featureId,name:x.name,description:x.description,categoryId:h,selected:!1},g=Cg(l,o,v.name);g&&f.push(v),u[h]&&g&&!u[h].features[x.featureId]&&(u[h].features[x.featureId]=v)}))});const y={resourceName:d.resourceName,resourceId:d.resourceId,resourceType:d.resourceType,organization:d.organization,units:d.units,userGuideUrl:d.userGuideUrl,resourceDescription:d.resourceDescription,description:d.description,recommendedUse:d.recommendedUse,features:f.map(m=>m.name).sort((m,h)=>m>h),featureIds:f.map(m=>m.featureId),sortCategory:p};c.push(y)});for(const d in u){const f=u[d],p=[];for(const y in f.features)p.push(f.features[y]);e.filters.push({...f,features:p.sort((y,m)=>y.name>m.name)})}i.length>0?e.filters=e.filters.sort((d,f)=>i.indexOf(d.categoryName)>i.indexOf(f.categoryName)):e.filters=e.filters.sort((d,f)=>d.categoryName.localeCompare(f.categoryName)),e.resources=c.sort((d,f)=>d.resourceName.localeCompare(f.resourceName)).sort((d,f)=>e.resourceSorting[d.sortCategory]>e.resourceSorting[f.sortCategory]),e.filteredResources=[...e.resources],e.resourcesLoaded=!0},resetFilters:e=>{e.filters.forEach(t=>{t.features.forEach(n=>n.selected=!1)}),e.filteredResources=[...e.resources]},toggleFilter:(e,{payload:t})=>{const n=t,o=e.filters.find(i=>i.categoryId==n.categoryId).features.find(i=>i.featureId==n.featureId);o.selected=!o.selected;const s=wM(e.filters);if(s.length>0){const i=[],l=s.map(c=>c.features.map(u=>u.featureId));e.resources.forEach(c=>{let u=0;l.forEach(d=>{let f=!1;c.featureIds.forEach(p=>{d.indexOf(p)>=0&&(f=!0)}),f&&(u+=1)}),u>=l.length&&i.push(c)}),e.filteredResources=i}else e.filteredResources=[...e.resources]}},extraReducers:e=>{e.addCase(ha.pending,t=>{}).addCase(ha.fulfilled,(t,n)=>{}).addCase(ha.rejected,(t,n)=>{t.hasErrors=!0,console.log(n.error)})}}),{handleResponse:SM,processData:hD,resetFilters:_M,toggleFilter:jM}=Mw.actions,CM=e=>e.resourceCatalog.hasErrors,EM=e=>e.resourceCatalog.resourcesLoaded,RM=e=>e.resourceCatalog.filters,NM=e=>e.resourceCatalog.filteredResources,kM=Mw.reducer,TM=({resource:e})=>{const t=r=>r.length==0?"":a.jsx("ul",{children:r.map((o,s)=>a.jsx("li",{children:o},`feature_${e.resourceId}_${s}`))}),n=(r,o)=>o&&o!=""?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col fw-bold",children:r})}),a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",dangerouslySetInnerHTML:{__html:o}})})]}):"";return a.jsxs(Gt.Item,{eventKey:e.resourceId,children:[a.jsx(Gt.Header,{children:e.resourceName}),a.jsxs(Gt.Body,{children:[a.jsx("table",{className:"table",children:a.jsxs("tbody",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Resource Type:"}),a.jsx("td",{children:e.resourceType})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Organization:"}),a.jsx("td",{children:e.organization})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Units:"}),a.jsx("td",{children:e.units})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"User Guide:"}),a.jsx("td",{children:e.userGuideUrl==""?"":a.jsx("a",{href:e.userGuideUrl,target:"_blank",rel:"noreferrer",children:"Link to User Guide"})})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Features Available:"}),a.jsx("td",{children:t(e.features)})]})]})}),n("Resource Description",e.resourceDescription),n("Allocations Description",e.description),n("Recommended Use",e.recommendedUse)]})]})},OM=()=>{const e=pe(NM);return e.length==0?a.jsx("div",{className:"fw-bold",children:"No Resources Match Your Filters"}):a.jsxs("div",{children:[a.jsx("h4",{className:"mb-0",children:"Resources"}),a.jsx(Gt,{children:e.map(t=>a.jsx(TM,{resource:t},t.resourceId))})]})},PM=({filter:e})=>{const t=it(),n=()=>{t(jM(e))};return a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"form-check",children:[a.jsx("label",{className:"form-check-label",htmlFor:`filter_${e.featureId}`,children:e.name}),a.jsx("input",{className:"form-check-input",type:"checkbox",value:e.featureId,id:`filter_${e.featureId}`,checked:e.selected,onChange:n})]})})})},IM=({category:e})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("div",{className:"fw-bold mb-1 mt-1",children:a.jsx("abbr",{title:e.categoryDescription,children:e.categoryName})}),e.features.map(t=>a.jsx(PM,{filter:t},t.featureId))]})}),$M=()=>{const e=it(),t=pe(RM),n=t.filter(r=>r.features.filter(o=>o.selected).length>0);return a.jsxs("div",{children:[a.jsx("h4",{className:"mb-0",children:"Filters"}),t.map(r=>a.jsx(IM,{category:r},r.categoryId)),a.jsx("button",{className:"btn btn-warning mt-2 mb-2",onClick:()=>e(_M()),disabled:n.length==0,children:"Reset Filters"})]})},AM=({apiUrl:e,excludedCategories:t=[],excludedFilters:n=[],excludedResources:r=[],allowedCategories:o=[],allowedFilters:s=[]})=>{const i=it(),l=pe(EM),c=pe(CM);return w.useEffect(()=>{i(ha({apiUrl:e,excludedCategories:t,excludedFilters:n,excludedResources:r,allowedCategories:o,allowedFilters:s}))},[]),c?a.jsx("div",{className:"row",children:a.jsx("div",{className:"col text-center mt-2",children:a.jsx("h4",{children:"Unable to Load Resources"})})}):l?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"row mt-3",children:[a.jsx("div",{className:"col-sm-4",children:a.jsx($M,{})}),a.jsx("div",{className:"col-sm-8",children:a.jsx(OM,{})})]})}):a.jsx(Do,{})},Dw={apiUrl:null,pages:1,publications:[],publicationsLoaded:!0,showPagination:!1,filterSelections:{allJournalsToggled:!1,doi:"",journal:"",authorName:"",publicationType:""},pageData:{current_page:1,last_page:1},filterOptions:{journals:[],publication_types:[]}},MM=Ye("publicationsBrowser/initApp",async(e,{getState:t,dispatch:n})=>{await n(Nr()),await n(Fw())}),Nr=Ye("publicationsBrowser/getPublications",async(e,{getState:t})=>{const n=t().publicationsBrowser;let r=`${n.apiUrl}?page=${n.pageData.current_page}`;if(n.filterSelections.doi!==""&&(r+=`&doi=${encodeURIComponent(n.filterSelections.doi)}`),n.filterSelections.authorName!==""&&(r+=`&author_name=${encodeURIComponent(n.filterSelections.authorName)}`),n.filterSelections.journal!==""){const i=n.filterSelections.journal;n.filterOptions.journals.includes(i)&&(r+=`&journal=${encodeURIComponent(n.filterSelections.journal)}`)}return n.filterSelections.publicationType!==""&&(r+=`&publication_type=${encodeURIComponent(n.filterSelections.publicationType)}`),await(await fetch(r)).json()}),Fw=Ye("publicationsBrowser/getFilters",async(e,{getState:t,dispatch:n})=>{const o=`${t().publicationsBrowser.apiUrl}?filters=1`;return(await(await fetch(o)).json()).filters||[]}),Lw=ri({name:"publicationsBrowser",initialState:Dw,reducers:{updatePageData:(e,{payload:t})=>{t.current_page&&(e.pageData.current_page=t.current_page),t.last_page&&(e.pageData.last_page=t.last_page)},updateFilterSelection:(e,{payload:t})=>{e.filterSelections[t.name]=t.value},resetFilters:e=>{e.filterSelections={doi:"",allJournalsToggled:!1,journal:"",authorName:"",publicationType:""}}},extraReducers:e=>{e.addCase(Nr.pending,t=>{t.publicationsLoaded=!1,t.error=null}).addCase(Nr.fulfilled,(t,n)=>{t.publicationsLoaded=!0,t.publications=n.payload.publications||[],n.payload.pagination&&n.payload.pagination.last_page!==t.pageData.last_page&&(t.pageData.current_page=1),t.showPagination=!0,n.payload.pagination&&(t.pageData.last_page=n.payload.pagination.last_page)}).addCase(Nr.rejected,(t,n)=>{t.publicationsLoaded=!0,t.error=n.error.message}).addCase(Fw.fulfilled,(t,n)=>{t.filterOptions=n.payload})}}),{updatePageData:DM,updateFilterSelection:Eg,resetFilters:FM}=Lw.actions,LM=e=>e.publicationsBrowser.filterSelections,UM=e=>e.publicationsBrowser.publicationsLoaded,VM=e=>e.publicationsBrowser.publications,BM=e=>e.publicationsBrowser.filterOptions,zM=e=>e.publicationsBrowser.pageData,qM=Lw.reducer,kd=e=>(e=e.startsWith("https")?e.split("https://doi.org/").join(""):e,e),HM=({publication:e,index:t})=>{const n=e.authors.map(f=>`${f.last_name}, ${f.first_name.substr(0,1)}.`).join(", "),r=e.projects.map(f=>f.grant_number),o=e.publication_type==="Other"?"Publication":e.publication_type,s=e.projects,i=t%2==0?"bg-light":"",l={textIndent:"-50px",marginLeft:"50px"},c=e.publication_datas,u=f=>{switch(f){case"Publication Type":return e.publication_type;case"Publication Year":return e.publication_year?e.publication_year:"N/A";case"DOI":return e.doi?a.jsx("a",{href:`https://doi.org/${kd(e.doi)}`,target:"_blank",className:"fw-normal",children:kd(e.doi)}):!1;case"Journal":return e.journal.title?e.journal.title:!1;case"Volume/Issue":return c["Volume/Issue"]?c["Volume/Issue"]:!1;case"Pages":return c.Pages?c.Pages:!1;case"Publisher":return c.Publisher?c.Publisher:!1}},d=()=>{const f=u("Publication Year");let p=e.title;const y=u("Journal"),m=u("DOI"),h=u("Volume/Issue"),x=u("Pages"),v=u("Publisher");return p[p.length-1]!="."&&(p+="."),e.publication_type==="Journal Paper"||e.publication_type==="Other"?a.jsxs(a.Fragment,{children:[n," (",f,"). ",p,y?a.jsxs("em",{className:"ms-1",children:[y,"."]}):"",h?a.jsxs("span",{className:"ms-1",children:[h,","]}):"",x?a.jsxs("span",{className:"ms-1",children:[x,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Conference Paper"||e.publication_type==="Software"?a.jsxs(a.Fragment,{children:[n," (",f,"). ",p,y?a.jsxs("em",{className:"ms-1",children:[y,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Book"||e.publication_type==="Book Chapter"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p}),v?a.jsxs("em",{className:"ms-1",children:[v,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Dataset"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p})," [Dataset]. ",v||"",".",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Dissertation"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p}),". [Doctoral dissertation",v?", "+v:"","].",m?a.jsx("span",{className:"ms-1",children:m}):""]}):""};return a.jsx("div",{className:"col-12 mb-2 border-bottom",children:a.jsx("div",{className:"card",style:{border:"unset"},children:a.jsxs("div",{className:`card-body pt-2 mb-2 ${i}`,children:[a.jsx("p",{style:l,children:d()}),s.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-decoration-underline mb-2",children:["Projects Supporting this ",o]}),a.jsx("ul",{style:{...l,listStyleType:"none"},children:r.map((f,p)=>a.jsx("li",{id:`project_${p}`,children:a.jsx("a",{href:`https://allocations.access-ci.org/current-projects?_requestNumber=${f}`,id:`grant_link${p}`,target:"_blank",style:{fontWeight:"600"},children:f})},`grant_${p}`))})]})]})})})},WM=()=>{const e=pe(VM);return e.length===0?a.jsx("div",{children:"No Publications Found"}):a.jsx("div",{children:e.map((t,n)=>a.jsx(HM,{publication:t,index:n},`publication_${n}`))})},KM=()=>{const e=it(),t=pe(BM),n=pe(LM),r=()=>{window.scrollTo(0,0),e(jd(!1)),e(ul({current_page:1})),e(Nr())},o=()=>{e(FM()),window.scrollTo(0,0),e(Nr())};if(!t.journals)return a.jsx("p",{children:"Loading filters..."});const s=l=>{e(Eg({name:l.target.name,value:l.target.value}))},i=l=>{e(Eg({name:l.target.name,value:l.target.value}))};return a.jsx("div",{className:"row sticky-top mb-2",children:a.jsxs("div",{className:"col",children:[a.jsx("h3",{className:"mb-2",children:"Filters"}),a.jsx("h5",{id:"journals_filter_label",className:"mb-1",children:"Journals"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("input",{placeholder:"Type to search...",list:"journal_list",name:"journal",id:"journal_select",value:n.journal,className:"form-control","aria-labelledby":"journal_filter_label",onChange:l=>s(l),onInput:l=>i(l)}),a.jsx("datalist",{id:"journal_list",children:t.journals.map((l,c)=>a.jsx("option",{value:l,children:l},`journal_${c}`))})]}),a.jsx("h5",{id:"author_name_label",className:"mb-1",children:"Author Name"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{placeholder:"Last Name, First Initial",type:"text",className:"form-control",value:n.authorName,name:"authorName",id:"authorName","aria-labelledby":"author_name",onChange:s})}),a.jsx("h5",{id:"doi_number_label",className:"mb-1",children:"DOI"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{type:"text",className:"form-control",value:kd(n.doi),name:"doi",id:"doiNumber","aria-labelledby":"doi_number_label",onChange:s})}),a.jsx("h5",{id:"publication_type_label",className:"mb-1",children:"Publication Type"}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"publicationType",id:"publication_type_select",value:n.publicationType,className:"form-control","aria-labelledby":"publication_type_label",onChange:l=>s(l),children:[a.jsx("option",{value:"",children:"-- All --"}),t.publication_types.map((l,c)=>a.jsx("option",{value:l,children:l},`publication_type_${c}`))]})}),a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{className:"btn btn-primary me-2",onClick:r,children:"Submit"}),a.jsx("button",{className:"btn btn-secondary",onClick:o,children:"Reset"})]})]})})},Rg=()=>{const e=it(),t=pe(zM),[n,r]=w.useState([]),[o,s]=w.useState("0"),i=Array.from({length:t.last_page},(m,h)=>h),l=10,c={width:"50px",textAlign:"center"};w.useEffect(()=>{f()},[t]);const u=m=>{const h=parseInt(m);e(DM({current_page:m})),e(Nr(h))},d=m=>(event.preventDefault(),s("0"),u(m),!1),f=()=>{const m=[];if(t.last_page>l)if(t.current_page>4){m.push(1),m.push("spacer");for(var h=1;h>0;h--)t.current_page-h>1&&m.push(t.current_page-h);m.push(["current",t.current_page]);for(var h=1;h<2;h++)t.current_page+h<=t.last_page&&m.push(t.current_page+h);t.last_page-t.current_page>1&&(m.push("spacer"),m.push(t.last_page))}else[1,2,3,4,5].forEach(x=>{x==t.current_page?m.push(["current",x]):m.push(x)}),m.push("spacer"),m.push(t.last_page);else for(var h=1;h<=t.last_page;h++)h==t.current_page?m.push(["current",h]):m.push(h);r(m)},p=m=>{let h=m,x="";return typeof m=="object"?[h,x]=m:x=m,h=="spacer"?a.jsx("li",{className:"page-item disabled",children:a.jsx("span",{className:"page-link",style:c,children:". . ."})}):h=="current"?a.jsx("li",{className:"page-item active","aria-current":"page",children:a.jsx("span",{className:"page-link",style:c,children:x})}):a.jsx("li",{className:"page-item",children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(h),children:x})})},y=()=>a.jsx("li",{className:"page-item",children:a.jsxs("select",{className:"page-link",style:{...c,height:"100%"},value:o,onChange:m=>d(m.target.value),children:[a.jsx("option",{value:"0",children:"Go To"}),i.map(m=>a.jsx("option",{value:m+1,children:m+1},`page_option_${m}`))]})});return a.jsx("div",{children:a.jsx("nav",{"aria-label":"Pages for the table",children:a.jsxs("ul",{className:"pagination",children:[a.jsx("li",{className:`page-item ${t.current_page==1?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:{width:"50px",textAlign:"center"},onClick:()=>u(t.current_page-1),disabled:t.current_page==1,"aria-label":"Previous Page Button",children:"<"})}),n.map((m,h)=>a.jsx(je.Fragment,{children:p(m)},`page_${h}`)),t.last_page>l?y():"",a.jsx("li",{className:`page-item ${t.current_page==t.last_page?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(t.current_page+1),disabled:t.current_page==t.last_page,"aria-label":"Next Page Button",children:">"})})]})})})},GM=({apiUrl:e})=>{const t=it(),n=pe(UM),r=a.jsx("div",{className:"loadingDiv",children:"Loading ..."});return w.useEffect(()=>{t(MM())},[t]),a.jsx("div",{className:"container-fluid",children:a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-sm-3",children:a.jsx(KM,{})}),a.jsxs("div",{className:"col-sm-9",children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(Rg,{})})}),a.jsx("div",{className:"row",id:"publicationListRow",children:a.jsx("div",{className:"col",children:n?a.jsx(WM,{}):r})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(Rg,{})})})]})]})})},Uw=({id:e,type:t,checked:n,onChange:r})=>a.jsx("div",{className:"control-group",style:{marginBottom:"0px"},children:a.jsx("div",{className:"controls",children:a.jsxs("label",{htmlFor:e,className:"checkbox",children:[a.jsx("input",{onChange:()=>r(t.allocation_type_id),type:"checkbox",checked:n,id:e}),t.display_allocation_type]})})}),YM=({types:e,createData:t})=>{const[n,r]=w.useState(""),[o,s]=w.useState([]),i=async(u,d)=>{t(u,d),r(""),s([])};function l(u){let d=o;d.includes(u)?d=d.filter(f=>f!==u):d=[...d,u],s(d)}function c(){s(o.length===e.length?[]:[...e.map(d=>d.allocation_type_id)])}return a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Keyword"}),a.jsx("th",{children:"Allocation Type"}),a.jsx("td",{})]})}),a.jsx("tbody",{children:a.jsxs("tr",{children:[a.jsx("td",{style:{width:"150px"},children:a.jsx("input",{type:"text",value:n,className:"form-control",onChange:u=>r(u.target.value)})}),a.jsx("td",{children:a.jsxs("div",{className:"form-inline",children:[a.jsx("div",{className:"control-group",style:{marginBottom:"0px"},children:a.jsx("div",{className:"controls",children:a.jsxs("label",{htmlFor:"select-all-checkbox",className:"checkbox",children:[a.jsx("input",{onChange:()=>c(),type:"checkbox",checked:o.length===e.length,id:"select-all-checkbox"}),"Select All"]})})}),e.map(u=>a.jsx(Uw,{id:`id_create_alloc_type_${u.allocation_type_id}`,type:u,checked:o.includes(u.allocation_type_id),onChange:l},`create_keyword_alloc_t_${u.allocation_type_id}`))]})}),a.jsx("td",{style:{width:"50px"},children:a.jsx("button",{className:"btn btn-primary",type:"button",onClick:async()=>i(n,o),children:"Add"})})]})})]})},QM=({keyword:e,keywordAllocationTypeIds:t,types:n,saveData:r,deleteData:o})=>{const[s,i]=w.useState(!1),[l,c]=w.useState(e.keyword),[u,d]=w.useState(t),f=()=>{i(!1),r(e.keyword_id,l,u)},p=h=>{let x=u;x.includes(h)?x=x.filter(v=>v!==h):x=[...x,h],d(x)};let y="",m=e.keyword.toString();return s?(m=a.jsx("input",{type:"text",id:e.keyword_id,value:l,onChange:h=>c(h.target.value)}),y=n.map(h=>a.jsx(Uw,{checked:u.includes(h.allocation_type_id),id:`keyword_${e.keyword}_alloc_type_${h.allocation_type_id}`,onChange:p,type:h},`keyword_${e.keyword}_alloc_t_${h.allocation_type_id}`))):y=n.filter(h=>t.includes(h.allocation_type_id)).map(h=>h.display_allocation_type).join(", "),a.jsxs("tr",{children:[a.jsxs("td",{children:[" ",m," "]}),a.jsxs("td",{children:[" ",y," "]}),s?a.jsxs("td",{style:{width:"150px"},children:[a.jsx("button",{style:{marginRight:"5px"},className:"btn btn-warning btn-sm",onClick:()=>i(!1),children:"Cancel"}),a.jsx("button",{className:"btn btn-success btn-sm",onClick:async()=>{f()},children:"Save"})]}):a.jsxs("td",{style:{width:"150px"},children:[a.jsx("button",{style:{marginRight:"5px"},className:"btn btn-primary btn-sm",onClick:()=>i(!0),children:"Edit"}),a.jsx("button",{className:"btn btn-danger btn-sm",onClick:async()=>o(e.keyword_id),children:"Delete"})]})]})};function XM({allocationTypes:e}){const[t,n]=w.useState([]),[r,o]=w.useState([]),[s,i]=w.useState(""),[l,c]=w.useState(!0),u=async h=>{const v=(await h.json()).message??"Error: Changes not saved";h.ok&&await f(),i(v),c(h.ok)},d=async(h,x)=>{const v=await fetch("/keywords",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:JSON.stringify({value:h,allocation_types:x})});await u(v)},f=async()=>{r.length===0&&o(e);const x=await(await fetch("/keywords",{headers:{"Content-Type":"application/json",Accept:"application/json"}})).json();n(x)},p=async(h,x,v)=>{const g=await fetch(`/keywords/${h}`,{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:JSON.stringify({id:h,keyword:x,allocation_types:v})});await u(g)},y=async h=>{const x=await fetch(`/keywords/${h}`,{headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},method:"DELETE"});await u(x)};w.useEffect(()=>{f()},[]);let m=null;return s.length!==0&&(m=a.jsx(be,{color:l?"success":"warning",children:s})),a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"Type new keywords separated by semicolons, select the desired allocation types, and then submit."}),a.jsx(a.Fragment,{children:m}),a.jsx(YM,{types:r,createData:d},"add-keywords"),a.jsx("h3",{children:"Current Keywords"}),a.jsxs("table",{className:"table table-bordered",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Keyword"}),a.jsx("th",{children:"Allocation Types"}),a.jsx("td",{})]})}),a.jsx("tbody",{children:t.map(h=>a.jsx(QM,{keyword:h,keywordAllocationTypeIds:h.allocation_type_keywords.map(x=>x.allocation_type_id),types:r,saveData:p,deleteData:y},h.keyword_id))})]})]})}function ZM(e,{bootstrapFonts:t=!0,bootstrapVariables:n=!0,access:r=!1,baseUrl:o=null}={}){const s=e.attachShadow({mode:"open"}),i=document.createElement("div"),l=document.createElement("div"),c=document.createElement("div"),u=document.createElement("div"),d=document.createElement("link"),f=document.createElement("link"),p=document.createElement("link");return o=o??(typeof document>"u"?require("url").pathToFileURL(__filename).href:Rp&&Rp.src||new URL("xras-ui.cjs",document.baseURI).href).replace(/\/[^/]+$/,""),d.rel="stylesheet",d.href=`${o}/bootstrap.css`,f.rel="stylesheet",f.href=`${o}/xras-ui.css`,p.rel="stylesheet",p.href=`${o}/access.css`,c.appendChild(u),l.appendChild(c),i.appendChild(l),s.appendChild(d),s.appendChild(f),s.appendChild(p),s.appendChild(i),i.classList.add("bootstrap"),n&&l.classList.add("bootstrap-variables"),t&&(c.classList.add("bootstrap-fonts"),c.setAttribute("data-bs-theme","light")),u}function JM({target:e}){_t.createRoot(e).render(a.jsx(QC,{}))}function eD({availableResources:e,unavailableResources:t,canAdd:n,relativeUrlRoot:r,target:o}){_t.createRoot(o).render(a.jsx(mE,{availableResources:e,unavailableResources:t,canAdd:n,relativeUrlRoot:r}))}function tD({resourceId:e,target:t,setExternalSubmit:n,relativeUrlRoot:r}){_t.createRoot(t).render(a.jsx(_x,{resourceId:e,setExternalSubmit:n,relativeUrlRoot:r}))}function nD({target:e,username:t,routes:n}){Df(n);const r=Mo({reducer:{api:tR}});_t.createRoot(e).render(a.jsx(Ur,{store:r,children:a.jsx(cA,{username:t})}))}function rD({target:e,apiUrl:t}){const n=Mo({reducer:{projectsBrowser:jA},preloadedState:{projectsBrowser:{...vw,apiUrl:t}}});_t.createRoot(e).render(a.jsx(Ur,{store:n,children:a.jsx(NA,{})}))}function oD({target:e,apiUrl:t}){const n=Mo({reducer:{publicationsBrowser:qM},preloadedState:{publicationsBrowser:{...Dw,apiUrl:t}}});_t.createRoot(e).render(a.jsx(Ur,{store:n,children:a.jsx(GM,{apiUrl:t})}))}function Vw(){return Mo({reducer:{publications_store:z2}})}function sD({target:e,routes:t}){Df(t),_t.createRoot(e).render(a.jsx(Ur,{store:Vw(),children:a.jsx(Pw,{})}))}function iD({target:e,routes:t}){Df(t),_t.createRoot(e).render(a.jsx(Ur,{store:Vw(),children:a.jsx(U2,{...JSON.parse(e.dataset.publicationsSelectProps)})}))}function aD({target:e,catalogSources:t,onRamps:n,baseUrl:r}){const o=Mo({reducer:{resourceCatalog:tM}});_t.createRoot(e).render(a.jsx(Ur,{store:o,children:a.jsx(xM,{catalogSources:t,onRamps:n,baseUrl:r})}))}function lD({target:e,apiUrl:t,excludedCategories:n,excludedFilters:r,excludedResources:o,allowedCategories:s,allowedFilters:i}){const l=Mo({reducer:{resourceCatalog:kM}});_t.createRoot(e).render(a.jsx(Ur,{store:l,children:a.jsx(AM,{apiUrl:t,excludedCategories:n,excludedFilters:r,excludedResources:o,allowedCategories:s,allowedFilters:i})}))}function cD({allocationTypes:e,target:t}){_t.createRoot(t).render(a.jsx(XM,{allocationTypes:e}))}exports.allocationsMap=JM;exports.editResource=tD;exports.keywords=cD;exports.onRampsResourceCatalog=aD;exports.projects=nD;exports.projectsBrowser=rD;exports.publications=sD;exports.publicationsBrowser=oD;exports.publicationsSelect=iD;exports.resourceCatalog=lD;exports.resources=eD;exports.shadowTarget=ZM;
|
package/dist/xras-ui.js
CHANGED
|
@@ -21588,7 +21588,7 @@ function sA({ requestId: e, grantNumber: t }) {
|
|
|
21588
21588
|
}
|
|
21589
21589
|
) : null
|
|
21590
21590
|
] }) : null,
|
|
21591
|
-
r.isManager &&
|
|
21591
|
+
r.isManager && u.length > 0 && /* @__PURE__ */ a.jsxs(be, { color: "danger", children: [
|
|
21592
21592
|
"Some project personnel need to update their profiles. You will be unable to submit exchanges, renewals, and other actions until these issues are resolved:",
|
|
21593
21593
|
/* @__PURE__ */ a.jsx("br", {}),
|
|
21594
21594
|
/* @__PURE__ */ a.jsx("ul", { className: "fs-6 mb-0", children: u.map((d) => /* @__PURE__ */ a.jsxs("li", { children: [
|