diff --git a/assets/index-BHK3OXT5.js b/assets/index-CiMbNk0T.js similarity index 99% rename from assets/index-BHK3OXT5.js rename to assets/index-CiMbNk0T.js index c74aeec..ed44a4b 100644 --- a/assets/index-BHK3OXT5.js +++ b/assets/index-CiMbNk0T.js @@ -3967,7 +3967,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho */var ii=typeof Symbol=="function"&&Symbol.for,KM=ii?Symbol.for("react.element"):60103,JM=ii?Symbol.for("react.portal"):60106,H0=ii?Symbol.for("react.fragment"):60107,G0=ii?Symbol.for("react.strict_mode"):60108,W0=ii?Symbol.for("react.profiler"):60114,j0=ii?Symbol.for("react.provider"):60109,X0=ii?Symbol.for("react.context"):60110,QM=ii?Symbol.for("react.async_mode"):60111,$0=ii?Symbol.for("react.concurrent_mode"):60111,q0=ii?Symbol.for("react.forward_ref"):60112,Y0=ii?Symbol.for("react.suspense"):60113,v8=ii?Symbol.for("react.suspense_list"):60120,Z0=ii?Symbol.for("react.memo"):60115,K0=ii?Symbol.for("react.lazy"):60116,y8=ii?Symbol.for("react.block"):60121,_8=ii?Symbol.for("react.fundamental"):60117,x8=ii?Symbol.for("react.responder"):60118,w8=ii?Symbol.for("react.scope"):60119;function Rr(n){if(typeof n=="object"&&n!==null){var e=n.$$typeof;switch(e){case KM:switch(n=n.type,n){case QM:case $0:case H0:case W0:case G0:case Y0:return n;default:switch(n=n&&n.$$typeof,n){case X0:case q0:case K0:case Z0:case j0:return n;default:return e}}case JM:return e}}}function SN(n){return Rr(n)===$0}Jt.AsyncMode=QM;Jt.ConcurrentMode=$0;Jt.ContextConsumer=X0;Jt.ContextProvider=j0;Jt.Element=KM;Jt.ForwardRef=q0;Jt.Fragment=H0;Jt.Lazy=K0;Jt.Memo=Z0;Jt.Portal=JM;Jt.Profiler=W0;Jt.StrictMode=G0;Jt.Suspense=Y0;Jt.isAsyncMode=function(n){return SN(n)||Rr(n)===QM};Jt.isConcurrentMode=SN;Jt.isContextConsumer=function(n){return Rr(n)===X0};Jt.isContextProvider=function(n){return Rr(n)===j0};Jt.isElement=function(n){return typeof n=="object"&&n!==null&&n.$$typeof===KM};Jt.isForwardRef=function(n){return Rr(n)===q0};Jt.isFragment=function(n){return Rr(n)===H0};Jt.isLazy=function(n){return Rr(n)===K0};Jt.isMemo=function(n){return Rr(n)===Z0};Jt.isPortal=function(n){return Rr(n)===JM};Jt.isProfiler=function(n){return Rr(n)===W0};Jt.isStrictMode=function(n){return Rr(n)===G0};Jt.isSuspense=function(n){return Rr(n)===Y0};Jt.isValidElementType=function(n){return typeof n=="string"||typeof n=="function"||n===H0||n===$0||n===W0||n===G0||n===Y0||n===v8||typeof n=="object"&&n!==null&&(n.$$typeof===K0||n.$$typeof===Z0||n.$$typeof===j0||n.$$typeof===X0||n.$$typeof===q0||n.$$typeof===_8||n.$$typeof===x8||n.$$typeof===w8||n.$$typeof===y8)};Jt.typeOf=Rr;wN.exports=Jt;var S8=wN.exports,MN=S8,M8={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},E8={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},EN={};EN[MN.ForwardRef]=M8;EN[MN.Memo]=E8;var b8=!0;function T8(n,e,t){var i="";return t.split(" ").forEach(function(r){n[r]!==void 0?e.push(n[r]+";"):i+=r+" "}),i}var bN=function(e,t,i){var r=e.key+"-"+t.name;(i===!1||b8===!1)&&e.registered[r]===void 0&&(e.registered[r]=t.styles)},A8=function(e,t,i){bN(e,t,i);var r=e.key+"-"+t.name;if(e.inserted[t.name]===void 0){var s=t;do e.insert(t===s?"."+r:"",s,e.sheet,!0),s=s.next;while(s!==void 0)}};function C8(n){for(var e=0,t,i=0,r=n.length;r>=4;++i,r-=4)t=n.charCodeAt(i)&255|(n.charCodeAt(++i)&255)<<8|(n.charCodeAt(++i)&255)<<16|(n.charCodeAt(++i)&255)<<24,t=(t&65535)*1540483477+((t>>>16)*59797<<16),t^=t>>>24,e=(t&65535)*1540483477+((t>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(r){case 3:e^=(n.charCodeAt(i+2)&255)<<16;case 2:e^=(n.charCodeAt(i+1)&255)<<8;case 1:e^=n.charCodeAt(i)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var R8={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},P8=/[A-Z]|^ms/g,I8=/_EMO_([^_]+?)_([^]*?)_EMO_/g,TN=function(e){return e.charCodeAt(1)===45},fR=function(e){return e!=null&&typeof e!="boolean"},Ux=l8(function(n){return TN(n)?n:n.replace(P8,"-$&").toLowerCase()}),dR=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(I8,function(i,r,s){return Os={name:r,styles:s,next:Os},r})}return R8[e]!==1&&!TN(e)&&typeof t=="number"&&t!==0?t+"px":t};function ed(n,e,t){if(t==null)return"";if(t.__emotion_styles!==void 0)return t;switch(typeof t){case"boolean":return"";case"object":{if(t.anim===1)return Os={name:t.name,styles:t.styles,next:Os},t.name;if(t.styles!==void 0){var i=t.next;if(i!==void 0)for(;i!==void 0;)Os={name:i.name,styles:i.styles,next:Os},i=i.next;var r=t.styles+";";return r}return L8(n,e,t)}case"function":{if(n!==void 0){var s=Os,o=t(n);return Os=s,ed(n,e,o)}break}}return t}function L8(n,e,t){var i="";if(Array.isArray(t))for(var r=0;r({x:n,y:n});function X8(n){const{x:e,y:t,width:i,height:r}=n;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function RN(n){return IN(n)?(n.nodeName||"").toLowerCase():"#document"}function Io(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function PN(n){var e;return(e=(IN(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function IN(n){return n instanceof Node||n instanceof Io(n).Node}function $8(n){return n instanceof Element||n instanceof Io(n).Element}function nE(n){return n instanceof HTMLElement||n instanceof Io(n).HTMLElement}function mR(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Io(n).ShadowRoot}function LN(n){const{overflow:e,overflowX:t,overflowY:i,display:r}=iE(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(r)}function q8(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Y8(n){return["html","body","#document"].includes(RN(n))}function iE(n){return Io(n).getComputedStyle(n)}function Z8(n){if(RN(n)==="html")return n;const e=n.assignedSlot||n.parentNode||mR(n)&&n.host||PN(n);return mR(e)?e.host:e}function NN(n){const e=Z8(n);return Y8(e)?n.ownerDocument?n.ownerDocument.body:n.body:nE(e)&&LN(e)?e:NN(e)}function gv(n,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=NN(n),s=r===((i=n.ownerDocument)==null?void 0:i.body),o=Io(r);return s?e.concat(o,o.visualViewport||[],LN(r)?r:[],o.frameElement&&t?gv(o.frameElement):[]):e.concat(r,gv(r,[],t))}function K8(n){const e=iE(n);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=nE(n),s=r?n.offsetWidth:t,o=r?n.offsetHeight:i,a=pv(t)!==s||pv(i)!==o;return a&&(t=s,i=o),{width:t,height:i,$:a}}function rE(n){return $8(n)?n:n.contextElement}function gR(n){const e=rE(n);if(!nE(e))return mv(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:s}=K8(e);let o=(s?pv(t.width):t.width)/i,a=(s?pv(t.height):t.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const J8=mv(0);function Q8(n){const e=Io(n);return!q8()||!e.visualViewport?J8:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function e9(n,e,t){return!1}function vR(n,e,t,i){e===void 0&&(e=!1);const r=n.getBoundingClientRect(),s=rE(n);let o=mv(1);e&&(o=gR(n));const a=e9()?Q8(s):mv(0);let l=(r.left+a.x)/o.x,u=(r.top+a.y)/o.y,f=r.width/o.x,d=r.height/o.y;if(s){const p=Io(s),g=i;let v=p,x=v.frameElement;for(;x&&i&&g!==v;){const _=gR(x),m=x.getBoundingClientRect(),w=iE(x),S=m.left+(x.clientLeft+parseFloat(w.paddingLeft))*_.x,b=m.top+(x.clientTop+parseFloat(w.paddingTop))*_.y;l*=_.x,u*=_.y,f*=_.x,d*=_.y,l+=S,u+=b,v=Io(x),x=v.frameElement}}return X8({width:f,height:d,x:l,y:u})}function t9(n,e){let t=null,i;const r=PN(n);function s(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:u,top:f,width:d,height:p}=n.getBoundingClientRect();if(a||e(),!d||!p)return;const g=km(f),v=km(r.clientWidth-(u+d)),x=km(r.clientHeight-(f+p)),_=km(u),w={rootMargin:-g+"px "+-v+"px "+-x+"px "+-_+"px",threshold:j8(0,W8(1,l))||1};let S=!0;function b(R){const A=R[0].intersectionRatio;if(A!==l){if(!S)return o();A?o(!1,A):i=setTimeout(()=>{o(!1,1e-7)},1e3)}S=!1}try{t=new IntersectionObserver(b,{...w,root:r.ownerDocument})}catch{t=new IntersectionObserver(b,w)}t.observe(n)}return o(!0),s}function n9(n,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,u=rE(n),f=r||s?[...u?gv(u):[],...gv(e)]:[];f.forEach(m=>{r&&m.addEventListener("scroll",t,{passive:!0}),s&&m.addEventListener("resize",t)});const d=u&&a?t9(u,t):null;let p=-1,g=null;o&&(g=new ResizeObserver(m=>{let[w]=m;w&&w.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(e)})),t()}),u&&!l&&g.observe(u),g.observe(e));let v,x=l?vR(n):null;l&&_();function _(){const m=vR(n);x&&(m.x!==x.x||m.y!==x.y||m.width!==x.width||m.height!==x.height)&&t(),x=m,v=requestAnimationFrame(_)}return t(),()=>{var m;f.forEach(w=>{r&&w.removeEventListener("scroll",t),s&&w.removeEventListener("resize",t)}),d==null||d(),(m=g)==null||m.disconnect(),g=null,l&&cancelAnimationFrame(v)}}var VS=Y.useLayoutEffect,i9=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],vv=function(){};function r9(n,e){return e?e[0]==="-"?n+e:n+"__"+e:n}function s9(n,e){for(var t=arguments.length,i=new Array(t>2?t-2:0),r=2;r-1}function o9(n){return J0(n)?window.innerHeight:n.clientHeight}function ON(n){return J0(n)?window.pageYOffset:n.scrollTop}function yv(n,e){if(J0(n)){window.scrollTo(0,e);return}n.scrollTop=e}function a9(n){var e=getComputedStyle(n),t=e.position==="absolute",i=/(auto|scroll)/;if(e.position==="fixed")return document.documentElement;for(var r=n;r=r.parentElement;)if(e=getComputedStyle(r),!(t&&e.position==="static")&&i.test(e.overflow+e.overflowY+e.overflowX))return r;return document.documentElement}function l9(n,e,t,i){return t*((n=n/i-1)*n*n+1)+e}function Fm(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:vv,r=ON(n),s=e-r,o=10,a=0;function l(){a+=o;var u=l9(a,r,s,t);yv(n,u),at.bottom?yv(n,Math.min(e.offsetTop+e.clientHeight-n.offsetHeight+r,n.scrollHeight)):i.top-r1?t-1:0),r=1;r=v)return{placement:"bottom",maxHeight:e};if(I>=v&&!o)return s&&Fm(l,E,z),{placement:"bottom",maxHeight:e};if(!o&&I>=i||o&&C>=i){s&&Fm(l,E,z);var O=o?C-b:I-b;return{placement:"bottom",maxHeight:O}}if(r==="auto"||o){var q=e,j=o?A:L;return j>=i&&(q=Math.min(j-b-a,e)),{placement:"top",maxHeight:q}}if(r==="bottom")return s&&yv(l,E),{placement:"bottom",maxHeight:e};break;case"top":if(A>=v)return{placement:"top",maxHeight:e};if(L>=v&&!o)return s&&Fm(l,N,z),{placement:"top",maxHeight:e};if(!o&&L>=i||o&&A>=i){var Q=e;return(!o&&L>=i||o&&A>=i)&&(Q=o?A-R:L-R),s&&Fm(l,N,z),{placement:"top",maxHeight:Q}}return{placement:"bottom",maxHeight:e};default:throw new Error('Invalid placement provided "'.concat(r,'".'))}return u}function _9(n){var e={bottom:"top",top:"bottom"};return n?e[n]:"bottom"}var FN=function(e){return e==="auto"?"bottom":e},x9=function(e,t){var i,r=e.placement,s=e.theme,o=s.borderRadius,a=s.spacing,l=s.colors;return st((i={label:"menu"},zh(i,_9(r),"100%"),zh(i,"position","absolute"),zh(i,"width","100%"),zh(i,"zIndex",1),i),t?{}:{backgroundColor:l.neutral0,borderRadius:o,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:a.menuGutter,marginTop:a.menuGutter})},UN=Y.createContext(null),w9=function(e){var t=e.children,i=e.minMenuHeight,r=e.maxMenuHeight,s=e.menuPlacement,o=e.menuPosition,a=e.menuShouldScrollIntoView,l=e.theme,u=Y.useContext(UN)||{},f=u.setPortalPlacement,d=Y.useRef(null),p=Y.useState(r),g=Mo(p,2),v=g[0],x=g[1],_=Y.useState(null),m=Mo(_,2),w=m[0],S=m[1],b=l.spacing.controlHeight;return VS(function(){var R=d.current;if(R){var A=o==="fixed",C=a&&!A,L=y9({maxHeight:r,menuEl:R,minHeight:i,placement:s,shouldScroll:C,isFixedPosition:A,controlHeight:b});x(L.maxHeight),S(L.placement),f==null||f(L.placement)}},[r,s,o,a,i,f,b]),t({ref:d,placerProps:st(st({},e),{},{placement:w||FN(s),maxHeight:v})})},S9=function(e){var t=e.children,i=e.innerRef,r=e.innerProps;return nt("div",ct({},Cn(e,"menu",{menu:!0}),{ref:i},r),t)},M9=S9,E9=function(e,t){var i=e.maxHeight,r=e.theme.spacing.baseUnit;return st({maxHeight:i,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},t?{}:{paddingBottom:r,paddingTop:r})},b9=function(e){var t=e.children,i=e.innerProps,r=e.innerRef,s=e.isMulti;return nt("div",ct({},Cn(e,"menuList",{"menu-list":!0,"menu-list--is-multi":s}),{ref:r},i),t)},zN=function(e,t){var i=e.theme,r=i.spacing.baseUnit,s=i.colors;return st({textAlign:"center"},t?{}:{color:s.neutral40,padding:"".concat(r*2,"px ").concat(r*3,"px")})},T9=zN,A9=zN,C9=function(e){var t=e.children,i=t===void 0?"No options":t,r=e.innerProps,s=Do(e,g9);return nt("div",ct({},Cn(st(st({},s),{},{children:i,innerProps:r}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),r),i)},R9=function(e){var t=e.children,i=t===void 0?"Loading...":t,r=e.innerProps,s=Do(e,v9);return nt("div",ct({},Cn(st(st({},s),{},{children:i,innerProps:r}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),r),i)},P9=function(e){var t=e.rect,i=e.offset,r=e.position;return{left:t.left,position:r,top:i,width:t.width,zIndex:1}},I9=function(e){var t=e.appendTo,i=e.children,r=e.controlElement,s=e.innerProps,o=e.menuPlacement,a=e.menuPosition,l=Y.useRef(null),u=Y.useRef(null),f=Y.useState(FN(o)),d=Mo(f,2),p=d[0],g=d[1],v=Y.useMemo(function(){return{setPortalPlacement:g}},[]),x=Y.useState(null),_=Mo(x,2),m=_[0],w=_[1],S=Y.useCallback(function(){if(r){var C=u9(r),L=a==="fixed"?0:window.pageYOffset,I=C[p]+L;(I!==(m==null?void 0:m.offset)||C.left!==(m==null?void 0:m.rect.left)||C.width!==(m==null?void 0:m.rect.width))&&w({offset:I,rect:C})}},[r,a,p,m==null?void 0:m.offset,m==null?void 0:m.rect.left,m==null?void 0:m.rect.width]);VS(function(){S()},[S]);var b=Y.useCallback(function(){typeof u.current=="function"&&(u.current(),u.current=null),r&&l.current&&(u.current=n9(r,l.current,S,{elementResize:"ResizeObserver"in window}))},[r,S]);VS(function(){b()},[b]);var R=Y.useCallback(function(C){l.current=C,b()},[b]);if(!t&&a!=="fixed"||!m)return null;var A=nt("div",ct({ref:R},Cn(st(st({},e),{},{offset:m.offset,position:a,rect:m.rect}),"menuPortal",{"menu-portal":!0}),s),i);return nt(UN.Provider,{value:v},t?EI.createPortal(A,t):A)},L9=function(e){var t=e.isDisabled,i=e.isRtl;return{label:"container",direction:i?"rtl":void 0,pointerEvents:t?"none":void 0,position:"relative"}},N9=function(e){var t=e.children,i=e.innerProps,r=e.isDisabled,s=e.isRtl;return nt("div",ct({},Cn(e,"container",{"--is-disabled":r,"--is-rtl":s}),i),t)},D9=function(e,t){var i=e.theme.spacing,r=e.isMulti,s=e.hasValue,o=e.selectProps.controlShouldRenderValue;return st({alignItems:"center",display:r&&s&&o?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},t?{}:{padding:"".concat(i.baseUnit/2,"px ").concat(i.baseUnit*2,"px")})},O9=function(e){var t=e.children,i=e.innerProps,r=e.isMulti,s=e.hasValue;return nt("div",ct({},Cn(e,"valueContainer",{"value-container":!0,"value-container--is-multi":r,"value-container--has-value":s}),i),t)},k9=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},F9=function(e){var t=e.children,i=e.innerProps;return nt("div",ct({},Cn(e,"indicatorsContainer",{indicators:!0}),i),t)},wR,U9=["size"],z9=["innerProps","isRtl","size"],B9={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},BN=function(e){var t=e.size,i=Do(e,U9);return nt("svg",ct({height:t,width:t,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:B9},i))},sE=function(e){return nt(BN,ct({size:20},e),nt("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"}))},VN=function(e){return nt(BN,ct({size:20},e),nt("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"}))},HN=function(e,t){var i=e.isFocused,r=e.theme,s=r.spacing.baseUnit,o=r.colors;return st({label:"indicatorContainer",display:"flex",transition:"color 150ms"},t?{}:{color:i?o.neutral60:o.neutral20,padding:s*2,":hover":{color:i?o.neutral80:o.neutral40}})},V9=HN,H9=function(e){var t=e.children,i=e.innerProps;return nt("div",ct({},Cn(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),i),t||nt(VN,null))},G9=HN,W9=function(e){var t=e.children,i=e.innerProps;return nt("div",ct({},Cn(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),i),t||nt(sE,null))},j9=function(e,t){var i=e.isDisabled,r=e.theme,s=r.spacing.baseUnit,o=r.colors;return st({label:"indicatorSeparator",alignSelf:"stretch",width:1},t?{}:{backgroundColor:i?o.neutral10:o.neutral20,marginBottom:s*2,marginTop:s*2})},X9=function(e){var t=e.innerProps;return nt("span",ct({},t,Cn(e,"indicatorSeparator",{"indicator-separator":!0})))},$9=H8(wR||(wR=G8([` 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } -`]))),q9=function(e,t){var i=e.isFocused,r=e.size,s=e.theme,o=s.colors,a=s.spacing.baseUnit;return st({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"},t?{}:{color:i?o.neutral60:o.neutral20,padding:a*2})},zx=function(e){var t=e.delay,i=e.offset;return nt("span",{css:tE({animation:"".concat($9," 1s ease-in-out ").concat(t,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:i?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},Y9=function(e){var t=e.innerProps,i=e.isRtl,r=e.size,s=r===void 0?4:r,o=Do(e,z9);return nt("div",ct({},Cn(st(st({},o),{},{innerProps:t,isRtl:i,size:s}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),t),nt(zx,{delay:0,offset:i}),nt(zx,{delay:160,offset:!0}),nt(zx,{delay:320,offset:!i}))},Z9=function(e,t){var i=e.isDisabled,r=e.isFocused,s=e.theme,o=s.colors,a=s.borderRadius,l=s.spacing;return st({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},t?{}:{backgroundColor:i?o.neutral5:o.neutral0,borderColor:i?o.neutral10:r?o.primary:o.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px ".concat(o.primary):void 0,"&:hover":{borderColor:r?o.primary:o.neutral30}})},K9=function(e){var t=e.children,i=e.isDisabled,r=e.isFocused,s=e.innerRef,o=e.innerProps,a=e.menuIsOpen;return nt("div",ct({ref:s},Cn(e,"control",{control:!0,"control--is-disabled":i,"control--is-focused":r,"control--menu-is-open":a}),o,{"aria-disabled":i||void 0}),t)},J9=K9,Q9=["data"],ej=function(e,t){var i=e.theme.spacing;return t?{}:{paddingBottom:i.baseUnit*2,paddingTop:i.baseUnit*2}},tj=function(e){var t=e.children,i=e.cx,r=e.getStyles,s=e.getClassNames,o=e.Heading,a=e.headingProps,l=e.innerProps,u=e.label,f=e.theme,d=e.selectProps;return nt("div",ct({},Cn(e,"group",{group:!0}),l),nt(o,ct({},a,{selectProps:d,theme:f,getStyles:r,getClassNames:s,cx:i}),u),nt("div",null,t))},nj=function(e,t){var i=e.theme,r=i.colors,s=i.spacing;return st({label:"group",cursor:"default",display:"block"},t?{}:{color:r.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:s.baseUnit*3,paddingRight:s.baseUnit*3,textTransform:"uppercase"})},ij=function(e){var t=DN(e);t.data;var i=Do(t,Q9);return nt("div",ct({},Cn(e,"groupHeading",{"group-heading":!0}),i))},rj=tj,sj=["innerRef","isDisabled","isHidden","inputClassName"],oj=function(e,t){var i=e.isDisabled,r=e.value,s=e.theme,o=s.spacing,a=s.colors;return st(st({visibility:i?"hidden":"visible",transform:r?"translateZ(0)":""},aj),t?{}:{margin:o.baseUnit/2,paddingBottom:o.baseUnit/2,paddingTop:o.baseUnit/2,color:a.neutral80})},GN={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},aj={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":st({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},GN)},lj=function(e){return st({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},GN)},uj=function(e){var t=e.cx,i=e.value,r=DN(e),s=r.innerRef,o=r.isDisabled,a=r.isHidden,l=r.inputClassName,u=Do(r,sj);return nt("div",ct({},Cn(e,"input",{"input-container":!0}),{"data-value":i||""}),nt("input",ct({className:t({input:!0},l),ref:s,style:lj(a),disabled:o},u)))},cj=uj,hj=function(e,t){var i=e.theme,r=i.spacing,s=i.borderRadius,o=i.colors;return st({label:"multiValue",display:"flex",minWidth:0},t?{}:{backgroundColor:o.neutral10,borderRadius:s/2,margin:r.baseUnit/2})},fj=function(e,t){var i=e.theme,r=i.borderRadius,s=i.colors,o=e.cropWithEllipsis;return st({overflow:"hidden",textOverflow:o||o===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},t?{}:{borderRadius:r/2,color:s.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},dj=function(e,t){var i=e.theme,r=i.spacing,s=i.borderRadius,o=i.colors,a=e.isFocused;return st({alignItems:"center",display:"flex"},t?{}:{borderRadius:s/2,backgroundColor:a?o.dangerLight:void 0,paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:o.dangerLight,color:o.danger}})},WN=function(e){var t=e.children,i=e.innerProps;return nt("div",i,t)},pj=WN,mj=WN;function gj(n){var e=n.children,t=n.innerProps;return nt("div",ct({role:"button"},t),e||nt(sE,{size:14}))}var vj=function(e){var t=e.children,i=e.components,r=e.data,s=e.innerProps,o=e.isDisabled,a=e.removeProps,l=e.selectProps,u=i.Container,f=i.Label,d=i.Remove;return nt(u,{data:r,innerProps:st(st({},Cn(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":o})),s),selectProps:l},nt(f,{data:r,innerProps:st({},Cn(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},t),nt(d,{data:r,innerProps:st(st({},Cn(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(t||"option")},a),selectProps:l}))},yj=vj,_j=function(e,t){var i=e.isDisabled,r=e.isFocused,s=e.isSelected,o=e.theme,a=o.spacing,l=o.colors;return st({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},t?{}:{backgroundColor:s?l.primary:r?l.primary25:"transparent",color:i?l.neutral20:s?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:i?void 0:s?l.primary:l.primary50}})},xj=function(e){var t=e.children,i=e.isDisabled,r=e.isFocused,s=e.isSelected,o=e.innerRef,a=e.innerProps;return nt("div",ct({},Cn(e,"option",{option:!0,"option--is-disabled":i,"option--is-focused":r,"option--is-selected":s}),{ref:o,"aria-disabled":i},a),t)},wj=xj,Sj=function(e,t){var i=e.theme,r=i.spacing,s=i.colors;return st({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},t?{}:{color:s.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},Mj=function(e){var t=e.children,i=e.innerProps;return nt("div",ct({},Cn(e,"placeholder",{placeholder:!0}),i),t)},Ej=Mj,bj=function(e,t){var i=e.isDisabled,r=e.theme,s=r.spacing,o=r.colors;return st({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t?{}:{color:i?o.neutral40:o.neutral80,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},Tj=function(e){var t=e.children,i=e.isDisabled,r=e.innerProps;return nt("div",ct({},Cn(e,"singleValue",{"single-value":!0,"single-value--is-disabled":i}),r),t)},Aj=Tj,Cj={ClearIndicator:W9,Control:J9,DropdownIndicator:H9,DownChevron:VN,CrossIcon:sE,Group:rj,GroupHeading:ij,IndicatorsContainer:F9,IndicatorSeparator:X9,Input:cj,LoadingIndicator:Y9,Menu:M9,MenuList:b9,MenuPortal:I9,LoadingMessage:R9,NoOptionsMessage:C9,MultiValue:yj,MultiValueContainer:pj,MultiValueLabel:mj,MultiValueRemove:gj,Option:wj,Placeholder:Ej,SelectContainer:N9,SingleValue:Aj,ValueContainer:O9},Rj=function(e){return st(st({},Cj),e.components)},SR=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function Pj(n,e){return!!(n===e||SR(n)&&SR(e))}function Ij(n,e){if(n.length!==e.length)return!1;for(var t=0;t1?"s":""," ").concat(s.join(","),", selected.");case"select-option":return o?"option ".concat(r," is disabled. Select another option."):"option ".concat(r,", selected.");default:return""}},onFocus:function(e){var t=e.context,i=e.focused,r=e.options,s=e.label,o=s===void 0?"":s,a=e.selectValue,l=e.isDisabled,u=e.isSelected,f=e.isAppleDevice,d=function(x,_){return x&&x.length?"".concat(x.indexOf(_)+1," of ").concat(x.length):""};if(t==="value"&&a)return"value ".concat(o," focused, ").concat(d(a,i),".");if(t==="menu"&&f){var p=l?" disabled":"",g="".concat(u?" selected":"").concat(p);return"".concat(o).concat(g,", ").concat(d(r,i),".")}return""},onFilter:function(e){var t=e.inputValue,i=e.resultsMessage;return"".concat(i).concat(t?" for search term "+t:"",".")}},kj=function(e){var t=e.ariaSelection,i=e.focusedOption,r=e.focusedValue,s=e.focusableOptions,o=e.isFocused,a=e.selectValue,l=e.selectProps,u=e.id,f=e.isAppleDevice,d=l.ariaLiveMessages,p=l.getOptionLabel,g=l.inputValue,v=l.isMulti,x=l.isOptionDisabled,_=l.isSearchable,m=l.menuIsOpen,w=l.options,S=l.screenReaderStatus,b=l.tabSelectsValue,R=l.isLoading,A=l["aria-label"],C=l["aria-live"],L=Y.useMemo(function(){return st(st({},Oj),d||{})},[d]),I=Y.useMemo(function(){var j="";if(t&&L.onChange){var Q=t.option,oe=t.options,k=t.removedValue,W=t.removedValues,G=t.value,ne=function(Qe){return Array.isArray(Qe)?null:Qe},me=k||Q||ne(G),_e=me?p(me):"",J=oe||W||void 0,pe=J?J.map(p):[],Me=st({isDisabled:me&&x(me,a),label:_e,labels:pe},t);j=L.onChange(Me)}return j},[t,L,x,a,p]),E=Y.useMemo(function(){var j="",Q=i||r,oe=!!(i&&a&&a.includes(i));if(Q&&L.onFocus){var k={focused:Q,label:p(Q),isDisabled:x(Q,a),isSelected:oe,options:s,context:Q===i?"menu":"value",selectValue:a,isAppleDevice:f};j=L.onFocus(k)}return j},[i,r,p,x,L,s,a,f]),N=Y.useMemo(function(){var j="";if(m&&w.length&&!R&&L.onFilter){var Q=S({count:s.length});j=L.onFilter({inputValue:g,resultsMessage:Q})}return j},[s,g,m,L,w,S,R]),z=(t==null?void 0:t.action)==="initial-input-focus",O=Y.useMemo(function(){var j="";if(L.guidance){var Q=r?"value":m?"menu":"input";j=L.guidance({"aria-label":A,context:Q,isDisabled:i&&x(i,a),isMulti:v,isSearchable:_,tabSelectsValue:b,isInitialFocus:z})}return j},[A,i,r,v,x,_,m,L,a,b,z]),q=nt(Y.Fragment,null,nt("span",{id:"aria-selection"},I),nt("span",{id:"aria-focused"},E),nt("span",{id:"aria-results"},N),nt("span",{id:"aria-guidance"},O));return nt(Y.Fragment,null,nt(MR,{id:u},z&&q),nt(MR,{"aria-live":C,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},o&&!z&&q))},Fj=kj,HS=[{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źẑżžẓẕƶȥɀⱬꝣ"}],Uj=new RegExp("["+HS.map(function(n){return n.letters}).join("")+"]","g"),jN={};for(var Bx=0;Bx-1}},Hj=["innerRef"];function Gj(n){var e=n.innerRef,t=Do(n,Hj),i=m9(t,"onExited","in","enter","exit","appear");return nt("input",ct({ref:e},i,{css:tE({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 Wj=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function jj(n){var e=n.isEnabled,t=n.onBottomArrive,i=n.onBottomLeave,r=n.onTopArrive,s=n.onTopLeave,o=Y.useRef(!1),a=Y.useRef(!1),l=Y.useRef(0),u=Y.useRef(null),f=Y.useCallback(function(_,m){if(u.current!==null){var w=u.current,S=w.scrollTop,b=w.scrollHeight,R=w.clientHeight,A=u.current,C=m>0,L=b-R-S,I=!1;L>m&&o.current&&(i&&i(_),o.current=!1),C&&a.current&&(s&&s(_),a.current=!1),C&&m>L?(t&&!o.current&&t(_),A.scrollTop=b,I=!0,o.current=!0):!C&&-m>S&&(r&&!a.current&&r(_),A.scrollTop=0,I=!0,a.current=!0),I&&Wj(_)}},[t,i,r,s]),d=Y.useCallback(function(_){f(_,_.deltaY)},[f]),p=Y.useCallback(function(_){l.current=_.changedTouches[0].clientY},[]),g=Y.useCallback(function(_){var m=l.current-_.changedTouches[0].clientY;f(_,m)},[f]),v=Y.useCallback(function(_){if(_){var m=f9?{passive:!1}:!1;_.addEventListener("wheel",d,m),_.addEventListener("touchstart",p,m),_.addEventListener("touchmove",g,m)}},[g,p,d]),x=Y.useCallback(function(_){_&&(_.removeEventListener("wheel",d,!1),_.removeEventListener("touchstart",p,!1),_.removeEventListener("touchmove",g,!1))},[g,p,d]);return Y.useEffect(function(){if(e){var _=u.current;return v(_),function(){x(_)}}},[e,v,x]),function(_){u.current=_}}var bR=["boxSizing","height","overflow","paddingRight","position"],TR={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function AR(n){n.preventDefault()}function CR(n){n.stopPropagation()}function RR(){var n=this.scrollTop,e=this.scrollHeight,t=n+this.offsetHeight;n===0?this.scrollTop=1:t===e&&(this.scrollTop=n-1)}function PR(){return"ontouchstart"in window||navigator.maxTouchPoints}var IR=!!(typeof window<"u"&&window.document&&window.document.createElement),Ih=0,Au={capture:!1,passive:!1};function Xj(n){var e=n.isEnabled,t=n.accountForScrollbars,i=t===void 0?!0:t,r=Y.useRef({}),s=Y.useRef(null),o=Y.useCallback(function(l){if(IR){var u=document.body,f=u&&u.style;if(i&&bR.forEach(function(v){var x=f&&f[v];r.current[v]=x}),i&&Ih<1){var d=parseInt(r.current.paddingRight,10)||0,p=document.body?document.body.clientWidth:0,g=window.innerWidth-p+d||0;Object.keys(TR).forEach(function(v){var x=TR[v];f&&(f[v]=x)}),f&&(f.paddingRight="".concat(g,"px"))}u&&PR()&&(u.addEventListener("touchmove",AR,Au),l&&(l.addEventListener("touchstart",RR,Au),l.addEventListener("touchmove",CR,Au))),Ih+=1}},[i]),a=Y.useCallback(function(l){if(IR){var u=document.body,f=u&&u.style;Ih=Math.max(Ih-1,0),i&&Ih<1&&bR.forEach(function(d){var p=r.current[d];f&&(f[d]=p)}),u&&PR()&&(u.removeEventListener("touchmove",AR,Au),l&&(l.removeEventListener("touchstart",RR,Au),l.removeEventListener("touchmove",CR,Au)))}},[i]);return Y.useEffect(function(){if(e){var l=s.current;return o(l),function(){a(l)}}},[e,o,a]),function(l){s.current=l}}var $j=function(e){var t=e.target;return t.ownerDocument.activeElement&&t.ownerDocument.activeElement.blur()},qj={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function Yj(n){var e=n.children,t=n.lockEnabled,i=n.captureEnabled,r=i===void 0?!0:i,s=n.onBottomArrive,o=n.onBottomLeave,a=n.onTopArrive,l=n.onTopLeave,u=jj({isEnabled:r,onBottomArrive:s,onBottomLeave:o,onTopArrive:a,onTopLeave:l}),f=Xj({isEnabled:t}),d=function(g){u(g),f(g)};return nt(Y.Fragment,null,t&&nt("div",{onClick:$j,css:qj}),e(d))}var Zj={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},Kj=function(e){var t=e.name,i=e.onFocus;return nt("input",{required:!0,name:t,tabIndex:-1,"aria-hidden":"true",onFocus:i,css:Zj,value:"",onChange:function(){}})},Jj=Kj;function oE(n){var e;return typeof window<"u"&&window.navigator!=null?n.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function Qj(){return oE(/^iPhone/i)}function $N(){return oE(/^Mac/i)}function e7(){return oE(/^iPad/i)||$N()&&navigator.maxTouchPoints>1}function t7(){return Qj()||e7()}function n7(){return $N()||t7()}var i7=function(e){return e.label},r7=function(e){return e.label},s7=function(e){return e.value},o7=function(e){return!!e.isDisabled},a7={clearIndicator:G9,container:L9,control:Z9,dropdownIndicator:V9,group:ej,groupHeading:nj,indicatorsContainer:k9,indicatorSeparator:j9,input:oj,loadingIndicator:q9,loadingMessage:A9,menu:x9,menuList:E9,menuPortal:P9,multiValue:hj,multiValueLabel:fj,multiValueRemove:dj,noOptionsMessage:T9,option:_j,placeholder:Sj,singleValue:bj,valueContainer:D9},l7={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%)"},u7=4,qN=4,c7=38,h7=qN*2,f7={baseUnit:qN,controlHeight:c7,menuGutter:h7},Gx={borderRadius:u7,colors:l7,spacing:f7},d7={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:xR(),captureMenuScroll:!xR(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:Vj(),formatGroupLabel:i7,getOptionLabel:r7,getOptionValue:s7,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:o7,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!c9(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var t=e.count;return"".concat(t," result").concat(t!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function LR(n,e,t,i){var r=KN(n,e,t),s=JN(n,e,t),o=ZN(n,e),a=_v(n,e);return{type:"option",data:e,isDisabled:r,isSelected:s,label:o,value:a,index:i}}function yg(n,e){return n.options.map(function(t,i){if("options"in t){var r=t.options.map(function(o,a){return LR(n,o,e,a)}).filter(function(o){return DR(n,o)});return r.length>0?{type:"group",data:t,options:r,index:i}:void 0}var s=LR(n,t,e,i);return DR(n,s)?s:void 0}).filter(d9)}function YN(n){return n.reduce(function(e,t){return t.type==="group"?e.push.apply(e,$M(t.options.map(function(i){return i.data}))):e.push(t.data),e},[])}function NR(n,e){return n.reduce(function(t,i){return i.type==="group"?t.push.apply(t,$M(i.options.map(function(r){return{data:r.data,id:"".concat(e,"-").concat(i.index,"-").concat(r.index)}}))):t.push({data:i.data,id:"".concat(e,"-").concat(i.index)}),t},[])}function p7(n,e){return YN(yg(n,e))}function DR(n,e){var t=n.inputValue,i=t===void 0?"":t,r=e.data,s=e.isSelected,o=e.label,a=e.value;return(!eD(n)||!s)&&QN(n,{label:o,value:a,data:r},i)}function m7(n,e){var t=n.focusedValue,i=n.selectValue,r=i.indexOf(t);if(r>-1){var s=e.indexOf(t);if(s>-1)return t;if(r-1?t:e[0]}var Wx=function(e,t){var i,r=(i=e.find(function(s){return s.data===t}))===null||i===void 0?void 0:i.id;return r||null},ZN=function(e,t){return e.getOptionLabel(t)},_v=function(e,t){return e.getOptionValue(t)};function KN(n,e,t){return typeof n.isOptionDisabled=="function"?n.isOptionDisabled(e,t):!1}function JN(n,e,t){if(t.indexOf(e)>-1)return!0;if(typeof n.isOptionSelected=="function")return n.isOptionSelected(e,t);var i=_v(n,e);return t.some(function(r){return _v(n,r)===i})}function QN(n,e,t){return n.filterOption?n.filterOption(e,t):!0}var eD=function(e){var t=e.hideSelectedOptions,i=e.isMulti;return t===void 0?i:t},v7=1,tD=function(n){DW(t,n);var e=FW(t);function t(i){var r;if(LW(this,t),r=e.call(this,i),r.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:""},r.blockOptionHover=!1,r.isComposing=!1,r.commonProps=void 0,r.initialTouchX=0,r.initialTouchY=0,r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.isAppleDevice=n7(),r.controlRef=null,r.getControlRef=function(l){r.controlRef=l},r.focusedOptionRef=null,r.getFocusedOptionRef=function(l){r.focusedOptionRef=l},r.menuListRef=null,r.getMenuListRef=function(l){r.menuListRef=l},r.inputRef=null,r.getInputRef=function(l){r.inputRef=l},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(l,u){var f=r.props,d=f.onChange,p=f.name;u.name=p,r.ariaOnChange(l,u),d(l,u)},r.setValue=function(l,u,f){var d=r.props,p=d.closeMenuOnSelect,g=d.isMulti,v=d.inputValue;r.onInputChange("",{action:"set-value",prevInputValue:v}),p&&(r.setState({inputIsHiddenAfterUpdate:!g}),r.onMenuClose()),r.setState({clearFocusValueOnUpdate:!0}),r.onChange(l,{action:u,option:f})},r.selectOption=function(l){var u=r.props,f=u.blurInputOnSelect,d=u.isMulti,p=u.name,g=r.state.selectValue,v=d&&r.isOptionSelected(l,g),x=r.isOptionDisabled(l,g);if(v){var _=r.getOptionValue(l);r.setValue(g.filter(function(m){return r.getOptionValue(m)!==_}),"deselect-option",l)}else if(!x)d?r.setValue([].concat($M(g),[l]),"select-option",l):r.setValue(l,"select-option");else{r.ariaOnChange(l,{action:"select-option",option:l,name:p});return}f&&r.blurInput()},r.removeValue=function(l){var u=r.props.isMulti,f=r.state.selectValue,d=r.getOptionValue(l),p=f.filter(function(v){return r.getOptionValue(v)!==d}),g=zm(u,p,p[0]||null);r.onChange(g,{action:"remove-value",removedValue:l}),r.focusInput()},r.clearValue=function(){var l=r.state.selectValue;r.onChange(zm(r.props.isMulti,[],null),{action:"clear",removedValues:l})},r.popValue=function(){var l=r.props.isMulti,u=r.state.selectValue,f=u[u.length-1],d=u.slice(0,u.length-1),p=zm(l,d,d[0]||null);r.onChange(p,{action:"pop-value",removedValue:f})},r.getFocusedOptionId=function(l){return Wx(r.state.focusableOptionsWithIds,l)},r.getFocusableOptionsWithIds=function(){return NR(yg(r.props,r.state.selectValue),r.getElementId("option"))},r.getValue=function(){return r.state.selectValue},r.cx=function(){for(var l=arguments.length,u=new Array(l),f=0;fg||p>g}},r.onTouchEnd=function(l){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(l.target)&&r.menuListRef&&!r.menuListRef.contains(l.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(l){r.userIsDragging||r.onControlMouseDown(l)},r.onClearIndicatorTouchEnd=function(l){r.userIsDragging||r.onClearIndicatorMouseDown(l)},r.onDropdownIndicatorTouchEnd=function(l){r.userIsDragging||r.onDropdownIndicatorMouseDown(l)},r.handleInputChange=function(l){var u=r.props.inputValue,f=l.currentTarget.value;r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange(f,{action:"input-change",prevInputValue:u}),r.props.menuIsOpen||r.onMenuOpen()},r.onInputFocus=function(l){r.props.onFocus&&r.props.onFocus(l),r.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(l){var u=r.props.inputValue;if(r.menuListRef&&r.menuListRef.contains(document.activeElement)){r.inputRef.focus();return}r.props.onBlur&&r.props.onBlur(l),r.onInputChange("",{action:"input-blur",prevInputValue:u}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1})},r.onOptionHover=function(l){if(!(r.blockOptionHover||r.state.focusedOption===l)){var u=r.getFocusableOptions(),f=u.indexOf(l);r.setState({focusedOption:l,focusedOptionId:f>-1?r.getFocusedOptionId(l):null})}},r.shouldHideSelectedOptions=function(){return eD(r.props)},r.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),r.focus()},r.onKeyDown=function(l){var u=r.props,f=u.isMulti,d=u.backspaceRemovesValue,p=u.escapeClearsValue,g=u.inputValue,v=u.isClearable,x=u.isDisabled,_=u.menuIsOpen,m=u.onKeyDown,w=u.tabSelectsValue,S=u.openMenuOnFocus,b=r.state,R=b.focusedOption,A=b.focusedValue,C=b.selectValue;if(!x&&!(typeof m=="function"&&(m(l),l.defaultPrevented))){switch(r.blockOptionHover=!0,l.key){case"ArrowLeft":if(!f||g)return;r.focusValue("previous");break;case"ArrowRight":if(!f||g)return;r.focusValue("next");break;case"Delete":case"Backspace":if(g)return;if(A)r.removeValue(A);else{if(!d)return;f?r.popValue():v&&r.clearValue()}break;case"Tab":if(r.isComposing||l.shiftKey||!_||!w||!R||S&&r.isOptionSelected(R,C))return;r.selectOption(R);break;case"Enter":if(l.keyCode===229)break;if(_){if(!R||r.isComposing)return;r.selectOption(R);break}return;case"Escape":_?(r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange("",{action:"menu-close",prevInputValue:g}),r.onMenuClose()):v&&p&&r.clearValue();break;case" ":if(g)return;if(!_){r.openMenu("first");break}if(!R)return;r.selectOption(R);break;case"ArrowUp":_?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":_?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!_)return;r.focusOption("pageup");break;case"PageDown":if(!_)return;r.focusOption("pagedown");break;case"Home":if(!_)return;r.focusOption("first");break;case"End":if(!_)return;r.focusOption("last");break;default:return}l.preventDefault()}},r.state.instancePrefix="react-select-"+(r.props.instanceId||++v7),r.state.selectValue=yR(i.value),i.menuIsOpen&&r.state.selectValue.length){var s=r.getFocusableOptionsWithIds(),o=r.buildFocusableOptions(),a=o.indexOf(r.state.selectValue[0]);r.state.focusableOptionsWithIds=s,r.state.focusedOption=o[a],r.state.focusedOptionId=Wx(s,o[a])}return r}return NW(t,[{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&&_R(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(r){var s=this.props,o=s.isDisabled,a=s.menuIsOpen,l=this.state.isFocused;(l&&!o&&r.isDisabled||l&&a&&!r.menuIsOpen)&&this.focusInput(),l&&o&&!r.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!o&&r.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(_R(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(r,s){this.props.onInputChange(r,s)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(r){var s=this,o=this.state,a=o.selectValue,l=o.isFocused,u=this.buildFocusableOptions(),f=r==="first"?0:u.length-1;if(!this.props.isMulti){var d=u.indexOf(a[0]);d>-1&&(f=d)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[f],focusedOptionId:this.getFocusedOptionId(u[f])},function(){return s.onMenuOpen()})}},{key:"focusValue",value:function(r){var s=this.state,o=s.selectValue,a=s.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=o.indexOf(a);a||(l=-1);var u=o.length-1,f=-1;if(o.length){switch(r){case"previous":l===0?f=0:l===-1?f=u:f=l-1;break;case"next":l>-1&&l0&&arguments[0]!==void 0?arguments[0]:"first",s=this.props.pageSize,o=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,u=a.indexOf(o);o||(u=-1),r==="up"?l=u>0?u-1:a.length-1:r==="down"?l=(u+1)%a.length:r==="pageup"?(l=u-s,l<0&&(l=0)):r==="pagedown"?(l=u+s,l>a.length-1&&(l=a.length-1)):r==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Gx):st(st({},Gx),this.props.theme):Gx}},{key:"getCommonProps",value:function(){var r=this.clearValue,s=this.cx,o=this.getStyles,a=this.getClassNames,l=this.getValue,u=this.selectOption,f=this.setValue,d=this.props,p=d.isMulti,g=d.isRtl,v=d.options,x=this.hasValue();return{clearValue:r,cx:s,getStyles:o,getClassNames:a,getValue:l,hasValue:x,isMulti:p,isRtl:g,options:v,selectOption:u,selectProps:d,setValue:f,theme:this.getTheme()}}},{key:"hasValue",value:function(){var r=this.state.selectValue;return r.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var r=this.props,s=r.isClearable,o=r.isMulti;return s===void 0?o:s}},{key:"isOptionDisabled",value:function(r,s){return KN(this.props,r,s)}},{key:"isOptionSelected",value:function(r,s){return JN(this.props,r,s)}},{key:"filterOption",value:function(r,s){return QN(this.props,r,s)}},{key:"formatOptionLabel",value:function(r,s){if(typeof this.props.formatOptionLabel=="function"){var o=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(r,{context:s,inputValue:o,selectValue:a})}else return this.getOptionLabel(r)}},{key:"formatGroupLabel",value:function(r){return this.props.formatGroupLabel(r)}},{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 r=this.props,s=r.isDisabled,o=r.isSearchable,a=r.inputId,l=r.inputValue,u=r.tabIndex,f=r.form,d=r.menuIsOpen,p=r.required,g=this.getComponents(),v=g.Input,x=this.state,_=x.inputIsHidden,m=x.ariaSelection,w=this.commonProps,S=a||this.getElementId("input"),b=st(st(st({"aria-autocomplete":"list","aria-expanded":d,"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||""},d&&{"aria-controls":this.getElementId("listbox")}),!o&&{"aria-readonly":!0}),this.hasValue()?(m==null?void 0:m.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return o?Y.createElement(v,ct({},w,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:S,innerRef:this.getInputRef,isDisabled:s,isHidden:_,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:f,type:"text",value:l},b)):Y.createElement(Gj,ct({id:S,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:vv,onFocus:this.onInputFocus,disabled:s,tabIndex:u,inputMode:"none",form:f,value:""},b))}},{key:"renderPlaceholderOrValue",value:function(){var r=this,s=this.getComponents(),o=s.MultiValue,a=s.MultiValueContainer,l=s.MultiValueLabel,u=s.MultiValueRemove,f=s.SingleValue,d=s.Placeholder,p=this.commonProps,g=this.props,v=g.controlShouldRenderValue,x=g.isDisabled,_=g.isMulti,m=g.inputValue,w=g.placeholder,S=this.state,b=S.selectValue,R=S.focusedValue,A=S.isFocused;if(!this.hasValue()||!v)return m?null:Y.createElement(d,ct({},p,{key:"placeholder",isDisabled:x,isFocused:A,innerProps:{id:this.getElementId("placeholder")}}),w);if(_)return b.map(function(L,I){var E=L===R,N="".concat(r.getOptionLabel(L),"-").concat(r.getOptionValue(L));return Y.createElement(o,ct({},p,{components:{Container:a,Label:l,Remove:u},isFocused:E,isDisabled:x,key:N,index:I,removeProps:{onClick:function(){return r.removeValue(L)},onTouchEnd:function(){return r.removeValue(L)},onMouseDown:function(O){O.preventDefault()}},data:L}),r.formatOptionLabel(L,"value"))});if(m)return null;var C=b[0];return Y.createElement(f,ct({},p,{data:C,isDisabled:x}),this.formatOptionLabel(C,"value"))}},{key:"renderClearIndicator",value:function(){var r=this.getComponents(),s=r.ClearIndicator,o=this.commonProps,a=this.props,l=a.isDisabled,u=a.isLoading,f=this.state.isFocused;if(!this.isClearable()||!s||l||!this.hasValue()||u)return null;var d={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return Y.createElement(s,ct({},o,{innerProps:d,isFocused:f}))}},{key:"renderLoadingIndicator",value:function(){var r=this.getComponents(),s=r.LoadingIndicator,o=this.commonProps,a=this.props,l=a.isDisabled,u=a.isLoading,f=this.state.isFocused;if(!s||!u)return null;var d={"aria-hidden":"true"};return Y.createElement(s,ct({},o,{innerProps:d,isDisabled:l,isFocused:f}))}},{key:"renderIndicatorSeparator",value:function(){var r=this.getComponents(),s=r.DropdownIndicator,o=r.IndicatorSeparator;if(!s||!o)return null;var a=this.commonProps,l=this.props.isDisabled,u=this.state.isFocused;return Y.createElement(o,ct({},a,{isDisabled:l,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var r=this.getComponents(),s=r.DropdownIndicator;if(!s)return null;var o=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return Y.createElement(s,ct({},o,{innerProps:u,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var r=this,s=this.getComponents(),o=s.Group,a=s.GroupHeading,l=s.Menu,u=s.MenuList,f=s.MenuPortal,d=s.LoadingMessage,p=s.NoOptionsMessage,g=s.Option,v=this.commonProps,x=this.state.focusedOption,_=this.props,m=_.captureMenuScroll,w=_.inputValue,S=_.isLoading,b=_.loadingMessage,R=_.minMenuHeight,A=_.maxMenuHeight,C=_.menuIsOpen,L=_.menuPlacement,I=_.menuPosition,E=_.menuPortalTarget,N=_.menuShouldBlockScroll,z=_.menuShouldScrollIntoView,O=_.noOptionsMessage,q=_.onMenuScrollToTop,j=_.onMenuScrollToBottom;if(!C)return null;var Q=function(_e,J){var pe=_e.type,Me=_e.data,de=_e.isDisabled,Qe=_e.isSelected,lt=_e.label,K=_e.value,tt=x===Me,he=de?void 0:function(){return r.onOptionHover(Me)},we=de?void 0:function(){return r.selectOption(Me)},ye="".concat(r.getElementId("option"),"-").concat(J),Ce={id:ye,onClick:we,onMouseMove:he,onMouseOver:he,tabIndex:-1,role:"option","aria-selected":r.isAppleDevice?void 0:Qe};return Y.createElement(g,ct({},v,{innerProps:Ce,data:Me,isDisabled:de,isSelected:Qe,key:ye,label:lt,type:pe,value:K,isFocused:tt,innerRef:tt?r.getFocusedOptionRef:void 0}),r.formatOptionLabel(_e.data,"menu"))},oe;if(this.hasOptions())oe=this.getCategorizedOptions().map(function(me){if(me.type==="group"){var _e=me.data,J=me.options,pe=me.index,Me="".concat(r.getElementId("group"),"-").concat(pe),de="".concat(Me,"-heading");return Y.createElement(o,ct({},v,{key:Me,data:_e,options:J,Heading:a,headingProps:{id:de,data:me.data},label:r.formatGroupLabel(me.data)}),me.options.map(function(Qe){return Q(Qe,"".concat(pe,"-").concat(Qe.index))}))}else if(me.type==="option")return Q(me,"".concat(me.index))});else if(S){var k=b({inputValue:w});if(k===null)return null;oe=Y.createElement(d,v,k)}else{var W=O({inputValue:w});if(W===null)return null;oe=Y.createElement(p,v,W)}var G={minMenuHeight:R,maxMenuHeight:A,menuPlacement:L,menuPosition:I,menuShouldScrollIntoView:z},ne=Y.createElement(w9,ct({},v,G),function(me){var _e=me.ref,J=me.placerProps,pe=J.placement,Me=J.maxHeight;return Y.createElement(l,ct({},v,G,{innerRef:_e,innerProps:{onMouseDown:r.onMenuMouseDown,onMouseMove:r.onMenuMouseMove},isLoading:S,placement:pe}),Y.createElement(Yj,{captureEnabled:m,onTopArrive:q,onBottomArrive:j,lockEnabled:N},function(de){return Y.createElement(u,ct({},v,{innerRef:function(lt){r.getMenuListRef(lt),de(lt)},innerProps:{role:"listbox","aria-multiselectable":v.isMulti,id:r.getElementId("listbox")},isLoading:S,maxHeight:Me,focusedOption:x}),oe)}))});return E||I==="fixed"?Y.createElement(f,ct({},v,{appendTo:E,controlElement:this.controlRef,menuPlacement:L,menuPosition:I}),ne):ne}},{key:"renderFormField",value:function(){var r=this,s=this.props,o=s.delimiter,a=s.isDisabled,l=s.isMulti,u=s.name,f=s.required,d=this.state.selectValue;if(f&&!this.hasValue()&&!a)return Y.createElement(Jj,{name:u,onFocus:this.onValueInputFocus});if(!(!u||a))if(l)if(o){var p=d.map(function(x){return r.getOptionValue(x)}).join(o);return Y.createElement("input",{name:u,type:"hidden",value:p})}else{var g=d.length>0?d.map(function(x,_){return Y.createElement("input",{key:"i-".concat(_),name:u,type:"hidden",value:r.getOptionValue(x)})}):Y.createElement("input",{name:u,type:"hidden",value:""});return Y.createElement("div",null,g)}else{var v=d[0]?this.getOptionValue(d[0]):"";return Y.createElement("input",{name:u,type:"hidden",value:v})}}},{key:"renderLiveRegion",value:function(){var r=this.commonProps,s=this.state,o=s.ariaSelection,a=s.focusedOption,l=s.focusedValue,u=s.isFocused,f=s.selectValue,d=this.getFocusableOptions();return Y.createElement(Fj,ct({},r,{id:this.getElementId("live-region"),ariaSelection:o,focusedOption:a,focusedValue:l,isFocused:u,selectValue:f,focusableOptions:d,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var r=this.getComponents(),s=r.Control,o=r.IndicatorsContainer,a=r.SelectContainer,l=r.ValueContainer,u=this.props,f=u.className,d=u.id,p=u.isDisabled,g=u.menuIsOpen,v=this.state.isFocused,x=this.commonProps=this.getCommonProps();return Y.createElement(a,ct({},x,{className:f,innerProps:{id:d,onKeyDown:this.onKeyDown},isDisabled:p,isFocused:v}),this.renderLiveRegion(),Y.createElement(s,ct({},x,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:p,isFocused:v,menuIsOpen:g}),Y.createElement(l,ct({},x,{isDisabled:p}),this.renderPlaceholderOrValue(),this.renderInput()),Y.createElement(o,ct({},x,{isDisabled:p}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(r,s){var o=s.prevProps,a=s.clearFocusValueOnUpdate,l=s.inputIsHiddenAfterUpdate,u=s.ariaSelection,f=s.isFocused,d=s.prevWasFocused,p=s.instancePrefix,g=r.options,v=r.value,x=r.menuIsOpen,_=r.inputValue,m=r.isMulti,w=yR(v),S={};if(o&&(v!==o.value||g!==o.options||x!==o.menuIsOpen||_!==o.inputValue)){var b=x?p7(r,w):[],R=x?NR(yg(r,w),"".concat(p,"-option")):[],A=a?m7(s,w):null,C=g7(s,b),L=Wx(R,C);S={selectValue:w,focusedOption:C,focusedOptionId:L,focusableOptionsWithIds:R,focusedValue:A,clearFocusValueOnUpdate:!1}}var I=l!=null&&r!==o?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},E=u,N=f&&d;return f&&!N&&(E={value:zm(m,w,w[0]||null),options:w,action:"initial-input-focus"},N=!d),(u==null?void 0:u.action)==="initial-input-focus"&&(E=null),st(st(st({},S),I),{},{prevProps:r,ariaSelection:E,prevWasFocused:N})}}]),t}(Y.Component);tD.defaultProps=d7;var y7=Y.forwardRef(function(n,e){var t=IW(n);return Y.createElement(tD,ct({ref:e},t))}),_7=y7;const x7=({conceptCategories:n,concepts:e,setConcepts:t})=>{const i=r=>{r in n&&t(n[r].map((s,o)=>({label:s.label,description:s.description,color:EW(o),embeddings:[],position:[0,0,0],index:o})))};return We.jsxs("div",{className:"PanelConceptCategories",children:[We.jsx("h3",{style:{textAlign:"left"},className:"HiddenOnMobile",children:"# Categories"}),We.jsx(_7,{className:"SelectConcept",placeholder:"Select a category...",isSearchable:!1,menuPortalTarget:document.body,options:Object.keys(n).map(r=>({value:r,label:r})),onChange:r=>{i((r==null?void 0:r.value)||"")}}),We.jsx("h2",{style:{height:"300px",overflow:"scroll"},className:"HiddenOnMobile",children:e.map(r=>We.jsx(cN,{color:r.color,inputValue:r.label,inputId:`prompt-${r.index}`,title:r.description},`prompt-${r.index}`))})]})},w7=({onChangeMyConcept:n})=>We.jsxs("div",{className:"PanelMyConcept",children:[We.jsx("h3",{style:{textAlign:"left"},className:"HiddenOnMobile",children:"# Your concept"}),We.jsx("h2",{children:We.jsx(cN,{color:"black",inputId:"prompt-test",onChanged:n})}),We.jsx("div",{style:{textAlign:"center"},className:"HiddenOnMobile",children:We.jsx("button",{onClick:()=>{n(document.getElementById("prompt-test").value)},children:"Represent Concept"})})]}),S7=({text:n})=>We.jsx("div",{className:"CardHoveredConcept",children:We.jsx("strong",{children:We.jsx("em",{children:n})})}),nD=[{label:"Pure happiness",description:'Joy - "Pure happiness." Joy is a powerful, often euphoric state of happiness that is usually caused by something exceptionally good or satisfying. It often includes feelings of contentment, satisfaction, and well-being.'},{label:"Sorrowful distress",description:'Sadness - "Sorrowful distress." This emotion is typically associated with feelings of disadvantage, loss, and helplessness. When someone is sad, they often feel down and might have a low mood that affects their day-to-day activities.'},{label:"Anxiety anticipation",description:'Fear - "Anxiety anticipation." Fear is a response to an impending threat or danger, characterized by increased alertness and preparation for physical action. It often serves a protective purpose, triggering the "fight-or-flight" response.'},{label:"Fierce irritation",description:'Anger - "Fierce irritation." Anger is an emotional response to perceived wrongs and injustice, often resulting in a desire to assert authority or independence, or a tendency to retaliate against the source of offense.'},{label:"Unexpected astonishment",description:`Surprise - "Unexpected astonishment." This emotion is a response to an unexpected event. It can be either positive or negative, depending on the nature of the surprise. It's characterized by a high level of stimulation and a need to re-evaluate one's understanding of the situation.`},{label:"Revulsion reaction",description:'Disgust - "Revulsion reaction." Disgust is a powerful aversion to something perceived as unpleasant or offensive. This emotion can be triggered by various stimuli including unpleasant tastes, sights, or moral situations.'},{label:"Scornful disdain",description:'Contempt - "Scornful disdain." Contempt is an emotion that puts someone or something considered worthless or beneath consideration. This emotion often involves moral superiority and a lack of respect.'},{label:"Confident reliance",description:'Trust - "Confident reliance." Trust is an emotion reflecting a level of comfort and firm belief in the reliability or truth of someone or something. It involves a complex mix of affective experiences with a significant history of interactions.'}],iD=[{label:"Visionary guidance",description:'Authoritative Leadership - "Visionary guidance." This style is characterized by a leader who sets clear objectives and directions but allows individuals some flexibility in how they achieve these goals. They motivate by appealing to people’s shared goals.'},{label:"Collective input",description:'Democratic Leadership - "Collective input." Leaders using this style solicit input from team members in decision-making processes, fostering collaboration and participation. This approach can boost morale and creativity by making members feel valued and involved.'},{label:"Hands-off management",description:'Laissez-faire Leadership - "Hands-off management." In this style, the leader provides little guidance to team members, who are then allowed to make decisions and solve problems on their own. This can be effective in highly skilled teams but risky in teams needing direction.'},{label:"Performance reward",description:'Transactional Leadership - "Performance reward." Leaders focusing on this style are centered on clear structures wherein specific tasks are rewarded. Performance is closely monitored and feedback is given directly related to achievements. This approach works well in environments where tasks are routine and outcomes are predictable.'},{label:"Inspiring change",description:'Transformational Leadership - "Inspiring change." These leaders focus on initiating change in organizations, staff, and themselves. They are characterized by their ability to inspire and motivate employees to exceed expectations by aligning team goals with a higher vision.'},{label:"Personal development",description:'Coaching Leadership - "Personal development." Coaching leaders focus heavily on the professional and personal development of their team members. They provide one-on-one guidance to help team members meet their individual goals, which in turn enhances their performance at work.'},{label:"Directive control",description:'Autocratic Leadership - "Directive control." This style is defined by individual control over all decisions with little input from group members. It can be effective in crises but might stifle creativity and autonomy in a standard setting.'},{label:"Supportive facilitator",description:'Servant Leadership - "Supportive facilitator." Servant leaders put the needs of their team members first and help people develop and perform as highly as possible. They lead by example and gain authority by earning trust and fostering a service-oriented environment.'}],rD=[{label:"Continuous focus",description:'Sustained Attention - "Continuous focus." This type of attention is required for activities that demand prolonged concentration, such as studying for an exam or driving a long distance. It involves maintaining focus on a task over an extended period without becoming distracted.'},{label:"Targeted filtering",description:'Selective Attention - "Targeted filtering." Selective attention involves focusing on one specific aspect of the environment while ignoring other stimuli. For example, listening to a friend talk in a noisy room requires the ability to filter out the background noise.'},{label:"Switching focus",description:'Alternating Attention - "Switching focus." This type of attention allows an individual to shift focus between tasks that require different cognitive demands. For instance, alternating between writing a report and responding to emails.'},{label:"Multitasking efficiency",description:'Divided Attention - "Multitasking efficiency." Divided attention refers to the ability to process two or more responses or react to multiple tasks at the same time, such as cooking while watching TV.'},{label:"Complex management",description:'Executive Attention - "Complex management." This involves high-level thought, decision-making, and the management of attention resources among several tasks or priorities, such as planning a project while considering multiple variables.'},{label:"Involuntary awareness",description:'Passive Attention - "Involuntary awareness." Passive attention is drawn to stimuli without any conscious effort, often triggered by something surprising or significant, such as the sudden sound of a loud crash.'},{label:"Minimal engagement",description:'Bored Attention - "Minimal engagement." This is a form of attention where the focus is maintained nominally, often under unstimulating conditions. It’s the kind of attention you might use during a dull lecture or a repetitive task.'},{label:"Intense concentration",description:'Hyperfocus - "Intense concentration." This is an extreme form of mental concentration or visualization that focuses consciousness on a subject, topic, or task. In hyperfocus, one can become so absorbed in the task that they become oblivious to everything else around them, often found in highly engaging activities like playing video games or during a creative burst.'}],sD=[{label:"Persistent sadness",description:'Major Depression - "Persistent sadness." This mood disorder is characterized by a persistent feeling of sadness and a lack of interest in external stimuli. Symptoms can also include changes in sleep, appetite, energy level, concentration, daily behavior, or self-esteem.'},{label:"Constant worry",description:'Generalized Anxiety Disorder (GAD) - "Constant worry." GAD involves excessive, uncontrollable worry about everyday issues, such as health, money, or career. This worry is disproportionate to the actual source of concern and can affect physical health.'},{label:"Mood extremes",description:`Bipolar Disorder - "Mood extremes." This condition is marked by dramatic shifts in a person's mood, energy and ability to think clearly. These mood swings can range from highs (mania) to lows (depression), sometimes with periods of normal mood in between.`},{label:"Altered perceptions",description:'Schizophrenia - "Altered perceptions." Schizophrenia is a complex, long-term medical illness, characterized by symptoms like hallucinations, delusions, and extremely disordered thinking and behavior that impairs daily functioning.'},{label:"Compulsive behavior",description:'Obsessive-Compulsive Disorder (OCD) - "Compulsive behavior." OCD is characterized by unreasonable thoughts and fears (obsessions) that lead to compulsive behaviors. This disorder often centers on themes such as fear of germs or the need to arrange objects in a specific manner.'},{label:"Trauma aftermath",description:'Post-Traumatic Stress Disorder (PTSD) - "Trauma aftermath." PTSD can occur after a person has experienced or witnessed a traumatic event such as a natural disaster, a serious accident, a terrorist act, war/combat, rape, or other violent personal assault.'},{label:"Emotional instability",description:'Borderline Personality Disorder (BPD) - "Emotional instability." BPD is characterized by difficulties in regulating emotion. This can lead to severe, unstable mood swings, impulsivity and instability, poor self-image, and tumultuous personal relationships.'},{label:"Focus deficiency",description:'Attention Deficit Hyperactivity Disorder (ADHD) - "Focus deficiency." ADHD is characterized by a continuous pattern of inattention and/or hyperactivity-impulsivity that interferes with functioning or development. It often presents problems with organizing tasks, staying focused on one task, and social interaction.'}],oD=[{label:"Equitable entitlements",description:'Social Rights - "Equitable entitlements." This involves advocating and ensuring that all individuals have equal access to basic rights and liberties, such as education, healthcare, and fair treatment under the law.'},{label:"Eco-conscious actions",description:`Environmental Care - "Eco-conscious actions." Environmental responsibility emphasizes the protection and improvement of the planet's ecosystems. This includes efforts to reduce pollution, conserve resources, and uphold biodiversity.`},{label:"Wealth distribution",description:'Economic Equality - "Wealth distribution." This type of social responsibility focuses on reducing the disparities in economic opportunity and wealth among different groups within society, aiming to achieve a more equitable economic landscape.'},{label:"Ethical management",description:'Corporate Governance - "Ethical management." This pertains to the way in which companies are directed and controlled, ensuring they operate with fairness, transparency, and accountability to their stakeholders.'},{label:"Local engagement",description:'Community Involvement - "Local engagement." This emphasizes the importance of businesses and individuals participating in community development and support, such as local volunteering, support for community projects, and enhancement of local facilities.'},{label:"Diversity acceptance",description:'Cultural Awareness - "Diversity acceptance." Cultural responsibility involves recognizing, respecting, and preserving the various cultures within a community or society, promoting diversity and inclusion.'},{label:"Promoting well-being",description:'Health and Wellness - "Promoting well-being." This focuses on improving health outcomes for all members of society by advocating for better health services, education, and preventive measures to ensure public health and safety.'},{label:"Responsible purchasing",description:'Ethical Consumption - "Responsible purchasing." This involves making purchasing decisions that are conscious of the environmental and social impacts of products and services, supporting fair trade and ethically produced goods.'}],aD=[{label:"Bodily harm",description:'Physical Abuse - "Bodily harm." This form involves any intentional act causing injury or trauma to another person through physical contact. It includes hitting, punching, slapping, and other forms of physical assault.'},{label:"Psychological harm",description:'Emotional Abuse - "Psychological harm." Emotional or psychological abuse involves exposing someone to behavior that may result in psychological trauma, including anxiety, chronic depression, or post-traumatic stress disorder. It typically involves verbal assault, humiliation, intimidation, or infantilization.'},{label:"Violated consent",description:'Sexual Abuse - "Violated consent." This type of abuse involves forcing undesired sexual behavior by one person upon another. It ranges from non-consensual touching and coercive sexual acts to any sexual contact with someone unable to give consent.'},{label:"Economic control",description:`Financial Abuse - "Economic control." Financial or economic abuse involves controlling a person's ability to acquire, use, and maintain financial resources. Victims are often restricted from accessing funds or are stolen from directly, which diminishes their capacity to support themselves and forces dependency.`},{label:"Care deprivation",description:'Neglect - "Care deprivation." Neglect is a form of abuse where the caregiver fails to provide adequate care in terms of food, shelter, health care, and clothing to someone who cannot care for themselves, often resulting in deteriorating health or wellbeing.'},{label:"Destructive words",description:`Verbal Abuse - "Destructive words." This encompasses any use of language that is demeaning, derogatory, or insulting, intended to undermine the self-esteem of the person it's directed towards. It can be loud or subtle, including threats, insults, or excessively critical comments.`},{label:"Faith manipulation",description:'Spiritual Abuse - "Faith manipulation." This involves using a person’s spiritual beliefs to manipulate, control, or dominate them. It can include misusing doctrine, applying undue pressure to conform to specific beliefs, or exploiting spiritual authority for personal gain.'},{label:"Digital harassment",description:'Cyber Abuse - "Digital harassment." Cyber abuse takes place online and includes cyberbullying, stalking, and harassment. It uses digital technology to intimidate, threaten, or upset someone, often anonymously and repetitively.'}],lD=[{label:"Governance systems",description:'Politics - "Governance systems." This area involves the activities associated with the governance of a country or other area, especially the debate among individuals or parties having or hoping to achieve power. It shapes laws, policies, and the distribution of resources.'},{label:"Financial infrastructure",description:'Economy - "Financial infrastructure." The economy encompasses all activities related to production, consumption, and trade of goods and services in an area. It affects employment, income levels, and overall economic growth and stability.'},{label:"Knowledge dissemination",description:'Education - "Knowledge dissemination." This sector involves the systems and processes through which education is delivered, including schools, colleges, and educational content. It plays a crucial role in skill development, critical thinking, and social mobility.'},{label:"Spiritual practices",description:'Religion - "Spiritual practices." Religion pertains to the organized collection of beliefs, cultural systems, and world views that relate humanity to an order of existence. It often influences personal values, cultural norms, and community traditions.'},{label:"Medical services",description:'Healthcare - "Medical services." Healthcare represents the organized provision of medical care to individuals or a community through services offered by medical professionals. It impacts public health, life expectancy, and quality of life.'},{label:"Social expressions",description:'Culture - "Social expressions." Culture includes the arts, customs, practices, languages, values, and items that are passed along and valued by a group of people. It enriches societal interactions and reflects the historical and social context of the community.'},{label:"Ecological context",description:'Environment - "Ecological context." This area deals with the interaction between society and the natural surroundings, including issues of conservation, pollution control, and sustainable management of natural resources.'},{label:"Judicial frameworks",description:'Legal System - "Judicial frameworks." The legal system comprises the laws and regulations, as well as the processes and infrastructure for enforcing them, governing the behavior of the populace. It ensures order, resolves disputes, and maintains social justice.'}],M7={Emotions:nD,"Leadership styles":iD,"Attention types":rD,"Mental illness":sD,"Social rights":oD,"Abuse forms":aD,"Social areas":lD},uD=[];Object.values(M7).forEach(n=>n.forEach(e=>uD.push(e)));const E7={Emotions:nD,"Leadership styles":iD,"Attention types":rD,"Mental illness":sD,"Social rights":oD,"Abuse forms":aD,"Social areas":lD,All:uD},Iu="4.47.1";let OR=!1,hf,cD,hD,GS,fD,dD,pD,mD,gD;function b7(n,e={auto:!1}){if(OR)throw new Error(`you must \`import 'openai/shims/${n.kind}'\` before importing anything else from openai`);if(hf)throw new Error(`can't \`import 'openai/shims/${n.kind}'\` after \`import 'openai/shims/${hf}'\``);OR=e.auto,hf=n.kind,cD=n.fetch,hD=n.FormData,GS=n.File,fD=n.ReadableStream,dD=n.getMultipartRequestOptions,pD=n.getDefaultAgent,mD=n.fileFromPath,gD=n.isFsReadStream}class T7{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}function A7({manuallyImported:n}={}){const e=n?"You may need to use polyfills":"Add one of these imports before your first `import … from 'openai'`:\n- `import 'openai/shims/node'` (if you're running on Node)\n- `import 'openai/shims/web'` (otherwise)\n";let t,i,r,s;try{t=fetch,i=Request,r=Response,s=Headers}catch(o){throw new Error(`this environment is missing the following Web Fetch API type: ${o.message}. ${e}`)}return{kind:"web",fetch:t,Request:i,Response:r,Headers:s,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(o,a)=>({...a,body:new T7(o)}),getDefaultAgent:o=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:o=>!1}}hf||b7(A7(),{auto:!0});class kt extends Error{}class ci extends kt{constructor(e,t,i,r){super(`${ci.makeMessage(e,t,i)}`),this.status=e,this.headers=r,this.request_id=r==null?void 0:r["x-request-id"];const s=t;this.error=s,this.code=s==null?void 0:s.code,this.param=s==null?void 0:s.param,this.type=s==null?void 0:s.type}static makeMessage(e,t,i){const r=t!=null&&t.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):i;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||"(no status code or body)"}static generate(e,t,i,r){if(!e)return new Q0({cause:jS(t)});const s=t==null?void 0:t.error;return e===400?new vD(e,s,i,r):e===401?new yD(e,s,i,r):e===403?new _D(e,s,i,r):e===404?new xD(e,s,i,r):e===409?new wD(e,s,i,r):e===422?new SD(e,s,i,r):e===429?new MD(e,s,i,r):e>=500?new ED(e,s,i,r):new ci(e,s,i,r)}}class _r extends ci{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}}class Q0 extends ci{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,t&&(this.cause=t)}}class aE extends Q0{constructor({message:e}={}){super({message:e??"Request timed out."})}}class vD extends ci{constructor(){super(...arguments),this.status=400}}class yD extends ci{constructor(){super(...arguments),this.status=401}}class _D extends ci{constructor(){super(...arguments),this.status=403}}class xD extends ci{constructor(){super(...arguments),this.status=404}}class wD extends ci{constructor(){super(...arguments),this.status=409}}class SD extends ci{constructor(){super(...arguments),this.status=422}}class MD extends ci{constructor(){super(...arguments),this.status=429}}class ED extends ci{}class Bs{constructor(e,t){this.iterator=e,this.controller=t}static fromSSEResponse(e,t){let i=!1;async function*r(){if(i)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(const o of C7(e,t))if(!s){if(o.data.startsWith("[DONE]")){s=!0;continue}if(o.event===null){let a;try{a=JSON.parse(o.data)}catch(l){throw console.error("Could not parse message into JSON:",o.data),console.error("From chunk:",o.raw),l}if(a&&a.error)throw new ci(void 0,a.error,void 0,void 0);yield a}else{let a;try{a=JSON.parse(o.data)}catch(l){throw console.error("Could not parse message into JSON:",o.data),console.error("From chunk:",o.raw),l}if(o.event=="error")throw new ci(void 0,a.error,a.message,void 0);yield{event:o.event,data:a}}}s=!0}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{s||t.abort()}}return new Bs(r,t)}static fromReadableStream(e,t){let i=!1;async function*r(){const o=new Il,a=bD(e);for await(const l of a)for(const u of o.decode(l))yield u;for(const l of o.flush())yield l}async function*s(){if(i)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let o=!1;try{for await(const a of r())o||a&&(yield JSON.parse(a));o=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{o||t.abort()}}return new Bs(s,t)}[Symbol.asyncIterator](){return this.iterator()}tee(){const e=[],t=[],i=this.iterator(),r=s=>({next:()=>{if(s.length===0){const o=i.next();e.push(o),t.push(o)}return s.shift()}});return[new Bs(()=>r(e),this.controller),new Bs(()=>r(t),this.controller)]}toReadableStream(){const e=this;let t;const i=new TextEncoder;return new fD({async start(){t=e[Symbol.asyncIterator]()},async pull(r){try{const{value:s,done:o}=await t.next();if(o)return r.close();const a=i.encode(JSON.stringify(s)+` +`]))),q9=function(e,t){var i=e.isFocused,r=e.size,s=e.theme,o=s.colors,a=s.spacing.baseUnit;return st({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"},t?{}:{color:i?o.neutral60:o.neutral20,padding:a*2})},zx=function(e){var t=e.delay,i=e.offset;return nt("span",{css:tE({animation:"".concat($9," 1s ease-in-out ").concat(t,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:i?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},Y9=function(e){var t=e.innerProps,i=e.isRtl,r=e.size,s=r===void 0?4:r,o=Do(e,z9);return nt("div",ct({},Cn(st(st({},o),{},{innerProps:t,isRtl:i,size:s}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),t),nt(zx,{delay:0,offset:i}),nt(zx,{delay:160,offset:!0}),nt(zx,{delay:320,offset:!i}))},Z9=function(e,t){var i=e.isDisabled,r=e.isFocused,s=e.theme,o=s.colors,a=s.borderRadius,l=s.spacing;return st({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},t?{}:{backgroundColor:i?o.neutral5:o.neutral0,borderColor:i?o.neutral10:r?o.primary:o.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px ".concat(o.primary):void 0,"&:hover":{borderColor:r?o.primary:o.neutral30}})},K9=function(e){var t=e.children,i=e.isDisabled,r=e.isFocused,s=e.innerRef,o=e.innerProps,a=e.menuIsOpen;return nt("div",ct({ref:s},Cn(e,"control",{control:!0,"control--is-disabled":i,"control--is-focused":r,"control--menu-is-open":a}),o,{"aria-disabled":i||void 0}),t)},J9=K9,Q9=["data"],ej=function(e,t){var i=e.theme.spacing;return t?{}:{paddingBottom:i.baseUnit*2,paddingTop:i.baseUnit*2}},tj=function(e){var t=e.children,i=e.cx,r=e.getStyles,s=e.getClassNames,o=e.Heading,a=e.headingProps,l=e.innerProps,u=e.label,f=e.theme,d=e.selectProps;return nt("div",ct({},Cn(e,"group",{group:!0}),l),nt(o,ct({},a,{selectProps:d,theme:f,getStyles:r,getClassNames:s,cx:i}),u),nt("div",null,t))},nj=function(e,t){var i=e.theme,r=i.colors,s=i.spacing;return st({label:"group",cursor:"default",display:"block"},t?{}:{color:r.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:s.baseUnit*3,paddingRight:s.baseUnit*3,textTransform:"uppercase"})},ij=function(e){var t=DN(e);t.data;var i=Do(t,Q9);return nt("div",ct({},Cn(e,"groupHeading",{"group-heading":!0}),i))},rj=tj,sj=["innerRef","isDisabled","isHidden","inputClassName"],oj=function(e,t){var i=e.isDisabled,r=e.value,s=e.theme,o=s.spacing,a=s.colors;return st(st({visibility:i?"hidden":"visible",transform:r?"translateZ(0)":""},aj),t?{}:{margin:o.baseUnit/2,paddingBottom:o.baseUnit/2,paddingTop:o.baseUnit/2,color:a.neutral80})},GN={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},aj={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":st({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},GN)},lj=function(e){return st({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},GN)},uj=function(e){var t=e.cx,i=e.value,r=DN(e),s=r.innerRef,o=r.isDisabled,a=r.isHidden,l=r.inputClassName,u=Do(r,sj);return nt("div",ct({},Cn(e,"input",{"input-container":!0}),{"data-value":i||""}),nt("input",ct({className:t({input:!0},l),ref:s,style:lj(a),disabled:o},u)))},cj=uj,hj=function(e,t){var i=e.theme,r=i.spacing,s=i.borderRadius,o=i.colors;return st({label:"multiValue",display:"flex",minWidth:0},t?{}:{backgroundColor:o.neutral10,borderRadius:s/2,margin:r.baseUnit/2})},fj=function(e,t){var i=e.theme,r=i.borderRadius,s=i.colors,o=e.cropWithEllipsis;return st({overflow:"hidden",textOverflow:o||o===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},t?{}:{borderRadius:r/2,color:s.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},dj=function(e,t){var i=e.theme,r=i.spacing,s=i.borderRadius,o=i.colors,a=e.isFocused;return st({alignItems:"center",display:"flex"},t?{}:{borderRadius:s/2,backgroundColor:a?o.dangerLight:void 0,paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:o.dangerLight,color:o.danger}})},WN=function(e){var t=e.children,i=e.innerProps;return nt("div",i,t)},pj=WN,mj=WN;function gj(n){var e=n.children,t=n.innerProps;return nt("div",ct({role:"button"},t),e||nt(sE,{size:14}))}var vj=function(e){var t=e.children,i=e.components,r=e.data,s=e.innerProps,o=e.isDisabled,a=e.removeProps,l=e.selectProps,u=i.Container,f=i.Label,d=i.Remove;return nt(u,{data:r,innerProps:st(st({},Cn(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":o})),s),selectProps:l},nt(f,{data:r,innerProps:st({},Cn(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},t),nt(d,{data:r,innerProps:st(st({},Cn(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(t||"option")},a),selectProps:l}))},yj=vj,_j=function(e,t){var i=e.isDisabled,r=e.isFocused,s=e.isSelected,o=e.theme,a=o.spacing,l=o.colors;return st({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},t?{}:{backgroundColor:s?l.primary:r?l.primary25:"transparent",color:i?l.neutral20:s?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:i?void 0:s?l.primary:l.primary50}})},xj=function(e){var t=e.children,i=e.isDisabled,r=e.isFocused,s=e.isSelected,o=e.innerRef,a=e.innerProps;return nt("div",ct({},Cn(e,"option",{option:!0,"option--is-disabled":i,"option--is-focused":r,"option--is-selected":s}),{ref:o,"aria-disabled":i},a),t)},wj=xj,Sj=function(e,t){var i=e.theme,r=i.spacing,s=i.colors;return st({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},t?{}:{color:s.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},Mj=function(e){var t=e.children,i=e.innerProps;return nt("div",ct({},Cn(e,"placeholder",{placeholder:!0}),i),t)},Ej=Mj,bj=function(e,t){var i=e.isDisabled,r=e.theme,s=r.spacing,o=r.colors;return st({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t?{}:{color:i?o.neutral40:o.neutral80,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},Tj=function(e){var t=e.children,i=e.isDisabled,r=e.innerProps;return nt("div",ct({},Cn(e,"singleValue",{"single-value":!0,"single-value--is-disabled":i}),r),t)},Aj=Tj,Cj={ClearIndicator:W9,Control:J9,DropdownIndicator:H9,DownChevron:VN,CrossIcon:sE,Group:rj,GroupHeading:ij,IndicatorsContainer:F9,IndicatorSeparator:X9,Input:cj,LoadingIndicator:Y9,Menu:M9,MenuList:b9,MenuPortal:I9,LoadingMessage:R9,NoOptionsMessage:C9,MultiValue:yj,MultiValueContainer:pj,MultiValueLabel:mj,MultiValueRemove:gj,Option:wj,Placeholder:Ej,SelectContainer:N9,SingleValue:Aj,ValueContainer:O9},Rj=function(e){return st(st({},Cj),e.components)},SR=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function Pj(n,e){return!!(n===e||SR(n)&&SR(e))}function Ij(n,e){if(n.length!==e.length)return!1;for(var t=0;t1?"s":""," ").concat(s.join(","),", selected.");case"select-option":return o?"option ".concat(r," is disabled. Select another option."):"option ".concat(r,", selected.");default:return""}},onFocus:function(e){var t=e.context,i=e.focused,r=e.options,s=e.label,o=s===void 0?"":s,a=e.selectValue,l=e.isDisabled,u=e.isSelected,f=e.isAppleDevice,d=function(x,_){return x&&x.length?"".concat(x.indexOf(_)+1," of ").concat(x.length):""};if(t==="value"&&a)return"value ".concat(o," focused, ").concat(d(a,i),".");if(t==="menu"&&f){var p=l?" disabled":"",g="".concat(u?" selected":"").concat(p);return"".concat(o).concat(g,", ").concat(d(r,i),".")}return""},onFilter:function(e){var t=e.inputValue,i=e.resultsMessage;return"".concat(i).concat(t?" for search term "+t:"",".")}},kj=function(e){var t=e.ariaSelection,i=e.focusedOption,r=e.focusedValue,s=e.focusableOptions,o=e.isFocused,a=e.selectValue,l=e.selectProps,u=e.id,f=e.isAppleDevice,d=l.ariaLiveMessages,p=l.getOptionLabel,g=l.inputValue,v=l.isMulti,x=l.isOptionDisabled,_=l.isSearchable,m=l.menuIsOpen,w=l.options,S=l.screenReaderStatus,b=l.tabSelectsValue,R=l.isLoading,A=l["aria-label"],C=l["aria-live"],L=Y.useMemo(function(){return st(st({},Oj),d||{})},[d]),I=Y.useMemo(function(){var j="";if(t&&L.onChange){var Q=t.option,oe=t.options,k=t.removedValue,W=t.removedValues,G=t.value,ne=function(Qe){return Array.isArray(Qe)?null:Qe},me=k||Q||ne(G),_e=me?p(me):"",J=oe||W||void 0,pe=J?J.map(p):[],Me=st({isDisabled:me&&x(me,a),label:_e,labels:pe},t);j=L.onChange(Me)}return j},[t,L,x,a,p]),E=Y.useMemo(function(){var j="",Q=i||r,oe=!!(i&&a&&a.includes(i));if(Q&&L.onFocus){var k={focused:Q,label:p(Q),isDisabled:x(Q,a),isSelected:oe,options:s,context:Q===i?"menu":"value",selectValue:a,isAppleDevice:f};j=L.onFocus(k)}return j},[i,r,p,x,L,s,a,f]),N=Y.useMemo(function(){var j="";if(m&&w.length&&!R&&L.onFilter){var Q=S({count:s.length});j=L.onFilter({inputValue:g,resultsMessage:Q})}return j},[s,g,m,L,w,S,R]),z=(t==null?void 0:t.action)==="initial-input-focus",O=Y.useMemo(function(){var j="";if(L.guidance){var Q=r?"value":m?"menu":"input";j=L.guidance({"aria-label":A,context:Q,isDisabled:i&&x(i,a),isMulti:v,isSearchable:_,tabSelectsValue:b,isInitialFocus:z})}return j},[A,i,r,v,x,_,m,L,a,b,z]),q=nt(Y.Fragment,null,nt("span",{id:"aria-selection"},I),nt("span",{id:"aria-focused"},E),nt("span",{id:"aria-results"},N),nt("span",{id:"aria-guidance"},O));return nt(Y.Fragment,null,nt(MR,{id:u},z&&q),nt(MR,{"aria-live":C,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},o&&!z&&q))},Fj=kj,HS=[{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źẑżžẓẕƶȥɀⱬꝣ"}],Uj=new RegExp("["+HS.map(function(n){return n.letters}).join("")+"]","g"),jN={};for(var Bx=0;Bx-1}},Hj=["innerRef"];function Gj(n){var e=n.innerRef,t=Do(n,Hj),i=m9(t,"onExited","in","enter","exit","appear");return nt("input",ct({ref:e},i,{css:tE({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 Wj=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function jj(n){var e=n.isEnabled,t=n.onBottomArrive,i=n.onBottomLeave,r=n.onTopArrive,s=n.onTopLeave,o=Y.useRef(!1),a=Y.useRef(!1),l=Y.useRef(0),u=Y.useRef(null),f=Y.useCallback(function(_,m){if(u.current!==null){var w=u.current,S=w.scrollTop,b=w.scrollHeight,R=w.clientHeight,A=u.current,C=m>0,L=b-R-S,I=!1;L>m&&o.current&&(i&&i(_),o.current=!1),C&&a.current&&(s&&s(_),a.current=!1),C&&m>L?(t&&!o.current&&t(_),A.scrollTop=b,I=!0,o.current=!0):!C&&-m>S&&(r&&!a.current&&r(_),A.scrollTop=0,I=!0,a.current=!0),I&&Wj(_)}},[t,i,r,s]),d=Y.useCallback(function(_){f(_,_.deltaY)},[f]),p=Y.useCallback(function(_){l.current=_.changedTouches[0].clientY},[]),g=Y.useCallback(function(_){var m=l.current-_.changedTouches[0].clientY;f(_,m)},[f]),v=Y.useCallback(function(_){if(_){var m=f9?{passive:!1}:!1;_.addEventListener("wheel",d,m),_.addEventListener("touchstart",p,m),_.addEventListener("touchmove",g,m)}},[g,p,d]),x=Y.useCallback(function(_){_&&(_.removeEventListener("wheel",d,!1),_.removeEventListener("touchstart",p,!1),_.removeEventListener("touchmove",g,!1))},[g,p,d]);return Y.useEffect(function(){if(e){var _=u.current;return v(_),function(){x(_)}}},[e,v,x]),function(_){u.current=_}}var bR=["boxSizing","height","overflow","paddingRight","position"],TR={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function AR(n){n.preventDefault()}function CR(n){n.stopPropagation()}function RR(){var n=this.scrollTop,e=this.scrollHeight,t=n+this.offsetHeight;n===0?this.scrollTop=1:t===e&&(this.scrollTop=n-1)}function PR(){return"ontouchstart"in window||navigator.maxTouchPoints}var IR=!!(typeof window<"u"&&window.document&&window.document.createElement),Ih=0,Au={capture:!1,passive:!1};function Xj(n){var e=n.isEnabled,t=n.accountForScrollbars,i=t===void 0?!0:t,r=Y.useRef({}),s=Y.useRef(null),o=Y.useCallback(function(l){if(IR){var u=document.body,f=u&&u.style;if(i&&bR.forEach(function(v){var x=f&&f[v];r.current[v]=x}),i&&Ih<1){var d=parseInt(r.current.paddingRight,10)||0,p=document.body?document.body.clientWidth:0,g=window.innerWidth-p+d||0;Object.keys(TR).forEach(function(v){var x=TR[v];f&&(f[v]=x)}),f&&(f.paddingRight="".concat(g,"px"))}u&&PR()&&(u.addEventListener("touchmove",AR,Au),l&&(l.addEventListener("touchstart",RR,Au),l.addEventListener("touchmove",CR,Au))),Ih+=1}},[i]),a=Y.useCallback(function(l){if(IR){var u=document.body,f=u&&u.style;Ih=Math.max(Ih-1,0),i&&Ih<1&&bR.forEach(function(d){var p=r.current[d];f&&(f[d]=p)}),u&&PR()&&(u.removeEventListener("touchmove",AR,Au),l&&(l.removeEventListener("touchstart",RR,Au),l.removeEventListener("touchmove",CR,Au)))}},[i]);return Y.useEffect(function(){if(e){var l=s.current;return o(l),function(){a(l)}}},[e,o,a]),function(l){s.current=l}}var $j=function(e){var t=e.target;return t.ownerDocument.activeElement&&t.ownerDocument.activeElement.blur()},qj={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function Yj(n){var e=n.children,t=n.lockEnabled,i=n.captureEnabled,r=i===void 0?!0:i,s=n.onBottomArrive,o=n.onBottomLeave,a=n.onTopArrive,l=n.onTopLeave,u=jj({isEnabled:r,onBottomArrive:s,onBottomLeave:o,onTopArrive:a,onTopLeave:l}),f=Xj({isEnabled:t}),d=function(g){u(g),f(g)};return nt(Y.Fragment,null,t&&nt("div",{onClick:$j,css:qj}),e(d))}var Zj={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},Kj=function(e){var t=e.name,i=e.onFocus;return nt("input",{required:!0,name:t,tabIndex:-1,"aria-hidden":"true",onFocus:i,css:Zj,value:"",onChange:function(){}})},Jj=Kj;function oE(n){var e;return typeof window<"u"&&window.navigator!=null?n.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function Qj(){return oE(/^iPhone/i)}function $N(){return oE(/^Mac/i)}function e7(){return oE(/^iPad/i)||$N()&&navigator.maxTouchPoints>1}function t7(){return Qj()||e7()}function n7(){return $N()||t7()}var i7=function(e){return e.label},r7=function(e){return e.label},s7=function(e){return e.value},o7=function(e){return!!e.isDisabled},a7={clearIndicator:G9,container:L9,control:Z9,dropdownIndicator:V9,group:ej,groupHeading:nj,indicatorsContainer:k9,indicatorSeparator:j9,input:oj,loadingIndicator:q9,loadingMessage:A9,menu:x9,menuList:E9,menuPortal:P9,multiValue:hj,multiValueLabel:fj,multiValueRemove:dj,noOptionsMessage:T9,option:_j,placeholder:Sj,singleValue:bj,valueContainer:D9},l7={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%)"},u7=4,qN=4,c7=38,h7=qN*2,f7={baseUnit:qN,controlHeight:c7,menuGutter:h7},Gx={borderRadius:u7,colors:l7,spacing:f7},d7={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:xR(),captureMenuScroll:!xR(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:Vj(),formatGroupLabel:i7,getOptionLabel:r7,getOptionValue:s7,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:o7,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!c9(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var t=e.count;return"".concat(t," result").concat(t!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function LR(n,e,t,i){var r=KN(n,e,t),s=JN(n,e,t),o=ZN(n,e),a=_v(n,e);return{type:"option",data:e,isDisabled:r,isSelected:s,label:o,value:a,index:i}}function yg(n,e){return n.options.map(function(t,i){if("options"in t){var r=t.options.map(function(o,a){return LR(n,o,e,a)}).filter(function(o){return DR(n,o)});return r.length>0?{type:"group",data:t,options:r,index:i}:void 0}var s=LR(n,t,e,i);return DR(n,s)?s:void 0}).filter(d9)}function YN(n){return n.reduce(function(e,t){return t.type==="group"?e.push.apply(e,$M(t.options.map(function(i){return i.data}))):e.push(t.data),e},[])}function NR(n,e){return n.reduce(function(t,i){return i.type==="group"?t.push.apply(t,$M(i.options.map(function(r){return{data:r.data,id:"".concat(e,"-").concat(i.index,"-").concat(r.index)}}))):t.push({data:i.data,id:"".concat(e,"-").concat(i.index)}),t},[])}function p7(n,e){return YN(yg(n,e))}function DR(n,e){var t=n.inputValue,i=t===void 0?"":t,r=e.data,s=e.isSelected,o=e.label,a=e.value;return(!eD(n)||!s)&&QN(n,{label:o,value:a,data:r},i)}function m7(n,e){var t=n.focusedValue,i=n.selectValue,r=i.indexOf(t);if(r>-1){var s=e.indexOf(t);if(s>-1)return t;if(r-1?t:e[0]}var Wx=function(e,t){var i,r=(i=e.find(function(s){return s.data===t}))===null||i===void 0?void 0:i.id;return r||null},ZN=function(e,t){return e.getOptionLabel(t)},_v=function(e,t){return e.getOptionValue(t)};function KN(n,e,t){return typeof n.isOptionDisabled=="function"?n.isOptionDisabled(e,t):!1}function JN(n,e,t){if(t.indexOf(e)>-1)return!0;if(typeof n.isOptionSelected=="function")return n.isOptionSelected(e,t);var i=_v(n,e);return t.some(function(r){return _v(n,r)===i})}function QN(n,e,t){return n.filterOption?n.filterOption(e,t):!0}var eD=function(e){var t=e.hideSelectedOptions,i=e.isMulti;return t===void 0?i:t},v7=1,tD=function(n){DW(t,n);var e=FW(t);function t(i){var r;if(LW(this,t),r=e.call(this,i),r.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:""},r.blockOptionHover=!1,r.isComposing=!1,r.commonProps=void 0,r.initialTouchX=0,r.initialTouchY=0,r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.isAppleDevice=n7(),r.controlRef=null,r.getControlRef=function(l){r.controlRef=l},r.focusedOptionRef=null,r.getFocusedOptionRef=function(l){r.focusedOptionRef=l},r.menuListRef=null,r.getMenuListRef=function(l){r.menuListRef=l},r.inputRef=null,r.getInputRef=function(l){r.inputRef=l},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(l,u){var f=r.props,d=f.onChange,p=f.name;u.name=p,r.ariaOnChange(l,u),d(l,u)},r.setValue=function(l,u,f){var d=r.props,p=d.closeMenuOnSelect,g=d.isMulti,v=d.inputValue;r.onInputChange("",{action:"set-value",prevInputValue:v}),p&&(r.setState({inputIsHiddenAfterUpdate:!g}),r.onMenuClose()),r.setState({clearFocusValueOnUpdate:!0}),r.onChange(l,{action:u,option:f})},r.selectOption=function(l){var u=r.props,f=u.blurInputOnSelect,d=u.isMulti,p=u.name,g=r.state.selectValue,v=d&&r.isOptionSelected(l,g),x=r.isOptionDisabled(l,g);if(v){var _=r.getOptionValue(l);r.setValue(g.filter(function(m){return r.getOptionValue(m)!==_}),"deselect-option",l)}else if(!x)d?r.setValue([].concat($M(g),[l]),"select-option",l):r.setValue(l,"select-option");else{r.ariaOnChange(l,{action:"select-option",option:l,name:p});return}f&&r.blurInput()},r.removeValue=function(l){var u=r.props.isMulti,f=r.state.selectValue,d=r.getOptionValue(l),p=f.filter(function(v){return r.getOptionValue(v)!==d}),g=zm(u,p,p[0]||null);r.onChange(g,{action:"remove-value",removedValue:l}),r.focusInput()},r.clearValue=function(){var l=r.state.selectValue;r.onChange(zm(r.props.isMulti,[],null),{action:"clear",removedValues:l})},r.popValue=function(){var l=r.props.isMulti,u=r.state.selectValue,f=u[u.length-1],d=u.slice(0,u.length-1),p=zm(l,d,d[0]||null);r.onChange(p,{action:"pop-value",removedValue:f})},r.getFocusedOptionId=function(l){return Wx(r.state.focusableOptionsWithIds,l)},r.getFocusableOptionsWithIds=function(){return NR(yg(r.props,r.state.selectValue),r.getElementId("option"))},r.getValue=function(){return r.state.selectValue},r.cx=function(){for(var l=arguments.length,u=new Array(l),f=0;fg||p>g}},r.onTouchEnd=function(l){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(l.target)&&r.menuListRef&&!r.menuListRef.contains(l.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(l){r.userIsDragging||r.onControlMouseDown(l)},r.onClearIndicatorTouchEnd=function(l){r.userIsDragging||r.onClearIndicatorMouseDown(l)},r.onDropdownIndicatorTouchEnd=function(l){r.userIsDragging||r.onDropdownIndicatorMouseDown(l)},r.handleInputChange=function(l){var u=r.props.inputValue,f=l.currentTarget.value;r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange(f,{action:"input-change",prevInputValue:u}),r.props.menuIsOpen||r.onMenuOpen()},r.onInputFocus=function(l){r.props.onFocus&&r.props.onFocus(l),r.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(l){var u=r.props.inputValue;if(r.menuListRef&&r.menuListRef.contains(document.activeElement)){r.inputRef.focus();return}r.props.onBlur&&r.props.onBlur(l),r.onInputChange("",{action:"input-blur",prevInputValue:u}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1})},r.onOptionHover=function(l){if(!(r.blockOptionHover||r.state.focusedOption===l)){var u=r.getFocusableOptions(),f=u.indexOf(l);r.setState({focusedOption:l,focusedOptionId:f>-1?r.getFocusedOptionId(l):null})}},r.shouldHideSelectedOptions=function(){return eD(r.props)},r.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),r.focus()},r.onKeyDown=function(l){var u=r.props,f=u.isMulti,d=u.backspaceRemovesValue,p=u.escapeClearsValue,g=u.inputValue,v=u.isClearable,x=u.isDisabled,_=u.menuIsOpen,m=u.onKeyDown,w=u.tabSelectsValue,S=u.openMenuOnFocus,b=r.state,R=b.focusedOption,A=b.focusedValue,C=b.selectValue;if(!x&&!(typeof m=="function"&&(m(l),l.defaultPrevented))){switch(r.blockOptionHover=!0,l.key){case"ArrowLeft":if(!f||g)return;r.focusValue("previous");break;case"ArrowRight":if(!f||g)return;r.focusValue("next");break;case"Delete":case"Backspace":if(g)return;if(A)r.removeValue(A);else{if(!d)return;f?r.popValue():v&&r.clearValue()}break;case"Tab":if(r.isComposing||l.shiftKey||!_||!w||!R||S&&r.isOptionSelected(R,C))return;r.selectOption(R);break;case"Enter":if(l.keyCode===229)break;if(_){if(!R||r.isComposing)return;r.selectOption(R);break}return;case"Escape":_?(r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange("",{action:"menu-close",prevInputValue:g}),r.onMenuClose()):v&&p&&r.clearValue();break;case" ":if(g)return;if(!_){r.openMenu("first");break}if(!R)return;r.selectOption(R);break;case"ArrowUp":_?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":_?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!_)return;r.focusOption("pageup");break;case"PageDown":if(!_)return;r.focusOption("pagedown");break;case"Home":if(!_)return;r.focusOption("first");break;case"End":if(!_)return;r.focusOption("last");break;default:return}l.preventDefault()}},r.state.instancePrefix="react-select-"+(r.props.instanceId||++v7),r.state.selectValue=yR(i.value),i.menuIsOpen&&r.state.selectValue.length){var s=r.getFocusableOptionsWithIds(),o=r.buildFocusableOptions(),a=o.indexOf(r.state.selectValue[0]);r.state.focusableOptionsWithIds=s,r.state.focusedOption=o[a],r.state.focusedOptionId=Wx(s,o[a])}return r}return NW(t,[{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&&_R(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(r){var s=this.props,o=s.isDisabled,a=s.menuIsOpen,l=this.state.isFocused;(l&&!o&&r.isDisabled||l&&a&&!r.menuIsOpen)&&this.focusInput(),l&&o&&!r.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!o&&r.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(_R(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(r,s){this.props.onInputChange(r,s)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(r){var s=this,o=this.state,a=o.selectValue,l=o.isFocused,u=this.buildFocusableOptions(),f=r==="first"?0:u.length-1;if(!this.props.isMulti){var d=u.indexOf(a[0]);d>-1&&(f=d)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[f],focusedOptionId:this.getFocusedOptionId(u[f])},function(){return s.onMenuOpen()})}},{key:"focusValue",value:function(r){var s=this.state,o=s.selectValue,a=s.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=o.indexOf(a);a||(l=-1);var u=o.length-1,f=-1;if(o.length){switch(r){case"previous":l===0?f=0:l===-1?f=u:f=l-1;break;case"next":l>-1&&l0&&arguments[0]!==void 0?arguments[0]:"first",s=this.props.pageSize,o=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,u=a.indexOf(o);o||(u=-1),r==="up"?l=u>0?u-1:a.length-1:r==="down"?l=(u+1)%a.length:r==="pageup"?(l=u-s,l<0&&(l=0)):r==="pagedown"?(l=u+s,l>a.length-1&&(l=a.length-1)):r==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Gx):st(st({},Gx),this.props.theme):Gx}},{key:"getCommonProps",value:function(){var r=this.clearValue,s=this.cx,o=this.getStyles,a=this.getClassNames,l=this.getValue,u=this.selectOption,f=this.setValue,d=this.props,p=d.isMulti,g=d.isRtl,v=d.options,x=this.hasValue();return{clearValue:r,cx:s,getStyles:o,getClassNames:a,getValue:l,hasValue:x,isMulti:p,isRtl:g,options:v,selectOption:u,selectProps:d,setValue:f,theme:this.getTheme()}}},{key:"hasValue",value:function(){var r=this.state.selectValue;return r.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var r=this.props,s=r.isClearable,o=r.isMulti;return s===void 0?o:s}},{key:"isOptionDisabled",value:function(r,s){return KN(this.props,r,s)}},{key:"isOptionSelected",value:function(r,s){return JN(this.props,r,s)}},{key:"filterOption",value:function(r,s){return QN(this.props,r,s)}},{key:"formatOptionLabel",value:function(r,s){if(typeof this.props.formatOptionLabel=="function"){var o=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(r,{context:s,inputValue:o,selectValue:a})}else return this.getOptionLabel(r)}},{key:"formatGroupLabel",value:function(r){return this.props.formatGroupLabel(r)}},{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 r=this.props,s=r.isDisabled,o=r.isSearchable,a=r.inputId,l=r.inputValue,u=r.tabIndex,f=r.form,d=r.menuIsOpen,p=r.required,g=this.getComponents(),v=g.Input,x=this.state,_=x.inputIsHidden,m=x.ariaSelection,w=this.commonProps,S=a||this.getElementId("input"),b=st(st(st({"aria-autocomplete":"list","aria-expanded":d,"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||""},d&&{"aria-controls":this.getElementId("listbox")}),!o&&{"aria-readonly":!0}),this.hasValue()?(m==null?void 0:m.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return o?Y.createElement(v,ct({},w,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:S,innerRef:this.getInputRef,isDisabled:s,isHidden:_,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:f,type:"text",value:l},b)):Y.createElement(Gj,ct({id:S,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:vv,onFocus:this.onInputFocus,disabled:s,tabIndex:u,inputMode:"none",form:f,value:""},b))}},{key:"renderPlaceholderOrValue",value:function(){var r=this,s=this.getComponents(),o=s.MultiValue,a=s.MultiValueContainer,l=s.MultiValueLabel,u=s.MultiValueRemove,f=s.SingleValue,d=s.Placeholder,p=this.commonProps,g=this.props,v=g.controlShouldRenderValue,x=g.isDisabled,_=g.isMulti,m=g.inputValue,w=g.placeholder,S=this.state,b=S.selectValue,R=S.focusedValue,A=S.isFocused;if(!this.hasValue()||!v)return m?null:Y.createElement(d,ct({},p,{key:"placeholder",isDisabled:x,isFocused:A,innerProps:{id:this.getElementId("placeholder")}}),w);if(_)return b.map(function(L,I){var E=L===R,N="".concat(r.getOptionLabel(L),"-").concat(r.getOptionValue(L));return Y.createElement(o,ct({},p,{components:{Container:a,Label:l,Remove:u},isFocused:E,isDisabled:x,key:N,index:I,removeProps:{onClick:function(){return r.removeValue(L)},onTouchEnd:function(){return r.removeValue(L)},onMouseDown:function(O){O.preventDefault()}},data:L}),r.formatOptionLabel(L,"value"))});if(m)return null;var C=b[0];return Y.createElement(f,ct({},p,{data:C,isDisabled:x}),this.formatOptionLabel(C,"value"))}},{key:"renderClearIndicator",value:function(){var r=this.getComponents(),s=r.ClearIndicator,o=this.commonProps,a=this.props,l=a.isDisabled,u=a.isLoading,f=this.state.isFocused;if(!this.isClearable()||!s||l||!this.hasValue()||u)return null;var d={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return Y.createElement(s,ct({},o,{innerProps:d,isFocused:f}))}},{key:"renderLoadingIndicator",value:function(){var r=this.getComponents(),s=r.LoadingIndicator,o=this.commonProps,a=this.props,l=a.isDisabled,u=a.isLoading,f=this.state.isFocused;if(!s||!u)return null;var d={"aria-hidden":"true"};return Y.createElement(s,ct({},o,{innerProps:d,isDisabled:l,isFocused:f}))}},{key:"renderIndicatorSeparator",value:function(){var r=this.getComponents(),s=r.DropdownIndicator,o=r.IndicatorSeparator;if(!s||!o)return null;var a=this.commonProps,l=this.props.isDisabled,u=this.state.isFocused;return Y.createElement(o,ct({},a,{isDisabled:l,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var r=this.getComponents(),s=r.DropdownIndicator;if(!s)return null;var o=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return Y.createElement(s,ct({},o,{innerProps:u,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var r=this,s=this.getComponents(),o=s.Group,a=s.GroupHeading,l=s.Menu,u=s.MenuList,f=s.MenuPortal,d=s.LoadingMessage,p=s.NoOptionsMessage,g=s.Option,v=this.commonProps,x=this.state.focusedOption,_=this.props,m=_.captureMenuScroll,w=_.inputValue,S=_.isLoading,b=_.loadingMessage,R=_.minMenuHeight,A=_.maxMenuHeight,C=_.menuIsOpen,L=_.menuPlacement,I=_.menuPosition,E=_.menuPortalTarget,N=_.menuShouldBlockScroll,z=_.menuShouldScrollIntoView,O=_.noOptionsMessage,q=_.onMenuScrollToTop,j=_.onMenuScrollToBottom;if(!C)return null;var Q=function(_e,J){var pe=_e.type,Me=_e.data,de=_e.isDisabled,Qe=_e.isSelected,lt=_e.label,K=_e.value,tt=x===Me,he=de?void 0:function(){return r.onOptionHover(Me)},we=de?void 0:function(){return r.selectOption(Me)},ye="".concat(r.getElementId("option"),"-").concat(J),Ce={id:ye,onClick:we,onMouseMove:he,onMouseOver:he,tabIndex:-1,role:"option","aria-selected":r.isAppleDevice?void 0:Qe};return Y.createElement(g,ct({},v,{innerProps:Ce,data:Me,isDisabled:de,isSelected:Qe,key:ye,label:lt,type:pe,value:K,isFocused:tt,innerRef:tt?r.getFocusedOptionRef:void 0}),r.formatOptionLabel(_e.data,"menu"))},oe;if(this.hasOptions())oe=this.getCategorizedOptions().map(function(me){if(me.type==="group"){var _e=me.data,J=me.options,pe=me.index,Me="".concat(r.getElementId("group"),"-").concat(pe),de="".concat(Me,"-heading");return Y.createElement(o,ct({},v,{key:Me,data:_e,options:J,Heading:a,headingProps:{id:de,data:me.data},label:r.formatGroupLabel(me.data)}),me.options.map(function(Qe){return Q(Qe,"".concat(pe,"-").concat(Qe.index))}))}else if(me.type==="option")return Q(me,"".concat(me.index))});else if(S){var k=b({inputValue:w});if(k===null)return null;oe=Y.createElement(d,v,k)}else{var W=O({inputValue:w});if(W===null)return null;oe=Y.createElement(p,v,W)}var G={minMenuHeight:R,maxMenuHeight:A,menuPlacement:L,menuPosition:I,menuShouldScrollIntoView:z},ne=Y.createElement(w9,ct({},v,G),function(me){var _e=me.ref,J=me.placerProps,pe=J.placement,Me=J.maxHeight;return Y.createElement(l,ct({},v,G,{innerRef:_e,innerProps:{onMouseDown:r.onMenuMouseDown,onMouseMove:r.onMenuMouseMove},isLoading:S,placement:pe}),Y.createElement(Yj,{captureEnabled:m,onTopArrive:q,onBottomArrive:j,lockEnabled:N},function(de){return Y.createElement(u,ct({},v,{innerRef:function(lt){r.getMenuListRef(lt),de(lt)},innerProps:{role:"listbox","aria-multiselectable":v.isMulti,id:r.getElementId("listbox")},isLoading:S,maxHeight:Me,focusedOption:x}),oe)}))});return E||I==="fixed"?Y.createElement(f,ct({},v,{appendTo:E,controlElement:this.controlRef,menuPlacement:L,menuPosition:I}),ne):ne}},{key:"renderFormField",value:function(){var r=this,s=this.props,o=s.delimiter,a=s.isDisabled,l=s.isMulti,u=s.name,f=s.required,d=this.state.selectValue;if(f&&!this.hasValue()&&!a)return Y.createElement(Jj,{name:u,onFocus:this.onValueInputFocus});if(!(!u||a))if(l)if(o){var p=d.map(function(x){return r.getOptionValue(x)}).join(o);return Y.createElement("input",{name:u,type:"hidden",value:p})}else{var g=d.length>0?d.map(function(x,_){return Y.createElement("input",{key:"i-".concat(_),name:u,type:"hidden",value:r.getOptionValue(x)})}):Y.createElement("input",{name:u,type:"hidden",value:""});return Y.createElement("div",null,g)}else{var v=d[0]?this.getOptionValue(d[0]):"";return Y.createElement("input",{name:u,type:"hidden",value:v})}}},{key:"renderLiveRegion",value:function(){var r=this.commonProps,s=this.state,o=s.ariaSelection,a=s.focusedOption,l=s.focusedValue,u=s.isFocused,f=s.selectValue,d=this.getFocusableOptions();return Y.createElement(Fj,ct({},r,{id:this.getElementId("live-region"),ariaSelection:o,focusedOption:a,focusedValue:l,isFocused:u,selectValue:f,focusableOptions:d,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var r=this.getComponents(),s=r.Control,o=r.IndicatorsContainer,a=r.SelectContainer,l=r.ValueContainer,u=this.props,f=u.className,d=u.id,p=u.isDisabled,g=u.menuIsOpen,v=this.state.isFocused,x=this.commonProps=this.getCommonProps();return Y.createElement(a,ct({},x,{className:f,innerProps:{id:d,onKeyDown:this.onKeyDown},isDisabled:p,isFocused:v}),this.renderLiveRegion(),Y.createElement(s,ct({},x,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:p,isFocused:v,menuIsOpen:g}),Y.createElement(l,ct({},x,{isDisabled:p}),this.renderPlaceholderOrValue(),this.renderInput()),Y.createElement(o,ct({},x,{isDisabled:p}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(r,s){var o=s.prevProps,a=s.clearFocusValueOnUpdate,l=s.inputIsHiddenAfterUpdate,u=s.ariaSelection,f=s.isFocused,d=s.prevWasFocused,p=s.instancePrefix,g=r.options,v=r.value,x=r.menuIsOpen,_=r.inputValue,m=r.isMulti,w=yR(v),S={};if(o&&(v!==o.value||g!==o.options||x!==o.menuIsOpen||_!==o.inputValue)){var b=x?p7(r,w):[],R=x?NR(yg(r,w),"".concat(p,"-option")):[],A=a?m7(s,w):null,C=g7(s,b),L=Wx(R,C);S={selectValue:w,focusedOption:C,focusedOptionId:L,focusableOptionsWithIds:R,focusedValue:A,clearFocusValueOnUpdate:!1}}var I=l!=null&&r!==o?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},E=u,N=f&&d;return f&&!N&&(E={value:zm(m,w,w[0]||null),options:w,action:"initial-input-focus"},N=!d),(u==null?void 0:u.action)==="initial-input-focus"&&(E=null),st(st(st({},S),I),{},{prevProps:r,ariaSelection:E,prevWasFocused:N})}}]),t}(Y.Component);tD.defaultProps=d7;var y7=Y.forwardRef(function(n,e){var t=IW(n);return Y.createElement(tD,ct({ref:e},t))}),_7=y7;const x7=({conceptCategories:n,concepts:e,setConcepts:t})=>{const i=r=>{r in n&&t(n[r].map((s,o)=>({label:s.label,description:s.description,color:EW(o),embeddings:[],position:[0,0,0],index:o})))};return We.jsxs("div",{className:"PanelConceptCategories",children:[We.jsx("h3",{style:{textAlign:"left"},className:"HiddenOnMobile",children:"# Categories"}),We.jsx(_7,{className:"SelectConcept",placeholder:"Select a category...",isSearchable:!1,menuPortalTarget:document.body,options:Object.keys(n).map(r=>({value:r,label:r})),onChange:r=>{i((r==null?void 0:r.value)||"")}}),We.jsx("h2",{style:{height:"300px",overflow:"scroll"},className:"HiddenOnMobile",children:e.map(r=>We.jsx(cN,{color:r.color,inputValue:r.label,inputId:`prompt-${r.index}`,title:r.description},`prompt-${r.index}`))})]})},w7=({onChangeMyConcept:n})=>We.jsxs("div",{className:"PanelMyConcept",children:[We.jsx("h3",{style:{textAlign:"left"},className:"HiddenOnMobile",children:"# Your concept"}),We.jsx("h2",{children:We.jsx(cN,{color:"black",inputId:"prompt-test",onChanged:n})}),We.jsx("div",{style:{textAlign:"center"},className:"HiddenOnMobile",children:We.jsx("button",{onClick:()=>{n(document.getElementById("prompt-test").value)},children:"Represent Concept"})})]}),S7=({text:n})=>We.jsx("pre",{className:"CardHoveredConcept",children:We.jsx("strong",{children:We.jsx("em",{children:n})})}),nD=[{label:"Pure happiness",description:'Joy - "Pure happiness." Joy is a powerful, often euphoric state of happiness that is usually caused by something exceptionally good or satisfying. It often includes feelings of contentment, satisfaction, and well-being.'},{label:"Sorrowful distress",description:'Sadness - "Sorrowful distress." This emotion is typically associated with feelings of disadvantage, loss, and helplessness. When someone is sad, they often feel down and might have a low mood that affects their day-to-day activities.'},{label:"Anxiety anticipation",description:'Fear - "Anxiety anticipation." Fear is a response to an impending threat or danger, characterized by increased alertness and preparation for physical action. It often serves a protective purpose, triggering the "fight-or-flight" response.'},{label:"Fierce irritation",description:'Anger - "Fierce irritation." Anger is an emotional response to perceived wrongs and injustice, often resulting in a desire to assert authority or independence, or a tendency to retaliate against the source of offense.'},{label:"Unexpected astonishment",description:`Surprise - "Unexpected astonishment." This emotion is a response to an unexpected event. It can be either positive or negative, depending on the nature of the surprise. It's characterized by a high level of stimulation and a need to re-evaluate one's understanding of the situation.`},{label:"Revulsion reaction",description:'Disgust - "Revulsion reaction." Disgust is a powerful aversion to something perceived as unpleasant or offensive. This emotion can be triggered by various stimuli including unpleasant tastes, sights, or moral situations.'},{label:"Scornful disdain",description:'Contempt - "Scornful disdain." Contempt is an emotion that puts someone or something considered worthless or beneath consideration. This emotion often involves moral superiority and a lack of respect.'},{label:"Confident reliance",description:'Trust - "Confident reliance." Trust is an emotion reflecting a level of comfort and firm belief in the reliability or truth of someone or something. It involves a complex mix of affective experiences with a significant history of interactions.'}],iD=[{label:"Visionary guidance",description:'Authoritative Leadership - "Visionary guidance." This style is characterized by a leader who sets clear objectives and directions but allows individuals some flexibility in how they achieve these goals. They motivate by appealing to people’s shared goals.'},{label:"Collective input",description:'Democratic Leadership - "Collective input." Leaders using this style solicit input from team members in decision-making processes, fostering collaboration and participation. This approach can boost morale and creativity by making members feel valued and involved.'},{label:"Hands-off management",description:'Laissez-faire Leadership - "Hands-off management." In this style, the leader provides little guidance to team members, who are then allowed to make decisions and solve problems on their own. This can be effective in highly skilled teams but risky in teams needing direction.'},{label:"Performance reward",description:'Transactional Leadership - "Performance reward." Leaders focusing on this style are centered on clear structures wherein specific tasks are rewarded. Performance is closely monitored and feedback is given directly related to achievements. This approach works well in environments where tasks are routine and outcomes are predictable.'},{label:"Inspiring change",description:'Transformational Leadership - "Inspiring change." These leaders focus on initiating change in organizations, staff, and themselves. They are characterized by their ability to inspire and motivate employees to exceed expectations by aligning team goals with a higher vision.'},{label:"Personal development",description:'Coaching Leadership - "Personal development." Coaching leaders focus heavily on the professional and personal development of their team members. They provide one-on-one guidance to help team members meet their individual goals, which in turn enhances their performance at work.'},{label:"Directive control",description:'Autocratic Leadership - "Directive control." This style is defined by individual control over all decisions with little input from group members. It can be effective in crises but might stifle creativity and autonomy in a standard setting.'},{label:"Supportive facilitator",description:'Servant Leadership - "Supportive facilitator." Servant leaders put the needs of their team members first and help people develop and perform as highly as possible. They lead by example and gain authority by earning trust and fostering a service-oriented environment.'}],rD=[{label:"Continuous focus",description:'Sustained Attention - "Continuous focus." This type of attention is required for activities that demand prolonged concentration, such as studying for an exam or driving a long distance. It involves maintaining focus on a task over an extended period without becoming distracted.'},{label:"Targeted filtering",description:'Selective Attention - "Targeted filtering." Selective attention involves focusing on one specific aspect of the environment while ignoring other stimuli. For example, listening to a friend talk in a noisy room requires the ability to filter out the background noise.'},{label:"Switching focus",description:'Alternating Attention - "Switching focus." This type of attention allows an individual to shift focus between tasks that require different cognitive demands. For instance, alternating between writing a report and responding to emails.'},{label:"Multitasking efficiency",description:'Divided Attention - "Multitasking efficiency." Divided attention refers to the ability to process two or more responses or react to multiple tasks at the same time, such as cooking while watching TV.'},{label:"Complex management",description:'Executive Attention - "Complex management." This involves high-level thought, decision-making, and the management of attention resources among several tasks or priorities, such as planning a project while considering multiple variables.'},{label:"Involuntary awareness",description:'Passive Attention - "Involuntary awareness." Passive attention is drawn to stimuli without any conscious effort, often triggered by something surprising or significant, such as the sudden sound of a loud crash.'},{label:"Minimal engagement",description:'Bored Attention - "Minimal engagement." This is a form of attention where the focus is maintained nominally, often under unstimulating conditions. It’s the kind of attention you might use during a dull lecture or a repetitive task.'},{label:"Intense concentration",description:'Hyperfocus - "Intense concentration." This is an extreme form of mental concentration or visualization that focuses consciousness on a subject, topic, or task. In hyperfocus, one can become so absorbed in the task that they become oblivious to everything else around them, often found in highly engaging activities like playing video games or during a creative burst.'}],sD=[{label:"Persistent sadness",description:'Major Depression - "Persistent sadness." This mood disorder is characterized by a persistent feeling of sadness and a lack of interest in external stimuli. Symptoms can also include changes in sleep, appetite, energy level, concentration, daily behavior, or self-esteem.'},{label:"Constant worry",description:'Generalized Anxiety Disorder (GAD) - "Constant worry." GAD involves excessive, uncontrollable worry about everyday issues, such as health, money, or career. This worry is disproportionate to the actual source of concern and can affect physical health.'},{label:"Mood extremes",description:`Bipolar Disorder - "Mood extremes." This condition is marked by dramatic shifts in a person's mood, energy and ability to think clearly. These mood swings can range from highs (mania) to lows (depression), sometimes with periods of normal mood in between.`},{label:"Altered perceptions",description:'Schizophrenia - "Altered perceptions." Schizophrenia is a complex, long-term medical illness, characterized by symptoms like hallucinations, delusions, and extremely disordered thinking and behavior that impairs daily functioning.'},{label:"Compulsive behavior",description:'Obsessive-Compulsive Disorder (OCD) - "Compulsive behavior." OCD is characterized by unreasonable thoughts and fears (obsessions) that lead to compulsive behaviors. This disorder often centers on themes such as fear of germs or the need to arrange objects in a specific manner.'},{label:"Trauma aftermath",description:'Post-Traumatic Stress Disorder (PTSD) - "Trauma aftermath." PTSD can occur after a person has experienced or witnessed a traumatic event such as a natural disaster, a serious accident, a terrorist act, war/combat, rape, or other violent personal assault.'},{label:"Emotional instability",description:'Borderline Personality Disorder (BPD) - "Emotional instability." BPD is characterized by difficulties in regulating emotion. This can lead to severe, unstable mood swings, impulsivity and instability, poor self-image, and tumultuous personal relationships.'},{label:"Focus deficiency",description:'Attention Deficit Hyperactivity Disorder (ADHD) - "Focus deficiency." ADHD is characterized by a continuous pattern of inattention and/or hyperactivity-impulsivity that interferes with functioning or development. It often presents problems with organizing tasks, staying focused on one task, and social interaction.'}],oD=[{label:"Equitable entitlements",description:'Social Rights - "Equitable entitlements." This involves advocating and ensuring that all individuals have equal access to basic rights and liberties, such as education, healthcare, and fair treatment under the law.'},{label:"Eco-conscious actions",description:`Environmental Care - "Eco-conscious actions." Environmental responsibility emphasizes the protection and improvement of the planet's ecosystems. This includes efforts to reduce pollution, conserve resources, and uphold biodiversity.`},{label:"Wealth distribution",description:'Economic Equality - "Wealth distribution." This type of social responsibility focuses on reducing the disparities in economic opportunity and wealth among different groups within society, aiming to achieve a more equitable economic landscape.'},{label:"Ethical management",description:'Corporate Governance - "Ethical management." This pertains to the way in which companies are directed and controlled, ensuring they operate with fairness, transparency, and accountability to their stakeholders.'},{label:"Local engagement",description:'Community Involvement - "Local engagement." This emphasizes the importance of businesses and individuals participating in community development and support, such as local volunteering, support for community projects, and enhancement of local facilities.'},{label:"Diversity acceptance",description:'Cultural Awareness - "Diversity acceptance." Cultural responsibility involves recognizing, respecting, and preserving the various cultures within a community or society, promoting diversity and inclusion.'},{label:"Promoting well-being",description:'Health and Wellness - "Promoting well-being." This focuses on improving health outcomes for all members of society by advocating for better health services, education, and preventive measures to ensure public health and safety.'},{label:"Responsible purchasing",description:'Ethical Consumption - "Responsible purchasing." This involves making purchasing decisions that are conscious of the environmental and social impacts of products and services, supporting fair trade and ethically produced goods.'}],aD=[{label:"Bodily harm",description:'Physical Abuse - "Bodily harm." This form involves any intentional act causing injury or trauma to another person through physical contact. It includes hitting, punching, slapping, and other forms of physical assault.'},{label:"Psychological harm",description:'Emotional Abuse - "Psychological harm." Emotional or psychological abuse involves exposing someone to behavior that may result in psychological trauma, including anxiety, chronic depression, or post-traumatic stress disorder. It typically involves verbal assault, humiliation, intimidation, or infantilization.'},{label:"Violated consent",description:'Sexual Abuse - "Violated consent." This type of abuse involves forcing undesired sexual behavior by one person upon another. It ranges from non-consensual touching and coercive sexual acts to any sexual contact with someone unable to give consent.'},{label:"Economic control",description:`Financial Abuse - "Economic control." Financial or economic abuse involves controlling a person's ability to acquire, use, and maintain financial resources. Victims are often restricted from accessing funds or are stolen from directly, which diminishes their capacity to support themselves and forces dependency.`},{label:"Care deprivation",description:'Neglect - "Care deprivation." Neglect is a form of abuse where the caregiver fails to provide adequate care in terms of food, shelter, health care, and clothing to someone who cannot care for themselves, often resulting in deteriorating health or wellbeing.'},{label:"Destructive words",description:`Verbal Abuse - "Destructive words." This encompasses any use of language that is demeaning, derogatory, or insulting, intended to undermine the self-esteem of the person it's directed towards. It can be loud or subtle, including threats, insults, or excessively critical comments.`},{label:"Faith manipulation",description:'Spiritual Abuse - "Faith manipulation." This involves using a person’s spiritual beliefs to manipulate, control, or dominate them. It can include misusing doctrine, applying undue pressure to conform to specific beliefs, or exploiting spiritual authority for personal gain.'},{label:"Digital harassment",description:'Cyber Abuse - "Digital harassment." Cyber abuse takes place online and includes cyberbullying, stalking, and harassment. It uses digital technology to intimidate, threaten, or upset someone, often anonymously and repetitively.'}],lD=[{label:"Governance systems",description:'Politics - "Governance systems." This area involves the activities associated with the governance of a country or other area, especially the debate among individuals or parties having or hoping to achieve power. It shapes laws, policies, and the distribution of resources.'},{label:"Financial infrastructure",description:'Economy - "Financial infrastructure." The economy encompasses all activities related to production, consumption, and trade of goods and services in an area. It affects employment, income levels, and overall economic growth and stability.'},{label:"Knowledge dissemination",description:'Education - "Knowledge dissemination." This sector involves the systems and processes through which education is delivered, including schools, colleges, and educational content. It plays a crucial role in skill development, critical thinking, and social mobility.'},{label:"Spiritual practices",description:'Religion - "Spiritual practices." Religion pertains to the organized collection of beliefs, cultural systems, and world views that relate humanity to an order of existence. It often influences personal values, cultural norms, and community traditions.'},{label:"Medical services",description:'Healthcare - "Medical services." Healthcare represents the organized provision of medical care to individuals or a community through services offered by medical professionals. It impacts public health, life expectancy, and quality of life.'},{label:"Social expressions",description:'Culture - "Social expressions." Culture includes the arts, customs, practices, languages, values, and items that are passed along and valued by a group of people. It enriches societal interactions and reflects the historical and social context of the community.'},{label:"Ecological context",description:'Environment - "Ecological context." This area deals with the interaction between society and the natural surroundings, including issues of conservation, pollution control, and sustainable management of natural resources.'},{label:"Judicial frameworks",description:'Legal System - "Judicial frameworks." The legal system comprises the laws and regulations, as well as the processes and infrastructure for enforcing them, governing the behavior of the populace. It ensures order, resolves disputes, and maintains social justice.'}],M7={Emotions:nD,"Leadership styles":iD,"Attention types":rD,"Mental illness":sD,"Social rights":oD,"Abuse forms":aD,"Social areas":lD},uD=[];Object.values(M7).forEach(n=>n.forEach(e=>uD.push(e)));const E7={Emotions:nD,"Leadership styles":iD,"Attention types":rD,"Mental illness":sD,"Social rights":oD,"Abuse forms":aD,"Social areas":lD,"All categories":uD},Iu="4.47.1";let OR=!1,hf,cD,hD,GS,fD,dD,pD,mD,gD;function b7(n,e={auto:!1}){if(OR)throw new Error(`you must \`import 'openai/shims/${n.kind}'\` before importing anything else from openai`);if(hf)throw new Error(`can't \`import 'openai/shims/${n.kind}'\` after \`import 'openai/shims/${hf}'\``);OR=e.auto,hf=n.kind,cD=n.fetch,hD=n.FormData,GS=n.File,fD=n.ReadableStream,dD=n.getMultipartRequestOptions,pD=n.getDefaultAgent,mD=n.fileFromPath,gD=n.isFsReadStream}class T7{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}function A7({manuallyImported:n}={}){const e=n?"You may need to use polyfills":"Add one of these imports before your first `import … from 'openai'`:\n- `import 'openai/shims/node'` (if you're running on Node)\n- `import 'openai/shims/web'` (otherwise)\n";let t,i,r,s;try{t=fetch,i=Request,r=Response,s=Headers}catch(o){throw new Error(`this environment is missing the following Web Fetch API type: ${o.message}. ${e}`)}return{kind:"web",fetch:t,Request:i,Response:r,Headers:s,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(o,a)=>({...a,body:new T7(o)}),getDefaultAgent:o=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:o=>!1}}hf||b7(A7(),{auto:!0});class kt extends Error{}class ci extends kt{constructor(e,t,i,r){super(`${ci.makeMessage(e,t,i)}`),this.status=e,this.headers=r,this.request_id=r==null?void 0:r["x-request-id"];const s=t;this.error=s,this.code=s==null?void 0:s.code,this.param=s==null?void 0:s.param,this.type=s==null?void 0:s.type}static makeMessage(e,t,i){const r=t!=null&&t.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):i;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||"(no status code or body)"}static generate(e,t,i,r){if(!e)return new Q0({cause:jS(t)});const s=t==null?void 0:t.error;return e===400?new vD(e,s,i,r):e===401?new yD(e,s,i,r):e===403?new _D(e,s,i,r):e===404?new xD(e,s,i,r):e===409?new wD(e,s,i,r):e===422?new SD(e,s,i,r):e===429?new MD(e,s,i,r):e>=500?new ED(e,s,i,r):new ci(e,s,i,r)}}class _r extends ci{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}}class Q0 extends ci{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,t&&(this.cause=t)}}class aE extends Q0{constructor({message:e}={}){super({message:e??"Request timed out."})}}class vD extends ci{constructor(){super(...arguments),this.status=400}}class yD extends ci{constructor(){super(...arguments),this.status=401}}class _D extends ci{constructor(){super(...arguments),this.status=403}}class xD extends ci{constructor(){super(...arguments),this.status=404}}class wD extends ci{constructor(){super(...arguments),this.status=409}}class SD extends ci{constructor(){super(...arguments),this.status=422}}class MD extends ci{constructor(){super(...arguments),this.status=429}}class ED extends ci{}class Bs{constructor(e,t){this.iterator=e,this.controller=t}static fromSSEResponse(e,t){let i=!1;async function*r(){if(i)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{for await(const o of C7(e,t))if(!s){if(o.data.startsWith("[DONE]")){s=!0;continue}if(o.event===null){let a;try{a=JSON.parse(o.data)}catch(l){throw console.error("Could not parse message into JSON:",o.data),console.error("From chunk:",o.raw),l}if(a&&a.error)throw new ci(void 0,a.error,void 0,void 0);yield a}else{let a;try{a=JSON.parse(o.data)}catch(l){throw console.error("Could not parse message into JSON:",o.data),console.error("From chunk:",o.raw),l}if(o.event=="error")throw new ci(void 0,a.error,a.message,void 0);yield{event:o.event,data:a}}}s=!0}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{s||t.abort()}}return new Bs(r,t)}static fromReadableStream(e,t){let i=!1;async function*r(){const o=new Il,a=bD(e);for await(const l of a)for(const u of o.decode(l))yield u;for(const l of o.flush())yield l}async function*s(){if(i)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let o=!1;try{for await(const a of r())o||a&&(yield JSON.parse(a));o=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{o||t.abort()}}return new Bs(s,t)}[Symbol.asyncIterator](){return this.iterator()}tee(){const e=[],t=[],i=this.iterator(),r=s=>({next:()=>{if(s.length===0){const o=i.next();e.push(o),t.push(o)}return s.shift()}});return[new Bs(()=>r(e),this.controller),new Bs(()=>r(t),this.controller)]}toReadableStream(){const e=this;let t;const i=new TextEncoder;return new fD({async start(){t=e[Symbol.asyncIterator]()},async pull(r){try{const{value:s,done:o}=await t.next();if(o)return r.close();const a=i.encode(JSON.stringify(s)+` `);r.enqueue(a)}catch(s){r.error(s)}},async cancel(){var r;await((r=t.return)==null?void 0:r.call(t))}})}}async function*C7(n,e){if(!n.body)throw e.abort(),new kt("Attempted to iterate over a response with no body");const t=new I7,i=new Il,r=bD(n.body);for await(const s of R7(r))for(const o of i.decode(s)){const a=t.decode(o);a&&(yield a)}for(const s of i.flush()){const o=t.decode(s);o&&(yield o)}}async function*R7(n){let e=new Uint8Array;for await(const t of n){if(t==null)continue;const i=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?new TextEncoder().encode(t):t;let r=new Uint8Array(e.length+i.length);r.set(e),r.set(i,e.length),e=r;let s;for(;(s=P7(e))!==-1;)yield e.slice(0,s),e=e.slice(s)}e.length>0&&(yield e)}function P7(n){for(let i=0;i0&&(r=[this.buffer.join("")+r[0],...r.slice(1)],this.buffer=[]),i||(this.buffer=[r.pop()||""]),r)}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new kt(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new kt(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new kt("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];const e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}}Il.NEWLINE_CHARS=new Set([` `,"\r"]);Il.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function L7(n,e){const t=n.indexOf(e);return t!==-1?[n.substring(0,t),e,n.substring(t+e.length)]:[n,"",""]}function bD(n){if(n[Symbol.asyncIterator])return n;const e=n.getReader();return{async next(){try{const t=await e.read();return t!=null&&t.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){const t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}const TD=n=>n!=null&&typeof n=="object"&&typeof n.url=="string"&&typeof n.blob=="function",AD=n=>n!=null&&typeof n=="object"&&typeof n.name=="string"&&typeof n.lastModified=="number"&&CD(n),CD=n=>n!=null&&typeof n=="object"&&typeof n.size=="number"&&typeof n.type=="string"&&typeof n.text=="function"&&typeof n.slice=="function"&&typeof n.arrayBuffer=="function",N7=n=>AD(n)||TD(n)||gD(n);async function RD(n,e,t){var r;if(n=await n,t??(t=AD(n)?{lastModified:n.lastModified,type:n.type}:{}),TD(n)){const s=await n.blob();return e||(e=new URL(n.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new GS([s],e,t)}const i=await D7(n);if(e||(e=k7(n)??"unknown_file"),!t.type){const s=(r=i[0])==null?void 0:r.type;typeof s=="string"&&(t={...t,type:s})}return new GS(i,e,t)}async function D7(n){var t;let e=[];if(typeof n=="string"||ArrayBuffer.isView(n)||n instanceof ArrayBuffer)e.push(n);else if(CD(n))e.push(await n.arrayBuffer());else if(F7(n))for await(const i of n)e.push(i);else throw new Error(`Unexpected data type: ${typeof n}; constructor: ${(t=n==null?void 0:n.constructor)==null?void 0:t.name}; props: ${O7(n)}`);return e}function O7(n){return`[${Object.getOwnPropertyNames(n).map(t=>`"${t}"`).join(", ")}]`}function k7(n){var e;return jx(n.name)||jx(n.filename)||((e=jx(n.path))==null?void 0:e.split(/[\\/]/).pop())}const jx=n=>{if(typeof n=="string")return n;if(typeof Buffer<"u"&&n instanceof Buffer)return String(n)},F7=n=>n!=null&&typeof n=="object"&&typeof n[Symbol.asyncIterator]=="function",kR=n=>n&&typeof n=="object"&&n.body&&n[Symbol.toStringTag]==="MultipartBody",td=async n=>{const e=await U7(n.body);return dD(e,n)},U7=async n=>{const e=new hD;return await Promise.all(Object.entries(n||{}).map(([t,i])=>WS(e,t,i))),e},WS=async(n,e,t)=>{if(t!==void 0){if(t==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")n.append(e,String(t));else if(N7(t)){const i=await RD(t);n.append(e,i)}else if(Array.isArray(t))await Promise.all(t.map(i=>WS(n,e+"[]",i)));else if(typeof t=="object")await Promise.all(Object.entries(t).map(([i,r])=>WS(n,`${e}[${i}]`,r)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${t} instead`)}};var uc={},z7=function(n,e,t,i,r){if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t},B7=function(n,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:e.get(n)},Bm;async function PD(n){const{response:e}=n;if(n.options.stream)return cc("response",e.status,e.url,e.headers,e.body),n.options.__streamClass?n.options.__streamClass.fromSSEResponse(e,n.controller):Bs.fromSSEResponse(e,n.controller);if(e.status===204)return null;if(n.options.__binaryResponse)return e;const t=e.headers.get("content-type");if((t==null?void 0:t.includes("application/json"))||(t==null?void 0:t.includes("application/vnd.api+json"))){const s=await e.json();return cc("response",e.status,e.url,e.headers,s),s}const r=await e.text();return cc("response",e.status,e.url,e.headers,r),r}class ey extends Promise{constructor(e,t=PD){super(i=>{i(null)}),this.responsePromise=e,this.parseResponse=t}_thenUnwrap(e){return new ey(this.responsePromise,async t=>e(await this.parseResponse(t)))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){const[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}}class V7{constructor({baseURL:e,maxRetries:t=2,timeout:i=6e5,httpAgent:r,fetch:s}){this.baseURL=e,this.maxRetries=Xx("maxRetries",t),this.timeout=Xx("timeout",i),this.httpAgent=r,this.fetch=s??cD}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...$7(),...this.authHeaders(e)}}validateHeaders(e,t){}defaultIdempotencyKey(){return`stainless-node-retry-${K7()}`}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,i){return this.request(Promise.resolve(i).then(r=>({method:e,path:t,...r})))}getAPIList(e,t,i){return this.requestAPIList(t,{method:"get",path:e,...i})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}return null}buildRequest(e){var v;const{method:t,path:i,query:r,headers:s={}}=e,o=kR(e.body)?e.body.body:e.body?JSON.stringify(e.body,null,2):null,a=this.calculateContentLength(o),l=this.buildURL(i,r);"timeout"in e&&Xx("timeout",e.timeout);const u=e.timeout??this.timeout,f=e.httpAgent??this.httpAgent??pD(l),d=u+1e3;typeof((v=f==null?void 0:f.options)==null?void 0:v.timeout)=="number"&&d>(f.options.timeout??0)&&(f.options.timeout=d),this.idempotencyHeader&&t!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);const p=this.buildHeaders({options:e,headers:s,contentLength:a});return{req:{method:t,...o&&{body:o},headers:p,...f&&{agent:f},signal:e.signal??null},url:l,timeout:u}}buildHeaders({options:e,headers:t,contentLength:i}){const r={};i&&(r["content-length"]=i);const s=this.defaultHeaders(e);return BR(r,s),BR(r,t),kR(e.body)&&hf!=="node"&&delete r["content-type"],this.validateHeaders(r,t),r}async prepareOptions(e){}async prepareRequest(e,{url:t,options:i}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(t=>[...t])):{...e}:{}}makeStatusError(e,t,i,r){return ci.generate(e,t,i,r)}request(e,t=null){return new ey(this.makeRequest(e,t))}async makeRequest(e,t){var f,d;const i=await e;t==null&&(t=i.maxRetries??this.maxRetries),await this.prepareOptions(i);const{req:r,url:s,timeout:o}=this.buildRequest(i);if(await this.prepareRequest(r,{url:s,options:i}),cc("request",s,i,r.headers),(f=i.signal)!=null&&f.aborted)throw new _r;const a=new AbortController,l=await this.fetchWithTimeout(s,r,o,a).catch(jS);if(l instanceof Error){if((d=i.signal)!=null&&d.aborted)throw new _r;if(t)return this.retryRequest(i,t);throw l.name==="AbortError"?new aE:new Q0({cause:l})}const u=G7(l.headers);if(!l.ok){if(t&&this.shouldRetry(l)){const m=`retrying, ${t} attempts remaining`;return cc(`response (error; ${m})`,l.status,s,u),this.retryRequest(i,t,u)}const p=await l.text().catch(m=>jS(m).message),g=q7(p),v=g?void 0:p;throw cc(`response (error; ${t?"(error; no more retries left)":"(error; not retryable)"})`,l.status,s,u,v),this.makeStatusError(l.status,g,v,u)}return{response:l,options:i,controller:a}}requestAPIList(e,t){const i=this.makeRequest(t,null);return new H7(this,i,e)}buildURL(e,t){const i=Z7(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),r=this.defaultQuery();return LD(r)||(t={...r,...t}),typeof t=="object"&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}stringifyQuery(e){return Object.entries(e).filter(([t,i])=>typeof i<"u").map(([t,i])=>{if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(i)}`;if(i===null)return`${encodeURIComponent(t)}=`;throw new kt(`Cannot stringify type ${typeof i}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,t,i,r){const{signal:s,...o}=t||{};s&&s.addEventListener("abort",()=>r.abort());const a=setTimeout(()=>r.abort(),i);return this.getRequestClient().fetch.call(void 0,e,{signal:r.signal,...o}).finally(()=>{clearTimeout(a)})}getRequestClient(){return{fetch:this.fetch}}shouldRetry(e){const t=e.headers.get("x-should-retry");return t==="true"?!0:t==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,i){let r;const s=i==null?void 0:i["retry-after-ms"];if(s){const a=parseFloat(s);Number.isNaN(a)||(r=a)}const o=i==null?void 0:i["retry-after"];if(o&&!r){const a=parseFloat(o);Number.isNaN(a)?r=Date.parse(o)-Date.now():r=a*1e3}if(!(r&&0<=r&&r<60*1e3)){const a=e.maxRetries??this.maxRetries;r=this.calculateDefaultRetryTimeoutMillis(t,a)}return await Ed(r),this.makeRequest(e,t-1)}calculateDefaultRetryTimeoutMillis(e,t){const s=t-e,o=Math.min(.5*Math.pow(2,s),8),a=1-Math.random()*.25;return o*a*1e3}getUserAgent(){return`${this.constructor.name}/JS ${Iu}`}}class ID{constructor(e,t,i,r){Bm.set(this,void 0),z7(this,Bm,e),this.options=r,this.response=t,this.body=i}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){const e=this.nextPageInfo();if(!e)throw new kt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");const t={...this.options};if("params"in e&&typeof t.query=="object")t.query={...t.query,...e.params};else if("url"in e){const i=[...Object.entries(t.query||{}),...e.url.searchParams.entries()];for(const[r,s]of i)e.url.searchParams.set(r,s);t.query=void 0,t.path=e.url.toString()}return await B7(this,Bm,"f").requestAPIList(this.constructor,t)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Bm=new WeakMap,Symbol.asyncIterator)](){for await(const e of this.iterPages())for(const t of e.getPaginatedItems())yield t}}class H7 extends ey{constructor(e,t,i){super(t,async r=>new i(e,r.response,await PD(r),r.options))}async*[Symbol.asyncIterator](){const e=await this;for await(const t of e)yield t}}const G7=n=>new Proxy(Object.fromEntries(n.entries()),{get(e,t){const i=t.toString();return e[i.toLowerCase()]||e[i]}}),W7={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__binaryResponse:!0,__streamClass:!0},br=n=>typeof n=="object"&&n!==null&&!LD(n)&&Object.keys(n).every(e=>ND(W7,e)),j7=()=>{var e;if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Iu,"X-Stainless-OS":UR(Deno.build.os),"X-Stainless-Arch":FR(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:((e=Deno.version)==null?void 0:e.deno)??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Iu,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Iu,"X-Stainless-OS":UR(process.platform),"X-Stainless-Arch":FR(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};const n=X7();return n?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Iu,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${n.browser}`,"X-Stainless-Runtime-Version":n.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Iu,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function X7(){if(typeof navigator>"u"||!navigator)return null;const n=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:e,pattern:t}of n){const i=t.exec(navigator.userAgent);if(i){const r=i[1]||0,s=i[2]||0,o=i[3]||0;return{browser:e,version:`${r}.${s}.${o}`}}}return null}const FR=n=>n==="x32"?"x32":n==="x86_64"||n==="x64"?"x64":n==="arm"?"arm":n==="aarch64"||n==="arm64"?"arm64":n?`other:${n}`:"unknown",UR=n=>(n=n.toLowerCase(),n.includes("ios")?"iOS":n==="android"?"Android":n==="darwin"?"MacOS":n==="win32"?"Windows":n==="freebsd"?"FreeBSD":n==="openbsd"?"OpenBSD":n==="linux"?"Linux":n?`Other:${n}`:"Unknown");let zR;const $7=()=>zR??(zR=j7()),q7=n=>{try{return JSON.parse(n)}catch{return}},Y7=new RegExp("^(?:[a-z]+:)?//","i"),Z7=n=>Y7.test(n),Ed=n=>new Promise(e=>setTimeout(e,n)),Xx=(n,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new kt(`${n} must be an integer`);if(e<0)throw new kt(`${n} must be a positive integer`);return e},jS=n=>n instanceof Error?n:new Error(n),Vm=n=>{var e,t,i,r;if(typeof process<"u")return((e=uc==null?void 0:uc[n])==null?void 0:e.trim())??void 0;if(typeof Deno<"u")return(r=(i=(t=Deno.env)==null?void 0:t.get)==null?void 0:i.call(t,n))==null?void 0:r.trim()};function LD(n){if(!n)return!0;for(const e in n)return!1;return!0}function ND(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function BR(n,e){for(const t in e){if(!ND(e,t))continue;const i=t.toLowerCase();if(!i)continue;const r=e[t];r===null?delete n[i]:r!==void 0&&(n[i]=r)}}function cc(n,...e){typeof process<"u"&&(uc==null?void 0:uc.DEBUG)==="true"&&console.log(`OpenAI:DEBUG:${n}`,...e)}const K7=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)}),J7=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function VR(n){return n!=null&&typeof n=="object"&&!Array.isArray(n)}class lE extends ID{constructor(e,t,i,r){super(e,t,i,r),this.data=i.data||[],this.object=i.object}getPaginatedItems(){return this.data??[]}nextPageParams(){return null}nextPageInfo(){return null}}class ws extends ID{constructor(e,t,i,r){super(e,t,i,r),this.data=i.data||[]}getPaginatedItems(){return this.data??[]}nextPageParams(){const e=this.nextPageInfo();if(!e)return null;if("params"in e)return e.params;const t=Object.fromEntries(e.url.searchParams);return Object.keys(t).length?t:null}nextPageInfo(){var i;const e=this.getPaginatedItems();if(!e.length)return null;const t=(i=e[e.length-1])==null?void 0:i.id;return t?{params:{after:t}}:null}}class tn{constructor(e){this._client=e}}let xv=class extends tn{create(e,t){return this._client.post("/chat/completions",{body:e,...t,stream:e.stream??!1})}};xv||(xv={});let wv=class extends tn{constructor(){super(...arguments),this.completions=new xv(this._client)}};(function(n){n.Completions=xv})(wv||(wv={}));class Sv extends tn{create(e,t){return this._client.post("/audio/speech",{body:e,...t,__binaryResponse:!0})}}Sv||(Sv={});class Mv extends tn{create(e,t){return this._client.post("/audio/transcriptions",td({body:e,...t}))}}Mv||(Mv={});class Ev extends tn{create(e,t){return this._client.post("/audio/translations",td({body:e,...t}))}}Ev||(Ev={});class bv extends tn{constructor(){super(...arguments),this.transcriptions=new Mv(this._client),this.translations=new Ev(this._client),this.speech=new Sv(this._client)}}(function(n){n.Transcriptions=Mv,n.Translations=Ev,n.Speech=Sv})(bv||(bv={}));class Tv extends tn{create(e,t){return this._client.post("/batches",{body:e,...t})}retrieve(e,t){return this._client.get(`/batches/${e}`,t)}list(e={},t){return br(e)?this.list({},e):this._client.getAPIList("/batches",uE,{query:e,...t})}cancel(e,t){return this._client.post(`/batches/${e}/cancel`,t)}}class uE extends ws{}(function(n){n.BatchesPage=uE})(Tv||(Tv={}));class Av extends tn{create(e,t){return this._client.post("/assistants",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}retrieve(e,t){return this._client.get(`/assistants/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}update(e,t,i){return this._client.post(`/assistants/${e}`,{body:t,...i,headers:{"OpenAI-Beta":"assistants=v2",...i==null?void 0:i.headers}})}list(e={},t){return br(e)?this.list({},e):this._client.getAPIList("/assistants",cE,{query:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}del(e,t){return this._client.delete(`/assistants/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t==null?void 0:t.headers}})}}class cE extends ws{}(function(n){n.AssistantsPage=cE})(Av||(Av={}));function HR(n){return typeof n.parse=="function"}const hc=n=>(n==null?void 0:n.role)==="assistant",DD=n=>(n==null?void 0:n.role)==="function",OD=n=>(n==null?void 0:n.role)==="tool";var os=function(n,e,t,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(n,t):r?r.value=t:e.set(n,t),t},It=function(n,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:e.get(n)},Mi,_g,xg,Bh,Vh,wg,Hh,uo,Gh,Sg,Mg,Lu,XS,Cv,$S,qS,YS,ZS,kD,KS;const GR=10;class FD{constructor(){Mi.add(this),this.controller=new AbortController,_g.set(this,void 0),xg.set(this,()=>{}),Bh.set(this,()=>{}),Vh.set(this,void 0),wg.set(this,()=>{}),Hh.set(this,()=>{}),uo.set(this,{}),this._chatCompletions=[],this.messages=[],Gh.set(this,!1),Sg.set(this,!1),Mg.set(this,!1),Lu.set(this,!1),ZS.set(this,e=>{if(os(this,Sg,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new _r),e instanceof _r)return os(this,Mg,!0,"f"),this._emit("abort",e);if(e instanceof kt)return this._emit("error",e);if(e instanceof Error){const t=new kt(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new kt(String(e)))}),os(this,_g,new Promise((e,t)=>{os(this,xg,e,"f"),os(this,Bh,t,"f")}),"f"),os(this,Vh,new Promise((e,t)=>{os(this,wg,e,"f"),os(this,Hh,t,"f")}),"f"),It(this,_g,"f").catch(()=>{}),It(this,Vh,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},It(this,ZS,"f"))},0)}_addChatCompletion(e){var i;this._chatCompletions.push(e),this._emit("chatCompletion",e);const t=(i=e.choices[0])==null?void 0:i.message;return t&&this._addMessage(t),e}_addMessage(e,t=!0){if("content"in e||(e.content=null),this.messages.push(e),t){if(this._emit("message",e),(DD(e)||OD(e))&&e.content)this._emit("functionCallResult",e.content);else if(hc(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(hc(e)&&e.tool_calls)for(const i of e.tool_calls)i.type==="function"&&this._emit("functionCall",i.function)}}_connected(){this.ended||(It(this,xg,"f").call(this),this._emit("connect"))}get ended(){return It(this,Gh,"f")}get errored(){return It(this,Sg,"f")}get aborted(){return It(this,Mg,"f")}abort(){this.controller.abort()}on(e,t){return(It(this,uo,"f")[e]||(It(this,uo,"f")[e]=[])).push({listener:t}),this}off(e,t){const i=It(this,uo,"f")[e];if(!i)return this;const r=i.findIndex(s=>s.listener===t);return r>=0&&i.splice(r,1),this}once(e,t){return(It(this,uo,"f")[e]||(It(this,uo,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,i)=>{os(this,Lu,!0,"f"),e!=="error"&&this.once("error",i),this.once(e,t)})}async done(){os(this,Lu,!0,"f"),await It(this,Vh,"f")}async finalChatCompletion(){await this.done();const e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new kt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),It(this,Mi,"m",XS).call(this)}async finalMessage(){return await this.done(),It(this,Mi,"m",Cv).call(this)}async finalFunctionCall(){return await this.done(),It(this,Mi,"m",$S).call(this)}async finalFunctionCallResult(){return await this.done(),It(this,Mi,"m",qS).call(this)}async totalUsage(){return await this.done(),It(this,Mi,"m",YS).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emit(e,...t){if(It(this,Gh,"f"))return;e==="end"&&(os(this,Gh,!0,"f"),It(this,wg,"f").call(this));const i=It(this,uo,"f")[e];if(i&&(It(this,uo,"f")[e]=i.filter(r=>!r.once),i.forEach(({listener:r})=>r(...t))),e==="abort"){const r=t[0];!It(this,Lu,"f")&&!(i!=null&&i.length)&&Promise.reject(r),It(this,Bh,"f").call(this,r),It(this,Hh,"f").call(this,r),this._emit("end");return}if(e==="error"){const r=t[0];!It(this,Lu,"f")&&!(i!=null&&i.length)&&Promise.reject(r),It(this,Bh,"f").call(this,r),It(this,Hh,"f").call(this,r),this._emit("end")}}_emitFinal(){const e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);const t=It(this,Mi,"m",Cv).call(this);t&&this._emit("finalMessage",t);const i=It(this,Mi,"m",XS).call(this);i&&this._emit("finalContent",i);const r=It(this,Mi,"m",$S).call(this);r&&this._emit("finalFunctionCall",r);const s=It(this,Mi,"m",qS).call(this);s!=null&&this._emit("finalFunctionCallResult",s),this._chatCompletions.some(o=>o.usage)&&this._emit("totalUsage",It(this,Mi,"m",YS).call(this))}async _createChatCompletion(e,t,i){const r=i==null?void 0:i.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),It(this,Mi,"m",kD).call(this,t);const s=await e.create({...t,stream:!1},{...i,signal:this.controller.signal});return this._connected(),this._addChatCompletion(s)}async _runChatCompletion(e,t,i){for(const r of t.messages)this._addMessage(r,!1);return await this._createChatCompletion(e,t,i)}async _runFunctions(e,t,i){var p;const r="function",{function_call:s="auto",stream:o,...a}=t,l=typeof s!="string"&&(s==null?void 0:s.name),{maxChatCompletions:u=GR}=i||{},f={};for(const g of t.functions)f[g.name||g.function.name]=g;const d=t.functions.map(g=>({name:g.name||g.function.name,parameters:g.parameters,description:g.description}));for(const g of t.messages)this._addMessage(g,!1);for(let g=0;gJSON.stringify(C.name)).join(", ")}. Please try again`;this._addMessage({role:r,name:_,content:A});continue}let S;try{S=HR(w)?await w.parse(m):m}catch(A){this._addMessage({role:r,name:_,content:A instanceof Error?A.message:String(A)});continue}const b=await w.function(S,this),R=It(this,Mi,"m",KS).call(this,b);if(this._addMessage({role:r,name:_,content:R}),l)return}}async _runTools(e,t,i){var p,g;const r="tool",{tool_choice:s="auto",stream:o,...a}=t,l=typeof s!="string"&&((p=s==null?void 0:s.function)==null?void 0:p.name),{maxChatCompletions:u=GR}=i||{},f={};for(const v of t.tools)v.type==="function"&&(f[v.function.name||v.function.function.name]=v.function);const d="tools"in t?t.tools.map(v=>v.type==="function"?{type:"function",function:{name:v.function.name||v.function.function.name,parameters:v.function.parameters,description:v.function.description}}:v):void 0;for(const v of t.messages)this._addMessage(v,!1);for(let v=0;vJSON.stringify(E.function.name)).join(", ")}. Please try again`;this._addMessage({role:r,tool_call_id:w,content:I});continue}let A;try{A=HR(R)?await R.parse(b):b}catch(I){const E=I instanceof Error?I.message:String(I);this._addMessage({role:r,tool_call_id:w,content:E});continue}const C=await R.function(A,this),L=It(this,Mi,"m",KS).call(this,C);if(this._addMessage({role:r,tool_call_id:w,content:L}),l)return}}}}_g=new WeakMap,xg=new WeakMap,Bh=new WeakMap,Vh=new WeakMap,wg=new WeakMap,Hh=new WeakMap,uo=new WeakMap,Gh=new WeakMap,Sg=new WeakMap,Mg=new WeakMap,Lu=new WeakMap,ZS=new WeakMap,Mi=new WeakSet,XS=function(){return It(this,Mi,"m",Cv).call(this).content??null},Cv=function(){let e=this.messages.length;for(;e-- >0;){const t=this.messages[e];if(hc(t))return{...t,content:t.content??null}}throw new kt("stream ended without producing a ChatCompletionMessage with role=assistant")},$S=function(){var e,t;for(let i=this.messages.length-1;i>=0;i--){const r=this.messages[i];if(hc(r)&&(r!=null&&r.function_call))return r.function_call;if(hc(r)&&((e=r==null?void 0:r.tool_calls)!=null&&e.length))return(t=r.tool_calls.at(-1))==null?void 0:t.function}},qS=function(){for(let e=this.messages.length-1;e>=0;e--){const t=this.messages[e];if(DD(t)&&t.content!=null||OD(t)&&t.content!=null&&this.messages.some(i=>{var r;return i.role==="assistant"&&((r=i.tool_calls)==null?void 0:r.some(s=>s.type==="function"&&s.id===t.tool_call_id))}))return t.content}},YS=function(){const e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(const{usage:t}of this._chatCompletions)t&&(e.completion_tokens+=t.completion_tokens,e.prompt_tokens+=t.prompt_tokens,e.total_tokens+=t.total_tokens);return e},kD=function(e){if(e.n!=null&&e.n>1)throw new kt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},KS=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};class nd extends FD{static runFunctions(e,t,i){const r=new nd,s={...i,headers:{...i==null?void 0:i.headers,"X-Stainless-Helper-Method":"runFunctions"}};return r._run(()=>r._runFunctions(e,t,s)),r}static runTools(e,t,i){const r=new nd,s={...i,headers:{...i==null?void 0:i.headers,"X-Stainless-Helper-Method":"runTools"}};return r._run(()=>r._runTools(e,t,s)),r}_addMessage(e){super._addMessage(e),hc(e)&&e.content&&this._emit("content",e.content)}}var as=function(n,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:e.get(n)},$x=function(n,e,t,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(n,t):r?r.value=t:e.set(n,t),t},Ps,na,qx,Yx,Hm,WR;class id extends FD{constructor(){super(...arguments),Ps.add(this),na.set(this,void 0)}get currentChatCompletionSnapshot(){return as(this,na,"f")}static fromReadableStream(e){const t=new id;return t._run(()=>t._fromReadableStream(e)),t}static createChatCompletion(e,t,i){const r=new id;return r._run(()=>r._runChatCompletion(e,{...t,stream:!0},{...i,headers:{...i==null?void 0:i.headers,"X-Stainless-Helper-Method":"stream"}})),r}async _createChatCompletion(e,t,i){var o;const r=i==null?void 0:i.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),as(this,Ps,"m",qx).call(this);const s=await e.create({...t,stream:!0},{...i,signal:this.controller.signal});this._connected();for await(const a of s)as(this,Ps,"m",Yx).call(this,a);if((o=s.controller.signal)!=null&&o.aborted)throw new _r;return this._addChatCompletion(as(this,Ps,"m",Hm).call(this))}async _fromReadableStream(e,t){var o;const i=t==null?void 0:t.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort())),as(this,Ps,"m",qx).call(this),this._connected();const r=Bs.fromReadableStream(e,this.controller);let s;for await(const a of r)s&&s!==a.id&&this._addChatCompletion(as(this,Ps,"m",Hm).call(this)),as(this,Ps,"m",Yx).call(this,a),s=a.id;if((o=r.controller.signal)!=null&&o.aborted)throw new _r;return this._addChatCompletion(as(this,Ps,"m",Hm).call(this))}[(na=new WeakMap,Ps=new WeakSet,qx=function(){this.ended||$x(this,na,void 0,"f")},Yx=function(t){var o,a,l;if(this.ended)return;const i=as(this,Ps,"m",WR).call(this,t);this._emit("chunk",t,i);const r=(a=(o=t.choices[0])==null?void 0:o.delta)==null?void 0:a.content,s=(l=i.choices[0])==null?void 0:l.message;r!=null&&(s==null?void 0:s.role)==="assistant"&&(s!=null&&s.content)&&this._emit("content",r,s.content)},Hm=function(){if(this.ended)throw new kt("stream has ended, this shouldn't happen");const t=as(this,na,"f");if(!t)throw new kt("request ended without sending any chunks");return $x(this,na,void 0,"f"),Q7(t)},WR=function(t){var i,r,s;let o=as(this,na,"f");const{choices:a,...l}=t;o?Object.assign(o,l):o=$x(this,na,{...l,choices:[]},"f");for(const{delta:u,finish_reason:f,index:d,logprobs:p=null,...g}of t.choices){let v=o.choices[d];if(v||(v=o.choices[d]={finish_reason:f,index:d,message:{},logprobs:p,...g}),p)if(!v.logprobs)v.logprobs=Object.assign({},p);else{const{content:b,...R}=p;Object.assign(v.logprobs,R),b&&((i=v.logprobs).content??(i.content=[]),v.logprobs.content.push(...b))}if(f&&(v.finish_reason=f),Object.assign(v,g),!u)continue;const{content:x,function_call:_,role:m,tool_calls:w,...S}=u;if(Object.assign(v.message,S),x&&(v.message.content=(v.message.content||"")+x),m&&(v.message.role=m),_&&(v.message.function_call?(_.name&&(v.message.function_call.name=_.name),_.arguments&&((r=v.message.function_call).arguments??(r.arguments=""),v.message.function_call.arguments+=_.arguments)):v.message.function_call=_),w){v.message.tool_calls||(v.message.tool_calls=[]);for(const{index:b,id:R,type:A,function:C,...L}of w){const I=(s=v.message.tool_calls)[b]??(s[b]={});Object.assign(I,L),R&&(I.id=R),A&&(I.type=A),C&&(I.function??(I.function={arguments:""})),C!=null&&C.name&&(I.function.name=C.name),C!=null&&C.arguments&&(I.function.arguments+=C.arguments)}}}return o},Symbol.asyncIterator)](){const e=[],t=[];let i=!1;return this.on("chunk",r=>{const s=t.shift();s?s.resolve(r):e.push(r)}),this.on("end",()=>{i=!0;for(const r of t)r.resolve(void 0);t.length=0}),this.on("abort",r=>{i=!0;for(const s of t)s.reject(r);t.length=0}),this.on("error",r=>{i=!0;for(const s of t)s.reject(r);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((s,o)=>t.push({resolve:s,reject:o})).then(s=>s?{value:s,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Bs(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Q7(n){const{id:e,choices:t,created:i,model:r,system_fingerprint:s,...o}=n;return{...o,id:e,choices:t.map(({message:a,finish_reason:l,index:u,logprobs:f,...d})=>{if(!l)throw new kt(`missing finish_reason for choice ${u}`);const{content:p=null,function_call:g,tool_calls:v,...x}=a,_=a.role;if(!_)throw new kt(`missing role for choice ${u}`);if(g){const{arguments:m,name:w}=g;if(m==null)throw new kt(`missing function_call.arguments for choice ${u}`);if(!w)throw new kt(`missing function_call.name for choice ${u}`);return{...d,message:{content:p,function_call:{arguments:m,name:w},role:_},finish_reason:l,index:u,logprobs:f}}return v?{...d,index:u,finish_reason:l,logprobs:f,message:{...x,role:_,content:p,tool_calls:v.map((m,w)=>{const{function:S,type:b,id:R,...A}=m,{arguments:C,name:L,...I}=S||{};if(R==null)throw new kt(`missing choices[${u}].tool_calls[${w}].id @@ -3990,4 +3990,6 @@ ${Wm}] ${Wm}rows: ${n.rows} ${Wm}columns: ${n.columns} }`}function r$(n,e,t,i,r){const{rows:s,columns:o}=n,a=Math.min(s,e),l=Math.min(o,t),u=[];if(r==="auto"){r=!1;e:for(let f=0;f=0&&t?` ${tP(n,e-1)}`:tP(n,e)).padEnd(e)}function tP(n,e){let t=n.toString();if(t.length<=e)return t;let i=n.toFixed(e);if(i.length>e&&(i=n.toFixed(Math.max(0,e-(i.length-e)))),i.length<=e&&!i.startsWith("0.000")&&!i.startsWith("-0.000"))return i;let r=n.toExponential(e);return r.length>e&&(r=n.toExponential(Math.max(0,e-(r.length-e)))),r.slice(0)}function o$(n,e){n.prototype.add=function(i){return typeof i=="number"?this.addS(i):this.addM(i)},n.prototype.addS=function(i){for(let r=0;r>i);return this},n.prototype.signPropagatingRightShiftM=function(i){if(i=e.checkMatrix(i),this.rows!==i.rows||this.columns!==i.columns)throw new RangeError("Matrices dimensions must be equal");for(let r=0;r>i.get(r,s));return this},n.signPropagatingRightShift=function(i,r){return new e(i).signPropagatingRightShift(r)},n.prototype.rightShift=function(i){return typeof i=="number"?this.rightShiftS(i):this.rightShiftM(i)},n.prototype.rightShiftS=function(i){for(let r=0;r>>i);return this},n.prototype.rightShiftM=function(i){if(i=e.checkMatrix(i),this.rows!==i.rows||this.columns!==i.columns)throw new RangeError("Matrices dimensions must be equal");for(let r=0;r>>i.get(r,s));return this},n.rightShift=function(i,r){return new e(i).rightShift(r)},n.prototype.zeroFillRightShift=n.prototype.rightShift,n.prototype.zeroFillRightShiftS=n.prototype.rightShiftS,n.prototype.zeroFillRightShiftM=n.prototype.rightShiftM,n.zeroFillRightShift=n.rightShift,n.prototype.not=function(){for(let i=0;ii)throw new RangeError("Row index out of range")}function Br(n,e,t){let i=t?n.columns:n.columns-1;if(e<0||e>i)throw new RangeError("Column index out of range")}function Du(n,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==n.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Ou(n,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==n.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function wE(n,e){if(!Zi.isAnyArray(e))throw new TypeError("row indices must be an array");for(let t=0;t=n.rows)throw new RangeError("row indices are out of range")}function SE(n,e){if(!Zi.isAnyArray(e))throw new TypeError("column indices must be an array");for(let t=0;t=n.columns)throw new RangeError("column indices are out of range")}function s1(n,e,t,i,r){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(jm("startRow",e),jm("endRow",t),jm("startColumn",i),jm("endColumn",r),e>t||i>r||e<0||e>=n.rows||t<0||t>=n.rows||i<0||i>=n.columns||r<0||r>=n.columns)throw new RangeError("Submatrix indices are out of range")}function sy(n,e=0){let t=[];for(let i=0;i=s)throw new RangeError("min must be smaller than max");let a=s-r,l=new Oe(e,t);for(let u=0;ui?(s=!0,i=t):(r=!1,s=!0);e++}return r}isReducedEchelonForm(){let e=0,t=0,i=-1,r=!0,s=!1;for(;ei?(s=!0,i=t):(r=!1,s=!0);for(let o=t+1;oe.get(r,i)&&(r=s);if(e.get(r,i)===0)i++;else{e.swapRows(t,r);let s=e.get(t,i);for(let o=i;o=0;)if(e.maxRow(r)===0)r--;else{let s=0,o=!1;for(;st[i]&&(t[i]=this.get(i,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let i=0;it[r]&&(t[r]=this.get(i,r));return t}case void 0:{let t=this.get(0,0);for(let i=0;it&&(t=this.get(i,r));return t}default:throw new Error(`invalid option: ${e}`)}}maxIndex(){Cu(this);let e=this.get(0,0),t=[0,0];for(let i=0;ie&&(e=this.get(i,r),t[0]=i,t[1]=r);return t}min(e){if(this.isEmpty())return NaN;switch(e){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let i=0;it&&(t=this.get(e,i));return t}maxRowIndex(e){zr(this,e),Cu(this);let t=this.get(e,0),i=[e,0];for(let r=1;rt&&(t=this.get(e,r),i[1]=r);return i}minRow(e){if(zr(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let i=1;it&&(t=this.get(i,e));return t}maxColumnIndex(e){Br(this,e),Cu(this);let t=this.get(0,e),i=[0,e];for(let r=1;rt&&(t=this.get(r,e),i[0]=r);return i}minColumn(e){if(Br(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let i=1;i=i)throw new RangeError("min must be smaller than max");let r=new Oe(this.rows,this.columns);for(let s=0;s0&&eP(o,{min:t,max:i,output:o}),r.setRow(s,o)}return r}scaleColumns(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:i=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(i))throw new TypeError("max must be a number");if(t>=i)throw new RangeError("min must be smaller than max");let r=new Oe(this.rows,this.columns);for(let s=0;si||t<0||t>=this.columns||i<0||i>=this.columns)throw new RangeError("Argument out of range");let r=new Oe(e.length,i-t+1);for(let s=0;s=this.rows)throw new RangeError(`Row index out of range: ${e[s]}`);r.set(s,o-t,this.get(e[s],o))}return r}subMatrixColumn(e,t,i){if(t===void 0&&(t=0),i===void 0&&(i=this.rows-1),t>i||t<0||t>=this.rows||i<0||i>=this.rows)throw new RangeError("Argument out of range");let r=new Oe(i-t+1,e.length);for(let s=0;s=this.columns)throw new RangeError(`Column index out of range: ${e[s]}`);r.set(o-t,s,this.get(o,e[s]))}return r}setSubMatrix(e,t,i){if(e=Oe.checkMatrix(e),e.isEmpty())return this;let r=t+e.rows-1,s=i+e.columns-1;s1(this,t,r,i,s);for(let o=0;otypeof e=="number")}xt.random=xt.rand;xt.randomInt=xt.randInt;xt.diagonal=xt.diag;xt.prototype.diagonal=xt.prototype.diag;xt.identity=xt.eye;xt.prototype.negate=xt.prototype.neg;xt.prototype.tensorProduct=xt.prototype.kroneckerProduct;var od,o1,Ac;let Oe=(Ac=class extends xt{constructor(t,i){super();g_(this,od);wp(this,"data");if(Ac.isMatrix(t))v_(this,od,o1).call(this,t.rows,t.columns),Ac.copy(t,this);else if(Number.isInteger(t)&&t>=0)v_(this,od,o1).call(this,t,i);else if(Zi.isAnyArray(t)){const r=t;if(t=r.length,i=t?r[0].length:0,typeof i!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let s=0;s"u"&&(i=t,t=this.columns),Br(this,t,!0),i=Ou(this,i);for(let r=0;r=0)for(let r=0;r=0)Sp(this,Ei,new Oe(t,t));else if(Sp(this,Ei,new Oe(t)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return ts(this,Ei).size}get rows(){return ts(this,Ei).rows}get columns(){return ts(this,Ei).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return Oe.isMatrix(t)&&t.klassType==="SymmetricMatrix"}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}clone(){const t=new Yv(this.diagonalSize);for(const[i,r,s]of this.upperRightEntries())t.set(i,r,s);return t}toMatrix(){return new Oe(this)}get(t,i){return ts(this,Ei).get(t,i)}set(t,i,r){return ts(this,Ei).set(t,i,r),ts(this,Ei).set(i,t,r),this}removeCross(t){return ts(this,Ei).removeRow(t),ts(this,Ei).removeColumn(t),this}addCross(t,i){i===void 0&&(i=t,t=this.diagonalSize);const r=i.slice();return r.splice(t,1),ts(this,Ei).addRow(t,r),ts(this,Ei).addColumn(t,i),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const i=[];for(const[r,s]of t.entries())s||i.push(r);i.reverse();for(const r of i)this.removeCross(r);return this}toCompact(){const{diagonalSize:t}=this,i=new Array(t*(t+1)/2);for(let r=0,s=0,o=0;o=t&&(r=++s);return i}static fromCompact(t){const i=t.length,r=(Math.sqrt(8*i+1)-1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const s=new Yv(r);for(let o=0,a=0,l=0;l=r&&(o=++a);return s}*upperRightEntries(){for(let t=0,i=0;t=this.diagonalSize&&(i=++t)}}*upperRightValues(){for(let t=0,i=0;t=this.diagonalSize&&(i=++t)}};Ei=new WeakMap;let wl=Yv;wl.prototype.klassType="SymmetricMatrix";class oy extends wl{static isDistanceMatrix(e){return wl.isSymmetricMatrix(e)&&e.klassSubType==="DistanceMatrix"}constructor(e){if(super(e),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(e,t,i){return e===t&&(i=0),super.set(e,t,i)}addCross(e,t){return t===void 0&&(t=e,e=this.diagonalSize),t=t.slice(),t[e]=0,super.addCross(e,t)}toSymmetricMatrix(){return new wl(this)}clone(){const e=new oy(this.diagonalSize);for(const[t,i,r]of this.upperRightEntries())t!==i&&e.set(t,i,r);return e}toCompact(){const{diagonalSize:e}=this,t=(e-1)*e/2,i=new Array(t);for(let r=1,s=0,o=0;o=e&&(r=++s+1);return i}static fromCompact(e){const t=e.length,i=(Math.sqrt(8*t+1)+1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(e)}`);const r=new this(i);for(let s=1,o=0,a=0;a=i&&(s=++o+1);return r}}oy.prototype.klassSubType="DistanceMatrix";class ko extends xt{constructor(e,t,i){super(),this.matrix=e,this.rows=t,this.columns=i}}class T$ extends ko{constructor(e,t){Br(e,t),super(e,e.rows,1),this.column=t}set(e,t,i){return this.matrix.set(e,this.column,i),this}get(e){return this.matrix.get(e,this.column)}}class A$ extends ko{constructor(e,t){SE(e,t),super(e,e.rows,t.length),this.columnIndices=t}set(e,t,i){return this.matrix.set(e,this.columnIndices[t],i),this}get(e,t){return this.matrix.get(e,this.columnIndices[t])}}class C$ extends ko{constructor(e){super(e,e.rows,e.columns)}set(e,t,i){return this.matrix.set(e,this.columns-t-1,i),this}get(e,t){return this.matrix.get(e,this.columns-t-1)}}class R$ extends ko{constructor(e){super(e,e.rows,e.columns)}set(e,t,i){return this.matrix.set(this.rows-e-1,t,i),this}get(e,t){return this.matrix.get(this.rows-e-1,t)}}class P$ extends ko{constructor(e,t){zr(e,t),super(e,1,e.columns),this.row=t}set(e,t,i){return this.matrix.set(this.row,t,i),this}get(e,t){return this.matrix.get(this.row,t)}}class I$ extends ko{constructor(e,t){wE(e,t),super(e,t.length,e.columns),this.rowIndices=t}set(e,t,i){return this.matrix.set(this.rowIndices[e],t,i),this}get(e,t){return this.matrix.get(this.rowIndices[e],t)}}class Ng extends ko{constructor(e,t,i){wE(e,t),SE(e,i),super(e,t.length,i.length),this.rowIndices=t,this.columnIndices=i}set(e,t,i){return this.matrix.set(this.rowIndices[e],this.columnIndices[t],i),this}get(e,t){return this.matrix.get(this.rowIndices[e],this.columnIndices[t])}}class L$ extends ko{constructor(e,t,i,r,s){s1(e,t,i,r,s),super(e,i-t+1,s-r+1),this.startRow=t,this.startColumn=r}set(e,t,i){return this.matrix.set(this.startRow+e,this.startColumn+t,i),this}get(e,t){return this.matrix.get(this.startRow+e,this.startColumn+t)}}class N$ extends ko{constructor(e){super(e,e.columns,e.rows)}set(e,t,i){return this.matrix.set(t,e,i),this}get(e,t){return this.matrix.get(t,e)}}class JD extends xt{constructor(e,t={}){const{rows:i=1}=t;if(e.length%i!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=i,this.columns=e.length/i,this.data=e}set(e,t,i){let r=this._calculateIndex(e,t);return this.data[r]=i,this}get(e,t){let i=this._calculateIndex(e,t);return this.data[i]}_calculateIndex(e,t){return e*this.columns+t}}class Tr extends xt{constructor(e){super(),this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,t,i){return this.data[e][t]=i,this}get(e,t){return this.data[e][t]}}function D$(n,e){if(Zi.isAnyArray(n))return n[0]&&Zi.isAnyArray(n[0])?new Tr(n):new JD(n,e);throw new Error("the argument is not an array")}class ay{constructor(e){e=Tr.checkMatrix(e);let t=e.clone(),i=t.rows,r=t.columns,s=new Float64Array(i),o=1,a,l,u,f,d,p,g,v,x;for(a=0;aMath.abs(v[f])&&(f=a);if(f!==l){for(u=0;u=0;u--){for(l=0;lo?r.set(s,o,e.get(s,o)):s===o?r.set(s,o,1):r.set(s,o,0);return r}get upperTriangularMatrix(){let e=this.LU,t=e.rows,i=e.columns,r=new Oe(t,i);for(let s=0;sMath.abs(e)?(t=e/n,Math.abs(n)*Math.sqrt(1+t*t)):e!==0?(t=n/e,Math.abs(e)*Math.sqrt(1+t*t)):0}class ME{constructor(e){e=Tr.checkMatrix(e);let t=e.clone(),i=e.rows,r=e.columns,s=new Float64Array(r),o,a,l,u;for(l=0;l=0;u--){for(l=0;l=0;a--){for(s=0;s=0;E--)if(v[E]!==0){for(let N=E+1;N=0;E--){if(E0;){let E,N;for(E=C-2;E>=-1&&E!==-1;E--){const z=Number.MIN_VALUE+I*Math.abs(v[E]+Math.abs(v[E+1]));if(Math.abs(m[E])<=z||Number.isNaN(m[E])){m[E]=0;break}}if(E===C-2)N=4;else{let z;for(z=C-1;z>=E&&z!==E;z--){let O=(z!==C?Math.abs(m[z]):0)+(z!==E+1?Math.abs(m[z-1]):0);if(Math.abs(v[z])<=I*O){v[z]=0;break}}z===E?N=3:z===C-1?N=1:(N=2,E=z)}switch(E++,N){case 1:{let z=m[C-2];m[C-2]=0;for(let O=C-2;O>=E;O--){let q=po(v[O],z),j=v[O]/q,Q=z/q;if(v[O]=q,O!==E&&(z=-Q*m[O-1],m[O-1]=j*m[O-1]),u)for(let oe=0;oe=v[E+1]);){let z=v[E];if(v[E]=v[E+1],v[E+1]=z,u&&Et&&s.set(f,d,e.get(f,d)/this.s[d]);let o=this.U,a=o.rows,l=o.columns,u=new Oe(i,a);for(let f=0;fe&&t++;return t}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return Oe.diag(this.s)}}function O$(n,e=!1){return n=Tr.checkMatrix(n),e?new Vc(n).inverse():QD(n,Oe.eye(n.rows))}function QD(n,e,t=!1){return n=Tr.checkMatrix(n),e=Tr.checkMatrix(e),t?new Vc(n).solve(e):n.isSquare()?new ay(n).solve(e):new ME(n).solve(e)}function Dg(n){if(n=Oe.checkMatrix(n),n.isSquare()){if(n.columns===0)return 1;let e,t,i,r;if(n.columns===2)return e=n.get(0,0),t=n.get(0,1),i=n.get(1,0),r=n.get(1,1),e*r-t*i;if(n.columns===3){let s,o,a;return s=new Ng(n,[1,2],[1,2]),o=new Ng(n,[1,2],[0,2]),a=new Ng(n,[1,2],[0,1]),e=n.get(0,0),t=n.get(0,1),i=n.get(0,2),e*Dg(s)-t*Dg(o)+i*Dg(a)}else return new ay(n).determinant}else throw Error("determinant can only be calculated for a square matrix")}function k$(n,e){let t=[];for(let i=0;ir)return new Array(e.rows+1).fill(0);{let s=e.addRow(t,[0]);for(let o=0;oe?s[o]=1/s[o]:s[o]=0;return r.mmul(Oe.diag(s).mmul(i.transpose()))}function B$(n,e=n,t={}){n=new Oe(n);let i=!1;if(typeof e=="object"&&!Oe.isMatrix(e)&&!Zi.isAnyArray(e)?(t=e,e=n,i=!0):e=new Oe(e),n.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:r=!0}=t;r&&(n=n.center("column"),i||(e=e.center("column")));const s=n.transpose().mmul(e);for(let o=0;o0?r.set(s,s+1,t[s]):t[s]<0&&r.set(s,s-1,t[s])}return r}}function H$(n,e,t,i){let r,s,o,a,l,u,f,d;for(l=0;l0;a--){for(d=0,o=0,u=0;u0&&(s=-s),e[a]=d*s,o=o-r*s,t[a-1]=r-s,l=0;lu)do{for(r=t[u],d=(t[u+1]-r)/(2*e[u]),p=po(d,1),d<0&&(p=-p),t[u]=e[u]/(d+p),t[u+1]=e[u]*(d+p),g=t[u+1],s=r-t[u],o=u+2;o=u;o--)for(_=x,x=v,S=w,r=v*e[o],s=v*d,p=po(d,e[o]),e[o+1]=w*p,w=e[o]/p,v=d/p,d=v*t[o]-w*r,t[o+1]=s+w*(v*r+w*t[o]),l=0;lA*R);t[u]=t[u]+b,e[u]=0}for(o=0;o=d;u--)t[u]=e.get(u,d-1)/p,l+=t[u]*t[u];for(a=Math.sqrt(l),t[d]>0&&(a=-a),l=l-t[d]*a,t[d]=t[d]-a,f=d;f=d;u--)o+=t[u]*e.get(u,f);for(o=o/l,u=d;u<=s;u++)e.set(u,f,e.get(u,f)-o*t[u])}for(u=0;u<=s;u++){for(o=0,f=s;f>=d;f--)o+=t[f]*e.get(u,f);for(o=o/l,f=d;f<=s;f++)e.set(u,f,e.get(u,f)-o*t[f])}t[d]=p*t[d],e.set(d,d-1,p*a)}}for(u=0;u=r+1;d--)if(e.get(d,d-1)!==0){for(u=d+1;u<=s;u++)t[u]=e.get(u,d-1);for(f=d;f<=s;f++){for(a=0,u=d;u<=s;u++)a+=t[u]*i.get(u,f);for(a=a/t[d]/e.get(d,d-1),u=d;u<=s;u++)i.set(u,f,i.get(u,f)+a*t[u])}}}function j$(n,e,t,i,r){let s=n-1,o=0,a=n-1,l=Number.EPSILON,u=0,f=0,d=0,p=0,g=0,v=0,x=0,_=0,m,w,S,b,R,A,C,L,I,E,N,z,O,q,j;for(m=0;ma)&&(t[m]=r.get(m,m),e[m]=0),w=Math.max(m-1,0);w=o;){for(b=s;b>o&&(v=Math.abs(r.get(b-1,b-1))+Math.abs(r.get(b,b)),v===0&&(v=f),!(Math.abs(r.get(b,b-1))=0){for(x=d>=0?d+x:d-x,t[s-1]=L+x,t[s]=t[s-1],x!==0&&(t[s]=L-C/x),e[s-1]=0,e[s]=0,L=r.get(s,s-1),v=Math.abs(L)+Math.abs(x),d=L/v,p=x/v,g=Math.sqrt(d*d+p*p),d=d/g,p=p/g,w=s-1;w0)){for(v=Math.sqrt(v),I=b&&(x=r.get(R,R),g=L-x,v=I-x,d=(g*v-C)/r.get(R+1,R)+r.get(R,R+1),p=r.get(R+1,R+1)-x-g-v,g=r.get(R+2,R+1),v=Math.abs(d)+Math.abs(p)+Math.abs(g),d=d/v,p=p/v,g=g/v,!(R===b||Math.abs(r.get(R,R-1))*(Math.abs(p)+Math.abs(g))R+2&&r.set(m,m-3,0);for(S=R;S<=s-1&&(q=S!==s-1,S!==R&&(d=r.get(S,S-1),p=r.get(S+1,S-1),g=q?r.get(S+2,S-1):0,L=Math.abs(d)+Math.abs(p)+Math.abs(g),L!==0&&(d=d/L,p=p/L,g=g/L)),L!==0);S++)if(v=Math.sqrt(d*d+p*p+g*g),d<0&&(v=-v),v!==0){for(S!==R?r.set(S,S-1,-v*L):b!==R&&r.set(S,S-1,-r.get(S,S-1)),d=d+v,L=d/v,I=p/v,x=g/v,p=p/d,g=g/d,w=S;w=0;s--)if(d=t[s],p=e[s],p===0)for(b=s,r.set(s,s,1),m=s-1;m>=0;m--){for(C=r.get(m,m)-d,g=0,w=b;w<=s;w++)g=g+r.get(m,w)*r.get(w,s);if(e[m]<0)x=C,v=g;else if(b=m,e[m]===0?r.set(m,s,C!==0?-g/C:-g/(l*f)):(L=r.get(m,m+1),I=r.get(m+1,m),p=(t[m]-d)*(t[m]-d)+e[m]*e[m],A=(L*v-x*g)/p,r.set(m,s,A),r.set(m+1,s,Math.abs(L)>Math.abs(x)?(-g-C*A)/L:(-v-I*A)/x)),A=Math.abs(r.get(m,s)),l*A*A>1)for(w=m;w<=s;w++)r.set(w,s,r.get(w,s)/A)}else if(p<0)for(b=s-1,Math.abs(r.get(s,s-1))>Math.abs(r.get(s-1,s))?(r.set(s-1,s-1,p/r.get(s,s-1)),r.set(s-1,s,-(r.get(s,s)-d)/r.get(s,s-1))):(j=Xm(0,-r.get(s-1,s),r.get(s-1,s-1)-d,p),r.set(s-1,s-1,j[0]),r.set(s-1,s,j[1])),r.set(s,s-1,0),r.set(s,s,1),m=s-2;m>=0;m--){for(E=0,N=0,w=b;w<=s;w++)E=E+r.get(m,w)*r.get(w,s-1),N=N+r.get(m,w)*r.get(w,s);if(C=r.get(m,m)-d,e[m]<0)x=C,g=E,v=N;else if(b=m,e[m]===0?(j=Xm(-E,-N,C,p),r.set(m,s-1,j[0]),r.set(m,s,j[1])):(L=r.get(m,m+1),I=r.get(m+1,m),z=(t[m]-d)*(t[m]-d)+e[m]*e[m]-p*p,O=(t[m]-d)*2*p,z===0&&O===0&&(z=l*f*(Math.abs(C)+Math.abs(p)+Math.abs(L)+Math.abs(I)+Math.abs(x))),j=Xm(L*g-x*E+p*N,L*v-x*N-p*E,z,O),r.set(m,s-1,j[0]),r.set(m,s,j[1]),Math.abs(L)>Math.abs(x)+Math.abs(p)?(r.set(m+1,s-1,(-E-C*r.get(m,s-1)+p*r.get(m,s))/L),r.set(m+1,s,(-N-C*r.get(m,s)-p*r.get(m,s-1))/L)):(j=Xm(-g-I*r.get(m,s-1),-v-I*r.get(m,s),x,p),r.set(m+1,s-1,j[0]),r.set(m+1,s,j[1]))),A=Math.max(Math.abs(r.get(m,s-1)),Math.abs(r.get(m,s))),l*A*A>1)for(w=m;w<=s;w++)r.set(w,s-1,r.get(w,s-1)/A),r.set(w,s,r.get(w,s)/A)}for(m=0;ma)for(w=m;w=o;w--)for(m=o;m<=a;m++){for(x=0,S=o;S<=Math.min(w,a);S++)x=x+i.get(m,S)*r.get(S,w);i.set(m,w,x)}}}function Xm(n,e,t,i){let r,s;return Math.abs(t)>Math.abs(i)?(r=i/t,s=t+r*i,[(n+r*e)/s,(e-r*n)/s]):(r=t/i,s=i+r*t,[(r*n+e)/s,(r*e-n)/s])}class tO{constructor(e){if(e=Tr.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let t=e,i=t.rows,r=new Oe(i,i),s=!0,o,a,l;for(a=0;a0,r.set(a,a,Math.sqrt(Math.max(u,0))),l=a+1;l=0;l--)for(a=0;ao;g++)d=e.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),d=d.div(d.norm()),u=e.mmul(d).div(d.transpose().mmul(d).get(0,0)),g>0&&(l=u.clone().sub(p).pow(2).sum()),p=u.clone(),i?(f=i.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),f=f.div(f.norm()),a=i.mmul(f).div(f.transpose().mmul(f).get(0,0))):a=u;if(i){let g=e.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));g=g.div(g.norm());let v=e.clone().sub(u.clone().mmul(g.transpose())),x=a.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),_=i.clone().sub(u.clone().mulS(x.get(0,0)).mmul(f.transpose()));this.t=u,this.p=g.transpose(),this.w=d.transpose(),this.q=f,this.u=a,this.s=u.transpose().mmul(u),this.xResidual=v,this.yResidual=_,this.betas=x}else this.w=d.transpose(),this.s=u.transpose().mmul(u).sqrt(),r?this.t=u.clone().div(this.s.get(0,0)):this.t=u,this.xResidual=e.sub(u.mmul(d.transpose()))}}Nt.AbstractMatrix=xt;Nt.CHO=tO;Nt.CholeskyDecomposition=tO;Nt.DistanceMatrix=oy;Nt.EVD=eO;Nt.EigenvalueDecomposition=eO;Nt.LU=ay;Nt.LuDecomposition=ay;var iO=Nt.Matrix=Oe;Nt.MatrixColumnSelectionView=A$;Nt.MatrixColumnView=T$;Nt.MatrixFlipColumnView=C$;Nt.MatrixFlipRowView=R$;Nt.MatrixRowSelectionView=I$;Nt.MatrixRowView=P$;Nt.MatrixSelectionView=Ng;Nt.MatrixSubView=L$;Nt.MatrixTransposeView=N$;Nt.NIPALS=nO;Nt.Nipals=nO;Nt.QR=ME;Nt.QrDecomposition=ME;Nt.SVD=Vc;Nt.SingularValueDecomposition=Vc;Nt.SymmetricMatrix=wl;Nt.WrapperMatrix1D=JD;Nt.WrapperMatrix2D=Tr;Nt.correlation=V$;Nt.covariance=B$;var iP=Nt.default=Oe;Nt.determinant=Dg;var X$=Nt.inverse=O$;Nt.linearDependencies=U$;Nt.pseudoInverse=z$;Nt.solve=QD;Nt.wrap=D$;const qv=iO;iP.Matrix&&iP.Matrix;const $$=X$;function q$(n,e,t,i,r){const s=t.length,o=n.x.length;let a=new Array(s);for(let l=0;l0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s},oP=Ft&&Ft.__spread||function(){for(var n=[],e=0;e0&&s.set(o,f,d)}var p=Mn.transpose(s);return Mn.maximum(s,p)},n.prototype.transform=function(e){var t=this,i=this.X;if(i===void 0||i.length===0)throw new Error("No data has been fit.");var r=Math.floor(this.nNeighbors*this.transformQueueSize);r=Math.min(i.length,r);var s=$m.initializeSearch(this.rpForest,i,e,r,this.initFromRandom,this.initFromTree,this.random),o=this.search(i,this.searchGraph,s,e),a=tq.deheapSort(o),l=a.indices,u=a.weights;l=l.map(function(j){return j.slice(0,t.nNeighbors)}),u=u.map(function(j){return j.slice(0,t.nNeighbors)});var f=Math.max(0,this.localConnectivity-1),d=this.smoothKNNDistance(u,this.nNeighbors,f),p=d.sigmas,g=d.rhos,v=this.computeMembershipStrengths(l,u,p,g),x=v.rows,_=v.cols,m=v.vals,w=[e.length,i.length],S=new Mn.SparseMatrix(x,_,m,w),b=Mn.normalize(S,"l1"),R=Mn.getCSR(b),A=e.length,C=In.reshape2d(R.indices,A,this.nNeighbors),L=In.reshape2d(R.values,A,this.nNeighbors),I=lO(C,L,this.embedding),E=this.nEpochs?this.nEpochs/3:S.nRows<=1e4?100:30,N=S.getValues().reduce(function(j,Q){return Q>j?Q:j},0);S=S.map(function(j){return j0});if(v.length>=i){var x=Math.floor(i),_=i-x;x>0?(a[u]=v[x-1],_>lP&&(a[u]+=_*(v[x]-v[x-1]))):a[u]=_*v[0]}else v.length>0&&(a[u]=In.max(v));for(var m=0;m0?w+=Math.exp(-(b/p)):w+=1}if(Math.abs(w-o)o?(d=p,p=(f+d)/2):(f=p,d===1/0?p*=2:p=(f+d)/2)}if(l[u]=p,a[u]>0){var R=In.mean(g);l[u]0&&(i[a]=t/s[a])}),i},n.prototype.assignOptimizationStateParameters=function(e){Object.assign(this.optimizationState,e)},n.prototype.prepareForOptimizationLoop=function(){var e=this,t=e.repulsionStrength,i=e.learningRate,r=e.negativeSampleRate,s=this.optimizationState,o=s.epochsPerSample,a=s.headEmbedding,l=s.tailEmbedding,u=a[0].length,f=a.length===l.length,d=o.map(function(v){return v/r}),p=oP(d),g=oP(o);this.assignOptimizationStateParameters({epochOfNextSample:g,epochOfNextNegativeSample:p,epochsPerNegativeSample:d,moveOther:f,initialAlpha:i,alpha:i,gamma:t,dim:u})},n.prototype.initializeOptimization=function(){var e=this.embedding,t=this.embedding,i=this.optimizationState,r=i.head,s=i.tail,o=i.epochsPerSample,a=this.getNEpochs(),l=this.graph.nCols,u=sO(this.spread,this.minDist),f=u.a,d=u.b;this.assignOptimizationStateParameters({headEmbedding:e,tailEmbedding:t,head:r,tail:s,epochsPerSample:o,a:f,b:d,nEpochs:a,nVertices:l})},n.prototype.optimizeLayoutStep=function(e){for(var t=this.optimizationState,i=t.head,r=t.tail,s=t.headEmbedding,o=t.tailEmbedding,a=t.epochsPerSample,l=t.epochOfNextSample,u=t.epochOfNextNegativeSample,f=t.epochsPerNegativeSample,d=t.moveOther,p=t.initialAlpha,g=t.alpha,v=t.gamma,x=t.a,_=t.b,m=t.dim,w=t.nEpochs,S=t.nVertices,b=4,R=0;Re)){var A=i[R],C=r[R],L=s[A],I=o[C],E=cP(L,I),N=0;E>0&&(N=-2*x*_*Math.pow(E,_-1),N/=x*Math.pow(E,_)+1);for(var z=0;z0)W=2*v*_,W/=(.001+k)*(x*Math.pow(k,_)+1);else if(A===Q)continue;for(var z=0;z0&&(O=uP(W*(L[z]-oe[z]),b)),L[z]+=O*g}}u[R]+=q*f[R]}return t.alpha=p*(1-e/w),t.currentEpoch+=1,s},n.prototype.optimizeLayoutAsync=function(e){var t=this;return e===void 0&&(e=function(){return!0}),new Promise(function(i,r){var s=function(){return rP(t,void 0,void 0,function(){var o,a,l,u,f,d;return sP(this,function(p){try{if(o=this.optimizationState,a=o.nEpochs,l=o.currentEpoch,this.embedding=this.optimizeLayoutStep(l),u=this.optimizationState.currentEpoch,f=e(u)===!1,d=u===a,!f&&!d)setTimeout(function(){return s()},0);else return[2,i(d)]}catch(g){r(g)}return[2]})})};setTimeout(function(){return s()},0)})},n.prototype.optimizeLayout=function(e){e===void 0&&(e=function(){return!0});for(var t=!1,i=[];!t;){var r=this.optimizationState,s=r.nEpochs,o=r.currentEpoch;i=this.optimizeLayoutStep(o);var a=this.optimizationState.currentEpoch,l=e(a)===!1;t=a===s||l}return i},n.prototype.getNEpochs=function(){var e=this.graph;if(this.nEpochs>0)return this.nEpochs;var t=e.nRows;return t<=2500?500:t<=5e3?400:t<=7500?300:200},n}();Oo.UMAP=iq;function rO(n,e){for(var t=0,i=0;ie?e:n<-e?-e:n}function cP(n,e){for(var t=0,i=0;i=e;return v?Math.exp(-(i[g]-e)/n):p}),s=[.5,.5],o={x:i,y:r},a={damping:1.5,initialValues:s,gradientDifference:.1,maxIterations:100,errorTolerance:.01},l=nq.default(o,t,a).parameterValues,u=a1(l,2),f=u[0],d=u[1];return{a:f,b:d}}Oo.findABParams=sO;function oO(n,e,t,i){return t===void 0&&(t=1),i===void 0&&(i=5),n.map(function(r,s,o){return e[s]===-1||e[o]===-1?r*Math.exp(-t):e[s]!==e[o]?r*Math.exp(-i):r})}Oo.fastIntersection=oO;function aO(n){n=Mn.normalize(n,"max");var e=Mn.transpose(n),t=Mn.pairwiseMultiply(e,n);return n=Mn.add(n,Mn.subtract(e,t)),Mn.eliminateZeros(n)}Oo.resetLocalConnectivity=aO;function lO(n,e,t){for(var i=In.zeros(n.length).map(function(l){return In.zeros(t[0].length)}),r=0;rthis.calculateEmbedding(i)));return this.theUMAP=new aq({nNeighbors:1,nComponents:3,minDist:.5}),this.theUMAP.fit(t)}async calculateProjection(e){if(this.initOpenAi(),!this.theUMAP)return[0,0,0];const t=await this.calculateEmbedding(e);return this.theUMAP.transform([t])[0]}}const uq=()=>We.jsxs("div",{className:"ItemOpenAiKey",children:["OpenAI API key    ",We.jsx("input",{id:"llm-key",style:{width:"auto"},type:"password"})]});function cq(){let[n]=Y.useState(new lq);const[e,t]=Y.useState(-1),[i,r]=Y.useState([]),[s,o]=Y.useState([0,0,0]),a=async f=>{o(await n.calculateProjection(f))},l=f=>{u(f)},u=async f=>{const d=await n.initializeProjection(f.map(p=>p.label));f.map(p=>{p.position=d[p.index]}),r(f.slice())};return We.jsxs(We.Fragment,{children:[We.jsx(uq,{}),We.jsxs("div",{id:"main-div",children:[We.jsxs("div",{id:"left-pane",children:[We.jsx(x7,{conceptCategories:E7,concepts:i,setConcepts:l}),We.jsx(w7,{onChangeMyConcept:a})]}),We.jsx("div",{id:"right-pane",children:We.jsx(MW,{concepts:i,spherePos:s,onHoverConcept:t,onSelectConcept:t})})]}),e!=-1&&We.jsx(S7,{text:`${i[e].label}`})]})}Kx.createRoot(document.getElementById("root")).render(We.jsx(wP.StrictMode,{children:We.jsx(cq,{})})); +${ZD}`)}function s$(n,e,t){return(n>=0&&t?` ${tP(n,e-1)}`:tP(n,e)).padEnd(e)}function tP(n,e){let t=n.toString();if(t.length<=e)return t;let i=n.toFixed(e);if(i.length>e&&(i=n.toFixed(Math.max(0,e-(i.length-e)))),i.length<=e&&!i.startsWith("0.000")&&!i.startsWith("-0.000"))return i;let r=n.toExponential(e);return r.length>e&&(r=n.toExponential(Math.max(0,e-(r.length-e)))),r.slice(0)}function o$(n,e){n.prototype.add=function(i){return typeof i=="number"?this.addS(i):this.addM(i)},n.prototype.addS=function(i){for(let r=0;r>i);return this},n.prototype.signPropagatingRightShiftM=function(i){if(i=e.checkMatrix(i),this.rows!==i.rows||this.columns!==i.columns)throw new RangeError("Matrices dimensions must be equal");for(let r=0;r>i.get(r,s));return this},n.signPropagatingRightShift=function(i,r){return new e(i).signPropagatingRightShift(r)},n.prototype.rightShift=function(i){return typeof i=="number"?this.rightShiftS(i):this.rightShiftM(i)},n.prototype.rightShiftS=function(i){for(let r=0;r>>i);return this},n.prototype.rightShiftM=function(i){if(i=e.checkMatrix(i),this.rows!==i.rows||this.columns!==i.columns)throw new RangeError("Matrices dimensions must be equal");for(let r=0;r>>i.get(r,s));return this},n.rightShift=function(i,r){return new e(i).rightShift(r)},n.prototype.zeroFillRightShift=n.prototype.rightShift,n.prototype.zeroFillRightShiftS=n.prototype.rightShiftS,n.prototype.zeroFillRightShiftM=n.prototype.rightShiftM,n.zeroFillRightShift=n.rightShift,n.prototype.not=function(){for(let i=0;ii)throw new RangeError("Row index out of range")}function Br(n,e,t){let i=t?n.columns:n.columns-1;if(e<0||e>i)throw new RangeError("Column index out of range")}function Du(n,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==n.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Ou(n,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==n.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function wE(n,e){if(!Zi.isAnyArray(e))throw new TypeError("row indices must be an array");for(let t=0;t=n.rows)throw new RangeError("row indices are out of range")}function SE(n,e){if(!Zi.isAnyArray(e))throw new TypeError("column indices must be an array");for(let t=0;t=n.columns)throw new RangeError("column indices are out of range")}function s1(n,e,t,i,r){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(jm("startRow",e),jm("endRow",t),jm("startColumn",i),jm("endColumn",r),e>t||i>r||e<0||e>=n.rows||t<0||t>=n.rows||i<0||i>=n.columns||r<0||r>=n.columns)throw new RangeError("Submatrix indices are out of range")}function sy(n,e=0){let t=[];for(let i=0;i=s)throw new RangeError("min must be smaller than max");let a=s-r,l=new Oe(e,t);for(let u=0;ui?(s=!0,i=t):(r=!1,s=!0);e++}return r}isReducedEchelonForm(){let e=0,t=0,i=-1,r=!0,s=!1;for(;ei?(s=!0,i=t):(r=!1,s=!0);for(let o=t+1;oe.get(r,i)&&(r=s);if(e.get(r,i)===0)i++;else{e.swapRows(t,r);let s=e.get(t,i);for(let o=i;o=0;)if(e.maxRow(r)===0)r--;else{let s=0,o=!1;for(;st[i]&&(t[i]=this.get(i,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let i=0;it[r]&&(t[r]=this.get(i,r));return t}case void 0:{let t=this.get(0,0);for(let i=0;it&&(t=this.get(i,r));return t}default:throw new Error(`invalid option: ${e}`)}}maxIndex(){Cu(this);let e=this.get(0,0),t=[0,0];for(let i=0;ie&&(e=this.get(i,r),t[0]=i,t[1]=r);return t}min(e){if(this.isEmpty())return NaN;switch(e){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let i=0;it&&(t=this.get(e,i));return t}maxRowIndex(e){zr(this,e),Cu(this);let t=this.get(e,0),i=[e,0];for(let r=1;rt&&(t=this.get(e,r),i[1]=r);return i}minRow(e){if(zr(this,e),this.isEmpty())return NaN;let t=this.get(e,0);for(let i=1;it&&(t=this.get(i,e));return t}maxColumnIndex(e){Br(this,e),Cu(this);let t=this.get(0,e),i=[0,e];for(let r=1;rt&&(t=this.get(r,e),i[0]=r);return i}minColumn(e){if(Br(this,e),this.isEmpty())return NaN;let t=this.get(0,e);for(let i=1;i=i)throw new RangeError("min must be smaller than max");let r=new Oe(this.rows,this.columns);for(let s=0;s0&&eP(o,{min:t,max:i,output:o}),r.setRow(s,o)}return r}scaleColumns(e={}){if(typeof e!="object")throw new TypeError("options must be an object");const{min:t=0,max:i=1}=e;if(!Number.isFinite(t))throw new TypeError("min must be a number");if(!Number.isFinite(i))throw new TypeError("max must be a number");if(t>=i)throw new RangeError("min must be smaller than max");let r=new Oe(this.rows,this.columns);for(let s=0;si||t<0||t>=this.columns||i<0||i>=this.columns)throw new RangeError("Argument out of range");let r=new Oe(e.length,i-t+1);for(let s=0;s=this.rows)throw new RangeError(`Row index out of range: ${e[s]}`);r.set(s,o-t,this.get(e[s],o))}return r}subMatrixColumn(e,t,i){if(t===void 0&&(t=0),i===void 0&&(i=this.rows-1),t>i||t<0||t>=this.rows||i<0||i>=this.rows)throw new RangeError("Argument out of range");let r=new Oe(i-t+1,e.length);for(let s=0;s=this.columns)throw new RangeError(`Column index out of range: ${e[s]}`);r.set(o-t,s,this.get(o,e[s]))}return r}setSubMatrix(e,t,i){if(e=Oe.checkMatrix(e),e.isEmpty())return this;let r=t+e.rows-1,s=i+e.columns-1;s1(this,t,r,i,s);for(let o=0;otypeof e=="number")}xt.random=xt.rand;xt.randomInt=xt.randInt;xt.diagonal=xt.diag;xt.prototype.diagonal=xt.prototype.diag;xt.identity=xt.eye;xt.prototype.negate=xt.prototype.neg;xt.prototype.tensorProduct=xt.prototype.kroneckerProduct;var od,o1,Ac;let Oe=(Ac=class extends xt{constructor(t,i){super();g_(this,od);wp(this,"data");if(Ac.isMatrix(t))v_(this,od,o1).call(this,t.rows,t.columns),Ac.copy(t,this);else if(Number.isInteger(t)&&t>=0)v_(this,od,o1).call(this,t,i);else if(Zi.isAnyArray(t)){const r=t;if(t=r.length,i=t?r[0].length:0,typeof i!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let s=0;s"u"&&(i=t,t=this.columns),Br(this,t,!0),i=Ou(this,i);for(let r=0;r=0)for(let r=0;r=0)Sp(this,Ei,new Oe(t,t));else if(Sp(this,Ei,new Oe(t)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return ts(this,Ei).size}get rows(){return ts(this,Ei).rows}get columns(){return ts(this,Ei).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return Oe.isMatrix(t)&&t.klassType==="SymmetricMatrix"}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}clone(){const t=new Yv(this.diagonalSize);for(const[i,r,s]of this.upperRightEntries())t.set(i,r,s);return t}toMatrix(){return new Oe(this)}get(t,i){return ts(this,Ei).get(t,i)}set(t,i,r){return ts(this,Ei).set(t,i,r),ts(this,Ei).set(i,t,r),this}removeCross(t){return ts(this,Ei).removeRow(t),ts(this,Ei).removeColumn(t),this}addCross(t,i){i===void 0&&(i=t,t=this.diagonalSize);const r=i.slice();return r.splice(t,1),ts(this,Ei).addRow(t,r),ts(this,Ei).addColumn(t,i),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const i=[];for(const[r,s]of t.entries())s||i.push(r);i.reverse();for(const r of i)this.removeCross(r);return this}toCompact(){const{diagonalSize:t}=this,i=new Array(t*(t+1)/2);for(let r=0,s=0,o=0;o=t&&(r=++s);return i}static fromCompact(t){const i=t.length,r=(Math.sqrt(8*i+1)-1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const s=new Yv(r);for(let o=0,a=0,l=0;l=r&&(o=++a);return s}*upperRightEntries(){for(let t=0,i=0;t=this.diagonalSize&&(i=++t)}}*upperRightValues(){for(let t=0,i=0;t=this.diagonalSize&&(i=++t)}};Ei=new WeakMap;let wl=Yv;wl.prototype.klassType="SymmetricMatrix";class oy extends wl{static isDistanceMatrix(e){return wl.isSymmetricMatrix(e)&&e.klassSubType==="DistanceMatrix"}constructor(e){if(super(e),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(e,t,i){return e===t&&(i=0),super.set(e,t,i)}addCross(e,t){return t===void 0&&(t=e,e=this.diagonalSize),t=t.slice(),t[e]=0,super.addCross(e,t)}toSymmetricMatrix(){return new wl(this)}clone(){const e=new oy(this.diagonalSize);for(const[t,i,r]of this.upperRightEntries())t!==i&&e.set(t,i,r);return e}toCompact(){const{diagonalSize:e}=this,t=(e-1)*e/2,i=new Array(t);for(let r=1,s=0,o=0;o=e&&(r=++s+1);return i}static fromCompact(e){const t=e.length,i=(Math.sqrt(8*t+1)+1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(e)}`);const r=new this(i);for(let s=1,o=0,a=0;a=i&&(s=++o+1);return r}}oy.prototype.klassSubType="DistanceMatrix";class ko extends xt{constructor(e,t,i){super(),this.matrix=e,this.rows=t,this.columns=i}}class T$ extends ko{constructor(e,t){Br(e,t),super(e,e.rows,1),this.column=t}set(e,t,i){return this.matrix.set(e,this.column,i),this}get(e){return this.matrix.get(e,this.column)}}class A$ extends ko{constructor(e,t){SE(e,t),super(e,e.rows,t.length),this.columnIndices=t}set(e,t,i){return this.matrix.set(e,this.columnIndices[t],i),this}get(e,t){return this.matrix.get(e,this.columnIndices[t])}}class C$ extends ko{constructor(e){super(e,e.rows,e.columns)}set(e,t,i){return this.matrix.set(e,this.columns-t-1,i),this}get(e,t){return this.matrix.get(e,this.columns-t-1)}}class R$ extends ko{constructor(e){super(e,e.rows,e.columns)}set(e,t,i){return this.matrix.set(this.rows-e-1,t,i),this}get(e,t){return this.matrix.get(this.rows-e-1,t)}}class P$ extends ko{constructor(e,t){zr(e,t),super(e,1,e.columns),this.row=t}set(e,t,i){return this.matrix.set(this.row,t,i),this}get(e,t){return this.matrix.get(this.row,t)}}class I$ extends ko{constructor(e,t){wE(e,t),super(e,t.length,e.columns),this.rowIndices=t}set(e,t,i){return this.matrix.set(this.rowIndices[e],t,i),this}get(e,t){return this.matrix.get(this.rowIndices[e],t)}}class Ng extends ko{constructor(e,t,i){wE(e,t),SE(e,i),super(e,t.length,i.length),this.rowIndices=t,this.columnIndices=i}set(e,t,i){return this.matrix.set(this.rowIndices[e],this.columnIndices[t],i),this}get(e,t){return this.matrix.get(this.rowIndices[e],this.columnIndices[t])}}class L$ extends ko{constructor(e,t,i,r,s){s1(e,t,i,r,s),super(e,i-t+1,s-r+1),this.startRow=t,this.startColumn=r}set(e,t,i){return this.matrix.set(this.startRow+e,this.startColumn+t,i),this}get(e,t){return this.matrix.get(this.startRow+e,this.startColumn+t)}}class N$ extends ko{constructor(e){super(e,e.columns,e.rows)}set(e,t,i){return this.matrix.set(t,e,i),this}get(e,t){return this.matrix.get(t,e)}}class JD extends xt{constructor(e,t={}){const{rows:i=1}=t;if(e.length%i!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=i,this.columns=e.length/i,this.data=e}set(e,t,i){let r=this._calculateIndex(e,t);return this.data[r]=i,this}get(e,t){let i=this._calculateIndex(e,t);return this.data[i]}_calculateIndex(e,t){return e*this.columns+t}}class Tr extends xt{constructor(e){super(),this.data=e,this.rows=e.length,this.columns=e[0].length}set(e,t,i){return this.data[e][t]=i,this}get(e,t){return this.data[e][t]}}function D$(n,e){if(Zi.isAnyArray(n))return n[0]&&Zi.isAnyArray(n[0])?new Tr(n):new JD(n,e);throw new Error("the argument is not an array")}class ay{constructor(e){e=Tr.checkMatrix(e);let t=e.clone(),i=t.rows,r=t.columns,s=new Float64Array(i),o=1,a,l,u,f,d,p,g,v,x;for(a=0;aMath.abs(v[f])&&(f=a);if(f!==l){for(u=0;u=0;u--){for(l=0;lo?r.set(s,o,e.get(s,o)):s===o?r.set(s,o,1):r.set(s,o,0);return r}get upperTriangularMatrix(){let e=this.LU,t=e.rows,i=e.columns,r=new Oe(t,i);for(let s=0;sMath.abs(e)?(t=e/n,Math.abs(n)*Math.sqrt(1+t*t)):e!==0?(t=n/e,Math.abs(e)*Math.sqrt(1+t*t)):0}class ME{constructor(e){e=Tr.checkMatrix(e);let t=e.clone(),i=e.rows,r=e.columns,s=new Float64Array(r),o,a,l,u;for(l=0;l=0;u--){for(l=0;l=0;a--){for(s=0;s=0;E--)if(v[E]!==0){for(let N=E+1;N=0;E--){if(E0;){let E,N;for(E=C-2;E>=-1&&E!==-1;E--){const z=Number.MIN_VALUE+I*Math.abs(v[E]+Math.abs(v[E+1]));if(Math.abs(m[E])<=z||Number.isNaN(m[E])){m[E]=0;break}}if(E===C-2)N=4;else{let z;for(z=C-1;z>=E&&z!==E;z--){let O=(z!==C?Math.abs(m[z]):0)+(z!==E+1?Math.abs(m[z-1]):0);if(Math.abs(v[z])<=I*O){v[z]=0;break}}z===E?N=3:z===C-1?N=1:(N=2,E=z)}switch(E++,N){case 1:{let z=m[C-2];m[C-2]=0;for(let O=C-2;O>=E;O--){let q=po(v[O],z),j=v[O]/q,Q=z/q;if(v[O]=q,O!==E&&(z=-Q*m[O-1],m[O-1]=j*m[O-1]),u)for(let oe=0;oe=v[E+1]);){let z=v[E];if(v[E]=v[E+1],v[E+1]=z,u&&Et&&s.set(f,d,e.get(f,d)/this.s[d]);let o=this.U,a=o.rows,l=o.columns,u=new Oe(i,a);for(let f=0;fe&&t++;return t}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return Oe.diag(this.s)}}function O$(n,e=!1){return n=Tr.checkMatrix(n),e?new Vc(n).inverse():QD(n,Oe.eye(n.rows))}function QD(n,e,t=!1){return n=Tr.checkMatrix(n),e=Tr.checkMatrix(e),t?new Vc(n).solve(e):n.isSquare()?new ay(n).solve(e):new ME(n).solve(e)}function Dg(n){if(n=Oe.checkMatrix(n),n.isSquare()){if(n.columns===0)return 1;let e,t,i,r;if(n.columns===2)return e=n.get(0,0),t=n.get(0,1),i=n.get(1,0),r=n.get(1,1),e*r-t*i;if(n.columns===3){let s,o,a;return s=new Ng(n,[1,2],[1,2]),o=new Ng(n,[1,2],[0,2]),a=new Ng(n,[1,2],[0,1]),e=n.get(0,0),t=n.get(0,1),i=n.get(0,2),e*Dg(s)-t*Dg(o)+i*Dg(a)}else return new ay(n).determinant}else throw Error("determinant can only be calculated for a square matrix")}function k$(n,e){let t=[];for(let i=0;ir)return new Array(e.rows+1).fill(0);{let s=e.addRow(t,[0]);for(let o=0;oe?s[o]=1/s[o]:s[o]=0;return r.mmul(Oe.diag(s).mmul(i.transpose()))}function B$(n,e=n,t={}){n=new Oe(n);let i=!1;if(typeof e=="object"&&!Oe.isMatrix(e)&&!Zi.isAnyArray(e)?(t=e,e=n,i=!0):e=new Oe(e),n.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:r=!0}=t;r&&(n=n.center("column"),i||(e=e.center("column")));const s=n.transpose().mmul(e);for(let o=0;o0?r.set(s,s+1,t[s]):t[s]<0&&r.set(s,s-1,t[s])}return r}}function H$(n,e,t,i){let r,s,o,a,l,u,f,d;for(l=0;l0;a--){for(d=0,o=0,u=0;u0&&(s=-s),e[a]=d*s,o=o-r*s,t[a-1]=r-s,l=0;lu)do{for(r=t[u],d=(t[u+1]-r)/(2*e[u]),p=po(d,1),d<0&&(p=-p),t[u]=e[u]/(d+p),t[u+1]=e[u]*(d+p),g=t[u+1],s=r-t[u],o=u+2;o=u;o--)for(_=x,x=v,S=w,r=v*e[o],s=v*d,p=po(d,e[o]),e[o+1]=w*p,w=e[o]/p,v=d/p,d=v*t[o]-w*r,t[o+1]=s+w*(v*r+w*t[o]),l=0;lA*R);t[u]=t[u]+b,e[u]=0}for(o=0;o=d;u--)t[u]=e.get(u,d-1)/p,l+=t[u]*t[u];for(a=Math.sqrt(l),t[d]>0&&(a=-a),l=l-t[d]*a,t[d]=t[d]-a,f=d;f=d;u--)o+=t[u]*e.get(u,f);for(o=o/l,u=d;u<=s;u++)e.set(u,f,e.get(u,f)-o*t[u])}for(u=0;u<=s;u++){for(o=0,f=s;f>=d;f--)o+=t[f]*e.get(u,f);for(o=o/l,f=d;f<=s;f++)e.set(u,f,e.get(u,f)-o*t[f])}t[d]=p*t[d],e.set(d,d-1,p*a)}}for(u=0;u=r+1;d--)if(e.get(d,d-1)!==0){for(u=d+1;u<=s;u++)t[u]=e.get(u,d-1);for(f=d;f<=s;f++){for(a=0,u=d;u<=s;u++)a+=t[u]*i.get(u,f);for(a=a/t[d]/e.get(d,d-1),u=d;u<=s;u++)i.set(u,f,i.get(u,f)+a*t[u])}}}function j$(n,e,t,i,r){let s=n-1,o=0,a=n-1,l=Number.EPSILON,u=0,f=0,d=0,p=0,g=0,v=0,x=0,_=0,m,w,S,b,R,A,C,L,I,E,N,z,O,q,j;for(m=0;ma)&&(t[m]=r.get(m,m),e[m]=0),w=Math.max(m-1,0);w=o;){for(b=s;b>o&&(v=Math.abs(r.get(b-1,b-1))+Math.abs(r.get(b,b)),v===0&&(v=f),!(Math.abs(r.get(b,b-1))=0){for(x=d>=0?d+x:d-x,t[s-1]=L+x,t[s]=t[s-1],x!==0&&(t[s]=L-C/x),e[s-1]=0,e[s]=0,L=r.get(s,s-1),v=Math.abs(L)+Math.abs(x),d=L/v,p=x/v,g=Math.sqrt(d*d+p*p),d=d/g,p=p/g,w=s-1;w0)){for(v=Math.sqrt(v),I=b&&(x=r.get(R,R),g=L-x,v=I-x,d=(g*v-C)/r.get(R+1,R)+r.get(R,R+1),p=r.get(R+1,R+1)-x-g-v,g=r.get(R+2,R+1),v=Math.abs(d)+Math.abs(p)+Math.abs(g),d=d/v,p=p/v,g=g/v,!(R===b||Math.abs(r.get(R,R-1))*(Math.abs(p)+Math.abs(g))R+2&&r.set(m,m-3,0);for(S=R;S<=s-1&&(q=S!==s-1,S!==R&&(d=r.get(S,S-1),p=r.get(S+1,S-1),g=q?r.get(S+2,S-1):0,L=Math.abs(d)+Math.abs(p)+Math.abs(g),L!==0&&(d=d/L,p=p/L,g=g/L)),L!==0);S++)if(v=Math.sqrt(d*d+p*p+g*g),d<0&&(v=-v),v!==0){for(S!==R?r.set(S,S-1,-v*L):b!==R&&r.set(S,S-1,-r.get(S,S-1)),d=d+v,L=d/v,I=p/v,x=g/v,p=p/d,g=g/d,w=S;w=0;s--)if(d=t[s],p=e[s],p===0)for(b=s,r.set(s,s,1),m=s-1;m>=0;m--){for(C=r.get(m,m)-d,g=0,w=b;w<=s;w++)g=g+r.get(m,w)*r.get(w,s);if(e[m]<0)x=C,v=g;else if(b=m,e[m]===0?r.set(m,s,C!==0?-g/C:-g/(l*f)):(L=r.get(m,m+1),I=r.get(m+1,m),p=(t[m]-d)*(t[m]-d)+e[m]*e[m],A=(L*v-x*g)/p,r.set(m,s,A),r.set(m+1,s,Math.abs(L)>Math.abs(x)?(-g-C*A)/L:(-v-I*A)/x)),A=Math.abs(r.get(m,s)),l*A*A>1)for(w=m;w<=s;w++)r.set(w,s,r.get(w,s)/A)}else if(p<0)for(b=s-1,Math.abs(r.get(s,s-1))>Math.abs(r.get(s-1,s))?(r.set(s-1,s-1,p/r.get(s,s-1)),r.set(s-1,s,-(r.get(s,s)-d)/r.get(s,s-1))):(j=Xm(0,-r.get(s-1,s),r.get(s-1,s-1)-d,p),r.set(s-1,s-1,j[0]),r.set(s-1,s,j[1])),r.set(s,s-1,0),r.set(s,s,1),m=s-2;m>=0;m--){for(E=0,N=0,w=b;w<=s;w++)E=E+r.get(m,w)*r.get(w,s-1),N=N+r.get(m,w)*r.get(w,s);if(C=r.get(m,m)-d,e[m]<0)x=C,g=E,v=N;else if(b=m,e[m]===0?(j=Xm(-E,-N,C,p),r.set(m,s-1,j[0]),r.set(m,s,j[1])):(L=r.get(m,m+1),I=r.get(m+1,m),z=(t[m]-d)*(t[m]-d)+e[m]*e[m]-p*p,O=(t[m]-d)*2*p,z===0&&O===0&&(z=l*f*(Math.abs(C)+Math.abs(p)+Math.abs(L)+Math.abs(I)+Math.abs(x))),j=Xm(L*g-x*E+p*N,L*v-x*N-p*E,z,O),r.set(m,s-1,j[0]),r.set(m,s,j[1]),Math.abs(L)>Math.abs(x)+Math.abs(p)?(r.set(m+1,s-1,(-E-C*r.get(m,s-1)+p*r.get(m,s))/L),r.set(m+1,s,(-N-C*r.get(m,s)-p*r.get(m,s-1))/L)):(j=Xm(-g-I*r.get(m,s-1),-v-I*r.get(m,s),x,p),r.set(m+1,s-1,j[0]),r.set(m+1,s,j[1]))),A=Math.max(Math.abs(r.get(m,s-1)),Math.abs(r.get(m,s))),l*A*A>1)for(w=m;w<=s;w++)r.set(w,s-1,r.get(w,s-1)/A),r.set(w,s,r.get(w,s)/A)}for(m=0;ma)for(w=m;w=o;w--)for(m=o;m<=a;m++){for(x=0,S=o;S<=Math.min(w,a);S++)x=x+i.get(m,S)*r.get(S,w);i.set(m,w,x)}}}function Xm(n,e,t,i){let r,s;return Math.abs(t)>Math.abs(i)?(r=i/t,s=t+r*i,[(n+r*e)/s,(e-r*n)/s]):(r=t/i,s=i+r*t,[(r*n+e)/s,(r*e-n)/s])}class tO{constructor(e){if(e=Tr.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let t=e,i=t.rows,r=new Oe(i,i),s=!0,o,a,l;for(a=0;a0,r.set(a,a,Math.sqrt(Math.max(u,0))),l=a+1;l=0;l--)for(a=0;ao;g++)d=e.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),d=d.div(d.norm()),u=e.mmul(d).div(d.transpose().mmul(d).get(0,0)),g>0&&(l=u.clone().sub(p).pow(2).sum()),p=u.clone(),i?(f=i.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),f=f.div(f.norm()),a=i.mmul(f).div(f.transpose().mmul(f).get(0,0))):a=u;if(i){let g=e.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));g=g.div(g.norm());let v=e.clone().sub(u.clone().mmul(g.transpose())),x=a.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),_=i.clone().sub(u.clone().mulS(x.get(0,0)).mmul(f.transpose()));this.t=u,this.p=g.transpose(),this.w=d.transpose(),this.q=f,this.u=a,this.s=u.transpose().mmul(u),this.xResidual=v,this.yResidual=_,this.betas=x}else this.w=d.transpose(),this.s=u.transpose().mmul(u).sqrt(),r?this.t=u.clone().div(this.s.get(0,0)):this.t=u,this.xResidual=e.sub(u.mmul(d.transpose()))}}Nt.AbstractMatrix=xt;Nt.CHO=tO;Nt.CholeskyDecomposition=tO;Nt.DistanceMatrix=oy;Nt.EVD=eO;Nt.EigenvalueDecomposition=eO;Nt.LU=ay;Nt.LuDecomposition=ay;var iO=Nt.Matrix=Oe;Nt.MatrixColumnSelectionView=A$;Nt.MatrixColumnView=T$;Nt.MatrixFlipColumnView=C$;Nt.MatrixFlipRowView=R$;Nt.MatrixRowSelectionView=I$;Nt.MatrixRowView=P$;Nt.MatrixSelectionView=Ng;Nt.MatrixSubView=L$;Nt.MatrixTransposeView=N$;Nt.NIPALS=nO;Nt.Nipals=nO;Nt.QR=ME;Nt.QrDecomposition=ME;Nt.SVD=Vc;Nt.SingularValueDecomposition=Vc;Nt.SymmetricMatrix=wl;Nt.WrapperMatrix1D=JD;Nt.WrapperMatrix2D=Tr;Nt.correlation=V$;Nt.covariance=B$;var iP=Nt.default=Oe;Nt.determinant=Dg;var X$=Nt.inverse=O$;Nt.linearDependencies=U$;Nt.pseudoInverse=z$;Nt.solve=QD;Nt.wrap=D$;const qv=iO;iP.Matrix&&iP.Matrix;const $$=X$;function q$(n,e,t,i,r){const s=t.length,o=n.x.length;let a=new Array(s);for(let l=0;l0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s},oP=Ft&&Ft.__spread||function(){for(var n=[],e=0;e0&&s.set(o,f,d)}var p=Mn.transpose(s);return Mn.maximum(s,p)},n.prototype.transform=function(e){var t=this,i=this.X;if(i===void 0||i.length===0)throw new Error("No data has been fit.");var r=Math.floor(this.nNeighbors*this.transformQueueSize);r=Math.min(i.length,r);var s=$m.initializeSearch(this.rpForest,i,e,r,this.initFromRandom,this.initFromTree,this.random),o=this.search(i,this.searchGraph,s,e),a=tq.deheapSort(o),l=a.indices,u=a.weights;l=l.map(function(j){return j.slice(0,t.nNeighbors)}),u=u.map(function(j){return j.slice(0,t.nNeighbors)});var f=Math.max(0,this.localConnectivity-1),d=this.smoothKNNDistance(u,this.nNeighbors,f),p=d.sigmas,g=d.rhos,v=this.computeMembershipStrengths(l,u,p,g),x=v.rows,_=v.cols,m=v.vals,w=[e.length,i.length],S=new Mn.SparseMatrix(x,_,m,w),b=Mn.normalize(S,"l1"),R=Mn.getCSR(b),A=e.length,C=In.reshape2d(R.indices,A,this.nNeighbors),L=In.reshape2d(R.values,A,this.nNeighbors),I=lO(C,L,this.embedding),E=this.nEpochs?this.nEpochs/3:S.nRows<=1e4?100:30,N=S.getValues().reduce(function(j,Q){return Q>j?Q:j},0);S=S.map(function(j){return j0});if(v.length>=i){var x=Math.floor(i),_=i-x;x>0?(a[u]=v[x-1],_>lP&&(a[u]+=_*(v[x]-v[x-1]))):a[u]=_*v[0]}else v.length>0&&(a[u]=In.max(v));for(var m=0;m0?w+=Math.exp(-(b/p)):w+=1}if(Math.abs(w-o)o?(d=p,p=(f+d)/2):(f=p,d===1/0?p*=2:p=(f+d)/2)}if(l[u]=p,a[u]>0){var R=In.mean(g);l[u]0&&(i[a]=t/s[a])}),i},n.prototype.assignOptimizationStateParameters=function(e){Object.assign(this.optimizationState,e)},n.prototype.prepareForOptimizationLoop=function(){var e=this,t=e.repulsionStrength,i=e.learningRate,r=e.negativeSampleRate,s=this.optimizationState,o=s.epochsPerSample,a=s.headEmbedding,l=s.tailEmbedding,u=a[0].length,f=a.length===l.length,d=o.map(function(v){return v/r}),p=oP(d),g=oP(o);this.assignOptimizationStateParameters({epochOfNextSample:g,epochOfNextNegativeSample:p,epochsPerNegativeSample:d,moveOther:f,initialAlpha:i,alpha:i,gamma:t,dim:u})},n.prototype.initializeOptimization=function(){var e=this.embedding,t=this.embedding,i=this.optimizationState,r=i.head,s=i.tail,o=i.epochsPerSample,a=this.getNEpochs(),l=this.graph.nCols,u=sO(this.spread,this.minDist),f=u.a,d=u.b;this.assignOptimizationStateParameters({headEmbedding:e,tailEmbedding:t,head:r,tail:s,epochsPerSample:o,a:f,b:d,nEpochs:a,nVertices:l})},n.prototype.optimizeLayoutStep=function(e){for(var t=this.optimizationState,i=t.head,r=t.tail,s=t.headEmbedding,o=t.tailEmbedding,a=t.epochsPerSample,l=t.epochOfNextSample,u=t.epochOfNextNegativeSample,f=t.epochsPerNegativeSample,d=t.moveOther,p=t.initialAlpha,g=t.alpha,v=t.gamma,x=t.a,_=t.b,m=t.dim,w=t.nEpochs,S=t.nVertices,b=4,R=0;Re)){var A=i[R],C=r[R],L=s[A],I=o[C],E=cP(L,I),N=0;E>0&&(N=-2*x*_*Math.pow(E,_-1),N/=x*Math.pow(E,_)+1);for(var z=0;z0)W=2*v*_,W/=(.001+k)*(x*Math.pow(k,_)+1);else if(A===Q)continue;for(var z=0;z0&&(O=uP(W*(L[z]-oe[z]),b)),L[z]+=O*g}}u[R]+=q*f[R]}return t.alpha=p*(1-e/w),t.currentEpoch+=1,s},n.prototype.optimizeLayoutAsync=function(e){var t=this;return e===void 0&&(e=function(){return!0}),new Promise(function(i,r){var s=function(){return rP(t,void 0,void 0,function(){var o,a,l,u,f,d;return sP(this,function(p){try{if(o=this.optimizationState,a=o.nEpochs,l=o.currentEpoch,this.embedding=this.optimizeLayoutStep(l),u=this.optimizationState.currentEpoch,f=e(u)===!1,d=u===a,!f&&!d)setTimeout(function(){return s()},0);else return[2,i(d)]}catch(g){r(g)}return[2]})})};setTimeout(function(){return s()},0)})},n.prototype.optimizeLayout=function(e){e===void 0&&(e=function(){return!0});for(var t=!1,i=[];!t;){var r=this.optimizationState,s=r.nEpochs,o=r.currentEpoch;i=this.optimizeLayoutStep(o);var a=this.optimizationState.currentEpoch,l=e(a)===!1;t=a===s||l}return i},n.prototype.getNEpochs=function(){var e=this.graph;if(this.nEpochs>0)return this.nEpochs;var t=e.nRows;return t<=2500?500:t<=5e3?400:t<=7500?300:200},n}();Oo.UMAP=iq;function rO(n,e){for(var t=0,i=0;ie?e:n<-e?-e:n}function cP(n,e){for(var t=0,i=0;i=e;return v?Math.exp(-(i[g]-e)/n):p}),s=[.5,.5],o={x:i,y:r},a={damping:1.5,initialValues:s,gradientDifference:.1,maxIterations:100,errorTolerance:.01},l=nq.default(o,t,a).parameterValues,u=a1(l,2),f=u[0],d=u[1];return{a:f,b:d}}Oo.findABParams=sO;function oO(n,e,t,i){return t===void 0&&(t=1),i===void 0&&(i=5),n.map(function(r,s,o){return e[s]===-1||e[o]===-1?r*Math.exp(-t):e[s]!==e[o]?r*Math.exp(-i):r})}Oo.fastIntersection=oO;function aO(n){n=Mn.normalize(n,"max");var e=Mn.transpose(n),t=Mn.pairwiseMultiply(e,n);return n=Mn.add(n,Mn.subtract(e,t)),Mn.eliminateZeros(n)}Oo.resetLocalConnectivity=aO;function lO(n,e,t){for(var i=In.zeros(n.length).map(function(l){return In.zeros(t[0].length)}),r=0;rthis.calculateEmbedding(i)));return this.theUMAP=new aq({nNeighbors:1,nComponents:3,minDist:.5}),this.theUMAP.fit(t)}async calculateProjection(e){if(this.initOpenAi(),!this.theUMAP)return[0,0,0];const t=await this.calculateEmbedding(e);return this.theUMAP.transform([t])[0]}}const uq=()=>We.jsxs("div",{className:"ItemOpenAiKey",children:["OpenAI API key    ",We.jsx("input",{id:"llm-key",style:{width:"auto"},type:"password"})]});function cq(n,e){return Math.hypot(n[0]-e[0],n[1]-e[1],n[2]-e[2])}function hq(){let[n]=Y.useState(new lq);const[e,t]=Y.useState(-1),[i,r]=Y.useState([-1,-1,-1]),[s,o]=Y.useState([]),[a,l]=Y.useState([0,0,0]),u=async p=>{const g=await n.calculateProjection(p);l(g);let v=[];s.forEach(x=>{v.push({index:x.index,distance:cq(g,x.position)})}),v.sort((x,_)=>x.distance-_.distance),r(v.map(x=>x.index).slice(0,3))},f=p=>{d(p)},d=async p=>{r([-1,-1,-1]);const g=await n.initializeProjection(p.map(v=>v.label));p.map(v=>{v.position=g[v.index]}),o(p.slice())};return We.jsxs(We.Fragment,{children:[We.jsx(uq,{}),We.jsxs("div",{id:"main-div",children:[We.jsxs("div",{id:"left-pane",children:[We.jsx(x7,{conceptCategories:E7,concepts:s,setConcepts:f}),We.jsx(w7,{onChangeMyConcept:u})]}),We.jsx("div",{id:"right-pane",children:We.jsx(MW,{concepts:s,spherePos:a,onHoverConcept:t,onSelectConcept:t})})]}),!1,i[0]!=-1&&We.jsx(S7,{text:`1. ${s[i[0]].label} +2. ${s[i[1]].label} +3. ${s[i[2]].label}`})]})}Kx.createRoot(document.getElementById("root")).render(We.jsx(wP.StrictMode,{children:We.jsx(hq,{})})); diff --git a/index.html b/index.html index 9404293..19d1019 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Embedding Viewer - +